r14271 by fschmid - Xara Importer: support for regular shapes, this time with working positioning.

scribus-commit scribus-commit at lists.scribus.net
Mon Nov 9 18:10:20 CET 2009


Revision: 14271
Author: fschmid
Date: 2009-11-09T10:41:42.912657Z
Commit message: Xara Importer: support for regular shapes, this time with working positioning.

Changeset: 
M  /trunk/Scribus/scribus/plugins/xarimplugin/importxar.cpp

Diffs:
Index: scribus/plugins/xarimplugin/importxar.cpp
===================================================================
--- scribus/plugins/xarimplugin/importxar.cpp	(revision 14270)
+++ scribus/plugins/xarimplugin/importxar.cpp	(revision 14271)
@@ -601,17 +601,22 @@
 //	qDebug() << "Bytes read" << bytesRead << "of" << dataLen;
 	ts.skipRawData(dataLen - bytesRead);
 	int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, baseX, baseY, 10, 10, gc->LWidth, gc->FillCol, gc->StrokeCol, true);
-	double w = distance(minorAxisX, minorAxisY) * 2;
-	double h = distance(majorAxisX, majorAxisY) * 2;
-	bool star = flags & 2;
-	QPainterPath path = RegularPolygon(w, h, numSides, star, r1, 45, 0);
+	double w = distance(minorAxisX, minorAxisY);
+	double h = distance(majorAxisX, majorAxisY);
 	Coords.resize(0);
 	Coords.svgInit();
+	QPainterPath path;
+	if (flags & 1)
+		path.addEllipse(QPointF(0,0), w, h);
+	else
+		path = RegularPolygon(w * 2, h * 2, numSides, flags & 2, r1, 45, 0);
 	Coords.fromQPainterPath(path);
-	Coords.translate(-w / 2.0, -h / 2.0 + docHeight);
+	if (!(flags & 1))
+		Coords.translate(-w, -h);
 	QTransform matrix(scaleX, skewX, skewY, scaleY, 0, 0);
+	Coords.map(matrix);
 	Coords.translate(transX, -transY);
-	Coords.map(matrix);
+	Coords.translate(0, docHeight);
 	finishItem(z);
 }
 
@@ -1281,13 +1286,25 @@
 
 void XarPlug::addGraphicContext()
 {
+/*	XarStyle *gc2 = m_gc.top();
+	XarStyle *gc = new XarStyle;
+	if ( m_gc.top() )
+		*gc = *( m_gc.top() );
+	m_gc.push( gc );
+	if (gc2->Elements.count() > 0)
+		gc2->Elements.removeLast(); */
 	XarStyle *gc2 = m_gc.top();
 	XarStyle *gc = new XarStyle;
 	if ( m_gc.top() )
 		*gc = *( m_gc.top() );
 	m_gc.push( gc );
 	if (gc2->Elements.count() > 0)
+	{
+		PageItem* ite = gc2->Elements.last();
+		gc->Elements.clear();
+		gc->Elements.append(ite);
 		gc2->Elements.removeLast();
+	}
 }
 
 void XarPlug::popGraphicContext()




More information about the scribus-commit mailing list