diff --git a/Region.C b/Region.C index 3aae149..22387a9 100644 --- a/Region.C +++ b/Region.C @@ -51,6 +51,10 @@ Region::init ( void ) _end = 0; _scale = 1.0f; _clip = NULL; + + + _box_color = FL_CYAN; + _color = FL_BLUE; } Region::Region ( const Region & rhs ) @@ -296,14 +300,20 @@ Region::draw ( int X, int Y, int W, int H ) int rx = timeline.ts_to_x( _offset ) - X; int rw = min( timeline.ts_to_x( _end - _start ), W ); - fl_draw_box( FL_PLASTIC_UP_BOX, rx, Y, rw, H, FL_CYAN ); + fl_push_clip( rx, Y, rw, H ); + + /* dirty hack to keep the box from flipping to vertical at small sizes */ + fl_draw_box( FL_PLASTIC_UP_BOX, rx - 10, Y, rw + 50, H, _box_color ); // fl_push_clip( x() + Fl::box_dx( box() ), y(), w() - Fl::box_dw( box() ), h() ); - draw_waveform( rx, Y, rw, H, _clip, _start, _end, _scale, FL_GREEN ); + draw_waveform( rx, Y, rw, H, _clip, _start, _end, _scale, _color ); -// fl_pop_clip(); + fl_color( FL_BLACK ); + 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 ); diff --git a/Region.H b/Region.H index 2da8e54..4a424fe 100644 --- a/Region.H +++ b/Region.H @@ -27,6 +27,11 @@ #include "Track.H" #include "Timeline.H" + +/* Regions are "virtual" FLTK widgets; this is necessary because the + * dimensions of real FLTK widgets are limited to 16-bits, which is + * far too little for our purposes */ + class Region { @@ -40,6 +45,16 @@ class Region float _scale; /* amplitude adjustment */ + bool _selected; + + Fl_Color _color; /* color of waveform */ + Fl_Color _box_color; /* color of background (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 ); @@ -54,6 +69,11 @@ public: 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 ); } + Fl_Group * parent ( void ) const { return _track; } + + Fl_Color color ( void ) { return _color; } + Fl_Color box_color ( void ) { return _box_color; } + int handle ( int m ); void draw ( int X, int Y, int W, int H ); void resize ( void ); diff --git a/Track.C b/Track.C index 7e690da..6355f9a 100644 --- a/Track.C +++ b/Track.C @@ -22,14 +22,21 @@ #include "Region.H" +#include + void Track::draw ( void ) { Fl_Group::draw(); + + fl_push_clip( x(), y(), w(), h() ); + for ( list ::iterator r = _regions.begin(); r != _regions.end(); r++ ) { (*r)->draw( timeline.xoffset + x(), y(), w(), h() ); } + + fl_pop_clip(); } void