]> git.lyx.org Git - lyx.git/blobdiff - src/TextMetrics.cpp
Transfer current_font and real_current_font from Text to Cursor.
[lyx.git] / src / TextMetrics.cpp
index 9bde046c8edc25a659edfeba7285a1e40c166512..cb5946266832028daa23517cadf5e5a92fb5b783 100644 (file)
@@ -1112,7 +1112,9 @@ Inset * TextMetrics::editXY(Cursor & cur, int x, int y)
        if (!inset) {
                // Either we deconst editXY or better we move current_font
                // and real_current_font to Cursor
-               text_->setCurrentFont(cur);
+               // FIXME: what is needed now that current_font and real_current_font
+               // are transferred?
+               cur.setCurrentFont();
                return 0;
        }
 
@@ -1136,7 +1138,7 @@ Inset * TextMetrics::editXY(Cursor & cur, int x, int y)
        inset = inset->editXY(cur, x, y);
 
        if (cur.top().text() == text_)
-               text_->setCurrentFont(cur);
+               cur.setCurrentFont();
        return inset;
 }
 
@@ -1457,6 +1459,20 @@ void TextMetrics::deleteLineForward(Cursor & cur)
 }
 
 
+bool TextMetrics::isLastRow(pit_type pit, Row const & row) const
+{
+       ParagraphList const & pars = text_->paragraphs();
+       return row.endpos() >= pars[pit].size()
+               && pit + 1 == pit_type(pars.size());
+}
+
+
+bool TextMetrics::isFirstRow(pit_type pit, Row const & row) const
+{
+       return row.pos() == 0 && pit == 0;
+}
+
+
 int TextMetrics::leftMargin(int max_width, pit_type pit) const
 {
        BOOST_ASSERT(pit >= 0);