X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d14612c6621bf7dd9c711e2f94856137b926e863..f861258fcace51a1aaba2f31c7498b3ba9e31371:/src/generic/prntdlgg.cpp diff --git a/src/generic/prntdlgg.cpp b/src/generic/prntdlgg.cpp index 3602295dab..6270c0f62f 100644 --- a/src/generic/prntdlgg.cpp +++ b/src/generic/prntdlgg.cpp @@ -113,6 +113,11 @@ wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent, wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent, wxPrintData* data) + : wxDialog(parent, -1, _("Print"), + wxPoint(0, 0), wxSize(600, 600), + wxDEFAULT_DIALOG_STYLE | + wxDIALOG_MODAL | + wxTAB_TRAVERSAL) { if ( data ) m_printDialogData = *data; @@ -122,8 +127,8 @@ wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent, void wxGenericPrintDialog::Init(wxWindow *parent) { - wxDialog::Create(parent, -1, _("Print"), wxPoint(0, 0), wxSize(600, 600), - wxDEFAULT_DIALOG_STYLE | wxDIALOG_MODAL | wxTAB_TRAVERSAL); + // wxDialog::Create(parent, -1, _("Print"), wxPoint(0, 0), wxSize(600, 600), + // wxDEFAULT_DIALOG_STYLE | wxDIALOG_MODAL | wxTAB_TRAVERSAL); (void)new wxStaticBox( this, -1, _( "Printer options" ), wxPoint( 5, 5), wxSize( 300, 60 ) ); @@ -137,7 +142,8 @@ void wxGenericPrintDialog::Init(wxWindow *parent) m_fromText = (wxTextCtrl*)NULL; m_toText = (wxTextCtrl*)NULL; - + m_rangeRadioBox = (wxRadioBox *)NULL; + if (m_printDialogData.GetFromPage() != 0) { m_rangeRadioBox = new wxRadioBox(this, wxPRINTID_RANGE, _("Print Range"), @@ -228,7 +234,7 @@ void wxGenericPrintDialog::OnOK(wxCommandEvent& WXUNUSED(event)) wxString f = wxFileSelector(_("PostScript file"), wxPathOnly(wxThePrintSetupData->GetPrinterFile()), wxFileNameFromPath(wxThePrintSetupData->GetPrinterFile()), - "ps", "*.ps", 0, this); + _T("ps"), _T("*.ps"), 0, this); if ( f.IsEmpty() ) return; @@ -287,17 +293,21 @@ bool wxGenericPrintDialog::TransferDataToWindow() m_fromText->SetValue(buf); sprintf(buf, "%d", m_printDialogData.GetToPage()); m_toText->SetValue(buf); - if (m_printDialogData.GetAllPages()) - m_rangeRadioBox->SetSelection(0); - else - m_rangeRadioBox->SetSelection(1); + if(m_rangeRadioBox) + if (m_printDialogData.GetAllPages()) + m_rangeRadioBox->SetSelection(0); + else + m_rangeRadioBox->SetSelection(1); } else { m_fromText->Enable(FALSE); m_toText->Enable(FALSE); - m_rangeRadioBox->SetSelection(0); - m_rangeRadioBox->wxRadioBox::Enable(1, FALSE); + if(m_rangeRadioBox) + { + m_rangeRadioBox->SetSelection(0); + m_rangeRadioBox->wxRadioBox::Enable(1, FALSE); + } } } } @@ -315,20 +325,23 @@ bool wxGenericPrintDialog::TransferDataFromWindow() { if (m_printDialogData.GetEnablePageNumbers()) { - if(m_fromText) m_printDialogData.SetFromPage(atoi(m_fromText->GetValue())); - if(m_toText) m_printDialogData.SetToPage(atoi(m_toText->GetValue())); + if(m_fromText) m_printDialogData.SetFromPage(wxAtoi(m_fromText->GetValue())); + if(m_toText) m_printDialogData.SetToPage(wxAtoi(m_toText->GetValue())); + } + if(m_rangeRadioBox) + { + if (m_rangeRadioBox->GetSelection() == 0) + m_printDialogData.SetAllPages(TRUE); + else + m_printDialogData.SetAllPages(FALSE); } - if (m_rangeRadioBox->GetSelection() == 0) - m_printDialogData.SetAllPages(TRUE); - else - m_printDialogData.SetAllPages(FALSE); } else { // continuous printing m_printDialogData.SetFromPage(1); m_printDialogData.SetToPage(32000); } - m_printDialogData.SetNoCopies(atoi(m_noCopiesText->GetValue())); + m_printDialogData.SetNoCopies(wxAtoi(m_noCopiesText->GetValue())); m_printDialogData.SetPrintToFile(m_printToFileCheckBox->GetValue()); return TRUE; @@ -677,9 +690,9 @@ bool wxGenericPageSetupDialog::TransferDataToWindow() bool wxGenericPageSetupDialog::TransferDataFromWindow() { if (m_marginLeftText && m_marginTopText) - m_pageData.SetMarginTopLeft(wxPoint(atoi((const char *)m_marginLeftText->GetValue()),atoi((const char *)m_marginTopText->GetValue()))); + m_pageData.SetMarginTopLeft(wxPoint(wxAtoi((const wxChar *)m_marginLeftText->GetValue()),wxAtoi((const wxChar *)m_marginTopText->GetValue()))); if (m_marginRightText && m_marginBottomText) - m_pageData.SetMarginBottomRight(wxPoint(atoi((const char *)m_marginRightText->GetValue()),atoi((const char *)m_marginBottomText->GetValue()))); + m_pageData.SetMarginBottomRight(wxPoint(wxAtoi((const wxChar *)m_marginRightText->GetValue()),wxAtoi((const wxChar *)m_marginBottomText->GetValue()))); if (m_orientationRadioBox) {