Unless somebody can tell me that they have problems with this, I am
going to apply this pretty soon.

I do not see any new problems with this patch.

Please look it over and comment.

Index: po/POTFILES.in
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/po/POTFILES.in,v
retrieving revision 1.324
diff -u -p -r1.324 POTFILES.in
--- po/POTFILES.in	26 Mar 2003 15:55:51 -0000	1.324
+++ po/POTFILES.in	29 Mar 2003 21:28:46 -0000
@@ -29,9 +29,10 @@ src/frontends/controllers/helper_funcs.C
 src/frontends/gnome/GLog.C
 src/frontends/LyXView.C
 src/frontends/qt2/Alert_pimpl.C
+src/frontends/qt2/BulletsModule.C
 src/frontends/qt2/Dialogs.C
 src/frontends/qt2/FileDialog.C
-src/frontends/qt2/lengthcombo.C
+src/frontends/qt2/floatplacement.C
 src/frontends/qt2/QAbout.C
 src/frontends/qt2/QBibitem.C
 src/frontends/qt2/QBibtex.C
@@ -123,7 +124,6 @@ src/frontends/xforms/FormToc.C
 src/frontends/xforms/FormUrl.C
 src/frontends/xforms/FormVCLog.C
 src/frontends/xforms/FormWrap.C
-src/frontends/xforms/input_validators.C
 src/frontends/xforms/Menubar_pimpl.C
 src/frontends/xforms/xformsBC.h
 src/frontends/xforms/xforms_helpers.C
@@ -169,7 +169,6 @@ src/lyxfont.C
 src/lyxfunc.C
 src/lyx_main.C
 src/lyxrc.C
-src/lyxtextclasslist.C
 src/lyxvc.C
 src/mathed/formulabase.C
 src/mathed/formulamacro.C
@@ -181,8 +180,6 @@ src/paragraph.C
 src/paragraph_funcs.C
 src/ParagraphParameters.C
 src/rowpainter.C
-src/support/filetools.C
-src/tabular.C
 src/text2.C
 src/text3.C
 src/text.C
Index: src/lyxrow.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxrow.C,v
retrieving revision 1.21
diff -u -p -r1.21 lyxrow.C
--- src/lyxrow.C	27 Mar 2003 12:41:46 -0000	1.21
+++ src/lyxrow.C	29 Mar 2003 21:28:47 -0000
@@ -28,6 +28,12 @@ Row::Row()
 {}
 
 
+Row::Row(Paragraph * pa, pos_type po)
+	: par_(pa), pos_(po), fill_(0), height_(0), width_(0),
+	  ascent_of_text_(0), baseline_(0), next_(0), previous_(0)
+{}
+
+
 Paragraph * Row::par()
 {
 	return par_;
Index: src/lyxrow.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxrow.h,v
retrieving revision 1.24
diff -u -p -r1.24 lyxrow.h
--- src/lyxrow.h	21 Mar 2003 14:20:45 -0000	1.24
+++ src/lyxrow.h	29 Mar 2003 21:28:47 -0000
@@ -23,7 +23,8 @@ class Row {
 public:
 	///
 	Row();
-
+	///
+	Row(Paragraph * pa, lyx::pos_type po);
 	///
 	void par(Paragraph * p);
 	///
Index: src/lyxtext.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxtext.h,v
retrieving revision 1.152
diff -u -p -r1.152 lyxtext.h
--- src/lyxtext.h	29 Mar 2003 19:29:28 -0000	1.152
+++ src/lyxtext.h	29 Mar 2003 21:28:47 -0000
@@ -245,12 +245,14 @@ public:
 	 of the row
 	 */
 	Row * getRow(Paragraph * par, lyx::pos_type pos, int & y) const;
-	/** returns the firstrow, this could be done with the above too but
-	    IMO it's stupid to have to allocate a dummy y all the time I need
-	    the first row
-	*/
-	Row * firstRow() const { return &*rowlist_.begin(); }
-	Row * lastRow() const { return &const_cast<LyXText*>(this)->rowlist_.back(); }
+
+	RowList & rows() {
+		return rowlist_;
+	}
+	RowList const & rows() const {
+		return rowlist_;
+	}
+
 	/** The cursor.
 	  Later this variable has to be removed. There should be now internal
 	  cursor in a text (and thus not in a buffer). By keeping this it is
@@ -508,11 +510,6 @@ private:
 	  */
 	string copylayouttype;
 
-	/** inserts a new row behind the specified row, increments
-	    the touched counters */
-	RowList::iterator
-	insertRow(RowList::iterator rowit,
-		  Paragraph * par, lyx::pos_type pos);
 	/// removes the row and reset the touched counters
 	void removeRow(Row * row);
 
Index: src/text.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v
retrieving revision 1.329
diff -u -p -r1.329 text.C
--- src/text.C	29 Mar 2003 19:29:28 -0000	1.329
+++ src/text.C	29 Mar 2003 21:28:49 -0000
@@ -78,9 +78,11 @@ int LyXText::top_y() const
 		return 0;
 
 	int y = 0;
-	for (Row * row = firstRow();
-	     row && row != anchor_row_; row = row->next()) {
-		y += row->height();
+
+	RowList::iterator rit = rows().begin();
+	RowList::iterator end = rows().end();
+	for (; rit != end && rit != anchor_row_; ++rit) {
+		y += rit->height();
 	}
 	return y + anchor_row_offset_;
 }
@@ -88,7 +90,7 @@ int LyXText::top_y() const
 
 void LyXText::top_y(int newy)
 {
-	if (!firstRow())
+	if (rows().empty())
 		return;
 	lyxerr[Debug::GUI] << "setting top y = " << newy << endl;
 
@@ -993,6 +995,7 @@ LColor::color LyXText::backgroundColor()
 		return LColor::background;
 }
 
+
 void LyXText::setHeightOfRow(Row * row)
 {
 	// get the maximum ascent and the maximum descent
@@ -1299,12 +1302,12 @@ void LyXText::setHeightOfRow(Row * row)
 	}
 	row->width(int(maxwidth + x));
 	if (inset_owner) {
-		Row * r = firstRow();
 		width = max(0, workWidth());
-		while (r) {
-			if (r->width() > width)
-				width = r->width();
-			r = r->next();
+		RowList::iterator rit = rows().begin();
+		RowList::iterator end = rows().end();
+		for (; rit != end; ++rit) {
+			if (rit->width() > width)
+				width = rit->width();
 		}
 	}
 }
@@ -1326,7 +1329,8 @@ void LyXText::appendParagraph(RowList::i
 
 		if (z < last) {
 			++z;
-			rowit = insertRow(rowit, rowit->par(), z);
+			rowit = rowlist_.insert(rowit->next(),
+						new Row(rowit->par(), z));
 		} else {
 			done = true;
 		}
@@ -1355,7 +1359,7 @@ void LyXText::breakAgain(Row * row)
 			if (!row->next() || (row->next() && row->next()->par() != row->par())) {
 				// insert a new row
 				++z;
-				insertRow(row, row->par(), z);
+				rowlist_.insert(row->next(), new Row(row->par(), z));
 				row = row->next();
 			} else  {
 				row = row->next();
@@ -1400,7 +1404,7 @@ void LyXText::breakAgainOneRow(Row * row
 		    || (row->next() && row->next()->par() != row->par())) {
 			// insert a new row
 			++z;
-			insertRow(row, row->par(), z);
+			rowlist_.insert(row->next(), new Row(row->par(), z));
 			row = row->next();
 		} else  {
 			row = row->next();
@@ -1518,7 +1522,7 @@ void LyXText::breakParagraph(ParagraphLi
 	  && cursor.par()->next()->isNewline(0))
 	   cursor.par()->next()->erase(0);
 
-	insertParagraph(cursor.par()->next(), cursor.row());
+	insertParagraph(cursor.par()->next(), cursor.row()->next());
 	updateCounters();
 
 	// This check is necessary. Otherwise the new empty paragraph will
@@ -2768,84 +2772,50 @@ void LyXText::backspace()
 // returns pointer to a specified row
 Row * LyXText::getRow(Paragraph * par, pos_type pos, int & y) const
 {
-	if (!firstRow())
+	if (rows().empty())
 		return 0;
 
-	Row * tmprow = firstRow();
 	y = 0;
 
 	// find the first row of the specified paragraph
-	while (tmprow->next() && tmprow->par() != par) {
-		y += tmprow->height();
-		tmprow = tmprow->next();
+	RowList::iterator rit = rows().begin();
+	RowList::iterator end = rows().end();
+	while (boost::next(rit) != end && rit->par() != par) {
+		y += rit->height();
+		++rit;
 	}
 
 	// now find the wanted row
-	while (tmprow->pos() < pos
-	       && tmprow->next()
-	       && tmprow->next()->par() == par
-	       && tmprow->next()->pos() <= pos) {
-		y += tmprow->height();
-		tmprow = tmprow->next();
+	while (rit->pos() < pos
+	       && boost::next(rit) != end
+	       && boost::next(rit)->par() == par
+	       && boost::next(rit)->pos() <= pos) {
+		y += rit->height();
+		++rit;
 	}
 
-	return tmprow;
+	return &*rit;
 }
 
 
 Row * LyXText::getRowNearY(int & y) const
 {
-#if 1
 	// If possible we should optimize this method. (Lgb)
-	Row * tmprow = firstRow();
 	int tmpy = 0;
 
-	while (tmprow->next() && tmpy + tmprow->height() <= y) {
-		tmpy += tmprow->height();
-		tmprow = tmprow->next();
+	RowList::iterator rit = rows().begin();
+	RowList::iterator end = rows().end();
+
+	while (boost::next(rit) != end && tmpy + rit->height() <= y) {
+		tmpy += rit->height();
+		++rit;
 	}
 
 	y = tmpy;   // return the real y
 
 	//lyxerr << "returned y = " << y << endl;
 
-	return tmprow;
-#else
-	// Search from the current cursor position.
-
-	Row * tmprow = cursor.row();
-	int tmpy = cursor.y() - tmprow->baseline();
-
-	lyxerr << "cursor.y() = " << tmpy << endl;
-	lyxerr << "tmprow->height() = " << tmprow->height() << endl;
-	lyxerr << "tmprow->baseline() = " << tmprow->baseline() << endl;
-	lyxerr << "first = " << first << endl;
-	lyxerr << "y = " << y << endl;
-
-	if (y < tmpy) {
-		lyxerr << "up" << endl;
-		do {
-			tmpy -= tmprow->height();
-			tmprow = tmprow->previous();
-		} while (tmprow && tmpy - tmprow->height() >= y);
-	} else if (y > tmpy) {
-		lyxerr << "down" << endl;
-
-		while (tmprow->next() && tmpy + tmprow->height() <= y) {
-			tmpy += tmprow->height();
-			tmprow = tmprow->next();
-		}
-	} else {
-		lyxerr << "equal" << endl;
-	}
-
-	y = tmpy; // return the real y
-
-	lyxerr << "returned y = " << y << endl;
-
-	return tmprow;
-
-#endif
+	return &*rit;
 }
 
 
Index: src/text2.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text2.C,v
retrieving revision 1.306
diff -u -p -r1.306 text2.C
--- src/text2.C	29 Mar 2003 19:29:30 -0000	1.306
+++ src/text2.C	29 Mar 2003 21:28:50 -0000
@@ -80,20 +80,17 @@ void LyXText::init(BufferView * bview, b
 		copylayouttype.erase();
 		top_y(0);
 		clearPaint();
-	} else if (firstRow())
+	} else if (!rowlist_.empty())
 		return;
 
 	Paragraph * par = ownerParagraph();
 	current_font = getFont(bview->buffer(), par, 0);
 
 	while (par) {
-		if (rowlist_.empty())
-			insertParagraph(par, rowlist_.end());
-		else
-			insertParagraph(par, lastRow());
+		insertParagraph(par, rowlist_.end());
 		par = par->next();
 	}
-	setCursorIntern(firstRow()->par(), 0);
+	setCursorIntern(rowlist_.begin()->par(), 0);
 	selection.cursor = cursor;
 
 	updateCounters();
@@ -261,23 +258,6 @@ void LyXText::setCharFont(Buffer const *
 }
 
 
-// inserts a new row before the specified row, increments
-// the touched counters
-RowList::iterator
- LyXText::insertRow(RowList::iterator rowit, Paragraph * par,
-		    pos_type pos)
-{
-	Row * tmprow = new Row;
-	tmprow->par(par);
-	tmprow->pos(pos);
-
-	if (rowit == rowlist_.end())
-		return rowlist_.insert(rowlist_.begin(), tmprow);
-	else
-		return rowlist_.insert(boost::next(rowit), tmprow);
-}
-
-
 // removes the row and reset the touched counters
 void LyXText::removeRow(Row * row)
 {
@@ -329,7 +309,7 @@ void LyXText::removeParagraph(Row * row)
 void LyXText::insertParagraph(Paragraph * par, RowList::iterator rowit)
 {
 	// insert a new row, starting at position 0
-	RowList::iterator rit = insertRow(rowit, par, 0);
+	RowList::iterator rit = rowlist_.insert(rowit, new Row(par, 0));
 
 	// and now append the whole paragraph before the new row
 	appendParagraph(rit);
@@ -748,10 +728,15 @@ void LyXText::redoParagraphs(LyXCursor c
 	tmppar = first_phys_par;
 	do {
 		if (tmppar) {
-			insertParagraph(tmppar, tmprow);
+			if (!tmprow) {
+				insertParagraph(tmppar, rowlist_.begin());
+			} else {
+				insertParagraph(tmppar, tmprow->next());
+			}
+			
 
 			if (!tmprow) {
-				tmprow = firstRow();
+				tmprow = &*rows().begin();
 			}
 			while (tmprow->next()
 			       && tmprow->next()->par() == tmppar) {
@@ -766,7 +751,7 @@ void LyXText::redoParagraphs(LyXCursor c
 		setHeightOfRow(prevrow);
 		const_cast<LyXText *>(this)->postPaint(y - prevrow->height());
 	} else {
-		setHeightOfRow(firstRow());
+		setHeightOfRow(&*rows().begin());
 		const_cast<LyXText *>(this)->postPaint(0);
 	}
 
@@ -778,7 +763,7 @@ void LyXText::redoParagraphs(LyXCursor c
 
 void LyXText::fullRebreak()
 {
-	if (!firstRow()) {
+	if (rows().empty()) {
 		init(bv());
 		return;
 	}
@@ -1287,15 +1272,15 @@ void LyXText::setCounter(Buffer const * 
 // Updates all counters. Paragraphs with changed label string will be rebroken
 void LyXText::updateCounters()
 {
-	Row * row = firstRow();
-	Paragraph * par = row->par();
+	RowList::iterator rowit = rows().begin();
+	Paragraph * par = rowit->par();
 
 	// CHECK if this is really needed. (Lgb)
 	bv()->buffer()->params.getLyXTextClass().counters().reset();
 
 	while (par) {
-		while (row->par() != par)
-			row = row->next();
+		while (rowit->par() != par)
+			++rowit;
 
 		string const oldLabel = par->params().labelString();
 
@@ -1305,8 +1290,8 @@ void LyXText::updateCounters()
 		string const & newLabel = par->params().labelString();
 
 		if (oldLabel.empty() && !newLabel.empty()) {
-			removeParagraph(row);
-			appendParagraph(row);
+			removeParagraph(&*rowit);
+			appendParagraph(rowit);
 		}
 
 		par = par->next();
Index: src/insets/insetert.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetert.C,v
retrieving revision 1.113
diff -u -p -r1.113 insetert.C
--- src/insets/insetert.C	29 Mar 2003 10:55:48 -0000	1.113
+++ src/insets/insetert.C	29 Mar 2003 21:28:51 -0000
@@ -455,7 +455,7 @@ Inset::RESULT InsetERT::localDispatch(Fu
 		 * taken by the text).
 		 */
 		LyXText * t = inset.getLyXText(cmd.view());
-		t->need_break_row = t->firstRow();
+		t->need_break_row = &*t->rows().begin();
 		t->fullRebreak();
 		t->setCursorIntern(t->cursor.par(), t->cursor.pos());
 		inset.update(cmd.view(), true);
@@ -677,11 +677,11 @@ int InsetERT::getMaxWidth(BufferView * b
 	if (status_ != Inlined || w < 0)
 		return w;
 	LyXText * text = inset.getLyXText(bv);
-	int rw = text->firstRow()->width();
+	int rw = text->rows().begin()->width();
 	if (!rw)
 		rw = w;
 	rw += 40;
-	if (!text->firstRow()->next() && rw < w)
+	if (text->rows().size() == 1 && rw < w)
 		return -1;
 	return w;
 }
Index: src/insets/insetminipage.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetminipage.C,v
retrieving revision 1.61
diff -u -p -r1.61 insetminipage.C
--- src/insets/insetminipage.C	22 Mar 2003 17:26:02 -0000	1.61
+++ src/insets/insetminipage.C	29 Mar 2003 21:28:51 -0000
@@ -120,7 +120,7 @@ dispatch_result InsetMinipage::localDisp
 		/* FIXME: I refuse to believe we have to live
 		 * with ugliness like this ... */
 		LyXText * t = inset.getLyXText(cmd.view());
-		t->need_break_row = t->firstRow();
+		t->need_break_row = &*t->rows().begin();
 		t->fullRebreak();
 		inset.update(cmd.view(), true);
 		t->setCursorIntern(t->cursor.par(), t->cursor.pos());
Index: src/insets/insettext.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettext.C,v
retrieving revision 1.365
diff -u -p -r1.365 insettext.C
--- src/insets/insettext.C	28 Mar 2003 02:37:14 -0000	1.365
+++ src/insets/insettext.C	29 Mar 2003 21:28:52 -0000
@@ -297,7 +297,7 @@ void InsetText::read(Buffer const * buf,
 
 int InsetText::ascent(BufferView * bv, LyXFont const &) const
 {
-	insetAscent = getLyXText(bv)->firstRow()->ascent_of_text() +
+	insetAscent = getLyXText(bv)->rows().begin()->ascent_of_text() +
 		TEXT_TO_INSET_OFFSET;
 	return insetAscent;
 }
@@ -306,7 +306,7 @@ int InsetText::ascent(BufferView * bv, L
 int InsetText::descent(BufferView * bv, LyXFont const &) const
 {
 	LyXText * llt = getLyXText(bv);
-	insetDescent = llt->height - llt->firstRow()->ascent_of_text() +
+	insetDescent = llt->height - llt->rows().begin()->ascent_of_text() +
 		TEXT_TO_INSET_OFFSET;
 	return insetDescent;
 }
@@ -396,15 +396,17 @@ void InsetText::draw(BufferView * bv, Ly
 	}
 	x += TEXT_TO_INSET_OFFSET;
 
-	Row * row = lt->firstRow();
-	int y_offset = baseline - row->ascent_of_text();
+	RowList::iterator rowit = lt->rows().begin();
+	RowList::iterator end = lt->rows().end();
+
+	int y_offset = baseline - rowit->ascent_of_text();
 	int ph = pain.paperHeight();
 	int first = 0;
 	int y = y_offset;
-	while ((row != 0) && ((y+row->height()) <= 0)) {
-		y += row->height();
-		first += row->height();
-		row = row->next();
+	while ((rowit != end) && ((y + rowit->height()) <= 0)) {
+		y += rowit->height();
+		first += rowit->height();
+		++rowit;
 	}
 	if (y_offset < 0) {
 		lt->top_y(-y_offset);
@@ -417,12 +419,12 @@ void InsetText::draw(BufferView * bv, Ly
 
 	int yf = y_offset + first;
 	y = 0;
-	while ((row != 0) && (yf < ph)) {
-		RowPainter rp(*bv, *lt, *row);
+	while ((rowit != end) && (yf < ph)) {
+		RowPainter rp(*bv, *lt, *rowit);
 		rp.paint(y + y_offset + first, int(x), y + lt->top_y());
-		y += row->height();
-		yf += row->height();
-		row = row->next();
+		y += rowit->height();
+		yf += rowit->height();
+		++rowit;
 	}
 
 	lt->clearPaint();
@@ -2155,7 +2157,7 @@ LyXText * InsetText::getLyXText(BufferVi
 		if (recursive && the_locking_inset)
 			return the_locking_inset->getLyXText(lbv, true);
 		LyXText * lt = cached_text.get();
-		lyx::Assert(lt && lt->firstRow()->par() == &*(paragraphs.begin()));
+		lyx::Assert(lt && lt->rows().begin()->par() == &*(paragraphs.begin()));
 		return lt;
 	}
 	// Super UGLY! (Lgb)
@@ -2524,12 +2526,13 @@ void InsetText::toggleSelection(BufferVi
 
 	int x = top_x + TEXT_TO_INSET_OFFSET;
 
-	Row * row = lt->firstRow();
-	int y_offset = top_baseline - row->ascent_of_text();
+	RowList::iterator rowit = lt->rows().begin();
+	RowList::iterator end = lt->rows().end();
+	int y_offset = top_baseline - rowit->ascent_of_text();
 	int y = y_offset;
-	while ((row != 0) && ((y+row->height()) <= 0)) {
-		y += row->height();
-		row = row->next();
+	while ((rowit != end) && ((y + rowit->height()) <= 0)) {
+		y += rowit->height();
+		++rowit;
 	}
 	if (y_offset < 0)
 		y_offset = y;
-- 
        Lgb

Reply via email to