Fix message for high bitrate frames during verify.
[dcpomatic.git] / src / wx / audio_dialog.cc
index c64f64e31eb4104ce612f9ca24cd98d3212b66f1..714bf78e4e6c5c35b9e552dcf144ebb45b75f7e5 100644 (file)
@@ -30,6 +30,7 @@
 #include "lib/film.h"
 #include "lib/job_manager.h"
 #include "lib/maths_util.h"
+#include <dcp/filesystem.h>
 #include <libxml++/libxml++.h>
 #include <boost/filesystem.hpp>
 #include <iostream>
@@ -56,7 +57,7 @@ using namespace boost::placeholders;
  *  @param film Film we are using.
  *  @param content Content to analyse, or 0 to analyse all of the film's audio.
  */
-AudioDialog::AudioDialog (wxWindow* parent, shared_ptr<Film> film, weak_ptr<FilmViewer> viewer, shared_ptr<Content> content)
+AudioDialog::AudioDialog (wxWindow* parent, shared_ptr<Film> film, FilmViewer& viewer, shared_ptr<Content> content)
        : wxDialog (
                parent,
                wxID_ANY,
@@ -73,7 +74,6 @@ AudioDialog::AudioDialog (wxWindow* parent, shared_ptr<Film> film, weak_ptr<Film
 #endif
                )
        , _film (film)
-       , _viewer (viewer)
        , _content (content)
        , _channels (film->audio_channels ())
        , _plot (nullptr)
@@ -115,7 +115,7 @@ AudioDialog::AudioDialog (wxWindow* parent, shared_ptr<Film> film, weak_ptr<Film
                _channel_checkbox[i] = new CheckBox (this, std_to_wx(audio_channel_name(i)));
                _channel_checkbox[i]->SetForegroundColour(wxColour(_plot->colour(i)));
                right->Add (_channel_checkbox[i], 0, wxEXPAND | wxALL, 3);
-               _channel_checkbox[i]->Bind (wxEVT_CHECKBOX, boost::bind (&AudioDialog::channel_clicked, this, _1));
+               _channel_checkbox[i]->bind(&AudioDialog::channel_clicked, this, _1);
        }
 
        show_or_hide_channel_checkboxes ();
@@ -134,7 +134,7 @@ AudioDialog::AudioDialog (wxWindow* parent, shared_ptr<Film> film, weak_ptr<Film
        for (int i = 0; i < AudioPoint::COUNT; ++i) {
                _type_checkbox[i] = new CheckBox (this, types[i]);
                right->Add (_type_checkbox[i], 0, wxEXPAND | wxALL, 3);
-               _type_checkbox[i]->Bind (wxEVT_CHECKBOX, boost::bind (&AudioDialog::type_clicked, this, _1));
+               _type_checkbox[i]->bind(&AudioDialog::type_clicked, this, _1);
        }
 
        {
@@ -208,7 +208,7 @@ AudioDialog::try_to_load_analysis ()
        auto check = _content.lock();
 
        auto const path = film->audio_analysis_path (_playlist);
-       if (!boost::filesystem::exists (path)) {
+       if (!dcp::filesystem::exists(path)) {
                _plot->set_analysis (shared_ptr<AudioAnalysis> ());
                _analysis.reset ();
 
@@ -296,7 +296,7 @@ AudioDialog::analysis_finished ()
                return;
        }
 
-       if (!boost::filesystem::exists (film->audio_analysis_path (_playlist))) {
+       if (!dcp::filesystem::exists(film->audio_analysis_path(_playlist))) {
                /* We analysed and still nothing showed up, so maybe it was cancelled or it failed.
                   Give up.
                */
@@ -321,13 +321,13 @@ AudioDialog::channel_clicked (wxCommandEvent& ev)
 }
 
 void
-AudioDialog::film_change (ChangeType type, Film::Property p)
+AudioDialog::film_change(ChangeType type, FilmProperty p)
 {
        if (type != ChangeType::DONE) {
                return;
        }
 
-       if (p == Film::Property::AUDIO_CHANNELS) {
+       if (p == FilmProperty::AUDIO_CHANNELS) {
                auto film = _film.lock ();
                if (film) {
                        _channels = film->audio_channels ();
@@ -400,10 +400,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()) {
@@ -413,9 +416,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);
                }
        }