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
* WXUNUSED(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 _T("ps"), _T("*.ps"), 0, this);
241 m_printDialogData
.GetPrintData().SetFilename(f
);
242 wxThePrintSetupData
->SetPrinterFile(f
);
246 m_printDialogData
.GetPrintData().SetPrintMode(wxPRINT_MODE_PRINTER
);
247 wxThePrintSetupData
->SetPrinterMode(wxPRINT_MODE_PRINTER
);
253 void wxGenericPrintDialog::OnRange(wxCommandEvent
& event
)
255 if (!m_fromText
) return;
257 if (event
.GetInt() == 0)
259 m_fromText
->Enable(FALSE
);
260 m_toText
->Enable(FALSE
);
262 else if (event
.GetInt() == 1)
264 m_fromText
->Enable(TRUE
);
265 m_toText
->Enable(TRUE
);
269 void wxGenericPrintDialog::OnSetup(wxCommandEvent
& WXUNUSED(event
))
271 *wxThePrintSetupData
= m_printDialogData
.GetPrintData();
272 wxGenericPrintSetupDialog
*genericPrintSetupDialog
=
273 new wxGenericPrintSetupDialog(this, wxThePrintSetupData
);
274 int ret
= genericPrintSetupDialog
->ShowModal();
275 if ( ret
!= wxID_CANCEL
)
277 *wxThePrintSetupData
= genericPrintSetupDialog
->GetPrintData();
278 m_printDialogData
= genericPrintSetupDialog
->GetPrintData();
281 genericPrintSetupDialog
->Close(TRUE
);
284 bool wxGenericPrintDialog::TransferDataToWindow()
288 if(m_printDialogData
.GetFromPage() != 0)
292 if (m_printDialogData
.GetEnablePageNumbers())
294 m_fromText
->Enable(TRUE
);
295 m_toText
->Enable(TRUE
);
296 sprintf(buf
, "%d", m_printDialogData
.GetFromPage());
297 m_fromText
->SetValue(buf
);
298 sprintf(buf
, "%d", m_printDialogData
.GetToPage());
299 m_toText
->SetValue(buf
);
301 if (m_printDialogData
.GetAllPages())
302 m_rangeRadioBox
->SetSelection(0);
304 m_rangeRadioBox
->SetSelection(1);
308 m_fromText
->Enable(FALSE
);
309 m_toText
->Enable(FALSE
);
312 m_rangeRadioBox
->SetSelection(0);
313 m_rangeRadioBox
->wxRadioBox::Enable(1, FALSE
);
318 sprintf(buf
, "%d", m_printDialogData
.GetNoCopies());
319 m_noCopiesText
->SetValue(buf
);
321 m_printToFileCheckBox
->SetValue(m_printDialogData
.GetPrintToFile());
322 m_printToFileCheckBox
->Enable(m_printDialogData
.GetEnablePrintToFile());
326 bool wxGenericPrintDialog::TransferDataFromWindow()
328 if(m_printDialogData
.GetFromPage() != -1)
330 if (m_printDialogData
.GetEnablePageNumbers())
332 if(m_fromText
) m_printDialogData
.SetFromPage(wxAtoi(m_fromText
->GetValue()));
333 if(m_toText
) m_printDialogData
.SetToPage(wxAtoi(m_toText
->GetValue()));
337 if (m_rangeRadioBox
->GetSelection() == 0)
338 m_printDialogData
.SetAllPages(TRUE
);
340 m_printDialogData
.SetAllPages(FALSE
);
344 { // continuous printing
345 m_printDialogData
.SetFromPage(1);
346 m_printDialogData
.SetToPage(32000);
348 m_printDialogData
.SetNoCopies(wxAtoi(m_noCopiesText
->GetValue()));
349 m_printDialogData
.SetPrintToFile(m_printToFileCheckBox
->GetValue());
355 TODO: collate and noCopies should be duplicated across dialog data and print data objects
356 (slightly different semantics on Windows but let's ignore this for a bit).
359 wxDC
*wxGenericPrintDialog::GetPrintDC()
361 // return new wxPostScriptDC(wxThePrintSetupData->GetPrinterFile(), FALSE, (wxWindow *) NULL);
362 return new wxPostScriptDC(GetPrintDialogData().GetPrintData());
365 // ----------------------------------------------------------------------------
366 // Generic print setup dialog
367 // ----------------------------------------------------------------------------
369 wxGenericPrintSetupDialog::wxGenericPrintSetupDialog(wxWindow
*parent
, wxPrintData
* data
):
370 wxDialog(parent
, -1, _("Print Setup"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE
|wxDIALOG_MODAL
|wxTAB_TRAVERSAL
)
375 // Convert wxPrintSetupData to standard wxPrintData object
376 wxGenericPrintSetupDialog::wxGenericPrintSetupDialog(wxWindow
*parent
, wxPrintSetupData
* data
):
377 wxDialog(parent
, -1, _("Print Setup"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE
|wxDIALOG_MODAL
|wxTAB_TRAVERSAL
)
379 wxPrintData printData
;
383 printData
= * wxThePrintSetupData
;
388 void wxGenericPrintSetupDialog::Init(wxPrintData
* data
)
393 int staticBoxWidth
= 300;
395 (void) new wxStaticBox(this, wxPRINTID_STATIC
, _("Paper size"), wxPoint(10, 10), wxSize(staticBoxWidth
, 60) );
399 m_paperTypeChoice
= CreatePaperTypeChoice(&xPos
, &yPos
);
401 wxString
*choices
= new wxString
[2];
402 choices
[0] = _("Portrait");
403 choices
[1] = _("Landscape");
405 m_orientationRadioBox
= new wxRadioBox(this, wxPRINTID_ORIENTATION
, _("Orientation"),
406 wxPoint(10, 80), wxSize(-1, -1), 2, choices
, 1, wxRA_VERTICAL
);
407 m_orientationRadioBox
->SetSelection(0);
409 (void) new wxStaticBox(this, wxPRINTID_STATIC
, _("Options"), wxPoint(10, 130), wxSize(staticBoxWidth
, 50) );
411 int colourYPos
= 145;
417 m_colourCheckBox
= new wxCheckBox(this, wxPRINTID_PRINTCOLOUR
, _("Print in colour"), wxPoint(15, colourYPos
));
419 (void) new wxStaticBox(this, wxPRINTID_STATIC
, _("Print spooling"), wxPoint(330, 10), wxSize(200,170) );
421 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Printer command:"), wxPoint(340, 30));
423 m_printerCommandText
= new wxTextCtrl(this, wxPRINTID_COMMAND
, "", wxPoint(360, 55), wxSize(150, -1));
425 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Printer options:"), wxPoint(340, 110));
427 m_printerOptionsText
= new wxTextCtrl(this, wxPRINTID_OPTIONS
, "", wxPoint(360, 135), wxSize(150, -1));
429 wxButton
*okButton
= new wxButton(this, wxID_OK
, _("OK"), wxPoint(130, 200), wxSize(100, -1));
430 (void) new wxButton(this, wxID_CANCEL
, _("Cancel"), wxPoint(320, 200), wxSize(100, -1));
432 okButton
->SetDefault();
433 okButton
->SetFocus();
442 wxGenericPrintSetupDialog::~wxGenericPrintSetupDialog()
446 bool wxGenericPrintSetupDialog::TransferDataToWindow()
448 if (m_printerCommandText
&& m_printData
.GetPrinterCommand())
449 m_printerCommandText
->SetValue(m_printData
.GetPrinterCommand());
450 if (m_printerOptionsText
&& m_printData
.GetPrinterOptions())
451 m_printerOptionsText
->SetValue(m_printData
.GetPrinterOptions());
452 if (m_colourCheckBox
)
453 m_colourCheckBox
->SetValue(m_printData
.GetColour());
455 if (m_orientationRadioBox
)
457 if (m_printData
.GetOrientation() == wxPORTRAIT
)
458 m_orientationRadioBox
->SetSelection(0);
460 m_orientationRadioBox
->SetSelection(1);
465 bool wxGenericPrintSetupDialog::TransferDataFromWindow()
467 if (m_printerCommandText
)
468 m_printData
.SetPrinterCommand(m_printerCommandText
->GetValue());
469 if (m_printerOptionsText
)
470 m_printData
.SetPrinterOptions(m_printerOptionsText
->GetValue());
471 if (m_colourCheckBox
)
472 m_printData
.SetColour(m_colourCheckBox
->GetValue());
473 if (m_orientationRadioBox
)
475 int sel
= m_orientationRadioBox
->GetSelection();
477 m_printData
.SetOrientation(wxPORTRAIT
);
479 m_printData
.SetOrientation(wxLANDSCAPE
);
481 if (m_paperTypeChoice
)
483 wxString
val(m_paperTypeChoice
->GetStringSelection());
484 if (!val
.IsNull() && val
!= "")
485 m_printData
.SetPaperId(wxThePrintPaperDatabase
->ConvertNameToId(val
));
488 // This is for backward compatibility only
489 *wxThePrintSetupData
= GetPrintData();
493 wxChoice
*wxGenericPrintSetupDialog::CreatePaperTypeChoice(int *x
, int *y
)
495 /* Should not be necessary
496 if (!wxThePrintPaperDatabase)
498 wxThePrintPaperDatabase = new wxPrintPaperDatabase;
499 wxThePrintPaperDatabase->CreateDatabase();
502 int n
= wxThePrintPaperDatabase
->Number();
503 wxString
*choices
= new wxString
[n
];
506 for (i
= 0; i
< n
; i
++)
508 wxPrintPaperType
*paper
= (wxPrintPaperType
*)wxThePrintPaperDatabase
->Nth(i
)->Data();
509 choices
[i
] = paper
->GetName();
510 if (m_printData
.GetPaperId() == paper
->GetId())
516 wxChoice
*choice
= new wxChoice(this, wxPRINTID_PAPERSIZE
, wxPoint(*x
, *y
), wxSize(width
, -1), n
,
519 // SetFont(thisFont);
523 choice
->SetSelection(sel
);
526 #endif // wxUSE_POSTSCRIPT
528 // ----------------------------------------------------------------------------
529 // Generic page setup dialog
530 // ----------------------------------------------------------------------------
532 void wxGenericPageSetupDialog::OnPrinter(wxCommandEvent
& WXUNUSED(event
))
534 // We no longer query GetPrintMode, so we can eliminate the need
535 // to call SetPrintMode.
536 // This has the limitation that we can't explicitly call the PostScript
537 // print setup dialog from the generic Page Setup dialog under Windows,
538 // but since this choice would only happen when trying to do PostScript
539 // printing under Windows (and only in 16-bit Windows which
540 // doesn't have a Windows-specific page setup dialog) it's worth it.
542 // First save the current settings, so the wxPrintData object is up to date.
543 TransferDataFromWindow();
545 // Transfer the current print settings from this dialog to the page setup dialog.
546 wxPrintDialogData data
;
547 data
= GetPageSetupData().GetPrintData();
548 data
.SetSetupDialog(TRUE
);
549 wxPrintDialog
*printDialog
= new wxPrintDialog(this, & data
);
550 printDialog
->ShowModal();
552 // Transfer the page setup print settings from the page dialog to this dialog again, in case
553 // the page setup dialog changed something.
554 GetPageSetupData().GetPrintData() = printDialog
->GetPrintDialogData().GetPrintData();
555 GetPageSetupData().CalculatePaperSizeFromId(); // Make sure page size reflects the id in wxPrintData
557 printDialog
->Destroy();
559 // Now update the dialog in case the page setup dialog changed some of our settings.
560 TransferDataToWindow();
563 wxGenericPageSetupDialog::wxGenericPageSetupDialog(wxWindow
*parent
, wxPageSetupData
* data
):
564 wxDialog(parent
, -1, _("Page Setup"), wxPoint(0, 0), wxSize(600, 600), wxDIALOG_MODAL
|wxDEFAULT_DIALOG_STYLE
|wxTAB_TRAVERSAL
)
569 int buttonWidth
= 75;
570 int buttonHeight
= 25;
579 wxButton
*okButton
= new wxButton(this, wxID_OK
, _("OK"), wxPoint(5, yPos
), wxSize(buttonWidth
, buttonHeight
));
580 (void) new wxButton(this, wxID_CANCEL
, _("Cancel"), wxPoint(buttonWidth
+ 5 + spacing
, yPos
), wxSize(buttonWidth
, buttonHeight
));
582 m_printerButton
= new wxButton(this, wxPRINTID_SETUP
, _("Printer..."), wxPoint(buttonWidth
*2 + 5 + 2*spacing
, yPos
), wxSize(buttonWidth
, buttonHeight
));
584 if ( !m_pageData
.GetEnablePrinter() )
585 m_printerButton
->Enable(FALSE
);
587 // if (m_printData.GetEnableHelp())
588 // wxButton *helpButton = new wxButton(this, (wxFunction)wxGenericPageSetupHelpProc, _("Help"), -1, -1, buttonWidth, buttonHeight);
590 okButton
->SetDefault();
591 okButton
->SetFocus();
600 m_paperTypeChoice
= CreatePaperTypeChoice(&xPos
, &yPos
);
604 wxString
*choices
= new wxString
[2];
605 choices
[0] = _("Portrait");
606 choices
[1] = _("Landscape");
607 m_orientationRadioBox
= new wxRadioBox(this, wxPRINTID_ORIENTATION
, _("Orientation"),
608 wxPoint(xPos
, yPos
), wxSize(-1, -1), 2, choices
, 2);
609 m_orientationRadioBox
->SetSelection(0);
614 int staticWidth
= 110;
622 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Left margin (mm):"), wxPoint(xPos
, yPos
));
625 m_marginLeftText
= new wxTextCtrl(this, wxPRINTID_LEFTMARGIN
, "", wxPoint(xPos
, yPos
), wxSize(textWidth
, -1));
626 xPos
+= textWidth
+ spacing
;
628 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Right margin (mm):"), wxPoint(xPos
, yPos
));
631 m_marginRightText
= new wxTextCtrl(this, wxPRINTID_RIGHTMARGIN
, "", wxPoint(xPos
, yPos
), wxSize(textWidth
, -1));
632 xPos
+= textWidth
+ spacing
;
637 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Top margin (mm):"), wxPoint(xPos
, yPos
));
640 m_marginTopText
= new wxTextCtrl(this, wxPRINTID_TOPMARGIN
, "", wxPoint(xPos
, yPos
), wxSize(textWidth
, -1));
641 xPos
+= textWidth
+ spacing
;
643 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Bottom margin (mm):"), wxPoint(xPos
, yPos
));
646 m_marginBottomText
= new wxTextCtrl(this, wxPRINTID_BOTTOMMARGIN
, "", wxPoint(xPos
, yPos
), wxSize(textWidth
, -1));
655 wxGenericPageSetupDialog::~wxGenericPageSetupDialog()
659 bool wxGenericPageSetupDialog::TransferDataToWindow()
661 if (m_marginLeftText
)
662 m_marginLeftText
->SetValue(IntToString((int) m_pageData
.GetMarginTopLeft().x
));
664 m_marginTopText
->SetValue(IntToString((int) m_pageData
.GetMarginTopLeft().y
));
665 if (m_marginRightText
)
666 m_marginRightText
->SetValue(IntToString((int) m_pageData
.GetMarginBottomRight().x
));
667 if (m_marginBottomText
)
668 m_marginBottomText
->SetValue(IntToString((int) m_pageData
.GetMarginBottomRight().y
));
670 if (m_orientationRadioBox
)
672 if (m_pageData
.GetPrintData().GetOrientation() == wxPORTRAIT
)
673 m_orientationRadioBox
->SetSelection(0);
675 m_orientationRadioBox
->SetSelection(1);
678 // Find the paper type from either the current paper size in the wxPageSetupDialogData, or
679 // failing that, the id in the wxPrintData object.
681 wxPrintPaperType
* type
= wxThePrintPaperDatabase
->FindPaperType(
682 wxSize(m_pageData
.GetPaperSize().x
* 10, m_pageData
.GetPaperSize().y
* 10));
684 if (!type
&& m_pageData
.GetPrintData().GetPaperId() != wxPAPER_NONE
)
685 type
= wxThePrintPaperDatabase
->FindPaperType(m_pageData
.GetPrintData().GetPaperId());
689 m_paperTypeChoice
->SetStringSelection(type
->GetName());
695 bool wxGenericPageSetupDialog::TransferDataFromWindow()
697 if (m_marginLeftText
&& m_marginTopText
)
698 m_pageData
.SetMarginTopLeft(wxPoint(wxAtoi((const wxChar
*)m_marginLeftText
->GetValue()),wxAtoi((const wxChar
*)m_marginTopText
->GetValue())));
699 if (m_marginRightText
&& m_marginBottomText
)
700 m_pageData
.SetMarginBottomRight(wxPoint(wxAtoi((const wxChar
*)m_marginRightText
->GetValue()),wxAtoi((const wxChar
*)m_marginBottomText
->GetValue())));
702 if (m_orientationRadioBox
)
704 int sel
= m_orientationRadioBox
->GetSelection();
708 wxThePrintSetupData
->SetPrinterOrientation(wxPORTRAIT
);
710 m_pageData
.GetPrintData().SetOrientation(wxPORTRAIT
);
715 wxThePrintSetupData
->SetPrinterOrientation(wxLANDSCAPE
);
717 m_pageData
.GetPrintData().SetOrientation(wxLANDSCAPE
);
720 if (m_paperTypeChoice
)
722 wxString
val(m_paperTypeChoice
->GetStringSelection());
723 if (!val
.IsNull() && val
!= "")
725 wxPrintPaperType
* paper
= wxThePrintPaperDatabase
->FindPaperType(val
);
728 m_pageData
.SetPaperSize(wxSize(paper
->GetWidth()/10, paper
->GetHeight()/10));
729 m_pageData
.GetPrintData().SetPaperId(paper
->GetId());
737 wxChoice
*wxGenericPageSetupDialog::CreatePaperTypeChoice(int *x
, int *y
)
740 if (!wxThePrintPaperDatabase)
742 wxThePrintPaperDatabase = new wxPrintPaperDatabase;
743 wxThePrintPaperDatabase->CreateDatabase();
747 int n
= wxThePrintPaperDatabase
->Number();
748 wxString
*choices
= new wxString
[n
];
750 for (i
= 0; i
< n
; i
++)
752 wxPrintPaperType
*paper
= (wxPrintPaperType
*)wxThePrintPaperDatabase
->Nth(i
)->Data();
753 choices
[i
] = paper
->GetName();
756 (void) new wxStaticText(this, wxPRINTID_STATIC
, _("Paper size"), wxPoint(*x
, *y
));
759 wxChoice
*choice
= new wxChoice(this, wxPRINTID_PAPERSIZE
, wxPoint(*x
, *y
), wxSize(300, -1), n
,
764 // choice->SetSelection(sel);