Browse Source

Timeline: Fix 'Vary Color' region drawing mode. Also, tweak appearance.

tags/non-daw-v1.2.0
Jonathan Moore Liles 10 years ago
parent
commit
a1336880b5
4 changed files with 17 additions and 19 deletions
  1. +6
    -7
      timeline/src/Audio_Region.C
  2. +1
    -1
      timeline/src/Sequence_Region.C
  3. +9
    -10
      timeline/src/Waveform.C
  4. +1
    -1
      timeline/src/Waveform.H

+ 6
- 7
timeline/src/Audio_Region.C View File

@@ -559,16 +559,15 @@ Audio_Region::draw ( void )
nframes_t loop_frames_needed = _loop ? _loop : total_frames_needed;
int loop_peaks_needed = timeline->ts_to_x( loop_frames_needed );
Fl_Color c = Fl::get_color( _color );
Fl_Color fg_color = FL_FOREGROUND_COLOR;
Fl_Color bg_color = FL_BACKGROUND_COLOR;

if ( recording() )
if ( !active_r() )
{
// loop_peaks_needed = timeline->ts_to_x( _range.length );
c = FL_BLACK;
fg_color = fl_inactive(fg_color);
bg_color = fl_inactive(bg_color);
}
c = fl_color_add_alpha( c, 220 );

if ( ! fo ) /* first loop... */
{
if ( _loop )
@@ -639,7 +638,7 @@ Audio_Region::draw ( void )
loop_peaks_needed,
ch,
pbuf + i, peaks, channels,
c );
fg_color, bg_color );
}
}
else


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

@@ -258,7 +258,7 @@ Sequence_Region::draw ( void )
void
Sequence_Region::draw_label ( const char *label, Fl_Align align, Fl_Color color, int xo, int yo )
{
fl_color( FL_WHITE );
fl_color( active_r() ? FL_FOREGROUND_COLOR : fl_inactive( FL_FOREGROUND_COLOR ) );
fl_font( FL_HELVETICA_ITALIC, 10 );
fl_draw( label, line_x() + Fl::box_dx( box() ), y() + Fl::box_dy( box() ), abs_w() - Fl::box_dw( box() ), h() - Fl::box_dh( box() ), align );
}


+ 9
- 10
timeline/src/Waveform.C View File

@@ -55,7 +55,7 @@ Waveform::scale ( Peak *pbuf, int npeaks, float gain )
void
Waveform::draw ( int X, int Y, int W, int H,
const Peak *pbuf, int peaks, int skip,
Fl_Color color )
Fl_Color fg_color, Fl_Color bg_color )
{
int j;

@@ -69,6 +69,8 @@ Waveform::draw ( int X, int Y, int W, int H,

if ( ! W )
return;

fg_color = fl_color_add_alpha( Fl::get_color( fg_color ), 200 );
if ( Waveform::fill )
{
@@ -81,14 +83,11 @@ Waveform::draw ( int X, int Y, int W, int H,

const float diff = fabs( p.max - p.min );
if ( diff > 2.0f )
if ( diff > 2.0f )
fl_color( FL_RED );
else
if ( Waveform::vary_color )
fl_color( fl_color_average( FL_WHITE, color, diff * 0.5f ) );
else
fl_color( color );

fl_color( fl_color_average( fg_color, bg_color, diff * 0.5f ) );
const int ty = mid - ( halfheight * p.min );
const int by = mid - ( halfheight * p.max );
fl_line( x, ty, x, by );
@@ -96,8 +95,8 @@ Waveform::draw ( int X, int Y, int W, int H,
}
else
{
fl_color( color );
fl_color( fg_color );
fl_begin_complex_polygon();
j = start;
@@ -116,7 +115,7 @@ Waveform::draw ( int X, int Y, int W, int H,

if ( Waveform::outline )
{
fl_color( fl_darker( fl_darker( color ) ) );
fl_color( bg_color );

fl_line_style( FL_SOLID, 0 );



+ 1
- 1
timeline/src/Waveform.H View File

@@ -34,6 +34,6 @@ public:
static void scale ( Peak *pbuf, int npeaks, float gain );
static void draw ( int X, int Y, int W, int H,
const Peak *pbuf, int peaks, int skip,
Fl_Color color );
Fl_Color fg_color, Fl_Color bg_color );

};

Loading…
Cancel
Save