diff options
author | Carl Hetherington <carl@carlh.net> | 2011-12-07 01:44:47 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2011-12-07 01:44:47 +0000 |
commit | 668c8b1f9e1df57e749e93953918832a38b17e23 (patch) | |
tree | ad16fe6c9874e19736612b1dd39838c0867a71b3 /gtk2_ardour | |
parent | 790d9042c644843f8105c714fad641dd17b7d722 (diff) |
Pass whole GdkEventButton into port matrix button
press/release handlers, rather than just selected
highlights. Remove port in the port matrix on Keyboard
is_delete_event (part of #4536).
git-svn-id: svn://localhost/ardour2/branches/3.0@10920 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/port_matrix_body.cc | 6 | ||||
-rw-r--r-- | gtk2_ardour/port_matrix_column_labels.cc | 9 | ||||
-rw-r--r-- | gtk2_ardour/port_matrix_column_labels.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/port_matrix_component.h | 4 | ||||
-rw-r--r-- | gtk2_ardour/port_matrix_grid.cc | 14 | ||||
-rw-r--r-- | gtk2_ardour/port_matrix_grid.h | 4 | ||||
-rw-r--r-- | gtk2_ardour/port_matrix_row_labels.cc | 10 | ||||
-rw-r--r-- | gtk2_ardour/port_matrix_row_labels.h | 2 |
8 files changed, 28 insertions, 23 deletions
diff --git a/gtk2_ardour/port_matrix_body.cc b/gtk2_ardour/port_matrix_body.cc index 5d7bb0c4b6..83864a607c 100644 --- a/gtk2_ardour/port_matrix_body.cc +++ b/gtk2_ardour/port_matrix_body.cc @@ -334,7 +334,7 @@ PortMatrixBody::on_button_press_event (GdkEventButton* ev) (*i)->button_press ( (*i)->parent_to_component_x (ev->x), (*i)->parent_to_component_y (ev->y), - ev->button, ev->time, ev->state + ev ); } } @@ -350,12 +350,12 @@ PortMatrixBody::on_button_release_event (GdkEventButton* ev) (*i)->button_release ( (*i)->parent_to_component_x (ev->x), (*i)->parent_to_component_y (ev->y), - ev->button, ev->time, ev->state + ev ); } else { (*i)->button_release ( -1, -1, - ev->button, ev->time, ev->state + ev ); } } diff --git a/gtk2_ardour/port_matrix_column_labels.cc b/gtk2_ardour/port_matrix_column_labels.cc index 04b57c404f..5496c40a49 100644 --- a/gtk2_ardour/port_matrix_column_labels.cc +++ b/gtk2_ardour/port_matrix_column_labels.cc @@ -18,6 +18,7 @@ */ #include <iostream> +#include "gtkmm2ext/keyboard.h" #include "ardour/bundle.h" #include "ardour/types.h" #include "port_matrix_column_labels.h" @@ -451,7 +452,7 @@ PortMatrixColumnLabels::position_to_channel (double p, double o, boost::shared_p } void -PortMatrixColumnLabels::button_press (double x, double y, int b, uint32_t t, guint) +PortMatrixColumnLabels::button_press (double x, double y, GdkEventButton* ev) { ARDOUR::BundleChannel w = position_to_channel (x, y, _matrix->visible_columns()); @@ -463,11 +464,13 @@ PortMatrixColumnLabels::button_press (double x, double y, int b, uint32_t t, gui w.channel = -1; } - if (b == 3) { + if (Gtkmm2ext::Keyboard::is_delete_event (ev) && w.channel != -1) { + _matrix->remove_channel (w); + } else if (ev->button == 3) { _matrix->popup_menu ( w, ARDOUR::BundleChannel (), - t + ev->time ); } } diff --git a/gtk2_ardour/port_matrix_column_labels.h b/gtk2_ardour/port_matrix_column_labels.h index 9ff59ec33b..b3f2ed8c80 100644 --- a/gtk2_ardour/port_matrix_column_labels.h +++ b/gtk2_ardour/port_matrix_column_labels.h @@ -36,7 +36,7 @@ class PortMatrixColumnLabels : public PortMatrixLabels public: PortMatrixColumnLabels (PortMatrix *, PortMatrixBody *); - void button_press (double, double, int, uint32_t, guint); + void button_press (double, double, GdkEventButton *); double component_to_parent_x (double x) const; double parent_to_component_x (double x) const; diff --git a/gtk2_ardour/port_matrix_component.h b/gtk2_ardour/port_matrix_component.h index a574d20341..c61d7ec67d 100644 --- a/gtk2_ardour/port_matrix_component.h +++ b/gtk2_ardour/port_matrix_component.h @@ -50,8 +50,8 @@ public: virtual double parent_to_component_y (double y) const = 0; virtual void mouseover_changed (std::list<PortMatrixNode> const &) = 0; virtual void draw_extra (cairo_t *) = 0; - virtual void button_press (double, double, int, uint32_t, guint) {} - virtual void button_release (double, double, int, uint32_t, guint) {} + virtual void button_press (double, double, GdkEventButton *) {} + virtual void button_release (double, double, GdkEventButton *) {} virtual void motion (double, double) {} void set_show_ports (bool); diff --git a/gtk2_ardour/port_matrix_grid.cc b/gtk2_ardour/port_matrix_grid.cc index a4ca3df1b8..daa25139dc 100644 --- a/gtk2_ardour/port_matrix_grid.cc +++ b/gtk2_ardour/port_matrix_grid.cc @@ -312,12 +312,12 @@ PortMatrixGrid::position_to_node (double x, double y) const } void -PortMatrixGrid::button_press (double x, double y, int b, uint32_t t, guint) +PortMatrixGrid::button_press (double x, double y, GdkEventButton* ev) { ARDOUR::BundleChannel const px = position_to_channel (x, y, _matrix->visible_columns()); ARDOUR::BundleChannel const py = position_to_channel (y, x, _matrix->visible_rows()); - if (b == 1) { + if (ev->button == 1) { _dragging = true; _drag_valid = (px.bundle && py.bundle); @@ -326,9 +326,9 @@ PortMatrixGrid::button_press (double x, double y, int b, uint32_t t, guint) _drag_start_x = x / grid_spacing (); _drag_start_y = y / grid_spacing (); - } else if (b == 3) { + } else if (ev->button == 3) { - _matrix->popup_menu (px, py, t); + _matrix->popup_menu (px, py, ev->time); } } @@ -366,9 +366,9 @@ PortMatrixGrid::set_association (PortMatrixNode node, bool s) } void -PortMatrixGrid::button_release (double x, double y, int b, uint32_t /*t*/, guint s) +PortMatrixGrid::button_release (double x, double y, GdkEventButton* ev) { - if (b == 1) { + if (ev->button == 1) { if (x != -1) { @@ -387,7 +387,7 @@ PortMatrixGrid::button_release (double x, double y, int b, uint32_t /*t*/, guint } else { - if (Keyboard::modifier_state_equals (s, Keyboard::PrimaryModifier)) { + if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) { /* associate/disassociate things diagonally down and right until we run out */ PortMatrixNode::State s = (PortMatrixNode::State) 0; while (1) { diff --git a/gtk2_ardour/port_matrix_grid.h b/gtk2_ardour/port_matrix_grid.h index ec7eb32b4b..383db2d42b 100644 --- a/gtk2_ardour/port_matrix_grid.h +++ b/gtk2_ardour/port_matrix_grid.h @@ -41,8 +41,8 @@ class PortMatrixGrid : public PortMatrixComponent public: PortMatrixGrid (PortMatrix *, PortMatrixBody *); - void button_press (double, double, int, uint32_t, guint); - void button_release (double, double, int, uint32_t, guint); + void button_press (double, double, GdkEventButton *); + void button_release (double, double, GdkEventButton *); void motion (double, double); double component_to_parent_x (double x) const; diff --git a/gtk2_ardour/port_matrix_row_labels.cc b/gtk2_ardour/port_matrix_row_labels.cc index 38b2dde6a7..e7f1153e90 100644 --- a/gtk2_ardour/port_matrix_row_labels.cc +++ b/gtk2_ardour/port_matrix_row_labels.cc @@ -20,6 +20,7 @@ #include <iostream> #include <boost/weak_ptr.hpp> #include <cairo/cairo.h> +#include "gtkmm2ext/keyboard.h" #include "ardour/bundle.h" #include "port_matrix_row_labels.h" #include "port_matrix.h" @@ -140,7 +141,7 @@ PortMatrixRowLabels::render (cairo_t* cr) } void -PortMatrixRowLabels::button_press (double x, double y, int b, uint32_t t, guint) +PortMatrixRowLabels::button_press (double x, double y, GdkEventButton* ev) { ARDOUR::BundleChannel w = position_to_channel (y, x, _matrix->visible_rows()); @@ -152,12 +153,13 @@ PortMatrixRowLabels::button_press (double x, double y, int b, uint32_t t, guint) w.channel = -1; } - if (b == 3) { - + if (Gtkmm2ext::Keyboard::is_delete_event (ev) && w.channel != -1) { + _matrix->remove_channel (w); + } else if (ev->button == 3) { _matrix->popup_menu ( ARDOUR::BundleChannel (), w, - t + ev->time ); } } diff --git a/gtk2_ardour/port_matrix_row_labels.h b/gtk2_ardour/port_matrix_row_labels.h index 34086b1074..21839df41e 100644 --- a/gtk2_ardour/port_matrix_row_labels.h +++ b/gtk2_ardour/port_matrix_row_labels.h @@ -43,7 +43,7 @@ class PortMatrixRowLabels : public PortMatrixLabels public: PortMatrixRowLabels (PortMatrix *, PortMatrixBody *); - void button_press (double, double, int, uint32_t, guint); + void button_press (double, double, GdkEventButton *); double component_to_parent_x (double x) const; double parent_to_component_x (double x) const; |