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;
}
{
}
-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)
{