r23873 by jghali - Some refactoring related to print engines
scribus-commit
scribus-commit at lists.scribus.net
Thu Jun 4 10:31:21 UTC 2020
Author: jghali
Date: Thu Jun 4 10:31:21 2020
New Revision: 23873
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23873
Log:
Some refactoring related to print engines
Modified:
trunk/Scribus/scribus/plugins/scriptplugin/objprinter.cpp
trunk/Scribus/scribus/plugins/scriptplugin_py2x/objprinter.cpp
trunk/Scribus/scribus/scprintengine.h
trunk/Scribus/scribus/scprintengine_gdi.cpp
trunk/Scribus/scribus/scprintengine_gdi.h
trunk/Scribus/scribus/scprintengine_ps.cpp
trunk/Scribus/scribus/scprintengine_ps.h
trunk/Scribus/scribus/scribus.cpp
trunk/Scribus/scribus/ui/printpreview.cpp
Modified: trunk/Scribus/scribus/plugins/scriptplugin/objprinter.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23873&path=/trunk/Scribus/scribus/plugins/scriptplugin/objprinter.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/objprinter.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/objprinter.cpp Thu Jun 4 10:31:21 2020
@@ -442,8 +442,8 @@
bool printDone = false;
if (PrinterUtil::getDefaultSettings(prn, options.devMode))
{
- ScPrintEngine_GDI winPrint;
- printDone = winPrint.print(*currentDoc, options);
+ ScPrintEngine_GDI winPrint(*currentDoc);
+ printDone = winPrint.print(options);
}
if (!printDone)
PyErr_SetString(PyExc_SystemError, "Printing failed");
Modified: trunk/Scribus/scribus/plugins/scriptplugin_py2x/objprinter.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23873&path=/trunk/Scribus/scribus/plugins/scriptplugin_py2x/objprinter.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin_py2x/objprinter.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin_py2x/objprinter.cpp Thu Jun 4 10:31:21 2020
@@ -442,8 +442,8 @@
bool printDone = false;
if (PrinterUtil::getDefaultSettings(prn, options.devMode))
{
- ScPrintEngine_GDI winPrint;
- printDone = winPrint.print(*currentDoc, options);
+ ScPrintEngine_GDI winPrint(*currentDoc);
+ printDone = winPrint.print(options);
}
if (!printDone)
PyErr_SetString(PyExc_SystemError, "Printing failed");
Modified: trunk/Scribus/scribus/scprintengine.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23873&path=/trunk/Scribus/scribus/scprintengine.h
==============================================================================
--- trunk/Scribus/scribus/scprintengine.h (original)
+++ trunk/Scribus/scribus/scprintengine.h Thu Jun 4 10:31:21 2020
@@ -16,19 +16,19 @@
{
Q_OBJECT
-protected:
+public:
+ ScPrintEngine(ScribusDoc& doc) : m_doc(doc) {}
+ virtual ~ScPrintEngine() {}
- bool m_abort;
- QString m_errorMessage;
-
- ScPrintEngine() { m_abort = false; }
-
-public:
- virtual ~ScPrintEngine() {}
- virtual bool print(ScribusDoc& doc, PrintOptions& options) = 0;
+ virtual bool print(PrintOptions& options) = 0;
virtual const QString& errorMessage(void) { return m_errorMessage; }
public slots:
void cancelRequested(void) { m_abort = true; }
+
+protected:
+ ScribusDoc& m_doc;
+ bool m_abort { false };
+ QString m_errorMessage;
};
#endif
Modified: trunk/Scribus/scribus/scprintengine_gdi.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23873&path=/trunk/Scribus/scribus/scprintengine_gdi.cpp
==============================================================================
--- trunk/Scribus/scribus/scprintengine_gdi.cpp (original)
+++ trunk/Scribus/scribus/scprintengine_gdi.cpp Thu Jun 4 10:31:21 2020
@@ -62,7 +62,7 @@
BYTE data[32768];
} sPSPassthrough;
-ScPrintEngine_GDI::ScPrintEngine_GDI(void) : ScPrintEngine()
+ScPrintEngine_GDI::ScPrintEngine_GDI(ScribusDoc& doc) : ScPrintEngine(doc)
{
m_abort = false;
m_forceGDI = false;
@@ -79,7 +79,7 @@
//m_forceGDI = false;
}
-bool ScPrintEngine_GDI::print(ScribusDoc& doc, PrintOptions& options)
+bool ScPrintEngine_GDI::print(PrintOptions& options)
{
bool toFile;
bool success;
@@ -96,7 +96,7 @@
toFile = printerUseFilePort(options.printer);
if (toFile)
{
- QString docName = doc.documentFileName();
+ QString docName = m_doc.documentFileName();
diaSelection = docName.right(docName.length() - docName.lastIndexOf("/") - 1);
diaSelection = diaSelection.left(diaSelection.indexOf("."));
diaSelection += ".prn";
@@ -106,12 +106,12 @@
docDir = dirs->get("winprn", prefsDocDir);
else
docDir = ".";
- CustomFDialog dia(doc.scMW()->view, docDir, QObject::tr("Save As"), "Spool Files (*.prn *.ps);;All Files (*)", fdNone);
+ CustomFDialog dia(m_doc.scMW()->view, docDir, QObject::tr("Save As"), "Spool Files (*.prn *.ps);;All Files (*)", fdNone);
dia.setSelection(diaSelection);
if (dia.exec() == QDialog::Accepted)
{
QString selectedFile = dia.selectedFile();
- if (overwrite(doc.scMW()->view, selectedFile))
+ if (overwrite(m_doc.scMW()->view, selectedFile))
{
dirs->set("winprn", selectedFile.left(selectedFile.lastIndexOf("/")));
fileName = QDir::toNativeSeparators(selectedFile);
@@ -122,13 +122,13 @@
}
// Set user options in the DEVmode structure
- setDeviceParams(&doc, options, (DEVMODEW*) devMode.data());
+ setDeviceParams(options, (DEVMODEW*) devMode.data());
// Create the device context
printerDC = CreateDCW(nullptr, (LPCWSTR) printerName.utf16(), nullptr, (DEVMODEW*) devMode.data());
if (printerDC)
{
- success = printPages(&doc, options, printerDC, (DEVMODEW*) devMode.data(), fileName);
+ success = printPages(options, printerDC, (DEVMODEW*) devMode.data(), fileName);
DeleteDC(printerDC);
}
else
@@ -140,7 +140,7 @@
return success;
}
-bool ScPrintEngine_GDI::gdiPrintPreview(ScribusDoc* doc, ScPage* page, QImage* image, PrintOptions& options, double scale)
+bool ScPrintEngine_GDI::gdiPrintPreview(ScPage* page, QImage* image, PrintOptions& options, double scale)
{
bool success = true;
HCOLORSPACE hColorSpace = nullptr;
@@ -148,7 +148,7 @@
double scalex = 1, scaley = 1;
bool rotate = false;
- if (!doc || !page || !image)
+ if (!page || !image)
return false;
resetData();
@@ -174,7 +174,7 @@
if (options.mirrorV) dy += cliph;
// Create the GDI painters
- ScPageOutput pageOutput(doc, false);
+ ScPageOutput pageOutput(&m_doc, false);
QRect drawRect(0, 0, imagew, imageh);
cairo_surface_t* surface = cairo_image_surface_create_for_data(image->bits(), CAIRO_FORMAT_ARGB32, imagew, imageh, imagew*4);
@@ -186,7 +186,7 @@
cairo_surface_destroy(surface);
return false;
}
- ScPainterEx_Cairo painter(context, drawRect, doc, !options.useColor);
+ ScPainterEx_Cairo painter(context, drawRect, &m_doc, !options.useColor);
scalex *= scale;
scaley *= scale;
@@ -203,7 +203,7 @@
return success;
}
-bool ScPrintEngine_GDI::printPages(ScribusDoc* doc, PrintOptions& options, HDC printerDC, DEVMODEW* devMode, QString& fileName)
+bool ScPrintEngine_GDI::printPages(PrintOptions& options, HDC printerDC, DEVMODEW* devMode, QString& fileName)
{
int jobId;
QScopedPointer<MultiProgressDialog> progress;
@@ -220,7 +220,7 @@
printPageFunc = (useGDI) ? &ScPrintEngine_GDI::printPage_GDI : &ScPrintEngine_GDI::printPage_PS;
// Setup document infos structure
- wcsncpy (docName, (const WCHAR*) doc->documentFileName().utf16(), 511);
+ wcsncpy (docName, (const WCHAR*) m_doc.documentFileName().utf16(), 511);
ZeroMemory(&docInfo, sizeof(docInfo));
docInfo.cbSize = sizeof(docInfo);
docInfo.lpszDocName = docName;
@@ -255,7 +255,7 @@
bool usingGui = ScCore->usingGUI();
if (usingGui)
{
- progress.reset(new MultiProgressDialog(QObject::tr("Printing..."), CommonStrings::tr_Cancel, doc->scMW()));
+ progress.reset(new MultiProgressDialog(QObject::tr("Printing..."), CommonStrings::tr_Cancel, m_doc.scMW()));
progress->setOverallTotalSteps(options.pageNumbers.size());
progress->setOverallProgress(0);
connect(progress.data(), SIGNAL(canceled()), this, SLOT(cancelRequested()));
@@ -266,8 +266,8 @@
{
if (usingGui)
progress->setOverallProgress(index);
- docPage = doc->Pages->at(options.pageNumbers[index] - 1);
- success = (this->*printPageFunc)(doc, docPage, options, printerDC, context);
+ docPage = m_doc.Pages->at(options.pageNumbers[index] - 1);
+ success = (this->*printPageFunc)(docPage, options, printerDC, context);
ScQApp->processEvents();
if (!success || m_abort)
break;
@@ -288,7 +288,7 @@
return success;
}
-bool ScPrintEngine_GDI::printPage_GDI(ScribusDoc* doc, ScPage* page, PrintOptions& options, HDC printerDC, cairo_t* context)
+bool ScPrintEngine_GDI::printPage_GDI(ScPage* page, PrintOptions& options, HDC printerDC, cairo_t* context)
{
int logPixelsX;
int logPixelsY;
@@ -311,8 +311,8 @@
if (isPostscriptPrinter(printerDC))
{
success = false;
- QString mProf = doc->prefsData().colorPrefs.DCMSset.DefaultSolidColorRGBProfile;
- QString pProf = doc->prefsData().colorPrefs.DCMSset.DefaultPrinterProfile;
+ QString mProf = m_doc.prefsData().colorPrefs.DCMSset.DefaultSolidColorRGBProfile;
+ QString pProf = m_doc.prefsData().colorPrefs.DCMSset.DefaultPrinterProfile;
if (ScCore->MonitorProfiles.contains(mProf) && ScCore->PrinterProfiles.contains(pProf))
{
inputProfile = QDir::toNativeSeparators(ScCore->InputProfiles[mProf]);
@@ -400,11 +400,11 @@
// Create the GDI painter
MarksOptions marksOptions(options);
- ScPageOutput pageOutput(doc, true, 300, true);
+ ScPageOutput pageOutput(&m_doc, true, 300, true);
pageOutput.setMarksOptions(marksOptions);
QRect drawRect(0, 0, physicalWidth, physicalHeight);
- ScPainterEx_Cairo painter(context, drawRect, doc, !options.useColor);
+ ScPainterEx_Cairo painter(context, drawRect, &m_doc, !options.useColor);
painter.clear();
scalex *= (logPixelsX / 72.0);
@@ -425,7 +425,7 @@
return success;
}
-bool ScPrintEngine_GDI::printPage_PS(ScribusDoc* doc, ScPage* page, PrintOptions& options, HDC printerDC, cairo_t* /*context*/)
+bool ScPrintEngine_GDI::printPage_PS(ScPage* page, PrintOptions& options, HDC printerDC, cairo_t* /*context*/)
{
bool succeed = false;
PrintOptions options2 = options;
@@ -437,7 +437,7 @@
options2.includePDFMarks = false;
tempFilePath = ScPaths::tempFileDir() + "/tmp.ps";
- PSLib *dd = new PSLib(doc, options2, PSLib::OutputEPS);
+ PSLib *dd = new PSLib(&m_doc, options2, PSLib::OutputEPS);
ret = dd->createPS(tempFilePath);
delete dd;
if (ret != 0) return false;
@@ -447,8 +447,8 @@
QString tmp;
QStringList opts;
QString tempFilePath2 = ScPaths::tempFileDir() + "/tmp2.ps";
- opts.append( QString("-dDEVICEWIDTHPOINTS=%1").arg(tmp.setNum(doc->pageWidth())));
- opts.append( QString("-dDEVICEHEIGHTPOINTS=%1").arg(tmp.setNum(doc->pageHeight())));
+ opts.append( QString("-dDEVICEWIDTHPOINTS=%1").arg(tmp.setNum(m_doc.pageWidth())));
+ opts.append( QString("-dDEVICEHEIGHTPOINTS=%1").arg(tmp.setNum(m_doc.pageHeight())));
if (QFile::exists(tempFilePath2))
QFile::remove(tempFilePath2);
ret = convertPS2PS(tempFilePath, tempFilePath2, opts, options.prnEngine);
@@ -476,7 +476,7 @@
return succeed;
}
-bool ScPrintEngine_GDI::printPage_PS_Sep(ScribusDoc* doc, ScPage* page, PrintOptions& options, HDC printerDC, cairo_t* context)
+bool ScPrintEngine_GDI::printPage_PS_Sep(ScPage* page, PrintOptions& options, HDC printerDC, cairo_t* context)
{
bool succeed = true;
QStringList separations;
@@ -488,7 +488,7 @@
{
PrintOptions tempOptions = options;
tempOptions.separationName = separations.at(i);
- succeed &= printPage_PS(doc, page, tempOptions, printerDC, context);
+ succeed &= printPage_PS(page, tempOptions, printerDC, context);
if (!succeed) break;
}
return succeed;
@@ -616,7 +616,7 @@
return ((fileSize == bw) && (br >= 0));
}
-void ScPrintEngine_GDI::setDeviceParams(ScribusDoc* doc, PrintOptions& options, DEVMODEW* devMode)
+void ScPrintEngine_GDI::setDeviceParams(PrintOptions& options, DEVMODEW* devMode)
{
HANDLE handle;
QString printer = options.printer;
@@ -633,7 +633,7 @@
}
OpenPrinterW((LPWSTR) printer.utf16(), &handle, nullptr);
- DocumentPropertiesW((HWND) doc->scMW()->winId(), handle, (LPWSTR) printer.utf16(), devMode, devMode, DM_IN_BUFFER | DM_OUT_BUFFER);
+ DocumentPropertiesW((HWND) m_doc.scMW()->winId(), handle, (LPWSTR) printer.utf16(), devMode, devMode, DM_IN_BUFFER | DM_OUT_BUFFER);
ClosePrinter(handle);
}
Modified: trunk/Scribus/scribus/scprintengine_gdi.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23873&path=/trunk/Scribus/scribus/scprintengine_gdi.h
==============================================================================
--- trunk/Scribus/scribus/scprintengine_gdi.h (original)
+++ trunk/Scribus/scribus/scprintengine_gdi.h Thu Jun 4 10:31:21 2020
@@ -22,7 +22,7 @@
{
public:
- ScPrintEngine_GDI(void);
+ ScPrintEngine_GDI(ScribusDoc& doc);
/*! \brief Force use of gdi even on ps printers
\param force if gdi should be forced
@@ -36,7 +36,7 @@
\retval bool return true if no error occurred
\author Jean Ghali
*/
- virtual bool print(ScribusDoc& doc, PrintOptions& options);
+ bool print(PrintOptions& options) override;
/*! \brief Draw print preview to an image using gdi method
\param doc the document whose page is to be preview
@@ -47,7 +47,7 @@
\retval bool true on success
\author Jean Ghali
*/
- bool gdiPrintPreview( ScribusDoc* doc, ScPage* page, QImage* image, PrintOptions& options, double scale = 1.0 );
+ bool gdiPrintPreview(ScPage* page, QImage* image, PrintOptions& options, double scale = 1.0);
/*! \brief Get the default printer name
\retval QString the default printer name on success or an empty string
@@ -57,11 +57,11 @@
protected:
- bool m_forceGDI;
+ bool m_forceGDI { false };
void resetData(void);
- typedef bool (ScPrintEngine_GDI::*PrintPageFunc) (ScribusDoc* doc, ScPage* page, PrintOptions& options, HDC printerDC, cairo_t* context);
+ typedef bool (ScPrintEngine_GDI::*PrintPageFunc) (ScPage* page, PrintOptions& options, HDC printerDC, cairo_t* context);
/*! \brief Print selected pages to a printer or a file
\param doc the document whose pages are to be printer
@@ -72,7 +72,7 @@
\retval bool true on success
\author Jean Ghali
*/
- bool printPages(ScribusDoc* doc, PrintOptions& options, HDC printerDC, DEVMODEW* devMode, QString& fileName);
+ bool printPages(PrintOptions& options, HDC printerDC, DEVMODEW* devMode, QString& fileName);
/*! \brief Print a page to a gdi printer
Print a page using GDI drawing code ( works on all printers : PS, PCL, GDI... )
@@ -84,7 +84,7 @@
\retval bool true on success
\author Jean Ghali
*/
- bool printPage_GDI(ScribusDoc* doc, ScPage* page, PrintOptions& options, HDC printerDC, cairo_t* context);
+ bool printPage_GDI(ScPage* page, PrintOptions& options, HDC printerDC, cairo_t* context);
/*! \brief Print a page to a PostScript printer using passthroughs
Print a page using PS drawing code and PS passthroughs ( works on PS printers only )
@@ -96,7 +96,7 @@
\retval bool true on success
\author Jean Ghali
*/
- bool printPage_PS (ScribusDoc* doc, ScPage* page, PrintOptions& options, HDC printerDC, cairo_t* context);
+ bool printPage_PS (ScPage* page, PrintOptions& options, HDC printerDC, cairo_t* context);
/*! \brief Print a page separations to a PostScript printer using passthroughs
Print a page using PS drawing code and PS passthroughs ( works on PS printers only )
@@ -108,7 +108,7 @@
\retval bool true on success
\author Jean Ghali
*/
- bool printPage_PS_Sep(ScribusDoc* doc, ScPage* page, PrintOptions& options, HDC printerDC, cairo_t* context);
+ bool printPage_PS_Sep(ScPage* page, PrintOptions& options, HDC printerDC, cairo_t* context);
/*! \brief Send a file to printer using PostScript Passthrough
Send a postscript file to a printer using ps passthrough ( works on PS printers only )
@@ -128,7 +128,7 @@
\param devMode pointer to a DEVMODE structure
\author Jean Ghali
*/
- void setDeviceParams(ScribusDoc* doc, PrintOptions& options, DEVMODEW* devMode);
+ void setDeviceParams(PrintOptions& options, DEVMODEW* devMode);
/*! \brief Get support for PostScript Passthrough
Get ps passthrough support and escape code
Modified: trunk/Scribus/scribus/scprintengine_ps.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23873&path=/trunk/Scribus/scribus/scprintengine_ps.cpp
==============================================================================
--- trunk/Scribus/scribus/scprintengine_ps.cpp (original)
+++ trunk/Scribus/scribus/scprintengine_ps.cpp Thu Jun 4 10:31:21 2020
@@ -14,11 +14,16 @@
#include "util_file.h"
#include "util_ghostscript.h"
-bool ScPrintEngine_PS::print(ScribusDoc& doc, PrintOptions& options)
+ScPrintEngine_PS::ScPrintEngine_PS(ScribusDoc& doc)
+ : ScPrintEngine(doc)
{
- bool retw = false;
+
+}
+
+bool ScPrintEngine_PS::print(PrintOptions& options)
+{
QString filename(options.filename);
- PSLib *dd = new PSLib(&doc, options, PSLib::OutputPS);
+ PSLib *dd = new PSLib(&m_doc, options, PSLib::OutputPS);
if (dd == nullptr)
return false;
@@ -42,39 +47,38 @@
// use gs to convert our PS to a lower version
QString tmp;
QStringList opts;
- opts.append( QString("-dDEVICEWIDTHPOINTS=%1").arg(tmp.setNum(doc.pageWidth())) );
- opts.append( QString("-dDEVICEHEIGHTPOINTS=%1").arg(tmp.setNum(doc.pageHeight())) );
+ opts.append( QString("-dDEVICEWIDTHPOINTS=%1").arg(tmp.setNum(m_doc.pageWidth())) );
+ opts.append( QString("-dDEVICEHEIGHTPOINTS=%1").arg(tmp.setNum(m_doc.pageHeight())) );
convertPS2PS(filename, filename + ".tmp", opts, options.prnEngine);
moveFile(filename + ".tmp", filename);
}
- if (!options.toFile)
+ if (options.toFile)
+ return true;
+
+ // Print and delete the PS file
+ QByteArray cmd;
+ if (options.useAltPrintCommand)
{
- // print and delete the PS file
- QByteArray cmd;
- if (options.useAltPrintCommand)
- {
- cmd += options.printerCommand;
- cmd += " ";
- cmd += filename;
- system(cmd.data());
- }
- else
- {
- QByteArray cc;
- cmd += "lpr -P '";
- cmd += options.printer;
- cmd += "'";
- if (options.copies > 1)
- cmd += " -#" + cc.setNum(options.copies);
- cmd += options.printerOptions;
- cmd += " "+filename;
- system(cmd.data());
- }
- // Disabled that for now, as kprinter won't work otherwise
- // leaving that file around doesn't harm, as it will be overwritten the next time.
- // unlink(filename);
+ cmd += options.printerCommand;
+ cmd += " ";
+ cmd += filename;
+ system(cmd.data());
}
+ else
+ {
+ QByteArray cc;
+ cmd += "lpr -P '";
+ cmd += options.printer;
+ cmd += "'";
+ if (options.copies > 1)
+ cmd += " -#" + cc.setNum(options.copies);
+ cmd += options.printerOptions;
+ cmd += " " + filename;
+ system(cmd.data());
+ }
+ // Disabled that for now, as kprinter won't work otherwise
+ // leaving that file around doesn't harm, as it will be overwritten the next time.
+ // unlink(filename);
- retw = true;
- return retw;
+ return true;
}
Modified: trunk/Scribus/scribus/scprintengine_ps.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23873&path=/trunk/Scribus/scribus/scprintengine_ps.h
==============================================================================
--- trunk/Scribus/scribus/scprintengine_ps.h (original)
+++ trunk/Scribus/scribus/scprintengine_ps.h Thu Jun 4 10:31:21 2020
@@ -12,8 +12,10 @@
class ScPrintEngine_PS : public ScPrintEngine
{
public:
+ ScPrintEngine_PS(ScribusDoc& doc);
~ScPrintEngine_PS() {}
- virtual bool print(ScribusDoc& doc, PrintOptions& options);
+
+ bool print(PrintOptions& options) override;
};
#endif
Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23873&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Thu Jun 4 10:31:21 2020
@@ -4595,10 +4595,10 @@
SHORT shiftState = GetKeyState( VK_SHIFT );
bool forceGDI = ( shiftState & 0x8000 ) ? true : false;
if (doc->Print_Options.toFile)
- prnEngine = dynamic_cast<ScPrintEngine*>(new ScPrintEngine_PS());
+ prnEngine = dynamic_cast<ScPrintEngine*>(new ScPrintEngine_PS(*doc));
else
{
- ScPrintEngine_GDI* gdiEngine = new ScPrintEngine_GDI();
+ ScPrintEngine_GDI* gdiEngine = new ScPrintEngine_GDI(*doc);
gdiEngine->setForceGDI( forceGDI );
prnEngine = dynamic_cast<ScPrintEngine*>(gdiEngine);
}
@@ -4607,7 +4607,7 @@
#endif
if (prnEngine)
{
- printDone = prnEngine->print(*doc, options);
+ printDone = prnEngine->print(options);
if (!printDone)
error = prnEngine->errorMessage();
delete prnEngine;
Modified: trunk/Scribus/scribus/ui/printpreview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23873&path=/trunk/Scribus/scribus/ui/printpreview.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/printpreview.cpp (original)
+++ trunk/Scribus/scribus/ui/printpreview.cpp Thu Jun 4 10:31:21 2020
@@ -482,7 +482,7 @@
{
QImage image;
ScPage* page;
- ScPrintEngine_GDI winPrint;
+ ScPrintEngine_GDI winPrint(*doc);
PrintOptions options;
page = doc->Pages->at(pageIndex);
options.copies = 1;
@@ -496,7 +496,7 @@
options.toFile = false;
options.useColor = !useGray->isChecked();
options.useSpotColors = false;
- bool done = winPrint.gdiPrintPreview(doc, page, &image, options, res / 72.0);
+ bool done = winPrint.gdiPrintPreview(page, &image, options, res / 72.0);
if (done)
image.save( ScPaths::tempFileDir() + "/sc.png", "PNG" );
return (done ? 0 : 1);
More information about the scribus-commit
mailing list