Browse Source

Reinstitute drag scrolling.

tags/non-daw-v1.1.0
Jonathan Moore Liles 17 years ago
parent
commit
825d16c5b7
2 changed files with 54 additions and 53 deletions
  1. +2
    -28
      Region.C
  2. +52
    -25
      Region.H

+ 2
- 28
Region.C View File

@@ -240,23 +240,6 @@ Region::handle ( int m )
ret = Track_Widget::handle( m );
return ret | 1;

/* if ( X >= timeline.scroll->x() + timeline.scroll->w() || */
/* X <= timeline.scroll->x() ) */
/* { */
/* /\* this drag needs to scroll *\/ */

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

/* if ( X <= timeline.scroll->x() ) */
/* pos -= 100; */
/* else */
/* pos += 100; */

/* if ( pos < 0 ) */
/* pos = 0; */

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

// _offset = timeline.x_to_ts( x() );

@@ -309,8 +292,6 @@ Region::draw ( int X, int Y, int W, int H )

int rx = x();

// printf( "rx %d, rw %d\n", rx, rw );

fl_push_clip( rx, Y, rw, H );

/* dirty hack to keep the box from flipping to vertical at small sizes */
@@ -327,16 +308,9 @@ Region::draw ( int X, int Y, int W, int H )
fl_line( rx, Y, rx, Y + H );
fl_line( rx + rw - 1, Y, rx + rw - 1, Y + H );

fl_pop_clip();

fl_font( FL_HELVETICA, 14 );
fl_color( FL_BLACK );

draw_label( _clip->name(), (Fl_Align)(FL_ALIGN_LEFT | FL_ALIGN_BOTTOM | FL_ALIGN_CLIP | FL_ALIGN_INSIDE) );

/* fl_color( FL_RED ); */
/* fl_line( x(), y(), x(), y() + h() ); */
draw_label( _clip->name(), (Fl_Align)(FL_ALIGN_LEFT | FL_ALIGN_BOTTOM /*| FL_ALIGN_CLIP*/ | FL_ALIGN_INSIDE) );

fl_pop_clip();

}



+ 52
- 25
Region.H View File

@@ -168,10 +168,10 @@ public:

if ( align & FL_ALIGN_INSIDE )
{
X += Fl::box_dx( box() );
Y += Fl::box_dy( box() );
W -= Fl::box_dw( box() );
H -= Fl::box_dh( box() );
X += Fl::box_dx( box() );
Y += Fl::box_dy( box() );
W -= Fl::box_dw( box() );
H -= Fl::box_dh( box() );
}

if ( align & FL_ALIGN_CLIP ) fl_push_clip( X, Y, W, H );
@@ -223,6 +223,33 @@ public:
_track->redraw();
fl_cursor( FL_CURSOR_MOVE );


if ( X >= _track->x() + _track->w() ||
X <= _track->x() )
{
/* this drag needs to scroll */

nframes_t pos = timeline.xoffset;

nframes_t d = timeline.x_to_ts( 100 );

if ( X <= _track->x() )
{

if ( pos > d )
pos -= d;
else
pos = 0;
}
else
pos += d;

timeline.xoffset = pos;

timeline.tracks->redraw();
}


return 1;
}
default:
@@ -291,33 +318,33 @@ public:

};

class Region : public Track_Widget
{
class Region : public Track_Widget
{

Clip *_clip; /* clip this region represents */
Clip *_clip; /* clip this region represents */

float _scale; /* amplitude adjustment */
float _scale; /* amplitude adjustment */

static Fl_Boxtype _box;
static Fl_Color _selection_color;
static Fl_Color selection_color ( void ) { return _selection_color; }
static void selection_color ( Fl_Color v ) { _selection_color = v; }
static Fl_Boxtype _box;
static Fl_Color _selection_color;
static Fl_Color selection_color ( void ) { return _selection_color; }
static void selection_color ( Fl_Color v ) { _selection_color = v; }

enum trim_e { NO, LEFT, RIGHT };
void trim ( enum trim_e t, int X );
void init ( void );
enum trim_e { NO, LEFT, RIGHT };
void trim ( enum trim_e t, int X );
void init ( void );

public:
public:

Fl_Boxtype box ( void ) const { return Region::_box; }
Fl_Boxtype box ( void ) const { return Region::_box; }

Region ( const Region & rhs );
Region ( Clip *c );
Region ( const Region & rhs );
Region ( Clip *c );

int handle ( int m );
void draw_box( int X, int Y, int W, int H );
void draw ( int X, int Y, int W, int H );
void resize ( void );
int handle ( int m );
void draw_box( int X, int Y, int W, int H );
void draw ( int X, int Y, int W, int H );
void resize ( void );

void normalize ( void );
};
void normalize ( void );
};

Loading…
Cancel
Save