r18905 by craig - Move haveNewDoc action enabling to appModeHelper. Disable MenuManager::setMenuEnabled to ensure consistent experience on all platforms as OSX does not allow it

scribus-commit scribus-commit at lists.scribus.net
Wed Mar 12 21:33:12 UTC 2014


Author: craig
Date: Wed Mar 12 21:33:12 2014
New Revision: 18905

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18905
Log:
Move haveNewDoc action enabling to appModeHelper. Disable MenuManager::setMenuEnabled to ensure consistent experience on all platforms as OSX does not allow it

Modified:
    trunk/Scribus/scribus/appmodehelper.cpp
    trunk/Scribus/scribus/appmodehelper.h
    trunk/Scribus/scribus/menumanager.cpp
    trunk/Scribus/scribus/scribus.cpp

Modified: trunk/Scribus/scribus/appmodehelper.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18905&path=/trunk/Scribus/scribus/appmodehelper.cpp
==============================================================================
--- trunk/Scribus/scribus/appmodehelper.cpp (original)
+++ trunk/Scribus/scribus/appmodehelper.cpp Wed Mar 12 21:33:12 2014
@@ -234,6 +234,96 @@
 	(*scrActions)["toolsPDFAnnotLink"]->setEnabled(setter);
 }
 
+void AppModeHelper::mainWindowHasNewDoc(ScribusDoc *doc, bool clipScrapHaveData)
+{
+	(*scrActions)["filePrint"]->setEnabled(true);
+	(*scrActions)["fileSave"]->setEnabled(!doc->isConverted);
+	(*scrActions)["fileClose"]->setEnabled(true);
+	(*scrActions)["fileDocSetup150"]->setEnabled(true);
+	(*scrActions)["fileRevert"]->setEnabled(false);
+	(*scrActions)["fileCollect"]->setEnabled(true);
+	(*scrActions)["fileSaveAs"]->setEnabled(true);
+	(*scrActions)["fileExportAsEPS"]->setEnabled(true);
+	(*scrActions)["fileExportAsPDF"]->setEnabled(true);
+	(*scrActions)["pageImport"]->setEnabled(true);
+
+	if ( ScCore->haveGS() || ScCore->isWinGUI() )
+		(*scrActions)["PrintPreview"]->setEnabled(true);
+
+	if ((*scrActions)["SaveAsDocumentTemplate"])
+		(*scrActions)["SaveAsDocumentTemplate"]->setEnabled(true);
+
+	(*scrActions)["editCut"]->setEnabled(false);
+	(*scrActions)["editCopy"]->setEnabled(false);
+	(*scrActions)["editPaste"]->setEnabled(clipScrapHaveData);
+	(*scrActions)["editCopyContents"]->setEnabled(false);
+	(*scrActions)["editPasteContents"]->setEnabled(false);
+	(*scrActions)["editPasteContentsAbs"]->setEnabled(false);
+	(*scrActions)["editSelectAll"]->setEnabled(true);
+	(*scrActions)["editSelectAllOnLayer"]->setEnabled(true);
+	(*scrActions)["editDeselectAll"]->setEnabled(false);
+	(*scrActions)["editReplaceColors"]->setEnabled(true);
+	(*scrActions)["editStyles"]->setEnabled(true);
+	(*scrActions)["editMarks"]->setEnabled(true);
+	(*scrActions)["editNotesStyles"]->setEnabled(true);
+	(*scrActions)["editMasterPages"]->setEnabled(true);
+	(*scrActions)["editJavascripts"]->setEnabled(true);
+
+	(*scrActions)["viewFitInWindow"]->setEnabled(true);
+	(*scrActions)["viewFitWidth"]->setEnabled(true);
+	(*scrActions)["viewFit50"]->setEnabled(true);
+	(*scrActions)["viewFit75"]->setEnabled(true);
+	(*scrActions)["viewFit100"]->setEnabled(true);
+	(*scrActions)["viewFit200"]->setEnabled(true);
+	(*scrActions)["viewFit400"]->setEnabled(true);
+
+	(*scrActions)["viewSnapToGrid"]->setChecked(doc->SnapGrid);
+	(*scrActions)["viewSnapToGuides"]->setChecked(doc->SnapGuides);
+	(*scrActions)["viewSnapToElements"]->setChecked(doc->SnapElement);
+	(*scrActions)["viewShowRulers"]->setEnabled(true);
+
+	(*scrActions)["insertFrame"]->setEnabled(true);
+
+	(*scrActions)["toolsSelect"]->setEnabled(true);
+	(*scrActions)["toolsZoom"]->setEnabled(true);
+	(*scrActions)["toolsInsertTextFrame"]->setEnabled(true);
+	(*scrActions)["toolsInsertImageFrame"]->setEnabled(true);
+	(*scrActions)["toolsInsertTable"]->setEnabled(true);
+	(*scrActions)["toolsInsertShape"]->setEnabled(true);
+	(*scrActions)["toolsInsertLine"]->setEnabled(true);
+	(*scrActions)["toolsInsertBezier"]->setEnabled(true);
+	(*scrActions)["toolsInsertFreehandLine"]->setEnabled(true);
+	(*scrActions)["toolsInsertCalligraphicLine"]->setEnabled(true);
+	(*scrActions)["toolsInsertPolygon"]->setEnabled(true);
+	(*scrActions)["toolsInsertArc"]->setEnabled(true);
+	(*scrActions)["toolsInsertSpiral"]->setEnabled(true);
+	(*scrActions)["toolsInsertRenderFrame"]->setEnabled(true);
+	(*scrActions)["toolsMeasurements"]->setEnabled(true);
+	(*scrActions)["toolsEyeDropper"]->setEnabled(true);
+	(*scrActions)["toolsPDFPushButton"]->setEnabled(true);
+	(*scrActions)["toolsPDFRadioButton"]->setEnabled(true);
+	(*scrActions)["toolsPDFTextField"]->setEnabled(true);
+	(*scrActions)["toolsPDFCheckBox"]->setEnabled(true);
+	(*scrActions)["toolsPDFComboBox"]->setEnabled(true);
+	(*scrActions)["toolsPDFListBox"]->setEnabled(true);
+	(*scrActions)["toolsPDFAnnotText"]->setEnabled(true);
+	(*scrActions)["toolsPDFAnnotLink"]->setEnabled(true);
+#ifdef HAVE_OSG
+	(*scrActions)["toolsPDFAnnot3D"]->setEnabled(true);
+#endif
+
+	bool setter = doc->DocPages.count() > 1 ? true : false;
+	(*scrActions)["pageDelete"]->setEnabled(setter);
+	(*scrActions)["pageMove"]->setEnabled(setter);
+	(*scrActions)["pageInsert"]->setEnabled(true);
+	(*scrActions)["pageImport"]->setEnabled(true);
+	(*scrActions)["pageCopy"]->setEnabled(true);
+	(*scrActions)["pageApplyMasterPage"]->setEnabled(true);
+	(*scrActions)["pageCopyToMasterPage"]->setEnabled(true);
+	(*scrActions)["pageManageGuides"]->setEnabled(true);
+	(*scrActions)["pageManageMargins"]->setEnabled(true);
+}
+
 void AppModeHelper::enableTextActions(bool enabled, const QString& fontName)
 {
 	(*scrActions)["insertGlyph"]->setEnabled(enabled);

Modified: trunk/Scribus/scribus/appmodehelper.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18905&path=/trunk/Scribus/scribus/appmodehelper.h
==============================================================================
--- trunk/Scribus/scribus/appmodehelper.h (original)
+++ trunk/Scribus/scribus/appmodehelper.h Wed Mar 12 21:33:12 2014
@@ -39,6 +39,7 @@
 		void setInlineEditMode(bool b, ScribusDoc* doc);
 		void setMasterPageEditMode(bool b, ScribusDoc *doc);
 		void changeLayer(ScribusDoc *doc, bool clipScrapHaveData);
+		void mainWindowHasNewDoc(ScribusDoc *doc, bool clipScrapHaveData);
 		//! \brief enable or disable the unicode actions and their menus
 		void enableTextActions(bool enabled, const QString& fontName=QString::null);
 

Modified: trunk/Scribus/scribus/menumanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18905&path=/trunk/Scribus/scribus/menumanager.cpp
==============================================================================
--- trunk/Scribus/scribus/menumanager.cpp (original)
+++ trunk/Scribus/scribus/menumanager.cpp Wed Mar 12 21:33:12 2014
@@ -86,8 +86,10 @@
 
 void MenuManager::setMenuEnabled(const QString &menuName, const bool enabled)
 {
-	if (menuBarMenus.contains(menuName) && menuBarMenus.value(menuName)!=NULL)
-		menuBarMenus.value(menuName)->setEnabled(enabled);
+	return;
+	// OSX UI rules don't allow this so let's not do it elsewhere.
+	//if (menuBarMenus.contains(menuName) && menuBarMenus.value(menuName)!=NULL)
+	//	menuBarMenus.value(menuName)->setEnabled(enabled);
 }
 
 bool MenuManager::addMenuStringToMenuBar(const QString &menuName, bool rememberMenu)

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18905&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Wed Mar 12 21:33:12 2014
@@ -2519,106 +2519,7 @@
 
 void ScribusMainWindow::HaveNewDoc()
 {
-	scrActions["filePrint"]->setEnabled(true);
-	scrActions["fileSave"]->setEnabled(!doc->isConverted);
-	scrActions["fileClose"]->setEnabled(true);
-//	scrActions["fileDocSetup"]->setEnabled(true);
-	scrActions["fileDocSetup150"]->setEnabled(true);
-	scrActions["fileRevert"]->setEnabled(false);
-	scrActions["fileCollect"]->setEnabled(true);
-	scrActions["fileSaveAs"]->setEnabled(true);
-	scrMenuMgr->setMenuEnabled("FileImport", true);
-	scrMenuMgr->setMenuEnabled("FileExport", true);
-	scrActions["fileExportAsEPS"]->setEnabled(true);
-	scrActions["fileExportAsPDF"]->setEnabled(true);
-	scrActions["pageImport"]->setEnabled(true);
-	//scrActions["toolsPreflightVerifier"]->setEnabled(true);
-
-	if ( ScCore->haveGS() || ScCore->isWinGUI() )
-		scrActions["PrintPreview"]->setEnabled(true);
-
-	if (scrActions["SaveAsDocumentTemplate"])
-		scrActions["SaveAsDocumentTemplate"]->setEnabled(true);
-
-	scrActions["editCut"]->setEnabled(false);
-	scrActions["editCopy"]->setEnabled(false);
-	scrActions["editPaste"]->setEnabled((ScMimeData::clipboardHasScribusData()) || (scrapbookPalette->tempBView->objectMap.count() > 0));
-	scrMenuMgr->setMenuEnabled("EditPasteRecent", scrapbookPalette->tempBView->objectMap.count() > 0);
-	scrMenuMgr->setMenuEnabled("EditContents", false);
-	scrActions["editCopyContents"]->setEnabled(false);
-	scrActions["editPasteContents"]->setEnabled(false);
-	scrActions["editPasteContentsAbs"]->setEnabled(false);
-	scrActions["editSelectAll"]->setEnabled(true);
-	scrActions["editSelectAllOnLayer"]->setEnabled(true);
-	scrActions["editDeselectAll"]->setEnabled(false);
-	scrActions["editReplaceColors"]->setEnabled(true);
-//	scrActions["editPatterns"]->setEnabled(true);
-//	scrActions["editGradients"]->setEnabled(true);
- 	scrActions["editStyles"]->setEnabled(true);
-	scrActions["editMarks"]->setEnabled(true);
-	scrActions["editNotesStyles"]->setEnabled(true);
-	scrActions["editMasterPages"]->setEnabled(true);
-	scrActions["editJavascripts"]->setEnabled(true);
-
-//	scrMenuMgr->setMenuEnabled("View", true);
-	scrActions["viewFitInWindow"]->setEnabled(true);
-	scrActions["viewFitWidth"]->setEnabled(true);
-	scrActions["viewFit50"]->setEnabled(true);
-	scrActions["viewFit75"]->setEnabled(true);
-	scrActions["viewFit100"]->setEnabled(true);
-	scrActions["viewFit200"]->setEnabled(true);
-	scrActions["viewFit400"]->setEnabled(true);
-
-	scrActions["viewSnapToGrid"]->setChecked(doc->SnapGrid);
-	scrActions["viewSnapToGuides"]->setChecked(doc->SnapGuides);
-	scrActions["viewSnapToElements"]->setChecked(doc->SnapElement);
-	scrActions["viewShowRulers"]->setEnabled(true);
-
-	scrMenuMgr->setMenuEnabled("Insert", true);
-	scrActions["insertFrame"]->setEnabled(true);
-	//scrMenuMgr->setMenuEnabled("Windows", true);
-//	scrMenuMgr->setMenuEnabled("Page", true);
-	//scrMenuMgr->setMenuEnabled("Extras", true);
-
-	scrActions["toolsSelect"]->setEnabled(true);
-	scrActions["toolsZoom"]->setEnabled(true);
-	scrActions["toolsInsertTextFrame"]->setEnabled(true);
-	scrActions["toolsInsertImageFrame"]->setEnabled(true);
-	scrActions["toolsInsertTable"]->setEnabled(true);
-	scrActions["toolsInsertShape"]->setEnabled(true);
-	scrActions["toolsInsertLine"]->setEnabled(true);
-	scrActions["toolsInsertBezier"]->setEnabled(true);
-	scrActions["toolsInsertFreehandLine"]->setEnabled(true);
-	scrActions["toolsInsertCalligraphicLine"]->setEnabled(true);
-	scrActions["toolsInsertPolygon"]->setEnabled(true);
-	scrActions["toolsInsertArc"]->setEnabled(true);
-	scrActions["toolsInsertSpiral"]->setEnabled(true);
-	scrActions["toolsInsertRenderFrame"]->setEnabled(true);
-	scrActions["toolsMeasurements"]->setEnabled(true);
-	scrActions["toolsEyeDropper"]->setEnabled(true);
-	scrActions["toolsPDFPushButton"]->setEnabled(true);
-	scrActions["toolsPDFRadioButton"]->setEnabled(true);
-	scrActions["toolsPDFTextField"]->setEnabled(true);
-	scrActions["toolsPDFCheckBox"]->setEnabled(true);
-	scrActions["toolsPDFComboBox"]->setEnabled(true);
-	scrActions["toolsPDFListBox"]->setEnabled(true);
-	scrActions["toolsPDFAnnotText"]->setEnabled(true);
-	scrActions["toolsPDFAnnotLink"]->setEnabled(true);
-#ifdef HAVE_OSG
-	scrActions["toolsPDFAnnot3D"]->setEnabled(true);
-#endif
-
-	bool setter = doc->DocPages.count() > 1 ? true : false;
-	scrActions["pageDelete"]->setEnabled(setter);
-	scrActions["pageMove"]->setEnabled(setter);
-	scrActions["pageInsert"]->setEnabled(true);
-	scrActions["pageImport"]->setEnabled(true);
-	scrActions["pageCopy"]->setEnabled(true);
-	scrActions["pageApplyMasterPage"]->setEnabled(true);
-	scrActions["pageCopyToMasterPage"]->setEnabled(true);
-	scrActions["pageManageGuides"]->setEnabled(true);
-	scrActions["pageManageMargins"]->setEnabled(true);
-	scrMenuMgr->setMenuEnabled("ItemLayer", doc->layerCount() > 1);
+	appModeHelper.mainWindowHasNewDoc(doc, (ScMimeData::clipboardHasScribusData()) || (scrapbookPalette->tempHasContents()));
 
 	//Update palettes
 	updateActiveWindowCaption(doc->DocName);




More information about the scribus-commit mailing list