Browse Source

Don't drag-scroll past beginning of track.

tags/non-daw-v1.1.0
Jonathan Moore Liles 17 years ago
parent
commit
76d2d70611
2 changed files with 14 additions and 8 deletions
  1. +11
    -5
      Region.C
  2. +3
    -3
      main.C

+ 11
- 5
Region.C View File

@@ -179,13 +179,19 @@ Region::handle ( int m )
if ( Fl::event_x() >= timeline.scroll->x() + timeline.scroll->w() || if ( Fl::event_x() >= timeline.scroll->x() + timeline.scroll->w() ||
Fl::event_x() <= timeline.scroll->x() ) Fl::event_x() <= timeline.scroll->x() )
{ {
int d;
/* this drag needs to scroll */

long pos = timeline.scroll->xposition();

if ( Fl::event_x() <= timeline.scroll->x() ) if ( Fl::event_x() <= timeline.scroll->x() )
d = -100;
pos -= 100;
else else
d = 100;
/* this drag needs to scroll */
timeline.scroll->position( timeline.scroll->xposition() + d, timeline.scroll->yposition() );
pos += 100;

if ( pos < 0 )
pos = 0;

timeline.scroll->position( pos, timeline.scroll->yposition() );
} }


return 1; return 1;


+ 3
- 3
main.C View File

@@ -110,9 +110,9 @@ main ( int argc, char **argv )


Region *wave2 = new Region( *wave ); Region *wave2 = new Region( *wave );


wave2->peaks( peaks );
wave2->start( 300 );
wave2->end( len );
/* wave2->peaks( peaks ); */
/* wave2->start( 300 ); */
/* wave2->end( len ); */


track2->add( wave2 ); track2->add( wave2 );




Loading…
Cancel
Save