Work on vertical scrolling.
This commit is contained in:
parent
d18b06bb00
commit
668a568d42
1
Makefile
1
Makefile
|
@ -1,6 +1,5 @@
|
||||||
|
|
||||||
CXXFLAGS=-ggdb -Wall -O0
|
CXXFLAGS=-ggdb -Wall -O0
|
||||||
|
|
||||||
#LIBS=-L/usr/lib/sox -I/usr/include/sox -lsox -lsfx
|
#LIBS=-L/usr/lib/sox -I/usr/include/sox -lsox -lsfx
|
||||||
LIBS=-lsndfile `fltk-config --ldflags`
|
LIBS=-lsndfile `fltk-config --ldflags`
|
||||||
# CXXFLAGS=`fltk-config -cxxflags`
|
# CXXFLAGS=`fltk-config -cxxflags`
|
||||||
|
|
8
Region.C
8
Region.C
|
@ -294,10 +294,10 @@ Region::draw_box( int X, int Y, int W, int H )
|
||||||
fl_push_clip( x(), Y, w(), H );
|
fl_push_clip( x(), Y, w(), H );
|
||||||
|
|
||||||
if ( _selected )
|
if ( _selected )
|
||||||
fl_draw_box( fl_down( box() ), x() - 10, Y, w() + 50, H, _selection_color );
|
fl_draw_box( fl_down( box() ), x() - 10, y(), w() + 50, h(), _selection_color );
|
||||||
// fl_draw_box( fl_down( box() ), x() - 10, Y, w() + 50, H, fl_invert_color( _box_color ) );
|
// fl_draw_box( fl_down( box() ), x() - 10, Y, w() + 50, H, fl_invert_color( _box_color ) );
|
||||||
else
|
else
|
||||||
fl_draw_box( box(), x() - 10, Y, w() + 50, H, _box_color );
|
fl_draw_box( box(), x() - 10, y(), w() + 50, h(), _box_color );
|
||||||
|
|
||||||
fl_pop_clip();
|
fl_pop_clip();
|
||||||
}
|
}
|
||||||
|
@ -343,9 +343,9 @@ Region::draw ( int X, int Y, int W, int H )
|
||||||
|
|
||||||
// fl_push_clip( x() + Fl::box_dx( box() ), y(), w() - Fl::box_dw( box() ), h() );
|
// fl_push_clip( x() + Fl::box_dx( box() ), y(), w() - Fl::box_dw( box() ), h() );
|
||||||
|
|
||||||
int ch = H / _clip->channels();
|
int ch = h() / _clip->channels();
|
||||||
for ( int i = _clip->channels(); i--; )
|
for ( int i = _clip->channels(); i--; )
|
||||||
draw_waveform( rx, Y + (i * ch), rw, ch, _clip, i,
|
draw_waveform( rx, y() + (i * ch), rw, ch, _clip, i,
|
||||||
_start + offset, min( (_end - _start) - offset, _end),
|
_start + offset, min( (_end - _start) - offset, _end),
|
||||||
_scale, _selected ? _color : fl_invert_color( _color ) );
|
_scale, _selected ? _color : fl_invert_color( _color ) );
|
||||||
|
|
||||||
|
|
|
@ -41,13 +41,14 @@ public:
|
||||||
_zoom = 1.0f;
|
_zoom = 1.0f;
|
||||||
_zoom_min = 0;
|
_zoom_min = 0;
|
||||||
_zoom_max = 256;
|
_zoom_max = 256;
|
||||||
_zoom_changed = true;
|
_zoom_changed = false;
|
||||||
|
|
||||||
step( 1 );
|
step( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool zoom_changed ( void ) const { return _zoom_changed; }
|
bool zoom_changed ( void ) const { return _zoom_changed; }
|
||||||
double zoom ( void ) const { return _zoom; }
|
double zoom ( void ) const { return _zoom; }
|
||||||
|
void zoom ( double v ) { _zoom = v; }
|
||||||
double value ( void ) const { return Fl_Slider::value(); }
|
double value ( void ) const { return Fl_Slider::value(); }
|
||||||
void zoom_range ( double zmin, double zmax ) { _zoom_min = zmin; _zoom_max = zmax; }
|
void zoom_range ( double zmin, double zmax ) { _zoom_min = zmin; _zoom_max = zmax; }
|
||||||
|
|
||||||
|
@ -58,6 +59,9 @@ public:
|
||||||
{
|
{
|
||||||
case FL_MOUSEWHEEL:
|
case FL_MOUSEWHEEL:
|
||||||
{
|
{
|
||||||
|
if ( ! Fl::event_ctrl() )
|
||||||
|
return 0;
|
||||||
|
|
||||||
int d = Fl::event_dy();
|
int d = Fl::event_dy();
|
||||||
|
|
||||||
double z = _zoom;
|
double z = _zoom;
|
||||||
|
|
14
Timeline.C
14
Timeline.C
|
@ -25,6 +25,9 @@
|
||||||
|
|
||||||
Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Group( X, Y, W, H, L )
|
Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Group( X, Y, W, H, L )
|
||||||
{
|
{
|
||||||
|
|
||||||
|
xoffset = 0;
|
||||||
|
|
||||||
{
|
{
|
||||||
Fl_Pack *o = new Fl_Pack( 0, 0, 800, 600, "rulers" );
|
Fl_Pack *o = new Fl_Pack( 0, 0, 800, 600, "rulers" );
|
||||||
o->type( Fl_Pack::VERTICAL );
|
o->type( Fl_Pack::VERTICAL );
|
||||||
|
@ -62,7 +65,7 @@ Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Group( X,
|
||||||
|
|
||||||
{
|
{
|
||||||
Fl_Scroll *o = new Fl_Scroll( 0, 24 * 2, 800, 600 - (24 * 3) );
|
Fl_Scroll *o = new Fl_Scroll( 0, 24 * 2, 800, 600 - (24 * 3) );
|
||||||
o->type( Fl_Scroll::VERTICAL );
|
o->type( Fl_Scroll::VERTICAL_ALWAYS );
|
||||||
|
|
||||||
sample_rate = 44100;
|
sample_rate = 44100;
|
||||||
fpp = 256;
|
fpp = 256;
|
||||||
|
@ -74,8 +77,15 @@ Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Group( X,
|
||||||
o->type( Fl_Pack::VERTICAL );
|
o->type( Fl_Pack::VERTICAL );
|
||||||
o->spacing( 10 );
|
o->spacing( 10 );
|
||||||
|
|
||||||
|
Track *l = NULL;
|
||||||
|
for ( int i = 6; i--; )
|
||||||
{
|
{
|
||||||
|
|
||||||
Track *o = new Audio_Track( 0, 0, 800, 100 );
|
Track *o = new Audio_Track( 0, 0, 800, 100 );
|
||||||
|
o->prev( l );
|
||||||
|
if ( l )
|
||||||
|
l->next( o );
|
||||||
|
l = o;
|
||||||
o->end();
|
o->end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,6 +97,8 @@ Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Group( X,
|
||||||
o->end();
|
o->end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
redraw();
|
||||||
|
|
||||||
end();
|
end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
main.C
2
main.C
|
@ -66,6 +66,7 @@ cb_scroll ( Fl_Widget *w, void *v )
|
||||||
int maxx = timeline->ts_to_x( timeline->length );
|
int maxx = timeline->ts_to_x( timeline->length );
|
||||||
sb->range( 0, maxx );
|
sb->range( 0, maxx );
|
||||||
|
|
||||||
|
// timeline->redraw();
|
||||||
timeline->redraw();
|
timeline->redraw();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -124,6 +125,7 @@ main ( int argc, char **argv )
|
||||||
timeline->scrollbar = new Scalebar( 0, 600 - 24, 800, 24 );
|
timeline->scrollbar = new Scalebar( 0, 600 - 24, 800, 24 );
|
||||||
timeline->scrollbar->range( 0, 48000 * 2 );
|
timeline->scrollbar->range( 0, 48000 * 2 );
|
||||||
timeline->scrollbar->zoom_range( 2, 8192 );
|
timeline->scrollbar->zoom_range( 2, 8192 );
|
||||||
|
timeline->scrollbar->zoom( 256 );
|
||||||
timeline->scrollbar->type( 1 );
|
timeline->scrollbar->type( 1 );
|
||||||
timeline->scrollbar->callback( cb_scroll, 0 );
|
timeline->scrollbar->callback( cb_scroll, 0 );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue