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

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


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

Changeset: 
M  /trunk/Scribus/scribus/canvasmode.cpp
M  /trunk/Scribus/scribus/scribusdoc.cpp

Diffs:
Index: scribus/canvasmode.cpp
===================================================================
--- scribus/canvasmode.cpp	(revision 15197)
+++ scribus/canvasmode.cpp	(revision 15198)
@@ -1000,21 +1000,18 @@
 							m_view->TransformPoly(10, 0, resizeBy/unitGetRatioFromIndex(m_doc->unitIndex()));
 						else
 						{
-							int oldRotMode = m_doc->RotMode();
-							m_doc->RotMode(0);
 							if (resizingsmaller)
 							{
 								currItem->Sizing = false;
-								m_doc->SizeItem(currItem->width()+resizeBy, currItem->height(), currItem->ItemNr, true);
+								m_doc->SizeItem(currItem->width()+resizeBy, currItem->height(), currItem->ItemNr);
 							}
 							else
 							{
 								m_doc->MoveItem(-resizeBy, 0, currItem, false);
 								currItem->moveImageXYOffsetBy(resizeBy/currItem->imageXScale(), 0);
 								currItem->Sizing = false;
-								m_doc->SizeItem(currItem->width()+resizeBy, currItem->height(), currItem->ItemNr, true);
+								m_doc->SizeItem(currItem->width()+resizeBy, currItem->height(), currItem->ItemNr);
 							}
-							m_doc->RotMode(oldRotMode);
 						}
 					}
 					currItem->update();
@@ -1070,21 +1067,18 @@
 							m_view->TransformPoly(11, 0, resizeBy/unitGetRatioFromIndex(m_doc->unitIndex()));
 						else
 						{
-							int oldRotMode = m_doc->RotMode();
-							m_doc->RotMode(0);
 							if (resizingsmaller)
 							{
 								m_doc->MoveItem(-resizeBy, 0, currItem, false);
 								currItem->moveImageXYOffsetBy(resizeBy/currItem->imageXScale(), 0);
 								currItem->Sizing = false;
-								m_doc->SizeItem(currItem->width()+resizeBy, currItem->height(), currItem->ItemNr, true);
+								m_doc->SizeItem(currItem->width()+resizeBy, currItem->height(), currItem->ItemNr);
 							}
 							else
 							{
 								currItem->Sizing = false;
-								m_doc->SizeItem(currItem->width()+resizeBy, currItem->height(), currItem->ItemNr, true);
-							}
-							m_doc->RotMode(oldRotMode);
+								m_doc->SizeItem(currItem->width()+resizeBy, currItem->height(), currItem->ItemNr);
+							}
 						}
 					}
 					currItem->update();
@@ -1140,21 +1134,18 @@
 							m_view->TransformPoly(12, 0, resizeBy/unitGetRatioFromIndex(m_doc->unitIndex()));
 						else
 						{
-							int oldRotMode = m_doc->RotMode();
-							m_doc->RotMode(0);
 							if (resizingsmaller)
 							{
 								currItem->Sizing = false;
-								m_doc->SizeItem(currItem->width(), currItem->height()+resizeBy, currItem->ItemNr, true);
+								m_doc->SizeItem(currItem->width(), currItem->height()+resizeBy, currItem->ItemNr);
 							}
 							else
 							{
 								m_doc->MoveItem(0, -resizeBy, currItem, false);
 								currItem->moveImageXYOffsetBy(0, resizeBy/currItem->imageYScale());
 								currItem->Sizing = false;
-								m_doc->SizeItem(currItem->width(), currItem->height()+resizeBy, currItem->ItemNr, true);
-							}
-							m_doc->RotMode(oldRotMode);
+								m_doc->SizeItem(currItem->width(), currItem->height()+resizeBy, currItem->ItemNr);
+							}
 						}
 					}
 					currItem->update();
@@ -1210,21 +1201,18 @@
 							m_view->TransformPoly(13, 0, resizeBy/unitGetRatioFromIndex(m_doc->unitIndex()));
 						else
 						{
-							int oldRotMode = m_doc->RotMode();
-							m_doc->RotMode(0);
 							if (resizingsmaller)
 							{
 								m_doc->MoveItem(0, -resizeBy, currItem, false);
 								currItem->moveImageXYOffsetBy(0, resizeBy/currItem->imageYScale());
 								currItem->Sizing = false;
-								m_doc->SizeItem(currItem->width(), currItem->height()+resizeBy, currItem->ItemNr, true);
+								m_doc->SizeItem(currItem->width(), currItem->height()+resizeBy, currItem->ItemNr);
 							}
 							else
 							{
 								currItem->Sizing = false;
-								m_doc->SizeItem(currItem->width(), currItem->height()+resizeBy, currItem->ItemNr, true);
-							}
-							m_doc->RotMode(oldRotMode);
+								m_doc->SizeItem(currItem->width(), currItem->height()+resizeBy, currItem->ItemNr);
+							}
 						}
 					}
 					currItem->update();
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp	(revision 15197)
+++ scribus/scribusdoc.cpp	(revision 15198)
@@ -10676,8 +10676,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