fixed wxProgressDialog for ranges > 65535
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13159 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -73,6 +73,7 @@ wxMSW:
|
|||||||
|
|
||||||
- fixed flicker in wxTreeCtrl::SetItemXXX()
|
- fixed flicker in wxTreeCtrl::SetItemXXX()
|
||||||
- fixed redraw problems in dynamically resized wxStaticText
|
- fixed redraw problems in dynamically resized wxStaticText
|
||||||
|
- fixed wxProgressDialog for ranges > 65535
|
||||||
|
|
||||||
2.3.2
|
2.3.2
|
||||||
-----
|
-----
|
||||||
|
@@ -112,6 +112,12 @@ private:
|
|||||||
// the maximum value
|
// the maximum value
|
||||||
int m_maximum;
|
int m_maximum;
|
||||||
|
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
// the factor we use to always keep the value in 16 bit range as the native
|
||||||
|
// control only supports ranges from 0 to 65,535
|
||||||
|
size_t m_factor;
|
||||||
|
#endif // __WXMSW__
|
||||||
|
|
||||||
// for wxPD_APP_MODAL case
|
// for wxPD_APP_MODAL case
|
||||||
class WXDLLEXPORT wxWindowDisabler *m_winDisabler;
|
class WXDLLEXPORT wxWindowDisabler *m_winDisabler;
|
||||||
|
|
||||||
|
@@ -110,6 +110,13 @@ wxProgressDialog::wxProgressDialog(wxString const &title,
|
|||||||
m_state = hasAbortButton ? Continue : Uncancelable;
|
m_state = hasAbortButton ? Continue : Uncancelable;
|
||||||
m_maximum = maximum;
|
m_maximum = maximum;
|
||||||
|
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
// we can't have values > 65,536 in the progress control under Windows, so
|
||||||
|
// scale everything down
|
||||||
|
m_factor = m_maximum / 65536 + 1;
|
||||||
|
m_maximum /= m_factor;
|
||||||
|
#endif // __WXMSW__
|
||||||
|
|
||||||
m_parentTop = parent;
|
m_parentTop = parent;
|
||||||
while ( m_parentTop && m_parentTop->GetParent() )
|
while ( m_parentTop && m_parentTop->GetParent() )
|
||||||
{
|
{
|
||||||
@@ -142,7 +149,7 @@ wxProgressDialog::wxProgressDialog(wxString const &title,
|
|||||||
// note that we can't use wxGA_SMOOTH because it happens to also mean
|
// note that we can't use wxGA_SMOOTH because it happens to also mean
|
||||||
// wxDIALOG_MODAL and will cause the dialog to be modal. Have an extra
|
// wxDIALOG_MODAL and will cause the dialog to be modal. Have an extra
|
||||||
// style argument to wxProgressDialog, perhaps.
|
// style argument to wxProgressDialog, perhaps.
|
||||||
m_gauge = new wxGauge(this, -1, maximum,
|
m_gauge = new wxGauge(this, -1, m_maximum,
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
wxGA_HORIZONTAL);
|
wxGA_HORIZONTAL);
|
||||||
|
|
||||||
@@ -305,19 +312,20 @@ bool
|
|||||||
wxProgressDialog::Update(int value, const wxString& newmsg)
|
wxProgressDialog::Update(int value, const wxString& newmsg)
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( value == -1 || m_gauge, wxT("cannot update non existent dialog") );
|
wxASSERT_MSG( value == -1 || m_gauge, wxT("cannot update non existent dialog") );
|
||||||
|
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
value /= m_factor;
|
||||||
|
#endif // __WXMSW__
|
||||||
|
|
||||||
wxASSERT_MSG( value <= m_maximum, wxT("invalid progress value") );
|
wxASSERT_MSG( value <= m_maximum, wxT("invalid progress value") );
|
||||||
|
|
||||||
if ( m_gauge )
|
if ( m_gauge )
|
||||||
|
{
|
||||||
m_gauge->SetValue(value + 1);
|
m_gauge->SetValue(value + 1);
|
||||||
|
}
|
||||||
|
|
||||||
if ( !newmsg.IsEmpty() )
|
if ( !newmsg.IsEmpty() )
|
||||||
{
|
{
|
||||||
#ifdef __WXMSW__
|
|
||||||
// this seems to be necessary or garbage is left when the new label is
|
|
||||||
// longer than the old one
|
|
||||||
m_msg->SetLabel(wxEmptyString);
|
|
||||||
#endif // MSW
|
|
||||||
|
|
||||||
m_msg->SetLabel(newmsg);
|
m_msg->SetLabel(newmsg);
|
||||||
|
|
||||||
wxYield();
|
wxYield();
|
||||||
|
Reference in New Issue
Block a user