r23900 by jghali - Code cleanup

scribus-commit scribus-commit at lists.scribus.net
Mon Jun 22 10:20:30 UTC 2020


Author: jghali
Date: Mon Jun 22 10:20:30 2020
New Revision: 23900

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

Modified:
    trunk/Scribus/scribus/ui/storyeditor.cpp
    trunk/Scribus/scribus/ui/storyeditor.h

Modified: trunk/Scribus/scribus/ui/storyeditor.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23900&path=/trunk/Scribus/scribus/ui/storyeditor.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/storyeditor.cpp	(original)
+++ trunk/Scribus/scribus/ui/storyeditor.cpp	Mon Jun 22 10:20:30 2020
@@ -121,13 +121,7 @@
 	pal.setColor(QPalette::Window, QColor(255,255,255));
 	setAutoFillBackground(true);
 	setPalette(pal);
-	offs = 0;
-	currentPar = 0;
-	m_editor = nullptr;
-	noUpdt = true;
-	inRep = false;
 	pmen = new QMenu(this);
-	paraStyleAct = nullptr;
 	setMinimumWidth(fontMetrics().horizontalAdvance( tr("No Style") )+30);
 }
 
@@ -278,40 +272,16 @@
 	noUpdt = r;
 }
 
-SEditor::SEditor(QWidget* parent, ScribusDoc *docc, StoryEditor* parentSE) : QTextEdit(parent)
+SEditor::SEditor(QWidget* parent, ScribusDoc *docc, StoryEditor* parentSE) : 
+		QTextEdit(parent),
+		parentStoryEditor(parentSE)
 {
 	setCurrentDocument(docc);
-	parentStoryEditor = parentSE;
-	wasMod = false;
-	ready = false;
-	unicodeInputCount = 0;
-	CurrAlign = 0.0;
-	CurrDirection = 0.0;
-	CurrFontSize = 0.0;
-	CurrTextFillSh = 0.0;
-	CurrTextStrokeSh = 0.0;
-	CurrTextScaleH = 0.0;
-	CurrTextScaleV = 0.0;
-	CurrTextBase = 0.0;
-	CurrTextShadowX = 0.0;
-	CurrTextShadowY = 0.0;
-	CurrTextOutline = 0.0;
-	CurrTextUnderPos = 0.0;
-	CurrTextUnderWidth = 0.0;
-	CurrTextStrikePos = 0.0;
-	CurrTextStrikeWidth = 0.0;
-	CurrTextKern = 0.0;
-	SelCharStart = 0;
-	SelCharEnd = 0;
-	StyledText.clear();
 	document()->setUndoRedoEnabled(true);
 	viewport()->setAcceptDrops(false);
-	unicodeTextEditMode = false;
-	blockContentsChangeHook = 0;
 	setAutoFillBackground(true);
 	connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(ClipChange()));
 	connect(this->document(), SIGNAL(contentsChange(int, int, int)), this, SLOT(handleContentsChange(int, int, int)));
-	SuspendContentsChange = 0;
 }
 
 void SEditor::setCurrentDocument(ScribusDoc *docc)

Modified: trunk/Scribus/scribus/ui/storyeditor.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23900&path=/trunk/Scribus/scribus/ui/storyeditor.h
==============================================================================
--- trunk/Scribus/scribus/ui/storyeditor.h	(original)
+++ trunk/Scribus/scribus/ui/storyeditor.h	Mon Jun 22 10:20:30 2020
@@ -126,7 +126,6 @@
 	void setDirection(QTextCursor& tCursor, int style);
 	void setEffects(QTextCursor& tCursor, int effects);
 
-	int  blockContentsChangeHook;
 	void keyPressEvent(QKeyEvent *k);
 	void inputMethodEvent(QInputMethodEvent *event);
 	void focusOutEvent(QFocusEvent *e);
@@ -135,32 +134,33 @@
 	virtual bool canInsertFromMimeData( const QMimeData * source ) const;
 	virtual QMimeData * createMimeDataFromSelection () const;
 	virtual void insertFromMimeData ( const QMimeData * source );
-	StoryEditor* parentStoryEditor;
 
 	QList<PageItem*> FrameItems;
-	ScribusDoc* doc;
-	bool unicodeTextEditMode;
-	bool wasMod;
-	bool ready;
-	int unicodeInputCount;
+	ScribusDoc* doc { nullptr };
+	StoryEditor* parentStoryEditor { nullptr };
+	int  blockContentsChangeHook { 0 };
+	bool unicodeTextEditMode { false };
+	bool wasMod { false };
+	bool ready { false };
+	int unicodeInputCount { 0 };
 	StyleFlag CurrentEffects;
 	QString currentParaStyle;
-	int CurrAlign;
-	int CurrDirection;
-	double CurrFontSize;
-	double CurrTextFillSh;
-	double CurrTextStrokeSh;
-	double CurrTextScaleH;
-	double CurrTextScaleV;
-	double CurrTextBase;
-	double CurrTextShadowX;
-	double CurrTextShadowY;
-	double CurrTextOutline;
-	double CurrTextUnderPos;
-	double CurrTextUnderWidth;
-	double CurrTextStrikePos;
-	double CurrTextStrikeWidth;
-	double CurrTextKern;
+	int CurrAlign { 0 };
+	int CurrDirection { 0 };
+	double CurrFontSize { 0.0 };
+	double CurrTextFillSh { 0.0 };
+	double CurrTextStrokeSh { 0.0 };
+	double CurrTextScaleH { 0.0 };
+	double CurrTextScaleV { 0.0 };
+	double CurrTextBase { 0.0 };
+	double CurrTextShadowX { 0.0 };
+	double CurrTextShadowY { 0.0 };
+	double CurrTextOutline { 0.0 };
+	double CurrTextUnderPos { 0.0 };
+	double CurrTextUnderWidth { 0.0 };
+	double CurrTextStrikePos { 0.0 };
+	double CurrTextStrikeWidth { 0.0 };
+	double CurrTextKern { 0.0 };
 	QString CurrTextStroke;
 	QString CurrTextFill;
 	QString prevFont;
@@ -169,9 +169,9 @@
 
 	QStack< std::tuple<int, int, int> > SelStack;
 
-	int SelCharStart;
-	int SelCharEnd;
-	int SuspendContentsChange;	// input method
+	int SelCharStart { 0 };
+	int SelCharEnd { 0 };
+	int SuspendContentsChange { 0 };	// input method
 
 protected slots:
 	void handleContentsChange(int position, int charsRemoved, int charsAdded); 
@@ -201,19 +201,19 @@
 
 	void setEditor(SEditor* editor);
 
-	int offs;
-	int currentPar;
-	QMenu *pmen;
-	QWidgetAction* paraStyleAct;
-	bool noUpdt;
-	bool inRep;
+	int offs { 0 };
+	int currentPar { 0 };
+	QMenu *pmen { nullptr };
+	QWidgetAction* paraStyleAct { nullptr };
+	bool noUpdt { true };
+	bool inRep { false };
 
 protected:
 	void paintEvent(QPaintEvent *e);
 	void mouseReleaseEvent(QMouseEvent *m);
 
 private:
-	SEditor *m_editor;
+	SEditor *m_editor { nullptr };
 
 signals:
 	void ChangeStyle(int, const QString&);
@@ -240,12 +240,13 @@
 	virtual void changeEvent(QEvent *e);
 	
 	void setCurrentDocument(ScribusDoc *doc);
-	QLabel* FillIcon;
-	ColorCombo* TxFill;
-	ShadeButton *PM2;
-	QAction* pm2Action;
-	QAction* txFillAction;
-	QAction* fillIconAction;
+
+	QLabel* FillIcon { nullptr };
+	ColorCombo* TxFill { nullptr };
+	ShadeButton *PM2 { nullptr };
+	QAction* pm2Action { nullptr };
+	QAction* txFillAction { nullptr };
+	QAction* fillIconAction { nullptr };
 
 public slots:
 	void SetColor(int c);
@@ -269,12 +270,13 @@
 	virtual void changeEvent(QEvent *e);
 	
 	void setCurrentDocument(ScribusDoc *doc);
-	QLabel* StrokeIcon;
-	ColorCombo* TxStroke;
-	ShadeButton *PM1;
-	QAction* strokeIconAction;
-	QAction* txStrokeAction;
-	QAction* pm1Action;
+
+	QLabel* StrokeIcon { nullptr };
+	ColorCombo* TxStroke { nullptr };
+	ShadeButton *PM1 { nullptr };
+	QAction* strokeIconAction { nullptr };
+	QAction* txStrokeAction { nullptr };
+	QAction* pm1Action { nullptr };
 
 
 public slots:
@@ -298,12 +300,12 @@
 	
 	virtual void changeEvent(QEvent *e);
 	
-	StyleSelect* SeStyle;
-	QLabel* trackingLabel;
-	ScrSpinBox* Extra;
-	QAction* seStyleAction;
-	QAction* trackingLabelAction;
-	QAction* extraAction;
+	StyleSelect* SeStyle { nullptr };
+	QLabel* trackingLabel { nullptr };
+	ScrSpinBox* Extra { nullptr };
+	QAction* seStyleAction { nullptr };
+	QAction* trackingLabelAction { nullptr };
+	QAction* extraAction { nullptr };
 
 public slots:
 	void newStrikeHandler();
@@ -339,12 +341,12 @@
 	
 	virtual void changeEvent(QEvent *e);
 	
-	AlignSelect* GroupAlign;
-	DirectionSelect* GroupDirection;
-	ParaStyleComboBox *paraStyleCombo;
-	QAction* groupAlignAction;
-	QAction* groupDirectionAction;
-	QAction* paraStyleComboAction;
+	AlignSelect* GroupAlign { nullptr };
+	DirectionSelect* GroupDirection { nullptr };
+	ParaStyleComboBox *paraStyleCombo { nullptr };
+	QAction* groupAlignAction { nullptr };
+	QAction* groupDirectionAction { nullptr };
+	QAction* paraStyleComboAction { nullptr };
 
 public slots:
 	void SetAlign(int s);
@@ -368,12 +370,12 @@
 	
 	virtual void changeEvent(QEvent *e);
 	
-	FontCombo* Fonts;
-	ScrSpinBox* charScaleH;
-	ScrSpinBox* charScaleV;
-	QAction* fontsAction;
-	QAction* chScaleHAction;
-	QAction* chScaleVAction;
+	FontCombo* Fonts { nullptr };
+	ScrSpinBox* charScaleH { nullptr };
+	ScrSpinBox* charScaleV { nullptr };
+	QAction* fontsAction { nullptr };
+	QAction* chScaleHAction { nullptr };
+	QAction* chScaleVAction { nullptr };
 
 public slots:
 	void SetFont(const QString& f);
@@ -388,12 +390,12 @@
 	void newScaleV(double);
 
 private:
-	ScrSpinBox* Size;
-	QLabel*  lblScaleTxtH;
-	QLabel*  lblScaleTxtV;
-	QAction* sizeAction;
-	QAction* scaleTxtHAction;
-	QAction* scaleTxtVAction;
+	ScrSpinBox* Size { nullptr };
+	QLabel*  lblScaleTxtH { nullptr };
+	QLabel*  lblScaleTxtV { nullptr };
+	QAction* sizeAction { nullptr };
+	QAction* scaleTxtHAction { nullptr };
+	QAction* scaleTxtVAction { nullptr };
 
 private slots:
 	void iconSetChange();




More information about the scribus-commit mailing list