r15005 by jghali - fix ps printing problem on win32 after the recent changes in pslib related to landscape printing
scribus-commit
scribus-commit at lists.scribus.net
Fri Apr 23 20:50:41 CEST 2010
Revision: 15005
Author: jghali
Date: 2010-04-23T18:44:10.712437Z
Commit message: fix ps printing problem on win32 after the recent changes in pslib related to landscape printing
Changeset:
M /trunk/Scribus/scribus/scprintengine_gdi.cpp
M /trunk/Scribus/scribus/scprintengine_gdi.h
Diffs:
Index: scribus/scprintengine_gdi.h
===================================================================
--- scribus/scprintengine_gdi.h (revision 15004)
+++ scribus/scprintengine_gdi.h (revision 15005)
@@ -77,10 +77,11 @@
\param printerDC the printer deice context
\param pageWidth width
\param pageHeight height
+ \parah landscape the page is to be printer in landscape mode
\retval bool true on success
\author Jean Ghali
*/
- bool sendPSFile ( QString filePath, HDC printerDC, int pageWidth, int pageHeight );
+ bool sendPSFile ( QString filePath, HDC printerDC, int pageWidth, int pageHeight, bool landscape );
/*! \brief Set device params into DEVMODE structure according to print options
Set printing params according to options and DEVMODE structure
\param options print options
Index: scribus/scprintengine_gdi.cpp
===================================================================
--- scribus/scprintengine_gdi.cpp (revision 15004)
+++ scribus/scprintengine_gdi.cpp (revision 15005)
@@ -310,11 +310,11 @@
if ( options.useICC && isPostscriptPrinter(printerDC) )
{
success = false;
- QString mProf = doc->CMSSettings.DefaultSolidColorRGBProfile;
- QString pProf = doc->CMSSettings.DefaultPrinterProfile;
+ QString mProf = doc->prefsData().colorPrefs.DCMSset.DefaultSolidColorRGBProfile;
+ QString pProf = doc->prefsData().colorPrefs.DCMSset.DefaultPrinterProfile;
if ( ScCore->MonitorProfiles.contains(mProf) && ScCore->PrinterProfiles.contains(pProf) )
{
- inputProfile = QDir::convertSeparators(ScCore->InputProfiles[mProf]);
+ inputProfile = QDir::convertSeparators(ScCore->InputProfiles[mProf]);
printerProfile = QDir::convertSeparators(ScCore->PrinterProfiles[pProf]);
// Avoid color transform if input and output profile are the same
if ( inputProfile != printerProfile )
@@ -471,7 +471,7 @@
double bleedH = options.bleeds.Left + options.bleeds.Right;
double bleedV = options.bleeds.Top + options.bleeds.Bottom;
StartPage( printerDC );
- succeed = sendPSFile( tempFilePath, printerDC, page->width() + bleedH, page->height() + bleedV);
+ succeed = sendPSFile( tempFilePath, printerDC, page->width() + bleedH, page->height() + bleedV, (page->orientation() == 1));
EndPage( printerDC );
}
@@ -497,7 +497,7 @@
return succeed;
}
-bool ScPrintEngine_GDI::sendPSFile( QString filePath, HDC printerDC, int pageWidth, int pageHeight )
+bool ScPrintEngine_GDI::sendPSFile( QString filePath, HDC printerDC, int pageWidth, int pageHeight, bool landscape )
{
int escape;
int logPixelsX;
@@ -553,9 +553,30 @@
if( ExtEscape( printerDC, escape, sizeof(sps), (LPCSTR) &sps, 0, NULL) <= 0 )
return false;
+ // Match Postscript and GDI coordinate system
+ sprintf( (char*) sps.data, "0 %0.3f neg translate\n", (double) physicalHeight );
+ sps.numBytes = strlen( (char*) sps.data );
+ if( ExtEscape( printerDC, escape, sizeof(sps), (LPCSTR) &sps, 0, NULL) <= 0 )
+ return false;
+
+ // In case of landscape printing, pslib will rotate the page
+ // we must take that into account
+ if (landscape)
+ {
+ sprintf( (char*) sps.data, "-90 rotate %0.3f %0.3f translate\n", (double) -pageHeight, 0.0);
+ sps.numBytes = strlen( (char*) sps.data );
+ if( ExtEscape( printerDC, escape, sizeof(sps), (LPCSTR) &sps, 0, NULL) <= 0 )
+ return false;
+ transx = ( physicalHeight - pageHeight ) / -2.0;
+ transy = ( physicalWidth - pageWidth ) / 2.0;
+ }
+ else
+ {
+ transx = ( physicalWidth - pageWidth ) / 2.0;
+ transy = ( physicalHeight - pageHeight ) / 2.0;
+ }
+
// Center the printed page in paper zone
- transx = ( physicalWidth - pageWidth ) / 2.0;
- transy = ( pageHeight - physicalHeight ) / 2.0 - pageHeight;
sprintf( (char*) sps.data, "%0.3f %0.3f translate\n", transx, transy );
sps.numBytes = strlen( (char*) sps.data );
if( ExtEscape( printerDC, escape, sizeof(sps), (LPCSTR) &sps, 0, NULL) <= 0 )
More information about the scribus-commit
mailing list