some very minor fixes (I don't even remember what exactly)
[wxWidgets.git] / src / generic / prntdlgg.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: prntdlgg.cpp
3 // Purpose: Generic print dialogs
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 04/01/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 #pragma implementation "prntdlgg.h"
14 #endif
15
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
18
19 #ifdef __BORLANDC__
20 #pragma hdrstop
21 #endif
22
23 #include "wx/defs.h"
24
25 #ifndef WX_PRECOMP
26 #include "wx/utils.h"
27 #include "wx/dc.h"
28 #include "wx/app.h"
29 #include "wx/frame.h"
30 #include "wx/stattext.h"
31 #include "wx/statbox.h"
32 #include "wx/button.h"
33 #include "wx/checkbox.h"
34 #include "wx/textctrl.h"
35 #include "wx/radiobox.h"
36 #include "wx/filedlg.h"
37 #include "wx/choice.h"
38 #include <wx/intl.h>
39 #endif
40
41 #include "wx/generic/prntdlgg.h"
42 #include "wx/generic/dcpsg.h"
43 #include "wx/printdlg.h"
44
45 #include <stdlib.h>
46 #include <string.h>
47
48 #if !USE_SHARED_LIBRARY
49 IMPLEMENT_CLASS(wxGenericPrintDialog, wxDialog)
50 IMPLEMENT_CLASS(wxGenericPrintSetupDialog, wxDialog)
51 IMPLEMENT_CLASS(wxGenericPageSetupDialog, wxDialog)
52
53 BEGIN_EVENT_TABLE(wxGenericPrintDialog, wxDialog)
54 EVT_BUTTON(wxID_OK, wxGenericPrintDialog::OnOK)
55 EVT_BUTTON(wxPRINTID_SETUP, wxGenericPrintDialog::OnSetup)
56 EVT_RADIOBOX(wxPRINTID_RANGE, wxGenericPrintDialog::OnRange)
57 END_EVENT_TABLE()
58
59 BEGIN_EVENT_TABLE(wxGenericPageSetupDialog, wxDialog)
60 EVT_BUTTON(wxPRINTID_SETUP, wxGenericPageSetupDialog::OnPrinter)
61 END_EVENT_TABLE()
62 #endif
63
64 extern wxPrintPaperDatabase *wxThePrintPaperDatabase;
65
66 /*
67 * Generic print dialog for non-Windows printing use.
68 */
69
70
71 wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent, wxPrintData* data):
72 wxDialog(parent, -1, _("Print"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL)
73 {
74 if ( data )
75 printData = *data;
76
77 (void)new wxStaticBox( this, -1, _( "Printer options" ), wxPoint( 5, 5), wxSize( 300, 60 ) );
78
79 printToFileCheckBox = new wxCheckBox(this, wxPRINTID_PRINTTOFILE, _("Print to File"), wxPoint(20, 25) );
80
81 setupButton = new wxButton(this, wxPRINTID_SETUP, _("Setup..."), wxPoint(160, 25), wxSize(100, -1));
82
83 wxString *choices = new wxString[2];
84 choices[0] = _("All");
85 choices[1] = _("Pages");
86
87 fromText = (wxTextCtrl*)NULL;
88
89 if(printData.GetFromPage() != 0)
90 {
91 rangeRadioBox = new wxRadioBox(this, wxPRINTID_RANGE, _("Print Range"),
92 wxPoint(5, 80), wxSize(-1, -1), 2, choices, 1, wxRA_VERTICAL);
93 rangeRadioBox->SetSelection(1);
94 }
95
96 if(printData.GetFromPage() != 0)
97 {
98 (void) new wxStaticText(this, wxPRINTID_STATIC, _("From:"), wxPoint(5, 135));
99
100 fromText = new wxTextCtrl(this, wxPRINTID_FROM, "", wxPoint(45, 130), wxSize(40, -1));
101
102 (void) new wxStaticText(this, wxPRINTID_STATIC, _("To:"), wxPoint(100, 135));
103
104 toText = new wxTextCtrl(this, wxPRINTID_TO, "", wxPoint(133, 130), wxSize(40, -1));
105 }
106
107 (void) new wxStaticText(this, wxPRINTID_STATIC, _("Copies:"), wxPoint(200, 135));
108
109 noCopiesText = new wxTextCtrl(this, wxPRINTID_COPIES, "", wxPoint(252, 130), wxSize(40, -1));
110
111 wxButton *okButton = new wxButton(this, wxID_OK, _("OK"), wxPoint(40, 180), wxSize(100, -1));
112 (void) new wxButton(this, wxID_CANCEL, _("Cancel"), wxPoint(180, 180), wxSize(100, -1));
113
114 okButton->SetDefault();
115 okButton->SetFocus();
116 Fit();
117 Centre(wxBOTH);
118
119 // Calls wxWindow::OnInitDialog and then wxGenericPrintDialog::TransferDataToWindow
120 InitDialog();
121 delete[] choices;
122 }
123
124 int wxGenericPrintDialog::ShowModal(void)
125 {
126 if ( printData.GetSetupDialog() )
127 {
128 wxGenericPrintSetupDialog *genericPrintSetupDialog =
129 new wxGenericPrintSetupDialog(GetParent(), wxThePrintSetupData);
130 int ret = genericPrintSetupDialog->ShowModal();
131 if ( ret != wxID_CANCEL )
132 {
133 *wxThePrintSetupData = genericPrintSetupDialog->printData;
134 }
135 genericPrintSetupDialog->Close(TRUE);
136 return ret;
137 }
138 else
139 {
140 return wxDialog::ShowModal();
141 }
142 }
143
144 wxGenericPrintDialog::~wxGenericPrintDialog(void)
145 {
146 }
147
148 void wxGenericPrintDialog::OnOK(wxCommandEvent& WXUNUSED(event))
149 {
150 TransferDataFromWindow();
151
152 // There are some interactions between the global setup data
153 // and the standard print dialog. The global printing 'mode'
154 // is determined by whether the user checks Print to file
155 // or not.
156 if (printData.GetPrintToFile())
157 {
158 wxThePrintSetupData->SetPrinterMode(PS_FILE);
159
160 wxString f = wxFileSelector(_("PostScript file"),
161 wxPathOnly(wxThePrintSetupData->GetPrinterFile()),
162 wxFileNameFromPath(wxThePrintSetupData->GetPrinterFile()),
163 "ps", "*.ps", 0, this);
164 if ( f.IsEmpty() )
165 return;
166
167 wxThePrintSetupData->SetPrinterFile(f);
168 }
169 else
170 wxThePrintSetupData->SetPrinterMode(PS_PRINTER);
171
172 EndModal(wxID_OK);
173 }
174
175 void wxGenericPrintDialog::OnRange(wxCommandEvent& event)
176 {
177 if (!fromText) return;
178
179 if (event.GetInt() == 0)
180 {
181 fromText->Enable(FALSE);
182 toText->Enable(FALSE);
183 }
184 else if (event.GetInt() == 1)
185 {
186 fromText->Enable(TRUE);
187 toText->Enable(TRUE);
188 }
189 }
190
191 void wxGenericPrintDialog::OnSetup(wxCommandEvent& WXUNUSED(event))
192 {
193 wxGenericPrintSetupDialog *genericPrintSetupDialog =
194 new wxGenericPrintSetupDialog(this, wxThePrintSetupData);
195 int ret = genericPrintSetupDialog->ShowModal();
196 if ( ret != wxID_CANCEL )
197 {
198 *wxThePrintSetupData = genericPrintSetupDialog->printData;
199 printData.SetOrientation(wxThePrintSetupData->GetPrinterOrientation());
200 }
201
202 genericPrintSetupDialog->Close(TRUE);
203 }
204
205 bool wxGenericPrintDialog::TransferDataToWindow(void)
206 {
207 char buf[10];
208
209 if(printData.GetFromPage() != 0)
210 {
211 if (printData.GetEnablePageNumbers())
212 {
213 fromText->Enable(TRUE);
214 toText->Enable(TRUE);
215
216 sprintf(buf, "%d", printData.GetFromPage());
217 fromText->SetValue(buf);
218 sprintf(buf, "%d", printData.GetToPage());
219 toText->SetValue(buf);
220
221 if (printData.GetAllPages())
222 rangeRadioBox->SetSelection(0);
223 else
224 rangeRadioBox->SetSelection(1);
225 }
226 else
227 {
228 fromText->Enable(FALSE);
229 toText->Enable(FALSE);
230 rangeRadioBox->SetSelection(0);
231 rangeRadioBox->wxRadioBox::Enable(1, FALSE);
232 }
233 }
234 sprintf(buf, "%d", printData.GetNoCopies());
235 noCopiesText->SetValue(buf);
236
237 printToFileCheckBox->SetValue(printData.GetPrintToFile());
238 printToFileCheckBox->Enable(printData.GetEnablePrintToFile());
239 return TRUE;
240 }
241
242 bool wxGenericPrintDialog::TransferDataFromWindow(void)
243 {
244 if(printData.GetFromPage() != -1)
245 {
246 if (printData.GetEnablePageNumbers())
247 {
248 printData.SetFromPage(atoi(fromText->GetValue()));
249 printData.SetToPage(atoi(toText->GetValue()));
250 }
251 if (rangeRadioBox->GetSelection() == 0)
252 printData.SetAllPages(TRUE);
253 else
254 printData.SetAllPages(FALSE);
255 }
256 else
257 { // continuous printing
258 printData.SetFromPage(1);
259 printData.SetToPage(32000);
260 }
261 printData.SetNoCopies(atoi(noCopiesText->GetValue()));
262 printData.SetPrintToFile(printToFileCheckBox->GetValue());
263
264 return TRUE;
265 }
266
267 wxDC *wxGenericPrintDialog::GetPrintDC(void)
268 {
269 return new wxPostScriptDC(wxThePrintSetupData->GetPrinterFile(), FALSE, (wxWindow *) NULL);
270 }
271
272 /*
273 * Generic print setup dialog
274 */
275
276 wxGenericPrintSetupDialog::wxGenericPrintSetupDialog(wxWindow *parent, wxPrintSetupData* data):
277 wxDialog(parent, -1, _("Print Setup"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL)
278 {
279 if ( data )
280 printData = *data;
281
282 (void) new wxStaticBox(this, wxPRINTID_STATIC, _("Paper size"), wxPoint(10, 10), wxSize(200,60) );
283
284 int xPos = 20;
285 int yPos = 30;
286 paperTypeChoice = CreatePaperTypeChoice(&xPos, &yPos);
287
288 wxString *choices = new wxString[2];
289 choices[0] = _("Portrait");
290 choices[1] = _("Landscape");
291
292 orientationRadioBox = new wxRadioBox(this, wxPRINTID_ORIENTATION, _("Orientation"),
293 wxPoint(10, 80), wxSize(-1, -1), 2, choices, 1, wxRA_VERTICAL );
294 orientationRadioBox->SetSelection(0);
295
296 (void) new wxStaticBox(this, wxPRINTID_STATIC, _("Options"), wxPoint(10, 130), wxSize(200,50) );
297
298 int colourXPos = 145;
299
300 #ifdef __WXMOTIF__
301 colourXPos = 150;
302 #endif
303
304 colourCheckBox = new wxCheckBox(this, wxPRINTID_PRINTCOLOUR, _("Print in colour"), wxPoint(15, colourXPos));
305
306
307 (void) new wxStaticBox(this, wxPRINTID_STATIC, _("Print spooling"), wxPoint(230, 10), wxSize(200,170) );
308
309 (void) new wxStaticText(this, wxPRINTID_STATIC, _("Printer command:"), wxPoint(240, 30));
310
311 printerCommandText = new wxTextCtrl(this, wxPRINTID_COMMAND, "", wxPoint(260, 55), wxSize(150, -1));
312
313 (void) new wxStaticText(this, wxPRINTID_STATIC, _("Printer options:"), wxPoint(240, 110));
314
315 printerOptionsText = new wxTextCtrl(this, wxPRINTID_OPTIONS, "", wxPoint(260, 135), wxSize(150, -1));
316
317 wxButton *okButton = new wxButton(this, wxID_OK, _("OK"), wxPoint(80, 200), wxSize(100, -1));
318 (void) new wxButton(this, wxID_CANCEL, _("Cancel"), wxPoint(270, 200), wxSize(100, -1));
319
320 okButton->SetDefault();
321 okButton->SetFocus();
322
323 Fit();
324 Centre(wxBOTH);
325
326 InitDialog();
327 delete[] choices;
328 }
329
330 wxGenericPrintSetupDialog::~wxGenericPrintSetupDialog(void)
331 {
332 }
333
334 bool wxGenericPrintSetupDialog::TransferDataToWindow(void)
335 {
336 if (printerCommandText && printData.GetPrinterCommand())
337 printerCommandText->SetValue(printData.GetPrinterCommand());
338 if (printerOptionsText && printData.GetPrinterOptions())
339 printerOptionsText->SetValue(printData.GetPrinterOptions());
340 if (colourCheckBox)
341 colourCheckBox->SetValue(printData.GetColour());
342
343 if (orientationRadioBox)
344 {
345 if (printData.GetPrinterOrientation() == PS_PORTRAIT)
346 orientationRadioBox->SetSelection(0);
347 else
348 orientationRadioBox->SetSelection(1);
349 }
350 return TRUE;
351 }
352
353 bool wxGenericPrintSetupDialog::TransferDataFromWindow(void)
354 {
355 if (printerCommandText)
356 printData.SetPrinterCommand(WXSTRINGCAST printerCommandText->GetValue());
357 if (printerOptionsText)
358 printData.SetPrinterOptions(WXSTRINGCAST printerOptionsText->GetValue());
359 if (colourCheckBox)
360 printData.SetColour(colourCheckBox->GetValue());
361 if (orientationRadioBox)
362 {
363 int sel = orientationRadioBox->GetSelection();
364 if (sel == 0)
365 printData.SetPrinterOrientation(PS_PORTRAIT);
366 else
367 printData.SetPrinterOrientation(PS_LANDSCAPE);
368 }
369 if (paperTypeChoice)
370 {
371 wxString val(paperTypeChoice->GetStringSelection());
372 if (!val.IsNull() && val != "")
373 printData.SetPaperName((char *)(const char *)val);
374 }
375 *wxThePrintSetupData = GetPrintData();
376 return TRUE;
377 }
378
379 wxChoice *wxGenericPrintSetupDialog::CreatePaperTypeChoice(int *x, int *y)
380 {
381 if (!wxThePrintPaperDatabase)
382 {
383 wxThePrintPaperDatabase = new wxPrintPaperDatabase;
384 wxThePrintPaperDatabase->CreateDatabase();
385 }
386 int n = wxThePrintPaperDatabase->Number();
387 wxString *choices = new wxString [n];
388 int sel = 0;
389 int i;
390 for (i = 0; i < n; i++)
391 {
392 wxPrintPaperType *paper = (wxPrintPaperType *)wxThePrintPaperDatabase->Nth(i)->Data();
393 choices[i] = paper->pageName;
394 if (printData.GetPaperName() && choices[i] == printData.GetPaperName())
395 sel = i;
396 }
397
398 int width = 170;
399 #ifdef __WXMOTIF__
400 width = 150;
401 #endif
402
403 wxChoice *choice = new wxChoice(this, wxPRINTID_PAPERSIZE, wxPoint(*x, *y), wxSize(width, -1), n,
404 choices);
405
406 delete[] choices;
407
408 choice->SetSelection(sel);
409 return choice;
410 }
411
412 /*
413 * Generic page setup dialog
414 */
415
416 void wxGenericPageSetupDialog::OnPrinter(wxCommandEvent& WXUNUSED(event))
417 {
418 // We no longer query GetPrintMode, so we can eliminate the need
419 // to call SetPrintMode.
420 // This has the limitation that we can't explicitly call the PostScript
421 // print setup dialog from the generic Page Setup dialog under Windows,
422 // but since this choice would only happen when trying to do PostScript
423 // printing under Windows (and only in 16-bit Windows which
424 // doesn't have a Windows-specific page setup dialog) it's worth it.
425
426 wxPrintData data;
427 data.SetSetupDialog(TRUE);
428 wxPrintDialog *printDialog = new wxPrintDialog(this, & data);
429 printDialog->ShowModal();
430
431 printDialog->Destroy();
432
433 #if 0
434 if (wxTheApp->GetPrintMode() == wxPRINT_POSTSCRIPT)
435 {
436 wxGenericPrintSetupDialog *genericPrintSetupDialog =
437 new wxGenericPrintSetupDialog(this, wxThePrintSetupData);
438 int ret = genericPrintSetupDialog->ShowModal();
439 if (ret == wxID_OK)
440 *wxThePrintSetupData = genericPrintSetupDialog->GetPrintData();
441
442 genericPrintSetupDialog->Close(TRUE);
443 }
444 #ifdef __WXMSW__
445 else
446 {
447 wxPrintData data;
448 data.SetSetupDialog(TRUE);
449 wxPrintDialog printDialog(this, & data);
450 printDialog.ShowModal();
451 }
452 #endif
453 #endif
454 // 0
455 }
456
457 wxGenericPageSetupDialog::wxGenericPageSetupDialog(wxWindow *parent, wxPageSetupData* data):
458 wxDialog(parent, -1, _("Page Setup"), wxPoint(0, 0), wxSize(600, 600), wxDIALOG_MODAL|wxDEFAULT_DIALOG_STYLE)
459 {
460 if ( data )
461 pageData = *data;
462
463 int buttonWidth = 75;
464 int buttonHeight = 25;
465 int spacing = 5;
466 #ifdef __WXMOTIF__
467 spacing = 15;
468 #endif
469
470 int yPos = 5;
471 int xPos = 5;
472
473 wxButton *okButton = new wxButton(this, wxID_OK, _("OK"), wxPoint(5, yPos), wxSize(buttonWidth, buttonHeight));
474 (void) new wxButton(this, wxID_CANCEL, _("Cancel"), wxPoint(buttonWidth + 5 + spacing, yPos), wxSize(buttonWidth, buttonHeight));
475
476 printerButton = new wxButton(this, wxPRINTID_SETUP, _("Printer..."), wxPoint(buttonWidth*2 + 5 + 2*spacing, yPos), wxSize(buttonWidth, buttonHeight));
477
478 if ( !pageData.GetEnablePrinter() )
479 printerButton->Enable(FALSE);
480
481 // if (printData.GetEnableHelp())
482 // wxButton *helpButton = new wxButton(this, (wxFunction)wxGenericPageSetupHelpProc, _("Help"), -1, -1, buttonWidth, buttonHeight);
483
484 okButton->SetDefault();
485 okButton->SetFocus();
486
487 xPos = 5;
488 yPos += 35;
489
490 #ifdef __WXMOTIF__
491 yPos += 10;
492 #endif
493
494 paperTypeChoice = CreatePaperTypeChoice(&xPos, &yPos);
495
496 xPos = 5;
497
498 wxString *choices = new wxString[2];
499 choices[0] = _("Portrait");
500 choices[1] = _("Landscape");
501 orientationRadioBox = new wxRadioBox(this, wxPRINTID_ORIENTATION, _("Orientation"),
502 wxPoint(xPos, yPos), wxSize(-1, -1), 2, choices, 2);
503 orientationRadioBox->SetSelection(0);
504
505 xPos = 5;
506 yPos += 60;
507
508 int staticWidth = 110;
509 #ifdef __WXMOTIF__
510 staticWidth += 20;
511 #endif
512
513 int textWidth = 60;
514 spacing = 10;
515
516 (void) new wxStaticText(this, wxPRINTID_STATIC, _("Left margin (mm):"), wxPoint(xPos, yPos));
517 xPos += staticWidth;
518
519 marginLeftText = new wxTextCtrl(this, wxPRINTID_LEFTMARGIN, "", wxPoint(xPos, yPos), wxSize(textWidth, -1));
520 xPos += textWidth + spacing;
521
522 (void) new wxStaticText(this, wxPRINTID_STATIC, _("Right margin (mm):"), wxPoint(xPos, yPos));
523 xPos += staticWidth;
524
525 marginRightText = new wxTextCtrl(this, wxPRINTID_RIGHTMARGIN, "", wxPoint(xPos, yPos), wxSize(textWidth, -1));
526 xPos += textWidth + spacing;
527
528 yPos += 35;
529 xPos = 5;
530
531 (void) new wxStaticText(this, wxPRINTID_STATIC, _("Top margin (mm):"), wxPoint(xPos, yPos));
532 xPos += staticWidth;
533
534 marginTopText = new wxTextCtrl(this, wxPRINTID_TOPMARGIN, "", wxPoint(xPos, yPos), wxSize(textWidth, -1));
535 xPos += textWidth + spacing;
536
537 (void) new wxStaticText(this, wxPRINTID_STATIC, _("Bottom margin (mm):"), wxPoint(xPos, yPos));
538 xPos += staticWidth;
539
540 marginBottomText = new wxTextCtrl(this, wxPRINTID_BOTTOMMARGIN, "", wxPoint(xPos, yPos), wxSize(textWidth, -1));
541
542 Fit();
543 Centre(wxBOTH);
544
545 InitDialog();
546 delete [] choices;
547 }
548
549 wxGenericPageSetupDialog::~wxGenericPageSetupDialog(void)
550 {
551 }
552
553 bool wxGenericPageSetupDialog::TransferDataToWindow(void)
554 {
555 if (marginLeftText)
556 marginLeftText->SetValue(IntToString((int) pageData.GetMarginTopLeft().x));
557 if (marginTopText)
558 marginTopText->SetValue(IntToString((int) pageData.GetMarginTopLeft().y));
559 if (marginRightText)
560 marginRightText->SetValue(IntToString((int) pageData.GetMarginBottomRight().x));
561 if (marginBottomText)
562 marginBottomText->SetValue(IntToString((int) pageData.GetMarginBottomRight().y));
563
564 if (orientationRadioBox)
565 {
566 if (pageData.GetOrientation() == wxPORTRAIT)
567 orientationRadioBox->SetSelection(0);
568 else
569 orientationRadioBox->SetSelection(1);
570 }
571 return TRUE;
572 }
573
574 bool wxGenericPageSetupDialog::TransferDataFromWindow(void)
575 {
576 if (marginLeftText && marginTopText)
577 pageData.SetMarginTopLeft(wxPoint(atoi((const char *)marginLeftText->GetValue()),atoi((const char *)marginTopText->GetValue())));
578 if (marginRightText && marginBottomText)
579 pageData.SetMarginBottomRight(wxPoint(atoi((const char *)marginRightText->GetValue()),atoi((const char *)marginBottomText->GetValue())));
580
581 if (orientationRadioBox)
582 {
583 int sel = orientationRadioBox->GetSelection();
584 if (sel == 0)
585 {
586 wxThePrintSetupData->SetPrinterOrientation(wxPORTRAIT);
587 pageData.SetOrientation(wxPORTRAIT);
588 }
589 else
590 {
591 wxThePrintSetupData->SetPrinterOrientation(wxLANDSCAPE);
592 pageData.SetOrientation(wxLANDSCAPE);
593 }
594 }
595 if (paperTypeChoice)
596 {
597 wxString val(paperTypeChoice->GetStringSelection());
598 if (!val.IsNull() && val != "")
599 {
600 wxPrintPaperType* paper = wxThePrintPaperDatabase->FindPaperType((char*) (const char *)val);
601 if ( paper )
602 {
603 pageData.SetPaperSize(wxPoint(paper->widthMM, paper->heightMM));
604 }
605 }
606 }
607
608 return TRUE;
609 }
610
611 wxChoice *wxGenericPageSetupDialog::CreatePaperTypeChoice(int *x, int *y)
612 {
613 if (!wxThePrintPaperDatabase)
614 {
615 wxThePrintPaperDatabase = new wxPrintPaperDatabase;
616 wxThePrintPaperDatabase->CreateDatabase();
617 }
618 int n = wxThePrintPaperDatabase->Number();
619 wxString *choices = new wxString [n];
620 int sel = 0;
621 int i;
622 for (i = 0; i < n; i++)
623 {
624 wxPrintPaperType *paper = (wxPrintPaperType *)wxThePrintPaperDatabase->Nth(i)->Data();
625 choices[i] = paper->pageName;
626 if (pageData.GetPaperSize().x == paper->widthMM && pageData.GetPaperSize().y == paper->heightMM)
627 sel = i;
628 }
629
630 (void) new wxStaticText(this, wxPRINTID_STATIC, _("Paper size"), wxPoint(*x, *y));
631 *y += 25;
632
633 wxChoice *choice = new wxChoice(this, wxPRINTID_PAPERSIZE, wxPoint(*x, *y), wxSize(300, -1), n,
634 choices);
635 *y += 35;
636 delete[] choices;
637
638 choice->SetSelection(sel);
639 return choice;
640 }
641