From 962cbf2ee0ba655db3e6db00ade68b5f1e85ba1e Mon Sep 17 00:00:00 2001 From: Gilles Depeyrot Date: Fri, 4 Jan 2002 21:51:02 +0000 Subject: [PATCH] added missing casts after removal of dependancy on mac headers git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13374 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/cmndata.cpp | 50 +++---- src/mac/carbon/checklst.cpp | 9 +- src/mac/carbon/dcprint.cpp | 38 +++--- src/mac/carbon/listbox.cpp | 8 +- src/mac/carbon/printdlg.cpp | 266 ++++++++++++++++++------------------ src/mac/checklst.cpp | 9 +- src/mac/dcprint.cpp | 38 +++--- src/mac/listbox.cpp | 8 +- src/mac/printdlg.cpp | 266 ++++++++++++++++++------------------ 9 files changed, 346 insertions(+), 346 deletions(-) diff --git a/src/common/cmndata.cpp b/src/common/cmndata.cpp index 57c36a0a7c..2b82ea36fd 100644 --- a/src/common/cmndata.cpp +++ b/src/common/cmndata.cpp @@ -186,30 +186,32 @@ wxPrintData::wxPrintData() PMPrintSession macPrintSession = kPMNoReference; OSStatus err; - err = ::UMAPrOpen(&macPrintSession) ; - if ( err == noErr ) - { - err = PMCreatePageFormat(&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(macPrintSession, m_macPageFormat); - } - - err = PMCreatePrintSettings(&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(macPrintSession, m_macPrintSettings); - } - } - ::UMAPrClose(&macPrintSession) ; + 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_macPrintInfo = (THPrint) NewHandleClear( sizeof( TPrint ) ); diff --git a/src/mac/carbon/checklst.cpp b/src/mac/carbon/checklst.cpp index 743fea9aac..84cad9fe34 100644 --- a/src/mac/carbon/checklst.cpp +++ b/src/mac/carbon/checklst.cpp @@ -52,7 +52,6 @@ static pascal void wxMacCheckListDefinition( short message, Boolean isSelected, Cell cell, short dataOffset, short dataLength, ListHandle listHandle ) { - FontInfo fontInfo; GrafPtr savePort; GrafPtr grafPtr; RgnHandle savedClipRegion; @@ -180,8 +179,8 @@ bool wxCheckListBox::Create(wxWindow *parent, Size asize; - CreateListBoxControl( parent->MacGetRootWindow(), &bounds, false, 0, 1, false, true, - 14, 14, false, &listDef, &m_macControl ); + CreateListBoxControl( MAC_WXHWND(parent->MacGetRootWindow()), &bounds, false, 0, 1, false, true, + 14, 14, false, &listDef, (ControlRef *)&m_macControl ); GetControlData( (ControlHandle) m_macControl, kControlNoPart, kControlListBoxListHandleTag, sizeof(ListHandle), (Ptr) &m_macList, &asize); @@ -352,10 +351,10 @@ void wxCheckListBox::OnLeftClick(wxMouseEvent& event) int topcell ; #if TARGET_CARBON Point pt ; - GetListCellSize( m_macList , &pt ) ; + GetListCellSize( (ListHandle)m_macList , &pt ) ; lineheight = pt.v ; ListBounds visible ; - GetListVisibleCells( m_macList , &visible ) ; + GetListVisibleCells( (ListHandle)m_macList , &visible ) ; topcell = visible.top ; #else lineheight = (**(ListHandle)m_macList).cellSize.v ; diff --git a/src/mac/carbon/dcprint.cpp b/src/mac/carbon/dcprint.cpp index e81573f6bc..4a7c007eca 100644 --- a/src/mac/carbon/dcprint.cpp +++ b/src/mac/carbon/dcprint.cpp @@ -43,7 +43,7 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printdata) m_printData.ConvertToNative() ; #if TARGET_CARBON && PM_USE_SESSION_APIS - err = UMAPrOpen(&m_macPrintSession) ; + err = UMAPrOpen((PMPrintSession *)&m_macPrintSession) ; if ( err != noErr || m_macPrintSession == kPMNoData ) #else err = UMAPrOpen() ; @@ -54,7 +54,7 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printdata) wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; dialog.ShowModal(); #if TARGET_CARBON && PM_USE_SESSION_APIS - UMAPrClose(&m_macPrintSession) ; + UMAPrClose((PMPrintSession *)&m_macPrintSession) ; #else UMAPrClose() ; #endif @@ -94,9 +94,9 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printdata) m_macPort = (GrafPtr ) m_macPrintPort ; #else #if PM_USE_SESSION_APIS - err = PMSessionBeginDocument(m_macPrintSession, - m_printData.m_macPrintSettings, - m_printData.m_macPageFormat); + err = PMSessionBeginDocument((PMPrintSession)m_macPrintSession, + (PMPrintSettings)m_printData.m_macPrintSettings, + (PMPageFormat)m_printData.m_macPageFormat); if ( err != noErr ) #else m_macPrintPort = kPMNoReference ; @@ -111,7 +111,7 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printdata) wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; dialog.ShowModal(); #if TARGET_CARBON && PM_USE_SESSION_APIS - UMAPrClose(&m_macPrintSession) ; + UMAPrClose((PMPrintSession *)&m_macPrintSession) ; #else UMAPrClose() ; #endif @@ -119,21 +119,21 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printdata) return; } // sets current port - ::GetPort( &m_macPort ) ; + ::GetPort( (GrafPtr *)&m_macPort ) ; #endif m_ok = TRUE ; m_minY = m_minX = 0 ; #if TARGET_CARBON PMRect rPaper; - err = PMGetAdjustedPaperRect(m_printData.m_macPageFormat, &rPaper); + err = PMGetAdjustedPaperRect((PMPageFormat)m_printData.m_macPageFormat, &rPaper); if ( err != noErr ) { message.Printf( "Print Error %d", err ) ; wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; dialog.ShowModal(); #if TARGET_CARBON && PM_USE_SESSION_APIS - UMAPrClose(&m_macPrintSession) ; + UMAPrClose((PMPrintSession *)&m_macPrintSession) ; #else UMAPrClose() ; #endif @@ -180,7 +180,7 @@ wxPrinterDC::~wxPrinterDC(void) if ( m_ok ) { #if PM_USE_SESSION_APIS - err = PMSessionEndDocument(m_macPrintSession); + err = PMSessionEndDocument((PMPrintSession)m_macPrintSession); #else err = PMEndDocument(m_macPrintPort); #endif @@ -191,7 +191,7 @@ wxPrinterDC::~wxPrinterDC(void) dialog.ShowModal(); } #if TARGET_CARBON && PM_USE_SESSION_APIS - UMAPrClose(&m_macPrintSession) ; + UMAPrClose((PMPrintSession *)&m_macPrintSession) ; #else UMAPrClose() ; #endif @@ -253,8 +253,8 @@ void wxPrinterDC::StartPage(void) } #else #if PM_USE_SESSION_APIS - err = PMSessionBeginPage(m_macPrintSession, - m_printData.m_macPageFormat, + err = PMSessionBeginPage((PMPrintSession)m_macPrintSession, + (PMPageFormat)m_printData.m_macPageFormat, nil); #else err = PMBeginPage(m_macPrintPort, nil); @@ -265,9 +265,9 @@ void wxPrinterDC::StartPage(void) wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; dialog.ShowModal(); #if PM_USE_SESSION_APIS - PMSessionEndPage(m_macPrintSession); - PMSessionEndDocument(m_macPrintSession); - UMAPrClose(&m_macPrintSession) ; + PMSessionEndPage((PMPrintSession)m_macPrintSession); + PMSessionEndDocument((PMPrintSession)m_macPrintSession); + UMAPrClose((PMPrintSession *)&m_macPrintSession) ; #else PMEndPage(m_macPrintPort); PMEndDocument(m_macPrintPort); @@ -302,7 +302,7 @@ void wxPrinterDC::EndPage(void) } #else #if PM_USE_SESSION_APIS - err = PMSessionEndPage(m_macPrintSession); + err = PMSessionEndPage((PMPrintSession)m_macPrintSession); #else err = PMEndPage(m_macPrintPort); #endif @@ -312,8 +312,8 @@ void wxPrinterDC::EndPage(void) wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; dialog.ShowModal(); #if PM_USE_SESSION_APIS - PMSessionEndDocument(m_macPrintSession); - UMAPrClose(&m_macPrintSession) ; + PMSessionEndDocument((PMPrintSession)m_macPrintSession); + UMAPrClose((PMPrintSession *)&m_macPrintSession) ; #else PMEndDocument(m_macPrintPort); UMAPrClose() ; diff --git a/src/mac/carbon/listbox.cpp b/src/mac/carbon/listbox.cpp index 9533882e9e..3e5ae1bc37 100644 --- a/src/mac/carbon/listbox.cpp +++ b/src/mac/carbon/listbox.cpp @@ -168,8 +168,8 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id, Size asize; - CreateListBoxControl( parent->MacGetRootWindow(), &bounds, false, 0, 1, false, true, - kwxMacListItemHeight, kwxMacListItemHeight, false, &listDef, &m_macControl ); + CreateListBoxControl( MAC_WXHWND(parent->MacGetRootWindow()), &bounds, false, 0, 1, false, true, + kwxMacListItemHeight, kwxMacListItemHeight, false, &listDef, (ControlRef *)&m_macControl ); GetControlData( (ControlHandle) m_macControl, kControlNoPart, kControlListBoxListHandleTag, sizeof(ListHandle), (Ptr) &m_macList, &asize); @@ -273,7 +273,7 @@ void wxListBox::DoSetSize(int x, int y, #if TARGET_CARBON Rect bounds ; GetControlBounds( (ControlHandle) m_macControl , &bounds ) ; - ControlRef control = GetListVerticalScrollBar( m_macList ) ; + ControlRef control = GetListVerticalScrollBar( (ListHandle)m_macList ) ; if ( control ) { Rect scrollbounds ; @@ -737,7 +737,7 @@ void wxListBox::OnSize( const wxSizeEvent &event) Point pt; #if TARGET_CARBON - GetListCellSize(m_macList, &pt); + GetListCellSize((ListHandle)m_macList, &pt); #else pt = (**(ListHandle)m_macList).cellSize ; #endif diff --git a/src/mac/carbon/printdlg.cpp b/src/mac/carbon/printdlg.cpp index 38c128ac21..5fd25c56da 100644 --- a/src/mac/carbon/printdlg.cpp +++ b/src/mac/carbon/printdlg.cpp @@ -95,86 +95,86 @@ int wxPrintDialog::ShowModal() PMPrintSession macPrintSession = kPMNoReference; Boolean accepted; - err = ::UMAPrOpen(&macPrintSession) ; - if ( err == noErr ) - { - m_printDialogData.ConvertToNative() ; - - // Set up a valid PageFormat object. - if (m_printDialogData.GetPrintData().m_macPageFormat == kPMNoPageFormat) - { - err = PMCreatePageFormat(&m_printDialogData.GetPrintData().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_printDialogData.GetPrintData().m_macPageFormat != kPMNoPageFormat)) - { - err = PMSessionDefaultPageFormat(macPrintSession, - m_printDialogData.GetPrintData().m_macPageFormat); - } - } - else - { - err = PMSessionValidatePageFormat(macPrintSession, - m_printDialogData.GetPrintData().m_macPageFormat, - kPMDontWantBoolean); - } + err = ::UMAPrOpen(&macPrintSession) ; + if ( err == noErr ) + { + m_printDialogData.ConvertToNative() ; + + // Set up a valid PageFormat object. + if (m_printDialogData.GetPrintData().m_macPageFormat == kPMNoPageFormat) + { + err = PMCreatePageFormat((PMPageFormat *)&m_printDialogData.GetPrintData().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_printDialogData.GetPrintData().m_macPageFormat != kPMNoPageFormat)) + { + err = PMSessionDefaultPageFormat((PMPrintSession)macPrintSession, + (PMPageFormat)m_printDialogData.GetPrintData().m_macPageFormat); + } + } + else + { + err = PMSessionValidatePageFormat((PMPrintSession)macPrintSession, + (PMPageFormat)m_printDialogData.GetPrintData().m_macPageFormat, + kPMDontWantBoolean); + } - // Set up a valid PrintSettings object. - if (m_printDialogData.GetPrintData().m_macPrintSettings == kPMNoPrintSettings) - { - err = PMCreatePrintSettings(&m_printDialogData.GetPrintData().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_printDialogData.GetPrintData().m_macPrintSettings != kPMNoPrintSettings)) - { - err = PMSessionDefaultPrintSettings(macPrintSession, - m_printDialogData.GetPrintData().m_macPrintSettings); - } - } - else - { - err = PMSessionValidatePrintSettings(macPrintSession, - m_printDialogData.GetPrintData().m_macPrintSettings, - kPMDontWantBoolean); - } - // Set a valid page range before displaying the Print dialog - if (err == noErr) - { - // err = PMSetPageRange(m_printDialogData.GetPrintData().m_macPrintSettings, - // minPage, maxPage); - } - - // Display the Print dialog. - if (err == noErr) - { - err = PMSessionPrintDialog(macPrintSession, - m_printDialogData.GetPrintData().m_macPrintSettings, - m_printDialogData.GetPrintData().m_macPageFormat, - &accepted); - if ((err == noErr) && !accepted) - { - err = kPMCancel; // user clicked Cancel button - } - } - if ( err == noErr ) - { - m_printDialogData.ConvertFromNative() ; - result = wxID_OK ; - } - } - if ((err != noErr) && (err != kPMCancel)) - { - message.Printf( "Print Error %d", err ) ; - wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; - dialog.ShowModal(); - } - ::UMAPrClose(&macPrintSession) ; + // Set up a valid PrintSettings object. + if (m_printDialogData.GetPrintData().m_macPrintSettings == kPMNoPrintSettings) + { + err = PMCreatePrintSettings((PMPrintSettings *)&m_printDialogData.GetPrintData().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_printDialogData.GetPrintData().m_macPrintSettings != kPMNoPrintSettings)) + { + err = PMSessionDefaultPrintSettings((PMPrintSession)macPrintSession, + (PMPrintSettings)m_printDialogData.GetPrintData().m_macPrintSettings); + } + } + else + { + err = PMSessionValidatePrintSettings((PMPrintSession)macPrintSession, + (PMPrintSettings)m_printDialogData.GetPrintData().m_macPrintSettings, + kPMDontWantBoolean); + } + // Set a valid page range before displaying the Print dialog + if (err == noErr) + { + // err = PMSetPageRange(m_printDialogData.GetPrintData().m_macPrintSettings, + // minPage, maxPage); + } + + // Display the Print dialog. + if (err == noErr) + { + err = PMSessionPrintDialog((PMPrintSession)macPrintSession, + (PMPrintSettings)m_printDialogData.GetPrintData().m_macPrintSettings, + (PMPageFormat)m_printDialogData.GetPrintData().m_macPageFormat, + &accepted); + if ((err == noErr) && !accepted) + { + err = kPMCancel; // user clicked Cancel button + } + } + if ( err == noErr ) + { + m_printDialogData.ConvertFromNative() ; + result = wxID_OK ; + } + } + if ((err != noErr) && (err != kPMCancel)) + { + message.Printf( "Print Error %d", err ) ; + wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; + dialog.ShowModal(); + } + ::UMAPrClose(&macPrintSession) ; #else #pragma warning "TODO: Printing for carbon without session apis" #endif @@ -247,60 +247,60 @@ int wxPageSetupDialog::ShowModal() PMPrintSession macPrintSession = kPMNoReference; Boolean accepted; - err = ::UMAPrOpen(&macPrintSession) ; - if ( err == noErr ) - { - m_pageSetupData.ConvertToNative() ; - - // Set up a valid PageFormat object. - if (m_pageSetupData.GetPrintData().m_macPageFormat == kPMNoPageFormat) - { - err = PMCreatePageFormat(&m_pageSetupData.GetPrintData().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_pageSetupData.GetPrintData().m_macPageFormat != kPMNoPageFormat)) - { - err = PMSessionDefaultPageFormat(macPrintSession, - m_pageSetupData.GetPrintData().m_macPageFormat); - } - } - else - { - err = PMSessionValidatePageFormat(macPrintSession, - m_pageSetupData.GetPrintData().m_macPageFormat, - kPMDontWantBoolean); - } - - // Display the Page Setup dialog. - if (err == noErr) - { - err = PMSessionPageSetupDialog(macPrintSession, - m_pageSetupData.GetPrintData().m_macPageFormat, - &accepted); - if ((err == noErr) && !accepted) - { - err = kPMCancel; // user clicked Cancel button - } - } - - // If the user did not cancel, flatten and save the PageFormat object - // with our document. - if (err == noErr) { - // err = FlattenAndSavePageFormat(m_pageSetupData.GetPrintData().m_macPageFormat); - m_pageSetupData.ConvertFromNative() ; - result = wxID_OK ; - } - } - if ((err != noErr) && (err != kPMCancel)) - { - message.Printf( "Print Error %d", err ) ; - wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; - dialog.ShowModal(); - } - ::UMAPrClose(&macPrintSession) ; + err = ::UMAPrOpen(&macPrintSession) ; + if ( err == noErr ) + { + m_pageSetupData.ConvertToNative() ; + + // Set up a valid PageFormat object. + if (m_pageSetupData.GetPrintData().m_macPageFormat == kPMNoPageFormat) + { + err = PMCreatePageFormat((PMPageFormat *)&m_pageSetupData.GetPrintData().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_pageSetupData.GetPrintData().m_macPageFormat != kPMNoPageFormat)) + { + err = PMSessionDefaultPageFormat((PMPrintSession)macPrintSession, + (PMPageFormat)m_pageSetupData.GetPrintData().m_macPageFormat); + } + } + else + { + err = PMSessionValidatePageFormat((PMPrintSession)macPrintSession, + (PMPageFormat)m_pageSetupData.GetPrintData().m_macPageFormat, + kPMDontWantBoolean); + } + + // Display the Page Setup dialog. + if (err == noErr) + { + err = PMSessionPageSetupDialog((PMPrintSession)macPrintSession, + (PMPageFormat)m_pageSetupData.GetPrintData().m_macPageFormat, + &accepted); + if ((err == noErr) && !accepted) + { + err = kPMCancel; // user clicked Cancel button + } + } + + // If the user did not cancel, flatten and save the PageFormat object + // with our document. + if (err == noErr) { + // err = FlattenAndSavePageFormat(m_pageSetupData.GetPrintData().m_macPageFormat); + m_pageSetupData.ConvertFromNative() ; + result = wxID_OK ; + } + } + if ((err != noErr) && (err != kPMCancel)) + { + message.Printf( "Print Error %d", err ) ; + wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; + dialog.ShowModal(); + } + ::UMAPrClose(&macPrintSession) ; #else #pragma warning "TODO: Printing for carbon without session apis" #endif diff --git a/src/mac/checklst.cpp b/src/mac/checklst.cpp index 743fea9aac..84cad9fe34 100644 --- a/src/mac/checklst.cpp +++ b/src/mac/checklst.cpp @@ -52,7 +52,6 @@ static pascal void wxMacCheckListDefinition( short message, Boolean isSelected, Cell cell, short dataOffset, short dataLength, ListHandle listHandle ) { - FontInfo fontInfo; GrafPtr savePort; GrafPtr grafPtr; RgnHandle savedClipRegion; @@ -180,8 +179,8 @@ bool wxCheckListBox::Create(wxWindow *parent, Size asize; - CreateListBoxControl( parent->MacGetRootWindow(), &bounds, false, 0, 1, false, true, - 14, 14, false, &listDef, &m_macControl ); + CreateListBoxControl( MAC_WXHWND(parent->MacGetRootWindow()), &bounds, false, 0, 1, false, true, + 14, 14, false, &listDef, (ControlRef *)&m_macControl ); GetControlData( (ControlHandle) m_macControl, kControlNoPart, kControlListBoxListHandleTag, sizeof(ListHandle), (Ptr) &m_macList, &asize); @@ -352,10 +351,10 @@ void wxCheckListBox::OnLeftClick(wxMouseEvent& event) int topcell ; #if TARGET_CARBON Point pt ; - GetListCellSize( m_macList , &pt ) ; + GetListCellSize( (ListHandle)m_macList , &pt ) ; lineheight = pt.v ; ListBounds visible ; - GetListVisibleCells( m_macList , &visible ) ; + GetListVisibleCells( (ListHandle)m_macList , &visible ) ; topcell = visible.top ; #else lineheight = (**(ListHandle)m_macList).cellSize.v ; diff --git a/src/mac/dcprint.cpp b/src/mac/dcprint.cpp index e81573f6bc..4a7c007eca 100644 --- a/src/mac/dcprint.cpp +++ b/src/mac/dcprint.cpp @@ -43,7 +43,7 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printdata) m_printData.ConvertToNative() ; #if TARGET_CARBON && PM_USE_SESSION_APIS - err = UMAPrOpen(&m_macPrintSession) ; + err = UMAPrOpen((PMPrintSession *)&m_macPrintSession) ; if ( err != noErr || m_macPrintSession == kPMNoData ) #else err = UMAPrOpen() ; @@ -54,7 +54,7 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printdata) wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; dialog.ShowModal(); #if TARGET_CARBON && PM_USE_SESSION_APIS - UMAPrClose(&m_macPrintSession) ; + UMAPrClose((PMPrintSession *)&m_macPrintSession) ; #else UMAPrClose() ; #endif @@ -94,9 +94,9 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printdata) m_macPort = (GrafPtr ) m_macPrintPort ; #else #if PM_USE_SESSION_APIS - err = PMSessionBeginDocument(m_macPrintSession, - m_printData.m_macPrintSettings, - m_printData.m_macPageFormat); + err = PMSessionBeginDocument((PMPrintSession)m_macPrintSession, + (PMPrintSettings)m_printData.m_macPrintSettings, + (PMPageFormat)m_printData.m_macPageFormat); if ( err != noErr ) #else m_macPrintPort = kPMNoReference ; @@ -111,7 +111,7 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printdata) wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; dialog.ShowModal(); #if TARGET_CARBON && PM_USE_SESSION_APIS - UMAPrClose(&m_macPrintSession) ; + UMAPrClose((PMPrintSession *)&m_macPrintSession) ; #else UMAPrClose() ; #endif @@ -119,21 +119,21 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printdata) return; } // sets current port - ::GetPort( &m_macPort ) ; + ::GetPort( (GrafPtr *)&m_macPort ) ; #endif m_ok = TRUE ; m_minY = m_minX = 0 ; #if TARGET_CARBON PMRect rPaper; - err = PMGetAdjustedPaperRect(m_printData.m_macPageFormat, &rPaper); + err = PMGetAdjustedPaperRect((PMPageFormat)m_printData.m_macPageFormat, &rPaper); if ( err != noErr ) { message.Printf( "Print Error %d", err ) ; wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; dialog.ShowModal(); #if TARGET_CARBON && PM_USE_SESSION_APIS - UMAPrClose(&m_macPrintSession) ; + UMAPrClose((PMPrintSession *)&m_macPrintSession) ; #else UMAPrClose() ; #endif @@ -180,7 +180,7 @@ wxPrinterDC::~wxPrinterDC(void) if ( m_ok ) { #if PM_USE_SESSION_APIS - err = PMSessionEndDocument(m_macPrintSession); + err = PMSessionEndDocument((PMPrintSession)m_macPrintSession); #else err = PMEndDocument(m_macPrintPort); #endif @@ -191,7 +191,7 @@ wxPrinterDC::~wxPrinterDC(void) dialog.ShowModal(); } #if TARGET_CARBON && PM_USE_SESSION_APIS - UMAPrClose(&m_macPrintSession) ; + UMAPrClose((PMPrintSession *)&m_macPrintSession) ; #else UMAPrClose() ; #endif @@ -253,8 +253,8 @@ void wxPrinterDC::StartPage(void) } #else #if PM_USE_SESSION_APIS - err = PMSessionBeginPage(m_macPrintSession, - m_printData.m_macPageFormat, + err = PMSessionBeginPage((PMPrintSession)m_macPrintSession, + (PMPageFormat)m_printData.m_macPageFormat, nil); #else err = PMBeginPage(m_macPrintPort, nil); @@ -265,9 +265,9 @@ void wxPrinterDC::StartPage(void) wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; dialog.ShowModal(); #if PM_USE_SESSION_APIS - PMSessionEndPage(m_macPrintSession); - PMSessionEndDocument(m_macPrintSession); - UMAPrClose(&m_macPrintSession) ; + PMSessionEndPage((PMPrintSession)m_macPrintSession); + PMSessionEndDocument((PMPrintSession)m_macPrintSession); + UMAPrClose((PMPrintSession *)&m_macPrintSession) ; #else PMEndPage(m_macPrintPort); PMEndDocument(m_macPrintPort); @@ -302,7 +302,7 @@ void wxPrinterDC::EndPage(void) } #else #if PM_USE_SESSION_APIS - err = PMSessionEndPage(m_macPrintSession); + err = PMSessionEndPage((PMPrintSession)m_macPrintSession); #else err = PMEndPage(m_macPrintPort); #endif @@ -312,8 +312,8 @@ void wxPrinterDC::EndPage(void) wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; dialog.ShowModal(); #if PM_USE_SESSION_APIS - PMSessionEndDocument(m_macPrintSession); - UMAPrClose(&m_macPrintSession) ; + PMSessionEndDocument((PMPrintSession)m_macPrintSession); + UMAPrClose((PMPrintSession *)&m_macPrintSession) ; #else PMEndDocument(m_macPrintPort); UMAPrClose() ; diff --git a/src/mac/listbox.cpp b/src/mac/listbox.cpp index 9533882e9e..3e5ae1bc37 100644 --- a/src/mac/listbox.cpp +++ b/src/mac/listbox.cpp @@ -168,8 +168,8 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id, Size asize; - CreateListBoxControl( parent->MacGetRootWindow(), &bounds, false, 0, 1, false, true, - kwxMacListItemHeight, kwxMacListItemHeight, false, &listDef, &m_macControl ); + CreateListBoxControl( MAC_WXHWND(parent->MacGetRootWindow()), &bounds, false, 0, 1, false, true, + kwxMacListItemHeight, kwxMacListItemHeight, false, &listDef, (ControlRef *)&m_macControl ); GetControlData( (ControlHandle) m_macControl, kControlNoPart, kControlListBoxListHandleTag, sizeof(ListHandle), (Ptr) &m_macList, &asize); @@ -273,7 +273,7 @@ void wxListBox::DoSetSize(int x, int y, #if TARGET_CARBON Rect bounds ; GetControlBounds( (ControlHandle) m_macControl , &bounds ) ; - ControlRef control = GetListVerticalScrollBar( m_macList ) ; + ControlRef control = GetListVerticalScrollBar( (ListHandle)m_macList ) ; if ( control ) { Rect scrollbounds ; @@ -737,7 +737,7 @@ void wxListBox::OnSize( const wxSizeEvent &event) Point pt; #if TARGET_CARBON - GetListCellSize(m_macList, &pt); + GetListCellSize((ListHandle)m_macList, &pt); #else pt = (**(ListHandle)m_macList).cellSize ; #endif diff --git a/src/mac/printdlg.cpp b/src/mac/printdlg.cpp index 38c128ac21..5fd25c56da 100644 --- a/src/mac/printdlg.cpp +++ b/src/mac/printdlg.cpp @@ -95,86 +95,86 @@ int wxPrintDialog::ShowModal() PMPrintSession macPrintSession = kPMNoReference; Boolean accepted; - err = ::UMAPrOpen(&macPrintSession) ; - if ( err == noErr ) - { - m_printDialogData.ConvertToNative() ; - - // Set up a valid PageFormat object. - if (m_printDialogData.GetPrintData().m_macPageFormat == kPMNoPageFormat) - { - err = PMCreatePageFormat(&m_printDialogData.GetPrintData().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_printDialogData.GetPrintData().m_macPageFormat != kPMNoPageFormat)) - { - err = PMSessionDefaultPageFormat(macPrintSession, - m_printDialogData.GetPrintData().m_macPageFormat); - } - } - else - { - err = PMSessionValidatePageFormat(macPrintSession, - m_printDialogData.GetPrintData().m_macPageFormat, - kPMDontWantBoolean); - } + err = ::UMAPrOpen(&macPrintSession) ; + if ( err == noErr ) + { + m_printDialogData.ConvertToNative() ; + + // Set up a valid PageFormat object. + if (m_printDialogData.GetPrintData().m_macPageFormat == kPMNoPageFormat) + { + err = PMCreatePageFormat((PMPageFormat *)&m_printDialogData.GetPrintData().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_printDialogData.GetPrintData().m_macPageFormat != kPMNoPageFormat)) + { + err = PMSessionDefaultPageFormat((PMPrintSession)macPrintSession, + (PMPageFormat)m_printDialogData.GetPrintData().m_macPageFormat); + } + } + else + { + err = PMSessionValidatePageFormat((PMPrintSession)macPrintSession, + (PMPageFormat)m_printDialogData.GetPrintData().m_macPageFormat, + kPMDontWantBoolean); + } - // Set up a valid PrintSettings object. - if (m_printDialogData.GetPrintData().m_macPrintSettings == kPMNoPrintSettings) - { - err = PMCreatePrintSettings(&m_printDialogData.GetPrintData().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_printDialogData.GetPrintData().m_macPrintSettings != kPMNoPrintSettings)) - { - err = PMSessionDefaultPrintSettings(macPrintSession, - m_printDialogData.GetPrintData().m_macPrintSettings); - } - } - else - { - err = PMSessionValidatePrintSettings(macPrintSession, - m_printDialogData.GetPrintData().m_macPrintSettings, - kPMDontWantBoolean); - } - // Set a valid page range before displaying the Print dialog - if (err == noErr) - { - // err = PMSetPageRange(m_printDialogData.GetPrintData().m_macPrintSettings, - // minPage, maxPage); - } - - // Display the Print dialog. - if (err == noErr) - { - err = PMSessionPrintDialog(macPrintSession, - m_printDialogData.GetPrintData().m_macPrintSettings, - m_printDialogData.GetPrintData().m_macPageFormat, - &accepted); - if ((err == noErr) && !accepted) - { - err = kPMCancel; // user clicked Cancel button - } - } - if ( err == noErr ) - { - m_printDialogData.ConvertFromNative() ; - result = wxID_OK ; - } - } - if ((err != noErr) && (err != kPMCancel)) - { - message.Printf( "Print Error %d", err ) ; - wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; - dialog.ShowModal(); - } - ::UMAPrClose(&macPrintSession) ; + // Set up a valid PrintSettings object. + if (m_printDialogData.GetPrintData().m_macPrintSettings == kPMNoPrintSettings) + { + err = PMCreatePrintSettings((PMPrintSettings *)&m_printDialogData.GetPrintData().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_printDialogData.GetPrintData().m_macPrintSettings != kPMNoPrintSettings)) + { + err = PMSessionDefaultPrintSettings((PMPrintSession)macPrintSession, + (PMPrintSettings)m_printDialogData.GetPrintData().m_macPrintSettings); + } + } + else + { + err = PMSessionValidatePrintSettings((PMPrintSession)macPrintSession, + (PMPrintSettings)m_printDialogData.GetPrintData().m_macPrintSettings, + kPMDontWantBoolean); + } + // Set a valid page range before displaying the Print dialog + if (err == noErr) + { + // err = PMSetPageRange(m_printDialogData.GetPrintData().m_macPrintSettings, + // minPage, maxPage); + } + + // Display the Print dialog. + if (err == noErr) + { + err = PMSessionPrintDialog((PMPrintSession)macPrintSession, + (PMPrintSettings)m_printDialogData.GetPrintData().m_macPrintSettings, + (PMPageFormat)m_printDialogData.GetPrintData().m_macPageFormat, + &accepted); + if ((err == noErr) && !accepted) + { + err = kPMCancel; // user clicked Cancel button + } + } + if ( err == noErr ) + { + m_printDialogData.ConvertFromNative() ; + result = wxID_OK ; + } + } + if ((err != noErr) && (err != kPMCancel)) + { + message.Printf( "Print Error %d", err ) ; + wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; + dialog.ShowModal(); + } + ::UMAPrClose(&macPrintSession) ; #else #pragma warning "TODO: Printing for carbon without session apis" #endif @@ -247,60 +247,60 @@ int wxPageSetupDialog::ShowModal() PMPrintSession macPrintSession = kPMNoReference; Boolean accepted; - err = ::UMAPrOpen(&macPrintSession) ; - if ( err == noErr ) - { - m_pageSetupData.ConvertToNative() ; - - // Set up a valid PageFormat object. - if (m_pageSetupData.GetPrintData().m_macPageFormat == kPMNoPageFormat) - { - err = PMCreatePageFormat(&m_pageSetupData.GetPrintData().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_pageSetupData.GetPrintData().m_macPageFormat != kPMNoPageFormat)) - { - err = PMSessionDefaultPageFormat(macPrintSession, - m_pageSetupData.GetPrintData().m_macPageFormat); - } - } - else - { - err = PMSessionValidatePageFormat(macPrintSession, - m_pageSetupData.GetPrintData().m_macPageFormat, - kPMDontWantBoolean); - } - - // Display the Page Setup dialog. - if (err == noErr) - { - err = PMSessionPageSetupDialog(macPrintSession, - m_pageSetupData.GetPrintData().m_macPageFormat, - &accepted); - if ((err == noErr) && !accepted) - { - err = kPMCancel; // user clicked Cancel button - } - } - - // If the user did not cancel, flatten and save the PageFormat object - // with our document. - if (err == noErr) { - // err = FlattenAndSavePageFormat(m_pageSetupData.GetPrintData().m_macPageFormat); - m_pageSetupData.ConvertFromNative() ; - result = wxID_OK ; - } - } - if ((err != noErr) && (err != kPMCancel)) - { - message.Printf( "Print Error %d", err ) ; - wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; - dialog.ShowModal(); - } - ::UMAPrClose(&macPrintSession) ; + err = ::UMAPrOpen(&macPrintSession) ; + if ( err == noErr ) + { + m_pageSetupData.ConvertToNative() ; + + // Set up a valid PageFormat object. + if (m_pageSetupData.GetPrintData().m_macPageFormat == kPMNoPageFormat) + { + err = PMCreatePageFormat((PMPageFormat *)&m_pageSetupData.GetPrintData().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_pageSetupData.GetPrintData().m_macPageFormat != kPMNoPageFormat)) + { + err = PMSessionDefaultPageFormat((PMPrintSession)macPrintSession, + (PMPageFormat)m_pageSetupData.GetPrintData().m_macPageFormat); + } + } + else + { + err = PMSessionValidatePageFormat((PMPrintSession)macPrintSession, + (PMPageFormat)m_pageSetupData.GetPrintData().m_macPageFormat, + kPMDontWantBoolean); + } + + // Display the Page Setup dialog. + if (err == noErr) + { + err = PMSessionPageSetupDialog((PMPrintSession)macPrintSession, + (PMPageFormat)m_pageSetupData.GetPrintData().m_macPageFormat, + &accepted); + if ((err == noErr) && !accepted) + { + err = kPMCancel; // user clicked Cancel button + } + } + + // If the user did not cancel, flatten and save the PageFormat object + // with our document. + if (err == noErr) { + // err = FlattenAndSavePageFormat(m_pageSetupData.GetPrintData().m_macPageFormat); + m_pageSetupData.ConvertFromNative() ; + result = wxID_OK ; + } + } + if ((err != noErr) && (err != kPMCancel)) + { + message.Printf( "Print Error %d", err ) ; + wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; + dialog.ShowModal(); + } + ::UMAPrClose(&macPrintSession) ; #else #pragma warning "TODO: Printing for carbon without session apis" #endif -- 2.45.2