Browse Source

Clean up track widget event handling some.

tags/non-daw-v1.1.0
Jonathan Moore Liles 17 years ago
parent
commit
f58e156e3a
2 changed files with 18 additions and 23 deletions
  1. +14
    -13
      Region.C
  2. +4
    -10
      Track_Widget.C

+ 14
- 13
Region.C View File

@@ -236,8 +236,8 @@ Region::handle ( int m )
case FL_PUSH: case FL_PUSH:
{ {


if ( Fl::event_state() & FL_SHIFT &&
! ( Fl::event_state() & FL_CTRL ))
/* trimming / splitting */
if ( Fl::event_shift() && ! Fl::event_ctrl() )
{ {
switch ( Fl::event_button() ) switch ( Fl::event_button() )
{ {
@@ -283,10 +283,10 @@ Region::handle ( int m )
{ {
ox = x() - X; ox = x() - X;
oy = y() - Y; oy = y() - Y;
/* for panning */
os = _start;


if ( Fl::event_ctrl() )
os = _start;

/* normalization and selection */
if ( Fl::event_button2() ) if ( Fl::event_button2() )
{ {
if ( Fl::event_ctrl() ) if ( Fl::event_ctrl() )
@@ -305,6 +305,11 @@ Region::handle ( int m )
redraw(); redraw();
goto changed; goto changed;
} }
if ( Fl::event_button1() && Fl::event_ctrl() )
{
/* duplication */
return 1;
}
else else
return Track_Widget::handle( m ); return Track_Widget::handle( m );
} }
@@ -313,18 +318,11 @@ Region::handle ( int m )
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();
}

/* delete _drag; */
/* _drag = NULL; */


goto changed; goto changed;
} }
@@ -336,6 +334,7 @@ Region::handle ( int m )
_log.hold(); _log.hold();
} }


/* panning */
if ( Fl::event_state() & FL_SHIFT && if ( Fl::event_state() & FL_SHIFT &&
Fl::event_state() & FL_CTRL ) Fl::event_state() & FL_CTRL )
{ {
@@ -355,6 +354,7 @@ Region::handle ( int m )
return 1; return 1;
} }


/* trimming */
if ( Fl::event_state() & FL_SHIFT ) if ( Fl::event_state() & FL_SHIFT )
if ( trimming ) if ( trimming )
{ {
@@ -364,7 +364,7 @@ Region::handle ( int m )
else else
return 0; return 0;


/* duplication */
if ( Fl::event_state() & FL_CTRL ) if ( Fl::event_state() & FL_CTRL )
{ {
if ( _drag->state == 0 ) if ( _drag->state == 0 )
@@ -375,6 +375,7 @@ Region::handle ( int m )
} }
} }


/* track jumping */
if ( ! selected() ) if ( ! selected() )
{ {
if ( Y > y() + h() ) if ( Y > y() + h() )


+ 4
- 10
Track_Widget.C View File

@@ -143,6 +143,7 @@ Track_Widget::handle ( int m )
return 1; return 1;
case FL_PUSH: case FL_PUSH:
{ {
/* deletion */
if ( Fl::event_state() & FL_CTRL && if ( Fl::event_state() & FL_CTRL &&
Fl::event_button3() ) Fl::event_button3() )
{ {
@@ -165,6 +166,7 @@ Track_Widget::handle ( int m )
} }


fl_cursor( FL_CURSOR_HAND ); fl_cursor( FL_CURSOR_HAND );

return 1; return 1;
case FL_DRAG: case FL_DRAG:
{ {
@@ -175,11 +177,9 @@ Track_Widget::handle ( int m )
_log.hold(); _log.hold();
} }


const int ox = _drag->x;
// _current->_drag->x;
fl_cursor( FL_CURSOR_MOVE );


/* const int ox = _drag->x; */
/* const int oy = _drag->y; */
const int ox = _drag->x;


redraw(); redraw();


@@ -194,10 +194,6 @@ Track_Widget::handle ( int m )
_track->snap( this ); _track->snap( this );
} }


// _track->redraw();
fl_cursor( FL_CURSOR_MOVE );


if ( X >= _track->x() + _track->w() || if ( X >= _track->x() + _track->w() ||
X <= _track->x() ) X <= _track->x() )
{ {
@@ -220,10 +216,8 @@ Track_Widget::handle ( int m )


timeline->position( timeline->ts_to_x( pos ) ); timeline->position( timeline->ts_to_x( pos ) );
_track->redraw(); _track->redraw();
// timeline->redraw();
} }



return 1; return 1;
} }
default: default:


Loading…
Cancel
Save