1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Generic print dialogs
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
21 #pragma implementation "prntdlgg.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
38 #include "wx/stattext.h"
39 #include "wx/statbox.h"
40 #include "wx/button.h"
41 #include "wx/checkbox.h"
42 #include "wx/textctrl.h"
43 #include "wx/radiobox.h"
44 #include "wx/filedlg.h"
45 #include "wx/choice.h"
49 #include "wx/generic/prntdlgg.h"
52 #include "wx/generic/dcpsg.h"
55 #include "wx/printdlg.h"
58 // For print paper things
59 #include "wx/prntbase.h"
64 // ----------------------------------------------------------------------------
66 // ----------------------------------------------------------------------------
70 #if !USE_SHARED_LIBRARY
71 IMPLEMENT_CLASS(wxGenericPrintDialog
, wxDialog
)
72 IMPLEMENT_CLASS(wxGenericPrintSetupDialog
, wxDialog
)
73 IMPLEMENT_CLASS(wxGenericPageSetupDialog
, wxDialog
)
75 BEGIN_EVENT_TABLE(wxGenericPrintDialog
, wxDialog
)
76 EVT_BUTTON(wxID_OK
, wxGenericPrintDialog::OnOK
)
77 EVT_BUTTON(wxPRINTID_SETUP
, wxGenericPrintDialog::OnSetup
)
78 EVT_RADIOBOX(wxPRINTID_RANGE
, wxGenericPrintDialog::OnRange
)
81 BEGIN_EVENT_TABLE(wxGenericPageSetupDialog
, wxDialog
)
82 EVT_BUTTON(wxPRINTID_SETUP
, wxGenericPageSetupDialog::OnPrinter
)
84 #endif // USE_SHARED_LIBRARY
86 // ----------------------------------------------------------------------------
88 // ----------------------------------------------------------------------------
90 extern wxPrintPaperDatabase
*wxThePrintPaperDatabase
;
92 // ============================================================================
94 // ============================================================================
96 // ----------------------------------------------------------------------------
97 // Generic print dialog for non-Windows printing use.
98 // ----------------------------------------------------------------------------
100 wxGenericPrintDialog::wxGenericPrintDialog(wxWindow
*parent
,
101 wxPrintDialogData
* data
)
102 : wxDialog(parent
, -1, _("Print"),
103 wxPoint(0, 0), wxSize(600, 600),
104 wxDEFAULT_DIALOG_STYLE
|
109 m_printDialogData
= *data
;
114 wxGenericPrintDialog::wxGenericPrintDialog(wxWindow
*parent
,
118 m_printDialogData
= *data
;
123 void wxGenericPrintDialog::Init(wxWindow
*parent
)
125 wxDialog::Create(parent
, -1, _("Print"), wxPoint(0, 0), wxSize(600, 600),
126 wxDEFAULT_DIALOG_STYLE
| wxDIALOG_MODAL
| wxTAB_TRAVERSAL
);
128 (void)new wxStaticBox( this, -1, _( "Printer options" ), wxPoint( 5, 5), wxSize( 300, 60 ) );
130 m_printToFileCheckBox
= new wxCheckBox(this, wxPRINTID_PRINTTOFILE
, _("Print to File"), wxPoint(20, 25) );
132 m_setupButton
= new wxButton(this, wxPRINTID_SETUP
, _("Setup..."), wxPoint(160, 25), wxSize(100, -1));
134 wxString
*choices
= new wxString
[2];
135 choices
[0] = _("All");
136 choices
[1] = _("Pages");
138 m_fromText
= (wxTextCtrl
*)NULL
;
140 if (m_printDialogData
.GetFromPage() != 0)
142 m_rangeRadioBox
= new wxRadioBox(this, wxPRINTID_RANGE
, _("Print Range"),
143 wxPoint(5, 80), wxSize(-1, -1),
146 m_rangeRadioBox
->SetSelection(1);
149 if(m_printDialogData
.GetFromPage() != 0)
151 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("From:"), wxPoint(5, 135));
153 m_fromText
= new wxTextCtrl(this, wxPRINTID_FROM
, "", wxPoint(45, 130), wxSize(40, -1));
155 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("To:"), wxPoint(100, 135));
157 m_toText
= new wxTextCtrl(this, wxPRINTID_TO
, "", wxPoint(133, 130), wxSize(40, -1));
160 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Copies:"), wxPoint(200, 135));
162 m_noCopiesText
= new wxTextCtrl(this, wxPRINTID_COPIES
, "", wxPoint(252, 130), wxSize(40, -1));
164 wxButton
*okButton
= new wxButton(this, wxID_OK
, _("OK"), wxPoint(40, 180), wxSize(100, -1));
165 (void) new wxButton(this, wxID_CANCEL
, _("Cancel"), wxPoint(180, 180), wxSize(100, -1));
167 okButton
->SetDefault();
168 okButton
->SetFocus();
172 // Calls wxWindow::OnInitDialog and then wxGenericPrintDialog::TransferDataToWindow
177 int wxGenericPrintDialog::ShowModal()
179 if ( m_printDialogData
.GetSetupDialog() )
181 // Make sure wxPrintData object reflects the settings now, in case the setup dialog
182 // changes it. In fact there aren't any common settings at
183 // present, but there might be in future.
184 // TransferDataFromWindow();
186 wxGenericPrintSetupDialog
*genericPrintSetupDialog
=
187 new wxGenericPrintSetupDialog(this, & m_printDialogData
.GetPrintData());
188 int ret
= genericPrintSetupDialog
->ShowModal();
189 if ( ret
!= wxID_CANCEL
)
191 // Transfer settings to the global object (for compatibility) and to
192 // the print dialog's print data.
193 *wxThePrintSetupData
= genericPrintSetupDialog
->GetPrintData();
194 m_printDialogData
.GetPrintData() = genericPrintSetupDialog
->GetPrintData();
196 genericPrintSetupDialog
->Destroy();
198 // Restore the wxPrintData settings again (uncomment if any settings become common
200 // TransferDataToWindow();
206 return wxDialog::ShowModal();
210 wxGenericPrintDialog::~wxGenericPrintDialog()
214 void wxGenericPrintDialog::OnOK(wxCommandEvent
& WXUNUSED(event
))
216 TransferDataFromWindow();
218 // There are some interactions between the global setup data
219 // and the standard print dialog. The global printing 'mode'
220 // is determined by whether the user checks Print to file
222 if (m_printDialogData
.GetPrintToFile())
224 m_printDialogData
.GetPrintData().SetPrintMode(wxPRINT_MODE_FILE
);
225 wxThePrintSetupData
->SetPrinterMode(wxPRINT_MODE_FILE
);
227 wxString f
= wxFileSelector(_("PostScript file"),
228 wxPathOnly(wxThePrintSetupData
->GetPrinterFile()),
229 wxFileNameFromPath(wxThePrintSetupData
->GetPrinterFile()),
230 "ps", "*.ps", 0, this);
234 m_printDialogData
.GetPrintData().SetFilename(f
);
235 wxThePrintSetupData
->SetPrinterFile(f
);
238 wxThePrintSetupData
->SetPrinterMode(wxPRINT_MODE_PRINTER
);
243 void wxGenericPrintDialog::OnRange(wxCommandEvent
& event
)
245 if (!m_fromText
) return;
247 if (event
.GetInt() == 0)
249 m_fromText
->Enable(FALSE
);
250 m_toText
->Enable(FALSE
);
252 else if (event
.GetInt() == 1)
254 m_fromText
->Enable(TRUE
);
255 m_toText
->Enable(TRUE
);
259 void wxGenericPrintDialog::OnSetup(wxCommandEvent
& WXUNUSED(event
))
261 wxGenericPrintSetupDialog
*genericPrintSetupDialog
=
262 new wxGenericPrintSetupDialog(this, wxThePrintSetupData
);
263 int ret
= genericPrintSetupDialog
->ShowModal();
264 if ( ret
!= wxID_CANCEL
)
266 *wxThePrintSetupData
= genericPrintSetupDialog
->GetPrintData();
267 m_printDialogData
= genericPrintSetupDialog
->GetPrintData();
270 genericPrintSetupDialog
->Close(TRUE
);
273 bool wxGenericPrintDialog::TransferDataToWindow()
277 if(m_printDialogData
.GetFromPage() != 0)
279 if (m_printDialogData
.GetEnablePageNumbers())
281 m_fromText
->Enable(TRUE
);
282 m_toText
->Enable(TRUE
);
284 sprintf(buf
, "%d", m_printDialogData
.GetFromPage());
285 m_fromText
->SetValue(buf
);
286 sprintf(buf
, "%d", m_printDialogData
.GetToPage());
287 m_toText
->SetValue(buf
);
289 if (m_printDialogData
.GetAllPages())
290 m_rangeRadioBox
->SetSelection(0);
292 m_rangeRadioBox
->SetSelection(1);
296 m_fromText
->Enable(FALSE
);
297 m_toText
->Enable(FALSE
);
298 m_rangeRadioBox
->SetSelection(0);
299 m_rangeRadioBox
->wxRadioBox::Enable(1, FALSE
);
302 sprintf(buf
, "%d", m_printDialogData
.GetNoCopies());
303 m_noCopiesText
->SetValue(buf
);
305 m_printToFileCheckBox
->SetValue(m_printDialogData
.GetPrintToFile());
306 m_printToFileCheckBox
->Enable(m_printDialogData
.GetEnablePrintToFile());
310 bool wxGenericPrintDialog::TransferDataFromWindow()
312 if(m_printDialogData
.GetFromPage() != -1)
314 if (m_printDialogData
.GetEnablePageNumbers())
316 m_printDialogData
.SetFromPage(atoi(m_fromText
->GetValue()));
317 m_printDialogData
.SetToPage(atoi(m_toText
->GetValue()));
319 if (m_rangeRadioBox
->GetSelection() == 0)
320 m_printDialogData
.SetAllPages(TRUE
);
322 m_printDialogData
.SetAllPages(FALSE
);
325 { // continuous printing
326 m_printDialogData
.SetFromPage(1);
327 m_printDialogData
.SetToPage(32000);
329 m_printDialogData
.SetNoCopies(atoi(m_noCopiesText
->GetValue()));
330 m_printDialogData
.SetPrintToFile(m_printToFileCheckBox
->GetValue());
336 TODO: collate and noCopies should be duplicated across dialog data and print data objects
337 (slightly different semantics on Windows but let's ignore this for a bit).
340 wxDC
*wxGenericPrintDialog::GetPrintDC()
342 return new wxPostScriptDC(wxThePrintSetupData
->GetPrinterFile(), FALSE
, (wxWindow
*) NULL
);
345 // ----------------------------------------------------------------------------
346 // Generic print setup dialog
347 // ----------------------------------------------------------------------------
349 wxGenericPrintSetupDialog::wxGenericPrintSetupDialog(wxWindow
*parent
, wxPrintData
* data
):
350 wxDialog(parent
, -1, _("Print Setup"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE
|wxDIALOG_MODAL
|wxTAB_TRAVERSAL
)
355 // Convert wxPrintSetupData to standard wxPrintData object
356 wxGenericPrintSetupDialog::wxGenericPrintSetupDialog(wxWindow
*parent
, wxPrintSetupData
* data
):
357 wxDialog(parent
, -1, _("Print Setup"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE
|wxDIALOG_MODAL
|wxTAB_TRAVERSAL
)
359 wxPrintData printData
;
363 printData
= * wxThePrintSetupData
;
368 void wxGenericPrintSetupDialog::Init(wxPrintData
* data
)
373 int staticBoxWidth
= 300;
375 (void) new wxStaticBox(this, wxPRINTID_STATIC
, _("Paper size"), wxPoint(10, 10), wxSize(staticBoxWidth
, 60) );
379 m_paperTypeChoice
= CreatePaperTypeChoice(&xPos
, &yPos
);
381 wxString
*choices
= new wxString
[2];
382 choices
[0] = _("Portrait");
383 choices
[1] = _("Landscape");
385 m_orientationRadioBox
= new wxRadioBox(this, wxPRINTID_ORIENTATION
, _("Orientation"),
386 wxPoint(10, 80), wxSize(-1, -1), 2, choices
, 1, wxRA_VERTICAL
);
387 m_orientationRadioBox
->SetSelection(0);
389 (void) new wxStaticBox(this, wxPRINTID_STATIC
, _("Options"), wxPoint(10, 130), wxSize(staticBoxWidth
, 50) );
391 int colourYPos
= 145;
397 m_colourCheckBox
= new wxCheckBox(this, wxPRINTID_PRINTCOLOUR
, _("Print in colour"), wxPoint(15, colourYPos
));
399 (void) new wxStaticBox(this, wxPRINTID_STATIC
, _("Print spooling"), wxPoint(330, 10), wxSize(200,170) );
401 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Printer command:"), wxPoint(340, 30));
403 m_printerCommandText
= new wxTextCtrl(this, wxPRINTID_COMMAND
, "", wxPoint(360, 55), wxSize(150, -1));
405 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Printer options:"), wxPoint(340, 110));
407 m_printerOptionsText
= new wxTextCtrl(this, wxPRINTID_OPTIONS
, "", wxPoint(360, 135), wxSize(150, -1));
409 wxButton
*okButton
= new wxButton(this, wxID_OK
, _("OK"), wxPoint(130, 200), wxSize(100, -1));
410 (void) new wxButton(this, wxID_CANCEL
, _("Cancel"), wxPoint(320, 200), wxSize(100, -1));
412 okButton
->SetDefault();
413 okButton
->SetFocus();
422 wxGenericPrintSetupDialog::~wxGenericPrintSetupDialog()
426 bool wxGenericPrintSetupDialog::TransferDataToWindow()
428 if (m_printerCommandText
&& m_printData
.GetPrinterCommand())
429 m_printerCommandText
->SetValue(m_printData
.GetPrinterCommand());
430 if (m_printerOptionsText
&& m_printData
.GetPrinterOptions())
431 m_printerOptionsText
->SetValue(m_printData
.GetPrinterOptions());
432 if (m_colourCheckBox
)
433 m_colourCheckBox
->SetValue(m_printData
.GetColour());
435 if (m_orientationRadioBox
)
437 if (m_printData
.GetOrientation() == wxPORTRAIT
)
438 m_orientationRadioBox
->SetSelection(0);
440 m_orientationRadioBox
->SetSelection(1);
445 bool wxGenericPrintSetupDialog::TransferDataFromWindow()
447 if (m_printerCommandText
)
448 m_printData
.SetPrinterCommand(m_printerCommandText
->GetValue());
449 if (m_printerOptionsText
)
450 m_printData
.SetPrinterOptions(m_printerOptionsText
->GetValue());
451 if (m_colourCheckBox
)
452 m_printData
.SetColour(m_colourCheckBox
->GetValue());
453 if (m_orientationRadioBox
)
455 int sel
= m_orientationRadioBox
->GetSelection();
457 m_printData
.SetOrientation(wxPORTRAIT
);
459 m_printData
.SetOrientation(wxLANDSCAPE
);
461 if (m_paperTypeChoice
)
463 wxString
val(m_paperTypeChoice
->GetStringSelection());
464 if (!val
.IsNull() && val
!= "")
465 m_printData
.SetPaperId(wxThePrintPaperDatabase
->ConvertNameToId(val
));
468 // This is for backward compatibility only
469 *wxThePrintSetupData
= GetPrintData();
473 wxChoice
*wxGenericPrintSetupDialog::CreatePaperTypeChoice(int *x
, int *y
)
475 /* Should not be necessary
476 if (!wxThePrintPaperDatabase)
478 wxThePrintPaperDatabase = new wxPrintPaperDatabase;
479 wxThePrintPaperDatabase->CreateDatabase();
482 int n
= wxThePrintPaperDatabase
->Number();
483 wxString
*choices
= new wxString
[n
];
486 for (i
= 0; i
< n
; i
++)
488 wxPrintPaperType
*paper
= (wxPrintPaperType
*)wxThePrintPaperDatabase
->Nth(i
)->Data();
489 choices
[i
] = paper
->GetName();
490 if (m_printData
.GetPaperId() == paper
->GetId())
496 wxChoice
*choice
= new wxChoice(this, wxPRINTID_PAPERSIZE
, wxPoint(*x
, *y
), wxSize(width
, -1), n
,
499 // SetFont(thisFont);
503 choice
->SetSelection(sel
);
506 #endif // wxUSE_POSTSCRIPT
508 // ----------------------------------------------------------------------------
509 // Generic page setup dialog
510 // ----------------------------------------------------------------------------
512 void wxGenericPageSetupDialog::OnPrinter(wxCommandEvent
& WXUNUSED(event
))
514 // We no longer query GetPrintMode, so we can eliminate the need
515 // to call SetPrintMode.
516 // This has the limitation that we can't explicitly call the PostScript
517 // print setup dialog from the generic Page Setup dialog under Windows,
518 // but since this choice would only happen when trying to do PostScript
519 // printing under Windows (and only in 16-bit Windows which
520 // doesn't have a Windows-specific page setup dialog) it's worth it.
522 // First save the current settings, so the wxPrintData object is up to date.
523 TransferDataFromWindow();
525 // Transfer the current print settings from this dialog to the page setup dialog.
526 wxPrintDialogData data
;
527 data
= GetPageSetupData().GetPrintData();
528 data
.SetSetupDialog(TRUE
);
529 wxPrintDialog
*printDialog
= new wxPrintDialog(this, & data
);
530 printDialog
->ShowModal();
532 // Transfer the page setup print settings from the page dialog to this dialog again, in case
533 // the page setup dialog changed something.
534 GetPageSetupData().GetPrintData() = printDialog
->GetPrintDialogData().GetPrintData();
535 GetPageSetupData().CalculatePaperSizeFromId(); // Make sure page size reflects the id in wxPrintData
537 printDialog
->Destroy();
539 // Now update the dialog in case the page setup dialog changed some of our settings.
540 TransferDataToWindow();
543 wxGenericPageSetupDialog::wxGenericPageSetupDialog(wxWindow
*parent
, wxPageSetupData
* data
):
544 wxDialog(parent
, -1, _("Page Setup"), wxPoint(0, 0), wxSize(600, 600), wxDIALOG_MODAL
|wxDEFAULT_DIALOG_STYLE
|wxTAB_TRAVERSAL
)
549 int buttonWidth
= 75;
550 int buttonHeight
= 25;
559 wxButton
*okButton
= new wxButton(this, wxID_OK
, _("OK"), wxPoint(5, yPos
), wxSize(buttonWidth
, buttonHeight
));
560 (void) new wxButton(this, wxID_CANCEL
, _("Cancel"), wxPoint(buttonWidth
+ 5 + spacing
, yPos
), wxSize(buttonWidth
, buttonHeight
));
562 m_printerButton
= new wxButton(this, wxPRINTID_SETUP
, _("Printer..."), wxPoint(buttonWidth
*2 + 5 + 2*spacing
, yPos
), wxSize(buttonWidth
, buttonHeight
));
564 if ( !m_pageData
.GetEnablePrinter() )
565 m_printerButton
->Enable(FALSE
);
567 // if (m_printData.GetEnableHelp())
568 // wxButton *helpButton = new wxButton(this, (wxFunction)wxGenericPageSetupHelpProc, _("Help"), -1, -1, buttonWidth, buttonHeight);
570 okButton
->SetDefault();
571 okButton
->SetFocus();
580 m_paperTypeChoice
= CreatePaperTypeChoice(&xPos
, &yPos
);
584 wxString
*choices
= new wxString
[2];
585 choices
[0] = _("Portrait");
586 choices
[1] = _("Landscape");
587 m_orientationRadioBox
= new wxRadioBox(this, wxPRINTID_ORIENTATION
, _("Orientation"),
588 wxPoint(xPos
, yPos
), wxSize(-1, -1), 2, choices
, 2);
589 m_orientationRadioBox
->SetSelection(0);
594 int staticWidth
= 110;
602 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Left margin (mm):"), wxPoint(xPos
, yPos
));
605 m_marginLeftText
= new wxTextCtrl(this, wxPRINTID_LEFTMARGIN
, "", wxPoint(xPos
, yPos
), wxSize(textWidth
, -1));
606 xPos
+= textWidth
+ spacing
;
608 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Right margin (mm):"), wxPoint(xPos
, yPos
));
611 m_marginRightText
= new wxTextCtrl(this, wxPRINTID_RIGHTMARGIN
, "", wxPoint(xPos
, yPos
), wxSize(textWidth
, -1));
612 xPos
+= textWidth
+ spacing
;
617 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Top margin (mm):"), wxPoint(xPos
, yPos
));
620 m_marginTopText
= new wxTextCtrl(this, wxPRINTID_TOPMARGIN
, "", wxPoint(xPos
, yPos
), wxSize(textWidth
, -1));
621 xPos
+= textWidth
+ spacing
;
623 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Bottom margin (mm):"), wxPoint(xPos
, yPos
));
626 m_marginBottomText
= new wxTextCtrl(this, wxPRINTID_BOTTOMMARGIN
, "", wxPoint(xPos
, yPos
), wxSize(textWidth
, -1));
635 wxGenericPageSetupDialog::~wxGenericPageSetupDialog()
639 bool wxGenericPageSetupDialog::TransferDataToWindow()
641 if (m_marginLeftText
)
642 m_marginLeftText
->SetValue(IntToString((int) m_pageData
.GetMarginTopLeft().x
));
644 m_marginTopText
->SetValue(IntToString((int) m_pageData
.GetMarginTopLeft().y
));
645 if (m_marginRightText
)
646 m_marginRightText
->SetValue(IntToString((int) m_pageData
.GetMarginBottomRight().x
));
647 if (m_marginBottomText
)
648 m_marginBottomText
->SetValue(IntToString((int) m_pageData
.GetMarginBottomRight().y
));
650 if (m_orientationRadioBox
)
652 if (m_pageData
.GetPrintData().GetOrientation() == wxPORTRAIT
)
653 m_orientationRadioBox
->SetSelection(0);
655 m_orientationRadioBox
->SetSelection(1);
658 // Find the paper type from either the current paper size in the wxPageSetupDialogData, or
659 // failing that, the id in the wxPrintData object.
661 wxPrintPaperType
* type
= wxThePrintPaperDatabase
->FindPaperType(
662 wxSize(m_pageData
.GetPaperSize().x
* 10, m_pageData
.GetPaperSize().y
* 10));
664 if (!type
&& m_pageData
.GetPrintData().GetPaperId() != wxPAPER_NONE
)
665 type
= wxThePrintPaperDatabase
->FindPaperType(m_pageData
.GetPrintData().GetPaperId());
669 m_paperTypeChoice
->SetStringSelection(type
->GetName());
675 bool wxGenericPageSetupDialog::TransferDataFromWindow()
677 if (m_marginLeftText
&& m_marginTopText
)
678 m_pageData
.SetMarginTopLeft(wxPoint(atoi((const char *)m_marginLeftText
->GetValue()),atoi((const char *)m_marginTopText
->GetValue())));
679 if (m_marginRightText
&& m_marginBottomText
)
680 m_pageData
.SetMarginBottomRight(wxPoint(atoi((const char *)m_marginRightText
->GetValue()),atoi((const char *)m_marginBottomText
->GetValue())));
682 if (m_orientationRadioBox
)
684 int sel
= m_orientationRadioBox
->GetSelection();
688 wxThePrintSetupData
->SetPrinterOrientation(wxPORTRAIT
);
690 m_pageData
.GetPrintData().SetOrientation(wxPORTRAIT
);
695 wxThePrintSetupData
->SetPrinterOrientation(wxLANDSCAPE
);
697 m_pageData
.GetPrintData().SetOrientation(wxLANDSCAPE
);
700 if (m_paperTypeChoice
)
702 wxString
val(m_paperTypeChoice
->GetStringSelection());
703 if (!val
.IsNull() && val
!= "")
705 wxPrintPaperType
* paper
= wxThePrintPaperDatabase
->FindPaperType(val
);
708 m_pageData
.SetPaperSize(wxSize(paper
->GetWidth()/10, paper
->GetHeight()/10));
709 m_pageData
.GetPrintData().SetPaperId(paper
->GetId());
717 wxChoice
*wxGenericPageSetupDialog::CreatePaperTypeChoice(int *x
, int *y
)
720 if (!wxThePrintPaperDatabase)
722 wxThePrintPaperDatabase = new wxPrintPaperDatabase;
723 wxThePrintPaperDatabase->CreateDatabase();
727 int n
= wxThePrintPaperDatabase
->Number();
728 wxString
*choices
= new wxString
[n
];
730 for (i
= 0; i
< n
; i
++)
732 wxPrintPaperType
*paper
= (wxPrintPaperType
*)wxThePrintPaperDatabase
->Nth(i
)->Data();
733 choices
[i
] = paper
->GetName();
736 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Paper size"), wxPoint(*x
, *y
));
739 wxChoice
*choice
= new wxChoice(this, wxPRINTID_PAPERSIZE
, wxPoint(*x
, *y
), wxSize(300, -1), n
,
744 // choice->SetSelection(sel);