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
;
139 m_toText
= (wxTextCtrl
*)NULL
;
141 if (m_printDialogData
.GetFromPage() != 0)
143 m_rangeRadioBox
= new wxRadioBox(this, wxPRINTID_RANGE
, _("Print Range"),
144 wxPoint(5, 80), wxSize(-1, -1),
147 m_rangeRadioBox
->SetSelection(1);
150 if(m_printDialogData
.GetFromPage() != 0)
152 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("From:"), wxPoint(5, 135));
154 m_fromText
= new wxTextCtrl(this, wxPRINTID_FROM
, "", wxPoint(45, 130), wxSize(40, -1));
156 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("To:"), wxPoint(100, 135));
158 m_toText
= new wxTextCtrl(this, wxPRINTID_TO
, "", wxPoint(133, 130), wxSize(40, -1));
161 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Copies:"), wxPoint(200, 135));
163 m_noCopiesText
= new wxTextCtrl(this, wxPRINTID_COPIES
, "", wxPoint(252, 130), wxSize(40, -1));
165 wxButton
*okButton
= new wxButton(this, wxID_OK
, _("OK"), wxPoint(40, 180), wxSize(100, -1));
166 (void) new wxButton(this, wxID_CANCEL
, _("Cancel"), wxPoint(180, 180), wxSize(100, -1));
168 okButton
->SetDefault();
169 okButton
->SetFocus();
173 // Calls wxWindow::OnInitDialog and then wxGenericPrintDialog::TransferDataToWindow
178 int wxGenericPrintDialog
::ShowModal()
180 if ( m_printDialogData
.GetSetupDialog() )
182 // Make sure wxPrintData object reflects the settings now, in case the setup dialog
183 // changes it. In fact there aren't any common settings at
184 // present, but there might be in future.
185 // TransferDataFromWindow();
187 wxGenericPrintSetupDialog
*genericPrintSetupDialog
=
188 new wxGenericPrintSetupDialog(this, & m_printDialogData
.GetPrintData());
189 int ret
= genericPrintSetupDialog
->ShowModal();
190 if ( ret
!= wxID_CANCEL
)
192 // Transfer settings to the global object (for compatibility) and to
193 // the print dialog's print data.
194 *wxThePrintSetupData
= genericPrintSetupDialog
->GetPrintData();
195 m_printDialogData
.GetPrintData() = genericPrintSetupDialog
->GetPrintData();
197 genericPrintSetupDialog
->Destroy();
199 // Restore the wxPrintData settings again (uncomment if any settings become common
201 // TransferDataToWindow();
207 return wxDialog
::ShowModal();
211 wxGenericPrintDialog
::~wxGenericPrintDialog()
215 void wxGenericPrintDialog
::OnOK(wxCommandEvent
& WXUNUSED(event
))
217 TransferDataFromWindow();
219 // There are some interactions between the global setup data
220 // and the standard print dialog. The global printing 'mode'
221 // is determined by whether the user checks Print to file
223 if (m_printDialogData
.GetPrintToFile())
225 m_printDialogData
.GetPrintData().SetPrintMode(wxPRINT_MODE_FILE
);
226 wxThePrintSetupData
->SetPrinterMode(wxPRINT_MODE_FILE
);
228 wxString f
= wxFileSelector(_("PostScript file"),
229 wxPathOnly(wxThePrintSetupData
->GetPrinterFile()),
230 wxFileNameFromPath(wxThePrintSetupData
->GetPrinterFile()),
231 "ps", "*.ps", 0, this);
235 m_printDialogData
.GetPrintData().SetFilename(f
);
236 wxThePrintSetupData
->SetPrinterFile(f
);
239 wxThePrintSetupData
->SetPrinterMode(wxPRINT_MODE_PRINTER
);
244 void wxGenericPrintDialog
::OnRange(wxCommandEvent
& event
)
246 if (!m_fromText
) return;
248 if (event
.GetInt() == 0)
250 m_fromText
->Enable(FALSE
);
251 m_toText
->Enable(FALSE
);
253 else if (event
.GetInt() == 1)
255 m_fromText
->Enable(TRUE
);
256 m_toText
->Enable(TRUE
);
260 void wxGenericPrintDialog
::OnSetup(wxCommandEvent
& WXUNUSED(event
))
262 wxGenericPrintSetupDialog
*genericPrintSetupDialog
=
263 new wxGenericPrintSetupDialog(this, wxThePrintSetupData
);
264 int ret
= genericPrintSetupDialog
->ShowModal();
265 if ( ret
!= wxID_CANCEL
)
267 *wxThePrintSetupData
= genericPrintSetupDialog
->GetPrintData();
268 m_printDialogData
= genericPrintSetupDialog
->GetPrintData();
271 genericPrintSetupDialog
->Close(TRUE
);
274 bool wxGenericPrintDialog
::TransferDataToWindow()
278 if(m_printDialogData
.GetFromPage() != 0)
282 if (m_printDialogData
.GetEnablePageNumbers())
284 m_fromText
->Enable(TRUE
);
285 m_toText
->Enable(TRUE
);
286 sprintf(buf
, "%d", m_printDialogData
.GetFromPage());
287 m_fromText
->SetValue(buf
);
288 sprintf(buf
, "%d", m_printDialogData
.GetToPage());
289 m_toText
->SetValue(buf
);
290 if (m_printDialogData
.GetAllPages())
291 m_rangeRadioBox
->SetSelection(0);
293 m_rangeRadioBox
->SetSelection(1);
297 m_fromText
->Enable(FALSE
);
298 m_toText
->Enable(FALSE
);
299 m_rangeRadioBox
->SetSelection(0);
300 m_rangeRadioBox
->wxRadioBox
::Enable(1, FALSE
);
304 sprintf(buf
, "%d", m_printDialogData
.GetNoCopies());
305 m_noCopiesText
->SetValue(buf
);
307 m_printToFileCheckBox
->SetValue(m_printDialogData
.GetPrintToFile());
308 m_printToFileCheckBox
->Enable(m_printDialogData
.GetEnablePrintToFile());
312 bool wxGenericPrintDialog
::TransferDataFromWindow()
314 if(m_printDialogData
.GetFromPage() != -1)
316 if (m_printDialogData
.GetEnablePageNumbers())
318 if(m_fromText
) m_printDialogData
.SetFromPage(atoi(m_fromText
->GetValue()));
319 if(m_toText
) m_printDialogData
.SetToPage(atoi(m_toText
->GetValue()));
321 if (m_rangeRadioBox
->GetSelection() == 0)
322 m_printDialogData
.SetAllPages(TRUE
);
324 m_printDialogData
.SetAllPages(FALSE
);
327 { // continuous printing
328 m_printDialogData
.SetFromPage(1);
329 m_printDialogData
.SetToPage(32000);
331 m_printDialogData
.SetNoCopies(atoi(m_noCopiesText
->GetValue()));
332 m_printDialogData
.SetPrintToFile(m_printToFileCheckBox
->GetValue());
338 TODO: collate and noCopies should be duplicated across dialog data and print data objects
339 (slightly different semantics on Windows but let's ignore this for a bit).
342 wxDC
*wxGenericPrintDialog
::GetPrintDC()
344 return new wxPostScriptDC(wxThePrintSetupData
->GetPrinterFile(), FALSE
, (wxWindow
*) NULL
);
347 // ----------------------------------------------------------------------------
348 // Generic print setup dialog
349 // ----------------------------------------------------------------------------
351 wxGenericPrintSetupDialog
::wxGenericPrintSetupDialog(wxWindow
*parent
, wxPrintData
* data
):
352 wxDialog(parent
, -1, _("Print Setup"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE
|wxDIALOG_MODAL
|wxTAB_TRAVERSAL
)
357 // Convert wxPrintSetupData to standard wxPrintData object
358 wxGenericPrintSetupDialog
::wxGenericPrintSetupDialog(wxWindow
*parent
, wxPrintSetupData
* data
):
359 wxDialog(parent
, -1, _("Print Setup"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE
|wxDIALOG_MODAL
|wxTAB_TRAVERSAL
)
361 wxPrintData printData
;
365 printData
= * wxThePrintSetupData
;
370 void wxGenericPrintSetupDialog
::Init(wxPrintData
* data
)
375 int staticBoxWidth
= 300;
377 (void) new wxStaticBox(this, wxPRINTID_STATIC
, _("Paper size"), wxPoint(10, 10), wxSize(staticBoxWidth
, 60) );
381 m_paperTypeChoice
= CreatePaperTypeChoice(&xPos
, &yPos
);
383 wxString
*choices
= new wxString
[2];
384 choices
[0] = _("Portrait");
385 choices
[1] = _("Landscape");
387 m_orientationRadioBox
= new wxRadioBox(this, wxPRINTID_ORIENTATION
, _("Orientation"),
388 wxPoint(10, 80), wxSize(-1, -1), 2, choices
, 1, wxRA_VERTICAL
);
389 m_orientationRadioBox
->SetSelection(0);
391 (void) new wxStaticBox(this, wxPRINTID_STATIC
, _("Options"), wxPoint(10, 130), wxSize(staticBoxWidth
, 50) );
393 int colourYPos
= 145;
399 m_colourCheckBox
= new wxCheckBox(this, wxPRINTID_PRINTCOLOUR
, _("Print in colour"), wxPoint(15, colourYPos
));
401 (void) new wxStaticBox(this, wxPRINTID_STATIC
, _("Print spooling"), wxPoint(330, 10), wxSize(200,170) );
403 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Printer command:"), wxPoint(340, 30));
405 m_printerCommandText
= new wxTextCtrl(this, wxPRINTID_COMMAND
, "", wxPoint(360, 55), wxSize(150, -1));
407 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Printer options:"), wxPoint(340, 110));
409 m_printerOptionsText
= new wxTextCtrl(this, wxPRINTID_OPTIONS
, "", wxPoint(360, 135), wxSize(150, -1));
411 wxButton
*okButton
= new wxButton(this, wxID_OK
, _("OK"), wxPoint(130, 200), wxSize(100, -1));
412 (void) new wxButton(this, wxID_CANCEL
, _("Cancel"), wxPoint(320, 200), wxSize(100, -1));
414 okButton
->SetDefault();
415 okButton
->SetFocus();
424 wxGenericPrintSetupDialog
::~wxGenericPrintSetupDialog()
428 bool wxGenericPrintSetupDialog
::TransferDataToWindow()
430 if (m_printerCommandText
&& m_printData
.GetPrinterCommand())
431 m_printerCommandText
->SetValue(m_printData
.GetPrinterCommand());
432 if (m_printerOptionsText
&& m_printData
.GetPrinterOptions())
433 m_printerOptionsText
->SetValue(m_printData
.GetPrinterOptions());
434 if (m_colourCheckBox
)
435 m_colourCheckBox
->SetValue(m_printData
.GetColour());
437 if (m_orientationRadioBox
)
439 if (m_printData
.GetOrientation() == wxPORTRAIT
)
440 m_orientationRadioBox
->SetSelection(0);
442 m_orientationRadioBox
->SetSelection(1);
447 bool wxGenericPrintSetupDialog
::TransferDataFromWindow()
449 if (m_printerCommandText
)
450 m_printData
.SetPrinterCommand(m_printerCommandText
->GetValue());
451 if (m_printerOptionsText
)
452 m_printData
.SetPrinterOptions(m_printerOptionsText
->GetValue());
453 if (m_colourCheckBox
)
454 m_printData
.SetColour(m_colourCheckBox
->GetValue());
455 if (m_orientationRadioBox
)
457 int sel
= m_orientationRadioBox
->GetSelection();
459 m_printData
.SetOrientation(wxPORTRAIT
);
461 m_printData
.SetOrientation(wxLANDSCAPE
);
463 if (m_paperTypeChoice
)
465 wxString
val(m_paperTypeChoice
->GetStringSelection());
466 if (!val
.IsNull() && val
!= "")
467 m_printData
.SetPaperId(wxThePrintPaperDatabase
->ConvertNameToId(val
));
470 // This is for backward compatibility only
471 *wxThePrintSetupData
= GetPrintData();
475 wxChoice
*wxGenericPrintSetupDialog
::CreatePaperTypeChoice(int *x
, int *y
)
477 /* Should not be necessary
478 if (!wxThePrintPaperDatabase)
480 wxThePrintPaperDatabase = new wxPrintPaperDatabase;
481 wxThePrintPaperDatabase->CreateDatabase();
484 int n
= wxThePrintPaperDatabase
->Number();
485 wxString
*choices
= new wxString
[n
];
488 for (i
= 0; i
< n
; i
++)
490 wxPrintPaperType
*paper
= (wxPrintPaperType
*)wxThePrintPaperDatabase
->Nth(i
)->Data();
491 choices
[i
] = paper
->GetName();
492 if (m_printData
.GetPaperId() == paper
->GetId())
498 wxChoice
*choice
= new wxChoice(this, wxPRINTID_PAPERSIZE
, wxPoint(*x
, *y
), wxSize(width
, -1), n
,
501 // SetFont(thisFont);
505 choice
->SetSelection(sel
);
508 #endif // wxUSE_POSTSCRIPT
510 // ----------------------------------------------------------------------------
511 // Generic page setup dialog
512 // ----------------------------------------------------------------------------
514 void wxGenericPageSetupDialog
::OnPrinter(wxCommandEvent
& WXUNUSED(event
))
516 // We no longer query GetPrintMode, so we can eliminate the need
517 // to call SetPrintMode.
518 // This has the limitation that we can't explicitly call the PostScript
519 // print setup dialog from the generic Page Setup dialog under Windows,
520 // but since this choice would only happen when trying to do PostScript
521 // printing under Windows (and only in 16-bit Windows which
522 // doesn't have a Windows-specific page setup dialog) it's worth it.
524 // First save the current settings, so the wxPrintData object is up to date.
525 TransferDataFromWindow();
527 // Transfer the current print settings from this dialog to the page setup dialog.
528 wxPrintDialogData data
;
529 data
= GetPageSetupData().GetPrintData();
530 data
.SetSetupDialog(TRUE
);
531 wxPrintDialog
*printDialog
= new wxPrintDialog(this, & data
);
532 printDialog
->ShowModal();
534 // Transfer the page setup print settings from the page dialog to this dialog again, in case
535 // the page setup dialog changed something.
536 GetPageSetupData().GetPrintData() = printDialog
->GetPrintDialogData().GetPrintData();
537 GetPageSetupData().CalculatePaperSizeFromId(); // Make sure page size reflects the id in wxPrintData
539 printDialog
->Destroy();
541 // Now update the dialog in case the page setup dialog changed some of our settings.
542 TransferDataToWindow();
545 wxGenericPageSetupDialog
::wxGenericPageSetupDialog(wxWindow
*parent
, wxPageSetupData
* data
):
546 wxDialog(parent
, -1, _("Page Setup"), wxPoint(0, 0), wxSize(600, 600), wxDIALOG_MODAL
|wxDEFAULT_DIALOG_STYLE
|wxTAB_TRAVERSAL
)
551 int buttonWidth
= 75;
552 int buttonHeight
= 25;
561 wxButton
*okButton
= new wxButton(this, wxID_OK
, _("OK"), wxPoint(5, yPos
), wxSize(buttonWidth
, buttonHeight
));
562 (void) new wxButton(this, wxID_CANCEL
, _("Cancel"), wxPoint(buttonWidth
+ 5 + spacing
, yPos
), wxSize(buttonWidth
, buttonHeight
));
564 m_printerButton
= new wxButton(this, wxPRINTID_SETUP
, _("Printer..."), wxPoint(buttonWidth
*2 + 5 + 2*spacing
, yPos
), wxSize(buttonWidth
, buttonHeight
));
566 if ( !m_pageData
.GetEnablePrinter() )
567 m_printerButton
->Enable(FALSE
);
569 // if (m_printData.GetEnableHelp())
570 // wxButton *helpButton = new wxButton(this, (wxFunction)wxGenericPageSetupHelpProc, _("Help"), -1, -1, buttonWidth, buttonHeight);
572 okButton
->SetDefault();
573 okButton
->SetFocus();
582 m_paperTypeChoice
= CreatePaperTypeChoice(&xPos
, &yPos
);
586 wxString
*choices
= new wxString
[2];
587 choices
[0] = _("Portrait");
588 choices
[1] = _("Landscape");
589 m_orientationRadioBox
= new wxRadioBox(this, wxPRINTID_ORIENTATION
, _("Orientation"),
590 wxPoint(xPos
, yPos
), wxSize(-1, -1), 2, choices
, 2);
591 m_orientationRadioBox
->SetSelection(0);
596 int staticWidth
= 110;
604 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Left margin (mm):"), wxPoint(xPos
, yPos
));
607 m_marginLeftText
= new wxTextCtrl(this, wxPRINTID_LEFTMARGIN
, "", wxPoint(xPos
, yPos
), wxSize(textWidth
, -1));
608 xPos
+= textWidth
+ spacing
;
610 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Right margin (mm):"), wxPoint(xPos
, yPos
));
613 m_marginRightText
= new wxTextCtrl(this, wxPRINTID_RIGHTMARGIN
, "", wxPoint(xPos
, yPos
), wxSize(textWidth
, -1));
614 xPos
+= textWidth
+ spacing
;
619 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Top margin (mm):"), wxPoint(xPos
, yPos
));
622 m_marginTopText
= new wxTextCtrl(this, wxPRINTID_TOPMARGIN
, "", wxPoint(xPos
, yPos
), wxSize(textWidth
, -1));
623 xPos
+= textWidth
+ spacing
;
625 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Bottom margin (mm):"), wxPoint(xPos
, yPos
));
628 m_marginBottomText
= new wxTextCtrl(this, wxPRINTID_BOTTOMMARGIN
, "", wxPoint(xPos
, yPos
), wxSize(textWidth
, -1));
637 wxGenericPageSetupDialog
::~wxGenericPageSetupDialog()
641 bool wxGenericPageSetupDialog
::TransferDataToWindow()
643 if (m_marginLeftText
)
644 m_marginLeftText
->SetValue(IntToString((int) m_pageData
.GetMarginTopLeft().x
));
646 m_marginTopText
->SetValue(IntToString((int) m_pageData
.GetMarginTopLeft().y
));
647 if (m_marginRightText
)
648 m_marginRightText
->SetValue(IntToString((int) m_pageData
.GetMarginBottomRight().x
));
649 if (m_marginBottomText
)
650 m_marginBottomText
->SetValue(IntToString((int) m_pageData
.GetMarginBottomRight().y
));
652 if (m_orientationRadioBox
)
654 if (m_pageData
.GetPrintData().GetOrientation() == wxPORTRAIT
)
655 m_orientationRadioBox
->SetSelection(0);
657 m_orientationRadioBox
->SetSelection(1);
660 // Find the paper type from either the current paper size in the wxPageSetupDialogData, or
661 // failing that, the id in the wxPrintData object.
663 wxPrintPaperType
* type
= wxThePrintPaperDatabase
->FindPaperType(
664 wxSize(m_pageData
.GetPaperSize().x
* 10, m_pageData
.GetPaperSize().y
* 10));
666 if (!type
&& m_pageData
.GetPrintData().GetPaperId() != wxPAPER_NONE
)
667 type
= wxThePrintPaperDatabase
->FindPaperType(m_pageData
.GetPrintData().GetPaperId());
671 m_paperTypeChoice
->SetStringSelection(type
->GetName());
677 bool wxGenericPageSetupDialog
::TransferDataFromWindow()
679 if (m_marginLeftText
&& m_marginTopText
)
680 m_pageData
.SetMarginTopLeft(wxPoint(atoi((const char *)m_marginLeftText
->GetValue()),atoi((const char *)m_marginTopText
->GetValue())));
681 if (m_marginRightText
&& m_marginBottomText
)
682 m_pageData
.SetMarginBottomRight(wxPoint(atoi((const char *)m_marginRightText
->GetValue()),atoi((const char *)m_marginBottomText
->GetValue())));
684 if (m_orientationRadioBox
)
686 int sel
= m_orientationRadioBox
->GetSelection();
690 wxThePrintSetupData
->SetPrinterOrientation(wxPORTRAIT
);
692 m_pageData
.GetPrintData().SetOrientation(wxPORTRAIT
);
697 wxThePrintSetupData
->SetPrinterOrientation(wxLANDSCAPE
);
699 m_pageData
.GetPrintData().SetOrientation(wxLANDSCAPE
);
702 if (m_paperTypeChoice
)
704 wxString
val(m_paperTypeChoice
->GetStringSelection());
705 if (!val
.IsNull() && val
!= "")
707 wxPrintPaperType
* paper
= wxThePrintPaperDatabase
->FindPaperType(val
);
710 m_pageData
.SetPaperSize(wxSize(paper
->GetWidth()/10, paper
->GetHeight()/10));
711 m_pageData
.GetPrintData().SetPaperId(paper
->GetId());
719 wxChoice
*wxGenericPageSetupDialog
::CreatePaperTypeChoice(int *x
, int *y
)
722 if (!wxThePrintPaperDatabase)
724 wxThePrintPaperDatabase = new wxPrintPaperDatabase;
725 wxThePrintPaperDatabase->CreateDatabase();
729 int n
= wxThePrintPaperDatabase
->Number();
730 wxString
*choices
= new wxString
[n
];
732 for (i
= 0; i
< n
; i
++)
734 wxPrintPaperType
*paper
= (wxPrintPaperType
*)wxThePrintPaperDatabase
->Nth(i
)->Data();
735 choices
[i
] = paper
->GetName();
738 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Paper size"), wxPoint(*x
, *y
));
741 wxChoice
*choice
= new wxChoice(this, wxPRINTID_PAPERSIZE
, wxPoint(*x
, *y
), wxSize(300, -1), n
,
746 // choice->SetSelection(sel);