Work on selection operations more.

This commit is contained in:
Jonathan Moore Liles 2008-03-04 20:12:54 -06:00
parent 6a5417cd1a
commit 78afcbe019
3 changed files with 18 additions and 19 deletions

View File

@ -152,6 +152,7 @@ void
Region::trim ( enum trim_e t, int X ) Region::trim ( enum trim_e t, int X )
{ {
X -= _track->x();
redraw(); redraw();
switch ( t ) switch ( t )
@ -204,15 +205,14 @@ Region::trim ( enum trim_e t, int X )
int int
Region::handle ( int m ) Region::handle ( int m )
{ {
static bool dragging = false;
static int ox, oy; static int ox, oy;
static enum trim_e trimming; static enum trim_e trimming;
static bool copied = false; static bool copied = false;
static nframes_t os; static nframes_t os;
int X = Fl::event_x() - _track->x(); // int X = Fl::event_x() - _track->x();
int X = Fl::event_x();
int Y = Fl::event_y(); int Y = Fl::event_y();
int ret; int ret;
@ -232,10 +232,12 @@ Region::handle ( int m )
{ {
case 1: case 1:
trim( trimming = LEFT, X ); trim( trimming = LEFT, X );
_drag = new Drag( x() - X, y() - Y );
_log.hold(); _log.hold();
break; break;
case 3: case 3:
trim( trimming = RIGHT, X ); trim( trimming = RIGHT, X );
_drag = new Drag( x() - X, y() - Y );
_log.hold(); _log.hold();
break; break;
case 2: case 2:
@ -306,24 +308,29 @@ Region::handle ( int m )
break; break;
} }
case FL_RELEASE: case FL_RELEASE:
{
Track_Widget::handle( m ); Track_Widget::handle( m );
copied = false; copied = false;
if ( trimming != NO ) if ( trimming != NO )
{ {
trimming = NO; trimming = NO;
_log.release(); // _log.release();
} }
if ( dragging )
_log.release();
dragging = false; /* delete _drag; */
/* _drag = NULL; */
goto changed; goto changed;
}
case FL_DRAG: case FL_DRAG:
if ( ! dragging ) if ( ! _drag )
{ {
_drag = new Drag( x() - X, y() - Y );
_log.hold(); _log.hold();
dragging = true;
} }
if ( Fl::event_state() & FL_SHIFT && if ( Fl::event_state() & FL_SHIFT &&
@ -354,7 +361,6 @@ Region::handle ( int m )
else else
return 0; return 0;
ret = Track_Widget::handle( m );
if ( Fl::event_state() & FL_CTRL ) if ( Fl::event_state() & FL_CTRL )
{ {
@ -383,7 +389,7 @@ Region::handle ( int m )
} }
} }
// ret = Track_Widget::handle( m ); ret = Track_Widget::handle( m );
return ret | 1; return ret | 1;
default: default:
return Track_Widget::handle( m ); return Track_Widget::handle( m );

View File

@ -77,7 +77,7 @@ Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Overlay_Wi
{ {
Scalebar *o = new Scalebar( X, Y + H - 18, W - 18, 18 ); Scalebar *o = new Scalebar( X, Y + H - 18, W - 18, 18 );
o->range( 0, 48000 * 2 ); o->range( 0, 48000 * 300 );
o->zoom_range( 2, 8192 ); o->zoom_range( 2, 8192 );
o->zoom( 256 ); o->zoom( 256 );
o->type( FL_HORIZONTAL ); o->type( FL_HORIZONTAL );

7
main.C
View File

@ -54,14 +54,7 @@ Timeline *timeline;
void cb_undo ( Fl_Widget *w, void *v ) void cb_undo ( Fl_Widget *w, void *v )
{ {
/* static char pat[20]; */
Loggable::undo(); Loggable::undo();
/* sprintf( pat, "undo %d", Loggable::undo_index() ); */
/* w->label( pat ); */
} }
int int