Browse Source

Use base class handle() in Region.

tags/non-daw-v1.1.0
Jonathan Moore Liles 17 years ago
parent
commit
9e23dd5878
2 changed files with 18 additions and 22 deletions
  1. +9
    -21
      Region.C
  2. +9
    -1
      Region.H

+ 9
- 21
Region.C View File

@@ -133,6 +133,9 @@ Region::handle ( int m )
int X = Fl::event_x(); int X = Fl::event_x();
int Y = Fl::event_y(); int Y = Fl::event_y();


int ret;


switch ( m ) switch ( m )
{ {
case FL_PUSH: case FL_PUSH:
@@ -168,13 +171,13 @@ Region::handle ( int m )
// Fl::local_grab( this ); // Fl::local_grab( this );
} }


ret = Track_Widget::handle( m );
return ret | 1;

/* if ( Fl::event_button() == 2 ) */ /* if ( Fl::event_button() == 2 ) */
/* normalize(); */ /* normalize(); */



return 1;
} }
return 0;
break; break;
} }
case FL_RELEASE: case FL_RELEASE:
@@ -223,21 +226,6 @@ Region::handle ( int m )
} }
} }


if ( ox + X >= _track->x() )
{
int nx = ox + X;

// nx = _track->snap( this, nx );

// _offset = timeline.x_to_ts( nx );

// position( nx, y() );

_offset = timeline.x_to_ts( nx ) + timeline.xoffset;

_track->snap( this );
}

if ( Y > y() + h() ) if ( Y > y() + h() )
{ {
if ( _track->next() ) if ( _track->next() )
@@ -252,7 +240,8 @@ Region::handle ( int m )


_track->redraw(); _track->redraw();


fl_cursor( FL_CURSOR_MOVE );
ret = Track_Widget::handle( m );
return ret | 1;


/* if ( X >= timeline.scroll->x() + timeline.scroll->w() || */ /* if ( X >= timeline.scroll->x() + timeline.scroll->w() || */
/* X <= timeline.scroll->x() ) */ /* X <= timeline.scroll->x() ) */
@@ -274,9 +263,8 @@ Region::handle ( int m )


// _offset = timeline.x_to_ts( x() ); // _offset = timeline.x_to_ts( x() );


return 1;
default: default:
return 0;
return Track_Widget::handle( m );
break; break;
} }
} }


+ 9
- 1
Region.H View File

@@ -140,6 +140,12 @@ public:
return 0; return 0;
} }
} }

bool
operator< ( const Track_Widget & rhs )
{
return _offset < rhs._offset;
}
}; };




@@ -183,7 +189,9 @@ public:
snprintf( pat, 40, "%.1f", _tempo ); snprintf( pat, 40, "%.1f", _tempo );


fl_font( FL_HELVETICA, 14 ); fl_font( FL_HELVETICA, 14 );
fl_color( FL_YELLOW );
fl_color( FL_BLACK );
fl_draw( pat, x() + w() + 1, Y + 1, w(), h(), FL_ALIGN_LEFT );
fl_color( FL_WHITE );
fl_draw( pat, x() + w(), Y, w(), h(), FL_ALIGN_LEFT ); fl_draw( pat, x() + w(), Y, w(), h(), FL_ALIGN_LEFT );


} }


Loading…
Cancel
Save