summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-11-23 14:31:09 +0000
committerCarl Hetherington <carl@carlh.net>2010-11-23 14:31:09 +0000
commite6665809fb0bc6cbfa524ee359ef565cb7b89586 (patch)
tree0bb4b24efedde3c5e3582e687f29f5e998b7a05b /libs
parent601d6bb3bf7941c05088f8488f1fa24fc817b077 (diff)
Improve shift-selection behaviour in processor box.
git-svn-id: svn://localhost/ardour2/branches/3.0@8073 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/gtkmm2ext/gtkmm2ext/dndvbox.h48
1 files changed, 43 insertions, 5 deletions
diff --git a/libs/gtkmm2ext/gtkmm2ext/dndvbox.h b/libs/gtkmm2ext/gtkmm2ext/dndvbox.h
index ff3b2ef355..3bdb675950 100644
--- a/libs/gtkmm2ext/gtkmm2ext/dndvbox.h
+++ b/libs/gtkmm2ext/gtkmm2ext/dndvbox.h
@@ -252,14 +252,52 @@ private:
}
if (ev->button == 1 || ev->button == 3) {
+
if (!selected (child)) {
- if ((ev->state & Gdk::CONTROL_MASK) == 0) {
- clear_selection ();
- }
- if (child) {
- add_to_selection (child);
+
+ if ((ev->state & Gdk::SHIFT_MASK) && !_selection.empty()) {
+
+ /* Shift-click; select all between the clicked child and any existing selections */
+
+ bool selecting = false;
+ bool done = false;
+ for (typename std::list<T*>::const_iterator i = _children.begin(); i != _children.end(); ++i) {
+
+ bool const was_selected = selected (*i);
+
+ if (selecting && !was_selected) {
+ add_to_selection (*i);
+ }
+
+ if (!selecting && !done) {
+ if (selected (*i)) {
+ selecting = true;
+ } else if (*i == child) {
+ selecting = true;
+ add_to_selection (child);
+ }
+ } else if (selecting) {
+ if (was_selected || *i == child) {
+ selecting = false;
+ done = true;
+ }
+ }
+ }
+
+ } else {
+
+ if ((ev->state & Gdk::CONTROL_MASK) == 0) {
+ clear_selection ();
+ }
+
+ if (child) {
+ add_to_selection (child);
+ }
+
}
+
SelectionChanged (); /* EMIT SIGNAL */
+
} else {
/* XXX THIS NEEDS GENERALIZING FOR OS X */
if (ev->button == 1 && (ev->state & Gdk::CONTROL_MASK)) {