Editor zooming: Config preference to define how much zooming will be easily allowed...
authorBen Loftis <ben@harrisonconsoles.com>
Sun, 27 Aug 2017 03:44:48 +0000 (22:44 -0500)
committerBen Loftis <ben@harrisonconsoles.com>
Sun, 27 Aug 2017 03:44:58 +0000 (22:44 -0500)
gtk2_ardour/editor_canvas.cc
gtk2_ardour/editor_ops.cc
gtk2_ardour/rc_option_editor.cc
gtk2_ardour/ui_config_vars.h

index 565dbf0b784bdc289b9ce016e8a74611d056f1c7..729034a2049d24228918b5b7d68a7d389dc009ea 100644 (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;
index a0370d0d7ed97849c72b0629405912e8f63b05b8..f8c7a9c5467538f3294e26d54b568641fa190902 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);
 }
index ea7db58809e6d3b5a33083af1764885ad61257a0..0cf2ed41f34c4e1e1dcdfe1c1b7f438b12513018 100644 (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"),
index 0bf9a2c15a134186c6a10cbace2004c826b475d6..9fa737315133f288a4237997932b22a5d65ab1b9 100644 (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")