Browse Source

Timeline: Eliminate some unnecessary repeated drawing of measure lines.

tags/non-daw-v1.2.0
Jonathan Moore Liles 13 years ago
parent
commit
1d59665702
10 changed files with 55 additions and 55 deletions
  1. +18
    -22
      timeline/src/Audio_Region.C
  2. +8
    -2
      timeline/src/Audio_Region.H
  3. +2
    -3
      timeline/src/Audio_Sequence.C
  4. +4
    -4
      timeline/src/Control_Sequence.C
  5. +15
    -20
      timeline/src/Sequence.C
  6. +1
    -0
      timeline/src/Sequence.H
  7. +1
    -1
      timeline/src/Sequence_Region.C
  8. +5
    -0
      timeline/src/Sequence_Widget.C
  9. +1
    -0
      timeline/src/Sequence_Widget.H
  10. +0
    -3
      timeline/src/Track.C

+ 18
- 22
timeline/src/Audio_Region.C View File

@@ -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 )
{ {
@@ -462,14 +462,8 @@ Audio_Region::draw_box( void )
{ {
b = FL_DOWN_FRAME; 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(); 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_average( FL_BLACK, FL_RED, 0.20 );
c = fl_color_add_alpha( c, 220 );


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 )


+ 8
- 2
timeline/src/Audio_Region.H View File

@@ -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 );


+ 2
- 3
timeline/src/Audio_Sequence.C View File

@@ -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 );
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(); fl_pop_clip();




+ 4
- 4
timeline/src/Control_Sequence.C View File

@@ -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() ) )
return;
// draw_box();


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++ )


+ 15
- 20
timeline/src/Sequence.C View File

@@ -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 )
{ {
fl_push_clip( x(), y(), w(), h() );


if ( ! fl_not_clipped( x(), y(), w(), h() ) )
return;
draw_box();


fl_push_clip( x(), y(), w(), h() );
for ( list <Sequence_Widget *>::const_iterator r = _widgets.begin(); r != _widgets.end(); ++r )
(*r)->draw_box();


/* 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() );

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();


for ( list <Sequence_Widget *>::const_iterator r = _widgets.begin(); r != _widgets.end(); ++r )
(*r)->draw();
(*r)->draw_label();


fl_pop_clip(); fl_pop_clip();

} }


#include "FL/test_press.H" #include "FL/test_press.H"


+ 1
- 0
timeline/src/Sequence.H View File

@@ -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; }




+ 1
- 1
timeline/src/Sequence_Region.C View File

@@ -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


+ 5
- 0
timeline/src/Sequence_Widget.C View File

@@ -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 )
{ {


+ 1
- 0
timeline/src/Sequence_Widget.H View File

@@ -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


+ 0
- 3
timeline/src/Track.C View File

@@ -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…
Cancel
Save