add ctrl-click behaviour to DndVBox, though not generalized to use primary/secondary...
authorPaul Davis <paul@linuxaudiosystems.com>
Sat, 28 Nov 2009 02:19:13 +0000 (02:19 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Sat, 28 Nov 2009 02:19:13 +0000 (02:19 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@6202 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/gtkmm2ext/gtkmm2ext/dndvbox.h

index 7a011e9dcc8dd97b439ca8ca2549cd464cffac27..166544d73fb02319e1997ff1fb49b8f40296906a 100644 (file)
@@ -258,9 +258,18 @@ private:
                                        add_to_selection (child);
                                }
                                SelectionChanged (); /* EMIT SIGNAL */
+                       } else {
+                               /* XXX THIS NEEDS GENERALIZING FOR OS X */
+                               if (ev->button == 1 && (ev->state & Gdk::CONTROL_MASK)) {
+                                       if (child && selected (child)) {
+                                               remove_from_selection (child);
+                                               SelectionChanged (); /* EMIT SIGNAL */
+                                       }
+                               }
                        }
                }
 
+
                return ButtonPress (ev, child); /* EMIT SIGNAL */
        }
        
@@ -292,6 +301,16 @@ private:
                _selection.push_back (child);
        }
                
+       
+       void remove_from_selection (T* child)
+       {
+               typename std::list<T*>::iterator x = find (_selection.begin(), _selection.end(), child);
+               if (x != _selection.end()) {
+                       child->action_widget().set_state (Gtk::STATE_NORMAL);
+                       _selection.erase (x);
+               }
+       }
+               
        T* child_from_widget (Gtk::Widget const * w) const
        {
                typename std::list<T*>::const_iterator i = _children.begin();