]> git.lyx.org Git - features.git/commitdiff
Transfer metrics and screen related methods from Text to TextMetrics.
authorAbdelrazak Younes <younes@lyx.org>
Sun, 2 Sep 2007 11:27:19 +0000 (11:27 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Sun, 2 Sep 2007 11:27:19 +0000 (11:27 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19995 a592a061-630c-0410-9148-cb99ea01b6c8

src/Text.cpp
src/Text.h
src/TextMetrics.cpp
src/TextMetrics.h
src/rowpainter.cpp

index 4013905d6dccc6001b26bd4e029708be65ea49db..230d64c3ed7f89ff07ff0e4fd7f20ba3aa3af61b 100644 (file)
@@ -1160,19 +1160,6 @@ bool Text::dissolveInset(Cursor & cur) {
 }
 
 
-bool Text::isLastRow(pit_type pit, Row const & row) const
-{
-       return row.endpos() >= pars_[pit].size()
-               && pit + 1 == pit_type(paragraphs().size());
-}
-
-
-bool Text::isFirstRow(pit_type pit, Row const & row) const
-{
-       return row.pos() == 0 && pit == 0;
-}
-
-
 void Text::getWord(CursorSlice & from, CursorSlice & to,
        word_location const loc)
 {
index f0d75fa8efedea35f08fd863f4c56847788cb9d7..fe8714079a3a7e79e24c0d33f3c768f897ff5976 100644 (file)
@@ -256,13 +256,6 @@ public:
        /// return true if this is the main text
        bool isMainText(Buffer const &) const;
 
-       /// is this row the last in the text?
-       /// FIXME: move to TextMetrics.
-       bool isLastRow(pit_type pit, Row const & row) const;
-       /// is this row the first in the text?
-       /// FIXME: move to TextMetrics.
-       bool isFirstRow(pit_type pit, Row const & row) const;
-
        ///
        double spacing(Buffer const & buffer, Paragraph const & par) const;
        /// make a suggestion for a label
index 9bde046c8edc25a659edfeba7285a1e40c166512..cde93d0cfb4cb899901575ce0df79285cbc3ea76 100644 (file)
@@ -1457,6 +1457,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);
index 784e91fc365bcd8593e66f06609fd6e299fa5b0e..77f4166f53698c594e8b7ed61ffe63608170a868 100644 (file)
@@ -181,6 +181,11 @@ public:
        ///
        void deleteLineForward(Cursor & cur);
 
+       /// is this row the last in the text?
+       bool isLastRow(pit_type pit, Row const & row) const;
+       /// is this row the first in the text?
+       bool isFirstRow(pit_type pit, Row const & row) const;
+
        /// Returns an inset if inset was hit, or 0 if not.
        /// \warning This method is not recursive! It will return the
        /// outermost inset within this Text.
index 82fa18dbb39a3edb075f901bdaa76287d342002f..f85af08eef5f7d10b435bb0d001fcf03e67cfb71 100644 (file)
@@ -389,7 +389,7 @@ void RowPainter::paintChangeBar()
        if (start == end || !par_.isChanged(start, end))
                return;
 
-       int const height = text_.isLastRow(pit_, row_)
+       int const height = text_metrics_.isLastRow(pit_, row_)
                ? row_.ascent()
                : row_.height();
 
@@ -421,7 +421,7 @@ void RowPainter::paintDepthBar()
                return;
 
        depth_type prev_depth = 0;
-       if (!text_.isFirstRow(pit_, row_)) {
+       if (!text_metrics_.isFirstRow(pit_, row_)) {
                pit_type pit2 = pit_;
                if (row_.pos() == 0)
                        --pit2;
@@ -429,7 +429,7 @@ void RowPainter::paintDepthBar()
        }
 
        depth_type next_depth = 0;
-       if (!text_.isLastRow(pit_, row_)) {
+       if (!text_metrics_.isLastRow(pit_, row_)) {
                pit_type pit2 = pit_;
                if (row_.endpos() >= pars_[pit2].size())
                        ++pit2;