summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-10-18 20:37:14 +0200
committerCarl Hetherington <cth@carlh.net>2022-10-18 20:37:14 +0200
commita2b97a1e3e4211a5c6b86ab780bcb9f5f4a9eeeb (patch)
tree354d75141352ab018a7a7020a28c68691ec1a23e /src
parente983d424808894dc9b036c46cd61d8fa39487dfd (diff)
parent179685ef5cfb81d362282ee2fae526533e6404a3 (diff)
Improve the appearance of things in macOS dark mode in various ways.
Diffstat (limited to 'src')
-rw-r--r--src/lib/release_notes.cc12
-rw-r--r--src/lib/release_notes.h2
-rw-r--r--src/tools/dcpomatic.cc2
-rw-r--r--src/wx/audio_dialog.cc11
-rw-r--r--src/wx/audio_plot.cc20
-rw-r--r--src/wx/config_dialog.cc2
-rw-r--r--src/wx/config_dialog.h6
-rw-r--r--src/wx/full_config_dialog.cc18
-rw-r--r--src/wx/html_dialog.cc4
-rw-r--r--src/wx/timeline.cc2
-rw-r--r--src/wx/timeline_dialog.cc10
-rw-r--r--src/wx/timeline_labels_view.cc4
-rw-r--r--src/wx/timeline_reels_view.cc6
-rw-r--r--src/wx/timeline_time_axis_view.cc5
-rw-r--r--src/wx/wx_util.cc7
-rw-r--r--src/wx/wx_util.h1
16 files changed, 70 insertions, 42 deletions
diff --git a/src/lib/release_notes.cc b/src/lib/release_notes.cc
index 236713184..d69738427 100644
--- a/src/lib/release_notes.cc
+++ b/src/lib/release_notes.cc
@@ -31,7 +31,7 @@ using boost::optional;
optional<string>
-find_release_notes(optional<string> current)
+find_release_notes(bool dark, optional<string> current)
{
auto last = Config::instance()->last_release_notes_version();
if (!current) {
@@ -43,14 +43,18 @@ find_release_notes(optional<string> current)
Config::instance()->set_last_release_notes_version(*current);
- const string header = String::compose("<h1>DCP-o-matic %1 release notes</h1>", *current);
+ string const colour = dark ? "white" : "black";
+ auto const span = String::compose("<span style=\"color: %1\">", colour);
+
+ const string header = String::compose("<h1>%1DCP-o-matic %2 release notes</span></h1>", span, *current);
if (!last) {
- return header +
+ return header + span +
_("In this version there are changes to the way that subtitles are positioned. "
"Positioning should now be more correct, with respect to the standards, but you "
"should check any subtitles in your project to make sure that they are placed "
- "where you want them.");
+ "where you want them.")
+ + "</span>";
}
return {};
diff --git a/src/lib/release_notes.h b/src/lib/release_notes.h
index a5026b432..d0837248b 100644
--- a/src/lib/release_notes.h
+++ b/src/lib/release_notes.h
@@ -23,4 +23,4 @@
#include <string>
-extern boost::optional<std::string> find_release_notes(boost::optional<std::string> current = boost::optional<std::string>());
+extern boost::optional<std::string> find_release_notes(bool dark, boost::optional<std::string> current = boost::optional<std::string>());
diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc
index eec81d3c8..001d1859e 100644
--- a/src/tools/dcpomatic.cc
+++ b/src/tools/dcpomatic.cc
@@ -1746,7 +1746,7 @@ private:
UpdateChecker::instance()->run ();
}
- auto release_notes = find_release_notes();
+ auto release_notes = find_release_notes(gui_is_dark());
if (release_notes) {
auto notes = new HTMLDialog(nullptr, _("Release notes"), std_to_wx(*release_notes), true);
notes->Centre();
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) {
diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc
index 7148fd173..07ab2d8aa 100644
--- a/src/wx/config_dialog.cc
+++ b/src/wx/config_dialog.cc
@@ -1054,7 +1054,7 @@ LocationsPage::GetName () const
wxBitmap
LocationsPage::GetLargeIcon () const
{
- return wxBitmap(bitmap_path("locations.png"), wxBITMAP_TYPE_PNG);
+ return wxBitmap(icon_path("locations"), wxBITMAP_TYPE_PNG);
}
#endif
diff --git a/src/wx/config_dialog.h b/src/wx/config_dialog.h
index c767929f7..a258e1fe2 100644
--- a/src/wx/config_dialog.h
+++ b/src/wx/config_dialog.h
@@ -88,7 +88,7 @@ public:
#ifdef DCPOMATIC_OSX
wxBitmap GetLargeIcon () const override
{
- return wxBitmap(bitmap_path("general.png"), wxBITMAP_TYPE_PNG);
+ return wxBitmap(icon_path("general"), wxBITMAP_TYPE_PNG);
}
#endif
@@ -166,7 +166,7 @@ public:
#ifdef DCPOMATIC_OSX
wxBitmap GetLargeIcon () const override
{
- return wxBitmap(bitmap_path("keys.png"), wxBITMAP_TYPE_PNG);
+ return wxBitmap(icon_path("keys"), wxBITMAP_TYPE_PNG);
}
#endif
@@ -197,7 +197,7 @@ public:
#ifdef DCPOMATIC_OSX
wxBitmap GetLargeIcon () const override
{
- return wxBitmap(bitmap_path("sound.png"), wxBITMAP_TYPE_PNG);
+ return wxBitmap(icon_path("sound"), wxBITMAP_TYPE_PNG);
}
#endif
diff --git a/src/wx/full_config_dialog.cc b/src/wx/full_config_dialog.cc
index 40cb0c285..1aeacd3ca 100644
--- a/src/wx/full_config_dialog.cc
+++ b/src/wx/full_config_dialog.cc
@@ -257,7 +257,7 @@ public:
#ifdef DCPOMATIC_OSX
wxBitmap GetLargeIcon () const override
{
- return wxBitmap(bitmap_path("defaults.png"), wxBITMAP_TYPE_PNG);
+ return wxBitmap(icon_path("defaults"), wxBITMAP_TYPE_PNG);
}
#endif
@@ -615,7 +615,7 @@ public:
#ifdef DCPOMATIC_OSX
wxBitmap GetLargeIcon () const override
{
- return wxBitmap(bitmap_path("servers.png"), wxBITMAP_TYPE_PNG);
+ return wxBitmap(icon_path("servers"), wxBITMAP_TYPE_PNG);
}
#endif
@@ -678,7 +678,7 @@ public:
#ifdef DCPOMATIC_OSX
wxBitmap GetLargeIcon () const override
{
- return wxBitmap(bitmap_path("tms.png"), wxBITMAP_TYPE_PNG);
+ return wxBitmap(icon_path("tms"), wxBITMAP_TYPE_PNG);
}
#endif
@@ -789,7 +789,7 @@ public:
#ifdef DCPOMATIC_OSX
wxBitmap GetLargeIcon () const override
{
- return wxBitmap(bitmap_path("email.png"), wxBITMAP_TYPE_PNG);
+ return wxBitmap(icon_path("email"), wxBITMAP_TYPE_PNG);
}
#endif
@@ -961,7 +961,7 @@ public:
#ifdef DCPOMATIC_OSX
wxBitmap GetLargeIcon () const override
{
- return wxBitmap(bitmap_path("kdm_email.png"), wxBITMAP_TYPE_PNG);
+ return wxBitmap(icon_path("kdm_email"), wxBITMAP_TYPE_PNG);
}
#endif
@@ -1086,7 +1086,7 @@ public:
#ifdef DCPOMATIC_OSX
wxBitmap GetLargeIcon () const override
{
- return wxBitmap(bitmap_path("notifications.png"), wxBITMAP_TYPE_PNG);
+ return wxBitmap(icon_path("notifications"), wxBITMAP_TYPE_PNG);
}
#endif
@@ -1262,7 +1262,7 @@ public:
#ifdef DCPOMATIC_OSX
wxBitmap GetLargeIcon () const override
{
- return wxBitmap(bitmap_path("cover_sheet.png"), wxBITMAP_TYPE_PNG);
+ return wxBitmap(icon_path("cover_sheet"), wxBITMAP_TYPE_PNG);
}
#endif
@@ -1321,7 +1321,7 @@ public:
#ifdef DCPOMATIC_OSX
wxBitmap GetLargeIcon () const override
{
- return wxBitmap(bitmap_path("identifiers.png"), wxBITMAP_TYPE_PNG);
+ return wxBitmap(icon_path("identifiers"), wxBITMAP_TYPE_PNG);
}
#endif
@@ -1439,7 +1439,7 @@ public:
#ifdef DCPOMATIC_OSX
wxBitmap GetLargeIcon () const override
{
- return wxBitmap(bitmap_path("advanced.png"), wxBITMAP_TYPE_PNG);
+ return wxBitmap(icon_path("advanced"), wxBITMAP_TYPE_PNG);
}
#endif
diff --git a/src/wx/html_dialog.cc b/src/wx/html_dialog.cc
index 19c3aaf2a..c8138c8cd 100644
--- a/src/wx/html_dialog.cc
+++ b/src/wx/html_dialog.cc
@@ -52,6 +52,10 @@ HTMLDialog::HTMLDialog (wxWindow* parent, wxString title, wxString html, bool ok
h->SetPage (html);
sizer->Add (h, 1, wxEXPAND | wxALL, 6);
+ if (gui_is_dark()) {
+ h->SetHTMLBackgroundColour(*wxBLACK);
+ }
+
h->Bind (wxEVT_HTML_LINK_CLICKED, boost::bind(&HTMLDialog::link_clicked, this, _1));
SetSizer (sizer);
diff --git a/src/wx/timeline.cc b/src/wx/timeline.cc
index 6886daa42..a9372b6bb 100644
--- a/src/wx/timeline.cc
+++ b/src/wx/timeline.cc
@@ -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),
diff --git a/src/wx/timeline_dialog.cc b/src/wx/timeline_dialog.cc
index 91737f204..0d05e66d6 100644
--- a/src/wx/timeline_dialog.cc
+++ b/src/wx/timeline_dialog.cc
@@ -63,11 +63,11 @@ TimelineDialog::TimelineDialog(ContentPanel* cp, shared_ptr<Film> film, FilmView
{
auto sizer = new wxBoxSizer (wxVERTICAL);
- wxBitmap select (bitmap_path("select.png"), wxBITMAP_TYPE_PNG);
- wxBitmap zoom (bitmap_path("zoom.png"), wxBITMAP_TYPE_PNG);
- wxBitmap zoom_all (bitmap_path("zoom_all.png"), wxBITMAP_TYPE_PNG);
- wxBitmap snap (bitmap_path("snap.png"), wxBITMAP_TYPE_PNG);
- wxBitmap sequence (bitmap_path("sequence.png"), wxBITMAP_TYPE_PNG);
+ wxBitmap select(icon_path("select"), wxBITMAP_TYPE_PNG);
+ wxBitmap zoom(icon_path("zoom"), wxBITMAP_TYPE_PNG);
+ wxBitmap zoom_all(icon_path("zoom_all"), wxBITMAP_TYPE_PNG);
+ wxBitmap snap(icon_path("snap"), wxBITMAP_TYPE_PNG);
+ wxBitmap sequence(icon_path("sequence"), wxBITMAP_TYPE_PNG);
_toolbar = new wxToolBar (this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTB_HORIZONTAL);
_toolbar->SetMargins (4, 4);
diff --git a/src/wx/timeline_labels_view.cc b/src/wx/timeline_labels_view.cc
index 7075d4b7d..181adc5ca 100644
--- a/src/wx/timeline_labels_view.cc
+++ b/src/wx/timeline_labels_view.cc
@@ -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) {
diff --git a/src/wx/timeline_reels_view.cc b/src/wx/timeline_reels_view.cc
index 331f6580d..2ec8f9e82 100644
--- a/src/wx/timeline_reels_view.cc
+++ b/src/wx/timeline_reels_view.cc
@@ -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()) {
diff --git a/src/wx/timeline_time_axis_view.cc b/src/wx/timeline_time_axis_view.cc
index 023b42ec7..3b1b3cd99 100644
--- a/src/wx/timeline_time_axis_view.cc
+++ b/src/wx/timeline_time_axis_view.cc
@@ -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;
diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc
index 9d9d4c599..074f47d61 100644
--- a/src/wx/wx_util.cc
+++ b/src/wx/wx_util.cc
@@ -651,6 +651,13 @@ bitmap_path (string name)
}
+wxString
+icon_path(string name)
+{
+ return gui_is_dark() ? bitmap_path(String::compose("%1_white.png", name)) : bitmap_path(String::compose("%1_black.png", name));
+}
+
+
wxSize
small_button_size (wxWindow* parent, wxString text)
{
diff --git a/src/wx/wx_util.h b/src/wx/wx_util.h
index fb1a3a001..50fb7268f 100644
--- a/src/wx/wx_util.h
+++ b/src/wx/wx_util.h
@@ -119,6 +119,7 @@ extern double calculate_mark_interval (double start);
extern bool display_progress (wxString title, wxString task);
extern bool report_errors_from_last_job (wxWindow* parent);
extern wxString bitmap_path (std::string name);
+extern wxString icon_path(std::string name);
extern wxSize small_button_size (wxWindow* parent, wxString text);
extern bool gui_is_dark ();
extern double dpi_scale_factor (wxWindow* window);