X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cfb00da4c4cdcd7292a6021441f858ddc1cd2818..8998887c224924d5f6f4601597c162d6429495e1:/src/common/cmndata.cpp?ds=sidebyside diff --git a/src/common/cmndata.cpp b/src/common/cmndata.cpp index d4e48ea153..b3d61564b8 100644 --- a/src/common/cmndata.cpp +++ b/src/common/cmndata.cpp @@ -17,7 +17,7 @@ // headers // ---------------------------------------------------------------------------- -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "cmndata.h" #endif @@ -48,13 +48,12 @@ #endif // wxUSE_PRINTING_ARCHITECTURE #ifdef __WXMSW__ - #include + #include #include "wx/msw/private.h" - #if !defined(__WIN32__) - #include + #ifndef __SMARTPHONE__ #include - #endif // Win16 + #endif #if defined(__WATCOMC__) || defined(__SYMANTEC__) || defined(__SALFORDC__) #include @@ -62,6 +61,10 @@ #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) @@ -71,23 +74,6 @@ 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 -# endif -# include -#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 @@ -102,12 +88,9 @@ 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) @@ -122,28 +105,27 @@ wxColourData::~wxColourData() 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; } // ---------------------------------------------------------------------------- @@ -153,13 +135,13 @@ void wxColourData::operator=(const wxColourData& data) wxFontData::wxFontData() { // Intialize colour to black. - fontColour = wxNullColour; + 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; } @@ -187,33 +169,16 @@ wxPrintData::wxPrintData() m_devMode = (void*) NULL; m_devNames = (void*) NULL; #elif defined( __WXMAC__ ) -#if TARGET_CARBON - m_macPageFormat = kPMNoPageFormat; - m_macPrintSettings = kPMNoPrintSettings; - m_macPrintSession = kPMNoReference ; - ValidateOrCreateNative() ; -#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 = wxT(""); - m_colour = TRUE; + m_colour = true; m_duplexMode = wxDUPLEX_SIMPLEX; m_printQuality = wxPRINT_QUALITY_HIGH; m_paperId = wxPAPER_A4; @@ -245,6 +210,10 @@ wxPrintData::wxPrintData() m_printerTranslateX = 0; m_printerTranslateY = 0; m_printMode = wxPRINT_MODE_FILE; + +#ifdef wxUSE_STREAMS + m_outputstream = NULL; +#endif } wxPrintData::wxPrintData(const wxPrintData& printData) @@ -254,13 +223,7 @@ 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; - m_macPrintSession = kPMNoReference ; -#else - m_macPrintSettings = NULL; -#endif + m_nativePrintData = wxNativePrintData::Create() ; #endif (*this) = printData; } @@ -275,40 +238,7 @@ wxPrintData::~wxPrintData() 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; - } - - if ( m_macPrintSession != kPMNoReference ) - { - #if PM_USE_SESSION_APIS - (void)PMRelease(m_macPrintSession); - #else - (void)PMDisposePrintSession(m_macPrintSession); - #endif - m_macPrintSession = kPMNoReference; - } -#else - wxASSERT( m_macPrintSettings ); - // we should perhaps delete -#endif + delete m_nativePrintData ; #endif } @@ -397,7 +327,11 @@ void wxPrintData::ConvertToNative() 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; @@ -453,10 +387,8 @@ void wxPrintData::ConvertToNative() //// Collation -#ifndef __WIN16__ devMode->dmCollate = (m_printCollate ? DMCOLLATE_TRUE : DMCOLLATE_FALSE); devMode->dmFields |= DM_COLLATE; -#endif //// Number of copies @@ -548,6 +480,32 @@ void wxPrintData::ConvertToNative() 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 = DMBIN_USER + m_bin - wxPRINTBIN_USER; + break; + } + + devMode->dmFields |= DM_DEFAULTSOURCE; + } + GlobalUnlock(hDevMode); } @@ -579,15 +537,13 @@ void wxPrintData::ConvertFromNative() //// 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 @@ -596,6 +552,11 @@ void wxPrintData::ConvertFromNative() m_printNoCopies = devMode->dmCopies; } + if (devMode->dmFields & DM_DEFAULTSOURCE) + { + m_bin = (wxPrintBin)devMode->dmDefaultSource; + } + //// Printer name if (devMode->dmDeviceName[0] != 0) @@ -608,12 +569,12 @@ void wxPrintData::ConvertFromNative() 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; //// Paper size @@ -755,153 +716,12 @@ void wxPrintData::ConvertFromNative() void wxPrintData::ConvertToNative() { - ValidateOrCreateNative() ; -#if TARGET_CARBON - PMSetCopies( (PMPrintSettings) m_macPrintSettings , m_printNoCopies , false ) ; - PMSetOrientation( (PMPageFormat) m_macPageFormat , ( m_printOrientation == wxLANDSCAPE ) ? - kPMLandscape : kPMPortrait , false ) ; - // collate cannot be set -#if 0 // not yet tested - if ( m_printerName.Length() > 0 ) - PMSessionSetCurrentPrinter( (PMPrintSession) m_macPrintSession , wxMacCFStringHolder( m_printerName ) ) ; -#endif - PMColorMode color ; - PMGetColorMode( (PMPrintSettings) m_macPrintSettings, &color ) ; - if (m_colour) - { - if ( color == kPMBlackAndWhite ) - PMSetColorMode( (PMPrintSettings) m_macPrintSettings, kPMColor ) ; - } - else - PMSetColorMode( (PMPrintSettings) m_macPrintSettings, kPMBlackAndWhite ) ; - - // PMDuplexMode not yet accessible via API - // PMQualityMode not yet accessible via API - // todo paperSize -#else - // on mac the paper rect has a negative top left corner, because the page rect (printable area) is at 0,0 - (**(THPrint)m_macPrintSettings).prJob.iCopies = m_printNoCopies; - (**(THPrint)m_macPrintSettings).rPaper.left = int( ((double) m_minMarginTopLeft.x)*mm2pt ); - (**(THPrint)m_macPrintSettings).rPaper.top = int( ((double) m_minMarginTopLeft.y)*mm2pt ); - - (**(THPrint)m_macPrintSettings).rPaper.right = int( ((double) m_paperSize.x - m_minMarginTopLeft.x)*mm2pt ); - (**(THPrint)m_macPrintSettings).rPaper.bottom = int( ((double) m_paperSize.y - m_minMarginTopLeft.y)*mm2pt ); - - (**(THPrint)m_macPrintSettings).prInfo.rPage.left = 0; - (**(THPrint)m_macPrintSettings).prInfo.rPage.top = 0; - (**(THPrint)m_macPrintSettings).prInfo.rPage.right = int( ((double) m_paperSize.x - m_minMarginTopLeft.x - m_minMarginBottomRight.x)*mm2pt ); - (**(THPrint)m_macPrintSettings).prInfo.rPage.bottom = int( ((double) m_paperSize.y - m_minMarginTopLeft.y - m_minMarginBottomRight.y)*mm2pt ); -#endif + m_nativePrintData->TransferFrom( this ) ; } void wxPrintData::ConvertFromNative() { -#if TARGET_CARBON - OSStatus err = noErr ; - - UInt32 copies ; - err = PMGetCopies( (PMPrintSettings) m_macPrintSettings , &copies ) ; - if ( err == noErr ) - m_printNoCopies = copies ; - - PMOrientation orientation ; - err = PMGetOrientation( (PMPageFormat) m_macPageFormat , &orientation ) ; - if ( err == noErr ) - { - if ( orientation == kPMPortrait || orientation == kPMReversePortrait ) - m_printOrientation = wxPORTRAIT ; - else - m_printOrientation = wxLANDSCAPE ; - } - - // collate cannot be set -#if 0 - { - wxMacCFStringHolder name ; - PMPrinter printer ; - PMSessionGetCurrentPrinter( (PMPrintSession) m_macPrintSession , - &printer ) ; - m_printerName = name.AsString() ; - } -#endif - - PMColorMode color ; - err = PMGetColorMode( (PMPrintSettings) m_macPrintSettings, &color ) ; - if ( err == noErr ) - m_colour = !(color == kPMBlackAndWhite) ; - - // PMDuplexMode not yet accessible via API - // PMQualityMode not yet accessible via API - // todo paperSize - PMRect rPaper; - err = PMGetUnadjustedPaperRect((PMPageFormat) m_macPageFormat, &rPaper); - if ( err == noErr ) - { - m_paperSize.x = (int)(( rPaper.right - rPaper.left ) * pt2mm + 0.5 ); - m_paperSize.y = (int)(( rPaper.bottom - rPaper.top ) * pt2mm + 0.5 ); - } -#else - m_printNoCopies = (**(THPrint)m_macPrintSettings).prJob.iCopies; - - // paper size - m_paperSize.x = ((double) (**(THPrint)m_macPrintSettings).rPaper.right - (**(THPrint)m_macPrintSettings).rPaper.left ) * pt2mm; - m_paperSize.y = ((double) (**(THPrint)m_macPrintSettings).rPaper.bottom - (**(THPrint)m_macPrintSettings).rPaper.top ) * pt2mm; -#endif -} - -void wxPrintData::ValidateOrCreateNative() -{ -#if TARGET_CARBON - OSStatus err = noErr ; - if ( m_macPrintSession == kPMNoReference ) - { - err = PMCreateSession( (PMPrintSession *) &m_macPrintSession ) ; - } - // Set up a valid PageFormat object. - if ( m_macPageFormat == kPMNoPageFormat) - { - 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) m_macPrintSession, - (PMPageFormat) m_macPageFormat); - } - } - else - { - err = PMSessionValidatePageFormat((PMPrintSession) m_macPrintSession, - (PMPageFormat) m_macPageFormat, - kPMDontWantBoolean); - } - - // Set up a valid PrintSettings object. - if ( m_macPrintSettings == kPMNoPrintSettings) - { - 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) m_macPrintSession, - (PMPrintSettings) m_macPrintSettings); - } - } - else - { - err = PMSessionValidatePrintSettings((PMPrintSession) m_macPrintSession, - (PMPrintSettings) m_macPrintSettings, - kPMDontWantBoolean); - } -#else -#endif + m_nativePrintData->TransferTo( this ) ; } #endif @@ -909,43 +729,7 @@ void wxPrintData::ValidateOrCreateNative() void wxPrintData::operator=(const wxPrintData& data) { #ifdef __WXMAC__ -#if TARGET_CARBON - if ( m_macPrintSession != kPMNoPrintSettings ) - { - PMRelease( m_macPrintSession ) ; - m_macPrintSession = kPMNoPrintSettings ; - } - if ( data.m_macPrintSession != kPMNoPrintSettings ) - { - m_macPrintSession = data.m_macPrintSession ; - PMRetain( m_macPrintSession ) ; - } - - if ( m_macPrintSettings != kPMNoPrintSettings ) - { - PMRelease( m_macPrintSettings ) ; - m_macPrintSettings = kPMNoPrintSettings ; - } - if ( data.m_macPrintSettings != kPMNoPrintSettings ) - { - m_macPrintSettings = data.m_macPrintSettings ; - PMRetain( m_macPrintSettings ) ; - } - - if ( m_macPageFormat != kPMNoPageFormat ) - { - PMRelease( m_macPageFormat ) ; - m_macPageFormat = kPMNoPageFormat ; - } - if ( data.m_macPageFormat != kPMNoPageFormat ) - { - m_macPageFormat = data.m_macPageFormat ; - PMRetain( m_macPageFormat ) ; - } -#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; @@ -956,6 +740,10 @@ void wxPrintData::operator=(const wxPrintData& data) 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; @@ -977,7 +765,7 @@ bool wxPrintData::Ok() const ((wxPrintData*)this)->ConvertToNative(); return (m_devMode != NULL) ; #else - return TRUE; + return true; #endif } @@ -995,15 +783,15 @@ wxPrintDialogData::wxPrintDialogData() 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) @@ -1020,20 +808,20 @@ wxPrintDialogData::wxPrintDialogData(const wxPrintData& printData) #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; } @@ -1141,6 +929,8 @@ void wxPrintDialogData::ConvertToNative() 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 ) @@ -1178,7 +968,7 @@ void wxPrintDialogData::ConvertFromNative() } // Now convert the DEVMODE object, passed down from the PRINTDLG object, - // into wxWindows form. + // into wxWidgets form. m_printData.ConvertFromNative(); m_printFromPage = pd->nFromPage; @@ -1187,7 +977,7 @@ void wxPrintDialogData::ConvertFromNative() 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); @@ -1231,37 +1021,13 @@ void wxPrintDialogData::SetOwnerWindow(wxWindow* win) void wxPrintDialogData::ConvertToNative() { m_printData.ConvertToNative(); -#if TARGET_CARBON - PMSetPageRange( (PMPrintSettings) m_printData.m_macPrintSettings , m_printMinPage , m_printMaxPage ) ; - PMSetCopies( (PMPrintSettings) m_printData.m_macPrintSettings , m_printNoCopies , false ) ; - PMSetFirstPage( (PMPrintSettings) m_printData.m_macPrintSettings , m_printFromPage , false ) ; - PMSetLastPage( (PMPrintSettings) m_printData.m_macPrintSettings , m_printToPage , false ) ; -#else - (**(THPrint)m_printData.m_macPrintSettings).prJob.iFstPage = m_printFromPage; - (**(THPrint)m_printData.m_macPrintSettings).prJob.iLstPage = m_printToPage; -#endif + m_printData.m_nativePrintData->TransferFrom( this ) ; } void wxPrintDialogData::ConvertFromNative() { m_printData.ConvertFromNative(); -#if TARGET_CARBON - UInt32 minPage , maxPage ; - PMGetPageRange( (PMPrintSettings) m_printData.m_macPrintSettings , &minPage , &maxPage ) ; - m_printMinPage = minPage ; - m_printMaxPage = maxPage ; - UInt32 copies ; - PMGetCopies( (PMPrintSettings) m_printData.m_macPrintSettings , &copies ) ; - m_printNoCopies = copies ; - UInt32 from , to ; - PMGetFirstPage((PMPrintSettings) m_printData.m_macPrintSettings , &from ) ; - PMGetLastPage((PMPrintSettings) m_printData.m_macPrintSettings , &to ) ; - m_printFromPage = from ; - m_printToPage = to ; -#else - 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 @@ -1311,13 +1077,13 @@ wxPageSetupDialogData::wxPageSetupDialogData() 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) @@ -1341,13 +1107,13 @@ wxPageSetupDialogData::wxPageSetupDialogData(const wxPrintData& printData) 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; @@ -1577,12 +1343,7 @@ void wxPageSetupDialogData::SetOwnerWindow(wxWindow* win) void wxPageSetupDialogData::ConvertToNative() { m_printData.ConvertToNative(); - // should we setup the page rect here ? - // since MacOS sometimes has two same paper rects with different - // page rects we could make it roundtrip safe perhaps -#if TARGET_CARBON -#else -#endif + m_printData.m_nativePrintData->TransferFrom( this ) ; } void wxPageSetupDialogData::ConvertFromNative() @@ -1590,27 +1351,7 @@ void wxPageSetupDialogData::ConvertFromNative() m_printData.ConvertFromNative (); m_paperSize = m_printData.GetPaperSize() ; CalculateIdFromPaperSize(); -#if TARGET_CARBON - PMRect rPaper; - OSStatus err = PMGetUnadjustedPaperRect((PMPageFormat) m_printData.m_macPageFormat, &rPaper); - if ( err == noErr ) - { - PMRect rPage ; - err = PMGetUnadjustedPageRect((PMPageFormat) m_printData.m_macPageFormat , &rPage ) ; - if ( err == noErr ) - { - m_minMarginTopLeft.x = (int)(((double) rPage.left - rPaper.left ) * pt2mm); - m_minMarginTopLeft.y = (int)(((double) rPage.top - rPaper.top ) * pt2mm); - m_minMarginBottomRight.x = ((double) rPaper.right - rPage.right ) * pt2mm; - m_minMarginBottomRight.y = ((double) rPaper.bottom - rPage.bottom ) * pt2mm; - } - } -#else - m_minMarginTopLeft.x = ((double) (**(THPrint)m_macPrintSettings).prInfo.rPage.left )-(**(THPrint)m_macPrintSettings).rPaper.left ) * pt2mm; - m_minMarginTopLeft.y = ((double) (**(THPrint)m_macPrintSettings).prInfo.rPage.top )-(**(THPrint)m_macPrintSettings).rPaper.top ) * pt2mm; - m_minMarginBottomRight.x = ((double) (**(THPrint)m_macPrintSettings).rPaper.right - (**(THPrint)m_macPrintSettings).prInfo.rPage.right ) * pt2mm; - m_minMarginBottomRight.y = ((double)(**(THPrint)m_macPrintSettings).rPaper.bottom - (**(THPrint)m_macPrintSettings).prInfo.rPage.bottom ) * pt2mm; -#endif + m_printData.m_nativePrintData->TransferTo( this ) ; // adjust minimal values if ( m_marginTopLeft.x < m_minMarginTopLeft.x )