From f58e156e3acb531ae8d3a4052cdaf3f7384dfe3a Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Thu, 6 Mar 2008 13:30:08 -0600 Subject: [PATCH] Clean up track widget event handling some. --- Region.C | 27 ++++++++++++++------------- Track_Widget.C | 14 ++++---------- 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/Region.C b/Region.C index eafe942..9153f5c 100644 --- a/Region.C +++ b/Region.C @@ -236,8 +236,8 @@ Region::handle ( int m ) case FL_PUSH: { - if ( Fl::event_state() & FL_SHIFT && - ! ( Fl::event_state() & FL_CTRL )) + /* trimming / splitting */ + if ( Fl::event_shift() && ! Fl::event_ctrl() ) { switch ( Fl::event_button() ) { @@ -283,10 +283,10 @@ Region::handle ( int m ) { ox = x() - X; oy = y() - Y; + /* for panning */ + os = _start; - if ( Fl::event_ctrl() ) - os = _start; - + /* normalization and selection */ if ( Fl::event_button2() ) { if ( Fl::event_ctrl() ) @@ -305,6 +305,11 @@ Region::handle ( int m ) redraw(); goto changed; } + if ( Fl::event_button1() && Fl::event_ctrl() ) + { + /* duplication */ + return 1; + } else return Track_Widget::handle( m ); } @@ -313,18 +318,11 @@ Region::handle ( int m ) case FL_RELEASE: { - Track_Widget::handle( m ); copied = false; if ( trimming != NO ) - { trimming = NO; -// _log.release(); - } - -/* delete _drag; */ -/* _drag = NULL; */ goto changed; } @@ -336,6 +334,7 @@ Region::handle ( int m ) _log.hold(); } + /* panning */ if ( Fl::event_state() & FL_SHIFT && Fl::event_state() & FL_CTRL ) { @@ -355,6 +354,7 @@ Region::handle ( int m ) return 1; } + /* trimming */ if ( Fl::event_state() & FL_SHIFT ) if ( trimming ) { @@ -364,7 +364,7 @@ Region::handle ( int m ) else return 0; - + /* duplication */ if ( Fl::event_state() & FL_CTRL ) { if ( _drag->state == 0 ) @@ -375,6 +375,7 @@ Region::handle ( int m ) } } + /* track jumping */ if ( ! selected() ) { if ( Y > y() + h() ) diff --git a/Track_Widget.C b/Track_Widget.C index 13af790..9c99995 100644 --- a/Track_Widget.C +++ b/Track_Widget.C @@ -143,6 +143,7 @@ Track_Widget::handle ( int m ) return 1; case FL_PUSH: { + /* deletion */ if ( Fl::event_state() & FL_CTRL && Fl::event_button3() ) { @@ -165,6 +166,7 @@ Track_Widget::handle ( int m ) } fl_cursor( FL_CURSOR_HAND ); + return 1; case FL_DRAG: { @@ -175,11 +177,9 @@ Track_Widget::handle ( int m ) _log.hold(); } - const int ox = _drag->x; -// _current->_drag->x; + fl_cursor( FL_CURSOR_MOVE ); -/* const int ox = _drag->x; */ -/* const int oy = _drag->y; */ + const int ox = _drag->x; redraw(); @@ -194,10 +194,6 @@ Track_Widget::handle ( int m ) _track->snap( this ); } - // _track->redraw(); - fl_cursor( FL_CURSOR_MOVE ); - - if ( X >= _track->x() + _track->w() || X <= _track->x() ) { @@ -220,10 +216,8 @@ Track_Widget::handle ( int m ) timeline->position( timeline->ts_to_x( pos ) ); _track->redraw(); -// timeline->redraw(); } - return 1; } default: