Browse Source

Try to clean up region dragging.

tags/non-daw-v1.1.0
Jonathan Moore Liles 17 years ago
parent
commit
c8bb330e8e
4 changed files with 16 additions and 13 deletions
  1. +1
    -1
      Timeline/Region.C
  2. +10
    -10
      Timeline/Sequence_Widget.C
  3. +2
    -2
      Timeline/Sequence_Widget.H
  4. +3
    -0
      Timeline/Timeline.C

+ 1
- 1
Timeline/Region.C View File

@@ -420,7 +420,7 @@ Region::handle ( int m )

if ( ! _drag )
{
begin_drag( Drag( x() - X, y() - Y ) );
begin_drag( Drag( x() - X, y() - Y, x_to_offset( X ) ) );
_log.hold();
}



+ 10
- 10
Timeline/Sequence_Widget.C View File

@@ -180,29 +180,29 @@ Sequence_Widget::handle ( int m )

return 1;
case FL_DRAG:
case FL_DND_DRAG:
{
if ( ! _drag )
{
begin_drag ( Drag( x() - X, y() - Y ) );
begin_drag ( Drag( x() - X, y() - Y, x_to_offset( X ) ) );
_log.hold();
}

fl_cursor( FL_CURSOR_MOVE );

const int ox = _drag->x;

redraw();

if ( timeline->ts_to_x( timeline->xoffset ) + ox + X > _track->x() )
{
int nx = (ox + X) - _track->x();
const nframes_t of = timeline->x_to_offset( X );

// _r->offset = timeline->x_to_ts( nx ) + timeline->xoffset;
offset( timeline->x_to_ts( nx ) + timeline->xoffset );
if ( of >= _drag->offset )
{
_r->offset = of - _drag->offset;

if ( Sequence_Widget::_current == this )
_track->snap( this );
if ( Sequence_Widget::_current == this )
_track->snap( this );
}
else
_r->offset = 0;
}

if ( X >= _track->x() + _track->w() ||


+ 2
- 2
Timeline/Sequence_Widget.H View File

@@ -35,9 +35,9 @@ struct Drag
int y;
int state;

Sequence_Widget *original;
nframes_t offset;

Drag( int X, int Y ) : x( X ), y( Y ) { state = 0; }
Drag( int X, int Y, nframes_t offset=0 ) : x( X ), y( Y ), offset( offset ) { state = 0; }
};

struct Range


+ 3
- 0
Timeline/Timeline.C View File

@@ -562,6 +562,9 @@ Timeline::resize ( int X, int Y, int W, int H )
void
Timeline::draw ( void )
{
if ( ! visible_r() )
return;

int X, Y, W, H;

int bdx = 0;


Loading…
Cancel
Save