r18068 by fschmid - Fixed Bug #11350: Missing option from Items and Context Menu: Send to Inline Frames

scribus-commit scribus-commit at lists.scribus.net
Mon Jan 7 11:38:29 UTC 2013


Author: fschmid
Date: Mon Jan  7 11:38:29 2013
New Revision: 18068

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18068
Log:
Fixed Bug #11350: Missing option from Items and Context Menu: Send to Inline Frames

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

Modified: trunk/Scribus/scribus/actionmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18068&path=/trunk/Scribus/scribus/actionmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/actionmanager.cpp (original)
+++ trunk/Scribus/scribus/actionmanager.cpp Mon Jan  7 11:38:29 2013
@@ -421,6 +421,8 @@
 	scrActions->insert(name, new ScrAction(loadIcon("16/go-up.png"), loadIcon("22/go-up.png"), "", defaultKey(name), mainWindow));
 	name="itemSendToPattern";
 	scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
+	name="itemSendToInline";
+	scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
 	name="itemImageInfo";
 	scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
 	name="itemAttributes";
@@ -507,6 +509,8 @@
 	scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
 	name="itemConvertToTextFrame";
 	scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
+	name="itemConvertToSymbolFrame";
+	scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
 
 	name="itemsUnWeld";
 	scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
@@ -524,6 +528,8 @@
 	connect( (*scrActions)["itemPDFAnnotationProps"], SIGNAL(triggered()), mainWindow, SLOT(ModifyAnnot()) );
 	connect( (*scrActions)["itemPDFFieldProps"], SIGNAL(triggered()), mainWindow, SLOT(ModifyAnnot()) );
 	connect( (*scrActions)["itemSendToPattern"], SIGNAL(triggered()), mainWindow, SLOT(PutToPatterns()) );
+	connect( (*scrActions)["itemSendToInline"], SIGNAL(triggered()), mainWindow, SLOT(PutToInline()) );
+	connect( (*scrActions)["itemConvertToSymbolFrame"], SIGNAL(triggered()), mainWindow, SLOT(ConvertToSymbol()) );
 	connect( (*scrActions)["itemAttributes"], SIGNAL(triggered()), mainWindow, SLOT(objectAttributes()) );
 	connect( (*scrActions)["itemShapeEdit"], SIGNAL(triggered()), mainWindow, SLOT(toggleNodeEdit()) );
 	connect( (*scrActions)["itemImageInfo"], SIGNAL(triggered()), mainWindow, SLOT(getImageInfo()) );
@@ -1505,6 +1511,7 @@
 	(*scrActions)["itemLower"]->setTexts( tr("&Lower"));
 	(*scrActions)["itemRaise"]->setTexts( tr("&Raise"));
 	(*scrActions)["itemSendToPattern"]->setTexts( tr("Send to Patterns"));
+	(*scrActions)["itemSendToInline"]->setTexts( tr("Send to Inline Items"));
 	(*scrActions)["itemAttributes"]->setTexts( tr("&Attributes..."));
 	(*scrActions)["itemImageInfo"]->setTexts( tr("More Info..."));
 	(*scrActions)["itemImageIsVisible"]->setTexts( tr("I&mage Visible"));
@@ -1543,6 +1550,7 @@
 	(*scrActions)["itemConvertToOutlines"]->setTexts( tr("&Outlines", "Convert to oulines"));
 	(*scrActions)["itemConvertToPolygon"]->setTexts( tr("&Polygon"));
 	(*scrActions)["itemConvertToTextFrame"]->setTexts( tr("&Text Frame"));
+	(*scrActions)["itemConvertToSymbolFrame"]->setTexts( tr("&Symbol"));
 	(*scrActions)["itemsUnWeld"]->setTexts( tr("Unweld items"));
 	(*scrActions)["itemWeld"]->setTexts( tr("Weld items"));
 	(*scrActions)["itemEditWeld"]->setTexts( tr("Edit weld item"));
@@ -2025,6 +2033,7 @@
 		<< "itemRaiseToTop" 
 		<< "itemLowerToBottom" 
 		<< "itemSendToPattern" 
+		<< "itemSendToInline"
 		<< "itemAttributes" 
 		<< "itemPDFIsAnnotation" 
 		<< "itemPDFIsBookmark" 
@@ -2036,6 +2045,7 @@
 		<< "itemConvertToOutlines" 
 		<< "itemConvertToPolygon" 
 		<< "itemConvertToTextFrame" 
+		<< "itemConvertToSymbolFrame"
 		<< "itemAttachTextToPath" 
 		<< "itemDetachTextFromPath" 
 		<< "itemCombinePolygons" 

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18068&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Mon Jan  7 11:38:29 2013
@@ -784,8 +784,6 @@
 	scrMenuMgr->addMenuSeparator("Edit");
 	scrMenuMgr->addMenuItem(scrActions["editColors"], "Edit", true);
 	scrMenuMgr->addMenuItem(scrActions["editReplaceColors"], "Edit", false);
-//	scrMenuMgr->addMenuItem(scrActions["editGradients"], "Edit", false);
-//	scrMenuMgr->addMenuItem(scrActions["editPatterns"], "Edit", false);
 	scrMenuMgr->addMenuItem(scrActions["editStyles"], "Edit", false);
 	scrMenuMgr->addMenuItem(scrActions["editMarks"], "Edit", false);
 	scrMenuMgr->addMenuItem(scrActions["editNotesStyles"], "Edit", false);
@@ -841,6 +839,7 @@
 	scrMenuMgr->addMenuToMenu("itemSendToScrapbook", "Item");
 //	scrMenuMgr->addMenuItem(scrActions["itemSendToScrapbook"], "Item", false);
 	scrMenuMgr->addMenuItem(scrActions["itemSendToPattern"], "Item", false);
+	scrMenuMgr->addMenuItem(scrActions["itemSendToInline"], "Item", false);
 	// Table submenu.
 	scrMenuMgr->addMenuSeparator("Item");
 	scrMenuMgr->createMenu("ItemTable", tr("Table"));
@@ -890,6 +889,7 @@
 	scrMenuMgr->addMenuItem(scrActions["itemConvertToOutlines"], "ItemConvertTo", false);
 	scrMenuMgr->addMenuItem(scrActions["itemConvertToPolygon"], "ItemConvertTo", false);
 	scrMenuMgr->addMenuItem(scrActions["itemConvertToTextFrame"], "ItemConvertTo", false);
+	scrMenuMgr->addMenuItem(scrActions["itemConvertToSymbolFrame"], "ItemConvertTo", false);
 	scrMenuMgr->addMenuSeparator("Item");
 	scrMenuMgr->addMenuItem(scrActions["toolsLinkTextFrame"], "Item", false);
 	scrMenuMgr->addMenuItem(scrActions["toolsUnlinkTextFrame"], "Item", false);
@@ -2853,6 +2853,7 @@
 //		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);
@@ -2871,6 +2872,7 @@
 		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);
@@ -2916,6 +2918,7 @@
 		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);
@@ -2930,6 +2933,7 @@
 		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);
@@ -2969,6 +2973,7 @@
 		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);
@@ -2984,6 +2989,7 @@
 		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);
@@ -2997,6 +3003,7 @@
 			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);
@@ -3085,6 +3092,7 @@
 //		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);
@@ -3102,6 +3110,7 @@
 		scrActions["itemConvertToOutlines"]->setEnabled(true);
 		scrActions["itemConvertToPolygon"]->setEnabled(false);
 		scrActions["itemConvertToTextFrame"]->setEnabled(false);
+		scrActions["itemConvertToSymbolFrame"]->setEnabled(true);
 
 		scrActions["toolsRotate"]->setEnabled(true);
 		scrActions["toolsCopyProperties"]->setEnabled(true);
@@ -3150,6 +3159,7 @@
 //		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);
@@ -3167,6 +3177,7 @@
 			scrActions["itemConvertToOutlines"]->setEnabled(false);
 			scrActions["itemConvertToPolygon"]->setEnabled(false);
 			scrActions["itemConvertToTextFrame"]->setEnabled(doc->appMode != modeEdit);
+			scrActions["itemConvertToSymbolFrame"]->setEnabled(doc->appMode != modeEdit);
 		}
 		else if ((SelectedType == PageItem::RegularPolygon) || (SelectedType == PageItem::Arc)) // Regular Polygon + Arc
 		{
@@ -3176,6 +3187,7 @@
 			scrActions["itemConvertToOutlines"]->setEnabled(false);
 			scrActions["itemConvertToPolygon"]->setEnabled(doc->appMode != modeEdit);
 			scrActions["itemConvertToTextFrame"]->setEnabled(doc->appMode != modeEdit);
+			scrActions["itemConvertToSymbolFrame"]->setEnabled(doc->appMode != modeEdit);
 		}
 		else if (SelectedType == PageItem::PolyLine) //Polyline
 		{
@@ -3185,6 +3197,7 @@
 			scrActions["itemConvertToOutlines"]->setEnabled(false);
 			scrActions["itemConvertToPolygon"]->setEnabled(doc->appMode != modeEdit);
 			scrActions["itemConvertToTextFrame"]->setEnabled(false);
+			scrActions["itemConvertToSymbolFrame"]->setEnabled(doc->appMode != modeEdit);
 		}
 		else if ((SelectedType == PageItem::Line) || (SelectedType == PageItem::Spiral)) // Line
 		{
@@ -3197,6 +3210,7 @@
 			else
 				scrActions["itemConvertToPolygon"]->setEnabled(false);
 			scrActions["itemConvertToTextFrame"]->setEnabled(false);
+			scrActions["itemConvertToSymbolFrame"]->setEnabled(doc->appMode != modeEdit);
 		}
 		else if (SelectedType == PageItem::Symbol)
 			scrMenuMgr->setMenuEnabled("ItemConvertTo", false);
@@ -3230,6 +3244,7 @@
 			//scrActions["itemConvertToOutlines"]->setEnabled(false);
 			scrActions["itemConvertToPolygon"]->setEnabled(false);
 			scrActions["itemConvertToTextFrame"]->setEnabled(false);
+			scrActions["itemConvertToSymbolFrame"]->setEnabled(false);
 		}
 		scrActions["editSearchReplace"]->setEnabled(false);
 
@@ -3313,6 +3328,7 @@
 			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);
@@ -3326,6 +3342,7 @@
 //			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["toolsRotate"]->setEnabled(false);
@@ -3341,6 +3358,7 @@
 //			scrActions["itemSendToScrapbook"]->setEnabled(setter);
 			scrMenuMgr->setMenuEnabled("itemSendToScrapbook", true);
 			scrActions["itemSendToPattern"]->setEnabled(true);
+			scrActions["itemSendToInline"]->setEnabled(true);
 			if (docSelectionCount > 1)
 			{
 				bool haveSameParent = true;
@@ -4905,6 +4923,7 @@
 //		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);
@@ -6808,6 +6827,7 @@
 //				scrActions["itemSendToScrapbook"]->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(true);
@@ -6861,6 +6881,7 @@
 //			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);
@@ -10356,6 +10377,7 @@
 	doc->SnapGrid  = false;
 	doc->SnapGuides = false;
 	doc->SnapElement = false;
+	bool wasUndo = undoManager->undoEnabled();
 	undoManager->setUndoEnabled(false);
 	slotElemRead(buffer, 0, 0, false, true, doc, view);
 	doc->SnapGrid  = savedAlignGrid;
@@ -10392,18 +10414,219 @@
 	*doc->m_Selection=tempSelection;
 	doc->minCanvasCoordinate = minSize;
 	doc->maxCanvasCoordinate = maxSize;
-	undoManager->setUndoEnabled(true);
+	undoManager->setUndoEnabled(wasUndo);
 	inlinePalette->unsetDoc();
 	inlinePalette->setDoc(doc);
 	view->Deselect(false);
 }
 
+void ScribusMainWindow::PutToInline()
+{
+	Selection tempSelection(*doc->m_Selection);
+	bool savedAlignGrid = doc->SnapGrid;
+	bool savedAlignGuides = doc->SnapGuides;
+	bool savedAlignElement = doc->SnapElement;
+	int ac = doc->Items->count();
+	bool isGroup = false;
+	double gx, gy, gh, gw;
+	FPoint minSize = doc->minCanvasCoordinate;
+	FPoint maxSize = doc->maxCanvasCoordinate;
+	doc->SnapGrid  = false;
+	doc->SnapGuides = false;
+	doc->SnapElement = false;
+	bool wasUndo = undoManager->undoEnabled();
+	undoManager->setUndoEnabled(false);
+	internalCopy = true;
+	slotEditCopy();
+	slotElemRead(internalCopyBuffer, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), false, true, doc, view);
+	internalCopy = false;
+	doc->SnapGrid  = savedAlignGrid;
+	doc->SnapGuides = savedAlignGuides;
+	doc->SnapElement = savedAlignElement;
+	doc->m_Selection->clear();
+	if (doc->Items->count() - ac > 1)
+		isGroup = true;
+	doc->m_Selection->delaySignalsOn();
+	for (int as = ac; as < doc->Items->count(); ++as)
+	{
+		doc->m_Selection->addItem(doc->Items->at(as));
+	}
+	if (isGroup)
+		doc->GroupCounter++;
+	doc->m_Selection->setGroupRect();
+	doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
+	PageItem* currItem3 = doc->Items->at(ac);
+	currItem3->isEmbedded = true;
+	currItem3->setIsAnnotation(false);
+	currItem3->isBookmark = false;
+	currItem3->gXpos = currItem3->xPos() - gx;
+	currItem3->gYpos = currItem3->yPos() - gy;
+	currItem3->gWidth = gw;
+	currItem3->gHeight = gh;
+	doc->addToInlineFrames(currItem3);
+	int acc = doc->Items->count();
+	for (int as = ac; as < acc; ++as)
+	{
+		doc->Items->takeAt(ac);
+	}
+	doc->m_Selection->clear();
+	doc->m_Selection->delaySignalsOff();
+	*doc->m_Selection=tempSelection;
+	doc->minCanvasCoordinate = minSize;
+	doc->maxCanvasCoordinate = maxSize;
+	undoManager->setUndoEnabled(wasUndo);
+	inlinePalette->unsetDoc();
+	inlinePalette->setDoc(doc);
+	view->Deselect(false);
+}
+
 void ScribusMainWindow::PutToPatterns()
+{
+	QString patternName = "Pattern_"+doc->m_Selection->itemAt(0)->itemName();
+	patternName = patternName.trimmed().simplified().replace(" ", "_");
+	bool savedAlignGrid = doc->SnapGrid;
+	bool savedAlignGuides = doc->SnapGuides;
+	bool savedAlignElement = doc->SnapElement;
+	int ac = doc->Items->count();
+	FPoint minSize = doc->minCanvasCoordinate;
+	FPoint maxSize = doc->maxCanvasCoordinate;
+	doc->SnapGrid  = false;
+	doc->SnapGuides = false;
+	doc->SnapElement = false;
+	bool wasUndo = undoManager->undoEnabled();
+	undoManager->setUndoEnabled(false);
+	internalCopy = true;
+	slotEditCopy();
+	slotElemRead(internalCopyBuffer, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), false, true, doc, view);
+	internalCopy = false;
+	doc->SnapGrid  = savedAlignGrid;
+	doc->SnapGuides = savedAlignGuides;
+	doc->SnapElement = savedAlignElement;
+	doc->m_Selection->clear();
+	view->Deselect(true);
+	PageItem* currItem;
+	doc->m_Selection->delaySignalsOn();
+	for (int as = ac; as < doc->Items->count(); ++as)
+	{
+		doc->m_Selection->addItem(doc->Items->at(as));
+	}
+	if (doc->Items->count() - ac > 1)
+		currItem = doc->groupObjectsSelection(doc->m_Selection);
+	else
+		currItem = doc->m_Selection->itemAt(0);
+	QList<PageItem*> allItems;
+	if (currItem->isGroup())
+		allItems = currItem->asGroupFrame()->getItemList();
+	else
+		allItems.append(currItem);
+	QStringList results;
+	for (int ii = 0; ii < allItems.count(); ii++)
+	{
+		PageItem *item = allItems.at(ii);
+		if ((!results.contains(item->pattern())) && ((item->GrType == 8) || (item->itemType() == PageItem::Symbol)))
+			results.append(item->pattern());
+		if (!item->strokePattern().isEmpty())
+		{
+			if (!results.contains(item->strokePattern()))
+				results.append(item->strokePattern());
+		}
+		if (!item->patternMask().isEmpty())
+		{
+			if (!results.contains(item->patternMask()))
+				results.append(item->patternMask());
+		}
+	}
+	patternsDependingOnThis.clear();
+	QStringList mainPatterns = doc->docPatterns.keys();
+	for (int b = 0; b < results.count(); b++)
+	{
+		QString temp = results[b];
+		for (int a = 0; a < mainPatterns.count(); a++)
+		{
+			if (mainPatterns[a] != temp)
+			{
+				QStringList subPatterns;
+				subPatterns = doc->getUsedPatternsHelper(mainPatterns[a], subPatterns);
+				if (subPatterns.contains(temp))
+					patternsDependingOnThis.prepend(mainPatterns[a]);
+			}
+		}
+		patternsDependingOnThis.prepend(temp);
+	}
+	allItems.clear();
+	Query dia(this, "tt", 1, 0, tr("&Name:"), tr("New Entry"));
+	dia.setEditText(patternName, true);
+	dia.setForbiddenList(patternsDependingOnThis);
+	dia.setTestList(doc->docPatterns.keys());
+	dia.setCheckMode(true);
+	if (dia.exec())
+		patternName = dia.getEditText();
+	else
+	{
+		doc->m_Selection->clear();
+		doc->m_Selection->delaySignalsOff();
+		doc->Items->removeAll(currItem);
+		delete currItem;
+		doc->minCanvasCoordinate = minSize;
+		doc->maxCanvasCoordinate = maxSize;
+		if (outlinePalette->isVisible())
+			outlinePalette->BuildTree();
+		undoManager->setUndoEnabled(wasUndo);
+		return;
+	}
+	ScPattern pat = ScPattern();
+	pat.setDoc(doc);
+	double minx =  std::numeric_limits<double>::max();
+	double miny =  std::numeric_limits<double>::max();
+	double maxx = -std::numeric_limits<double>::max();
+	double maxy = -std::numeric_limits<double>::max();
+	double x1, x2, y1, y2;
+	currItem->getVisualBoundingRect(&x1, &y1, &x2, &y2);
+	minx = qMin(minx, x1);
+	miny = qMin(miny, y1);
+	maxx = qMax(maxx, x2);
+	maxy = qMax(maxy, y2);
+	pat.pattern = currItem->DrawObj_toImage(qMax(maxx - minx, maxy - miny));
+	pat.width = maxx - minx;
+	pat.height = maxy - miny;
+	pat.items.append(currItem);
+	// #11274 : OwnPage is not meaningful for pattern items
+	// We set consequently pattern item's OwnPage to -1
+	QList<PageItem*> patternItems = pat.items;
+	while (patternItems.count() > 0)
+	{
+		PageItem* patItem = patternItems.takeAt(0);
+		if (patItem->isGroup())
+			patternItems += patItem->groupItemList;
+		patItem->OwnPage = -1;
+	}
+	if (doc->docPatterns.contains(patternName))
+		doc->docPatterns.remove(patternName);
+	currItem->gXpos = currItem->xPos() - minx;
+	currItem->gYpos = currItem->yPos() - miny;
+	currItem->setXYPos(currItem->gXpos, currItem->gYpos, true);
+	doc->addPattern(patternName, pat);
+	doc->Items->removeAll(currItem);
+	doc->m_Selection->clear();
+	doc->m_Selection->delaySignalsOff();
+	propertiesPalette->updateColorList();
+	symbolPalette->updateSymbolList();
+	emit UpdateRequest(reqColorsUpdate);
+	if (outlinePalette->isVisible())
+		outlinePalette->BuildTree();
+	doc->minCanvasCoordinate = minSize;
+	doc->maxCanvasCoordinate = maxSize;
+	view->DrawNew();
+	undoManager->setUndoEnabled(wasUndo);
+}
+
+void ScribusMainWindow::ConvertToSymbol()
 {
 	int z;
 	uint docSelectionCount = doc->m_Selection->count();
 	QString patternName = "Pattern_"+doc->m_Selection->itemAt(0)->itemName();
 	patternName = patternName.trimmed().simplified().replace(" ", "_");
+	bool wasUndo = undoManager->undoEnabled();
 	undoManager->setUndoEnabled(false);
 	PageItem* currItem;
 	Selection itemSelection(this, false);
@@ -10520,7 +10743,7 @@
 	if (outlinePalette->isVisible())
 		outlinePalette->BuildTree();
 	view->DrawNew();
-	undoManager->setUndoEnabled(true);
+	undoManager->setUndoEnabled(wasUndo);
 }
 
 void ScribusMainWindow::managePaints()

Modified: trunk/Scribus/scribus/scribus.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18068&path=/trunk/Scribus/scribus/scribus.h
==============================================================================
--- trunk/Scribus/scribus/scribus.h (original)
+++ trunk/Scribus/scribus/scribus.h Mon Jan  7 11:38:29 2013
@@ -276,7 +276,9 @@
 	void windowsMenuActivated(int id);
 	void PutScrap(int scID);
 	void PutToInline(QString buffer);
+	void PutToInline();
 	void PutToPatterns();
+	void ConvertToSymbol();
 	void changeLayer(int);
 	void showLayer();
 	void ManageJava();

Modified: trunk/Scribus/scribus/ui/contextmenu.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18068&path=/trunk/Scribus/scribus/ui/contextmenu.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/contextmenu.cpp (original)
+++ trunk/Scribus/scribus/ui/contextmenu.cpp Mon Jan  7 11:38:29 2013
@@ -354,6 +354,7 @@
 
 //		addAction(m_AP->scrActions["itemSendToScrapbook"]);
 		addAction(m_AP->scrActions["itemSendToPattern"]);
+		addAction(m_AP->scrActions["itemSendToInline"]);
 		//<-- Add Layer Items
 		if (m_doc->layerCount() > 1)
 		{
@@ -421,6 +422,8 @@
 			menuConvertTo->addAction(m_AP->scrActions["itemConvertToPolygon"]);
 		if (m_AP->scrActions["itemConvertToTextFrame"]->isEnabled() && m_actionList.contains("itemConvertToTextFrame"))
 			menuConvertTo->addAction(m_AP->scrActions["itemConvertToTextFrame"]);
+		if (m_AP->scrActions["itemConvertToSymbolFrame"]->isEnabled())
+			menuConvertTo->addAction(m_AP->scrActions["itemConvertToSymbolFrame"]);
 		if (menuConvertTo->actions().count()>0)
 		{
 			QAction *act = addMenu(menuConvertTo);




More information about the scribus-commit mailing list