Refactor scrolling in Editor ruler canvas area into two utility methods
This commit is contained in:
parent
743e324c6a
commit
08cbe0532c
|
@ -377,6 +377,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
|
||||||
void scroll_left_step ();
|
void scroll_left_step ();
|
||||||
void scroll_right_step ();
|
void scroll_right_step ();
|
||||||
|
|
||||||
|
void scroll_left_half_page ();
|
||||||
|
void scroll_right_half_page ();
|
||||||
|
|
||||||
void prepare_for_cleanup ();
|
void prepare_for_cleanup ();
|
||||||
void finish_cleanup ();
|
void finish_cleanup ();
|
||||||
|
|
||||||
|
|
|
@ -1018,7 +1018,6 @@ Editor::canvas_meter_marker_event (GdkEvent *event, ArdourCanvas::Item* item, Me
|
||||||
bool
|
bool
|
||||||
Editor::canvas_ruler_event (GdkEvent *event, ArdourCanvas::Item* item, ItemType type)
|
Editor::canvas_ruler_event (GdkEvent *event, ArdourCanvas::Item* item, ItemType type)
|
||||||
{
|
{
|
||||||
framepos_t xdelta;
|
|
||||||
bool handled = false;
|
bool handled = false;
|
||||||
|
|
||||||
if (event->type == GDK_SCROLL) {
|
if (event->type == GDK_SCROLL) {
|
||||||
|
@ -1056,22 +1055,12 @@ Editor::canvas_ruler_event (GdkEvent *event, ArdourCanvas::Item* item, ItemType
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GDK_SCROLL_LEFT:
|
case GDK_SCROLL_LEFT:
|
||||||
xdelta = (current_page_samples() / 2);
|
scroll_left_half_page ();
|
||||||
if (leftmost_frame > xdelta) {
|
|
||||||
reset_x_origin (leftmost_frame - xdelta);
|
|
||||||
} else {
|
|
||||||
reset_x_origin (0);
|
|
||||||
}
|
|
||||||
handled = true;
|
handled = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GDK_SCROLL_RIGHT:
|
case GDK_SCROLL_RIGHT:
|
||||||
xdelta = (current_page_samples() / 2);
|
scroll_right_half_page ();
|
||||||
if (max_framepos - xdelta > leftmost_frame) {
|
|
||||||
reset_x_origin (leftmost_frame + xdelta);
|
|
||||||
} else {
|
|
||||||
reset_x_origin (max_framepos - current_page_samples());
|
|
||||||
}
|
|
||||||
handled = true;
|
handled = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -1614,6 +1614,28 @@ Editor::scroll_right_step ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Editor::scroll_left_half_page ()
|
||||||
|
{
|
||||||
|
framepos_t xdelta = (current_page_samples() / 2);
|
||||||
|
if (leftmost_frame > xdelta) {
|
||||||
|
reset_x_origin (leftmost_frame - xdelta);
|
||||||
|
} else {
|
||||||
|
reset_x_origin (0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Editor::scroll_right_half_page ()
|
||||||
|
{
|
||||||
|
framepos_t xdelta = (current_page_samples() / 2);
|
||||||
|
if (max_framepos - xdelta > leftmost_frame) {
|
||||||
|
reset_x_origin (leftmost_frame + xdelta);
|
||||||
|
} else {
|
||||||
|
reset_x_origin (max_framepos - current_page_samples());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* ZOOM */
|
/* ZOOM */
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in New Issue
Block a user