use new method in MidiPatchManager to use MIDNAM data when setting a MidiTimeAxisView
[ardour.git] / gtk2_ardour / editor_videotimeline.cc
index 4bf8b047cbbbe7177ef82d7e5d8bb31fb698b2e2..45d0e3995172678cf4e1ebf2a64288e6d7dc93fb 100644 (file)
@@ -1,24 +1,24 @@
 /*
-    Copyright (C) 2010 Paul Davis
   Author: Robin Gareus <robin@gareus.org>
-
-    This program 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.
-
-    This program 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 this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include <jack/types.h>
+ * Copyright (C) 2013-2017 Paul Davis <paul@linuxaudiosystems.com>
* Copyright (C) 2013-2017 Robin Gareus <robin@gareus.org>
+ * Copyright (C) 2013 John Emmas <john@creativepost.co.uk>
+ *
* This program 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.
+ *
+ * This program 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "pbd/gstdio_compat.h"
 
 #include "ardour/profile.h"
 #include "ardour/rc_configuration.h"
 #include "audio_time_axis.h"
 #include "video_image_frame.h"
 #include "export_video_dialog.h"
-#include "export_video_infobox.h"
 #include "interthread_progress_window.h"
 
 #include "pbd/openuri.h"
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace std;
 
@@ -54,6 +53,9 @@ Editor::set_video_timeline_height (const int h)
 void
 Editor::update_video_timeline (bool flush)
 {
+       // catch GUIIdle -> Editor::idle_visual_changer during quit/close
+       assert (ARDOUR_UI::instance()->video_timeline);
+
        if (flush) {
                ARDOUR_UI::instance()->video_timeline->flush_local_cache();
        }
@@ -80,13 +82,10 @@ Editor::toggle_video_timeline_locked ()
 }
 
 void
-Editor::embed_audio_from_video (std::string path, framepos_t n)
+Editor::embed_audio_from_video (std::string path, samplepos_t n, bool lock_position_to_video)
 {
        vector<std::string> paths;
        paths.push_back(path);
-#if 0
-       do_import (paths, Editing::ImportDistinctFiles, Editing::ImportAsTrack, ARDOUR::SrcBest, n);
-#else
        current_interthread_info = &import_status;
        import_status.current = 1;
        import_status.total = paths.size ();
@@ -98,35 +97,13 @@ Editor::embed_audio_from_video (std::string path, framepos_t n)
        boost::shared_ptr<ARDOUR::Track> track;
        bool ok = (import_sndfiles (paths, Editing::ImportDistinctFiles, Editing::ImportAsTrack, ARDOUR::SrcBest, n, 1, 1, track, false) == 0);
        if (ok && track) {
-               boost::shared_ptr<ARDOUR::Playlist> pl = track->playlist();
-               pl->find_next_region(n, ARDOUR::End, 0)->set_video_locked(true);
+               if (lock_position_to_video) {
+                       boost::shared_ptr<ARDOUR::Playlist> pl = track->playlist();
+                       pl->find_next_region(n, ARDOUR::End, 0)->set_video_locked(true);
+               }
                _session->save_state ("");
        }
 
        import_status.all_done = true;
-#endif
-       unlink(path.c_str());
-}
-
-void
-Editor::export_video ()
-{
-       if (ARDOUR::Config->get_show_video_export_info()) {
-               ExportVideoInfobox infobox (_session);
-               Gtk::ResponseType rv = (Gtk::ResponseType) infobox.run();
-               if (infobox.show_again()) {
-                       ARDOUR::Config->set_show_video_export_info(false);
-               }
-               switch (rv) {
-                       case GTK_RESPONSE_YES:
-                               PBD::open_uri (ARDOUR::Config->get_reference_manual_url() + "/video-timeline/operations/#export");
-                               break;
-                       default:
-                               break;
-               }
-       }
-       ExportVideoDialog dialog (_session, get_selection().time);
-       Gtk::ResponseType r = (Gtk::ResponseType) dialog.run();
-       (void) r; // keep gcc quiet
-       dialog.hide();
+       ::g_unlink(path.c_str());
 }