r13799 by pierre - made ScribusDoc::rotMode private and setup standard getter/setter plus signal

scribus-commit scribus-commit at lists.scribus.net
Wed Jul 29 23:10:35 CEST 2009


Revision: 13799
Author: pierre
Date: 2009-07-29T21:05:32.999317Z
Commit message: made ScribusDoc::rotMode  private and setup standard getter/setter plus signal

Changeset: 
M  /trunk/Scribus/scribus/ui/propertiespalette.cpp
M  /trunk/Scribus/scribus/scribus.cpp
M  /trunk/Scribus/scribus/canvas.cpp
M  /trunk/Scribus/scribus/canvasgesture_resize.cpp
M  /trunk/Scribus/scribus/plugins/xfigimplugin/importxfig.cpp
M  /trunk/Scribus/scribus/canvasmode_rotate.cpp
M  /trunk/Scribus/scribus/scribusdoc.cpp
M  /trunk/Scribus/scribus/canvasmode_legacy.cpp
M  /trunk/Scribus/scribus/plugins/tools/transform/transformeffect.cpp
M  /trunk/Scribus/scribus/scribusdoc.h
M  /trunk/Scribus/scribus/plugins/tools/transform/transformdialog.cpp

Diffs:
Index: scribus/canvasmode_legacy.cpp
===================================================================
--- scribus/canvasmode_legacy.cpp	(revision 13798)
+++ scribus/canvasmode_legacy.cpp	(revision 13799)
@@ -1877,7 +1877,7 @@
 					m_view->undoManager->beginTransaction(currItem->getUName(), currItem->getUPixmap(),
 														  Um::Rotate, "", Um::IRotate);
 */
-				RotMode = m_doc->RotMode;
+				RotMode = m_doc->RotMode();
 				if (m_doc->m_Selection->isMultipleSelection())
 				{
 					double gx, gy, gh, gw;
@@ -1886,12 +1886,12 @@
 					m_doc->m_Selection->getGroupRect(&gxR, &gyR, &gwR, &ghR);
 					if (QRect(static_cast<int>(gx), static_cast<int>(gy), static_cast<int>(gw), static_cast<int>(gh)).intersects(mpo))
 					{
-						m_doc->RotMode = 2;
+						m_doc->RotMode ( 2 );
 						m_view->RCenter = FPoint(gxR+gwR/2.0, gyR+ghR/2.0);
 						if (QRect(static_cast<int>(gx+gw)-6, static_cast<int>(gy+gh)-6, 6, 6).intersects(mpo))
 						{
 							m_view->RCenter = FPoint(gxR, gyR);
-							m_doc->RotMode = 0;
+							m_doc->RotMode ( 0);
 						}
 					}
 					m_view->oldW = xy2Deg(mousePointDoc.x() - m_view->RCenter.x(), mousePointDoc.y() - m_view->RCenter.y());
@@ -1900,7 +1900,7 @@
 				{
 					QMatrix mat;
 					m_canvas->Transform(currItem, mat);
-					m_doc->RotMode = 2;
+					m_doc->RotMode ( 2);
 //					RCenter = FPoint(currItem->xPos()+currItem->width()/2, currItem->yPos()+currItem->height()/2, 0, 0, currItem->rotation(), 1, 1, true);
 					m_view->RCenter = FPoint(currItem->width()/2, currItem->height()/2, 0, 0, currItem->rotation(), 1, 1, false);
 //					if (!currItem->asLine())
@@ -1911,25 +1911,25 @@
 							{
 //								RCenter = FPoint(currItem->xPos()+currItem->width(), currItem->yPos()+currItem->height(), 0, 0, currItem->rotation(), 1, 1, true);
 								m_view->RCenter = FPoint(currItem->width(), currItem->height(), 0, 0, currItem->rotation(), 1, 1, false);
-								m_doc->RotMode = 4;
+								m_doc->RotMode ( 4 );
 							}
 							else if (mat.mapRect(QRect(static_cast<int>(currItem->width())-6, 0, 6, 6)).intersects(mpo))
 							{
 //								RCenter = FPoint(currItem->xPos(), currItem->yPos()+currItem->height(), 0, 0, currItem->rotation(), 1, 1, true);
 								m_view->RCenter = FPoint(0, currItem->height(), 0, 0, currItem->rotation(), 1, 1, false);
-								m_doc->RotMode = 3;
+								m_doc->RotMode ( 3 );
 							}
 							else if (mat.mapRect(QRect(static_cast<int>(currItem->width())-6, static_cast<int>(currItem->height())-6, 6, 6)).intersects(mpo))
 							{
 //								RCenter = FPoint(currItem->xPos(), currItem->yPos());
 								m_view->RCenter = FPoint(0, 0);
-								m_doc->RotMode = 0;
+								m_doc->RotMode ( 0 );
 							}
 							else if (mat.mapRect(QRect(0, static_cast<int>(currItem->height())-6, 6, 6)).intersects(mpo))
 							{
 //								RCenter = FPoint(currItem->xPos()+currItem->width(), currItem->yPos(), 0, 0, currItem->rotation(), 1, 1, true);
 								m_view->RCenter = FPoint(currItem->width(), 0, 0, 0, currItem->rotation(), 1, 1, false);
-								m_doc->RotMode = 1;
+								m_doc->RotMode ( 1 );
 							}
 						}
 //					}
@@ -2414,7 +2414,7 @@
 		if (m_doc->appMode != modeEdit)
 		{
 			if (m_doc->appMode == modeRotation)
-				m_doc->RotMode = RotMode;
+				m_doc->RotMode ( RotMode );
 			if (!PrefsManager::instance()->appPrefs.stickyTools)
 				m_view->requestMode(modeNormal);
 			else
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp	(revision 13798)
+++ scribus/scribusdoc.cpp	(revision 13799)
@@ -194,7 +194,7 @@
 	BookMarks(),
 	OldBM(false),
 	hasName(false),
-	RotMode(0),
+	rotMode(0),
 	AutoSave(prefsData.AutoSave),
 	AutoSaveTime(prefsData.AutoSaveTime),
 	autoSaveTimer(new QTimer(this)),
@@ -306,7 +306,7 @@
 	BookMarks(),
 	OldBM(false),
 	hasName(false),
-	RotMode(0),
+	rotMode(0),
 	AutoSave(prefsData.AutoSave),
 	AutoSaveTime(prefsData.AutoSaveTime),
 	autoSaveTimer(new QTimer(this)),
@@ -9598,7 +9598,7 @@
 		return;
 	QRectF oldR = currItem->getBoundingRect();
 //	if ((Doc->RotMode != 0) && (m_MouseButtonPressed))
-	if (RotMode != 0)
+	if (rotMode != 0)
 	{
 		QMatrix ma;
 		ma.translate(currItem->xPos(), currItem->yPos());
@@ -9607,7 +9607,7 @@
 		double ro = angle - currItem->rotation();
 		currItem->setRotation(angle);
 		FPoint n(0,0);
-		switch (RotMode)
+		switch (rotMode)
 		{
 		case 2:
 			ma.translate(currItem->width()/2.0, currItem->height()/2.0);
@@ -9688,17 +9688,17 @@
 	double dX = ma.m11() * (currItem->width() - newX) + ma.m21() * (currItem->height() - newY) + ma.dx();
 	double dY = ma.m22() * (currItem->height() - newY) + ma.m12() * (currItem->width() - newX) + ma.dy();
 	currItem->setWidthHeight(newX, newY, true);
-	if ((RotMode != 0) && (fromMP) && (!isLoading()) && (appMode == modeNormal))
+	if ((rotMode != 0) && (fromMP) && (!isLoading()) && (appMode == modeNormal))
 	{
 		double moveX=dX, moveY=dY;
-		if (RotMode==2)
+		if (rotMode==2)
 		{
 			moveX/=2.0;
 			moveY/=2.0;
 		}
-		else if (RotMode==3)
+		else if (rotMode==3)
 			moveX=0.0;
-		else if (RotMode==1)
+		else if (rotMode==1)
 			moveY=0.0;
 		MoveItem(moveX, moveY, currItem);
 	}
@@ -9996,8 +9996,8 @@
 	double gx, gy, gh, gw, x, y;
 	int aa;
 	double sc = 1; //FIXME:av Scale;
-	int drm = RotMode;
-	RotMode = 0;
+	int drm = rotMode;
+	rotMode = 0;
 	itemSelection->getGroupRect(&gx, &gy, &gw, &gh);
 //	gx -= minCanvasCoordinate.x();
 //	gy -= minCanvasCoordinate.y();
@@ -10103,10 +10103,10 @@
 	GroupOnPage(bb);
 	itemSelection->setGroupRect();
 	itemSelection->getGroupRect(&gx, &gy, &gw, &gh);
-	RotMode = drm;
-	if ((RotMode != 0) && (!isLoading()))
+	rotMode = drm;
+	if ((rotMode != 0) && (!isLoading()))
 	{
-		switch (RotMode)
+		switch (rotMode)
 		{
 		case 2:
 			moveGroup((origGW-gw) / 2.0, (origGH-gh) / 2.0, true);
@@ -11118,3 +11118,9 @@
 }
 
 
+void ScribusDoc::RotMode(const int& val)
+{
+	rotMode = val;
+	emit rotationMode(rotMode);
+}
+
Index: scribus/canvas.cpp
===================================================================
--- scribus/canvas.cpp	(revision 13798)
+++ scribus/canvas.cpp	(revision 13799)
@@ -2181,15 +2181,15 @@
 	ma.translate(gx, gy);
 	ma.rotate(r);
 	FPoint n;
-	if (m_doc->RotMode == 0)
+	if (m_doc->RotMode() == 0)
 		n = FPoint(0.0, 0.0);
-	else if (m_doc->RotMode == 1)
+	else if (m_doc->RotMode() == 1)
 		n = FPoint(gw, 0.0);
-	else if (m_doc->RotMode == 2)
+	else if (m_doc->RotMode() == 2)
 		n = FPoint(gw / 2.0, gh / 2.0);
-	else if (m_doc->RotMode == 3)
+	else if (m_doc->RotMode() == 3)
 		n = FPoint(0.0, gh);
-	else if (m_doc->RotMode == 4)
+	else if (m_doc->RotMode() == 4)
 		n = FPoint(gw, gh);
 	gx = ma.m11() * n.x() + ma.m21() * n.y() + ma.dx();
 	gy = ma.m22() * n.y() + ma.m12() * n.x() + ma.dy();
Index: scribus/scribusdoc.h
===================================================================
--- scribus/scribusdoc.h	(revision 13798)
+++ scribus/scribusdoc.h	(revision 13799)
@@ -893,6 +893,11 @@
 	//! \brief Returns a serializer for this document
 	Serializer *serializer();
 
+	//! \brief Get rotation mode
+	int RotMode() const {return rotMode;}
+	//! \brief Set rotation mode
+	void RotMode(const int& val);
+
 protected:
 	void addSymbols();
 	bool m_hasGUI;
@@ -903,6 +908,7 @@
 	int ActiveLayer;
 	int docUnitIndex;
 	double docUnitRatio;
+	int rotMode;
 	bool automaticTextFrames; // Flag for automatic Textframes
 	bool m_masterPageMode;
 	QMap<QString, double> m_constants;
@@ -1063,7 +1069,6 @@
 	QList<BookMa> BookMarks;
 	bool OldBM;
 	bool hasName;
-	int RotMode;
 	bool AutoSave;
 	int AutoSaveTime;
 	QTimer * const autoSaveTimer;
@@ -1130,6 +1135,9 @@
 	void signalRebuildOutLinePalette();
 	//! Temporary signal for SizeItem
 	void widthAndHeight(double, double);
+
+	//! Signal a change in rotation mode (aka basepoint)
+	void rotationMode(int);
 	
 public slots:
 	void itemSelection_ToggleLock();
Index: scribus/ui/propertiespalette.cpp
===================================================================
--- scribus/ui/propertiespalette.cpp	(revision 13798)
+++ scribus/ui/propertiespalette.cpp	(revision 13799)
@@ -3596,8 +3596,8 @@
 			double oldW = (CurItem->width() != 0.0) ? CurItem->width() : 1.0;
 			if (CurItem->isTableItem)
 			{
-				int rmo = doc->RotMode;
-				doc->RotMode = 0;
+				int rmo = doc->RotMode();
+				doc->RotMode ( 0 );
 				double dist = w - CurItem->width();
 				PageItem* bb2;
 				PageItem* bb = CurItem;
@@ -3623,7 +3623,7 @@
 					bb2 = bb2->RightLink;
 				}
 				doc->MoveSizeItem(FPoint(0, 0), FPoint(-dist, 0), bb->ItemNr, true);
-				doc->RotMode = rmo;
+				doc->RotMode ( rmo );
 				if (keepFrameWHRatioButton->isChecked())
 				{
 					keepFrameWHRatioButton->setChecked(false);
@@ -3704,8 +3704,8 @@
 				double oldH = (CurItem->height() != 0.0) ? CurItem->height() : 1.0;
 				if (CurItem->isTableItem)
 				{
-					int rmo = doc->RotMode;
-					doc->RotMode = 0;
+					int rmo = doc->RotMode();
+					doc->RotMode ( 0 );
 					double dist = h - CurItem->height();
 					PageItem* bb2;
 					PageItem* bb = CurItem;
@@ -3731,7 +3731,7 @@
 						bb2 = bb2->BottomLink;
 					}
 					doc->MoveSizeItem(FPoint(0, 0), FPoint(0, -dist), bb->ItemNr, true);
-					doc->RotMode = rmo;
+					doc->RotMode ( rmo );
 					if (keepFrameWHRatioButton->isChecked())
 					{
 						keepFrameWHRatioButton->setChecked(false);
@@ -4320,7 +4320,7 @@
 	if ((HaveDoc) && (HaveItem))
 	{
 		HaveItem = false;
-		doc->RotMode = m;
+		doc->RotMode ( m );
 		if (doc->m_Selection->isMultipleSelection())
 		{
 			doc->m_Selection->setGroupRect();
Index: scribus/canvasmode_rotate.cpp
===================================================================
--- scribus/canvasmode_rotate.cpp	(revision 13798)
+++ scribus/canvasmode_rotate.cpp	(revision 13799)
@@ -226,7 +226,7 @@
 	if (GetItem(&currItem))
 	{
 		m_inItemRotation = true;
-		m_oldRotMode   = m_rotMode   = m_doc->RotMode;
+		m_oldRotMode   = m_rotMode   = m_doc->RotMode();
 		m_oldRotCenter = m_rotCenter = m_view->RCenter;
 		if (m_doc->m_Selection->isMultipleSelection())
 		{
@@ -243,7 +243,7 @@
 					m_rotCenter = FPoint(gxR, gyR);
 					m_rotMode   = 0;
 				}
-				m_doc->RotMode  = m_rotMode;
+				m_doc->RotMode  ( m_rotMode );
 				m_view->RCenter = m_rotCenter;
 			}
 			m_startAngle = xy2Deg(mousePointDoc.x() - m_view->RCenter.x(), mousePointDoc.y() - m_view->RCenter.y());
@@ -280,7 +280,7 @@
 						m_rotMode   = 1;
 					}	
 				}
-				m_doc->RotMode  = m_rotMode;
+				m_doc->RotMode  ( m_rotMode );
 				m_view->RCenter = m_rotCenter;
 //			}
 			m_view->RCenter = m_rotCenter = FPoint(currItem->xPos()+ m_view->RCenter.x(), currItem->yPos()+ m_view->RCenter.y()); //?????
@@ -343,7 +343,7 @@
 				m_view->updateContents();
 		}
 	}
-	m_doc->RotMode  = m_oldRotMode;
+	m_doc->RotMode( m_oldRotMode );
 	m_view->RCenter = m_oldRotCenter;
 	if (!PrefsManager::instance()->appPrefs.stickyTools)
 		m_view->requestMode(modeNormal);
Index: scribus/scribus.cpp
===================================================================
--- scribus/scribus.cpp	(revision 13798)
+++ scribus/scribus.cpp	(revision 13799)
@@ -3174,7 +3174,7 @@
 		break;
 	}
 	doc->CurrentSel = SelectedType;
-	propertiesPalette->RotationGroup->setCheckedId(doc->RotMode);
+	propertiesPalette->RotationGroup->setCheckedId(doc->RotMode());
 	if (docSelectionCount > 1)
 	{
 		if (!doc->m_Selection->itemsAreSameType())
Index: scribus/plugins/tools/transform/transformeffect.cpp
===================================================================
--- scribus/plugins/tools/transform/transformeffect.cpp	(revision 13798)
+++ scribus/plugins/tools/transform/transformeffect.cpp	(revision 13799)
@@ -181,8 +181,8 @@
 				QMatrix comulatedMatrix = matrix;
 				PageItem *currItem = currDoc->m_Selection->itemAt(0);
 				Elements.append(currItem);
-				int rotBack = currDoc->RotMode;
-				currDoc->RotMode = 0;
+				int rotBack = currDoc->RotMode();
+				currDoc->RotMode ( 0 );
 				currDoc->scMW()->slotEditCopy();
 				currDoc->view()->Deselect(true);
 				for (int b = 0; b < nrOfCopies; b++)
@@ -248,7 +248,7 @@
 					currDoc->m_Selection->addItem(Elements.at(c), true);
 				}
 				currDoc->m_Selection->setGroupRect();
-				currDoc->RotMode = rotBack;
+				currDoc->RotMode (rotBack);
 				currDoc->useRaster = savedAlignGrid;
 				currDoc->SnapGuides = savedAlignGuides;
 				currDoc->DoDrawing = true;
Index: scribus/plugins/tools/transform/transformdialog.cpp
===================================================================
--- scribus/plugins/tools/transform/transformdialog.cpp	(revision 13798)
+++ scribus/plugins/tools/transform/transformdialog.cpp	(revision 13799)
@@ -67,7 +67,7 @@
 	verticalSkew->setSuffix(unitGetSuffixFromIndex(6));
 	linkSkew->setChecked(true);
 	numberOfCopies->setValue(0);
-	basePoint->setCheckedId(m_doc->RotMode);
+	basePoint->setCheckedId(m_doc->RotMode());
 	connect(transformSelector, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(setCurrentTransform(QListWidgetItem*)));
 	connect(horizontalScale, SIGNAL(valueChanged(double)), this, SLOT(changeHScale(double)));
 	connect(verticalScale, SIGNAL(valueChanged(double)), this, SLOT(changeVScale(double)));
Index: scribus/plugins/xfigimplugin/importxfig.cpp
===================================================================
--- scribus/plugins/xfigimplugin/importxfig.cpp	(revision 13798)
+++ scribus/plugins/xfigimplugin/importxfig.cpp	(revision 13799)
@@ -1124,10 +1124,10 @@
 		if (line_style > 0)
 			ite->setDashes(getDashValues(LineW, line_style));
 		ite->setTextFlowMode(PageItem::TextFlowDisabled);
-		int rot = m_Doc->RotMode;
-		m_Doc->RotMode = 2;
+		int rot = m_Doc->RotMode();
+		m_Doc->RotMode ( 2);
 		m_Doc->RotateItem(-angle * 180.0 / M_PI, ite);
-		m_Doc->RotMode = rot;
+		m_Doc->RotMode( rot);
 		depthMap.insert(999 - depth, currentItemNr);
 		currentItemNr++;
 	}
Index: scribus/canvasgesture_resize.cpp
===================================================================
--- scribus/canvasgesture_resize.cpp	(revision 13798)
+++ scribus/canvasgesture_resize.cpp	(revision 13799)
@@ -187,8 +187,8 @@
 	QRectF newBounds = m_bounds.normalized();
 	if (m_doc->m_Selection->isMultipleSelection())
 	{
-		int RotModeBack = m_doc->RotMode;
-		m_doc->RotMode = 0;
+		int RotModeBack = m_doc->RotMode();
+		m_doc->RotMode ( 0 );
 		double gx, gy, gh, gw;
 		m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
 		QRectF oldBounds(gx, gy, gw, gh);
@@ -203,7 +203,7 @@
 		double dy = newBounds.y() - oldBounds.y();
 		if (dx != 0 || dy != 0)
 			m_doc->moveGroup(dx + m_extraX, dy + m_extraY);
-		m_doc->RotMode = RotModeBack;
+		m_doc->RotMode ( RotModeBack );
 	}
 	else
 	{




More information about the scribus-commit mailing list