summaryrefslogtreecommitdiffstats
path: root/scribus/plugins
diff options
context:
space:
mode:
authorjghali <jghali@11d20701-8431-0410-a711-e3c959e3b870>2012-02-11 15:29:07 +0000
committerjghali <jghali@11d20701-8431-0410-a711-e3c959e3b870>2012-02-11 15:29:07 +0000
commitfa81c448b0b76a7bf18589674135b9a8e13c5d2c (patch)
tree88b8751e4457543ede469e35355ba0556429bdd9 /scribus/plugins
parent0a3229cf1860de8f59f5f59a3d0b3c563ea13df8 (diff)
downloadscribus-fa81c448b0b76a7bf18589674135b9a8e13c5d2c.tar.gz
scribus-fa81c448b0b76a7bf18589674135b9a8e13c5d2c.tar.xz
scribus-fa81c448b0b76a7bf18589674135b9a8e13c5d2c.zip
minor code cleanup in ps importer
git-svn-id: svn://scribus.net/branches/Version14x/Scribus@17292 11d20701-8431-0410-a711-e3c959e3b870
Diffstat (limited to 'scribus/plugins')
-rw-r--r--scribus/plugins/import/ps/importps.cpp53
1 files changed, 9 insertions, 44 deletions
diff --git a/scribus/plugins/import/ps/importps.cpp b/scribus/plugins/import/ps/importps.cpp
index ab3e5dc..7e0e673 100644
--- a/scribus/plugins/import/ps/importps.cpp
+++ b/scribus/plugins/import/ps/importps.cpp
@@ -583,7 +583,7 @@ void EPSPlug::parseOutput(QString fn, bool eps)
{
if ((Elements.count() != 0) && (lastPath == currPath))
{
- ite = Elements.at(Elements.count()-1);
+ ite = Elements.last();
ite->setFillColor(CurrColor);
ite->setFillTransparency(1.0 - Opacity);
lastPath = "";
@@ -627,7 +627,7 @@ void EPSPlug::parseOutput(QString fn, bool eps)
// LineW = qMax(LineW, 0.01); // Set Linewidth to be a least 0.01 pts, a Stroke without a Linewidth makes no sense
if ((Elements.count() != 0) && (lastPath == currPath))
{
- ite = Elements.at(Elements.count()-1);
+ ite = Elements.last();
ite->setLineColor(CurrColor);
ite->setLineWidth(LineW);
ite->PLineEnd = CapStyle;
@@ -680,13 +680,14 @@ void EPSPlug::parseOutput(QString fn, bool eps)
{
if (Coords.size() != 0)
{
- QString vers = QString(qVersion()).left(5);
- if (vers < "4.3.3")
+ QPainterPath tmpPath = Coords.toQPainterPath(true);
+ tmpPath = boundingBoxRect.intersected(tmpPath);
+ if ((tmpPath.boundingRect().width() != 0) && (tmpPath.boundingRect().height() != 0))
{
- clipCoords = Coords;
+ clipCoords.fromQPainterPath(tmpPath);
z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, baseX, baseY, 10, 10, 0, CommonStrings::None, CommonStrings::None, true);
ite = m_Doc->Items->at(z);
- ite->PoLine = Coords.copy(); //FIXME: try to avoid copy if FPointArray when properly shared
+ ite->PoLine = clipCoords.copy(); //FIXME: try to avoid copy if FPointArray when properly shared
ite->PoLine.translate(m_Doc->currentPage()->xOffset(), m_Doc->currentPage()->yOffset());
ite->ClipEdited = true;
ite->FrameType = 3;
@@ -712,42 +713,6 @@ void EPSPlug::parseOutput(QString fn, bool eps)
gsStackMarks.push(gsStack.count());
m_Doc->GroupCounter++;
}
- else
- {
- QPainterPath tmpPath = Coords.toQPainterPath(true);
- tmpPath = boundingBoxRect.intersected(tmpPath);
- if ((tmpPath.boundingRect().width() != 0) && (tmpPath.boundingRect().height() != 0))
- {
- clipCoords.fromQPainterPath(tmpPath);
- z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, baseX, baseY, 10, 10, 0, CommonStrings::None, CommonStrings::None, true);
- ite = m_Doc->Items->at(z);
- ite->PoLine = clipCoords.copy(); //FIXME: try to avoid copy if FPointArray when properly shared
- ite->PoLine.translate(m_Doc->currentPage()->xOffset(), m_Doc->currentPage()->yOffset());
- ite->ClipEdited = true;
- ite->FrameType = 3;
- FPoint wh = getMaxClipF(&ite->PoLine);
- ite->setWidthHeight(wh.x(),wh.y());
- ite->Clip = FlattenPath(ite->PoLine, ite->Segments);
- m_Doc->AdjustItemSize(ite);
- ite->Groups.push(m_Doc->GroupCounter);
- if (groupStack.count() != 0)
- {
- QStack<int> groupOld = groupStack.top()->Groups;
- for (int gg = 0; gg < groupOld.count(); gg++)
- {
- ite->Groups.push(groupOld[gg]);
- }
- }
- ite->isGroupControl = true;
- ite->setItemName( tr("Group%1").arg(m_Doc->GroupCounter));
- ite->setTextFlowMode(PageItem::TextFlowDisabled);
- Elements.append(ite);
- groupStack.push(ite);
- elemCount.push(Elements.count());
- gsStackMarks.push(gsStack.count());
- m_Doc->GroupCounter++;
- }
- }
}
Coords = FPointArray(0);
lastPath = "";
@@ -774,7 +739,7 @@ void EPSPlug::parseOutput(QString fn, bool eps)
Elements.removeLast();
}
else
- ite->groupsLastItem = Elements.at(Elements.count()-1);
+ ite->groupsLastItem = Elements.last();
gsStackMarks.pop();
}
}
@@ -865,7 +830,7 @@ void EPSPlug::parseOutput(QString fn, bool eps)
Elements.removeLast();
}
else
- ite->groupsLastItem = Elements.at(Elements.count()-1);
+ ite->groupsLastItem = Elements.last();
}
}
}