int Module::handle ( int m ) { switch ( m ) { case FL_KEYBOARD: { if ( Fl_Group::handle( m ) ) return 1; if ( Fl::event_key() == FL_Menu ) { menu_popup( &menu(), x(), y() ); return 1; } else return menu().test_shortcut() != 0; } case FL_PUSH: { take_focus(); if ( Fl_Group::handle( m ) ) return 1; else if ( test_press( FL_BUTTON3 ) ) { menu_popup( &menu() ); return 1; } else if ( test_press( FL_BUTTON1 ) ) { command_open_parameter_editor(); return 1; } else if ( test_press( FL_BUTTON3 | FL_CTRL ) ) { command_remove(); return 1; } else if ( test_press( FL_BUTTON2 ) ) { bypass( !bypass() ); redraw(); return 1; } return 0; } case FL_FOCUS: case FL_UNFOCUS: redraw(); return 1; } return Fl_Group::handle( m ); }
void Module::menu_cb ( const Fl_Menu_ *m ) { char picked[256]; if ( ! m->mvalue() || m->mvalue()->flags & FL_SUBMENU_POINTER || m->mvalue()->flags & FL_SUBMENU ) return; strncpy( picked, m->mvalue()->label(), sizeof( picked ) ); // m->item_pathname( picked, sizeof( picked ) ); DMESSAGE( "%s", picked ); Logger log( this ); if ( ! strcmp( picked, "Edit Parameters" ) ) command_open_parameter_editor(); else if ( ! strcmp( picked, "Bypass" ) ) { if ( ! bypassable() ) { fl_alert( "Due to its channel configuration, this module cannot be bypassed." ); } else { bypass( !bypass() ); redraw(); } } else if ( ! strcmp( picked, "Cut" ) ) { if ( copy() ) { chain()->remove( this ); Fl::delete_widget( this ); } } else if ( ! strcmp( picked, "Copy" ) ) { copy(); } else if ( ! strcmp( picked, "Paste" ) ) { paste_before(); } else if ( ! strcmp( picked, "Show Analysis" ) ) { show_analysis_window(); } else if ( ! strcmp( picked, "Remove" ) ) command_remove(); }
void Module::menu_cb ( const Fl_Menu_ *m ) { char picked[256]; if ( ! m->mvalue() || m->mvalue()->flags & FL_SUBMENU_POINTER || m->mvalue()->flags & FL_SUBMENU ) return; strncpy( picked, m->mvalue()->label(), sizeof( picked ) ); // m->item_pathname( picked, sizeof( picked ) ); DMESSAGE( "%s", picked ); Logger log( this ); if ( ! strcmp( picked, "Edit Parameters" ) ) command_open_parameter_editor(); else if ( ! strcmp( picked, "Bypass" ) ) bypass( ! ( m->mvalue()->flags & FL_MENU_VALUE ) ); else if ( ! strcmp( picked, "Cut" ) ) { copy(); chain()->remove( this ); Fl::delete_widget( this ); } else if ( ! strcmp( picked, "Copy" ) ) { copy(); } else if ( ! strcmp( picked, "Paste" ) ) { paste_before(); } else if ( ! strcmp( picked, "Remove" ) ) command_remove(); }
int Module::handle ( int m ) { static unsigned long _event_state = 0; unsigned long evstate = Fl::event_state(); switch ( m ) { case FL_ENTER: // Fl::focus(this); case FL_LEAVE: return 1; } if ( Fl_Group::handle( m ) ) return 1; switch ( m ) { case FL_KEYBOARD: { if ( Fl::event_key() == FL_Menu ) { menu_popup( &menu(), x(), y() ); return 1; } else return menu().test_shortcut() != 0; } case FL_PUSH: take_focus(); _event_state = evstate; return 1; // if ( Fl::visible_focus() && handle( FL_FOCUS )) Fl::focus(this); case FL_DRAG: _event_state = evstate; return 1; case FL_RELEASE: { unsigned long e = _event_state; _event_state = 0; if ( ! Fl::event_inside( this ) ) return 1; if ( ( e & FL_BUTTON1 ) && ( e & FL_CTRL ) ) { Fl::focus(this); return 1; } else if ( e & FL_BUTTON1 ) { command_open_parameter_editor(); return 1; } else if ( e & FL_BUTTON3 && e & FL_CTRL ) { command_remove(); return 1; } else if ( e & FL_BUTTON3 ) { menu_popup( &menu() ); return 1; } else if ( e & FL_BUTTON2 ) { if ( !bypassable() ) { fl_alert( "Due to its channel configuration, this module cannot be bypassed." ); } else { bypass( !bypass() ); redraw(); } return 1; } /* else */ /* { */ /* take_focus(); */ /* } */ return 0; } case FL_FOCUS: case FL_UNFOCUS: redraw(); return 1; } return 0; }