InsetText::InsetText(BufferParams const & bp)
- : autoBreakRows_(false), drawFrame_(NEVER),
+ : autoBreakRows_(false), drawFrame_(false),
frame_color_(LColor::insetframe), text_(0)
{
paragraphs().push_back(Paragraph());
}
+InsetText::InsetText() : text_(0)
+{}
+
+
void InsetText::operator=(InsetText const & in)
{
UpdatableInset::operator=(in);
{
clear(false);
+#ifdef WITH_WARNINGS
#warning John, look here. Doesnt make much sense.
+#endif
if (buf.params().tracking_changes)
paragraphs().begin()->trackChanges();
text_.draw(pi, x, y + bv->top_y());
- if (drawFrame_ == ALWAYS || drawFrame_ == LOCKED)
+ if (drawFrame_)
drawFrame(pi.pain, x, y);
}
}
cur.clearSelection();
- mergeParagraph(cur.bv().buffer()->params(), paragraphs(), 0);
+ mergeParagraph(cur.buffer().params(), paragraphs(), 0);
}
}
LyXView * lv = cur.bv().owner();
lv->view_state_changed();
lv->updateMenubar();
- lv->updateToolbar();
+ lv->updateToolbars();
if (old_par != cur.par()) {
lv->setLayout(text_.getPar(cur.par()).layout()->name());
old_par = cur.par();
}
-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());
- updateLocal(cur);
+#ifdef WITH_WARNINGS
+#warning can someone check if/when this is needed?
+#endif
+//Andre?
+// updateLocal(cur);
}
-InsetBase * InsetText::editXY(LCursor & cur, int x, int y)
+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::getCursorPos(CursorSlice const & cur, int & x, int & y) const
+void InsetText::getCursorPos(LCursor const & cur, int & x, int & y) const
{
- x = text_.cursorX(cur);
- y = text_.cursorY(cur);
+ x = text_.cursorX(cur.top());
+ y = text_.cursorY(cur.top());
}
}
-void InsetText::setDrawFrame(DrawFrame how)
+void InsetText::setDrawFrame(bool flag)
{
- drawFrame_ = how;
+ drawFrame_ = flag;
}
void InsetText::appendParagraphs(Buffer * buffer, ParagraphList & plist)
{
+#ifdef WITH_WARNINGS
#warning FIXME Check if Changes stuff needs changing here. (Lgb)
// And it probably does. You have to take a look at this John. (Lgb)
#warning John, have a look here. (Lgb)
+#endif
ParagraphList::iterator pit = plist.begin();
ParagraphList::iterator ins = paragraphs().insert(paragraphs().end(), *pit);
++pit;
}
-ParagraphList & InsetText::paragraphs() const
+ParagraphList const & InsetText::paragraphs() const
+{
+ return text_.paragraphs();
+}
+
+
+ParagraphList & InsetText::paragraphs()
{
- return const_cast<ParagraphList &>(text_.paragraphs());
+ return text_.paragraphs();
}