r16384 by fschmid - Scribus 1.5.0 format plugin: don't save path data for Arc, RegularPolygon and Spiral items.

scribus-commit scribus-commit at lists.scribus.net
Thu Feb 17 22:25:57 CET 2011


Author: fschmid
Date: Thu Feb 17 21:25:57 2011
New Revision: 16384

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16384
Log:
Scribus 1.5.0 format plugin: don't save path data for Arc, RegularPolygon and Spiral items.

Modified:
    trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
    trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16384&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp Thu Feb 17 21:25:57 2011
@@ -3640,63 +3640,6 @@
 		currItem->DashValues.clear();
 	currItem->DashOffset = attrs.valueAsDouble("DASHOFF", 0.0);
 
-	tmp = "";
-	if (attrs.hasAttribute("NUMPO"))
-	{
-		currItem->PoLine.resize(attrs.valueAsUInt("NUMPO"));
-		tmp = attrs.valueAsString("POCOOR");
-		ScTextStream fp(&tmp, QIODevice::ReadOnly);
-		uint numPo = attrs.valueAsUInt("NUMPO");
-		for (uint cx=0; cx < numPo; ++cx)
-		{
-			fp >> xf;
-			fp >> yf;
-			currItem->PoLine.setPoint(cx, xf, yf);
-		}
-	}
-	else
-	{
-		currItem->PoLine.resize(0);
-		currItem->PoLine.parseSVG(attrs.valueAsString("path"));
-	}
-
-	tmp = "";
-	if (attrs.hasAttribute("NUMCO"))
-	{
-		currItem->ContourLine.resize(attrs.valueAsUInt("NUMCO"));
-		tmp = attrs.valueAsString("COCOOR");
-		ScTextStream fp(&tmp, QIODevice::ReadOnly);
-		uint numCo = attrs.valueAsUInt("NUMCO");
-		for (uint cx=0; cx < numCo; ++cx)
-		{
-			fp >> xf;
-			fp >> yf;
-			currItem->ContourLine.setPoint(cx, xf, yf);
-		}
-	}
-	else if (attrs.hasAttribute("copath"))
-		currItem->ContourLine.parseSVG(attrs.valueAsString("copath"));
-	else
-		currItem->ContourLine = currItem->PoLine.copy();
-
-	if (!currItem->asLine())
-		currItem->Clip = FlattenPath(currItem->PoLine, currItem->Segments);
-	else
-	{
-		int ph = static_cast<int>(qMax(1.0, currItem->lineWidth() / 2.0));
-		currItem->Segments.clear();
-		currItem->PoLine.resize(0);
-		currItem->Clip.setPoints(4, -ph,-ph, static_cast<int>(currItem->width()+ph),-ph,
-		                  static_cast<int>(currItem->width()+ph),static_cast<int>(currItem->height()+ph),
-		                  -ph,static_cast<int>(currItem->height()+ph));
-		currItem->setHeight(1.0);
-	}
-
-	if (currItem->asPathText())
-	{
-		currItem->updatePolyClip();
-		currItem->Frame = true;
-	}
 	if (currItem->asRegularPolygon())
 	{
 		PageItem_RegularPolygon *regitem = currItem->asRegularPolygon();
@@ -3707,21 +3650,83 @@
 		regitem->polyCurvature    = attrs.valueAsDouble("POLYCUR", 0.0);
 		regitem->polyOuterCurvature    = attrs.valueAsDouble("POLYOCUR", 0.0);
 		regitem->polyUseFactor    = attrs.valueAsBool("POLYS", false);
-	}
-	if (currItem->asArc())
+		regitem->recalcPath();
+	}
+	else if (currItem->asArc())
 	{
 		PageItem_Arc *arcitem = currItem->asArc();
 		arcitem->arcHeight     = attrs.valueAsDouble("arcHeight", 1.0);
 		arcitem->arcWidth      = attrs.valueAsDouble("arcWidth", 1.0);
 		arcitem->arcStartAngle = attrs.valueAsDouble("arcStartAngle", 30.0);
 		arcitem->arcSweepAngle = attrs.valueAsDouble("arcSweepAngle", 300.0);
-	}
-	if (currItem->asSpiral())
+		arcitem->recalcPath();
+	}
+	else if (currItem->asSpiral())
 	{
 		PageItem_Spiral *arcitem = currItem->asSpiral();
 		arcitem->spiralStartAngle = attrs.valueAsDouble("spiralStartAngle", 0.0);
 		arcitem->spiralEndAngle = attrs.valueAsDouble("spiralEndAngle", 360.0);
 		arcitem->spiralFactor = attrs.valueAsDouble("spiralFactor", 1.2);
+		arcitem->recalcPath();
+	}
+	else
+	{
+		tmp = "";
+		if (attrs.hasAttribute("NUMPO"))
+		{
+			currItem->PoLine.resize(attrs.valueAsUInt("NUMPO"));
+			tmp = attrs.valueAsString("POCOOR");
+			ScTextStream fp(&tmp, QIODevice::ReadOnly);
+			uint numPo = attrs.valueAsUInt("NUMPO");
+			for (uint cx=0; cx < numPo; ++cx)
+			{
+				fp >> xf;
+				fp >> yf;
+				currItem->PoLine.setPoint(cx, xf, yf);
+			}
+		}
+		else
+		{
+			currItem->PoLine.resize(0);
+			currItem->PoLine.parseSVG(attrs.valueAsString("path"));
+		}
+	}
+	tmp = "";
+	if (attrs.hasAttribute("NUMCO"))
+	{
+		currItem->ContourLine.resize(attrs.valueAsUInt("NUMCO"));
+		tmp = attrs.valueAsString("COCOOR");
+		ScTextStream fp(&tmp, QIODevice::ReadOnly);
+		uint numCo = attrs.valueAsUInt("NUMCO");
+		for (uint cx=0; cx < numCo; ++cx)
+		{
+			fp >> xf;
+			fp >> yf;
+			currItem->ContourLine.setPoint(cx, xf, yf);
+		}
+	}
+	else if (attrs.hasAttribute("copath"))
+		currItem->ContourLine.parseSVG(attrs.valueAsString("copath"));
+	else
+		currItem->ContourLine = currItem->PoLine.copy();
+
+	if (!currItem->asLine())
+		currItem->Clip = FlattenPath(currItem->PoLine, currItem->Segments);
+	else
+	{
+		int ph = static_cast<int>(qMax(1.0, currItem->lineWidth() / 2.0));
+		currItem->Segments.clear();
+		currItem->PoLine.resize(0);
+		currItem->Clip.setPoints(4, -ph,-ph, static_cast<int>(currItem->width()+ph),-ph,
+		                  static_cast<int>(currItem->width()+ph),static_cast<int>(currItem->height()+ph),
+		                  -ph,static_cast<int>(currItem->height()+ph));
+		currItem->setHeight(1.0);
+	}
+
+	if (currItem->asPathText())
+	{
+		currItem->updatePolyClip();
+		currItem->Frame = true;
 	}
 	currItem->GrType = attrs.valueAsInt("GRTYP", 0);
 	QString GrColor;

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16384&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp Thu Feb 17 21:25:57 2011
@@ -1980,7 +1980,8 @@
 		docu.writeAttribute("DASHS", dlp);
 		docu.writeAttribute("DASHOFF", item->DashOffset);
 	}
-	docu.writeAttribute("path", item->PoLine.svgPath(!item->isPolyLine()));
+	if (!(item->isArc() || item->isSpiral() || item->isRegularPolygon()))
+		docu.writeAttribute("path", item->PoLine.svgPath(!item->isPolyLine()));
 	QString colp = item->ContourLine.svgPath(true);
 	if (!colp.isEmpty())
 		docu.writeAttribute("copath", colp);




More information about the scribus-commit mailing list