_old_follow_playhead (false)
{
Region::RegionPropertyChanged.connect (region_property_connection, invalidator (*this), boost::bind (&CairoWidget::set_dirty, this), gui_context());
+ Route::RemoteControlIDChange.connect (route_ctrl_id_connection, invalidator (*this), boost::bind (&CairoWidget::set_dirty, this), gui_context());
_editor->playhead_cursor->PositionChanged.connect (position_connection, invalidator (*this), boost::bind (&EditorSummary::playhead_position_changed, this, _1), gui_context());
add_events (Gdk::POINTER_MOTION_MASK|Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK);
EditorSummary::on_key_press_event (GdkEventKey* key)
{
gint x, y;
-
- switch (key->keyval) {
- case GDK_p:
- if (_session) {
- get_pointer (x, y);
- _session->request_locate ((framepos_t) x / _x_scale, _session->transport_rolling());
- return true;
+ GtkAccelKey set_playhead_accel;
+ if (gtk_accel_map_lookup_entry ("<Actions>/Editor/set-playhead", &set_playhead_accel)) {
+ if (key->keyval == set_playhead_accel.accel_key && (int) key->state == set_playhead_accel.accel_mods) {
+ if (_session) {
+ get_pointer (x, y);
+ _session->request_locate (_start + (framepos_t) x / _x_scale, _session->transport_rolling());
+ return true;
+ }
}
- break;
- default:
- break;
}
return false;
bool
EditorSummary::on_key_release_event (GdkEventKey* key)
{
- switch (key->keyval) {
- case GDK_p:
- return true;
- default:
- break;
+
+ GtkAccelKey set_playhead_accel;
+ if (gtk_accel_map_lookup_entry ("<Actions>/Editor/set-playhead", &set_playhead_accel)) {
+ if (key->keyval == set_playhead_accel.accel_key && (int) key->state == set_playhead_accel.accel_mods) {
+ return true;
+ }
}
return false;
}
}
set_editor (x, y);
- set_cursor (_start_position);
+ // set_cursor (_start_position);
} else if (_zoom_dragging) {
double x = xr.first;
double y = yr.first;
- double amount = 8;
-
- if (Keyboard::modifier_state_contains (ev->state, Keyboard::SecondaryModifier)) {
- amount = 64;
- } else if (Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier)) {
- amount = 1;
- }
-
- if (Keyboard::modifier_state_equals (ev->state, Keyboard::SecondaryModifier)) {
-
- /* secondary-wheel == left-right scrolling */
-
- if (ev->direction == GDK_SCROLL_UP) {
- x -= amount;
- } else if (ev->direction == GDK_SCROLL_DOWN) {
- x += amount;
- }
-
- } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
-
- /* primary-wheel == zoom */
-
- if (ev->direction == GDK_SCROLL_UP) {
- _editor->temporal_zoom_step (false);
- } else {
- _editor->temporal_zoom_step (true);
- }
-
- } else {
-
- if (ev->direction == GDK_SCROLL_DOWN) {
- y += amount;
- } else if (ev->direction == GDK_SCROLL_UP) {
- y -= amount;
- } else if (ev->direction == GDK_SCROLL_LEFT) {
- x -= amount;
- } else if (ev->direction == GDK_SCROLL_RIGHT) {
- x += amount;
- }
+ switch (ev->direction) {
+ case GDK_SCROLL_UP:
+ if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollHorizontalModifier)) {
+ x -= 64;
+ } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollZoomHorizontalModifier)) {
+ _editor->temporal_zoom_step (false);
+ } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollZoomVerticalModifier)) {
+ yr.first += 4;
+ yr.second -= 4;
+ set_editor (xr, yr);
+ return true;
+ } else {
+ y -= 8;
+ }
+ break;
+ case GDK_SCROLL_DOWN:
+ if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollHorizontalModifier)) {
+ x += 64;
+ } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollZoomHorizontalModifier)) {
+ _editor->temporal_zoom_step (true);
+ } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollZoomVerticalModifier)) {
+ yr.first -= 4;
+ yr.second += 4;
+ set_editor (xr, yr);
+ return true;
+ } else {
+ y += 8;
+ }
+ break;
+ case GDK_SCROLL_LEFT:
+ if (Keyboard::modifier_state_contains (ev->state, Keyboard::SecondaryModifier)) {
+ x -= 64;
+ } else if (Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier)) {
+ x -= 1;
+ } else {
+ x -= 8;
+ }
+ break;
+ case GDK_SCROLL_RIGHT:
+ if (Keyboard::modifier_state_contains (ev->state, Keyboard::SecondaryModifier)) {
+ x += 64;
+ } else if (Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier)) {
+ x += 1;
+ } else {
+ x += 8;
+ }
+ break;
+ default:
+ break;
}
set_editor (x, y);
as it also means that we won't change these variables if an idle handler
is merely pending but not executing. But c'est la vie.
*/
-
+
return;
}
int const o = int (_last_playhead);
int const n = int (playhead_frame_to_position (p));
if (_session && o != n) {
- int a = min (o, n);
+ int a = max(2, min (o, n));
int b = max (o, n);
- set_overlays_dirty (a - 1, 0, b + 1, get_height ());
+ set_overlays_dirty (a - 2, 0, b + 2, get_height ());
}
}