X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Ftools%2Fdcpomatic.cc;h=1fccb992a1e60e88bf49335c85924068073e9a88;hb=3412af70b950dcdc604413ef05c26becda6da789;hp=d4695f1fa08b04475dd4210a3ff7ee40c5b02601;hpb=f8a0bc6135a933dcf660bbc46b4b3d29d503690e;p=dcpomatic.git 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 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();