diff --git a/lib/ntk b/lib/ntk index ff7f8bd..9fdf8b4 160000 --- a/lib/ntk +++ b/lib/ntk @@ -1 +1 @@ -Subproject commit ff7f8bdc4dfcbf6c34f5165a97f9a4368f69f6c8 +Subproject commit 9fdf8b4fd9d12d1cc88b283fe00079a2324f2055 diff --git a/timeline/src/Timeline.C b/timeline/src/Timeline.C index 897c088..c12b4ca 100644 --- a/timeline/src/Timeline.C +++ b/timeline/src/Timeline.C @@ -142,6 +142,64 @@ draw_full_arrow_symbol ( Fl_Color color ) } + + +class Timeline::Timeline_Panzoomer : public Fl_Panzoomer +{ +public: + Timeline_Panzoomer ( int X,int Y,int W,int H, const char *L=0) + : Fl_Panzoomer(X,Y,W,H) + { + } +protected: + void + draw_background ( int X, int Y,int W, int H ) + { + nframes_t sf = 0; + nframes_t ef = timeline->length(); + + double ty = Y; + + for ( int i = 0; i < timeline->tracks->children(); i++ ) + { + Track *t = (Track*)timeline->tracks->child( i ); + + Sequence *s = t->sequence(); + + if ( !s ) + continue; + + fl_color( FL_BLACK ); + + const double scale = (double)H / ( pack_visible_height( timeline->tracks ) ); + +// double th = (double)H / timeline->tracks->children(); + const double th = t->h() * scale; + + fl_line( X, ty, + X + W, ty ); + + for ( list ::const_iterator r = s->_widgets.begin(); + r != s->_widgets.end(); ++r ) + { + fl_rectf( + X + ( W * ( (double)(*r)->start() / ef ) ), + ty, + W * ( (double)(*r)->length() / ef ), + th, + (*r)->actual_box_color()); + } + + fl_font( FL_HELVETICA, th ); + fl_color( FL_FOREGROUND_COLOR ); + fl_draw( t->name(), X, ty, W, th, (Fl_Align)(FL_ALIGN_LEFT | FL_ALIGN_INSIDE )); + + ty += th; + } + } +}; + + nframes_t @@ -681,7 +739,7 @@ Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : BASE( X, Y, W track_window = o; } { - Fl_Panzoomer *o = new Fl_Panzoomer( X, + Fl_Panzoomer *o = new Timeline_Panzoomer( X, track_window->y() + track_window->h(), W, 50 ); @@ -694,8 +752,6 @@ Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : BASE( X, Y, W o->type( FL_HORIZONTAL ); o->callback( cb_scroll, this ); - o->draw_thumbnail_view_callback( &Timeline::draw_thumbnail_view, this ); - //resizable(o); panzoomer = o; } @@ -1132,59 +1188,6 @@ Timeline::add_cursor ( Cursor_Point *o ) punch_cursor_track->add( o ); } -void -Timeline::draw_thumbnail_view ( int X, int Y, int W, int H, void *v ) -{ - ((Timeline*)v)->draw_thumbnail_view( X,Y,W,H ); -} - -void -Timeline::draw_thumbnail_view ( int X, int Y, int W, int H ) const -{ - nframes_t sf = 0; - nframes_t ef = timeline->length(); - - double ty = Y; - - for ( int i = 0; i < timeline->tracks->children(); i++ ) - { - Track *t = (Track*)timeline->tracks->child( i ); - - Sequence *s = t->sequence(); - - if ( !s ) - continue; - - fl_color( FL_BLACK ); - - const double scale = (double)H / ( pack_visible_height( tracks ) ); - -// double th = (double)H / timeline->tracks->children(); - const double th = t->h() * scale; - - fl_line( X, ty, - X + W, ty ); - - for ( list ::const_iterator r = s->_widgets.begin(); - r != s->_widgets.end(); ++r ) - { - fl_rectf( - X + ( W * ( (double)(*r)->start() / ef ) ), - ty, - W * ( (double)(*r)->length() / ef ), - th, - (*r)->actual_box_color()); - } - - fl_font( FL_HELVETICA, th ); - fl_color( FL_FOREGROUND_COLOR ); - fl_draw( t->name(), X, ty, W, th, (Fl_Align)(FL_ALIGN_LEFT | FL_ALIGN_INSIDE )); - - ty += th; - } -} - - void Timeline::draw_cursors ( Cursor_Sequence *o ) const { diff --git a/timeline/src/Timeline.H b/timeline/src/Timeline.H index 12bde14..de66322 100644 --- a/timeline/src/Timeline.H +++ b/timeline/src/Timeline.H @@ -95,10 +95,12 @@ class Timeline : public Fl_Single_Window, public RWLock #endif #endif + { + + class Timeline_Panzoomer; + static void draw_clip ( void * v, int X, int Y, int W, int H ); - static void draw_thumbnail_view( int X, int Y,int W, int H, void *v); - void draw_thumbnail_view( int X, int Y,int W, int H) const; int _old_xposition; int _old_yposition;