- if (nodraw())
- return;
-
- Painter & pain = bv->painter();
-
- if (!widthCollapsed)
- widthCollapsed = width_collapsed(pain, f);
-
- button_length = widthCollapsed;
- button_top_y = -ascent(bv, f);
- button_bottom_y = -ascent(bv, f) + ascent_collapsed(pain,f) +
- descent_collapsed(pain, f);
-
- if (collapsed_) {
- draw_collapsed(pain, f, baseline, x);
- x += TEXT_TO_INSET_OFFSET;
- 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))
- {
-#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(bv, 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())
- w = pain.paperWidth();
- if (baseline < 0)
- h += (baseline - ascent(bv, f));
- pain.fillRectangle(tx, ty - 1, w, h + 2);
- cleared = true;
-#endif
- }
-
- top_x = int(x);
- top_baseline = baseline;
-
- int const bl = baseline - ascent(bv, f) + ascent_collapsed(pain, f);
-
- draw_collapsed(pain, f, bl, old_x);
- inset.draw(bv, f,
- bl + descent_collapsed(pain, f) + inset.ascent(bv, f),
- x, cleared);
- need_update = NONE;