Timeline: Eliminate some unnecessary repeated drawing of measure lines.
This commit is contained in:
parent
ee5e4958d3
commit
1d59665702
|
@ -452,7 +452,7 @@ Audio_Region::draw_box( void )
|
|||
}
|
||||
|
||||
Fl_Boxtype b;
|
||||
Fl_Color c = color;
|
||||
Fl_Color c = selected() ? selection_color : color;
|
||||
|
||||
if ( Audio_Region::show_box )
|
||||
{
|
||||
|
@ -462,14 +462,8 @@ Audio_Region::draw_box( void )
|
|||
{
|
||||
b = FL_DOWN_FRAME;
|
||||
}
|
||||
|
||||
if ( selected() )
|
||||
fl_draw_box( fl_down( b ), x(), y(), w(), h(), selection_color );
|
||||
else
|
||||
fl_draw_box( b, x(), y(), w(), h(), c );
|
||||
|
||||
/* used to draw fades here */
|
||||
/* draw fades */
|
||||
fl_draw_box( b, x(), y(), w(), h(), c );
|
||||
|
||||
fl_pop_clip();
|
||||
}
|
||||
|
@ -633,16 +627,14 @@ Audio_Region::draw ( void )
|
|||
// DMESSAGE( "using cached peaks" );
|
||||
}
|
||||
|
||||
Fl_Color c = _color;
|
||||
Fl_Color c = Fl::get_color( _color );
|
||||
|
||||
|
||||
// c = fl_color_average( FL_BLACK, FL_RED, 0.20 );
|
||||
c = fl_color_add_alpha( c, 220 );
|
||||
|
||||
if ( peaks && pbuf )
|
||||
{
|
||||
int ch = (h() - Fl::box_dh( box() )) / channels;
|
||||
|
||||
|
||||
for ( int i = 0; i < channels; ++i )
|
||||
{
|
||||
Waveform::draw( X + xo,
|
||||
|
@ -664,8 +656,6 @@ Audio_Region::draw ( void )
|
|||
}
|
||||
while ( _loop && xo < W );
|
||||
|
||||
timeline->draw_measure_lines( X, Y, W, H );
|
||||
|
||||
if ( _loop && offset < _loop )
|
||||
{
|
||||
const int lx = timeline->ts_to_x( _loop - offset );
|
||||
|
@ -703,14 +693,7 @@ Audio_Region::draw ( void )
|
|||
/* fl_line( rx, Y, rx, Y + H ); */
|
||||
/* fl_line( rx + rw - 1, Y, rx + rw - 1, Y + H ); */
|
||||
|
||||
if ( _clip->dummy() )
|
||||
{
|
||||
char pat[256];
|
||||
snprintf( pat, sizeof( pat ), "Missing Source!: %s", _clip->name() );
|
||||
draw_label( pat, align() );
|
||||
}
|
||||
else
|
||||
draw_label( _clip->name(), align() );
|
||||
|
||||
|
||||
/* if ( current() ) */
|
||||
/* { */
|
||||
|
@ -727,6 +710,19 @@ Audio_Region::draw ( void )
|
|||
|
||||
}
|
||||
|
||||
void
|
||||
Audio_Region::draw_label ( void )
|
||||
{
|
||||
if ( _clip->dummy() )
|
||||
{
|
||||
char pat[256];
|
||||
snprintf( pat, sizeof( pat ), "Missing Source!: %s", _clip->name() );
|
||||
draw_label( pat, align() );
|
||||
}
|
||||
else
|
||||
draw_label( _clip->name(), align() );
|
||||
}
|
||||
|
||||
/** split region at absolute frame /where/ */
|
||||
void
|
||||
Audio_Region::split ( nframes_t where )
|
||||
|
|
|
@ -119,8 +119,14 @@ protected:
|
|||
virtual void get ( Log_Entry &e ) const;
|
||||
virtual void set ( Log_Entry &e );
|
||||
|
||||
void draw_label ( const char *label, Fl_Align align )
|
||||
{
|
||||
Sequence_Widget::draw_label( label, align );
|
||||
}
|
||||
|
||||
int handle ( int m );
|
||||
void draw_box( void );
|
||||
void draw_label ( void );
|
||||
void draw_box ( void );
|
||||
void draw ( void );
|
||||
void resize ( void );
|
||||
|
||||
|
@ -152,7 +158,7 @@ public:
|
|||
~Audio_Region ( );
|
||||
|
||||
Fl_Boxtype box ( void ) const { return Audio_Region::_box; }
|
||||
Fl_Align align ( void ) const { return (Fl_Align)(FL_ALIGN_LEFT | FL_ALIGN_BOTTOM /*| FL_ALIGN_CLIP*/ | FL_ALIGN_INSIDE); }
|
||||
Fl_Align align ( void ) const { return (Fl_Align)(FL_ALIGN_LEFT | FL_ALIGN_BOTTOM | FL_ALIGN_INSIDE | FL_ALIGN_CLIP ); }
|
||||
|
||||
void normalize ( void );
|
||||
void split ( nframes_t where );
|
||||
|
|
|
@ -164,7 +164,6 @@ Audio_Sequence::draw ( void )
|
|||
{
|
||||
if ( *o <= **r )
|
||||
{
|
||||
|
||||
/* if ( o->x() == (*r)->x() && o->w() == (*r)->w() ) */
|
||||
/* printf( "complete superposition\n" ); */
|
||||
|
||||
|
@ -189,8 +188,8 @@ Audio_Sequence::draw ( void )
|
|||
|
||||
fl_push_clip( b.x, b.y, b.w, b.h );
|
||||
|
||||
draw_box( FL_FLAT_BOX, b.x - 100, b.y, b.w + 200, b.h, c );
|
||||
draw_box( FL_UP_FRAME, b.x - 100, b.y, b.w + 200, b.h, c );
|
||||
Fl_Widget::draw_box( FL_FLAT_BOX, b.x - 100, b.y, b.w + 200, b.h, c );
|
||||
Fl_Widget::draw_box( FL_UP_FRAME, b.x - 100, b.y, b.w + 200, b.h, c );
|
||||
|
||||
fl_pop_clip();
|
||||
|
||||
|
|
|
@ -310,13 +310,13 @@ Control_Sequence::draw_curve ( bool flip, bool filled )
|
|||
void
|
||||
Control_Sequence::draw ( void )
|
||||
{
|
||||
if ( ! fl_not_clipped( x(), y(), w(), h() ) )
|
||||
return;
|
||||
// draw_box();
|
||||
|
||||
fl_push_clip( x(), y(), w(), h() );
|
||||
|
||||
|
||||
/* draw the box with the ends cut off. */
|
||||
draw_box( box(), x() - Fl::box_dx( box() ), y(), w() + Fl::box_dw( box() ) + 1, h(), color() );
|
||||
// draw_box( box(), x() - Fl::box_dx( box() ), y(), w() + Fl::box_dw( box() ) + 1, h(), color() );
|
||||
|
||||
const int bx = x();
|
||||
const int by = y() + Fl::box_dy( box() );
|
||||
|
@ -387,7 +387,7 @@ Control_Sequence::draw ( void )
|
|||
fl_line_style( FL_SOLID, 0 );
|
||||
}
|
||||
|
||||
// timeline->draw_measure_lines( x(), y(), w(), h(), color );
|
||||
timeline->draw_measure_lines( X, Y, W, H );
|
||||
|
||||
if ( interpolation() == None || _highlighted || Fl::focus() == this )
|
||||
for ( list <Sequence_Widget *>::const_iterator r = _widgets.begin(); r != _widgets.end(); r++ )
|
||||
|
|
|
@ -255,42 +255,37 @@ Sequence::snap ( Sequence_Widget *r )
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
Sequence::draw_box ( void )
|
||||
{
|
||||
/* draw the box with the ends cut off. */
|
||||
Fl_Widget::draw_box( box(), x() - Fl::box_dx( box() ) - 1, y(), w() + Fl::box_dw( box() ) + 2, h(), color() );
|
||||
}
|
||||
|
||||
void
|
||||
Sequence::draw ( void )
|
||||
{
|
||||
|
||||
if ( ! fl_not_clipped( x(), y(), w(), h() ) )
|
||||
return;
|
||||
|
||||
fl_push_clip( x(), y(), w(), h() );
|
||||
|
||||
/* draw the box with the ends cut off. */
|
||||
draw_box( box(), x() - Fl::box_dx( box() ) - 1, y(), w() + Fl::box_dw( box() ) + 2, h(), color() );
|
||||
draw_box();
|
||||
|
||||
for ( list <Sequence_Widget *>::const_iterator r = _widgets.begin(); r != _widgets.end(); ++r )
|
||||
(*r)->draw_box();
|
||||
|
||||
|
||||
for ( list <Sequence_Widget *>::const_iterator r = _widgets.begin(); r != _widgets.end(); ++r )
|
||||
(*r)->draw();
|
||||
|
||||
int X, Y, W, H;
|
||||
|
||||
fl_clip_box( x(), y(), w(), h(), X, Y, W, H );
|
||||
|
||||
/* if ( Sequence_Widget::pushed() && Sequence_Widget::pushed()->sequence() == this ) */
|
||||
/* { */
|
||||
/* /\* make sure the Sequence_Widget::pushed widget is above all others *\/ */
|
||||
/* remove( Sequence_Widget::pushed() ); */
|
||||
/* add( Sequence_Widget::pushed() ); */
|
||||
/* } */
|
||||
|
||||
// printf( "track::draw %d,%d %dx%d\n", X,Y,W,H );
|
||||
|
||||
timeline->draw_measure_lines( X, Y, W, H );
|
||||
|
||||
for ( list <Sequence_Widget *>::const_iterator r = _widgets.begin(); r != _widgets.end(); ++r )
|
||||
(*r)->draw_box();
|
||||
|
||||
|
||||
for ( list <Sequence_Widget *>::const_iterator r = _widgets.begin(); r != _widgets.end(); ++r )
|
||||
(*r)->draw();
|
||||
(*r)->draw_label();
|
||||
|
||||
fl_pop_clip();
|
||||
|
||||
}
|
||||
|
||||
#include "FL/test_press.H"
|
||||
|
|
|
@ -136,6 +136,7 @@ public:
|
|||
virtual void snap ( Sequence_Widget *r );
|
||||
virtual int handle ( int m );
|
||||
virtual void draw ( void );
|
||||
virtual void draw_box ( void );
|
||||
|
||||
virtual nframes_t process ( nframes_t ) { return 0; }
|
||||
|
||||
|
|
|
@ -247,7 +247,7 @@ Sequence_Region::handle ( int m )
|
|||
void
|
||||
Sequence_Region::draw_box ( void )
|
||||
{
|
||||
fl_draw_box( box(), line_x(), y(), abs_w(), h(), box_color() );
|
||||
fl_draw_box( box(), line_x(), y(), abs_w(), h(), fl_color_add_alpha( box_color(), 127 ) );
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -230,6 +230,11 @@ Sequence_Widget::start ( nframes_t where )
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
Sequence_Widget::draw_label ( void )
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Sequence_Widget::draw_label ( const char *label, Fl_Align align, Fl_Color color, int xo, int yo )
|
||||
{
|
||||
|
|
|
@ -281,6 +281,7 @@ public:
|
|||
|
||||
virtual void draw_box ( void );
|
||||
virtual void draw ( void );
|
||||
virtual void draw_label ( void );
|
||||
|
||||
bool
|
||||
operator< ( const Sequence_Widget & rhs ) const
|
||||
|
|
|
@ -839,8 +839,6 @@ Track::draw ( void )
|
|||
|
||||
fl_clip_box( x(), y(), w(), h(), X, Y, W, H );
|
||||
|
||||
timeline->draw_measure_lines( X, Y, W, H );
|
||||
|
||||
if ( _selected )
|
||||
{
|
||||
Fl_Color c = color();
|
||||
|
@ -854,7 +852,6 @@ Track::draw ( void )
|
|||
else
|
||||
Fl_Group::draw();
|
||||
|
||||
|
||||
fl_pop_clip();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue