r18006 by fschmid - Better fix for Bug #11300 as the first fix broke clipping badly
scribus-commit
scribus-commit at lists.scribus.net
Sat Dec 29 20:32:45 UTC 2012
Author: fschmid
Date: Sat Dec 29 20:32:45 2012
New Revision: 18006
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18006
Log:
Better fix for Bug #11300 as the first fix broke clipping badly
Modified:
trunk/Scribus/scribus/fpointarray.cpp
trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp
trunk/Scribus/scribus/plugins/import/pdf/pdfimportoptions.cpp
trunk/Scribus/scribus/plugins/import/pdf/pdfimportoptions.h
trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
Modified: trunk/Scribus/scribus/fpointarray.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18006&path=/trunk/Scribus/scribus/fpointarray.cpp
==============================================================================
--- trunk/Scribus/scribus/fpointarray.cpp (original)
+++ trunk/Scribus/scribus/fpointarray.cpp Sat Dec 29 20:32:45 2012
@@ -614,6 +614,8 @@
void FPointArray::svgMoveTo(double x, double y)
{
+ if (!svgState)
+ return;
svgState->reset(x, y);
svgState->WasM = true;
}
@@ -621,10 +623,10 @@
void FPointArray::svgLineTo(double x1, double y1)
{
+ if (!svgState)
+ return;
if (svgState->needsMarker())
- {
setMarker();
- }
svgState->FirstM = false;
svgState->WasM = false;
if (size() > 3)
@@ -648,10 +650,10 @@
void FPointArray::svgCurveToCubic(double x1, double y1, double x2, double y2, double x3, double y3)
{
+ if (!svgState)
+ return;
if (svgState->needsMarker())
- {
setMarker();
- }
svgState->FirstM = false;
svgState->WasM = false;
if (svgState->PathLen > 3)
@@ -677,6 +679,8 @@
void FPointArray::svgClosePath()
{
+ if (!svgState)
+ return;
if (svgState->PathLen > 2)
{
if ((svgState->PathLen == 4) || (point(size()-2).x() != svgState->StartX) || (point(size()-2).y() != svgState->StartY))
@@ -691,6 +695,8 @@
void FPointArray::svgArcTo(double r1, double r2, double angle, bool largeArcFlag, bool sweepFlag, double x1, double y1)
{
+ if (!svgState)
+ return;
calculateArc(false, svgState->CurrX, svgState->CurrY, angle, x1, y1, r1, r2, largeArcFlag, sweepFlag);
}
@@ -1085,6 +1091,5 @@
}
}
return ret;
-
-}
-
+}
+
Modified: trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18006&path=/trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp Sat Dec 29 20:32:45 2012
@@ -455,7 +455,7 @@
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
PdfImportOptions *optImp = new PdfImportOptions(ScCore->primaryMainWindow());
QFileInfo fi = QFileInfo(fn);
- optImp->setUpOptions(fi.fileName(), firstPage, lastPage, interactive, this);
+ optImp->setUpOptions(fi.fileName(), firstPage, lastPage, interactive, boxesAreDifferent, this);
if (!optImp->exec())
{
if (progressDialog)
Modified: trunk/Scribus/scribus/plugins/import/pdf/pdfimportoptions.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18006&path=/trunk/Scribus/scribus/plugins/import/pdf/pdfimportoptions.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pdf/pdfimportoptions.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/pdf/pdfimportoptions.cpp Sat Dec 29 20:32:45 2012
@@ -18,7 +18,6 @@
m_plugin = NULL;
m_maxPage = 0;
m_resized = false;
-// ui->cropGroup->hide(); // for now as functionality is not implemented yet
}
PdfImportOptions::~PdfImportOptions()
@@ -57,14 +56,15 @@
return ret;
}
-void PdfImportOptions::setUpOptions(QString fileName, int actPage, int numPages, bool interact, PdfPlug* plug)
+void PdfImportOptions::setUpOptions(QString fileName, int actPage, int numPages, bool interact, bool cropPossible, PdfPlug* plug)
{
m_plugin = plug;
ui->fileLabel->setText(fileName);
ui->spinBox->setMaximum(numPages);
ui->spinBox->setMinimum(actPage);
ui->spinBox->setValue(actPage);
- ui->cropGroup->setChecked(false);
+ ui->cropGroup->setVisible(cropPossible);
+ ui->cropGroup->setChecked(cropPossible);
if (interact)
{
ui->allPages->setChecked(false);
Modified: trunk/Scribus/scribus/plugins/import/pdf/pdfimportoptions.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18006&path=/trunk/Scribus/scribus/plugins/import/pdf/pdfimportoptions.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pdf/pdfimportoptions.h (original)
+++ trunk/Scribus/scribus/plugins/import/pdf/pdfimportoptions.h Sat Dec 29 20:32:45 2012
@@ -21,7 +21,7 @@
public:
explicit PdfImportOptions(QWidget *parent = 0);
~PdfImportOptions();
- void setUpOptions(QString fileName, int actPage, int numPages, bool interact, PdfPlug* plug);
+ void setUpOptions(QString fileName, int actPage, int numPages, bool interact, bool cropPossible, PdfPlug* plug);
QString getPagesString();
int getCropBox();
void paintEvent(QPaintEvent *e);
Modified: trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18006&path=/trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp Sat Dec 29 20:32:45 2012
@@ -1265,7 +1265,7 @@
sing->PoLine.translate(dx, dy);
if (sing->isGroup())
{
- QList<PageItem*> allItems = sing->asGroupFrame()->getItemList();
+ QList<PageItem*> allItems = sing->asGroupFrame()->groupItemList;
for (int si = 0; si < allItems.count(); si++)
{
allItems[si]->moveBy(dx, dy, true);
@@ -1434,8 +1434,7 @@
m_ctm = QTransform(ctm[0], ctm[1], ctm[2], ctm[3], ctm[4], ctm[5]);
QString output = convertPath(state->getPath());
FPointArray out;
- bool haveClip = out.parseSVG(output);
- if (haveClip)
+ if (!output.isEmpty())
{
out.parseSVG(output);
if (!pathIsClosed)
@@ -1448,7 +1447,7 @@
crect = crect.normalized();
int z = m_doc->itemAdd(PageItem::Group, PageItem::Rectangle, crect.x() + m_doc->currentPage()->xOffset(), crect.y() + m_doc->currentPage()->yOffset(), crect.width(), crect.height(), 0, CommonStrings::None, CommonStrings::None, true);
PageItem *ite = m_doc->Items->at(z);
- if (haveClip)
+ if (!output.isEmpty())
{
FPoint wh(getMinClipF(&out));
out.translate(-wh.x(), -wh.y());
@@ -1485,9 +1484,9 @@
m_ctm = QTransform(ctm[0], ctm[1], ctm[2], ctm[3], ctm[4], ctm[5]);
QString output = convertPath(state->getPath());
FPointArray out;
- bool haveClip = out.parseSVG(output);
- if (haveClip)
- {
+ if (!output.isEmpty())
+ {
+ out.parseSVG(output);
if (!pathIsClosed)
out.svgClosePath();
out.map(m_ctm);
@@ -1498,7 +1497,7 @@
crect = crect.normalized();
int z = m_doc->itemAdd(PageItem::Group, PageItem::Rectangle, crect.x() + m_doc->currentPage()->xOffset(), crect.y() + m_doc->currentPage()->yOffset(), crect.width(), crect.height(), 0, CommonStrings::None, CommonStrings::None, true);
PageItem *ite = m_doc->Items->at(z);
- if (haveClip)
+ if (!output.isEmpty())
{
FPoint wh(getMinClipF(&out));
out.translate(-wh.x(), -wh.y());
More information about the scribus-commit
mailing list