diff --git a/Audio_Track.C b/Audio_Track.C index 055ce22..322a54a 100644 --- a/Audio_Track.C +++ b/Audio_Track.C @@ -71,7 +71,7 @@ Audio_Track::handle ( int m ) if ( ! strcmp( text, "Region" ) ) - return 0; + return 1; char *file; diff --git a/Region.C b/Region.C index eb37a5a..144bfbe 100644 --- a/Region.C +++ b/Region.C @@ -85,7 +85,6 @@ Region::init ( void ) _end = 0; _scale = 1.0f; _clip = NULL; - _current = false; _box_color = FL_CYAN; _color = FL_BLUE; @@ -103,7 +102,6 @@ Region::Region ( const Region & rhs ) _scale = rhs._scale; _box_color = rhs._box_color; _color = rhs._color; - _current = false; log_create(); } @@ -224,12 +222,10 @@ Region::handle ( int m ) switch ( m ) { case FL_ENTER: - _current = true; Track_Widget::handle( m ); redraw(); break; case FL_LEAVE: - _current = false; Track_Widget::handle( m ); redraw(); break; @@ -476,7 +472,7 @@ Region::draw ( int X, int Y, int W, int H ) draw_label( _clip->name(), align() ); - if ( _current ) + if ( current() ) { char pat[40]; diff --git a/Region.H b/Region.H index 78c5146..485a1f7 100644 --- a/Region.H +++ b/Region.H @@ -47,8 +47,6 @@ class Region : public Track_Widget float _scale; /* amplitude adjustment */ - bool _current; /* region is receiving operations */ - static Fl_Boxtype _box; static Fl_Color _selection_color; static Fl_Color selection_color ( void ) { return _selection_color; } @@ -153,6 +151,8 @@ protected: init(); } + bool current ( void ) const { return this == Track::belowmouse(); } + public: /* for loggable */ diff --git a/Track.C b/Track.C index c8f3d02..9a99956 100644 --- a/Track.C +++ b/Track.C @@ -26,7 +26,8 @@ queue Track::_delete_queue; -Track_Widget *Track::pushed = NULL; +Track_Widget *Track::_pushed = NULL; +Track_Widget *Track::_belowmouse = NULL; void Track::sort ( void ) @@ -241,17 +242,14 @@ done: int Track::handle ( int m ) { -// static Track_Widget *pushed; - static Track_Widget *belowmouse; switch ( m ) { case FL_DND_ENTER: printf( "enter\n" ); - if ( pushed && pushed->track()->class_name() == class_name() ) + if ( pushed() && pushed()->track()->class_name() == class_name() ) { - printf( "%s -> %s\n", pushed->track()->class_name(), class_name() ); - add( pushed ); + add( pushed() ); redraw(); } case FL_DND_LEAVE: @@ -260,11 +258,11 @@ Track::handle ( int m ) { Track_Widget *r = event_widget(); - if ( r != belowmouse ) + if ( r != belowmouse() ) { - if ( belowmouse ) - belowmouse->handle( FL_LEAVE ); - belowmouse = r; + if ( belowmouse() ) + belowmouse()->handle( FL_LEAVE ); + _belowmouse = r; if ( r ) r->handle( FL_ENTER ); @@ -274,17 +272,17 @@ Track::handle ( int m ) } default: { - Track_Widget *r = pushed ? pushed : event_widget(); + Track_Widget *r = pushed() ? pushed() : event_widget(); if ( r ) { int retval = r->dispatch( m ); if ( retval && m == FL_PUSH ) - pushed = r; + _pushed = r; if ( retval && m == FL_RELEASE ) - pushed = NULL; + _pushed = NULL; Loggable::block_start(); @@ -295,12 +293,12 @@ Track::handle ( int m ) _delete_queue.pop(); - if ( pushed == t ) - pushed = NULL; - if ( belowmouse == t ) + if ( pushed() == t ) + _pushed = NULL; + if ( belowmouse() == t ) { - belowmouse->handle( FL_LEAVE ); - belowmouse = NULL; + belowmouse()->handle( FL_LEAVE ); + _belowmouse = NULL; } delete t; diff --git a/Track.H b/Track.H index 2fa6cdb..e479e13 100644 --- a/Track.H +++ b/Track.H @@ -42,7 +42,8 @@ class Track : public Fl_Group, public Loggable char *_name; static queue _delete_queue; - static Track_Widget *pushed; + static Track_Widget *_pushed; + static Track_Widget *_belowmouse; protected: @@ -101,6 +102,9 @@ public: log_destroy(); } + static Track_Widget *pushed ( void ) { return _pushed; }; + static Track_Widget *belowmouse ( void ) { return _belowmouse; }; + const char * name ( void ) const { return _name; } void name ( char *s ) { if ( _name ) free( _name ); _name = s; }