#include "lyxtext.h"
#include "debug.h"
#include "lyxtextclasslist.h"
+#include "lyxrow.h"
#include "insets/insettext.h"
}
+// attention this function can be called with bv == 0
void InsetERT::status(BufferView * bv, ERTStatus const st) const
{
if (st != status_) {
status_ = st;
+ need_update = FULL;
switch (st) {
case Inlined:
- inset.setAutoBreakRows(false);
+#warning Another gross hack. (Lgb)
+ if (bv)
+ inset.setUpdateStatus(bv, InsetText::INIT);
break;
case Open:
- inset.setAutoBreakRows(true);
collapsed_ = false;
- need_update = FULL;
setButtonLabel();
break;
case Collapsed:
- inset.setAutoBreakRows(true);
collapsed_ = true;
- need_update = FULL;
setButtonLabel();
if (bv)
bv->unlockInset(const_cast<InsetERT *>(this));
}
-string const InsetERT::selectNextWordToSpellcheck(BufferView * bv,float &) const
+string const InsetERT::selectNextWordToSpellcheck(BufferView * bv,
+ float &) const
{
bv->unlockInset(const_cast<InsetERT *>(this));
return string();
}
+
void InsetERT::getDrawFont(LyXFont & font) const
{
#ifndef INHERIT_LANG
font.setFamily(LyXFont::TYPEWRITER_FAMILY);
font.setColor(LColor::latex);
}
+
+
+int InsetERT::getMaxWidth(BufferView * bv, UpdatableInset const * in) const
+{
+ int w = InsetCollapsable::getMaxWidth(bv, in);
+ if (status_ != Inlined || w < 0)
+ return w;
+ LyXText * text = inset.getLyXText(bv);
+ int rw = text->firstRow()->width();
+ if (!rw)
+ rw = w;
+ rw += 40;
+ if (!text->firstRow()->next() && rw < w)
+ return -1;
+ return w;
+}