Editor zooming: Config preference to define how much zooming will be easily allowed beyond the session_ui_extents()

This commit is contained in:
Ben Loftis 2017-08-26 22:44:48 -05:00
parent 49765f8897
commit 1c145ccfc3
4 changed files with 32 additions and 7 deletions

View File

@ -584,6 +584,10 @@ Editor::autoscroll_active () const
std::pair <framepos_t,framepos_t>
Editor::session_gui_extents () const
{
if (!_session) {
return std::pair <framepos_t,framepos_t>(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 <framepos_t,framepos_t> ret (session_extent_start, session_extent_end);
return ret;

View 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);
}

View File

@ -2345,6 +2345,18 @@ RCOptionEditor::RCOptionEditor ()
dps->add (1.0, _("100%"));
add_option (_("Editor"), dps);
ComboOption<float>* eet = new ComboOption<float> (
"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"),

View File

@ -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")