Make snapping work again.
This commit is contained in:
parent
bcfa0cb029
commit
7501a8094b
2
Region.C
2
Region.C
|
@ -225,7 +225,7 @@ Region::handle ( int m )
|
||||||
|
|
||||||
_offset = timeline.x_to_ts( nx ) + timeline.xoffset;
|
_offset = timeline.x_to_ts( nx ) + timeline.xoffset;
|
||||||
|
|
||||||
// _track->snap( this );
|
_track->snap( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( Y > y() + h() )
|
if ( Y > y() + h() )
|
||||||
|
|
8
Region.H
8
Region.H
|
@ -49,10 +49,10 @@ public:
|
||||||
Region ( const Region & rhs );
|
Region ( const Region & rhs );
|
||||||
Region ( Clip *c );
|
Region ( Clip *c );
|
||||||
|
|
||||||
int y ( void ) { return _track->y(); }
|
int y ( void ) const { return _track->y(); }
|
||||||
int h ( void ) { return _track->h(); }
|
int h ( void ) const { return _track->h(); }
|
||||||
int x ( void ) { return _track->x() + timeline.ts_to_x( _offset - timeline.xoffset ); }
|
int x ( void ) const { return _track->x() + timeline.ts_to_x( _offset - timeline.xoffset ); }
|
||||||
int w ( void ) { return timeline.ts_to_x( _end - _start ); }
|
int w ( void ) const { return timeline.ts_to_x( _end - _start ); }
|
||||||
|
|
||||||
int handle ( int m );
|
int handle ( int m );
|
||||||
void draw ( int X, int Y, int W, int H );
|
void draw ( int X, int Y, int W, int H );
|
||||||
|
|
65
Track.C
65
Track.C
|
@ -76,51 +76,52 @@ Track::add ( Region *r )
|
||||||
// r->redraw();
|
// r->redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** snap /r/ to nearest edge */
|
/* snap /r/ to nearest edge */
|
||||||
/* void */
|
void
|
||||||
/* Track::snap ( Region *r ) */
|
Track::snap ( Region *r )
|
||||||
/* { */
|
{
|
||||||
/* const int snap_pixels = 10; */
|
const int snap_pixels = 10;
|
||||||
|
|
||||||
/* int rx1 = r->x(); */
|
int rx1 = r->x();
|
||||||
/* int rx2 = r->x() + r->w(); */
|
int rx2 = r->x() + r->w();
|
||||||
|
|
||||||
/* for ( int i = children(); i-- ; ) */
|
for ( list <Region*>::iterator i = _regions.begin(); i != _regions.end(); i++ )
|
||||||
/* { */
|
{
|
||||||
/* const Region *w = (Region*)child( i ); */
|
const Region *w = (*i);
|
||||||
|
|
||||||
/* if ( w == r ) */
|
if ( w == r )
|
||||||
/* continue; */
|
continue;
|
||||||
|
|
||||||
/* int wx1 = w->x(); */
|
int wx1 = w->x();
|
||||||
/* int wx2 = w->x() + w->w(); */
|
int wx2 = w->x() + w->w();
|
||||||
|
|
||||||
/* if ( abs( rx1 - wx2 ) < snap_pixels ) */
|
if ( abs( rx1 - wx2 ) < snap_pixels )
|
||||||
/* { */
|
{
|
||||||
/* r->offset( w->offset() + w->length() + 1 ); */
|
r->offset( w->offset() + w->length() + 1 );
|
||||||
|
|
||||||
/* printf( "snap: %lu | %lu\n", w->offset() + w->length(), r->offset() ); */
|
printf( "snap: %lu | %lu\n", w->offset() + w->length(), r->offset() );
|
||||||
|
|
||||||
/* goto done; */
|
goto done;
|
||||||
/* } */
|
}
|
||||||
|
|
||||||
/* if ( abs( rx2 - wx1 ) < snap_pixels ) */
|
if ( abs( rx2 - wx1 ) < snap_pixels )
|
||||||
/* { */
|
{
|
||||||
/* r->offset( ( w->offset() - r->length() ) - 1 ); */
|
r->offset( ( w->offset() - r->length() ) - 1 );
|
||||||
|
|
||||||
/* printf( "snap: %lu | %lu\n", r->offset() + r->length(), w->offset() ); */
|
printf( "snap: %lu | %lu\n", r->offset() + r->length(), w->offset() );
|
||||||
|
|
||||||
/* goto done; */
|
goto done;
|
||||||
/* } */
|
}
|
||||||
/* } */
|
}
|
||||||
|
|
||||||
/* r->offset( timeline.x_to_ts( r->x() ) ); */
|
// r->offset( timeline.x_to_ts( r->x() ) );
|
||||||
|
|
||||||
/* done: */
|
done:
|
||||||
|
|
||||||
/* r->resize(); */
|
return;
|
||||||
/* // r->position( rx1, y() ); */
|
// r->resize();
|
||||||
/* } */
|
// r->position( rx1, y() );
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
Track::handle ( int m )
|
Track::handle ( int m )
|
||||||
|
|
12
main.C
12
main.C
|
@ -65,6 +65,7 @@ cb_zoom ( Fl_Widget *w, void *v )
|
||||||
/* ((Region*)(track->child( j )))->resize(); */
|
/* ((Region*)(track->child( j )))->resize(); */
|
||||||
/* } */
|
/* } */
|
||||||
|
|
||||||
|
|
||||||
timeline.scroll->redraw();
|
timeline.scroll->redraw();
|
||||||
|
|
||||||
if ( timeline.fpp < FRAMES_PER_PEAK )
|
if ( timeline.fpp < FRAMES_PER_PEAK )
|
||||||
|
@ -84,11 +85,12 @@ cb_scroll ( Fl_Widget *w, void *v )
|
||||||
|
|
||||||
printf( "%lu\n", timeline.xoffset );
|
printf( "%lu\n", timeline.xoffset );
|
||||||
|
|
||||||
/* for ( int i = timeline.tracks->children(); i-- ; ) */
|
for ( int i = timeline.tracks->children(); i-- ; )
|
||||||
/* { */
|
{
|
||||||
/* Fl_Group *track = (Fl_Group*)timeline.tracks->child( i ); */
|
Fl_Group *track = (Fl_Group*)timeline.tracks->child( i );
|
||||||
/* track-> */
|
track->damage( FL_DAMAGE_SCROLL );
|
||||||
/* } */
|
}
|
||||||
|
|
||||||
/* /\* for ( int j = track->children(); j-- ; ) *\/ */
|
/* /\* for ( int j = track->children(); j-- ; ) *\/ */
|
||||||
/* /\* ((Region*)(track->child( j )))->resize(); *\/ */
|
/* /\* ((Region*)(track->child( j )))->resize(); *\/ */
|
||||||
/* /\* } *\/ */
|
/* /\* } *\/ */
|
||||||
|
|
Loading…
Reference in New Issue