r22954 by craig - CLean up master page mode switching code a little

scribus-commit scribus-commit at lists.scribus.net
Mon Apr 15 21:48:42 UTC 2019


Author: craig
Date: Mon Apr 15 21:48:42 2019
New Revision: 22954

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22954
Log:
CLean up master page mode switching code a little

Modified:
    trunk/Scribus/scribus/scribusdoc.cpp
    trunk/Scribus/scribus/scribusdoc.h

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22954&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp	(original)
+++ trunk/Scribus/scribus/scribusdoc.cpp	Mon Apr 15 21:48:42 2019
@@ -5420,6 +5420,7 @@
 	}
 	
 	Items->append(newItem);
+
 	if (UndoManager::undoEnabled())
 	{
 		ScItemState<PageItem*> *is = new ScItemState<PageItem*>("Create PageItem");
@@ -6566,7 +6567,13 @@
 {
 	if (changeToMasterPageMode == m_masterPageMode)
 		return;
-	if (changeToMasterPageMode)
+	m_masterPageMode = changeToMasterPageMode;
+	assignPageModeLists();
+}
+
+void ScribusDoc::assignPageModeLists()
+{
+	if (m_masterPageMode)
 	{
 		Pages = &MasterPages;
 		Items = &MasterItems;
@@ -6576,7 +6583,6 @@
 		Pages = &DocPages;
 		Items = &DocItems;
 	}
-	m_masterPageMode = changeToMasterPageMode;
 }
 
 void ScribusDoc::setSymbolEditMode(bool mode, const QString& symbolName)
@@ -6711,16 +6717,7 @@
 				docPatterns[m_ScMW->patternsDependingOnThis[a]].pattern = currItem->DrawObj_toImage(qMin(qMax(x2 - x1, y2 - y1), 500.0));
 			}
 		}
-		if (masterPageMode())
-		{
-			Pages = &MasterPages;
-			Items = &MasterItems;
-		}
-		else
-		{
-			Pages = &DocPages;
-			Items = &DocItems;
-		}
+		assignPageModeLists();
 		delete addedPage;
 		setActiveLayer(m_storedLayerID);
 		setLayerVisible(m_storedLayerID, m_storedLayerVis);
@@ -6854,16 +6851,7 @@
 			currItem->inlineCharID = m_currentEditedIFrame;
 			FrameItems[m_currentEditedIFrame] = currItem;
 		}
-		if (masterPageMode())
-		{
-			Pages = &MasterPages;
-			Items = &MasterItems;
-		}
-		else
-		{
-			Pages = &DocPages;
-			Items = &DocItems;
-		}
+		assignPageModeLists();
 		delete addedPage;
 		EditFrameItems.clear();
 		setActiveLayer(m_storedLayerID);

Modified: trunk/Scribus/scribus/scribusdoc.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22954&path=/trunk/Scribus/scribus/scribusdoc.h
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.h	(original)
+++ trunk/Scribus/scribus/scribusdoc.h	Mon Apr 15 21:48:42 2019
@@ -123,9 +123,9 @@
 	const ScGuardedPtr<ScribusDoc>& guardedPtr() const;
 	
 	UpdateManager* updateManager() { return &m_updateManager; }
-	MassObservable<PageItem*> * itemsChanged() { return &m_itemsChanged; }
-	MassObservable<ScPage*>     * pagesChanged() { return &m_pagesChanged; }
-	MassObservable<QRectF>    * regionsChanged() { return &m_regionsChanged; }
+	MassObservable<PageItem*>* itemsChanged() { return &m_itemsChanged; }
+	MassObservable<ScPage*>* pagesChanged() { return &m_pagesChanged; }
+	MassObservable<QRectF>* regionsChanged() { return &m_regionsChanged; }
 	
 	void invalidateAll();
 	void invalidateLayer(int layerID);
@@ -915,6 +915,7 @@
 	 * Do we need to return if the move to master page mode was successful?
 	 */
 	void setMasterPageMode(bool);
+	void assignPageModeLists();
 
 	/*** Is the document in master page mode? */
 	bool masterPageMode() const { return m_masterPageMode; }
@@ -1259,6 +1260,7 @@
 	QList<PageItem*> DocItems;
 	QHash<int, PageItem*> FrameItems;
 	QList<PageItem*> EditFrameItems;
+
 	Selection* const m_Selection;
 	/** \brief Number of Columns */
 	double PageSp;




More information about the scribus-commit mailing list