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 // ----------------------------------------------------------------------------
68 #if !USE_SHARED_LIBRARY
72 IMPLEMENT_CLASS(wxGenericPrintDialog
, wxDialog
)
73 IMPLEMENT_CLASS(wxGenericPrintSetupDialog
, 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
)
82 IMPLEMENT_CLASS(wxGenericPageSetupDialog
, wxDialog
)
84 BEGIN_EVENT_TABLE(wxGenericPageSetupDialog
, wxDialog
)
85 EVT_BUTTON(wxPRINTID_SETUP
, wxGenericPageSetupDialog::OnPrinter
)
87 #endif // USE_SHARED_LIBRARY
89 // ----------------------------------------------------------------------------
91 // ----------------------------------------------------------------------------
93 extern wxPrintPaperDatabase
*wxThePrintPaperDatabase
;
97 // ============================================================================
99 // ============================================================================
101 // ----------------------------------------------------------------------------
102 // Generic print dialog for non-Windows printing use.
103 // ----------------------------------------------------------------------------
105 wxGenericPrintDialog::wxGenericPrintDialog(wxWindow
*parent
,
106 wxPrintDialogData
* data
)
107 : wxDialog(parent
, -1, _("Print"),
108 wxPoint(0, 0), wxSize(600, 600),
109 wxDEFAULT_DIALOG_STYLE
|
114 m_printDialogData
= *data
;
119 wxGenericPrintDialog::wxGenericPrintDialog(wxWindow
*parent
,
121 : wxDialog(parent
, -1, _("Print"),
122 wxPoint(0, 0), wxSize(600, 600),
123 wxDEFAULT_DIALOG_STYLE
|
128 m_printDialogData
= *data
;
133 void wxGenericPrintDialog::Init(wxWindow
* WXUNUSED(parent
))
135 // wxDialog::Create(parent, -1, _("Print"), wxPoint(0, 0), wxSize(600, 600),
136 // wxDEFAULT_DIALOG_STYLE | wxDIALOG_MODAL | wxTAB_TRAVERSAL);
138 (void)new wxStaticBox( this, -1, _( "Printer options" ), wxPoint( 5, 5), wxSize( 300, 60 ) );
140 m_printToFileCheckBox
= new wxCheckBox(this, wxPRINTID_PRINTTOFILE
, _("Print to File"), wxPoint(20, 25) );
142 m_setupButton
= new wxButton(this, wxPRINTID_SETUP
, _("Setup..."), wxPoint(160, 25), wxSize(100, -1));
144 wxString
*choices
= new wxString
[2];
145 choices
[0] = _("All");
146 choices
[1] = _("Pages");
148 m_fromText
= (wxTextCtrl
*)NULL
;
149 m_toText
= (wxTextCtrl
*)NULL
;
150 m_rangeRadioBox
= (wxRadioBox
*)NULL
;
152 if (m_printDialogData
.GetFromPage() != 0)
154 m_rangeRadioBox
= new wxRadioBox(this, wxPRINTID_RANGE
, _("Print Range"),
155 wxPoint(5, 80), wxSize(-1, -1),
158 m_rangeRadioBox
->SetSelection(1);
161 if(m_printDialogData
.GetFromPage() != 0)
163 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("From:"), wxPoint(5, 135));
165 m_fromText
= new wxTextCtrl(this, wxPRINTID_FROM
, "", wxPoint(45, 130), wxSize(40, -1));
167 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("To:"), wxPoint(100, 135));
169 m_toText
= new wxTextCtrl(this, wxPRINTID_TO
, "", wxPoint(133, 130), wxSize(40, -1));
172 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Copies:"), wxPoint(200, 135));
174 m_noCopiesText
= new wxTextCtrl(this, wxPRINTID_COPIES
, "", wxPoint(252, 130), wxSize(40, -1));
176 wxButton
*okButton
= new wxButton(this, wxID_OK
, _("OK"), wxPoint(40, 180), wxSize(80, -1));
177 (void) new wxButton(this, wxID_CANCEL
, _("Cancel"), wxPoint(180, 180), wxSize(80, -1));
179 okButton
->SetDefault();
180 okButton
->SetFocus();
184 // Calls wxWindow::OnInitDialog and then wxGenericPrintDialog::TransferDataToWindow
189 int wxGenericPrintDialog::ShowModal()
191 if ( m_printDialogData
.GetSetupDialog() )
193 // Make sure wxPrintData object reflects the settings now, in case the setup dialog
194 // changes it. In fact there aren't any common settings at
195 // present, but there might be in future.
196 // TransferDataFromWindow();
198 wxGenericPrintSetupDialog
*genericPrintSetupDialog
=
199 new wxGenericPrintSetupDialog(this, & m_printDialogData
.GetPrintData());
200 int ret
= genericPrintSetupDialog
->ShowModal();
201 if ( ret
!= wxID_CANCEL
)
203 // Transfer settings to the global object (for compatibility) and to
204 // the print dialog's print data.
205 *wxThePrintSetupData
= genericPrintSetupDialog
->GetPrintData();
206 m_printDialogData
.GetPrintData() = genericPrintSetupDialog
->GetPrintData();
208 genericPrintSetupDialog
->Destroy();
210 // Restore the wxPrintData settings again (uncomment if any settings become common
212 // TransferDataToWindow();
218 return wxDialog::ShowModal();
222 wxGenericPrintDialog::~wxGenericPrintDialog()
226 void wxGenericPrintDialog::OnOK(wxCommandEvent
& WXUNUSED(event
))
228 TransferDataFromWindow();
230 // There are some interactions between the global setup data
231 // and the standard print dialog. The global printing 'mode'
232 // is determined by whether the user checks Print to file
234 if (m_printDialogData
.GetPrintToFile())
236 m_printDialogData
.GetPrintData().SetPrintMode(wxPRINT_MODE_FILE
);
237 wxThePrintSetupData
->SetPrinterMode(wxPRINT_MODE_FILE
);
239 wxString f
= wxFileSelector(_("PostScript file"),
240 wxPathOnly(wxThePrintSetupData
->GetPrinterFile()),
241 wxFileNameFromPath(wxThePrintSetupData
->GetPrinterFile()),
242 _T("ps"), _T("*.ps"), 0, this);
246 m_printDialogData
.GetPrintData().SetFilename(f
);
247 wxThePrintSetupData
->SetPrinterFile(f
);
251 m_printDialogData
.GetPrintData().SetPrintMode(wxPRINT_MODE_PRINTER
);
252 wxThePrintSetupData
->SetPrinterMode(wxPRINT_MODE_PRINTER
);
258 void wxGenericPrintDialog::OnRange(wxCommandEvent
& event
)
260 if (!m_fromText
) return;
262 if (event
.GetInt() == 0)
264 m_fromText
->Enable(FALSE
);
265 m_toText
->Enable(FALSE
);
267 else if (event
.GetInt() == 1)
269 m_fromText
->Enable(TRUE
);
270 m_toText
->Enable(TRUE
);
274 void wxGenericPrintDialog::OnSetup(wxCommandEvent
& WXUNUSED(event
))
276 *wxThePrintSetupData
= m_printDialogData
.GetPrintData();
277 wxGenericPrintSetupDialog
*genericPrintSetupDialog
=
278 new wxGenericPrintSetupDialog(this, wxThePrintSetupData
);
279 int ret
= genericPrintSetupDialog
->ShowModal();
280 if ( ret
!= wxID_CANCEL
)
282 *wxThePrintSetupData
= genericPrintSetupDialog
->GetPrintData();
283 m_printDialogData
= genericPrintSetupDialog
->GetPrintData();
286 genericPrintSetupDialog
->Close(TRUE
);
289 bool wxGenericPrintDialog::TransferDataToWindow()
293 if(m_printDialogData
.GetFromPage() != 0)
297 if (m_printDialogData
.GetEnablePageNumbers())
299 m_fromText
->Enable(TRUE
);
300 m_toText
->Enable(TRUE
);
301 sprintf(buf
, "%d", m_printDialogData
.GetFromPage());
302 m_fromText
->SetValue(buf
);
303 sprintf(buf
, "%d", m_printDialogData
.GetToPage());
304 m_toText
->SetValue(buf
);
306 if (m_printDialogData
.GetAllPages())
307 m_rangeRadioBox
->SetSelection(0);
309 m_rangeRadioBox
->SetSelection(1);
313 m_fromText
->Enable(FALSE
);
314 m_toText
->Enable(FALSE
);
317 m_rangeRadioBox
->SetSelection(0);
318 m_rangeRadioBox
->wxRadioBox::Enable(1, FALSE
);
323 sprintf(buf
, "%d", m_printDialogData
.GetNoCopies());
324 m_noCopiesText
->SetValue(buf
);
326 m_printToFileCheckBox
->SetValue(m_printDialogData
.GetPrintToFile());
327 m_printToFileCheckBox
->Enable(m_printDialogData
.GetEnablePrintToFile());
331 bool wxGenericPrintDialog::TransferDataFromWindow()
333 if(m_printDialogData
.GetFromPage() != -1)
335 if (m_printDialogData
.GetEnablePageNumbers())
337 if(m_fromText
) m_printDialogData
.SetFromPage(wxAtoi(m_fromText
->GetValue()));
338 if(m_toText
) m_printDialogData
.SetToPage(wxAtoi(m_toText
->GetValue()));
342 if (m_rangeRadioBox
->GetSelection() == 0)
343 m_printDialogData
.SetAllPages(TRUE
);
345 m_printDialogData
.SetAllPages(FALSE
);
349 { // continuous printing
350 m_printDialogData
.SetFromPage(1);
351 m_printDialogData
.SetToPage(32000);
353 m_printDialogData
.SetNoCopies(wxAtoi(m_noCopiesText
->GetValue()));
354 m_printDialogData
.SetPrintToFile(m_printToFileCheckBox
->GetValue());
360 TODO: collate and noCopies should be duplicated across dialog data and print data objects
361 (slightly different semantics on Windows but let's ignore this for a bit).
364 wxDC
*wxGenericPrintDialog::GetPrintDC()
366 // return new wxPostScriptDC(wxThePrintSetupData->GetPrinterFile(), FALSE, (wxWindow *) NULL);
367 return new wxPostScriptDC(GetPrintDialogData().GetPrintData());
370 // ----------------------------------------------------------------------------
371 // Generic print setup dialog
372 // ----------------------------------------------------------------------------
374 wxGenericPrintSetupDialog::wxGenericPrintSetupDialog(wxWindow
*parent
, wxPrintData
* data
):
375 wxDialog(parent
, -1, _("Print Setup"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE
|wxDIALOG_MODAL
|wxTAB_TRAVERSAL
)
380 // Convert wxPrintSetupData to standard wxPrintData object
381 wxGenericPrintSetupDialog::wxGenericPrintSetupDialog(wxWindow
*parent
, wxPrintSetupData
* data
):
382 wxDialog(parent
, -1, _("Print Setup"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE
|wxDIALOG_MODAL
|wxTAB_TRAVERSAL
)
384 wxPrintData printData
;
388 printData
= * wxThePrintSetupData
;
393 void wxGenericPrintSetupDialog::Init(wxPrintData
* data
)
398 int staticBoxWidth
= 300;
400 (void) new wxStaticBox(this, wxPRINTID_STATIC
, _("Paper size"), wxPoint(10, 10), wxSize(staticBoxWidth
, 60) );
404 m_paperTypeChoice
= CreatePaperTypeChoice(&xPos
, &yPos
);
406 wxString
*choices
= new wxString
[2];
407 choices
[0] = _("Portrait");
408 choices
[1] = _("Landscape");
410 m_orientationRadioBox
= new wxRadioBox(this, wxPRINTID_ORIENTATION
, _("Orientation"),
411 wxPoint(10, 80), wxSize(-1, -1), 2, choices
, 1, wxRA_VERTICAL
);
412 m_orientationRadioBox
->SetSelection(0);
414 (void) new wxStaticBox(this, wxPRINTID_STATIC
, _("Options"), wxPoint(10, 130), wxSize(staticBoxWidth
, 50) );
416 int colourYPos
= 145;
422 m_colourCheckBox
= new wxCheckBox(this, wxPRINTID_PRINTCOLOUR
, _("Print in colour"), wxPoint(15, colourYPos
));
424 (void) new wxStaticBox(this, wxPRINTID_STATIC
, _("Print spooling"), wxPoint(330, 10), wxSize(200,170) );
426 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Printer command:"), wxPoint(340, 30));
428 m_printerCommandText
= new wxTextCtrl(this, wxPRINTID_COMMAND
, "", wxPoint(360, 55), wxSize(150, -1));
430 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Printer options:"), wxPoint(340, 110));
432 m_printerOptionsText
= new wxTextCtrl(this, wxPRINTID_OPTIONS
, "", wxPoint(360, 135), wxSize(150, -1));
434 wxButton
*okButton
= new wxButton(this, wxID_OK
, _("OK"), wxPoint(130, 200), wxSize(80, -1));
435 (void) new wxButton(this, wxID_CANCEL
, _("Cancel"), wxPoint(320, 200), wxSize(80, -1));
437 okButton
->SetDefault();
438 okButton
->SetFocus();
447 wxGenericPrintSetupDialog::~wxGenericPrintSetupDialog()
451 bool wxGenericPrintSetupDialog::TransferDataToWindow()
453 if (m_printerCommandText
&& m_printData
.GetPrinterCommand())
454 m_printerCommandText
->SetValue(m_printData
.GetPrinterCommand());
455 if (m_printerOptionsText
&& m_printData
.GetPrinterOptions())
456 m_printerOptionsText
->SetValue(m_printData
.GetPrinterOptions());
457 if (m_colourCheckBox
)
458 m_colourCheckBox
->SetValue(m_printData
.GetColour());
460 if (m_orientationRadioBox
)
462 if (m_printData
.GetOrientation() == wxPORTRAIT
)
463 m_orientationRadioBox
->SetSelection(0);
465 m_orientationRadioBox
->SetSelection(1);
470 bool wxGenericPrintSetupDialog::TransferDataFromWindow()
472 if (m_printerCommandText
)
473 m_printData
.SetPrinterCommand(m_printerCommandText
->GetValue());
474 if (m_printerOptionsText
)
475 m_printData
.SetPrinterOptions(m_printerOptionsText
->GetValue());
476 if (m_colourCheckBox
)
477 m_printData
.SetColour(m_colourCheckBox
->GetValue());
478 if (m_orientationRadioBox
)
480 int sel
= m_orientationRadioBox
->GetSelection();
482 m_printData
.SetOrientation(wxPORTRAIT
);
484 m_printData
.SetOrientation(wxLANDSCAPE
);
486 if (m_paperTypeChoice
)
488 wxString
val(m_paperTypeChoice
->GetStringSelection());
489 if (!val
.IsNull() && val
!= "")
490 m_printData
.SetPaperId(wxThePrintPaperDatabase
->ConvertNameToId(val
));
493 // This is for backward compatibility only
494 *wxThePrintSetupData
= GetPrintData();
498 wxChoice
*wxGenericPrintSetupDialog::CreatePaperTypeChoice(int *x
, int *y
)
500 /* Should not be necessary
501 if (!wxThePrintPaperDatabase)
503 wxThePrintPaperDatabase = new wxPrintPaperDatabase;
504 wxThePrintPaperDatabase->CreateDatabase();
507 int n
= wxThePrintPaperDatabase
->Number();
508 wxString
*choices
= new wxString
[n
];
511 for (i
= 0; i
< n
; i
++)
513 wxPrintPaperType
*paper
= (wxPrintPaperType
*)wxThePrintPaperDatabase
->Nth(i
)->Data();
514 choices
[i
] = paper
->GetName();
515 if (m_printData
.GetPaperId() == paper
->GetId())
521 wxChoice
*choice
= new wxChoice(this, wxPRINTID_PAPERSIZE
, wxPoint(*x
, *y
), wxSize(width
, -1), n
,
524 // SetFont(thisFont);
528 choice
->SetSelection(sel
);
531 #endif // wxUSE_POSTSCRIPT
533 // ----------------------------------------------------------------------------
534 // Generic page setup dialog
535 // ----------------------------------------------------------------------------
537 void wxGenericPageSetupDialog::OnPrinter(wxCommandEvent
& WXUNUSED(event
))
539 // We no longer query GetPrintMode, so we can eliminate the need
540 // to call SetPrintMode.
541 // This has the limitation that we can't explicitly call the PostScript
542 // print setup dialog from the generic Page Setup dialog under Windows,
543 // but since this choice would only happen when trying to do PostScript
544 // printing under Windows (and only in 16-bit Windows which
545 // doesn't have a Windows-specific page setup dialog) it's worth it.
547 // First save the current settings, so the wxPrintData object is up to date.
548 TransferDataFromWindow();
550 // Transfer the current print settings from this dialog to the page setup dialog.
551 wxPrintDialogData data
;
552 data
= GetPageSetupData().GetPrintData();
553 data
.SetSetupDialog(TRUE
);
554 wxPrintDialog
*printDialog
= new wxPrintDialog(this, & data
);
555 printDialog
->ShowModal();
557 // Transfer the page setup print settings from the page dialog to this dialog again, in case
558 // the page setup dialog changed something.
559 GetPageSetupData().GetPrintData() = printDialog
->GetPrintDialogData().GetPrintData();
560 GetPageSetupData().CalculatePaperSizeFromId(); // Make sure page size reflects the id in wxPrintData
562 printDialog
->Destroy();
564 // Now update the dialog in case the page setup dialog changed some of our settings.
565 TransferDataToWindow();
568 wxGenericPageSetupDialog::wxGenericPageSetupDialog(wxWindow
*parent
, wxPageSetupData
* data
):
569 wxDialog(parent
, -1, _("Page Setup"), wxPoint(0, 0), wxSize(600, 600), wxDIALOG_MODAL
|wxDEFAULT_DIALOG_STYLE
|wxTAB_TRAVERSAL
)
574 int buttonWidth
= 75;
575 int buttonHeight
= 25;
584 wxButton
*okButton
= new wxButton(this, wxID_OK
, _("OK"), wxPoint(5, yPos
), wxSize(buttonWidth
, buttonHeight
));
585 (void) new wxButton(this, wxID_CANCEL
, _("Cancel"), wxPoint(buttonWidth
+ 5 + spacing
, yPos
), wxSize(buttonWidth
, buttonHeight
));
587 m_printerButton
= new wxButton(this, wxPRINTID_SETUP
, _("Printer..."), wxPoint(buttonWidth
*2 + 5 + 2*spacing
, yPos
), wxSize(buttonWidth
, buttonHeight
));
589 if ( !m_pageData
.GetEnablePrinter() )
590 m_printerButton
->Enable(FALSE
);
592 // if (m_printData.GetEnableHelp())
593 // wxButton *helpButton = new wxButton(this, (wxFunction)wxGenericPageSetupHelpProc, _("Help"), -1, -1, buttonWidth, buttonHeight);
595 okButton
->SetDefault();
596 okButton
->SetFocus();
605 m_paperTypeChoice
= CreatePaperTypeChoice(&xPos
, &yPos
);
609 wxString
*choices
= new wxString
[2];
610 choices
[0] = _("Portrait");
611 choices
[1] = _("Landscape");
612 m_orientationRadioBox
= new wxRadioBox(this, wxPRINTID_ORIENTATION
, _("Orientation"),
613 wxPoint(xPos
, yPos
), wxSize(-1, -1), 2, choices
, 2);
614 m_orientationRadioBox
->SetSelection(0);
619 int staticWidth
= 110;
627 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Left margin (mm):"), wxPoint(xPos
, yPos
));
630 m_marginLeftText
= new wxTextCtrl(this, wxPRINTID_LEFTMARGIN
, "", wxPoint(xPos
, yPos
), wxSize(textWidth
, -1));
631 xPos
+= textWidth
+ spacing
;
633 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Right margin (mm):"), wxPoint(xPos
, yPos
));
636 m_marginRightText
= new wxTextCtrl(this, wxPRINTID_RIGHTMARGIN
, "", wxPoint(xPos
, yPos
), wxSize(textWidth
, -1));
637 xPos
+= textWidth
+ spacing
;
642 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Top margin (mm):"), wxPoint(xPos
, yPos
));
645 m_marginTopText
= new wxTextCtrl(this, wxPRINTID_TOPMARGIN
, "", wxPoint(xPos
, yPos
), wxSize(textWidth
, -1));
646 xPos
+= textWidth
+ spacing
;
648 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Bottom margin (mm):"), wxPoint(xPos
, yPos
));
651 m_marginBottomText
= new wxTextCtrl(this, wxPRINTID_BOTTOMMARGIN
, "", wxPoint(xPos
, yPos
), wxSize(textWidth
, -1));
660 wxGenericPageSetupDialog::~wxGenericPageSetupDialog()
664 bool wxGenericPageSetupDialog::TransferDataToWindow()
666 if (m_marginLeftText
)
667 m_marginLeftText
->SetValue(IntToString((int) m_pageData
.GetMarginTopLeft().x
));
669 m_marginTopText
->SetValue(IntToString((int) m_pageData
.GetMarginTopLeft().y
));
670 if (m_marginRightText
)
671 m_marginRightText
->SetValue(IntToString((int) m_pageData
.GetMarginBottomRight().x
));
672 if (m_marginBottomText
)
673 m_marginBottomText
->SetValue(IntToString((int) m_pageData
.GetMarginBottomRight().y
));
675 if (m_orientationRadioBox
)
677 if (m_pageData
.GetPrintData().GetOrientation() == wxPORTRAIT
)
678 m_orientationRadioBox
->SetSelection(0);
680 m_orientationRadioBox
->SetSelection(1);
683 // Find the paper type from either the current paper size in the wxPageSetupDialogData, or
684 // failing that, the id in the wxPrintData object.
686 wxPrintPaperType
* type
= wxThePrintPaperDatabase
->FindPaperType(
687 wxSize(m_pageData
.GetPaperSize().x
* 10, m_pageData
.GetPaperSize().y
* 10));
689 if (!type
&& m_pageData
.GetPrintData().GetPaperId() != wxPAPER_NONE
)
690 type
= wxThePrintPaperDatabase
->FindPaperType(m_pageData
.GetPrintData().GetPaperId());
694 m_paperTypeChoice
->SetStringSelection(type
->GetName());
700 bool wxGenericPageSetupDialog::TransferDataFromWindow()
702 if (m_marginLeftText
&& m_marginTopText
)
703 m_pageData
.SetMarginTopLeft(wxPoint(wxAtoi((const wxChar
*)m_marginLeftText
->GetValue()),wxAtoi((const wxChar
*)m_marginTopText
->GetValue())));
704 if (m_marginRightText
&& m_marginBottomText
)
705 m_pageData
.SetMarginBottomRight(wxPoint(wxAtoi((const wxChar
*)m_marginRightText
->GetValue()),wxAtoi((const wxChar
*)m_marginBottomText
->GetValue())));
707 if (m_orientationRadioBox
)
709 int sel
= m_orientationRadioBox
->GetSelection();
713 wxThePrintSetupData
->SetPrinterOrientation(wxPORTRAIT
);
715 m_pageData
.GetPrintData().SetOrientation(wxPORTRAIT
);
720 wxThePrintSetupData
->SetPrinterOrientation(wxLANDSCAPE
);
722 m_pageData
.GetPrintData().SetOrientation(wxLANDSCAPE
);
725 if (m_paperTypeChoice
)
727 wxString
val(m_paperTypeChoice
->GetStringSelection());
728 if (!val
.IsNull() && val
!= "")
730 wxPrintPaperType
* paper
= wxThePrintPaperDatabase
->FindPaperType(val
);
733 m_pageData
.SetPaperSize(wxSize(paper
->GetWidth()/10, paper
->GetHeight()/10));
734 m_pageData
.GetPrintData().SetPaperId(paper
->GetId());
742 wxChoice
*wxGenericPageSetupDialog::CreatePaperTypeChoice(int *x
, int *y
)
745 if (!wxThePrintPaperDatabase)
747 wxThePrintPaperDatabase = new wxPrintPaperDatabase;
748 wxThePrintPaperDatabase->CreateDatabase();
752 int n
= wxThePrintPaperDatabase
->Number();
753 wxString
*choices
= new wxString
[n
];
755 for (i
= 0; i
< n
; i
++)
757 wxPrintPaperType
*paper
= (wxPrintPaperType
*)wxThePrintPaperDatabase
->Nth(i
)->Data();
758 choices
[i
] = paper
->GetName();
761 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Paper size"), wxPoint(*x
, *y
));
764 wxChoice
*choice
= new wxChoice(this, wxPRINTID_PAPERSIZE
, wxPoint(*x
, *y
), wxSize(300, -1), n
,
769 // choice->SetSelection(sel);