Make scroll-wheel modifier keys consistent in editor summary pane.

Separate out the handling of left/right scroll events from normal up/down
ones in the editor summary pane scroll wheel handling, and use the new
constants for scroll wheel keyboard modifiers in conjunction with up/down
scroll events. Modifiers for left/right scroll events should be unaffected
by this.
This commit is contained in:
Colin Fletcher 2013-06-21 20:44:40 +01:00
parent 21914c884e
commit 741f9de3f7

View file

@ -623,45 +623,45 @@ EditorSummary::on_scroll_event (GdkEventScroll* ev)
double x = xr.first; double x = xr.first;
double y = yr.first; double y = yr.first;
double amount = 8; switch (ev->direction) {
case GDK_SCROLL_UP:
if (Keyboard::modifier_state_contains (ev->state, Keyboard::SecondaryModifier)) { if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollHorizontalModifier)) {
amount = 64; x -= 64;
} else if (Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier)) { } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollZoomHorizontalModifier)) {
amount = 1; _editor->temporal_zoom_step (false);
} } else {
y -= 8;
if (Keyboard::modifier_state_equals (ev->state, Keyboard::SecondaryModifier)) { }
break;
/* secondary-wheel == left-right scrolling */ case GDK_SCROLL_DOWN:
if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollHorizontalModifier)) {
if (ev->direction == GDK_SCROLL_UP) { x += 64;
x -= amount; } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollZoomHorizontalModifier)) {
} else if (ev->direction == GDK_SCROLL_DOWN) { _editor->temporal_zoom_step (true);
x += amount; } else {
} y += 8;
}
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) { break;
case GDK_SCROLL_LEFT:
/* primary-wheel == zoom */ if (Keyboard::modifier_state_contains (ev->state, Keyboard::SecondaryModifier)) {
x -= 64;
if (ev->direction == GDK_SCROLL_UP) { } else if (Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier)) {
_editor->temporal_zoom_step (false); x -= 1;
} else { } else {
_editor->temporal_zoom_step (true); x -= 8;
} }
break;
} else { case GDK_SCROLL_RIGHT:
if (Keyboard::modifier_state_contains (ev->state, Keyboard::SecondaryModifier)) {
if (ev->direction == GDK_SCROLL_DOWN) { x += 64;
y += amount; } else if (Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier)) {
} else if (ev->direction == GDK_SCROLL_UP) { x += 1;
y -= amount; } else {
} else if (ev->direction == GDK_SCROLL_LEFT) { x += 8;
x -= amount; }
} else if (ev->direction == GDK_SCROLL_RIGHT) { break;
x += amount; default:
} break;
} }
set_editor (x, y); set_editor (x, y);