1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxPrinterDC class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "dcprint.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
26 #include "wx/dcprint.h"
28 #include "wx/mac/uma.h"
31 #if !USE_SHARED_LIBRARY
32 IMPLEMENT_CLASS(wxPrinterDC
, wxDC
)
35 GrafPtr macPrintFormerPort
= NULL
;
37 wxPrinterDC::wxPrinterDC(const wxPrintData
& printdata
)
43 m_printData
= printdata
;
44 m_printData
.ConvertToNative() ;
50 message
.Printf( "Print Error %d", err
) ;
51 wxMessageDialog
dialog( NULL
, message
, "", wxICON_HAND
| wxOK
) ;
55 if ( ::PrValidate( m_printData
.m_macPrintInfo
) )
57 ::PrStlDialog( m_printData
.m_macPrintInfo
) ;
58 // the driver has changed in the mean time, should we pop up a page setup dialog ?
63 message
.Printf( "Print Error %d", err
) ;
64 wxMessageDialog
dialog( NULL
, message
, "", wxICON_HAND
| wxOK
) ;
67 ::GetPort( &macPrintFormerPort
) ;
68 m_macPrintPort
= ::PrOpenDoc( m_printData
.m_macPrintInfo
, NULL
, NULL
) ;
72 message
.Printf( "Print Error %d", err
) ;
73 wxMessageDialog
dialog( NULL
, message
, "", wxICON_HAND
| wxOK
) ;
77 m_macPort
= (GrafPtr
) m_macPrintPort
;
80 m_maxX
= (**m_printData
.m_macPrintInfo
).rPaper
.right
- (**m_printData
.m_macPrintInfo
).rPaper
.left
;
81 m_maxY
= (**m_printData
.m_macPrintInfo
).rPaper
.bottom
- (**m_printData
.m_macPrintInfo
).rPaper
.top
;
83 #pragma warning "TODO:printing support for carbon"
87 wxPrinterDC::~wxPrinterDC(void)
95 ::PrCloseDoc( m_macPrintPort
) ;
100 if ( (**m_printData
.m_macPrintInfo
).prJob
.bJDocLoop
== bSpoolLoop
)
103 ::PrPicFile( m_printData
.m_macPrintInfo
, NULL
, NULL
, NULL
, &status
) ;
108 message
.Printf( "Print Error %d", err
) ;
109 wxMessageDialog
dialog( NULL
, message
, "", wxICON_HAND
| wxOK
) ;
113 // ::SetPort( macPrintFormerPort ) ;
114 ::SetPort( LMGetWMgrPort() ) ;
115 m_macPortHelper
.Clear() ;
118 #pragma warning "TODO:printing support for carbon"
122 bool wxPrinterDC::StartDoc( const wxString
& WXUNUSED(message
) )
127 void wxPrinterDC::EndDoc(void)
131 void wxPrinterDC::StartPage(void)
137 m_logicalFunction
= wxCOPY
;
138 // m_textAlignment = wxALIGN_TOP_LEFT;
139 m_backgroundMode
= wxTRANSPARENT
;
141 m_textForegroundColour
= *wxBLACK
;
142 m_textBackgroundColour
= *wxWHITE
;
143 m_pen
= *wxBLACK_PEN
;
144 m_font
= *wxNORMAL_FONT
;
145 m_brush
= *wxTRANSPARENT_BRUSH
;
146 m_backgroundBrush
= *wxWHITE_BRUSH
;
148 m_macFontInstalled
= false ;
149 m_macBrushInstalled
= false ;
150 m_macPenInstalled
= false ;
156 PrOpenPage( m_macPrintPort
, NULL
) ;
157 SetOrigin( - (**m_printData
.m_macPrintInfo
).rPaper
.left
, - (**m_printData
.m_macPrintInfo
).rPaper
.top
) ;
158 Rect clip
= { -32000 , -32000 , 32000 , 32000 } ;
159 ::ClipRect( &clip
) ;
163 message
.Printf( "Print Error %d", err
) ;
164 wxMessageDialog
dialog( NULL
, message
, "", wxICON_HAND
| wxOK
) ;
165 ::PrClosePage( m_macPrintPort
) ;
166 ::PrCloseDoc( m_macPrintPort
) ;
168 ::SetPort( macPrintFormerPort
) ;
172 #pragma warning "TODO:printing support for carbon"
176 void wxPrinterDC::EndPage(void)
185 PrClosePage( (TPrPort
*) m_macPort
) ;
189 message
.Printf( "Print Error %d", err
) ;
190 wxMessageDialog
dialog( NULL
, message
, "", wxICON_HAND
| wxOK
) ;
191 ::PrCloseDoc( m_macPrintPort
) ;
193 ::SetPort( macPrintFormerPort
) ;
197 #pragma warning "TODO:printing support for carbon"