summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk2_ardour/ardour.menus.in1
-rw-r--r--gtk2_ardour/editor.cc1
-rw-r--r--gtk2_ardour/editor.h3
-rw-r--r--gtk2_ardour/editor_actions.cc1
-rw-r--r--gtk2_ardour/editor_canvas.cc12
-rw-r--r--gtk2_ardour/editor_ops.cc33
6 files changed, 45 insertions, 6 deletions
diff --git a/gtk2_ardour/ardour.menus.in b/gtk2_ardour/ardour.menus.in
index 668df5c905..855f5679f4 100644
--- a/gtk2_ardour/ardour.menus.in
+++ b/gtk2_ardour/ardour.menus.in
@@ -449,6 +449,7 @@
<menuitem action='temporal-zoom-in'/>
<menuitem action='temporal-zoom-out'/>
<menuitem action='zoom-to-session'/>
+ <menuitem action='zoom-to-extents'/>
<menuitem action='zoom-to-selection'/>
<menuitem action='zoom-to-selection-horiz'/>
<menuitem action='fit-selection'/>
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index d525761140..210f6350be 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -3782,6 +3782,7 @@ Editor::build_track_count_menu ()
zoom_preset_selector.AddMenuElem (MenuElem (_("Zoom to 8 hours"), sigc::bind (sigc::mem_fun(*this, &Editor::set_zoom_preset), 8 * 60 * 60 * 1000)));
zoom_preset_selector.AddMenuElem (MenuElem (_("Zoom to 24 hours"), sigc::bind (sigc::mem_fun(*this, &Editor::set_zoom_preset), 24 * 60 * 60 * 1000)));
zoom_preset_selector.AddMenuElem (MenuElem (_("Zoom to Session"), sigc::mem_fun(*this, &Editor::temporal_zoom_session)));
+ zoom_preset_selector.AddMenuElem (MenuElem (_("Zoom to Extents"), sigc::mem_fun(*this, &Editor::temporal_zoom_extents)));
zoom_preset_selector.AddMenuElem (MenuElem (_("Zoom to Range/Region Selection"), sigc::bind (sigc::mem_fun(*this, &Editor::temporal_zoom_selection), Horizontal)));
}
}
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index b43beff9bc..68ba110123 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -365,7 +365,7 @@ public:
void toggle_measure_visibility ();
/* returns the left-most and right-most time that the gui should allow the user to scroll to */
- std::pair <framepos_t,framepos_t> session_gui_extents() const;
+ std::pair <framepos_t,framepos_t> session_gui_extents( bool use_extra = true ) const;
/* fades */
@@ -1342,6 +1342,7 @@ private:
void calc_extra_zoom_edges(framepos_t &start, framepos_t &end);
void temporal_zoom_selection (Editing::ZoomAxis);
void temporal_zoom_session ();
+ void temporal_zoom_extents ();
void temporal_zoom (framecnt_t samples_per_pixel);
void temporal_zoom_by_frame (framepos_t start, framepos_t end);
void temporal_zoom_to_frame (bool coarser, framepos_t frame);
diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc
index 14d82fc3ce..8a447beecf 100644
--- a/gtk2_ardour/editor_actions.cc
+++ b/gtk2_ardour/editor_actions.cc
@@ -276,6 +276,7 @@ Editor::register_actions ()
reg_sens (editor_actions, "temporal-zoom-out", _("Zoom Out"), sigc::bind (sigc::mem_fun(*this, &Editor::temporal_zoom_step), true));
reg_sens (editor_actions, "temporal-zoom-in", _("Zoom In"), sigc::bind (sigc::mem_fun(*this, &Editor::temporal_zoom_step), false));
reg_sens (editor_actions, "zoom-to-session", _("Zoom to Session"), sigc::mem_fun(*this, &Editor::temporal_zoom_session));
+ reg_sens (editor_actions, "zoom-to-extents", _("Zoom to Extents"), sigc::mem_fun(*this, &Editor::temporal_zoom_extents));
reg_sens (editor_actions, "zoom-to-selection", _("Zoom to Selection"), sigc::bind (sigc::mem_fun(*this, &Editor::temporal_zoom_selection), Both));
reg_sens (editor_actions, "zoom-to-selection-horiz", _("Zoom to Selection (Horizontal)"), sigc::bind (sigc::mem_fun(*this, &Editor::temporal_zoom_selection), Horizontal));
reg_sens (editor_actions, "toggle-zoom", _("Toggle Zoom State"), sigc::mem_fun(*this, &Editor::swap_visual_state));
diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc
index 729034a204..56571c3de8 100644
--- a/gtk2_ardour/editor_canvas.cc
+++ b/gtk2_ardour/editor_canvas.cc
@@ -582,7 +582,7 @@ Editor::autoscroll_active () const
}
std::pair <framepos_t,framepos_t>
-Editor::session_gui_extents () const
+Editor::session_gui_extents ( bool use_extra ) const
{
if (!_session) {
return std::pair <framepos_t,framepos_t>(max_framepos,0);
@@ -616,10 +616,12 @@ Editor::session_gui_extents () const
//ToDo: also incorporate automation regions (in case the session has no audio/midi but is just used for automating plugins or the like)
//add additional time to the ui extents ( user-defined in config )
- framecnt_t const extra = UIConfiguration::instance().get_extra_ui_extents_time() * 60 * _session->nominal_frame_rate();
- session_extent_end += extra;
- session_extent_start -= extra;
-
+ if (use_extra) {
+ framecnt_t const extra = UIConfiguration::instance().get_extra_ui_extents_time() * 60 * _session->nominal_frame_rate();
+ session_extent_end += extra;
+ session_extent_start -= extra;
+ }
+
//range-check
if (session_extent_end > max_framepos) {
session_extent_end = max_framepos;
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index f8c7a9c546..41fe50d6ef 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -2059,6 +2059,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)
{
if (!_session) return;