2 Copyright (C) 2010 Paul Davis
3 Author: Robin Gareus <robin@gareus.org>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #include <glib/gstdio.h>
23 #include "ardour/profile.h"
24 #include "ardour/rc_configuration.h"
25 #include "ardour/audio_track.h"
26 #include "ardour/audioregion.h"
28 #include "ardour_ui.h"
30 #include "canvas/rectangle.h"
32 #include "audio_time_axis.h"
33 #include "video_image_frame.h"
34 #include "export_video_dialog.h"
35 #include "export_video_infobox.h"
36 #include "interthread_progress_window.h"
38 #include "pbd/openuri.h"
44 Editor::set_video_timeline_height (const int h)
46 if (videotl_bar_height == h) { return; }
47 if (h < 2 || h > 8) { return; }
48 videotl_bar_height = h;
49 videotl_label.set_size_request (-1, (int)timebar_height * videotl_bar_height);
50 ARDOUR_UI::instance()->video_timeline->set_height(videotl_bar_height * timebar_height);
51 update_ruler_visibility();
55 Editor::update_video_timeline (bool flush)
58 ARDOUR_UI::instance()->video_timeline->flush_local_cache();
60 if (!ruler_video_action->get_active()) return;
61 ARDOUR_UI::instance()->video_timeline->update_video_timeline();
65 Editor::is_video_timeline_locked ()
67 return ARDOUR_UI::instance()->video_timeline->is_offset_locked();
71 Editor::set_video_timeline_locked (const bool l)
73 ARDOUR_UI::instance()->video_timeline->set_offset_locked(l);
77 Editor::toggle_video_timeline_locked ()
79 ARDOUR_UI::instance()->video_timeline->toggle_offset_locked();
83 Editor::embed_audio_from_video (std::string path, framepos_t n, bool lock_position_to_video)
85 vector<std::string> paths;
86 paths.push_back(path);
87 current_interthread_info = &import_status;
88 import_status.current = 1;
89 import_status.total = paths.size ();
90 import_status.all_done = false;
92 ImportProgressWindow ipw (&import_status, _("Import"), _("Cancel Import"));
95 boost::shared_ptr<ARDOUR::Track> track;
96 bool ok = (import_sndfiles (paths, Editing::ImportDistinctFiles, Editing::ImportAsTrack, ARDOUR::SrcBest, n, 1, 1, track, false) == 0);
98 if (lock_position_to_video) {
99 boost::shared_ptr<ARDOUR::Playlist> pl = track->playlist();
100 pl->find_next_region(n, ARDOUR::End, 0)->set_video_locked(true);
102 _session->save_state ("");
105 import_status.all_done = true;
106 ::g_unlink(path.c_str());
110 Editor::export_video (bool range)
112 if (ARDOUR::Config->get_show_video_export_info()) {
113 ExportVideoInfobox infobox (_session);
114 Gtk::ResponseType rv = (Gtk::ResponseType) infobox.run();
115 if (infobox.show_again()) {
116 ARDOUR::Config->set_show_video_export_info(false);
119 case GTK_RESPONSE_YES:
120 PBD::open_uri (ARDOUR::Config->get_reference_manual_url() + "/video-timeline/operations/#export");
126 ExportVideoDialog dialog (_session, get_selection().time, range);
127 Gtk::ResponseType r = (Gtk::ResponseType) dialog.run();
128 (void) r; // keep gcc quiet