13
0

Fix glitchness in DnDVBox placeholders.

git-svn-id: svn://localhost/ardour2/branches/3.0@10640 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2011-11-16 00:57:46 +00:00
parent 7736879a3e
commit 41efdd54a4

View File

@ -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)