From 4ab676c967a48efcb4fbb1c1b84cbafd493692a2 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 31 Oct 2017 17:27:21 +0100 Subject: [PATCH] Show elapsed/estimated times in wxMSW wxProgressDialog by default This further improves the dialog usability when the main thread doesn't update it frequently enough, as these times can be seen immediately without having to expand the "details" part of the dialog which can be very sluggish in this case. It is also more consistent with the generic dialog and the behaviour of the native dialog before 6b91c5dfab876f0f1b17d54304bfb2fda27398ef which removed the code clearing TDF_EXPAND_FOOTER_AREA style. --- src/msw/progdlg.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/msw/progdlg.cpp b/src/msw/progdlg.cpp index 44916657f9..49a33eb49e 100644 --- a/src/msw/progdlg.cpp +++ b/src/msw/progdlg.cpp @@ -987,10 +987,12 @@ void wxProgressDialog::UpdateExpandedInformation(int value) unsigned long remainingTime; UpdateTimeEstimates(value, elapsedTime, estimatedTime, remainingTime); - if ( m_sharedData->m_progressBarMarquee ) + // The value of 0 is special, we can't estimate anything before we have at + // least one update, so leave the times dependent on it indeterminate. + // + // Similarly, in indeterminate mode we don't have any estimations neither. + if ( !value || m_sharedData->m_progressBarMarquee ) { - // In indeterminate mode we don't have any estimation neither for the - // remaining nor for estimated time. estimatedTime = remainingTime = static_cast(-1); } @@ -1081,6 +1083,13 @@ void* wxProgressDialogTaskRunner::Entry() { tdc.pszExpandedInformation = m_sharedData.m_expandedInformation.t_str(); + + // If we have elapsed/estimated/... times to show, show them from + // the beginning for consistency with the generic version and also + // because showing them later may be very sluggish if the main + // thread doesn't update the dialog sufficiently frequently, while + // hiding them still works reasonably well. + tdc.dwFlags |= TDF_EXPANDED_BY_DEFAULT; } }