summaryrefslogtreecommitdiff
path: root/src/wx
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-04-04 20:55:08 +0200
committerCarl Hetherington <cth@carlh.net>2021-04-04 20:55:08 +0200
commit0aabb6497979e2df9731f8753645149d85c02bc8 (patch)
tree93b536f42f019b516e2ddd7eaf5c8291d08580cd /src/wx
parent8e1b0dfe3103867a749ff51156e3ed6547f298a0 (diff)
parent1c1cf56ec8982690afa5d9463d3bb76bc9c4081d (diff)
Remove the ISDCF metadata dialogue box (#1929).
We obtain its information from elsewhere: mostly the Interop/SMPTE metadata dialogue box.
Diffstat (limited to 'src/wx')
-rw-r--r--src/wx/dcp_panel.cc49
-rw-r--r--src/wx/dcp_panel.h2
-rw-r--r--src/wx/full_config_dialog.cc16
-rw-r--r--src/wx/full_language_tag_dialog.cc2
-rw-r--r--src/wx/interop_metadata_dialog.cc50
-rw-r--r--src/wx/interop_metadata_dialog.h9
-rw-r--r--src/wx/isdcf_metadata_dialog.cc113
-rw-r--r--src/wx/isdcf_metadata_dialog.h47
-rw-r--r--src/wx/language_tag_dialog.cc8
-rw-r--r--src/wx/metadata_dialog.cc387
-rw-r--r--src/wx/metadata_dialog.h95
-rw-r--r--src/wx/player_config_dialog.cc1
-rw-r--r--src/wx/smpte_metadata_dialog.cc230
-rw-r--r--src/wx/smpte_metadata_dialog.h37
-rw-r--r--src/wx/wscript2
15 files changed, 557 insertions, 491 deletions
diff --git a/src/wx/dcp_panel.cc b/src/wx/dcp_panel.cc
index 8501eae9c..302ed4184 100644
--- a/src/wx/dcp_panel.cc
+++ b/src/wx/dcp_panel.cc
@@ -20,7 +20,6 @@
#include "dcp_panel.h"
#include "wx_util.h"
-#include "isdcf_metadata_dialog.h"
#include "audio_dialog.h"
#include "focus_manager.h"
#include "check_box.h"
@@ -85,7 +84,6 @@ DCPPanel::DCPPanel (wxNotebook* n, shared_ptr<Film> film, weak_ptr<FilmViewer> v
FocusManager::instance()->add(_name);
_use_isdcf_name = new CheckBox (_panel, _("Use ISDCF name"));
- _edit_isdcf_button = new Button (_panel, _("Details..."));
_copy_isdcf_name_button = new Button (_panel, _("Copy as name"));
/* wxST_ELLIPSIZE_MIDDLE works around a bug in GTK2 and/or wxWidgets, see
@@ -126,7 +124,6 @@ DCPPanel::DCPPanel (wxNotebook* n, shared_ptr<Film> film, weak_ptr<FilmViewer> v
_name->Bind (wxEVT_TEXT, boost::bind (&DCPPanel::name_changed, this));
_use_isdcf_name->Bind (wxEVT_CHECKBOX, boost::bind (&DCPPanel::use_isdcf_name_toggled, this));
- _edit_isdcf_button->Bind (wxEVT_BUTTON, boost::bind (&DCPPanel::edit_isdcf_button_clicked, this));
_copy_isdcf_name_button->Bind(wxEVT_BUTTON, boost::bind (&DCPPanel::copy_isdcf_name_button_clicked, this));
_dcp_content_type->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::dcp_content_type_changed, this));
_encrypted->Bind (wxEVT_CHECKBOX, boost::bind (&DCPPanel::encrypted_toggled, this));
@@ -162,8 +159,8 @@ DCPPanel::add_to_grid ()
auto name_sizer = new wxBoxSizer (wxHORIZONTAL);
name_sizer->Add (_name_label, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_X_GAP);
- name_sizer->Add (_name, 1, wxALIGN_CENTER_VERTICAL);
- _grid->Add (name_sizer, wxGBPosition(r, 0), wxGBSpan(1, 2), wxEXPAND);
+ name_sizer->Add (_name, 1, wxRIGHT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_X_GAP);
+ _grid->Add (name_sizer, wxGBPosition(r, 0), wxGBSpan(1, 2), wxRIGHT | wxEXPAND, DCPOMATIC_DIALOG_BORDER);
++r;
int flags = wxALIGN_CENTER_VERTICAL;
@@ -173,14 +170,13 @@ DCPPanel::add_to_grid ()
_grid->Add (_use_isdcf_name, wxGBPosition (r, 0), wxDefaultSpan, flags);
{
- wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
- s->Add (_edit_isdcf_button, 1, wxEXPAND | wxRIGHT, DCPOMATIC_SIZER_X_GAP);
- s->Add (_copy_isdcf_name_button, 1, wxEXPAND | wxLEFT, DCPOMATIC_SIZER_X_GAP);
+ auto s = new wxBoxSizer (wxHORIZONTAL);
+ s->Add (_copy_isdcf_name_button, 0, wxLEFT, DCPOMATIC_SIZER_X_GAP);
_grid->Add (s, wxGBPosition (r, 1), wxDefaultSpan, wxEXPAND);
}
++r;
- _grid->Add (_dcp_name, wxGBPosition(r, 0), wxGBSpan (1, 2), wxALIGN_CENTER_VERTICAL | wxEXPAND);
+ _grid->Add (_dcp_name, wxGBPosition(r, 0), wxGBSpan(1, 2), wxALIGN_CENTER_VERTICAL);
++r;
add_label_to_sizer (_grid, _dcp_content_type_label, true, wxGBPosition (r, 0));
@@ -323,6 +319,7 @@ DCPPanel::metadata_clicked ()
}
_interop_metadata_dialog = new InteropMetadataDialog (_panel, _film);
+ _interop_metadata_dialog->setup ();
_interop_metadata_dialog->Show ();
} else {
if (_smpte_metadata_dialog) {
@@ -331,6 +328,7 @@ DCPPanel::metadata_clicked ()
}
_smpte_metadata_dialog = new SMPTEMetadataDialog (_panel, _film);
+ _smpte_metadata_dialog->setup ();
_smpte_metadata_dialog->Show ();
}
}
@@ -377,12 +375,8 @@ DCPPanel::film_changed (Film::Property p)
}
}
setup_dcp_name ();
- _edit_isdcf_button->Enable (_film->use_isdcf_name ());
break;
}
- case Film::Property::ISDCF_METADATA:
- setup_dcp_name ();
- break;
case Film::Property::VIDEO_FRAME_RATE:
{
bool done = false;
@@ -444,6 +438,20 @@ DCPPanel::film_changed (Film::Property p)
setup_dcp_name ();
setup_sensitivity ();
break;
+ case Film::Property::CONTENT_VERSIONS:
+ case Film::Property::VERSION_NUMBER:
+ case Film::Property::RELEASE_TERRITORY:
+ case Film::Property::RATINGS:
+ case Film::Property::FACILITY:
+ case Film::Property::STUDIO:
+ case Film::Property::TEMP_VERSION:
+ case Film::Property::PRE_RELEASE:
+ case Film::Property::RED_BAND:
+ case Film::Property::TWO_D_VERSION_OF_THREE_D:
+ case Film::Property::CHAIN:
+ case Film::Property::LUMINANCE:
+ setup_dcp_name ();
+ break;
default:
break;
}
@@ -560,7 +568,6 @@ DCPPanel::set_film (shared_ptr<Film> film)
film_changed (Film::Property::RESOLUTION);
film_changed (Film::Property::ENCRYPTED);
film_changed (Film::Property::J2K_BANDWIDTH);
- film_changed (Film::Property::ISDCF_METADATA);
film_changed (Film::Property::VIDEO_FRAME_RATE);
film_changed (Film::Property::AUDIO_CHANNELS);
film_changed (Film::Property::SEQUENCE);
@@ -586,7 +593,6 @@ DCPPanel::setup_sensitivity ()
{
_name->Enable (_generally_sensitive);
_use_isdcf_name->Enable (_generally_sensitive);
- _edit_isdcf_button->Enable (_generally_sensitive);
_dcp_content_type->Enable (_generally_sensitive);
_copy_isdcf_name_button->Enable (_generally_sensitive);
_encrypted->Enable (_generally_sensitive);
@@ -633,19 +639,6 @@ DCPPanel::use_isdcf_name_toggled ()
}
void
-DCPPanel::edit_isdcf_button_clicked ()
-{
- if (!_film) {
- return;
- }
-
- auto d = new ISDCFMetadataDialog (_panel, _film->isdcf_metadata (), _film->three_d ());
- d->ShowModal ();
- _film->set_isdcf_metadata (d->isdcf_metadata ());
- d->Destroy ();
-}
-
-void
DCPPanel::setup_dcp_name ()
{
_dcp_name->SetLabel (std_to_wx (_film->dcp_name (true)));
diff --git a/src/wx/dcp_panel.h b/src/wx/dcp_panel.h
index 9b362a26c..a076e4bb4 100644
--- a/src/wx/dcp_panel.h
+++ b/src/wx/dcp_panel.h
@@ -64,7 +64,6 @@ public:
private:
void name_changed ();
void use_isdcf_name_toggled ();
- void edit_isdcf_button_clicked ();
void copy_isdcf_name_button_clicked ();
void container_changed ();
void dcp_content_type_changed ();
@@ -118,7 +117,6 @@ private:
wxStaticText* _container_label;
wxChoice* _container;
wxStaticText* _container_size;
- wxButton* _edit_isdcf_button;
wxButton* _copy_isdcf_name_button;
wxStaticText* _j2k_bandwidth_label;
wxStaticText* _mbits_label;
diff --git a/src/wx/full_config_dialog.cc b/src/wx/full_config_dialog.cc
index 3b07c7765..962295528 100644
--- a/src/wx/full_config_dialog.cc
+++ b/src/wx/full_config_dialog.cc
@@ -28,7 +28,6 @@
#include "filter_dialog.h"
#include "dir_picker_ctrl.h"
#include "file_picker_ctrl.h"
-#include "isdcf_metadata_dialog.h"
#include "server_dialog.h"
#include "make_chain_dialog.h"
#include "email_dialog.h"
@@ -275,10 +274,6 @@ private:
#endif
table->Add (_directory, 1, wxEXPAND);
- add_label_to_sizer (table, _panel, _("Default ISDCF name details"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
- _isdcf_metadata_button = new Button (_panel, _("Edit..."));
- table->Add (_isdcf_metadata_button);
-
add_label_to_sizer (table, _panel, _("Default container"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
_container = new wxChoice (_panel, wxID_ANY);
table->Add (_container);
@@ -328,8 +323,6 @@ 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));
- _isdcf_metadata_button->Bind (wxEVT_BUTTON, boost::bind (&DefaultsPage::edit_isdcf_metadata_clicked, this));
-
for (auto i: Ratio::containers()) {
_container->Append (std_to_wx(i->container_nickname()));
}
@@ -414,14 +407,6 @@ private:
Config::instance()->set_default_kdm_directory (wx_to_std (_kdm_directory->GetPath ()));
}
- void edit_isdcf_metadata_clicked ()
- {
- ISDCFMetadataDialog* d = new ISDCFMetadataDialog (_panel, Config::instance()->default_isdcf_metadata (), false);
- d->ShowModal ();
- Config::instance()->set_default_isdcf_metadata (d->isdcf_metadata ());
- d->Destroy ();
- }
-
void still_length_changed ()
{
Config::instance()->set_default_still_length (_still_length->GetValue ());
@@ -446,7 +431,6 @@ private:
wxSpinCtrl* _j2k_bandwidth;
wxSpinCtrl* _audio_delay;
- wxButton* _isdcf_metadata_button;
wxSpinCtrl* _still_length;
#ifdef DCPOMATIC_USE_OWN_PICKER
DirPickerCtrl* _directory;
diff --git a/src/wx/full_language_tag_dialog.cc b/src/wx/full_language_tag_dialog.cc
index 2b3aeb7de..a26dcc0bb 100644
--- a/src/wx/full_language_tag_dialog.cc
+++ b/src/wx/full_language_tag_dialog.cc
@@ -173,7 +173,7 @@ private:
{
auto search = _search->GetValue();
_list->set_search (search.ToStdString());
- if (search.Length() > 0) {
+ if (search.Length() > 0 && _list->GetItemCount() > 0) {
_list->EnsureVisible (0);
}
SearchChanged (_search->GetValue().ToStdString());
diff --git a/src/wx/interop_metadata_dialog.cc b/src/wx/interop_metadata_dialog.cc
index aa61984b3..61aa23498 100644
--- a/src/wx/interop_metadata_dialog.cc
+++ b/src/wx/interop_metadata_dialog.cc
@@ -38,24 +38,22 @@ using namespace boost::placeholders;
InteropMetadataDialog::InteropMetadataDialog (wxWindow* parent, weak_ptr<Film> film)
- : wxDialog (parent, wxID_ANY, _("Metadata"))
- , _film (film)
+ : MetadataDialog (parent, film)
{
- auto overall_sizer = new wxBoxSizer (wxVERTICAL);
- SetSizer (overall_sizer);
- auto sizer = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
- sizer->AddGrowableCol (1, 1);
+}
- auto f = _film.lock();
- DCPOMATIC_ASSERT (f);
+void
+InteropMetadataDialog::setup_standard (wxPanel* panel, wxSizer* sizer)
+{
+ MetadataDialog::setup_standard (panel, sizer);
{
int flags = wxALIGN_TOP | wxLEFT | wxRIGHT | wxTOP;
#ifdef __WXOSX__
flags |= wxALIGN_RIGHT;
#endif
- auto m = create_label (this, _("Ratings"), true);
+ auto m = create_label (panel, _("Ratings"), true);
sizer->Add (m, 0, flags, DCPOMATIC_SIZER_GAP);
}
@@ -63,7 +61,7 @@ InteropMetadataDialog::InteropMetadataDialog (wxWindow* parent, weak_ptr<Film> f
columns.push_back (EditableListColumn(_("Agency"), 200, true));
columns.push_back (EditableListColumn(_("Label"), 50, true));
_ratings = new EditableList<dcp::Rating, RatingDialog> (
- this,
+ panel,
columns,
boost::bind(&InteropMetadataDialog::ratings, this),
boost::bind(&InteropMetadataDialog::set_ratings, this, _1),
@@ -78,23 +76,13 @@ InteropMetadataDialog::InteropMetadataDialog (wxWindow* parent, weak_ptr<Film> f
);
sizer->Add (_ratings, 1, wxEXPAND);
- add_label_to_sizer (sizer, this, _("Content version"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL);
- _content_version = new wxTextCtrl (this, wxID_ANY);
+ add_label_to_sizer (sizer, panel, _("Content version"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL);
+ _content_version = new wxTextCtrl (panel, wxID_ANY);
sizer->Add (_content_version, 1, wxEXPAND);
- auto cv = f->content_versions();
+ auto cv = film()->content_versions();
_content_version->SetValue (std_to_wx(cv.empty() ? "" : cv[0]));
- overall_sizer->Add (sizer, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER);
-
- auto buttons = CreateSeparatedButtonSizer (wxCLOSE);
- if (buttons) {
- overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
- }
-
- overall_sizer->Layout ();
- overall_sizer->SetSizeHints (this);
-
_content_version->Bind (wxEVT_TEXT, boost::bind(&InteropMetadataDialog::content_version_changed, this));
_content_version->SetFocus ();
}
@@ -103,25 +91,19 @@ InteropMetadataDialog::InteropMetadataDialog (wxWindow* parent, weak_ptr<Film> f
vector<dcp::Rating>
InteropMetadataDialog::ratings () const
{
- auto film = _film.lock ();
- DCPOMATIC_ASSERT (film);
- return film->ratings ();
+ return film()->ratings ();
}
+
void
InteropMetadataDialog::set_ratings (vector<dcp::Rating> r)
{
- auto film = _film.lock ();
- DCPOMATIC_ASSERT (film);
- film->set_ratings (r);
+ film()->set_ratings (r);
}
+
void
InteropMetadataDialog::content_version_changed ()
{
- auto film = _film.lock ();
- DCPOMATIC_ASSERT (film);
- vector<string> cv;
- cv.push_back (wx_to_std(_content_version->GetValue()));
- film->set_content_versions (cv);
+ film()->set_content_versions ({ wx_to_std(_content_version->GetValue()) });
}
diff --git a/src/wx/interop_metadata_dialog.h b/src/wx/interop_metadata_dialog.h
index b8a1a36e6..b730c1238 100644
--- a/src/wx/interop_metadata_dialog.h
+++ b/src/wx/interop_metadata_dialog.h
@@ -20,6 +20,7 @@
#include "editable_list.h"
+#include "metadata_dialog.h"
#include <dcp/language_tag.h>
#include <dcp/types.h>
#include <wx/wx.h>
@@ -31,17 +32,19 @@ class LanguageTagWidget;
class RatingDialog;
-class InteropMetadataDialog : public wxDialog
+class InteropMetadataDialog : public MetadataDialog
{
public:
InteropMetadataDialog (wxWindow* parent, std::weak_ptr<Film> film);
private:
- std::vector<dcp::Rating> ratings () const;
+ void setup_standard (wxPanel* panel, wxSizer* sizer) override;
+
void set_ratings (std::vector<dcp::Rating> r);
void content_version_changed ();
- std::weak_ptr<Film> _film;
+ std::vector<dcp::Rating> ratings () const;
+
EditableList<dcp::Rating, RatingDialog>* _ratings;
wxTextCtrl* _content_version;
};
diff --git a/src/wx/isdcf_metadata_dialog.cc b/src/wx/isdcf_metadata_dialog.cc
deleted file mode 100644
index 2fde930c6..000000000
--- a/src/wx/isdcf_metadata_dialog.cc
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net>
-
- This file is part of DCP-o-matic.
-
- DCP-o-matic is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- DCP-o-matic is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#include "isdcf_metadata_dialog.h"
-#include "wx_util.h"
-#include "check_box.h"
-#include "lib/film.h"
-#include <wx/wx.h>
-#include <wx/sizer.h>
-#include <wx/spinctrl.h>
-
-using std::shared_ptr;
-
-/** @param parent Parent window.
- * @param dm Initial ISDCF metadata.
- * @param threed true if the film is in 3D.
- */
-ISDCFMetadataDialog::ISDCFMetadataDialog (wxWindow* parent, ISDCFMetadata dm, bool threed)
- : TableDialog (parent, _("ISDCF name"), 2, 1, true)
-{
- add (_("Content version"), true);
- _content_version = add (new wxSpinCtrl (this, wxID_ANY));
-
- add (_("Territory (e.g. UK)"), true);
- _territory = add (new wxTextCtrl (this, wxID_ANY));
-
- add (_("Rating (e.g. 15)"), true);
- _rating = add (new wxTextCtrl (this, wxID_ANY));
-
- add (_("Studio (e.g. TCF)"), true);
- _studio = add (new wxTextCtrl (this, wxID_ANY));
-
- add (_("Facility (e.g. DLA)"), true);
- _facility = add (new wxTextCtrl (this, wxID_ANY));
-
- _temp_version = add (new CheckBox(this, _("Temp version")));
- add_spacer ();
-
- _pre_release = add (new CheckBox(this, _("Pre-release")));
- add_spacer ();
-
- _red_band = add (new CheckBox(this, _("Red band")));
- add_spacer ();
-
- add (_("Chain"), true);
- _chain = add (new wxTextCtrl (this, wxID_ANY));
-
- _two_d_version_of_three_d = add (new CheckBox(this, _("2D version of content available in 3D")));
- add_spacer ();
-
- if (threed) {
- _two_d_version_of_three_d->Enable (false);
- }
-
- add (_("Mastered luminance (e.g. 14fl)"), true);
- _mastered_luminance = add (new wxTextCtrl (this, wxID_ANY));
-
- _content_version->SetRange (1, 1024);
-
- _content_version->SetValue (dm.content_version);
- _territory->SetValue (std_to_wx (dm.territory));
- _rating->SetValue (std_to_wx (dm.rating));
- _studio->SetValue (std_to_wx (dm.studio));
- _facility->SetValue (std_to_wx (dm.facility));
- _temp_version->SetValue (dm.temp_version);
- _pre_release->SetValue (dm.pre_release);
- _red_band->SetValue (dm.red_band);
- _chain->SetValue (std_to_wx (dm.chain));
- _two_d_version_of_three_d->SetValue (dm.two_d_version_of_three_d);
- _mastered_luminance->SetValue (std_to_wx (dm.mastered_luminance));
-
- layout ();
-
- _content_version->SetFocus ();
-}
-
-
-ISDCFMetadata
-ISDCFMetadataDialog::isdcf_metadata () const
-{
- ISDCFMetadata dm;
-
- dm.content_version = _content_version->GetValue ();
- dm.territory = wx_to_std (_territory->GetValue ());
- dm.rating = wx_to_std (_rating->GetValue ());
- dm.studio = wx_to_std (_studio->GetValue ());
- dm.facility = wx_to_std (_facility->GetValue ());
- dm.temp_version = _temp_version->GetValue ();
- dm.pre_release = _pre_release->GetValue ();
- dm.red_band = _red_band->GetValue ();
- dm.chain = wx_to_std (_chain->GetValue ());
- dm.two_d_version_of_three_d = _two_d_version_of_three_d->GetValue ();
- dm.mastered_luminance = wx_to_std (_mastered_luminance->GetValue ());
-
- return dm;
-}
diff --git a/src/wx/isdcf_metadata_dialog.h b/src/wx/isdcf_metadata_dialog.h
deleted file mode 100644
index 778009551..000000000
--- a/src/wx/isdcf_metadata_dialog.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net>
-
- This file is part of DCP-o-matic.
-
- DCP-o-matic is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- DCP-o-matic is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#include "table_dialog.h"
-#include "lib/isdcf_metadata.h"
-#include <wx/textctrl.h>
-
-class wxSpinCtrl;
-class Film;
-
-class ISDCFMetadataDialog : public TableDialog
-{
-public:
- ISDCFMetadataDialog (wxWindow *, ISDCFMetadata, bool threed);
-
- ISDCFMetadata isdcf_metadata () const;
-
-private:
- wxSpinCtrl* _content_version;
- wxTextCtrl* _territory;
- wxTextCtrl* _rating;
- wxTextCtrl* _studio;
- wxTextCtrl* _facility;
- wxCheckBox* _temp_version;
- wxCheckBox* _pre_release;
- wxCheckBox* _red_band;
- wxTextCtrl* _chain;
- wxCheckBox* _two_d_version_of_three_d;
- wxTextCtrl* _mastered_luminance;
-};
diff --git a/src/wx/language_tag_dialog.cc b/src/wx/language_tag_dialog.cc
index c72c64b31..ca08996c6 100644
--- a/src/wx/language_tag_dialog.cc
+++ b/src/wx/language_tag_dialog.cc
@@ -116,7 +116,9 @@ LanguageTagDialog::set (dcp::LanguageTag tag)
_custom.push_back (tag);
selection = _presets.size() + _custom.size() - 1;
populate_list ();
- _list->EnsureVisible (_list->GetItemCount() - 1);
+ if (_list->GetItemCount() > 0) {
+ _list->EnsureVisible (_list->GetItemCount() - 1);
+ }
} else {
selection = _presets.size() + std::distance(_custom.begin(), iter);
}
@@ -125,7 +127,9 @@ LanguageTagDialog::set (dcp::LanguageTag tag)
}
_list->SetItemState (selection, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
- _list->EnsureVisible (selection);
+ if (static_cast<int>(selection) < _list->GetItemCount()) {
+ _list->EnsureVisible (selection);
+ }
}
diff --git a/src/wx/metadata_dialog.cc b/src/wx/metadata_dialog.cc
new file mode 100644
index 000000000..c0e543b34
--- /dev/null
+++ b/src/wx/metadata_dialog.cc
@@ -0,0 +1,387 @@
+/*
+ Copyright (C) 2021 Carl Hetherington <cth@carlh.net>
+
+ This file is part of DCP-o-matic.
+
+ DCP-o-matic is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ DCP-o-matic is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+
+#include "dcpomatic_button.h"
+#include "full_language_tag_dialog.h"
+#include "metadata_dialog.h"
+#include "wx_util.h"
+#include "lib/film.h"
+#include <boost/bind.hpp>
+#include <boost/weak_ptr.hpp>
+#include <wx/notebook.h>
+#include <wx/spinctrl.h>
+#include <wx/wx.h>
+
+
+using std::weak_ptr;
+
+
+MetadataDialog::MetadataDialog (wxWindow* parent, weak_ptr<Film> weak_film)
+ : wxDialog (parent, wxID_ANY, _("Metadata"))
+ , WeakFilm (weak_film)
+{
+
+}
+
+
+void
+MetadataDialog::setup ()
+{
+ auto notebook = new wxNotebook (this, wxID_ANY);
+
+ auto prepare = [notebook](std::function<void (wxPanel*, wxSizer*)> setup, wxString name) {
+ auto panel = new wxPanel (notebook, wxID_ANY);
+ auto sizer = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
+ sizer->AddGrowableCol (1, 1);
+ setup (panel, sizer);
+ auto overall_sizer = new wxBoxSizer (wxVERTICAL);
+ overall_sizer->Add (sizer, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER);
+ panel->SetSizer (overall_sizer);
+ notebook->AddPage (panel, name);
+ };
+
+ prepare (boost::bind(&MetadataDialog::setup_standard, this, _1, _2), _("Standard"));
+ prepare (boost::bind(&MetadataDialog::setup_advanced, this, _1, _2), _("Advanced"));
+
+ auto overall_sizer = new wxBoxSizer (wxVERTICAL);
+ overall_sizer->Add (notebook, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER);
+
+ auto buttons = CreateSeparatedButtonSizer (wxCLOSE);
+ if (buttons) {
+ overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
+ }
+
+ SetSizer (overall_sizer);
+ overall_sizer->Layout ();
+ overall_sizer->SetSizeHints (this);
+
+ _edit_release_territory->Bind (wxEVT_BUTTON, boost::bind(&MetadataDialog::edit_release_territory, this));
+ _enable_release_territory->Bind (wxEVT_CHECKBOX, boost::bind(&MetadataDialog::enable_release_territory_changed, this));
+ _enable_facility->Bind (wxEVT_CHECKBOX, boost::bind(&MetadataDialog::enable_facility_changed, this));
+ _facility->Bind (wxEVT_TEXT, boost::bind(&MetadataDialog::facility_changed, this));
+ _enable_studio->Bind (wxEVT_CHECKBOX, boost::bind(&MetadataDialog::enable_studio_changed, this));
+ _studio->Bind (wxEVT_TEXT, boost::bind(&MetadataDialog::studio_changed, this));
+ _enable_chain->Bind (wxEVT_CHECKBOX, boost::bind(&MetadataDialog::enable_chain_changed, this));
+ _chain->Bind (wxEVT_TEXT, boost::bind(&MetadataDialog::chain_changed, this));
+ _temp_version->Bind (wxEVT_CHECKBOX, boost::bind(&MetadataDialog::temp_version_changed, this));
+ _pre_release->Bind (wxEVT_CHECKBOX, boost::bind(&MetadataDialog::pre_release_changed, this));
+ _red_band->Bind (wxEVT_CHECKBOX, boost::bind(&MetadataDialog::red_band_changed, this));
+ _two_d_version_of_three_d->Bind (wxEVT_CHECKBOX, boost::bind(&MetadataDialog::two_d_version_of_three_d_changed, this));
+ _enable_luminance->Bind (wxEVT_CHECKBOX, boost::bind(&MetadataDialog::enable_luminance_changed, this));
+ _luminance_value->Bind (wxEVT_SPINCTRLDOUBLE, boost::bind(&MetadataDialog::luminance_changed, this));
+ _luminance_unit->Bind (wxEVT_CHOICE, boost::bind(&MetadataDialog::luminance_changed, this));
+
+ _film_changed_connection = film()->Change.connect(boost::bind(&MetadataDialog::film_changed, this, _1, _2));
+
+ film_changed (ChangeType::DONE, Film::Property::RELEASE_TERRITORY);
+ film_changed (ChangeType::DONE, Film::Property::FACILITY);
+ film_changed (ChangeType::DONE, Film::Property::STUDIO);
+ film_changed (ChangeType::DONE, Film::Property::TEMP_VERSION);
+ film_changed (ChangeType::DONE, Film::Property::PRE_RELEASE);
+ film_changed (ChangeType::DONE, Film::Property::RED_BAND);
+ film_changed (ChangeType::DONE, Film::Property::TWO_D_VERSION_OF_THREE_D);
+ film_changed (ChangeType::DONE, Film::Property::CHAIN);
+ film_changed (ChangeType::DONE, Film::Property::LUMINANCE);
+
+ setup_sensitivity ();
+}
+
+
+void
+MetadataDialog::film_changed (ChangeType type, Film::Property property)
+{
+ if (type != ChangeType::DONE) {
+ return;
+ }
+
+ if (property == Film::Property::RELEASE_TERRITORY) {
+ auto rt = film()->release_territory();
+ checked_set (_enable_release_territory, static_cast<bool>(rt));
+ if (rt) {
+ _release_territory = *rt;
+ checked_set (_release_territory_text, std_to_wx(*dcp::LanguageTag::get_subtag_description(*_release_territory)));
+ }
+ } else if (property == Film::Property::FACILITY) {
+ checked_set (_enable_facility, static_cast<bool>(film()->facility()));
+ if (film()->facility()) {
+ checked_set (_facility, *film()->facility());
+ }
+ } else if (property == Film::Property::STUDIO) {
+ checked_set (_enable_studio, static_cast<bool>(film()->studio()));
+ if (film()->studio()) {
+ checked_set (_studio, *film()->studio());
+ }
+ } else if (property == Film::Property::CHAIN) {
+ checked_set (_enable_chain, static_cast<bool>(film()->chain()));
+ if (film()->chain()) {
+ checked_set (_chain, *film()->chain());
+ }
+ } else if (property == Film::Property::TEMP_VERSION) {
+ checked_set (_temp_version, film()->temp_version());
+ } else if (property == Film::Property::PRE_RELEASE) {
+ checked_set (_pre_release, film()->pre_release());
+ } else if (property == Film::Property::RED_BAND) {
+ checked_set (_red_band, film()->red_band());
+ } else if (property == Film::Property::TWO_D_VERSION_OF_THREE_D) {
+ checked_set (_two_d_version_of_three_d, film()->two_d_version_of_three_d());
+ } else if (property == Film::Property::LUMINANCE) {
+ auto lum = film()->luminance();
+ checked_set (_enable_luminance, static_cast<bool>(lum));
+ if (lum) {
+ checked_set (_luminance_value, lum->value());
+ switch (lum->unit()) {
+ case dcp::Luminance::Unit::CANDELA_PER_SQUARE_METRE:
+ checked_set (_luminance_unit, 0);
+ break;
+ case dcp::Luminance::Unit::FOOT_LAMBERT:
+ checked_set (_luminance_unit, 1);
+ break;
+ }
+ }
+ }
+}
+
+
+void
+MetadataDialog::setup_standard (wxPanel* panel, wxSizer* sizer)
+{
+ _enable_release_territory = new wxCheckBox (panel, wxID_ANY, _("Release territory"));
+ sizer->Add (_enable_release_territory, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_GAP);
+ {
+ auto s = new wxBoxSizer (wxHORIZONTAL);
+ _release_territory_text = new wxStaticText (panel, wxID_ANY, wxT(""));
+ s->Add (_release_territory_text, 1, wxLEFT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_X_GAP);
+ _edit_release_territory = new Button (panel, _("Edit..."));
+ s->Add (_edit_release_territory, 0, wxLEFT, DCPOMATIC_SIZER_GAP);
+ sizer->Add (s, 0, wxEXPAND);
+ }
+}
+
+
+void
+MetadataDialog::edit_release_territory ()
+{
+ DCPOMATIC_ASSERT (film()->release_territory());
+ auto d = new RegionSubtagDialog(this, *film()->release_territory());
+ d->ShowModal ();
+ auto tag = d->get();
+ if (tag) {
+ _release_territory = *tag;
+ film()->set_release_territory(*tag);
+ }
+ d->Destroy ();
+}
+
+
+void
+MetadataDialog::setup_sensitivity ()
+{
+ auto const enabled = _enable_release_territory->GetValue();
+ _release_territory_text->Enable (enabled);
+ _edit_release_territory->Enable (enabled);
+ _facility->Enable (_enable_facility->GetValue());
+ _chain->Enable (_enable_chain->GetValue());
+ _studio->Enable (_enable_studio->GetValue());
+ _luminance_value->Enable (_enable_luminance->GetValue());
+ _luminance_unit->Enable (_enable_luminance->GetValue());
+}
+
+
+void
+MetadataDialog::enable_release_territory_changed ()
+{
+ setup_sensitivity ();
+ if (_enable_release_territory->GetValue()) {
+ film()->set_release_territory (_release_territory.get_value_or(dcp::LanguageTag::RegionSubtag("US")));
+ } else {
+ film()->set_release_territory ();
+ }
+}
+
+
+void
+MetadataDialog::setup_advanced (wxPanel* panel, wxSizer* sizer)
+{
+ _enable_facility = new wxCheckBox (panel, wxID_ANY, _("Facility"));
+ sizer->Add (_enable_facility, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL);
+ _facility = new wxTextCtrl (panel, wxID_ANY);
+ sizer->Add (_facility, 1, wxEXPAND);
+
+ _enable_studio = new wxCheckBox (panel, wxID_ANY, _("Studio"));
+ sizer->Add (_enable_studio, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL);
+ _studio = new wxTextCtrl (panel, wxID_ANY);
+ sizer->Add (_studio, 1, wxEXPAND);
+
+ _enable_chain = new wxCheckBox (panel, wxID_ANY, _("Chain"));
+ sizer->Add (_enable_chain, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL);
+ _chain = new wxTextCtrl (panel, wxID_ANY);
+ sizer->Add (_chain, 1, wxEXPAND);
+
+ _temp_version = new wxCheckBox (panel, wxID_ANY, _("Temporary version"));
+ sizer->Add (_temp_version, 0, wxALIGN_CENTER_VERTICAL);
+ sizer->AddSpacer (0);
+
+ _pre_release = new wxCheckBox (panel, wxID_ANY, _("Pre-release"));
+ sizer->Add (_pre_release, 0, wxALIGN_CENTER_VERTICAL);
+ sizer->AddSpacer (0);
+
+ _red_band = new wxCheckBox (panel, wxID_ANY, _("Red band"));
+ sizer->Add (_red_band, 0, wxALIGN_CENTER_VERTICAL);
+ sizer->AddSpacer (0);
+
+ _two_d_version_of_three_d = new wxCheckBox (panel, wxID_ANY, _("2D version of 3D DCP"));
+ sizer->Add (_two_d_version_of_three_d, 0, wxALIGN_CENTER_VERTICAL);
+ sizer->AddSpacer (0);
+
+ _enable_luminance = new wxCheckBox (panel, wxID_ANY, _("Luminance"));
+ sizer->Add (_enable_luminance, 0, wxALIGN_CENTER_VERTICAL);
+ {
+ auto s = new wxBoxSizer (wxHORIZONTAL);
+ _luminance_value = new wxSpinCtrlDouble (panel, wxID_ANY);
+ _luminance_value->SetDigits (1);
+ _luminance_value->SetIncrement (0.1);
+ s->Add (_luminance_value, 0);
+ _luminance_unit = new wxChoice (panel, wxID_ANY);
+ s->Add (_luminance_unit, 0, wxLEFT, DCPOMATIC_SIZER_X_GAP);
+ sizer->Add (s, 1, wxEXPAND);
+ }
+
+ _luminance_unit->Append (wxString::FromUTF8(_("candela per m²")));
+ _luminance_unit->Append (_("foot lambert"));
+
+}
+
+
+void
+MetadataDialog::facility_changed ()
+{
+ film()->set_facility (wx_to_std(_facility->GetValue()));
+}
+
+
+void
+MetadataDialog::enable_facility_changed ()
+{
+ setup_sensitivity ();
+ if (_enable_facility->GetValue()) {
+ film()->set_facility (wx_to_std(_facility->GetValue()));
+ } else {
+ film()->set_facility ();
+ }
+}
+
+
+void
+MetadataDialog::studio_changed ()
+{
+ film()->set_studio (wx_to_std(_studio->GetValue()));
+}
+
+
+void
+MetadataDialog::enable_studio_changed ()
+{
+ setup_sensitivity ();
+ if (_enable_studio->GetValue()) {
+ film()->set_studio (wx_to_std(_studio->GetValue()));
+ } else {
+ film()->set_studio ();
+ }
+}
+
+
+void
+MetadataDialog::temp_version_changed ()
+{
+ film()->set_temp_version(_temp_version->GetValue());
+}
+
+
+void
+MetadataDialog::pre_release_changed ()
+{
+ film()->set_pre_release(_pre_release->GetValue());
+}
+
+
+void
+MetadataDialog::red_band_changed ()
+{
+ film()->set_red_band(_red_band->GetValue());
+}
+
+
+void
+MetadataDialog::two_d_version_of_three_d_changed ()
+{
+ film()->set_two_d_version_of_three_d(_two_d_version_of_three_d->GetValue());
+}
+
+
+void
+MetadataDialog::chain_changed ()
+{
+ film()->set_chain (wx_to_std(_chain->GetValue()));
+}
+
+
+void
+MetadataDialog::enable_chain_changed ()
+{
+ setup_sensitivity ();
+ if (_enable_chain->GetValue()) {
+ chain_changed ();
+ } else {
+ film()->set_chain ();
+ }
+}
+
+
+void
+MetadataDialog::enable_luminance_changed ()
+{
+ setup_sensitivity ();
+ if (_enable_luminance->GetValue()) {
+ luminance_changed ();
+ } else {
+ film()->set_luminance ();
+ }
+}
+
+
+void
+MetadataDialog::luminance_changed ()
+{
+ dcp::Luminance::Unit unit;
+ switch (_luminance_unit->GetSelection()) {
+ case 0:
+ unit = dcp::Luminance::Unit::CANDELA_PER_SQUARE_METRE;
+ break;
+ case 1:
+ unit = dcp::Luminance::Unit::FOOT_LAMBERT;
+ break;
+ default:
+ DCPOMATIC_ASSERT (false);
+ }
+
+ film()->set_luminance (dcp::Luminance(_luminance_value->GetValue(), unit));
+}
+
diff --git a/src/wx/metadata_dialog.h b/src/wx/metadata_dialog.h
new file mode 100644
index 000000000..7c4471e59
--- /dev/null
+++ b/src/wx/metadata_dialog.h
@@ -0,0 +1,95 @@
+/*
+ Copyright (C) 2021 Carl Hetherington <cth@carlh.net>
+
+ This file is part of DCP-o-matic.
+
+ DCP-o-matic is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ DCP-o-matic is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+
+#ifndef DCPOMATIC_METADATA_DIALOG_H
+#define DCPOMATIC_METADATA_DIALOG_H
+
+
+#include "lib/change_signaller.h"
+#include "lib/film.h"
+#include "lib/warnings.h"
+#include "lib/weak_film.h"
+DCPOMATIC_DISABLE_WARNINGS
+#include <wx/wx.h>
+DCPOMATIC_ENABLE_WARNINGS
+
+
+class Button;
+class wxSpinCtrlDouble;
+
+
+class MetadataDialog : public wxDialog, public WeakFilm
+{
+public:
+ MetadataDialog (wxWindow* parent, std::weak_ptr<Film> film);
+
+ virtual void setup ();
+
+protected:
+ virtual void setup_standard (wxPanel*, wxSizer*);
+ virtual void setup_advanced (wxPanel*, wxSizer*);
+ virtual void film_changed (ChangeType type, Film::Property property);
+ virtual void setup_sensitivity ();
+
+private:
+ void edit_release_territory ();
+ void enable_release_territory_changed ();
+ void facility_changed ();
+ void enable_facility_changed ();
+ void studio_changed ();
+ void enable_studio_changed ();
+ void temp_version_changed ();
+ void pre_release_changed ();
+ void red_band_changed ();
+ void two_d_version_of_three_d_changed ();
+ void chain_changed ();
+ void enable_chain_changed ();
+ void enable_luminance_changed ();
+ void luminance_changed ();
+
+ wxCheckBox* _enable_release_territory;
+ /** The current release territory displayed in the UI; since we can't easily convert
+ * the string in _release_territory_text to a RegionSubtag we just store the RegionSubtag
+ * alongside.
+ */
+ boost::optional<dcp::LanguageTag::RegionSubtag> _release_territory;
+ wxStaticText* _release_territory_text;
+ Button* _edit_release_territory;
+ wxCheckBox* _enable_facility;
+ wxTextCtrl* _facility;
+ wxCheckBox* _enable_chain;
+ wxTextCtrl* _chain;
+ wxCheckBox* _enable_studio;
+ wxTextCtrl* _studio;
+ wxCheckBox* _temp_version;
+ wxCheckBox* _pre_release;
+ wxCheckBox* _red_band;
+ wxCheckBox* _two_d_version_of_three_d;
+ wxCheckBox* _enable_luminance;
+ wxSpinCtrlDouble* _luminance_value;
+ wxChoice* _luminance_unit;
+
+ boost::signals2::scoped_connection _film_changed_connection;
+};
+
+
+#endif
+
diff --git a/src/wx/player_config_dialog.cc b/src/wx/player_config_dialog.cc
index c32e892d9..3c480e37e 100644
--- a/src/wx/player_config_dialog.cc
+++ b/src/wx/player_config_dialog.cc
@@ -28,7 +28,6 @@
#include "filter_dialog.h"
#include "file_picker_ctrl.h"
#include "dir_picker_ctrl.h"
-#include "isdcf_metadata_dialog.h"
#include "server_dialog.h"
#include "make_chain_dialog.h"
#include "email_dialog.h"
diff --git a/src/wx/smpte_metadata_dialog.cc b/src/wx/smpte_metadata_dialog.cc
index 464da6710..e4d2d9622 100644
--- a/src/wx/smpte_metadata_dialog.cc
+++ b/src/wx/smpte_metadata_dialog.cc
@@ -28,7 +28,6 @@
#include "lib/film.h"
#include <dcp/types.h>
#include <wx/gbsizer.h>
-#include <wx/notebook.h>
#include <wx/spinctrl.h>
@@ -60,13 +59,10 @@ content_versions_column (string v, int)
}
-wxPanel *
-SMPTEMetadataDialog::main_panel (wxWindow* parent)
+void
+SMPTEMetadataDialog::setup_standard (wxPanel* panel, wxSizer* sizer)
{
- auto panel = new wxPanel (parent, wxID_ANY);
-
- auto sizer = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
- sizer->AddGrowableCol (1, 1);
+ MetadataDialog::setup_standard (panel, sizer);
add_label_to_sizer (sizer, panel, _("Title language"), true, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL);
_name_language = new LanguageTagWidget(
@@ -98,33 +94,13 @@ SMPTEMetadataDialog::main_panel (wxWindow* parent)
false
);
sizer->Add (_ratings, 1, wxEXPAND);
-
- auto overall_sizer = new wxBoxSizer (wxVERTICAL);
- overall_sizer->Add (sizer, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER);
- panel->SetSizer (overall_sizer);
-
- return panel;
}
-wxPanel *
-SMPTEMetadataDialog::advanced_panel (wxWindow* parent)
+void
+SMPTEMetadataDialog::setup_advanced (wxPanel* panel, wxSizer* sizer)
{
- auto panel = new wxPanel (parent, wxID_ANY);
-
- auto sizer = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
- sizer->AddGrowableCol (1, 1);
-
- _enable_release_territory = new wxCheckBox (panel, wxID_ANY, _("Release territory"));
- sizer->Add (_enable_release_territory, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_GAP);
- {
- auto s = new wxBoxSizer (wxHORIZONTAL);
- _release_territory_text = new wxStaticText (panel, wxID_ANY, wxT(""));
- s->Add (_release_territory_text, 1, wxLEFT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_X_GAP);
- _edit_release_territory = new Button (panel, _("Edit..."));
- s->Add (_edit_release_territory, 0, wxLEFT, DCPOMATIC_SIZER_GAP);
- sizer->Add (s, 0, wxEXPAND);
- }
+ MetadataDialog::setup_advanced (panel, sizer);
add_label_to_sizer (sizer, panel, _("Version number"), true, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL);
_version_number = new wxSpinCtrl (panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 1000);
@@ -134,33 +110,11 @@ SMPTEMetadataDialog::advanced_panel (wxWindow* parent)
_status = new wxChoice (panel, wxID_ANY);
sizer->Add (_status, 0);
- _enable_chain = new wxCheckBox (panel, wxID_ANY, _("Chain"));
- sizer->Add (_enable_chain, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL);
- _chain = new wxTextCtrl (panel, wxID_ANY);
- sizer->Add (_chain, 1, wxEXPAND);
-
_enable_distributor = new wxCheckBox (panel, wxID_ANY, _("Distributor"));
sizer->Add (_enable_distributor, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL);
_distributor = new wxTextCtrl (panel, wxID_ANY);
sizer->Add (_distributor, 1, wxEXPAND);
- _enable_facility = new wxCheckBox (panel, wxID_ANY, _("Facility"));
- sizer->Add (_enable_facility, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL);
- _facility = new wxTextCtrl (panel, wxID_ANY);
- sizer->Add (_facility, 1, wxEXPAND);
-
- add_label_to_sizer (sizer, panel, _("Luminance"), true, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL);
- {
- auto s = new wxBoxSizer (wxHORIZONTAL);
- _luminance_value = new wxSpinCtrlDouble (panel, wxID_ANY);
- _luminance_value->SetDigits (1);
- _luminance_value->SetIncrement (0.1);
- s->Add (_luminance_value, 0);
- _luminance_unit = new wxChoice (panel, wxID_ANY);
- s->Add (_luminance_unit, 0, wxLEFT, DCPOMATIC_SIZER_X_GAP);
- sizer->Add (s, 1, wxEXPAND);
- }
-
{
int flags = wxALIGN_TOP | wxRIGHT | wxTOP;
#ifdef __WXOSX__
@@ -182,69 +136,36 @@ SMPTEMetadataDialog::advanced_panel (wxWindow* parent)
false
);
sizer->Add (_content_versions, 1, wxEXPAND);
-
- auto overall_sizer = new wxBoxSizer (wxVERTICAL);
- overall_sizer->Add (sizer, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER);
- panel->SetSizer (overall_sizer);
-
- return panel;
}
SMPTEMetadataDialog::SMPTEMetadataDialog (wxWindow* parent, weak_ptr<Film> weak_film)
- : wxDialog (parent, wxID_ANY, _("Metadata"))
- , WeakFilm (weak_film)
+ : MetadataDialog (parent, weak_film)
{
- auto notebook = new wxNotebook (this, wxID_ANY);
- notebook->AddPage (main_panel(notebook), _("Standard"));
- notebook->AddPage (advanced_panel(notebook), _("Advanced"));
- auto overall_sizer = new wxBoxSizer (wxVERTICAL);
- overall_sizer->Add (notebook, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER);
+}
- auto buttons = CreateSeparatedButtonSizer (wxCLOSE);
- if (buttons) {
- overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
- }
- SetSizer (overall_sizer);
- overall_sizer->Layout ();
- overall_sizer->SetSizeHints (this);
+void
+SMPTEMetadataDialog::setup ()
+{
+ MetadataDialog::setup ();
_status->Append (_("Temporary"));
_status->Append (_("Pre-release"));
_status->Append (_("Final"));
- _luminance_unit->Append (wxString::FromUTF8(_("candela per m²")));
- _luminance_unit->Append (_("foot lambert"));
-
_name_language->Changed.connect (boost::bind(&SMPTEMetadataDialog::name_language_changed, this, _1));
- _edit_release_territory->Bind (wxEVT_BUTTON, boost::bind(&SMPTEMetadataDialog::edit_release_territory, this));
_version_number->Bind (wxEVT_SPINCTRL, boost::bind(&SMPTEMetadataDialog::version_number_changed, this));
_status->Bind (wxEVT_CHOICE, boost::bind(&SMPTEMetadataDialog::status_changed, this));
- _enable_chain->Bind (wxEVT_CHECKBOX, boost::bind(&SMPTEMetadataDialog::enable_chain_changed, this));
- _chain->Bind (wxEVT_TEXT, boost::bind(&SMPTEMetadataDialog::chain_changed, this));
_enable_distributor->Bind (wxEVT_CHECKBOX, boost::bind(&SMPTEMetadataDialog::enable_distributor_changed, this));
_distributor->Bind (wxEVT_TEXT, boost::bind(&SMPTEMetadataDialog::distributor_changed, this));
- _enable_facility->Bind (wxEVT_CHECKBOX, boost::bind(&SMPTEMetadataDialog::enable_facility_changed, this));
- _facility->Bind (wxEVT_TEXT, boost::bind(&SMPTEMetadataDialog::facility_changed, this));
- _luminance_value->Bind (wxEVT_SPINCTRLDOUBLE, boost::bind(&SMPTEMetadataDialog::luminance_changed, this));
- _luminance_unit->Bind (wxEVT_CHOICE, boost::bind(&SMPTEMetadataDialog::luminance_changed, this));
- _enable_release_territory->Bind (wxEVT_CHECKBOX, boost::bind(&SMPTEMetadataDialog::enable_release_territory_changed, this));
-
- _version_number->SetFocus ();
-
- _film_changed_connection = film()->Change.connect(boost::bind(&SMPTEMetadataDialog::film_changed, this, _1, _2));
film_changed (ChangeType::DONE, Film::Property::NAME_LANGUAGE);
- film_changed (ChangeType::DONE, Film::Property::RELEASE_TERRITORY);
film_changed (ChangeType::DONE, Film::Property::VERSION_NUMBER);
film_changed (ChangeType::DONE, Film::Property::STATUS);
- film_changed (ChangeType::DONE, Film::Property::CHAIN);
film_changed (ChangeType::DONE, Film::Property::DISTRIBUTOR);
- film_changed (ChangeType::DONE, Film::Property::FACILITY);
film_changed (ChangeType::DONE, Film::Property::CONTENT_VERSIONS);
- film_changed (ChangeType::DONE, Film::Property::LUMINANCE);
setup_sensitivity ();
}
@@ -253,19 +174,14 @@ SMPTEMetadataDialog::SMPTEMetadataDialog (wxWindow* parent, weak_ptr<Film> weak_
void
SMPTEMetadataDialog::film_changed (ChangeType type, Film::Property property)
{
+ MetadataDialog::film_changed (type, property);
+
if (type != ChangeType::DONE || film()->interop()) {
return;
}
if (property == Film::Property::NAME_LANGUAGE) {
_name_language->set (film()->name_language());
- } else if (property == Film::Property::RELEASE_TERRITORY) {
- auto rt = film()->release_territory();
- checked_set (_enable_release_territory, static_cast<bool>(rt));
- if (rt) {
- _release_territory = *rt;
- checked_set (_release_territory_text, std_to_wx(*dcp::LanguageTag::get_subtag_description(*_release_territory)));
- }
} else if (property == Film::Property::VERSION_NUMBER) {
checked_set (_version_number, film()->version_number());
} else if (property == Film::Property::STATUS) {
@@ -280,37 +196,11 @@ SMPTEMetadataDialog::film_changed (ChangeType type, Film::Property property)
checked_set (_status, 2);
break;
}
- } else if (property == Film::Property::CHAIN) {
- checked_set (_enable_chain, static_cast<bool>(film()->chain()));
- if (film()->chain()) {
- checked_set (_chain, *film()->chain());
- }
} else if (property == Film::Property::DISTRIBUTOR) {
checked_set (_enable_distributor, static_cast<bool>(film()->distributor()));
if (film()->distributor()) {
checked_set (_distributor, *film()->distributor());
}
- } else if (property == Film::Property::FACILITY) {
- checked_set (_enable_facility, static_cast<bool>(film()->facility()));
- if (film()->facility()) {
- checked_set (_facility, *film()->facility());
- }
- } else if (property == Film::Property::LUMINANCE) {
- auto lum = film()->luminance();
- if (lum) {
- checked_set (_luminance_value, lum->value());
- switch (lum->unit()) {
- case dcp::Luminance::Unit::CANDELA_PER_SQUARE_METRE:
- checked_set (_luminance_unit, 0);
- break;
- case dcp::Luminance::Unit::FOOT_LAMBERT:
- checked_set (_luminance_unit, 1);
- break;
- }
- } else {
- checked_set (_luminance_value, 4.5);
- checked_set (_luminance_unit, 1);
- }
}
}
@@ -351,21 +241,6 @@ SMPTEMetadataDialog::name_language_changed (dcp::LanguageTag tag)
void
-SMPTEMetadataDialog::edit_release_territory ()
-{
- DCPOMATIC_ASSERT (film()->release_territory());
- auto d = new RegionSubtagDialog(this, *film()->release_territory());
- d->ShowModal ();
- auto tag = d->get();
- if (tag) {
- _release_territory = *tag;
- film()->set_release_territory(*tag);
- }
- d->Destroy ();
-}
-
-
-void
SMPTEMetadataDialog::version_number_changed ()
{
film()->set_version_number (_version_number->GetValue());
@@ -390,13 +265,6 @@ SMPTEMetadataDialog::status_changed ()
void
-SMPTEMetadataDialog::chain_changed ()
-{
- film()->set_chain (wx_to_std(_chain->GetValue()));
-}
-
-
-void
SMPTEMetadataDialog::distributor_changed ()
{
film()->set_distributor (wx_to_std(_distributor->GetValue()));
@@ -404,67 +272,11 @@ SMPTEMetadataDialog::distributor_changed ()
void
-SMPTEMetadataDialog::facility_changed ()
-{
- film()->set_facility (wx_to_std(_facility->GetValue()));
-}
-
-
-void
-SMPTEMetadataDialog::luminance_changed ()
-{
- dcp::Luminance::Unit unit;
- switch (_luminance_unit->GetSelection()) {
- case 0:
- unit = dcp::Luminance::Unit::CANDELA_PER_SQUARE_METRE;
- break;
- case 1:
- unit = dcp::Luminance::Unit::FOOT_LAMBERT;
- break;
- default:
- DCPOMATIC_ASSERT (false);
- }
-
- film()->set_luminance (dcp::Luminance(_luminance_value->GetValue(), unit));
-}
-
-
-void
SMPTEMetadataDialog::setup_sensitivity ()
{
- {
- auto const enabled = _enable_release_territory->GetValue();
- _release_territory_text->Enable (enabled);
- _edit_release_territory->Enable (enabled);
- }
+ MetadataDialog::setup_sensitivity ();
- _chain->Enable (_enable_chain->GetValue());
_distributor->Enable (_enable_distributor->GetValue());
- _facility->Enable (_enable_facility->GetValue());
-}
-
-
-void
-SMPTEMetadataDialog::enable_release_territory_changed ()
-{
- setup_sensitivity ();
- if (_enable_release_territory->GetValue()) {
- film()->set_release_territory (_release_territory.get_value_or(dcp::LanguageTag::RegionSubtag("US")));
- } else {
- film()->set_release_territory ();
- }
-}
-
-
-void
-SMPTEMetadataDialog::enable_chain_changed ()
-{
- setup_sensitivity ();
- if (_enable_chain->GetValue()) {
- film()->set_chain (wx_to_std(_chain->GetValue()));
- } else {
- film()->set_chain ();
- }
}
@@ -480,15 +292,3 @@ SMPTEMetadataDialog::enable_distributor_changed ()
}
-void
-SMPTEMetadataDialog::enable_facility_changed ()
-{
- setup_sensitivity ();
- if (_enable_facility->GetValue()) {
- film()->set_facility (wx_to_std(_facility->GetValue()));
- } else {
- film()->set_facility ();
- }
-}
-
-
diff --git a/src/wx/smpte_metadata_dialog.h b/src/wx/smpte_metadata_dialog.h
index 46272adbb..d1a792a36 100644
--- a/src/wx/smpte_metadata_dialog.h
+++ b/src/wx/smpte_metadata_dialog.h
@@ -21,6 +21,7 @@
#include "editable_list.h"
#include "full_language_tag_dialog.h"
+#include "metadata_dialog.h"
#include "lib/film.h"
#include "lib/weak_film.h"
#include <dcp/language_tag.h>
@@ -36,54 +37,34 @@ class LanguageTagWidget;
class LanguageTagDialog;
-class SMPTEMetadataDialog : public wxDialog, public WeakFilm
+class SMPTEMetadataDialog : public MetadataDialog
{
public:
SMPTEMetadataDialog (wxWindow* parent, std::weak_ptr<Film> film);
+ void setup () override;
+
private:
- wxPanel* main_panel (wxWindow* parent);
- wxPanel* advanced_panel (wxWindow* parent);
+ void setup_standard (wxPanel* parent, wxSizer* sizer) override;
+ void setup_advanced (wxPanel* parent, wxSizer* sizer) override;
+ void film_changed (ChangeType type, Film::Property property) override;
+ void setup_sensitivity () override;
+
std::vector<dcp::Rating> ratings () const;
void set_ratings (std::vector<dcp::Rating> r);
std::vector<std::string> content_versions () const;
void set_content_versions (std::vector<std::string> v);
void name_language_changed (dcp::LanguageTag tag);
- void edit_release_territory ();
void version_number_changed ();
void status_changed ();
- void chain_changed ();
void distributor_changed ();
- void facility_changed ();
- void luminance_changed ();
- void film_changed (ChangeType type, Film::Property property);
- void setup_sensitivity ();
- void enable_release_territory_changed ();
- void enable_chain_changed ();
void enable_distributor_changed ();
- void enable_facility_changed ();
LanguageTagWidget* _name_language;
- wxCheckBox* _enable_release_territory;
- /** The current release territory displayed in the UI; since we can't easily convert
- * the string in _release_territory_text to a RegionSubtag we just store the RegionSubtag
- * alongside.
- */
- boost::optional<dcp::LanguageTag::RegionSubtag> _release_territory;
- wxStaticText* _release_territory_text;
- Button* _edit_release_territory;
wxSpinCtrl* _version_number;
wxChoice* _status;
- wxCheckBox* _enable_chain;
- wxTextCtrl* _chain;
wxCheckBox* _enable_distributor;
wxTextCtrl* _distributor;
- wxCheckBox* _enable_facility;
- wxTextCtrl* _facility;
- wxSpinCtrlDouble* _luminance_value;
- wxChoice* _luminance_unit;
EditableList<dcp::Rating, RatingDialog>* _ratings;
EditableList<std::string, ContentVersionDialog>* _content_versions;
-
- boost::signals2::scoped_connection _film_changed_connection;
};
diff --git a/src/wx/wscript b/src/wx/wscript
index 76eea3fa5..1d0fb0810 100644
--- a/src/wx/wscript
+++ b/src/wx/wscript
@@ -85,7 +85,6 @@ sources = """
image_sequence_dialog.cc
instant_i18n_dialog.cc
interop_metadata_dialog.cc
- isdcf_metadata_dialog.cc
job_manager_view.cc
job_view.cc
job_view_dialog.cc
@@ -99,6 +98,7 @@ sources = """
make_chain_dialog.cc
markers_dialog.cc
message_dialog.cc
+ metadata_dialog.cc
monitor_dialog.cc
move_to_dialog.cc
nag_dialog.cc