a-fluidsynth: implement LV2_BANKPATCH__notify
[ardour.git] / gtk2_ardour / editor_ops.cc
index a0370d0d7ed97849c72b0629405912e8f63b05b8..41fe50d6ef59b79db0853c9807733588500bc128 100644 (file)
@@ -1790,11 +1790,11 @@ Editor::temporal_zoom_step_scale (bool zoom_out, double scale)
        }
 
        //zoom-behavior-tweaks
-       //limit our maximum zoom to the session gui extents value (+10%)
+       //limit our maximum zoom to the session gui extents value
        std::pair<framepos_t, framepos_t> ext = session_gui_extents();
        framecnt_t session_extents_pp = ( ext.second - ext.first )  / _visible_canvas_width;
-       if (nspp > session_extents_pp * 1.1)
-               nspp = session_extents_pp * 1.1;
+       if (nspp > session_extents_pp)
+               nspp = session_extents_pp;
 
        temporal_zoom (nspp);
 }
@@ -2058,6 +2058,39 @@ Editor::temporal_zoom_session ()
        }
 }
 
+void
+Editor::temporal_zoom_extents ()
+{
+       ENSURE_GUI_THREAD (*this, &Editor::temporal_zoom_extents)
+
+       if (_session) {
+               std::pair<framepos_t, framepos_t> ext = session_gui_extents( false );  //in this case we want to zoom to the extents explicitly; ignore the users prefs for extra padding
+
+               framecnt_t start = ext.first;
+               framecnt_t end = ext.second;
+
+               if (_session->actively_recording () ) {
+                       framepos_t cur = playhead_cursor->current_frame ();
+                       if (cur > end) {
+                               /* recording beyond the end marker; zoom out
+                                * by 5 seconds more so that if 'follow
+                                * playhead' is active we don't immediately
+                                * scroll.
+                                */
+                               end = cur + _session->frame_rate() * 5;
+                       }
+               }
+
+               if ((start == 0 && end == 0) || end < start) {
+                       return;
+               }
+
+               calc_extra_zoom_edges(start, end);
+
+               temporal_zoom_by_frame (start, end);
+       }
+}
+
 void
 Editor::temporal_zoom_by_frame (framepos_t start, framepos_t end)
 {