mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 07:45:00 +01:00
add scroll wheel handler to canvas
This commit is contained in:
parent
4bba1059e8
commit
2cc25a9d79
2 changed files with 27 additions and 0 deletions
|
|
@ -689,6 +689,32 @@ GtkCanvas::context ()
|
||||||
return w->create_cairo_context ();
|
return w->create_cairo_context ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Handler for GDK scroll events.
|
||||||
|
* @param ev Event.
|
||||||
|
* @return true if the event was handled.
|
||||||
|
*/
|
||||||
|
bool
|
||||||
|
GtkCanvas::on_scroll_event (GdkEventScroll* ev)
|
||||||
|
{
|
||||||
|
/* translate event coordinates from window to canvas */
|
||||||
|
|
||||||
|
GdkEvent copy = *((GdkEvent*)ev);
|
||||||
|
Duple winpos = Duple (ev->x, ev->y);
|
||||||
|
Duple where = window_to_canvas (winpos);
|
||||||
|
|
||||||
|
pick_current_item (winpos, ev->state);
|
||||||
|
|
||||||
|
copy.button.x = where.x;
|
||||||
|
copy.button.y = where.y;
|
||||||
|
|
||||||
|
/* Coordinates in the event will be canvas coordinates, correctly adjusted
|
||||||
|
for scroll if this GtkCanvas is in a GtkCanvasViewport.
|
||||||
|
*/
|
||||||
|
|
||||||
|
DEBUG_TRACE (PBD::DEBUG::CanvasEvents, string_compose ("canvas scroll @ %1, %2 => %3\n", ev->x, ev->y, where));
|
||||||
|
return deliver_event (reinterpret_cast<GdkEvent*>(©));
|
||||||
|
}
|
||||||
|
|
||||||
/** Handler for GDK button press events.
|
/** Handler for GDK button press events.
|
||||||
* @param ev Event.
|
* @param ev Event.
|
||||||
* @return true if the event was handled.
|
* @return true if the event was handled.
|
||||||
|
|
|
||||||
|
|
@ -151,6 +151,7 @@ public:
|
||||||
Coord height() const;
|
Coord height() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
bool on_scroll_event (GdkEventScroll *);
|
||||||
bool on_expose_event (GdkEventExpose *);
|
bool on_expose_event (GdkEventExpose *);
|
||||||
bool on_button_press_event (GdkEventButton *);
|
bool on_button_press_event (GdkEventButton *);
|
||||||
bool on_button_release_event (GdkEventButton* event);
|
bool on_button_release_event (GdkEventButton* event);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue