Applied patches.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26464 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling 2004-03-29 18:02:59 +00:00
parent 3a72b6a474
commit 963907fa8f
2 changed files with 25 additions and 19 deletions

View File

@ -496,23 +496,34 @@ void wxPreviewControlBar::CreateButtons()
void wxPreviewControlBar::SetZoomControl(int zoom) void wxPreviewControlBar::SetZoomControl(int zoom)
{ {
wxChar buf[20];
wxSprintf( buf, wxT("%d%%"), zoom );
if (m_zoomControl) 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() int wxPreviewControlBar::GetZoomControl()
{ {
wxChar buf[20]; if (m_zoomControl && (m_zoomControl->GetStringSelection() != wxEmptyString))
if (m_zoomControl && (m_zoomControl->GetStringSelection() != wxT("")))
{ {
wxStrcpy(buf, m_zoomControl->GetStringSelection()); long val;
buf[wxStrlen(buf) - 1] = 0; if (m_zoomControl->GetStringSelection().BeforeFirst(wxT('%')).ToLong(&val))
return (int)wxAtoi(buf); return int(val);
} }
else return 0;
return 0;
} }

View File

@ -705,21 +705,16 @@ wxGenericPageSetupDialog::~wxGenericPageSetupDialog()
{ {
} }
static inline wxString IntToString( long value )
{
return wxString::Format(wxT("%ld"), value);
}
bool wxGenericPageSetupDialog::TransferDataToWindow() bool wxGenericPageSetupDialog::TransferDataToWindow()
{ {
if (m_marginLeftText) 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) 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) 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) 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) if (m_orientationRadioBox)
{ {