r15197 by jghali - stop misusing SizeItem() fromMP argument when resizing with arrows

scribus-commit scribus-commit at lists.scribus.net
Wed Jun 16 09:40:28 CEST 2010


Revision: 15197
Author: jghali
Date: 2010-06-16T07:31:24.181882Z
Commit message: stop misusing SizeItem() fromMP argument when resizing with arrows

Changeset: 
M  /branches/Version135/Scribus/scribus/scribus.cpp
M  /branches/Version135/Scribus/scribus/scribusdoc.cpp

Diffs:
Index: scribus/scribus.cpp
===================================================================
--- scribus/scribus.cpp	(revision 15196)
+++ scribus/scribus.cpp	(revision 15197)
@@ -1595,21 +1595,18 @@
 								view->TransformPoly(10, 0, resizeBy/unitGetRatioFromIndex(doc->unitIndex()));
 							else
 							{
-								int oldRotMode = doc->RotMode;
-								doc->RotMode   = 0; 
 								if (resizingsmaller)
 								{
 									currItem->Sizing = false;
-									doc->SizeItem(currItem->width()+resizeBy, currItem->height(), currItem->ItemNr, true);
+									doc->SizeItem(currItem->width()+resizeBy, currItem->height(), currItem->ItemNr);
 								}
 								else
 								{
 									doc->MoveItem(-resizeBy, 0, currItem, false);
 									currItem->moveImageXYOffsetBy(resizeBy/currItem->imageXScale(), 0);
 									currItem->Sizing = false;
-									doc->SizeItem(currItem->width()+resizeBy, currItem->height(), currItem->ItemNr, true);
+									doc->SizeItem(currItem->width()+resizeBy, currItem->height(), currItem->ItemNr);
 								}
-								doc->RotMode = oldRotMode;
  							}
 						}
 						currItem->update();
@@ -1665,21 +1662,18 @@
 								view->TransformPoly(11, 0, resizeBy/unitGetRatioFromIndex(doc->unitIndex()));
 							else
 							{
-								int oldRotMode = doc->RotMode;
-								doc->RotMode   = 0; 
 								if (resizingsmaller)
 								{
 									doc->MoveItem(-resizeBy, 0, currItem, false);
 									currItem->moveImageXYOffsetBy(resizeBy/currItem->imageXScale(), 0);
 									currItem->Sizing = false;
-									doc->SizeItem(currItem->width()+resizeBy, currItem->height(), currItem->ItemNr, true);
+									doc->SizeItem(currItem->width()+resizeBy, currItem->height(), currItem->ItemNr);
 								}
 								else
 								{
 									currItem->Sizing = false;
-									doc->SizeItem(currItem->width()+resizeBy, currItem->height(), currItem->ItemNr, true);
+									doc->SizeItem(currItem->width()+resizeBy, currItem->height(), currItem->ItemNr);
 								}
-								doc->RotMode = oldRotMode;
 							}
 						}
 						currItem->update();
@@ -1735,21 +1729,18 @@
 								view->TransformPoly(12, 0, resizeBy/unitGetRatioFromIndex(doc->unitIndex()));
 							else
 							{
-								int oldRotMode = doc->RotMode;
-								doc->RotMode   = 0; 
 								if (resizingsmaller)
 								{
 									currItem->Sizing = false;
-									doc->SizeItem(currItem->width(), currItem->height()+resizeBy, currItem->ItemNr, true);
+									doc->SizeItem(currItem->width(), currItem->height()+resizeBy, currItem->ItemNr);
 								}
 								else
 								{
 									doc->MoveItem(0, -resizeBy, currItem, false);
 									currItem->moveImageXYOffsetBy(0, resizeBy/currItem->imageYScale());
 									currItem->Sizing = false;
-									doc->SizeItem(currItem->width(), currItem->height()+resizeBy, currItem->ItemNr, true);
+									doc->SizeItem(currItem->width(), currItem->height()+resizeBy, currItem->ItemNr);
 								}
-								doc->RotMode = oldRotMode;
 							}
 						}
 						currItem->update();
@@ -1805,21 +1796,18 @@
 								view->TransformPoly(13, 0, resizeBy/unitGetRatioFromIndex(doc->unitIndex()));
 							else
 							{
-								int oldRotMode = doc->RotMode;
-								doc->RotMode   = 0; 
 								if (resizingsmaller)
 								{
 									doc->MoveItem(0, -resizeBy, currItem, false);
 									currItem->moveImageXYOffsetBy(0, resizeBy/currItem->imageYScale());
 									currItem->Sizing = false;
-									doc->SizeItem(currItem->width(), currItem->height()+resizeBy, currItem->ItemNr, true);
+									doc->SizeItem(currItem->width(), currItem->height()+resizeBy, currItem->ItemNr);
 								}
 								else
 								{
 									currItem->Sizing = false;
-									doc->SizeItem(currItem->width(), currItem->height()+resizeBy, currItem->ItemNr, true);
+									doc->SizeItem(currItem->width(), currItem->height()+resizeBy, currItem->ItemNr);
 								}
-								doc->RotMode = oldRotMode;
 							}
 						}
 						currItem->update();
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp	(revision 15196)
+++ scribus/scribusdoc.cpp	(revision 15197)
@@ -9577,8 +9577,12 @@
 	{
 		if (!fromMP)
 		{
-			currItem->setRotation(atan2(currItem->height(),currItem->width())*(180.0/M_PI));
-			currItem->setWidthHeight(sqrt(pow(currItem->width(),2)+pow(currItem->height(),2)), 1.0);
+			FPoint g(currItem->xPos(), currItem->yPos());
+			FPoint t(currItem->width(), 0, currItem->xPos(), currItem->yPos(), currItem->rotation(), 1, 1);
+			t -= g;
+			currItem->setRotation( atan2(t.y(), t.x()) * (180.0/M_PI));
+			currItem->setWidthHeight( sqrt(pow(t.x(), 2) + pow(t.y(), 2)), 1.0);
+			//currItem->setXYPos(currItem->xPos(), currItem->yPos());
 		}
 		currItem->Clip.setPoints(4, -ph,-ph, static_cast<int>(currItem->width()+ph),-ph,
 		                  static_cast<int>(currItem->width()+ph),static_cast<int>(currItem->height()+ph),




More information about the scribus-commit mailing list