diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-12-29 00:53:27 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-12-29 00:53:27 +0100 |
| commit | 9c20eca7eca7d1285756acc7b14e8c3d52baaa79 (patch) | |
| tree | 5f5f7e190ddcb3ab93508458a07846aa7841305b | |
| parent | 59ced56507cfa560d98912c5fe0c4362e56c8943 (diff) | |
Allow KDM output panel widgets to be created with specific parents.
| -rw-r--r-- | src/wx/kdm_output_panel.cc | 82 | ||||
| -rw-r--r-- | src/wx/kdm_output_panel.h | 3 | ||||
| -rw-r--r-- | src/wx/tall_kdm_output_panel.cc | 3 |
3 files changed, 54 insertions, 34 deletions
diff --git a/src/wx/kdm_output_panel.cc b/src/wx/kdm_output_panel.cc index 3548d4dee..3788c3fce 100644 --- a/src/wx/kdm_output_panel.cc +++ b/src/wx/kdm_output_panel.cc @@ -66,63 +66,50 @@ KDMOutputPanel::KDMOutputPanel (wxWindow* parent) , _forensic_mark_audio (true) , _forensic_mark_audio_up_to (12) { - _type = new KDMChoice (this); - _type->set(Config::instance()->default_kdm_type()); - _advanced = new Button(this, _("Advanced...")); - _annotation_text = new wxTextCtrl(this, wxID_ANY); - _container_name_format = new NameFormatEditor (this, Config::instance()->kdm_container_name_format(), dcp::NameFormat::Map(), dcp::NameFormat::Map(), ""); - dcp::NameFormat::Map titles; - titles['f'] = wx_to_std (_("film name")); - titles['c'] = wx_to_std (_("cinema")); - titles['s'] = wx_to_std (_("screen")); - titles['b'] = wx_to_std (_("from date/time")); - titles['e'] = wx_to_std (_("to date/time")); - dcp::NameFormat::Map ex; - ex['f'] = "Bambi"; - ex['c'] = "Lumière"; - ex['s'] = "Screen 1"; - ex['b'] = "2012/03/15 12:30"; - ex['e'] = "2012/03/22 02:30"; - _filename_format = new NameFormatEditor (this, Config::instance()->kdm_filename_format(), titles, ex, ".xml"); +} - _write_to = new CheckBox (this, _("Write to")); + +void +KDMOutputPanel::create_destination_widgets(wxWindow* parent) +{ + _write_to = new CheckBox(parent, _("Write to")); #ifdef DCPOMATIC_USE_OWN_PICKER - _folder = new DirPickerCtrl (this); + _folder = new DirPickerCtrl(parent); #else - _folder = new wxDirPickerCtrl (this, wxID_ANY, wxEmptyString, char_to_wx(wxDirSelectorPromptStr), wxDefaultPosition, wxSize (300, -1)); + _folder = new wxDirPickerCtrl(parent, wxID_ANY, wxEmptyString, char_to_wx(wxDirSelectorPromptStr), wxDefaultPosition, wxSize(300, -1)); #endif auto path = Config::instance()->default_kdm_directory(); if (path) { - _folder->SetPath (std_to_wx (path->string ())); + _folder->SetPath(std_to_wx(path->string())); } else { - _folder->SetPath (wxStandardPaths::Get().GetDocumentsDir()); + _folder->SetPath(wxStandardPaths::Get().GetDocumentsDir()); } - _write_flat = new wxRadioButton (this, wxID_ANY, _("Write all KDMs to the same folder"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP); - _write_folder = new wxRadioButton (this, wxID_ANY, _("Write a folder for each cinema's KDMs")); - _write_zip = new wxRadioButton (this, wxID_ANY, _("Write a ZIP file for each cinema's KDMs")); + _write_flat = new wxRadioButton(parent, wxID_ANY, _("Write all KDMs to the same folder"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP); + _write_folder = new wxRadioButton(parent, wxID_ANY, _("Write a folder for each cinema's KDMs")); + _write_zip = new wxRadioButton(parent, wxID_ANY, _("Write a ZIP file for each cinema's KDMs")); - _email = new CheckBox (this, _("Send by email")); - _add_email_addresses = new wxButton(this, wxID_ANY, _("Set additional email addresses...")); + _email = new CheckBox(parent, _("Send by email")); + _add_email_addresses = new wxButton(parent, wxID_ANY, _("Set additional email addresses...")); switch (Config::instance()->last_kdm_write_type().get_value_or(Config::KDM_WRITE_FLAT)) { case Config::KDM_WRITE_FLAT: - _write_flat->SetValue (true); + _write_flat->SetValue(true); break; case Config::KDM_WRITE_FOLDER: - _write_folder->SetValue (true); + _write_folder->SetValue(true); break; case Config::KDM_WRITE_ZIP: - _write_zip->SetValue (true); + _write_zip->SetValue(true); break; } - _write_to->SetValue (Config::instance()->write_kdms_to_disk()); - _email->SetValue (Config::instance()->email_kdms()); + _write_to->SetValue(Config::instance()->write_kdms_to_disk()); + _email->SetValue(Config::instance()->email_kdms()); _write_to->bind(&KDMOutputPanel::write_to_changed, this); _email->bind(&KDMOutputPanel::email_changed, this); @@ -130,7 +117,34 @@ KDMOutputPanel::KDMOutputPanel (wxWindow* parent) _write_flat->Bind (wxEVT_RADIOBUTTON, boost::bind (&KDMOutputPanel::kdm_write_type_changed, this)); _write_folder->Bind (wxEVT_RADIOBUTTON, boost::bind (&KDMOutputPanel::kdm_write_type_changed, this)); _write_zip->Bind (wxEVT_RADIOBUTTON, boost::bind (&KDMOutputPanel::kdm_write_type_changed, this)); - _advanced->Bind (wxEVT_BUTTON, boost::bind (&KDMOutputPanel::advanced_clicked, this)); +} + + +void +KDMOutputPanel::create_details_widgets(wxWindow* parent) +{ + _type = new KDMChoice(parent); + _type->set(Config::instance()->default_kdm_type()); + _advanced = new Button(parent, _("Advanced...")); + _annotation_text = new wxTextCtrl(parent, wxID_ANY); + + _container_name_format = new NameFormatEditor(parent, Config::instance()->kdm_container_name_format(), dcp::NameFormat::Map(), dcp::NameFormat::Map(), ""); + + dcp::NameFormat::Map titles; + titles['f'] = wx_to_std (_("film name")); + titles['c'] = wx_to_std (_("cinema")); + titles['s'] = wx_to_std (_("screen")); + titles['b'] = wx_to_std (_("from date/time")); + titles['e'] = wx_to_std (_("to date/time")); + dcp::NameFormat::Map ex; + ex['f'] = "Bambi"; + ex['c'] = "Lumière"; + ex['s'] = "Screen 1"; + ex['b'] = "2012/03/15 12:30"; + ex['e'] = "2012/03/22 02:30"; + _filename_format = new NameFormatEditor(parent, Config::instance()->kdm_filename_format(), titles, ex, ".xml"); + + _advanced->Bind(wxEVT_BUTTON, boost::bind (&KDMOutputPanel::advanced_clicked, this)); } diff --git a/src/wx/kdm_output_panel.h b/src/wx/kdm_output_panel.h index 447588fe7..dd4dbb1fc 100644 --- a/src/wx/kdm_output_panel.h +++ b/src/wx/kdm_output_panel.h @@ -75,6 +75,9 @@ public: boost::signals2::signal<void ()> MethodChanged; protected: + void create_destination_widgets(wxWindow* parent); + void create_details_widgets(wxWindow* parent); + KDMChoice* _type; wxTextCtrl* _annotation_text; NameFormatEditor* _container_name_format; diff --git a/src/wx/tall_kdm_output_panel.cc b/src/wx/tall_kdm_output_panel.cc index 1fb5cd958..d0bb3d7dd 100644 --- a/src/wx/tall_kdm_output_panel.cc +++ b/src/wx/tall_kdm_output_panel.cc @@ -63,6 +63,9 @@ using namespace boost::placeholders; TallKDMOutputPanel::TallKDMOutputPanel(wxWindow* parent) : KDMOutputPanel(parent) { + create_destination_widgets(this); + create_details_widgets(this); + auto table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, 0); table->AddGrowableCol (1); |
