- wxASSERT_MSG( value == -1 || m_gauge, wxT("cannot update non existent dialog") );
- wxASSERT_MSG( value <= m_maximum, wxT("invalid progress value") );
-
-
- if( m_gauge )
- m_gauge->SetValue(value + 1);
-
- if( !newmsg.IsEmpty() )
- m_msg->SetLabel(newmsg);
-
- if ( (m_elapsed || m_remaining || m_estimated) && (value != 0) )
- {
- unsigned long elapsed = wxGetCurrentTime() - m_timeStart;
- unsigned long estimated = elapsed * m_maximum / value;
- unsigned long remaining = estimated - elapsed;
-
- SetTimeLabel(elapsed, m_elapsed);
- SetTimeLabel(estimated, m_estimated);
- SetTimeLabel(remaining, m_remaining);
- }
-
- if ( (value == m_maximum ) && !m_AutoHide )
- {
- if ( m_btnAbort )
- {
- // tell the user what he should do...
- m_btnAbort->SetLabel(_("Close"));
- }
-
- if ( !newmsg )
- {
- // also provide the finishing message if the application didn't
- m_msg->SetLabel(_("Done."));
- }
-
- // so that we return TRUE below and that out [Cancel] handler knew what
- // to do
- m_state = Finished;
-
- wxYield();
-
- (void)ShowModal();
- }
- else
- {
- // update the display
- wxYield();
- }
-
- return m_state != Canceled;
+ 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") );
+
+ if ( m_gauge )
+ {
+ m_gauge->SetValue(value + 1);
+ }
+
+ if ( !newmsg.IsEmpty() )
+ {
+ m_msg->SetLabel(newmsg);
+
+ wxYield();
+ wxYield();
+ }
+
+ if ( (m_elapsed || m_remaining || m_estimated) && (value != 0) )
+ {
+ unsigned long elapsed = wxGetCurrentTime() - m_timeStart;
+ unsigned long estimated = elapsed * m_maximum / value;
+ unsigned long remaining = estimated - elapsed;
+
+ SetTimeLabel(elapsed, m_elapsed);
+ SetTimeLabel(estimated, m_estimated);
+ SetTimeLabel(remaining, m_remaining);
+ }
+
+ if ( (value == m_maximum ) )
+ {
+ // so that we return TRUE below and that out [Cancel] handler knew what
+ // to do
+ m_state = Finished;
+ if( !(GetWindowStyle() & wxPD_AUTO_HIDE) )
+ {
+ if ( m_btnAbort )
+ {
+ // tell the user what he should do...
+ m_btnAbort->SetLabel(_("Close"));
+ }
+#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
+ else // enable the close button to give the user a way to close the dlg
+ {
+ EnableCloseButton(TRUE);
+ }
+#endif // __WXMSW__
+
+ if ( !newmsg )
+ {
+ // also provide the finishing message if the application didn't
+ m_msg->SetLabel(_("Done."));
+ }
+
+ wxYield();
+ wxYield();
+
+ (void)ShowModal();
+ }
+ else
+ {
+ Hide();
+ ReenableOtherWindows();
+ }
+ }
+ else
+ {
+ // update the display
+ wxYield();
+ wxYield();
+ }
+
+#ifdef __WXMAC__
+ MacUpdateImmediately();
+#endif
+
+ return m_state != Canceled;
+}
+
+void wxProgressDialog::Resume()
+{
+ m_state = Continue;
+
+ // it may have been disabled by OnCancel(), so enable it back to let the
+ // user interrupt us again if needed
+ m_btnAbort->Enable();