]> git.lyx.org Git - features.git/commitdiff
rename row.end into row.endpos
authorAndré Pönitz <poenitz@gmx.net>
Wed, 22 Oct 2003 16:30:57 +0000 (16:30 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Wed, 22 Oct 2003 16:30:57 +0000 (16:30 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7956 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/bufferview_funcs.C
src/lyxrow.C
src/lyxrow.h
src/lyxrow_funcs.C
src/lyxrow_funcs.h
src/rowpainter.C
src/text.C
src/text2.C

index fc6f716d7af41c30dd22077a862078bf5bf8412b..c438cc39c1d24d382a4be54f4d86ab892747caa5 100644 (file)
@@ -1,3 +1,15 @@
+
+2003-10-22  André Pönitz  <poenitz@gmx.net>
+
+       * lyxtext.h:
+       * text.C: use Row & instead of RowList::iterator
+
+       * lyxrow.h: rename end() to endpos()
+
+       * rowpainter.C:
+       * text.C:
+       * text2.C: adjust
+
 2003-10-22  Angus Leeming  <leeming@lyx.org>
 
        * buffer.[Ch] (fully_loaded): new member function, returning true
index 757c8ef0002d3762928418b231d293805e25c3b5..58a8fbc497208d5a64e44297dc2e22d77155d140 100644 (file)
@@ -365,7 +365,7 @@ string const currentState(BufferView * bv)
        state << _(", Paragraph: ") << text->cursorPar()->id();
        state << _(", Position: ") << text->cursor.pos();
        RowList::iterator rit = text->cursorRow();
-       state << bformat(_(", Row b:%1$d e:%2$d"), rit->pos(), rit->end());
+       state << bformat(_(", Row b:%1$d e:%2$d"), rit->pos(), rit->endpos());
        state << _(", Inset: ");
        InsetOld * inset = text->cursorPar()->inInset();
        if (inset)
index 8ae4715e650e0f6aadf5a74126a3382ed6f95471..fadebef1099bea31d63b66269ee2547e262c7d0a 100644 (file)
@@ -48,13 +48,13 @@ pos_type Row::pos() const
 }
 
 
-void Row::end(pos_type p)
+void Row::endpos(pos_type p)
 {
        end_ = p;
 }
 
 
-pos_type Row::end() const
+pos_type Row::endpos() const
 {
        return end_;
 }
index 585b46cb8b6479dc5459954d20fd8ab4acc00c4d..56f3430e2650db865636b106fa32b91bb1ad6852 100644 (file)
@@ -29,9 +29,9 @@ public:
        ///
        lyx::pos_type pos() const;
        ///
-       void end(lyx::pos_type p);
+       void endpos(lyx::pos_type p);
        ///
-       lyx::pos_type end() const;
+       lyx::pos_type endpos() const;
        ///
        void fill(int f);
        ///
index e7af3d086fa557af4a56c55700e8efb9b65df7db..4510855ef9fe5ae54403ab4fc01f2779c546500c 100644 (file)
@@ -24,17 +24,11 @@ using std::min;
 using std::endl;
 
 
-bool isParEnd(Paragraph const & par, Row const & row)
-{
-       return row.end() == par.size();
-}
-
-
 pos_type lastPos(Paragraph const & par, Row const & row)
 {
        if (par.empty())
                return 0;
-       pos_type pos = row.end() - 1;
+       pos_type pos = row.endpos() - 1;
        if (pos == par.size())
                --pos;
        return pos;
@@ -113,14 +107,14 @@ bool hfillExpansion(Paragraph const & par, Row const & row, pos_type pos)
 
        // at the end of a row it does not count
        // unless another hfill exists on the line
-       if (pos >= lastPos(par, row)) {
+       if (pos >= row.endpos()) {
                for (pos_type i = row.pos(); i < pos && !par.isHfill(i); ++i)
                        return false;
        }
 
        // at the beginning of a row it does not count, if it is not
        // the first row of a paragaph
-       if (row.isParStart())
+       if (row.pos() == 0)
                return true;
 
        // in some labels it does not count
index 236584de7e9b660b2bf4de91be81a51a242df31a..3eb84c1c3a74f6b91c3f0b8d683a8cc35950d51b 100644 (file)
@@ -18,8 +18,6 @@
 class Paragraph;
 class Row;
 
-bool isParEnd(Paragraph const & par, Row const & row);
-
 lyx::pos_type lastPos(Paragraph const & par, Row const & row);
 
 int numberOfSeparators(Paragraph const & par, Row const & row);
index 82c5a08d4958cf1cabb4be571d5e5d8a9d22f3e1..efb9342e1951767be15862a874a235c71005de63 100644 (file)
@@ -14,6 +14,7 @@
 #include "rowpainter.h"
 
 #include "buffer.h"
+#include "debug.h"
 #include "bufferparams.h"
 #include "BufferView.h"
 #include "encoding.h"
@@ -527,7 +528,7 @@ void RowPainter::paintDepthBar()
        Paragraph::depth_type prev_depth = 0;
        if (row_ != text_.firstRow()) {
                ParagraphList::iterator pit2 = pit_;
-               if (row_ == pit2->rows.begin())
+               if (row_->pos() == 0)
                        --pit2;
                prev_depth = pit2->getDepth();
        }
@@ -535,7 +536,7 @@ void RowPainter::paintDepthBar()
        Paragraph::depth_type next_depth = 0;
        if (row_ != text_.lastRow()) {
                ParagraphList::iterator pit2 = pit_;
-               if (boost::next(row_) == pit2->rows.end())
+               if (row_->endpos() >= pit2->size())
                        ++pit2;
                next_depth = pit2->getDepth();
        }
@@ -735,12 +736,14 @@ void RowPainter::paintFirst()
        }
 
        bool const is_rtl = pit_->isRightToLeftPar(bv_.buffer()->params());
+       bool const is_seq = isFirstInSequence(pit_, text_.ownerParagraphs());
+       //lyxerr << "paintFirst: " << pit_->id() << " is_seq: " << is_seq << std::endl;
 
        // should we print a label?
        if (layout->labeltype >= LABEL_STATIC
            && (layout->labeltype != LABEL_STATIC
-               || layout->latextype != LATEX_ENVIRONMENT
-               || isFirstInSequence(pit_, text_.ownerParagraphs()))) {
+                     || layout->latextype != LATEX_ENVIRONMENT
+                     || is_seq)) {
 
                LyXFont font = getLabelFont();
                if (!pit_->getLabelstring().empty()) {
@@ -788,7 +791,7 @@ void RowPainter::paintFirst()
 
        // the labels at the top of an environment.
        // More or less for bibliography
-       } else if (isFirstInSequence(pit_, text_.ownerParagraphs()) &&
+       } else if (is_seq &&
                (layout->labeltype == LABEL_TOP_ENVIRONMENT ||
                layout->labeltype == LABEL_BIBLIO ||
                layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT)) {
@@ -1036,10 +1039,10 @@ void RowPainter::paint()
        // changebar
        paintChangeBar();
 
-       if (row_->isParStart())
+       if (row_->pos() == 0)
                paintFirst();
 
-       if (isParEnd(*pit_, *row_))
+       if (row_->endpos() >= pit_->size())
                paintLast();
 
        // paint text
index 582a91ec3f499db730a0bfe56b38174d31e5a882..654f2b39d2de43cbf6771bd3f760afe016fb9bc5 100644 (file)
@@ -769,8 +769,10 @@ pos_type LyXText::rowBreakPoint(ParagraphList::iterator pit,
 // returns the minimum space a row needs on the screen in pixel
 int LyXText::fill(ParagraphList::iterator pit, Row & row, int paper_width) const
 {
-       if (paper_width < 0)
+       if (paper_width < 0) {
+               lyxerr << "paperwidth < 0: " << paper_width << "  Why?" << endl;
                return 0;
+       }
 
        int w;
        // get the pure distance
@@ -781,7 +783,7 @@ int LyXText::fill(ParagraphList::iterator pit, Row & row, int paper_width) const
        // special handling of the right address boxes
        if (layout->margintype == MARGIN_RIGHT_ADDRESS_BOX) {
                int const tmpfill = row.fill();
-               row.fill(0); // the minfill in MarginLeft()
+               row.fill(0); // the minfill in leftMargin()
                w = leftMargin(pit, row);
                row.fill(tmpfill);
        } else
@@ -1106,7 +1108,7 @@ void LyXText::setHeightOfRow(ParagraphList::iterator pit, Row & row)
        }
 
        // is it a bottom line?
-       if (row.end() == pit->size()) {
+       if (row.endpos() >= pit->size()) {
                // the bottom margin
                ParagraphList::iterator nextpit = boost::next(pit);
                if (nextpit == ownerParagraphs().end() && !isInInset())
@@ -1468,8 +1470,8 @@ void LyXText::prepareToPrint(ParagraphList::iterator pit, Row & row) const
                {
                        int const ns = numberOfSeparators(*pit, row);
                        bool disp_inset = false;
-                       if (row.end() < pit->size()) {
-                               InsetOld * in = pit->getInset(row.end());
+                       if (row.endpos() < pit->size()) {
+                               InsetOld * in = pit->getInset(row.endpos());
                                if (in)
                                        disp_inset = in->display();
                        }
@@ -1477,8 +1479,8 @@ void LyXText::prepareToPrint(ParagraphList::iterator pit, Row & row) const
                        // par, does not end in newline, and is not row above a
                        // display inset... then stretch it
                        if (ns
-                               && row.end() < pit->size()
-                               && !pit->isNewline(row.end())
+                               && row.endpos() < pit->size()
+                               && !pit->isNewline(row.endpos())
                                && !disp_inset
                                ) {
                                        fill_separator = w / ns;
@@ -2146,18 +2148,17 @@ int LyXText::redoParagraphInternal(ParagraphList::iterator pit)
        for (pos_type z = 0; z < pit->size() + 1; ) {
                Row row(z);
                z = rowBreakPoint(pit, row) + 1;
-               row.end(z);
+               row.endpos(z);
                int const f = fill(pit, row, ww);
                int const w = ww - f;
                par_width = std::max(par_width, w);
                row.fill(f);
                row.width(w);
+               prepareToPrint(pit, row);
+               setHeightOfRow(pit, row);
+               row.y_offset(pit->height);
+               pit->height += row.height();
                pit->rows.push_back(row);
-               RowList::iterator rit = boost::prior(pit->rows.end());
-               prepareToPrint(pit, *rit);
-               setHeightOfRow(pit, *rit);
-               rit->y_offset(pit->height);
-               pit->height += rit->height();
        }
        height += pit->height;
 
index 6df04db2c6ffd39936dcfa646c0ee07fc50490f6..098a3168da43ae313e4ea5a8fea13ee92c685505 100644 (file)
@@ -566,7 +566,7 @@ void LyXText::cursorHome()
 
 void LyXText::cursorEnd()
 {
-       setCursor(cursorPar(), cursorRow()->end() - 1);
+       setCursor(cursorPar(), cursorRow()->endpos() - 1);
 }
 
 
@@ -1502,7 +1502,7 @@ pos_type LyXText::getColumnNearX(ParagraphList::iterator pit,
        boundary = false;
        // This (rtl_support test) is not needed, but gives
        // some speedup if rtl_support == false
-       bool const lastrow = lyxrc.rtl_support && row.end() == pit->size();
+       bool const lastrow = lyxrc.rtl_support && row.endpos() == pit->size();
 
        // If lastrow is false, we don't need to compute
        // the value of rtl.
@@ -1511,7 +1511,7 @@ pos_type LyXText::getColumnNearX(ParagraphList::iterator pit,
                : false;
        if (lastrow &&
                 ((rtl  &&  left_side && vc == row.pos() && x < tmpx - 5) ||
-                 (!rtl && !left_side && vc == last + 1   && x > tmpx + 5)))
+                 (!rtl && !left_side && vc == last + 1  && x > tmpx + 5)))
                c = last + 1;
        else if (vc == row.pos()) {
                c = vis2log(vc);