Merge branch 'master' into cairocanvas
[ardour.git] / gtk2_ardour / editor.cc
index c7bdfc15daa526c9197627672d6fccf4de3ae60a..2b430c8a40e9c4db9db6543f80f34c70a0a0c638 100644 (file)
@@ -47,6 +47,7 @@
 #include "pbd/stacktrace.h"
 
 #include <glibmm/miscutils.h>
+#include <glibmm/uriutils.h>
 #include <gtkmm/image.h>
 #include <gdkmm/color.h>
 #include <gdkmm/bitmap.h>
@@ -1913,6 +1914,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)));
+       }
 }
 
 
@@ -3175,33 +3179,8 @@ Editor::convert_drop_to_paths (
        }
 
        for (vector<string>::iterator i = uris.begin(); i != uris.end(); ++i) {
-
                if ((*i).substr (0,7) == "file://") {
-
-                       string const p = PBD::url_decode (*i);
-
-                       // scan forward past three slashes
-
-                       string::size_type slashcnt = 0;
-                       string::size_type n = 0;
-                       string::const_iterator x = p.begin();
-
-                       while (slashcnt < 3 && x != p.end()) {
-                               if ((*x) == '/') {
-                                       slashcnt++;
-                               } else if (slashcnt == 3) {
-                                       break;
-                               }
-                               ++n;
-                               ++x;
-                       }
-
-                       if (slashcnt != 3 || x == p.end()) {
-                               error << _("malformed URL passed to drag-n-drop code") << endmsg;
-                               continue;
-                       }
-
-                       paths.push_back (p.substr (n - 1));
+                       paths.push_back (Glib::filename_from_uri (*i));
                }
        }
 
@@ -3210,7 +3189,6 @@ Editor::convert_drop_to_paths (
 
 void
 Editor::new_tempo_section ()
-
 {
 }
 
@@ -4266,7 +4244,16 @@ Editor::set_samples_per_pixel (framecnt_t spp)
 
        ZoomChanged (); /* EMIT_SIGNAL */
 
-       //reset_scrolling_region ();
+       ArdourCanvas::GtkCanvasViewport* c;
+
+       c = get_time_bars_canvas();
+       if (c) {
+               c->canvas()->zoomed ();
+       }
+       c = get_track_canvas();
+       if (c) {
+               c->canvas()->zoomed ();
+       }
 
        if (playhead_cursor) {
                playhead_cursor->set_position (playhead_cursor->current_frame ());
@@ -4392,7 +4379,7 @@ Editor::get_preferred_edit_position (bool ignore_playhead, bool from_context_men
        EditPoint ep = _edit_point;
 
        if (from_context_menu && (ep == EditAtMouse)) {
-               return  window_event_frame (&context_click_event, 0, 0);
+               return  canvas_event_frame (&context_click_event, 0, 0);
        }
 
        if (entered_marker) {
@@ -4879,8 +4866,10 @@ Editor::add_routes (RouteList& routes)
                rtv->view()->RegionViewRemoved.connect (sigc::mem_fun (*this, &Editor::region_view_removed));
        }
 
-       _routes->routes_added (new_views);
-       _summary->routes_added (new_views);
+       if (new_views.size() > 0) {
+               _routes->routes_added (new_views);
+               _summary->routes_added (new_views);
+       }
 
        if (show_editor_mixer_when_tracks_arrive) {
                show_editor_mixer (true);