r22884 by jghali - #15596: remove the global variable ScMW

scribus-commit scribus-commit at lists.scribus.net
Mon Mar 11 12:42:40 UTC 2019


Author: jghali
Date: Mon Mar 11 12:42:40 2019
New Revision: 22884

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22884
Log:
#15596: remove the global variable ScMW

Modified:
    trunk/Scribus/scribus/gtaction.cpp
    trunk/Scribus/scribus/gtaction.h
    trunk/Scribus/scribus/gtwriter.cpp
    trunk/Scribus/scribus/gtwriter.h
    trunk/Scribus/scribus/main_nix.cpp
    trunk/Scribus/scribus/main_win32.cpp
    trunk/Scribus/scribus/pageitem.cpp
    trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
    trunk/Scribus/scribus/scribus.h
    trunk/Scribus/scribus/ui/multiprogressdialog.h

Modified: trunk/Scribus/scribus/gtaction.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22884&path=/trunk/Scribus/scribus/gtaction.cpp
==============================================================================
--- trunk/Scribus/scribus/gtaction.cpp	(original)
+++ trunk/Scribus/scribus/gtaction.cpp	Mon Mar 11 12:42:40 2019
@@ -53,23 +53,6 @@
 #include "ui/textpalette.h"
 #include "ui/propertiespalette_text.h"
 #include "ui/missing.h"
-
-
-
-// gtAction::gtAction(bool append)
-// {
-// 	prefsManager=PrefsManager::instance();
-// 	textFrame = ScMW->doc->m_Selection->itemAt(0);
-// 	it = textFrame;
-// 	lastParagraphStyle = -1;
-// 	inPara = false;
-// 	isFirstWrite = true;
-// 	lastCharWasLineChange = false;
-// 	currentFrameStyle = "";
-// 	doAppend = append;
-// 	updateParagraphStyles = false;
-// 	overridePStyleFont = true;
-// }
 
 gtAction::gtAction(bool append, PageItem* pageitem)
 {

Modified: trunk/Scribus/scribus/gtaction.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22884&path=/trunk/Scribus/scribus/gtaction.h
==============================================================================
--- trunk/Scribus/scribus/gtaction.h	(original)
+++ trunk/Scribus/scribus/gtaction.h	Mon Mar 11 12:42:40 2019
@@ -55,6 +55,34 @@
 
 class SCRIBUS_API gtAction
 {
+public:
+	gtAction(bool append, PageItem *pageitem);
+	~gtAction();
+
+	void setTextFrame(PageItem* frame);
+	void setProgressInfo();
+	void setProgressInfoDone();
+	void setInfo(const QString& infoText);
+	double getLineSpacing(int fontSize);
+	void clearFrame();
+	void getFrameFont(gtFont *font);
+	void getFrameStyle(gtFrameStyle *fstyle);
+	void write(const QString& text, gtStyle *style, bool isNote);
+	void writeUnstyled(const QString& text, bool isNote);
+	void applyFrameStyle(gtFrameStyle* fstyle);
+	void createParagraphStyle(gtParagraphStyle* pstyle);
+	void setCharStyleAttributes(gtFont *font, CharStyle& style);
+	void setParaStyleAttributes(gtParagraphStyle *gtstyle, ParagraphStyle& style);
+	void updateParagraphStyle(const QString& pstyleName, gtParagraphStyle* pstyle);
+	void removeParagraphStyle(const QString& name);
+	void removeParagraphStyle(int index);
+	double getFrameWidth();
+	QString getFrameName();
+	bool getUpdateParagraphStyles();
+	void setUpdateParagraphStyles(bool newUPS);
+	bool getOverridePStyleFont();
+	void setOverridePStyleFont(bool newOPSF);
+
 private:
 	UndoManager* m_undoManager;
 	ScribusMainWindow* m_ScMW;
@@ -86,33 +114,6 @@
 	PrefsManager *m_prefsManager;
 	StoryText* m_noteStory;
 	TextNote* m_note;
-public:
-//	gtAction(bool append);
-	gtAction(bool append, PageItem *pageitem);
-	~gtAction();
-	void setTextFrame(PageItem* frame);
-	void setProgressInfo();
-	void setProgressInfoDone();
-	void setInfo(const QString& infoText);
-	double getLineSpacing(int fontSize);
-	void clearFrame();
-	void getFrameFont(gtFont *font);
-	void getFrameStyle(gtFrameStyle *fstyle);
-	void write(const QString& text, gtStyle *style, bool isNote);
-	void writeUnstyled(const QString& text, bool isNote);
-	void applyFrameStyle(gtFrameStyle* fstyle);
-	void createParagraphStyle(gtParagraphStyle* pstyle);
-	void setCharStyleAttributes(gtFont *font, CharStyle& style);
-	void setParaStyleAttributes(gtParagraphStyle *gtstyle, ParagraphStyle& style);
-	void updateParagraphStyle(const QString& pstyleName, gtParagraphStyle* pstyle);
-	void removeParagraphStyle(const QString& name);
-	void removeParagraphStyle(int index);
-	double getFrameWidth();
-	QString getFrameName();
-	bool getUpdateParagraphStyles();
-	void setUpdateParagraphStyles(bool newUPS);
-	bool getOverridePStyleFont();
-	void setOverridePStyleFont(bool newOPSF);
 };
 
 #endif

Modified: trunk/Scribus/scribus/gtwriter.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22884&path=/trunk/Scribus/scribus/gtwriter.cpp
==============================================================================
--- trunk/Scribus/scribus/gtwriter.cpp	(original)
+++ trunk/Scribus/scribus/gtwriter.cpp	Mon Mar 11 12:42:40 2019
@@ -29,20 +29,6 @@
 
 #include "pageitem.h"
 #include "scribusstructs.h"
-
-// gtWriter::gtWriter(bool append)
-// {
-// 	action = new gtAction(append, ScMW->doc->m_Selection->itemAt(0));
-// 	errorSet = false;
-// 	action->setProgressInfo();
-// 	setDefaultStyle();
-// 	unsetCharacterStyle();
-// 	unsetParagraphStyle();
-// // 	if (!append)
-// // 		action->clearFrame();
-// // 	else
-// // 		this->append("\n");
-// }
 
 gtWriter::gtWriter(bool append, PageItem *pageitem)
 {

Modified: trunk/Scribus/scribus/gtwriter.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22884&path=/trunk/Scribus/scribus/gtwriter.h
==============================================================================
--- trunk/Scribus/scribus/gtwriter.h	(original)
+++ trunk/Scribus/scribus/gtwriter.h	Mon Mar 11 12:42:40 2019
@@ -38,9 +38,9 @@
 class SCRIBUS_API gtWriter 
 {
 public:
-// 	gtWriter(bool append);
 	gtWriter(bool append, PageItem *pageitem);
 	~gtWriter();
+
 	gtFrameStyle* getDefaultStyle();
 	void setFrameStyle(gtFrameStyle *fStyle);
 	void setParagraphStyle(gtParagraphStyle *pStyle);

Modified: trunk/Scribus/scribus/main_nix.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22884&path=/trunk/Scribus/scribus/main_nix.cpp
==============================================================================
--- trunk/Scribus/scribus/main_nix.cpp	(original)
+++ trunk/Scribus/scribus/main_nix.cpp	Mon Mar 11 12:42:40 2019
@@ -45,7 +45,6 @@
 static void defaultCrashHandler(int sig);
 
 ScribusCore SCRIBUS_API *ScCore;
-ScribusMainWindow SCRIBUS_API *ScMW;
 ScribusQApp SCRIBUS_API *ScQApp;
 bool emergencyActivated;
 
@@ -128,9 +127,13 @@
 		if (ScribusQApp::useGUI)
 		{
 			ScCore->closeSplash();
-			ScMessageBox::critical(ScMW, sigHdr, sigMsg);
-			ScMW->emergencySave();
-			ScMW->close();
+			ScribusMainWindow* mainWin = ScCore->primaryMainWindow();
+			if (mainWin)
+			{
+				ScMessageBox::critical(mainWin, sigHdr, sigMsg);
+				mainWin->emergencySave();
+				mainWin->close();
+			}
 		}
 		alarm(300);
 	}

Modified: trunk/Scribus/scribus/main_win32.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22884&path=/trunk/Scribus/scribus/main_win32.cpp
==============================================================================
--- trunk/Scribus/scribus/main_win32.cpp	(original)
+++ trunk/Scribus/scribus/main_win32.cpp	Mon Mar 11 12:42:40 2019
@@ -74,7 +74,6 @@
 extern const char ARG_CONSOLE_SHORT[];
 
 ScribusCore SCRIBUS_API *ScCore;
-ScribusMainWindow SCRIBUS_API *ScMW;
 ScribusQApp SCRIBUS_API *ScQApp;
 bool emergencyActivated;
 
@@ -301,9 +300,13 @@
 		if (ScribusQApp::useGUI)
 		{
 			ScCore->closeSplash();
-			ScMessageBox::critical(ScMW, expHdr, expMsg);
-			ScMW->emergencySave();
-			ScMW->close();
+			ScribusMainWindow* mainWin = ScCore->primaryMainWindow();
+			if (mainWin)
+			{
+				ScMessageBox::critical(mainWin, expHdr, expMsg);
+				mainWin->emergencySave();
+				mainWin->close();
+			}
 		}
 		ScImageCacheManager::instance().removeMasterLock();
 	}
@@ -337,11 +340,22 @@
 		if (ScribusQApp::useGUI)
 		{
 			ScCore->closeSplash();
-			QString expHdr = QObject::tr("Scribus Crash");
-			QString expMsg = msg;
-			ScMessageBox::critical(ScMW, expHdr, expMsg);
-			ScMW->emergencySave();
-			ScMW->close();
+			ScribusMainWindow* mainWin = ScCore->primaryMainWindow();
+			if (mainWin)
+			{
+				QString expHdr = QObject::tr("Scribus Crash");
+				QString expMsg = msg;
+				ScMessageBox::critical(mainWin, expHdr, expMsg);
+				mainWin->emergencySave();
+				mainWin->close();
+			}
+		}
+		else
+		{
+			cerr << "Fatal: " << localMsg.constData();
+			if (context.file && context.function)
+				cerr << "(" << context.file << ":" << context.line << ", " << context.function << ")";
+			cerr << endl;
 		}
 		ExitProcess(255);
 	}

Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22884&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp	(original)
+++ trunk/Scribus/scribus/pageitem.cpp	Mon Mar 11 12:42:40 2019
@@ -9604,7 +9604,7 @@
 void PageItem::drawLockedMarker(ScPainter *p)
 {
 	//TODO: CB clean
-	double scp1 = p->zoomFactor() ;// / ScMW->view->scale();
+	double scp1 = p->zoomFactor() ;
 	double ofwh = 6 * scp1;
 	double ofx = m_width - ofwh/2;
 	double ofy = m_height - ofwh*1.5;

Modified: trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22884&path=/trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp	(original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp	Mon Mar 11 12:42:40 2019
@@ -599,7 +599,7 @@
 		PyErr_Print();
 }
 
-void initscribus(ScribusMainWindow *pl)
+void initscribus(ScribusMainWindow *mainWin)
 {
 	if (!scripterCore)
 	{
@@ -838,7 +838,6 @@
 	else
 		qDebug("Couldn't parse version string '%s' in scripter", VERSION);
 
-// 	ScMW = pl;
 	// Function aliases for compatibility
 	// We need to import the __builtins__, warnings and exceptions modules to be able to run
 	// the generated Python functions from inside the `scribus' module's context.
@@ -932,10 +931,10 @@
 	Py_DECREF(wrappedQApp);
 	wrappedQApp = nullptr;
 
-	wrappedMainWindow = wrapQObject(pl);
+	wrappedMainWindow = wrapQObject(mainWin);
 	if (!wrappedMainWindow)
 	{
-		qDebug("Failed to wrap up ScMW");
+		qDebug("Failed to wrap up ScribusMainWindow");
 		PyErr_Print();
 	}
 	// Push it into the module dict, stealing a ref in the process

Modified: trunk/Scribus/scribus/scribus.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22884&path=/trunk/Scribus/scribus/scribus.h
==============================================================================
--- trunk/Scribus/scribus/scribus.h	(original)
+++ trunk/Scribus/scribus/scribus.h	Mon Mar 11 12:42:40 2019
@@ -420,7 +420,7 @@
 	\author Craig Bradney
 	\date Sun 30 Jan 2005
 	\brief Zoom the view.
-	Take the ScMW zoom actions and pass the view a %. Actions have whole number values like 20.0, 100.0, etc. Zoom to Fit uses -100 as a marker.
+	Take the main window zoom actions and pass the view a %. Actions have whole number values like 20.0, 100.0, etc. Zoom to Fit uses -100 as a marker.
 	\param zoomFactor Value stored in the ScrAction.
 	 */
 	void slotZoom(double zoomFactor); // 20, 50, 100, or -100 for Fit

Modified: trunk/Scribus/scribus/ui/multiprogressdialog.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22884&path=/trunk/Scribus/scribus/ui/multiprogressdialog.h
==============================================================================
--- trunk/Scribus/scribus/ui/multiprogressdialog.h	(original)
+++ trunk/Scribus/scribus/ui/multiprogressdialog.h	Mon Mar 11 12:42:40 2019
@@ -52,7 +52,7 @@
 		 * one standard progress bar, typically for the overall progress and others may be added easily.
 		 * @param titleText Title of the dialog
 		 * @param cancelButtonText Text of the cancel button.. Cancel, Close, @sa CommontStrings::
-		 * @param parent Parent widget for the dialog, commonly ScMW
+		 * @param parent Parent widget for the dialog, commonly ScribusMainWindow
 		 * @param f Qt GUI flags
 		 */
 		MultiProgressDialog(const QString& titleText, const QString & cancelButtonText, QWidget* parent=0);




More information about the scribus-commit mailing list