13
0

vtl: add close/remove video menu entry

This commit is contained in:
Robin Gareus 2013-03-29 09:46:29 +01:00
parent 0c2d95b08f
commit 941898843e
5 changed files with 29 additions and 2 deletions

View File

@ -36,6 +36,7 @@
<!--menuitem action='importFromSession'/-->
#ifdef WITH_VIDEOTIMELINE
<menuitem action='OpenVideo'/>
<menuitem action='CloseVideo'/>
<menu name='Video' action='Video'>
<menuitem action='StartVideoServer'/>
<menuitem action='StopVideoServer'/>

View File

@ -3484,6 +3484,19 @@ ARDOUR_UI::add_video (Gtk::Window* float_window)
}
}
void
ARDOUR_UI::remove_video ()
{
video_timeline->close_session();
editor->toggle_ruler_video(false);
/* delete session state */
XMLNode* node = new XMLNode(X_("Videotimeline"));
_session->add_extra_xml(*node);
node = new XMLNode(X_("Videomonitor"));
_session->add_extra_xml(*node);
}
void
ARDOUR_UI::flush_videotimeline_cache (bool localcacheonly)
{

View File

@ -227,6 +227,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
void add_routes_thread ();
#ifdef WITH_VIDEOTIMELINE
void add_video (Gtk::Window* float_window);
void remove_video ();
void start_video_server_menu (Gtk::Window* float_window);
bool start_video_server (Gtk::Window* float_window, bool popup_msg);
void stop_video_server (bool ask_confirm=false);

View File

@ -136,6 +136,9 @@ ARDOUR_UI::install_actions ()
act = ActionManager::register_action (main_actions, X_("OpenVideo"), _("Open Video"),
sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::add_video), (Gtk::Window*) 0));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (main_actions, X_("CloseVideo"), _("Remove Video"),
sigc::mem_fun (*this, &ARDOUR_UI::remove_video));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (main_actions, X_("ExportVideo"), _("Export To Video File"),
sigc::mem_fun (*editor, &PublicEditor::export_video));
ActionManager::session_sensitive_actions.push_back (act);

View File

@ -153,12 +153,16 @@ VideoTimeLine::save_session ()
void
VideoTimeLine::close_session ()
{
if (video_duration == 0) {
return;
}
close_video_monitor();
save_session();
remove_frames();
video_filename = "";
video_duration = 0L;
video_duration = 0;
GuiUpdate("set-xjadeo-sensitive-off");
}
/** load settings from session */
@ -171,6 +175,11 @@ VideoTimeLine::set_session (ARDOUR::Session *s)
LocaleGuard lg (X_("POSIX"));
XMLNode* node = _session->extra_xml (X_("Videotimeline"));
if (!node || !node->property (X_("Filename"))) {
return;
}
if (node) {
ARDOUR_UI::instance()->start_video_server((Gtk::Window*)0, false);
@ -210,7 +219,7 @@ VideoTimeLine::set_session (ARDOUR::Session *s)
node = _session->extra_xml (X_("Videomonitor"));
if (node) {
const XMLProperty* prop = node->property (X_("active"));
if (prop->value() == "yes" && found_xjadeo() && !video_filename.empty() && local_file) {
if (prop && prop->value() == "yes" && found_xjadeo() && !video_filename.empty() && local_file) {
open_video_monitor(false);
}
}