1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Common GDI data
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
21 #pragma implementation "cmndata.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
33 #include "wx/string.h"
38 #include "wx/gdicmn.h"
39 #include "wx/cmndata.h"
43 #if (defined(__WXMOTIF__) || defined(__WXGTK__) || defined(__WXPM__)) && wxUSE_POSTSCRIPT
44 #define wxCOMPATIBILITY_WITH_PRINTSETUPDATA 1
47 #if wxUSE_PRINTING_ARCHITECTURE
50 #if wxCOMPATIBILITY_WITH_PRINTSETUPDATA
51 #include "wx/generic/dcpsg.h"
53 #endif // wxUSE_PRINTING_ARCHITECTURE
57 #include "wx/msw/private.h"
59 #if !defined(__WIN32__)
69 #if defined(__WATCOMC__) || defined(__SC__) || defined(__SALFORDC__)
75 #if wxUSE_PRINTING_ARCHITECTURE
76 IMPLEMENT_DYNAMIC_CLASS(wxPrintData
, wxObject
)
77 IMPLEMENT_DYNAMIC_CLASS(wxPrintDialogData
, wxObject
)
78 IMPLEMENT_DYNAMIC_CLASS(wxPageSetupDialogData
, wxObject
)
79 #endif // wxUSE_PRINTING_ARCHITECTURE
81 IMPLEMENT_DYNAMIC_CLASS(wxFontData
, wxObject
)
82 IMPLEMENT_DYNAMIC_CLASS(wxColourData
, wxObject
)
85 #define mm2pt 2.83464566929
86 #define pt2mm 0.352777777778
89 // ============================================================================
91 // ============================================================================
93 // ----------------------------------------------------------------------------
95 // ----------------------------------------------------------------------------
97 wxColourData::wxColourData()
100 for (i
= 0; i
< 16; i
++)
101 custColours
[i
].Set(255, 255, 255);
104 dataColour
.Set(0,0,0);
107 wxColourData::wxColourData(const wxColourData
& data
)
112 wxColourData::~wxColourData()
116 void wxColourData::SetCustomColour(int i
, wxColour
& colour
)
121 custColours
[i
] = colour
;
124 wxColour
wxColourData::GetCustomColour(int i
)
127 return wxColour(0,0,0);
129 return custColours
[i
];
132 void wxColourData::operator=(const wxColourData
& data
)
135 for (i
= 0; i
< 16; i
++)
136 custColours
[i
] = data
.custColours
[i
];
138 dataColour
= (wxColour
&)data
.dataColour
;
139 chooseFull
= data
.chooseFull
;
142 // ----------------------------------------------------------------------------
144 // ----------------------------------------------------------------------------
146 wxFontData::wxFontData()
148 // Intialize colour to black.
149 fontColour
.Set(0, 0, 0);
153 enableEffects
= TRUE
;
157 m_encoding
= wxFONTENCODING_SYSTEM
;
160 wxFontData::~wxFontData()
164 #if wxUSE_PRINTING_ARCHITECTURE
165 // ----------------------------------------------------------------------------
167 // ----------------------------------------------------------------------------
169 wxPrintData::wxPrintData()
172 m_devMode
= (void*) NULL
;
173 m_devNames
= (void*) NULL
;
174 #elif defined( __WXMAC__ )
175 m_macPrintInfo
= (THPrint
) NewHandleClear( sizeof( TPrint
) ) ;
176 (**m_macPrintInfo
).iPrVersion
= 0; // something invalid
178 (**m_macPrintInfo
).prInfo
.iHRes
= 72;
179 (**m_macPrintInfo
).prInfo
.iVRes
= 72;
180 Rect r1
= { 0, 0, 8*72 - 2 * 18, 11*72 - 2 * 36 } ;
181 (**m_macPrintInfo
).prInfo
.rPage
= r1
;// must have its top left & (0,0)
183 Rect r2
= { -18, -36, 8*72 - 18, 11*72 - 36 } ;
184 (**m_macPrintInfo
).rPaper
= r2
;
185 (**m_macPrintInfo
).prStl
.iPageV
= 11 * 120 ; // 11 inches in 120th of an inch
186 (**m_macPrintInfo
).prStl
.iPageH
= 8 * 120 ; // 8 inches in 120th of an inch
189 m_macPrintInfo = (THPrint) NewHandleClear( sizeof( TPrint ) ) ;
190 ::PrintDefault( m_macPrintInfo ) ;
191 OSErr err = PrError() ;
193 wxASSERT( err == noErr ) ;
196 m_printOrientation
= wxPORTRAIT
;
198 m_printCollate
= FALSE
;
203 m_duplexMode
= wxDUPLEX_SIMPLEX
;
204 m_printQuality
= wxPRINT_QUALITY_HIGH
;
205 m_paperId
= wxPAPER_A4
;
206 m_paperSize
= wxSize(210, 297);
208 // PostScript-specific data
209 m_printerCommand
= "";
210 m_previewCommand
= "";
211 m_printerOptions
= "";
214 m_printerScaleX
= 1.0;
215 m_printerScaleY
= 1.0;
216 m_printerTranslateX
= 0;
217 m_printerTranslateY
= 0;
218 m_printMode
= wxPRINT_MODE_FILE
;
221 wxPrintData::wxPrintData(const wxPrintData
& printData
)
224 m_devMode
= (void*) NULL
;
225 m_devNames
= (void*) NULL
;
226 #elif defined( __WXMAC__ )
227 m_macPrintInfo
= NULL
;
229 (THPrint) NewHandleClear( sizeof( TPrint ) ) ;
231 m_macPrintInfo = (THPrint) NewHandleClear( sizeof( TPrint ) ) ;
232 ::PrintDefault( m_macPrintInfo ) ;
233 OSErr err = PrError() ;
235 wxASSERT( err == noErr ) ;
241 wxPrintData::~wxPrintData()
244 HGLOBAL hDevMode
= (HGLOBAL
)(DWORD
) m_devMode
;
246 GlobalFree(hDevMode
);
247 HGLOBAL hDevNames
= (HGLOBAL
)(DWORD
) m_devNames
;
249 GlobalFree(hDevNames
);
250 #elif defined(__WXMAC__)
251 wxASSERT( m_macPrintInfo
) ;
252 // ::DisposeHandle( (Handle) m_macPrintInfo ) ;
256 #if defined(__WXMSW__) // && defined(__WIN32__)
258 #if defined(__WXDEBUG__) && defined(__WIN32__)
259 static wxString
wxGetPrintDlgError()
261 DWORD err
= CommDlgExtendedError();
262 wxString msg
= wxT("Unknown");
265 case CDERR_FINDRESFAILURE
: msg
= wxT("CDERR_FINDRESFAILURE"); break;
266 case CDERR_INITIALIZATION
: msg
= wxT("CDERR_INITIALIZATION"); break;
267 case CDERR_LOADRESFAILURE
: msg
= wxT("CDERR_LOADRESFAILURE"); break;
268 case CDERR_LOADSTRFAILURE
: msg
= wxT("CDERR_LOADSTRFAILURE"); break;
269 case CDERR_LOCKRESFAILURE
: msg
= wxT("CDERR_LOCKRESFAILURE"); break;
270 case CDERR_MEMALLOCFAILURE
: msg
= wxT("CDERR_MEMALLOCFAILURE"); break;
271 case CDERR_MEMLOCKFAILURE
: msg
= wxT("CDERR_MEMLOCKFAILURE"); break;
272 case CDERR_NOHINSTANCE
: msg
= wxT("CDERR_NOHINSTANCE"); break;
273 case CDERR_NOHOOK
: msg
= wxT("CDERR_NOHOOK"); break;
274 case CDERR_NOTEMPLATE
: msg
= wxT("CDERR_NOTEMPLATE"); break;
275 case CDERR_STRUCTSIZE
: msg
= wxT("CDERR_STRUCTSIZE"); break;
276 case PDERR_RETDEFFAILURE
: msg
= wxT("PDERR_RETDEFFAILURE"); break;
277 case PDERR_PRINTERNOTFOUND
: msg
= wxT("PDERR_PRINTERNOTFOUND"); break;
278 case PDERR_PARSEFAILURE
: msg
= wxT("PDERR_PARSEFAILURE"); break;
279 case PDERR_NODEVICES
: msg
= wxT("PDERR_NODEVICES"); break;
280 case PDERR_NODEFAULTPRN
: msg
= wxT("PDERR_NODEFAULTPRN"); break;
281 case PDERR_LOADDRVFAILURE
: msg
= wxT("PDERR_LOADDRVFAILURE"); break;
282 case PDERR_INITFAILURE
: msg
= wxT("PDERR_INITFAILURE"); break;
283 case PDERR_GETDEVMODEFAIL
: msg
= wxT("PDERR_GETDEVMODEFAIL"); break;
284 case PDERR_DNDMMISMATCH
: msg
= wxT("PDERR_DNDMMISMATCH"); break;
285 case PDERR_DEFAULTDIFFERENT
: msg
= wxT("PDERR_DEFAULTDIFFERENT"); break;
286 case PDERR_CREATEICFAILURE
: msg
= wxT("PDERR_CREATEICFAILURE"); break;
293 static HGLOBAL
wxCreateDevNames(const wxString
& driverName
, const wxString
& printerName
, const wxString
& portName
)
296 // if (!driverName.IsEmpty() && !printerName.IsEmpty() && !portName.IsEmpty())
297 if (driverName
.IsEmpty() && printerName
.IsEmpty() && portName
.IsEmpty())
302 hDev
= GlobalAlloc(GPTR
, 4*sizeof(WORD
)+
303 driverName
.Length() + 1 +
304 printerName
.Length() + 1 +
305 portName
.Length()+1);
306 LPDEVNAMES lpDev
= (LPDEVNAMES
)GlobalLock(hDev
);
307 lpDev
->wDriverOffset
= sizeof(WORD
)*4;
308 wxStrcpy((wxChar
*)lpDev
+ lpDev
->wDriverOffset
, driverName
);
310 lpDev
->wDeviceOffset
= (WORD
)(lpDev
->wDriverOffset
+ driverName
.Length()+1);
311 wxStrcpy((wxChar
*)lpDev
+ lpDev
->wDeviceOffset
, printerName
);
313 lpDev
->wOutputOffset
= (WORD
)(lpDev
->wDeviceOffset
+ printerName
.Length()+1);
314 wxStrcpy((wxChar
*)lpDev
+ lpDev
->wOutputOffset
, portName
);
323 void wxPrintData::ConvertToNative()
325 HGLOBAL hDevMode
= (HGLOBAL
)(DWORD
) m_devMode
;
326 HGLOBAL hDevNames
= (HGLOBAL
)(DWORD
) m_devNames
;
329 // Use PRINTDLG as a way of creating a DEVMODE object
330 PRINTDLG
*pd
= new PRINTDLG
;
332 // GNU-WIN32 has the wrong size PRINTDLG - can't work out why.
335 pd
->lStructSize
= 66 ;
337 memset(pd
, 0, sizeof(PRINTDLG
));
338 pd
->lStructSize
= sizeof(PRINTDLG
);
341 pd
->hwndOwner
= (HWND
)NULL
;
342 pd
->hDevMode
= NULL
; // Will be created by PrintDlg
343 pd
->hDevNames
= NULL
; // Ditto
344 pd
->hInstance
= (HINSTANCE
) wxGetInstance();
346 pd
->Flags
= PD_RETURNDEFAULT
;
349 // Fill out the DEVMODE structure
350 // so we can use it as input in the 'real' PrintDlg
354 GlobalFree(pd
->hDevMode
);
356 GlobalFree(pd
->hDevNames
);
358 pd
->hDevNames
= NULL
;
360 #if defined(__WXDEBUG__) && defined(__WIN32__)
361 wxString
str(wxT("Printing error: "));
362 str
+= wxGetPrintDlgError();
368 hDevMode
= pd
->hDevMode
;
369 m_devMode
= (void*)(long) hDevMode
;
372 // We'll create a new DEVNAMEs structure below.
374 GlobalFree(pd
->hDevNames
);
375 pd
->hDevNames
= NULL
;
377 // hDevNames = pd->hDevNames;
378 // m_devNames = (void*)(long) hDevNames;
379 // pd->hDevnames = NULL;
388 LPDEVMODE devMode
= (LPDEVMODE
) GlobalLock(hDevMode
);
393 devMode
->dmOrientation
= m_printOrientation
;
395 devMode
->dmFields
= DM_ORIENTATION
;
400 devMode
->dmCollate
= (m_printCollate
? DMCOLLATE_TRUE
: DMCOLLATE_FALSE
);
401 devMode
->dmFields
|= DM_COLLATE
;
404 //// Number of copies
406 devMode
->dmCopies
= m_printNoCopies
;
407 devMode
->dmFields
|= DM_COPIES
;
411 if (m_printerName
!= wxT(""))
413 // TODO: make this Unicode compatible
414 int len
= wxMin(31, m_printerName
.Len());
416 for (i
= 0; i
< len
; i
++)
417 devMode
->dmDeviceName
[i
] = m_printerName
.GetChar(i
);
418 devMode
->dmDeviceName
[i
] = 0;
424 devMode
->dmColor
= DMCOLOR_COLOR
;
426 devMode
->dmColor
= DMCOLOR_MONOCHROME
;
428 devMode
->dmFields
|= DM_COLOR
;
433 if (m_paperId
== wxPAPER_NONE
)
435 devMode
->dmPaperWidth
= m_paperSize
.x
* 10;
436 devMode
->dmPaperLength
= m_paperSize
.y
* 10;
437 devMode
->dmFields
|= DM_PAPERWIDTH
;
438 devMode
->dmFields
|= DM_PAPERLENGTH
;
442 if (wxThePrintPaperDatabase
)
444 wxPrintPaperType
* paper
= wxThePrintPaperDatabase
->FindPaperType(m_paperId
);
447 devMode
->dmPaperSize
= paper
->GetPlatformId();
448 devMode
->dmFields
|= DM_PAPERSIZE
;
457 switch (m_duplexMode
)
459 case wxDUPLEX_HORIZONTAL
: {
460 duplex
= DMDUP_HORIZONTAL
; break;
462 case wxDUPLEX_VERTICAL
: {
463 duplex
= DMDUP_VERTICAL
; break;
466 case wxDUPLEX_SIMPLEX
: {
467 duplex
= DMDUP_SIMPLEX
; break;
470 devMode
->dmDuplex
= duplex
;
471 devMode
->dmFields
|= DM_DUPLEX
;
476 switch (m_printQuality
)
478 case wxPRINT_QUALITY_MEDIUM
: {
479 quality
= DMRES_MEDIUM
; break;
481 case wxPRINT_QUALITY_LOW
: {
482 quality
= DMRES_LOW
; break;
484 case wxPRINT_QUALITY_DRAFT
: {
485 quality
= DMRES_DRAFT
; break;
487 case wxPRINT_QUALITY_HIGH
: {
488 quality
= DMRES_HIGH
; break;
491 quality
= m_printQuality
; break;
494 devMode
->dmPrintQuality
= quality
;
495 devMode
->dmFields
|= DM_PRINTQUALITY
;
497 GlobalUnlock(hDevMode
);
502 GlobalFree(hDevNames
);
505 // TODO: I hope it's OK to pass some empty strings to DEVNAMES.
506 m_devNames
= (void*) (long) wxCreateDevNames("", m_printerName
, "");
509 void wxPrintData::ConvertFromNative()
511 HGLOBAL hDevMode
= (HGLOBAL
)(DWORD
) m_devMode
;
512 HGLOBAL hDevNames
= (HGLOBAL
)(DWORD
) m_devNames
;
519 LPDEVMODE devMode
= (LPDEVMODE
)GlobalLock(hDevMode
);
524 if (devMode
->dmFields
& DM_ORIENTATION
)
525 m_printOrientation
= devMode
->dmOrientation
;
531 if (devMode
->dmFields
& DM_COLLATE
)
533 if (devMode
->dmCollate
== DMCOLLATE_TRUE
)
534 m_printCollate
= TRUE
;
536 m_printCollate
= FALSE
;
540 //// Number of copies
542 if (devMode
->dmFields
& DM_COPIES
)
544 m_printNoCopies
= devMode
->dmCopies
;
549 if (devMode
->dmDeviceName
[0] != 0)
551 // TODO: make this Unicode compatible
554 while (devMode
->dmDeviceName
[i
] != 0)
556 buf
[i
] = devMode
->dmDeviceName
[i
];
566 if (devMode
->dmFields
& DM_COLOR
)
568 if (devMode
->dmColor
== DMCOLOR_COLOR
)
579 if (devMode
->dmFields
& DM_PAPERSIZE
)
581 if (wxThePrintPaperDatabase
)
583 wxPrintPaperType
* paper
= wxThePrintPaperDatabase
->FindPaperTypeByPlatformId(devMode
->dmPaperSize
);
586 m_paperId
= paper
->GetId();
587 m_paperSize
.x
= paper
->GetWidth() / 10 ;
588 m_paperSize
.y
= paper
->GetHeight() / 10 ;
592 // Shouldn't really get here
593 wxFAIL_MSG(wxT("Couldn't find paper size in paper database."));
595 m_paperId
= wxPAPER_NONE
;
602 // Shouldn't really get here
603 wxFAIL_MSG(wxT("Paper database wasn't initialized in wxPrintData::ConvertFromNative."));
605 m_paperId
= wxPAPER_NONE
;
610 else if ((devMode
->dmFields
& DM_PAPERWIDTH
) && (devMode
->dmFields
& DM_PAPERLENGTH
))
612 m_paperSize
.x
= devMode
->dmPaperWidth
/ 10;
613 m_paperSize
.y
= devMode
->dmPaperLength
/ 10;
614 m_paperId
= wxPAPER_NONE
;
618 // Shouldn't really get here
619 wxFAIL_MSG(wxT("Couldn't find paper size from DEVMODE."));
623 m_paperId
= wxPAPER_NONE
;
629 if (devMode
->dmFields
& DM_DUPLEX
)
631 switch (devMode
->dmDuplex
)
633 case DMDUP_HORIZONTAL
: {
634 m_duplexMode
= wxDUPLEX_HORIZONTAL
; break;
636 case DMDUP_VERTICAL
: {
637 m_duplexMode
= wxDUPLEX_VERTICAL
; break;
640 case DMDUP_SIMPLEX
: {
641 m_duplexMode
= wxDUPLEX_SIMPLEX
; break;
646 m_duplexMode
= wxDUPLEX_SIMPLEX
;
650 if (devMode
->dmFields
& DM_PRINTQUALITY
)
652 switch (devMode
->dmPrintQuality
)
655 m_printQuality
= wxPRINT_QUALITY_MEDIUM
; break;
658 m_printQuality
= wxPRINT_QUALITY_LOW
; break;
661 m_printQuality
= wxPRINT_QUALITY_DRAFT
; break;
664 m_printQuality
= wxPRINT_QUALITY_HIGH
; break;
668 // TODO: if the printer fills in the resolution in DPI, how
669 // will the application know if it's high, low, draft etc.??
670 // wxFAIL_MSG("Warning: DM_PRINTQUALITY was not one of the standard values.");
671 m_printQuality
= devMode
->dmPrintQuality
; break;
677 m_printQuality
= wxPRINT_QUALITY_HIGH
;
679 GlobalUnlock(hDevMode
);
684 LPDEVNAMES lpDevNames
= (LPDEVNAMES
)GlobalLock(hDevNames
);
687 // TODO: Unicode-ification
690 // port is obsolete in WIN32
691 // m_printData.SetPortName((LPSTR)lpDevNames + lpDevNames->wDriverOffset);
693 // Get the printer name
694 wxString printerName
= (LPSTR
)lpDevNames
+ lpDevNames
->wDeviceOffset
;
696 // Not sure if we should check for this mismatch
697 // wxASSERT_MSG( (m_printerName == "" || (devName == m_printerName)), "Printer name obtained from DEVMODE and DEVNAMES were different!");
699 if (printerName
!= wxT(""))
700 m_printerName
= printerName
;
702 GlobalUnlock(hDevNames
);
710 void wxPrintData::ConvertToNative()
712 (**m_macPrintInfo
).prJob
.iCopies
= m_printNoCopies
;
715 void wxPrintData::ConvertFromNative()
717 m_printNoCopies
= (**m_macPrintInfo
).prJob
.iCopies
;
721 void wxPrintData::operator=(const wxPrintData
& data
)
724 m_macPrintInfo
= data
.m_macPrintInfo
;
725 HandToHand( (Handle
*) &m_macPrintInfo
) ;
727 m_printNoCopies
= data
.m_printNoCopies
;
728 m_printCollate
= data
.m_printCollate
;
729 m_printOrientation
= data
.m_printOrientation
;
730 m_printerName
= data
.m_printerName
;
731 m_colour
= data
.m_colour
;
732 m_duplexMode
= data
.m_duplexMode
;
733 m_printQuality
= data
.m_printQuality
;
734 m_paperId
= data
.m_paperId
;
735 m_paperSize
= data
.m_paperSize
;
737 // PostScript-specific data
738 m_printerCommand
= data
.m_printerCommand
;
739 m_previewCommand
= data
.m_previewCommand
;
740 m_printerOptions
= data
.m_printerOptions
;
741 m_filename
= data
.m_filename
;
742 m_afmPath
= data
.m_afmPath
;
743 m_printerScaleX
= data
.m_printerScaleX
;
744 m_printerScaleY
= data
.m_printerScaleY
;
745 m_printerTranslateX
= data
.m_printerTranslateX
;
746 m_printerTranslateY
= data
.m_printerTranslateY
;
747 m_printMode
= data
.m_printMode
;
751 #if wxCOMPATIBILITY_WITH_PRINTSETUPDATA
752 void wxPrintData::operator=(const wxPrintSetupData
& setupData
)
754 SetPrinterCommand(setupData
.GetPrinterCommand());
755 SetPreviewCommand(setupData
.GetPrintPreviewCommand());
756 SetPrinterOptions(setupData
.GetPrinterOptions());
759 setupData
.GetPrinterTranslation(& xt
, & yt
);
760 SetPrinterTranslation(xt
, yt
);
763 setupData
.GetPrinterScaling(& xs
, & ys
);
764 SetPrinterScaling(xs
, ys
);
766 SetOrientation(setupData
.GetPrinterOrientation());
767 SetPrintMode((wxPrintMode
) setupData
.GetPrinterMode());
768 SetFontMetricPath(setupData
.GetAFMPath());
769 if (setupData
.GetPaperName() != "")
770 SetPaperId(wxThePrintPaperDatabase
->ConvertNameToId(setupData
.GetPaperName()));
771 SetColour(setupData
.GetColour());
772 SetFilename(setupData
.GetPrinterFile());
774 #endif // wxCOMPATIBILITY_WITH_PRINTSETUPDATA
777 // ----------------------------------------------------------------------------
779 // ----------------------------------------------------------------------------
781 wxPrintDialogData::wxPrintDialogData()
784 m_printDlgData
= NULL
;
791 m_printAllPages
= FALSE
;
792 m_printCollate
= FALSE
;
793 m_printToFile
= FALSE
;
794 m_printSelection
= FALSE
;
795 m_printEnableSelection
= FALSE
;
796 m_printEnablePageNumbers
= TRUE
;
797 m_printEnablePrintToFile
= TRUE
;
798 m_printEnableHelp
= FALSE
;
799 m_printSetupDialog
= FALSE
;
802 wxPrintDialogData::wxPrintDialogData(const wxPrintDialogData
& dialogData
)
805 m_printDlgData
= NULL
;
807 (*this) = dialogData
;
810 wxPrintDialogData::wxPrintDialogData(const wxPrintData
& printData
)
813 m_printDlgData
= NULL
;
820 m_printAllPages
= FALSE
;
821 m_printCollate
= FALSE
;
822 m_printToFile
= FALSE
;
823 m_printSelection
= FALSE
;
824 m_printEnableSelection
= FALSE
;
825 m_printEnablePageNumbers
= TRUE
;
826 m_printEnablePrintToFile
= TRUE
;
827 m_printEnableHelp
= FALSE
;
828 m_printSetupDialog
= FALSE
;
830 m_printData
= printData
;
833 wxPrintDialogData::~wxPrintDialogData()
836 PRINTDLG
*pd
= (PRINTDLG
*) m_printDlgData
;
837 if ( pd
&& pd
->hDevMode
)
838 GlobalFree(pd
->hDevMode
);
845 void wxPrintDialogData::ConvertToNative()
847 m_printData
.ConvertToNative();
849 PRINTDLG
*pd
= (PRINTDLG
*) m_printDlgData
;
854 m_printDlgData
= (void*) pd
;
856 // GNU-WIN32 has the wrong size PRINTDLG - can't work out why.
858 pd
->lStructSize
= 66 ;
860 pd
->lStructSize
= sizeof(PRINTDLG
);
862 pd
->hwndOwner
= (HWND
)NULL
;
863 pd
->hDevMode
= NULL
; // Will be created by PrintDlg
864 pd
->hDevNames
= NULL
; // Ditto
866 pd
->Flags
= PD_RETURNDEFAULT
;
870 // Pass the devmode data to the PRINTDLG structure, since it'll
871 // be needed when PrintDlg is called.
874 GlobalFree(pd
->hDevMode
);
877 // Pass the devnames data to the PRINTDLG structure, since it'll
878 // be needed when PrintDlg is called.
881 GlobalFree(pd
->hDevNames
);
884 pd
->hDevMode
= (HGLOBAL
)(DWORD
) m_printData
.GetNativeData();
886 m_printData
.SetNativeData((void*) NULL
);
888 wxASSERT_MSG( (pd
->hDevMode
), wxT("hDevMode must be non-NULL in ConvertToNative!"));
890 pd
->hDevNames
= (HGLOBAL
)(DWORD
) m_printData
.GetNativeDataDevNames();
892 m_printData
.SetNativeDataDevNames((void*) NULL
);
894 pd
->hDC
= (HDC
) NULL
;
895 pd
->nFromPage
= (UINT
)m_printFromPage
;
896 pd
->nToPage
= (UINT
)m_printToPage
;
897 pd
->nMinPage
= (UINT
)m_printMinPage
;
898 pd
->nMaxPage
= (UINT
)m_printMaxPage
;
899 pd
->nCopies
= (UINT
)m_printNoCopies
;
901 pd
->Flags
= PD_RETURNDC
;
904 pd
->lStructSize
= 66 ;
906 pd
->lStructSize
= sizeof( PRINTDLG
);
909 pd
->hwndOwner
=(HWND
)NULL
;
910 // pd->hDevNames=(HANDLE)NULL;
911 pd
->hInstance
=(HINSTANCE
)NULL
;
912 pd
->lCustData
= (LPARAM
) NULL
;
913 pd
->lpfnPrintHook
= NULL
;
914 pd
->lpfnSetupHook
= NULL
;
915 pd
->lpPrintTemplateName
= NULL
;
916 pd
->lpSetupTemplateName
= NULL
;
917 pd
->hPrintTemplate
= (HGLOBAL
) NULL
;
918 pd
->hSetupTemplate
= (HGLOBAL
) NULL
;
920 if ( m_printAllPages
)
921 pd
->Flags
|= PD_ALLPAGES
;
922 if ( m_printAllPages
)
923 pd
->Flags
|= PD_SELECTION
;
924 if ( m_printCollate
)
925 pd
->Flags
|= PD_COLLATE
;
927 pd
->Flags
|= PD_PRINTTOFILE
;
928 if ( !m_printEnablePrintToFile
)
929 pd
->Flags
|= PD_DISABLEPRINTTOFILE
;
930 if ( !m_printEnableSelection
)
931 pd
->Flags
|= PD_NOSELECTION
;
932 if ( !m_printEnablePageNumbers
)
933 pd
->Flags
|= PD_NOPAGENUMS
;
934 if ( m_printEnableHelp
)
935 pd
->Flags
|= PD_SHOWHELP
;
936 if ( m_printSetupDialog
)
937 pd
->Flags
|= PD_PRINTSETUP
;
940 void wxPrintDialogData::ConvertFromNative()
942 PRINTDLG
*pd
= (PRINTDLG
*) m_printDlgData
;
946 // Pass the devmode data back to the wxPrintData structure where it really belongs.
949 if (m_printData
.GetNativeData())
951 // Make sure we don't leak memory
952 GlobalFree((HGLOBAL
)(DWORD
) m_printData
.GetNativeData());
954 m_printData
.SetNativeData((void*)(long) pd
->hDevMode
);
958 // Pass the devnames data back to the wxPrintData structure where it really belongs.
961 if (m_printData
.GetNativeDataDevNames())
963 // Make sure we don't leak memory
964 GlobalFree((HGLOBAL
)(DWORD
) m_printData
.GetNativeDataDevNames());
966 m_printData
.SetNativeDataDevNames((void*)(long) pd
->hDevNames
);
967 pd
->hDevNames
= NULL
;
970 // Now convert the DEVMODE object, passed down from the PRINTDLG object,
971 // into wxWindows form.
972 m_printData
.ConvertFromNative();
974 m_printFromPage
= pd
->nFromPage
;
975 m_printToPage
= pd
->nToPage
;
976 m_printMinPage
= pd
->nMinPage
;
977 m_printMaxPage
= pd
->nMaxPage
;
978 m_printNoCopies
= pd
->nCopies
;
980 m_printAllPages
= ((pd
->Flags
& PD_ALLPAGES
) == PD_ALLPAGES
);
981 m_printSelection
= ((pd
->Flags
& PD_SELECTION
) == PD_SELECTION
);
982 m_printCollate
= ((pd
->Flags
& PD_COLLATE
) == PD_COLLATE
);
983 m_printToFile
= ((pd
->Flags
& PD_PRINTTOFILE
) == PD_PRINTTOFILE
);
984 m_printEnablePrintToFile
= ((pd
->Flags
& PD_DISABLEPRINTTOFILE
) != PD_DISABLEPRINTTOFILE
);
985 m_printEnableSelection
= ((pd
->Flags
& PD_NOSELECTION
) != PD_NOSELECTION
);
986 m_printEnablePageNumbers
= ((pd
->Flags
& PD_NOPAGENUMS
) != PD_NOPAGENUMS
);
987 m_printEnableHelp
= ((pd
->Flags
& PD_SHOWHELP
) == PD_SHOWHELP
);
988 m_printSetupDialog
= ((pd
->Flags
& PD_PRINTSETUP
) == PD_PRINTSETUP
);
990 /* port is obsolete in WIN32
994 LPDEVNAMES lpDevNames = (LPDEVNAMES)GlobalLock(pd->hDevNames);
996 m_printData.SetPortName((LPSTR)lpDevNames + lpDevNames->wDriverOffset);
997 wxString devName = (LPSTR)lpDevNames + lpDevNames->wDeviceOffset;
998 GlobalUnlock(pd->hDevNames);
1000 // wxASSERT_MSG( (m_printerName == "" || (devName == m_printerName)), "Printer name obtained from DEVMODE and DEVNAMES were different!");
1006 void wxPrintDialogData::SetOwnerWindow(wxWindow
* win
)
1008 if ( m_printDlgData
== NULL
)
1011 if ( m_printDlgData
!= NULL
&& win
!= NULL
)
1013 PRINTDLG
*pd
= (PRINTDLG
*) m_printDlgData
;
1014 pd
->hwndOwner
=(HWND
) win
->GetHWND();
1020 void wxPrintDialogData::ConvertToNative()
1022 (**m_printData
.m_macPrintInfo
).prJob
.iFstPage
= m_printFromPage
;
1023 (**m_printData
.m_macPrintInfo
).prJob
.iLstPage
= m_printToPage
;
1024 m_printData
.ConvertToNative() ;
1027 void wxPrintDialogData::ConvertFromNative()
1029 m_printData
.ConvertFromNative() ;
1030 m_printFromPage
= (**m_printData
.m_macPrintInfo
).prJob
.iFstPage
;
1031 m_printToPage
= (**m_printData
.m_macPrintInfo
).prJob
.iLstPage
;
1036 void wxPrintDialogData::operator=(const wxPrintDialogData
& data
)
1038 m_printFromPage
= data
.m_printFromPage
;
1039 m_printToPage
= data
.m_printToPage
;
1040 m_printMinPage
= data
.m_printMinPage
;
1041 m_printMaxPage
= data
.m_printMaxPage
;
1042 m_printNoCopies
= data
.m_printNoCopies
;
1043 m_printAllPages
= data
.m_printAllPages
;
1044 m_printCollate
= data
.m_printCollate
;
1045 m_printToFile
= data
.m_printToFile
;
1046 m_printSelection
= data
.m_printSelection
;
1047 m_printEnableSelection
= data
.m_printEnableSelection
;
1048 m_printEnablePageNumbers
= data
.m_printEnablePageNumbers
;
1049 m_printEnableHelp
= data
.m_printEnableHelp
;
1050 m_printEnablePrintToFile
= data
.m_printEnablePrintToFile
;
1051 m_printSetupDialog
= data
.m_printSetupDialog
;
1053 m_printData
= data
.m_printData
;
1056 void wxPrintDialogData::operator=(const wxPrintData
& data
)
1061 // ----------------------------------------------------------------------------
1062 // wxPageSetupDialogData
1063 // ----------------------------------------------------------------------------
1065 wxPageSetupDialogData::wxPageSetupDialogData()
1067 #if defined(__WIN95__)
1068 m_pageSetupData
= NULL
;
1070 m_paperSize
= wxSize(0, 0);
1072 CalculatePaperSizeFromId();
1074 m_minMarginTopLeft
= wxPoint(0, 0);
1075 m_minMarginBottomRight
= wxPoint(0, 0);
1076 m_marginTopLeft
= wxPoint(0, 0);
1077 m_marginBottomRight
= wxPoint(0, 0);
1080 m_defaultMinMargins
= FALSE
;
1081 m_enableMargins
= TRUE
;
1082 m_enableOrientation
= TRUE
;
1083 m_enablePaper
= TRUE
;
1084 m_enablePrinter
= TRUE
;
1085 m_enableHelp
= FALSE
;
1086 m_getDefaultInfo
= FALSE
;
1089 wxPageSetupDialogData::wxPageSetupDialogData(const wxPageSetupDialogData
& dialogData
)
1091 #if defined(__WIN95__)
1092 m_pageSetupData
= NULL
;
1094 (*this) = dialogData
;
1097 wxPageSetupDialogData::wxPageSetupDialogData(const wxPrintData
& printData
)
1099 #if defined(__WIN95__)
1100 m_pageSetupData
= NULL
;
1102 m_paperSize
= wxSize(0, 0);
1103 m_minMarginTopLeft
= wxPoint(0, 0);
1104 m_minMarginBottomRight
= wxPoint(0, 0);
1105 m_marginTopLeft
= wxPoint(0, 0);
1106 m_marginBottomRight
= wxPoint(0, 0);
1109 m_defaultMinMargins
= FALSE
;
1110 m_enableMargins
= TRUE
;
1111 m_enableOrientation
= TRUE
;
1112 m_enablePaper
= TRUE
;
1113 m_enablePrinter
= TRUE
;
1114 m_enableHelp
= FALSE
;
1115 m_getDefaultInfo
= FALSE
;
1117 m_printData
= printData
;
1119 // The wxPrintData paper size overrides these values, unless the size cannot
1121 CalculatePaperSizeFromId();
1124 wxPageSetupDialogData::~wxPageSetupDialogData()
1126 #if defined(__WIN95__) && defined(__WXMSW__)
1127 PAGESETUPDLG
*pd
= (PAGESETUPDLG
*)m_pageSetupData
;
1128 if ( pd
&& pd
->hDevMode
)
1129 GlobalFree(pd
->hDevMode
);
1130 if ( pd
&& pd
->hDevNames
)
1131 GlobalFree(pd
->hDevNames
);
1137 void wxPageSetupDialogData::operator=(const wxPageSetupDialogData
& data
)
1139 m_paperSize
= data
.m_paperSize
;
1140 m_minMarginTopLeft
= data
.m_minMarginTopLeft
;
1141 m_minMarginBottomRight
= data
.m_minMarginBottomRight
;
1142 m_marginTopLeft
= data
.m_marginTopLeft
;
1143 m_marginBottomRight
= data
.m_marginBottomRight
;
1144 m_defaultMinMargins
= data
.m_defaultMinMargins
;
1145 m_enableMargins
= data
.m_enableMargins
;
1146 m_enableOrientation
= data
.m_enableOrientation
;
1147 m_enablePaper
= data
.m_enablePaper
;
1148 m_enablePrinter
= data
.m_enablePrinter
;
1149 m_getDefaultInfo
= data
.m_getDefaultInfo
;;
1150 m_enableHelp
= data
.m_enableHelp
;
1152 m_printData
= data
.m_printData
;
1155 void wxPageSetupDialogData::operator=(const wxPrintData
& data
)
1160 #if defined(__WIN95__)
1161 void wxPageSetupDialogData::ConvertToNative()
1163 m_printData
.ConvertToNative();
1165 PAGESETUPDLG
*pd
= (PAGESETUPDLG
*) m_pageSetupData
;
1167 if ( m_pageSetupData
== NULL
)
1169 pd
= new PAGESETUPDLG
;
1170 pd
->hDevMode
= NULL
;
1171 pd
->hDevNames
= NULL
;
1172 m_pageSetupData
= (void *)pd
;
1175 // Pass the devmode data (created in m_printData.ConvertToNative)
1176 // to the PRINTDLG structure, since it'll
1177 // be needed when PrintDlg is called.
1181 GlobalFree(pd
->hDevMode
);
1182 pd
->hDevMode
= NULL
;
1185 pd
->hDevMode
= (HGLOBAL
) m_printData
.GetNativeData();
1187 m_printData
.SetNativeData((void*) NULL
);
1189 wxASSERT_MSG( (pd
->hDevMode
), wxT("hDevMode must be non-NULL in ConvertToNative!"));
1191 // Pass the devnames data (created in m_printData.ConvertToNative)
1192 // to the PRINTDLG structure, since it'll
1193 // be needed when PrintDlg is called.
1197 GlobalFree(pd
->hDevNames
);
1198 pd
->hDevNames
= NULL
;
1201 pd
->hDevNames
= (HGLOBAL
) m_printData
.GetNativeDataDevNames();
1203 m_printData
.SetNativeDataDevNames((void*) NULL
);
1205 // pd->hDevMode = GlobalAlloc(GMEM_MOVEABLE, sizeof(DEVMODE));
1207 pd
->Flags
= PSD_MARGINS
|PSD_MINMARGINS
;
1209 if ( m_defaultMinMargins
)
1210 pd
->Flags
|= PSD_DEFAULTMINMARGINS
;
1211 if ( !m_enableMargins
)
1212 pd
->Flags
|= PSD_DISABLEMARGINS
;
1213 if ( !m_enableOrientation
)
1214 pd
->Flags
|= PSD_DISABLEORIENTATION
;
1215 if ( !m_enablePaper
)
1216 pd
->Flags
|= PSD_DISABLEPAPER
;
1217 if ( !m_enablePrinter
)
1218 pd
->Flags
|= PSD_DISABLEPRINTER
;
1219 if ( m_getDefaultInfo
)
1220 pd
->Flags
|= PSD_RETURNDEFAULT
;
1222 pd
->Flags
|= PSD_SHOWHELP
;
1224 // We want the units to be in hundredths of a millimetre
1225 pd
->Flags
|= PSD_INHUNDREDTHSOFMILLIMETERS
;
1227 pd
->lStructSize
= sizeof( PAGESETUPDLG
);
1228 pd
->hwndOwner
=(HWND
)NULL
;
1229 // pd->hDevNames=(HWND)NULL;
1230 pd
->hInstance
=(HINSTANCE
)NULL
;
1232 pd
->ptPaperSize
.x
= m_paperSize
.x
* 100;
1233 pd
->ptPaperSize
.y
= m_paperSize
.y
* 100;
1235 pd
->rtMinMargin
.left
= m_minMarginTopLeft
.x
* 100;
1236 pd
->rtMinMargin
.top
= m_minMarginTopLeft
.y
* 100;
1237 pd
->rtMinMargin
.right
= m_minMarginBottomRight
.x
* 100;
1238 pd
->rtMinMargin
.bottom
= m_minMarginBottomRight
.y
* 100;
1240 pd
->rtMargin
.left
= m_marginTopLeft
.x
* 100;
1241 pd
->rtMargin
.top
= m_marginTopLeft
.y
* 100;
1242 pd
->rtMargin
.right
= m_marginBottomRight
.x
* 100;
1243 pd
->rtMargin
.bottom
= m_marginBottomRight
.y
* 100;
1246 pd
->lpfnPageSetupHook
= NULL
;
1247 pd
->lpfnPagePaintHook
= NULL
;
1248 pd
->hPageSetupTemplate
= NULL
;
1249 pd
->lpPageSetupTemplateName
= NULL
;
1254 DEVMODE *devMode = (DEVMODE*) GlobalLock(pd->hDevMode);
1255 memset(devMode, 0, sizeof(DEVMODE));
1256 devMode->dmSize = sizeof(DEVMODE);
1257 devMode->dmOrientation = m_orientation;
1258 devMode->dmFields = DM_ORIENTATION;
1259 GlobalUnlock(pd->hDevMode);
1264 void wxPageSetupDialogData::ConvertFromNative()
1266 PAGESETUPDLG
*pd
= (PAGESETUPDLG
*) m_pageSetupData
;
1270 // Pass the devmode data back to the wxPrintData structure where it really belongs.
1273 if (m_printData
.GetNativeData())
1275 // Make sure we don't leak memory
1276 GlobalFree((HGLOBAL
) m_printData
.GetNativeData());
1278 m_printData
.SetNativeData((void*) pd
->hDevMode
);
1279 pd
->hDevMode
= NULL
;
1282 m_printData
.ConvertFromNative();
1284 // Pass the devnames data back to the wxPrintData structure where it really belongs.
1287 if (m_printData
.GetNativeDataDevNames())
1289 // Make sure we don't leak memory
1290 GlobalFree((HGLOBAL
) m_printData
.GetNativeDataDevNames());
1292 m_printData
.SetNativeDataDevNames((void*) pd
->hDevNames
);
1293 pd
->hDevNames
= NULL
;
1296 m_printData
.ConvertFromNative();
1298 pd
->Flags
= PSD_MARGINS
|PSD_MINMARGINS
;
1300 m_defaultMinMargins
= ((pd
->Flags
& PSD_DEFAULTMINMARGINS
) == PSD_DEFAULTMINMARGINS
);
1301 m_enableMargins
= ((pd
->Flags
& PSD_DISABLEMARGINS
) != PSD_DISABLEMARGINS
);
1302 m_enableOrientation
= ((pd
->Flags
& PSD_DISABLEORIENTATION
) != PSD_DISABLEORIENTATION
);
1303 m_enablePaper
= ((pd
->Flags
& PSD_DISABLEPAPER
) != PSD_DISABLEPAPER
);
1304 m_enablePrinter
= ((pd
->Flags
& PSD_DISABLEPRINTER
) != PSD_DISABLEPRINTER
);
1305 m_getDefaultInfo
= ((pd
->Flags
& PSD_RETURNDEFAULT
) == PSD_RETURNDEFAULT
);
1306 m_enableHelp
= ((pd
->Flags
& PSD_SHOWHELP
) == PSD_SHOWHELP
);
1308 m_paperSize
.x
= pd
->ptPaperSize
.x
/ 100;
1309 m_paperSize
.y
= pd
->ptPaperSize
.y
/ 100;
1311 m_minMarginTopLeft
.x
= pd
->rtMinMargin
.left
/ 100;
1312 m_minMarginTopLeft
.y
= pd
->rtMinMargin
.top
/ 100;
1313 m_minMarginBottomRight
.x
= pd
->rtMinMargin
.right
/ 100;
1314 m_minMarginBottomRight
.y
= pd
->rtMinMargin
.bottom
/ 100;
1316 m_marginTopLeft
.x
= pd
->rtMargin
.left
/ 100 ;
1317 m_marginTopLeft
.y
= pd
->rtMargin
.top
/ 100 ;
1318 m_marginBottomRight
.x
= pd
->rtMargin
.right
/ 100 ;
1319 m_marginBottomRight
.y
= pd
->rtMargin
.bottom
/ 100 ;
1322 void wxPageSetupDialogData::SetOwnerWindow(wxWindow
* win
)
1324 if ( m_pageSetupData
== NULL
)
1327 if ( m_pageSetupData
!= NULL
&& win
!= NULL
)
1329 PAGESETUPDLG
*pd
= (PAGESETUPDLG
*) m_pageSetupData
;
1330 pd
->hwndOwner
=(HWND
) win
->GetHWND();
1336 void wxPageSetupDialogData::ConvertToNative()
1338 m_printData
.ConvertToNative() ;
1339 // on mac the paper rect has a negative top left corner, because the page rect (printable area) is at 0,0
1340 (**m_printData
.m_macPrintInfo
).rPaper
.left
= int( ((double) m_minMarginTopLeft
.x
)*mm2pt
) ;
1341 (**m_printData
.m_macPrintInfo
).rPaper
.top
= int( ((double) m_minMarginTopLeft
.y
)*mm2pt
) ;
1343 (**m_printData
.m_macPrintInfo
).rPaper
.right
= int( ((double) m_paperSize
.x
- m_minMarginTopLeft
.x
)*mm2pt
) ;
1344 (**m_printData
.m_macPrintInfo
).rPaper
.bottom
= int( ((double) m_paperSize
.y
- m_minMarginTopLeft
.y
)*mm2pt
) ;
1346 (**m_printData
.m_macPrintInfo
).prInfo
.rPage
.left
= 0 ;
1347 (**m_printData
.m_macPrintInfo
).prInfo
.rPage
.top
= 0 ;
1348 (**m_printData
.m_macPrintInfo
).prInfo
.rPage
.right
= int( ((double) m_paperSize
.x
- m_minMarginTopLeft
.x
- m_minMarginBottomRight
.x
)*mm2pt
) ;
1349 (**m_printData
.m_macPrintInfo
).prInfo
.rPage
.bottom
= int( ((double) m_paperSize
.y
- m_minMarginTopLeft
.y
- m_minMarginBottomRight
.y
)*mm2pt
) ;
1352 void wxPageSetupDialogData::ConvertFromNative()
1354 m_printData
.ConvertFromNative () ;
1356 m_paperSize
.x
= ((double) (**m_printData
.m_macPrintInfo
).rPaper
.right
- (**m_printData
.m_macPrintInfo
).rPaper
.left
) * pt2mm
;
1357 m_paperSize
.y
= ((double) (**m_printData
.m_macPrintInfo
).rPaper
.bottom
- (**m_printData
.m_macPrintInfo
).rPaper
.top
) * pt2mm
;
1359 m_minMarginTopLeft
.x
= ((double) -(**m_printData
.m_macPrintInfo
).rPaper
.left
) * pt2mm
;
1360 m_minMarginTopLeft
.y
= ((double) -(**m_printData
.m_macPrintInfo
).rPaper
.top
) * pt2mm
;
1362 m_minMarginBottomRight
.x
= ((double) (**m_printData
.m_macPrintInfo
).rPaper
.right
- (**m_printData
.m_macPrintInfo
).prInfo
.rPage
.right
) * pt2mm
;
1363 m_minMarginBottomRight
.y
= ((double)(**m_printData
.m_macPrintInfo
).rPaper
.bottom
- (**m_printData
.m_macPrintInfo
).prInfo
.rPage
.bottom
) * pt2mm
;
1365 // adjust minimal values
1366 //TODO add custom fields in dialog for margins
1368 if ( m_marginTopLeft
.x
< m_minMarginTopLeft
.x
)
1369 m_marginTopLeft
.x
= m_minMarginTopLeft
.x
;
1371 if ( m_marginBottomRight
.x
< m_minMarginBottomRight
.x
)
1372 m_marginBottomRight
.x
= m_minMarginBottomRight
.x
;
1374 if ( m_marginTopLeft
.y
< m_minMarginTopLeft
.y
)
1375 m_marginTopLeft
.y
= m_minMarginTopLeft
.y
;
1377 if ( m_marginBottomRight
.y
< m_minMarginBottomRight
.y
)
1378 m_marginBottomRight
.y
= m_minMarginBottomRight
.y
;
1383 // If a corresponding paper type is found in the paper database, will set the m_printData
1384 // paper size id member as well.
1385 void wxPageSetupDialogData::SetPaperSize(const wxSize
& sz
)
1389 CalculateIdFromPaperSize();
1392 // Sets the wxPrintData id, plus the paper width/height if found in the paper database.
1393 void wxPageSetupDialogData::SetPaperSize(wxPaperSize id
)
1395 m_printData
.SetPaperId(id
);
1397 CalculatePaperSizeFromId();
1400 // Use paper size defined in this object to set the wxPrintData
1402 void wxPageSetupDialogData::CalculateIdFromPaperSize()
1404 wxASSERT_MSG( (wxThePrintPaperDatabase
!= (wxPrintPaperDatabase
*) NULL
),
1405 wxT("wxThePrintPaperDatabase should not be NULL. Do not create global print dialog data objects.") );
1407 wxSize sz
= GetPaperSize();
1409 wxPaperSize id
= wxThePrintPaperDatabase
->GetSize(wxSize(sz
.x
* 10, sz
.y
* 10));
1410 if (id
!= wxPAPER_NONE
)
1412 m_printData
.SetPaperId(id
);
1416 // Use paper id in wxPrintData to set this object's paper size
1417 void wxPageSetupDialogData::CalculatePaperSizeFromId()
1419 wxASSERT_MSG( (wxThePrintPaperDatabase
!= (wxPrintPaperDatabase
*) NULL
),
1420 wxT("wxThePrintPaperDatabase should not be NULL. Do not create global print dialog data objects.") );
1422 wxSize sz
= wxThePrintPaperDatabase
->GetSize(m_printData
.GetPaperId());
1426 // sz is in 10ths of a mm, so multiply by 10.
1427 m_paperSize
.x
= sz
.x
* 10;
1428 m_paperSize
.y
= sz
.y
* 10;
1432 #endif // wxUSE_PRINTING_ARCHITECTURE