r16970 by fschmid - Fixed incorrect behaviour of "PutToPatterns" and in editing symbols

scribus-commit scribus-commit at lists.scribus.net
Thu Nov 10 23:30:36 UTC 2011


Author: fschmid
Date: Thu Nov 10 23:30:36 2011
New Revision: 16970

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=16970
Log:
Fixed incorrect behaviour of "PutToPatterns" and in editing symbols

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

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16970&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Thu Nov 10 23:30:36 2011
@@ -10022,8 +10022,8 @@
 	maxx = qMax(maxx, x2);
 	maxy = qMax(maxy, y2);
 	pat.pattern = currItem->DrawObj_toImage(qMax(maxx - minx, maxy - miny));
-	pat.width = currItem->gWidth;
-	pat.height = currItem->gHeight;
+	pat.width = maxx - minx;
+	pat.height = maxy - miny;
 	pat.items.append(currItem);
 	if (doc->docPatterns.contains(patternName))
 		doc->docPatterns.remove(patternName);
@@ -10032,6 +10032,9 @@
 	double y = currItem->yPos();
 	double w = currItem->width();
 	double h = currItem->height();
+	currItem->setXYPos(0, 0, true);
+	currItem->gXpos = currItem->xPos();
+	currItem->gYpos = currItem->yPos();
 	int d = doc->Items->indexOf(currItem);
 	z = doc->itemAdd(PageItem::Symbol, PageItem::Rectangle, x, y, w, h, 0, CommonStrings::None, CommonStrings::None, true);
 	PageItem* groupItem = doc->Items->takeAt(z);

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16970&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Thu Nov 10 23:30:36 2011
@@ -5647,16 +5647,34 @@
 			}
 		}
 		currItem = Items->at(0);
-		docPatterns[currentEditedSymbol].pattern = currItem->DrawObj_toImage(qMax(currItem->gWidth, currItem->gHeight));
-		docPatterns[currentEditedSymbol].width = currItem->gWidth;
-		docPatterns[currentEditedSymbol].height = currItem->gHeight;
+		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);
+		currItem->setXYPos(0, 0, true);
+		currItem->gXpos = currItem->xPos();
+		currItem->gYpos = currItem->yPos();
+		docPatterns[currentEditedSymbol].pattern = currItem->DrawObj_toImage(qMax(maxx - minx, maxy - miny));
+		docPatterns[currentEditedSymbol].width = maxx - minx;
+		docPatterns[currentEditedSymbol].height = maxy - miny;
 		if (m_ScMW->patternsDependingOnThis.count() > 1)
 		{
 			for (int a = 1; a < m_ScMW->patternsDependingOnThis.count(); a++)
 			{
 				Items = &docPatterns[m_ScMW->patternsDependingOnThis[a]].items;
 				currItem = Items->at(0);
-				docPatterns[m_ScMW->patternsDependingOnThis[a]].pattern = currItem->DrawObj_toImage(qMax(currItem->gWidth, currItem->gHeight));
+				currItem->getVisualBoundingRect(&x1, &y1, &x2, &y2);
+				minx = qMin(minx, x1);
+				miny = qMin(miny, y1);
+				maxx = qMax(maxx, x2);
+				maxy = qMax(maxy, y2);
+				docPatterns[m_ScMW->patternsDependingOnThis[a]].pattern = currItem->DrawObj_toImage(qMax(maxx - minx, maxy - miny));
 			}
 		}
 		if (masterPageMode())




More information about the scribus-commit mailing list