From 33c646109f82930d06ebec7951ef480bb86d2fba Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Thu, 22 May 2008 17:02:39 -0500 Subject: [PATCH] Adapt other classes to the new handle_widget_change() method. --- Timeline/Audio_Region.C | 2 -- Timeline/Sequence.C | 6 ++++-- Timeline/Sequence_Widget.C | 2 ++ Timeline/Tempo_Point.C | 16 ++-------------- Timeline/Tempo_Sequence.C | 8 ++++++++ Timeline/Tempo_Sequence.H | 1 + Timeline/Time_Point.C | 18 ++---------------- Timeline/Time_Sequence.C | 8 ++++++++ Timeline/Time_Sequence.H | 1 + 9 files changed, 28 insertions(+), 34 deletions(-) diff --git a/Timeline/Audio_Region.C b/Timeline/Audio_Region.C index f8df6f1..c398799 100644 --- a/Timeline/Audio_Region.C +++ b/Timeline/Audio_Region.C @@ -359,8 +359,6 @@ Audio_Region::handle ( int m ) copied = false; - sequence()->handle_widget_change( _r->start, _r->length ); - return 1; } case FL_DRAG: diff --git a/Timeline/Sequence.C b/Timeline/Sequence.C index e621230..c902838 100644 --- a/Timeline/Sequence.C +++ b/Timeline/Sequence.C @@ -149,9 +149,9 @@ Sequence::draw ( void ) void Sequence::remove ( Sequence_Widget *r ) { -// Logger _log( this ); - _widgets.remove( r ); + + handle_widget_change( r->start(), r->length() ); } @@ -213,6 +213,8 @@ Sequence::add ( Sequence_Widget *r ) _widgets.push_back( r ); sort(); + + handle_widget_change( r->start(), r->length() ); } static nframes_t diff --git a/Timeline/Sequence_Widget.C b/Timeline/Sequence_Widget.C index 6a6ca40..b6d2fc8 100644 --- a/Timeline/Sequence_Widget.C +++ b/Timeline/Sequence_Widget.C @@ -313,6 +313,8 @@ Sequence_Widget::handle ( int m ) _log.release(); } + sequence()->handle_widget_change( _r->start, _r->length ); + fl_cursor( FL_CURSOR_HAND ); return 1; diff --git a/Timeline/Tempo_Point.C b/Timeline/Tempo_Point.C index 1628b06..c133d4a 100644 --- a/Timeline/Tempo_Point.C +++ b/Timeline/Tempo_Point.C @@ -52,8 +52,7 @@ Tempo_Point::set ( Log_Entry &e ) } - timeline->update_tempomap(); - timeline->redraw(); + sequence()->handle_widget_change( start(), length() ); _make_label(); } @@ -62,7 +61,6 @@ Tempo_Point::set ( Log_Entry &e ) Tempo_Point::Tempo_Point ( ) { timeline->tempo_track->add( this ); - timeline->update_tempomap(); } Tempo_Point::Tempo_Point ( nframes_t when, float bpm ) @@ -72,7 +70,6 @@ Tempo_Point::Tempo_Point ( nframes_t when, float bpm ) _make_label(); timeline->tempo_track->add( this ); - timeline->update_tempomap(); start( when ); @@ -84,7 +81,6 @@ Tempo_Point::Tempo_Point ( nframes_t when, float bpm ) Tempo_Point::~Tempo_Point ( ) { timeline->tempo_track->remove( this ); - timeline->update_tempomap(); log_destroy(); } @@ -101,15 +97,7 @@ Tempo_Point::handle ( int m ) return 0; } - int r = Sequence_Widget::handle( m ); - - if ( m == FL_RELEASE ) - { - sequence()->sort(); - timeline->update_tempomap(); - timeline->redraw(); - } - return r; + return Sequence_Point::handle( m ); } diff --git a/Timeline/Tempo_Sequence.C b/Timeline/Tempo_Sequence.C index e920505..ecacd8c 100644 --- a/Timeline/Tempo_Sequence.C +++ b/Timeline/Tempo_Sequence.C @@ -19,6 +19,14 @@ #include "Tempo_Sequence.H" +void +Tempo_Sequence::handle_widget_change ( nframes_t, nframes_t ) +{ + sort(); + timeline->update_tempomap(); + timeline->redraw(); +} + int Tempo_Sequence::handle ( int m ) { diff --git a/Timeline/Tempo_Sequence.H b/Timeline/Tempo_Sequence.H index 9a32c1a..d74b9d3 100644 --- a/Timeline/Tempo_Sequence.H +++ b/Timeline/Tempo_Sequence.H @@ -40,6 +40,7 @@ public: // box( FL_DOWN_BOX ); } + void handle_widget_change ( nframes_t start, nframes_t length ); int handle ( int m ); }; diff --git a/Timeline/Time_Point.C b/Timeline/Time_Point.C index 471c486..edc12b4 100644 --- a/Timeline/Time_Point.C +++ b/Timeline/Time_Point.C @@ -54,8 +54,7 @@ Time_Point::set ( Log_Entry &e ) } - timeline->update_tempomap(); - timeline->redraw(); + sequence()->handle_widget_change( start(), length() ); _make_label(); } @@ -64,7 +63,6 @@ Time_Point::set ( Log_Entry &e ) Time_Point::Time_Point ( ) : _time( 4, 4 ) { timeline->time_track->add( this ); - timeline->update_tempomap(); } Time_Point::Time_Point ( nframes_t when, int bpb, int note ) : _time( bpb, note ) @@ -72,7 +70,6 @@ Time_Point::Time_Point ( nframes_t when, int bpb, int note ) : _time( bpb, note _make_label(); timeline->time_track->add( this ); - timeline->update_tempomap(); start( when ); @@ -83,7 +80,6 @@ Time_Point::Time_Point ( const Time_Point &rhs ) : Sequence_Point( rhs ) { _time = rhs._time; - timeline->update_tempomap(); log_create(); } @@ -91,7 +87,6 @@ Time_Point::Time_Point ( const Time_Point &rhs ) : Sequence_Point( rhs ) Time_Point::~Time_Point ( ) { timeline->time_track->remove( this ); - timeline->update_tempomap(); log_destroy(); } @@ -114,16 +109,7 @@ Time_Point::handle ( int m ) } - int r = Sequence_Widget::handle( m ); - - if ( m == FL_RELEASE ) - { - sequence()->sort(); - timeline->update_tempomap(); - timeline->redraw(); - } - return r; - + return Sequence_Point::handle( m ); } diff --git a/Timeline/Time_Sequence.C b/Timeline/Time_Sequence.C index 75088a1..712b473 100644 --- a/Timeline/Time_Sequence.C +++ b/Timeline/Time_Sequence.C @@ -19,6 +19,14 @@ #include "Time_Sequence.H" +void +Time_Sequence::handle_widget_change ( nframes_t, nframes_t ) +{ + sort(); + timeline->update_tempomap(); + timeline->redraw(); +} + int Time_Sequence::handle ( int m ) { diff --git a/Timeline/Time_Sequence.H b/Timeline/Time_Sequence.H index ceec6d1..9686455 100644 --- a/Timeline/Time_Sequence.H +++ b/Timeline/Time_Sequence.H @@ -63,5 +63,6 @@ public: add( new Time_Point( when, bpb, note ) ); } + void handle_widget_change ( nframes_t start, nframes_t length ); int handle ( int m ); };