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_Boxtype b;
|
||||||
Fl_Color c = color;
|
Fl_Color c = selected() ? selection_color : color;
|
||||||
|
|
||||||
if ( Audio_Region::show_box )
|
if ( Audio_Region::show_box )
|
||||||
{
|
{
|
||||||
|
@ -463,13 +463,7 @@ Audio_Region::draw_box( void )
|
||||||
b = FL_DOWN_FRAME;
|
b = FL_DOWN_FRAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( selected() )
|
fl_draw_box( b, x(), y(), w(), h(), c );
|
||||||
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_pop_clip();
|
fl_pop_clip();
|
||||||
}
|
}
|
||||||
|
@ -633,16 +627,14 @@ Audio_Region::draw ( void )
|
||||||
// DMESSAGE( "using cached peaks" );
|
// DMESSAGE( "using cached peaks" );
|
||||||
}
|
}
|
||||||
|
|
||||||
Fl_Color c = _color;
|
Fl_Color c = Fl::get_color( _color );
|
||||||
|
|
||||||
|
c = fl_color_add_alpha( c, 220 );
|
||||||
// c = fl_color_average( FL_BLACK, FL_RED, 0.20 );
|
|
||||||
|
|
||||||
if ( peaks && pbuf )
|
if ( peaks && pbuf )
|
||||||
{
|
{
|
||||||
int ch = (h() - Fl::box_dh( box() )) / channels;
|
int ch = (h() - Fl::box_dh( box() )) / channels;
|
||||||
|
|
||||||
|
|
||||||
for ( int i = 0; i < channels; ++i )
|
for ( int i = 0; i < channels; ++i )
|
||||||
{
|
{
|
||||||
Waveform::draw( X + xo,
|
Waveform::draw( X + xo,
|
||||||
|
@ -664,8 +656,6 @@ Audio_Region::draw ( void )
|
||||||
}
|
}
|
||||||
while ( _loop && xo < W );
|
while ( _loop && xo < W );
|
||||||
|
|
||||||
timeline->draw_measure_lines( X, Y, W, H );
|
|
||||||
|
|
||||||
if ( _loop && offset < _loop )
|
if ( _loop && offset < _loop )
|
||||||
{
|
{
|
||||||
const int lx = timeline->ts_to_x( _loop - offset );
|
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, Y, rx, Y + H ); */
|
||||||
/* fl_line( rx + rw - 1, Y, rx + rw - 1, 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() ) */
|
/* 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/ */
|
/** split region at absolute frame /where/ */
|
||||||
void
|
void
|
||||||
Audio_Region::split ( nframes_t where )
|
Audio_Region::split ( nframes_t where )
|
||||||
|
|
|
@ -119,8 +119,14 @@ protected:
|
||||||
virtual void get ( Log_Entry &e ) const;
|
virtual void get ( Log_Entry &e ) const;
|
||||||
virtual void set ( Log_Entry &e );
|
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 );
|
int handle ( int m );
|
||||||
void draw_box( void );
|
void draw_label ( void );
|
||||||
|
void draw_box ( void );
|
||||||
void draw ( void );
|
void draw ( void );
|
||||||
void resize ( void );
|
void resize ( void );
|
||||||
|
|
||||||
|
@ -152,7 +158,7 @@ public:
|
||||||
~Audio_Region ( );
|
~Audio_Region ( );
|
||||||
|
|
||||||
Fl_Boxtype box ( void ) const { return Audio_Region::_box; }
|
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 normalize ( void );
|
||||||
void split ( nframes_t where );
|
void split ( nframes_t where );
|
||||||
|
|
|
@ -164,7 +164,6 @@ Audio_Sequence::draw ( void )
|
||||||
{
|
{
|
||||||
if ( *o <= **r )
|
if ( *o <= **r )
|
||||||
{
|
{
|
||||||
|
|
||||||
/* if ( o->x() == (*r)->x() && o->w() == (*r)->w() ) */
|
/* if ( o->x() == (*r)->x() && o->w() == (*r)->w() ) */
|
||||||
/* printf( "complete superposition\n" ); */
|
/* printf( "complete superposition\n" ); */
|
||||||
|
|
||||||
|
@ -189,8 +188,8 @@ Audio_Sequence::draw ( void )
|
||||||
|
|
||||||
fl_push_clip( b.x, b.y, b.w, b.h );
|
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 );
|
Fl_Widget::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_UP_FRAME, b.x - 100, b.y, b.w + 200, b.h, c );
|
||||||
|
|
||||||
fl_pop_clip();
|
fl_pop_clip();
|
||||||
|
|
||||||
|
|
|
@ -310,13 +310,13 @@ Control_Sequence::draw_curve ( bool flip, bool filled )
|
||||||
void
|
void
|
||||||
Control_Sequence::draw ( void )
|
Control_Sequence::draw ( void )
|
||||||
{
|
{
|
||||||
if ( ! fl_not_clipped( x(), y(), w(), h() ) )
|
// draw_box();
|
||||||
return;
|
|
||||||
|
|
||||||
fl_push_clip( x(), y(), w(), h() );
|
fl_push_clip( x(), y(), w(), h() );
|
||||||
|
|
||||||
|
|
||||||
/* draw the box with the ends cut off. */
|
/* 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 bx = x();
|
||||||
const int by = y() + Fl::box_dy( box() );
|
const int by = y() + Fl::box_dy( box() );
|
||||||
|
@ -387,7 +387,7 @@ Control_Sequence::draw ( void )
|
||||||
fl_line_style( FL_SOLID, 0 );
|
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 )
|
if ( interpolation() == None || _highlighted || Fl::focus() == this )
|
||||||
for ( list <Sequence_Widget *>::const_iterator r = _widgets.begin(); r != _widgets.end(); r++ )
|
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
|
void
|
||||||
Sequence::draw ( void )
|
Sequence::draw ( void )
|
||||||
{
|
{
|
||||||
|
|
||||||
if ( ! fl_not_clipped( x(), y(), w(), h() ) )
|
|
||||||
return;
|
|
||||||
|
|
||||||
fl_push_clip( x(), y(), w(), h() );
|
fl_push_clip( x(), y(), w(), h() );
|
||||||
|
|
||||||
/* draw the box with the ends cut off. */
|
draw_box();
|
||||||
draw_box( box(), x() - Fl::box_dx( box() ) - 1, y(), w() + Fl::box_dw( box() ) + 2, h(), color() );
|
|
||||||
|
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;
|
int X, Y, W, H;
|
||||||
|
|
||||||
fl_clip_box( x(), y(), w(), h(), 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 );
|
timeline->draw_measure_lines( X, Y, W, H );
|
||||||
|
|
||||||
for ( list <Sequence_Widget *>::const_iterator r = _widgets.begin(); r != _widgets.end(); ++r )
|
for ( list <Sequence_Widget *>::const_iterator r = _widgets.begin(); r != _widgets.end(); ++r )
|
||||||
(*r)->draw_box();
|
(*r)->draw_label();
|
||||||
|
|
||||||
|
|
||||||
for ( list <Sequence_Widget *>::const_iterator r = _widgets.begin(); r != _widgets.end(); ++r )
|
|
||||||
(*r)->draw();
|
|
||||||
|
|
||||||
fl_pop_clip();
|
fl_pop_clip();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "FL/test_press.H"
|
#include "FL/test_press.H"
|
||||||
|
|
|
@ -136,6 +136,7 @@ public:
|
||||||
virtual void snap ( Sequence_Widget *r );
|
virtual void snap ( Sequence_Widget *r );
|
||||||
virtual int handle ( int m );
|
virtual int handle ( int m );
|
||||||
virtual void draw ( void );
|
virtual void draw ( void );
|
||||||
|
virtual void draw_box ( void );
|
||||||
|
|
||||||
virtual nframes_t process ( nframes_t ) { return 0; }
|
virtual nframes_t process ( nframes_t ) { return 0; }
|
||||||
|
|
||||||
|
|
|
@ -247,7 +247,7 @@ Sequence_Region::handle ( int m )
|
||||||
void
|
void
|
||||||
Sequence_Region::draw_box ( 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
|
void
|
||||||
|
|
|
@ -230,6 +230,11 @@ Sequence_Widget::start ( nframes_t where )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Sequence_Widget::draw_label ( void )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Sequence_Widget::draw_label ( const char *label, Fl_Align align, Fl_Color color, int xo, int yo )
|
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_box ( void );
|
||||||
virtual void draw ( void );
|
virtual void draw ( void );
|
||||||
|
virtual void draw_label ( void );
|
||||||
|
|
||||||
bool
|
bool
|
||||||
operator< ( const Sequence_Widget & rhs ) const
|
operator< ( const Sequence_Widget & rhs ) const
|
||||||
|
|
|
@ -839,8 +839,6 @@ Track::draw ( void )
|
||||||
|
|
||||||
fl_clip_box( x(), y(), w(), h(), X, Y, W, H );
|
fl_clip_box( x(), y(), w(), h(), X, Y, W, H );
|
||||||
|
|
||||||
timeline->draw_measure_lines( X, Y, W, H );
|
|
||||||
|
|
||||||
if ( _selected )
|
if ( _selected )
|
||||||
{
|
{
|
||||||
Fl_Color c = color();
|
Fl_Color c = color();
|
||||||
|
@ -854,7 +852,6 @@ Track::draw ( void )
|
||||||
else
|
else
|
||||||
Fl_Group::draw();
|
Fl_Group::draw();
|
||||||
|
|
||||||
|
|
||||||
fl_pop_clip();
|
fl_pop_clip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue