r23741 by jghali - Code cleanup

scribus-commit scribus-commit at lists.scribus.net
Sun May 10 15:54:06 UTC 2020


Author: jghali
Date: Sun May 10 15:54:06 2020
New Revision: 23741

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

Modified:
    trunk/Scribus/scribus/nodeeditcontext.cpp
    trunk/Scribus/scribus/nodeeditcontext.h
    trunk/Scribus/scribus/ui/markanchor.h
    trunk/Scribus/scribus/ui/markvariabletext.h

Modified: trunk/Scribus/scribus/nodeeditcontext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23741&path=/trunk/Scribus/scribus/nodeeditcontext.cpp
==============================================================================
--- trunk/Scribus/scribus/nodeeditcontext.cpp	(original)
+++ trunk/Scribus/scribus/nodeeditcontext.cpp	Sun May 10 15:54:06 2020
@@ -5,19 +5,7 @@
 #include "util_math.h"
 
 NodeEditContext::NodeEditContext() :
-	oldClip(nullptr),
-	nodeTransaction(nullptr),
-	m_submode(MOVE_POINT),
-	m_isContourLine(false),
-	m_ClRe(-1),
-	m_ClRe2(-1),
-	m_SegP1(-1),
-	m_SegP2(-1),
-	m_EdPoints(true),
-	m_MoveSym(false),
-	m_oldItemX(0.0),
-	m_oldItemY(0.0),
-	m_preview(false)
+	nodeTransaction(nullptr)
 {
 }
 
@@ -25,7 +13,6 @@
 { 
 	return m_ClRe != -1;
 }
-
 
 void NodeEditContext::deselect() 
 { 
@@ -254,34 +241,34 @@
 			np.setY(0);
 		}
 		update(QPointF(np.x(), np.y()));
-		if ((m_ClRe+1 < static_cast<int>(EndInd)) && (m_ClRe % 2 == 0))
+		if ((m_ClRe + 1 < static_cast<int>(EndInd)) && (m_ClRe % 2 == 0))
 		{
 			FPoint ap(Clip.point(m_ClRe));
-			FPoint ap2(Clip.point(m_ClRe+1));
+			FPoint ap2(Clip.point(m_ClRe + 1));
 			ap2.setX(ap2.x() - (ap.x() - np.x()));
 			ap2.setY(ap2.y() - (ap.y() - np.y()));
-			Clip.setPoint(m_ClRe+1, ap2);
+			Clip.setPoint(m_ClRe + 1, ap2);
 		}
 		Clip.setPoint(m_ClRe, np);
-		if (((m_ClRe % 4 != 0) && (m_ClRe % 2 == 0)) && (m_ClRe+3 < static_cast<int>(EndInd)) && (m_ClRe != static_cast<int>(StartInd)))
-		{
-			FPoint ap(Clip.point(m_ClRe+2));
-			FPoint ap2(Clip.point(m_ClRe+3));
+		if (((m_ClRe % 4 != 0) && (m_ClRe % 2 == 0)) && (m_ClRe + 3 < static_cast<int>(EndInd)) && (m_ClRe != static_cast<int>(StartInd)))
+		{
+			FPoint ap(Clip.point(m_ClRe + 2));
+			FPoint ap2(Clip.point(m_ClRe + 3));
 			ap2.setX(ap2.x() - (ap.x() - np.x()));
 			ap2.setY(ap2.y() - (ap.y() - np.y()));
-			Clip.setPoint(m_ClRe+3, ap2);
-			Clip.setPoint(m_ClRe+2, np);
-		}
-		if ((m_ClRe % 4 == 0) && (m_ClRe+3 < static_cast<int>(EndInd)) && (m_ClRe != static_cast<int>(StartInd)))
-		{
-			FPoint ap(Clip.point(m_ClRe-2));
-			FPoint ap2(Clip.point(m_ClRe-1));
+			Clip.setPoint(m_ClRe + 3, ap2);
+			Clip.setPoint(m_ClRe + 2, np);
+		}
+		if ((m_ClRe % 4 == 0) && (m_ClRe + 3 < static_cast<int>(EndInd)) && (m_ClRe != static_cast<int>(StartInd)))
+		{
+			FPoint ap(Clip.point(m_ClRe - 2));
+			FPoint ap2(Clip.point(m_ClRe - 1));
 			ap2.setX(ap2.x() - (ap.x() - np.x()));
 			ap2.setY(ap2.y() - (ap.y() - np.y()));
-			Clip.setPoint(m_ClRe-1, ap2);
-			Clip.setPoint(m_ClRe-2, np);
-		}
-		if (((m_ClRe == static_cast<int>(StartInd)) || (m_ClRe == static_cast<int>(EndInd-2))) &&
+			Clip.setPoint(m_ClRe - 1, ap2);
+			Clip.setPoint(m_ClRe - 2, np);
+		}
+		if (((m_ClRe == static_cast<int>(StartInd)) || (m_ClRe == static_cast<int>(EndInd - 2))) &&
 			((currItem->itemType() == PageItem::Polygon)
 			|| (currItem->itemType() == PageItem::Group)
 			|| (currItem->itemType() == PageItem::Symbol)
@@ -290,12 +277,12 @@
 		{
 			if (m_ClRe == static_cast<int>(StartInd))
 			{
-				FPoint ap(Clip.point(EndInd-2));
-				FPoint ap2(Clip.point(EndInd-1));
+				FPoint ap(Clip.point(EndInd- 2));
+				FPoint ap2(Clip.point(EndInd - 1));
 				ap2.setX(ap2.x() - (ap.x() - np.x()));
 				ap2.setY(ap2.y() - (ap.y() - np.y()));
-				Clip.setPoint(EndInd-2, Clip.point(StartInd));
-				Clip.setPoint(EndInd-1, ap2);
+				Clip.setPoint(EndInd - 2, Clip.point(StartInd));
+				Clip.setPoint(EndInd - 1, ap2);
 			}
 			else
 			{
@@ -303,11 +290,11 @@
 				FPoint ap2(Clip.point(StartInd + 1));
 				ap2.setX(ap2.x() - (ap.x() - np.x()));
 				ap2.setY(ap2.y() - (ap.y() - np.y()));
-				Clip.setPoint(StartInd, Clip.point(EndInd-2));
+				Clip.setPoint(StartInd, Clip.point(EndInd - 2));
 				Clip.setPoint(StartInd + 1, ap2);
 			}
 		}
-		if (((m_ClRe == static_cast<int>(StartInd+1)) || (m_ClRe == static_cast<int>(EndInd-1))) &&
+		if (((m_ClRe == static_cast<int>(StartInd + 1)) || (m_ClRe == static_cast<int>(EndInd - 1))) &&
 			((currItem->itemType() == PageItem::Polygon)
 			|| (currItem->itemType() == PageItem::Group)
 			|| (currItem->itemType() == PageItem::Symbol)
@@ -316,31 +303,31 @@
 			(m_MoveSym))
 		{
 			uint kon = 0;
-			if (m_ClRe == static_cast<int>(StartInd+1))
-				kon = EndInd-1;
+			if (m_ClRe == static_cast<int>(StartInd + 1))
+				kon = EndInd - 1;
 			else
 				kon = StartInd + 1;
-			FPoint lxy(Clip.point(m_ClRe-1));
+			FPoint lxy(Clip.point(m_ClRe - 1));
 			FPoint lk(Clip.point(m_ClRe));
 			double dx = lxy.x() - lk.x();
 			double dy = lxy.y() - lk.y();
-			lk.setX(lk.x() + dx*2);
-			lk.setY(lk.y() + dy*2);
+			lk.setX(lk.x() + dx * 2);
+			lk.setY(lk.y() + dy * 2);
 			Clip.setPoint(kon, lk);
 		}
-		if ((m_ClRe % 2 != 0) && (m_MoveSym) && (m_ClRe != static_cast<int>(StartInd + 1)) && (m_ClRe != static_cast<int>(EndInd-1)))
+		if ((m_ClRe % 2 != 0) && (m_MoveSym) && (m_ClRe != static_cast<int>(StartInd + 1)) && (m_ClRe != static_cast<int>(EndInd - 1)))
 		{
 			uint kon = 0;
-			if ((m_ClRe+1) % 4 == 0)
+			if ((m_ClRe + 1) % 4 == 0)
 				kon = m_ClRe + 2;
 			else
 				kon = m_ClRe - 2;
-			FPoint lxy(Clip.point(m_ClRe-1));
+			FPoint lxy(Clip.point(m_ClRe - 1));
 			FPoint lk(Clip.point(m_ClRe));
 			double dx = lxy.x() - lk.x();
 			double dy = lxy.y() - lk.y();
-			lk.setX(lk.x() + dx*2);
-			lk.setY(lk.y() + dy*2);
+			lk.setX(lk.x() + dx * 2);
+			lk.setY(lk.y() + dy * 2);
 			Clip.setPoint(kon, lk);
 		}
 		if (Doc->nodeEdit.m_isContourLine)
@@ -375,9 +362,9 @@
 	currItem->ClipEdited = true;
 	FPoint np;
 	if (Doc->nodeEdit.m_isContourLine)
-		np = currItem->ContourLine.point(Doc->nodeEdit.m_ClRe-1);
-	else
-		np = currItem->PoLine.point(Doc->nodeEdit.m_ClRe-1);
+		np = currItem->ContourLine.point(Doc->nodeEdit.m_ClRe - 1);
+	else
+		np = currItem->PoLine.point(Doc->nodeEdit.m_ClRe - 1);
 	currItem->OldB2 = currItem->width();
 	currItem->OldH2 = currItem->height();
 	if (Doc->nodeEdit.m_isContourLine)
@@ -458,24 +445,24 @@
 	FPoint np = Clip.point(Doc->nodeEdit.clre());
 	currItem->OldB2 = currItem->width();
 	currItem->OldH2 = currItem->height();
-	if ((Doc->nodeEdit.clre() == StartInd) || (Doc->nodeEdit.clre() == EndInd-2))
+	if ((Doc->nodeEdit.clre() == StartInd) || (Doc->nodeEdit.clre() == EndInd - 2))
 	{
 		if (currItem->asPolyLine())
 		{
 			if (Doc->nodeEdit.clre() == StartInd)
-				Clip.setPoint(StartInd+1, np);
+				Clip.setPoint(StartInd + 1, np);
 			else
-				Clip.setPoint(EndInd-1, np);
+				Clip.setPoint(EndInd - 1, np);
 		}
 		else
 		{
-			Clip.setPoint(StartInd+1, np);
-			Clip.setPoint(EndInd-1, np);
-		}
-	}
-	else
-	{
-		Clip.setPoint(Doc->nodeEdit.m_ClRe+1, np);
+			Clip.setPoint(StartInd + 1, np);
+			Clip.setPoint(EndInd - 1, np);
+		}
+	}
+	else
+	{
+		Clip.setPoint(Doc->nodeEdit.m_ClRe + 1, np);
 		Clip.setPoint((Doc->nodeEdit.m_ClRe % 4 != 0 ? Doc->nodeEdit.m_ClRe + 3 : Doc->nodeEdit.m_ClRe - 1), np);
 	}
 	if (!Doc->nodeEdit.m_isContourLine)

Modified: trunk/Scribus/scribus/nodeeditcontext.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23741&path=/trunk/Scribus/scribus/nodeeditcontext.h
==============================================================================
--- trunk/Scribus/scribus/nodeeditcontext.h	(original)
+++ trunk/Scribus/scribus/nodeeditcontext.h	Sun May 10 15:54:06 2020
@@ -75,24 +75,24 @@
 		void finishTransaction2(PageItem* currItem, ScItemState<QPair<FPointArray, FPointArray> >* state);
 		void moveClipPoint(PageItem *currItem, const FPoint& ip);
 
-		FPointArray *oldClip;
+		FPointArray *oldClip { nullptr };
 		UndoTransaction nodeTransaction;
 
 		enum SubMode { MOVE_POINT = 0, ADD_POINT = 1, DEL_POINT = 2, SPLIT_PATH = 3 };
 
 	protected:
-		int m_submode;
-		bool m_isContourLine;
+		int m_submode { MOVE_POINT };
+		bool m_isContourLine { false };
 
-		int m_ClRe;
-		int m_ClRe2;
-		int m_SegP1;
-		int m_SegP2;
-		bool m_EdPoints;
-		bool m_MoveSym;
+		int m_ClRe { -1 };
+		int m_ClRe2 { -1 };
+		int m_SegP1 { -1 };
+		int m_SegP2 { -1 };
+		bool m_EdPoints { true };
+		bool m_MoveSym { false };
 		QList<int> m_SelNode;
-		double m_oldItemX;
-		double m_oldItemY;
-		bool m_preview;
+		double m_oldItemX { 0.0 };
+		double m_oldItemY { 0.0 };
+		bool m_preview { false };
 };
 #endif

Modified: trunk/Scribus/scribus/ui/markanchor.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23741&path=/trunk/Scribus/scribus/ui/markanchor.h
==============================================================================
--- trunk/Scribus/scribus/ui/markanchor.h	(original)
+++ trunk/Scribus/scribus/ui/markanchor.h	Sun May 10 15:54:06 2020
@@ -11,8 +11,9 @@
 public:
 	explicit MarkAnchor(QWidget *parent = nullptr);
 	~MarkAnchor() {}
-	virtual void values(QString& label);
-	virtual void setValues(const QString label);
+
+	void values(QString& label) override;
+	void setValues(const QString label) override;
 
 protected:
 	void changeEvent(QEvent *e);

Modified: trunk/Scribus/scribus/ui/markvariabletext.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23741&path=/trunk/Scribus/scribus/ui/markvariabletext.h
==============================================================================
--- trunk/Scribus/scribus/ui/markvariabletext.h	(original)
+++ trunk/Scribus/scribus/ui/markvariabletext.h	Sun May 10 15:54:06 2020
@@ -13,8 +13,9 @@
 	explicit MarkVariableText(const QList<Mark*>&, QWidget *parent = 0);
 	explicit MarkVariableText(const Mark*, QWidget *parent = 0);
 	~MarkVariableText();
-	virtual Mark* values(QString& label, QString& text);
-	virtual void setValues(const QString label, const QString text);
+
+	Mark* values(QString& label, QString& text) override;
+	void setValues(const QString label, const QString text) override;
 
 protected:
 	void changeEvent(QEvent *e);
@@ -30,10 +31,10 @@
 		LineEdit = 1
 	};
 
-	QWidget* labelEditWidget;
+	QWidget* labelEditWidget = nullptr;
 	const WidgetType m_widgetType;
 
-	const Mark* m_mark;
+	const Mark* m_mark = nullptr;
 };
 
 #endif // MARKVARIABLETEXT_H




More information about the scribus-commit mailing list