r17056 by fschmid - Better selection drawing and enabled setting of the selection frame colour in the application preferences.

scribus-commit scribus-commit at lists.scribus.net
Sat Dec 3 12:11:02 UTC 2011


Author: fschmid
Date: Sat Dec  3 12:11:02 2011
New Revision: 17056

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17056
Log:
Better selection drawing and enabled setting of the selection frame colour in the application preferences.

Modified:
    trunk/Scribus/scribus/canvasmode.cpp

Modified: trunk/Scribus/scribus/canvasmode.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17056&path=/trunk/Scribus/scribus/canvasmode.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode.cpp (original)
+++ trunk/Scribus/scribus/canvasmode.cpp Sat Dec  3 12:11:02 2011
@@ -237,7 +237,7 @@
 	psx->setClipping(true);
 	psx->setClipRegion(QRegion ( m_canvas->exposedRect() ) );
 	const double markWidth = 4.0 / m_canvas->scale();
-	const double halfMarkWidth = 2.0 / m_canvas->scale();
+	QRectF handleRect = QRectF(0, 0, markWidth, markWidth);
 	if (m_doc->m_Selection->isMultipleSelection())
 	{
 		PageItem *curItem(0);
@@ -268,16 +268,24 @@
 		psx->drawRect(QRectF(x, y, w, h));
 		if(drawHandles)
 		{
-			psx->setBrush(Qt::green);
+			psx->setBrush(Qt::white);
 			psx->setPen(m_pen["handle"]);
-			psx->drawRect(QRectF(x+w-markWidth, y+h-markWidth, markWidth, markWidth));
-			psx->drawRect(QRectF(x+w/2.0 - halfMarkWidth, y+h-markWidth, markWidth, markWidth));
-			psx->drawRect(QRectF(x+w/2.0 - halfMarkWidth, y, markWidth, markWidth));
-			psx->drawRect(QRectF(x+w-markWidth, y+h/2.0 - halfMarkWidth, markWidth, markWidth));
-			psx->drawRect(QRectF(x+w-markWidth, y, markWidth, markWidth));
-			psx->drawRect(QRectF(x, y, markWidth, markWidth));
-			psx->drawRect(QRectF(x, y+h/2.0 - halfMarkWidth, markWidth, markWidth));
-			psx->drawRect(QRectF(x, y+h-markWidth, markWidth, markWidth));
+			handleRect.moveCenter(QPointF(x, y));
+			psx->drawRect(handleRect);
+			handleRect.moveCenter(QPointF(x+w/2.0, y));
+			psx->drawRect(handleRect);
+			handleRect.moveCenter(QPointF(x+w, y));
+			psx->drawRect(handleRect);
+			handleRect.moveCenter(QPointF(x+w, y+h/2.0));
+			psx->drawRect(handleRect);
+			handleRect.moveCenter(QPointF(x+w, y+h));
+			psx->drawRect(handleRect);
+			handleRect.moveCenter(QPointF(x+w/2.0, y+h));
+			psx->drawRect(handleRect);
+			handleRect.moveCenter(QPointF(x, y+h));
+			psx->drawRect(handleRect);
+			handleRect.moveCenter(QPointF(x, y+h/2.0));
+			psx->drawRect(handleRect);
 		}
 //		tg=tt.elapsed();
 		psx->restore();
@@ -392,23 +400,33 @@
 					if(currItem->asLine())
 					{
 						psx->setRenderHint(QPainter::Antialiasing);
-						psx->setBrush(Qt::green);
+						psx->setBrush(Qt::white);
 						psx->setPen(m_pen["handle"]);
-						psx->drawEllipse(QRectF(x+w-markWidth, y+h/2.0-markWidth, 2* markWidth,2* markWidth));
-						psx->drawEllipse(QRectF(x-markWidth, y+h/2.0-markWidth, 2* markWidth, 2* markWidth));
+						handleRect.moveCenter(QPointF(x, y+h/2.0));
+						psx->drawRect(handleRect);
+						handleRect.moveCenter(QPointF(x+w, y+h/2.0));
+						psx->drawRect(handleRect);
 					}
 					else
 					{
-						psx->setBrush(Qt::green);
+						psx->setBrush(Qt::white);
 						psx->setPen(m_pen["handle"]);
-						psx->drawRect(QRectF(x+w-markWidth, y+h-markWidth, markWidth, markWidth));
-						psx->drawRect(QRectF(x+w/2.0 - halfMarkWidth, y+h-markWidth, markWidth, markWidth));
-						psx->drawRect(QRectF(x+w/2.0 - halfMarkWidth, y, markWidth, markWidth));
-						psx->drawRect(QRectF(x+w-markWidth, y+h/2.0 - halfMarkWidth, markWidth, markWidth));
-						psx->drawRect(QRectF(x+w-markWidth, y, markWidth, markWidth));
-						psx->drawRect(QRectF(x, y, markWidth, markWidth));
-						psx->drawRect(QRectF(x, y+h/2.0 - halfMarkWidth, markWidth, markWidth));
-						psx->drawRect(QRectF(x, y+h-markWidth, markWidth, markWidth));
+						handleRect.moveCenter(QPointF(x, y));
+						psx->drawRect(handleRect);
+						handleRect.moveCenter(QPointF(x+w/2.0, y));
+						psx->drawRect(handleRect);
+						handleRect.moveCenter(QPointF(x+w, y));
+						psx->drawRect(handleRect);
+						handleRect.moveCenter(QPointF(x+w, y+h/2.0));
+						psx->drawRect(handleRect);
+						handleRect.moveCenter(QPointF(x+w, y+h));
+						psx->drawRect(handleRect);
+						handleRect.moveCenter(QPointF(x+w/2.0, y+h));
+						psx->drawRect(handleRect);
+						handleRect.moveCenter(QPointF(x, y+h));
+						psx->drawRect(handleRect);
+						handleRect.moveCenter(QPointF(x, y+h/2.0));
+						psx->drawRect(handleRect);
 					}
 				}
 				if (currItem->isWelded())




More information about the scribus-commit mailing list