r16291 by fschmid - Allow normal resizing of Arc items again.

scribus-commit scribus-commit at lists.scribus.net
Sat Jan 22 10:22:06 CET 2011


Author: fschmid
Date: Sat Jan 22 09:22:05 2011
New Revision: 16291

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16291
Log:
Allow normal resizing of Arc items again.

Modified:
    trunk/Scribus/scribus/canvasgesture_resize.cpp
    trunk/Scribus/scribus/pageitem_arc.cpp
    trunk/Scribus/scribus/scribusdoc.cpp
    trunk/Scribus/scribus/ui/propertiespalette.cpp

Modified: trunk/Scribus/scribus/canvasgesture_resize.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16291&path=/trunk/Scribus/scribus/canvasgesture_resize.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasgesture_resize.cpp (original)
+++ trunk/Scribus/scribus/canvasgesture_resize.cpp Sat Jan 22 09:22:05 2011
@@ -29,6 +29,8 @@
 #include "scribusview.h"
 #include "selection.h"
 #include "undomanager.h"
+#include "pageitem_arc.h"
+#include "util_math.h"
 
 ResizeGesture::ResizeGesture (CanvasMode* parent) : CanvasGesture(parent)
 {
@@ -196,6 +198,18 @@
 //		qDebug() << "ResizeGesture::doResize: begin transaction" << m_transactionStarted;
 	}
 	QRectF newBounds = m_bounds.normalized();
+	double dw = (newBounds.width() - m_extraWidth) - currItem->width();
+	double dh = (newBounds.height() - m_extraHeight) - currItem->height();
+	double dsch = 1.0;
+	double dscw = 1.0;
+	if (currItem->isArc())
+	{
+		PageItem_Arc* item = currItem->asArc();
+		if (currItem->height() != 0.0)
+			dsch = item->arcHeight / currItem->height();
+		if (currItem->width() != 0.0)
+			dscw = item->arcWidth / currItem->width();
+	}
 	if (m_doc->m_Selection->isMultipleSelection())
 	{
 		int RotModeBack = m_doc->RotMode();
@@ -293,10 +307,20 @@
 		currItem->setXYPos(newBounds.x() + m_extraX, newBounds.y() + m_extraY);
 		currItem->setWidth(newBounds.width() - m_extraWidth);
 		currItem->setHeight(newBounds.height() - m_extraHeight);
+		currItem->updateClip();
+		if (currItem->isArc())
+		{
+			PageItem_Arc* item = currItem->asArc();
+			item->arcWidth += dw * dscw;
+			item->arcHeight += dh * dsch;
+			item->recalcPath();
+			FPoint tp2(getMinClipF(&currItem->PoLine));
+			currItem->PoLine.translate(-tp2.x(), -tp2.y());
+			m_doc->AdjustItemSize(currItem);
+		}
 		// rotation does not change
 	}
 	m_origBounds = m_bounds;
-	currItem->updateClip();
 }
 
 

Modified: trunk/Scribus/scribus/pageitem_arc.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16291&path=/trunk/Scribus/scribus/pageitem_arc.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_arc.cpp (original)
+++ trunk/Scribus/scribus/pageitem_arc.cpp Sat Jan 22 09:22:05 2011
@@ -60,7 +60,6 @@
 	path.closeSubpath();
 	PoLine.fromQPainterPath(path);
 	Clip = FlattenPath(PoLine, Segments);
-	setSizeLocked(true);
 }
 
 void PageItem_Arc::DrawObj_Item(ScPainter *p, QRectF /*e*/)

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16291&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Sat Jan 22 09:22:05 2011
@@ -5044,9 +5044,6 @@
 	// If converting a text frame to another object, drop links
 	if (oldItem->asTextFrame() && (newType != PageItem::TextFrame))
 		oldItem->dropLinks();
-	// if converting an arc to another object release size lock
-	if (oldItem->isArc() && (newType != PageItem::Arc))
-		newItem->setSizeLocked(false);
 	// If converting text to path, delete the bezier
 	if (newType == PageItem::PathText)
 	{
@@ -11635,6 +11632,18 @@
 		bb->OldH = bb->height();
 		bb->OldB2 = bb->width();
 		bb->OldH2 = bb->height();
+		double dw = (bb->width() * scx) - bb->width();
+		double dh = (bb->height() * scy) - bb->height();
+		double dsch = 1.0;
+		double dscw = 1.0;
+		if (bb->isArc())
+		{
+			PageItem_Arc* item = bb->asArc();
+			if (bb->height() != 0.0)
+				dsch = item->arcHeight / bb->height();
+			if (bb->width() != 0.0)
+				dscw = item->arcWidth / bb->width();
+		}
 		bb->Sizing = false;
 		double oldRot, oldLocalX, oldLocalY;
 		oldRot = bb->rotation();
@@ -11682,6 +11691,15 @@
 			bb->PoLine.map(ma2);
 			bb->setRotation(0.0);
 			bb->ClipEdited = true;
+			if (bb->isArc())
+			{
+				PageItem_Arc* item = bb->asArc();
+				item->arcWidth += dw * dscw;
+				item->arcHeight += dh * dsch;
+				item->recalcPath();
+				FPoint tp2(getMinClipF(&bb->PoLine));
+				bb->PoLine.translate(-tp2.x(), -tp2.y());
+			}
 			AdjustItemSize(bb, true, false);
 			QTransform ma3;
 			ma3.translate(gx, gy);

Modified: trunk/Scribus/scribus/ui/propertiespalette.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16291&path=/trunk/Scribus/scribus/ui/propertiespalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette.cpp (original)
+++ trunk/Scribus/scribus/ui/propertiespalette.cpp Sat Jan 22 09:22:05 2011
@@ -1971,7 +1971,6 @@
 	setXY(CurItem->xPos(), CurItem->yPos());
 	setLocked(i->locked());
 	setSizeLocked(i->sizeLocked());
-	NoResize->setEnabled(!CurItem->isArc());
 	setScaleAndOffset(i->imageXScale(), i->imageYScale(), i->imageXOffset(), i->imageYOffset());
 	setLineWidth(i->lineWidth());
 	setLIvalue(i->lineStyle(), i->lineEnd(), i->lineJoin());




More information about the scribus-commit mailing list