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"
33 #if wxUSE_PRINTING_ARCHITECTURE
40 #include "wx/stattext.h"
41 #include "wx/statbox.h"
42 #include "wx/button.h"
43 #include "wx/checkbox.h"
44 #include "wx/textctrl.h"
45 #include "wx/radiobox.h"
46 #include "wx/filedlg.h"
47 #include "wx/choice.h"
48 #include "wx/combobox.h"
52 #include "wx/generic/prntdlgg.h"
55 #include "wx/generic/dcpsg.h"
58 #include "wx/printdlg.h"
61 // For print paper things
62 #include "wx/prntbase.h"
67 // ----------------------------------------------------------------------------
69 // ----------------------------------------------------------------------------
71 #if !USE_SHARED_LIBRARY
75 IMPLEMENT_CLASS(wxGenericPrintDialog
, wxDialog
)
76 IMPLEMENT_CLASS(wxGenericPrintSetupDialog
, wxDialog
)
78 BEGIN_EVENT_TABLE(wxGenericPrintDialog
, wxDialog
)
79 EVT_BUTTON(wxID_OK
, wxGenericPrintDialog::OnOK
)
80 EVT_BUTTON(wxPRINTID_SETUP
, wxGenericPrintDialog::OnSetup
)
81 EVT_RADIOBOX(wxPRINTID_RANGE
, wxGenericPrintDialog::OnRange
)
85 IMPLEMENT_CLASS(wxGenericPageSetupDialog
, wxDialog
)
87 BEGIN_EVENT_TABLE(wxGenericPageSetupDialog
, wxDialog
)
88 EVT_BUTTON(wxPRINTID_SETUP
, wxGenericPageSetupDialog::OnPrinter
)
90 #endif // USE_SHARED_LIBRARY
92 // ----------------------------------------------------------------------------
94 // ----------------------------------------------------------------------------
96 extern wxPrintPaperDatabase
*wxThePrintPaperDatabase
;
100 // ============================================================================
102 // ============================================================================
104 // ----------------------------------------------------------------------------
105 // Generic print dialog for non-Windows printing use.
106 // ----------------------------------------------------------------------------
108 wxGenericPrintDialog::wxGenericPrintDialog(wxWindow
*parent
,
109 wxPrintDialogData
* data
)
110 : wxDialog(parent
, -1, _("Print"),
111 wxPoint(0, 0), wxSize(600, 600),
112 wxDEFAULT_DIALOG_STYLE
|
117 m_printDialogData
= *data
;
122 wxGenericPrintDialog::wxGenericPrintDialog(wxWindow
*parent
,
124 : wxDialog(parent
, -1, _("Print"),
125 wxPoint(0, 0), wxSize(600, 600),
126 wxDEFAULT_DIALOG_STYLE
|
131 m_printDialogData
= *data
;
136 void wxGenericPrintDialog::Init(wxWindow
* WXUNUSED(parent
))
138 // wxDialog::Create(parent, -1, _("Print"), wxPoint(0, 0), wxSize(600, 600),
139 // wxDEFAULT_DIALOG_STYLE | wxDIALOG_MODAL | wxTAB_TRAVERSAL);
141 (void)new wxStaticBox( this, -1, _( "Printer options" ), wxPoint( 5, 5), wxSize( 300, 60 ) );
143 m_printToFileCheckBox
= new wxCheckBox(this, wxPRINTID_PRINTTOFILE
, _("Print to File"), wxPoint(20, 25) );
145 m_setupButton
= new wxButton(this, wxPRINTID_SETUP
, _("Setup..."), wxPoint(160, 25), wxSize(100, -1));
147 wxString
*choices
= new wxString
[2];
148 choices
[0] = _("All");
149 choices
[1] = _("Pages");
151 m_fromText
= (wxTextCtrl
*)NULL
;
152 m_toText
= (wxTextCtrl
*)NULL
;
153 m_rangeRadioBox
= (wxRadioBox
*)NULL
;
155 if (m_printDialogData
.GetFromPage() != 0)
157 m_rangeRadioBox
= new wxRadioBox(this, wxPRINTID_RANGE
, _("Print Range"),
158 wxPoint(5, 80), wxSize(-1, -1),
161 m_rangeRadioBox
->SetSelection(1);
164 if(m_printDialogData
.GetFromPage() != 0)
166 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("From:"), wxPoint(5, 135));
168 m_fromText
= new wxTextCtrl(this, wxPRINTID_FROM
, "", wxPoint(45, 130), wxSize(40, -1));
170 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("To:"), wxPoint(100, 135));
172 m_toText
= new wxTextCtrl(this, wxPRINTID_TO
, "", wxPoint(133, 130), wxSize(40, -1));
175 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Copies:"), wxPoint(200, 135));
177 m_noCopiesText
= new wxTextCtrl(this, wxPRINTID_COPIES
, "", wxPoint(252, 130), wxSize(40, -1));
179 wxButton
*okButton
= new wxButton(this, wxID_OK
, _("OK"), wxPoint(40, 180), wxSize(80, -1));
180 (void) new wxButton(this, wxID_CANCEL
, _("Cancel"), wxPoint(180, 180), wxSize(80, -1));
182 okButton
->SetDefault();
183 okButton
->SetFocus();
187 // Calls wxWindow::OnInitDialog and then wxGenericPrintDialog::TransferDataToWindow
192 int wxGenericPrintDialog::ShowModal()
194 if ( m_printDialogData
.GetSetupDialog() )
196 // Make sure wxPrintData object reflects the settings now, in case the setup dialog
197 // changes it. In fact there aren't any common settings at
198 // present, but there might be in future.
199 // TransferDataFromWindow();
201 wxGenericPrintSetupDialog
*genericPrintSetupDialog
=
202 new wxGenericPrintSetupDialog(this, & m_printDialogData
.GetPrintData());
203 int ret
= genericPrintSetupDialog
->ShowModal();
204 if ( ret
!= wxID_CANCEL
)
206 // Transfer settings to the global object (for compatibility) and to
207 // the print dialog's print data.
208 *wxThePrintSetupData
= genericPrintSetupDialog
->GetPrintData();
209 m_printDialogData
.GetPrintData() = genericPrintSetupDialog
->GetPrintData();
211 genericPrintSetupDialog
->Destroy();
213 // Restore the wxPrintData settings again (uncomment if any settings become common
215 // TransferDataToWindow();
221 return wxDialog::ShowModal();
225 wxGenericPrintDialog::~wxGenericPrintDialog()
229 void wxGenericPrintDialog::OnOK(wxCommandEvent
& WXUNUSED(event
))
231 TransferDataFromWindow();
233 // There are some interactions between the global setup data
234 // and the standard print dialog. The global printing 'mode'
235 // is determined by whether the user checks Print to file
237 if (m_printDialogData
.GetPrintToFile())
239 m_printDialogData
.GetPrintData().SetPrintMode(wxPRINT_MODE_FILE
);
240 wxThePrintSetupData
->SetPrinterMode(wxPRINT_MODE_FILE
);
242 wxString f
= wxFileSelector(_("PostScript file"),
243 wxPathOnly(wxThePrintSetupData
->GetPrinterFile()),
244 wxFileNameFromPath(wxThePrintSetupData
->GetPrinterFile()),
245 _T("ps"), _T("*.ps"), 0, this);
249 m_printDialogData
.GetPrintData().SetFilename(f
);
250 wxThePrintSetupData
->SetPrinterFile(f
);
254 m_printDialogData
.GetPrintData().SetPrintMode(wxPRINT_MODE_PRINTER
);
255 wxThePrintSetupData
->SetPrinterMode(wxPRINT_MODE_PRINTER
);
261 void wxGenericPrintDialog::OnRange(wxCommandEvent
& event
)
263 if (!m_fromText
) return;
265 if (event
.GetInt() == 0)
267 m_fromText
->Enable(FALSE
);
268 m_toText
->Enable(FALSE
);
270 else if (event
.GetInt() == 1)
272 m_fromText
->Enable(TRUE
);
273 m_toText
->Enable(TRUE
);
277 void wxGenericPrintDialog::OnSetup(wxCommandEvent
& WXUNUSED(event
))
279 *wxThePrintSetupData
= m_printDialogData
.GetPrintData();
280 wxGenericPrintSetupDialog
*genericPrintSetupDialog
=
281 new wxGenericPrintSetupDialog(this, wxThePrintSetupData
);
282 int ret
= genericPrintSetupDialog
->ShowModal();
283 if ( ret
!= wxID_CANCEL
)
285 *wxThePrintSetupData
= genericPrintSetupDialog
->GetPrintData();
286 m_printDialogData
= genericPrintSetupDialog
->GetPrintData();
289 genericPrintSetupDialog
->Close(TRUE
);
292 bool wxGenericPrintDialog::TransferDataToWindow()
296 if(m_printDialogData
.GetFromPage() != 0)
300 if (m_printDialogData
.GetEnablePageNumbers())
302 m_fromText
->Enable(TRUE
);
303 m_toText
->Enable(TRUE
);
304 sprintf(buf
, "%d", m_printDialogData
.GetFromPage());
305 m_fromText
->SetValue(buf
);
306 sprintf(buf
, "%d", m_printDialogData
.GetToPage());
307 m_toText
->SetValue(buf
);
309 if (m_printDialogData
.GetAllPages())
310 m_rangeRadioBox
->SetSelection(0);
312 m_rangeRadioBox
->SetSelection(1);
316 m_fromText
->Enable(FALSE
);
317 m_toText
->Enable(FALSE
);
320 m_rangeRadioBox
->SetSelection(0);
321 m_rangeRadioBox
->wxRadioBox::Enable(1, FALSE
);
326 sprintf(buf
, "%d", m_printDialogData
.GetNoCopies());
327 m_noCopiesText
->SetValue(buf
);
329 m_printToFileCheckBox
->SetValue(m_printDialogData
.GetPrintToFile());
330 m_printToFileCheckBox
->Enable(m_printDialogData
.GetEnablePrintToFile());
334 bool wxGenericPrintDialog::TransferDataFromWindow()
336 if(m_printDialogData
.GetFromPage() != -1)
338 if (m_printDialogData
.GetEnablePageNumbers())
340 if(m_fromText
) m_printDialogData
.SetFromPage(wxAtoi(m_fromText
->GetValue()));
341 if(m_toText
) m_printDialogData
.SetToPage(wxAtoi(m_toText
->GetValue()));
345 if (m_rangeRadioBox
->GetSelection() == 0)
346 m_printDialogData
.SetAllPages(TRUE
);
348 m_printDialogData
.SetAllPages(FALSE
);
352 { // continuous printing
353 m_printDialogData
.SetFromPage(1);
354 m_printDialogData
.SetToPage(32000);
356 m_printDialogData
.SetNoCopies(wxAtoi(m_noCopiesText
->GetValue()));
357 m_printDialogData
.SetPrintToFile(m_printToFileCheckBox
->GetValue());
363 TODO: collate and noCopies should be duplicated across dialog data and print data objects
364 (slightly different semantics on Windows but let's ignore this for a bit).
367 wxDC
*wxGenericPrintDialog::GetPrintDC()
369 // return new wxPostScriptDC(wxThePrintSetupData->GetPrinterFile(), FALSE, (wxWindow *) NULL);
370 return new wxPostScriptDC(GetPrintDialogData().GetPrintData());
373 // ----------------------------------------------------------------------------
374 // Generic print setup dialog
375 // ----------------------------------------------------------------------------
377 wxGenericPrintSetupDialog::wxGenericPrintSetupDialog(wxWindow
*parent
, wxPrintData
* data
):
378 wxDialog(parent
, -1, _("Print Setup"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE
|wxDIALOG_MODAL
|wxTAB_TRAVERSAL
)
383 // Convert wxPrintSetupData to standard wxPrintData object
384 wxGenericPrintSetupDialog::wxGenericPrintSetupDialog(wxWindow
*parent
, wxPrintSetupData
* data
):
385 wxDialog(parent
, -1, _("Print Setup"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE
|wxDIALOG_MODAL
|wxTAB_TRAVERSAL
)
387 wxPrintData printData
;
391 printData
= * wxThePrintSetupData
;
396 void wxGenericPrintSetupDialog::Init(wxPrintData
* data
)
401 int staticBoxWidth
= 300;
403 (void) new wxStaticBox(this, wxPRINTID_STATIC
, _("Paper size"), wxPoint(10, 10), wxSize(staticBoxWidth
, 60) );
407 m_paperTypeChoice
= CreatePaperTypeChoice(&xPos
, &yPos
);
409 wxString
*choices
= new wxString
[2];
410 choices
[0] = _("Portrait");
411 choices
[1] = _("Landscape");
413 m_orientationRadioBox
= new wxRadioBox(this, wxPRINTID_ORIENTATION
, _("Orientation"),
414 wxPoint(10, 80), wxSize(-1, -1), 2, choices
, 1, wxRA_VERTICAL
);
415 m_orientationRadioBox
->SetSelection(0);
417 (void) new wxStaticBox(this, wxPRINTID_STATIC
, _("Options"), wxPoint(10, 130), wxSize(staticBoxWidth
, 50) );
419 int colourYPos
= 145;
425 m_colourCheckBox
= new wxCheckBox(this, wxPRINTID_PRINTCOLOUR
, _("Print in colour"), wxPoint(15, colourYPos
));
427 (void) new wxStaticBox(this, wxPRINTID_STATIC
, _("Print spooling"), wxPoint(330, 10), wxSize(200,170) );
429 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Printer command:"), wxPoint(340, 30));
431 m_printerCommandText
= new wxTextCtrl(this, wxPRINTID_COMMAND
, "", wxPoint(360, 55), wxSize(150, -1));
433 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Printer options:"), wxPoint(340, 110));
435 m_printerOptionsText
= new wxTextCtrl(this, wxPRINTID_OPTIONS
, "", wxPoint(360, 135), wxSize(150, -1));
437 wxButton
*okButton
= new wxButton(this, wxID_OK
, _("OK"), wxPoint(130, 200), wxSize(80, -1));
438 (void) new wxButton(this, wxID_CANCEL
, _("Cancel"), wxPoint(320, 200), wxSize(80, -1));
440 okButton
->SetDefault();
441 okButton
->SetFocus();
450 wxGenericPrintSetupDialog::~wxGenericPrintSetupDialog()
454 bool wxGenericPrintSetupDialog::TransferDataToWindow()
456 if (m_printerCommandText
&& m_printData
.GetPrinterCommand())
457 m_printerCommandText
->SetValue(m_printData
.GetPrinterCommand());
458 if (m_printerOptionsText
&& m_printData
.GetPrinterOptions())
459 m_printerOptionsText
->SetValue(m_printData
.GetPrinterOptions());
460 if (m_colourCheckBox
)
461 m_colourCheckBox
->SetValue(m_printData
.GetColour());
463 if (m_orientationRadioBox
)
465 if (m_printData
.GetOrientation() == wxPORTRAIT
)
466 m_orientationRadioBox
->SetSelection(0);
468 m_orientationRadioBox
->SetSelection(1);
473 bool wxGenericPrintSetupDialog::TransferDataFromWindow()
475 if (m_printerCommandText
)
476 m_printData
.SetPrinterCommand(m_printerCommandText
->GetValue());
477 if (m_printerOptionsText
)
478 m_printData
.SetPrinterOptions(m_printerOptionsText
->GetValue());
479 if (m_colourCheckBox
)
480 m_printData
.SetColour(m_colourCheckBox
->GetValue());
481 if (m_orientationRadioBox
)
483 int sel
= m_orientationRadioBox
->GetSelection();
485 m_printData
.SetOrientation(wxPORTRAIT
);
487 m_printData
.SetOrientation(wxLANDSCAPE
);
489 if (m_paperTypeChoice
)
491 wxString
val(m_paperTypeChoice
->GetStringSelection());
492 if (!val
.IsNull() && val
!= "")
493 m_printData
.SetPaperId(wxThePrintPaperDatabase
->ConvertNameToId(val
));
496 // This is for backward compatibility only
497 *wxThePrintSetupData
= GetPrintData();
501 wxComboBox
*wxGenericPrintSetupDialog::CreatePaperTypeChoice(int *x
, int *y
)
503 /* Should not be necessary
504 if (!wxThePrintPaperDatabase)
506 wxThePrintPaperDatabase = new wxPrintPaperDatabase;
507 wxThePrintPaperDatabase->CreateDatabase();
510 int n
= wxThePrintPaperDatabase
->Number();
511 wxString
*choices
= new wxString
[n
];
514 for (i
= 0; i
< n
; i
++)
516 wxPrintPaperType
*paper
= (wxPrintPaperType
*)wxThePrintPaperDatabase
->Nth(i
)->Data();
517 choices
[i
] = paper
->GetName();
518 if (m_printData
.GetPaperId() == paper
->GetId())
524 wxComboBox
*choice
= new wxComboBox(this, wxPRINTID_PAPERSIZE
,
526 wxPoint(*x
, *y
), wxSize(width
, -1), n
,
529 // SetFont(thisFont);
533 choice
->SetSelection(sel
);
536 #endif // wxUSE_POSTSCRIPT
538 // ----------------------------------------------------------------------------
539 // Generic page setup dialog
540 // ----------------------------------------------------------------------------
542 void wxGenericPageSetupDialog::OnPrinter(wxCommandEvent
& WXUNUSED(event
))
544 // We no longer query GetPrintMode, so we can eliminate the need
545 // to call SetPrintMode.
546 // This has the limitation that we can't explicitly call the PostScript
547 // print setup dialog from the generic Page Setup dialog under Windows,
548 // but since this choice would only happen when trying to do PostScript
549 // printing under Windows (and only in 16-bit Windows which
550 // doesn't have a Windows-specific page setup dialog) it's worth it.
552 // First save the current settings, so the wxPrintData object is up to date.
553 TransferDataFromWindow();
555 // Transfer the current print settings from this dialog to the page setup dialog.
556 wxPrintDialogData data
;
557 data
= GetPageSetupData().GetPrintData();
558 data
.SetSetupDialog(TRUE
);
559 wxPrintDialog
*printDialog
= new wxPrintDialog(this, & data
);
560 printDialog
->ShowModal();
562 // Transfer the page setup print settings from the page dialog to this dialog again, in case
563 // the page setup dialog changed something.
564 GetPageSetupData().GetPrintData() = printDialog
->GetPrintDialogData().GetPrintData();
565 GetPageSetupData().CalculatePaperSizeFromId(); // Make sure page size reflects the id in wxPrintData
567 printDialog
->Destroy();
569 // Now update the dialog in case the page setup dialog changed some of our settings.
570 TransferDataToWindow();
573 wxGenericPageSetupDialog::wxGenericPageSetupDialog(wxWindow
*parent
, wxPageSetupData
* data
):
574 wxDialog(parent
, -1, _("Page Setup"), wxPoint(0, 0), wxSize(600, 600), wxDIALOG_MODAL
|wxDEFAULT_DIALOG_STYLE
|wxTAB_TRAVERSAL
)
579 int buttonWidth
= 75;
580 int buttonHeight
= 25;
589 wxButton
*okButton
= new wxButton(this, wxID_OK
, _("OK"), wxPoint(5, yPos
), wxSize(buttonWidth
, buttonHeight
));
590 (void) new wxButton(this, wxID_CANCEL
, _("Cancel"), wxPoint(buttonWidth
+ 5 + spacing
, yPos
), wxSize(buttonWidth
, buttonHeight
));
592 m_printerButton
= new wxButton(this, wxPRINTID_SETUP
, _("Printer..."), wxPoint(buttonWidth
*2 + 5 + 2*spacing
, yPos
), wxSize(buttonWidth
, buttonHeight
));
594 if ( !m_pageData
.GetEnablePrinter() )
595 m_printerButton
->Enable(FALSE
);
597 // if (m_printData.GetEnableHelp())
598 // wxButton *helpButton = new wxButton(this, (wxFunction)wxGenericPageSetupHelpProc, _("Help"), -1, -1, buttonWidth, buttonHeight);
600 okButton
->SetDefault();
601 okButton
->SetFocus();
610 m_paperTypeChoice
= CreatePaperTypeChoice(&xPos
, &yPos
);
614 wxString
*choices
= new wxString
[2];
615 choices
[0] = _("Portrait");
616 choices
[1] = _("Landscape");
617 m_orientationRadioBox
= new wxRadioBox(this, wxPRINTID_ORIENTATION
, _("Orientation"),
618 wxPoint(xPos
, yPos
), wxSize(-1, -1), 2, choices
, 2);
619 m_orientationRadioBox
->SetSelection(0);
624 int staticWidth
= 110;
632 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Left margin (mm):"), wxPoint(xPos
, yPos
));
635 m_marginLeftText
= new wxTextCtrl(this, wxPRINTID_LEFTMARGIN
, "", wxPoint(xPos
, yPos
), wxSize(textWidth
, -1));
636 xPos
+= textWidth
+ spacing
;
638 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Right margin (mm):"), wxPoint(xPos
, yPos
));
641 m_marginRightText
= new wxTextCtrl(this, wxPRINTID_RIGHTMARGIN
, "", wxPoint(xPos
, yPos
), wxSize(textWidth
, -1));
642 xPos
+= textWidth
+ spacing
;
647 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Top margin (mm):"), wxPoint(xPos
, yPos
));
650 m_marginTopText
= new wxTextCtrl(this, wxPRINTID_TOPMARGIN
, "", wxPoint(xPos
, yPos
), wxSize(textWidth
, -1));
651 xPos
+= textWidth
+ spacing
;
653 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Bottom margin (mm):"), wxPoint(xPos
, yPos
));
656 m_marginBottomText
= new wxTextCtrl(this, wxPRINTID_BOTTOMMARGIN
, "", wxPoint(xPos
, yPos
), wxSize(textWidth
, -1));
665 wxGenericPageSetupDialog::~wxGenericPageSetupDialog()
669 bool wxGenericPageSetupDialog::TransferDataToWindow()
671 if (m_marginLeftText
)
672 m_marginLeftText
->SetValue(IntToString((int) m_pageData
.GetMarginTopLeft().x
));
674 m_marginTopText
->SetValue(IntToString((int) m_pageData
.GetMarginTopLeft().y
));
675 if (m_marginRightText
)
676 m_marginRightText
->SetValue(IntToString((int) m_pageData
.GetMarginBottomRight().x
));
677 if (m_marginBottomText
)
678 m_marginBottomText
->SetValue(IntToString((int) m_pageData
.GetMarginBottomRight().y
));
680 if (m_orientationRadioBox
)
682 if (m_pageData
.GetPrintData().GetOrientation() == wxPORTRAIT
)
683 m_orientationRadioBox
->SetSelection(0);
685 m_orientationRadioBox
->SetSelection(1);
688 // Find the paper type from either the current paper size in the wxPageSetupDialogData, or
689 // failing that, the id in the wxPrintData object.
691 wxPrintPaperType
* type
= wxThePrintPaperDatabase
->FindPaperType(
692 wxSize(m_pageData
.GetPaperSize().x
* 10, m_pageData
.GetPaperSize().y
* 10));
694 if (!type
&& m_pageData
.GetPrintData().GetPaperId() != wxPAPER_NONE
)
695 type
= wxThePrintPaperDatabase
->FindPaperType(m_pageData
.GetPrintData().GetPaperId());
699 m_paperTypeChoice
->SetStringSelection(type
->GetName());
705 bool wxGenericPageSetupDialog::TransferDataFromWindow()
707 if (m_marginLeftText
&& m_marginTopText
)
708 m_pageData
.SetMarginTopLeft(wxPoint(wxAtoi((const wxChar
*)m_marginLeftText
->GetValue()),wxAtoi((const wxChar
*)m_marginTopText
->GetValue())));
709 if (m_marginRightText
&& m_marginBottomText
)
710 m_pageData
.SetMarginBottomRight(wxPoint(wxAtoi((const wxChar
*)m_marginRightText
->GetValue()),wxAtoi((const wxChar
*)m_marginBottomText
->GetValue())));
712 if (m_orientationRadioBox
)
714 int sel
= m_orientationRadioBox
->GetSelection();
718 wxThePrintSetupData
->SetPrinterOrientation(wxPORTRAIT
);
720 m_pageData
.GetPrintData().SetOrientation(wxPORTRAIT
);
725 wxThePrintSetupData
->SetPrinterOrientation(wxLANDSCAPE
);
727 m_pageData
.GetPrintData().SetOrientation(wxLANDSCAPE
);
730 if (m_paperTypeChoice
)
732 wxString
val(m_paperTypeChoice
->GetStringSelection());
733 if (!val
.IsNull() && val
!= "")
735 wxPrintPaperType
* paper
= wxThePrintPaperDatabase
->FindPaperType(val
);
738 m_pageData
.SetPaperSize(wxSize(paper
->GetWidth()/10, paper
->GetHeight()/10));
739 m_pageData
.GetPrintData().SetPaperId(paper
->GetId());
747 wxComboBox
*wxGenericPageSetupDialog::CreatePaperTypeChoice(int *x
, int *y
)
750 if (!wxThePrintPaperDatabase)
752 wxThePrintPaperDatabase = new wxPrintPaperDatabase;
753 wxThePrintPaperDatabase->CreateDatabase();
757 int n
= wxThePrintPaperDatabase
->Number();
758 wxString
*choices
= new wxString
[n
];
760 for (i
= 0; i
< n
; i
++)
762 wxPrintPaperType
*paper
= (wxPrintPaperType
*)wxThePrintPaperDatabase
->Nth(i
)->Data();
763 choices
[i
] = paper
->GetName();
766 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Paper size"), wxPoint(*x
, *y
));
769 wxComboBox
*choice
= new wxComboBox(this, wxPRINTID_PAPERSIZE
,
771 wxPoint(*x
, *y
), wxSize(300, -1), n
,
776 // choice->SetSelection(sel);