r23398 by craig - Code cleanup

scribus-commit scribus-commit at lists.scribus.net
Sun Dec 8 11:52:15 UTC 2019


Author: craig
Date: Sun Dec  8 11:52:15 2019
New Revision: 23398

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

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

Modified: trunk/Scribus/scribus/canvasmode.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23398&path=/trunk/Scribus/scribus/canvasmode.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode.cpp	(original)
+++ trunk/Scribus/scribus/canvasmode.cpp	Sun Dec  8 11:52:15 2019
@@ -78,10 +78,7 @@
 	m_view(view),
 	m_canvas(view->m_canvas),
 	m_doc(view->Doc),
-	m_panGesture(nullptr),
-	undoManager(UndoManager::instance()),
-	xSnap(0.0),
-	ySnap(0.0)
+	undoManager(UndoManager::instance())
 {
 	m_pen["outline"]	= QPen(Qt::gray, 1.0 , Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
 	m_pen["outline"].setCosmetic(true);
@@ -99,10 +96,6 @@
 	m_brush["selection-group"] = QColor(255,0,0,10);
 	m_brush["selection-group-inside"] = Qt::NoBrush;
 	m_brush["handle"]	= PrefsManager::instance().appPrefs.displayPrefs.frameColor;
-
-	m_keyRepeat = false;
-	m_arrowKeyDown = false;
-	//m_mousePointDoc = FPoint(0,0);
 }
 
 CanvasMode::~CanvasMode()

Modified: trunk/Scribus/scribus/canvasmode.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23398&path=/trunk/Scribus/scribus/canvasmode.h
==============================================================================
--- trunk/Scribus/scribus/canvasmode.h	(original)
+++ trunk/Scribus/scribus/canvasmode.h	Sun Dec  8 11:52:15 2019
@@ -148,12 +148,13 @@
 	
 
 protected:
-	ScribusView * const m_view;
-	Canvas * const m_canvas;
-	ScribusDoc * const m_doc;
-	PanGesture * m_panGesture;
+	ScribusView* const m_view;
+	Canvas* const m_canvas;
+	ScribusDoc* const m_doc;
+	PanGesture* m_panGesture {nullptr};
 	UndoManager* undoManager;
-	double xSnap, ySnap;
+	double xSnap {0.0};
+	double ySnap {0.0};
 	
 	void setResizeCursor(int how, double rot = 0.0);
 	bool commonMouseMove(QMouseEvent *m);
@@ -167,8 +168,8 @@
 	QMap<QString,QPen> m_pen;
 	QMap<QString,QBrush> m_brush;
 
-	bool m_keyRepeat;
-	bool m_arrowKeyDown;
+	bool m_keyRepeat {false};
+	bool m_arrowKeyDown {false};
 	//FPoint m_mousePointDoc;
 };
 

Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23398&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp	(original)
+++ trunk/Scribus/scribus/pageitem.cpp	Sun Dec  8 11:52:15 2019
@@ -1306,6 +1306,7 @@
 {
 	return firstChar;
 }
+
 int PageItem::lastInFrame() const
 {
 	return qMin(signed(m_maxChars), itemText.length()) - 1;
@@ -4586,7 +4587,7 @@
 		return; // nothing to do -> return
 	assert(newType != 1);	//DEBUG CR 2005-02-06
 	assert(newType != 3);	//DEBUG CR 2005-02-06
-	QString fromType = "", toType = "";
+	QString fromType;
 	switch (m_itemType)
 	{
 		case ImageFrame:
@@ -4604,9 +4605,9 @@
 			fromType = Um::Polygon;
 			break;
 		default:
-			fromType = "";
 			break;
 	}
+	QString toType;
 	switch (newType)
 	{
 		case ImageFrame:
@@ -4632,7 +4633,6 @@
 			setUPixmap(Um::IPolyline);
 			break;
 		default:
-			toType = "";
 			setUPixmap(nullptr);
 			break;
 	}

Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23398&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp	(original)
+++ trunk/Scribus/scribus/scribusview.cpp	Sun Dec  8 11:52:15 2019
@@ -2474,7 +2474,7 @@
 	resizeContents(qRound((Doc->maxCanvasCoordinate.x() - Doc->minCanvasCoordinate.x()) * m_canvas->scale()), qRound((Doc->maxCanvasCoordinate.y() - Doc->minCanvasCoordinate.y()) * m_canvas->scale()));
 }
 
-void ScribusView::showSymbolPage(QString symbolName)
+void ScribusView::showSymbolPage(const QString& symbolName)
 {
 	deselectItems(false);
 	OldScale = m_canvas->scale();
@@ -2521,8 +2521,8 @@
 	m_ScMW->layerMenu->setEnabled(false);
 	updateOn = false;
 	setZoom();
-	m_oldZoomX = qRound(Doc->currentPage()->xOffset()- 10);
-	m_oldZoomY = qRound(Doc->currentPage()->yOffset()- 10);
+	m_oldZoomX = qRound(Doc->currentPage()->xOffset() - 10);
+	m_oldZoomY = qRound(Doc->currentPage()->yOffset() - 10);
 	setCanvasPos(Doc->currentPage()->xOffset() - 10, Doc->currentPage()->yOffset() - 10);
 	updateOn = true;
 	endEditButton->setVisible(true);
@@ -2556,8 +2556,6 @@
 	if (clipw <= 0 || cliph <= 0)
 		return QImage();
 
-	QImage im;
-	QImage pm;
 	double sca = m_canvas->scale();
 	bool   frs = Doc->guidesPrefs().framesShown;
 	double cx = Doc->minCanvasCoordinate.x();
@@ -2574,7 +2572,7 @@
 	setScale(1.0);
 	m_canvas->setPreviewMode(true);
 	m_canvas->setForcedRedraw(true);
-	pm = QImage(clipw, cliph, QImage::Format_ARGB32_Premultiplied);
+	QImage pm = QImage(clipw, cliph, QImage::Format_ARGB32_Premultiplied);
 	ScPainter *painter = new ScPainter(&pm, pm.width(), pm.height(), 1.0, 0);
 	painter->clear(Doc->paperColor());
 	painter->translate(-clipx, -clipy);
@@ -2597,6 +2595,7 @@
 	painter->end();
 	double sx = pm.width() / static_cast<double>(maxGr);
 	double sy = pm.height() / static_cast<double>(maxGr);
+	QImage im;
 	if (sy < sx)
 		im = pm.scaled(static_cast<int>(pm.width() / sx), static_cast<int>(pm.height() / sx), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
 	else

Modified: trunk/Scribus/scribus/scribusview.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23398&path=/trunk/Scribus/scribus/scribusview.h
==============================================================================
--- trunk/Scribus/scribus/scribusview.h	(original)
+++ trunk/Scribus/scribus/scribusview.h	Sun Dec  8 11:52:15 2019
@@ -158,7 +158,7 @@
 	void reformPagesView();
 	void showMasterPage(int nr);
 	void hideMasterPage();
-	void showSymbolPage(QString symbolName);
+	void showSymbolPage(const QString& symbolName);
 	void hideSymbolPage();
 	void showInlinePage(int id);
 	void hideInlinePage();




More information about the scribus-commit mailing list