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