From c2b2953f8c051743729bfa3328336abf19a25587 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 12 Oct 2013 22:55:54 +0200 Subject: [PATCH] export video-range: add to context menu --- gtk2_ardour/ardour_ui_ed.cc | 2 +- gtk2_ardour/editor.cc | 3 +++ gtk2_ardour/editor.h | 2 +- gtk2_ardour/editor_videotimeline.cc | 4 ++-- gtk2_ardour/export_video_dialog.cc | 8 ++++++-- gtk2_ardour/export_video_dialog.h | 2 +- gtk2_ardour/public_editor.h | 2 +- 7 files changed, 15 insertions(+), 8 deletions(-) diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index 251fc8f6fc..0ed7a95df3 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -139,7 +139,7 @@ ARDOUR_UI::install_actions () sigc::mem_fun (*this, &ARDOUR_UI::remove_video)); act->set_sensitive (false); act = ActionManager::register_action (main_actions, X_("ExportVideo"), _("Export To Video File"), - sigc::mem_fun (*editor, &PublicEditor::export_video)); + hide_return (sigc::bind (sigc::mem_fun(*editor, &PublicEditor::export_video), false))); ActionManager::session_sensitive_actions.push_back (act); act = ActionManager::register_action (main_actions, X_("Snapshot"), _("Snapshot..."), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::snapshot_session), false)); diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index fc4b6f4d6c..cf3eab5724 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -1911,6 +1911,9 @@ Editor::add_selection_context_items (Menu_Helpers::MenuList& edit_items) edit_items.push_back (MenuElem (_("Bounce Range to Region List"), sigc::bind (sigc::mem_fun(*this, &Editor::bounce_range_selection), false, false))); edit_items.push_back (MenuElem (_("Bounce Range to Region List With Processing"), sigc::bind (sigc::mem_fun(*this, &Editor::bounce_range_selection), false, true))); edit_items.push_back (MenuElem (_("Export Range..."), sigc::mem_fun(*this, &Editor::export_selection))); + if (ARDOUR_UI::instance()->video_timeline->get_duration() > 0) { + edit_items.push_back (MenuElem (_("Export Video Range..."), sigc::bind (sigc::mem_fun(*this, &Editor::export_video), true))); + } } diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 033888c4b6..e9269841ff 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -924,7 +924,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void toggle_ruler_video (bool onoff) {ruler_video_action->set_active(onoff);} int videotl_bar_height; /* in units of timebar_height; default: 4 */ int get_videotl_bar_height () const { return videotl_bar_height; } - void export_video (); + void export_video (bool range = false); void toggle_region_video_lock (); Gtk::VBox time_button_vbox; diff --git a/gtk2_ardour/editor_videotimeline.cc b/gtk2_ardour/editor_videotimeline.cc index 6f3317eabd..7d1c009d58 100644 --- a/gtk2_ardour/editor_videotimeline.cc +++ b/gtk2_ardour/editor_videotimeline.cc @@ -122,7 +122,7 @@ Editor::embed_audio_from_video (std::string path, framepos_t n) } void -Editor::export_video () +Editor::export_video (bool range) { if (ARDOUR::Config->get_show_video_export_info()) { ExportVideoInfobox infobox (_session); @@ -138,7 +138,7 @@ Editor::export_video () break; } } - ExportVideoDialog dialog (_session, get_selection().time); + ExportVideoDialog dialog (_session, get_selection().time, range); Gtk::ResponseType r = (Gtk::ResponseType) dialog.run(); dialog.hide(); #if 0 diff --git a/gtk2_ardour/export_video_dialog.cc b/gtk2_ardour/export_video_dialog.cc index eacc32bde2..2f9df2fb1c 100644 --- a/gtk2_ardour/export_video_dialog.cc +++ b/gtk2_ardour/export_video_dialog.cc @@ -61,7 +61,7 @@ using namespace PBD; using namespace ARDOUR; using namespace VideoUtils; -ExportVideoDialog::ExportVideoDialog (Session* s, TimeSelection &tme) +ExportVideoDialog::ExportVideoDialog (Session* s, TimeSelection &tme, bool range) : ArdourDialog (_("Export Video File ")) , export_range (tme) , outfn_path_label (_("File:"), Gtk::ALIGN_LEFT) @@ -152,7 +152,11 @@ ExportVideoDialog::ExportVideoDialog (Session* s, TimeSelection &tme) if (!export_range.empty()) { insnd_combo.append_text (_("Selected range")); // TODO show export_range.start() -> export_range.end_frame() } - insnd_combo.set_active(0); + if (range) { + insnd_combo.set_active(2); + } else { + insnd_combo.set_active(0); + } outfn_path_entry.set_width_chars(38); outfn_path_entry.set_text (_session->session_directory().export_path() + G_DIR_SEPARATOR +"export.avi"); diff --git a/gtk2_ardour/export_video_dialog.h b/gtk2_ardour/export_video_dialog.h index 7e3cf442a7..5ebcf3258d 100644 --- a/gtk2_ardour/export_video_dialog.h +++ b/gtk2_ardour/export_video_dialog.h @@ -41,7 +41,7 @@ class ExportVideoDialog : public ArdourDialog , public PBD::ScopedConnectionList { public: - ExportVideoDialog (ARDOUR::Session*, TimeSelection &tme); + ExportVideoDialog (ARDOUR::Session*, TimeSelection &tme, bool range = false); ~ExportVideoDialog (); std::string get_exported_filename () { return outfn_path_entry.get_text(); } diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index b5f8503458..1905875141 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -300,7 +300,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible, publi virtual int get_videotl_bar_height () const = 0; virtual void set_video_timeline_height (const int h) = 0; virtual void embed_audio_from_video (std::string, framepos_t n = 0) = 0; - virtual void export_video () = 0; + virtual void export_video (bool range = false) = 0; virtual RouteTimeAxisView* get_route_view_by_route_id (const PBD::ID& id) const = 0;