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