r19575 by craig - Move appmode/selected item code from ScribusMainWindow::HaveNewSel to new function in AppModeHelper

scribus-commit scribus-commit at lists.scribus.net
Sun Oct 12 06:14:40 UTC 2014


Author: craig
Date: Sun Oct 12 06:14:40 2014
New Revision: 19575

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19575
Log:
Move appmode/selected item code from ScribusMainWindow::HaveNewSel to new function in AppModeHelper

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

Modified: trunk/Scribus/scribus/appmodehelper.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19575&path=/trunk/Scribus/scribus/appmodehelper.cpp
==============================================================================
--- trunk/Scribus/scribus/appmodehelper.cpp (original)
+++ trunk/Scribus/scribus/appmodehelper.cpp Sun Oct 12 06:14:40 2014
@@ -354,6 +354,429 @@
 	emit AppModeChanged(oldMode, newMode);
 	a_actMgr->connectModeActions();
 	PluginManager::instance().enablePluginActionsForSelection(scmw);
+}
+
+void AppModeHelper::enableActionsForSelection(ScribusMainWindow* scmw, ScribusDoc* doc)
+{
+	int SelectedType = -1;
+	PageItem *currItem = NULL;
+	const uint docSelectionCount = doc->m_Selection->count();
+	if (docSelectionCount > 0)
+	{
+		currItem = doc->m_Selection->itemAt(0);
+		SelectedType = currItem->itemType();
+	}
+	assert (docSelectionCount == 0 || currItem != NULL); // help coverity analysis
+
+	bool inAnEditMode=doc->inAnEditMode();
+	switch (SelectedType)
+	{
+		case -1: // None
+			(*a_scrActions)["fileImportText"]->setEnabled(false);
+			(*a_scrActions)["fileImportText2"]->setEnabled(false);
+			(*a_scrActions)["fileImportImage"]->setEnabled(false);
+			(*a_scrActions)["fileImportAppendText"]->setEnabled(false);
+			(*a_scrActions)["fileExportText"]->setEnabled(false);
+			(*a_scrActions)["itemDuplicate"]->setEnabled(false);
+			(*a_scrActions)["itemMulDuplicate"]->setEnabled(false);
+			(*a_scrActions)["itemTransform"]->setEnabled(false);
+			(*a_scrActions)["itemDelete"]->setEnabled(false);
+			(*a_scrActions)["itemRaise"]->setEnabled(false);
+			(*a_scrActions)["itemLower"]->setEnabled(false);
+			(*a_scrActions)["itemRaiseToTop"]->setEnabled(false);
+			(*a_scrActions)["itemLowerToBottom"]->setEnabled(false);
+			(*a_scrActions)["itemSendToPattern"]->setEnabled(false);
+			(*a_scrActions)["itemSendToInline"]->setEnabled(false);
+			(*a_scrActions)["itemAdjustFrameToImage"]->setEnabled(false);
+			(*a_scrActions)["itemAdjustImageToFrame"]->setEnabled(false);
+			(*a_scrActions)["itemExtendedImageProperties"]->setEnabled(false);
+			(*a_scrActions)["itemUpdateImage"]->setEnabled(false);
+			(*a_scrActions)["itemPreviewFull"]->setEnabled(false);
+			(*a_scrActions)["itemPreviewNormal"]->setEnabled(false);
+			(*a_scrActions)["itemPreviewLow"]->setEnabled(false);
+			(*a_scrActions)["itemAttributes"]->setEnabled(false);
+			(*a_scrActions)["itemConvertToBezierCurve"]->setEnabled(false);
+			(*a_scrActions)["itemConvertToImageFrame"]->setEnabled(false);
+			(*a_scrActions)["itemConvertToOutlines"]->setEnabled(false);
+			(*a_scrActions)["itemConvertToPolygon"]->setEnabled(false);
+			(*a_scrActions)["itemConvertToTextFrame"]->setEnabled(false);
+			(*a_scrActions)["itemConvertToSymbolFrame"]->setEnabled(false);
+			(*a_scrActions)["itemLock"]->setEnabled(false);
+			(*a_scrActions)["itemLockSize"]->setEnabled(false);
+			(*a_scrActions)["itemPrintingEnabled"]->setEnabled(false);
+			(*a_scrActions)["editCut"]->setEnabled(false);
+			(*a_scrActions)["editCopy"]->setEnabled(false);
+			(*a_scrActions)["editCopyContents"]->setEnabled(false);
+			(*a_scrActions)["editSearchReplace"]->setEnabled(false);
+			(*a_scrActions)["extrasHyphenateText"]->setEnabled(false);
+			(*a_scrActions)["extrasDeHyphenateText"]->setEnabled(false);
+
+			(*a_scrActions)["itemWeld"]->setEnabled(false);
+			(*a_scrActions)["itemsUnWeld"]->setEnabled(false);
+			(*a_scrActions)["itemEditWeld"]->setEnabled(false);
+
+			(*a_scrActions)["toolsUnlinkTextFrame"]->setEnabled(false);
+			(*a_scrActions)["toolsUnlinkTextFrameWithTextCopy"]->setEnabled(false);
+			(*a_scrActions)["toolsUnlinkTextFrameWithTextCut"]->setEnabled(false);
+			(*a_scrActions)["toolsLinkTextFrame"]->setEnabled(false);
+			(*a_scrActions)["toolsEditContents"]->setEnabled(false);
+			(*a_scrActions)["toolsEditWithStoryEditor"]->setEnabled(false);
+			(*a_scrActions)["toolsRotate"]->setEnabled(false);
+			(*a_scrActions)["toolsCopyProperties"]->setEnabled(false);
+			break;
+		case PageItem::ImageFrame: //Image Frame
+			(*a_scrActions)["fileImportAppendText"]->setEnabled(false);
+			(*a_scrActions)["fileImportText"]->setEnabled(false);
+			(*a_scrActions)["fileImportText2"]->setEnabled(false);
+			(*a_scrActions)["fileImportImage"]->setEnabled(true);
+			(*a_scrActions)["editCut"]->setEnabled(true);
+			(*a_scrActions)["editCopy"]->setEnabled(true);
+			(*a_scrActions)["editClearContents"]->setEnabled(true);
+			(*a_scrActions)["editTruncateContents"]->setEnabled(true);
+			(*a_scrActions)["editSearchReplace"]->setEnabled(false);
+			(*a_scrActions)["extrasHyphenateText"]->setEnabled(false);
+			(*a_scrActions)["extrasDeHyphenateText"]->setEnabled(false);
+			(*a_scrActions)["itemDuplicate"]->setEnabled(true);
+			(*a_scrActions)["itemMulDuplicate"]->setEnabled(true);
+			(*a_scrActions)["itemTransform"]->setEnabled(true);
+			(*a_scrActions)["itemDelete"]->setEnabled(true);
+			(*a_scrActions)["itemRaise"]->setEnabled(true);
+			(*a_scrActions)["itemLower"]->setEnabled(true);
+			(*a_scrActions)["itemRaiseToTop"]->setEnabled(true);
+			(*a_scrActions)["itemLowerToBottom"]->setEnabled(true);
+			(*a_scrActions)["itemSendToPattern"]->setEnabled(true);
+			(*a_scrActions)["itemSendToInline"]->setEnabled(true);
+			(*a_scrActions)["itemAdjustFrameToImage"]->setEnabled(true);
+			(*a_scrActions)["itemAdjustImageToFrame"]->setEnabled(true);
+			(*a_scrActions)["itemExtendedImageProperties"]->setEnabled(currItem->pixm.imgInfo.valid);
+			(*a_scrActions)["itemUpdateImage"]->setEnabled(true);
+			(*a_scrActions)["itemPreviewFull"]->setEnabled(true);
+			(*a_scrActions)["itemPreviewNormal"]->setEnabled(true);
+			(*a_scrActions)["itemPreviewLow"]->setEnabled(true);
+			(*a_scrActions)["itemAttributes"]->setEnabled(true);
+			(*a_scrActions)["itemConvertToBezierCurve"]->setEnabled(false);
+			(*a_scrActions)["itemConvertToImageFrame"]->setEnabled(false);
+			(*a_scrActions)["itemConvertToOutlines"]->setEnabled(false);
+			(*a_scrActions)["itemConvertToPolygon"]->setEnabled(!inAnEditMode);
+			(*a_scrActions)["itemConvertToTextFrame"]->setEnabled(!inAnEditMode);
+			(*a_scrActions)["itemConvertToSymbolFrame"]->setEnabled(!inAnEditMode);
+			(*a_scrActions)["toolsUnlinkTextFrame"]->setEnabled(false);
+			(*a_scrActions)["toolsUnlinkTextFrameWithTextCopy"]->setEnabled(false);
+			(*a_scrActions)["toolsUnlinkTextFrameWithTextCut"]->setEnabled(false);
+			(*a_scrActions)["toolsLinkTextFrame"]->setEnabled(false);
+			(*a_scrActions)["toolsEditContents"]->setEnabled(currItem->ScaleType);
+			(*a_scrActions)["toolsEditWithStoryEditor"]->setEnabled(false);
+			(*a_scrActions)["toolsRotate"]->setEnabled(true);
+			(*a_scrActions)["toolsCopyProperties"]->setEnabled(true);
+			(*a_scrActions)["itemImageIsVisible"]->setChecked(currItem->imageShown());
+			(*a_scrActions)["itemToggleInlineImage"]->setChecked(currItem->isImageInline());
+			(*a_scrActions)["itemPreviewFull"]->setChecked(currItem->pixm.imgInfo.lowResType==(*a_scrActions)["itemPreviewFull"]->actionInt());
+			(*a_scrActions)["itemPreviewNormal"]->setChecked(currItem->pixm.imgInfo.lowResType==(*a_scrActions)["itemPreviewNormal"]->actionInt());
+			(*a_scrActions)["itemPreviewLow"]->setChecked(currItem->pixm.imgInfo.lowResType==(*a_scrActions)["itemPreviewLow"]->actionInt());
+
+			break;
+		case PageItem::TextFrame: //Text Frame
+			(*a_scrActions)["fileImportText"]->setEnabled(true);
+			(*a_scrActions)["fileImportText2"]->setEnabled(true);
+			(*a_scrActions)["fileImportImage"]->setEnabled(false);
+			(*a_scrActions)["fileImportAppendText"]->setEnabled(true);
+			(*a_scrActions)["fileExportText"]->setEnabled(true);
+			(*a_scrActions)["editCut"]->setEnabled(true);
+			(*a_scrActions)["editCopy"]->setEnabled(true);
+			//scrMenuMgr->setMenuEnabled("EditContents", true);
+			(*a_scrActions)["editClearContents"]->setEnabled(true);
+			(*a_scrActions)["editTruncateContents"]->setEnabled(true);
+			(*a_scrActions)["editSearchReplace"]->setEnabled(currItem->itemText.length() != 0);
+			(*a_scrActions)["extrasHyphenateText"]->setEnabled(true);
+			(*a_scrActions)["extrasDeHyphenateText"]->setEnabled(true);
+			//		scrMenuMgr->setMenuEnabled("Item", true);
+			(*a_scrActions)["itemDuplicate"]->setEnabled(true);
+			(*a_scrActions)["itemMulDuplicate"]->setEnabled(true);
+			(*a_scrActions)["itemTransform"]->setEnabled(true);
+			(*a_scrActions)["itemDelete"]->setEnabled(true);
+			(*a_scrActions)["itemRaise"]->setEnabled(true);
+			(*a_scrActions)["itemLower"]->setEnabled(true);
+			(*a_scrActions)["itemRaiseToTop"]->setEnabled(true);
+			(*a_scrActions)["itemLowerToBottom"]->setEnabled(true);
+			//scrMenuMgr->setMenuEnabled("itemSendToScrapbook", true);
+			(*a_scrActions)["itemSendToPattern"]->setEnabled(true);
+			(*a_scrActions)["itemSendToInline"]->setEnabled(true);
+			(*a_scrActions)["itemAdjustFrameToImage"]->setEnabled(false);
+			(*a_scrActions)["itemAdjustImageToFrame"]->setEnabled(false);
+			(*a_scrActions)["itemExtendedImageProperties"]->setEnabled(false);
+			(*a_scrActions)["itemUpdateImage"]->setEnabled(false);
+			(*a_scrActions)["itemPreviewFull"]->setEnabled(false);
+			(*a_scrActions)["itemPreviewNormal"]->setEnabled(false);
+			(*a_scrActions)["itemPreviewLow"]->setEnabled(false);
+			(*a_scrActions)["itemAttributes"]->setEnabled(true);
+			//scrMenuMgr->setMenuEnabled("ItemConvertTo", !((doc->appMode == modeEdit) || (currItem->isAnnotation())));
+			(*a_scrActions)["itemConvertToBezierCurve"]->setEnabled(false);
+			(*a_scrActions)["itemConvertToImageFrame"]->setEnabled(!inAnEditMode);
+			(*a_scrActions)["itemConvertToOutlines"]->setEnabled(!inAnEditMode);
+			(*a_scrActions)["itemConvertToPolygon"]->setEnabled(!inAnEditMode);
+			(*a_scrActions)["itemConvertToTextFrame"]->setEnabled(false);
+			(*a_scrActions)["itemConvertToSymbolFrame"]->setEnabled(!inAnEditMode);
+
+			(*a_scrActions)["toolsRotate"]->setEnabled(true);
+			(*a_scrActions)["toolsCopyProperties"]->setEnabled(true);
+			(*a_scrActions)["toolsEditWithStoryEditor"]->setEnabled(true);
+			(*a_scrActions)["insertSampleText"]->setEnabled(true);
+			//scrMenuMgr->setMenuEnabled("InsertMark",true);
+
+			if ((currItem->nextInChain() != 0) || (currItem->prevInChain() != 0))
+			{
+				(*a_scrActions)["itemConvertToBezierCurve"]->setEnabled(false);
+				(*a_scrActions)["itemConvertToImageFrame"]->setEnabled(false);
+				(*a_scrActions)["itemConvertToPolygon"]->setEnabled(false);
+				(*a_scrActions)["itemConvertToTextFrame"]->setEnabled(false);
+				(*a_scrActions)["itemConvertToSymbolFrame"]->setEnabled(false);
+				(*a_scrActions)["toolsUnlinkTextFrame"]->setEnabled(true);
+				(*a_scrActions)["toolsUnlinkTextFrameWithTextCopy"]->setEnabled(true);
+				(*a_scrActions)["toolsUnlinkTextFrameWithTextCut"]->setEnabled(true);
+				// FIXME: once there's one itemtext per story, always enable editcontents
+				if ((currItem->prevInChain() != 0) && (currItem->itemText.length() == 0))
+					(*a_scrActions)["toolsEditContents"]->setEnabled(false);
+				else
+					(*a_scrActions)["toolsEditContents"]->setEnabled(true);
+			}
+			else
+			{
+				(*a_scrActions)["toolsEditContents"]->setEnabled(true);
+				(*a_scrActions)["toolsUnlinkTextFrame"]->setEnabled(false);
+				(*a_scrActions)["toolsUnlinkTextFrameWithTextCopy"]->setEnabled(false);
+				(*a_scrActions)["toolsUnlinkTextFrameWithTextCut"]->setEnabled(false);
+			}
+			(*a_scrActions)["toolsLinkTextFrame"]->setEnabled(!currItem->nextInChain());
+			//		if (doc->masterPageMode())
+			//			(*a_scrActions)["toolsLinkTextFrame"]->setEnabled(false);
+			if (doc->appMode == modeEdit)
+			{
+				(*a_scrActions)["editSelectAll"]->setEnabled(true);
+				(*a_scrActions)["editSelectAllOnLayer"]->setEnabled(false);
+				if (currItem->asTextFrame())
+				{
+					enableTextActions(true, currItem->currentStyle().charStyle().font().scName());
+				}
+			}
+			else
+			{
+				doc->currentStyle = currItem->itemText.defaultStyle();
+			}
+
+			break;
+		case PageItem::Table:
+			(*a_scrActions)["editCut"]->setEnabled(true);
+			(*a_scrActions)["editCopy"]->setEnabled(true);
+			(*a_scrActions)["toolsRotate"]->setEnabled(true);
+			if (doc->appMode == modeEditTable)
+			{
+				PageItem *i2 = currItem->asTable()->activeCell().textFrame();
+				enableTextActions(true, i2->currentCharStyle().font().scName());
+				(*a_scrActions)["insertSampleText"]->setEnabled(true);
+				(*a_scrActions)["toolsEditWithStoryEditor"]->setEnabled(true);
+			}
+			break;
+		case PageItem::PathText: //Path Text
+			(*a_scrActions)["fileImportText"]->setEnabled(true);
+			(*a_scrActions)["fileImportText2"]->setEnabled(true);
+			(*a_scrActions)["fileImportImage"]->setEnabled(false);
+			(*a_scrActions)["fileImportAppendText"]->setEnabled(true);
+			(*a_scrActions)["fileExportText"]->setEnabled(true);
+			(*a_scrActions)["editCut"]->setEnabled(true);
+			(*a_scrActions)["editCopy"]->setEnabled(true);
+			(*a_scrActions)["editClearContents"]->setEnabled(false);
+			(*a_scrActions)["editTruncateContents"]->setEnabled(false);
+			(*a_scrActions)["editSearchReplace"]->setEnabled(false);
+			(*a_scrActions)["extrasHyphenateText"]->setEnabled(false);
+			(*a_scrActions)["extrasDeHyphenateText"]->setEnabled(false);
+			//		scrMenuMgr->setMenuEnabled("Item", true);
+			(*a_scrActions)["itemDuplicate"]->setEnabled(true);
+			(*a_scrActions)["itemMulDuplicate"]->setEnabled(true);
+			(*a_scrActions)["itemTransform"]->setEnabled(true);
+			(*a_scrActions)["itemDelete"]->setEnabled(true);
+			(*a_scrActions)["itemRaise"]->setEnabled(true);
+			(*a_scrActions)["itemLower"]->setEnabled(true);
+			(*a_scrActions)["itemRaiseToTop"]->setEnabled(true);
+			(*a_scrActions)["itemLowerToBottom"]->setEnabled(true);
+			//		(*a_scrActions)["itemSendToScrapbook"]->setEnabled(true);
+			(*a_scrActions)["itemSendToPattern"]->setEnabled(true);
+			(*a_scrActions)["itemSendToInline"]->setEnabled(true);
+			(*a_scrActions)["itemAdjustFrameToImage"]->setEnabled(false);
+			(*a_scrActions)["itemAdjustImageToFrame"]->setEnabled(false);
+			(*a_scrActions)["itemExtendedImageProperties"]->setEnabled(false);
+			(*a_scrActions)["itemUpdateImage"]->setEnabled(false);
+			(*a_scrActions)["itemPreviewFull"]->setEnabled(false);
+			(*a_scrActions)["itemPreviewNormal"]->setEnabled(false);
+			(*a_scrActions)["itemPreviewLow"]->setEnabled(false);
+			(*a_scrActions)["itemAttributes"]->setEnabled(true);
+			//scrMenuMgr->setMenuEnabled("ItemShapes", false);
+			(*a_scrActions)["itemDetachTextFromPath"]->setEnabled(true);
+			//		scrMenuMgr->setMenuEnabled("ItemConvertTo", true);
+			(*a_scrActions)["itemConvertToBezierCurve"]->setEnabled(false);
+			(*a_scrActions)["itemConvertToImageFrame"]->setEnabled(false);
+			(*a_scrActions)["itemConvertToOutlines"]->setEnabled(true);
+			(*a_scrActions)["itemConvertToPolygon"]->setEnabled(false);
+			(*a_scrActions)["itemConvertToTextFrame"]->setEnabled(false);
+			(*a_scrActions)["itemConvertToSymbolFrame"]->setEnabled(true);
+
+			(*a_scrActions)["toolsRotate"]->setEnabled(true);
+			(*a_scrActions)["toolsCopyProperties"]->setEnabled(true);
+			(*a_scrActions)["toolsEditContents"]->setEnabled(false);
+			(*a_scrActions)["toolsEditWithStoryEditor"]->setEnabled(true);
+			(*a_scrActions)["toolsLinkTextFrame"]->setEnabled(false);
+			(*a_scrActions)["toolsUnlinkTextFrame"]->setEnabled(false);
+			(*a_scrActions)["toolsUnlinkTextFrameWithTextCopy"]->setEnabled(false);
+			(*a_scrActions)["toolsUnlinkTextFrameWithTextCut"]->setEnabled(false);
+			break;
+		default:
+			(*a_scrActions)["fileImportText"]->setEnabled(false);
+			(*a_scrActions)["fileImportText2"]->setEnabled(false);
+			(*a_scrActions)["fileImportImage"]->setEnabled(false);
+			(*a_scrActions)["fileImportAppendText"]->setEnabled(false);
+			(*a_scrActions)["fileExportText"]->setEnabled(false);
+			(*a_scrActions)["editCut"]->setEnabled(true);
+			(*a_scrActions)["editCopy"]->setEnabled(true);
+			(*a_scrActions)["editClearContents"]->setEnabled(false);
+			(*a_scrActions)["editTruncateContents"]->setEnabled(false);
+			(*a_scrActions)["editSearchReplace"]->setEnabled(false);
+
+			(*a_scrActions)["extrasHyphenateText"]->setEnabled(false);
+			(*a_scrActions)["extrasDeHyphenateText"]->setEnabled(false);
+			(*a_scrActions)["itemDuplicate"]->setEnabled(true);
+			(*a_scrActions)["itemMulDuplicate"]->setEnabled(true);
+			(*a_scrActions)["itemTransform"]->setEnabled(true);
+			(*a_scrActions)["itemDelete"]->setEnabled(true);
+			(*a_scrActions)["itemRaise"]->setEnabled(true);
+			(*a_scrActions)["itemLower"]->setEnabled(true);
+			(*a_scrActions)["itemRaiseToTop"]->setEnabled(true);
+			(*a_scrActions)["itemLowerToBottom"]->setEnabled(true);
+			(*a_scrActions)["itemSendToPattern"]->setEnabled(true);
+			(*a_scrActions)["itemSendToInline"]->setEnabled(true);
+			(*a_scrActions)["itemAdjustFrameToImage"]->setEnabled(false);
+			(*a_scrActions)["itemAdjustImageToFrame"]->setEnabled(false);
+			(*a_scrActions)["itemExtendedImageProperties"]->setEnabled(false);
+			(*a_scrActions)["itemUpdateImage"]->setEnabled(false);
+			(*a_scrActions)["itemPreviewFull"]->setEnabled(false);
+			(*a_scrActions)["itemPreviewNormal"]->setEnabled(false);
+			(*a_scrActions)["itemPreviewLow"]->setEnabled(false);
+			(*a_scrActions)["itemAttributes"]->setEnabled(true);
+
+			if (SelectedType == PageItem::Polygon) //Polygon
+			{
+				(*a_scrActions)["itemConvertToBezierCurve"]->setEnabled(!inAnEditMode);
+				(*a_scrActions)["itemConvertToImageFrame"]->setEnabled(!inAnEditMode);
+				(*a_scrActions)["itemConvertToOutlines"]->setEnabled(false);
+				(*a_scrActions)["itemConvertToPolygon"]->setEnabled(false);
+				(*a_scrActions)["itemConvertToTextFrame"]->setEnabled(!inAnEditMode);
+				(*a_scrActions)["itemConvertToSymbolFrame"]->setEnabled(!inAnEditMode);
+			}
+			else if ((SelectedType == PageItem::RegularPolygon) || (SelectedType == PageItem::Arc)) // Regular Polygon + Arc
+			{
+				(*a_scrActions)["itemConvertToBezierCurve"]->setEnabled(!inAnEditMode);
+				(*a_scrActions)["itemConvertToImageFrame"]->setEnabled(!inAnEditMode);
+				(*a_scrActions)["itemConvertToOutlines"]->setEnabled(false);
+				(*a_scrActions)["itemConvertToPolygon"]->setEnabled(!inAnEditMode);
+				(*a_scrActions)["itemConvertToTextFrame"]->setEnabled(!inAnEditMode);
+				(*a_scrActions)["itemConvertToSymbolFrame"]->setEnabled(!inAnEditMode);
+			}
+			else if (SelectedType == PageItem::PolyLine) //Polyline
+			{
+				(*a_scrActions)["itemConvertToBezierCurve"]->setEnabled(false);
+				(*a_scrActions)["itemConvertToImageFrame"]->setEnabled(false);
+				(*a_scrActions)["itemConvertToOutlines"]->setEnabled(false);
+				(*a_scrActions)["itemConvertToPolygon"]->setEnabled(!inAnEditMode);
+				(*a_scrActions)["itemConvertToTextFrame"]->setEnabled(false);
+				(*a_scrActions)["itemConvertToSymbolFrame"]->setEnabled(!inAnEditMode);
+			}
+			else if ((SelectedType == PageItem::Line) || (SelectedType == PageItem::Spiral)) // Line
+			{
+				(*a_scrActions)["itemConvertToBezierCurve"]->setEnabled(true);
+				(*a_scrActions)["itemConvertToImageFrame"]->setEnabled(false);
+				(*a_scrActions)["itemConvertToOutlines"]->setEnabled(false);
+				if (SelectedType == PageItem::Spiral)
+					(*a_scrActions)["itemConvertToPolygon"]->setEnabled(!inAnEditMode);
+				else
+					(*a_scrActions)["itemConvertToPolygon"]->setEnabled(false);
+				(*a_scrActions)["itemConvertToTextFrame"]->setEnabled(false);
+				(*a_scrActions)["itemConvertToSymbolFrame"]->setEnabled(!inAnEditMode);
+			}
+			else if (SelectedType == PageItem::Symbol)
+			{
+				(*a_scrActions)["itemConvertToBezierCurve"]->setEnabled(false);
+				(*a_scrActions)["itemConvertToImageFrame"]->setEnabled(false);
+				(*a_scrActions)["itemConvertToOutlines"]->setEnabled(false);
+				(*a_scrActions)["itemConvertToPolygon"]->setEnabled(false);
+				(*a_scrActions)["itemConvertToTextFrame"]->setEnabled(false);
+				(*a_scrActions)["itemConvertToSymbolFrame"]->setEnabled(false);
+			}
+			(*a_scrActions)["toolsEditContents"]->setEnabled(false);
+			(*a_scrActions)["toolsEditWithStoryEditor"]->setEnabled(false);
+			(*a_scrActions)["toolsUnlinkTextFrame"]->setEnabled(false);
+			(*a_scrActions)["toolsUnlinkTextFrameWithTextCopy"]->setEnabled(false);
+			(*a_scrActions)["toolsUnlinkTextFrameWithTextCut"]->setEnabled(false);
+			(*a_scrActions)["toolsLinkTextFrame"]->setEnabled(false);
+			(*a_scrActions)["toolsRotate"]->setEnabled(true);
+			(*a_scrActions)["toolsCopyProperties"]->setEnabled(true);
+			break;
+	}
+
+	if (docSelectionCount == 1)
+	{
+		(*a_scrActions)["itemsUnWeld"]->setEnabled(currItem->isWelded());
+		(*a_scrActions)["itemEditWeld"]->setEnabled(currItem->isWelded());
+	}
+	if (docSelectionCount > 1)
+	{
+		if (!doc->m_Selection->itemsAreSameType())
+		{
+			(*a_scrActions)["itemConvertToBezierCurve"]->setEnabled(false);
+			(*a_scrActions)["itemConvertToImageFrame"]->setEnabled(false);
+			//(*a_scrActions)["itemConvertToOutlines"]->setEnabled(false);
+			(*a_scrActions)["itemConvertToPolygon"]->setEnabled(false);
+			(*a_scrActions)["itemConvertToTextFrame"]->setEnabled(false);
+			(*a_scrActions)["itemConvertToSymbolFrame"]->setEnabled(false);
+		}
+		(*a_scrActions)["editSearchReplace"]->setEnabled(false);
+
+		bool hPoly = false;
+		for (uint i=0; i < docSelectionCount; ++i)
+		{
+			PageItem* it=doc->m_Selection->itemAt(i);
+			if ((it->asPolygon()) || (it->asPolyLine()))
+				hPoly = true;
+		}
+		(*a_scrActions)["itemCombinePolygons"]->setEnabled(hPoly);
+
+		// It is possible to select objects on different layer using
+		// document outline palette. We need to check selected objects
+		// are on a common layer before allowing user to group them
+		bool objectsOnSameLayer = (doc->m_Selection->objectsLayer() != -1);
+		(*a_scrActions)["itemGroup"]->setEnabled(objectsOnSameLayer);
+
+		if (docSelectionCount == 2)
+		{
+			(*a_scrActions)["itemWeld"]->setEnabled(true);
+			//CB swap it around if currItem is not at 0 index from the lastItem loop at start of havenewsel
+			PageItem* it=doc->m_Selection->itemAt(1);
+			if (currItem==it)
+				it=doc->m_Selection->itemAt(0);
+			if ((currItem->asTextFrame() || it->asTextFrame()) && (it->asPolygon() || it->asPolyLine()))
+			{
+				if ((currItem->nextInChain() == 0) && (currItem->prevInChain() == 0) && (it->nextInChain() == 0) && (it->prevInChain() == 0) && (!currItem->isGroup()) && (!it->isGroup()))
+					(*a_scrActions)["itemAttachTextToPath"]->setEnabled(true);
+			}
+		}
+		else
+			(*a_scrActions)["itemWeld"]->setEnabled(false);
+	}
+	else
+	{
+		(*a_scrActions)["itemWeld"]->setEnabled(false);
+		(*a_scrActions)["itemGroup"]->setEnabled(false);
+		(*a_scrActions)["itemAttachTextToPath"]->setEnabled(false);
+		(*a_scrActions)["itemCombinePolygons"]->setEnabled(false);
+	}
+
 }
 
 void AppModeHelper::setModeActionsPerMode(int newMode)

Modified: trunk/Scribus/scribus/appmodehelper.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19575&path=/trunk/Scribus/scribus/appmodehelper.h
==============================================================================
--- trunk/Scribus/scribus/appmodehelper.h (original)
+++ trunk/Scribus/scribus/appmodehelper.h Sun Oct 12 06:14:40 2014
@@ -25,6 +25,8 @@
 #include "appmodes.h"
 #include "scraction.h"
 
+class PageItem;
+
 class AppModeHelper : public QObject
 {
 	Q_OBJECT
@@ -37,6 +39,7 @@
 		void setup(ActionManager* am, QMap<QString, QPointer<ScrAction> > *, QMap<QString, QPointer<ScrAction> > *, QMap<QString, QPointer<ScrAction> > *, QMap<QString, QPointer<ScrAction> > *, QMap<QString, QPointer<ScrAction> > *, QMap<QString, QPointer<ScrAction> > *);
 		void resetApplicationMode(ScribusMainWindow* scmw, int newMode);
 		void setApplicationMode(ScribusMainWindow* scmw, ScribusDoc* doc, int newMode);
+		void enableActionsForSelection(ScribusMainWindow* scmw, ScribusDoc *doc);
 		void setModeActionsPerMode(int newMode);
 		void setActionGroupEnabled(QMap<QString, QPointer<ScrAction> > *, bool enabled);
 		void setTextEditMode(bool b);

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19575&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Sun Oct 12 06:14:40 2014
@@ -2696,204 +2696,19 @@
 
 	view->horizRuler->textMode(false);
 	view->horizRuler->update();
+
+	appModeHelper->enableActionsForSelection(this, doc);
+
 	switch (SelectedType)
 	{
 	case -1: // None
-		scrActions["fileImportText"]->setEnabled(false);
-		scrActions["fileImportText2"]->setEnabled(false);
-		scrActions["fileImportImage"]->setEnabled(false);
-		scrActions["fileImportAppendText"]->setEnabled(false);
-		scrActions["fileExportText"]->setEnabled(false);
-		scrActions["itemDuplicate"]->setEnabled(false);
-		scrActions["itemMulDuplicate"]->setEnabled(false);
-		scrActions["itemTransform"]->setEnabled(false);
-		scrActions["itemDelete"]->setEnabled(false);
-		scrActions["itemRaise"]->setEnabled(false);
-		scrActions["itemLower"]->setEnabled(false);
-		scrActions["itemRaiseToTop"]->setEnabled(false);
-		scrActions["itemLowerToBottom"]->setEnabled(false);
-//		scrActions["itemSendToScrapbook"]->setEnabled(false);
-		scrMenuMgr->setMenuEnabled("itemSendToScrapbook", false);
-		scrActions["itemSendToPattern"]->setEnabled(false);
-		scrActions["itemSendToInline"]->setEnabled(false);
-		scrActions["itemAdjustFrameToImage"]->setEnabled(false);
-		scrActions["itemAdjustImageToFrame"]->setEnabled(false);
-		scrActions["itemExtendedImageProperties"]->setEnabled(false);
-		scrActions["itemUpdateImage"]->setEnabled(false);
-		scrActions["itemPreviewFull"]->setEnabled(false);
-		scrActions["itemPreviewNormal"]->setEnabled(false);
-		scrActions["itemPreviewLow"]->setEnabled(false);
-		scrActions["itemAttributes"]->setEnabled(false);
-//		scrMenuMgr->setMenuEnabled("Item", false);
-		//scrMenuMgr->setMenuEnabled("ItemShapes", false);
-//		scrMenuMgr->setMenuEnabled("ItemConvertTo", false);
-		scrMenuMgr->setMenuEnabled("EditContents", false);
-		scrActions["itemConvertToBezierCurve"]->setEnabled(false);
-		scrActions["itemConvertToImageFrame"]->setEnabled(false);
-		scrActions["itemConvertToOutlines"]->setEnabled(false);
-		scrActions["itemConvertToPolygon"]->setEnabled(false);
-		scrActions["itemConvertToTextFrame"]->setEnabled(false);
-		scrActions["itemConvertToSymbolFrame"]->setEnabled(false);
-		scrActions["itemLock"]->setEnabled(false);
-		scrActions["itemLockSize"]->setEnabled(false);
-		scrActions["itemPrintingEnabled"]->setEnabled(false);
-		scrActions["editCut"]->setEnabled(false);
-		scrActions["editCopy"]->setEnabled(false);
-		scrActions["editCopyContents"]->setEnabled(false);
-		scrActions["editSearchReplace"]->setEnabled(false);
-		scrActions["extrasHyphenateText"]->setEnabled(false);
-		scrActions["extrasDeHyphenateText"]->setEnabled(false);
-
-		scrActions["itemWeld"]->setEnabled(false);
-		scrActions["itemsUnWeld"]->setEnabled(false);
-		scrActions["itemEditWeld"]->setEnabled(false);
-
-		scrActions["toolsUnlinkTextFrame"]->setEnabled(false);
-		scrActions["toolsUnlinkTextFrameWithTextCopy"]->setEnabled(false);
-		scrActions["toolsUnlinkTextFrameWithTextCut"]->setEnabled(false);
-		scrActions["toolsLinkTextFrame"]->setEnabled(false);
-		scrActions["toolsEditContents"]->setEnabled(false);
-		scrActions["toolsEditWithStoryEditor"]->setEnabled(false);
-		scrActions["toolsRotate"]->setEnabled(false);
-		scrActions["toolsCopyProperties"]->setEnabled(false);
-		//CB 061005 moved to cpalette choosegrad
-		//propertiesPalette->Cpal->gradientQCombo->setCurrentItem(0);
 		outlinePalette->slotShowSelect(doc->currentPageNumber(), NULL);
 		propertiesPalette->setGradientEditMode(false);
 		break;
-	case PageItem::ImageFrame: //Image Frame
-		scrActions["fileImportAppendText"]->setEnabled(false);
-		scrActions["fileImportText"]->setEnabled(false);
-		scrActions["fileImportText2"]->setEnabled(false);
-		scrActions["fileImportImage"]->setEnabled(true);
-		scrActions["editCut"]->setEnabled(true);
-		scrActions["editCopy"]->setEnabled(true);
-		scrMenuMgr->setMenuEnabled("EditContents", true);
-		scrActions["editClearContents"]->setEnabled(true);
-		scrActions["editTruncateContents"]->setEnabled(true);
-		scrActions["editSearchReplace"]->setEnabled(false);
-		scrActions["extrasHyphenateText"]->setEnabled(false);
-		scrActions["extrasDeHyphenateText"]->setEnabled(false);
-		scrActions["itemDuplicate"]->setEnabled(true);
-		scrActions["itemMulDuplicate"]->setEnabled(true);
-		scrActions["itemTransform"]->setEnabled(true);
-		scrActions["itemDelete"]->setEnabled(true);
-		scrActions["itemRaise"]->setEnabled(true);
-		scrActions["itemLower"]->setEnabled(true);
-		scrActions["itemRaiseToTop"]->setEnabled(true);
-		scrActions["itemLowerToBottom"]->setEnabled(true);
-		scrMenuMgr->setMenuEnabled("itemSendToScrapbook", true);
-		scrActions["itemSendToPattern"]->setEnabled(true);
-		scrActions["itemSendToInline"]->setEnabled(true);
-		scrActions["itemAdjustFrameToImage"]->setEnabled(true);
-		scrActions["itemAdjustImageToFrame"]->setEnabled(true);
-		scrActions["itemExtendedImageProperties"]->setEnabled(currItem->pixm.imgInfo.valid);
-		scrActions["itemUpdateImage"]->setEnabled(true);
-		scrActions["itemPreviewFull"]->setEnabled(true);
-		scrActions["itemPreviewNormal"]->setEnabled(true);
-		scrActions["itemPreviewLow"]->setEnabled(true);
-		scrActions["itemAttributes"]->setEnabled(true);
-		scrActions["itemConvertToBezierCurve"]->setEnabled(false);
-		scrActions["itemConvertToImageFrame"]->setEnabled(false);
-		scrActions["itemConvertToOutlines"]->setEnabled(false);
-		scrActions["itemConvertToPolygon"]->setEnabled(doc->appMode != modeEdit);
-		scrActions["itemConvertToTextFrame"]->setEnabled(doc->appMode != modeEdit);
-		scrActions["itemConvertToSymbolFrame"]->setEnabled(doc->appMode != modeEdit);
-		scrActions["toolsUnlinkTextFrame"]->setEnabled(false);
-		scrActions["toolsUnlinkTextFrameWithTextCopy"]->setEnabled(false);
-		scrActions["toolsUnlinkTextFrameWithTextCut"]->setEnabled(false);
-		scrActions["toolsLinkTextFrame"]->setEnabled(false);
-		scrActions["toolsEditContents"]->setEnabled(currItem->ScaleType);
-		scrActions["toolsEditWithStoryEditor"]->setEnabled(false);
-		scrActions["toolsRotate"]->setEnabled(true);
-		scrActions["toolsCopyProperties"]->setEnabled(true);
-		scrActions["itemImageIsVisible"]->setChecked(currItem->imageShown());
-		scrActions["itemToggleInlineImage"]->setChecked(currItem->isImageInline());
-		scrActions["itemPreviewFull"]->setChecked(currItem->pixm.imgInfo.lowResType==scrActions["itemPreviewFull"]->actionInt());
-		scrActions["itemPreviewNormal"]->setChecked(currItem->pixm.imgInfo.lowResType==scrActions["itemPreviewNormal"]->actionInt());
-		scrActions["itemPreviewLow"]->setChecked(currItem->pixm.imgInfo.lowResType==scrActions["itemPreviewLow"]->actionInt());
-
-		break;
 	case PageItem::TextFrame: //Text Frame
-		scrActions["fileImportText"]->setEnabled(true);
-		scrActions["fileImportText2"]->setEnabled(true);
-		scrActions["fileImportImage"]->setEnabled(false);
-		scrActions["fileImportAppendText"]->setEnabled(true);
-		scrActions["fileExportText"]->setEnabled(true);
-		scrActions["editCut"]->setEnabled(true);
-		scrActions["editCopy"]->setEnabled(true);
-		scrMenuMgr->setMenuEnabled("EditContents", true);
-		scrActions["editClearContents"]->setEnabled(true);
-		scrActions["editTruncateContents"]->setEnabled(true);
-		scrActions["editSearchReplace"]->setEnabled(currItem->itemText.length() != 0);
-		scrActions["extrasHyphenateText"]->setEnabled(true);
-		scrActions["extrasDeHyphenateText"]->setEnabled(true);
-		//		scrMenuMgr->setMenuEnabled("Item", true);
-		scrActions["itemDuplicate"]->setEnabled(true);
-		scrActions["itemMulDuplicate"]->setEnabled(true);
-		scrActions["itemTransform"]->setEnabled(true);
-		scrActions["itemDelete"]->setEnabled(true);
-		scrActions["itemRaise"]->setEnabled(true);
-		scrActions["itemLower"]->setEnabled(true);
-		scrActions["itemRaiseToTop"]->setEnabled(true);
-		scrActions["itemLowerToBottom"]->setEnabled(true);
-		scrMenuMgr->setMenuEnabled("itemSendToScrapbook", true);
-		scrActions["itemSendToPattern"]->setEnabled(true);
-		scrActions["itemSendToInline"]->setEnabled(true);
-		scrActions["itemAdjustFrameToImage"]->setEnabled(false);
-		scrActions["itemAdjustImageToFrame"]->setEnabled(false);
-		scrActions["itemExtendedImageProperties"]->setEnabled(false);
-		scrActions["itemUpdateImage"]->setEnabled(false);
-		scrActions["itemPreviewFull"]->setEnabled(false);
-		scrActions["itemPreviewNormal"]->setEnabled(false);
-		scrActions["itemPreviewLow"]->setEnabled(false);
-		scrActions["itemAttributes"]->setEnabled(true);
-		scrMenuMgr->setMenuEnabled("ItemConvertTo", !((doc->appMode == modeEdit) || (currItem->isAnnotation())));
-		scrActions["itemConvertToBezierCurve"]->setEnabled(false);
-		scrActions["itemConvertToImageFrame"]->setEnabled(doc->appMode != modeEdit);
-		scrActions["itemConvertToOutlines"]->setEnabled(doc->appMode != modeEdit);
-		scrActions["itemConvertToPolygon"]->setEnabled(doc->appMode != modeEdit);
-		scrActions["itemConvertToTextFrame"]->setEnabled(false);
-		scrActions["itemConvertToSymbolFrame"]->setEnabled(doc->appMode != modeEdit);
-
-		scrActions["toolsRotate"]->setEnabled(true);
-		scrActions["toolsCopyProperties"]->setEnabled(true);
-		scrActions["toolsEditWithStoryEditor"]->setEnabled(true);
-		scrActions["insertSampleText"]->setEnabled(true);
-		scrMenuMgr->setMenuEnabled("InsertMark",true);
-
-		if ((currItem->nextInChain() != 0) || (currItem->prevInChain() != 0))
-		{
-			scrActions["itemConvertToBezierCurve"]->setEnabled(false);
-			scrActions["itemConvertToImageFrame"]->setEnabled(false);
-			scrActions["itemConvertToPolygon"]->setEnabled(false);
-			scrActions["itemConvertToTextFrame"]->setEnabled(false);
-			scrActions["itemConvertToSymbolFrame"]->setEnabled(false);
-			scrActions["toolsUnlinkTextFrame"]->setEnabled(true);
-			scrActions["toolsUnlinkTextFrameWithTextCopy"]->setEnabled(true);
-			scrActions["toolsUnlinkTextFrameWithTextCut"]->setEnabled(true);
-			// FIXME: once there's one itemtext per story, always enable editcontents
-			if ((currItem->prevInChain() != 0) && (currItem->itemText.length() == 0))
-				scrActions["toolsEditContents"]->setEnabled(false);
-			else
-				scrActions["toolsEditContents"]->setEnabled(true);
-		}
-		else
-		{
-			scrActions["toolsEditContents"]->setEnabled(true);
-			scrActions["toolsUnlinkTextFrame"]->setEnabled(false);
-			scrActions["toolsUnlinkTextFrameWithTextCopy"]->setEnabled(false);
-			scrActions["toolsUnlinkTextFrameWithTextCut"]->setEnabled(false);
-		}
-		scrActions["toolsLinkTextFrame"]->setEnabled(!currItem->nextInChain());
-//		if (doc->masterPageMode())
-//			scrActions["toolsLinkTextFrame"]->setEnabled(false);
 		if (doc->appMode == modeEdit)
 		{
 			setTBvals(currItem);
-			scrActions["editSelectAll"]->setEnabled(true);
-			scrActions["editSelectAllOnLayer"]->setEnabled(false);
-			scrMenuMgr->setMenuEnabled("InsertMark",true);
 			charPalette->setEnabled(true, currItem);
 			if (currItem->asTextFrame())
 			{
@@ -2905,7 +2720,6 @@
 		}
 		else
 		{
-			scrMenuMgr->setMenuEnabled("InsertMark",false);
 			doc->currentStyle = currItem->itemText.defaultStyle();
 			propertiesPalette->textPal->showParStyle(doc->currentStyle.parent());
 			propertiesPalette->textPal->showCharStyle(doc->currentStyle.charStyle().parent());
@@ -2914,77 +2728,16 @@
 			propertiesPalette->textPal->updateStyle(doc->currentStyle);
 			setStyleEffects(doc->currentStyle.charStyle().effects());
 		}
-
-//		doc->docParagraphStyles[0].setLineSpacingMode(static_cast<ParagraphStyle::LineSpacingMode>(currItem->lineSpacingMode()));
-//		doc->docParagraphStyles[0].setLineSpacing(currItem->lineSpacing());
-//		doc->docParagraphStyles[0].setAlignment(currItem->textAlignment);
-
 		break;
 	case PageItem::Table:
-		scrActions["editCut"]->setEnabled(true);
-		scrActions["editCopy"]->setEnabled(true);
-		scrActions["toolsRotate"]->setEnabled(true);
 		if (doc->appMode == modeEditTable)
 		{
 			charPalette->setEnabled(true, currItem);
 			PageItem *i2 = currItem->asTable()->activeCell().textFrame();
 			appModeHelper->enableTextActions(true, i2->currentCharStyle().font().scName());
-			scrActions["insertSampleText"]->setEnabled(true);
-			scrActions["toolsEditWithStoryEditor"]->setEnabled(true);
 		}
 		break;
 	case PageItem::PathText: //Path Text
-		scrActions["fileImportText"]->setEnabled(true);
-		scrActions["fileImportText2"]->setEnabled(true);
-		scrActions["fileImportImage"]->setEnabled(false);
-		scrActions["fileImportAppendText"]->setEnabled(true);
-		scrActions["fileExportText"]->setEnabled(true);
-		scrActions["editCut"]->setEnabled(true);
-		scrActions["editCopy"]->setEnabled(true);
-		scrActions["editClearContents"]->setEnabled(false);
-		scrActions["editTruncateContents"]->setEnabled(false);
-		scrActions["editSearchReplace"]->setEnabled(false);
-		scrActions["extrasHyphenateText"]->setEnabled(false);
-		scrActions["extrasDeHyphenateText"]->setEnabled(false);
-		//		scrMenuMgr->setMenuEnabled("Item", true);
-		scrActions["itemDuplicate"]->setEnabled(true);
-		scrActions["itemMulDuplicate"]->setEnabled(true);
-		scrActions["itemTransform"]->setEnabled(true);
-		scrActions["itemDelete"]->setEnabled(true);
-		scrActions["itemRaise"]->setEnabled(true);
-		scrActions["itemLower"]->setEnabled(true);
-		scrActions["itemRaiseToTop"]->setEnabled(true);
-		scrActions["itemLowerToBottom"]->setEnabled(true);
-//		scrActions["itemSendToScrapbook"]->setEnabled(true);
-		scrMenuMgr->setMenuEnabled("itemSendToScrapbook", true);
-		scrActions["itemSendToPattern"]->setEnabled(true);
-		scrActions["itemSendToInline"]->setEnabled(true);
-		scrActions["itemAdjustFrameToImage"]->setEnabled(false);
-		scrActions["itemAdjustImageToFrame"]->setEnabled(false);
-		scrActions["itemExtendedImageProperties"]->setEnabled(false);
-		scrActions["itemUpdateImage"]->setEnabled(false);
-		scrActions["itemPreviewFull"]->setEnabled(false);
-		scrActions["itemPreviewNormal"]->setEnabled(false);
-		scrActions["itemPreviewLow"]->setEnabled(false);
-		scrActions["itemAttributes"]->setEnabled(true);
-		//scrMenuMgr->setMenuEnabled("ItemShapes", false);
-		scrActions["itemDetachTextFromPath"]->setEnabled(true);
-//		scrMenuMgr->setMenuEnabled("ItemConvertTo", true);
-		scrActions["itemConvertToBezierCurve"]->setEnabled(false);
-		scrActions["itemConvertToImageFrame"]->setEnabled(false);
-		scrActions["itemConvertToOutlines"]->setEnabled(true);
-		scrActions["itemConvertToPolygon"]->setEnabled(false);
-		scrActions["itemConvertToTextFrame"]->setEnabled(false);
-		scrActions["itemConvertToSymbolFrame"]->setEnabled(true);
-
-		scrActions["toolsRotate"]->setEnabled(true);
-		scrActions["toolsCopyProperties"]->setEnabled(true);
-		scrActions["toolsEditContents"]->setEnabled(false);
-		scrActions["toolsEditWithStoryEditor"]->setEnabled(true);
-		scrActions["toolsLinkTextFrame"]->setEnabled(false);
-		scrActions["toolsUnlinkTextFrame"]->setEnabled(false);
-		scrActions["toolsUnlinkTextFrameWithTextCopy"]->setEnabled(false);
-		scrActions["toolsUnlinkTextFrameWithTextCut"]->setEnabled(false);
 		if (doc->appMode == modeEdit)
 			setTBvals(currItem);
 		else
@@ -2998,256 +2751,15 @@
 			setStyleEffects(doc->currentStyle.charStyle().effects());
 		}
 		break;
-	default:
-		scrActions["fileImportText"]->setEnabled(false);
-		scrActions["fileImportText2"]->setEnabled(false);
-		scrActions["fileImportImage"]->setEnabled(false);
-		scrActions["fileImportAppendText"]->setEnabled(false);
-		scrActions["fileExportText"]->setEnabled(false);
-		scrActions["editCut"]->setEnabled(true);
-		scrActions["editCopy"]->setEnabled(true);
-		scrMenuMgr->setMenuEnabled("EditContents", false);
-		scrActions["editClearContents"]->setEnabled(false);
-		scrActions["editTruncateContents"]->setEnabled(false);
-		scrActions["editSearchReplace"]->setEnabled(false);
-
-		scrActions["extrasHyphenateText"]->setEnabled(false);
-		scrActions["extrasDeHyphenateText"]->setEnabled(false);
-		//		scrMenuMgr->setMenuEnabled("Item", true);
-		scrActions["itemDuplicate"]->setEnabled(true);
-		scrActions["itemMulDuplicate"]->setEnabled(true);
-		scrActions["itemTransform"]->setEnabled(true);
-		scrActions["itemDelete"]->setEnabled(true);
-		scrActions["itemRaise"]->setEnabled(true);
-		scrActions["itemLower"]->setEnabled(true);
-		scrActions["itemRaiseToTop"]->setEnabled(true);
-		scrActions["itemLowerToBottom"]->setEnabled(true);
-//		scrActions["itemSendToScrapbook"]->setEnabled(true);
-		scrMenuMgr->setMenuEnabled("itemSendToScrapbook", true);
-		scrActions["itemSendToPattern"]->setEnabled(true);
-		scrActions["itemSendToInline"]->setEnabled(true);
-		scrActions["itemAdjustFrameToImage"]->setEnabled(false);
-		scrActions["itemAdjustImageToFrame"]->setEnabled(false);
-		scrActions["itemExtendedImageProperties"]->setEnabled(false);
-		scrActions["itemUpdateImage"]->setEnabled(false);
-		scrActions["itemPreviewFull"]->setEnabled(false);
-		scrActions["itemPreviewNormal"]->setEnabled(false);
-		scrActions["itemPreviewLow"]->setEnabled(false);
-		scrActions["itemAttributes"]->setEnabled(true);
-		bool inAnEditMode=doc->inAnEditMode();
-		if (SelectedType == PageItem::Polygon) //Polygon
-		{
-			scrMenuMgr->setMenuEnabled("ItemConvertTo", true);
-			scrActions["itemConvertToBezierCurve"]->setEnabled(!inAnEditMode);
-			scrActions["itemConvertToImageFrame"]->setEnabled(!inAnEditMode);
-			scrActions["itemConvertToOutlines"]->setEnabled(false);
-			scrActions["itemConvertToPolygon"]->setEnabled(false);
-			scrActions["itemConvertToTextFrame"]->setEnabled(!inAnEditMode);
-			scrActions["itemConvertToSymbolFrame"]->setEnabled(!inAnEditMode);
-		}
-		else if ((SelectedType == PageItem::RegularPolygon) || (SelectedType == PageItem::Arc)) // Regular Polygon + Arc
-		{
-			scrMenuMgr->setMenuEnabled("ItemConvertTo", true);
-			scrActions["itemConvertToBezierCurve"]->setEnabled(!inAnEditMode);
-			scrActions["itemConvertToImageFrame"]->setEnabled(!inAnEditMode);
-			scrActions["itemConvertToOutlines"]->setEnabled(false);
-			scrActions["itemConvertToPolygon"]->setEnabled(!inAnEditMode);
-			scrActions["itemConvertToTextFrame"]->setEnabled(!inAnEditMode);
-			scrActions["itemConvertToSymbolFrame"]->setEnabled(!inAnEditMode);
-		}
-		else if (SelectedType == PageItem::PolyLine) //Polyline
-		{
-			scrMenuMgr->setMenuEnabled("ItemConvertTo", true);
-			scrActions["itemConvertToBezierCurve"]->setEnabled(false);
-			scrActions["itemConvertToImageFrame"]->setEnabled(false);
-			scrActions["itemConvertToOutlines"]->setEnabled(false);
-			scrActions["itemConvertToPolygon"]->setEnabled(!inAnEditMode);
-			scrActions["itemConvertToTextFrame"]->setEnabled(false);
-			scrActions["itemConvertToSymbolFrame"]->setEnabled(!inAnEditMode);
-		}
-		else if ((SelectedType == PageItem::Line) || (SelectedType == PageItem::Spiral)) // Line
-		{
-			scrMenuMgr->setMenuEnabled("ItemConvertTo", true);
-			scrActions["itemConvertToBezierCurve"]->setEnabled(true);
-			scrActions["itemConvertToImageFrame"]->setEnabled(false);
-			scrActions["itemConvertToOutlines"]->setEnabled(false);
-			if (SelectedType == PageItem::Spiral)
-				scrActions["itemConvertToPolygon"]->setEnabled(!inAnEditMode);
-			else
-				scrActions["itemConvertToPolygon"]->setEnabled(false);
-			scrActions["itemConvertToTextFrame"]->setEnabled(false);
-			scrActions["itemConvertToSymbolFrame"]->setEnabled(!inAnEditMode);
-		}
-		else if (SelectedType == PageItem::Symbol)
-			scrMenuMgr->setMenuEnabled("ItemConvertTo", false);
-		scrActions["toolsEditContents"]->setEnabled(false);
-		scrActions["toolsEditWithStoryEditor"]->setEnabled(false);
-		scrActions["toolsUnlinkTextFrame"]->setEnabled(false);
-		scrActions["toolsUnlinkTextFrameWithTextCopy"]->setEnabled(false);
-		scrActions["toolsUnlinkTextFrameWithTextCut"]->setEnabled(false);
-		scrActions["toolsLinkTextFrame"]->setEnabled(false);
-//		if (SelectedType != 5)
-			scrActions["toolsRotate"]->setEnabled(true);
-//		else
-//			scrActions["toolsRotate"]->setEnabled(false);
-		scrActions["toolsCopyProperties"]->setEnabled(true);
-		break;
 	}
 	doc->CurrentSel = SelectedType;
 	propertiesPalette->xyzPal->basePointWidget->setCheckedId(doc->RotMode());
-	if (docSelectionCount == 1)
-	{
-		PageItem* bx = doc->m_Selection->itemAt(0);
-		scrActions["itemsUnWeld"]->setEnabled(bx->isWelded());
-		scrActions["itemEditWeld"]->setEnabled(bx->isWelded());
-	}
-	if (docSelectionCount > 1)
-	{
-		if (!doc->m_Selection->itemsAreSameType())
-		{
-			scrActions["itemConvertToBezierCurve"]->setEnabled(false);
-			scrActions["itemConvertToImageFrame"]->setEnabled(false);
-			//scrActions["itemConvertToOutlines"]->setEnabled(false);
-			scrActions["itemConvertToPolygon"]->setEnabled(false);
-			scrActions["itemConvertToTextFrame"]->setEnabled(false);
-			scrActions["itemConvertToSymbolFrame"]->setEnabled(false);
-		}
-		scrActions["editSearchReplace"]->setEnabled(false);
-
-		bool hPoly = false;
-		for (uint bx=0; bx < docSelectionCount; ++bx)
-		{
-			PageItem* bxi=doc->m_Selection->itemAt(bx);
-			if ((bxi->asPolygon()) || (bxi->asPolyLine()))
-				hPoly = true;
-		}
-		// It is possible to select objects on different layer using
-		// document outline palette. We need to check selected objects
-		// are on a common layer before allowing user to group them
-		bool objectsOnSameLayer = (doc->m_Selection->objectsLayer() != -1);
-		scrActions["itemGroup"]->setEnabled(objectsOnSameLayer);
-		scrActions["itemCombinePolygons"]->setEnabled(hPoly);
-		if (docSelectionCount == 2)
-		{
-			scrActions["itemWeld"]->setEnabled(true);
-			//CB swap bx around if currItem is not at 0 index from the lastItem loop at start of havenewsel
-			PageItem* bx=doc->m_Selection->itemAt(1);
-			if (currItem==bx)
-				bx=doc->m_Selection->itemAt(0);
-
-			if ((currItem->asTextFrame() && (bx->asPolygon() || bx->asPolyLine())) || (bx->asTextFrame() && (currItem->asPolygon() || currItem->asPolyLine())))
-			{
-				if ((currItem->nextInChain() == 0) && (currItem->prevInChain() == 0) && (bx->nextInChain() == 0) && (bx->prevInChain() == 0) && (!currItem->isGroup()) && (!bx->isGroup()))
-					scrActions["itemAttachTextToPath"]->setEnabled(true);
-			}
-
-		}
-		else
-			scrActions["itemWeld"]->setEnabled(false);
-	}
-	else
-	{
-		scrActions["itemWeld"]->setEnabled(false);
-		scrActions["itemGroup"]->setEnabled(false);
-		scrActions["itemAttachTextToPath"]->setEnabled(false);
-		scrActions["itemCombinePolygons"]->setEnabled(false);
-	}
-
-	if (docSelectionCount != 0)
-	{
-		actionManager->setPDFActions(view);
-		updateItemLayerList();
-		rebuildScrapbookMenu();
-
-		//propertiesPalette->textFlowsAroundFrame->setChecked(currItem->textFlowsAroundFrame());
-		propertiesPalette->setTextFlowMode(currItem->textFlowMode());
-		scrActions["itemLock"]->setEnabled(true);
-		scrActions["itemLockSize"]->setEnabled(true);
-		scrActions["itemPrintingEnabled"]->setEnabled(true);
-		if (currItem->isGroup())
-		{
-			scrActions["itemUngroup"]->setEnabled(doc->appMode != modeEdit);
-			scrActions["itemGroupAdjust"]->setEnabled(doc->appMode != modeEdit);
-		}
-		else
-		{
-			scrActions["itemUngroup"]->setEnabled(false);
-			scrActions["itemGroupAdjust"]->setEnabled(false);
-			scrActions["itemSplitPolygons"]->setEnabled( (currItem->asPolygon()) && (currItem->Segments.count() != 0) );
-		}
-		if (currItem->locked())
-		{
-			//scrMenuMgr->setMenuEnabled("ItemShapes", false);
-			scrMenuMgr->setMenuEnabled("ItemConvertTo", false);
-			scrActions["itemConvertToBezierCurve"]->setEnabled(false);
-			scrActions["itemConvertToImageFrame"]->setEnabled(false);
-			scrActions["itemConvertToOutlines"]->setEnabled(false);
-			scrActions["itemConvertToPolygon"]->setEnabled(false);
-			scrActions["itemConvertToTextFrame"]->setEnabled(false);
-			scrActions["itemConvertToSymbolFrame"]->setEnabled(false);
-			scrActions["itemSplitPolygons"]->setEnabled(false);
-			scrActions["itemAttachTextToPath"]->setEnabled(false);
-			scrActions["itemDetachTextFromPath"]->setEnabled(false);
-			scrActions["itemCombinePolygons"]->setEnabled(false);
-			scrActions["itemDelete"]->setEnabled(false);
-			scrMenuMgr->setMenuEnabled("ItemLevel", false);
-			scrActions["itemLowerToBottom"]->setEnabled(false);
-			scrActions["itemRaiseToTop"]->setEnabled(false);
-			scrActions["itemRaise"]->setEnabled(false);
-			scrActions["itemLower"]->setEnabled(false);
-//			scrActions["itemSendToScrapbook"]->setEnabled(!(currItem->isTableItem && currItem->isSingleSel));
-			scrMenuMgr->setMenuEnabled("itemSendToScrapbook", true);
-			scrActions["itemSendToPattern"]->setEnabled(true);
-			scrActions["itemSendToInline"]->setEnabled(true);
-			scrActions["editCut"]->setEnabled(false);
-			scrActions["editClearContents"]->setEnabled(false);
-			scrActions["editTruncateContents"]->setEnabled(false);
-			scrActions["toolsRotate"]->setEnabled(false);
-		}
-		else
-		{
-			bool setter = !currItem->isGroup();
-			scrMenuMgr->setMenuEnabled("ItemLevel", setter);
-			scrActions["itemDuplicate"]->setEnabled(true);
-			scrActions["itemMulDuplicate"]->setEnabled(true);
-			scrActions["itemTransform"]->setEnabled(true);
-			scrActions["itemDelete"]->setEnabled(true);
-//			scrActions["itemSendToScrapbook"]->setEnabled(setter);
-			scrMenuMgr->setMenuEnabled("itemSendToScrapbook", true);
-			scrActions["itemSendToPattern"]->setEnabled(true);
-			scrActions["itemSendToInline"]->setEnabled(true);
-			if (docSelectionCount > 1)
-			{
-				bool haveSameParent = true;
-				PageItem *firstItem = doc->m_Selection->itemAt(0);
-				for (uint a = 1; a < docSelectionCount; ++a)
-				{
-					if (doc->m_Selection->itemAt(a)->Parent != firstItem->Parent)
-					{
-						haveSameParent = false;
-						break;
-					}
-				}
-				scrActions["itemRaise"]->setEnabled(haveSameParent);
-				scrActions["itemLower"]->setEnabled(haveSameParent);
-				scrActions["itemRaiseToTop"]->setEnabled(haveSameParent);
-				scrActions["itemLowerToBottom"]->setEnabled(haveSameParent);
-			}
-		}
-		scrActions["itemLock"]->setChecked(currItem->locked());
-		scrActions["itemLockSize"]->setChecked(currItem->sizeLocked());
-		scrActions["itemPrintingEnabled"]->setChecked(currItem->printEnabled());
-	}
 
 	if (SelectedType != -1)
 	{
-		//propertiesPalette->setCurrentItem(currItem);
 		outlinePalette->slotShowSelect(currItem->OwnPage, currItem);
 		actionManager->connectNewSelectionActions(view, doc);
-// 		propertiesPalette->handleSelectionChanged();
-	}
-//	else
-//		propertiesPalette->handleSelectionChanged();
+	}
 
 	PluginManager& pluginManager(PluginManager::instance());
 	QStringList pluginNames(pluginManager.pluginNames(false));

Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19575&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp (original)
+++ trunk/Scribus/scribus/scribusview.cpp Sun Oct 12 06:14:40 2014
@@ -484,7 +484,6 @@
 
 	if (Doc->appMode != appMode)
 	{
-		//m_ScMW->setAppMode(appMode);
 		m_ScMW->appModeHelper->setApplicationMode(m_ScMW, Doc, appMode);
 		CanvasMode* newCanvasMode = modeInstances.value(appMode);
 		if (!newCanvasMode)
@@ -502,7 +501,6 @@
 	}
 	else
 	{
-		//m_ScMW->setAppMode(appMode);
 		m_ScMW->appModeHelper->setApplicationMode(m_ScMW, Doc, appMode);
 	}
 	if (updateNecessary)




More information about the scribus-commit mailing list