mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 07:14:56 +01:00
Stop line drags in collapsed groups.
git-svn-id: svn://localhost/ardour2/branches/3.0@5390 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
9f5b9f3c3e
commit
e11d65d98d
2 changed files with 18 additions and 11 deletions
|
|
@ -30,6 +30,7 @@ using namespace std;
|
||||||
PortMatrixGrid::PortMatrixGrid (PortMatrix* m, PortMatrixBody* b)
|
PortMatrixGrid::PortMatrixGrid (PortMatrix* m, PortMatrixBody* b)
|
||||||
: PortMatrixComponent (m, b),
|
: PortMatrixComponent (m, b),
|
||||||
_dragging (false),
|
_dragging (false),
|
||||||
|
_drag_valid (false),
|
||||||
_moved (false)
|
_moved (false)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -291,18 +292,21 @@ PortMatrixGrid::position_to_node (uint32_t x, uint32_t y) const
|
||||||
void
|
void
|
||||||
PortMatrixGrid::button_press (double x, double y, int b, uint32_t t)
|
PortMatrixGrid::button_press (double x, double y, int b, uint32_t t)
|
||||||
{
|
{
|
||||||
|
pair<boost::shared_ptr<PortGroup>, ARDOUR::BundleChannel> px = position_to_group_and_channel (x / grid_spacing(), _matrix->columns());
|
||||||
|
pair<boost::shared_ptr<PortGroup>, ARDOUR::BundleChannel> py = position_to_group_and_channel (y / grid_spacing(), _matrix->rows());
|
||||||
|
|
||||||
if (b == 1) {
|
if (b == 1) {
|
||||||
|
|
||||||
_dragging = true;
|
_dragging = true;
|
||||||
|
_drag_valid = (px.second.bundle && py.second.bundle);
|
||||||
|
|
||||||
_moved = false;
|
_moved = false;
|
||||||
_drag_start_x = x / grid_spacing ();
|
_drag_start_x = x / grid_spacing ();
|
||||||
_drag_start_y = y / grid_spacing ();
|
_drag_start_y = y / grid_spacing ();
|
||||||
|
|
||||||
} else if (b == 3) {
|
} else if (b == 3) {
|
||||||
|
|
||||||
_matrix->popup_menu (
|
_matrix->popup_menu (px, py, t);
|
||||||
position_to_group_and_channel (x / grid_spacing(), _matrix->columns()),
|
|
||||||
position_to_group_and_channel (y / grid_spacing(), _matrix->rows()), t);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -408,6 +412,7 @@ PortMatrixGrid::button_release (double x, double y, int b, uint32_t t)
|
||||||
|
|
||||||
if (_dragging && _moved) {
|
if (_dragging && _moved) {
|
||||||
|
|
||||||
|
if (_drag_valid) {
|
||||||
list<PortMatrixNode> const p = nodes_on_line (_drag_start_x, _drag_start_y, _drag_x, _drag_y);
|
list<PortMatrixNode> const p = nodes_on_line (_drag_start_x, _drag_start_y, _drag_x, _drag_y);
|
||||||
|
|
||||||
if (!p.empty()) {
|
if (!p.empty()) {
|
||||||
|
|
@ -416,6 +421,7 @@ PortMatrixGrid::button_release (double x, double y, int b, uint32_t t)
|
||||||
set_association (*i, toggle_state (s));
|
set_association (*i, toggle_state (s));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
@ -462,7 +468,7 @@ PortMatrixGrid::draw_extra (cairo_t* cr)
|
||||||
cairo_stroke (cr);
|
cairo_stroke (cr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_dragging && _moved) {
|
if (_dragging && _drag_valid && _moved) {
|
||||||
|
|
||||||
list<PortMatrixNode> const p = nodes_on_line (_drag_start_x, _drag_start_y, _drag_x, _drag_y);
|
list<PortMatrixNode> const p = nodes_on_line (_drag_start_x, _drag_start_y, _drag_x, _drag_y);
|
||||||
|
|
||||||
|
|
@ -525,7 +531,7 @@ PortMatrixGrid::motion (double x, double y)
|
||||||
_moved = true;
|
_moved = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_dragging && _moved) {
|
if (_dragging && _drag_valid && _moved) {
|
||||||
_drag_x = px;
|
_drag_x = px;
|
||||||
_drag_y = py;
|
_drag_y = py;
|
||||||
_body->queue_draw ();
|
_body->queue_draw ();
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,7 @@ private:
|
||||||
bool toggle_state (PortMatrixNode::State) const;
|
bool toggle_state (PortMatrixNode::State) const;
|
||||||
|
|
||||||
bool _dragging;
|
bool _dragging;
|
||||||
|
bool _drag_valid;
|
||||||
bool _moved;
|
bool _moved;
|
||||||
int _drag_start_x;
|
int _drag_start_x;
|
||||||
int _drag_start_y;
|
int _drag_start_y;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue