Progress reporter: remove wxPD_APP_MODAL style, not useful, that creates issues on OSX.

All platforms now use the same code.
This commit is contained in:
jean-pierre charras 2018-01-15 17:57:03 +01:00
parent 5141a4ecf0
commit 94c8a947ad
2 changed files with 11 additions and 14 deletions

View File

@ -67,17 +67,21 @@ void PROGRESS_REPORTER::AdvanceProgress( )
int PROGRESS_REPORTER::currentProgress() const
{
double current = (1.0 / (double)m_numPhases) * ( (double) m_phase + ( (double) m_progress.load() / (double) m_maxProgress ) );
double current = ( 1.0 / (double)m_numPhases ) *
( (double) m_phase + ( (double) m_progress.load() / (double) m_maxProgress ) );
return (int)(current * 1000);
}
// Please, *DO NOT* use wxPD_APP_MODAL style: it is not necessary
// (without this option the PROGRESS_REPORTER is modal for the parent frame)
// and PROGRESS_REPORTER works fine on OSX only without this style
// when called from a quasi modal dialog
WX_PROGRESS_REPORTER::WX_PROGRESS_REPORTER( wxWindow* aParent,
const wxString& aTitle,
int aNumPhases ) :
const wxString& aTitle, int aNumPhases ) :
PROGRESS_REPORTER( aNumPhases ),
wxProgressDialog( aTitle, wxT( "" ), 1, aParent, wxPD_AUTO_HIDE | wxPD_CAN_ABORT |
wxPD_APP_MODAL | wxPD_ELAPSED_TIME )
wxPD_ELAPSED_TIME )
{
}

View File

@ -408,16 +408,8 @@ void DRC::RunTests( wxTextCtrl* aMessages )
wxSafeYield();
}
// Refill all zones
// On OSX the progress bar managed by Fill_All_Zones() create issues
// when Fill_All_Zones() is called by a QuasiModal dialog
// so it is not shown on OSX, until a better fix is found
#ifdef __WXMAC__
wxWindow* caller = nullptr; // Do not show progress bar
#else
// caller (a wxTopLevelFrame) is the wxDialog or the Pcb Editor frame that call DRC:
wxWindow* caller = aMessages ? aMessages->GetParent() : m_pcbEditorFrame;
#endif
m_pcbEditorFrame->Fill_All_Zones( caller, true );
// test zone clearances to other zones
@ -677,10 +669,11 @@ void DRC::testTracks( wxWindow *aActiveWindow, bool aShowProgressBar )
if( aShowProgressBar && deltamax > 3 )
{
// Do not use wxPD_APP_MODAL style here: it is not necessary and create issues
// on OSX
progressDialog = new wxProgressDialog( _( "Track clearances" ), wxEmptyString,
deltamax, aActiveWindow,
wxPD_AUTO_HIDE | wxPD_CAN_ABORT |
wxPD_APP_MODAL | wxPD_ELAPSED_TIME );
wxPD_AUTO_HIDE | wxPD_CAN_ABORT | wxPD_ELAPSED_TIME );
progressDialog->Update( 0, wxEmptyString );
}