void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
int baseline, float & x, bool cleared) const
{
+ if (nodraw())
+ return;
+
Painter & pain = bv->painter();
button_length = widthCollapsed;
return;
}
+ float old_x = x;
+
+#if 0
+ UpdatableInset::draw(bv, f, baseline, x, cleared);
+#else
+ if (!owner())
+ x += static_cast<float>(scroll());
+#endif
if (!cleared && (inset.need_update == InsetText::FULL ||
inset.need_update == InsetText::INIT ||
top_x != int(x) ||
- top_baseline != baseline)) {
+ top_baseline != baseline))
+ {
+#if 1
+ // we don't need anymore to clear here we just have to tell
+ // the underlying LyXText that it should do the RowClear!
+ inset.SetUpdateStatus(bv, InsetText::FULL);
+ bv->text->status = LyXText::CHANGED_IN_DRAW;
+ return;
+#else
int w = owner() ? width(bv, f) : pain.paperWidth();
int h = ascent(bv, f) + descent(bv, f);
int const tx = (needFullRow() && !owner()) ? 0 : int(x);
int const ty = max(0, baseline - ascent(bv, f));
-
+
if ((ty + h) > pain.paperHeight())
h = pain.paperHeight();
if ((top_x + w) > pain.paperWidth())
h += (baseline - ascent(bv, f));
pain.fillRectangle(tx, ty - 1, w, h + 2);
cleared = true;
+#endif
}
top_x = int(x);
top_baseline = baseline;
- float dummy = x;
int const bl = baseline - ascent(bv, f) + ascent_collapsed(pain, f);
- draw_collapsed(pain, f, bl, dummy);
+ draw_collapsed(pain, f, bl, old_x);
inset.draw(bv, f,
bl + descent_collapsed(pain, f) + inset.ascent(bv, f),
x, cleared);
} else if (!collapsed) {
if (!bv->lockInset(this))
return;
- inset.Edit(bv, xp, yp+(top_baseline - inset.y()), button);
+ inset.Edit(bv, xp, yp + (top_baseline - inset.y()), button);
}
}
collapsed = true;
}
inset.InsetUnlock(bv);
+ if (scroll())
+ scroll(bv, 0.0F);
bv->updateInset(this, false);
}
{
return inset.getLabelList();
}
+
+bool InsetCollapsable::nodraw() const
+{
+ return inset.nodraw();
+}
+
+int InsetCollapsable::scroll(bool recursive) const
+{
+ int sx = UpdatableInset::scroll(false);
+
+ if (recursive)
+ sx += inset.scroll(recursive);
+
+ return sx;
+}