r17392 by craig - #8562: Holding Control while creating items now produces squared frames again

scribus-commit scribus-commit at lists.scribus.net
Wed Mar 21 19:59:54 UTC 2012


Author: craig
Date: Wed Mar 21 19:59:53 2012
New Revision: 17392

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17392
Log:
#8562: Holding Control while creating items now produces squared frames again

Modified:
    trunk/Scribus/scribus/canvasmode_create.cpp

Modified: trunk/Scribus/scribus/canvasmode_create.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17392&path=/trunk/Scribus/scribus/canvasmode_create.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_create.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_create.cpp Wed Mar 21 19:59:53 2012
@@ -84,6 +84,15 @@
 	if (createObjectMode != modeDrawLine)
 	{
 		QRectF bounds = QRectF(topLeft, btRight).normalized();
+		//Lock Height to Width for Control Modifier for region drawing
+		if (modifiers==Qt::ControlModifier)
+		{
+			bounds.setHeight(bounds.width());
+			if (btRight.y()<topLeft.y())
+				bounds.moveBottom(topLeft.y());
+			if (btRight.x()<topLeft.x() && btRight.y()>topLeft.y())
+				bounds.moveTop(topLeft.y());
+		}
 		QRect localRect = m_canvas->canvasToLocal(bounds);
 		if (localRect.width() <= 0 || localRect.height() <= 0)
 			return;
@@ -595,11 +604,26 @@
 
 	wSize = canvasCurrCoord.x() - createObjectPos.x();
 	hSize = canvasCurrCoord.y() - createObjectPos.y();
+	//Lock Height to Width for Control Modifier for final item creation
+	if (modifiers == Qt::ControlModifier)
+		hSize=wSize;
 	PageItem *newObject = NULL, *currItem = NULL;
 	// FIXME for modeDrawLine
 	QRectF createObjectRect(createObjectPos.x(), createObjectPos.y(), wSize, hSize);
 	if (createObjectMode != modeDrawLine)
+	{
 		createObjectRect = createObjectRect.normalized();
+		if (modifiers==Qt::ControlModifier)
+		{
+			//bottom right and upper left are ok
+			//upper right
+			if (canvasCurrCoord.y() < createObjectPos.y() && createObjectPos.x()<canvasCurrCoord.x())
+				createObjectRect.translate(0.0, -createObjectRect.height());
+			//bottom left
+			if (canvasCurrCoord.x()<createObjectPos.x() && canvasCurrCoord.y()>createObjectPos.y())
+				createObjectRect.translate(0.0, createObjectRect.height());
+		}
+	}
 	double Rxp  = createObjectRect.x();
 	double Ryp  = createObjectRect.y();
 	double Rxpd = createObjectRect.width();




More information about the scribus-commit mailing list