From: Robert Roebling Date: Mon, 29 Mar 2004 18:02:59 +0000 (+0000) Subject: Applied patches. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/963907fa8fbeea14a9c412d90bf938fbd59583ce Applied patches. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26464 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/prntbase.cpp b/src/common/prntbase.cpp index c047f6d3cd..7545ff42a3 100644 --- a/src/common/prntbase.cpp +++ b/src/common/prntbase.cpp @@ -496,23 +496,34 @@ void wxPreviewControlBar::CreateButtons() void wxPreviewControlBar::SetZoomControl(int zoom) { - wxChar buf[20]; - wxSprintf( buf, wxT("%d%%"), zoom ); - if (m_zoomControl) - m_zoomControl->SetStringSelection(buf); + { + int n, count = m_zoomControl->GetCount(); + long val; + for (n=0; nGetString(n).BeforeFirst(wxT('%')).ToLong(&val) && + (val >= long(zoom))) + { + m_zoomControl->SetSelection(n); + return; + } + } + + m_zoomControl->SetSelection(count-1); + } } int wxPreviewControlBar::GetZoomControl() { - wxChar buf[20]; - if (m_zoomControl && (m_zoomControl->GetStringSelection() != wxT(""))) + if (m_zoomControl && (m_zoomControl->GetStringSelection() != wxEmptyString)) { - wxStrcpy(buf, m_zoomControl->GetStringSelection()); - buf[wxStrlen(buf) - 1] = 0; - return (int)wxAtoi(buf); + long val; + if (m_zoomControl->GetStringSelection().BeforeFirst(wxT('%')).ToLong(&val)) + return int(val); } - else return 0; + + return 0; } diff --git a/src/generic/prntdlgg.cpp b/src/generic/prntdlgg.cpp index 19d2d2800c..e41ee6da36 100644 --- a/src/generic/prntdlgg.cpp +++ b/src/generic/prntdlgg.cpp @@ -705,21 +705,16 @@ wxGenericPageSetupDialog::~wxGenericPageSetupDialog() { } -static inline wxString IntToString( long value ) -{ - return wxString::Format(wxT("%ld"), value); -} - bool wxGenericPageSetupDialog::TransferDataToWindow() { if (m_marginLeftText) - m_marginLeftText->SetValue(IntToString(m_pageData.GetMarginTopLeft().x)); + m_marginLeftText->SetValue(wxString::Format(wxT("%d"), m_pageData.GetMarginTopLeft().x)); if (m_marginTopText) - m_marginTopText->SetValue(IntToString(m_pageData.GetMarginTopLeft().y)); + m_marginTopText->SetValue(wxString::Format(wxT("%d"), m_pageData.GetMarginTopLeft().y)); if (m_marginRightText) - m_marginRightText->SetValue(IntToString(m_pageData.GetMarginBottomRight().x)); + m_marginRightText->SetValue(wxString::Format(wxT("%d"), m_pageData.GetMarginBottomRight().x)); if (m_marginBottomText) - m_marginBottomText->SetValue(IntToString(m_pageData.GetMarginBottomRight().y)); + m_marginBottomText->SetValue(wxString::Format(wxT("%d"), m_pageData.GetMarginBottomRight().y)); if (m_orientationRadioBox) {