diff options
author | Carl Hetherington <carl@carlh.net> | 2011-01-06 00:29:40 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2011-01-06 00:29:40 +0000 |
commit | 1f8e12a1b1cd5d6e4d2ec4961f6c50c671bf75b1 (patch) | |
tree | b9bbb905ff2e6be38dd21ef7b372d18d6de65af6 /libs | |
parent | cf1541c3086b376ecac1b70cafef058b4348ab96 (diff) |
Another try at prettifying the processor list with different colours pre- and post-fader, a border etc. All colours should now be configurable from the UI RC file.
git-svn-id: svn://localhost/ardour2/branches/3.0@8453 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/dndvbox.h | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/libs/gtkmm2ext/gtkmm2ext/dndvbox.h b/libs/gtkmm2ext/gtkmm2ext/dndvbox.h index 9afec560fc..582696ffe5 100644 --- a/libs/gtkmm2ext/gtkmm2ext/dndvbox.h +++ b/libs/gtkmm2ext/gtkmm2ext/dndvbox.h @@ -162,9 +162,9 @@ public: /** Look at a y coordinate and find the children below y, and the ones either side. * @param y y position. * @param before Filled in with the child before, or 0. - * @param before Filled in with the child under y, or 0. + * @param at Filled in with the child under y, or 0. * @param after Filled in with the child after, or 0. - * @return Fractional position in terms of child height. + * @return Fractional position in terms of child height, or -1 if not over a child. */ double get_children_around_position (int y, T** before, T** at, T** after) const { @@ -173,17 +173,28 @@ public: return -1; } - /* fractional position in terms of children */ - double const nf = double (y) / _children.front()->widget().get_allocation().get_height (); - *before = 0; - int i = 0; typename std::list<T*>::const_iterator j = _children.begin (); - while (i < int (nf) && j != _children.end()) { + + /* index of current child */ + int i = 0; + /* top of current child */ + double top = 0; + /* bottom of current child */ + double bottom = (*j)->widget().get_allocation().get_height (); + + while (y >= bottom && j != _children.end()) { + + top = bottom; + *before = *j; ++i; ++j; + + if (j != _children.end()) { + bottom += (*j)->widget().get_allocation().get_height (); + } } if (j == _children.end()) { @@ -197,7 +208,7 @@ public: ++j; *after = j != _children.end() ? *j : 0; - return nf; + return i + ((y - top) / (*at)->widget().get_allocation().get_height()); } /** @param y y coordinate. @@ -214,6 +225,10 @@ public: return r; } + + void set_spacing (int s) { + _internal_vbox.set_spacing (s); + } /** Children have been reordered by a drag */ sigc::signal<void> Reordered; |