13
0

Fix dragging grid lines when you move the mouse outside of the grid during the drag.

git-svn-id: svn://localhost/ardour2/branches/3.0@6120 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2009-11-18 14:53:55 +00:00
parent 0f313672f5
commit b7cfd2849e
3 changed files with 36 additions and 26 deletions

View File

@ -328,14 +328,19 @@ PortMatrixBody::on_button_press_event (GdkEventButton* ev)
bool bool
PortMatrixBody::on_button_release_event (GdkEventButton* ev) PortMatrixBody::on_button_release_event (GdkEventButton* ev)
{ {
if (Gdk::Region (_grid->parent_rectangle()).point_in (ev->x, ev->y)) { for (list<PortMatrixComponent*>::iterator i = _components.begin(); i != _components.end(); ++i) {
if (Gdk::Region ((*i)->parent_rectangle()).point_in (ev->x, ev->y)) {
_grid->button_release ( (*i)->button_release (
_grid->parent_to_component_x (ev->x), (*i)->parent_to_component_x (ev->x),
_grid->parent_to_component_y (ev->y), (*i)->parent_to_component_y (ev->y),
ev->button, ev->time ev->button, ev->time
); );
} else {
(*i)->button_release (
-1, -1,
ev->button, ev->time
);
}
} }
return true; return true;

View File

@ -50,6 +50,7 @@ public:
virtual void mouseover_changed (std::list<PortMatrixNode> const &) = 0; virtual void mouseover_changed (std::list<PortMatrixNode> const &) = 0;
virtual void draw_extra (cairo_t *) = 0; virtual void draw_extra (cairo_t *) = 0;
virtual void button_press (double, double, int, uint32_t) {} virtual void button_press (double, double, int, uint32_t) {}
virtual void button_release (double, double, int, uint32_t) {}
virtual void motion (double, double) {} virtual void motion (double, double) {}
void set_show_ports (bool); void set_show_ports (bool);

View File

@ -359,6 +359,8 @@ PortMatrixGrid::button_release (double x, double y, int b, uint32_t /*t*/)
{ {
if (b == 1) { if (b == 1) {
if (x != -1) {
if (_dragging && _moved) { if (_dragging && _moved) {
if (_drag_valid) { if (_drag_valid) {
@ -382,6 +384,8 @@ PortMatrixGrid::button_release (double x, double y, int b, uint32_t /*t*/)
} }
require_render (); require_render ();
}
_body->queue_draw (); _body->queue_draw ();
} }