r14423 by fschmid - Follow Up to Bug #8653: don't group objects if they already form a group

scribus-commit scribus-commit at lists.scribus.net
Thu Dec 17 17:25:18 CET 2009


Revision: 14423
Author: fschmid
Date: 2009-12-17T04:53:17.986828Z
Commit message: Follow Up to Bug #8653: don't group objects if they already form a group

Changeset: 
M  /trunk/Scribus/scribus/scribus.cpp

Diffs:
Index: scribus/scribus.cpp
===================================================================
--- scribus/scribus.cpp	(revision 14422)
+++ scribus/scribus.cpp	(revision 14423)
@@ -9293,12 +9293,34 @@
 	internalCopy = true;
 	doc->useRaster = false;
 	doc->SnapGuides = false;
+	bool isGroup = true;
+	int firstElem = -1;
+	PageItem* currItem = doc->m_Selection->itemAt(0);
+	if (currItem->Groups.count() != 0)
+		firstElem = currItem->Groups.top();
+	for (uint bx = 0; bx < docSelectionCount; ++bx)
+	{
+		PageItem* bxi = doc->m_Selection->itemAt(bx);
+		if (bxi->Groups.count() != 0)
+		{
+			if (bxi->Groups.top() != firstElem)
+			{
+				isGroup = false;
+				break;
+			}
+		}
+		else
+		{
+			isGroup = false;
+			break;
+		}
+	}
 	Selection itemSelection(this, false);
 	itemSelection.copy(*doc->m_Selection, false);
 	slotEditCopy();
 	doc->m_Selection->delaySignalsOn();
 	view->Deselect(true);
-	if (docSelectionCount > 1)
+	if ((docSelectionCount > 1) && (!isGroup))
 	{
 		z = doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, 0, 0, 10, 10, 0, CommonStrings::None, CommonStrings::None, true);
 		groupItem = doc->Items->at(z);
@@ -9308,7 +9330,7 @@
 	doc->SnapGuides = savedAlignGuides;
 	internalCopy = false;
 	int ae = doc->Items->count();
-	if (docSelectionCount > 1)
+	if ((docSelectionCount > 1) && (!isGroup))
 	{
 		double minx = 99999.9;
 		double miny = 99999.9;
@@ -9341,7 +9363,7 @@
 	}
 	ScPattern pat = ScPattern();
 	pat.setDoc(doc);
-	PageItem* currItem = doc->Items->at(ac);
+	currItem = doc->Items->at(ac);
 	pat.pattern = currItem->DrawObj_toImage();
 	pat.width = currItem->gWidth;
 	pat.height = currItem->gHeight;




More information about the scribus-commit mailing list