]> git.lyx.org Git - lyx.git/blobdiff - src/rowpainter.C
Clean-up FileFilterList API.
[lyx.git] / src / rowpainter.C
index 7f2694101bb74fb9d85b8e213f548fd448b223f0..a90f6f44da9219403c516f7f7325071bbd0a2e0e 100644 (file)
@@ -41,7 +41,7 @@
 #include "support/textutils.h"
 
 using lyx::pos_type;
-using lyx::par_type;
+using lyx::pit_type;
 
 using std::endl;
 using std::max;
@@ -57,7 +57,7 @@ class RowPainter {
 public:
        /// initialise and run painter
        RowPainter(BufferView const & bv, Painter & pain, LyXText const & text,
-               par_type pit, RowList::iterator rit, int y);
+               pit_type pit, RowList::iterator rit, int y);
 private:
        // paint various parts
        void paintBackground();
@@ -104,7 +104,7 @@ private:
        Row & row_;
 
        /// Row's paragraph
-       par_type const pit_;
+       pit_type const pit_;
        Paragraph const & par_;
 
        // Looks ugly - is
@@ -119,7 +119,7 @@ private:
 
 
 RowPainter::RowPainter(BufferView const & bv, Painter & pain,
-       LyXText const & text, par_type pit, RowList::iterator rit, int y)
+       LyXText const & text, pit_type pit, RowList::iterator rit, int y)
        : bv_(bv), pain_(pain), text_(text), pars_(text.paragraphs()),
          rit_(rit), row_(*rit), pit_(pit), par_(text.paragraphs()[pit]),
          xo_(text_.xo_), yo_(y), width_(text_.width())
@@ -403,8 +403,8 @@ void RowPainter::paintSelection()
        LCursor const & cur = bv_.cursor();
        int const starty = text_.cursorY(cur.selBegin());
        int const endy = text_.cursorY(cur.selEnd());
-       par_type startpit = cur.selBegin().par();
-       par_type endpit = cur.selEnd().par();
+       pit_type startpit = cur.selBegin().pit();
+       pit_type endpit = cur.selEnd().pit();
        RowList::iterator startrow = pars_[startpit].getRow(cur.selBegin().pos());
        RowList::iterator endrow = pars_[endpit].getRow(cur.selEnd().pos());
        int const h = row_.height();
@@ -530,7 +530,7 @@ void RowPainter::paintDepthBar()
 
        Paragraph::depth_type prev_depth = 0;
        if (!text_.isFirstRow(pit_, row_)) {
-               par_type pit2 = pit_;
+               pit_type pit2 = pit_;
                if (row_.pos() == 0)
                        --pit2;
                prev_depth = pars_[pit2].getDepth();
@@ -538,7 +538,7 @@ void RowPainter::paintDepthBar()
 
        Paragraph::depth_type next_depth = 0;
        if (!text_.isLastRow(pit_, row_)) {
-               par_type pit2 = pit_;
+               pit_type pit2 = pit_;
                if (row_.endpos() >= pars_[pit2].size())
                        ++pit2;
                next_depth = pars_[pit2].getDepth();
@@ -767,15 +767,16 @@ void RowPainter::paintText()
                if (x_ > bv_.workWidth())
                        break;
 
-               pos_type pos = text_.bidi.vis2log(vpos);
+               pos_type const pos = text_.bidi.vis2log(vpos);
 
                if (pos >= par_.size()) {
                        ++vpos;
                        continue;
                }
 
-               if (x_ + singleWidth(pos) < 0) {
-                       x_ += singleWidth(pos);
+               const int width_pos = singleWidth(pos);
+               if (x_ + width_pos < 0) {
+                       x_ += width_pos;
                        ++vpos;
                        continue;
                }
@@ -803,7 +804,7 @@ void RowPainter::paintText()
                        int const lwidth = font_metrics::width(layout->labelsep,
                                getLabelFont());
 
-                       x_ += label_hfill_ + lwidth - singleWidth(body_pos - 1);
+                       x_ += label_hfill_ + lwidth - width_pos;
                }
 
                if (par_.isHfill(pos)) {
@@ -833,7 +834,7 @@ void RowPainter::paintText()
                        x_ += 2;
                        ++vpos;
                } else if (par_.isSeparator(pos)) {
-                       x_ += singleWidth(pos);
+                       x_ += width_pos;
                        if (pos >= body_pos)
                                x_ += separator_;
                        ++vpos;
@@ -853,7 +854,7 @@ void RowPainter::paintText()
 
 
 int paintPars(BufferView const & bv, Painter & pain,
-             LyXText const & text, par_type pit, par_type end)
+             LyXText const & text, pit_type pit, pit_type end)
 {
        //lyxerr << "  paintRows: pit: " << &*pit << endl;
        ParagraphList & pars = text.paragraphs();
@@ -881,7 +882,7 @@ int paintPars(BufferView const & bv, Painter & pain,
 } // namespace anon
 
 
-void refreshPar(BufferView const & bv, LyXText const & text, par_type pit)
+void refreshPar(BufferView const & bv, LyXText const & text, pit_type pit)
 {
        static NullPainter nop;
        paintPars(bv, nop, text, pit, pit + 1);
@@ -890,7 +891,7 @@ void refreshPar(BufferView const & bv, LyXText const & text, par_type pit)
 
 int paintText(BufferView const & bv)
 {
-       par_type pit, end;
+       pit_type pit, end;
        getParsInRange(bv.text()->paragraphs(), bv.top_y(),
                       bv.top_y() + bv.workHeight(), pit, end);
        //lyxerr << "top_y: " << bv.top_y() << " y: " << pit->y << endl;