Add channel count hints to the default audio channel count preference,
authorCarl Hetherington <cth@carlh.net>
Fri, 15 Jul 2016 21:53:21 +0000 (22:53 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 15 Jul 2016 21:53:21 +0000 (22:53 +0100)
and remove the choice for default to zero channels.  Remove em-dash
from hints as it apparently does not render on Windows for some reason.

src/wx/config_dialog.cc
src/wx/dcp_panel.cc
src/wx/dcp_panel.h
src/wx/wx_util.cc
src/wx/wx_util.h

index e44ed879bbcd6895b527abc11c813d6a1c7f2e74..8b7cbdae5a7713eefcfb82ea7469685515e17558 100644 (file)
@@ -43,6 +43,7 @@
 #include "lib/exceptions.h"
 #include <dcp/exceptions.h>
 #include <dcp/certificate_chain.h>
+#include <dcp/raw_convert.h>
 #include <wx/stdpaths.h>
 #include <wx/preferences.h>
 #include <wx/spinctrl.h>
@@ -477,12 +478,7 @@ private:
                        _dcp_content_type->Append (std_to_wx (ct[i]->pretty_name ()));
                }
 
-               vector<pair<string, string> > items;
-               for (int i = 0; i <= 16; i += 2) {
-                       items.push_back (make_pair (raw_convert<string> (i), raw_convert<string> (i)));
-               }
-
-               checked_set (_dcp_audio_channels, items);
+               setup_audio_channels_choice (_dcp_audio_channels, 2);
 
                _dcp_content_type->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DefaultsPage::dcp_content_type_changed, this));
                _dcp_audio_channels->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DefaultsPage::dcp_audio_channels_changed, this));
@@ -539,7 +535,7 @@ private:
        {
                int const s = _dcp_audio_channels->GetSelection ();
                if (s != wxNOT_FOUND) {
-                       Config::instance()->set_default_dcp_audio_channels (s * 2);
+                       Config::instance()->set_default_dcp_audio_channels (dcp::raw_convert<int> (string_client_data (_dcp_audio_channels->GetClientObject (s))));
                }
        }
 
index 5b882763fd64deced4c83a9a4f6a1e9f950a8702..49595dfd75d2c91889a95d5100918426f68d6796 100644 (file)
@@ -404,7 +404,7 @@ DCPPanel::film_changed (int p)
                } else {
                        checked_set (_audio_processor, 0);
                }
-               setup_audio_channels_choice ();
+               setup_audio_channels_choice (_audio_channels, minimum_allowed_audio_channels ());
                film_changed (Film::AUDIO_CHANNELS);
                break;
        case Film::REEL_TYPE:
@@ -728,29 +728,6 @@ DCPPanel::minimum_allowed_audio_channels () const
        return min;
 }
 
-void
-DCPPanel::setup_audio_channels_choice ()
-{
-       vector<pair<string, string> > items;
-       for (int i = minimum_allowed_audio_channels(); i <= 16; i += 2) {
-               if (i == 2) {
-                       items.push_back (make_pair (wx_to_std (_("2 — stereo")), dcp::raw_convert<string> (i)));
-               } else if (i == 4) {
-                       items.push_back (make_pair (wx_to_std (_("4 — L/C/R/Lfe")), dcp::raw_convert<string> (i)));
-               } else if (i == 6) {
-                       items.push_back (make_pair (wx_to_std (_("6 — 5.1")), dcp::raw_convert<string> (i)));
-               } else if (i == 8) {
-                       items.push_back (make_pair (wx_to_std (_("8 — 5.1/HI/VI")), dcp::raw_convert<string> (i)));
-               } else if (i == 12) {
-                       items.push_back (make_pair (wx_to_std (_("12 — 7.1/HI/VI")), dcp::raw_convert<string> (i)));
-               } else {
-                       items.push_back (make_pair (dcp::raw_convert<string> (i), dcp::raw_convert<string> (i)));
-               }
-       }
-
-       checked_set (_audio_channels, items);
-}
-
 wxPanel *
 DCPPanel::make_audio_panel ()
 {
@@ -764,7 +741,7 @@ DCPPanel::make_audio_panel ()
 
        add_label_to_sizer (grid, panel, _("Channels"), true, wxGBPosition (r, 0));
        _audio_channels = new wxChoice (panel, wxID_ANY);
-       setup_audio_channels_choice ();
+       setup_audio_channels_choice (_audio_channels, minimum_allowed_audio_channels ());
        grid->Add (_audio_channels, wxGBPosition (r, 1));
        ++r;
 
index a6fab5d050b10cd027eebde390707b43cacb04e0..9209d3f9ba5197e64df993cb8b0885f9b87c7691 100644 (file)
@@ -79,7 +79,6 @@ private:
        void setup_frame_rate_widget ();
        void setup_container ();
        void setup_dcp_name ();
-       void setup_audio_channels_choice ();
 
        int minimum_allowed_audio_channels () const;
 
index 40e72543a7e374495057f8872c792b68f1ed71e8..e12443dd34bc7b27c147604f3828c9d95a3a4fa0 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -26,6 +26,7 @@
 #include "file_picker_ctrl.h"
 #include "lib/config.h"
 #include "lib/util.h"
+#include <dcp/raw_convert.h>
 #include <wx/spinctrl.h>
 #include <boost/thread.hpp>
 
@@ -357,3 +358,26 @@ time_to_timecode (DCPTime t, double fps)
        int const f = lrint (w * fps);
        return wxString::Format (wxT("%02d:%02d:%02d.%02d"), h, m, s, f);
 }
+
+void
+setup_audio_channels_choice (wxChoice* choice, int minimum)
+{
+       vector<pair<string, string> > items;
+       for (int i = minimum; i <= 16; i += 2) {
+               if (i == 2) {
+                       items.push_back (make_pair (wx_to_std (_("2 - stereo")), dcp::raw_convert<string> (i)));
+               } else if (i == 4) {
+                       items.push_back (make_pair (wx_to_std (_("4 - L/C/R/Lfe")), dcp::raw_convert<string> (i)));
+               } else if (i == 6) {
+                       items.push_back (make_pair (wx_to_std (_("6 - 5.1")), dcp::raw_convert<string> (i)));
+               } else if (i == 8) {
+                       items.push_back (make_pair (wx_to_std (_("8 - 5.1/HI/VI")), dcp::raw_convert<string> (i)));
+               } else if (i == 12) {
+                       items.push_back (make_pair (wx_to_std (_("12 - 7.1/HI/VI")), dcp::raw_convert<string> (i)));
+               } else {
+                       items.push_back (make_pair (dcp::raw_convert<string> (i), dcp::raw_convert<string> (i)));
+               }
+       }
+
+       checked_set (choice, items);
+}
index 54552e3cbc407d69b62893e1e6886bf4baa071b6..44a2a821252853cb54fb2527ea7167a4f317da29 100644 (file)
@@ -69,6 +69,7 @@ extern void dcpomatic_setup_i18n ();
 extern wxString context_translation (wxString);
 extern std::string string_client_data (wxClientData* o);
 extern wxString time_to_timecode (DCPTime t, double fps);
+extern void setup_audio_channels_choice (wxChoice* choice, int minimum);
 
 extern void checked_set (FilePickerCtrl* widget, boost::filesystem::path value);
 extern void checked_set (wxSpinCtrl* widget, int value);