]> git.lyx.org Git - lyx.git/blobdiff - src/rowpainter.C
* remove various xforms relicts, in particular:
[lyx.git] / src / rowpainter.C
index 5971b39d4603beb591bacfd7106137449e10d8fe..498d1c982f12a8fd6da67bd8aadf7f4460c036d0 100644 (file)
@@ -34,6 +34,8 @@
 
 #include "frontends/font_metrics.h"
 #include "frontends/nullpainter.h"
+#include "frontends/LyXView.h"
+#include "frontends/WorkArea.h"
 #include "frontends/Painter.h"
 
 #include "insets/insettext.h"
@@ -42,6 +44,8 @@
 
 #include <boost/crc.hpp>
 
+using lyx::frontend::Painter;
+using lyx::frontend::NullPainter;
 using lyx::char_type;
 using lyx::pos_type;
 using lyx::pit_type;
@@ -54,6 +58,10 @@ using std::string;
 
 namespace {
 
+/// Flag: do a full redraw of inside text of inset
+/// Working variable indicating a full screen refresh
+bool refreshInside;
+
 /**
  * A class used for painting an individual row of text.
  */
@@ -167,15 +175,15 @@ void RowPainter::paintInset(pos_type const pos, LyXFont const & font)
        theCoords.insets().add(inset, int(x_), yo_);
        InsetText const * const in = inset->asTextInset();
        // non-wide insets are painted completely. Recursive
-       bool tmp = bv_.repaintAll();
+       bool tmp = refreshInside;
        if (!in || !in->Wide()) {
-               bv_.repaintAll(true);
+               refreshInside = true;
                lyxerr[Debug::PAINTING] << endl << "Paint inset fully" << endl;
        }
-       if (bv_.repaintAll())
+       if (refreshInside)
                inset->drawSelection(pi, int(x_), yo_);
        inset->draw(pi, int(x_), yo_);
-       bv_.repaintAll(tmp);
+       refreshInside = tmp;
        x_ += inset->width();
 }
 
@@ -250,7 +258,7 @@ void RowPainter::paintChars(pos_type & vpos, LyXFont font,
        pos_type pos = text_.bidi.vis2log(vpos);
        pos_type const end = row_.endpos();
        FontSpan const font_span = par_.fontSpan(pos);
-       Change::Type const prev_change = par_.lookupChange(pos);
+       Change::Type const prev_change = par_.lookupChange(pos).type;
 
        // first character
        string str;
@@ -799,9 +807,9 @@ void paintPar
        lyx::size_type rowno(0);
        for (RowList::const_iterator rit = rb; rit != re; ++rit, ++rowno) {
                y += rit->ascent();
-               // Allow setting of bv->repaintAll() for nested insets in
+               // Allow setting of refreshInside for nested insets in
                // this row only
-               bool tmp = pi.base.bv->repaintAll();
+               bool tmp = refreshInside;
 
                // Row signature; has row changed since last paint?
                lyx::size_type const row_sig = calculateRowSignature(*rit, par, x, y);
@@ -817,8 +825,7 @@ void paintPar
                        if (in) {
                                InsetText const * const t = in->asTextInset();
                                if (t)
-                                       t->Wide() = in_inset_alone_on_row &&
-                                                   t->Tall();
+                                       t->Wide() = in_inset_alone_on_row;
                        }
                }
 
@@ -836,13 +843,13 @@ void paintPar
                        // (if paragraph background was not cleared)
                        if (!repaintAll &&
                            (!in_inset_alone_on_row || row_has_changed)) {
-                               pi.pain.fillRectangle(( rowno ? 0 : x - 10 ), y - rit->ascent(),
-                                   pi.base.bv->workWidth(), rit->height(),
+                               pi.pain.fillRectangle(x, y - rit->ascent(),
+                                   text.maxwidth_, rit->height(),
                                    text.backgroundColor());
                                // If outer row has changed, force nested
                                // insets to repaint completely
                                if (row_has_changed)
-                                       pi.base.bv->repaintAll(true);
+                                       refreshInside = true;
                        }
 
                        // Instrumentation for testing row cache (see also
@@ -864,7 +871,7 @@ void paintPar
                }
                y += rit->descent();
                // Restore, see above
-               pi.base.bv->repaintAll(tmp);
+               refreshInside = tmp;
        }
        lyxerr[Debug::PAINTING] << "." << endl;
 }
@@ -874,13 +881,13 @@ void paintPar
 
 void paintText(BufferView const & bv, ViewMetricsInfo const & vi)
 {
-       Painter & pain = bv.painter();
+       Painter & pain = bv.owner()->workArea()->getPainter();
        LyXText * const text = bv.text();
        bool const select = bv.cursor().selection();
 
        PainterInfo pi(const_cast<BufferView *>(&bv), pain);
        // Should the whole screen, including insets, be refreshed?
-       bool repaintAll(select || !vi.singlepar);
+       bool repaintAll = select || !vi.singlepar;
 
        if (repaintAll) {
                // Clear background (if not delegated to rows)
@@ -894,7 +901,7 @@ void paintText(BufferView const & bv, ViewMetricsInfo const & vi)
        int yy = vi.y1;
        // draw contents
        for (pit_type pit = vi.p1; pit <= vi.p2; ++pit) {
-               bv.repaintAll(repaintAll);
+               refreshInside = repaintAll;
                Paragraph const & par = text->getPar(pit);
                yy += par.ascent();
                paintPar(pi, *bv.text(), pit, 0, yy, repaintAll);
@@ -935,7 +942,7 @@ void paintTextInset(LyXText const & text, PainterInfo & pi, int x, int y)
 
        y -= text.getPar(0).ascent();
        // This flag can not be set from within same inset:
-       bool repaintAll = pi.base.bv->repaintAll();
+       bool repaintAll = refreshInside;
        for (int pit = 0; pit < int(text.paragraphs().size()); ++pit) {
                y += text.getPar(pit).ascent();
                paintPar(pi, text, pit, x, y, repaintAll);