summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_videotimeline.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2013-03-12 22:00:09 +0100
committerRobin Gareus <robin@gareus.org>2013-03-13 20:28:15 +0100
commit0c3e840700a915fc1476cef73c591048f688f81e (patch)
tree3241845f899cfed86217db2f6f589740b2b9c04a /gtk2_ardour/editor_videotimeline.cc
parentd91565093965b3405774acd878b3baf38839f4e4 (diff)
videotimline
squashed 694 commits from http://gareus.org/gitweb/?p=ardour3.git
Diffstat (limited to 'gtk2_ardour/editor_videotimeline.cc')
-rw-r--r--gtk2_ardour/editor_videotimeline.cc126
1 files changed, 126 insertions, 0 deletions
diff --git a/gtk2_ardour/editor_videotimeline.cc b/gtk2_ardour/editor_videotimeline.cc
new file mode 100644
index 0000000000..18a49fc9b6
--- /dev/null
+++ b/gtk2_ardour/editor_videotimeline.cc
@@ -0,0 +1,126 @@
+/*
+ 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.
+
+*/
+#ifdef WITH_VIDEOTIMELINE
+
+#include <jack/types.h>
+
+#include "ardour/profile.h"
+#include "ardour/rc_configuration.h"
+
+#include "ardour_ui.h"
+#include "editor.h"
+#include "simplerect.h"
+#include "canvas_impl.h"
+#include "editing.h"
+#include "audio_time_axis.h"
+#include "video_image_frame.h"
+#include "export_video_dialog.h"
+#include "export_video_infobox.h"
+
+#include "i18n.h"
+
+using namespace std;
+
+void
+Editor::set_video_timeline_height (const int h)
+{
+ if (videotl_bar_height == h) { return; }
+ if (h < 2 || h > 8) { return; }
+ videotl_bar_height = h;
+ const double nh = (videotl_bar_height * timebar_height - ((ARDOUR::Profile->get_sae())?1.0:0.0));
+ videotl_label.set_size_request (-1, (int)timebar_height * videotl_bar_height);
+ videotl_bar->property_y2().set_value(nh);
+ ARDOUR_UI::instance()->video_timeline->set_height(videotl_bar_height * timebar_height);
+ update_ruler_visibility();
+}
+
+void
+Editor::update_video_timeline (bool flush)
+{
+#if DEBUG
+ framepos_t rightmost_frame = leftmost_frame + current_page_frames();
+ std::cout << "VIDEO SCROLL: " << leftmost_frame << " -- " << rightmost_frame << std::endl;
+ std::cout << "SCROLL UNITS: " << frame_to_unit(leftmost_frame) << " -- " << frame_to_unit(rightmost_frame)
+ << " = " << frame_to_unit(rightmost_frame) - frame_to_unit(leftmost_frame)
+ << std::endl;
+#endif
+
+ // TODO later: make this a list for mult. video tracks
+ // also modify ardour_ui_dialogs.cc : set_session()
+ if (flush) {
+ ARDOUR_UI::instance()->video_timeline->flush_local_cache();
+ }
+ if (!ruler_video_action->get_active()) return;
+ ARDOUR_UI::instance()->video_timeline->update_video_timeline();
+}
+
+bool
+Editor::is_video_timeline_locked ()
+{
+ return ARDOUR_UI::instance()->video_timeline->is_offset_locked();
+}
+
+void
+Editor::set_video_timeline_locked (const bool l)
+{
+ ARDOUR_UI::instance()->video_timeline->set_offset_locked(l);
+}
+
+void
+Editor::toggle_video_timeline_locked ()
+{
+ ARDOUR_UI::instance()->video_timeline->toggle_offset_locked();
+}
+
+void
+Editor::embed_audio_from_video (std::string path)
+{
+ vector<std::string> paths;
+ framepos_t n = 0; /* -1: use file's timestamp - but br0ken with ffmpeg wav extract */
+ paths.push_back(path);
+#if 0
+ do_embed (paths, Editing::ImportDistinctFiles, Editing::ImportAsTrack, n);
+#else
+ do_import (paths, Editing::ImportDistinctFiles, Editing::ImportAsTrack, ARDOUR::SrcBest, n);
+ unlink(path.c_str());
+#endif
+}
+
+void
+Editor::export_video ()
+{
+ if (ARDOUR::Config->get_show_video_export_info()) {
+ ExportVideoInfobox infobox (_session);
+ infobox.run();
+ if (infobox.show_again()) {
+ ARDOUR::Config->set_show_video_export_info(false);
+ }
+ }
+ ExportVideoDialog dialog (*this, _session);
+ Gtk::ResponseType r = (Gtk::ResponseType) dialog.run();
+ dialog.hide();
+#if 0
+ if (r == Gtk::RESPONSE_ACCEPT) {
+ ARDOUR_UI::instance()->popup_error(string_compose(_("Export Successful: %1"),dialog.get_exported_filename()));
+ }
+#endif
+}
+
+#endif /* WITH_VIDEOTIMELINE */