framepos_t xdelta;
int direction = ev->direction;
+ /* this event arrives without transformation by the canvas, so we have
+ * to transform the coordinates to be able to look things up.
+ */
+
+ Duple event_coords = _track_canvas->window_to_canvas (Duple (ev->x, ev->y));
+
retry:
switch (direction) {
case GDK_SCROLL_UP:
- if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
+ 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;
return true;
- } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::SecondaryModifier)) {
+ } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollHorizontalModifier)) {
direction = GDK_SCROLL_LEFT;
goto retry;
- } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
+ } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollZoomVerticalModifier)) {
if (!current_stepping_trackview) {
step_timeout = Glib::signal_timeout().connect (sigc::mem_fun(*this, &Editor::track_height_step_timeout), 500);
- std::pair<TimeAxisView*, int> const p = trackview_by_y_position (ev->y + vertical_adjustment.get_value());
+ std::pair<TimeAxisView*, int> const p = trackview_by_y_position (event_coords.y);
current_stepping_trackview = p.first;
if (!current_stepping_trackview) {
return false;
break;
case GDK_SCROLL_DOWN:
- if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
+ 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;
return true;
- } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::SecondaryModifier)) {
+ } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollHorizontalModifier)) {
direction = GDK_SCROLL_RIGHT;
goto retry;
- } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
+ } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollZoomVerticalModifier)) {
if (!current_stepping_trackview) {
step_timeout = Glib::signal_timeout().connect (sigc::mem_fun(*this, &Editor::track_height_step_timeout), 500);
- std::pair<TimeAxisView*, int> const p = trackview_by_y_position (ev->y + vertical_adjustment.get_value());
+ std::pair<TimeAxisView*, int> const p = trackview_by_y_position (event_coords.y);
current_stepping_trackview = p.first;
if (!current_stepping_trackview) {
return false;
break;
case GDK_SCROLL_LEFT:
- xdelta = (current_page_frames() / 8);
+ xdelta = (current_page_samples() / 8);
if (leftmost_frame > xdelta) {
reset_x_origin (leftmost_frame - xdelta);
} else {
break;
case GDK_SCROLL_RIGHT:
- xdelta = (current_page_frames() / 8);
+ xdelta = (current_page_samples() / 8);
if (max_framepos - xdelta > leftmost_frame) {
reset_x_origin (leftmost_frame + xdelta);
} else {
- reset_x_origin (max_framepos - current_page_frames());
+ reset_x_origin (max_framepos - current_page_samples());
}
break;
return typed_event (item, event, CdMarkerBarItem);
}
-#ifdef WITH_VIDEOTIMELINE
bool
Editor::canvas_videotl_bar_event (GdkEvent *event, ArdourCanvas::Item* item)
{
return typed_event (item, event, VideoBarItem);
}
-#endif
bool
Editor::canvas_tempo_marker_event (GdkEvent *event, ArdourCanvas::Item* item, TempoMarker* /*marker*/)
bool
Editor::track_canvas_drag_motion (Glib::RefPtr<Gdk::DragContext> const& context, int x, int y, guint time)
{
- ArdourCanvas::Coord wx;
- ArdourCanvas::Coord wy;
boost::shared_ptr<Region> region;
boost::shared_ptr<Region> region_copy;
RouteTimeAxisView* rtav;
return false;
}
- _track_canvas_viewport->window_to_canvas (x, y, wx, wy);
-
event.type = GDK_MOTION_NOTIFY;
- event.button.x = wx;
- event.button.y = wy;
+ event.button.x = x;
+ event.button.y = y;
/* assume we're dragging with button 1 */
event.motion.state = Gdk::BUTTON1_MASK;
- (void) event_frame (&event, &px, &py);
+ (void) window_event_frame (&event, &px, &py);
std::pair<TimeAxisView*, int> const tv = trackview_by_y_position (py);
bool can_drop = false;
const SelectionData& /*data*/,
guint /*info*/, guint /*time*/)
{
- double wx;
- double wy;
boost::shared_ptr<Region> region;
boost::shared_ptr<Region> region_copy;
RouteTimeAxisView* rtav;
double px;
double py;
- _track_canvas_viewport->window_to_canvas (x, y, wx, wy);
-
event.type = GDK_MOTION_NOTIFY;
- event.button.x = wx;
- event.button.y = wy;
+ event.button.x = x;
+ event.button.y = y;
/* assume we're dragging with button 1 */
event.motion.state = Gdk::BUTTON1_MASK;
- framepos_t const pos = event_frame (&event, &px, &py);
+ framepos_t const pos = window_event_frame (&event, &px, &py);
std::pair<TimeAxisView*, int> const tv = trackview_by_y_position (py);