diff options
author | Carl Hetherington <carl@carlh.net> | 2011-11-16 00:57:46 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2011-11-16 00:57:46 +0000 |
commit | 41efdd54a4e5980a24183b2d26a0f4fc683760c3 (patch) | |
tree | 41d8da8b8657bcea275221d28c4881006ab2c89e /libs/gtkmm2ext | |
parent | 7736879a3ecc4f275626152b79207f9dd0a4ad40 (diff) |
Fix glitchness in DnDVBox placeholders.
git-svn-id: svn://localhost/ardour2/branches/3.0@10640 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/gtkmm2ext')
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/dndvbox.h | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/libs/gtkmm2ext/gtkmm2ext/dndvbox.h b/libs/gtkmm2ext/gtkmm2ext/dndvbox.h index a5b85234c4..2f09779e71 100644 --- a/libs/gtkmm2ext/gtkmm2ext/dndvbox.h +++ b/libs/gtkmm2ext/gtkmm2ext/dndvbox.h @@ -218,6 +218,24 @@ public: sigc::signal<void> SelectionChanged; private: + + /** @return the bottom y position of a child, pretending any placeholder + * is not there. + */ + double bottom_of_child_ignoring_placeholder (T* child) const + { + Gtk::Allocation const a = child->widget().get_allocation (); + double bottom = a.get_y() + a.get_height(); + + if (_placeholder) { + Gtk::Allocation const b = _placeholder->get_allocation (); + if (b.get_y() < a.get_y()) { + bottom -= (b.get_height () + _internal_vbox.get_spacing ()); + } + } + + return bottom; + } /** Look at a y coordinate and find the children below y, and the ones either side. * @param y y position. @@ -242,8 +260,7 @@ private: /* top of current child */ double top = 0; /* bottom of current child */ - Gtk::Allocation const a = (*j)->widget().get_allocation(); - double bottom = a.get_y() + a.get_height(); + double bottom = bottom_of_child_ignoring_placeholder (*j); while (y >= bottom && j != _children.end()) { @@ -254,8 +271,7 @@ private: ++j; if (j != _children.end()) { - Gtk::Allocation const a = (*j)->widget().get_allocation(); - bottom = a.get_y() + a.get_height(); + bottom = bottom_of_child_ignoring_placeholder (*j); } } @@ -270,7 +286,7 @@ private: ++j; *after = j != _children.end() ? *j : 0; - return i + ((y - top) / (*at)->widget().get_allocation().get_height()); + return i + ((y - top) / (bottom - top)); } void drag_begin (Glib::RefPtr<Gdk::DragContext> const & context, T* child) |