Change bitmap_path to take a full name with extension.
[dcpomatic.git] / src / wx / full_config_dialog.cc
index c13ec7ed0c8b678259566326466d87c00f16e3dd..bb804cae876c837951e387db26de934118c5a9be 100644 (file)
@@ -257,7 +257,7 @@ public:
 #ifdef DCPOMATIC_OSX
        wxBitmap GetLargeIcon () const override
        {
-               return wxBitmap(bitmap_path("defaults"), wxBITMAP_TYPE_PNG);
+               return wxBitmap(bitmap_path("defaults.png"), wxBITMAP_TYPE_PNG);
        }
 #endif
 
@@ -343,6 +343,14 @@ private:
                _kdm_type = new KDMChoice (_panel);
                table->Add (_kdm_type, 1, wxEXPAND);
 
+               add_label_to_sizer (table, _panel, _("Default KDM duration"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
+               _kdm_duration = new wxSpinCtrl (_panel);
+               _kdm_duration_unit = new wxChoice (_panel, wxID_ANY);
+               auto kdm_duration_sizer = new wxBoxSizer (wxHORIZONTAL);
+               kdm_duration_sizer->Add (_kdm_duration, 0, wxEXPAND | wxRIGHT, DCPOMATIC_SIZER_GAP);
+               kdm_duration_sizer->Add (_kdm_duration_unit, 0, wxEXPAND | wxRIGHT, DCPOMATIC_SIZER_GAP);
+               table->Add (kdm_duration_sizer, 1, wxEXPAND);
+
                table->Add (_use_isdcf_name_by_default = new CheckBox(_panel, _("Use ISDCF name by default")), 0, wxALIGN_CENTRE_VERTICAL);
 
                _still_length->SetRange (1, 3600);
@@ -351,6 +359,13 @@ private:
                _directory->Bind (wxEVT_DIRPICKER_CHANGED, boost::bind (&DefaultsPage::directory_changed, this));
                _kdm_directory->Bind (wxEVT_DIRPICKER_CHANGED, boost::bind (&DefaultsPage::kdm_directory_changed, this));
                _kdm_type->Bind (wxEVT_CHOICE, boost::bind(&DefaultsPage::kdm_type_changed, this));
+               _kdm_duration_unit->Append (_("days"));
+               _kdm_duration_unit->Append (_("weeks"));
+               _kdm_duration_unit->Append (_("months"));
+               _kdm_duration_unit->Append (_("years"));
+
+               _kdm_duration->Bind (wxEVT_SPINCTRL, boost::bind(&DefaultsPage::kdm_duration_changed, this));
+               _kdm_duration_unit->Bind (wxEVT_CHOICE, boost::bind(&DefaultsPage::kdm_duration_changed, this));
 
                _use_isdcf_name_by_default->Bind (wxEVT_CHECKBOX, boost::bind(&DefaultsPage::use_isdcf_name_by_default_changed, this));
 
@@ -436,9 +451,51 @@ private:
                        }
                }
 
+               checked_set (_kdm_duration, config->default_kdm_duration().duration);
+               switch (config->default_kdm_duration().unit) {
+                       case RoughDuration::Unit::DAYS:
+                               _kdm_duration->SetRange(1, 365);
+                               checked_set (_kdm_duration_unit, 0);
+                               break;
+                       case RoughDuration::Unit::WEEKS:
+                               _kdm_duration->SetRange(1, 52);
+                               checked_set (_kdm_duration_unit, 1);
+                               break;
+                       case RoughDuration::Unit::MONTHS:
+                               _kdm_duration->SetRange(1, 12);
+                               checked_set (_kdm_duration_unit, 2);
+                               break;
+                       case RoughDuration::Unit::YEARS:
+                               _kdm_duration->SetRange(1, 40);
+                               checked_set (_kdm_duration_unit, 3);
+                               break;
+               }
+
                setup_sensitivity ();
        }
 
+       void kdm_duration_changed ()
+       {
+               auto config = Config::instance();
+               auto duration = _kdm_duration->GetValue();
+               RoughDuration::Unit unit = RoughDuration::Unit::DAYS;
+               switch (_kdm_duration_unit->GetSelection()) {
+               case 0:
+                       unit = RoughDuration::Unit::DAYS;
+                       break;
+               case 1:
+                       unit = RoughDuration::Unit::WEEKS;
+                       break;
+               case 2:
+                       unit = RoughDuration::Unit::MONTHS;
+                       break;
+               case 3:
+                       unit = RoughDuration::Unit::YEARS;
+                       break;
+               }
+               config->set_default_kdm_duration (RoughDuration(duration, unit));
+       }
+
        void j2k_bandwidth_changed ()
        {
                Config::instance()->set_default_j2k_bandwidth (_j2k_bandwidth->GetValue() * 1000000);
@@ -531,6 +588,8 @@ private:
        wxDirPickerCtrl* _kdm_directory;
 #endif
        KDMChoice* _kdm_type;
+       wxSpinCtrl* _kdm_duration;
+       wxChoice* _kdm_duration_unit;
        wxCheckBox* _use_isdcf_name_by_default;
        wxChoice* _container;
        wxChoice* _dcp_content_type;
@@ -556,7 +615,7 @@ public:
 #ifdef DCPOMATIC_OSX
        wxBitmap GetLargeIcon () const override
        {
-               return wxBitmap(bitmap_path("servers"), wxBITMAP_TYPE_PNG);
+               return wxBitmap(bitmap_path("servers.png"), wxBITMAP_TYPE_PNG);
        }
 #endif
 
@@ -573,7 +632,9 @@ private:
                        columns,
                        boost::bind (&Config::servers, Config::instance()),
                        boost::bind (&Config::set_servers, Config::instance(), _1),
-                       boost::bind (&EncodingServersPage::server_column, this, _1)
+                       boost::bind (&EncodingServersPage::server_column, this, _1),
+                       false,
+                       EditableListButton::NEW | EditableListButton::EDIT | EditableListButton::REMOVE
                        );
 
                _panel->GetSizer()->Add (_servers_list, 1, wxEXPAND | wxALL, _border);
@@ -617,7 +678,7 @@ public:
 #ifdef DCPOMATIC_OSX
        wxBitmap GetLargeIcon () const override
        {
-               return wxBitmap(bitmap_path("tms"), wxBITMAP_TYPE_PNG);
+               return wxBitmap(bitmap_path("tms.png"), wxBITMAP_TYPE_PNG);
        }
 #endif
 
@@ -728,7 +789,7 @@ public:
 #ifdef DCPOMATIC_OSX
        wxBitmap GetLargeIcon () const override
        {
-               return wxBitmap(bitmap_path("email"), wxBITMAP_TYPE_PNG);
+               return wxBitmap(bitmap_path("email.png"), wxBITMAP_TYPE_PNG);
        }
 #endif
 
@@ -900,7 +961,7 @@ public:
 #ifdef DCPOMATIC_OSX
        wxBitmap GetLargeIcon () const override
        {
-               return wxBitmap(bitmap_path("kdm_email"), wxBITMAP_TYPE_PNG);
+               return wxBitmap(bitmap_path("kdm_email.png"), wxBITMAP_TYPE_PNG);
        }
 #endif
 
@@ -929,7 +990,10 @@ private:
                        bind (&Config::set_kdm_cc, Config::instance(), _1),
                        [] (string s, int) {
                                return s;
-                       });
+                       },
+                       true,
+                       EditableListButton::NEW | EditableListButton::EDIT | EditableListButton::REMOVE
+                       );
                table->Add (_cc, 1, wxEXPAND | wxALL);
 
                add_label_to_sizer (table, _panel, _("BCC address"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
@@ -1022,7 +1086,7 @@ public:
 #ifdef DCPOMATIC_OSX
        wxBitmap GetLargeIcon () const override
        {
-               return wxBitmap(bitmap_path("notifications"), wxBITMAP_TYPE_PNG);
+               return wxBitmap(bitmap_path("notifications.png"), wxBITMAP_TYPE_PNG);
        }
 #endif
 
@@ -1063,7 +1127,10 @@ private:
                        bind (&Config::set_notification_cc, Config::instance(), _1),
                        [] (string s, int) {
                                return s;
-                       });
+                       },
+                       true,
+                       EditableListButton::NEW | EditableListButton::EDIT | EditableListButton::REMOVE
+                       );
                table->Add (_cc, 1, wxEXPAND | wxALL);
 
                add_label_to_sizer (table, _panel, _("BCC address"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
@@ -1195,7 +1262,7 @@ public:
 #ifdef DCPOMATIC_OSX
        wxBitmap GetLargeIcon () const override
        {
-               return wxBitmap(bitmap_path("cover_sheet"), wxBITMAP_TYPE_PNG);
+               return wxBitmap(bitmap_path("cover_sheet.png"), wxBITMAP_TYPE_PNG);
        }
 #endif
 
@@ -1254,7 +1321,7 @@ public:
 #ifdef DCPOMATIC_OSX
        wxBitmap GetLargeIcon () const override
        {
-               return wxBitmap(bitmap_path("identifiers"), wxBITMAP_TYPE_PNG);
+               return wxBitmap(bitmap_path("identifiers.png"), wxBITMAP_TYPE_PNG);
        }
 #endif
 
@@ -1372,7 +1439,7 @@ public:
 #ifdef DCPOMATIC_OSX
        wxBitmap GetLargeIcon () const override
        {
-               return wxBitmap(bitmap_path("advanced"), wxBITMAP_TYPE_PNG);
+               return wxBitmap(bitmap_path("advanced.png"), wxBITMAP_TYPE_PNG);
        }
 #endif
 
@@ -1415,23 +1482,29 @@ private:
                table->AddSpacer (0);
 
                _allow_any_dcp_frame_rate = new CheckBox (_panel, _("Allow any DCP frame rate"));
-               table->Add (_allow_any_dcp_frame_rate, 1, wxEXPAND | wxALL);
+               table->Add (_allow_any_dcp_frame_rate, 1, wxEXPAND | wxLEFT, DCPOMATIC_SIZER_GAP);
                table->AddSpacer (0);
 
                _allow_any_container = new CheckBox (_panel, _("Allow full-frame and non-standard container ratios"));
-               table->Add (_allow_any_container, 1, wxEXPAND | wxALL);
-               table->AddSpacer (0);
-
-               restart = add_label_to_sizer (table, _panel, _("(restart DCP-o-matic to see all ratios)"), false);
+               table->Add (_allow_any_container, 1, wxEXPAND | wxLEFT, DCPOMATIC_SIZER_GAP);
+               restart = new StaticText (_panel, _("(restart DCP-o-matic to see all ratios)"));
+               table->Add (restart, 1, wxEXPAND | wxALL | wxALIGN_CENTRE_VERTICAL);
                restart->SetFont (font);
+
+               _allow_96khz_audio = new CheckBox (_panel, _("Allow creation of DCPs with 96kHz audio"));
+               table->Add (_allow_96khz_audio, 1, wxEXPAND | wxLEFT, DCPOMATIC_SIZER_GAP);
                table->AddSpacer (0);
 
+               _use_all_audio_channels = new CheckBox(_panel, _("Allow mapping to all audio channels"));
+               table->Add(_use_all_audio_channels, 1, wxEXPAND | wxLEFT, DCPOMATIC_SIZER_GAP);
+               table->AddSpacer(0);
+
                _show_experimental_audio_processors = new CheckBox (_panel, _("Show experimental audio processors"));
-               table->Add (_show_experimental_audio_processors, 1, wxEXPAND | wxALL);
+               table->Add (_show_experimental_audio_processors, 1, wxEXPAND | wxLEFT, DCPOMATIC_SIZER_GAP);
                table->AddSpacer (0);
 
                _only_servers_encode = new CheckBox (_panel, _("Only servers encode"));
-               table->Add (_only_servers_encode, 1, wxEXPAND | wxALL);
+               table->Add (_only_servers_encode, 1, wxEXPAND | wxLEFT, DCPOMATIC_SIZER_GAP);
                table->AddSpacer (0);
 
                {
@@ -1449,7 +1522,7 @@ private:
                        align->Add (format, 0, wxTOP, 2);
                        table->Add (align, 0, wxALIGN_RIGHT | wxRIGHT, DCPOMATIC_SIZER_GAP - 2);
 #else
-                       table->Add (format, 0, wxTOP | wxRIGHT | wxALIGN_TOP, DCPOMATIC_SIZER_GAP);
+                       table->Add (format, 0, wxTOP | wxLEFT | wxRIGHT | wxALIGN_TOP, DCPOMATIC_SIZER_GAP);
 #endif
                        dcp::NameFormat::Map titles;
                        titles['t'] = wx_to_std (_("type (cpl/pkl)"));
@@ -1468,7 +1541,7 @@ private:
                        align->Add (format, 0, wxTOP, 2);
                        table->Add (align, 0, wxALIGN_RIGHT | wxRIGHT, DCPOMATIC_SIZER_GAP - 2);
 #else
-                       table->Add (format, 0, wxTOP | wxRIGHT | wxALIGN_TOP, DCPOMATIC_SIZER_GAP);
+                       table->Add (format, 0, wxTOP | wxLEFT | wxRIGHT | wxALIGN_TOP, DCPOMATIC_SIZER_GAP);
 #endif
                        dcp::NameFormat::Map titles;
                        titles['t'] = wx_to_std (_("type (j2c/pcm/sub)"));
@@ -1528,6 +1601,8 @@ private:
                _video_display_mode->Bind (wxEVT_CHOICE, boost::bind(&AdvancedPage::video_display_mode_changed, this));
                _allow_any_dcp_frame_rate->Bind (wxEVT_CHECKBOX, boost::bind (&AdvancedPage::allow_any_dcp_frame_rate_changed, this));
                _allow_any_container->Bind (wxEVT_CHECKBOX, boost::bind (&AdvancedPage::allow_any_container_changed, this));
+               _allow_96khz_audio->Bind (wxEVT_CHECKBOX, boost::bind(&AdvancedPage::allow_96khz_audio_changed, this));
+               _use_all_audio_channels->Bind(wxEVT_CHECKBOX, boost::bind(&AdvancedPage::use_all_channels_changed, this));
                _show_experimental_audio_processors->Bind (wxEVT_CHECKBOX, boost::bind (&AdvancedPage::show_experimental_audio_processors_changed, this));
                _only_servers_encode->Bind (wxEVT_CHECKBOX, boost::bind (&AdvancedPage::only_servers_encode_changed, this));
                _frames_in_memory_multiplier->Bind (wxEVT_SPINCTRL, boost::bind(&AdvancedPage::frames_in_memory_multiplier_changed, this));
@@ -1563,6 +1638,8 @@ private:
                }
                checked_set (_allow_any_dcp_frame_rate, config->allow_any_dcp_frame_rate ());
                checked_set (_allow_any_container, config->allow_any_container ());
+               checked_set (_allow_96khz_audio, config->allow_96khz_audio());
+               checked_set (_use_all_audio_channels, config->use_all_audio_channels());
                checked_set (_show_experimental_audio_processors, config->show_experimental_audio_processors ());
                checked_set (_only_servers_encode, config->only_servers_encode ());
                checked_set (_log_general, config->log_types() & LogEntry::TYPE_GENERAL);
@@ -1610,6 +1687,16 @@ private:
                Config::instance()->set_allow_any_container(_allow_any_container->GetValue());
        }
 
+       void allow_96khz_audio_changed ()
+       {
+               Config::instance()->set_allow_96hhz_audio(_allow_96khz_audio->GetValue());
+       }
+
+       void use_all_channels_changed ()
+       {
+               Config::instance()->set_use_all_audio_channels(_use_all_audio_channels->GetValue());
+       }
+
        void show_experimental_audio_processors_changed ()
        {
                Config::instance()->set_show_experimental_audio_processors(_show_experimental_audio_processors->GetValue());
@@ -1678,6 +1765,8 @@ private:
        wxSpinCtrl* _frames_in_memory_multiplier = nullptr;
        wxCheckBox* _allow_any_dcp_frame_rate = nullptr;
        wxCheckBox* _allow_any_container = nullptr;
+       wxCheckBox* _allow_96khz_audio = nullptr;
+       wxCheckBox* _use_all_audio_channels = nullptr;
        wxCheckBox* _show_experimental_audio_processors = nullptr;
        wxCheckBox* _only_servers_encode = nullptr;
        NameFormatEditor* _dcp_metadata_filename_format = nullptr;