Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 24743 → Rev 24744

/trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.cpp
23,15 → 23,15
#include <QThread>
 
BarcodeType::BarcodeType(const QString &cmd, const QString &exa, const QString &exaop)
: command(cmd),
exampleContents(exa),
exampleOptions(exaop)
{
command = cmd;
exampleContents = exa;
exampleOptions = exaop;
 
}
 
BarcodeGenerator::BarcodeGenerator(QWidget* parent, const char* name)
: QDialog(parent),
paintBarcodeTimer(nullptr)
: QDialog(parent)
{
ui.setupUi(this);
setObjectName(name);
305,7 → 305,7
paintColorSample(ui.txtLabel, txtColor);
paintColorSample(ui.bgLabel, bgColor);
 
paintBarcodeTimer=new QTimer(this);
paintBarcodeTimer = new QTimer(this);
paintBarcodeTimer->setSingleShot(true);
connect(paintBarcodeTimer, SIGNAL(timeout()), this, SLOT(paintBarcode()));
 
383,7 → 383,7
bcComboChanged();
}
 
void BarcodeGenerator::bcComboChanged(int i)
void BarcodeGenerator::bcComboChanged(int)
{
bcComboChanged();
}
774,12 → 774,12
reject();
}
 
void BarcodeGenerator::codeEdit_textChanged(const QString& s)
void BarcodeGenerator::codeEdit_textChanged(const QString&)
{
enqueuePaintBarcode(0);
}
 
void BarcodeGenerator::on_optionsEdit_textChanged(const QString &s )
void BarcodeGenerator::on_optionsEdit_textChanged(const QString&)
{
updateUIFromOptionsText();
enqueuePaintBarcode(0);
/trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.h
74,7 → 74,7
//! \brief BC/BC type mapping. QMap keys are used as BC names.
BarcodeMap map;
 
QTimer *paintBarcodeTimer;
QTimer* paintBarcodeTimer { nullptr };
 
//! \brief List of available barcode encoders.
QList<QString> encoderlist;
/trunk/Scribus/scribus/plugins/import/ai/importai.cpp
13,6 → 13,7
#include <QList>
#include <QMimeData>
#include <QRegExp>
#include <QScopedPointer>
#include <QStack>
#include <QTemporaryFile>
#include <QDebug>
63,10 → 64,10
#endif
 
AIPlug::AIPlug(ScribusDoc* doc, int flags)
: m_Doc(doc),
importerFlags(flags)
{
tmpSel = new Selection(this, false);
m_Doc = doc;
importerFlags = flags;
interactive = (flags & LoadSavePlugin::lfInteractive);
}
 
78,7 → 79,7
importedColors.clear();
importedGradients.clear();
importedPatterns.clear();
QFileInfo fi = QFileInfo(fName);
QFileInfo fi(fName);
/* Check if the file is an old style AI or one of the newer PDF wrapped ones */
QFile fT(fName);
if (fT.open(QIODevice::ReadOnly))
205,7 → 206,7
importedColors.clear();
importedGradients.clear();
importedPatterns.clear();
QFileInfo fi = QFileInfo(fName);
QFileInfo fi(fName);
/* Check if the file is an old style AI or one of the newer PDF wrapped ones */
QFile fT(fName);
if (fT.open(QIODevice::ReadOnly))
297,8 → 298,7
importedColors.clear();
importedGradients.clear();
importedPatterns.clear();
QFileInfo fi = QFileInfo(fName);
// QString ext = fi.suffix().toLower();
QFileInfo fi(fName);
if ( !ScCore->usingGUI() )
{
interactive = false;
349,7 → 349,7
progressDialog->setProgress("GI", 0);
progressDialog->show();
connect(progressDialog, SIGNAL(canceled()), this, SLOT(cancelRequested()));
qApp->processEvents();
QCoreApplication::processEvents();
}
else
progressDialog = nullptr;
361,7 → 361,7
if (progressDialog)
{
progressDialog->setOverallProgress(1);
qApp->processEvents();
QCoreApplication::processEvents();
}
parseHeader(fName, x, y, b, h);
if (b == 0)
400,12 → 400,12
m_Doc->documentInfo().setTitle(docTitle);
m_Doc->documentInfo().setDate(docDate+" "+docTime);
}
if ((!ret) && (interactive))
if (!ret && interactive)
{
baseX = m_Doc->currentPage()->xOffset();
baseY = m_Doc->currentPage()->yOffset();
}
if ((ret) || (!interactive))
if (ret || !interactive)
{
if (b-x > h-y)
m_Doc->setPageOrientation(1);
413,8 → 413,7
m_Doc->setPageOrientation(0);
m_Doc->setPageSize("Custom");
}
ColorList::Iterator it;
for (it = CustColors.begin(); it != CustColors.end(); ++it)
for (auto it = CustColors.begin(); it != CustColors.end(); ++it)
{
if (!m_Doc->PageColors.contains(it.key()))
{
430,7 → 429,7
if ((!(flags & LoadSavePlugin::lfLoadAsPattern)) && (m_Doc->view() != nullptr))
m_Doc->view()->updatesOn(false);
m_Doc->scMW()->setScriptRunning(true);
qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
QGuiApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
QString CurDirP = QDir::currentPath();
QDir::setCurrent(fi.path());
if (convert(fName))
466,7 → 465,7
m_Doc->DoDrawing = true;
m_Doc->scMW()->setScriptRunning(false);
m_Doc->setLoading(false);
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
QGuiApplication::changeOverrideCursor(QCursor(Qt::ArrowCursor));
if ((Elements.count() > 0) && (!ret) && (interactive))
{
if (flags & LoadSavePlugin::lfScripted)
548,7 → 547,7
m_Doc->DoDrawing = true;
m_Doc->scMW()->setScriptRunning(false);
m_Doc->view()->updatesOn(true);
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
QGuiApplication::changeOverrideCursor(QCursor(Qt::ArrowCursor));
}
if (interactive)
m_Doc->setLoading(false);
555,12 → 554,12
//CB If we have a gui we must refresh it if we have used the progressbar
if (!(flags & LoadSavePlugin::lfLoadAsPattern))
{
if ((showProgress) && (!interactive))
if (showProgress && !interactive)
m_Doc->view()->DrawNew();
}
if (convertedPDF)
QFile::remove(fName);
qApp->restoreOverrideCursor();
QGuiApplication::restoreOverrideCursor();
return success;
}
 
577,7 → 576,7
QFile outf(outfile);
if (!outf.open(QIODevice::WriteOnly))
{
qDebug()<<"Failed to open QFile outf in AIPlug::extractFromPDF";
qDebug() << "Failed to open QFile outf in AIPlug::extractFromPDF";
return false;
}
try
667,8 → 666,7
 
bool AIPlug::decompressAIData(QString &fName)
{
QString f2 = fName+"_decom.ai";
char buffer[4096];
QString f2 = fName + "_decom.ai";
 
QFile source(fName);
if (!source.open(QFile::ReadOnly))
697,6 → 695,7
 
qint64 bytesRead = -1;
qint64 bytesWritten = -1;
char buffer[4096];
 
bytesRead = compressor.read(buffer, 4096);
while (bytesRead > 0)
717,7 → 716,7
if (!convertedPDF)
{
QFileInfo bF2(fName);
QString tmpFile = ScPaths::tempFileDir()+ "/"+bF2.baseName()+"_tmp.ai";
QString tmpFile = ScPaths::tempFileDir() + "/" + bF2.baseName() + "_tmp.ai";
moveFile(f2, tmpFile);
fName = tmpFile;
convertedPDF = true;
1450,7 → 1449,7
{
ScTextStream ts2(&Cdata, QIODevice::ReadOnly);
ts2 >> x >> y >> x1 >> y1 >> x2 >> y2;
QTransform symTrans = QTransform(x, y, x1, y1, x2, y2);
QTransform symTrans(x, y, x1, y1, x2, y2);
double rotation = getRotationFromMatrix(symTrans, 0.0);
QTransform symT;
symT.translate(x2, y2);
2466,26 → 2465,19
}
if (found)
textFont = family;
else
else if (importerFlags & LoadSavePlugin::lfCreateThumbnail)
textFont = PrefsManager::instance().appPrefs.itemToolPrefs.textFont;
else if (!PrefsManager::instance().appPrefs.fontPrefs.GFontSub.contains(family))
{
if (importerFlags & LoadSavePlugin::lfCreateThumbnail)
textFont = PrefsManager::instance().appPrefs.itemToolPrefs.textFont;
else
{
if (!PrefsManager::instance().appPrefs.fontPrefs.GFontSub.contains(family))
{
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
MissingFont *dia = new MissingFont(nullptr, family, m_Doc);
dia->exec();
QString tmpf = dia->getReplacementFont();
delete dia;
qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
PrefsManager::instance().appPrefs.fontPrefs.GFontSub[family] = tmpf;
}
else
textFont = PrefsManager::instance().appPrefs.fontPrefs.GFontSub[family];
}
QGuiApplication::changeOverrideCursor(QCursor(Qt::ArrowCursor));
QScopedPointer<MissingFont> dia(new MissingFont(nullptr, family, m_Doc));
dia->exec();
QString tmpf = dia->getReplacementFont();
QGuiApplication::changeOverrideCursor(QCursor(Qt::WaitCursor));
PrefsManager::instance().appPrefs.fontPrefs.GFontSub[family] = tmpf;
}
else
textFont = PrefsManager::instance().appPrefs.fontPrefs.GFontSub[family];
textSize *= 10.0;
}
else if (command == "TO")
2494,7 → 2486,7
{
if (!((textData.length() == 1) && (textData.text(0) == SpecialChars::PARSEP)))
{
QPointF pos = QPointF(textMatrix.dx(), textMatrix.dy());
QPointF pos(textMatrix.dx(), textMatrix.dy());
pos += QPointF(m_Doc->currentPage()->xOffset(), -m_Doc->currentPage()->yOffset());
pos += QPointF(0.0, textSize / 10.0 + 2.0);
z = m_Doc->itemAdd(PageItem::TextFrame, PageItem::Unspecified, pos.x() - docX, docHeight - (pos.y() - docY), 10, 10, 0, CommonStrings::None, CommonStrings::None);
2691,8 → 2683,7
m_Doc->itemSelection_GroupObjects(false, false, tmpSel);
if ((tmpSel->width() > 1) && (tmpSel->height() > 1))
{
ScPattern pat = ScPattern();
pat.setDoc(m_Doc);
ScPattern pat(m_Doc);
PageItem* currItem = tmpSel->itemAt(0);
currItem->setItemName(currentPatternDefName);
m_Doc->DoDrawing = true;
2699,7 → 2690,7
QImage tmpImg = currItem->DrawObj_toImage(qMin(qMax(qRound(patternX2 - patternX1), qRound(patternY2 - patternY1)), 500));
if (!tmpImg.isNull())
{
QImage retImg = QImage(qRound(patternX2 - patternX1), qRound(patternY2 - patternY1), QImage::Format_ARGB32_Premultiplied);
QImage retImg(qRound(patternX2 - patternX1), qRound(patternY2 - patternY1), QImage::Format_ARGB32_Premultiplied);
retImg.fill( qRgba(255, 255, 255, 0) );
QPainter p;
p.begin(&retImg);
2788,7 → 2779,7
if (progressDialog)
{
progressDialog->setProgress("GI", ts.device()->pos());
qApp->processEvents();
QCoreApplication::processEvents();
}
}
}
2849,8 → 2840,7
m_Doc->itemSelection_GroupObjects(false, false, tmpSel);
if ((tmpSel->width() > 1) && (tmpSel->height() > 1))
{
ScPattern pat = ScPattern();
pat.setDoc(m_Doc);
ScPattern pat(m_Doc);
PageItem* currItem = tmpSel->itemAt(0);
currItem->setItemName(currentPatternDefName);
m_Doc->DoDrawing = true;
2886,7 → 2876,7
if (progressDialog)
{
progressDialog->setProgress("GI", ts.device()->pos());
qApp->processEvents();
QCoreApplication::processEvents();
}
}
}
2978,8 → 2968,8
psdata.resize(dataSize);
ts.readRawData(psdata.data(), dataSize);
}
QTransform imgMatrix = QTransform(m1, m2, m3, m4, m5, m6);
QPointF pos = QPointF(imgMatrix.dx(), imgMatrix.dy());
QTransform imgMatrix(m1, m2, m3, m4, m5, m6);
QPointF pos(imgMatrix.dx(), imgMatrix.dy());
pos += QPointF(m_Doc->currentPage()->xOffset(), -m_Doc->currentPage()->yOffset());
pos += QPointF(baseX, -baseY);
int z = m_Doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, pos.x() - docX, docHeight - (pos.y() - docY), 10, 10, 0, CurrColorFill, CurrColorStroke);
3099,7 → 3089,7
if (progressDialog)
{
progressDialog->setProgress("GI", ts.device()->pos());
qApp->processEvents();
QCoreApplication::processEvents();
}
}
}
3116,7 → 3106,7
if (progressDialog)
{
progressDialog->setProgress("GI", ts.device()->pos());
qApp->processEvents();
QCoreApplication::processEvents();
}
}
}
3130,7 → 3120,7
if (progressDialog)
{
progressDialog->setProgress("GI", ts.device()->pos());
qApp->processEvents();
QCoreApplication::processEvents();
}
}
}
3148,7 → 3138,7
if (progressDialog)
{
progressDialog->setProgress("GI", ts.device()->pos());
qApp->processEvents();
QCoreApplication::processEvents();
}
}
} */
3162,7 → 3152,7
if (progressDialog)
{
progressDialog->setProgress("GI", ts.device()->pos());
qApp->processEvents();
QCoreApplication::processEvents();
}
}
}
3183,7 → 3173,7
if (progressDialog)
{
progressDialog->setProgress("GI", ts.device()->pos());
qApp->processEvents();
QCoreApplication::processEvents();
}
}
}
3197,7 → 3187,7
if (progressDialog)
{
progressDialog->setProgress("GI", ts.device()->pos());
qApp->processEvents();
QCoreApplication::processEvents();
}
}
}
3211,7 → 3201,7
if (progressDialog)
{
progressDialog->setProgress("GI", ts.device()->pos());
qApp->processEvents();
QCoreApplication::processEvents();
}
}
}
3225,7 → 3215,7
if (progressDialog)
{
progressDialog->setProgress("GI", ts.device()->pos());
qApp->processEvents();
QCoreApplication::processEvents();
}
}
}
3235,7 → 3225,7
if (progressDialog)
{
progressDialog->setProgress("GI", ts.device()->pos());
qApp->processEvents();
QCoreApplication::processEvents();
}
}
else if (tmp.contains("BeginRaster") && (tmp.startsWith("%")))
3248,7 → 3238,7
if (progressDialog)
{
progressDialog->setProgress("GI", ts.device()->pos());
qApp->processEvents();
QCoreApplication::processEvents();
}
}
}
3262,7 → 3252,7
if (progressDialog)
{
progressDialog->setProgress("GI", ts.device()->pos());
qApp->processEvents();
QCoreApplication::processEvents();
}
}
}
3276,7 → 3266,7
if (progressDialog)
{
progressDialog->setProgress("GI", ts.device()->pos());
qApp->processEvents();
QCoreApplication::processEvents();
}
}
}
3290,7 → 3280,7
if (progressDialog)
{
progressDialog->setProgress("GI", ts.device()->pos());
qApp->processEvents();
QCoreApplication::processEvents();
}
}
}
3311,7 → 3301,7
if (progressDialog)
{
progressDialog->setProgress("GI", ts.device()->pos());
qApp->processEvents();
QCoreApplication::processEvents();
}
}
}
3399,16 → 3389,15
{
progressDialog->setOverallProgress(2);
progressDialog->setLabel("GI", tr("Generating Items"));
qApp->processEvents();
QCoreApplication::processEvents();
}
QFile f(fn);
if (f.open(QIODevice::ReadOnly))
{
int fSize = (int) f.size();
if (progressDialog)
{
progressDialog->setTotalSteps("GI", fSize);
qApp->processEvents();
progressDialog->setTotalSteps("GI", (int) f.size());
QCoreApplication::processEvents();
}
QDataStream ts(&f);
while (!ts.atEnd())
3421,7 → 3410,7
if (progressDialog)
{
progressDialog->setProgress("GI", ts.device()->pos());
qApp->processEvents();
QCoreApplication::processEvents();
}
}
f.close();
/trunk/Scribus/scribus/plugins/import/ai/importai.h
129,7 → 129,7
bool cancel = false;
ScribusDoc* m_Doc = nullptr;
Selection* tmpSel = nullptr;
int importerFlags;
int importerFlags { 0 };
QStringList commandList;
bool convertedPDF = false;
QMap<QString, VGradient> m_gradients;
/trunk/Scribus/scribus/plugins/import/cdr/importcdr.cpp
52,26 → 52,18
#include "util_math.h"
 
CdrPlug::CdrPlug(ScribusDoc* doc, int flags)
: interactive(flags & LoadSavePlugin::lfInteractive),
importerFlags(flags),
m_Doc(doc)
{
baseX = baseY = 0;
docWidth = docHeight = 1;
 
tmpSel = new Selection(this, false);
m_Doc = doc;
importerFlags = flags;
interactive = (flags & LoadSavePlugin::lfInteractive);
progressDialog = nullptr;
cancel = false;
}
 
QImage CdrPlug::readThumbnail(const QString& fName)
{
QFileInfo fi = QFileInfo(fName);
double b, h;
b = PrefsManager::instance().appPrefs.docSetupPrefs.pageWidth;
h = PrefsManager::instance().appPrefs.docSetupPrefs.pageHeight;
docWidth = b;
docHeight = h;
QFileInfo fi(fName);
docWidth = PrefsManager::instance().appPrefs.docSetupPrefs.pageWidth;
docHeight = PrefsManager::instance().appPrefs.docSetupPrefs.pageHeight;
progressDialog = nullptr;
m_Doc = new ScribusDoc();
m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
129,7 → 121,7
cancel = false;
double b, h;
bool ret = false;
QFileInfo fi = QFileInfo(fNameIn);
QFileInfo fi(fNameIn);
if ( !ScCore->usingGUI() )
{
interactive = false;
150,7 → 142,7
progressDialog->setProgress("GI", 0);
progressDialog->show();
connect(progressDialog, SIGNAL(canceled()), this, SLOT(cancelRequested()));
qApp->processEvents();
QCoreApplication::processEvents();
}
else
progressDialog = nullptr;
160,7 → 152,7
if (progressDialog)
{
progressDialog->setOverallProgress(1);
qApp->processEvents();
QCoreApplication::processEvents();
}
if (b == 0.0)
b = PrefsManager::instance().appPrefs.docSetupPrefs.pageWidth;
178,25 → 170,22
baseX = 0;
baseY = 0;
}
else
else if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
{
if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
{
m_Doc=ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
ScCore->primaryMainWindow()->HaveNewDoc();
ret = true;
baseX = 0;
baseY = 0;
baseX = m_Doc->currentPage()->xOffset();
baseY = m_Doc->currentPage()->yOffset();
}
m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
ScCore->primaryMainWindow()->HaveNewDoc();
ret = true;
baseX = 0;
baseY = 0;
baseX = m_Doc->currentPage()->xOffset();
baseY = m_Doc->currentPage()->yOffset();
}
if ((!ret) && (interactive))
if (!ret && interactive)
{
baseX = m_Doc->currentPage()->xOffset();
baseY = m_Doc->currentPage()->yOffset();
}
if ((ret) || (!interactive))
if (ret || !interactive)
{
if (docWidth > docHeight)
m_Doc->setPageOrientation(1);
212,7 → 201,7
if ((!(flags & LoadSavePlugin::lfLoadAsPattern)) && (m_Doc->view() != nullptr))
m_Doc->view()->updatesOn(false);
m_Doc->scMW()->setScriptRunning(true);
qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
QGuiApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
QString CurDirP = QDir::currentPath();
QDir::setCurrent(fi.path());
if (convert(fNameIn))
224,7 → 213,7
m_Doc->DoDrawing = true;
m_Doc->scMW()->setScriptRunning(false);
m_Doc->setLoading(false);
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
QGuiApplication::changeOverrideCursor(QCursor(Qt::ArrowCursor));
if ((Elements.count() > 0) && (!ret) && (interactive))
{
if (flags & LoadSavePlugin::lfScripted)
299,7 → 288,7
m_Doc->DoDrawing = true;
m_Doc->scMW()->setScriptRunning(false);
m_Doc->view()->updatesOn(true);
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
QGuiApplication::changeOverrideCursor(QCursor(Qt::ArrowCursor));
}
if (interactive)
m_Doc->setLoading(false);
306,10 → 295,10
//CB If we have a gui we must refresh it if we have used the progressbar
if (!(flags & LoadSavePlugin::lfLoadAsPattern))
{
if ((showProgress) && (!interactive))
if (showProgress && !interactive)
m_Doc->view()->DrawNew();
}
qApp->restoreOverrideCursor();
QGuiApplication::restoreOverrideCursor();
return success;
}
 
330,7 → 319,7
qDebug() << "File " << QFile::encodeName(fn).data() << " does not exist";
return false;
}
QFileInfo fi = QFileInfo(fn);
QFileInfo fi(fn);
QString ext = fi.suffix().toLower();
#if HAVE_REVENGE
librevenge::RVNGFileStream input(QFile::encodeName(fn).data());
381,10 → 370,10
progressDialog->close();
if (importerFlags & LoadSavePlugin::lfCreateDoc)
{
ScribusMainWindow* mw=(m_Doc==nullptr) ? ScCore->primaryMainWindow() : m_Doc->scMW();
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
ScribusMainWindow* mw = (m_Doc == nullptr) ? ScCore->primaryMainWindow() : m_Doc->scMW();
QGuiApplication::changeOverrideCursor(QCursor(Qt::ArrowCursor));
ScMessageBox::warning(mw, CommonStrings::trWarning, tr("Parsing failed!\n\nPlease submit your file (if possible) to the\nDocument Liberation Project http://www.documentliberation.org"));
qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
QGuiApplication::changeOverrideCursor(QCursor(Qt::WaitCursor));
}
return false;
}
/trunk/Scribus/scribus/plugins/import/cdr/importcdr.h
59,21 → 59,23
private:
bool convert(const QString& fn);
 
double baseX { 0.0 };
double baseY { 0.0 };
double docWidth { 1.0 };
double docHeight { 1.0 };
 
QList<PageItem*> Elements;
double baseX, baseY;
double docWidth;
double docHeight;
 
QStringList importedColors;
QStringList importedPatterns;
 
bool interactive;
MultiProgressDialog * progressDialog;
bool cancel;
ScribusDoc* m_Doc;
Selection* tmpSel;
int importerFlags;
bool interactive { false };
bool cancel { false };
int importerFlags { 0 };
 
MultiProgressDialog* progressDialog { nullptr };
ScribusDoc* m_Doc { nullptr };
Selection* tmpSel { nullptr };
 
public slots:
void cancelRequested() { cancel = true; }
};
/trunk/Scribus/scribus/plugins/import/cgm/importcgm.cpp
2404,8 → 2404,7
tmpImg.save(fileName, "PNG");
m_Doc->loadPict(fileName, ite);
ite->setImageScalingMode(false, true);
ScPattern pat = ScPattern();
pat.setDoc(m_Doc);
ScPattern pat(m_Doc);
pat.pattern = tmpImg;
pat.xoffset = 0;
pat.yoffset = 0;
/trunk/Scribus/scribus/plugins/import/drw/importdrw.cpp
1863,8 → 1863,7
image = image.scaled(48, 48);
}
image = image.convertToFormat(QImage::Format_ARGB32);
ScPattern pat = ScPattern();
pat.setDoc(m_Doc);
ScPattern pat(m_Doc);
PageItem* newItem = new PageItem_ImageFrame(m_Doc, 0, 0, 1, 1, 0, CommonStrings::None, CommonStrings::None);
QTemporaryFile *tempFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_drw_XXXXXX.png");
tempFile->setAutoRemove(false);
/trunk/Scribus/scribus/plugins/import/emf/importemf.cpp
13,6 → 13,7
 
#include <QByteArray>
#include <QCursor>
#include <QDebug>
#include <QDrag>
#include <QFile>
#include <QList>
19,9 → 20,9
#include <QMimeData>
#include <QRawFont>
#include <QRegExp>
#include <QScopedPointer>
#include <QTextCodec>
#include <QUuid>
#include <QDebug>
 
#include <cstdlib>
 
426,47 → 427,17
#define U_RNDT_Infinite 0x10000003
 
EmfPlug::EmfPlug(ScribusDoc* doc, int flags)
: clipGroup(nullptr),
docWidth(0.0),
docHeight(0.0),
baseX(0.0),
baseY(0.0),
docX(0.0),
docY(0.0),
dpiX(0.0),
dpiY(0.0),
EmfPdpiX(0),
EmfPdpiY(0.0),
m_records(0),
recordCount(0),
viewPextendX(0),
viewPextendY(0),
winPextendX(0),
winPextendY(0),
winOrigX(0),
winOrigY(0),
progressDialog(nullptr),
cancel(false),
m_Doc(doc),
importerFlags(flags),
inPath(false),
inEMFPlus(false),
emfPlusDual(false),
emfMixed(false),
emfPlusScale(0.0),
SerializableObject_Valid(false),
m_ObjSize(0),
m_currObjSize(0),
m_objID(0)
: m_Doc(doc),
importerFlags(flags)
{
tmpSel=new Selection(this, false);
tmpSel = new Selection(this, false);
interactive = (flags & LoadSavePlugin::lfInteractive);
}
 
QImage EmfPlug::readThumbnail(const QString& fName)
{
QFileInfo fi = QFileInfo(fName);
baseFile = QDir::cleanPath(QDir::toNativeSeparators(fi.absolutePath()+"/"));
QFileInfo fi(fName);
baseFile = QDir::cleanPath(QDir::toNativeSeparators(fi.absolutePath() + "/"));
double b = 0;
double h = 0;
double x = 0;
568,7 → 539,7
cancel = false;
double x, y, b, h;
bool ret = false;
QFileInfo fi = QFileInfo(fNameIn);
QFileInfo fi(fNameIn);
if ( !ScCore->usingGUI() )
{
interactive = false;
577,7 → 548,7
baseFile = QDir::cleanPath(QDir::toNativeSeparators(fi.absolutePath()+"/"));
if ( showProgress )
{
ScribusMainWindow* mw=(m_Doc==nullptr) ? ScCore->primaryMainWindow() : m_Doc->scMW();
ScribusMainWindow* mw = (m_Doc == nullptr) ? ScCore->primaryMainWindow() : m_Doc->scMW();
progressDialog = new MultiProgressDialog( tr("Importing: %1").arg(fi.fileName()), CommonStrings::tr_Cancel, mw );
QStringList barNames, barTexts;
barNames << "GI";
590,7 → 561,7
progressDialog->setProgress("GI", 0);
progressDialog->show();
connect(progressDialog, SIGNAL(canceled()), this, SLOT(cancelRequested()));
qApp->processEvents();
QCoreApplication::processEvents();
}
else
progressDialog = nullptr;
602,7 → 573,7
if (progressDialog)
{
progressDialog->setOverallProgress(1);
qApp->processEvents();
QCoreApplication::processEvents();
}
parseHeader(fNameIn, x, y, b, h);
if (b == 0.0)
630,22 → 601,19
baseX = m_Doc->currentPage()->xOffset();
baseY = m_Doc->currentPage()->yOffset();
}
else
else if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
{
if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
{
m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
ScCore->primaryMainWindow()->HaveNewDoc();
m_Doc->setPageHeight(docHeight);
m_Doc->setPageWidth(docWidth);
m_Doc->currentPage()->setInitialWidth(docWidth);
m_Doc->currentPage()->setInitialHeight(docHeight);
m_Doc->currentPage()->setWidth(docWidth);
m_Doc->currentPage()->setHeight(docHeight);
ret = true;
baseX = m_Doc->currentPage()->xOffset();
baseY = m_Doc->currentPage()->yOffset();
}
m_Doc = ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
ScCore->primaryMainWindow()->HaveNewDoc();
m_Doc->setPageHeight(docHeight);
m_Doc->setPageWidth(docWidth);
m_Doc->currentPage()->setInitialWidth(docWidth);
m_Doc->currentPage()->setInitialHeight(docHeight);
m_Doc->currentPage()->setWidth(docWidth);
m_Doc->currentPage()->setHeight(docHeight);
ret = true;
baseX = m_Doc->currentPage()->xOffset();
baseY = m_Doc->currentPage()->yOffset();
}
if ((!ret) && (interactive))
{
668,7 → 636,7
if ((!(flags & LoadSavePlugin::lfLoadAsPattern)) && (m_Doc->view() != nullptr))
m_Doc->view()->updatesOn(false);
m_Doc->scMW()->setScriptRunning(true);
qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
QGuiApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
QString CurDirP = QDir::currentPath();
QDir::setCurrent(fi.path());
if (convert(fNameIn))
707,7 → 675,7
m_Doc->DoDrawing = true;
m_Doc->scMW()->setScriptRunning(false);
m_Doc->setLoading(false);
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
QGuiApplication::changeOverrideCursor(QCursor(Qt::ArrowCursor));
if ((Elements.count() > 0) && (!ret) && (interactive))
{
if (flags & LoadSavePlugin::lfScripted)
783,7 → 751,7
m_Doc->scMW()->setScriptRunning(false);
if (m_Doc->view() != nullptr)
m_Doc->view()->updatesOn(true);
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
QGuiApplication::changeOverrideCursor(QCursor(Qt::ArrowCursor));
}
if (interactive)
m_Doc->setLoading(false);
790,10 → 758,10
//CB If we have a gui we must refresh it if we have used the progressbar
if (!(flags & LoadSavePlugin::lfLoadAsPattern))
{
if ((showProgress) && (!interactive))
if (showProgress && !interactive)
m_Doc->view()->DrawNew();
}
qApp->restoreOverrideCursor();
QGuiApplication::restoreOverrideCursor();
return success;
}
 
1067,7 → 1035,7
{
progressDialog->setOverallProgress(2);
progressDialog->setLabel("GI", tr("Generating Items"));
qApp->processEvents();
QCoreApplication::processEvents();
}
QFile f(fn);
if (f.open(QIODevice::ReadOnly))
1075,7 → 1043,7
if (progressDialog)
{
progressDialog->setTotalSteps("GI", m_records);
qApp->processEvents();
QCoreApplication::processEvents();
}
QDataStream ds(&f);
ds.setByteOrder(QDataStream::LittleEndian);
1699,7 → 1667,7
if (progressDialog)
{
progressDialog->setProgress("GI", recordCount);
qApp->processEvents();
QCoreApplication::processEvents();
}
}
invalidateClipGroup();
1762,10 → 1730,6
QPointF EmfPlug::convertDevice2Pts(QPointF in)
{
QPointF out;
// double scaleX = (bBoxMM.width() / 1000.0 / 2.54 * 72.0) / bBoxDev.width(); // Device -> Pts
// double scaleY = (bBoxMM.height() / 1000.0 / 2.54 * 72.0) / bBoxDev.height(); // Device -> Pts
// out.setX(in.x() * scaleX);
// out.setY(in.y() * scaleY);
out.setX(in.x() / dpiX * 72.0);
out.setY(in.y() / dpiY * 72.0);
return out;
1786,8 → 1750,6
// double scaleY = qAbs((bBoxMM.height() / 1000.0 / 2.54 * 72.0) / bBoxDev.height()); // Device -> Pts
if (currentDC.m_mapMode == 1)
{
// out.setX(in.x() * scaleX);
// out.setY(in.y() * scaleY);
out.setX(in.x() / dpiX * 72.0);
out.setY(in.y() / dpiY * 72.0);
}
1833,50 → 1795,50
 
void EmfPlug::createPatternFromDIB(const QImage& img, quint32 brID)
{
if (!img.isNull())
{
QTemporaryFile *tempFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_emf_XXXXXX.png");
tempFile->setAutoRemove(false);
if (tempFile->open())
{
QString fileName = getLongPathName(tempFile->fileName());
if (!fileName.isEmpty())
{
tempFile->close();
img.save(fileName, "PNG");
ScPattern pat = ScPattern();
pat.setDoc(m_Doc);
int z = m_Doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, 0, 0, 1, 1, 0, CommonStrings::None, CommonStrings::None);
PageItem* newItem = m_Doc->Items->at(z);
m_Doc->loadPict(fileName, newItem);
m_Doc->Items->takeAt(z);
newItem->isInlineImage = true;
newItem->isTempFile = true;
pat.width = newItem->pixm.qImage().width();
pat.height = newItem->pixm.qImage().height();
pat.scaleX = (72.0 / newItem->pixm.imgInfo.xres) * newItem->pixm.imgInfo.lowResScale;
pat.scaleY = (72.0 / newItem->pixm.imgInfo.xres) * newItem->pixm.imgInfo.lowResScale;
pat.pattern = newItem->pixm.qImage().copy();
newItem->setWidth(pat.pattern.width());
newItem->setHeight(pat.pattern.height());
newItem->SetRectFrame();
newItem->gXpos = 0.0;
newItem->gYpos = 0.0;
newItem->gWidth = pat.pattern.width();
newItem->gHeight = pat.pattern.height();
pat.items.append(newItem);
QString patternName = "Pattern_"+newItem->itemName();
m_Doc->addPattern(patternName, pat);
emfStyle sty;
sty.styType = U_OT_Brush;
sty.brushStyle = U_BT_TextureFill;
sty.patternName = patternName;
sty.fillTrans = 0;
emfStyleMap.insert(brID, sty);
importedPatterns.append(patternName);
}
}
}
if (img.isNull())
return;
 
QScopedPointer<QTemporaryFile> tempFile(new QTemporaryFile(QDir::tempPath() + "/scribus_temp_emf_XXXXXX.png"));
tempFile->setAutoRemove(false);
if (!tempFile->open())
return;
 
QString fileName = getLongPathName(tempFile->fileName());
tempFile->close();
 
if (fileName.isEmpty())
return;
 
img.save(fileName, "PNG");
ScPattern pat(m_Doc);
int z = m_Doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, 0, 0, 1, 1, 0, CommonStrings::None, CommonStrings::None);
PageItem* newItem = m_Doc->Items->at(z);
m_Doc->loadPict(fileName, newItem);
m_Doc->Items->takeAt(z);
newItem->isInlineImage = true;
newItem->isTempFile = true;
pat.width = newItem->pixm.qImage().width();
pat.height = newItem->pixm.qImage().height();
pat.scaleX = (72.0 / newItem->pixm.imgInfo.xres) * newItem->pixm.imgInfo.lowResScale;
pat.scaleY = (72.0 / newItem->pixm.imgInfo.xres) * newItem->pixm.imgInfo.lowResScale;
pat.pattern = newItem->pixm.qImage().copy();
newItem->setWidth(pat.pattern.width());
newItem->setHeight(pat.pattern.height());
newItem->SetRectFrame();
newItem->gXpos = 0.0;
newItem->gYpos = 0.0;
newItem->gWidth = pat.pattern.width();
newItem->gHeight = pat.pattern.height();
pat.items.append(newItem);
QString patternName = "Pattern_" + newItem->itemName();
m_Doc->addPattern(patternName, pat);
emfStyle sty;
sty.styType = U_OT_Brush;
sty.brushStyle = U_BT_TextureFill;
sty.patternName = patternName;
sty.fillTrans = 0;
emfStyleMap.insert(brID, sty);
importedPatterns.append(patternName);
}
 
void EmfPlug::getPolyInfo(QDataStream &ds, QRectF &bounds, quint32 &count)
1969,7 → 1931,7
currentDC.m_WorldMap = mm;
}
 
QPointF EmfPlug::intersectBoundingRect(PageItem *item, QLineF gradientVector)
QPointF EmfPlug::intersectBoundingRect(PageItem *item, const QLineF& gradientVector)
{
QPointF interPoint;
QPointF gradEnd;
2127,7 → 2089,7
gpath = points;
}
ite->meshGradientPatches.clear();
FPoint center = FPoint(cx.x(), cx.y());
FPoint center(cx.x(), cx.y());
QList<VColorStop*> colorStops = currentDC.gradient.colorStops();
if (colorStops.count() == 2)
{
2286,58 → 2248,55
}
}
}
else
else if (currentDC.brushStyle == U_BT_HatchFill)
{
if (currentDC.brushStyle == U_BT_HatchFill)
switch (currentDC.hatchStyle)
{
switch (currentDC.hatchStyle)
{
case U_HSP_Horizontal:
ite->setHatchParameters(0, 5, 0, currentDC.backgroundMode, currentDC.backColor, currentDC.CurrColorFill);
ite->GrType = Gradient_Hatch;
break;
case U_HSP_Vertical:
ite->setHatchParameters(0, 5, 90, currentDC.backgroundMode, currentDC.backColor, currentDC.CurrColorFill);
ite->GrType = Gradient_Hatch;
break;
case U_HSP_ForwardDiagonal:
ite->setHatchParameters(0, 5, -45, currentDC.backgroundMode, currentDC.backColor, currentDC.CurrColorFill);
ite->GrType = Gradient_Hatch;
break;
case U_HSP_BackwardDiagonal:
ite->setHatchParameters(0, 5, 45, currentDC.backgroundMode, currentDC.backColor, currentDC.CurrColorFill);
ite->GrType = Gradient_Hatch;
break;
case U_HSP_LargeGrid:
ite->setHatchParameters(1, 5, 0, currentDC.backgroundMode, currentDC.backColor, currentDC.CurrColorFill);
ite->GrType = Gradient_Hatch;
break;
case U_HSP_DiagonalCross:
ite->setHatchParameters(1, 5, 45, currentDC.backgroundMode, currentDC.backColor, currentDC.CurrColorFill);
ite->GrType = Gradient_Hatch;
break;
case 6:
case 7:
ite->setFillColor(currentDC.CurrColorFill);
break;
case 8:
case 9:
ite->setFillColor(currentDC.CurrColorText);
break;
case 10:
case 11:
ite->setFillColor(currentDC.backColor);
break;
default:
break;
}
case U_HSP_Horizontal:
ite->setHatchParameters(0, 5, 0, currentDC.backgroundMode, currentDC.backColor, currentDC.CurrColorFill);
ite->GrType = Gradient_Hatch;
break;
case U_HSP_Vertical:
ite->setHatchParameters(0, 5, 90, currentDC.backgroundMode, currentDC.backColor, currentDC.CurrColorFill);
ite->GrType = Gradient_Hatch;
break;
case U_HSP_ForwardDiagonal:
ite->setHatchParameters(0, 5, -45, currentDC.backgroundMode, currentDC.backColor, currentDC.CurrColorFill);
ite->GrType = Gradient_Hatch;
break;
case U_HSP_BackwardDiagonal:
ite->setHatchParameters(0, 5, 45, currentDC.backgroundMode, currentDC.backColor, currentDC.CurrColorFill);
ite->GrType = Gradient_Hatch;
break;
case U_HSP_LargeGrid:
ite->setHatchParameters(1, 5, 0, currentDC.backgroundMode, currentDC.backColor, currentDC.CurrColorFill);
ite->GrType = Gradient_Hatch;
break;
case U_HSP_DiagonalCross:
ite->setHatchParameters(1, 5, 45, currentDC.backgroundMode, currentDC.backColor, currentDC.CurrColorFill);
ite->GrType = Gradient_Hatch;
break;
case 6:
case 7:
ite->setFillColor(currentDC.CurrColorFill);
break;
case 8:
case 9:
ite->setFillColor(currentDC.CurrColorText);
break;
case 10:
case 11:
ite->setFillColor(currentDC.backColor);
break;
default:
break;
}
else if (currentDC.brushStyle == U_BT_TextureFill)
{
ite->setPattern(currentDC.patternName);
ite->GrType = Gradient_Pattern;
}
}
else if (currentDC.brushStyle == U_BT_TextureFill)
{
ite->setPattern(currentDC.patternName);
ite->GrType = Gradient_Pattern;
}
}
if (clipGroup != nullptr)
{
2365,28 → 2324,28
 
void EmfPlug::createClipGroup()
{
if (currentDC.clipValid)
{
int z = m_Doc->itemAdd(PageItem::Group, PageItem::Unspecified, baseX, baseY, 10, 10, 0, CommonStrings::None, CommonStrings::None);
PageItem* ite = m_Doc->Items->at(z);
ite->PoLine = currentDC.clipPath.copy();
ite->setFillEvenOdd(false);
ite->ClipEdited = true;
ite->FrameType = 3;
FPoint wh = getMaxClipF(&ite->PoLine);
ite->setWidthHeight(wh.x(),wh.y());
ite->setTextFlowMode(PageItem::TextFlowDisabled);
m_Doc->adjustItemSize(ite, true);
ite->moveBy(-docX, -docY, true);
ite->moveBy(-currentDC.winOrigin.x(), -currentDC.winOrigin.y());
ite->OldB2 = ite->width();
ite->OldH2 = ite->height();
ite->updateClip();
ite->OwnPage = m_Doc->OnPage(ite);
m_Doc->GroupOnPage(ite);
clipGroup = ite;
Elements.append(ite);
}
if (!currentDC.clipValid)
return;
 
int z = m_Doc->itemAdd(PageItem::Group, PageItem::Unspecified, baseX, baseY, 10, 10, 0, CommonStrings::None, CommonStrings::None);
PageItem* ite = m_Doc->Items->at(z);
ite->PoLine = currentDC.clipPath.copy();
ite->setFillEvenOdd(false);
ite->ClipEdited = true;
ite->FrameType = 3;
FPoint wh = getMaxClipF(&ite->PoLine);
ite->setWidthHeight(wh.x(),wh.y());
ite->setTextFlowMode(PageItem::TextFlowDisabled);
m_Doc->adjustItemSize(ite, true);
ite->moveBy(-docX, -docY, true);
ite->moveBy(-currentDC.winOrigin.x(), -currentDC.winOrigin.y());
ite->OldB2 = ite->width();
ite->OldH2 = ite->height();
ite->updateClip();
ite->OwnPage = m_Doc->OnPage(ite);
m_Doc->GroupOnPage(ite);
clipGroup = ite;
Elements.append(ite);
}
 
void EmfPlug::handleComment(QDataStream &ds)
2402,7 → 2361,7
{
QPointF p1 = getPoint(ds, true);
QPointF p2 = getPoint(ds, true);
QRectF BoxDev = QRectF(p1, p2);
QRectF BoxDev(p1, p2);
if (inPath)
{
QPainterPath painterPath;
2426,7 → 2385,7
{
QPointF p1 = getPoint(ds, true);
QPointF p2 = getPoint(ds, true);
QRectF BoxDev = QRectF(p1, p2);
QRectF BoxDev(p1, p2);
if (inPath)
{
QPainterPath painterPath;
2453,7 → 2412,7
qint32 x1, y1;
ds >> x1 >> y1;
QPointF p3 = convertLogical2Pts(QPointF(x1, y1));
QRectF BoxDev = QRectF(p1, p2);
QRectF BoxDev(p1, p2);
if (inPath)
{
QPainterPath painterPath;
2563,11 → 2522,11
{
QPointF p1 = getPoint(ds, true);
QPointF p2 = getPoint(ds, true);
QRectF BoxDev = QRectF(p1, p2);
QRectF BoxDev(p1, p2);
QPointF st = getPoint(ds, true);
QPointF en = getPoint(ds, true);
QLineF stlin = QLineF(BoxDev.center(), st);
QLineF enlin = QLineF(BoxDev.center(), en);
QLineF stlin(BoxDev.center(), st);
QLineF enlin(BoxDev.center(), en);
FPointArray pointArray;
QPainterPath painterPath;
painterPath.arcMoveTo(BoxDev, stlin.angle());
2597,11 → 2556,11
{
QPointF p1 = getPoint(ds, true);
QPointF p2 = getPoint(ds, true);
QRectF BoxDev = QRectF(p1, p2);
QRectF BoxDev(p1, p2);
QPointF st = getPoint(ds, true);
QPointF en = getPoint(ds, true);
QLineF stlin = QLineF(BoxDev.center(), st);
QLineF enlin = QLineF(BoxDev.center(), en);
QLineF stlin(BoxDev.center(), st);
QLineF enlin(BoxDev.center(), en);
if (inPath)
{
if (enlin.angleTo(stlin) > 180)
2646,11 → 2605,11
{
QPointF p1 = getPoint(ds, true);
QPointF p2 = getPoint(ds, true);
QRectF BoxDev = QRectF(p1, p2);
QRectF BoxDev(p1, p2);
QPointF st = getPoint(ds, true);
QPointF en = getPoint(ds, true);
QLineF stlin = QLineF(BoxDev.center(), st);
QLineF enlin = QLineF(BoxDev.center(), en);
QLineF stlin(BoxDev.center(), st);
QLineF enlin(BoxDev.center(), en);
FPointArray pointArray;
QPainterPath painterPath;
QPointF firstPoint;
2690,11 → 2649,11
{
QPointF p1 = getPoint(ds, true);
QPointF p2 = getPoint(ds, true);
QRectF BoxDev = QRectF(p1, p2);
QRectF BoxDev(p1, p2);
QPointF st = getPoint(ds, true);
QPointF en = getPoint(ds, true);
QLineF stlin = QLineF(BoxDev.center(), st);
QLineF enlin = QLineF(BoxDev.center(), en);
QLineF stlin(BoxDev.center(), st);
QLineF enlin(BoxDev.center(), en);
FPointArray pointArray;
QPainterPath painterPath;
QPointF firstPoint;
2938,48 → 2897,49
}
QPointF p = currentDC.m_WorldMap.map(QPointF(dstX, dstY));
p = convertLogical2Pts(p);
QPointF p2 = QPointF(qAbs(dstW), qAbs(dstH));
QLineF wl = QLineF(0, 0, p2.x(), 0);
QPointF p2(qAbs(dstW), qAbs(dstH));
QLineF wl(0, 0, p2.x(), 0);
wl = bm.map(wl);
QLineF hl = QLineF(0, 0, p2.y(), 0);
QLineF hl(0, 0, p2.y(), 0);
hl = bm.map(hl);
p2 = convertDevice2Pts(QPointF(wl.length(), hl.length()));
int z = m_Doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, baseX + p.x(), baseY + p.y(), p2.x(), p2.y(), 0, CommonStrings::None, CommonStrings::None);
PageItem* ite = m_Doc->Items->at(z);
finishItem(ite, false);
QTemporaryFile *tempFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_emf_XXXXXX.png");
 
QScopedPointer<QTemporaryFile> tempFile(new QTemporaryFile(QDir::tempPath() + "/scribus_temp_emf_XXXXXX.png"));
tempFile->setAutoRemove(false);
if (tempFile->open())
if (!tempFile->open())
return;
 
QString fileName = getLongPathName(tempFile->fileName());
tempFile->close();
 
if (fileName.isEmpty())
return;
 
img.save(fileName, "PNG");
ite->isInlineImage = true;
ite->isTempFile = true;
ite->AspectRatio = false;
ite->ScaleType = false;
if (currentDC.clipValid)
{
QString fileName = getLongPathName(tempFile->fileName());
if (!fileName.isEmpty())
{
tempFile->close();
img.save(fileName, "PNG");
ite->isInlineImage = true;
ite->isTempFile = true;
ite->AspectRatio = false;
ite->ScaleType = false;
if (currentDC.clipValid)
{
FPointArray cp = currentDC.clipPath.copy();
cp.translate(baseX, baseY);
cp.translate(-docX, -docY);
cp.translate(-ite->xPos(), -ite->yPos());
ite->PoLine = cp.copy();
FPoint wh = getMaxClipF(&ite->PoLine);
ite->setWidthHeight(wh.x(),wh.y());
ite->setTextFlowMode(PageItem::TextFlowDisabled);
m_Doc->adjustItemSize(ite);
ite->OldB2 = ite->width();
ite->OldH2 = ite->height();
ite->updateClip();
}
m_Doc->loadPict(fileName, ite);
ite->adjustPictScale();
}
FPointArray cp = currentDC.clipPath.copy();
cp.translate(baseX, baseY);
cp.translate(-docX, -docY);
cp.translate(-ite->xPos(), -ite->yPos());
ite->PoLine = cp.copy();
FPoint wh = getMaxClipF(&ite->PoLine);
ite->setWidthHeight(wh.x(),wh.y());
ite->setTextFlowMode(PageItem::TextFlowDisabled);
m_Doc->adjustItemSize(ite);
ite->OldB2 = ite->width();
ite->OldH2 = ite->height();
ite->updateClip();
}
delete tempFile;
m_Doc->loadPict(fileName, ite);
ite->adjustPictScale();
}
 
void EmfPlug::handlePatternFill(qint32 dstX, qint32 dstY, qint32 dstW, qint32 dstH)
2995,10 → 2955,10
}
QPointF p = currentDC.m_WorldMap.map(QPointF(dstX, dstY));
p = convertLogical2Pts(p);
QPointF p2 = QPointF(qAbs(dstW), qAbs(dstH));
QLineF wl = QLineF(0, 0, p2.x(), 0);
QPointF p2(qAbs(dstW), qAbs(dstH));
QLineF wl(0, 0, p2.x(), 0);
wl = bm.map(wl);
QLineF hl = QLineF(0, 0, p2.y(), 0);
QLineF hl(0, 0, p2.y(), 0);
hl = bm.map(hl);
p2 = convertDevice2Pts(QPointF(wl.length(), hl.length()));
int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, baseX + p.x(), baseY + p.y(), p2.x(), p2.y(), 0, CommonStrings::None, CommonStrings::None);
3009,7 → 2969,7
 
QImage EmfPlug::handleDIB(QDataStream &ds, qint64 filePos, quint32 offBitH, quint32 sizeBitH, quint32 offBits, quint32 sizeBits)
{
QImage img = QImage();
QImage img;
quint32 hSiz = 0, hCompression = 0, imgSize = 0, xres = 0, yres = 0, colorsUsed = 0, colorsReq = 0;
qint32 hWidth = 0, hHeight = 0;
quint16 hPlane = 0, hBitCount = 0;
3353,7 → 3313,7
sty.penWidth = convertLogical2Pts(static_cast<double>(penWidth));
else
sty.penWidth = convertDevice2Pts(static_cast<double>(penWidth));
QLineF p = QLineF(0, 0, sty.penWidth, 0);
QLineF p(0, 0, sty.penWidth, 0);
p = currentDC.m_WorldMap.map(p);
sty.penWidth = p.length();
emfStyleMap.insert(penID, sty);
3847,7 → 3807,7
lenS += 24;
float m11, m12, m21, m22, dx, dy;
ds >> m11 >> m12 >> m21 >> m22 >> dx >> dy;
QLineF lin = QLineF(0, 0, 1, 0);
QLineF lin(0, 0, 1, 0);
lin = QTransform(m11, m12, m21, m22, dx, dy).map(lin);
sty.gradientAngle = lin.angle();
}
3897,7 → 3857,7
{
float m11, m12, m21, m22, dx, dy;
ds >> m11 >> m12 >> m21 >> m22 >> dx >> dy;
QLineF lin = QLineF(0, 0, 1, 0);
QLineF lin(0, 0, 1, 0);
lin = QTransform(m11, m12, m21, m22, dx, dy).map(lin);
sty.gradientAngle = lin.angle() + 45;
}
4105,17 → 4065,17
{
qint32 penStyle;
ds >> penStyle;
if ((penStyle) == U_LS_Solid)
if (penStyle == U_LS_Solid)
sty.penStyle = Qt::SolidLine;
else if ((penStyle) == U_LS_Dash)
else if (penStyle == U_LS_Dash)
sty.penStyle = Qt::DashLine;
else if ((penStyle) == U_LS_Dot)
else if (penStyle == U_LS_Dot)
sty.penStyle = Qt::DotLine;
else if ((penStyle) == U_LS_DashDot)
else if (penStyle == U_LS_DashDot)
sty.penStyle = Qt::DashDotLine;
else if ((penStyle) == U_LS_DashDotDot)
else if (penStyle == U_LS_DashDotDot)
sty.penStyle = Qt::DashDotDotLine;
else if ((penStyle) == 5)
else if (penStyle == 5)
sty.penStyle = Qt::SolidLine;
else
sty.penStyle = Qt::SolidLine;
4313,7 → 4273,7
return retVal;
}
 
quint32 EmfPlug::getImageData(QDataStream &ds, quint16 id, bool first, bool cont, quint32 dataSize, emfStyle &sty)
quint32 EmfPlug::getImageData(QDataStream &ds, quint16 id, bool first, bool /*cont*/, quint32 dataSize, emfStyle& sty)
{
quint32 retVal = 0;
if (first)
4833,7 → 4793,7
font.setPixelSize(fSize);
QList<QChar> stringData;
QList<quint32> glyphs;
QTransform txTrans = QTransform();
QTransform txTrans;
if (txOpts & 0x00000001)
{
for (quint32 a = 0; a < numChars; a++)
5256,87 → 5216,85
currentDC.CurrFillTrans = 1.0 - col.alphaF();
currentDC.brushStyle = U_BT_SolidColor;
}
else
else if (emfStyleMapEMP.contains(brushID))
{
if (emfStyleMapEMP.contains(brushID))
emfStyle sty = emfStyleMapEMP[brushID];
currentDC.CurrColorFill = sty.brushColor;
currentDC.brushStyle = sty.brushStyle;
currentDC.hatchStyle = sty.hatchStyle;
currentDC.CurrFillTrans = sty.fillTrans;
if (sty.brushStyle == U_BT_HatchFill)
{
emfStyle sty = emfStyleMapEMP[brushID];
currentDC.CurrColorFill = sty.brushColor;
currentDC.brushStyle = sty.brushStyle;
currentDC.hatchStyle = sty.hatchStyle;
currentDC.CurrFillTrans = sty.fillTrans;
if (sty.brushStyle == U_BT_HatchFill)
currentDC.backColor = sty.penColor;
currentDC.backgroundMode = true;
}
else if (sty.brushStyle == U_BT_LinearGradient)
{
currentDC.gradientStart = sty.gradientStart;
currentDC.gradientEnd = sty.gradientEnd;
currentDC.gradientAngle = sty.gradientAngle;
currentDC.gradient = sty.gradient;
}
else if (sty.brushStyle == U_BT_PathGradient)
{
currentDC.gradientStart = sty.gradientStart;
currentDC.gradientAngle = sty.gradientAngle;
currentDC.gradient = sty.gradient;
currentDC.gradientPath = sty.gradientPath.copy();
}
else if (sty.brushStyle == U_BT_TextureFill)
{
currentDC.patternMode = sty.patternMode;
if (!sty.patternName.isEmpty())
{
currentDC.backColor = sty.penColor;
currentDC.backgroundMode = true;
currentDC.patternName = sty.patternName;
return;
}
else if (sty.brushStyle == U_BT_LinearGradient)
{
currentDC.gradientStart = sty.gradientStart;
currentDC.gradientEnd = sty.gradientEnd;
currentDC.gradientAngle = sty.gradientAngle;
currentDC.gradient = sty.gradient;
}
else if (sty.brushStyle == U_BT_PathGradient)
{
currentDC.gradientStart = sty.gradientStart;
currentDC.gradientAngle = sty.gradientAngle;
currentDC.gradient = sty.gradient;
currentDC.gradientPath = sty.gradientPath.copy();
}
else if (sty.brushStyle == U_BT_TextureFill)
{
currentDC.patternMode = sty.patternMode;
if (sty.patternName.isEmpty())
{
if (!emfStyleMapEMP[brushID].MetaFile)
{
QImage img = getImageDataFromStyle(brushID);
if (!img.isNull())
{
QTemporaryFile *tempFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_emf_XXXXXX.png");
tempFile->setAutoRemove(false);
if (tempFile->open())
{
QString fileName = getLongPathName(tempFile->fileName());
if (!fileName.isEmpty())
{
tempFile->close();
img.save(fileName, "PNG");
ScPattern pat = ScPattern();
pat.setDoc(m_Doc);
int z = m_Doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, 0, 0, 1, 1, 0, CommonStrings::None, CommonStrings::None);
PageItem* newItem = m_Doc->Items->at(z);
m_Doc->loadPict(fileName, newItem);
m_Doc->Items->takeAt(z);
newItem->isInlineImage = true;
newItem->isTempFile = true;
pat.width = newItem->pixm.qImage().width();
pat.height = newItem->pixm.qImage().height();
pat.scaleX = (72.0 / newItem->pixm.imgInfo.xres) * newItem->pixm.imgInfo.lowResScale;
pat.scaleY = (72.0 / newItem->pixm.imgInfo.xres) * newItem->pixm.imgInfo.lowResScale;
pat.pattern = newItem->pixm.qImage().copy();
newItem->setWidth(pat.pattern.width());
newItem->setHeight(pat.pattern.height());
newItem->SetRectFrame();
newItem->gXpos = 0.0;
newItem->gYpos = 0.0;
newItem->gWidth = pat.pattern.width();
newItem->gHeight = pat.pattern.height();
pat.items.append(newItem);
QString patternName = "Pattern_"+newItem->itemName();
m_Doc->addPattern(patternName, pat);
emfStyleMapEMP[brushID].patternName = patternName;
importedPatterns.append(patternName);
currentDC.patternName = patternName;
}
}
}
}
}
else
currentDC.patternName = sty.patternName;
}
 
if (emfStyleMapEMP[brushID].MetaFile)
return;
 
QImage img = getImageDataFromStyle(brushID);
if (img.isNull())
return;
 
QScopedPointer<QTemporaryFile> tempFile(new QTemporaryFile(QDir::tempPath() + "/scribus_temp_emf_XXXXXX.png"));
tempFile->setAutoRemove(false);
if (!tempFile->open())
return;
 
QString fileName = getLongPathName(tempFile->fileName());
tempFile->close();
 
if (fileName.isEmpty())
return;
img.save(fileName, "PNG");
ScPattern pat(m_Doc);
int z = m_Doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, 0, 0, 1, 1, 0, CommonStrings::None, CommonStrings::None);
PageItem* newItem = m_Doc->Items->at(z);
m_Doc->loadPict(fileName, newItem);
m_Doc->Items->takeAt(z);
newItem->isInlineImage = true;
newItem->isTempFile = true;
pat.width = newItem->pixm.qImage().width();
pat.height = newItem->pixm.qImage().height();
pat.scaleX = (72.0 / newItem->pixm.imgInfo.xres) * newItem->pixm.imgInfo.lowResScale;
pat.scaleY = (72.0 / newItem->pixm.imgInfo.xres) * newItem->pixm.imgInfo.lowResScale;
pat.pattern = newItem->pixm.qImage().copy();
newItem->setWidth(pat.pattern.width());
newItem->setHeight(pat.pattern.height());
newItem->SetRectFrame();
newItem->gXpos = 0.0;
newItem->gYpos = 0.0;
newItem->gWidth = pat.pattern.width();
newItem->gHeight = pat.pattern.height();
pat.items.append(newItem);
QString patternName = "Pattern_" + newItem->itemName();
m_Doc->addPattern(patternName, pat);
emfStyleMapEMP[brushID].patternName = patternName;
importedPatterns.append(patternName);
currentDC.patternName = patternName;
}
}
}
5573,7 → 5531,7
 
double EmfPlug::convertEMFPLogical2Pts(double in, quint16 unit)
{
QLineF dist = QLineF(0, 0, in, 0);
QLineF dist(0, 0, in, 0);
dist = currentDC.m_WorldMapEMFP.map(dist);
double out = dist.length();
switch (unit)
/trunk/Scribus/scribus/plugins/import/emf/importemf.h
160,7 → 160,7
QPointF getPoint(QDataStream &ds, bool size);
quint32 getColor(QDataStream &ds);
void setWTransform(const QTransform& mm, quint32 how);
QPointF intersectBoundingRect(PageItem *item, QLineF gradientVector);
QPointF intersectBoundingRect(PageItem *item, const QLineF& gradientVector);
void finishItem(PageItem* ite, bool fill = true);
void invalidateClipGroup();
void createClipGroup();
296,41 → 296,47
QHash<quint32, emfStyle> emfStyleMap;
QHash<quint32, emfStyle> emfStyleMapEMP;
QList<PageItem*> Elements;
PageItem* clipGroup;
double docWidth;
double docHeight;
double baseX, baseY;
double docX;
double docY;
double dpiX;
double dpiY;
quint32 EmfPdpiX, EmfPdpiY;
quint32 m_records;
int recordCount;
qint32 viewPextendX, viewPextendY;
qint32 winPextendX, winPextendY;
qint32 winOrigX, winOrigY;
PageItem* clipGroup { nullptr };
double docWidth { 0.0 };
double docHeight { 0.0 };
double baseX { 0.0 };
double baseY { 0.0 };
double docX { 0.0 };
double docY { 0.0 };
double dpiX { 0.0 };
double dpiY { 0.0 };
quint32 EmfPdpiX { 0 };
quint32 EmfPdpiY { 0 };
quint32 m_records { 0 };
int recordCount { 0 };
qint32 viewPextendX { 0 };
qint32 viewPextendY { 0 };
qint32 winPextendX { 0 };
qint32 winPextendY { 0 };
qint32 winOrigX { 0 };
qint32 winOrigY { 0 };
QRectF bBoxDev;
QRectF bBoxMM;
QStringList importedColors;
QStringList importedPatterns;
bool interactive;
MultiProgressDialog * progressDialog;
bool cancel;
ScribusDoc* m_Doc;
Selection* tmpSel;
int importerFlags;
bool interactive { false };
MultiProgressDialog * progressDialog { nullptr };
bool cancel { false };
ScribusDoc* m_Doc { nullptr };
Selection* tmpSel { nullptr };
int importerFlags { 0 };
QString baseFile;
bool inPath;
bool inEMFPlus;
bool emfPlusDual;
bool emfMixed;
float emfPlusScale;
bool SerializableObject_Valid;
bool inPath { false };
bool inEMFPlus { false };
bool emfPlusDual { false };
bool emfMixed { false };
float emfPlusScale { 0.0 };
bool SerializableObject_Valid { false };
ScImageEffectList m_Effects;
quint32 m_ObjSize;
quint32 m_currObjSize;
quint16 m_objID;
quint32 m_ObjSize { 0 };
quint32 m_currObjSize { 0 };
quint16 m_objID { 0 };
 
public slots:
void cancelRequested() { cancel = true; }
};
/trunk/Scribus/scribus/plugins/import/odg/importodg.cpp
3839,8 → 3839,7
{
tempFile->write(f);
tempFile->close();
ScPattern pat = ScPattern();
pat.setDoc(m_Doc);
ScPattern pat(m_Doc);
int z = m_Doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, 0, 0, 1, 1, 0, CommonStrings::None, CommonStrings::None);
PageItem* newItem = m_Doc->Items->at(z);
m_Doc->loadPict(fileName, newItem);
3935,8 → 3934,7
{
tempFile->write(buf);
tempFile->close();
ScPattern pat = ScPattern();
pat.setDoc(m_Doc);
ScPattern pat(m_Doc);
int z = m_Doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, 0, 0, 1, 1, 0, CommonStrings::None, CommonStrings::None);
PageItem* newItem = m_Doc->Items->at(z);
m_Doc->loadPict(fileName, newItem);
/trunk/Scribus/scribus/plugins/import/pct/importpct.cpp
2179,8 → 2179,7
*q = patternData[rr];
}
image = image.convertToFormat(QImage::Format_ARGB32);
ScPattern pat = ScPattern();
pat.setDoc(m_Doc);
ScPattern pat(m_Doc);
PageItem* newItem = new PageItem_ImageFrame(m_Doc, 0, 0, 1, 1, 0, CommonStrings::None, CommonStrings::None);
QTemporaryFile *tempFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_pct_XXXXXX.png");
tempFile->setAutoRemove(false);
/trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
1506,8 → 1506,7
PageItem *ite = m_doc->groupObjectsSelection(tmpSel);
ite->setFillTransparency(1.0 - state->getFillOpacity());
ite->setFillBlendmode(getBlendMode(state));
ScPattern pat = ScPattern();
pat.setDoc(m_doc);
ScPattern pat(m_doc);
m_doc->DoDrawing = true;
pat.pattern = ite->DrawObj_toImage(qMin(qMax(ite->width(), ite->height()), 500.0));
pat.xoffset = 0;
2358,9 → 2357,8
ite->setFillTransparency(1.0 - state->getFillOpacity());
ite->setFillBlendmode(getBlendMode(state));
m_doc->m_Selection->clear();
ScPattern pat = ScPattern();
pat.setDoc(m_doc);
m_doc->DoDrawing = true;
ScPattern pat(m_doc);
pat.pattern = ite->DrawObj_toImage(qMin(qMax(ite->width(), ite->height()), 500.0));
pat.xoffset = 0;
pat.yoffset = 0;
/trunk/Scribus/scribus/plugins/import/revenge/rawpainter.cpp
2129,8 → 2129,7
tempFile->write(imageData);
QString fileName = getLongPathName(tempFile->fileName());
tempFile->close();
ScPattern pat = ScPattern();
pat.setDoc(m_Doc);
ScPattern pat(m_Doc);
int z = m_Doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, 0, 0, 1, 1, 0, CommonStrings::None, CommonStrings::None);
PageItem* newItem = m_Doc->Items->at(z);
if (m_style["draw:red"] && m_style["draw:green"] && m_style["draw:blue"])
3344,8 → 3343,7
tempFile->write(imageData);
QString fileName = getLongPathName(tempFile->fileName());
tempFile->close();
ScPattern pat = ScPattern();
pat.setDoc(m_Doc);
ScPattern pat(m_Doc);
int z = m_Doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, 0, 0, 1, 1, 0, CommonStrings::None, CommonStrings::None);
PageItem* newItem = m_Doc->Items->at(z);
if (m_style["draw:red"] && m_style["draw:green"] && m_style["draw:blue"])
/trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
2955,8 → 2955,7
GElements = parseGroup(b);
if (GElements.count() > 0)
{
ScPattern pat;
pat.setDoc(m_Doc);
ScPattern pat(m_Doc);
PageItem* currItem = GElements.at(0);
m_Doc->DoDrawing = true;
double minx = std::numeric_limits<double>::max();
3015,8 → 3014,7
GElements = parseGroup(b);
if (GElements.count() > 0)
{
ScPattern pat;
pat.setDoc(m_Doc);
ScPattern pat(m_Doc);
PageItem* currItem = GElements.at(0);
m_Doc->DoDrawing = true;
pat.pattern = currItem->DrawObj_toImage(qMin(qMax(wpat, hpat), 500.0));
/trunk/Scribus/scribus/plugins/import/svm/importsvm.cpp
4193,8 → 4193,7
{
tempFile->close();
img.save(fileName, "PNG");
ScPattern pat = ScPattern();
pat.setDoc(m_Doc);
ScPattern pat(m_Doc);
int z = m_Doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, 0, 0, 1, 1, 0, CommonStrings::None, CommonStrings::None);
PageItem* newItem = m_Doc->Items->at(z);
m_Doc->loadPict(fileName, newItem);
/trunk/Scribus/scribus/plugins/import/wmf/metafuncs.h
22,7 → 22,7
{
const char* name;
unsigned short func;
void ( WMFImport::*method )( QList<PageItem*>& items, long, short* );
void ( WMFImport::*method )( QList<PageItem*>& items, long, const short* );
} metaFuncTab[] =
{
{ "SETBKCOLOR", 0x0201, &WMFImport::setBkColor },
/trunk/Scribus/scribus/plugins/import/wmf/wmfimport.cpp
39,10 → 39,6
#include "util.h"
#include "util_math.h"
 
 
 
using namespace std;
 
#include "wmfstruct.h"
#include "wmfcmd.h"
#include "wmfcontext.h"
49,6 → 45,8
#include "wmfhandle.h"
#include "metafuncs.h"
 
using namespace std;
 
#define WMFIMPORT_DEBUG 0
#define MAX_OBJHANDLE 128
 
137,22 → 135,10
};
 
WMFImport::WMFImport( ScribusDoc* doc, int flags )
: interactive(flags & LoadSavePlugin::lfInteractive),
m_Doc(doc)
{
m_tmpSel = new Selection(this, false);
m_Doc = doc;
unsupported = false;
importFailed = false;
importCanceled = true;
importedColors.clear();
m_docDesc = "";
m_docTitle = "";
interactive = (flags & LoadSavePlugin::lfInteractive);
 
m_IsPlaceable = false;
m_IsEnhanced = false;
m_Valid = false;
m_ObjHandleTab = nullptr;
m_Dpi = 1440;
}
 
WMFImport::~WMFImport()
184,7 → 170,7
return fNam;
}
 
QColor WMFImport::colorFromParam( short* params )
QColor WMFImport::colorFromParam(const short* params )
{
unsigned int colorRef;
int red, green, blue;
237,7 → 223,7
return codec;
}
 
QString WMFImport::symbolToUnicode ( const QByteArray& chars )
QString WMFImport::symbolToUnicode ( const QByteArray& chars ) const
{
/*Code under GPL licence (http://root.cern.ch/viewvc/trunk/LICENSE)
taken from http://root.cern.ch/viewvc/trunk/qt/src/TQtSymbolCodec.cxx*/
261,7 → 247,7
return r;
}
 
FPointArray WMFImport::pointsFromParam( short num, short* params )
FPointArray WMFImport::pointsFromParam( short num, const short* params ) const
{
FPointArray points;
points.resize( num );
272,7 → 258,7
return points;
}
 
FPointArray WMFImport::pointsToPolyline( const FPointArray& points, bool closePath )
FPointArray WMFImport::pointsToPolyline( const FPointArray& points, bool closePath ) const
{
bool bFirst = true;
double x = 0.0, y = 0.0;
298,7 → 284,7
return polyline;
}
 
void WMFImport::pointsToAngle( double xStart, double yStart, double xEnd, double yEnd, double& angleStart, double& angleLength )
void WMFImport::pointsToAngle( double xStart, double yStart, double xEnd, double yEnd, double& angleStart, double& angleLength ) const
{
double aStart = atan2( yStart, xStart );
double aLength = atan2( yEnd, xEnd ) - aStart;
332,7 → 318,7
m_Doc->PageColors.ensureDefaultColors();
QList<PageItem*> Elements = parseWmfCommands();
m_tmpSel->clear();
QImage tmpImage = QImage();
QImage tmpImage;
if (Elements.count() > 0)
{
if (Elements.count() > 1)
606,12 → 592,12
if ((!(flags & LoadSavePlugin::lfLoadAsPattern)) && (m_Doc->view() != nullptr))
m_Doc->view()->updatesOn(false);
m_Doc->scMW()->setScriptRunning(true);
qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
//gc->Family = m_Doc->toolSettings.textFont;
 
QGuiApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
m_Doc->PageColors.ensureDefaultColors();
//m_gc.push( gc );
QList<PageItem*> Elements = parseWmfCommands();
qApp->restoreOverrideCursor();
QGuiApplication::restoreOverrideCursor();
 
if (flags & LoadSavePlugin::lfCreateDoc)
{
m_Doc->documentInfo().setTitle(m_docTitle);
786,17 → 772,17
//item->DashValues = gc->dashArray;
}
 
void WMFImport::setWindowOrg( QList<PageItem*>& /*items*/, long, short* params )
void WMFImport::setWindowOrg( QList<PageItem*>& /*items*/, long, const short* params )
{
m_context.setWindowOrg( params[ 1 ], params[ 0 ] );
}
 
void WMFImport::setWindowExt( QList<PageItem*>& /*items*/, long, short* params )
void WMFImport::setWindowExt( QList<PageItem*>& /*items*/, long, const short* params )
{
m_context.setWindowExt( params[ 1 ], params[ 0 ] );
}
 
void WMFImport::lineTo( QList<PageItem*>& items, long, short* params )
void WMFImport::lineTo( QList<PageItem*>& items, long, const short* params )
{
double BaseX = m_Doc->currentPage()->xOffset();
double BaseY = m_Doc->currentPage()->yOffset();
823,12 → 809,12
m_context.setPosition( QPoint(params[1], params[0]) );
}
 
void WMFImport::moveTo( QList<PageItem*>& /*items*/, long, short* params )
void WMFImport::moveTo( QList<PageItem*>& /*items*/, long, const short* params )
{
m_context.setPosition( QPoint(params[1], params[0]) );
}
 
void WMFImport::ellipse( QList<PageItem*>& items, long, short* params )
void WMFImport::ellipse( QList<PageItem*>& items, long, const short* params )
{
double BaseX = m_Doc->currentPage()->xOffset();
double BaseY = m_Doc->currentPage()->yOffset();
849,7 → 835,7
items.append(ite);
}
 
void WMFImport::polygon( QList<PageItem*>& items, long, short* params )
void WMFImport::polygon( QList<PageItem*>& items, long, const short* params )
{
//cerr << "WMFImport::polygon unimplemented" << endl;
double BaseX = m_Doc->currentPage()->xOffset();
874,7 → 860,7
}
}
 
void WMFImport::polyPolygon( QList<PageItem*>& items, long num, short* params )
void WMFImport::polyPolygon( QList<PageItem*>& items, long num, const short* params )
{
int numPolys = params[0];
int pointIndex = params[0] + 1;
914,9 → 900,8
}
}
 
void WMFImport::polyline( QList<PageItem*>& items, long, short* params )
void WMFImport::polyline( QList<PageItem*>& items, long, const short* params )
{
//cerr << "WMFImport::polyline unimplemented" << endl;
double BaseX = m_Doc->currentPage()->xOffset();
double BaseY = m_Doc->currentPage()->yOffset();
bool doStroke = m_context.pen().style() != Qt::NoPen;
937,7 → 922,7
}
}
 
void WMFImport::rectangle( QList<PageItem*>& items, long, short* params )
void WMFImport::rectangle( QList<PageItem*>& items, long, const short* params )
{
//cerr << "WMFImport::rectangle unimplemented" << endl;
double BaseX = m_Doc->currentPage()->xOffset();
961,9 → 946,8
items.append(ite);
}
 
void WMFImport::roundRect( QList<PageItem*>& items, long, short* params )
void WMFImport::roundRect( QList<PageItem*>& items, long, const short* params )
{
//cerr << "WMFImport::roundRect unimplemented" << endl;
double BaseX = m_Doc->currentPage()->xOffset();
double BaseY = m_Doc->currentPage()->yOffset();
bool doFill = m_context.brush().style() != Qt::NoBrush;
993,7 → 977,7
items.append(ite);
}
 
void WMFImport::arc( QList<PageItem*>& items, long, short* params )
void WMFImport::arc( QList<PageItem*>& items, long, const short* params )
{
FPointArray pointArray;
QPainterPath painterPath;
1026,7 → 1010,7
}
}
 
void WMFImport::chord( QList<PageItem*>& items, long, short* params )
void WMFImport::chord( QList<PageItem*>& items, long, const short* params )
{
QPointF firstPoint;
FPointArray pointArray;
1063,7 → 1047,7
}
}
 
void WMFImport::pie( QList<PageItem*>& items, long, short* params )
void WMFImport::pie( QList<PageItem*>& items, long, const short* params )
{
QPointF firstPoint;
FPointArray pointArray;
1101,17 → 1085,17
}
}
 
void WMFImport::setPolyFillMode( QList<PageItem*>& /*items*/, long, short* params )
void WMFImport::setPolyFillMode( QList<PageItem*>& /*items*/, long, const short* params )
{
m_context.setWindingFill( params[0] );
}
 
void WMFImport::setBkColor( QList<PageItem*>& /*items*/, long, short* params )
void WMFImport::setBkColor( QList<PageItem*>& /*items*/, long, const short* params )
{
m_context.setBackgroundColor( colorFromParam( params ) );
}
 
void WMFImport::setBkMode(QList<PageItem*>& /*items*/, long, short* params )
void WMFImport::setBkMode(QList<PageItem*>& /*items*/, long, const short* params )
{
if ( params[ 0 ]==1 )
m_context.setBackgroundMode( Qt::TransparentMode );
1119,38 → 1103,38
m_context.setBackgroundMode( Qt::OpaqueMode );
}
 
void WMFImport::saveDC( QList<PageItem*>& /*items*/, long, short* )
void WMFImport::saveDC( QList<PageItem*>& /*items*/, long, const short* )
{
m_context.save();
}
 
void WMFImport::restoreDC( QList<PageItem*>& /*items*/, long, short *params )
void WMFImport::restoreDC( QList<PageItem*>& /*items*/, long, const short *params )
{
for ( int i=0; i > params[ 0 ] ; i-- )
m_context.restore();
}
 
void WMFImport::intersectClipRect( QList<PageItem*>& /*items*/, long, short* /*params*/ )
void WMFImport::intersectClipRect( QList<PageItem*>& /*items*/, long, const short* /*params*/ )
{
cerr << "WMFImport::intersectClipRect unimplemented" << endl;
}
 
void WMFImport::excludeClipRect( QList<PageItem*>& /*items*/, long, short* /*params*/ )
void WMFImport::excludeClipRect( QList<PageItem*>& /*items*/, long, const short* /*params*/ )
{
cerr << "WMFImport::excludeClipRect unimplemented" << endl;
}
 
void WMFImport::setTextColor( QList<PageItem*>& /*items*/, long, short* params )
void WMFImport::setTextColor( QList<PageItem*>& /*items*/, long, const short* params )
{
m_context.setTextColor( colorFromParam(params) );
}
 
void WMFImport::setTextAlign( QList<PageItem*>& /*items*/, long, short* params )
void WMFImport::setTextAlign( QList<PageItem*>& /*items*/, long, const short* params )
{
m_context.setTextAlign(params[ 0 ]);
}
 
void WMFImport::textOut( QList<PageItem*>& items, long num, short* params )
void WMFImport::textOut( QList<PageItem*>& items, long num, const short* params )
{
short *copyParm = new short[num + 1];
 
1166,7 → 1150,7
delete [] copyParm;
}
 
void WMFImport::extTextOut( QList<PageItem*>& items, long num, short* params )
void WMFImport::extTextOut( QList<PageItem*>& items, long num, const short* params )
{
QString textString;
double BaseX = m_Doc->currentPage()->xOffset();
1286,7 → 1270,7
m_context.restore();
}
 
void WMFImport::selectObject(QList<PageItem*>& items, long num, short* params )
void WMFImport::selectObject(QList<PageItem*>& /*items*/, long, const short* params )
{
int idx = params[ 0 ];
if ( idx >= 0 && idx < MAX_OBJHANDLE && m_ObjHandleTab[ idx ] )
1293,12 → 1277,12
m_ObjHandleTab[ idx ]->apply( m_context );
}
 
void WMFImport::deleteObject( QList<PageItem*>& /*items*/, long, short* params )
void WMFImport::deleteObject( QList<PageItem*>& /*items*/, long, const short* params )
{
deleteHandle( params[ 0 ] );
}
 
void WMFImport::createEmptyObject( QList<PageItem*>& /*items*/, long, short* )
void WMFImport::createEmptyObject( QList<PageItem*>& /*items*/, long, const short* )
{
// allocation of an empty object (to keep object counting in sync)
WmfObjPenHandle* handle = new WmfObjPenHandle();
1306,7 → 1290,7
cerr << "WMFImport: unimplemented createObject " << endl;
}
 
void WMFImport::createBrushIndirect( QList<PageItem*>& /*items*/, long, short* params )
void WMFImport::createBrushIndirect( QList<PageItem*>& /*items*/, long, const short* params )
{
static Qt::BrushStyle hatchedStyleTab[] =
{
1328,11 → 1312,10
Qt::Dense3Pattern /* should be device-independent BS_DIBPATTERN8x8 */
};
Qt::BrushStyle style;
short arg;
WmfObjBrushHandle* handle = new WmfObjBrushHandle();
addHandle( handle );
 
arg = params[0];
short arg = params[0];
if ( arg == 2 )
{
arg = params[3];
1355,7 → 1338,7
handle->brush.setColor( colorFromParam( params+1 ) );
}
 
void WMFImport::createPenIndirect( QList<PageItem*>& /*items*/, long, short* params )
void WMFImport::createPenIndirect( QList<PageItem*>& /*items*/, long, const short* params )
{
static Qt::PenStyle styleTab[] = { Qt::SolidLine, Qt::DashLine, Qt::DotLine, Qt::DashDotLine, Qt::DashDotDotLine,
Qt::NoPen, Qt::SolidLine };
1377,7 → 1360,7
handle->pen.setCapStyle( Qt::RoundCap );
}
 
void WMFImport::createFontIndirect( QList<PageItem*>& /*items*/, long , short* params)
void WMFImport::createFontIndirect( QList<PageItem*>& /*items*/, long , const short* params)
{
WmfObjFontHandle* handle = new WmfObjFontHandle();
addHandle( handle );
1398,11 → 1381,11
handle->charset = (params[ 6 ] & 0xFF00) >> 8;
}
 
void WMFImport::noop( QList<PageItem*>& /*items*/, long, short* )
void WMFImport::noop( QList<PageItem*>& /*items*/, long, const short* )
{
}
 
void WMFImport::end( QList<PageItem*>& /*items*/, long, short* )
void WMFImport::end( QList<PageItem*>& /*items*/, long, const short* )
{
//cerr << "WMFImport::end unimplemented" << endl;
}
1411,8 → 1394,11
{
int idx;
 
for ( idx =0; idx < MAX_OBJHANDLE ; idx++ )
if ( m_ObjHandleTab[ idx ] == nullptr ) break;
for (idx = 0; idx < MAX_OBJHANDLE; idx++)
{
if (m_ObjHandleTab[idx] == nullptr)
break;
}
 
if ( idx < MAX_OBJHANDLE )
m_ObjHandleTab[ idx ] = handle;
1459,7 → 1445,7
{
unsigned int l;
#if !defined( WORDS_BIGENDIAN )
l = *( unsigned int* )( params );
l = *(const unsigned int* )( params );
#else
char *bytes;
char swap[ 4 ];
/trunk/Scribus/scribus/plugins/import/wmf/wmfimport.h
50,14 → 50,14
void wmfLineTo(FPointArray *i, double x1, double y1);
void wmfCurveToCubic(FPointArray *i, double x1, double y1, double x2, double y2, double x3, double y3);
 
bool interactive;
bool interactive { false };
//! \brief Indicator if there is any unsupported feature in imported wmf.
bool unsupported;
bool importFailed;
bool importCanceled;
bool unsupported { false };
bool importFailed { false };
bool importCanceled { true };
 
ScribusDoc* m_Doc;
Selection* m_tmpSel;
ScribusDoc* m_Doc { nullptr };
Selection* m_tmpSel { nullptr };
QStringList importedColors;
 
protected:
67,7 → 67,9
 
WMFContext m_context;
 
bool m_IsPlaceable, m_IsEnhanced, m_Valid;
bool m_IsPlaceable { false };
bool m_IsEnhanced { false };
bool m_Valid { false };
 
// coordinate system
QRect m_HeaderBoundingBox;
74,9 → 76,9
QRect m_BBox;
 
QList<WmfCmd*> m_commands;
WmfObjHandle** m_ObjHandleTab;
WmfObjHandle** m_ObjHandleTab { nullptr };
FPointArray m_Points;
int m_Dpi;
int m_Dpi { 1440 };
 
/** Protected import functions */
bool importWMF(const TransactionSettings& trSettings, int flags);
91,21 → 93,21
QString importColor(const QColor& color);
 
/** Get color from parameters array */
QColor colorFromParam( short* params );
QColor colorFromParam(const short* params );
 
/** Get text codec from charset code */
QTextCodec* codecFromCharset( int charset );
 
/** Translate characters in symbol charset to unicode */
QString symbolToUnicode ( const QByteArray& chars );
QString symbolToUnicode ( const QByteArray& chars ) const;
 
/** Get polygon array from parameters array */
FPointArray pointsFromParam( short num, short* params );
FPointArray pointsFromParam( short num, const short* params ) const;
 
/** Transform a point array to an item path used as polyline */
FPointArray pointsToPolyline( const FPointArray& points, bool closePath );
FPointArray pointsToPolyline( const FPointArray& points, bool closePath ) const;
 
void pointsToAngle( double xStart, double yStart, double xEnd, double yEnd, double& angleStart, double& angleLength );
void pointsToAngle( double xStart, double yStart, double xEnd, double yEnd, double& angleStart, double& angleLength ) const;
 
/** Handle win-object-handles */
void addHandle( WmfObjHandle* );
124,76 → 126,76
public:
 
/** set window origin */
void setWindowOrg( QList<PageItem*>& items, long num, short* params );
void setWindowOrg( QList<PageItem*>& items, long num, const short* params );
/** set window extents */
void setWindowExt( QList<PageItem*>& items, long num, short* params );
void setWindowExt( QList<PageItem*>& items, long num, const short* params );
 
/****************** Drawing *******************/
/** draw line to coord */
void lineTo( QList<PageItem*>& items, long num, short* params );
void lineTo( QList<PageItem*>& items, long num, const short* params );
/** move pen to coord */
void moveTo( QList<PageItem*>& items, long num, short* params );
void moveTo( QList<PageItem*>& items, long num, const short* params );
/** draw ellipse */
void ellipse(QList<PageItem*>& items, long num, short* params );
void ellipse(QList<PageItem*>& items, long num, const short* params );
/** draw polygon */
void polygon( QList<PageItem*>& items, long num, short* params );
void polygon( QList<PageItem*>& items, long num, const short* params );
/** draw a list of polygons */
void polyPolygon( QList<PageItem*>& items, long num, short* params );
void polyPolygon( QList<PageItem*>& items, long num, const short* params );
/** draw series of lines */
void polyline( QList<PageItem*>& items, long num, short* params );
void polyline( QList<PageItem*>& items, long num, const short* params );
/** draw a rectangle */
void rectangle( QList<PageItem*>& items, long num, short* params );
void rectangle( QList<PageItem*>& items, long num, const short* params );
/** draw round rectangle */
void roundRect( QList<PageItem*>& items, long num, short* params );
void roundRect( QList<PageItem*>& items, long num, const short* params );
/** draw arc */
void arc( QList<PageItem*>& items, long num, short* params );
void arc( QList<PageItem*>& items, long num, const short* params );
/** draw chord */
void chord( QList<PageItem*>& items, long num, short* params );
void chord( QList<PageItem*>& items, long num, const short* params );
/** draw pie */
void pie( QList<PageItem*>& items, long num, short* params );
void pie( QList<PageItem*>& items, long num, const short* params );
/** set polygon fill mode */
void setPolyFillMode( QList<PageItem*>& items, long num, short* params );
void setPolyFillMode( QList<PageItem*>& items, long num, const short* params );
/** set background pen color */
void setBkColor( QList<PageItem*>& items, long num, short* params );
void setBkColor( QList<PageItem*>& items, long num, const short* params );
/** set background pen mode */
void setBkMode( QList<PageItem*>& items, long num, short* params );
void setBkMode( QList<PageItem*>& items, long num, const short* params );
/** save device context */
void saveDC( QList<PageItem*>& items, long num, short* params );
void saveDC( QList<PageItem*>& items, long num, const short* params );
/** restore device context */
void restoreDC( QList<PageItem*>& items, long num, short* params );
void restoreDC( QList<PageItem*>& items, long num, const short* params );
/** clipping region is the intersection of this region and the original region */
void intersectClipRect( QList<PageItem*>& items, long num, short* params );
void intersectClipRect( QList<PageItem*>& items, long num, const short* params );
/** delete a clipping rectangle of the original region */
void excludeClipRect( QList<PageItem*>& items, long num, short* params );
void excludeClipRect( QList<PageItem*>& items, long num, const short* params );
 
/****************** Text *******************/
/** set text color */
void setTextColor( QList<PageItem*>& items, long num, short* params );
void setTextColor( QList<PageItem*>& items, long num, const short* params );
/** set text alignment */
void setTextAlign( QList<PageItem*>& items, long num, short* params );
void setTextAlign( QList<PageItem*>& items, long num, const short* params );
/** draw text */
void textOut( QList<PageItem*>& items, long num, short* params );
void extTextOut( QList<PageItem*>& items, long num, short* params );
void textOut( QList<PageItem*>& items, long num, const short* params );
void extTextOut( QList<PageItem*>& items, long num, const short* params );
 
/****************** Object handle *******************/
/** Activate object handle */
void selectObject( QList<PageItem*>& items, long num, short* params );
void selectObject( QList<PageItem*>& items, long num, const short* params );
/** Free object handle */
void deleteObject( QList<PageItem*>& items, long num, short* params );
void deleteObject( QList<PageItem*>& items, long num, const short* params );
/** create an empty object in the object list */
void createEmptyObject( QList<PageItem*>& items, long num, short* params );
void createEmptyObject( QList<PageItem*>& items, long num, const short* params );
/** create a logical brush */
void createBrushIndirect( QList<PageItem*>& items, long num, short* params );
void createBrushIndirect( QList<PageItem*>& items, long num, const short* params );
/** create a logical pen */
void createPenIndirect( QList<PageItem*>& items, long num, short* params );
void createPenIndirect( QList<PageItem*>& items, long num, const short* params );
/** create a logical font */
void createFontIndirect( QList<PageItem*>& items, long num, short* params );
void createFontIndirect( QList<PageItem*>& items, long num, const short* params );
 
/****************** misc *******************/
/** nothing to do */
void noop( QList<PageItem*>& items, long , short* );
void noop( QList<PageItem*>& items, long , const short* );
/** end of meta file */
void end( QList<PageItem*>& items, long /*num*/, short* /*params*/ );
void end( QList<PageItem*>& items, long /*num*/, const short* /*params*/ );
 
};
 
/trunk/Scribus/scribus/plugins/import/xar/importxar.cpp
1908,8 → 1908,7
s++;
}
}
ScPattern pat = ScPattern();
pat.setDoc(m_Doc);
ScPattern pat(m_Doc);
PageItem* newItem = new PageItem_ImageFrame(m_Doc, 0, 0, 1, 1, 0, CommonStrings::None, CommonStrings::None);
QTemporaryFile *tempFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_xar_XXXXXX.png");
tempFile->setAutoRemove(false);
2707,8 → 2706,7
s++;
}
}
ScPattern pat = ScPattern();
pat.setDoc(m_Doc);
ScPattern pat(m_Doc);
PageItem* newItem = new PageItem_ImageFrame(m_Doc, 0, 0, 1, 1, 0, CommonStrings::None, CommonStrings::None);
QTemporaryFile *tempFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_xar_XXXXXX.png");
tempFile->setAutoRemove(false);
2867,8 → 2865,7
}
}
}
ScPattern pat = ScPattern();
pat.setDoc(m_Doc);
ScPattern pat(m_Doc);
PageItem* newItem = new PageItem_ImageFrame(m_Doc, 0, 0, 1, 1, 0, CommonStrings::None, CommonStrings::None);
QTemporaryFile *tempFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_xar_XXXXXX.png");
tempFile->setAutoRemove(false);
3677,8 → 3674,7
{
m_Doc->DoDrawing = true;
QImage tmpImg = groupItem->DrawObj_toImage(qMin(qMax(groupItem->width(), groupItem->height()), 500.0));
ScPattern pat = ScPattern();
pat.setDoc(m_Doc);
ScPattern pat(m_Doc);
pat.width = groupItem->width();
pat.height = groupItem->height();
pat.pattern = tmpImg;
/trunk/Scribus/scribus/plugins/import/xps/importxps.cpp
1466,8 → 1466,7
if (!item)
continue;
m_Doc->sizeItem((item->width() / conversionFactor) * vw, (item->height() / conversionFactor) * vh, item, false, true, false);
ScPattern pat = ScPattern();
pat.setDoc(m_Doc);
ScPattern pat(m_Doc);
m_Doc->DoDrawing = true;
QImage tmpImg = item->DrawObj_toImage(qMin(qMax(item->width(), item->height()), 500.0));
if (tmpImg.isNull())
/trunk/Scribus/scribus/printpreviewcreator_pdf.cpp
8,6 → 8,7
#include <QDir>
#include <QFileInfo>
#include <QImage>
#include <QScopedPointer>
#include <QTemporaryFile>
 
#include "commonstrings.h"
29,13 → 30,13
 
PrintPreviewCreator_PDF::PrintPreviewCreator_PDF(ScribusDoc* doc) :
SeparationPreviewCreator(doc),
m_prefsManager(PrefsManager::instance())
m_prefsManager(PrefsManager::instance()),
m_pdfPrintEngine(new ScPrintEngine_PDF(*doc))
{
m_pdfPrintEngine = new ScPrintEngine_PDF(*doc);
m_printOptions.prnLanguage = PrintLanguage::PDF;
 
// Generate a template name for temporary files
QTemporaryFile *tempFile = new QTemporaryFile(ScPaths::tempFileDir() + "/scpdfpreview_XXXXXX.png");
QScopedPointer<QTemporaryFile> tempFile(new QTemporaryFile(ScPaths::tempFileDir() + "/scpdfpreview_XXXXXX.png"));
if (tempFile->open())
{
QString tempFileBase = tempFile->fileName();
45,7 → 46,6
}
if (m_tempBaseName.isEmpty())
m_tempBaseName = "scpdfpreview";
delete tempFile;
}
 
PrintPreviewCreator_PDF::~PrintPreviewCreator_PDF()
/trunk/Scribus/scribus/printpreviewcreator_ps.cpp
8,6 → 8,7
#include <QDir>
#include <QFileInfo>
#include <QImage>
#include <QScopedPointer>
#include <QTemporaryFile>
#include <QTransform>
 
34,7 → 35,7
m_printOptions.prnLanguage = PrintLanguage::PostScript3;
 
// Generate a template name for temporary files
QTemporaryFile *tempFile = new QTemporaryFile(ScPaths::tempFileDir() + "/scpspreview_XXXXXX.png");
QScopedPointer<QTemporaryFile> tempFile(new QTemporaryFile(ScPaths::tempFileDir() + "/scpspreview_XXXXXX.png"));
if (tempFile->open())
{
QString tempFileBase = tempFile->fileName();
44,7 → 45,6
}
if (m_tempBaseName.isEmpty())
m_tempBaseName = "scpspreview";
delete tempFile;
}
 
PrintPreviewCreator_PS::~PrintPreviewCreator_PS()
/trunk/Scribus/scribus/pslib.cpp
672,7 → 672,6
PutStream("/PaintProc {\n");
QIODevice *spStream = spoolStream.device();
QByteArray buf;
// Qt4 QBuffer b(buf);
QBuffer b(&buf);
b.open( QIODevice::WriteOnly );
spoolStream.setDevice(&b);
701,7 → 700,7
{
progressDialog->setOverallProgress(ap);
progressDialog->setProgress("EMP", ap);
ScQApp->processEvents();
QCoreApplication::processEvents();
}
if (m_Doc->MasterItems.count() <= 0)
continue;
718,7 → 717,7
{
PageItem *it = m_Doc->MasterItems.at(api);
if (progressDialog)
ScQApp->processEvents();
QCoreApplication::processEvents();
if ((it->m_layerID != ll.ID) || (!it->printEnabled()))
continue;
double bLeft, bRight, bBottom, bTop;
1649,7 → 1648,7
progressDialog->setProgress("EP", 0);
progressDialog->show();
connect(progressDialog, SIGNAL(canceled()), this, SLOT(cancelRequested()));
ScQApp->processEvents();
QCoreApplication::processEvents();
}
}
uint docSelectionCount = m_Doc->m_Selection->count();
1984,7 → 1983,7
}
if (item->itemText.length() != 0)
setTextSt(item, PNr - 1, page, master);
if (((item->lineColor() != CommonStrings::None) || (!item->NamedLStyle.isEmpty()) || (!item->strokePattern().isEmpty()) || (item->GrTypeStroke > 0)))
if ((item->lineColor() != CommonStrings::None) || (!item->NamedLStyle.isEmpty()) || (!item->strokePattern().isEmpty()) || (item->GrTypeStroke > 0))
{
PS_setlinewidth(item->lineWidth());
PS_setcapjoin(item->PLineEnd, item->PLineJoin);
2618,7 → 2617,6
continue;
if ((!page->pageNameEmpty()) && (item->isImageFrame()) && ((Options.outputSeparations) || (!Options.useColor)))
continue;
//if ((!Art) && (view->SelItem.count() != 0) && (!item->Select))
if ((m_outputFormat == OutputEPS) && (!item->isSelected()) && (m_Doc->m_Selection->count() != 0))
continue;
double bLeft, bRight, bBottom, bTop;
2657,7 → 2655,7
{
PageItem *ite = page->FromMaster.at(am);
if (progressDialog)
ScQApp->processEvents();
QCoreApplication::processEvents();
if ((ite->m_layerID != layer.ID) || (!ite->printEnabled()))
continue;
if (!ite->isTextContainer())
2711,7 → 2709,7
}
if (ite->itemText.length() != 0)
setTextSt(ite, PNr - 1, mPage, true);
if (((ite->lineColor() != CommonStrings::None) || (!ite->NamedLStyle.isEmpty()) || (!ite->strokePattern().isEmpty()) || (ite->GrTypeStroke > 0)))
if ((ite->lineColor() != CommonStrings::None) || (!ite->NamedLStyle.isEmpty()) || (!ite->strokePattern().isEmpty()) || (ite->GrTypeStroke > 0))
{
PS_setlinewidth(ite->lineWidth());
PS_setcapjoin(ite->PLineEnd, ite->PLineJoin);
2787,7 → 2785,6
continue;
if ((!page->pageNameEmpty()) && (item->isImageFrame()) && ((Options.outputSeparations) || (!Options.useColor)))
continue;
//if ((!Art) && (view->SelItem.count() != 0) && (!item->Select))
if ((m_outputFormat == OutputEPS) && (!item->isSelected()) && (m_Doc->m_Selection->count() != 0))
continue;
double bLeft, bRight, bBottom, bTop;
/trunk/Scribus/scribus/scpattern.cpp
30,19 → 30,12
#include "scribusdoc.h"
#include "commonstrings.h"
 
ScPattern::ScPattern()
ScPattern::ScPattern(ScribusDoc* theDoc)
: doc(theDoc)
{
items.clear();
doc = nullptr;
pattern = QImage();
scaleX = 1.0;
scaleY = 1.0;
width = 0.0;
height = 0.0;
xoffset = 0.0;
yoffset = 0.0;
};
 
}
 
ScPattern::~ScPattern()
{
// while (!items.isEmpty())
65,6 → 58,7
{
items.clear();
doc->setLoading(true);
 
PageItem* newItem = new PageItem_ImageFrame(doc, 0, 0, 1, 1, 0, CommonStrings::None, CommonStrings::None);
if (newItem->loadImage(filename, false, 72, false))
{
83,7 → 77,11
items.append(newItem);
}
else
{
pattern = QImage();
delete newItem;
}
 
doc->setLoading(false);
}
 
/trunk/Scribus/scribus/scpattern.h
36,7 → 36,8
class SCRIBUS_API ScPattern
{
public:
ScPattern();
ScPattern() = default;
ScPattern(ScribusDoc* theDoc);
~ScPattern();
 
QImage* getPattern();
44,14 → 45,14
void setPattern(const QString& filename);
void createPreview();
 
double scaleX;
double scaleY;
double height;
double width;
double xoffset;
double yoffset;
double scaleX { 1.0 };
double scaleY { 1.0 };
double height { 0.0 };
double width { 0.0 };
double xoffset { 0.0 };
double yoffset { 0.0 };
QList<PageItem*> items;
ScribusDoc *doc;
ScribusDoc* doc { nullptr };
QImage pattern;
};
 
/trunk/Scribus/scribus/scribus.cpp
9078,8 → 9078,6
}
patternName = dia.getEditText();
 
ScPattern pat = ScPattern();
pat.setDoc(doc);
double minx = std::numeric_limits<double>::max();
double miny = std::numeric_limits<double>::max();
double maxx = -std::numeric_limits<double>::max();
9090,10 → 9088,13
miny = qMin(miny, y1);
maxx = qMax(maxx, x2);
maxy = qMax(maxy, y2);
 
ScPattern pat(doc);
pat.pattern = currItem->DrawObj_toImage(qMin(qMax(maxx - minx, maxy - miny), 500.0));
pat.width = maxx - minx;
pat.height = maxy - miny;
pat.items.append(currItem);
 
// #11274 : OwnPage is not meaningful for pattern items
// We set consequently pattern item's OwnPage to -1
QList<PageItem*> patternItems = pat.items;
/trunk/Scribus/scribus/scribusdoc.cpp
15672,8 → 15672,6
m_ScMW->patternsDependingOnThis.prepend(getEditedSymbol());
allItems.clear();
 
ScPattern pat;
pat.setDoc(this);
double minx = std::numeric_limits<double>::max();
double miny = std::numeric_limits<double>::max();
double maxx = -std::numeric_limits<double>::max();
15684,6 → 15682,8
miny = qMin(miny, y1);
maxx = qMax(maxx, x2);
maxy = qMax(maxy, y2);
 
ScPattern pat(this);
pat.pattern = currItem->DrawObj_toImage(qMin(qMax(maxx - minx, maxy - miny), 500.0));
pat.width = maxx - minx;
pat.height = maxy - miny;
/trunk/Scribus/scribus/ui/colorsandfills.cpp
1205,8 → 1205,7
else
{
QString patNam = fi.baseName().trimmed().simplified().replace(" ", "_");
ScPattern pat;
pat.setDoc(m_doc);
ScPattern pat(m_doc);
pat.setPattern(fileName);
if (!dialogPatterns.contains(patNam))
{
1288,8 → 1287,7
QString patNam = fi.baseName().trimmed().simplified().replace(" ", "_");
if (!dialogPatterns.contains(patNam))
{
ScPattern pat;
pat.setDoc(m_doc);
ScPattern pat(m_doc);
pat.setPattern(QDir::cleanPath(QDir::toNativeSeparators(fileName + "/" + d[dc])));
dialogPatterns.insert(patNam, pat);
origNamesPatterns.insert(patNam, patNam);
1361,8 → 1359,7
else
ite->layout();
}
ScPattern pat;
pat.setDoc(m_doc);
 
PageItem* currItem = m_doc->Items->at(ac);
double minx = std::numeric_limits<double>::max();
double miny = std::numeric_limits<double>::max();
1374,9 → 1371,12
miny = qMin(miny, y1);
maxx = qMax(maxx, x2);
maxy = qMax(maxy, y2);
 
ScPattern pat(m_doc);
pat.pattern = currItem->DrawObj_toImage(qMin(qMax(maxx - minx, maxy - miny), 500.0));
pat.width = maxx - minx;
pat.height = maxy - miny;
 
currItem->setXYPos(0, 0, true);
currItem->setWidthHeight(maxx - minx, maxy - miny, true);
currItem->groupWidth = maxx - minx;
/trunk/Scribus/scribus/ui/printdialog.cpp
40,16 → 40,17
extern bool previewDinUse;
 
PrintDialog::PrintDialog( QWidget* parent, ScribusDoc* doc, const PrintOptions& printOptions)
: QDialog( parent )
: QDialog( parent ),
m_doc(doc),
m_unit(doc->unitIndex()),
m_unitRatio(doc->unitRatio()),
m_devMode(printOptions.devMode)
{
setupUi(this);
setModal(true);
 
m_doc = doc;
m_unit = doc->unitIndex();
m_unitRatio = unitGetRatioFromIndex(doc->unitIndex());
prefs = PrefsManager::instance().prefsFile->getContext("print_options");
m_devMode = printOptions.devMode;
 
setWindowIcon(IconManager::instance().loadIcon("AppIcon.png"));
pageNrButton->setIcon(IconManager::instance().loadIcon("ellipsis.png"));
587,32 → 588,32
usePDFMarks->setChecked(m_doc->Print_Options.includePDFMarks);
}
 
QString PrintDialog::printerName()
QString PrintDialog::printerName() const
{
return PrintDest->currentText();
}
 
QString PrintDialog::outputFileName()
QString PrintDialog::outputFileName() const
{
return QDir::fromNativeSeparators(fileNameEdit->text());
}
 
bool PrintDialog::outputToFile()
bool PrintDialog::outputToFile() const
{
return (PrintDest->currentText() == CommonStrings::trFile);
}
 
int PrintDialog::numCopies()
int PrintDialog::numCopies() const
{
return Copies->value();
}
 
bool PrintDialog::outputSeparations()
bool PrintDialog::outputSeparations() const
{
return separationsCombo->isEnabled();
}
 
QString PrintDialog::separationName()
QString PrintDialog::separationName() const
{
if (separationsCombo->currentIndex() == 0)
return QString("All");
627,7 → 628,7
return separationsCombo->currentText();
}
 
QStringList PrintDialog::allSeparations()
QStringList PrintDialog::allSeparations() const
{
QStringList ret;
for (int i = 1; i < separationsCombo->count(); ++i)
635,57 → 636,57
return ret;
}
 
bool PrintDialog::color()
bool PrintDialog::color() const
{
return colorType->currentIndex() == 0;
}
 
bool PrintDialog::mirrorHorizontal()
bool PrintDialog::mirrorHorizontal() const
{
return mirrorHor->isChecked();
}
 
bool PrintDialog::mirrorVertical()
bool PrintDialog::mirrorVertical() const
{
return mirrorVert->isChecked();
}
 
bool PrintDialog::doGCR()
bool PrintDialog::doGCR() const
{
return applyGCR->isChecked();
}
 
bool PrintDialog::doClip()
bool PrintDialog::doClip() const
{
return clipMargins->isChecked();
}
 
PrintLanguage PrintDialog::printLanguage()
PrintLanguage PrintDialog::printLanguage() const
{
return printLanguages->currentLanguage();
}
 
bool PrintDialog::doDev()
bool PrintDialog::doDev() const
{
return setMediaSize->isChecked();
}
 
bool PrintDialog::doSpot()
bool PrintDialog::doSpot() const
{
return !convertSpots->isChecked();
}
 
bool PrintDialog::doPrintAll()
bool PrintDialog::doPrintAll() const
{
return printAllRadio->isChecked();
}
 
bool PrintDialog::doPrintCurrentPage()
bool PrintDialog::doPrintCurrentPage() const
{
return printCurrentRadio->isChecked();
}
 
QString PrintDialog::getPageString()
QString PrintDialog::getPageString() const
{
return pageNr->text();
}
/trunk/Scribus/scribus/ui/printdialog.h
28,24 → 28,24
PrintDialog( QWidget* parent, ScribusDoc* doc, const PrintOptions& printOptions);
~PrintDialog();
 
QString printerName();
QString outputFileName();
bool outputToFile();
int numCopies();
bool outputSeparations();
QString separationName();
QStringList allSeparations();
bool color();
bool mirrorHorizontal();
bool mirrorVertical();
bool doGCR();
bool doClip();
PrintLanguage printLanguage();
bool doDev();
bool doSpot();
bool doPrintAll();
bool doPrintCurrentPage();
QString getPageString();
QString printerName() const;
QString outputFileName() const;
bool outputToFile() const;
int numCopies() const;
bool outputSeparations() const;
QString separationName() const;
QStringList allSeparations() const;
bool color() const;
bool mirrorHorizontal() const;
bool mirrorVertical() const;
bool doGCR() const;
bool doClip() const;
PrintLanguage printLanguage() const;
bool doDev() const;
bool doSpot() const;
bool doPrintAll() const;
bool doPrintCurrentPage() const;
QString getPageString() const;
 
public slots:
void setMinMax(int min, int max, int cur);
67,7 → 67,7
void previewButtonClicked();
 
protected:
ScribusDoc* m_doc;
ScribusDoc* m_doc { nullptr };
PrefsContext* prefs { nullptr };
CupsOptions* m_cupsOptions { nullptr };
int m_unit { 0 };