summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-08-24 11:16:24 +0100
committerCarl Hetherington <cth@carlh.net>2016-08-24 11:16:24 +0100
commit3412af70b950dcdc604413ef05c26becda6da789 (patch)
treeb901f89335ec7e06531b475dbb45ff1ee7087e28 /src/tools
parenta26b6e9e392a1ac342a19e0d33d92865819c6ded (diff)
Bump libdcp for new method.
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/dcpomatic.cc24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc
index d4695f1fa..1fccb992a 100644
--- a/src/tools/dcpomatic.cc
+++ b/src/tools/dcpomatic.cc
@@ -143,6 +143,7 @@ enum {
ID_file_new = 1,
ID_file_open,
ID_file_save,
+ ID_file_save_as_template,
ID_file_history,
/* Allow spare IDs after _history for the recent files list */
ID_content_scale_to_fit_width = 100,
@@ -210,6 +211,7 @@ public:
Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&DOMFrame::file_new, this), ID_file_new);
Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&DOMFrame::file_open, this), ID_file_open);
Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&DOMFrame::file_save, this), ID_file_save);
+ Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&DOMFrame::file_save_as_template, this), ID_file_save_as_template);
Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&DOMFrame::file_history, this, _1), ID_file_history, ID_file_history + HISTORY_SIZE);
Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&DOMFrame::file_exit, this), wxID_EXIT);
Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&DOMFrame::edit_preferences, this), wxID_PREFERENCES);
@@ -339,7 +341,7 @@ private:
SetTitle (std_to_wx (s));
}
- void file_new ()
+ void file_new (bool from_template)
{
NewFilmDialog* d = new NewFilmDialog (this);
int const r = d->ShowModal ();
@@ -366,7 +368,7 @@ private:
}
if (maybe_save_then_delete_film ()) {
- new_film (d->get_path ());
+ new_film (d->get_path(), d->template_name());
}
}
@@ -404,6 +406,22 @@ private:
_film->write_metadata ();
}
+ void file_save_as_template ()
+ {
+ SaveTemplateDialog* td = new SaveTemplateDialog (this);
+ int const r = d->ShowModal ();
+ if (r == wxID_OK) {
+ bool ok = true;
+ if (Config::instance()->existing_template (r->name ())) {
+ ok = confirm_dialog (td, _("There is already a template with this name. Do you want to overwrite it?"));
+ }
+ if (ok) {
+ Config::instance()->save_template (_film, r->name ());
+ }
+ }
+ d->Destroy ();
+ }
+
void file_history (wxCommandEvent& event)
{
vector<boost::filesystem::path> history = Config::instance()->history ();
@@ -826,6 +844,8 @@ private:
add_item (_file_menu, _("&Open...\tCtrl-O"), ID_file_open, ALWAYS);
_file_menu->AppendSeparator ();
add_item (_file_menu, _("&Save\tCtrl-S"), ID_file_save, NEEDS_FILM);
+ _file_menu->AppendSeparator ();
+ add_item (_file_menu, _("&Save as template"), ID_file_save_as_template, NEEDS_FILM);
_history_position = _file_menu->GetMenuItems().GetCount();