I've just commited this.

It's very long, but mainly because it changes some signatures (and adds two
new files). *

I've added some bits here and there to dispatch functions to finally have an
update-less cursor movement (!). I hope I didn't break anything. Those who
are familiar with that code please have a look. 


Regards, Alfredo

*: linecout is not terrible though: 28 files changed, 329 insertions(+), 240
deletions(-)
? ChangeLog-old
? PosIterator.C-save
? PosIterator.h-save
? bfri.C
? safe
? textcursor.C-save
? textcursor.h-save
? insets/insetcollapsable-save.C
? insets/insettext-save.C
? insets/safe
? mathed/safe
Index: BufferView.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView.C,v
retrieving revision 1.249
diff -u -p -u -r1.249 BufferView.C
--- BufferView.C	3 Apr 2004 08:36:53 -0000	1.249
+++ BufferView.C	7 Apr 2004 20:15:49 -0000
@@ -379,23 +379,10 @@ void BufferView::setCursor(ParIterator c
 		par[i].inset().edit(cursor(), true);
 
 	cursor().setCursor(makeDocIterator(par, pos), false);
+	par.bottom().text()->redoParagraph(par.bottom().par());
 }
 
 
-/*
-if the fitCursor call refers to some point in never-explored-land, then we
-don't have y information in insets there, then we cannot even do an update
-to get it (because we need the y infomation for setting top_y first). So
-this is solved in putSelectionAt with:
-
-- setting top_y to the y of the outerPar (that has good info)
-- calling update
-- calling cursor().updatePos()
-- then call fitCursor()
-
-Ab.
-*/
-
 void BufferView::putSelectionAt(DocIterator const & cur,
 				int length, bool backwards)
 {
@@ -403,16 +390,8 @@ void BufferView::putSelectionAt(DocItera
 
 	cursor().clearSelection();
 
-	LyXText & text = *cur[0].text();
 	setCursor(par, cur.pos());
 
-	// hack for the chicken and egg problem
-	top_y(text.getPar(par.outerPar()).y);
-
-	update();
-	//text.setCursor(cursor(), cur.par(), cur.pos());
-	cursor().updatePos();
-
 	if (length) {
 		if (backwards) {
 			cursor().setSelection(cursor(), -length);
@@ -422,9 +401,6 @@ void BufferView::putSelectionAt(DocItera
 		} else
 			cursor().setSelection(cursor(), length);
 	}
-
-	fitCursor();
-	update();
 }
 
 
Index: BufferView_pimpl.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView_pimpl.C,v
retrieving revision 1.537
diff -u -p -u -r1.537 BufferView_pimpl.C
--- BufferView_pimpl.C	7 Apr 2004 08:07:19 -0000	1.537
+++ BufferView_pimpl.C	7 Apr 2004 20:15:50 -0000
@@ -44,6 +44,7 @@
 #include "paragraph_funcs.h"
 #include "ParagraphParameters.h"
 #include "pariterator.h"
+#include "rowpainter.h"
 #include "undo.h"
 #include "vspace.h"
 
@@ -66,6 +67,7 @@
 #include "support/globbing.h"
 #include "support/path_defines.h"
 #include "support/tostr.h"
+#include "support/types.h"
 
 #include <boost/bind.hpp>
 
@@ -358,6 +360,12 @@ void BufferView::Pimpl::setBuffer(Buffer
 
 bool BufferView::Pimpl::fitCursor()
 {
+	// to get the correct y cursor info
+	lyxerr << "BufferView::fitCursor" << std::endl;
+	lyx::par_type const pit = bv_->cursor().bottom().par();
+	bv_->text()->redoParagraph(pit);
+	refreshPar(*bv_, *bv_->text(), pit);
+
 	if (!screen().fitCursor(bv_))
 		return false;
 	updateScrollbar();
@@ -388,7 +396,6 @@ void BufferView::Pimpl::resizeCurrentBuf
 
 	text->init(bv_);
 	update();
-	bv_->cursor().updatePos();
 	fitCursor();
 
 	switchKeyMap();
@@ -896,11 +903,11 @@ bool BufferView::Pimpl::workAreaDispatch
 	if (!res.dispatched())
 		res = cur.dispatch(cmd);
 
-	// Redraw if requested or necessary.
-	if (res.update())
-		update();
-	if (fitCursor())
-		update();
+	if (res.dispatched()) {
+		// Redraw if requested or necessary.
+		if (fitCursor() || res.update())
+			update();
+	}
 
 	// see workAreaKeyPress
 	cursor_timeout.restart();
@@ -1089,7 +1096,6 @@ bool BufferView::Pimpl::dispatch(FuncReq
 #endif
 		while (lyx::find::findNextChange(bv_))
 			bv_->getLyXText()->rejectChange(bv_->cursor());
-		update();
 		break;
 	}
 
@@ -1103,7 +1109,6 @@ bool BufferView::Pimpl::dispatch(FuncReq
 
 	case LFUN_MARK_OFF:
 		cur.clearSelection();
-		update();
 		cur.resetAnchor();
 		cur.message(N_("Mark off"));
 		break;
@@ -1111,7 +1116,6 @@ bool BufferView::Pimpl::dispatch(FuncReq
 	case LFUN_MARK_ON:
 		cur.clearSelection();
 		cur.mark() = true;
-		update();
 		cur.resetAnchor();
 		cur.message(N_("Mark on"));
 		break;
@@ -1126,7 +1130,6 @@ bool BufferView::Pimpl::dispatch(FuncReq
 			cur.message(N_("Mark set"));
 		}
 		cur.resetAnchor();
-		update();
 		break;
 
 	case LFUN_CENTER:
Index: ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v
retrieving revision 1.1885
diff -u -p -u -r1.1885 ChangeLog
--- ChangeLog	6 Apr 2004 13:48:12 -0000	1.1885
+++ ChangeLog	7 Apr 2004 20:16:03 -0000
@@ -1,3 +1,31 @@
+
+2004-04-07  Alfredo Braunstein  <[EMAIL PROTECTED]>
+
+	* BufferView.C (setCursor): call redoParagraph (some insets could
+	have been opened) 
+	(putSelectionAt): remove the 'double update' trick
+
+	* BufferView_pimpl.C (fitCursor): call refreshPar
+	(workAreaDispatch): remove an uneeded update call
+	(dispatch): remove some manual update calls
+
+	* cursor.[Ch]: remove cached_y_, updatePos
+	(selHandle): set noUpdate when appropriate
+
+	* lyxfunc.C (dispatch): track if we need an update
+	
+	* metricsinfo.[Ch]: PainterInfo receive a Painter & on construction
+
+	* rowpainter.[Ch] (RowPainter): remove superfluous xo_ parameter
+	(paintSelection): cheap optimization, do not call cursorX when not
+	needed 
+	(paintPars): change signature
+	(refreshPar): add
+	(paintText): adjust
+	(paintTextInset): adjust
+
+	* text.C: adjust
+
 2004-04-05  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
 
 	* lengthcommon.C: compilation fix: remove explicit array size from
Index: cursor.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/cursor.C,v
retrieving revision 1.92
diff -u -p -u -r1.92 cursor.C
--- cursor.C	7 Apr 2004 13:15:34 -0000	1.92
+++ cursor.C	7 Apr 2004 20:16:04 -0000
@@ -84,8 +84,7 @@ void region(CursorSlice const & i1, Curs
 
 
 LCursor::LCursor(BufferView & bv)
-	: DocIterator(), bv_(&bv),
-	  anchor_(), cached_y_(0), x_target_(-1),
+	: DocIterator(), bv_(&bv), anchor_(), x_target_(-1),
 	  selection_(false), mark_(false)
 {}
 
@@ -95,7 +94,6 @@ void LCursor::reset(InsetBase & inset)
 	clear();
 	push_back(CursorSlice(inset));
 	anchor_ = DocIterator(inset);
-	cached_y_ = 0;
 	clearTargetX();
 	selection_ = false;
 	mark_ = false;
@@ -139,6 +137,7 @@ DispatchResult LCursor::dispatch(FuncReq
 	if (!disp_.dispatched()) {
 		lyxerr << "RESTORING OLD CURSOR!" << endl;
 		operator=(safe);
+		disp_.dispatched(false);
 	}
 	return disp_;
 }
@@ -236,15 +235,6 @@ int LCursor::currentMode()
 }
 
 
-void LCursor::updatePos()
-{
-	BOOST_ASSERT(!empty());
-	if (size() > 1)
-		cached_y_ = bv().top_y() + back().inset().yo();
-		//cached_y_ = back().inset().yo();
-}
-
-
 void LCursor::getDim(int & asc, int & des) const
 {
 	if (inMathed()) {
@@ -270,16 +260,6 @@ void LCursor::getPos(int & x, int & y) c
 	y = 0;
 	if (!empty())
 		inset().getCursorPos(back(), x, y);
-	// getCursorPos gives _screen_ coordinates. We need to add
-	// top_y to get document coordinates. This is hidden in cached_y_.
-	//y += cached_y_ - inset().yo();
-	// The rest is non-obvious. The reason we have to have these
-	// extra computation is that the getCursorPos() calls rely
-	// on the inset's own knowledge of its screen position.
-	// If we scroll up or down in a big enough increment,
-	// inset->draw() is not called: this doesn't update
-	// inset.yo_, so getCursor() returns an old value.
-	// Ugly as you like.
 }
 
 
@@ -535,8 +515,12 @@ void LCursor::selPaste(size_t n)
 void LCursor::selHandle(bool sel)
 {
 	//lyxerr << "LCursor::selHandle" << endl;
-	if (sel == selection())
+	if (sel == selection()) {
+		if (!sel)
+			noUpdate();
 		return;
+	}
+	
 	resetAnchor();
 	selection() = sel;
 }
Index: cursor.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/cursor.h,v
retrieving revision 1.59
diff -u -p -u -r1.59 cursor.h
--- cursor.h	7 Apr 2004 13:15:34 -0000	1.59
+++ cursor.h	7 Apr 2004 20:16:04 -0000
@@ -142,8 +142,6 @@ public:
 
 	/// access to normalized selection anchor
 	CursorSlice anchor() const;
-	/// cache the absolute coordinate from the top inset
-	void updatePos();
 	/// sets anchor to cursor position
 	void resetAnchor();
 	/// access to owning BufferView
@@ -180,8 +178,6 @@ public:
 	DispatchResult disp_;
 
 private:
-	///
-	int cached_y_;
 	/**
 	 * The target x position of the cursor. This is used for when
 	 * we have text like :
Index: lyxfunc.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxfunc.C,v
retrieving revision 1.611
diff -u -p -u -r1.611 lyxfunc.C
--- lyxfunc.C	7 Apr 2004 08:07:20 -0000	1.611
+++ lyxfunc.C	7 Apr 2004 20:16:06 -0000
@@ -586,6 +586,8 @@ void LyXFunc::dispatch(FuncRequest const
 	dispatch_buffer.erase();
 	selection_possible = false;
 
+	bool update = true;
+	
 	// We cannot use this function here
 	if (!getStatus(cmd).enabled()) {
 		lyxerr[Debug::ACTION] << "LyXFunc::dispatch: "
@@ -1356,17 +1358,20 @@ void LyXFunc::dispatch(FuncRequest const
 		}
 
 		default: {
+			update = false;
 			DispatchResult res = view()->cursor().dispatch(cmd);
-			if (!res.dispatched());
-				view()->dispatch(cmd);
+			if (res.dispatched())
+				update |= res.update();
+			else
+				update |= view()->dispatch(cmd);
+			
 			break;
 		}
 		}
 
 		if (view()->available()) {
-			view()->fitCursor();
-			view()->update();
-			view()->cursor().updatePos();
+			if (view()->fitCursor() || update)
+				view()->update();
 			// if we executed a mutating lfun, mark the buffer as dirty
 			if (getStatus(cmd).enabled()
 					&& !lyxaction.funcHasFlag(cmd.action, LyXAction::NoBuffer)
Index: metricsinfo.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/metricsinfo.C,v
retrieving revision 1.13
diff -u -p -u -r1.13 metricsinfo.C
--- metricsinfo.C	7 Apr 2004 13:15:34 -0000	1.13
+++ metricsinfo.C	7 Apr 2004 20:16:06 -0000
@@ -43,8 +43,8 @@ MetricsInfo::MetricsInfo(BufferView * bv
 
 
 
-PainterInfo::PainterInfo(BufferView * bv)
-	: pain(bv->painter())
+PainterInfo::PainterInfo(BufferView * bv, Painter & pa)
+	: pain(pa)
 {
 	base.bv = bv;
 }
Index: metricsinfo.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/metricsinfo.h,v
retrieving revision 1.10
diff -u -p -u -r1.10 metricsinfo.h
--- metricsinfo.h	6 Oct 2003 15:42:29 -0000	1.10
+++ metricsinfo.h	7 Apr 2004 20:16:06 -0000
@@ -76,7 +76,7 @@ struct MetricsInfo {
 //
 struct PainterInfo {
 	///
-	explicit PainterInfo(BufferView * bv);
+	PainterInfo(BufferView * bv, Painter & pain);
 	///
 	void draw(int x, int y, char c);
 
Index: rowpainter.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/rowpainter.C,v
retrieving revision 1.125
diff -u -p -u -r1.125 rowpainter.C
--- rowpainter.C	27 Mar 2004 01:18:47 -0000	1.125
+++ rowpainter.C	7 Apr 2004 20:16:06 -0000
@@ -32,6 +32,7 @@
 #include "vspace.h"
 
 #include "frontends/font_metrics.h"
+#include "frontends/nullpainter.h"
 #include "frontends/Painter.h"
 
 #include "insets/insettext.h"
@@ -57,8 +58,8 @@ namespace {
 class RowPainter {
 public:
 	/// initialise and run painter
-	RowPainter(BufferView const & bv, LyXText const & text,
-		par_type pit, RowList::iterator rit, int xo, int yo);
+	RowPainter(BufferView const & bv, Painter & pain, LyXText const & text,
+		par_type pit, RowList::iterator rit, int y);
 private:
 	// paint various parts
 	void paintBackground();
@@ -118,10 +119,11 @@ private:
 };
 
 
-RowPainter::RowPainter(BufferView const & bv, LyXText const & text,
-     par_type pit, RowList::iterator rit, int xo, int yo)
-	: bv_(bv), pain_(bv_.painter()), text_(text), pars_(text.paragraphs()),
-		rit_(rit), row_(*rit), pit_(pit), xo_(xo), yo_(yo), width_(text_.width())
+RowPainter::RowPainter(BufferView const & bv, Painter & pain,
+	LyXText const & text, par_type pit, RowList::iterator rit, int y)
+	: bv_(bv), pain_(pain), text_(text), pars_(text.paragraphs()),
+	  rit_(rit), row_(*rit), pit_(pit),
+	  xo_(text_.xo_), yo_(y), width_(text_.width())
 {
 	//lyxerr << "RowPainter: x: " << x_ << " xo: " << xo << " yo: " << yo
 	//	<< " pit->y: " << pit_->y
@@ -196,7 +198,7 @@ void RowPainter::paintInset(pos_type con
 {
 	InsetBase const * inset = pars_[pit_].getInset(pos);
 	BOOST_ASSERT(inset);
-	PainterInfo pi(const_cast<BufferView *>(&bv_));
+	PainterInfo pi(const_cast<BufferView *>(&bv_), pain_);
 	pi.base.font = getFont(pos);
 	inset->drawSelection(pi, int(x_), yo_ + row_.baseline());
 	inset->draw(pi, int(x_), yo_ + row_.baseline());
@@ -396,8 +398,6 @@ void RowPainter::paintSelection()
 
 	// the current selection
 	LCursor const & cur = bv_.cursor();
-	int const startx = text_.cursorX(cur.selBegin());
-	int const endx = text_.cursorX(cur.selEnd());
 	int const starty = text_.cursorY(cur.selBegin());
 	int const endy = text_.cursorY(cur.selEnd());
 	par_type startpit = cur.selBegin().par();
@@ -414,14 +414,18 @@ void RowPainter::paintSelection()
 
 	if (text_.bidi.same_direction()) {
 		if (sel_on_one_row) {
+			int const startx = text_.cursorX(cur.selBegin());
+			int const endx = text_.cursorX(cur.selEnd());
 			int const x1 = is_rtl ? endx : startx;
 			int const x2 = is_rtl ? startx : endx;
 			pain_.fillRectangle(x1, yo_, x2 - x1, h, LColor::selection);
 		} else if (sel_starts_here) {
+			int const startx = text_.cursorX(cur.selBegin());
 			int const x1 = is_rtl ? int(xo_) : startx;
 			int const x2 = is_rtl ? startx : int(xo_) + width_;
 			pain_.fillRectangle(x1, yo_, x2 - x1, h, LColor::selection);
 		} else if (sel_ends_here) {
+			int const endx = text_.cursorX(cur.selEnd());
 			int const x1 = is_rtl ? endx : int(xo_);
 			int const x2 = is_rtl ? int(xo_) + width_ : endx;
 			pain_.fillRectangle(x1, yo_, x2 - x1, h, LColor::selection);
@@ -844,43 +848,53 @@ void RowPainter::paintText()
 }
 
 
-int paintPars(BufferView const & bv, LyXText const & text,
-	par_type pit, int xo, int yo, int y)
+int paintPars(BufferView const & bv, Painter & pain,
+	      LyXText const & text, par_type pit, par_type end)
 {
 	//lyxerr << "  paintRows: pit: " << &*pit << endl;
-	int const y2 = bv.painter().paperHeight();
-	y -= bv.top_y();
-
 	ParagraphList & pars = text.paragraphs();
-	for ( ; pit != par_type(pars.size()); ++pit) {
+
+	int y = pars[pit].y + text.yo_ - bv.top_y();
+	int const y2 = pain.paperHeight();
+
+	for (; pit != end; ++pit) {
 		RowList::iterator row = pars[pit].rows.begin();
 		RowList::iterator rend = pars[pit].rows.end();
 
 		for ( ; row != rend; ++row) {
-			RowPainter(bv, text, pit, row, xo, y + yo);
+			RowPainter(bv, pain, text, pit, row, y);
 			y += row->height();
+			if (y >= y2)
+				break;
 		}
-		if (yo + y >= y2)
-			break;
-	}
 
+	}
 	return y;
 }
 
+
 } // namespace anon
 
 
+void refreshPar(BufferView const & bv, LyXText const & text, par_type pit)
+{
+	
+	static NullPainter nop;
+	paintPars(bv, nop, text, pit, pit + 1);
+}
+
+
 int paintText(BufferView const & bv)
 {
-	par_type pit;
-	bv.text()->updateParPositions();
-	bv.text()->getRowNearY(bv.top_y(), pit);
+	par_type pit, end;
+	getParsInRange(bv.text()->paragraphs(), bv.top_y(),
+		       bv.top_y() + bv.workHeight(), pit, end);
 	//lyxerr << "top_y: " << bv.top_y() << " y: " << pit->y << endl;
-	return paintPars(bv, *bv.text(), pit, 0, 0, bv.text()->paragraphs()[pit].y);
+	return paintPars(bv, bv.painter(), *bv.text(), pit, end);
 }
 
 
-void paintTextInset(LyXText const & text, PainterInfo & pi, int xo, int yo)
+void paintTextInset(LyXText const & text, PainterInfo & pi)
 {
-	paintPars(*pi.base.bv, text, 0, xo, yo, 0);
+	paintPars(*pi.base.bv, pi.pain, text, 0, text.paragraphs().size());
 }
Index: rowpainter.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/rowpainter.h,v
retrieving revision 1.18
diff -u -p -u -r1.18 rowpainter.h
--- rowpainter.h	15 Dec 2003 11:36:13 -0000	1.18
+++ rowpainter.h	7 Apr 2004 20:16:06 -0000
@@ -13,6 +13,8 @@
 #ifndef ROWPAINTER_H
 #define ROWPAINTER_H
 
+#include "support/types.h"
+
 class LyXText;
 class BufferView;
 class PainterInfo;
@@ -20,7 +22,11 @@ class PainterInfo;
 /// paint the rows of the main text, return last drawn y value
 int paintText(BufferView const & bv);
 
+/// refresh a par of the main text
+void refreshPar(BufferView const & bv, LyXText const & text,
+		lyx::par_type pit);
+
 /// paint the rows of a text inset
-void paintTextInset(LyXText const & text, PainterInfo & pi, int x, int y);
+void paintTextInset(LyXText const & text, PainterInfo & pi);
 
 #endif // ROWPAINTER_H
Index: text.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v
retrieving revision 1.558
diff -u -p -u -r1.558 text.C
--- text.C	5 Apr 2004 09:36:20 -0000	1.558
+++ text.C	7 Apr 2004 20:16:08 -0000
@@ -1863,7 +1863,7 @@ void LyXText::draw(PainterInfo & pi, int
 {
 	xo_ = x;
 	yo_ = y;
-	paintTextInset(*this, pi, x, y);
+	paintTextInset(*this, pi);
 }
 
 
Index: frontends/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/ChangeLog,v
retrieving revision 1.246
diff -u -p -u -r1.246 ChangeLog
--- frontends/ChangeLog	5 Apr 2004 18:17:47 -0000	1.246
+++ frontends/ChangeLog	7 Apr 2004 20:16:09 -0000
@@ -1,3 +1,13 @@
+
+2004-04-07  Alfredo Braunstein  <[EMAIL PROTECTED]>
+
+	* Makefile.am: adjust
+
+	* Painter.[Ch]: remove Painter & return value everywhere, make
+	virtual all remaining nonvirtual methods
+	
+	* nullpainter.[Ch]: add no-op painter
+
 2004-04-05  Angus Leeming  <[EMAIL PROTECTED]>
 
 	* Dialogs.h: remove redundant header file. Clean up comments.
Index: frontends/Makefile.am
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/Makefile.am,v
retrieving revision 1.58
diff -u -p -u -r1.58 Makefile.am
--- frontends/Makefile.am	5 Sep 2003 10:55:42 -0000	1.58
+++ frontends/Makefile.am	7 Apr 2004 20:16:09 -0000
@@ -35,5 +35,7 @@ libfrontends_la_SOURCES = \
 	key_state.h \
 	lyx_gui.h \
 	mouse_state.h \
+	nullpainter.C \
+	nullpainter.h \
 	screen.C \
 	screen.h
Index: frontends/Painter.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/Painter.C,v
retrieving revision 1.15
diff -u -p -u -r1.15 Painter.C
--- frontends/Painter.C	6 Oct 2003 15:42:44 -0000	1.15
+++ frontends/Painter.C	7 Apr 2004 20:16:09 -0000
@@ -22,15 +22,14 @@ using std::max;
 using std::string;
 
 
-Painter & Painter::button(int x, int y, int w, int h)
+void Painter::button(int x, int y, int w, int h)
 {
 	fillRectangle(x, y, w, h, LColor::buttonbg);
 	buttonFrame(x, y, w, h);
-	return * this;
 }
 
 
-Painter & Painter::buttonFrame(int x, int y, int w, int h)
+void Painter::buttonFrame(int x, int y, int w, int h)
 {
 	//  Width of a side of the button
 	int const d = 2;
@@ -52,12 +51,10 @@ Painter & Painter::buttonFrame(int x, in
 	x1[2] = x + w; y1[2] = (y + h - d);
 	x1[3] = x + w; y1[3] = y;
 	fillPolygon(x1, y1, 4, LColor::right);
-
-	return *this;
 }
 
 
-Painter & Painter::rectText(int x, int baseline,
+void Painter::rectText(int x, int baseline,
 	string const & str,
 	LyXFont const & font,
 	LColor_color back,
@@ -79,11 +76,10 @@ Painter & Painter::rectText(int x, int b
 	}
 
 	text(x + 3, baseline, str, font);
-	return *this;
 }
 
 
-Painter & Painter::buttonText(int x, int baseline,
+void Painter::buttonText(int x, int baseline,
 	string const & str,
 	LyXFont const & font)
 {
@@ -95,7 +91,6 @@ Painter & Painter::buttonText(int x, int
 
 	button(x, baseline - ascent, width, descent + ascent);
 	text(x + 4, baseline, str, font);
-	return *this;
 }
 
 
Index: frontends/Painter.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/Painter.h,v
retrieving revision 1.15
diff -u -p -u -r1.15 Painter.h
--- frontends/Painter.h	6 Oct 2003 15:42:44 -0000	1.15
+++ frontends/Painter.h	7 Apr 2004 20:16:10 -0000
@@ -74,7 +74,7 @@ public:
 	virtual int paperHeight() const = 0;
 
 	/// draw a line from point to point
-	virtual Painter & line(
+	virtual void line(
 		int x1, int y1,
 		int x2, int y2,
 		LColor_color,
@@ -87,7 +87,7 @@ public:
 	 * @param yp array of points' y co-ords
 	 * @param np size of the points array
 	 */
-	virtual Painter & lines(
+	virtual void lines(
 		int const * xp,
 		int const * yp,
 		int np,
@@ -96,7 +96,7 @@ public:
 		line_width = line_thin) = 0;
 
 	/// draw a rectangle
-	virtual Painter & rectangle(
+	virtual void rectangle(
 		int x, int y,
 		int w, int h,
 		LColor_color,
@@ -104,53 +104,53 @@ public:
 		line_width = line_thin) = 0;
 
 	/// draw a filled rectangle
-	virtual Painter & fillRectangle(
+	virtual void fillRectangle(
 		int x, int y,
 		int w, int h,
 		LColor_color) = 0;
 
 	/// draw a filled (irregular) polygon
-	virtual Painter & fillPolygon(
+	virtual void fillPolygon(
 		int const * xp,
 		int const * yp,
 		int np,
 		LColor_color) = 0;
 
 	/// draw an arc
-	virtual Painter & arc(
+	virtual void arc(
 		int x, int y,
 		unsigned int w, unsigned int h,
 		int a1, int a2,
 		LColor_color) = 0;
 
 	/// draw a pixel
-	virtual Painter & point(
+	virtual void point(
 		int x, int y,
 		LColor_color) = 0;
 
 	/// draw a filled rectangle with the shape of a 3D button
-	virtual Painter & button(int x, int y,
+	virtual void button(int x, int y,
 		int w, int h);
 
 	/// draw an image from the image cache
-	virtual Painter & image(int x, int y,
+	virtual void image(int x, int y,
 		int w, int h,
 		lyx::graphics::Image const & image) = 0;
 
 	/// draw a string at position x, y (y is the baseline)
-	virtual Painter & text(int x, int y,
+	virtual void text(int x, int y,
 		std::string const & str, LyXFont const & f) = 0;
 
 	/**
 	 * Draw a string at position x, y (y is the baseline)
 	 * This is just for fast drawing
 	 */
-	virtual Painter & text(int x, int y,
+	virtual void text(int x, int y,
 		char const * str, size_t l,
 		LyXFont const & f) = 0;
 
 	/// draw a char at position x, y (y is the baseline)
-	virtual Painter & text(int x, int y,
+	virtual void text(int x, int y,
 		char c, LyXFont const & f) = 0;
 
 	/**
@@ -159,24 +159,24 @@ public:
 	 * the given color. If frame is specified, a thin frame is drawn
 	 * around the text with the given color.
 	 */
-	Painter & rectText(int x, int baseline,
+	virtual void rectText(int x, int baseline,
 		std::string const & str,
 		LyXFont const & font,
 		LColor_color back,
 		LColor_color frame);
 
 	/// draw a string and enclose it inside a button frame
-	Painter & buttonText(int x,
+	virtual void buttonText(int x,
 		int baseline, std::string const & s,
 		LyXFont const & font);
 
 protected:
 	/// check the font, and if set, draw an underline
-	void underline(LyXFont const & f,
+	virtual void underline(LyXFont const & f,
 		int x, int y, int width);
 
 	/// draw a bevelled button border
-	Painter & buttonFrame(int x, int y, int w, int h);
+	virtual void buttonFrame(int x, int y, int w, int h);
 };
 
 #endif // PAINTER_H
Index: frontends/nullpainter.C
===================================================================
RCS file: frontends/nullpainter.C
diff -N frontends/nullpainter.C
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ frontends/nullpainter.C	7 Apr 2004 20:16:10 -0000
@@ -0,0 +1,22 @@
+/**
+ * \file nullpainter.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Alfredo Braunstein
+ * \author John Levon
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include "nullpainter.h"
+
+#include "LColor.h"
+
+#include <limits>
+
+
+int NullPainter::paperHeight() const
+{
+	return std::numeric_limits<int>::max();
+}
Index: frontends/nullpainter.h
===================================================================
RCS file: frontends/nullpainter.h
diff -N frontends/nullpainter.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ frontends/nullpainter.h	7 Apr 2004 20:16:10 -0000
@@ -0,0 +1,76 @@
+// -*- C++ -*-
+/**
+ * \file nullpainter.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Alfredo Braunstein
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef NULLPAINTER_H
+#define NULLPAINTER_H
+
+#include <config.h>
+
+#include "LColor.h"
+#include "Painter.h"
+
+class NullPainter : public Painter {
+public:
+	///
+	NullPainter() {}
+	
+	virtual ~NullPainter() {}
+
+	/// begin painting
+	void start() {}
+	/// end painting
+	void end() {}
+
+	/// 
+	int paperWidth() const { return 0; }
+	/// 
+	int paperHeight() const;
+	
+	///
+	void line(int, int, int, int, LColor_color,
+		       line_style = line_solid, line_width = line_thin) {}
+	///
+	void lines(int const *, int const *, int, LColor_color,
+			line_style = line_solid, line_width = line_thin) {}
+	///
+	void rectangle(int, int, int, int,	LColor_color,
+		line_style = line_solid, line_width = line_thin) {}
+	/// 
+	void fillRectangle(int, int, int, int, LColor_color) {}
+	/// 
+	void fillPolygon(int const *, int const *, int, LColor_color) {}
+	/// 
+	void arc(int, int,	unsigned int, unsigned int,
+		int, int, LColor_color) {}
+	/// 
+	void point(int, int, LColor_color) {}
+	/// 
+	void button(int, int, int, int) {}
+	/// 
+	void image(int, int, int, int, lyx::graphics::Image const &) {}
+	/// 
+	void text(int, int, std::string const &, LyXFont const &) {}
+	///
+	void text(int, int, char const *, size_t, LyXFont const &) {}
+	///
+	void text(int, int, char, LyXFont const &) {}
+	///
+	void rectText(int, int, std::string const &,
+		LyXFont const &, LColor_color, LColor_color) {}
+	///
+	void buttonText(int, int, std::string const &, LyXFont const &) {}
+	///
+	void underline(LyXFont const &, int, int, int) {}
+	///
+	void buttonFrame(int, int, int, int) {}
+};
+
+#endif // NULLPAINTER_H
Index: frontends/screen.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/screen.C,v
retrieving revision 1.93
diff -u -p -u -r1.93 screen.C
--- frontends/screen.C	3 Apr 2004 08:37:08 -0000	1.93
+++ frontends/screen.C	7 Apr 2004 20:16:10 -0000
@@ -213,8 +213,8 @@ bool LyXScreen::fitCursor(BufferView * b
 
 	bv->cursor().getPos(x, y);
 	bv->cursor().getDim(asc, desc);
-	//lyxerr << "LyXScreen::fitCursor: x: " << x << " y: " << y
-	//	<< "  top_y: " << top_y << endl;
+	lyxerr << "LyXScreen::fitCursor: x: " << x << " y: " << y
+	       << "  top_y: " << top_y << endl;
 
 	bool const big_row = h / 4 < asc + desc && asc + desc < h;
 
Index: frontends/gtk/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/gtk/ChangeLog,v
retrieving revision 1.36
diff -u -p -u -r1.36 ChangeLog
--- frontends/gtk/ChangeLog	5 Apr 2004 18:34:35 -0000	1.36
+++ frontends/gtk/ChangeLog	7 Apr 2004 20:16:11 -0000
@@ -1,3 +1,8 @@
+
+2004-04-07  Alfredo Braunstein  <[EMAIL PROTECTED]>
+
+	* GPainter.[Ch]: adjust to changes in Painter.h
+
 2004-04-05  Angus Leeming  <[EMAIL PROTECTED]>
 
 	* Dialogs.C (build): set the preferences dialog button policy to
Index: frontends/gtk/GPainter.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/gtk/GPainter.C,v
retrieving revision 1.9
diff -u -p -u -r1.9 GPainter.C
--- frontends/gtk/GPainter.C	27 Mar 2004 01:18:50 -0000	1.9
+++ frontends/gtk/GPainter.C	7 Apr 2004 20:16:11 -0000
@@ -86,7 +86,7 @@ void GPainter::setLineParam(Glib::RefPtr
 }
 
 
-Painter & GPainter::point(int x, int y, LColor_color c)
+void GPainter::point(int x, int y, LColor_color c)
 {
 	setForeground(owner_.getGC(), c);
 	owner_.getPixmap()->draw_point(owner_.getGC(), x, y);
@@ -94,7 +94,7 @@ Painter & GPainter::point(int x, int y, 
 }
 
 
-Painter & GPainter::line(int x1, int y1,
+void GPainter::line(int x1, int y1,
 	int x2, int y2,
 	LColor_color col,
 	line_style ls,
@@ -107,8 +107,7 @@ Painter & GPainter::line(int x1, int y1,
 }
 
 
-Painter & GPainter::lines(int const * xp, int const * yp,
-	int np,
+void GPainter::lines(int const * xp, int const * yp, int np,
 	LColor_color col,
 	line_style ls,
 	line_width lw)
@@ -126,8 +125,7 @@ Painter & GPainter::lines(int const * xp
 }
 
 
-Painter & GPainter::rectangle(int x, int y,
-	int w, int h,
+void GPainter::rectangle(int x, int y, int w, int h,
 	LColor_color col,
 	line_style ls,
 	line_width lw)
@@ -139,8 +137,7 @@ Painter & GPainter::rectangle(int x, int
 }
 
 
-Painter & GPainter::fillRectangle(int x, int y,
-	int w, int h,
+void GPainter::fillRectangle(int x, int y, int w, int h,
 	LColor_color col)
 {
 	setForeground(owner_.getGC(), col);
@@ -149,7 +146,7 @@ Painter & GPainter::fillRectangle(int x,
 }
 
 
-Painter & GPainter::fillPolygon(int const * xp, int const * yp,
+void GPainter::fillPolygon(int const * xp, int const * yp,
 	int np, LColor_color col)
 {
 	setForeground(owner_.getGC(), col);
@@ -164,8 +161,7 @@ Painter & GPainter::fillPolygon(int cons
 }
 
 
-Painter & GPainter::arc(int x, int y,
-	unsigned int w, unsigned int h,
+void GPainter::arc(int x, int y, unsigned int w, unsigned int h,
 	int a1, int a2, LColor_color col)
 {
 	setForeground(owner_.getGC(), col);
@@ -175,8 +171,7 @@ Painter & GPainter::arc(int x, int y,
 }
 
 
-Painter & GPainter::image(int x, int y,
-	int w, int h,
+void GPainter::image(int x, int y, int w, int h,
 	lyx::graphics::Image const & i)
 {
 	lyx::graphics::xformsImage const & image =
@@ -189,8 +184,7 @@ Painter & GPainter::image(int x, int y,
 }
 
 
-Painter & GPainter::text(int x, int y,
-	std::string const & s, LyXFont const & f)
+void GPainter::text(int x, int y, std::string const & s, LyXFont const & f)
 {
 	size_t size = s.length() + 1;
 	wchar_t * wcs = (wchar_t *) alloca(size * sizeof(wchar_t));
@@ -199,8 +193,7 @@ Painter & GPainter::text(int x, int y,
 }
 
 
-Painter & GPainter::text(int x, int y,
-	char c, LyXFont const & f)
+void GPainter::text(int x, int y, char c, LyXFont const & f)
 {
 	char s[2] = { c, '\0' };
 	return text(x, y, s, 1, f);
@@ -222,8 +215,7 @@ int width(wchar_t const *s, size_t n, Ly
 }
 
 
-Painter & GPainter::text(int x, int y, wchar_t const * s, int ls,
-                      LyXFont const & f)
+void GPainter::text(int x, int y, wchar_t const * s, int ls, LyXFont const & f)
 {
 	XftFont * font = getXftFont(f);
 	XftColor * xftClr = owner_.getColorHandler().
@@ -258,9 +250,7 @@ Painter & GPainter::text(int x, int y, w
 }
 
 
-Painter & GPainter::text(int x, int y,
-	char const * s, size_t ls,
-	LyXFont const & f)
+void GPainter::text(int x, int y, char const * s, size_t ls, LyXFont const & f)
 {
 	boost::scoped_array<wchar_t> wcs(new wchar_t[ls + 1]);
 	size_t len;
Index: frontends/gtk/GPainter.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/gtk/GPainter.h,v
retrieving revision 1.7
diff -u -p -u -r1.7 GPainter.h
--- frontends/gtk/GPainter.h	6 Oct 2003 15:42:49 -0000	1.7
+++ frontends/gtk/GPainter.h	7 Apr 2004 20:16:11 -0000
@@ -38,7 +38,7 @@ public:
 			  line_style ls, line_width lw);
 	XftColor * getXftColor(LColor_color clr);
 	/// draw a line from point to point
-	virtual Painter & line(
+	virtual void line(
 		int x1, int y1,
 		int x2, int y2,
 		LColor_color,
@@ -51,7 +51,7 @@ public:
 	 * @param yp array of points' y co-ords
 	 * @param np size of the points array
 	 */
-	virtual Painter & lines(
+	virtual void lines(
 		int const * xp,
 		int const * yp,
 		int np,
@@ -60,7 +60,7 @@ public:
 		line_width = line_thin);
 
 	/// draw a rectangle
-	virtual Painter & rectangle(
+	virtual void rectangle(
 		int x, int y,
 		int w, int h,
 		LColor_color,
@@ -68,55 +68,55 @@ public:
 		line_width = line_thin);
 
 	/// draw a filled rectangle
-	virtual Painter & fillRectangle(
+	virtual void fillRectangle(
 		int x, int y,
 		int w, int h,
 		LColor_color);
 
 	/// draw a filled (irregular) polygon
-	virtual Painter & fillPolygon(
+	virtual void fillPolygon(
 		int const * xp,
 		int const * yp,
 		int np,
 		LColor_color);
 
 	/// draw an arc
-	virtual Painter & arc(
+	virtual void arc(
 		int x, int y,
 		unsigned int w, unsigned int h,
 		int a1, int a2,
 		LColor_color);
 
 	/// draw a pixel
-	virtual Painter & point(
+	virtual void point(
 		int x, int y,
 		LColor_color);
 
 	/// draw an image from the image cache
-	virtual Painter & image(int x, int y,
+	virtual void image(int x, int y,
 		int w, int h,
 		lyx::graphics::Image const & image);
 
 	/// draw a string at position x, y (y is the baseline)
-	virtual Painter & text(int x, int y,
+	virtual void text(int x, int y,
 		std::string const & str, LyXFont const & f);
 
 	/** Draw a string at position x, y (y is the baseline)
 	 *  This is just for fast drawing
 	 */
-	virtual Painter & text(int x, int y,
+	virtual void text(int x, int y,
 		char const * str, size_t l,
 		LyXFont const & f);
 
-        virtual Painter & text(int x, int y, wchar_t const * str, int l,
+        virtual void text(int x, int y, wchar_t const * str, int l,
 			       LyXFont const & f);
 
 	/// draw a char at position x, y (y is the baseline)
-	virtual Painter & text(int x, int y,
+	virtual void text(int x, int y,
 			       char c, LyXFont const & f);
 
 	/// draw a wide string at position x, y
-	Painter & text(int x, int y,
+	void text(int x, int y,
 		XChar2b const * str, size_t l,
 		LyXFont const & f);
 
Index: frontends/qt2/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/ChangeLog,v
retrieving revision 1.666
diff -u -p -u -r1.666 ChangeLog
--- frontends/qt2/ChangeLog	5 Apr 2004 18:34:35 -0000	1.666
+++ frontends/qt2/ChangeLog	7 Apr 2004 20:16:15 -0000
@@ -1,3 +1,7 @@
+2004-04-07  Alfredo Braunstein  <[EMAIL PROTECTED]>
+
+	* QLPainter.[Ch]: adjust to changes in Painter.h
+
 2004-04-05  Angus Leeming  <[EMAIL PROTECTED]>
 
 	* Dialogs.C (build): set the preferences dialog button policy to
Index: frontends/qt2/QLPainter.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QLPainter.C,v
retrieving revision 1.30
diff -u -p -u -r1.30 QLPainter.C
--- frontends/qt2/QLPainter.C	6 Oct 2003 15:42:50 -0000	1.30
+++ frontends/qt2/QLPainter.C	7 Apr 2004 20:16:15 -0000
@@ -86,26 +86,22 @@ QPainter & QLPainter::setPen(LColor_colo
 }
 
 
-Painter & QLPainter::point(int x, int y, LColor_color c)
+void QLPainter::point(int x, int y, LColor_color c)
 {
 	setPen(c).drawPoint(x, y);
-	return *this;
 }
 
 
-Painter & QLPainter::line(int x1, int y1,
-	int x2, int y2,
+void QLPainter::line(int x1, int y1, int x2, int y2,
 	LColor_color col,
 	line_style ls,
 	line_width lw)
 {
 	setPen(col, ls, lw).drawLine(x1, y1, x2, y2);
-	return *this;
 }
 
 
-Painter & QLPainter::lines(int const * xp, int const * yp,
-	int np,
+void QLPainter::lines(int const * xp, int const * yp, int np,
 	LColor_color col,
 	line_style ls,
 	line_width lw)
@@ -121,38 +117,31 @@ Painter & QLPainter::lines(int const * x
 	}
 
 	setPen(col, ls, lw).drawPolyline(QPointArray(np, points.get()));
-
-	return *this;
 }
 
 
-Painter & QLPainter::rectangle(int x, int y,
-	int w, int h,
+void QLPainter::rectangle(int x, int y, int w, int h,
 	LColor_color col,
 	line_style ls,
 	line_width lw)
 {
 	setPen(col, ls, lw).drawRect(x, y, w, h);
-	return *this;
 }
 
 
-Painter & QLPainter::fillRectangle(int x, int y,
-	int w, int h,
-	LColor_color col)
+void QLPainter::fillRectangle(int x, int y, int w, int h, LColor_color col)
 {
 	qp_->fillRect(x, y, w, h, lcolorcache.get(col));
-	return *this;
 }
 
 
-Painter & QLPainter::fillPolygon(int const * xp, int const * yp,
+void QLPainter::fillPolygon(int const * xp, int const * yp,
 	int np, LColor_color col)
 {
 	// Must use new as np is not known at compile time.
 	boost::scoped_array<QCOORD> points(new QCOORD[np * 2]);
 
-	//if (1) return *this;
+	//if (1) return;
 
 	for (int i = 0, j = 0; i < np; ++i) {
 		points[j++] = xp[i];
@@ -163,39 +152,31 @@ Painter & QLPainter::fillPolygon(int con
 	qp_->setBrush(lcolorcache.get(col));
 	qp_->drawPolygon(QPointArray(np, points.get()));
 	qp_->setBrush(Qt::NoBrush);
-
-	return *this;
 }
 
 
-Painter & QLPainter::arc(int x, int y,
-	unsigned int w, unsigned int h,
+void QLPainter::arc(int x, int y, unsigned int w, unsigned int h,
 	int a1, int a2, LColor_color col)
 {
 	// LyX usings 1/64ths degree, Qt usings 1/16th
 	setPen(col).drawArc(x, y, w, h, a1 / 4, a2 / 4);
-	return *this;
 }
 
 
-Painter & QLPainter::image(int x, int y,
-	int w, int h,
+void QLPainter::image(int x, int y, int w, int h,
 	lyx::graphics::Image const & i)
 {
 	qp_->drawPixmap(x, y, static_cast<lyx::graphics::QLImage const &>(i).qpixmap(), 0, 0, w, h);
-	return *this;
 }
 
 
-Painter & QLPainter::text(int x, int y,
-	string const & s, LyXFont const & f)
+void QLPainter::text(int x, int y, string const & s, LyXFont const & f)
 {
 	return text(x, y, s.data(), s.length(), f);
 }
 
 
-Painter & QLPainter::text(int x, int y,
-	char c, LyXFont const & f)
+void QLPainter::text(int x, int y, char c, LyXFont const & f)
 {
 	char s[2] = { c, '\0' };
 	return text(x, y, s, 1, f);
@@ -230,8 +211,7 @@ void QLPainter::smallCapsText(int x, int
 }
 
 
-Painter & QLPainter::text(int x, int y,
-	char const * s, size_t ls,
+void QLPainter::text(int x, int y, char const * s, size_t ls,
 	LyXFont const & f)
 {
 	setPen(f.realColor());
@@ -269,6 +249,4 @@ Painter & QLPainter::text(int x, int y,
 	if (f.underbar() == LyXFont::ON) {
 		underline(f, x, y, font_metrics::width(s, ls, f));
 	}
-
-	return *this;
 }
Index: frontends/qt2/QLPainter.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QLPainter.h,v
retrieving revision 1.13
diff -u -p -u -r1.13 QLPainter.h
--- frontends/qt2/QLPainter.h	6 Oct 2003 15:42:50 -0000	1.13
+++ frontends/qt2/QLPainter.h	7 Apr 2004 20:16:15 -0000
@@ -40,7 +40,7 @@ public:
 	virtual int paperHeight() const;
 
 	/// draw a line from point to point
-	virtual Painter & line(
+	virtual void line(
 		int x1, int y1,
 		int x2, int y2,
 		LColor_color,
@@ -53,7 +53,7 @@ public:
 	 * @param yp array of points' y co-ords
 	 * @param np size of the points array
 	 */
-	virtual Painter & lines(
+	virtual void lines(
 		int const * xp,
 		int const * yp,
 		int np,
@@ -62,7 +62,7 @@ public:
 		line_width = line_thin);
 
 	/// draw a rectangle
-	virtual Painter & rectangle(
+	virtual void rectangle(
 		int x, int y,
 		int w, int h,
 		LColor_color,
@@ -70,48 +70,48 @@ public:
 		line_width = line_thin);
 
 	/// draw a filled rectangle
-	virtual Painter & fillRectangle(
+	virtual void fillRectangle(
 		int x, int y,
 		int w, int h,
 		LColor_color);
 
 	/// draw a filled (irregular) polygon
-	virtual Painter & fillPolygon(
+	virtual void fillPolygon(
 		int const * xp,
 		int const * yp,
 		int np,
 		LColor_color);
 
 	/// draw an arc
-	virtual Painter & arc(
+	virtual void arc(
 		int x, int y,
 		unsigned int w, unsigned int h,
 		int a1, int a2,
 		LColor_color);
 
 	/// draw a pixel
-	virtual Painter & point(
+	virtual void point(
 		int x, int y,
 		LColor_color);
 
 	/// draw an image from the image cache
-	virtual Painter & image(int x, int y,
+	virtual void image(int x, int y,
 		int w, int h,
 		lyx::graphics::Image const & image);
 
 	/// draw a string at position x, y (y is the baseline)
-	virtual Painter & text(int x, int y,
+	virtual void text(int x, int y,
 		std::string const & str, LyXFont const & f);
 
 	/** Draw a string at position x, y (y is the baseline)
 	 *  This is just for fast drawing
 	 */
-	virtual Painter & text(int x, int y,
+	virtual void text(int x, int y,
 		char const * str, size_t l,
 		LyXFont const & f);
 
 	/// draw a char at position x, y (y is the baseline)
-	virtual Painter & text(int x, int y,
+	virtual void text(int x, int y,
 		char c, LyXFont const & f);
 private:
 	/// draw small caps text
Index: frontends/xforms/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/ChangeLog,v
retrieving revision 1.898
diff -u -p -u -r1.898 ChangeLog
--- frontends/xforms/ChangeLog	5 Apr 2004 18:34:35 -0000	1.898
+++ frontends/xforms/ChangeLog	7 Apr 2004 20:16:21 -0000
@@ -1,3 +1,8 @@
+
+2004-04-07  Alfredo Braunstein  <[EMAIL PROTECTED]>
+
+	* XPainter.[Ch]: adjust to changes in Painter.h
+
 2004-04-05  Angus Leeming  <[EMAIL PROTECTED]>
 
 	* Dialogs.C (build): set the preferences dialog button policy to
Index: frontends/xforms/XPainter.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/XPainter.C,v
retrieving revision 1.29
diff -u -p -u -r1.29 XPainter.C
--- frontends/xforms/XPainter.C	6 Oct 2003 15:42:57 -0000	1.29
+++ frontends/xforms/XPainter.C	7 Apr 2004 20:16:22 -0000
@@ -51,15 +51,14 @@ int XPainter::paperHeight() const
 }
 
 
-Painter & XPainter::point(int x, int y, LColor_color c)
+void XPainter::point(int x, int y, LColor_color c)
 {
 	XDrawPoint(fl_get_display(), owner_.getPixmap(),
 		lyxColorHandler->getGCForeground(c), x, y);
-	return *this;
 }
 
 
-Painter & XPainter::line(int x1, int y1,
+void XPainter::line(int x1, int y1,
 	int x2, int y2,
 	LColor_color col,
 	line_style ls,
@@ -68,11 +67,10 @@ Painter & XPainter::line(int x1, int y1,
 	XDrawLine(fl_get_display(), owner_.getPixmap(),
 		lyxColorHandler->getGCLinepars(ls, lw, col),
 		x1, y1, x2, y2);
-	return *this;
 }
 
 
-Painter & XPainter::lines(int const * xp, int const * yp,
+void XPainter::lines(int const * xp, int const * yp,
 	int np,
 	LColor_color col,
 	line_style ls,
@@ -88,12 +86,10 @@ Painter & XPainter::lines(int const * xp
 	XDrawLines(fl_get_display(), owner_.getPixmap(),
 		lyxColorHandler->getGCLinepars(ls, lw, col),
 		points.get(), np, CoordModeOrigin);
-
-	return *this;
 }
 
 
-Painter & XPainter::rectangle(int x, int y,
+void XPainter::rectangle(int x, int y,
 	int w, int h,
 	LColor_color col,
 	line_style ls,
@@ -102,21 +98,19 @@ Painter & XPainter::rectangle(int x, int
 	XDrawRectangle(fl_get_display(), owner_.getPixmap(),
 		lyxColorHandler->getGCLinepars(ls, lw, col),
 		x, y, w, h);
-	return *this;
 }
 
 
-Painter & XPainter::fillRectangle(int x, int y,
+void XPainter::fillRectangle(int x, int y,
 	int w, int h,
 	LColor_color col)
 {
 	XFillRectangle(fl_get_display(), owner_.getPixmap(),
 		lyxColorHandler->getGCForeground(col), x, y, w, h);
-	return *this;
 }
 
 
-Painter & XPainter::fillPolygon(int const * xp, int const * yp,
+void XPainter::fillPolygon(int const * xp, int const * yp,
 	int np, LColor_color col)
 {
 	boost::scoped_array<XPoint> points(new XPoint[np]);
@@ -129,23 +123,20 @@ Painter & XPainter::fillPolygon(int cons
 	XFillPolygon(fl_get_display(), owner_.getPixmap(),
 		lyxColorHandler->getGCForeground(col), points.get(),
 		np, Nonconvex, CoordModeOrigin);
-
-	return *this;
 }
 
 
-Painter & XPainter::arc(int x, int y,
+void XPainter::arc(int x, int y,
 	unsigned int w, unsigned int h,
 	int a1, int a2, LColor_color col)
 {
 	XDrawArc(fl_get_display(), owner_.getPixmap(),
 		lyxColorHandler->getGCForeground(col),
 		x, y, w, h, a1, a2);
-	return *this;
 }
 
 
-Painter & XPainter::image(int x, int y,
+void XPainter::image(int x, int y,
 			  int w, int h,
 			  lyx::graphics::Image const & i)
 {
@@ -159,18 +150,17 @@ Painter & XPainter::image(int x, int y,
 	XCopyArea(fl_get_display(), image.getPixmap(), owner_.getPixmap(),
 		gc, 0, 0, w, h, x, y);
 	XFreeGC(fl_get_display(), gc);
-	return *this;
 }
 
 
-Painter & XPainter::text(int x, int y,
+void XPainter::text(int x, int y,
 	string const & s, LyXFont const & f)
 {
 	return text(x, y, s.data(), s.length(), f);
 }
 
 
-Painter & XPainter::text(int x, int y,
+void XPainter::text(int x, int y,
 	char c, LyXFont const & f)
 {
 	char s[2] = { c, '\0' };
@@ -178,7 +168,7 @@ Painter & XPainter::text(int x, int y,
 }
 
 
-Painter & XPainter::text(int x, int y,
+void XPainter::text(int x, int y,
 	char const * s, size_t ls,
 	LyXFont const & f)
 {
@@ -199,7 +189,7 @@ Painter & XPainter::text(int x, int y,
 			xs[i].byte2 = c & 0xff;
 		}
 		text(x, y, xs.get(), ls, font);
-		return *this;
+		return;
 	}
 
 	GC gc = lyxColorHandler->getGCForeground(f.realColor());
@@ -229,12 +219,10 @@ Painter & XPainter::text(int x, int y,
 	if (f.underbar() == LyXFont::ON) {
 		underline(f, x, y, font_metrics::width(s, ls, f));
 	}
-
-	return *this;
 }
 
 
-Painter & XPainter::text(int x, int y,
+void XPainter::text(int x, int y,
 	XChar2b const * s, size_t ls,
 	LyXFont const & f)
 {
@@ -271,6 +259,4 @@ Painter & XPainter::text(int x, int y,
 	if (f.underbar() == LyXFont::ON) {
 		underline(f, x, y, xfont_metrics::width(s, ls, f));
 	}
-
-	return *this;
 }
Index: frontends/xforms/XPainter.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/XPainter.h,v
retrieving revision 1.14
diff -u -p -u -r1.14 XPainter.h
--- frontends/xforms/XPainter.h	6 Oct 2003 15:42:57 -0000	1.14
+++ frontends/xforms/XPainter.h	7 Apr 2004 20:16:22 -0000
@@ -34,7 +34,7 @@ public:
 	virtual int paperHeight() const;
 
 	/// draw a line from point to point
-	virtual Painter & line(
+	virtual void line(
 		int x1, int y1,
 		int x2, int y2,
 		LColor_color,
@@ -47,7 +47,7 @@ public:
 	 * @param yp array of points' y co-ords
 	 * @param np size of the points array
 	 */
-	virtual Painter & lines(
+	virtual void lines(
 		int const * xp,
 		int const * yp,
 		int np,
@@ -56,7 +56,7 @@ public:
 		line_width = line_thin);
 
 	/// draw a rectangle
-	virtual Painter & rectangle(
+	virtual void rectangle(
 		int x, int y,
 		int w, int h,
 		LColor_color,
@@ -64,52 +64,52 @@ public:
 		line_width = line_thin);
 
 	/// draw a filled rectangle
-	virtual Painter & fillRectangle(
+	virtual void fillRectangle(
 		int x, int y,
 		int w, int h,
 		LColor_color);
 
 	/// draw a filled (irregular) polygon
-	virtual Painter & fillPolygon(
+	virtual void fillPolygon(
 		int const * xp,
 		int const * yp,
 		int np,
 		LColor_color);
 
 	/// draw an arc
-	virtual Painter & arc(
+	virtual void arc(
 		int x, int y,
 		unsigned int w, unsigned int h,
 		int a1, int a2,
 		LColor_color);
 
 	/// draw a pixel
-	virtual Painter & point(
+	virtual void point(
 		int x, int y,
 		LColor_color);
 
 	/// draw an image from the image cache
-	virtual Painter & image(int x, int y,
+	virtual void image(int x, int y,
 		int w, int h,
 		lyx::graphics::Image const & image);
 
 	/// draw a string at position x, y (y is the baseline)
-	virtual Painter & text(int x, int y,
+	virtual void text(int x, int y,
 		std::string const & str, LyXFont const & f);
 
 	/** Draw a string at position x, y (y is the baseline)
 	 *  This is just for fast drawing
 	 */
-	virtual Painter & text(int x, int y,
+	virtual void text(int x, int y,
 		char const * str, size_t l,
 		LyXFont const & f);
 
 	/// draw a char at position x, y (y is the baseline)
-	virtual Painter & text(int x, int y,
+	virtual void text(int x, int y,
 		char c, LyXFont const & f);
 
 	/// draw a wide string at position x, y
-	Painter & text(int x, int y,
+	void text(int x, int y,
 		XChar2b const * str, size_t l,
 		LyXFont const & f);
 
Index: mathed/formulamacro.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/formulamacro.C,v
retrieving revision 1.154
diff -u -p -u -r1.154 formulamacro.C
--- mathed/formulamacro.C	6 Apr 2004 19:25:38 -0000	1.154
+++ mathed/formulamacro.C	7 Apr 2004 20:16:22 -0000
@@ -144,7 +144,7 @@ void InsetFormulaMacro::draw(PainterInfo
 	LyXFont font = p.base.font;
 	font.setColor(LColor::math);
 
-	PainterInfo pi(p.base.bv);
+	PainterInfo pi(p.base.bv, p.pain);
 	pi.base.style = LM_ST_TEXT;
 	pi.base.font  = font;
 

Reply via email to