Timeline: Clean up use of Fl_Panzoomer.
This commit is contained in:
parent
7c8eb777e5
commit
46d1c9c72a
2
lib/ntk
2
lib/ntk
|
@ -1 +1 @@
|
||||||
Subproject commit ff7f8bdc4dfcbf6c34f5165a97f9a4368f69f6c8
|
Subproject commit 9fdf8b4fd9d12d1cc88b283fe00079a2324f2055
|
|
@ -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 <Sequence_Widget *>::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
|
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;
|
track_window = o;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
Fl_Panzoomer *o = new Fl_Panzoomer( X,
|
Fl_Panzoomer *o = new Timeline_Panzoomer( X,
|
||||||
track_window->y() + track_window->h(),
|
track_window->y() + track_window->h(),
|
||||||
W,
|
W,
|
||||||
50 );
|
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->type( FL_HORIZONTAL );
|
||||||
o->callback( cb_scroll, this );
|
o->callback( cb_scroll, this );
|
||||||
|
|
||||||
o->draw_thumbnail_view_callback( &Timeline::draw_thumbnail_view, this );
|
|
||||||
|
|
||||||
//resizable(o);
|
//resizable(o);
|
||||||
panzoomer = o;
|
panzoomer = o;
|
||||||
}
|
}
|
||||||
|
@ -1132,59 +1188,6 @@ Timeline::add_cursor ( Cursor_Point *o )
|
||||||
punch_cursor_track->add( 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 <Sequence_Widget *>::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
|
void
|
||||||
Timeline::draw_cursors ( Cursor_Sequence *o ) const
|
Timeline::draw_cursors ( Cursor_Sequence *o ) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -95,10 +95,12 @@ class Timeline : public Fl_Single_Window, public RWLock
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
class Timeline_Panzoomer;
|
||||||
|
|
||||||
static void draw_clip ( void * v, int X, int Y, int W, int H );
|
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_xposition;
|
||||||
int _old_yposition;
|
int _old_yposition;
|
||||||
|
|
Loading…
Reference in New Issue