PROGRESS_REPORTER: avoid clipping the bottom of the dialog in some cases.
It occurred on Windows, when the message to display is too long and was displayed using 2 lines. Now the dialog is resize after changing the message. Fixes #7953 https://gitlab.com/kicad/code/kicad/issues/7953
This commit is contained in:
parent
5bd30232e8
commit
fb246403d2
|
@ -27,6 +27,7 @@
|
|||
#include <thread>
|
||||
|
||||
PROGRESS_REPORTER::PROGRESS_REPORTER( int aNumPhases ) :
|
||||
m_msgChanged( false ),
|
||||
m_phase( 0 ),
|
||||
m_numPhases( aNumPhases ),
|
||||
m_progress( 0 ),
|
||||
|
@ -61,6 +62,7 @@ void PROGRESS_REPORTER::Report( const wxString& aMessage )
|
|||
{
|
||||
std::lock_guard<std::mutex> guard( m_mutex );
|
||||
m_rptMessage = aMessage;
|
||||
m_msgChanged = true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -170,14 +172,22 @@ bool WX_PROGRESS_REPORTER::updateUI()
|
|||
if( cur < 0 || cur > 1000 )
|
||||
cur = 0;
|
||||
|
||||
bool msgChanged = false;
|
||||
wxString message;
|
||||
{
|
||||
std::lock_guard<std::mutex> guard( m_mutex );
|
||||
message = m_rptMessage;
|
||||
msgChanged = m_msgChanged;
|
||||
m_msgChanged = false;
|
||||
}
|
||||
|
||||
SetRange( 1000 );
|
||||
return wxProgressDialog::Update( cur, message );
|
||||
bool diag = wxProgressDialog::Update( cur, message );
|
||||
|
||||
if( msgChanged )
|
||||
Fit();
|
||||
|
||||
return diag;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -116,6 +116,8 @@ protected:
|
|||
virtual bool updateUI() = 0;
|
||||
|
||||
wxString m_rptMessage;
|
||||
bool m_msgChanged; // true after change in m_rptMessage
|
||||
// the dialog needs perhaps a resize
|
||||
mutable std::mutex m_mutex;
|
||||
std::atomic_int m_phase;
|
||||
std::atomic_int m_numPhases;
|
||||
|
|
Loading…
Reference in New Issue