summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Mayberry <mojofunk@gmail.com>2016-01-07 21:19:09 +1000
committerTim Mayberry <mojofunk@gmail.com>2016-01-21 11:25:56 +1000
commit6ba6cce79905ea1fa831ca7525c16ca1878623a7 (patch)
tree7deb05331c00cabf986beff872cf05ae06a24b51
parent72bdfc38a8aabd5c1277825f84969d30adadb1af (diff)
Refactor code into Editor::temporal_zoom_step_mouse_focus method
-rw-r--r--gtk2_ardour/editor.h1
-rw-r--r--gtk2_ardour/editor_canvas_events.cc20
-rw-r--r--gtk2_ardour/editor_ops.cc8
3 files changed, 13 insertions, 16 deletions
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index 25945edb0a..3c89281a4a 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -295,6 +295,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
framecnt_t get_current_zoom () const { return samples_per_pixel; }
void cycle_zoom_focus ();
void temporal_zoom_step (bool coarser);
+ void temporal_zoom_step_mouse_focus (bool coarser);
void ensure_time_axis_view_is_visible (TimeAxisView const & tav, bool at_top);
void tav_zoom_step (bool coarser);
void tav_zoom_smooth (bool coarser, bool force_all);
diff --git a/gtk2_ardour/editor_canvas_events.cc b/gtk2_ardour/editor_canvas_events.cc
index 7dcfe37fe5..e821254c9b 100644
--- a/gtk2_ardour/editor_canvas_events.cc
+++ b/gtk2_ardour/editor_canvas_events.cc
@@ -76,10 +76,7 @@ Editor::track_canvas_scroll (GdkEventScroll* ev)
case GDK_SCROLL_UP:
if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollZoomHorizontalModifier)) {
//for mouse-wheel zoom, force zoom-focus to mouse
- Editing::ZoomFocus temp_focus = zoom_focus;
- zoom_focus = Editing::ZoomFocusMouse;
- temporal_zoom_step (false);
- zoom_focus = temp_focus;
+ temporal_zoom_step_mouse_focus (false);
return true;
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollHorizontalModifier)) {
scroll_left_step ();
@@ -105,10 +102,7 @@ Editor::track_canvas_scroll (GdkEventScroll* ev)
case GDK_SCROLL_DOWN:
if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollZoomHorizontalModifier)) {
//for mouse-wheel zoom, force zoom-focus to mouse
- Editing::ZoomFocus temp_focus = zoom_focus;
- zoom_focus = Editing::ZoomFocusMouse;
- temporal_zoom_step (true);
- zoom_focus = temp_focus;
+ temporal_zoom_step_mouse_focus (true);
return true;
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollHorizontalModifier)) {
scroll_right_step ();
@@ -1033,10 +1027,7 @@ Editor::canvas_ruler_event (GdkEvent *event, ArdourCanvas::Item* item, ItemType
scroll_left_half_page ();
} else if (Profile->get_mixbus()) {
//for mouse-wheel zoom, force zoom-focus to mouse
- Editing::ZoomFocus temp_focus = zoom_focus;
- zoom_focus = Editing::ZoomFocusMouse;
- temporal_zoom_step (false);
- zoom_focus = temp_focus;
+ temporal_zoom_step_mouse_focus (false);
} else {
temporal_zoom_step (false);
}
@@ -1049,10 +1040,7 @@ Editor::canvas_ruler_event (GdkEvent *event, ArdourCanvas::Item* item, ItemType
scroll_right_half_page ();
} else if (Profile->get_mixbus()) {
//for mouse-wheel zoom, force zoom-focus to mouse
- Editing::ZoomFocus temp_focus = zoom_focus;
- zoom_focus = Editing::ZoomFocusMouse;
- temporal_zoom_step (true);
- zoom_focus = temp_focus;
+ temporal_zoom_step_mouse_focus (true);
} else {
temporal_zoom_step (true);
}
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index d0b24be866..814cded541 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -1687,6 +1687,14 @@ Editor::tav_zoom_smooth (bool coarser, bool force_all)
}
}
+void
+Editor::temporal_zoom_step_mouse_focus (bool coarser)
+{
+ Editing::ZoomFocus temp_focus = zoom_focus;
+ zoom_focus = Editing::ZoomFocusMouse;
+ temporal_zoom_step (coarser);
+ zoom_focus = temp_focus;
+}
void
Editor::temporal_zoom_step (bool coarser)