r17128 by fschmid - Fixed "PutToPatterns" for items inside groups.

scribus-commit scribus-commit at lists.scribus.net
Tue Dec 27 17:27:18 UTC 2011


Author: fschmid
Date: Tue Dec 27 17:27:18 2011
New Revision: 17128

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

Modified:
    trunk/Scribus/scribus/pageitem.cpp
    trunk/Scribus/scribus/scribus.cpp

Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17128&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp (original)
+++ trunk/Scribus/scribus/pageitem.cpp Tue Dec 27 17:27:18 2011
@@ -386,8 +386,8 @@
 	QString tmp;
 	BackBox = 0;
 	NextBox = 0;
-	oldXpos = Xpos = x;
-	oldYpos = Ypos = y;
+	gXpos = oldXpos = Xpos = x;
+	gYpos = oldYpos = Ypos = y;
 	//CB Surely we can remove some of these?
 	OldB2 = OldB = oldWidth = Width = w;
 	OldH2 = OldH = oldHeight = Height = h;
@@ -399,7 +399,6 @@
 	oldRot = Rot = 0;
 	fillColorVal = fill;
 	lineColorVal = m_ItemType == PageItem::TextFrame ? fill : outline;
-	gXpos = gYpos = 0;
 	gWidth = gHeight = 0;
 	GrType = 0;
 	GrStartX = 0;

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17128&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Tue Dec 27 17:27:18 2011
@@ -9879,14 +9879,28 @@
 	if (doc->docPatterns.contains(patternName))
 		doc->docPatterns.remove(patternName);
 	doc->addPattern(patternName, pat);
+	int d = -1;
+	double sx = minx;
+	double sy = miny;
+	if (currItem->Parent == NULL)
+		d = doc->Items->indexOf(currItem);
+	else
+	{
+		sx = currItem->gXpos;
+		sy = currItem->gYpos;
+		d = currItem->Parent->asGroupFrame()->groupItemList.indexOf(currItem);
+	}
 	currItem->gXpos = currItem->xPos() - minx;
 	currItem->gYpos = currItem->yPos() - miny;
 	currItem->setXYPos(currItem->gXpos, currItem->gYpos, true);
-	int d = doc->Items->indexOf(currItem);
-	z = doc->itemAdd(PageItem::Symbol, PageItem::Rectangle, minx, miny, maxx - minx, maxy - miny, 0, CommonStrings::None, CommonStrings::None, true);
+	z = doc->itemAdd(PageItem::Symbol, PageItem::Rectangle, sx, sy, maxx - minx, maxy - miny, 0, CommonStrings::None, CommonStrings::None, true);
 	PageItem* groupItem = doc->Items->takeAt(z);
 	groupItem->setPattern(patternName);
-	doc->Items->replace(d, groupItem);
+	groupItem->Parent = currItem->Parent;
+	if (currItem->Parent == NULL)
+		doc->Items->replace(d, groupItem);
+	else
+		currItem->Parent->asGroupFrame()->groupItemList.replace(d, groupItem);
 	doc->m_Selection->delaySignalsOff();
 	propertiesPalette->updateColorList();
 	symbolPalette->updateSymbolList();




More information about the scribus-commit mailing list