// Modified by:
// Created: 01/02/97
// RCS-ID: $Id$
-// Copyright: (c) Julian Smart and Markus Holzem
+// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// headers
// ----------------------------------------------------------------------------
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "cmndata.h"
#endif
#endif // wxUSE_PRINTING_ARCHITECTURE
#ifdef __WXMSW__
- #include <windows.h>
+ #include <windowsx.h>
#include "wx/msw/private.h"
- #if !defined(__WIN32__)
- #include <print.h>
- #include <commdlg.h>
- #endif // Win16
-
- #ifdef __WXWINE__
- #include <cderr.h>
+ #ifndef __SMARTPHONE__ /* of WinCE */
#include <commdlg.h>
#endif
- #if defined(__WATCOMC__) || defined(__SC__) || defined(__SALFORDC__)
+ #if defined(__WATCOMC__) || defined(__SYMANTEC__) || defined(__SALFORDC__)
#include <windowsx.h>
#include <commdlg.h>
#endif
#endif // MSW
+#ifdef __WXMAC__
+ #include "wx/mac/private/print.h"
+#endif
+
#if wxUSE_PRINTING_ARCHITECTURE
IMPLEMENT_DYNAMIC_CLASS(wxPrintData, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxPrintDialogData, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxFontData, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxColourData, wxObject)
-#ifdef __WXMAC__
- #include "wx/mac/uma.h"
-
-#if defined(TARGET_CARBON) && !defined(__DARWIN__)
-# if PM_USE_SESSION_APIS
-# include <PMCore.h>
-# endif
-# include <PMApplication.h>
-#endif
-
-#ifndef __DARWIN__
- #include "Printing.h"
-#endif
- #define mm2pt 2.83464566929
- #define pt2mm 0.352777777778
-#endif // Mac
-
#ifndef DMPAPER_USER
#define DMPAPER_USER 256
#endif
wxColourData::wxColourData()
{
- int i;
- for (i = 0; i < 16; i++)
- custColours[i].Set(255, 255, 255);
-
- chooseFull = FALSE;
- dataColour.Set(0,0,0);
+ m_chooseFull = false;
+ m_dataColour.Set(0,0,0);
+ // m_custColours are wxNullColours initially
}
wxColourData::wxColourData(const wxColourData& data)
void wxColourData::SetCustomColour(int i, const wxColour& colour)
{
- if (i > 15 || i < 0)
- return;
+ wxCHECK_RET( (i >= 0 && i < 16), _T("custom colour index out of range") );
- custColours[i] = colour;
+ m_custColours[i] = colour;
}
wxColour wxColourData::GetCustomColour(int i)
{
- if (i > 15 || i < 0)
- return wxColour(0,0,0);
+ wxCHECK_MSG( (i >= 0 && i < 16), wxColour(0,0,0),
+ _T("custom colour index out of range") );
- return custColours[i];
+ return m_custColours[i];
}
void wxColourData::operator=(const wxColourData& data)
{
int i;
for (i = 0; i < 16; i++)
- custColours[i] = data.custColours[i];
+ m_custColours[i] = data.m_custColours[i];
- dataColour = (wxColour&)data.dataColour;
- chooseFull = data.chooseFull;
+ m_dataColour = (wxColour&)data.m_dataColour;
+ m_chooseFull = data.m_chooseFull;
}
// ----------------------------------------------------------------------------
wxFontData::wxFontData()
{
// Intialize colour to black.
- fontColour.Set(0, 0, 0);
+ m_fontColour = wxNullColour;
- showHelp = FALSE;
- allowSymbols = TRUE;
- enableEffects = TRUE;
- minSize = 0;
- maxSize = 0;
+ m_showHelp = false;
+ m_allowSymbols = true;
+ m_enableEffects = true;
+ m_minSize = 0;
+ m_maxSize = 0;
m_encoding = wxFONTENCODING_SYSTEM;
}
m_devMode = (void*) NULL;
m_devNames = (void*) NULL;
#elif defined( __WXMAC__ )
-#if TARGET_CARBON
- m_macPageFormat = kPMNoPageFormat;
- m_macPrintSettings = kPMNoPrintSettings;
-
- #if PM_USE_SESSION_APIS
- PMPrintSession macPrintSession = kPMNoReference;
- OSStatus err;
-
- err = ::UMAPrOpen(&macPrintSession) ;
- if ( err == noErr )
- {
- err = PMCreatePageFormat((PMPageFormat *)&m_macPageFormat);
-
- // Note that PMPageFormat is not session-specific, but calling
- // PMSessionDefaultPageFormat assigns values specific to the printer
- // associated with the current printing session.
- if ((err == noErr) && (m_macPageFormat != kPMNoPageFormat))
- {
- err = PMSessionDefaultPageFormat((PMPrintSession)macPrintSession,
- (PMPageFormat)m_macPageFormat);
- }
-
- err = PMCreatePrintSettings((PMPrintSettings *)&m_macPrintSettings);
-
- // Note that PMPrintSettings is not session-specific, but calling
- // PMSessionDefaultPrintSettings assigns values specific to the printer
- // associated with the current printing session.
- if ((err == noErr) && (m_macPrintSettings != kPMNoPrintSettings))
- {
- err = PMSessionDefaultPrintSettings((PMPrintSession)macPrintSession,
- (PMPrintSettings)m_macPrintSettings);
- }
- }
- ::UMAPrClose(&macPrintSession) ;
- #endif
-#else
- m_macPrintSettings = (THPrint) NewHandleClear( sizeof( TPrint ) );
- (**(THPrint)m_macPrintSettings).iPrVersion = 0; // something invalid
-
- (**(THPrint)m_macPrintSettings).prInfo.iHRes = 72;
- (**(THPrint)m_macPrintSettings).prInfo.iVRes = 72;
- Rect r1 = { 0, 0, 8*72 - 2 * 18, 11*72 - 2 * 36 };
- (**(THPrint)m_macPrintSettings).prInfo.rPage = r1;// must have its top left & (0,0)
-
- Rect r2 = { -18, -36, 8*72 - 18, 11*72 - 36 };
- (**(THPrint)m_macPrintSettings).rPaper = r2;
- (**(THPrint)m_macPrintSettings).prStl.iPageV = 11 * 120 ; // 11 inches in 120th of an inch
- (**(THPrint)m_macPrintSettings).prStl.iPageH = 8 * 120 ; // 8 inches in 120th of an inch
-#endif
+ m_nativePrintData = wxNativePrintData::Create() ;
#endif
+ m_bin = wxPRINTBIN_DEFAULT;
m_printOrientation = wxPORTRAIT;
m_printNoCopies = 1;
- m_printCollate = FALSE;
+ m_printCollate = false;
// New, 24/3/99
- m_printerName = "";
- m_colour = TRUE;
+ m_printerName = wxT("");
+ m_colour = true;
m_duplexMode = wxDUPLEX_SIMPLEX;
m_printQuality = wxPRINT_QUALITY_HIGH;
m_paperId = wxPAPER_A4;
m_printerTranslateX = 0;
m_printerTranslateY = 0;
m_printMode = wxPRINT_MODE_FILE;
+
+#ifdef wxUSE_STREAMS
+ m_outputstream = NULL;
+#endif
}
wxPrintData::wxPrintData(const wxPrintData& printData)
m_devMode = (void*) NULL;
m_devNames = (void*) NULL;
#elif defined( __WXMAC__ )
-#if TARGET_CARBON
- m_macPageFormat = kPMNoPageFormat;
- m_macPrintSettings = kPMNoPrintSettings;
-#else
- m_macPrintSettings = NULL;
-#endif
+ m_nativePrintData = wxNativePrintData::Create() ;
#endif
(*this) = printData;
}
if ( hDevNames )
GlobalFree(hDevNames);
#elif defined(__WXMAC__)
-#if TARGET_CARBON
- if (m_macPageFormat != kPMNoPageFormat)
- {
- #if PM_USE_SESSION_APIS
- (void)PMRelease(m_macPageFormat);
- #else
- (void)PMDisposePageFormat(m_macPageFormat);
- #endif
- m_macPageFormat = kPMNoPageFormat;
- }
-
- if (m_macPrintSettings != kPMNoPrintSettings)
- {
- #if PM_USE_SESSION_APIS
- (void)PMRelease(m_macPrintSettings);
- #else
- (void)PMDisposePrintSettings(m_macPrintSettings);
- #endif
- m_macPrintSettings = kPMNoPrintSettings;
- }
-
-#else
- wxASSERT( m_macPrintSettings );
- // we should perhaps delete
-#endif
+ delete m_nativePrintData ;
#endif
}
printerName.Length() + 1 +
portName.Length()+1 ) * sizeof(wxChar) );
LPDEVNAMES lpDev = (LPDEVNAMES)GlobalLock(hDev);
- lpDev->wDriverOffset = sizeof(WORD)*4;
- wxStrcpy((wxChar*)((char*)lpDev + lpDev->wDriverOffset ), driverName);
+ lpDev->wDriverOffset = sizeof(WORD) * 4 / sizeof(wxChar);
+ wxStrcpy((wxChar*)lpDev + lpDev->wDriverOffset, driverName);
lpDev->wDeviceOffset = (WORD)( lpDev->wDriverOffset +
- sizeof(wxChar) * ( driverName.Length() + 1 ) );
- wxStrcpy((wxChar*)((char*)lpDev + lpDev->wDeviceOffset ), printerName);
+ driverName.Length() + 1 );
+ wxStrcpy((wxChar*)lpDev + lpDev->wDeviceOffset, printerName);
lpDev->wOutputOffset = (WORD)( lpDev->wDeviceOffset +
- sizeof(wxChar) * ( printerName.Length() + 1 ) );
- wxStrcpy((wxChar*)((char*) lpDev + lpDev->wOutputOffset ), portName);
+ printerName.Length() + 1 );
+ wxStrcpy((wxChar*)lpDev + lpDev->wOutputOffset, portName);
lpDev->wDefault = 0;
pd.lStructSize = 66;
#else
memset(&pd, 0, sizeof(PRINTDLG));
+#ifdef __WXWINCE__
+ pd.cbStruct = sizeof(PRINTDLG);
+#else
pd.lStructSize = sizeof(PRINTDLG);
+#endif
#endif
pd.hwndOwner = (HWND)NULL;
//// Orientation
-#ifndef __WXWINE__
- devMode->dmOrientation = m_printOrientation;
-#endif
- devMode->dmFields = DM_ORIENTATION;
+ devMode->dmOrientation = (short)m_printOrientation;
//// Collation
-#ifndef __WIN16__
devMode->dmCollate = (m_printCollate ? DMCOLLATE_TRUE : DMCOLLATE_FALSE);
devMode->dmFields |= DM_COLLATE;
-#endif
//// Number of copies
- devMode->dmCopies = m_printNoCopies;
+ devMode->dmCopies = (short)m_printNoCopies;
devMode->dmFields |= DM_COPIES;
//// Printer name
devMode->dmFields |= DM_COLOR;
-#ifndef __WXWINE__
//// Paper size
if (m_paperId == wxPAPER_NONE)
{
// DEVMODE is in tenths of a milimeter
- devMode->dmPaperWidth = m_paperSize.x * 10;
- devMode->dmPaperLength = m_paperSize.y * 10;
+ devMode->dmPaperWidth = (short)(m_paperSize.x * 10);
+ devMode->dmPaperLength = (short)(m_paperSize.y * 10);
devMode->dmPaperSize = DMPAPER_USER;
devMode->dmFields |= DM_PAPERWIDTH;
devMode->dmFields |= DM_PAPERLENGTH;
wxPrintPaperType* paper = wxThePrintPaperDatabase->FindPaperType(m_paperId);
if (paper)
{
- devMode->dmPaperSize = paper->GetPlatformId();
+ devMode->dmPaperSize = (short)paper->GetPlatformId();
devMode->dmFields |= DM_PAPERSIZE;
}
}
}
-#endif
//// Duplex
- int duplex;
+ short duplex;
switch (m_duplexMode)
{
- case wxDUPLEX_HORIZONTAL: {
- duplex = DMDUP_HORIZONTAL; break;
- }
- case wxDUPLEX_VERTICAL: {
- duplex = DMDUP_VERTICAL; break;
- }
- default:
- case wxDUPLEX_SIMPLEX: {
- duplex = DMDUP_SIMPLEX; break;
- }
+ case wxDUPLEX_HORIZONTAL:
+ duplex = DMDUP_HORIZONTAL;
+ break;
+ case wxDUPLEX_VERTICAL:
+ duplex = DMDUP_VERTICAL;
+ break;
+ default:
+ // in fact case wxDUPLEX_SIMPLEX:
+ duplex = DMDUP_SIMPLEX;
+ break;
}
devMode->dmDuplex = duplex;
devMode->dmFields |= DM_DUPLEX;
//// Quality
- int quality;
+ short quality;
switch (m_printQuality)
{
- case wxPRINT_QUALITY_MEDIUM: {
- quality = DMRES_MEDIUM; break;
- }
- case wxPRINT_QUALITY_LOW: {
- quality = DMRES_LOW; break;
- }
- case wxPRINT_QUALITY_DRAFT: {
- quality = DMRES_DRAFT; break;
- }
- case wxPRINT_QUALITY_HIGH: {
- quality = DMRES_HIGH; break;
- }
- default: {
- quality = m_printQuality; break;
- }
+ case wxPRINT_QUALITY_MEDIUM:
+ quality = DMRES_MEDIUM;
+ break;
+ case wxPRINT_QUALITY_LOW:
+ quality = DMRES_LOW;
+ break;
+ case wxPRINT_QUALITY_DRAFT:
+ quality = DMRES_DRAFT;
+ break;
+ case wxPRINT_QUALITY_HIGH:
+ quality = DMRES_HIGH;
+ break;
+ default:
+ quality = (short)m_printQuality;
+ break;
}
devMode->dmPrintQuality = quality;
devMode->dmFields |= DM_PRINTQUALITY;
+ if ( m_bin != wxPRINTBIN_DEFAULT )
+ {
+ switch ( m_bin )
+ {
+ case wxPRINTBIN_ONLYONE: devMode->dmDefaultSource = DMBIN_ONLYONE; break;
+ case wxPRINTBIN_LOWER: devMode->dmDefaultSource = DMBIN_LOWER; break;
+ case wxPRINTBIN_MIDDLE: devMode->dmDefaultSource = DMBIN_MIDDLE; break;
+ case wxPRINTBIN_MANUAL: devMode->dmDefaultSource = DMBIN_MANUAL; break;
+ case wxPRINTBIN_ENVELOPE: devMode->dmDefaultSource = DMBIN_ENVELOPE; break;
+ case wxPRINTBIN_ENVMANUAL: devMode->dmDefaultSource = DMBIN_ENVMANUAL; break;
+ case wxPRINTBIN_AUTO: devMode->dmDefaultSource = DMBIN_AUTO; break;
+ case wxPRINTBIN_TRACTOR: devMode->dmDefaultSource = DMBIN_TRACTOR; break;
+ case wxPRINTBIN_SMALLFMT: devMode->dmDefaultSource = DMBIN_SMALLFMT; break;
+ case wxPRINTBIN_LARGEFMT: devMode->dmDefaultSource = DMBIN_LARGEFMT; break;
+ case wxPRINTBIN_LARGECAPACITY: devMode->dmDefaultSource = DMBIN_LARGECAPACITY; break;
+ case wxPRINTBIN_CASSETTE: devMode->dmDefaultSource = DMBIN_CASSETTE; break;
+ case wxPRINTBIN_FORMSOURCE: devMode->dmDefaultSource = DMBIN_FORMSOURCE; break;
+
+ default:
+ devMode->dmDefaultSource = (short)(DMBIN_USER + m_bin - wxPRINTBIN_USER);
+ break;
+ }
+
+ devMode->dmFields |= DM_DEFAULTSOURCE;
+ }
+
GlobalUnlock(hDevMode);
}
{
LPDEVMODE devMode = (LPDEVMODE)GlobalLock(hDevMode);
-#ifndef __WXWINE__
//// Orientation
if (devMode->dmFields & DM_ORIENTATION)
m_printOrientation = devMode->dmOrientation;
-#endif
//// Collation
-#ifndef __WIN16__
if (devMode->dmFields & DM_COLLATE)
{
if (devMode->dmCollate == DMCOLLATE_TRUE)
- m_printCollate = TRUE;
+ m_printCollate = true;
else
- m_printCollate = FALSE;
+ m_printCollate = false;
}
-#endif
//// Number of copies
m_printNoCopies = devMode->dmCopies;
}
+ if (devMode->dmFields & DM_DEFAULTSOURCE)
+ {
+ m_bin = (wxPrintBin)devMode->dmDefaultSource;
+ }
+
//// Printer name
if (devMode->dmDeviceName[0] != 0)
{
- // TODO: make this Unicode compatible
- char buf[32];
- int i = 0;
- while (devMode->dmDeviceName[i] != 0)
- {
- buf[i] = devMode->dmDeviceName[i];
- i ++;
- }
- buf[i] = 0;
-
- m_printerName = buf;
+ m_printerName = devMode->dmDeviceName;
}
//// Colour
if (devMode->dmFields & DM_COLOR)
{
if (devMode->dmColor == DMCOLOR_COLOR)
- m_colour = TRUE;
+ m_colour = true;
else
- m_colour = FALSE;
+ m_colour = false;
}
else
- m_colour = TRUE;
+ m_colour = true;
-#ifndef __WXWINE__
//// Paper size
// We don't know size of user defined paper and some buggy drivers
m_paperSize.y = 0;
m_paperId = wxPAPER_NONE;
}
-#endif
//// Duplex
#endif
#ifdef __WXMAC__
+
void wxPrintData::ConvertToNative()
{
-#if TARGET_CARBON
-#else
- (**(THPrint)m_macPrintSettings).prJob.iCopies = m_printNoCopies;
-#endif
+ m_nativePrintData->TransferFrom( this ) ;
}
void wxPrintData::ConvertFromNative()
{
-#if TARGET_CARBON
-#else
- m_printNoCopies = (**(THPrint)m_macPrintSettings).prJob.iCopies;
-#endif
+ m_nativePrintData->TransferTo( this ) ;
}
+
#endif
void wxPrintData::operator=(const wxPrintData& data)
{
#ifdef __WXMAC__
-#if TARGET_CARBON
-#else
- m_macPrintSettings = data.m_macPrintSettings;
- HandToHand( (Handle*) &m_macPrintSettings );
-#endif
+ m_nativePrintData->CopyFrom( data.m_nativePrintData ) ;
#endif
m_printNoCopies = data.m_printNoCopies;
m_printCollate = data.m_printCollate;
m_printQuality = data.m_printQuality;
m_paperId = data.m_paperId;
m_paperSize = data.m_paperSize;
+ m_bin = data.m_bin;
+#ifdef wxUSE_STREAMS
+ m_outputstream = data.m_outputstream;
+#endif
// PostScript-specific data
m_printerCommand = data.m_printerCommand;
((wxPrintData*)this)->ConvertToNative();
return (m_devMode != NULL) ;
#else
- return TRUE;
+ return true;
#endif
}
m_printMinPage = 0;
m_printMaxPage = 0;
m_printNoCopies = 1;
- m_printAllPages = FALSE;
- m_printCollate = FALSE;
- m_printToFile = FALSE;
- m_printSelection = FALSE;
- m_printEnableSelection = FALSE;
- m_printEnablePageNumbers = TRUE;
- m_printEnablePrintToFile = TRUE;
- m_printEnableHelp = FALSE;
- m_printSetupDialog = FALSE;
+ m_printAllPages = false;
+ m_printCollate = false;
+ m_printToFile = false;
+ m_printSelection = false;
+ m_printEnableSelection = false;
+ m_printEnablePageNumbers = true;
+ m_printEnablePrintToFile = true;
+ m_printEnableHelp = false;
+ m_printSetupDialog = false;
}
wxPrintDialogData::wxPrintDialogData(const wxPrintDialogData& dialogData)
#ifdef __WXMSW__
m_printDlgData = NULL;
#endif
- m_printFromPage = 0;
+ m_printFromPage = 1;
m_printToPage = 0;
- m_printMinPage = 0;
- m_printMaxPage = 0;
+ m_printMinPage = 1;
+ m_printMaxPage = 9999;
m_printNoCopies = 1;
- m_printAllPages = FALSE;
- m_printCollate = FALSE;
- m_printToFile = FALSE;
- m_printSelection = FALSE;
- m_printEnableSelection = FALSE;
- m_printEnablePageNumbers = TRUE;
- m_printEnablePrintToFile = TRUE;
- m_printEnableHelp = FALSE;
- m_printSetupDialog = FALSE;
+ m_printAllPages = false;
+ m_printCollate = false;
+ m_printToFile = false;
+ m_printSelection = false;
+ m_printEnableSelection = false;
+ m_printEnablePageNumbers = true;
+ m_printEnablePrintToFile = true;
+ m_printEnableHelp = false;
+ m_printSetupDialog = false;
m_printData = printData;
}
pd->Flags |= PD_NOSELECTION;
if ( !m_printEnablePageNumbers )
pd->Flags |= PD_NOPAGENUMS;
+ else if ( (!m_printAllPages) && (!m_printSelection) && (m_printFromPage != 0) && (m_printToPage != 0))
+ pd->Flags |= PD_PAGENUMS;
if ( m_printEnableHelp )
pd->Flags |= PD_SHOWHELP;
if ( m_printSetupDialog )
}
// Now convert the DEVMODE object, passed down from the PRINTDLG object,
- // into wxWindows form.
+ // into wxWidgets form.
m_printData.ConvertFromNative();
m_printFromPage = pd->nFromPage;
m_printMaxPage = pd->nMaxPage;
m_printNoCopies = pd->nCopies;
- m_printAllPages = ((pd->Flags & PD_ALLPAGES) == PD_ALLPAGES);
+ m_printAllPages = (((pd->Flags & PD_PAGENUMS) != PD_PAGENUMS) && ((pd->Flags & PD_SELECTION) != PD_SELECTION));
m_printSelection = ((pd->Flags & PD_SELECTION) == PD_SELECTION);
m_printCollate = ((pd->Flags & PD_COLLATE) == PD_COLLATE);
m_printToFile = ((pd->Flags & PD_PRINTTOFILE) == PD_PRINTTOFILE);
#endif // MSW
#ifdef __WXMAC__
+
void wxPrintDialogData::ConvertToNative()
{
-#if TARGET_CARBON
-#else
- (**(THPrint)m_printData.m_macPrintSettings).prJob.iFstPage = m_printFromPage;
- (**(THPrint)m_printData.m_macPrintSettings).prJob.iLstPage = m_printToPage;
m_printData.ConvertToNative();
-#endif
+ m_printData.m_nativePrintData->TransferFrom( this ) ;
}
void wxPrintDialogData::ConvertFromNative()
{
-#if TARGET_CARBON
-#else
m_printData.ConvertFromNative();
- m_printFromPage = (**(THPrint)m_printData.m_macPrintSettings).prJob.iFstPage;
- m_printToPage = (**(THPrint)m_printData.m_macPrintSettings).prJob.iLstPage;
-#endif
+ m_printData.m_nativePrintData->TransferTo( this ) ;
}
+
#endif
m_marginBottomRight = wxPoint(0, 0);
// Flags
- m_defaultMinMargins = FALSE;
- m_enableMargins = TRUE;
- m_enableOrientation = TRUE;
- m_enablePaper = TRUE;
- m_enablePrinter = TRUE;
- m_enableHelp = FALSE;
- m_getDefaultInfo = FALSE;
+ m_defaultMinMargins = false;
+ m_enableMargins = true;
+ m_enableOrientation = true;
+ m_enablePaper = true;
+ m_enablePrinter = true;
+ m_enableHelp = false;
+ m_getDefaultInfo = false;
}
wxPageSetupDialogData::wxPageSetupDialogData(const wxPageSetupDialogData& dialogData)
m_marginBottomRight = wxPoint(0, 0);
// Flags
- m_defaultMinMargins = FALSE;
- m_enableMargins = TRUE;
- m_enableOrientation = TRUE;
- m_enablePaper = TRUE;
- m_enablePrinter = TRUE;
- m_enableHelp = FALSE;
- m_getDefaultInfo = FALSE;
+ m_defaultMinMargins = false;
+ m_enableMargins = true;
+ m_enableOrientation = true;
+ m_enablePaper = true;
+ m_enablePrinter = true;
+ m_enableHelp = false;
+ m_getDefaultInfo = false;
m_printData = printData;
void wxPageSetupDialogData::ConvertToNative()
{
m_printData.ConvertToNative();
- // on mac the paper rect has a negative top left corner, because the page rect (printable area) is at 0,0
-#if TARGET_CARBON
-#else
- (**(THPrint)m_printData.m_macPrintSettings).rPaper.left = int( ((double) m_minMarginTopLeft.x)*mm2pt );
- (**(THPrint)m_printData.m_macPrintSettings).rPaper.top = int( ((double) m_minMarginTopLeft.y)*mm2pt );
-
- (**(THPrint)m_printData.m_macPrintSettings).rPaper.right = int( ((double) m_paperSize.x - m_minMarginTopLeft.x)*mm2pt );
- (**(THPrint)m_printData.m_macPrintSettings).rPaper.bottom = int( ((double) m_paperSize.y - m_minMarginTopLeft.y)*mm2pt );
-
- (**(THPrint)m_printData.m_macPrintSettings).prInfo.rPage.left = 0;
- (**(THPrint)m_printData.m_macPrintSettings).prInfo.rPage.top = 0;
- (**(THPrint)m_printData.m_macPrintSettings).prInfo.rPage.right = int( ((double) m_paperSize.x - m_minMarginTopLeft.x - m_minMarginBottomRight.x)*mm2pt );
- (**(THPrint)m_printData.m_macPrintSettings).prInfo.rPage.bottom = int( ((double) m_paperSize.y - m_minMarginTopLeft.y - m_minMarginBottomRight.y)*mm2pt );
-#endif
+ m_printData.m_nativePrintData->TransferFrom( this ) ;
}
void wxPageSetupDialogData::ConvertFromNative()
{
m_printData.ConvertFromNative ();
-
-#if TARGET_CARBON
-#else
- m_paperSize.x = ((double) (**(THPrint)m_printData.m_macPrintSettings).rPaper.right - (**(THPrint)m_printData.m_macPrintSettings).rPaper.left ) * pt2mm;
- m_paperSize.y = ((double) (**(THPrint)m_printData.m_macPrintSettings).rPaper.bottom - (**(THPrint)m_printData.m_macPrintSettings).rPaper.top ) * pt2mm;
-
- m_minMarginTopLeft.x = ((double) -(**(THPrint)m_printData.m_macPrintSettings).rPaper.left ) * pt2mm;
- m_minMarginTopLeft.y = ((double) -(**(THPrint)m_printData.m_macPrintSettings).rPaper.top ) * pt2mm;
-
- m_minMarginBottomRight.x = ((double) (**(THPrint)m_printData.m_macPrintSettings).rPaper.right - (**(THPrint)m_printData.m_macPrintSettings).prInfo.rPage.right ) * pt2mm;
- m_minMarginBottomRight.y = ((double)(**(THPrint)m_printData.m_macPrintSettings).rPaper.bottom - (**(THPrint)m_printData.m_macPrintSettings).prInfo.rPage.bottom ) * pt2mm;
-#endif
+ m_paperSize = m_printData.GetPaperSize() ;
+ CalculateIdFromPaperSize();
+ m_printData.m_nativePrintData->TransferTo( this ) ;
// adjust minimal values
- //TODO add custom fields in dialog for margins
if ( m_marginTopLeft.x < m_minMarginTopLeft.x )
m_marginTopLeft.x = m_minMarginTopLeft.x;