summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2011-01-04 23:26:59 +0000
committerCarl Hetherington <carl@carlh.net>2011-01-04 23:26:59 +0000
commit4a9f3173ee806f5e3955c30c1bacb60cdbcc1f96 (patch)
treecc943dccf9a9ae727f5e52138d8689d296d5573c /libs
parenta7d465fcb7254ad4acdf25208976802553c0f6a5 (diff)
Highlight a send processor entry differently when it the mixer strip's fader is being used to control it. Fixes #3659.
git-svn-id: svn://localhost/ardour2/branches/3.0@8440 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/gtkmm2ext/gtkmm2ext/dndvbox.h46
1 files changed, 38 insertions, 8 deletions
diff --git a/libs/gtkmm2ext/gtkmm2ext/dndvbox.h b/libs/gtkmm2ext/gtkmm2ext/dndvbox.h
index 0ba86fa8db..9afec560fc 100644
--- a/libs/gtkmm2ext/gtkmm2ext/dndvbox.h
+++ b/libs/gtkmm2ext/gtkmm2ext/dndvbox.h
@@ -42,7 +42,7 @@ template <class T>
class DnDVBox : public Gtk::EventBox
{
public:
- DnDVBox () : _drag_icon (0), _expecting_unwanted_button_event (false), _drag_placeholder (0)
+ DnDVBox () : _active (0), _drag_icon (0), _expecting_unwanted_button_event (false), _drag_placeholder (0)
{
_targets.push_back (Gtk::TargetEntry ("processor"));
@@ -107,6 +107,21 @@ public:
return _selection;
}
+ /** Set the `active' child; this is simply a child which is set to have the Gtk
+ * STATE_ACTIVE for whatever purposes the client may have.
+ * @param c Child, or 0 for none.
+ */
+ void set_active (T* c) {
+ T* old_active = _active;
+ _active = c;
+ if (old_active) {
+ setup_child_state (old_active);
+ }
+ if (_active) {
+ setup_child_state (_active);
+ }
+ }
+
/** @param Child
* @return true if the child is selected, otherwise false.
*/
@@ -468,27 +483,41 @@ private:
return ButtonRelease (ev, child); /* EMIT SIGNAL */
}
- void clear_selection ()
+ /** Setup a child's GTK state correctly */
+ void setup_child_state (T* c)
{
- for (typename std::list<T*>::iterator i = _selection.begin(); i != _selection.end(); ++i) {
- (*i)->action_widget().set_state (Gtk::STATE_NORMAL);
+ assert (c);
+
+ if (c == _active) {
+ c->action_widget().set_state (Gtk::STATE_ACTIVE);
+ } else if (selected (c)) {
+ c->action_widget().set_state (Gtk::STATE_SELECTED);
+ } else {
+ c->action_widget().set_state (Gtk::STATE_NORMAL);
}
+ }
+
+ void clear_selection ()
+ {
+ std::list<T*> old_selection = _selection;
_selection.clear ();
+ for (typename std::list<T*>::iterator i = old_selection.begin(); i != old_selection.end(); ++i) {
+ setup_child_state (*i);
+ }
}
void add_to_selection (T* child)
{
- child->action_widget().set_state (Gtk::STATE_SELECTED);
_selection.push_back (child);
+ setup_child_state (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);
+ setup_child_state (*x);
}
}
@@ -510,6 +539,7 @@ private:
std::list<Gtk::TargetEntry> _targets;
std::list<T*> _children;
std::list<T*> _selection;
+ T* _active;
Gtk::Window* _drag_icon;
bool _expecting_unwanted_button_event;
/** A blank label used as a placeholder to indicate where a dragged item would