r14869 by fschmid - Allow image rotation in the frame with the mouse (use the SHIFT key for that)

scribus-commit scribus-commit at lists.scribus.net
Thu Mar 11 13:30:19 CET 2010


Revision: 14869
Author: fschmid
Date: 2010-03-11T12:23:57.010762Z
Commit message: Allow image rotation in the frame with the mouse (use the SHIFT key for that)

Changeset: 
M  /trunk/Scribus/scribus/canvasmode_edit.cpp

Diffs:
Index: scribus/canvasmode_edit.cpp
===================================================================
--- scribus/canvasmode_edit.cpp	(revision 14868)
+++ scribus/canvasmode_edit.cpp	(revision 14869)
@@ -406,15 +406,40 @@
 		{
 			if (currItem->asImageFrame())
 			{
-				QTransform ro;
-				ro.rotate(-currItem->rotation());
-				QPointF rota = ro.map(QPointF(newX-Mxp,newY-Myp));
-				currItem->moveImageInFrame(rota.x()/currItem->imageXScale(), rota.y()/currItem->imageYScale());
-		//		m_view->updateContents(currItem->getRedrawBounding(m_canvas->scale()));
+				if (m->modifiers() & Qt::ShiftModifier)
+				{
+					qApp->changeOverrideCursor(QCursor(loadIcon("Rotieren2.png")));
+					QTransform p;
+					p.translate(currItem->xPos(), currItem->yPos());
+					p.rotate(currItem->rotation());
+					if (currItem->imageFlippedH())
+					{
+						p.translate(currItem->width(), 0);
+						p.scale(-1, 1);
+					}
+					if (currItem->imageFlippedV())
+					{
+						p.translate(0, currItem->height());
+						p.scale(1, -1);
+					}
+					p.translate(currItem->imageXOffset()*currItem->imageXScale(), currItem->imageYOffset()*currItem->imageYScale());
+					QPointF rotP = p.map(QPointF(0.0, 0.0));
+					double itemRotation = xy2Deg(mousePointDoc.x() - rotP.x(), mousePointDoc.y() - rotP.y());
+					currItem->setImageRotation(itemRotation);
+					m_canvas->displayRotHUD(m->globalPos(), itemRotation);
+				}
+				else
+				{
+					qApp->changeOverrideCursor(QCursor(loadIcon("HandC.xpm")));
+					QTransform ro;
+					ro.rotate(-currItem->rotation());
+					QPointF rota = ro.map(QPointF(newX-Mxp,newY-Myp));
+					currItem->moveImageInFrame(rota.x()/currItem->imageXScale(), rota.y()/currItem->imageYScale());
+					m_canvas->displayXYHUD(m->globalPos(), currItem->imageXOffset() * currItem->imageXScale(), currItem->imageYOffset() * currItem->imageYScale());
+				}
 				currItem->update();
 				Mxp = newX;
 				Myp = newY;
-				m_canvas->displayXYHUD(m->globalPos(), currItem->imageXOffset() * currItem->imageXScale(), currItem->imageYOffset() * currItem->imageYScale());
 			}
 			if (currItem->asTextFrame())
 			{
@@ -473,7 +498,12 @@
 						if (currItem->asTextFrame())
 							qApp->changeOverrideCursor(QCursor(Qt::IBeamCursor));
 						if (currItem->asImageFrame())
-							qApp->changeOverrideCursor(QCursor(loadIcon("HandC.xpm")));
+						{
+							if (m->modifiers() & Qt::ShiftModifier)
+								qApp->changeOverrideCursor(QCursor(loadIcon("Rotieren2.png")));
+							else
+								qApp->changeOverrideCursor(QCursor(loadIcon("HandC.xpm")));
+						}
 					}
 				}
 				else
@@ -644,8 +674,7 @@
 				}
 			}
 		}
-		else if (!currItem->asImageFrame() || 
-				 m_canvas->frameHitTest(QPointF(mousePointDoc.x(),mousePointDoc.y()), currItem) < 0)
+		else if (!currItem->asImageFrame() || m_canvas->frameHitTest(QPointF(mousePointDoc.x(),mousePointDoc.y()), currItem) < 0)
 		{
 			m_view->Deselect(true);
 			if (SeleItem(m))




More information about the scribus-commit mailing list