summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_ops.cc
diff options
context:
space:
mode:
authorTim Mayberry <mojofunk@gmail.com>2016-12-13 09:20:44 +1000
committerTim Mayberry <mojofunk@gmail.com>2016-12-13 12:25:03 +1000
commit89623923bdc475381bfb8b0d318b7284920e05fc (patch)
tree1e3c019e950803bb91cff301bebd44c2dfa3c88b /gtk2_ardour/editor_ops.cc
parent989f934c3825fb600decc467770fea6f802a60b1 (diff)
Change Zoom to Selection action (Z key) to zoom on both axes
Add Zoom to Selection (Horizontal) action to access previous behavior. Remove Editor::temporal_zoom_region as it was duplicate code and broken for both_axes Should Resolve: #7112
Diffstat (limited to 'gtk2_ardour/editor_ops.cc')
-rw-r--r--gtk2_ardour/editor_ops.cc66
1 files changed, 7 insertions, 59 deletions
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index 6171c77d2e..370f57d848 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -1922,53 +1922,6 @@ Editor::calc_extra_zoom_edges(framepos_t &start, framepos_t &end)
}
}
-void
-Editor::temporal_zoom_region (bool both_axes)
-{
- framepos_t start = max_framepos;
- framepos_t end = 0;
- set<TimeAxisView*> tracks;
-
- if ( !get_selection_extents(start, end) )
- return;
-
- calc_extra_zoom_edges (start, end);
-
- /* if we're zooming on both axes we need to save track heights etc.
- */
-
- undo_visual_stack.push_back (current_visual_state (both_axes));
-
- PBD::Unwinder<bool> nsv (no_save_visual, true);
-
- temporal_zoom_by_frame (start, end);
-
- if (both_axes) {
- uint32_t per_track_height = (uint32_t) floor ((_visible_canvas_height - 10.0) / tracks.size());
-
- /* set visible track heights appropriately */
-
- for (set<TimeAxisView*>::iterator t = tracks.begin(); t != tracks.end(); ++t) {
- (*t)->set_height (per_track_height);
- }
-
- /* hide irrelevant tracks */
-
- DisplaySuspender ds;
-
- for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
- if (find (tracks.begin(), tracks.end(), (*i)) == tracks.end()) {
- hide_track_in_display (*i);
- }
- }
-
- vertical_adjustment.set_value (0.0);
- }
-
- redo_visual_stack.push_back (current_visual_state (both_axes));
-}
-
-
bool
Editor::get_selection_extents (framepos_t &start, framepos_t &end) const
{
@@ -2010,7 +1963,7 @@ Editor::get_selection_extents (framepos_t &start, framepos_t &end) const
void
-Editor::temporal_zoom_selection (bool both_axes)
+Editor::temporal_zoom_selection (Editing::ZoomAxis axes)
{
if (!selection) return;
@@ -2018,23 +1971,18 @@ Editor::temporal_zoom_selection (bool both_axes)
//ToDo: if control points are selected, zoom to that
- //if region(s) are selected, zoom to that
- if ( !selection->regions.empty() )
- temporal_zoom_region (both_axes);
-
- //if a range is selected, zoom to that
- if (!selection->time.empty()) {
+ if (axes == Horizontal || axes == Both) {
- framepos_t start, end;
+ framepos_t start, end;
if (get_selection_extents (start, end)) {
- calc_extra_zoom_edges(start, end);
+ calc_extra_zoom_edges (start, end);
temporal_zoom_by_frame (start, end);
}
-
- if (both_axes)
- fit_selection();
}
+ if (axes == Vertical || axes == Both) {
+ fit_selection ();
+ }
}
void