On Fri, Aug 15, 2003 at 03:16:50PM +0100, John Levon wrote: > On Fri, Aug 15, 2003 at 04:12:43PM +0200, Alfredo Braunstein wrote: > > > Needless to say, I don't agree with > > > > - RowList::iterator anchor_row_; > > You have to evangelise/explain to Andre.
Lest it gets lost: The part of the patch concerning anchor_row_ Andre' -- Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. (T. Jefferson or B. Franklin or both...)
Index: lyxtext.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxtext.h,v retrieving revision 1.216 retrieving revision 1.218 diff -u -p -r1.216 -r1.218 --- lyxtext.h 15 Aug 2003 08:03:50 -0000 1.216 +++ lyxtext.h 15 Aug 2003 13:12:21 -0000 1.218 @@ -63,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: text.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v retrieving revision 1.418 retrieving revision 1.419 diff -u -p -r1.418 -r1.419 --- text.C 15 Aug 2003 08:03:51 -0000 1.418 +++ text.C 15 Aug 2003 13:12:21 -0000 1.419 @@ -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: text2.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text2.C,v retrieving revision 1.434 retrieving revision 1.438 diff -u -p -r1.434 -r1.438 --- text2.C 15 Aug 2003 08:03:51 -0000 1.434 +++ text2.C 15 Aug 2003 13:20:45 -0000 1.438 @@ -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,11 +554,9 @@ void LyXText::redoParagraph(ParagraphLis RowList::iterator end = pit->rows.end(); // remove rows of paragraph - for ( ; rit != end; ++rit) { - if (rit == anchor_row_) - anchor_row_ = endRow(); + for (int i = 0; rit != end; ++rit, ++i) height -= rit->height(); - } + pit->rows.clear(); // rebreak the paragraph @@ -609,8 +602,7 @@ void LyXText::metrics(MetricsInfo & mi, width = 0; height = 0; - anchor_row_ = endRow(); - anchor_row_offset_ = 0; + //anchor_y_ = 0; ParagraphList::iterator pit = ownerParagraphs().begin(); ParagraphList::iterator end = ownerParagraphs().end();