r17130 by fschmid - Fixed "Convert to Outline" for items inside groups.

scribus-commit scribus-commit at lists.scribus.net
Tue Dec 27 19:00:57 UTC 2011


Author: fschmid
Date: Tue Dec 27 19:00:57 2011
New Revision: 17130

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17130
Log:
Fixed "Convert to Outline" for items inside groups.

Modified:
    trunk/Scribus/scribus/scribusview.cpp

Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17130&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp (original)
+++ trunk/Scribus/scribus/scribusview.cpp Tue Dec 27 19:00:57 2011
@@ -79,6 +79,7 @@
 #include "commonstrings.h"
 #include "filewatcher.h"
 #include "hyphenator.h"
+#include "pageitem_group.h"
 #include "pageitem_imageframe.h"
 #include "pageitem_line.h"
 #include "pageitem_pathtext.h"
@@ -3878,19 +3879,33 @@
 			delItems.append(tmpSelection.takeItem(offset));
 		}
 		tmpSelection.clear();
-		int ind = Doc->Items->indexOf(currItem);
+		int ind = -1;
+		if (currItem->Parent == NULL)
+			ind = Doc->Items->indexOf(currItem);
+		else
+		{
+			ind = currItem->Parent->asGroupFrame()->groupItemList.indexOf(currItem);
+		}
 		if (newGroupedItems.count() > 1)
 		{
-			for (int ag = 0; ag < newGroupedItems.count(); ++ag)
-			{
-				Doc->Items->insert(ind+1+ag, newGroupedItems.at(ag));
-				tmpSelection.addItem(newGroupedItems.at(ag));
-			}
-			Doc->itemSelection_GroupObjects(true, false, &tmpSelection);
+			int z = Doc->itemAdd(PageItem::Group, PageItem::Rectangle, currItem->xPos(), currItem->yPos(), currItem->width(), currItem->height(), 0, CommonStrings::None, CommonStrings::None, true);
+			PageItem *gItem = Doc->Items->takeAt(z);
+			Doc->groupObjectsToItem(gItem, newGroupedItems);
+			gItem->Parent = currItem->Parent;
+			gItem->gXpos = currItem->gXpos;
+			gItem->gYpos = currItem->gYpos;
+			if (currItem->Parent == NULL)
+				Doc->Items->insert(ind+1, gItem);
+			else
+				currItem->Parent->asGroupFrame()->groupItemList.insert(ind+1, gItem);
 		}
 		else if (newGroupedItems.count() > 0)
 		{
-			Doc->Items->insert(ind+1, newGroupedItems.at(0));
+			newGroupedItems.at(0)->Parent = currItem->Parent;
+			if (currItem->Parent == NULL)
+				Doc->Items->insert(ind+1, newGroupedItems.at(0));
+			else
+				currItem->Parent->asGroupFrame()->groupItemList.insert(ind+1, newGroupedItems.at(0));
 		}
 		int toDeleteItemCount=delItems.count();
 		if (toDeleteItemCount != 0)




More information about the scribus-commit mailing list