r16090 by jghali - #9585: horizontal ruler markers misplacement

scribus-commit scribus-commit at lists.scribus.net
Mon Dec 13 20:43:30 CET 2010


Author: jghali
Date: Mon Dec 13 19:43:29 2010
New Revision: 16090

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16090
Log:
#9585: horizontal ruler markers misplacement

Modified:
    trunk/Scribus/scribus/ui/hruler.cpp

Modified: trunk/Scribus/scribus/ui/hruler.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16090&path=/trunk/Scribus/scribus/ui/hruler.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/hruler.cpp (original)
+++ trunk/Scribus/scribus/ui/hruler.cpp Mon Dec 13 19:43:29 2010
@@ -116,12 +116,12 @@
 
 int Hruler::textPosToLocal(double x) const
 {
-	return qRound(textPosToCanvas(x) * Scaling);
+	return qRound(textPosToCanvas(x) * Scaling)- currView->contentsX();
 }
 
 double Hruler::localToTextPos(int x) const
 {
-	return x/Scaling - textBase();
+	return ((x + currView->contentsX()) / Scaling - textBase());
 }
 
 void Hruler::shift(double pos)
@@ -521,16 +521,18 @@
 
 	if (textEditMode)
 	{
-		p.eraseRect(QRect(QPoint(qRound((ItemPos+Extra)*sc), 1), QPoint(qRound((ItemEndPos-RExtra)*sc), 15)));
-		p.drawLine(qRound((ItemPos+Extra)*sc), 16, qRound((ItemEndPos-RExtra)*sc), 16);
+		int rectX1 = textPosToLocal(Extra);
+		int rectX2 = textPosToLocal(ItemEndPos-ItemPos-RExtra);
+		p.eraseRect(QRect(QPoint(rectX1, 1), QPoint(rectX2, 15)));
+		p.drawLine(rectX1, 16, rectX2, 16);
 		p.save();
 		p.setRenderHints(QPainter::Antialiasing, true);
 		if (Revers)
 		{
-			p.translate(qRound((ItemPos)*sc), 0);
+			p.translate( textPosToLocal(0), 0);
 			p.scale(-1, 1);
-			p.translate(qRound((ItemPos+Extra)*sc-(ItemEndPos-RExtra)*sc), 0);
-			p.translate(-qRound(ItemPos*sc), 0);
+			p.translate( textPosToLocal(Extra) - textPosToLocal(ItemEndPos-ItemPos-RExtra), 0);
+			p.translate(-textPosToLocal(0), 0);
 		}
 		for (int CurrCol = 0; CurrCol < Cols; ++CurrCol)
 		{




More information about the scribus-commit mailing list