diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-09-27 23:12:56 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-09-27 23:12:56 +0200 |
| commit | b49833e6486fd18c119016c3e4561f4a9f4b4329 (patch) | |
| tree | 1fc64d1ef69c7332f29f3f3f2ee7c75f2d5705ca | |
| parent | 6066d80cbc5a60ea1697466b5b21521be7db6197 (diff) | |
Make the DCP (reels) timeline look a bit better in dark mode (#2980).
| -rw-r--r-- | src/wx/dcp_timeline.cc | 24 | ||||
| -rw-r--r-- | src/wx/dcp_timeline.h | 4 | ||||
| -rw-r--r-- | src/wx/dcp_timeline_reel_marker_view.cc | 12 |
3 files changed, 27 insertions, 13 deletions
diff --git a/src/wx/dcp_timeline.cc b/src/wx/dcp_timeline.cc index dc0265127..d8b9c7115 100644 --- a/src/wx/dcp_timeline.cc +++ b/src/wx/dcp_timeline.cc @@ -401,13 +401,19 @@ DCPTimeline::paint() gc->SetAntialiasMode(wxANTIALIAS_DEFAULT); - paint_reels(gc); - paint_content(gc); + wxColour palette[] = { + gui_is_dark() ? wxColour(190, 190, 190) : wxColour(0, 0, 0), + gui_is_dark() ? wxColour(134, 177, 218) : wxColour(0, 0, 255) + + }; + + paint_reels(gc, palette); + paint_content(gc, palette); } void -DCPTimeline::paint_reels(wxGraphicsContext* gc) +DCPTimeline::paint_reels(wxGraphicsContext* gc, wxColour* palette) { constexpr int x_offset = 2; @@ -415,8 +421,8 @@ DCPTimeline::paint_reels(wxGraphicsContext* gc) boundary->view().paint(gc); } - gc->SetFont(gc->CreateFont(*wxNORMAL_FONT, wxColour(0, 0, 0))); - gc->SetPen(*wxThePenList->FindOrCreatePen(wxColour(0, 0, 0), 2, wxPENSTYLE_SOLID)); + gc->SetFont(gc->CreateFont(*wxNORMAL_FONT, palette[0])); + gc->SetPen(*wxThePenList->FindOrCreatePen(palette[0], 2, wxPENSTYLE_SOLID)); auto const pps = pixels_per_second().get_value_or(1); @@ -451,7 +457,7 @@ DCPTimeline::paint_reels(wxGraphicsContext* gc) } }; - gc->SetPen(*wxThePenList->FindOrCreatePen(wxColour(0, 0, 255), 2, wxPENSTYLE_DOT)); + gc->SetPen(*wxThePenList->FindOrCreatePen(palette[1], 2, wxPENSTYLE_DOT)); int index = 0; DCPTime last; for (auto const& boundary: _reel_boundaries) { @@ -464,13 +470,13 @@ DCPTimeline::paint_reels(wxGraphicsContext* gc) void -DCPTimeline::paint_content(wxGraphicsContext* gc) +DCPTimeline::paint_content(wxGraphicsContext* gc, wxColour* palette) { auto const pps = pixels_per_second().get_value_or(1); auto const film = this->film(); - auto const& solid_pen = *wxThePenList->FindOrCreatePen(wxColour(0, 0, 0), 1, wxPENSTYLE_SOLID); - auto const& dotted_pen = *wxThePenList->FindOrCreatePen(wxColour(0, 0, 0), 1, wxPENSTYLE_DOT); + auto const& solid_pen = *wxThePenList->FindOrCreatePen(palette[0], 1, wxPENSTYLE_SOLID); + auto const& dotted_pen = *wxThePenList->FindOrCreatePen(palette[0], 1, wxPENSTYLE_DOT); auto const& video_brush = *wxTheBrushList->FindOrCreateBrush(VIDEO_CONTENT_COLOUR, wxBRUSHSTYLE_SOLID); auto const& audio_brush = *wxTheBrushList->FindOrCreateBrush(AUDIO_CONTENT_COLOUR, wxBRUSHSTYLE_SOLID); diff --git a/src/wx/dcp_timeline.h b/src/wx/dcp_timeline.h index e74adae8a..e09140e88 100644 --- a/src/wx/dcp_timeline.h +++ b/src/wx/dcp_timeline.h @@ -52,8 +52,8 @@ public: private: void paint(); - void paint_reels(wxGraphicsContext* gc); - void paint_content(wxGraphicsContext* gc); + void paint_reels(wxGraphicsContext* gc, wxColour* palette); + void paint_content(wxGraphicsContext* gc, wxColour* palette); void setup_pixels_per_second(); void left_down(wxMouseEvent& ev); void right_down(wxMouseEvent& ev); diff --git a/src/wx/dcp_timeline_reel_marker_view.cc b/src/wx/dcp_timeline_reel_marker_view.cc index 1c97ca175..c2eba3b77 100644 --- a/src/wx/dcp_timeline_reel_marker_view.cc +++ b/src/wx/dcp_timeline_reel_marker_view.cc @@ -48,8 +48,16 @@ DCPTimelineReelMarkerView::x_pos() const void DCPTimelineReelMarkerView::do_paint(wxGraphicsContext* gc) { - wxColour const outline = _active ? wxColour(0, 0, 0) : wxColour(128, 128, 128); - wxColour const fill = _active ? wxColour(255, 0, 0) : wxColour(192, 192, 192); + wxColour outline; + wxColour fill; + if (_active) { + outline = gui_is_dark() ? wxColour(190, 190, 190) : wxColour(0, 0, 0); + fill = gui_is_dark() ? wxColour(190, 0, 0) : wxColour(255, 0, 0); + } else { + outline = wxColour(128, 128, 128); + fill = wxColour(192, 192, 192); + } + gc->SetPen(*wxThePenList->FindOrCreatePen(outline, 2, wxPENSTYLE_SOLID)); gc->SetBrush(*wxTheBrushList->FindOrCreateBrush(fill, wxBRUSHSTYLE_SOLID)); |
