X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/01cf2f9512e90d1c70e9423f5b099fe5624bcc1b..a536e411022b21280532c9daadc806a437fbb4c6:/src/common/cmndata.cpp diff --git a/src/common/cmndata.cpp b/src/common/cmndata.cpp index 2fe0f2ff51..4ee83e61e9 100644 --- a/src/common/cmndata.cpp +++ b/src/common/cmndata.cpp @@ -39,8 +39,12 @@ #include "wx/cmndata.h" #include "wx/log.h" +#if wxUSE_FONTDLG + #include "wx/fontdlg.h" +#endif // wxUSE_FONTDLG + // For compatibility -#if (defined(__WXMOTIF__) || defined(__WXGTK__) || defined(__WXX11__)|| defined(__WXPM__) || defined(__WXMAC__)) && wxUSE_POSTSCRIPT +#if (defined(__WXMOTIF__) || defined(__WXMGL__) || defined(__WXGTK__) || defined(__WXX11__)|| defined(__WXPM__) || defined(__WXMAC__)) && wxUSE_POSTSCRIPT #define wxCOMPATIBILITY_WITH_PRINTSETUPDATA 1 #endif @@ -121,6 +125,7 @@ wxColourData::wxColourData() } wxColourData::wxColourData(const wxColourData& data) + : wxObject() { (*this) = data; } @@ -177,6 +182,14 @@ wxFontData::~wxFontData() { } +#if wxUSE_FONTDLG + +wxFontDialogBase::~wxFontDialogBase() +{ +} + +#endif // wxUSE_FONTDLG + #if wxUSE_PRINTING_ARCHITECTURE // ---------------------------------------------------------------------------- // Print data @@ -191,16 +204,16 @@ wxPrintData::wxPrintData() #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. @@ -209,9 +222,9 @@ wxPrintData::wxPrintData() 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. @@ -264,6 +277,7 @@ wxPrintData::wxPrintData() } wxPrintData::wxPrintData(const wxPrintData& printData) + : wxObject() { #ifdef __WXMSW__ m_devMode = (void*) NULL; @@ -309,7 +323,7 @@ wxPrintData::~wxPrintData() #endif m_macPrintSettings = kPMNoPrintSettings; } - + #else wxASSERT( m_macPrintSettings ); // we should perhaps delete @@ -851,6 +865,16 @@ void wxPrintData::operator=(const wxPrintSetupData& setupData) } #endif // wxCOMPATIBILITY_WITH_PRINTSETUPDATA +// Is this data OK for showing the print dialog? +bool wxPrintData::Ok() const +{ +#ifdef __WXMSW__ + ((wxPrintData*)this)->ConvertToNative(); + return (m_devMode != NULL) ; +#else + return TRUE; +#endif +} // ---------------------------------------------------------------------------- // Print dialog data @@ -878,6 +902,7 @@ wxPrintDialogData::wxPrintDialogData() } wxPrintDialogData::wxPrintDialogData(const wxPrintDialogData& dialogData) + : wxObject() { #ifdef __WXMSW__ m_printDlgData = NULL; @@ -964,7 +989,8 @@ void wxPrintDialogData::ConvertToNative() m_printData.SetNativeData((void*) NULL); - wxASSERT_MSG( (pd->hDevMode), wxT("hDevMode must be non-NULL in ConvertToNative!")); + // Shouldn't assert; we should be able to test Ok-ness at a higher level + //wxASSERT_MSG( (pd->hDevMode), wxT("hDevMode must be non-NULL in ConvertToNative!")); pd->hDevNames = (HGLOBAL)(DWORD) m_printData.GetNativeDataDevNames(); @@ -1172,6 +1198,7 @@ wxPageSetupDialogData::wxPageSetupDialogData() } wxPageSetupDialogData::wxPageSetupDialogData(const wxPageSetupDialogData& dialogData) + : wxObject() { #if defined(__WIN95__) m_pageSetupData = NULL; @@ -1219,7 +1246,7 @@ wxPageSetupDialogData::~wxPageSetupDialogData() #endif } -void wxPageSetupDialogData::operator=(const wxPageSetupDialogData& data) +wxPageSetupDialogData& wxPageSetupDialogData::operator=(const wxPageSetupDialogData& data) { m_paperSize = data.m_paperSize; m_minMarginTopLeft = data.m_minMarginTopLeft; @@ -1235,11 +1262,15 @@ void wxPageSetupDialogData::operator=(const wxPageSetupDialogData& data) m_enableHelp = data.m_enableHelp; m_printData = data.m_printData; + + return *this; } -void wxPageSetupDialogData::operator=(const wxPrintData& data) +wxPageSetupDialogData& wxPageSetupDialogData::operator=(const wxPrintData& data) { m_printData = data; + + return *this; } #if defined(__WIN95__) @@ -1271,7 +1302,8 @@ void wxPageSetupDialogData::ConvertToNative() m_printData.SetNativeData((void*) NULL); - wxASSERT_MSG( (pd->hDevMode), wxT("hDevMode must be non-NULL in ConvertToNative!")); + // Shouldn't assert; we should be able to test Ok-ness at a higher level + //wxASSERT_MSG( (pd->hDevMode), wxT("hDevMode must be non-NULL in ConvertToNative!")); // Pass the devnames data (created in m_printData.ConvertToNative) // to the PRINTDLG structure, since it'll