-ClipSelector names drawn, colours set

This commit is contained in:
Harry van Haaren 2013-07-22 09:45:17 +01:00
parent c6d0b9b208
commit bcd82b3778

View file

@ -44,6 +44,7 @@ class ClipState
ClipState() ClipState()
{ {
state = CLIP_EMPTY; state = CLIP_EMPTY;
name = "CLIP";
} }
ClipState(std::string n) ClipState(std::string n)
{ {
@ -74,10 +75,11 @@ class ClipSelector : public Fl_Button
mouseOver = false; mouseOver = false;
clips[0].state = ClipState::CLIP_EMPTY; clips[0].state = ClipState::CLIP_EMPTY;
clips[1].state = ClipState::CLIP_QUEUED; clips[1].state = ClipState::CLIP_LOADED;
clips[2].state = ClipState::CLIP_PLAYING; clips[2].state = ClipState::CLIP_QUEUED;
clips[3].state = ClipState::CLIP_RECORDING; clips[3].state = ClipState::CLIP_PLAYING;
clips[4].state = ClipState::CLIP_STOPPING; clips[4].state = ClipState::CLIP_RECORDING;
clips[5].state = ClipState::CLIP_STOPPING;
} }
static const int numClips = 10; static const int numClips = 10;
@ -119,25 +121,34 @@ class ClipSelector : public Fl_Button
switch( clips[i].state ) switch( clips[i].state )
{ {
case ClipState::CLIP_EMPTY: case ClipState::CLIP_EMPTY:
cairo_set_source_rgba(cr, 66 / 255.f, 66 / 255.f , 66 / 255.f, 0.4); cairo_set_source_rgba(cr, 66 / 255.f, 66 / 255.f , 66 / 255.f, 1.f);
cairo_fill(cr);
break; break;
case ClipState::CLIP_LOADED: case ClipState::CLIP_LOADED:
cairo_set_source_rgba(cr, 1.0, 0.48, 0, 0.5); cairo_set_source_rgba(cr, 1.0, 0.6, 0, 1.f);
cairo_fill(cr);
break; break;
case ClipState::CLIP_QUEUED: case ClipState::CLIP_QUEUED:
cairo_set_source_rgba( cr, 0 / 255.f, 153 / 255.f , 255 / 255.f , 1 ); cairo_set_source_rgba( cr, 0 / 255.f, 153 / 255.f , 255 / 255.f , 1 );
cairo_fill(cr);
break; break;
case ClipState::CLIP_PLAYING: case ClipState::CLIP_PLAYING:
cairo_set_source_rgba(cr, 0.0, 1.0, 0, 1.f ); cairo_set_source_rgba(cr, 0.0, 1.0, 0, 1.f );
cairo_fill(cr);
break; break;
case ClipState::CLIP_RECORDING: case ClipState::CLIP_RECORDING:
cairo_set_source_rgba(cr, 1.f, 0 / 255.f , 0 / 255.f, 1.f); cairo_set_source_rgba(cr, 1.f, 0 / 255.f , 0 / 255.f, 1.f);
cairo_fill(cr);
break; break;
case ClipState::CLIP_STOPPING: case ClipState::CLIP_STOPPING:
cairo_set_source_rgba(cr, 0 / 255.f, 0 / 255.f , 0 / 255.f, 0.4); cairo_set_source_rgba(cr, 0 / 255.f, 0 / 255.f , 0 / 255.f, 1.0);
cairo_fill(cr);
break; break;
} }
cairo_fill(cr);
cairo_rectangle( cr, x+1, drawY, clipWidth, clipHeight - 2 ); cairo_rectangle( cr, x+1, drawY, clipWidth, clipHeight - 2 );
@ -158,6 +169,12 @@ class ClipSelector : public Fl_Button
cairo_line_to( cr, x+clipHeight-1, drawY + clipHeight - 2); cairo_line_to( cr, x+clipHeight-1, drawY + clipHeight - 2);
cairo_stroke(cr); cairo_stroke(cr);
// clip name
cairo_move_to( cr, x+clipHeight-1+ 10, drawY + 15 );
cairo_set_source_rgba( cr, 255 / 255.f, 255 / 255.f , 255 / 255.f , 1 );
cairo_set_font_size( cr, 10 );
cairo_show_text( cr, label );
drawY += clipHeight + 2; drawY += clipHeight + 2;
} }