r19181 by craig - #1779: Rearrange context menu a little more

scribus-commit scribus-commit at lists.scribus.net
Thu Jun 5 19:48:14 UTC 2014


Author: craig
Date: Thu Jun  5 19:48:14 2014
New Revision: 19181

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19181
Log:
#1779: Rearrange context menu a little more

Modified:
    trunk/Scribus/scribus/ui/contextmenu.cpp

Modified: trunk/Scribus/scribus/ui/contextmenu.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19181&path=/trunk/Scribus/scribus/ui/contextmenu.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/contextmenu.cpp (original)
+++ trunk/Scribus/scribus/ui/contextmenu.cpp Thu Jun  5 19:48:14 2014
@@ -100,6 +100,8 @@
 	QMenu *menuLocking = new QMenu(this);
 	QMenu *menuSendTo = new QMenu(this);
 	QMenu *menuScrapbook = new QMenu(this);
+	QMenu *menuEdit = new QMenu(this);
+	QMenu *menuImage = new QMenu(this);
 //	QMenu *menuWeld = new QMenu(this);
 
 	//<-- Add Info
@@ -147,19 +149,54 @@
 //			currItem->createContextMenu(menuInfo, 5);
 			QAction *act = addMenu(menuInfo);
 			act->setText( tr("In&fo"));
-		} else	{
+		}
+		else
+		{
 			delete infoGroupLayout;
 			delete infoGroup;
 		}
 	}
 	//-->
 
-	//<-- Add undo
-	UndoManager * const undoManager(UndoManager::instance());
-	if (undoManager->hasUndoActions())
-		addAction(m_ScMW->scrActions["editUndoAction"]);
-	if (undoManager->hasRedoActions())
-		addAction(m_ScMW->scrActions["editRedoAction"]);
+	//<-- Add Contents Actions
+	if (m_actionList.contains("fileImportText"))
+	{
+		addSeparator();
+		menuEditContents->addAction(m_ScMW->scrActions["fileImportText"]);
+		menuEditContents->addAction(m_ScMW->scrActions["fileImportAppendText"]);
+		menuEditContents->addAction(m_ScMW->scrActions["toolsEditWithStoryEditor"]);
+		menuEditContents->addAction(m_ScMW->scrActions["insertSampleText"]);
+		menuEditContents->addSeparator();
+	}
+	else //enable this for, eg, text on a path
+		if (m_actionList.contains("toolsEditWithStoryEditor"))
+		{
+			addSeparator();
+			menuEditContents->addAction(m_ScMW->scrActions["toolsEditWithStoryEditor"]);
+		}
+	if (m_actionList.contains("fileImportImage"))
+		menuEditContents->addAction(m_ScMW->scrActions["fileImportImage"]);
+	if (selectedItemCount==1 && currItem->asImageFrame())
+	{
+		if (QApplication::clipboard()->mimeData()->hasImage())
+			menuEditContents->addAction(m_ScMW->scrActions["editPasteImageFromClipboard"]);
+	}
+	if (itemsAreSameType)
+	{
+		if (m_actionList.contains("editCopyContents"))
+			menuEditContents->addAction(m_ScMW->scrActions["editCopyContents"]);
+		if (m_actionList.contains("editPasteContents"))
+			menuEditContents->addAction(m_ScMW->scrActions["editPasteContents"]);
+		if (currItem->asImageFrame() && m_actionList.contains("editPasteContentsAbs"))
+			menuEditContents->addAction(m_ScMW->scrActions["editPasteContentsAbs"]);
+	}
+	if (m_actionList.contains("editClearContents"))
+		menuEditContents->addAction(m_ScMW->scrActions["editClearContents"]);
+	if (menuEditContents->actions().count()>0)
+	{
+		QAction *act = addMenu(menuEditContents);
+		act->setText( tr("Contents"));
+	}
 	//-->
 
 	//<-- Item specific actions
@@ -207,32 +244,14 @@
 			addSeparator();
 			addAction(m_ScMW->scrActions["itemUpdateMarks"]);
 		}
-		if (m_actionList.contains("fileImportText"))
-		{
-			addSeparator();
-			addAction(m_ScMW->scrActions["fileImportText"]);
-			addAction(m_ScMW->scrActions["fileImportAppendText"]);
-			addAction(m_ScMW->scrActions["toolsEditWithStoryEditor"]);
-			addAction(m_ScMW->scrActions["insertSampleText"]);
-		}
-		else //enable this for, eg, text on a path
-			if (m_actionList.contains("toolsEditWithStoryEditor"))
-			{
-				addSeparator();
-				addAction(m_ScMW->scrActions["toolsEditWithStoryEditor"]);
-			}
+
+
+
+
+
 		addSeparator();
-		if (m_actionList.contains("fileImportImage"))
-			addAction(m_ScMW->scrActions["fileImportImage"]);
-		if (selectedItemCount==1 && currItem->asImageFrame())
-		{
-			if (QApplication::clipboard()->mimeData()->hasImage())
-				addAction(m_ScMW->scrActions["editPasteImageFromClipboard"]);
-		}
-		if (m_actionList.contains("itemAdjustFrameToImage"))
-			addAction(m_ScMW->scrActions["itemAdjustFrameToImage"]);
-		if (m_actionList.contains("itemAdjustImageToFrame"))
-			addAction(m_ScMW->scrActions["itemAdjustImageToFrame"]);
+
+
 
 		if (m_actionList.contains("tableInsertRows"))
 			addAction(m_ScMW->scrActions["tableInsertRows"]);
@@ -260,17 +279,7 @@
 			addAction(m_ScMW->scrActions["tableAdjustTableToFrame"]);
 		if (m_actionList.contains("itemAdjustFrameHeightToText"))
 			addAction(m_ScMW->scrActions["itemAdjustFrameHeightToText"]);
-		if (m_actionList.contains("itemExtendedImageProperties"))
-			addAction(m_ScMW->scrActions["itemExtendedImageProperties"]);
-		if (m_actionList.contains("itemAdjustFrameToImage"))
-		{
-			if (currItem->PictureIsAvailable)
-				addAction(m_ScMW->scrActions["itemToggleInlineImage"]);
-		}
-		if (m_actionList.contains("itemImageInfo"))
-			addAction(m_ScMW->scrActions["itemImageInfo"]);
-		if (m_actionList.contains("itemUpdateImage"))
-			addAction(m_ScMW->scrActions["itemUpdateImage"]);
+
 		
 		if (m_actionList.contains("itemPreviewLow"))
 		{
@@ -291,13 +300,28 @@
 		}
 		
 		if (m_actionList.contains("styleImageEffects"))
-			addAction(m_ScMW->scrActions["styleImageEffects"]);
+			menuImage->addAction(m_ScMW->scrActions["styleImageEffects"]);
 		if (m_actionList.contains("editEditWithImageEditor"))
-			addAction(m_ScMW->scrActions["editEditWithImageEditor"]);
+			menuImage->addAction(m_ScMW->scrActions["editEditWithImageEditor"]);
 		if (selectedItemCount==1 && currItem->asImageFrame())
 		{
 			if (currItem->PictureIsAvailable)
 			{
+				if (m_actionList.contains("itemExtendedImageProperties"))
+					menuImage->addAction(m_ScMW->scrActions["itemExtendedImageProperties"]);
+				if (m_actionList.contains("itemAdjustFrameToImage"))
+				{
+					if (currItem->PictureIsAvailable)
+						menuImage->addAction(m_ScMW->scrActions["itemToggleInlineImage"]);
+				}
+				if (m_actionList.contains("itemImageInfo"))
+					menuImage->addAction(m_ScMW->scrActions["itemImageInfo"]);
+				if (m_actionList.contains("itemUpdateImage"))
+					menuImage->addAction(m_ScMW->scrActions["itemUpdateImage"]);
+				if (m_actionList.contains("itemAdjustFrameToImage"))
+					menuImage->addAction(m_ScMW->scrActions["itemAdjustFrameToImage"]);
+				if (m_actionList.contains("itemAdjustImageToFrame"))
+					menuImage->addAction(m_ScMW->scrActions["itemAdjustImageToFrame"]);
 				m_ScMW->scrActions["itemAdjustFrameToImage"]->setEnabled(true);
 				m_ScMW->scrActions["itemAdjustImageToFrame"]->setEnabled(true);
 				if (currItem->pixm.imgInfo.valid)
@@ -310,6 +334,13 @@
 					m_ScMW->scrActions["styleImageEffects"]->setEnabled(true);
 					m_ScMW->scrActions["editEditWithImageEditor"]->setEnabled(true);
 				}
+
+
+				if (menuImage->actions().count()>0)
+				{
+					QAction *act = addMenu(menuImage);
+					act->setText( tr("Image"));
+				}
 			}
 		}
 		
@@ -321,44 +352,22 @@
 	}
 	//-->
 
-	//<-- Item Attributes
-	if (selectedItemCount == 1)
-	{
-		addSeparator();
-		addAction(m_ScMW->scrActions["itemAttributes"]);
-	}
-	//-->
-
-	//<-- Item PDF Options
-	if (currItem->itemType() == PageItem::TextFrame)
-	{
-		QAction *act = addMenu(menuPDF);
-		act->setText( tr("&PDF Options"));
-		menuPDF->addAction(m_ScMW->scrActions["itemPDFIsAnnotation"]);
-		if (!m_doc->masterPageMode())
-			menuPDF->addAction(m_ScMW->scrActions["itemPDFIsBookmark"]);
-		if (selectedItemCount == 1)
-		{
-			menuPDF->addSeparator();
-			if (m_actionList.contains("itemPDFAnnotationProps"))
-				menuPDF->addAction(m_ScMW->scrActions["itemPDFAnnotationProps"]);
-			if (m_actionList.contains("itemPDFFieldProps"))
-				menuPDF->addAction(m_ScMW->scrActions["itemPDFFieldProps"]);
-		}
-	}
-	//-->
-
-	//<-- Item Locking
+
+
+
 	addSeparator();
-	//-->
+
 	
 	if (selectedItemCount>0)
 	{
+		//<-- Item Locking
 		menuLocking->addAction(m_ScMW->scrActions["itemLock"]);
 		menuLocking->addAction(m_ScMW->scrActions["itemLockSize"]);
 		QAction *actL = addMenu(menuLocking);
 		actL->setText( tr("Locking"));
-
+		//-->
+
+		//<-- Send To
 		QAction *actST = addMenu(menuSendTo);
 		actST->setText( tr("Send to"));
 		QAction *actScr = menuSendTo->addMenu(menuScrapbook);
@@ -397,6 +406,8 @@
 		}
 		//-->
 	}
+
+
 	//<-- Add Groups Items
 	if (selectedItemCount > 1)
 	{
@@ -413,7 +424,7 @@
 	}
 	//-->
 
-	//<-- Add Level Item
+	//<-- Add Level Items
 	if (!currItem->locked())
 	{
 		menuLevel->addAction(m_ScMW->scrActions["itemRaise"]);
@@ -450,36 +461,53 @@
 		}
 	}
 	//-->
-	
+	//<-- Item Attributes
+	if (selectedItemCount == 1)
+	{
+		addSeparator();
+		addAction(m_ScMW->scrActions["itemAttributes"]);
+	}
+	//-->
+
+	//<-- Item PDF Options
+	if (currItem->itemType() == PageItem::TextFrame)
+	{
+		QAction *act = addMenu(menuPDF);
+		act->setText( tr("&PDF Options"));
+		menuPDF->addAction(m_ScMW->scrActions["itemPDFIsAnnotation"]);
+		if (!m_doc->masterPageMode())
+			menuPDF->addAction(m_ScMW->scrActions["itemPDFIsBookmark"]);
+		if (selectedItemCount == 1)
+		{
+			menuPDF->addSeparator();
+			if (m_actionList.contains("itemPDFAnnotationProps"))
+				menuPDF->addAction(m_ScMW->scrActions["itemPDFAnnotationProps"]);
+			if (m_actionList.contains("itemPDFFieldProps"))
+				menuPDF->addAction(m_ScMW->scrActions["itemPDFFieldProps"]);
+		}
+	}
+	//-->
+	//<<-- Edit Menu
+	addSeparator();
 	//<-- Add Copy/Paste Actions
-	addSeparator();
 	if (!currItem->locked() && !(currItem->isSingleSel))
-		addAction(m_ScMW->scrActions["editCut"]);
+		menuEdit->addAction(m_ScMW->scrActions["editCut"]);
 	if (!(currItem->isSingleSel))
-		addAction(m_ScMW->scrActions["editCopy"]);
+		menuEdit->addAction(m_ScMW->scrActions["editCopy"]);
 	if ((m_doc->appMode == modeEdit) && (ScMimeData::clipboardHasScribusText()||ScMimeData::clipboardHasPlainText()) && (currItem->itemType() == PageItem::TextFrame))
-		addAction(m_ScMW->scrActions["editPaste"]);
+		menuEdit->addAction(m_ScMW->scrActions["editPaste"]);
 	if (!currItem->locked() && (m_doc->appMode != modeEdit) && (!(currItem->isSingleSel)))
-		addAction(m_ScMW->scrActions["itemDelete"]);
-	//-->
-	
-	//<-- Add Contents Actions
-	if (itemsAreSameType)
-	{
-		if (m_actionList.contains("editCopyContents"))
-			menuEditContents->addAction(m_ScMW->scrActions["editCopyContents"]);
-		if (m_actionList.contains("editPasteContents"))
-			menuEditContents->addAction(m_ScMW->scrActions["editPasteContents"]);
-		if (currItem->asImageFrame() && m_actionList.contains("editPasteContentsAbs"))
-			menuEditContents->addAction(m_ScMW->scrActions["editPasteContentsAbs"]);
-	}
-	if (m_actionList.contains("editClearContents"))
-		menuEditContents->addAction(m_ScMW->scrActions["editClearContents"]);
-	if (menuEditContents->actions().count()>0)
-	{
-		QAction *act = addMenu(menuEditContents);
-		act->setText( tr("Contents"));
-	}
+		menuEdit->addAction(m_ScMW->scrActions["itemDelete"]);
+	//-->
+	//<-- Add undo
+	UndoManager * const undoManager(UndoManager::instance());
+	if (undoManager->hasUndoActions())
+		menuEdit->addAction(m_ScMW->scrActions["editUndoAction"]);
+	if (undoManager->hasRedoActions())
+		menuEdit->addAction(m_ScMW->scrActions["editRedoAction"]);
+	QAction *actEdit = addMenu(menuEdit);
+	actEdit->setText( tr("Edit"));
+	//-->
 	//-->
 	
 	//<-- Add Welding Menu




More information about the scribus-commit mailing list