r17262 by fschmid - IDML Importer: Reading more pathtext properties.

scribus-commit scribus-commit at lists.scribus.net
Mon Jan 30 21:40:07 UTC 2012


Author: fschmid
Date: Mon Jan 30 21:40:07 2012
New Revision: 17262

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17262
Log:
IDML Importer: Reading more pathtext properties.

Modified:
    trunk/Scribus/scribus/plugins/import/idml/importidml.cpp

Modified: trunk/Scribus/scribus/plugins/import/idml/importidml.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17262&path=/trunk/Scribus/scribus/plugins/import/idml/importidml.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/idml/importidml.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/idml/importidml.cpp Mon Jan 30 21:40:07 2012
@@ -1401,6 +1401,11 @@
 					{
 						m_Doc->addPage(pagecount);
 						m_Doc->currentPage()->MPageNam = CommonStrings::trMasterPageNormal;
+						m_Doc->currentPage()->m_pageSize = "Custom";
+						m_Doc->currentPage()->setInitialHeight(docHeight);
+						m_Doc->currentPage()->setInitialWidth(docWidth);
+						m_Doc->currentPage()->setHeight(docHeight);
+						m_Doc->currentPage()->setWidth(docWidth);
 						m_Doc->view()->addPage(pagecount, true);
 						pagecount++;
 					}
@@ -1650,6 +1655,7 @@
 	QTransform imageTransform;
 	QString storyForPath = "";
 	int pathTextType = 0;
+	double pathTextStart = 0;
 	for(QDomNode it = itElem.firstChild(); !it.isNull(); it = it.nextSibling() )
 	{
 		QDomElement ite = it.toElement();
@@ -1880,6 +1886,8 @@
 				pathTextType = 0;
 			else if (ite.attribute("PathEffect") == "GravityPathEffect")		// not implemented in PathText yet
 				pathTextType = 0;
+			if (ite.hasAttribute("StartBracket"))
+				pathTextStart = ite.attribute("StartBracket").toDouble();
 		}
 	}
 	if (GCoords.size() > 0)
@@ -1940,6 +1948,7 @@
 						storyMap.insert(storyForPath, m_Doc->Items->at(z));
 					PageItem* item = m_Doc->Items->at(z);
 					item->setPathTextType(pathTextType);
+					item->setTextToFrameDistLeft(pathTextStart);
 				}
 				else if (isImage)
 				{
@@ -2008,12 +2017,22 @@
 					if (isOpen)
 					{
 						if (scX < 0)
+						{
 							item->PoLine.reverse();
+						}
 					}
 					else
 					{
 						if (scX > 0)
+						{
+							double totalCurveLen = 0;
+							for (uint segs = 0; segs < item->PoLine.size()-3; segs += 4)
+							{
+								totalCurveLen += item->PoLine.lenPathSeg(segs);
+							}
+							item->setTextToFrameDistLeft(totalCurveLen - pathTextStart);
 							item->PoLine.reverse();
+						}
 					}
 				}
 				item->OldB2 = item->width();
@@ -2108,6 +2127,7 @@
 					storyMap.insert(storyForPath, m_Doc->Items->at(z));
 				PageItem* item = m_Doc->Items->at(z);
 				item->setPathTextType(pathTextType);
+				item->setTextToFrameDistLeft(pathTextStart);
 			}
 			else if (isImage)
 			{
@@ -2179,12 +2199,22 @@
 				if (isOpen)
 				{
 					if (scX < 0)
+					{
 						item->PoLine.reverse();
+					}
 				}
 				else
 				{
 					if (scX > 0)
+					{
+						double totalCurveLen = 0;
+						for (uint segs = 0; segs < item->PoLine.size()-3; segs += 4)
+						{
+							totalCurveLen += item->PoLine.lenPathSeg(segs);
+						}
+						item->setTextToFrameDistLeft(totalCurveLen - pathTextStart);
 						item->PoLine.reverse();
+					}
 				}
 			}
 			item->setRotation(-rot, true);




More information about the scribus-commit mailing list