void MainFltkMenu::frameslider_cb(Fl_Widget *w, void *v) { Fl_Valuator *val = (Fl_Valuator *)w; MainFltkMenu *self = (MainFltkMenu *)v; // If the right mouse button is active, update frame only on release... //if (Fl::event_button() == FL_RIGHT_MOUSE) { XXX wrong way to do it if (Fl::event_state(FL_BUTTON3)) { if (!Fl::event_state()) { self->app->animation_set_frame((int)val->value()); } else { // but still update the value displayed in the current frame. char buf[10]; sprintf(buf, "%d", (int)val->value()); self->curframe->value(buf); } } else { self->app->animation_set_frame((int)val->value()); } }
static void joy_handler( int fd, void * UNUSED( user_arg ) ) { struct js_event e; int rc; rc = joydev_event( fd, &e, 0 ); if( rc < 0 ) { Fl::remove_fd( fd ); close( fd ); gui->joy_status->value( 0 ); return; } if( rc == 0 ) return; if(0) cout << ( e.type & JS_EVENT_AXIS ? "axis: " : e.type & JS_EVENT_BUTTON ? "button: " : "UNKNOWN" ) << int(e.number) << "=" << e.value << endl; const int num = e.number; const int value = e.value; if( e.type & JS_EVENT_AXIS ) { if(0) cout << "axis: " << num << "=" << value << endl; Fl_Group *g = gui->axes; if( num >= g->children() ) return; Fl_Valuator *a = (Fl_Valuator*) g->child( num ); a->value( value ); /* * This should have a config file of some sort. * Convert to the right hand rule. */ switch( num ) { case 0: joy_roll = value; break; case 1: joy_pitch = value; break; case 2: joy_yaw = value; break; case 3: joy_throttle = 16890 - value; break; default: /* Do nothing */ break; } return; } if( e.type & JS_EVENT_BUTTON ) { Fl_Group *g = gui->buttons; if( e.number >= g->children() ) return; Fl_Button *b = (Fl_Button*) g->child( e.number ); b->value( e.value ); joy_button[e.number] = e.value; return; } }