}
_smpte_metadata_dialog = new SMPTEMetadataDialog (_panel, _film);
+ _smpte_metadata_dialog->setup ();
_smpte_metadata_dialog->Show ();
}
}
--- /dev/null
+/*
+ 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 "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/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);
+}
+
--- /dev/null
+/*
+ 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 "lib/warnings.h"
+#include "lib/weak_film.h"
+DCPOMATIC_DISABLE_WARNINGS
+#include <wx/wx.h>
+DCPOMATIC_ENABLE_WARNINGS
+
+
+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*) {}
+};
#include "lib/film.h"
#include <dcp/types.h>
#include <wx/gbsizer.h>
-#include <wx/notebook.h>
#include <wx/spinctrl.h>
}
-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(
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);
+ MetadataDialog::setup_advanced (panel, sizer);
_enable_release_territory = new wxCheckBox (panel, wxID_ANY, _("Release territory"));
sizer->Add (_enable_release_territory, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_GAP);
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"));
_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);
#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>
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;
+
std::vector<dcp::Rating> ratings () const;
void set_ratings (std::vector<dcp::Rating> r);
std::vector<std::string> content_versions () const;
make_chain_dialog.cc
markers_dialog.cc
message_dialog.cc
+ metadata_dialog.cc
monitor_dialog.cc
move_to_dialog.cc
nag_dialog.cc