r23945 by jghali - Code style fixes and cleanups

scribus-commit scribus-commit at lists.scribus.net
Mon Jul 27 19:35:23 UTC 2020


Author: jghali
Date: Mon Jul 27 19:35:23 2020
New Revision: 23945

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23945
Log:
Code style fixes and cleanups

Modified:
    trunk/Scribus/scribus/canvasmode.cpp
    trunk/Scribus/scribus/scribusview.cpp

Modified: trunk/Scribus/scribus/canvasmode.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23945&path=/trunk/Scribus/scribus/canvasmode.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode.cpp	(original)
+++ trunk/Scribus/scribus/canvasmode.cpp	Mon Jul 27 19:35:23 2020
@@ -1098,38 +1098,38 @@
 		 */
 		if (m_doc->m_Selection->count() != 0)
 		{
-			double moveBy=1.0;
-			if (m_doc->unitIndex()!=SC_INCHES)
+			double moveBy = 1.0;
+			if (m_doc->unitIndex() != SC_INCHES)
 			{
 				if ((buttonModifiers & Qt::ShiftModifier) && !(buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier))
-					moveBy=0.1;
+					moveBy = 0.1;
 				else if (!(buttonModifiers & Qt::ShiftModifier) && (buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier))
-					moveBy=10.0;
+					moveBy = 10.0;
 				else if ((buttonModifiers & Qt::ShiftModifier) && (buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier))
-					moveBy=0.01;
-
-				moveBy/=m_doc->unitRatio();//Lets allow movement by the current doc ratio, not only points
+					moveBy = 0.01;
+
+				moveBy /= m_doc->unitRatio();//Lets allow movement by the current doc ratio, not only points
 			}
 			else
 			{
 				if ((buttonModifiers & Qt::ShiftModifier) && !(buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier))
-					moveBy=0.1/m_doc->unitRatio();
+					moveBy = 0.1 / m_doc->unitRatio();
 				else if (!(buttonModifiers & Qt::ShiftModifier) && (buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier))
-					moveBy=1.0/m_doc->unitRatio();
+					moveBy = 1.0 / m_doc->unitRatio();
 				else if ((buttonModifiers & Qt::ShiftModifier) && (buttonModifiers & Qt::ControlModifier) && !(buttonModifiers & Qt::AltModifier))
-					moveBy=0.01/m_doc->unitRatio();
+					moveBy = 0.01 / m_doc->unitRatio();
 			}
-			bool resizing=((buttonModifiers & Qt::AltModifier) && !(buttonModifiers & Qt::ControlModifier));
-			bool resizingsmaller=(resizing && (buttonModifiers & Qt::ShiftModifier));
-			double resizeBy=1.0;
+			bool resizing = ((buttonModifiers & Qt::AltModifier) && !(buttonModifiers & Qt::ControlModifier));
+			bool resizingsmaller = (resizing && (buttonModifiers & Qt::ShiftModifier));
+			double resizeBy = 1.0;
 
 			//CB with control locked out due to the requirement of moveby of 0.01, we cannot support
 			//resizeby 10 units unless we move to supporting modifier keys that most people don't have.
 			//if (buttonModifiers & Qt::ControlModifier)
-			//	resizeBy*=10.0;
-			resizeBy/=m_doc->unitRatio();
+			//	resizeBy *= 10.0;
+			resizeBy /= m_doc->unitRatio();
 			if (resizingsmaller)
-				resizeBy*=-1.0;
+				resizeBy *= -1.0;
 
 			PageItem *currItem = m_doc->m_Selection->itemAt(0);
 
@@ -1147,7 +1147,7 @@
 			{
 			case Qt::Key_Backspace:
 			case Qt::Key_Delete:
-					if (buttonModifiers==Qt::NoModifier)
+					if (buttonModifiers == Qt::NoModifier)
 						m_doc->itemSelection_DeleteItem();
 					else
 					{
@@ -1200,26 +1200,26 @@
 						/* Don't use Grid or Guide Snapping when dragging Items or Groups with the keyboard */
 						/* as the user might be trying to fine tune a position */
 							bool sav1 = m_doc->SnapGuides;
+							bool sav2 = m_doc->SnapGrid;
 							bool sav3 = m_doc->SnapElement;
-							bool sav2 = m_doc->SnapGrid;
 							m_doc->SnapGuides = false;
-							m_doc->SnapGrid   = false;
+							m_doc->SnapGrid = false;
 							m_doc->SnapElement = false;
 							if (m_doc->m_Selection->count() > 1)
-								m_view->startGroupTransaction(Um::Move, "", Um::IMove);
+								m_view->startGroupTransaction(Um::Move, QString(), Um::IMove);
 							m_doc->moveGroup(-moveBy, 0);
 							if (m_doc->m_Selection->count() > 1)
 								m_view->endGroupTransaction();
-							m_doc->SnapElement = sav3;
 							m_doc->SnapGuides = sav1;
 							m_doc->SnapGrid = sav2;
+							m_doc->SnapElement = sav3;
 						}
 					}
 					else
 					{
 						//CB If in EditContour mode, allow contour line to be scaled with arrow keys too
 						if (m_doc->nodeEdit.isContourLine())
-							m_view->TransformPoly(10, 0, resizeBy/unitGetRatioFromIndex(m_doc->unitIndex()));
+							m_view->TransformPoly(10, 0, resizeBy / unitGetRatioFromIndex(m_doc->unitIndex()));
 						else if (!currItem->sizeLocked())
 						{
 							if ((rotationFC > 0.0 && rotationFC < 45.0) || (rotationFC >= 315.0 && rotationFC <= 360.0))
@@ -1300,7 +1300,7 @@
 							m_doc->SnapGrid = false;
 							m_doc->SnapElement = false;
 							if (m_doc->m_Selection->count() > 1)
-								m_view->startGroupTransaction(Um::Move, "", Um::IMove);
+								m_view->startGroupTransaction(Um::Move, QString(), Um::IMove);
 							m_doc->moveGroup(moveBy, 0);
 							if (m_doc->m_Selection->count() > 1)
 								m_view->endGroupTransaction();
@@ -1313,7 +1313,7 @@
 					{
 						//CB If in EditContour mode, allow contour line to be scaled with arrow keys too
 						if (m_doc->nodeEdit.isContourLine())
-							m_view->TransformPoly(11, 0, resizeBy/unitGetRatioFromIndex(m_doc->unitIndex()));
+							m_view->TransformPoly(11, 0, resizeBy / unitGetRatioFromIndex(m_doc->unitIndex()));
 						else if (!currItem->sizeLocked())
 						{
 							if ((rotationFC > 0.0 && rotationFC < 45.0) || (rotationFC >= 315.0 && rotationFC <= 360.0))
@@ -1394,7 +1394,7 @@
 							m_doc->SnapGrid = false;
 							m_doc->SnapElement = false;
 							if (m_doc->m_Selection->count() > 1)
-								m_view->startGroupTransaction(Um::Move, "", Um::IMove);
+								m_view->startGroupTransaction(Um::Move, QString(), Um::IMove);
 							m_doc->moveGroup(0, -moveBy);
 							if (m_doc->m_Selection->count() > 1)
 								m_view->endGroupTransaction();
@@ -1407,7 +1407,7 @@
 					{
 						//CB If in EditContour mode, allow contour line to be scaled with arrow keys too
 						if (m_doc->nodeEdit.isContourLine())
-							m_view->TransformPoly(12, 0, resizeBy/unitGetRatioFromIndex(m_doc->unitIndex()));
+							m_view->TransformPoly(12, 0, resizeBy / unitGetRatioFromIndex(m_doc->unitIndex()));
 						else if (!currItem->sizeLocked())
 						{
 							if ((rotationFC > 0.0 && rotationFC < 45.0) || (rotationFC >= 315.0 && rotationFC <= 360.0))
@@ -1488,7 +1488,7 @@
 							m_doc->SnapGrid = false;
 							m_doc->SnapElement = false;
 							if (m_doc->m_Selection->count() > 1)
-								m_view->startGroupTransaction(Um::Move, "", Um::IMove);
+								m_view->startGroupTransaction(Um::Move, QString(), Um::IMove);
 							m_doc->moveGroup(0, moveBy);
 							if (m_doc->m_Selection->count() > 1)
 								m_view->endGroupTransaction();
@@ -1501,7 +1501,7 @@
 					{
 						//CB If in EditContour mode, allow contour line to be scaled with arrow keys too
 						if (m_doc->nodeEdit.isContourLine())
-							m_view->TransformPoly(13, 0, resizeBy/unitGetRatioFromIndex(m_doc->unitIndex()));
+							m_view->TransformPoly(13, 0, resizeBy / unitGetRatioFromIndex(m_doc->unitIndex()));
 						else if (!currItem->sizeLocked())
 						{
 							if ((rotationFC > 0.0 && rotationFC < 45.0) || (rotationFC >= 315.0 && rotationFC <= 360.0))

Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23945&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp	(original)
+++ trunk/Scribus/scribus/scribusview.cpp	Mon Jul 27 19:35:23 2020
@@ -1503,38 +1503,38 @@
 				ma.shear(0, 0.017455);
 				break;
 			case 8:
-				ma.scale(1.0 - (scaling / tpS.x()),1.0 - (scaling / tpS.y()));
+				ma.scale(1.0 - (scaling / tpS.x()), 1.0 - (scaling / tpS.y()));
 				break;
 			case 9:
-				ma.scale(1.0 + (scaling / tpS.x()),1.0 + (scaling / tpS.y()));
+				ma.scale(1.0 + (scaling / tpS.x()), 1.0 + (scaling / tpS.y()));
 				break;
 				//10-13 are for scaling the contour line in shape edit mode
 			case 10:
 				{
-					double s=1.0 - (scaling/(tp2.x() - tp.x()));
+					double s = 1.0 - (scaling / (tp2.x() - tp.x()));
 					ma.scale(s, 1);
-					ma.translate(-scaling/s/2,0);
+					ma.translate(-scaling / s / 2, 0);
 				}
 				break;
 			case 11:
 				{
-					double s=1.0 - (scaling/(tp2.x() - tp.x()));
+					double s = 1.0 - (scaling / (tp2.x() - tp.x()));
 					ma.scale(s, 1);
-					ma.translate(scaling/s/2,0);
+					ma.translate(scaling / s / 2, 0);
 				}
 				break;
 			case 12:
 				{
-					double s=1.0 - (scaling/(tp2.y() - tp.y()));
+					double s = 1.0 - (scaling / (tp2.y() - tp.y()));
 					ma.scale(1, s);
-					ma.translate(0,-scaling/s/2);
+					ma.translate(0, -scaling / s / 2);
 				}
 				break;
 			case 13:
 				{
-					double s=1.0 - (scaling/(tp2.y() - tp.y()));
+					double s = 1.0 - (scaling/(tp2.y() - tp.y()));
 					ma.scale(1, s);
-					ma.translate(0,scaling/s/2);
+					ma.translate(0, scaling / s / 2);
 				}
 				break;
 		}
@@ -1592,10 +1592,10 @@
 			ma.shear(0, 0.017455);
 			break;
 		case 8:
-			ma.scale(1.0 - (scaling / oldWidth),1.0 - (scaling / oldHeight));
+			ma.scale(1.0 - (scaling / oldWidth), 1.0 - (scaling / oldHeight));
 			break;
 		case 9:
-			ma.scale(1.0 + (scaling / oldWidth),1.0 + (scaling / oldHeight));
+			ma.scale(1.0 + (scaling / oldWidth), 1.0 + (scaling / oldHeight));
 			break;
 	}
 	currItem->PoLine.map(ma);
@@ -1633,10 +1633,10 @@
 			ma2.shear(0, 0.017455);
 			break;
 		case 8:
-			ma2.scale(1.0 - (scaling / oldWidth),1.0 - (scaling / oldHeight));
+			ma2.scale(1.0 - (scaling / oldWidth), 1.0 - (scaling / oldHeight));
 			break;
 		case 9:
-			ma2.scale(1.0 + (scaling / oldWidth),1.0 + (scaling / oldHeight));
+			ma2.scale(1.0 + (scaling / oldWidth), 1.0 + (scaling / oldHeight));
 			break;
 	}
 	double x = ma2.m11() * n.x() + ma2.m21() * n.y() + ma2.dx();
@@ -2414,8 +2414,8 @@
 void ScribusView::GotoLa(int l)
 {
 	int level = m_doc->layerCount()-l-1;
-	int layerID=m_doc->layerIDFromLevel(level);
-	if (layerID==-1)
+	int layerID = m_doc->layerIDFromLevel(level);
+	if (layerID == -1)
 		return;
 	m_doc->setActiveLayer(layerID);
 	//CB TODO fix this to use view calls after 1.3.2 release




More information about the scribus-commit mailing list