]> git.lyx.org Git - features.git/commitdiff
better fix for anchorrow problem
authorAndré Pönitz <poenitz@gmx.net>
Fri, 15 Aug 2003 13:12:24 +0000 (13:12 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Fri, 15 Aug 2003 13:12:24 +0000 (13:12 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7555 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt2/qscreen.C
src/lyxtext.h
src/text.C
src/text2.C

index 02e4e66db6e11a3a9d1d29e97c9412647cd10e07..6afb4444baba056d70c6c1cfb2134d307236893b 100644 (file)
@@ -76,7 +76,8 @@ void QScreen::draw(LyXText * text, BufferView * bv, unsigned int y)
 
        text->top_y(y);
 
-       drawFromTo(text, bv, 0, owner_.height(), 0, 0);
+       // not needed in the xforms frontend anymore
+       //drawFromTo(text, bv, 0, owner_.height(), 0, 0);
        repaint();
 
        owner_.getPainter().end();
index 59140c7f894b3c10d00879a40a559a9db0f0c2ac..b0374573edc24dd4ccf63f6ab287ca28681f85f9 100644 (file)
@@ -66,13 +66,8 @@ public:
        /// our buffer's default layout font
        LyXFont defaultfont_;
 private:
-       /** the 'anchor' row: the position of this row remains constant
-        *  with respect to the top of the screen
-        */
-       RowList::iterator anchor_row_;
-       /** the pixel offset with respect to this row of top_y
-        */
-       int anchor_row_offset_;
+       /// offset of dran area to document start.
+       int anchor_y_;
 public:
        /// update all cached row positions
        void updateRowPositions();
index ebbe4e107dfd3f9537ac1e6250a6bb7d188c4daf..1cd7375d0d170cfdb3ab9b118250d935fed75bd0 100644 (file)
@@ -97,10 +97,7 @@ void LyXText::updateRowPositions()
 
 int LyXText::top_y() const
 {
-       if (anchor_row_ == endRow())
-               return 0;
-
-       return anchor_row_->y() + anchor_row_offset_;
+       return anchor_y_;
 }
 
 
@@ -109,32 +106,8 @@ void LyXText::top_y(int newy)
        if (ownerParagraphs().begin()->rows.empty())
                return;
 
-       if (isInInset()) {
-               anchor_row_ = firstRow();
-               anchor_row_offset_ = newy;
-               return;
-       }
-
-       lyxerr[Debug::GUI] << "setting top y = " << newy << endl;
-
-       int y = newy;
-       ParagraphList::iterator dummypit;
-       anchor_row_ = getRowNearY(y, dummypit);
-       anchor_row_offset_ = newy - y;
-       lyxerr[Debug::GUI] << "changing reference to row: " << &*anchor_row_
-              << " offset: " << anchor_row_offset_ << endl;
-}
-
-
-void LyXText::anchor_row(RowList::iterator rit)
-{
-       int old_y = top_y();
-       anchor_row_offset_ = 0;
-       anchor_row_ = rit;
-       anchor_row_offset_ = old_y - top_y();
-       lyxerr[Debug::GUI] << "anchor_row(): changing reference to row: "
-                          << &*anchor_row_ << " offset: "
-                          << anchor_row_offset_ << endl;
+       anchor_y_ = newy;
+       lyxerr[Debug::GUI] << "changing reference to offset: " << anchor_y_ << endl;
 }
 
 
index b86338ad45a27e2282254cc0fab801f32ab4318e..74219602a026f552d43cce3cc19c84845c65276e 100644 (file)
@@ -60,19 +60,15 @@ using lyx::pos_type;
 
 
 LyXText::LyXText(BufferView * bv)
-       : height(0), width(0), anchor_row_offset_(0),
+       : height(0), width(0), anchor_y_(0),
          inset_owner(0), the_locking_inset(0), bv_owner(bv)
-{
-       anchor_row_ = endRow();
-}
+{}
 
 
 LyXText::LyXText(BufferView * bv, InsetText * inset)
-       : height(0), width(0), anchor_row_offset_(0),
+       : height(0), width(0), anchor_y_(0),
          inset_owner(inset), the_locking_inset(0), bv_owner(bv)
-{
-       anchor_row_ = endRow();
-}
+{}
 
 
 void LyXText::init(BufferView * bview)
@@ -87,8 +83,7 @@ void LyXText::init(BufferView * bview)
        width = 0;
        height = 0;
 
-       anchor_row_ = endRow();
-       anchor_row_offset_ = 0;
+       anchor_y_ = 0;
 
        current_font = getFont(beg, 0);
 
@@ -559,12 +554,9 @@ void LyXText::redoParagraph(ParagraphList::iterator pit)
        RowList::iterator end = pit->rows.end();
 
        // remove rows of paragraph
-       int anchor_cnt = -1;
-       for (int i = 0; rit != end; ++rit, ++i) {
-               if (rit == anchor_row_)
-                       anchor_cnt = i;
+       for (int i = 0; rit != end; ++rit, ++i)
                height -= rit->height();
-       }
+
        pit->rows.clear();
 
        // rebreak the paragraph
@@ -589,13 +581,6 @@ void LyXText::redoParagraph(ParagraphList::iterator pit)
                setHeightOfRow(pit, tmprow);
        }
 
-       if (anchor_cnt == -1) {
-               if (anchor_cnt >= pit->rows.size())
-                       anchor_cnt = pit->rows.size();
-               anchor_row_ = pit->rows.begin();
-               advance(anchor_row_, anchor_cnt);
-       }
-
        //lyxerr << "redoParagraph: " << pit->rows.size() << " rows\n";
 }
 
@@ -617,8 +602,7 @@ void LyXText::metrics(MetricsInfo & mi, Dimension & dim)
        width = 0;
        height = 0;
 
-       anchor_row_ = endRow();
-       anchor_row_offset_ = 0;
+       //anchor_y_ = 0;
 
        ParagraphList::iterator pit = ownerParagraphs().begin();
        ParagraphList::iterator end = ownerParagraphs().end();