Switch to absolute coordinates in LyXText::setCursorFromCoords

actually cures a bit of problems as we assumed that this was done already in
some places.

Alfredo
? ChangeLog-old
? PosIterator.C-save
? PosIterator.h-save
? bfri.C
? textcursor.C-save
? textcursor.h-save
? insets/insetcollapsable-save.C
? insets/insettext-save.C
Index: text2.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text2.C,v
retrieving revision 1.548
diff -u -p -u -r1.548 text2.C
--- text2.C	16 Feb 2004 11:58:42 -0000	1.548
+++ text2.C	16 Feb 2004 12:36:44 -0000
@@ -1293,9 +1293,11 @@ pos_type LyXText::getColumnNearX(Paragra
 }
 
 
-// x,y are coordinates relative to this LyXText
+// x,y are absolute coordinates
 void LyXText::setCursorFromCoordinates(LCursor & cur, int x, int y)
 {
+	x -= xo_;
+	y -= yo_;
 	CursorSlice old_cursor = cur.current();
 	ParagraphList::iterator pit;
 	Row const & row = *getRowNearY(y, pit);
@@ -1468,7 +1470,7 @@ void LyXText::cursorUp(LCursor & cur, bo
 	Row const & row = cur.textRow();
 	int x = cur.x_target();
 	int y = cursorY(cur.current()) - row.baseline() - 1;
-	setCursorFromCoordinates(cur, x - xo_, y - yo_);
+	setCursorFromCoordinates(cur, x, y);
 
 	if (!selecting) {
 		InsetBase * inset_hit = checkInsetHit(cur.x_target(), y);
@@ -1483,7 +1485,7 @@ void LyXText::cursorDown(LCursor & cur, 
 	Row const & row = cur.textRow();
 	int x = cur.x_target();
 	int y = cursorY(cur.current()) - row.baseline() + row.height() + 1;
-	setCursorFromCoordinates(cur, x - xo_, y - yo_);
+	setCursorFromCoordinates(cur, x, y);
 
 	if (!selecting) {
 		InsetBase * inset_hit = checkInsetHit(cur.x_target(), y);
Index: text3.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text3.C,v
retrieving revision 1.226
diff -u -p -u -r1.226 text3.C
--- text3.C	16 Feb 2004 11:58:45 -0000	1.226
+++ text3.C	16 Feb 2004 12:36:46 -0000
@@ -1147,7 +1147,7 @@ DispatchResult LyXText::dispatch(LCursor
 		// Clear the selection
 		cur.clearSelection();
 
-		setCursorFromCoordinates(cur, cmd.x - xo_, cmd.y - yo_);
+		setCursorFromCoordinates(cur, cmd.x, cmd.y);
 		cur.resetAnchor();
 		finishUndo();
 		cur.x_target() = cursorX(cur.current());
Index: insets/insetcollapsable.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetcollapsable.C,v
retrieving revision 1.239
diff -u -p -u -r1.239 insetcollapsable.C
--- insets/insetcollapsable.C	16 Feb 2004 11:58:46 -0000	1.239
+++ insets/insetcollapsable.C	16 Feb 2004 12:36:49 -0000
@@ -311,11 +311,6 @@ InsetBase * InsetCollapsable::editXY(LCu
 //inset yet. I personally think it's ok. (ab)
 		return this;
 	}
-
-//if (y <= yo() + inset.ascent() + button_dim.y2)
-//	y = yo();
-//else
-//	y += inset.ascent() - height_collapsed();
 	return inset.editXY(cur, x, y);
 }
 

Reply via email to