r16738 by jghali - better behavior of text cursor for rotated text frames

scribus-commit scribus-commit at lists.scribus.net
Sun Jul 31 00:32:16 UTC 2011


Author: jghali
Date: Sun Jul 31 00:32:16 2011
New Revision: 16738

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=16738
Log:
better behavior of text cursor for rotated text frames

Modified:
    trunk/Scribus/scribus/scribusview.cpp

Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16738&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp (original)
+++ trunk/Scribus/scribus/scribusview.cpp Sun Jul 31 00:32:16 2011
@@ -1587,18 +1587,19 @@
 			// #9592 : layout must be valid here, or screenToPosition() may crash
 			if (currItem->invalid)
 				currItem->layout();
-			if(currItem->reversed())
-			{ //handle Right to Left writing
-				FPoint point(currItem->width()-(pf.x() - currItem->xPos()), pf.y() - currItem->yPos());
-				currItem->itemText.setCursorPosition( currItem->itemText.length() == 0 ? 0 :
-					currItem->itemText.screenToPosition(point) );
+
+			QTransform transform = currItem->getTransform();
+			FPoint point(pf.x() - currItem->xPos(), pf.y() - currItem->yPos());
+			if (transform.isInvertible() && currItem->itemText.length() > 0)
+			{
+				double tx = 0, ty = 0;
+				transform.inverted().map(pf.x(), pf.y(), &tx, &ty);
+				point.setXY(tx, ty);
 			}
-			else
-			{
-				FPoint point(pf.x() - currItem->xPos(), pf.y() - currItem->yPos());
-				currItem->itemText.setCursorPosition( currItem->itemText.length() == 0 ? 0 :
-					currItem->itemText.screenToPosition(point) );
-			}
+			if (currItem->reversed())
+				point.setX(currItem->width() - point.x());
+			currItem->itemText.setCursorPosition( currItem->itemText.length() == 0 ? 0 :
+				currItem->itemText.screenToPosition(point) );
 
 			if (currItem->itemText.length() > 0)
 			{




More information about the scribus-commit mailing list