Improve timeline view colouring in dark mode.
authorCarl Hetherington <cth@carlh.net>
Mon, 17 Oct 2022 18:36:55 +0000 (20:36 +0200)
committerCarl Hetherington <cth@carlh.net>
Tue, 18 Oct 2022 18:37:00 +0000 (20:37 +0200)
src/wx/timeline.cc
src/wx/timeline_labels_view.cc
src/wx/timeline_reels_view.cc
src/wx/timeline_time_axis_view.cc

index 6886daa42771e6686fadb96b38890e7949a511b9..a9372b6bb862a4e1aa36ebba26b262ca6d4d4b9c 100644 (file)
@@ -207,7 +207,7 @@ Timeline::paint_main ()
        if (_zoom_point) {
                /* Translate back as _down_point and _zoom_point do not take scroll into account */
                gc->Translate (vsx * _x_scroll_rate, vsy * _y_scroll_rate);
-               gc->SetPen (*wxBLACK_PEN);
+               gc->SetPen(gui_is_dark() ? *wxWHITE_PEN : *wxBLACK_PEN);
                gc->SetBrush (*wxTRANSPARENT_BRUSH);
                gc->DrawRectangle (
                        min (_down_point.x, _zoom_point->x),
index 7075d4b7dce74418bfa264cc0ad007a57c9b271c..181adc5ca411b07a8ada58617309e62782768010 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "timeline.h"
 #include "timeline_labels_view.h"
+#include "wx_util.h"
 #include <dcp/warnings.h>
 LIBDCP_DISABLE_WARNINGS
 #include <wx/graphics.h>
@@ -64,7 +65,8 @@ void
 TimelineLabelsView::do_paint (wxGraphicsContext* gc, list<dcpomatic::Rect<int>>)
 {
        int const h = _timeline.pixels_per_track ();
-       gc->SetFont (gc->CreateFont(wxNORMAL_FONT->Bold(), wxColour(0, 0, 0)));
+       wxColour const colour = gui_is_dark() ? *wxWHITE : *wxBLACK;
+       gc->SetFont(gc->CreateFont(wxNORMAL_FONT->Bold(), colour));
 
        int fy = 0;
        if (_video_tracks) {
index 331f6580df9ff4ce6bb0258e02d1449a4209cfc3..2ec8f9e8283c06c7008c5a2e51564d9af3f5c339 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "timeline.h"
 #include "timeline_reels_view.h"
+#include "wx_util.h"
 #include <dcp/warnings.h>
 LIBDCP_DISABLE_WARNINGS
 #include <wx/graphics.h>
@@ -65,14 +66,15 @@ TimelineReelsView::do_paint (wxGraphicsContext* gc, list<dcpomatic::Rect<int>>)
 
        double const pps = _timeline.pixels_per_second().get ();
 
-       gc->SetPen (*wxThePenList->FindOrCreatePen (wxColour (0, 0, 255), 1, wxPENSTYLE_SOLID));
+       wxColour const colour = gui_is_dark() ? wxColour(182, 204, 240) : wxColour(0, 0, 255);
+       gc->SetPen(*wxThePenList->FindOrCreatePen(colour, 1, wxPENSTYLE_SOLID));
 
        auto path = gc->CreatePath ();
        path.MoveToPoint (time_x (DCPTime (0)), _y);
        path.AddLineToPoint (time_x (_timeline.film()->length()), _y);
        gc->StrokePath (path);
 
-       gc->SetFont (gc->CreateFont (*wxNORMAL_FONT, wxColour (0, 0, 255)));
+       gc->SetFont(gc->CreateFont(*wxNORMAL_FONT, colour));
 
        int reel = 1;
        for (auto i: _timeline.film()->reels()) {
index 023b42ec79ed4342958d9fec4605ac6424475ba0..3b1b3cd9945fa94e25a3c6ffb3862f89698d1f9f 100644 (file)
@@ -67,7 +67,8 @@ TimelineTimeAxisView::do_paint (wxGraphicsContext* gc, list<dcpomatic::Rect<int>
 
        double const pps = _timeline.pixels_per_second().get ();
 
-       gc->SetPen (*wxThePenList->FindOrCreatePen (wxColour (0, 0, 0), 1, wxPENSTYLE_SOLID));
+       wxColour const colour = gui_is_dark() ? *wxWHITE : *wxBLACK;
+       gc->SetPen(*wxThePenList->FindOrCreatePen(colour, 1, wxPENSTYLE_SOLID));
 
        double const mark_interval = calculate_mark_interval (rint (128 / pps));
 
@@ -78,7 +79,7 @@ TimelineTimeAxisView::do_paint (wxGraphicsContext* gc, list<dcpomatic::Rect<int>
        path.AddLineToPoint (_timeline.width(), y);
        gc->StrokePath (path);
 
-       gc->SetFont (gc->CreateFont (*wxNORMAL_FONT));
+       gc->SetFont(gc->CreateFont(*wxNORMAL_FONT, colour));
 
        /* Time in seconds */
        DCPTime t;