r23257 by jghali - Code style fixes

scribus-commit scribus-commit at lists.scribus.net
Wed Oct 16 00:02:08 UTC 2019


Author: jghali
Date: Wed Oct 16 00:02:08 2019
New Revision: 23257

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

Modified:
    trunk/Scribus/scribus/canvasmode_normal.cpp
    trunk/Scribus/scribus/pageitem.cpp

Modified: trunk/Scribus/scribus/canvasmode_normal.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23257&path=/trunk/Scribus/scribus/canvasmode_normal.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_normal.cpp	(original)
+++ trunk/Scribus/scribus/canvasmode_normal.cpp	Wed Oct 16 00:02:08 2019
@@ -519,7 +519,7 @@
 				int dX = qRound(newX - m_mousePressPoint.x()), dY = qRound(newY - m_mousePressPoint.y());
 				if (!m_doc->m_Selection->isMultipleSelection())
 				{
-					erf=true;
+					erf = true;
 					currItem = m_doc->m_Selection->itemAt(0);
 					//Control Alt drag image in frame without being in edit mode
 					if ((currItem->asImageFrame()) && (m->modifiers() & Qt::ControlModifier) && (m->modifiers() & Qt::AltModifier))
@@ -533,13 +533,12 @@
 						if ((m->modifiers() & Qt::ControlModifier) && !(m->modifiers() & Qt::ShiftModifier) && !(m->modifiers() & Qt::AltModifier))
 						{
 							if (abs(dX) > abs(dY))
-								dY=0;
-							else
-								if (abs(dY) > abs(dX))
-									dX=0;
-							erf=false;
-							dX+=qRound(m_dragConstrainInitPtX-currItem->xPos());
-							dY+=qRound(m_dragConstrainInitPtY-currItem->yPos());
+								dY = 0;
+							else if (abs(dY) > abs(dX))
+								dX = 0;
+							erf = false;
+							dX += qRound(m_dragConstrainInitPtX - currItem->xPos());
+							dY += qRound(m_dragConstrainInitPtY - currItem->yPos());
 						}
 						double gx, gy, gh, gw;
 						m_objectDeltaPos.setXY(dX, dY);
@@ -567,27 +566,27 @@
 							nx = nxo = gx + gw + m_objectDeltaPos.x();
 							ny = nyo = gy + gh + m_objectDeltaPos.y();
 							m_doc->ApplyGuides(&nx, &ny);
-							m_objectDeltaPos += FPoint(nx-nxo, ny-nyo);
+							m_objectDeltaPos += FPoint(nx - nxo, ny - nyo);
 							if (false)
 							{
-								nx = nxo = gx + gw/2 + m_objectDeltaPos.x();
-								ny = nyo = gy + gh/2 + m_objectDeltaPos.y();
+								nx = nxo = gx + gw / 2 + m_objectDeltaPos.x();
+								ny = nyo = gy + gh / 2 + m_objectDeltaPos.y();
 								m_doc->ApplyGuides(&nx, &ny);
-								m_objectDeltaPos += FPoint(nx-nxo, ny-nyo);
+								m_objectDeltaPos += FPoint(nx - nxo, ny - nyo);
 							}
 						}
 						if (m_doc->SnapElement)
 						{
 							xSnap = 0;
 							ySnap = 0;
-							double snapWidth[] = {0,gw,gw/2};
-							double snapHeight[] = {0,gh,gh/2};
+							double snapWidth[] = { 0, gw, gw / 2 };
+							double snapHeight[] = { 0, gh, gh / 2 };
 							if (m_objectDeltaPos.x() < 0)
-								std::swap(snapWidth[0],snapWidth[2]);
+								std::swap(snapWidth[0], snapWidth[2]);
 							if (m_objectDeltaPos.y() < 0)
-								std::swap(snapHeight[0],snapHeight[2]);
+								std::swap(snapHeight[0], snapHeight[2]);
 							double nx,ny,nyo,nxo;
-							for (int i = 0;i<3;i++)
+							for (int i = 0; i < 3; i++)
 							{
 								nx = gx + snapWidth[i] + m_objectDeltaPos.x();
 								ny = gy + snapHeight[i] + m_objectDeltaPos.y();
@@ -613,7 +612,7 @@
 							gx = nr.x();
 							gy = nr.y();
 							if ((fabs(gx - gxo) < (m_doc->guidesPrefs().guideRad) / m_canvas->scale()) && (fabs(gy - gyo) < (m_doc->guidesPrefs().guideRad) / m_canvas->scale()))
-								m_objectDeltaPos += FPoint(gx-gxo, gy-gyo);
+								m_objectDeltaPos += FPoint(gx - gxo, gy - gyo);
 						}
 					}
 				}
@@ -623,18 +622,17 @@
 					m_doc->m_Selection->setGroupRect();
 				//	m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
 					m_doc->m_Selection->getVisualGroupRect(&gx, &gy, &gw, &gh);
-					int dX=qRound(newX - m_mousePressPoint.x()), dY=qRound(newY - m_mousePressPoint.y());
+					int dX = qRound(newX - m_mousePressPoint.x()), dY = qRound(newY - m_mousePressPoint.y());
 					erf = true;
 					if (m->modifiers() & Qt::ControlModifier)
 					{
-						if (abs(dX)>abs(dY))
-							dY=0;
-						else
-							if (abs(dY)>abs(dX))
-								dX=0;
-						erf=false;
-						dX+=m_dragConstrainInitPtX-qRound(gx);
-						dY+=m_dragConstrainInitPtY-qRound(gy);
+						if (abs(dX) > abs(dY))
+							dY = 0;
+						else if (abs(dY) > abs(dX))
+							dX = 0;
+						erf = false;
+						dX += m_dragConstrainInitPtX-qRound(gx);
+						dY += m_dragConstrainInitPtY-qRound(gy);
 					}
 					m_objectDeltaPos.setXY(dX, dY);
 					if (m_doc->SnapGuides)
@@ -660,14 +658,14 @@
 					{
 						xSnap = 0;
 						ySnap = 0;
-						double snapWidth[] = {0,gw,gw/2};
-						double snapHeight[] = {0,gh,gh/2};
+						double snapWidth[] = { 0, gw, gw / 2 };
+						double snapHeight[] = { 0, gh, gh / 2 };
 						if (m_objectDeltaPos.x() <0 )
-							std::swap(snapWidth[0],snapWidth[2]);
+							std::swap(snapWidth[0], snapWidth[2]);
 						if (m_objectDeltaPos.y() < 0)
-							std::swap(snapHeight[0],snapHeight[2]);
+							std::swap(snapHeight[0], snapHeight[2]);
 						double nx,ny,nyo,nxo;
-						for (int i = 0;i<3;i++)
+						for (int i = 0; i < 3; i++)
 						{
 							nx = gx + snapWidth[i] + m_objectDeltaPos.x();
 							ny = gy + snapHeight[i] + m_objectDeltaPos.y();
@@ -692,7 +690,7 @@
 						gx = nr.x();
 						gy = nr.y();
 						if ((fabs(gx - gxo) < (m_doc->guidesPrefs().guideRad) / m_canvas->scale()) && (fabs(gy - gyo) < (m_doc->guidesPrefs().guideRad) / m_canvas->scale()))
-							m_objectDeltaPos += FPoint(gx-gxo, gy-gyo);
+							m_objectDeltaPos += FPoint(gx - gxo, gy - gyo);
 					}
 				}
 				if (erf)

Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23257&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp	(original)
+++ trunk/Scribus/scribus/pageitem.cpp	Wed Oct 16 00:02:08 2019
@@ -1037,12 +1037,12 @@
 
 void PageItem::resizeBy(const double dH, const double dW)
 {
-	if (dH==0.0 && dW==0.0)
-		return;
-	if (dH!=0.0)
-		m_width+=dH;
-	if (dW!=0.0)
-		m_height+=dW;
+	if (dH == 0.0 && dW == 0.0)
+		return;
+	if (dH != 0.0)
+		m_width += dH;
+	if (dW != 0.0)
+		m_height += dW;
 	updateConstants();
 	if (m_Doc->isLoading())
 		return;




More information about the scribus-commit mailing list