]>
Commit | Line | Data |
---|---|---|
ff910433 RR |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: gnomeprint.cpp | |
3 | // Author: XX | |
4 | // Created: XX/XX/XX | |
5 | // Copyright: XX | |
6 | ///////////////////////////////////////////////////////////////////////////// | |
7 | ||
8 | #ifdef __GNUG__ | |
9 | #pragma implementation "gprint.cpp" | |
10 | #endif | |
11 | ||
12 | // For compilers that support precompilation, includes "wx/wx.h". | |
13 | #include "wx/wxprec.h" | |
14 | ||
15 | #ifdef __BORLANDC__ | |
16 | #pragma hdrstop | |
17 | #endif | |
18 | ||
19 | #include "gprint.h" | |
20 | #include "wx/fontutil.h" | |
21 | #include "wx/printdlg.h" | |
22 | #include "wx/gtk/private.h" | |
23 | ||
24 | #include <libgnomeprint/gnome-print.h> | |
25 | #include <libgnomeprint/gnome-print-pango.h> | |
26 | #include <libgnomeprintui/gnome-print-dialog.h> | |
27 | ||
28 | //---------------------------------------------------------------------------- | |
29 | // wxGnomePrintNativeData | |
30 | //---------------------------------------------------------------------------- | |
31 | ||
32 | IMPLEMENT_CLASS(wxGnomePrintNativeData, wxPrintNativeDataBase) | |
33 | ||
34 | wxGnomePrintNativeData::wxGnomePrintNativeData() | |
35 | { | |
36 | m_config = gnome_print_config_default(); | |
37 | m_job = gnome_print_job_new( m_config ); | |
38 | } | |
39 | ||
40 | wxGnomePrintNativeData::~wxGnomePrintNativeData() | |
41 | { | |
42 | g_object_unref (G_OBJECT (m_config)); | |
43 | g_object_unref (G_OBJECT (m_job)); | |
44 | } | |
45 | ||
46 | bool wxGnomePrintNativeData::TransferTo( wxPrintData &data ) | |
47 | { | |
48 | // TODO | |
49 | return true; | |
50 | } | |
51 | ||
52 | bool wxGnomePrintNativeData::TransferFrom( const wxPrintData &data ) | |
53 | { | |
54 | // TODO | |
55 | return true; | |
56 | } | |
57 | ||
58 | //---------------------------------------------------------------------------- | |
59 | // wxGnomePrintFactory | |
60 | //---------------------------------------------------------------------------- | |
61 | ||
62 | wxPrinterBase* wxGnomePrintFactory::CreatePrinter( wxPrintDialogData *data ) | |
63 | { | |
64 | return new wxGnomePrinter( data ); | |
65 | } | |
66 | ||
67 | wxPrintPreviewBase *wxGnomePrintFactory::CreatePrintPreview( wxPrintout *preview, | |
68 | wxPrintout *printout, | |
69 | wxPrintDialogData *data ) | |
70 | { | |
71 | return new wxPostScriptPrintPreview( preview, printout, data ); | |
72 | } | |
73 | ||
74 | wxPrintPreviewBase *wxGnomePrintFactory::CreatePrintPreview( wxPrintout *preview, | |
75 | wxPrintout *printout, | |
76 | wxPrintData *data ) | |
77 | { | |
78 | return new wxPostScriptPrintPreview( preview, printout, data ); | |
79 | } | |
80 | ||
81 | wxPrintDialogBase *wxGnomePrintFactory::CreatePrintDialog( wxWindow *parent, | |
82 | wxPrintDialogData *data ) | |
83 | { | |
84 | return new wxGenericPrintDialog( parent, data ); | |
85 | } | |
86 | ||
87 | wxPrintDialogBase *wxGnomePrintFactory::CreatePrintDialog( wxWindow *parent, | |
88 | wxPrintData *data ) | |
89 | { | |
90 | return new wxGenericPrintDialog( parent, data ); | |
91 | } | |
92 | ||
93 | bool wxGnomePrintFactory::HasPrintSetupDialog() | |
94 | { | |
95 | return true; | |
96 | } | |
97 | ||
98 | wxDialog *wxGnomePrintFactory::CreatePrintSetupDialog( wxWindow *parent, wxPrintData *data ) | |
99 | { | |
100 | return new wxGnomePrintSetupDialog( parent, data ); | |
101 | } | |
102 | ||
103 | bool wxGnomePrintFactory::HasOwnPrintToFile() | |
104 | { | |
105 | return true; | |
106 | } | |
107 | ||
108 | bool wxGnomePrintFactory::HasPrinterLine() | |
109 | { | |
110 | return true; | |
111 | } | |
112 | ||
113 | wxString wxGnomePrintFactory::CreatePrinterLine() | |
114 | { | |
115 | // We should query "gnome_config_default" here | |
116 | return _("GNOME print"); | |
117 | } | |
118 | ||
119 | bool wxGnomePrintFactory::HasStatusLine() | |
120 | { | |
121 | return true; | |
122 | } | |
123 | ||
124 | wxString wxGnomePrintFactory::CreateStatusLine() | |
125 | { | |
126 | // We should query "gnome_config_default" here | |
127 | return _("Ready"); | |
128 | } | |
129 | ||
130 | wxPrintNativeDataBase *wxGnomePrintFactory::CreatePrintNativeData() | |
131 | { | |
132 | return new wxGnomePrintNativeData; | |
133 | } | |
134 | ||
135 | //---------------------------------------------------------------------------- | |
136 | // wxGnomePrintSetupDialog | |
137 | //---------------------------------------------------------------------------- | |
138 | ||
139 | IMPLEMENT_CLASS(wxGnomePrintSetupDialog, wxDialog) | |
140 | ||
141 | wxGnomePrintSetupDialog::wxGnomePrintSetupDialog( wxWindow *parent, wxPrintData *data ) | |
142 | { | |
143 | wxGnomePrintNativeData *native = | |
144 | (wxGnomePrintNativeData*) data->GetNativeData(); | |
145 | ||
146 | m_widget = gnome_print_dialog_new (native->GetPrintJob(), (guchar*)"Print setup", 0); | |
147 | } | |
148 | ||
149 | wxGnomePrintSetupDialog::~wxGnomePrintSetupDialog() | |
150 | { | |
151 | m_widget = NULL; | |
152 | } | |
153 | ||
154 | int wxGnomePrintSetupDialog::ShowModal() | |
155 | { | |
156 | int response = gtk_dialog_run (GTK_DIALOG (m_widget)); | |
157 | gtk_widget_destroy(m_widget); | |
158 | m_widget = NULL; | |
159 | ||
160 | if (response == GNOME_PRINT_DIALOG_RESPONSE_CANCEL) | |
161 | return wxID_CANCEL; | |
162 | ||
163 | return wxID_OK; | |
164 | } | |
165 | ||
166 | bool wxGnomePrintSetupDialog::Validate() | |
167 | { | |
168 | return true; | |
169 | } | |
170 | ||
171 | bool wxGnomePrintSetupDialog::TransferDataToWindow() | |
172 | { | |
173 | return true; | |
174 | } | |
175 | ||
176 | bool wxGnomePrintSetupDialog::TransferDataFromWindow() | |
177 | { | |
178 | return true; | |
179 | } | |
180 | ||
181 | ||
182 | //---------------------------------------------------------------------------- | |
183 | // wxGnomePrinter | |
184 | //---------------------------------------------------------------------------- | |
185 | ||
186 | IMPLEMENT_CLASS(wxGnomePrinter, wxPrinterBase) | |
187 | ||
188 | wxGnomePrinter::wxGnomePrinter( wxPrintDialogData *data ) : | |
189 | wxPrinterBase( data ) | |
190 | { | |
191 | m_gpc = NULL; | |
192 | } | |
193 | ||
194 | wxGnomePrinter::~wxGnomePrinter() | |
195 | { | |
196 | } | |
197 | ||
198 | bool wxGnomePrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt ) | |
199 | { | |
200 | if (!printout) | |
201 | { | |
202 | sm_lastError = wxPRINTER_ERROR; | |
203 | return false; | |
204 | } | |
205 | ||
206 | wxPrintData printdata = GetPrintDialogData().GetPrintData(); | |
207 | wxGnomePrintNativeData *data = | |
208 | (wxGnomePrintNativeData*) printdata.GetNativeData(); | |
209 | ||
210 | GnomePrintJob *job = data->GetPrintJob(); | |
211 | m_gpc = gnome_print_job_get_context (job); | |
212 | ||
213 | wxDC *dc; | |
214 | ||
215 | if (prompt) | |
216 | dc = PrintDialog( parent ); | |
217 | else | |
218 | dc = new wxGnomePrintDC( this ); | |
219 | ||
220 | if (!dc) | |
221 | { | |
222 | gnome_print_job_close( job ); | |
223 | return false; | |
224 | } | |
225 | ||
226 | printout->SetDC(dc); | |
227 | ||
228 | printout->OnPreparePrinting(); | |
229 | printout->OnBeginPrinting(); | |
230 | ||
231 | if (!printout->OnBeginDocument(0, 0)) | |
232 | { | |
233 | sm_lastError = wxPRINTER_ERROR; | |
234 | } | |
235 | else | |
236 | { | |
237 | int pn; | |
238 | for (pn = 1; pn <= 2; pn++) | |
239 | { | |
240 | dc->StartPage(); | |
241 | printout->OnPrintPage(pn); | |
242 | dc->EndPage(); | |
243 | } | |
244 | ||
245 | printout->OnEndDocument(); | |
246 | printout->OnEndPrinting(); | |
247 | } | |
248 | ||
249 | gnome_print_job_close( job ); | |
250 | gnome_print_job_print( job ); | |
251 | ||
252 | delete dc; | |
253 | ||
254 | return (sm_lastError == wxPRINTER_NO_ERROR); | |
255 | } | |
256 | ||
257 | wxDC* wxGnomePrinter::PrintDialog( wxWindow *parent ) | |
258 | { | |
259 | wxPrintDialog dialog( parent, &m_printDialogData ); | |
260 | if (dialog.ShowModal() == wxID_CANCEL) | |
261 | { | |
262 | sm_lastError = wxPRINTER_ERROR; | |
263 | return NULL; | |
264 | } | |
265 | ||
266 | return new wxGnomePrintDC( this ); | |
267 | } | |
268 | ||
269 | bool wxGnomePrinter::Setup( wxWindow *parent ) | |
270 | { | |
271 | } | |
272 | ||
273 | //----------------------------------------------------------------------------- | |
274 | // wxGnomePrintDC | |
275 | //----------------------------------------------------------------------------- | |
276 | ||
277 | IMPLEMENT_CLASS(wxGnomePrintDC, wxDCBase) | |
278 | ||
279 | wxGnomePrintDC::wxGnomePrintDC( wxGnomePrinter *printer ) | |
280 | { | |
281 | m_printer = printer; | |
282 | ||
283 | m_gpc = printer->GetPrintContext(); | |
284 | ||
285 | m_layout = gnome_print_pango_create_layout( m_gpc ); | |
286 | m_fontdesc = pango_font_description_from_string( "Sans 12" ); | |
287 | ||
288 | m_currentRed = 0; | |
289 | m_currentBlue = 0; | |
290 | m_currentGreen = 0; | |
291 | ||
292 | m_signX = 1; // default x-axis left to right | |
293 | m_signY = -1; // default y-axis bottom up -> top down | |
294 | } | |
295 | ||
296 | wxGnomePrintDC::~wxGnomePrintDC() | |
297 | { | |
298 | } | |
299 | ||
300 | bool wxGnomePrintDC::Ok() const | |
301 | { | |
302 | return true; | |
303 | } | |
304 | ||
305 | bool wxGnomePrintDC::DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style ) | |
306 | { | |
307 | return false; | |
308 | } | |
309 | ||
310 | bool wxGnomePrintDC::DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const | |
311 | { | |
312 | return false; | |
313 | } | |
314 | ||
315 | void wxGnomePrintDC::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) | |
316 | { | |
317 | if (m_pen.GetStyle() == wxTRANSPARENT) return; | |
318 | ||
319 | SetPen( m_pen ); | |
320 | ||
321 | gnome_print_moveto ( m_gpc, XDEV2LOG(x1), YDEV2LOG(y1) ); | |
322 | gnome_print_lineto ( m_gpc, XDEV2LOG(x2), YDEV2LOG(y2) ); | |
323 | gnome_print_stroke ( m_gpc); | |
324 | ||
325 | CalcBoundingBox( x1, y1 ); | |
326 | CalcBoundingBox( x2, y2 ); | |
327 | } | |
328 | ||
329 | void wxGnomePrintDC::DoCrossHair(wxCoord x, wxCoord y) | |
330 | { | |
331 | } | |
332 | ||
333 | void wxGnomePrintDC::DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc) | |
334 | { | |
335 | } | |
336 | ||
337 | void wxGnomePrintDC::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea) | |
338 | { | |
339 | } | |
340 | ||
341 | void wxGnomePrintDC::DoDrawPoint(wxCoord x, wxCoord y) | |
342 | { | |
343 | } | |
344 | ||
345 | void wxGnomePrintDC::DoDrawLines(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset) | |
346 | { | |
347 | } | |
348 | ||
349 | void wxGnomePrintDC::DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset, int fillStyle) | |
350 | { | |
351 | } | |
352 | ||
353 | void wxGnomePrintDC::DoDrawPolyPolygon(int n, int count[], wxPoint points[], wxCoord xoffset, wxCoord yoffset, int fillStyle) | |
354 | { | |
355 | } | |
356 | ||
357 | void wxGnomePrintDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) | |
358 | { | |
359 | if (m_brush.GetStyle () != wxTRANSPARENT) | |
360 | { | |
361 | SetBrush( m_brush ); | |
362 | ||
363 | gnome_print_newpath( m_gpc ); | |
364 | gnome_print_moveto( m_gpc, XLOG2DEV(x), YLOG2DEV(y) ); | |
365 | gnome_print_lineto( m_gpc, XLOG2DEV(x + width), YLOG2DEV(y) ); | |
366 | gnome_print_lineto( m_gpc, XLOG2DEV(x + width), YLOG2DEV(y + height) ); | |
367 | gnome_print_lineto( m_gpc, XLOG2DEV(x), YLOG2DEV(y + height) ); | |
368 | gnome_print_closepath( m_gpc ); | |
369 | gnome_print_fill( m_gpc ); | |
370 | ||
371 | CalcBoundingBox( x, y ); | |
372 | CalcBoundingBox( x + width, y + height ); | |
373 | } | |
374 | ||
375 | if (m_pen.GetStyle () != wxTRANSPARENT) | |
376 | { | |
377 | SetPen (m_pen); | |
378 | ||
379 | gnome_print_newpath( m_gpc ); | |
380 | gnome_print_moveto( m_gpc, XLOG2DEV(x), YLOG2DEV(y) ); | |
381 | gnome_print_lineto( m_gpc, XLOG2DEV(x + width), YLOG2DEV(y) ); | |
382 | gnome_print_lineto( m_gpc, XLOG2DEV(x + width), YLOG2DEV(y + height) ); | |
383 | gnome_print_lineto( m_gpc, XLOG2DEV(x), YLOG2DEV(y + height) ); | |
384 | gnome_print_closepath( m_gpc ); | |
385 | gnome_print_stroke( m_gpc ); | |
386 | ||
387 | CalcBoundingBox( x, y ); | |
388 | CalcBoundingBox( x + width, y + height ); | |
389 | } | |
390 | } | |
391 | ||
392 | void wxGnomePrintDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius) | |
393 | { | |
394 | } | |
395 | ||
396 | void wxGnomePrintDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height) | |
397 | { | |
398 | } | |
399 | ||
400 | void wxGnomePrintDC::DoDrawSpline(wxList *points) | |
401 | { | |
402 | } | |
403 | ||
404 | bool wxGnomePrintDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, | |
405 | wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop, bool useMask, | |
406 | wxCoord xsrcMask, wxCoord ysrcMask) | |
407 | { | |
408 | return false; | |
409 | } | |
410 | ||
411 | void wxGnomePrintDC::DoDrawIcon( const wxIcon& icon, wxCoord x, wxCoord y ) | |
412 | { | |
413 | } | |
414 | ||
415 | void wxGnomePrintDC::DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask ) | |
416 | { | |
417 | } | |
418 | ||
419 | void wxGnomePrintDC::DoDrawText(const wxString& text, wxCoord x, wxCoord y ) | |
420 | { | |
421 | if (m_textForegroundColour.Ok()) | |
422 | { | |
423 | unsigned char red = m_textForegroundColour.Red(); | |
424 | unsigned char blue = m_textForegroundColour.Blue(); | |
425 | unsigned char green = m_textForegroundColour.Green(); | |
426 | ||
427 | if (!(red == m_currentRed && green == m_currentGreen && blue == m_currentBlue)) | |
428 | { | |
429 | double redPS = (double)(red) / 255.0; | |
430 | double bluePS = (double)(blue) / 255.0; | |
431 | double greenPS = (double)(green) / 255.0; | |
432 | ||
433 | gnome_print_setrgbcolor( m_gpc, redPS, bluePS, greenPS ); | |
434 | ||
435 | m_currentRed = red; | |
436 | m_currentBlue = blue; | |
437 | m_currentGreen = green; | |
438 | } | |
439 | } | |
440 | ||
441 | x = XLOG2DEV(x); | |
442 | y = YLOG2DEV(y); | |
443 | ||
444 | wxPrintf( wxT("x,y: %d,%d\n"), x, y ); | |
445 | ||
446 | bool underlined = m_font.Ok() && m_font.GetUnderlined(); | |
447 | ||
448 | #if wxUSE_UNICODE | |
449 | const wxCharBuffer data = wxConvUTF8.cWC2MB( text ); | |
450 | #else | |
451 | const wxWCharBuffer wdata = wxConvLocal.cMB2WC( text ); | |
452 | if ( !wdata ) | |
453 | return; | |
454 | const wxCharBuffer data = wxConvUTF8.cWC2MB( wdata ); | |
455 | #endif | |
456 | ||
457 | size_t datalen = strlen((const char*)data); | |
458 | pango_layout_set_text( m_layout, (const char*) data, datalen); | |
459 | ||
460 | if (underlined) | |
461 | { | |
462 | PangoAttrList *attrs = pango_attr_list_new(); | |
463 | PangoAttribute *a = pango_attr_underline_new(PANGO_UNDERLINE_SINGLE); | |
464 | a->start_index = 0; | |
465 | a->end_index = datalen; | |
466 | pango_attr_list_insert(attrs, a); | |
467 | pango_layout_set_attributes(m_layout, attrs); | |
468 | pango_attr_list_unref(attrs); | |
469 | } | |
470 | ||
471 | gnome_print_moveto (m_gpc, x, y); | |
472 | gnome_print_pango_layout( m_gpc, m_layout ); | |
473 | ||
474 | if (underlined) | |
475 | { | |
476 | // undo underline attributes setting: | |
477 | pango_layout_set_attributes(m_layout, NULL); | |
478 | } | |
479 | ||
480 | // CalcBoundingBox (x + width, y + height); | |
481 | CalcBoundingBox (x, y); | |
482 | } | |
483 | ||
484 | void wxGnomePrintDC::DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle) | |
485 | { | |
486 | } | |
487 | ||
488 | void wxGnomePrintDC::Clear() | |
489 | { | |
490 | } | |
491 | ||
492 | void wxGnomePrintDC::SetFont( const wxFont& font ) | |
493 | { | |
494 | m_font = font; | |
495 | ||
496 | if (m_font.Ok()) | |
497 | { | |
498 | if (m_fontdesc) | |
499 | pango_font_description_free( m_fontdesc ); | |
500 | ||
501 | m_fontdesc = pango_font_description_copy( m_font.GetNativeFontInfo()->description ); | |
502 | ||
503 | pango_layout_set_font_description( m_layout, m_fontdesc ); | |
504 | } | |
505 | } | |
506 | ||
507 | void wxGnomePrintDC::SetPen( const wxPen& pen ) | |
508 | { | |
509 | if (!pen.Ok()) return; | |
510 | ||
511 | int oldStyle = m_pen.GetStyle(); | |
512 | ||
513 | m_pen = pen; | |
514 | ||
515 | gnome_print_setlinewidth( m_gpc, XLOG2DEVREL( 1000 * m_pen.GetWidth() ) / 1000.0f ); | |
516 | ||
517 | unsigned char red = m_pen.GetColour().Red(); | |
518 | unsigned char blue = m_pen.GetColour().Blue(); | |
519 | unsigned char green = m_pen.GetColour().Green(); | |
520 | ||
521 | if (!(red == m_currentRed && green == m_currentGreen && blue == m_currentBlue)) | |
522 | { | |
523 | double redPS = (double)(red) / 255.0; | |
524 | double bluePS = (double)(blue) / 255.0; | |
525 | double greenPS = (double)(green) / 255.0; | |
526 | ||
527 | gnome_print_setrgbcolor( m_gpc, redPS, bluePS, greenPS ); | |
528 | ||
529 | m_currentRed = red; | |
530 | m_currentBlue = blue; | |
531 | m_currentGreen = green; | |
532 | } | |
533 | } | |
534 | ||
535 | void wxGnomePrintDC::SetBrush( const wxBrush& brush ) | |
536 | { | |
537 | } | |
538 | ||
539 | void wxGnomePrintDC::SetLogicalFunction( int function ) | |
540 | { | |
541 | } | |
542 | ||
543 | void wxGnomePrintDC::SetBackground( const wxBrush& brush ) | |
544 | { | |
545 | } | |
546 | ||
547 | void wxGnomePrintDC::DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height) | |
548 | { | |
549 | } | |
550 | ||
551 | void wxGnomePrintDC::DestroyClippingRegion() | |
552 | { | |
553 | } | |
554 | ||
555 | bool wxGnomePrintDC::StartDoc(const wxString& message) | |
556 | { | |
557 | SetDeviceOrigin( 0,0 ); | |
558 | ||
559 | return true; | |
560 | } | |
561 | ||
562 | void wxGnomePrintDC::EndDoc() | |
563 | { | |
564 | } | |
565 | ||
566 | void wxGnomePrintDC::StartPage() | |
567 | { | |
568 | gnome_print_beginpage( m_gpc, (const guchar*) "1" ); | |
569 | } | |
570 | ||
571 | void wxGnomePrintDC::EndPage() | |
572 | { | |
573 | gnome_print_showpage( m_gpc ); | |
574 | } | |
575 | ||
576 | wxCoord wxGnomePrintDC::GetCharHeight() const | |
577 | { | |
578 | return 0; | |
579 | } | |
580 | ||
581 | wxCoord wxGnomePrintDC::GetCharWidth() const | |
582 | { | |
583 | return 0; | |
584 | } | |
585 | ||
586 | void wxGnomePrintDC::DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y, | |
587 | wxCoord *descent, | |
588 | wxCoord *externalLeading, | |
589 | wxFont *theFont ) const | |
590 | { | |
591 | } | |
592 | ||
593 | void wxGnomePrintDC::DoGetSize(int* width, int* height) const | |
594 | { | |
595 | // No idea if that is efficient | |
596 | GnomePrintConfig *config = gnome_print_config_default(); | |
597 | ||
598 | double w,h; | |
599 | bool result = gnome_print_config_get_page_size( config, &w, &h ); | |
600 | ||
601 | if (!result) | |
602 | { | |
603 | // Standard PS resolution DIN A4 size. | |
604 | w = 595.0; | |
605 | h = 842.0; | |
606 | } | |
607 | ||
608 | if (width) | |
609 | *width = (int) w; | |
610 | if (height) | |
611 | *height = (int) h; | |
612 | ||
613 | wxPrintf( wxT("size %d,%d\n"), *width, *height ); | |
614 | } | |
615 | ||
616 | void wxGnomePrintDC::DoGetSizeMM(int *width, int *height) const | |
617 | { | |
618 | double w,h; | |
619 | ||
620 | /// Later, for now DIN A4 | |
621 | w = 210.0; | |
622 | h = 297.0; | |
623 | ||
624 | if (width) | |
625 | *width = (int) w; | |
626 | if (height) | |
627 | *height = (int) h; | |
628 | } | |
629 | ||
630 | wxSize wxGnomePrintDC::GetPPI() const | |
631 | { | |
632 | return wxSize(72,72); | |
633 | } | |
634 | ||
635 | void wxGnomePrintDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp ) | |
636 | { | |
637 | m_signX = (xLeftRight ? 1 : -1); | |
638 | m_signY = (yBottomUp ? 1 : -1); | |
639 | ||
640 | ComputeScaleAndOrigin(); | |
641 | } | |
642 | ||
643 | void wxGnomePrintDC::SetDeviceOrigin( wxCoord x, wxCoord y ) | |
644 | { | |
645 | int h = 0; | |
646 | int w = 0; | |
647 | GetSize( &w, &h ); | |
648 | ||
649 | wxDC::SetDeviceOrigin( x, h-y ); | |
650 | } | |
651 | ||
652 | void wxGnomePrintDC::SetResolution(int ppi) | |
653 | { | |
654 | } | |
655 | ||
656 | int wxGnomePrintDC::GetResolution() | |
657 | { | |
658 | return 72; | |
659 | } |