diff --git a/mixer/src/Mixer.C b/mixer/src/Mixer.C index f9e4376..7dea3ec 100644 --- a/mixer/src/Mixer.C +++ b/mixer/src/Mixer.C @@ -616,6 +616,17 @@ void Mixer::remove ( Mixer_Strip *ms ) parent()->redraw(); } + +Mixer_Strip * +Mixer::event_inside ( void ) +{ + for ( int i = mixer_strips->children(); i--; ) + if ( Fl::event_inside( mixer_strips->child(i) ) ) + return (Mixer_Strip*)mixer_strips->child(i); + + return NULL; +} + bool Mixer::contains ( Mixer_Strip *ms ) { diff --git a/mixer/src/Mixer.H b/mixer/src/Mixer.H index 9fcb125..dedc2c4 100644 --- a/mixer/src/Mixer.H +++ b/mixer/src/Mixer.H @@ -91,6 +91,7 @@ public: void insert ( Mixer_Strip *ms, Mixer_Strip *before ); void insert ( Mixer_Strip *ms, int i ); bool contains ( Mixer_Strip *ms ); + Mixer_Strip * event_inside ( void ); bool save ( void ); void quit ( void ); diff --git a/mixer/src/Mixer_Strip.C b/mixer/src/Mixer_Strip.C index d083416..3b90ed2 100644 --- a/mixer/src/Mixer_Strip.C +++ b/mixer/src/Mixer_Strip.C @@ -232,10 +232,6 @@ void Mixer_Strip::cb_handle(Fl_Widget* o) { set_spatializer_visibility(); } - else if ( o == left_button ) - command_move_left(); - else if ( o == right_button ) - command_move_right(); else if ( o == close_button ) { if ( Fl::event_shift() || 1 == fl_choice( "Are you sure you want to remove this strip?\n\n(this action cannot be undone)", "Cancel", "Remove", NULL ) ) @@ -406,17 +402,9 @@ Mixer_Strip::init ( ) o->value( name() ); o->callback( cb_handle, (void*)this ); } - { Fl_Scalepack *o = new Fl_Scalepack( 7, 143, 110, 25 ); + { Fl_Scalepack *o = new Fl_Scalepack( 7, 143, 110, 18 ); o->type( Fl_Pack::HORIZONTAL ); - { Fl_Button* o = left_button = new Fl_Button(7, 143, 35, 25, "@<-"); - o->tooltip( "Move left" ); - o->type(0); - o->labelsize(10); - o->when( FL_WHEN_RELEASE ); - o->callback( ((Fl_Callback*)cb_handle), this ); - } // Fl_Button* o - - + { Fl_Flip_Button* o = width_button = new Fl_Flip_Button(61, 183, 45, 22, "[]/[-]"); o->type(1); o->tooltip( "Switch between wide and narrow views" ); @@ -436,14 +424,6 @@ Mixer_Strip::init ( ) o->callback( ((Fl_Callback*)cb_handle), this ); } // Fl_Button* o - { Fl_Button* o = right_button = new Fl_Button(7, 143, 35, 25, "@->"); - o->tooltip( "Move right" ); - o->type(0); - o->labelsize(10); - o->when( FL_WHEN_RELEASE ); - o->callback( ((Fl_Callback*)cb_handle), this ); - } // Fl_Button* o - o->end(); } // Fl_Group* o { Fl_Flip_Button* o = tab_button = new Fl_Flip_Button(61, 183, 45, 22, "fader/signal"); @@ -548,6 +528,7 @@ Mixer_Strip::draw ( void ) damage() & FL_DAMAGE_CHILD ) Fl_Group::draw(); + fl_color( Fl::focus() == this ? Fl_Group::selection_color() : FL_BLACK ); fl_rect( x(), y(), w(), h() ); } @@ -699,6 +680,8 @@ Mixer_Strip::handle ( int m ) static int _button = 0; Logger log( this ); + + static Fl_Widget *dragging = NULL; if ( Fl_Group::handle( m ) ) return 1; @@ -725,15 +708,35 @@ Mixer_Strip::handle ( int m ) menu_popup( &menu(), x(), y() ); return 1; } - else + else return menu().test_shortcut() != 0; break; } case FL_PUSH: + if ( Fl::event_button1() && Fl::event_inside( color_box ) ) + { + } + _button = Fl::event_button(); + + return 1; + + break; + + case FL_DRAG: + if ( Fl::event_is_click() ) + return 1; + + dragging = this; break; case FL_RELEASE: - { + if ( dragging == this ) + { + mixer->insert( this, mixer->event_inside() ); + dragging = NULL; + return 1; + } + int b = _button; _button = 0; @@ -748,7 +751,6 @@ Mixer_Strip::handle ( int m ) return 1; } break; - } } return 0; diff --git a/mixer/src/Mixer_Strip.H b/mixer/src/Mixer_Strip.H index ed96578..c040c4b 100644 --- a/mixer/src/Mixer_Strip.H +++ b/mixer/src/Mixer_Strip.H @@ -91,8 +91,6 @@ private: Fl_Flip_Button *width_button; Fl_Flip_Button *tab_button; Fl_Button *close_button; - Fl_Button *left_button; - Fl_Button *right_button; Fl_Input *name_field; Fl_Flowpack *controls_pack;