]> git.saurik.com Git - wxWidgets.git/commitdiff
Applied patches.
authorRobert Roebling <robert@roebling.de>
Mon, 29 Mar 2004 18:02:59 +0000 (18:02 +0000)
committerRobert Roebling <robert@roebling.de>
Mon, 29 Mar 2004 18:02:59 +0000 (18:02 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26464 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/prntbase.cpp
src/generic/prntdlgg.cpp

index c047f6d3cd258c909bccea78d6013b450d227a2b..7545ff42a35eff09f189614c85fb047bd3a4899a 100644 (file)
@@ -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; n<count; n++)
+        {
+            if (m_zoomControl->GetString(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;
 }
 
 
index 19d2d2800c93c77a0ea20942e8e38e85b55dca0b..e41ee6da364648fe9b59c2115e3c4ac65cf2d0ac 100644 (file)
@@ -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)
     {