diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index 565dbf0b78..729034a204 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -584,6 +584,10 @@ Editor::autoscroll_active () const std::pair Editor::session_gui_extents () const { + if (!_session) { + return std::pair (max_framepos,0); + } + framecnt_t session_extent_start = _session->current_start_frame(); framecnt_t session_extent_end = _session->current_end_frame(); @@ -611,10 +615,18 @@ 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) - //if all else fails, give us 2 minutes - framecnt_t const min_length = _session->nominal_frame_rate()*60*2; - if ( session_extent_end < min_length ) - session_extent_end = min_length; + //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; + + //range-check + if (session_extent_end > max_framepos) { + session_extent_end = max_framepos; + } + if (session_extent_start < 0) { + session_extent_start = 0; + } std::pair ret (session_extent_start, session_extent_end); return ret; diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index a0370d0d7e..f8c7a9c546 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -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 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); } diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index ea7db58809..0cf2ed41f3 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -2345,6 +2345,18 @@ RCOptionEditor::RCOptionEditor () dps->add (1.0, _("100%")); add_option (_("Editor"), dps); + ComboOption* eet = new ComboOption ( + "extra-ui-extents-time", + _("Limit zooming & summary view to X minutes beyond session extents"), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_extra_ui_extents_time), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_extra_ui_extents_time) + ); + eet->add (1, _("1 minute")); + eet->add (2, _("2 minutes")); + eet->add (20, _("20 minutes")); + eet->add (60, _("1 hour")); + add_option (_("Editor"), eet); + if (!Profile->get_mixbus()) { add_option (_("Editor"), diff --git a/gtk2_ardour/ui_config_vars.h b/gtk2_ardour/ui_config_vars.h index 0bf9a2c15a..9fa7373151 100644 --- a/gtk2_ardour/ui_config_vars.h +++ b/gtk2_ardour/ui_config_vars.h @@ -33,6 +33,7 @@ UI_CONFIG_VARIABLE (bool, show_waveform_clipping, "show-waveform-clipping", true UI_CONFIG_VARIABLE (uint32_t, lock_gui_after_seconds, "lock-gui-after-seconds", 0) UI_CONFIG_VARIABLE (bool, draggable_playhead, "draggable-playhead", true) UI_CONFIG_VARIABLE (float, draggable_playhead_speed, "draggable-playhead-speed", 1.0) +UI_CONFIG_VARIABLE (float, extra_ui_extents_time, "extra-ui-extents-time", 1.0) UI_CONFIG_VARIABLE (bool, new_automation_points_on_lane, "new-automation-points-on-lane", false) UI_CONFIG_VARIABLE (std::string, keyboard_layout, "keyboard-layout", "ansi") UI_CONFIG_VARIABLE (std::string, keyboard_layout_name, "keyboard-layout-name", "ansi")