InsetText::InsetText(BufferParams const & bp)
- : autoBreakRows_(false), drawFrame_(NEVER),
+ : autoBreakRows_(false), drawFrame_(false),
frame_color_(LColor::insetframe), text_(0)
{
paragraphs().push_back(Paragraph());
text_.draw(pi, x, y + bv->top_y());
- if (drawFrame_ == ALWAYS || drawFrame_ == LOCKED)
+ if (drawFrame_)
drawFrame(pi.pain, x, y);
}
}
-void InsetText::sanitizeEmptyText(BufferView & bv)
-{
- if (paragraphs().size() == 1
- && paragraphs().begin()->empty()
- && bv.getParentLanguage(this) != text_.current_font.language()) {
- LyXFont font(LyXFont::ALL_IGNORE);
- font.setLanguage(bv.getParentLanguage(this));
- text_.setFont(bv.cursor(), font, false);
- }
-}
-
-
void InsetText::edit(LCursor & cur, bool left)
{
//lyxerr << "InsetText: edit left/right" << endl;
text_.setCursor(cur.top(), par, pos);
cur.clearSelection();
finishUndo();
- sanitizeEmptyText(cur.bv());
#ifdef WITH_WARNINGS
#warning can someone check if/when this is needed?
#endif
InsetBase * InsetText::editXY(LCursor & cur, int x, int y) const
{
- lyxerr << "InsetText::edit xy" << endl;
old_par = -1;
return text_.editXY(cur, x, y);
//sanitizeEmptyText(cur.bv());
bool was_empty = paragraphs().begin()->empty() && paragraphs().size() == 1;
text_.dispatch(cur, cmd);
- // If the action has deleted all text in the inset, we need
- // to change the language to the language of the surronding
- // text.
- // Why this cleverness? (Andre')
- if (!was_empty && paragraphs().begin()->empty() &&
- paragraphs().size() == 1) {
- LyXFont font(LyXFont::ALL_IGNORE);
- font.setLanguage(cur.bv().getParentLanguage(this));
- text_.setFont(cur, font, false);
- }
}
int InsetText::docbook(Buffer const & buf, ostream & os,
OutputParams const & runparams) const
{
- docbookParagraphs(buf, paragraphs(), os, runparams);
+ docbookParagraphs(paragraphs(), buf, os, runparams);
return 0;
}
}
-void InsetText::setDrawFrame(DrawFrame how)
+void InsetText::setDrawFrame(bool flag)
{
- drawFrame_ = how;
+ drawFrame_ = flag;
}