#include <config.h>
-#ifdef __GNUG__
-#pragma implementation
-#endif
#include "insettext.h"
#include "WordLangTuple.h"
#include "paragraph_funcs.h"
#include "sgml.h"
+#include "rowpainter.h"
#include "frontends/Alert.h"
#include "frontends/Dialogs.h"
}
}
+
void InsetText::restoreLyXTextState(BufferView * bv, LyXText * t) const
{
if (sstate.lpar) {
need_update = FULL;
return;
}
-
+
// This is a gross hack...
LyXLayout_ptr old_layout = paragraphs.begin()->layout();
if (buf->params.tracking_changes)
paragraphs.begin()->trackChanges();
-
+
while (lex.isOK()) {
lex.nextToken();
token = lex.getString();
int yf = y_offset + first;
y = 0;
while ((row != 0) && (yf < ph)) {
- lt->getVisibleRow(bv, y + y_offset + first, int(x),
- row, y + lt->first_y, cleared);
+ Row * prev = row->previous();
+ RowPainter rp(*bv, *lt, *row);
+ if (rp.paint(y + y_offset + first, int(x), y + lt->first_y, cleared))
+ lt->markChangeInDraw(bv, row, prev);
if (bv->text->status() == LyXText::CHANGED_IN_DRAW) {
lt->need_break_row = row;
lt->fullRebreak(bv);
inset_y = ciy(bv) + drawTextYOffset;
cmd1.x = cmd.x - inset_x;
cmd1.y = cmd.x - inset_y;
-// note that we should do ret = inset->localDispatch(cmd1)
+// note that we should do ret = inset->localDispatch(cmd1)
// and fix this instead (Alfredo);
ret = true;
inset->edit(bv, cmd1.x, cmd1.y, cmd.button());
bool moving_arg, bool) const
{
TexRow texrow;
- buf->latexParagraphs(os, &*(paragraphs.begin()), 0,
+ buf->latexParagraphs(os, paragraphs.begin(), paragraphs.end(),
texrow, moving_arg);
return texrow.rows();
}
}
-int InsetText::beginningOfMainBody(Paragraph * p) const
-{
- if (p->layout()->labeltype != LABEL_MANUAL)
- return 0;
- else
- return p->beginningOfMainBody();
-}
-
-
void InsetText::getCursorPos(BufferView * bv, int & x, int & y) const
{
if (the_locking_inset) {
}
}
-
+
void InsetText::setText(string const & data, LyXFont const & font)
{
clear(false);
}
-Paragraph * InsetText::getParFromID(int id) const
-{
- ParagraphList::iterator it = paragraphs.begin();
- ParagraphList::iterator end = paragraphs.end();
- for (; it != end; ++it) {
- if (it->id() == id) {
- return &*(it);
- }
- Paragraph * tmp2 = it->getParFromID(id);
- if (tmp2 != 0) {
- return tmp2;
- }
- }
- return 0;
-}
-
-
Paragraph * InsetText::firstParagraph() const
{
Paragraph * result;
LyXCursor const & InsetText::cursor(BufferView * bv) const
{
- if (the_locking_inset)
- return the_locking_inset->cursor(bv);
- return getLyXText(bv)->cursor;
+ if (the_locking_inset)
+ return the_locking_inset->cursor(bv);
+ return getLyXText(bv)->cursor;
}
return result != lyxfind::SR_NOT_FOUND;
}
-
+
bool InsetText::searchForward(BufferView * bv, string const & str,
bool cs, bool mw)
{
void InsetText::collapseParagraphs(BufferView * bv) const
{
- BufferParams const & bparams = bv->buffer()->params;
LyXText * llt = getLyXText(bv);
while (paragraphs.begin()->next()) {
llt->selection.end.pos() + paragraphs.begin()->size());
}
}
- mergeParagraph(bparams, &*paragraphs.begin());
+ mergeParagraph(bv->buffer(), paragraphs.begin());
}
reinitLyXText();
}
}
-void InsetText::appendParagraphs(BufferParams const & bparams,
+void InsetText::appendParagraphs(Buffer * buffer,
Paragraph * newpar)
{
+ BufferParams const & bparams = buffer->params;
Paragraph * buf;
Paragraph * tmpbuf = newpar;
Paragraph * lastbuffer = buf = new Paragraph(*tmpbuf, false);
// paste it!
lastbuffer->next(buf);
buf->previous(lastbuffer);
- mergeParagraph(bparams, lastbuffer);
+ mergeParagraph(buffer, lastbuffer);
reinitLyXText();
}