| @@ -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() ) | ||||
| @@ -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 h ( void ) { return _track->h(); } | |||||
| int x ( void ) { return _track->x() + timeline.ts_to_x( _offset - timeline.xoffset ); } | |||||
| int w ( void ) { return timeline.ts_to_x( _end - _start ); } | |||||
| int y ( void ) const { return _track->y(); } | |||||
| int h ( void ) const { return _track->h(); } | |||||
| int x ( void ) const { return _track->x() + timeline.ts_to_x( _offset - timeline.xoffset ); } | |||||
| 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 ); | ||||
| @@ -76,51 +76,52 @@ Track::add ( Region *r ) | |||||
| // r->redraw(); | // r->redraw(); | ||||
| } | } | ||||
| /** snap /r/ to nearest edge */ | |||||
| /* void */ | |||||
| /* Track::snap ( Region *r ) */ | |||||
| /* { */ | |||||
| /* const int snap_pixels = 10; */ | |||||
| /* snap /r/ to nearest edge */ | |||||
| void | |||||
| Track::snap ( Region *r ) | |||||
| { | |||||
| const int snap_pixels = 10; | |||||
| /* int rx1 = r->x(); */ | |||||
| /* int rx2 = r->x() + r->w(); */ | |||||
| int rx1 = r->x(); | |||||
| int rx2 = r->x() + r->w(); | |||||
| /* for ( int i = children(); i-- ; ) */ | |||||
| /* { */ | |||||
| /* const Region *w = (Region*)child( i ); */ | |||||
| for ( list <Region*>::iterator i = _regions.begin(); i != _regions.end(); i++ ) | |||||
| { | |||||
| const Region *w = (*i); | |||||
| /* if ( w == r ) */ | |||||
| /* continue; */ | |||||
| if ( w == r ) | |||||
| continue; | |||||
| /* int wx1 = w->x(); */ | |||||
| /* int wx2 = w->x() + w->w(); */ | |||||
| int wx1 = w->x(); | |||||
| int wx2 = w->x() + w->w(); | |||||
| /* if ( abs( rx1 - wx2 ) < snap_pixels ) */ | |||||
| /* { */ | |||||
| /* r->offset( w->offset() + w->length() + 1 ); */ | |||||
| if ( abs( rx1 - wx2 ) < snap_pixels ) | |||||
| { | |||||
| 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 ) */ | |||||
| /* { */ | |||||
| /* r->offset( ( w->offset() - r->length() ) - 1 ); */ | |||||
| if ( abs( rx2 - wx1 ) < snap_pixels ) | |||||
| { | |||||
| 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(); */ | |||||
| /* // r->position( rx1, y() ); */ | |||||
| /* } */ | |||||
| return; | |||||
| // r->resize(); | |||||
| // r->position( rx1, y() ); | |||||
| } | |||||
| int | int | ||||
| Track::handle ( int m ) | Track::handle ( int m ) | ||||
| @@ -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-- ; ) */ | |||||
| /* { */ | |||||
| /* Fl_Group *track = (Fl_Group*)timeline.tracks->child( i ); */ | |||||
| /* track-> */ | |||||
| /* } */ | |||||
| for ( int i = timeline.tracks->children(); i-- ; ) | |||||
| { | |||||
| Fl_Group *track = (Fl_Group*)timeline.tracks->child( i ); | |||||
| 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(); *\/ */ | ||||
| /* /\* } *\/ */ | /* /\* } *\/ */ | ||||