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
,
116 : wxDialog(parent
, -1, _("Print"),
117 wxPoint(0, 0), wxSize(600, 600),
118 wxDEFAULT_DIALOG_STYLE
|
123 m_printDialogData
= *data
;
128 void wxGenericPrintDialog::Init(wxWindow
*parent
)
130 // wxDialog::Create(parent, -1, _("Print"), wxPoint(0, 0), wxSize(600, 600),
131 // wxDEFAULT_DIALOG_STYLE | wxDIALOG_MODAL | wxTAB_TRAVERSAL);
133 (void)new wxStaticBox( this, -1, _( "Printer options" ), wxPoint( 5, 5), wxSize( 300, 60 ) );
135 m_printToFileCheckBox
= new wxCheckBox(this, wxPRINTID_PRINTTOFILE
, _("Print to File"), wxPoint(20, 25) );
137 m_setupButton
= new wxButton(this, wxPRINTID_SETUP
, _("Setup..."), wxPoint(160, 25), wxSize(100, -1));
139 wxString
*choices
= new wxString
[2];
140 choices
[0] = _("All");
141 choices
[1] = _("Pages");
143 m_fromText
= (wxTextCtrl
*)NULL
;
144 m_toText
= (wxTextCtrl
*)NULL
;
145 m_rangeRadioBox
= (wxRadioBox
*)NULL
;
147 if (m_printDialogData
.GetFromPage() != 0)
149 m_rangeRadioBox
= new wxRadioBox(this, wxPRINTID_RANGE
, _("Print Range"),
150 wxPoint(5, 80), wxSize(-1, -1),
153 m_rangeRadioBox
->SetSelection(1);
156 if(m_printDialogData
.GetFromPage() != 0)
158 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("From:"), wxPoint(5, 135));
160 m_fromText
= new wxTextCtrl(this, wxPRINTID_FROM
, "", wxPoint(45, 130), wxSize(40, -1));
162 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("To:"), wxPoint(100, 135));
164 m_toText
= new wxTextCtrl(this, wxPRINTID_TO
, "", wxPoint(133, 130), wxSize(40, -1));
167 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Copies:"), wxPoint(200, 135));
169 m_noCopiesText
= new wxTextCtrl(this, wxPRINTID_COPIES
, "", wxPoint(252, 130), wxSize(40, -1));
171 wxButton
*okButton
= new wxButton(this, wxID_OK
, _("OK"), wxPoint(40, 180), wxSize(100, -1));
172 (void) new wxButton(this, wxID_CANCEL
, _("Cancel"), wxPoint(180, 180), wxSize(100, -1));
174 okButton
->SetDefault();
175 okButton
->SetFocus();
179 // Calls wxWindow::OnInitDialog and then wxGenericPrintDialog::TransferDataToWindow
184 int wxGenericPrintDialog::ShowModal()
186 if ( m_printDialogData
.GetSetupDialog() )
188 // Make sure wxPrintData object reflects the settings now, in case the setup dialog
189 // changes it. In fact there aren't any common settings at
190 // present, but there might be in future.
191 // TransferDataFromWindow();
193 wxGenericPrintSetupDialog
*genericPrintSetupDialog
=
194 new wxGenericPrintSetupDialog(this, & m_printDialogData
.GetPrintData());
195 int ret
= genericPrintSetupDialog
->ShowModal();
196 if ( ret
!= wxID_CANCEL
)
198 // Transfer settings to the global object (for compatibility) and to
199 // the print dialog's print data.
200 *wxThePrintSetupData
= genericPrintSetupDialog
->GetPrintData();
201 m_printDialogData
.GetPrintData() = genericPrintSetupDialog
->GetPrintData();
203 genericPrintSetupDialog
->Destroy();
205 // Restore the wxPrintData settings again (uncomment if any settings become common
207 // TransferDataToWindow();
213 return wxDialog::ShowModal();
217 wxGenericPrintDialog::~wxGenericPrintDialog()
221 void wxGenericPrintDialog::OnOK(wxCommandEvent
& WXUNUSED(event
))
223 TransferDataFromWindow();
225 // There are some interactions between the global setup data
226 // and the standard print dialog. The global printing 'mode'
227 // is determined by whether the user checks Print to file
229 if (m_printDialogData
.GetPrintToFile())
231 m_printDialogData
.GetPrintData().SetPrintMode(wxPRINT_MODE_FILE
);
232 wxThePrintSetupData
->SetPrinterMode(wxPRINT_MODE_FILE
);
234 wxString f
= wxFileSelector(_("PostScript file"),
235 wxPathOnly(wxThePrintSetupData
->GetPrinterFile()),
236 wxFileNameFromPath(wxThePrintSetupData
->GetPrinterFile()),
237 "ps", "*.ps", 0, this);
241 m_printDialogData
.GetPrintData().SetFilename(f
);
242 wxThePrintSetupData
->SetPrinterFile(f
);
245 wxThePrintSetupData
->SetPrinterMode(wxPRINT_MODE_PRINTER
);
250 void wxGenericPrintDialog::OnRange(wxCommandEvent
& event
)
252 if (!m_fromText
) return;
254 if (event
.GetInt() == 0)
256 m_fromText
->Enable(FALSE
);
257 m_toText
->Enable(FALSE
);
259 else if (event
.GetInt() == 1)
261 m_fromText
->Enable(TRUE
);
262 m_toText
->Enable(TRUE
);
266 void wxGenericPrintDialog::OnSetup(wxCommandEvent
& WXUNUSED(event
))
268 wxGenericPrintSetupDialog
*genericPrintSetupDialog
=
269 new wxGenericPrintSetupDialog(this, wxThePrintSetupData
);
270 int ret
= genericPrintSetupDialog
->ShowModal();
271 if ( ret
!= wxID_CANCEL
)
273 *wxThePrintSetupData
= genericPrintSetupDialog
->GetPrintData();
274 m_printDialogData
= genericPrintSetupDialog
->GetPrintData();
277 genericPrintSetupDialog
->Close(TRUE
);
280 bool wxGenericPrintDialog::TransferDataToWindow()
284 if(m_printDialogData
.GetFromPage() != 0)
288 if (m_printDialogData
.GetEnablePageNumbers())
290 m_fromText
->Enable(TRUE
);
291 m_toText
->Enable(TRUE
);
292 sprintf(buf
, "%d", m_printDialogData
.GetFromPage());
293 m_fromText
->SetValue(buf
);
294 sprintf(buf
, "%d", m_printDialogData
.GetToPage());
295 m_toText
->SetValue(buf
);
297 if (m_printDialogData
.GetAllPages())
298 m_rangeRadioBox
->SetSelection(0);
300 m_rangeRadioBox
->SetSelection(1);
304 m_fromText
->Enable(FALSE
);
305 m_toText
->Enable(FALSE
);
308 m_rangeRadioBox
->SetSelection(0);
309 m_rangeRadioBox
->wxRadioBox::Enable(1, FALSE
);
314 sprintf(buf
, "%d", m_printDialogData
.GetNoCopies());
315 m_noCopiesText
->SetValue(buf
);
317 m_printToFileCheckBox
->SetValue(m_printDialogData
.GetPrintToFile());
318 m_printToFileCheckBox
->Enable(m_printDialogData
.GetEnablePrintToFile());
322 bool wxGenericPrintDialog::TransferDataFromWindow()
324 if(m_printDialogData
.GetFromPage() != -1)
326 if (m_printDialogData
.GetEnablePageNumbers())
328 if(m_fromText
) m_printDialogData
.SetFromPage(atoi(m_fromText
->GetValue()));
329 if(m_toText
) m_printDialogData
.SetToPage(atoi(m_toText
->GetValue()));
333 if (m_rangeRadioBox
->GetSelection() == 0)
334 m_printDialogData
.SetAllPages(TRUE
);
336 m_printDialogData
.SetAllPages(FALSE
);
340 { // continuous printing
341 m_printDialogData
.SetFromPage(1);
342 m_printDialogData
.SetToPage(32000);
344 m_printDialogData
.SetNoCopies(atoi(m_noCopiesText
->GetValue()));
345 m_printDialogData
.SetPrintToFile(m_printToFileCheckBox
->GetValue());
351 TODO: collate and noCopies should be duplicated across dialog data and print data objects
352 (slightly different semantics on Windows but let's ignore this for a bit).
355 wxDC
*wxGenericPrintDialog::GetPrintDC()
357 return new wxPostScriptDC(wxThePrintSetupData
->GetPrinterFile(), FALSE
, (wxWindow
*) NULL
);
360 // ----------------------------------------------------------------------------
361 // Generic print setup dialog
362 // ----------------------------------------------------------------------------
364 wxGenericPrintSetupDialog::wxGenericPrintSetupDialog(wxWindow
*parent
, wxPrintData
* data
):
365 wxDialog(parent
, -1, _("Print Setup"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE
|wxDIALOG_MODAL
|wxTAB_TRAVERSAL
)
370 // Convert wxPrintSetupData to standard wxPrintData object
371 wxGenericPrintSetupDialog::wxGenericPrintSetupDialog(wxWindow
*parent
, wxPrintSetupData
* data
):
372 wxDialog(parent
, -1, _("Print Setup"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE
|wxDIALOG_MODAL
|wxTAB_TRAVERSAL
)
374 wxPrintData printData
;
378 printData
= * wxThePrintSetupData
;
383 void wxGenericPrintSetupDialog::Init(wxPrintData
* data
)
388 int staticBoxWidth
= 300;
390 (void) new wxStaticBox(this, wxPRINTID_STATIC
, _("Paper size"), wxPoint(10, 10), wxSize(staticBoxWidth
, 60) );
394 m_paperTypeChoice
= CreatePaperTypeChoice(&xPos
, &yPos
);
396 wxString
*choices
= new wxString
[2];
397 choices
[0] = _("Portrait");
398 choices
[1] = _("Landscape");
400 m_orientationRadioBox
= new wxRadioBox(this, wxPRINTID_ORIENTATION
, _("Orientation"),
401 wxPoint(10, 80), wxSize(-1, -1), 2, choices
, 1, wxRA_VERTICAL
);
402 m_orientationRadioBox
->SetSelection(0);
404 (void) new wxStaticBox(this, wxPRINTID_STATIC
, _("Options"), wxPoint(10, 130), wxSize(staticBoxWidth
, 50) );
406 int colourYPos
= 145;
412 m_colourCheckBox
= new wxCheckBox(this, wxPRINTID_PRINTCOLOUR
, _("Print in colour"), wxPoint(15, colourYPos
));
414 (void) new wxStaticBox(this, wxPRINTID_STATIC
, _("Print spooling"), wxPoint(330, 10), wxSize(200,170) );
416 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Printer command:"), wxPoint(340, 30));
418 m_printerCommandText
= new wxTextCtrl(this, wxPRINTID_COMMAND
, "", wxPoint(360, 55), wxSize(150, -1));
420 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Printer options:"), wxPoint(340, 110));
422 m_printerOptionsText
= new wxTextCtrl(this, wxPRINTID_OPTIONS
, "", wxPoint(360, 135), wxSize(150, -1));
424 wxButton
*okButton
= new wxButton(this, wxID_OK
, _("OK"), wxPoint(130, 200), wxSize(100, -1));
425 (void) new wxButton(this, wxID_CANCEL
, _("Cancel"), wxPoint(320, 200), wxSize(100, -1));
427 okButton
->SetDefault();
428 okButton
->SetFocus();
437 wxGenericPrintSetupDialog::~wxGenericPrintSetupDialog()
441 bool wxGenericPrintSetupDialog::TransferDataToWindow()
443 if (m_printerCommandText
&& m_printData
.GetPrinterCommand())
444 m_printerCommandText
->SetValue(m_printData
.GetPrinterCommand());
445 if (m_printerOptionsText
&& m_printData
.GetPrinterOptions())
446 m_printerOptionsText
->SetValue(m_printData
.GetPrinterOptions());
447 if (m_colourCheckBox
)
448 m_colourCheckBox
->SetValue(m_printData
.GetColour());
450 if (m_orientationRadioBox
)
452 if (m_printData
.GetOrientation() == wxPORTRAIT
)
453 m_orientationRadioBox
->SetSelection(0);
455 m_orientationRadioBox
->SetSelection(1);
460 bool wxGenericPrintSetupDialog::TransferDataFromWindow()
462 if (m_printerCommandText
)
463 m_printData
.SetPrinterCommand(m_printerCommandText
->GetValue());
464 if (m_printerOptionsText
)
465 m_printData
.SetPrinterOptions(m_printerOptionsText
->GetValue());
466 if (m_colourCheckBox
)
467 m_printData
.SetColour(m_colourCheckBox
->GetValue());
468 if (m_orientationRadioBox
)
470 int sel
= m_orientationRadioBox
->GetSelection();
472 m_printData
.SetOrientation(wxPORTRAIT
);
474 m_printData
.SetOrientation(wxLANDSCAPE
);
476 if (m_paperTypeChoice
)
478 wxString
val(m_paperTypeChoice
->GetStringSelection());
479 if (!val
.IsNull() && val
!= "")
480 m_printData
.SetPaperId(wxThePrintPaperDatabase
->ConvertNameToId(val
));
483 // This is for backward compatibility only
484 *wxThePrintSetupData
= GetPrintData();
488 wxChoice
*wxGenericPrintSetupDialog::CreatePaperTypeChoice(int *x
, int *y
)
490 /* Should not be necessary
491 if (!wxThePrintPaperDatabase)
493 wxThePrintPaperDatabase = new wxPrintPaperDatabase;
494 wxThePrintPaperDatabase->CreateDatabase();
497 int n
= wxThePrintPaperDatabase
->Number();
498 wxString
*choices
= new wxString
[n
];
501 for (i
= 0; i
< n
; i
++)
503 wxPrintPaperType
*paper
= (wxPrintPaperType
*)wxThePrintPaperDatabase
->Nth(i
)->Data();
504 choices
[i
] = paper
->GetName();
505 if (m_printData
.GetPaperId() == paper
->GetId())
511 wxChoice
*choice
= new wxChoice(this, wxPRINTID_PAPERSIZE
, wxPoint(*x
, *y
), wxSize(width
, -1), n
,
514 // SetFont(thisFont);
518 choice
->SetSelection(sel
);
521 #endif // wxUSE_POSTSCRIPT
523 // ----------------------------------------------------------------------------
524 // Generic page setup dialog
525 // ----------------------------------------------------------------------------
527 void wxGenericPageSetupDialog::OnPrinter(wxCommandEvent
& WXUNUSED(event
))
529 // We no longer query GetPrintMode, so we can eliminate the need
530 // to call SetPrintMode.
531 // This has the limitation that we can't explicitly call the PostScript
532 // print setup dialog from the generic Page Setup dialog under Windows,
533 // but since this choice would only happen when trying to do PostScript
534 // printing under Windows (and only in 16-bit Windows which
535 // doesn't have a Windows-specific page setup dialog) it's worth it.
537 // First save the current settings, so the wxPrintData object is up to date.
538 TransferDataFromWindow();
540 // Transfer the current print settings from this dialog to the page setup dialog.
541 wxPrintDialogData data
;
542 data
= GetPageSetupData().GetPrintData();
543 data
.SetSetupDialog(TRUE
);
544 wxPrintDialog
*printDialog
= new wxPrintDialog(this, & data
);
545 printDialog
->ShowModal();
547 // Transfer the page setup print settings from the page dialog to this dialog again, in case
548 // the page setup dialog changed something.
549 GetPageSetupData().GetPrintData() = printDialog
->GetPrintDialogData().GetPrintData();
550 GetPageSetupData().CalculatePaperSizeFromId(); // Make sure page size reflects the id in wxPrintData
552 printDialog
->Destroy();
554 // Now update the dialog in case the page setup dialog changed some of our settings.
555 TransferDataToWindow();
558 wxGenericPageSetupDialog::wxGenericPageSetupDialog(wxWindow
*parent
, wxPageSetupData
* data
):
559 wxDialog(parent
, -1, _("Page Setup"), wxPoint(0, 0), wxSize(600, 600), wxDIALOG_MODAL
|wxDEFAULT_DIALOG_STYLE
|wxTAB_TRAVERSAL
)
564 int buttonWidth
= 75;
565 int buttonHeight
= 25;
574 wxButton
*okButton
= new wxButton(this, wxID_OK
, _("OK"), wxPoint(5, yPos
), wxSize(buttonWidth
, buttonHeight
));
575 (void) new wxButton(this, wxID_CANCEL
, _("Cancel"), wxPoint(buttonWidth
+ 5 + spacing
, yPos
), wxSize(buttonWidth
, buttonHeight
));
577 m_printerButton
= new wxButton(this, wxPRINTID_SETUP
, _("Printer..."), wxPoint(buttonWidth
*2 + 5 + 2*spacing
, yPos
), wxSize(buttonWidth
, buttonHeight
));
579 if ( !m_pageData
.GetEnablePrinter() )
580 m_printerButton
->Enable(FALSE
);
582 // if (m_printData.GetEnableHelp())
583 // wxButton *helpButton = new wxButton(this, (wxFunction)wxGenericPageSetupHelpProc, _("Help"), -1, -1, buttonWidth, buttonHeight);
585 okButton
->SetDefault();
586 okButton
->SetFocus();
595 m_paperTypeChoice
= CreatePaperTypeChoice(&xPos
, &yPos
);
599 wxString
*choices
= new wxString
[2];
600 choices
[0] = _("Portrait");
601 choices
[1] = _("Landscape");
602 m_orientationRadioBox
= new wxRadioBox(this, wxPRINTID_ORIENTATION
, _("Orientation"),
603 wxPoint(xPos
, yPos
), wxSize(-1, -1), 2, choices
, 2);
604 m_orientationRadioBox
->SetSelection(0);
609 int staticWidth
= 110;
617 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Left margin (mm):"), wxPoint(xPos
, yPos
));
620 m_marginLeftText
= new wxTextCtrl(this, wxPRINTID_LEFTMARGIN
, "", wxPoint(xPos
, yPos
), wxSize(textWidth
, -1));
621 xPos
+= textWidth
+ spacing
;
623 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Right margin (mm):"), wxPoint(xPos
, yPos
));
626 m_marginRightText
= new wxTextCtrl(this, wxPRINTID_RIGHTMARGIN
, "", wxPoint(xPos
, yPos
), wxSize(textWidth
, -1));
627 xPos
+= textWidth
+ spacing
;
632 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Top margin (mm):"), wxPoint(xPos
, yPos
));
635 m_marginTopText
= new wxTextCtrl(this, wxPRINTID_TOPMARGIN
, "", wxPoint(xPos
, yPos
), wxSize(textWidth
, -1));
636 xPos
+= textWidth
+ spacing
;
638 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Bottom margin (mm):"), wxPoint(xPos
, yPos
));
641 m_marginBottomText
= new wxTextCtrl(this, wxPRINTID_BOTTOMMARGIN
, "", wxPoint(xPos
, yPos
), wxSize(textWidth
, -1));
650 wxGenericPageSetupDialog::~wxGenericPageSetupDialog()
654 bool wxGenericPageSetupDialog::TransferDataToWindow()
656 if (m_marginLeftText
)
657 m_marginLeftText
->SetValue(IntToString((int) m_pageData
.GetMarginTopLeft().x
));
659 m_marginTopText
->SetValue(IntToString((int) m_pageData
.GetMarginTopLeft().y
));
660 if (m_marginRightText
)
661 m_marginRightText
->SetValue(IntToString((int) m_pageData
.GetMarginBottomRight().x
));
662 if (m_marginBottomText
)
663 m_marginBottomText
->SetValue(IntToString((int) m_pageData
.GetMarginBottomRight().y
));
665 if (m_orientationRadioBox
)
667 if (m_pageData
.GetPrintData().GetOrientation() == wxPORTRAIT
)
668 m_orientationRadioBox
->SetSelection(0);
670 m_orientationRadioBox
->SetSelection(1);
673 // Find the paper type from either the current paper size in the wxPageSetupDialogData, or
674 // failing that, the id in the wxPrintData object.
676 wxPrintPaperType
* type
= wxThePrintPaperDatabase
->FindPaperType(
677 wxSize(m_pageData
.GetPaperSize().x
* 10, m_pageData
.GetPaperSize().y
* 10));
679 if (!type
&& m_pageData
.GetPrintData().GetPaperId() != wxPAPER_NONE
)
680 type
= wxThePrintPaperDatabase
->FindPaperType(m_pageData
.GetPrintData().GetPaperId());
684 m_paperTypeChoice
->SetStringSelection(type
->GetName());
690 bool wxGenericPageSetupDialog::TransferDataFromWindow()
692 if (m_marginLeftText
&& m_marginTopText
)
693 m_pageData
.SetMarginTopLeft(wxPoint(atoi((const char *)m_marginLeftText
->GetValue()),atoi((const char *)m_marginTopText
->GetValue())));
694 if (m_marginRightText
&& m_marginBottomText
)
695 m_pageData
.SetMarginBottomRight(wxPoint(atoi((const char *)m_marginRightText
->GetValue()),atoi((const char *)m_marginBottomText
->GetValue())));
697 if (m_orientationRadioBox
)
699 int sel
= m_orientationRadioBox
->GetSelection();
703 wxThePrintSetupData
->SetPrinterOrientation(wxPORTRAIT
);
705 m_pageData
.GetPrintData().SetOrientation(wxPORTRAIT
);
710 wxThePrintSetupData
->SetPrinterOrientation(wxLANDSCAPE
);
712 m_pageData
.GetPrintData().SetOrientation(wxLANDSCAPE
);
715 if (m_paperTypeChoice
)
717 wxString
val(m_paperTypeChoice
->GetStringSelection());
718 if (!val
.IsNull() && val
!= "")
720 wxPrintPaperType
* paper
= wxThePrintPaperDatabase
->FindPaperType(val
);
723 m_pageData
.SetPaperSize(wxSize(paper
->GetWidth()/10, paper
->GetHeight()/10));
724 m_pageData
.GetPrintData().SetPaperId(paper
->GetId());
732 wxChoice
*wxGenericPageSetupDialog::CreatePaperTypeChoice(int *x
, int *y
)
735 if (!wxThePrintPaperDatabase)
737 wxThePrintPaperDatabase = new wxPrintPaperDatabase;
738 wxThePrintPaperDatabase->CreateDatabase();
742 int n
= wxThePrintPaperDatabase
->Number();
743 wxString
*choices
= new wxString
[n
];
745 for (i
= 0; i
< n
; i
++)
747 wxPrintPaperType
*paper
= (wxPrintPaperType
*)wxThePrintPaperDatabase
->Nth(i
)->Data();
748 choices
[i
] = paper
->GetName();
751 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Paper size"), wxPoint(*x
, *y
));
754 wxChoice
*choice
= new wxChoice(this, wxPRINTID_PAPERSIZE
, wxPoint(*x
, *y
), wxSize(300, -1), n
,
759 // choice->SetSelection(sel);