Load the colors for the audio display timeline from the audio colorscheme

Originally committed to SVN as r5952.
This commit is contained in:
Thomas Goyne 2011-11-30 21:04:46 +00:00
parent 7bfdc78b72
commit 157c03ce63

View file

@ -279,20 +279,22 @@ class AudioDisplayTimeline : public AudioDisplayInteractionObject {
Sc_MAX = Sc_Decahour Sc_MAX = Sc_Decahour
}; };
Scale scale_minor; Scale scale_minor;
int scale_major_modulo; // If minor_scale_mark_index % scale_major_modulo == 0 the mark is a major mark int scale_major_modulo; ///< If minor_scale_mark_index % scale_major_modulo == 0 the mark is a major mark
double scale_minor_divisor; // Absolute scale-mark index multiplied by this number gives sample index for scale mark double scale_minor_divisor; ///< Absolute scale-mark index multiplied by this number gives sample index for scale mark
AudioDisplay *display; AudioDisplay *display;
UIColours colours; ///< Colour provider
public: public:
AudioDisplayTimeline(AudioDisplay *_display) AudioDisplayTimeline(AudioDisplay *display)
: num_samples(0) : num_samples(0)
, samplerate(44100) , samplerate(44100)
, samples_per_pixel(1) , samples_per_pixel(1)
, pixel_left(0) , pixel_left(0)
, dragging(false) , dragging(false)
, display(_display) , display(display)
{ {
} }
@ -303,6 +305,11 @@ public:
return height + 4; return height + 4;
} }
void SetColourScheme(std::string const& name)
{
colours.SetColourScheme(name);
}
void SetDisplaySize(const wxSize &display_size) void SetDisplaySize(const wxSize &display_size)
{ {
// The size is without anything that goes below the timeline (like scrollbar) // The size is without anything that goes below the timeline (like scrollbar)
@ -391,23 +398,20 @@ public:
void Paint(wxDC &dc) void Paint(wxDC &dc)
{ {
wxColour light(89, 145, 220);
wxColour dark(8, 4, 13);
int bottom = bounds.y + bounds.height; int bottom = bounds.y + bounds.height;
// Background // Background
dc.SetPen(wxPen(dark)); dc.SetPen(wxPen(colours.Dark()));
dc.SetBrush(wxBrush(dark)); dc.SetBrush(wxBrush(colours.Dark()));
dc.DrawRectangle(bounds); dc.DrawRectangle(bounds);
// Top line // Top line
dc.SetPen(wxPen(light)); dc.SetPen(wxPen(colours.Light()));
dc.DrawLine(bounds.x, bottom-1, bounds.x+bounds.width, bottom-1); dc.DrawLine(bounds.x, bottom-1, bounds.x+bounds.width, bottom-1);
// Prepare for writing text // Prepare for writing text
dc.SetTextBackground(dark); dc.SetTextBackground(colours.Dark());
dc.SetTextForeground(light); dc.SetTextForeground(colours.Light());
// Figure out the first scale mark to show // Figure out the first scale mark to show
int64_t sample_left = pixel_left * samples_per_pixel; int64_t sample_left = pixel_left * samples_per_pixel;
@ -839,6 +843,7 @@ void AudioDisplay::ReloadRenderingSettings()
audio_renderer->SetRenderer(audio_renderer_provider.get()); audio_renderer->SetRenderer(audio_renderer_provider.get());
scrollbar->SetColourScheme(colour_scheme_name); scrollbar->SetColourScheme(colour_scheme_name);
timeline->SetColourScheme(colour_scheme_name);
Refresh(); Refresh();
} }