-MouseZoomDrag::MouseZoomDrag (Editor* e, ArdourCanvas::Item* i)
- : Drag (e, i)
- , _zoom_out (false)
-{
- DEBUG_TRACE (DEBUG::Drags, "New MouseZoomDrag\n");
-}
-
-void
-MouseZoomDrag::start_grab (GdkEvent* event, Gdk::Cursor *)
-{
- if (Keyboard::the_keyboard().key_is_down (GDK_Control_L)) {
- Drag::start_grab (event, _editor->cursors()->zoom_out);
- _zoom_out = true;
- } else {
- Drag::start_grab (event, _editor->cursors()->zoom_in);
- _zoom_out = false;
- }
-
- show_verbose_cursor_time (adjusted_current_frame (event));
-}
-
-void
-MouseZoomDrag::motion (GdkEvent* event, bool first_move)
-{
- framepos_t start;
- framepos_t end;
-
- framepos_t const pf = adjusted_current_frame (event);
-
- framepos_t grab = grab_frame ();
- _editor->snap_to_with_modifier (grab, event);
-
- /* base start and end on initial click position */
- if (pf < grab) {
- start = pf;
- end = grab;
- } else {
- end = pf;
- start = grab;
- }
-
- if (start != end) {
-
- if (first_move) {
- _editor->zoom_rect->show();
- _editor->zoom_rect->raise_to_top();
- }
-
- _editor->reposition_zoom_rect(start, end);
-
- show_verbose_cursor_time (pf);
- }
-}
-
-void
-MouseZoomDrag::finished (GdkEvent* event, bool movement_occurred)
-{
- if (movement_occurred) {
- motion (event, false);
-
- if (grab_frame() < last_pointer_frame()) {
- _editor->temporal_zoom_by_frame (grab_frame(), last_pointer_frame());
- } else {
- _editor->temporal_zoom_by_frame (last_pointer_frame(), grab_frame());
- }
- } else {
- if (Keyboard::the_keyboard().key_is_down (GDK_Shift_L)) {
- _editor->tav_zoom_step (_zoom_out);
- } else {
- _editor->temporal_zoom_to_frame (_zoom_out, grab_frame());
- }
- }
-
- _editor->zoom_rect->hide();
-}
-
-void
-MouseZoomDrag::aborted (bool)
-{
- _editor->zoom_rect->hide ();
-}
-