Browse Source

Add gradient option for control sequence drawing.

tags/non-daw-v1.1.0
Jonathan Moore Liles 17 years ago
parent
commit
1bfdd8e568
2 changed files with 48 additions and 9 deletions
  1. +45
    -9
      Timeline/Control_Sequence.C
  2. +3
    -0
      Timeline/Control_Sequence.H

+ 45
- 9
Timeline/Control_Sequence.C View File

@@ -20,7 +20,8 @@
#include "Control_Sequence.H" #include "Control_Sequence.H"
#include "Track.H" #include "Track.H"



bool Control_Sequence::use_gradient = true;
bool Control_Sequence::use_polygon = true;


Control_Sequence::Control_Sequence ( Track *track ) : Sequence( 0, 0, 0, 0 ) Control_Sequence::Control_Sequence ( Track *track ) : Sequence( 0, 0, 0, 0 )
{ {
@@ -95,11 +96,25 @@ Control_Sequence::draw ( void )


fl_clip_box( x(), y(), w(), h(), X, Y, W, H ); fl_clip_box( x(), y(), w(), h(), X, Y, W, H );


fl_line_style( FL_SOLID, 4 );
if ( use_gradient )
{
Fl_Color target = fl_color_average( color(), FL_WHITE, 0.50f );

for ( int gy = 0; gy < h(); gy++ )
{
fl_color( fl_color_average( target, selection_color(), gy / (float)h()) );
fl_line( x(), y() + gy, x() + w(), y() + gy );
}
}


fl_color( fl_color_average( selection_color(), color(), 0.90f ) ); fl_color( fl_color_average( selection_color(), color(), 0.90f ) );
fl_line_style( FL_SOLID, 4 );

if ( use_polygon )
fl_begin_complex_polygon();
else
fl_begin_line();


fl_begin_complex_polygon();


list <Sequence_Widget *>::const_iterator e = _widgets.end(); list <Sequence_Widget *>::const_iterator e = _widgets.end();
e--; e--;
@@ -107,24 +122,45 @@ Control_Sequence::draw ( void )
if ( _widgets.size() ) if ( _widgets.size() )
for ( list <Sequence_Widget *>::const_iterator r = _widgets.begin(); ; r++ ) for ( list <Sequence_Widget *>::const_iterator r = _widgets.begin(); ; r++ )
{ {
const int ry = (*r)->y();

if ( r == _widgets.begin() ) if ( r == _widgets.begin() )
{ {
fl_vertex( x(), y() + h() );
fl_vertex( x(), (*r)->y() );
if ( use_gradient )
{
fl_vertex( x(), y() );
fl_vertex( x(), ry );
}
else
{
fl_vertex( x(), h() + y() );
fl_vertex( x(), ry );
}
} }


fl_vertex( (*r)->x(), (*r)->y() );
fl_vertex( (*r)->x(), ry );


if ( r == e ) if ( r == e )
{ {
fl_vertex( x() + w(), (*r)->y() );
fl_vertex( x() + w(), y() + h() );
if ( use_gradient )
{
fl_vertex( x() + w(), ry );
fl_vertex( x() + w(), y() );
}
else
{
fl_vertex( x() + w(), ry );
fl_vertex( x() + w(), h() + y() );
}
break; break;
} }


} }


fl_end_complex_polygon();
if ( use_polygon )
fl_end_complex_polygon();
else
fl_end_line();


fl_line_style( FL_SOLID, 0 ); fl_line_style( FL_SOLID, 0 );




+ 3
- 0
Timeline/Control_Sequence.H View File

@@ -40,6 +40,9 @@ protected:


public: public:


static bool use_gradient;
static bool use_polygon;

LOG_CREATE_FUNC( Control_Sequence ); LOG_CREATE_FUNC( Control_Sequence );


Control_Sequence ( Track * ); Control_Sequence ( Track * );


Loading…
Cancel
Save