diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-10-16 22:22:22 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-10-18 20:37:00 +0200 |
| commit | 1350e2f5cf87a419136c10370e46fd7d82f27efc (patch) | |
| tree | 426b6239310c156ebc2114b2fba1a804e8adfcc8 | |
| parent | 93a781c8b9d34effd376537268970193b9b01479 (diff) | |
Fix colouring of audio plot in dark mode.
| -rw-r--r-- | src/wx/audio_dialog.cc | 11 | ||||
| -rw-r--r-- | src/wx/audio_plot.cc | 20 |
2 files changed, 19 insertions, 12 deletions
diff --git a/src/wx/audio_dialog.cc b/src/wx/audio_dialog.cc index a4f1dd514..e433f45fd 100644 --- a/src/wx/audio_dialog.cc +++ b/src/wx/audio_dialog.cc @@ -399,10 +399,13 @@ AudioDialog::setup_statistics () ) ); + wxColour const peaking = *wxRED; + wxColour const not_peaking = gui_is_dark() ? *wxWHITE : *wxBLACK; + if (peak_dB > -3) { - _sample_peak->SetForegroundColour (wxColour (255, 0, 0)); + _sample_peak->SetForegroundColour(peaking); } else { - _sample_peak->SetForegroundColour (wxColour (0, 0, 0)); + _sample_peak->SetForegroundColour(not_peaking); } if (_analysis->overall_true_peak()) { @@ -412,9 +415,9 @@ AudioDialog::setup_statistics () _true_peak->SetLabel (wxString::Format (_("True peak is %.2fdB"), peak_dB)); if (peak_dB > -3) { - _true_peak->SetForegroundColour (wxColour (255, 0, 0)); + _true_peak->SetForegroundColour(peaking); } else { - _true_peak->SetForegroundColour (wxColour (0, 0, 0)); + _true_peak->SetForegroundColour(not_peaking); } } diff --git a/src/wx/audio_plot.cc b/src/wx/audio_plot.cc index 59df0425b..cac939ac0 100644 --- a/src/wx/audio_plot.cc +++ b/src/wx/audio_plot.cc @@ -72,7 +72,11 @@ AudioPlot::AudioPlot(wxWindow* parent, FilmViewer& viewer) _type_visible[i] = false; } - _colours.push_back (wxColour ( 0, 0, 0)); + if (gui_is_dark()) { + _colours.push_back(wxColour(255, 255, 255)); + } else { + _colours.push_back(wxColour(0, 0, 0)); + } _colours.push_back (wxColour (255, 0, 0)); _colours.push_back (wxColour ( 0, 255, 0)); _colours.push_back (wxColour (139, 0, 204)); @@ -165,14 +169,14 @@ AudioPlot::paint () gc->SetAntialiasMode (wxANTIALIAS_DEFAULT); if (!_analysis || _analysis->channels() == 0) { - gc->SetFont (gc->CreateFont (*wxNORMAL_FONT)); + gc->SetFont(gc->CreateFont(*wxNORMAL_FONT, gui_is_dark() ? *wxWHITE : *wxBLACK)); gc->DrawText (_message, 32, 32); delete gc; return; } auto h_grid = gc->CreatePath (); - gc->SetFont (gc->CreateFont (*wxSMALL_FONT)); + gc->SetFont(gc->CreateFont(*wxSMALL_FONT, gui_is_dark() ? *wxWHITE : *wxBLACK)); wxDouble db_label_height; wxDouble db_label_descent; wxDouble db_label_leading; @@ -195,7 +199,9 @@ AudioPlot::paint () gc->DrawText (std_to_wx (String::compose ("%1dB", i)), 0, y - (db_label_height / 2)); } - gc->SetPen (wxPen (wxColour (200, 200, 200))); + wxColour const grid_colour = gui_is_dark() ? wxColour(80, 80, 80) : wxColour(200, 200, 200); + + gc->SetPen(wxPen(grid_colour)); gc->StrokePath (h_grid); /* Draw an x axis with marks */ @@ -205,8 +211,6 @@ AudioPlot::paint () DCPOMATIC_ASSERT (_analysis->samples_per_point() != 0.0); double const pps = _analysis->sample_rate() * metrics.x_scale / _analysis->samples_per_point(); - gc->SetPen (*wxThePenList->FindOrCreatePen (wxColour (0, 0, 0), 1, wxPENSTYLE_SOLID)); - double const mark_interval = calculate_mark_interval (rint (128 / pps)); auto t = DCPTime::from_seconds (mark_interval); @@ -234,7 +238,7 @@ AudioPlot::paint () t += DCPTime::from_seconds (mark_interval); } - gc->SetPen (wxPen (wxColour (200, 200, 200))); + gc->SetPen(wxPen(grid_colour)); gc->StrokePath (v_grid); if (_type_visible[AudioPoint::PEAK]) { @@ -265,7 +269,7 @@ AudioPlot::paint () axes.MoveToPoint (metrics.db_label_width, 0); axes.AddLineToPoint (metrics.db_label_width, metrics.height - metrics.y_origin); axes.AddLineToPoint (metrics.db_label_width + data_width, metrics.height - metrics.y_origin); - gc->SetPen (wxPen (wxColour (0, 0, 0))); + gc->SetPen(wxPen(grid_colour)); gc->StrokePath (axes); if (_cursor) { |
