r18914 by craig - Move main window doc switching action code to AppModeHelper, fix #12144: Reorder Marks menu
scribus-commit
scribus-commit at lists.scribus.net
Sat Mar 15 16:49:34 UTC 2014
Author: craig
Date: Sat Mar 15 16:49:33 2014
New Revision: 18914
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18914
Log:
Move main window doc switching action code to AppModeHelper, fix #12144: Reorder Marks menu
Modified:
trunk/Scribus/scribus/appmodehelper.cpp
trunk/Scribus/scribus/appmodehelper.h
trunk/Scribus/scribus/scribus.cpp
Modified: trunk/Scribus/scribus/appmodehelper.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18914&path=/trunk/Scribus/scribus/appmodehelper.cpp
==============================================================================
--- trunk/Scribus/scribus/appmodehelper.cpp (original)
+++ trunk/Scribus/scribus/appmodehelper.cpp Sat Mar 15 16:49:33 2014
@@ -324,6 +324,82 @@
(*scrActions)["pageManageMargins"]->setEnabled(true);
}
+void AppModeHelper::mainWindowSwitchWin(ScribusDoc *doc)
+{
+ (*scrActions)["fileClose"]->setEnabled(true);
+ if (doc->masterPageMode() || doc->symbolEditMode() || doc->inlineEditMode())
+ {
+ (*scrActions)["pageInsert"]->setEnabled(false);
+ (*scrActions)["pageDelete"]->setEnabled(false);
+ (*scrActions)["pageCopy"]->setEnabled(false);
+ (*scrActions)["pageMove"]->setEnabled(false);
+ (*scrActions)["pageApplyMasterPage"]->setEnabled(false);
+ (*scrActions)["pageCopyToMasterPage"]->setEnabled(false);
+ (*scrActions)["editMasterPages"]->setEnabled(false);
+ (*scrActions)["fileNew"]->setEnabled(false);
+ (*scrActions)["fileNewFromTemplate"]->setEnabled(false);
+ if (doc->symbolEditMode() || doc->inlineEditMode())
+ {
+ (*scrActions)["fileCollect"]->setEnabled(false);
+ (*scrActions)["fileSaveAs"]->setEnabled(false);
+ (*scrActions)["fileExportAsEPS"]->setEnabled(false);
+ (*scrActions)["fileExportAsPDF"]->setEnabled(false);
+ (*scrActions)["fileSave"]->setEnabled(false);
+ }
+ else
+ (*scrActions)["fileSave"]->setEnabled(!doc->isConverted);
+ (*scrActions)["fileOpen"]->setEnabled(false);
+ (*scrActions)["fileRevert"]->setEnabled(false);
+ (*scrActions)["toolsPDFPushButton"]->setEnabled(false);
+ (*scrActions)["toolsPDFRadioButton"]->setEnabled(false);
+ (*scrActions)["toolsPDFTextField"]->setEnabled(false);
+ (*scrActions)["toolsPDFCheckBox"]->setEnabled(false);
+ (*scrActions)["toolsPDFComboBox"]->setEnabled(false);
+ (*scrActions)["toolsPDFListBox"]->setEnabled(false);
+ (*scrActions)["toolsPDFAnnotText"]->setEnabled(false);
+#ifdef HAVE_OSG
+ (*scrActions)["toolsPDFAnnot3D"]->setEnabled(false);
+#endif
+ }
+ else
+ {
+ (*scrActions)["editMasterPages"]->setEnabled(true);
+ (*scrActions)["fileNew"]->setEnabled(true);
+ (*scrActions)["fileNewFromTemplate"]->setEnabled(true);
+ (*scrActions)["fileOpen"]->setEnabled(true);
+ (*scrActions)["fileClose"]->setEnabled(true);
+ (*scrActions)["fileSave"]->setEnabled(!doc->isConverted);
+ (*scrActions)["fileRevert"]->setEnabled(false);
+
+ if (!doc->isModified())
+ {
+ 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);
+
+ (*scrActions)["fileSaveAs"]->setEnabled(true);
+ (*scrActions)["fileCollect"]->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);
+#ifdef HAVE_OSG
+ (*scrActions)["toolsPDFAnnot3D"]->setEnabled(true);
+#endif
+ }
+}
+
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=18914&path=/trunk/Scribus/scribus/appmodehelper.h
==============================================================================
--- trunk/Scribus/scribus/appmodehelper.h (original)
+++ trunk/Scribus/scribus/appmodehelper.h Sat Mar 15 16:49:33 2014
@@ -40,6 +40,7 @@
void setMasterPageEditMode(bool b, ScribusDoc *doc);
void changeLayer(ScribusDoc *doc, bool clipScrapHaveData);
void mainWindowHasNewDoc(ScribusDoc *doc, bool clipScrapHaveData);
+ void mainWindowSwitchWin(ScribusDoc *doc);
//! \brief enable or disable the unicode actions and their menus
void enableTextActions(bool enabled, const QString& fontName=QString::null);
Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18914&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Sat Mar 15 16:49:33 2014
@@ -996,9 +996,9 @@
scrMenuMgr->createMenu("InsertMark", tr("Marks"), "Insert");
scrMenuMgr->addMenuItemString("InsertMark", "Insert");
scrMenuMgr->addMenuItemString("insertMarkAnchor", "InsertMark");
+ scrMenuMgr->addMenuItemString("insertMark2Mark", "InsertMark");
+ scrMenuMgr->addMenuItemString("insertMarkItem", "InsertMark");
scrMenuMgr->addMenuItemString("insertMarkVariableText", "InsertMark");
- scrMenuMgr->addMenuItemString("insertMarkItem", "InsertMark");
- scrMenuMgr->addMenuItemString("insertMark2Mark", "InsertMark");
scrMenuMgr->addMenuItemString("insertMarkNote", "InsertMark");
//Page menu
@@ -2433,88 +2433,17 @@
doc->appMode = modeNormal;
view->requestMode(submodeEndNodeEdit);
} */
- scrActions["fileClose"]->setEnabled(true);
+ appModeHelper.mainWindowSwitchWin(doc);
+
if (doc->masterPageMode() || doc->symbolEditMode() || doc->inlineEditMode())
- {
- scrActions["pageInsert"]->setEnabled(false);
- scrActions["pageDelete"]->setEnabled(false);
- scrActions["pageCopy"]->setEnabled(false);
- scrActions["pageMove"]->setEnabled(false);
- scrActions["pageApplyMasterPage"]->setEnabled(false);
- scrActions["pageCopyToMasterPage"]->setEnabled(false);
- scrActions["editMasterPages"]->setEnabled(false);
- scrActions["fileNew"]->setEnabled(false);
- scrActions["fileNewFromTemplate"]->setEnabled(false);
- if (doc->symbolEditMode() || doc->inlineEditMode())
- {
- scrActions["fileCollect"]->setEnabled(false);
- scrActions["fileSaveAs"]->setEnabled(false);
- scrMenuMgr->setMenuEnabled("FileExport", false);
- scrActions["fileExportAsEPS"]->setEnabled(false);
- scrActions["fileExportAsPDF"]->setEnabled(false);
- scrActions["fileSave"]->setEnabled(false);
- }
- else
- scrActions["fileSave"]->setEnabled(!doc->isConverted);
- scrActions["fileOpen"]->setEnabled(false);
- scrActions["fileRevert"]->setEnabled(false);
- scrMenuMgr->setMenuEnabled("FileOpenRecent", false);
pagePalette->enablePalette(false);
- scrActions["toolsPDFPushButton"]->setEnabled(false);
- scrActions["toolsPDFRadioButton"]->setEnabled(false);
- scrActions["toolsPDFTextField"]->setEnabled(false);
- scrActions["toolsPDFCheckBox"]->setEnabled(false);
- scrActions["toolsPDFComboBox"]->setEnabled(false);
- scrActions["toolsPDFListBox"]->setEnabled(false);
- scrActions["toolsPDFAnnotText"]->setEnabled(false);
-#ifdef HAVE_OSG
- scrActions["toolsPDFAnnot3D"]->setEnabled(false);
-#endif
- }
else
{
- scrActions["editMasterPages"]->setEnabled(true);
- scrActions["fileNew"]->setEnabled(true);
- scrActions["fileNewFromTemplate"]->setEnabled(true);
- scrActions["fileOpen"]->setEnabled(true);
- scrActions["fileClose"]->setEnabled(true);
- scrActions["fileSave"]->setEnabled(!doc->isConverted);
- scrActions["fileRevert"]->setEnabled(false);
- scrMenuMgr->setMenuEnabled("FileOpenRecent", true);
-
if (doc->isModified())
slotDocCh(false);
- else
- {
- bool setter = doc->DocPages.count() > 1 ? true : false;
- scrActions["pageDelete"]->setEnabled(setter);
- scrActions["pageMove"]->setEnabled(setter);
- }
-// scrMenuMgr->setMenuEnabled("Page", true);
- 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);
-
- scrActions["fileSaveAs"]->setEnabled(true);
- scrActions["fileCollect"]->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);
-#ifdef HAVE_OSG
- scrActions["toolsPDFAnnot3D"]->setEnabled(true);
-#endif
pagePalette->enablePalette(true);
setPreviewToolbar();
}
- scrMenuMgr->setMenuEnabled("ItemLayer", doc->layerCount() > 1);
}
void ScribusMainWindow::HaveNewDoc()
More information about the scribus-commit
mailing list