]> git.lyx.org Git - features.git/blobdiff - src/insets/insettext.C
add ParagraphList::erase, make mergeParagraph take a Buffer* arg, adjust other funcs...
[features.git] / src / insets / insettext.C
index b251d181eb8887e288223929c09b464eab0f9de3..df7a181653685d6001b87f56c5cc975987120191 100644 (file)
@@ -36,6 +36,7 @@
 #include "WordLangTuple.h"
 #include "paragraph_funcs.h"
 #include "sgml.h"
+#include "rowpainter.h"
 
 #include "frontends/Alert.h"
 #include "frontends/Dialogs.h"
@@ -219,7 +220,7 @@ void InsetText::clear(bool just_mark_erased)
                need_update = FULL;
                return;
        }
+
        // This is a gross hack...
        LyXLayout_ptr old_layout = paragraphs.begin()->layout();
 
@@ -269,7 +270,7 @@ void InsetText::read(Buffer const * buf, LyXLex & lex)
 
        if (buf->params.tracking_changes)
                paragraphs.begin()->trackChanges();
+
        while (lex.isOK()) {
                lex.nextToken();
                token = lex.getString();
@@ -468,8 +469,10 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
                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);
@@ -1137,7 +1140,7 @@ bool InsetText::lfunMouseRelease(FuncRequest const & cmd)
                        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());
@@ -1592,7 +1595,7 @@ int InsetText::latex(Buffer const * buf, ostream & os,
                     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();
 }
@@ -2147,7 +2150,7 @@ void InsetText::markNew(bool track_changes)
        }
 }
 
+
 void InsetText::setText(string const & data, LyXFont const & font)
 {
        clear(false);
@@ -2690,7 +2693,7 @@ bool InsetText::nextChange(BufferView * bv, lyx::pos_type & length)
        return result != lyxfind::SR_NOT_FOUND;
 }
 
+
 bool InsetText::searchForward(BufferView * bv, string const & str,
                              bool cs, bool mw)
 {
@@ -2767,7 +2770,6 @@ bool InsetText::checkInsertChar(LyXFont & font)
 
 void InsetText::collapseParagraphs(BufferView * bv) const
 {
-       BufferParams const & bparams = bv->buffer()->params;
        LyXText * llt = getLyXText(bv);
 
        while (paragraphs.begin()->next()) {
@@ -2788,7 +2790,7 @@ void InsetText::collapseParagraphs(BufferView * bv) const
                                        llt->selection.end.pos() + paragraphs.begin()->size());
                        }
                }
-               mergeParagraph(bparams, &*paragraphs.begin());
+               mergeParagraph(bv->buffer(), paragraphs.begin());
        }
        reinitLyXText();
 }
@@ -2802,9 +2804,10 @@ void InsetText::getDrawFont(LyXFont & font) const
 }
 
 
-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);
@@ -2834,7 +2837,7 @@ void InsetText::appendParagraphs(BufferParams const & bparams,
        // paste it!
        lastbuffer->next(buf);
        buf->previous(lastbuffer);
-       mergeParagraph(bparams, lastbuffer);
+       mergeParagraph(buffer, lastbuffer);
 
        reinitLyXText();
 }