void InsetERT::setFont(BufferView *, LyXFont const &, bool, bool selectall)
{
+#ifdef WITH_WARNINGS
+#warning FIXME. More UI stupidity...
+#endif
// if selectall is activated then the fontchange was an outside general
// fontchange and this messages is not needed
if (!selectall)
- Alert::alert(_("Impossible operation!"),
- _("Not permitted to change font-types inside ERT-insets!"),
- _("Sorry."));
+ Alert::error(_("Cannot change font"),
+ _("You cannot change font settings inside TeX code."));
}
InsetERTMailer::string2params(cmd.argument, status_);
status(bv, status_);
- bv->updateInset(this, true);
+
+ /* FIXME: I refuse to believe we have to live
+ * with ugliness like this ! Note that this
+ * rebreak *is* needed. Consider a change from
+ * Open (needfullrow) to Inlined (only the space
+ * taken by the text).
+ */
+ LyXText * t = inset.getLyXText(cmd.view());
+ t->need_break_row = t->rows().begin();
+ t->fullRebreak();
+ t->setCursorIntern(t->cursor.par(), t->cursor.pos());
+ inset.update(cmd.view(), true);
+ bv->updateInset(this);
result = DISPATCHED;
}
break;
void InsetERT::draw(BufferView * bv, LyXFont const & f,
int baseline, float & x) const
{
- lyx::Assert(bv);
- cache(bv);
-
- Painter & pain = bv->painter();
-
- button_length = width_collapsed();
- button_top_y = -ascent(bv, f);
- button_bottom_y = -ascent(bv, f) + ascent_collapsed() +
- descent_collapsed();
-
- if (!isOpen()) {
- draw_collapsed(pain, baseline, x);
- return;
- }
-
- float old_x = x;
-
- if (!owner())
- x += static_cast<float>(scroll());
-
- top_x = int(x);
- topx_set = true;
- top_baseline = baseline;
-
- int const bl = baseline - ascent(bv, f) + ascent_collapsed();
-
- if (inlined()) {
- inset.draw(bv, f, baseline, x);
- } else {
- draw_collapsed(pain, bl, old_x);
- inset.draw(bv, f, bl + descent_collapsed() + inset.ascent(bv, f), x);
- }
- need_update = NONE;
+ InsetCollapsable::draw(bv, f, baseline, x, inlined());
}
{
if (st != status_) {
status_ = st;
- need_update = FULL;
switch (st) {
case Inlined:
if (bv)
bv->unlockInset(const_cast<InsetERT *>(this));
break;
}
- if (bv)
- bv->updateInset(const_cast<InsetERT *>(this), false);
+ if (bv) {
+ bv->updateInset(const_cast<InsetERT *>(this));
+ bv->buffer()->markDirty();
+ }
}
}
if (status_ != Inlined || w < 0)
return w;
LyXText * text = inset.getLyXText(bv);
- int rw = text->firstRow()->width();
+ int rw = text->rows().begin()->width();
if (!rw)
rw = w;
rw += 40;
- if (!text->firstRow()->next() && rw < w)
+ if (text->rows().size() == 1 && rw < w)
return -1;
return w;
}
-void InsetERT::update(BufferView * bv, LyXFont const & font,
- bool reinit)
+void InsetERT::update(BufferView * bv, bool reinit)
{
if (inset.need_update & InsetText::INIT ||
- inset.need_update & InsetText::FULL)
- {
+ inset.need_update & InsetText::FULL) {
setButtonLabel();
}
- InsetCollapsable::update(bv, font, reinit);
+
+ InsetCollapsable::update(bv, reinit);
}