Contine working on integrating the track headers.

This commit is contained in:
Jonathan Moore Liles 2008-02-28 20:47:29 -06:00
parent ea7facb2fb
commit 2e8999c103
3 changed files with 40 additions and 18 deletions

View File

@ -68,6 +68,7 @@ cb_vscroll ( Fl_Widget *w, void *v )
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 )
{ {
box( FL_FLAT_BOX );
xoffset = 0; xoffset = 0;
{ {
@ -92,7 +93,7 @@ Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Group( X,
} }
{ {
Fl_Pack *o = new Fl_Pack( X + Track_Header::width(), Y, W - Track_Header::width() - vscroll->w(), H - hscroll->h(), "rulers" ); Fl_Pack *o = new Fl_Pack( X + Track_Header::width(), Y, (W - Track_Header::width()) - vscroll->w(), H - hscroll->h(), "rulers" );
o->type( Fl_Pack::VERTICAL ); o->type( Fl_Pack::VERTICAL );
{ {
@ -103,6 +104,8 @@ Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Group( X,
o->add( new Tempo_Point( 0, 120 ) ); o->add( new Tempo_Point( 0, 120 ) );
o->add( new Tempo_Point( 56000, 250 ) ); o->add( new Tempo_Point( 56000, 250 ) );
o->label( "Tempo" );
o->align( FL_ALIGN_LEFT );
tempo_track = o; tempo_track = o;
o->end(); o->end();
@ -117,6 +120,9 @@ Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Group( X,
o->add( new Time_Point( 0, 4, 4 ) ); o->add( new Time_Point( 0, 4, 4 ) );
o->add( new Time_Point( 345344, 6, 8 ) ); o->add( new Time_Point( 345344, 6, 8 ) );
o->label( "Time" );
o->align( FL_ALIGN_LEFT );
time_track = o; time_track = o;
o->end(); o->end();
@ -279,9 +285,21 @@ Timeline::draw_clip ( void * v, int X, int Y, int W, int H )
fl_color( rand() ); fl_color( rand() );
fl_rectf( X, Y, X + W, Y + H ); fl_rectf( X, Y, X + W, Y + H );
tl->draw_child( *tl->tracks );
tl->draw_child( *tl->rulers ); tl->draw_child( *tl->rulers );
/* headers */
fl_push_clip( tl->tracks->x(), tl->rulers->y() + tl->rulers->h(), Track_Header::width(), tl->h() - tl->rulers->h() - tl->hscroll->h() );
tl->draw_child( *tl->tracks );
fl_pop_clip();
/* track bodies */
fl_push_clip( tl->tracks->x() + Track_Header::width(), tl->rulers->y() + tl->rulers->h(), tl->tracks->w() - Track_Header::width(), tl->h() - tl->rulers->h() - tl->hscroll->h() );
tl->draw_child( *tl->tracks );
fl_pop_clip();
// tl->draw_child( *tl->tracks );
fl_pop_clip(); fl_pop_clip();
} }
@ -306,7 +324,7 @@ Timeline::draw ( void )
draw_box( box(), x(), y(), w(), h(), color() ); draw_box( box(), x(), y(), w(), h(), color() );
fl_push_clip( rulers->x(), rulers->y(), rulers->w(), rulers->h() ); fl_push_clip( x(), rulers->y(), w(), rulers->h() );
draw_child( *rulers ); draw_child( *rulers );
fl_pop_clip(); fl_pop_clip();
@ -326,11 +344,17 @@ Timeline::draw ( void )
/* if ( damage() & FL_DAMAGE_SCROLL ) */ /* if ( damage() & FL_DAMAGE_SCROLL ) */
/* fl_push_no_clip(); */ /* fl_push_no_clip(); */
fl_push_clip( rulers->x(), rulers->y(), rulers->w(), rulers->h() ); fl_push_clip( rulers->x(), rulers->y(), rulers->w() - vscroll->w(), rulers->h() );
update_child( *rulers ); update_child( *rulers );
fl_pop_clip(); fl_pop_clip();
fl_push_clip( tracks->x(), rulers->y() + rulers->h(), tracks->w(), h() - rulers->h() - hscroll->h() ); /* headers */
fl_push_clip( tracks->x(), rulers->y() + rulers->h(), Track_Header::width(), h() - rulers->h() - hscroll->h() );
update_child( *tracks );
fl_pop_clip();
/* track bodies */
fl_push_clip( tracks->x() + Track_Header::width(), rulers->y() + rulers->h(), tracks->w() - Track_Header::width(), h() - rulers->h() - hscroll->h() );
update_child( *tracks ); update_child( *tracks );
fl_pop_clip(); fl_pop_clip();
@ -349,7 +373,7 @@ Timeline::draw ( void )
int dy = _old_yposition - yposition; int dy = _old_yposition - yposition;
if ( ! dy ) if ( ! dy )
fl_scroll( X + Track_Header::width(), rulers->y(), rulers->w(), rulers->h(), dx, 0, draw_clip, this ); fl_scroll( X + Track_Header::width(), rulers->y(), rulers->w() - Fl::box_dw( rulers->child(0)->box() ), rulers->h(), dx, 0, draw_clip, this );
Y = rulers->y() + rulers->h(); Y = rulers->y() + rulers->h();
H = h() - rulers->h() - hscroll->h(); H = h() - rulers->h() - hscroll->h();
@ -363,8 +387,6 @@ Timeline::draw ( void )
_old_yposition = yposition; _old_yposition = yposition;
} }
} }

View File

@ -6,15 +6,15 @@ decl {\#include "Track.H"} {public
} }
widget_class Track_Header {open widget_class Track_Header {open
xywh {30 535 1156 116} type Double resizable visible xywh {383 446 1156 116} type Double box THIN_UP_BOX resizable visible
} { } {
Function {width()} {open return_type {static int} Function {width()} {open return_type {static int}
} { } {
code {return 150;} {} code {return 150;} {}
} }
decl {Track *_track;} {} decl {Track *_track;} {}
Fl_Group {} {open selected Fl_Group {} {open
xywh {2 2 149 113} box THIN_UP_FRAME xywh {2 2 149 113} color 53
code0 {o->size( Track_Header::width(), o->h() );} code0 {o->size( Track_Header::width(), o->h() );}
} { } {
Fl_Group {} {open Fl_Group {} {open
@ -25,24 +25,24 @@ widget_class Track_Header {open
} }
Fl_Button record_button { Fl_Button record_button {
label {@circle} label {@circle}
xywh {6 38 26 27} type Toggle box THIN_UP_FRAME color 32 labelsize 8 xywh {6 38 26 27} type Toggle box ROUNDED_BOX color 50 labelsize 8
} }
Fl_Button mute_button { Fl_Button mute_button {
label m label m
xywh {35 38 26 27} type Toggle box PLASTIC_UP_FRAME color 48 labelsize 11 xywh {35 38 26 27} type Toggle box ROUNDED_BOX color 50 labelsize 11
} }
Fl_Button solo_button { Fl_Button solo_button {
label s label s
xywh {66 38 26 27} type Toggle box PLASTIC_UP_FRAME color 48 labelsize 11 xywh {66 38 26 27} type Toggle box ROUNDED_BOX color 50 labelsize 11
} }
Fl_Menu_Button take_menu { Fl_Menu_Button take_menu {
label T open label T open
xywh {97 38 47 27} box THIN_UP_BOX xywh {97 38 47 27} box ROUNDED_BOX color 50 align 20
} {} } {}
} }
} }
Fl_Pack takes {open Fl_Pack takes {open selected
xywh {150 1 1006 114} resizable xywh {150 0 1006 115} labeltype NO_LABEL align 64 resizable
code0 {o->resize( x() + width(), y(), w() - width(), h() );} code0 {o->resize( x() + width(), y(), w() - width(), h() );}
} {} } {}
Function {track( Track *t )} {open return_type void Function {track( Track *t )} {open return_type void

View File

@ -67,7 +67,7 @@ public:
int y ( void ) const { return _track->y(); } int y ( void ) const { return _track->y(); }
int h ( void ) const { return _track->h(); } int h ( void ) const { return _track->h(); }
int x ( void ) const { return _offset < timeline->xoffset ? -1 : min( 32767, _track->x() + timeline->ts_to_x( _offset - timeline->xoffset ) ); } int x ( void ) const { return _offset < timeline->xoffset ? _track->x() - 1 : min( 32767, _track->x() + timeline->ts_to_x( _offset - timeline->xoffset ) ); }
virtual int w ( void ) const virtual int w ( void ) const
{ {
int tx = timeline->ts_to_x( _offset ); int tx = timeline->ts_to_x( _offset );