From 94c8a947ad1d5a233f5a4cf48f5905d565150e6d Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 15 Jan 2018 17:57:03 +0100 Subject: [PATCH] Progress reporter: remove wxPD_APP_MODAL style, not useful, that creates issues on OSX. All platforms now use the same code. --- common/widgets/progress_reporter.cpp | 12 ++++++++---- pcbnew/drc.cpp | 13 +++---------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/common/widgets/progress_reporter.cpp b/common/widgets/progress_reporter.cpp index c76ee83b49..d405a90e6a 100644 --- a/common/widgets/progress_reporter.cpp +++ b/common/widgets/progress_reporter.cpp @@ -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 ) { } diff --git a/pcbnew/drc.cpp b/pcbnew/drc.cpp index f4b5591ca7..1a0cb32c68 100644 --- a/pcbnew/drc.cpp +++ b/pcbnew/drc.cpp @@ -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 ); }