r16742 by fschmid - Adjust LayerIDs of items inside of groups too when moving groups across layers.

scribus-commit scribus-commit at lists.scribus.net
Sun Jul 31 21:40:38 UTC 2011


Author: fschmid
Date: Sun Jul 31 21:40:38 2011
New Revision: 16742

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=16742
Log:
Adjust LayerIDs of items inside of groups too when moving groups across layers.

Modified:
    trunk/Scribus/scribus/pageitem.h
    trunk/Scribus/scribus/pageitem_group.cpp
    trunk/Scribus/scribus/pageitem_group.h
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/scribusdoc.cpp

Modified: trunk/Scribus/scribus/pageitem.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16742&path=/trunk/Scribus/scribus/pageitem.h
==============================================================================
--- trunk/Scribus/scribus/pageitem.h (original)
+++ trunk/Scribus/scribus/pageitem.h Sun Jul 31 21:40:38 2011
@@ -1075,7 +1075,7 @@
 	* Set the layer for the item
 	* @param layerId layer where this item is moved
 	*/
-	void setLayer(int layerId);
+	virtual void setLayer(int layerId);
 
 	/**
 	 * @brief Check the changes to the item and add undo actions for them.

Modified: trunk/Scribus/scribus/pageitem_group.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16742&path=/trunk/Scribus/scribus/pageitem_group.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_group.cpp (original)
+++ trunk/Scribus/scribus/pageitem_group.cpp Sun Jul 31 21:40:38 2011
@@ -80,6 +80,16 @@
 			ret += embedded->getItemList();
 	}
 	return ret;
+}
+
+void PageItem_Group::setLayer(int newLayerID)
+{
+	for (int em = 0; em < groupItemList.count(); ++em)
+	{
+		PageItem* embedded = groupItemList.at(em);
+		embedded->setLayer(newLayerID);
+	}
+	LayerID = newLayerID;
 }
 
 void PageItem_Group::replaceNamedResources(ResourceCollection& newNames)

Modified: trunk/Scribus/scribus/pageitem_group.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16742&path=/trunk/Scribus/scribus/pageitem_group.h
==============================================================================
--- trunk/Scribus/scribus/pageitem_group.h (original)
+++ trunk/Scribus/scribus/pageitem_group.h Sun Jul 31 21:40:38 2011
@@ -43,12 +43,13 @@
 	virtual PageItem_Group * asGroupFrame() { return this; }
 	virtual bool isGroup() const { return true; }
 	virtual ItemType realItemType() const { return PageItem::Group; }
+	void adjustXYPosition();
 	virtual QList<PageItem*> getItemList();
+	virtual void setLayer(int layerId);
 	virtual void getNamedResources(ResourceCollection& lists) const;
 	virtual void replaceNamedResources(ResourceCollection& newNames);
 	virtual void applicableActions(QStringList& actionList);
 	virtual QString infoDescription();
-	void adjustXYPosition();
 	
 protected:
 	virtual void DrawObj_Item(ScPainter *p, QRectF e);

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16742&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Sun Jul 31 21:40:38 2011
@@ -391,8 +391,8 @@
 		scrActions["SaveAsDocumentTemplate"]->setEnabled(false);
 
 	connect(ScCore->fileWatcher, SIGNAL(fileDeleted(QString )), this, SLOT(removeRecentFromWatcher(QString)));
-	connect(this, SIGNAL(TextStyle(const ParagraphStyle&)), propertiesPalette, SLOT(updateStyle(const ParagraphStyle&)));
-	connect(this, SIGNAL(TextEffects(int)), propertiesPalette, SLOT(setStil(int)));
+//	connect(this, SIGNAL(TextStyle(const ParagraphStyle&)), propertiesPalette, SLOT(updateStyle(const ParagraphStyle&)));
+//	connect(this, SIGNAL(TextEffects(int)), propertiesPalette, SLOT(setStil(int)));
 	connect(ClipB, SIGNAL(dataChanged()), this, SLOT(ClipChange()));
 //	connect(ClipB, SIGNAL(selectionChanged()), this, SLOT(ClipChange()));
 	setAcceptDrops(true);

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16742&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Sun Jul 31 21:40:38 2011
@@ -8212,29 +8212,19 @@
 	if (tmpSelection.count() != 0)
 		itemSelection_DeleteItem(&tmpSelection);
 	tmpSelection.clear();
-	QList<PageItem*> allItems;
 	for (int b = 0; b < DocItems.count(); ++b)
 	{
 		PageItem* currItem = DocItems.at(b);
-		if (currItem->isGroup())
-			allItems = currItem->getItemList();
-		else
-			allItems.append(currItem);
-		for (int ii = 0; ii < allItems.count(); ii++)
-		{
-			currItem = allItems.at(ii);
-			if (currItem->LayerID == l)
-			{
-				if (dl)
-				{
-					tmpSelection.addItem(currItem);
-					currItem->setLocked(false);
-				}
-				else
-					currItem->setLayer(newLayerID);
-			}
-		}
-		allItems.clear();
+		if (currItem->LayerID == l)
+		{
+			if (dl)
+			{
+				tmpSelection.addItem(currItem);
+				currItem->setLocked(false);
+			}
+			else
+				currItem->setLayer(newLayerID);
+		}
 	}
 	if (tmpSelection.count() != 0)
 		itemSelection_DeleteItem(&tmpSelection);




More information about the scribus-commit mailing list