#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>
_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));
{
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))));
}
}
} 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:
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 ()
{
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;
void setup_frame_rate_widget ();
void setup_container ();
void setup_dcp_name ();
- void setup_audio_channels_choice ();
int minimum_allowed_audio_channels () const;
/*
- 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.
#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>
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);
+}
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);