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
;
140 m_rangeRadioBox
= (wxRadioBox
*)NULL
;
142 if (m_printDialogData
.GetFromPage() != 0)
144 m_rangeRadioBox
= new wxRadioBox(this, wxPRINTID_RANGE
, _("Print Range"),
145 wxPoint(5, 80), wxSize(-1, -1),
148 m_rangeRadioBox
->SetSelection(1);
151 if(m_printDialogData
.GetFromPage() != 0)
153 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("From:"), wxPoint(5, 135));
155 m_fromText
= new wxTextCtrl(this, wxPRINTID_FROM
, "", wxPoint(45, 130), wxSize(40, -1));
157 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("To:"), wxPoint(100, 135));
159 m_toText
= new wxTextCtrl(this, wxPRINTID_TO
, "", wxPoint(133, 130), wxSize(40, -1));
162 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Copies:"), wxPoint(200, 135));
164 m_noCopiesText
= new wxTextCtrl(this, wxPRINTID_COPIES
, "", wxPoint(252, 130), wxSize(40, -1));
166 wxButton
*okButton
= new wxButton(this, wxID_OK
, _("OK"), wxPoint(40, 180), wxSize(100, -1));
167 (void) new wxButton(this, wxID_CANCEL
, _("Cancel"), wxPoint(180, 180), wxSize(100, -1));
169 okButton
->SetDefault();
170 okButton
->SetFocus();
174 // Calls wxWindow::OnInitDialog and then wxGenericPrintDialog::TransferDataToWindow
179 int wxGenericPrintDialog::ShowModal()
181 if ( m_printDialogData
.GetSetupDialog() )
183 // Make sure wxPrintData object reflects the settings now, in case the setup dialog
184 // changes it. In fact there aren't any common settings at
185 // present, but there might be in future.
186 // TransferDataFromWindow();
188 wxGenericPrintSetupDialog
*genericPrintSetupDialog
=
189 new wxGenericPrintSetupDialog(this, & m_printDialogData
.GetPrintData());
190 int ret
= genericPrintSetupDialog
->ShowModal();
191 if ( ret
!= wxID_CANCEL
)
193 // Transfer settings to the global object (for compatibility) and to
194 // the print dialog's print data.
195 *wxThePrintSetupData
= genericPrintSetupDialog
->GetPrintData();
196 m_printDialogData
.GetPrintData() = genericPrintSetupDialog
->GetPrintData();
198 genericPrintSetupDialog
->Destroy();
200 // Restore the wxPrintData settings again (uncomment if any settings become common
202 // TransferDataToWindow();
208 return wxDialog::ShowModal();
212 wxGenericPrintDialog::~wxGenericPrintDialog()
216 void wxGenericPrintDialog::OnOK(wxCommandEvent
& WXUNUSED(event
))
218 TransferDataFromWindow();
220 // There are some interactions between the global setup data
221 // and the standard print dialog. The global printing 'mode'
222 // is determined by whether the user checks Print to file
224 if (m_printDialogData
.GetPrintToFile())
226 m_printDialogData
.GetPrintData().SetPrintMode(wxPRINT_MODE_FILE
);
227 wxThePrintSetupData
->SetPrinterMode(wxPRINT_MODE_FILE
);
229 wxString f
= wxFileSelector(_("PostScript file"),
230 wxPathOnly(wxThePrintSetupData
->GetPrinterFile()),
231 wxFileNameFromPath(wxThePrintSetupData
->GetPrinterFile()),
232 "ps", "*.ps", 0, this);
236 m_printDialogData
.GetPrintData().SetFilename(f
);
237 wxThePrintSetupData
->SetPrinterFile(f
);
240 wxThePrintSetupData
->SetPrinterMode(wxPRINT_MODE_PRINTER
);
245 void wxGenericPrintDialog::OnRange(wxCommandEvent
& event
)
247 if (!m_fromText
) return;
249 if (event
.GetInt() == 0)
251 m_fromText
->Enable(FALSE
);
252 m_toText
->Enable(FALSE
);
254 else if (event
.GetInt() == 1)
256 m_fromText
->Enable(TRUE
);
257 m_toText
->Enable(TRUE
);
261 void wxGenericPrintDialog::OnSetup(wxCommandEvent
& WXUNUSED(event
))
263 wxGenericPrintSetupDialog
*genericPrintSetupDialog
=
264 new wxGenericPrintSetupDialog(this, wxThePrintSetupData
);
265 int ret
= genericPrintSetupDialog
->ShowModal();
266 if ( ret
!= wxID_CANCEL
)
268 *wxThePrintSetupData
= genericPrintSetupDialog
->GetPrintData();
269 m_printDialogData
= genericPrintSetupDialog
->GetPrintData();
272 genericPrintSetupDialog
->Close(TRUE
);
275 bool wxGenericPrintDialog::TransferDataToWindow()
279 if(m_printDialogData
.GetFromPage() != 0)
283 if (m_printDialogData
.GetEnablePageNumbers())
285 m_fromText
->Enable(TRUE
);
286 m_toText
->Enable(TRUE
);
287 sprintf(buf
, "%d", m_printDialogData
.GetFromPage());
288 m_fromText
->SetValue(buf
);
289 sprintf(buf
, "%d", m_printDialogData
.GetToPage());
290 m_toText
->SetValue(buf
);
292 if (m_printDialogData
.GetAllPages())
293 m_rangeRadioBox
->SetSelection(0);
295 m_rangeRadioBox
->SetSelection(1);
299 m_fromText
->Enable(FALSE
);
300 m_toText
->Enable(FALSE
);
303 m_rangeRadioBox
->SetSelection(0);
304 m_rangeRadioBox
->wxRadioBox::Enable(1, FALSE
);
309 sprintf(buf
, "%d", m_printDialogData
.GetNoCopies());
310 m_noCopiesText
->SetValue(buf
);
312 m_printToFileCheckBox
->SetValue(m_printDialogData
.GetPrintToFile());
313 m_printToFileCheckBox
->Enable(m_printDialogData
.GetEnablePrintToFile());
317 bool wxGenericPrintDialog::TransferDataFromWindow()
319 if(m_printDialogData
.GetFromPage() != -1)
321 if (m_printDialogData
.GetEnablePageNumbers())
323 if(m_fromText
) m_printDialogData
.SetFromPage(atoi(m_fromText
->GetValue()));
324 if(m_toText
) m_printDialogData
.SetToPage(atoi(m_toText
->GetValue()));
328 if (m_rangeRadioBox
->GetSelection() == 0)
329 m_printDialogData
.SetAllPages(TRUE
);
331 m_printDialogData
.SetAllPages(FALSE
);
335 { // continuous printing
336 m_printDialogData
.SetFromPage(1);
337 m_printDialogData
.SetToPage(32000);
339 m_printDialogData
.SetNoCopies(atoi(m_noCopiesText
->GetValue()));
340 m_printDialogData
.SetPrintToFile(m_printToFileCheckBox
->GetValue());
346 TODO: collate and noCopies should be duplicated across dialog data and print data objects
347 (slightly different semantics on Windows but let's ignore this for a bit).
350 wxDC
*wxGenericPrintDialog::GetPrintDC()
352 return new wxPostScriptDC(wxThePrintSetupData
->GetPrinterFile(), FALSE
, (wxWindow
*) NULL
);
355 // ----------------------------------------------------------------------------
356 // Generic print setup dialog
357 // ----------------------------------------------------------------------------
359 wxGenericPrintSetupDialog::wxGenericPrintSetupDialog(wxWindow
*parent
, wxPrintData
* data
):
360 wxDialog(parent
, -1, _("Print Setup"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE
|wxDIALOG_MODAL
|wxTAB_TRAVERSAL
)
365 // Convert wxPrintSetupData to standard wxPrintData object
366 wxGenericPrintSetupDialog::wxGenericPrintSetupDialog(wxWindow
*parent
, wxPrintSetupData
* data
):
367 wxDialog(parent
, -1, _("Print Setup"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE
|wxDIALOG_MODAL
|wxTAB_TRAVERSAL
)
369 wxPrintData printData
;
373 printData
= * wxThePrintSetupData
;
378 void wxGenericPrintSetupDialog::Init(wxPrintData
* data
)
383 int staticBoxWidth
= 300;
385 (void) new wxStaticBox(this, wxPRINTID_STATIC
, _("Paper size"), wxPoint(10, 10), wxSize(staticBoxWidth
, 60) );
389 m_paperTypeChoice
= CreatePaperTypeChoice(&xPos
, &yPos
);
391 wxString
*choices
= new wxString
[2];
392 choices
[0] = _("Portrait");
393 choices
[1] = _("Landscape");
395 m_orientationRadioBox
= new wxRadioBox(this, wxPRINTID_ORIENTATION
, _("Orientation"),
396 wxPoint(10, 80), wxSize(-1, -1), 2, choices
, 1, wxRA_VERTICAL
);
397 m_orientationRadioBox
->SetSelection(0);
399 (void) new wxStaticBox(this, wxPRINTID_STATIC
, _("Options"), wxPoint(10, 130), wxSize(staticBoxWidth
, 50) );
401 int colourYPos
= 145;
407 m_colourCheckBox
= new wxCheckBox(this, wxPRINTID_PRINTCOLOUR
, _("Print in colour"), wxPoint(15, colourYPos
));
409 (void) new wxStaticBox(this, wxPRINTID_STATIC
, _("Print spooling"), wxPoint(330, 10), wxSize(200,170) );
411 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Printer command:"), wxPoint(340, 30));
413 m_printerCommandText
= new wxTextCtrl(this, wxPRINTID_COMMAND
, "", wxPoint(360, 55), wxSize(150, -1));
415 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Printer options:"), wxPoint(340, 110));
417 m_printerOptionsText
= new wxTextCtrl(this, wxPRINTID_OPTIONS
, "", wxPoint(360, 135), wxSize(150, -1));
419 wxButton
*okButton
= new wxButton(this, wxID_OK
, _("OK"), wxPoint(130, 200), wxSize(100, -1));
420 (void) new wxButton(this, wxID_CANCEL
, _("Cancel"), wxPoint(320, 200), wxSize(100, -1));
422 okButton
->SetDefault();
423 okButton
->SetFocus();
432 wxGenericPrintSetupDialog::~wxGenericPrintSetupDialog()
436 bool wxGenericPrintSetupDialog::TransferDataToWindow()
438 if (m_printerCommandText
&& m_printData
.GetPrinterCommand())
439 m_printerCommandText
->SetValue(m_printData
.GetPrinterCommand());
440 if (m_printerOptionsText
&& m_printData
.GetPrinterOptions())
441 m_printerOptionsText
->SetValue(m_printData
.GetPrinterOptions());
442 if (m_colourCheckBox
)
443 m_colourCheckBox
->SetValue(m_printData
.GetColour());
445 if (m_orientationRadioBox
)
447 if (m_printData
.GetOrientation() == wxPORTRAIT
)
448 m_orientationRadioBox
->SetSelection(0);
450 m_orientationRadioBox
->SetSelection(1);
455 bool wxGenericPrintSetupDialog::TransferDataFromWindow()
457 if (m_printerCommandText
)
458 m_printData
.SetPrinterCommand(m_printerCommandText
->GetValue());
459 if (m_printerOptionsText
)
460 m_printData
.SetPrinterOptions(m_printerOptionsText
->GetValue());
461 if (m_colourCheckBox
)
462 m_printData
.SetColour(m_colourCheckBox
->GetValue());
463 if (m_orientationRadioBox
)
465 int sel
= m_orientationRadioBox
->GetSelection();
467 m_printData
.SetOrientation(wxPORTRAIT
);
469 m_printData
.SetOrientation(wxLANDSCAPE
);
471 if (m_paperTypeChoice
)
473 wxString
val(m_paperTypeChoice
->GetStringSelection());
474 if (!val
.IsNull() && val
!= "")
475 m_printData
.SetPaperId(wxThePrintPaperDatabase
->ConvertNameToId(val
));
478 // This is for backward compatibility only
479 *wxThePrintSetupData
= GetPrintData();
483 wxChoice
*wxGenericPrintSetupDialog::CreatePaperTypeChoice(int *x
, int *y
)
485 /* Should not be necessary
486 if (!wxThePrintPaperDatabase)
488 wxThePrintPaperDatabase = new wxPrintPaperDatabase;
489 wxThePrintPaperDatabase->CreateDatabase();
492 int n
= wxThePrintPaperDatabase
->Number();
493 wxString
*choices
= new wxString
[n
];
496 for (i
= 0; i
< n
; i
++)
498 wxPrintPaperType
*paper
= (wxPrintPaperType
*)wxThePrintPaperDatabase
->Nth(i
)->Data();
499 choices
[i
] = paper
->GetName();
500 if (m_printData
.GetPaperId() == paper
->GetId())
506 wxChoice
*choice
= new wxChoice(this, wxPRINTID_PAPERSIZE
, wxPoint(*x
, *y
), wxSize(width
, -1), n
,
509 // SetFont(thisFont);
513 choice
->SetSelection(sel
);
516 #endif // wxUSE_POSTSCRIPT
518 // ----------------------------------------------------------------------------
519 // Generic page setup dialog
520 // ----------------------------------------------------------------------------
522 void wxGenericPageSetupDialog::OnPrinter(wxCommandEvent
& WXUNUSED(event
))
524 // We no longer query GetPrintMode, so we can eliminate the need
525 // to call SetPrintMode.
526 // This has the limitation that we can't explicitly call the PostScript
527 // print setup dialog from the generic Page Setup dialog under Windows,
528 // but since this choice would only happen when trying to do PostScript
529 // printing under Windows (and only in 16-bit Windows which
530 // doesn't have a Windows-specific page setup dialog) it's worth it.
532 // First save the current settings, so the wxPrintData object is up to date.
533 TransferDataFromWindow();
535 // Transfer the current print settings from this dialog to the page setup dialog.
536 wxPrintDialogData data
;
537 data
= GetPageSetupData().GetPrintData();
538 data
.SetSetupDialog(TRUE
);
539 wxPrintDialog
*printDialog
= new wxPrintDialog(this, & data
);
540 printDialog
->ShowModal();
542 // Transfer the page setup print settings from the page dialog to this dialog again, in case
543 // the page setup dialog changed something.
544 GetPageSetupData().GetPrintData() = printDialog
->GetPrintDialogData().GetPrintData();
545 GetPageSetupData().CalculatePaperSizeFromId(); // Make sure page size reflects the id in wxPrintData
547 printDialog
->Destroy();
549 // Now update the dialog in case the page setup dialog changed some of our settings.
550 TransferDataToWindow();
553 wxGenericPageSetupDialog::wxGenericPageSetupDialog(wxWindow
*parent
, wxPageSetupData
* data
):
554 wxDialog(parent
, -1, _("Page Setup"), wxPoint(0, 0), wxSize(600, 600), wxDIALOG_MODAL
|wxDEFAULT_DIALOG_STYLE
|wxTAB_TRAVERSAL
)
559 int buttonWidth
= 75;
560 int buttonHeight
= 25;
569 wxButton
*okButton
= new wxButton(this, wxID_OK
, _("OK"), wxPoint(5, yPos
), wxSize(buttonWidth
, buttonHeight
));
570 (void) new wxButton(this, wxID_CANCEL
, _("Cancel"), wxPoint(buttonWidth
+ 5 + spacing
, yPos
), wxSize(buttonWidth
, buttonHeight
));
572 m_printerButton
= new wxButton(this, wxPRINTID_SETUP
, _("Printer..."), wxPoint(buttonWidth
*2 + 5 + 2*spacing
, yPos
), wxSize(buttonWidth
, buttonHeight
));
574 if ( !m_pageData
.GetEnablePrinter() )
575 m_printerButton
->Enable(FALSE
);
577 // if (m_printData.GetEnableHelp())
578 // wxButton *helpButton = new wxButton(this, (wxFunction)wxGenericPageSetupHelpProc, _("Help"), -1, -1, buttonWidth, buttonHeight);
580 okButton
->SetDefault();
581 okButton
->SetFocus();
590 m_paperTypeChoice
= CreatePaperTypeChoice(&xPos
, &yPos
);
594 wxString
*choices
= new wxString
[2];
595 choices
[0] = _("Portrait");
596 choices
[1] = _("Landscape");
597 m_orientationRadioBox
= new wxRadioBox(this, wxPRINTID_ORIENTATION
, _("Orientation"),
598 wxPoint(xPos
, yPos
), wxSize(-1, -1), 2, choices
, 2);
599 m_orientationRadioBox
->SetSelection(0);
604 int staticWidth
= 110;
612 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Left margin (mm):"), wxPoint(xPos
, yPos
));
615 m_marginLeftText
= new wxTextCtrl(this, wxPRINTID_LEFTMARGIN
, "", wxPoint(xPos
, yPos
), wxSize(textWidth
, -1));
616 xPos
+= textWidth
+ spacing
;
618 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Right margin (mm):"), wxPoint(xPos
, yPos
));
621 m_marginRightText
= new wxTextCtrl(this, wxPRINTID_RIGHTMARGIN
, "", wxPoint(xPos
, yPos
), wxSize(textWidth
, -1));
622 xPos
+= textWidth
+ spacing
;
627 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Top margin (mm):"), wxPoint(xPos
, yPos
));
630 m_marginTopText
= new wxTextCtrl(this, wxPRINTID_TOPMARGIN
, "", wxPoint(xPos
, yPos
), wxSize(textWidth
, -1));
631 xPos
+= textWidth
+ spacing
;
633 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Bottom margin (mm):"), wxPoint(xPos
, yPos
));
636 m_marginBottomText
= new wxTextCtrl(this, wxPRINTID_BOTTOMMARGIN
, "", wxPoint(xPos
, yPos
), wxSize(textWidth
, -1));
645 wxGenericPageSetupDialog::~wxGenericPageSetupDialog()
649 bool wxGenericPageSetupDialog::TransferDataToWindow()
651 if (m_marginLeftText
)
652 m_marginLeftText
->SetValue(IntToString((int) m_pageData
.GetMarginTopLeft().x
));
654 m_marginTopText
->SetValue(IntToString((int) m_pageData
.GetMarginTopLeft().y
));
655 if (m_marginRightText
)
656 m_marginRightText
->SetValue(IntToString((int) m_pageData
.GetMarginBottomRight().x
));
657 if (m_marginBottomText
)
658 m_marginBottomText
->SetValue(IntToString((int) m_pageData
.GetMarginBottomRight().y
));
660 if (m_orientationRadioBox
)
662 if (m_pageData
.GetPrintData().GetOrientation() == wxPORTRAIT
)
663 m_orientationRadioBox
->SetSelection(0);
665 m_orientationRadioBox
->SetSelection(1);
668 // Find the paper type from either the current paper size in the wxPageSetupDialogData, or
669 // failing that, the id in the wxPrintData object.
671 wxPrintPaperType
* type
= wxThePrintPaperDatabase
->FindPaperType(
672 wxSize(m_pageData
.GetPaperSize().x
* 10, m_pageData
.GetPaperSize().y
* 10));
674 if (!type
&& m_pageData
.GetPrintData().GetPaperId() != wxPAPER_NONE
)
675 type
= wxThePrintPaperDatabase
->FindPaperType(m_pageData
.GetPrintData().GetPaperId());
679 m_paperTypeChoice
->SetStringSelection(type
->GetName());
685 bool wxGenericPageSetupDialog::TransferDataFromWindow()
687 if (m_marginLeftText
&& m_marginTopText
)
688 m_pageData
.SetMarginTopLeft(wxPoint(atoi((const char *)m_marginLeftText
->GetValue()),atoi((const char *)m_marginTopText
->GetValue())));
689 if (m_marginRightText
&& m_marginBottomText
)
690 m_pageData
.SetMarginBottomRight(wxPoint(atoi((const char *)m_marginRightText
->GetValue()),atoi((const char *)m_marginBottomText
->GetValue())));
692 if (m_orientationRadioBox
)
694 int sel
= m_orientationRadioBox
->GetSelection();
698 wxThePrintSetupData
->SetPrinterOrientation(wxPORTRAIT
);
700 m_pageData
.GetPrintData().SetOrientation(wxPORTRAIT
);
705 wxThePrintSetupData
->SetPrinterOrientation(wxLANDSCAPE
);
707 m_pageData
.GetPrintData().SetOrientation(wxLANDSCAPE
);
710 if (m_paperTypeChoice
)
712 wxString
val(m_paperTypeChoice
->GetStringSelection());
713 if (!val
.IsNull() && val
!= "")
715 wxPrintPaperType
* paper
= wxThePrintPaperDatabase
->FindPaperType(val
);
718 m_pageData
.SetPaperSize(wxSize(paper
->GetWidth()/10, paper
->GetHeight()/10));
719 m_pageData
.GetPrintData().SetPaperId(paper
->GetId());
727 wxChoice
*wxGenericPageSetupDialog::CreatePaperTypeChoice(int *x
, int *y
)
730 if (!wxThePrintPaperDatabase)
732 wxThePrintPaperDatabase = new wxPrintPaperDatabase;
733 wxThePrintPaperDatabase->CreateDatabase();
737 int n
= wxThePrintPaperDatabase
->Number();
738 wxString
*choices
= new wxString
[n
];
740 for (i
= 0; i
< n
; i
++)
742 wxPrintPaperType
*paper
= (wxPrintPaperType
*)wxThePrintPaperDatabase
->Nth(i
)->Data();
743 choices
[i
] = paper
->GetName();
746 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Paper size"), wxPoint(*x
, *y
));
749 wxChoice
*choice
= new wxChoice(this, wxPRINTID_PAPERSIZE
, wxPoint(*x
, *y
), wxSize(300, -1), n
,
754 // choice->SetSelection(sel);