![]() |
KiCad PCB EDA Suite
|
Multi-thread safe progress reporter dialog, intended for use of tasks that paralleize reporting back of work status See PROGRESS_REPORTER. More...
#include <progress_reporter.h>
Public Member Functions | |
WX_PROGRESS_REPORTER (wxWindow *aParent, const wxString &aTitle, int aNumPhases, bool aCanAbort=true, bool aReserveSpaceForMessage=true) | |
Ctor: the PROGRESS_REPORTER will stay on top of aParent. More... | |
~WX_PROGRESS_REPORTER () | |
virtual void | SetTitle (const wxString &aTitle) override |
change the title displayed on the window caption More... | |
void | SetNumPhases (int aNumPhases) |
sets the number of phases More... | |
void | AddPhases (int aNumPhases) |
virtual void | BeginPhase (int aPhase) |
initialize the aPhase virtual zone of the dialog progress bar More... | |
virtual void | AdvancePhase () |
Uses the next vailable virtual zone of the dialog progress bar. More... | |
virtual void | AdvancePhase (const wxString &aMessage) |
Uses the next vailable virtual zone of the dialog progress bar and updates the message. More... | |
virtual void | Report (const wxString &aMessage) |
Display aMessage in the progress bar dialog. More... | |
virtual void | SetCurrentProgress (double aProgress) |
Set the progress value to aProgress (0..1) More... | |
void | SetMaxProgress (int aMaxProgress) |
Fix the value thar gives the 100 precent progress bar length (inside the current virtual zone) More... | |
void | AdvanceProgress () |
Increment the progress bar length (inside the current virtual zone) More... | |
bool | KeepRefreshing (bool aWait=false) |
Update the UI dialog. More... | |
bool | IsCancelled () const |
Protected Member Functions | |
int | currentProgress () const |
Protected Attributes | |
wxString | m_rptMessage |
std::mutex | m_mutex |
std::atomic_int | m_phase |
std::atomic_int | m_numPhases |
std::atomic_int | m_progress |
std::atomic_int | m_maxProgress |
std::atomic_bool | m_cancelled |
Private Member Functions | |
virtual bool | updateUI () override |
Multi-thread safe progress reporter dialog, intended for use of tasks that paralleize reporting back of work status See PROGRESS_REPORTER.
Definition at line 131 of file progress_reporter.h.
WX_PROGRESS_REPORTER::WX_PROGRESS_REPORTER | ( | wxWindow * | aParent, |
const wxString & | aTitle, | ||
int | aNumPhases, | ||
bool | aCanAbort = true , |
||
bool | aReserveSpaceForMessage = true |
||
) |
Ctor: the PROGRESS_REPORTER will stay on top of aParent.
the style is wxPD_AUTO_HIDE | wxPD_CAN_ABORT | wxPD_ELAPSED_TIME
aParent | is the wxDialog of Frame that manage this. |
aTitle | is the dialog progress title |
aNumPhases | is the number of "virtual sections" of the progress bar aNumPhases = 1 is the usual progress bar aNumPhases = n creates n virtual progress bar zones: a 0 to 100 percent width of a virtual zone fills 0 to 1/n progress bar full size of the nth virtual zone index |
aCanAbort | is true if the abort button should be shown |
aReserveSpaceForMessage | will ensure that the dialog is laid out for status messages, preventing layout issues on Windows when reporting a message after the initial layout |
Definition at line 135 of file progress_reporter.cpp.
WX_PROGRESS_REPORTER::~WX_PROGRESS_REPORTER | ( | ) |
Definition at line 161 of file progress_reporter.cpp.
|
inherited |
|
virtualinherited |
Uses the next vailable virtual zone of the dialog progress bar.
Definition at line 46 of file progress_reporter.cpp.
References PROGRESS_REPORTER::m_phase, and PROGRESS_REPORTER::m_progress.
Referenced by DIALOG_ERC::AdvancePhase(), PROGRESS_REPORTER::AdvancePhase(), DIALOG_DRC::AdvancePhase(), ZONE_FILLER::Fill(), FOOTPRINT_LIST_IMPL::ReadFootprintFiles(), DRC_ENGINE::ReportPhase(), DRC_TOOL::RunTests(), DIALOG_ERC::testErc(), and SYMBOL_ASYNC_LOADER::worker().
|
virtualinherited |
Uses the next vailable virtual zone of the dialog progress bar and updates the message.
Reimplemented in DIALOG_DRC, and DIALOG_ERC.
Definition at line 53 of file progress_reporter.cpp.
References PROGRESS_REPORTER::AdvancePhase(), and PROGRESS_REPORTER::Report().
|
inherited |
Increment the progress bar length (inside the current virtual zone)
Definition at line 79 of file progress_reporter.cpp.
References PROGRESS_REPORTER::m_progress.
Referenced by AR_AUTOPLACER::AutoplaceFootprints(), ZONE_FILLER::Fill(), FOOTPRINT_LIST_IMPL::joinWorkers(), and FOOTPRINT_LIST_IMPL::loader_job().
|
virtualinherited |
initialize the aPhase virtual zone of the dialog progress bar
Definition at line 39 of file progress_reporter.cpp.
References PROGRESS_REPORTER::m_phase, and PROGRESS_REPORTER::m_progress.
|
protectedinherited |
Definition at line 97 of file progress_reporter.cpp.
References PROGRESS_REPORTER::m_maxProgress, PROGRESS_REPORTER::m_numPhases, PROGRESS_REPORTER::m_phase, and PROGRESS_REPORTER::m_progress.
Referenced by updateUI(), and GAUGE_PROGRESS_REPORTER::updateUI().
|
inlineinherited |
Definition at line 110 of file progress_reporter.h.
References PROGRESS_REPORTER::m_cancelled.
Referenced by ZONE_FILLER::computeRawFilledArea(), ZONE_FILLER::Fill(), ZONE_FILLER::fillSingleZone(), SYMBOL_LIBRARY_MANAGER::Preload(), and CN_CONNECTIVITY_ALGO::SearchClusters().
|
inherited |
Update the UI dialog.
MUST only be called from the main thread. Returns false if the user clicked Cancel.
Definition at line 106 of file progress_reporter.cpp.
References PROGRESS_REPORTER::m_cancelled, PROGRESS_REPORTER::m_maxProgress, PROGRESS_REPORTER::m_progress, and PROGRESS_REPORTER::updateUI().
Referenced by AR_AUTOPLACER::AutoplaceFootprints(), ZONE_FILLER::Fill(), FOOTPRINT_LIST_IMPL::joinWorkers(), SYMBOL_LIBRARY_MANAGER::Preload(), FOOTPRINT_LIST_IMPL::ReadFootprintFiles(), DRC_ENGINE::ReportPhase(), DRC_ENGINE::ReportProgress(), reportProgress(), and CN_CONNECTIVITY_ALGO::searchConnections().
|
virtualinherited |
Display aMessage in the progress bar dialog.
Reimplemented in DIALOG_ERC.
Definition at line 60 of file progress_reporter.cpp.
References PROGRESS_REPORTER::m_mutex, and PROGRESS_REPORTER::m_rptMessage.
Referenced by PROGRESS_REPORTER::AdvancePhase(), AR_AUTOPLACER::AutoplaceFootprints(), ZONE_FILLER::Fill(), and FOOTPRINT_LIST_IMPL::ReadFootprintFiles().
|
virtualinherited |
Set the progress value to aProgress (0..1)
Reimplemented in CONSOLE_PROGRESS_REPORTER.
Definition at line 72 of file progress_reporter.cpp.
References PROGRESS_REPORTER::m_maxProgress, and PROGRESS_REPORTER::m_progress.
Referenced by DIALOG_ERC::AdvancePhase(), DIALOG_DRC::AdvancePhase(), DRC_ENGINE::ReportProgress(), reportProgress(), and CONSOLE_PROGRESS_REPORTER::SetCurrentProgress().
|
inherited |
Fix the value thar gives the 100 precent progress bar length (inside the current virtual zone)
Definition at line 67 of file progress_reporter.cpp.
References PROGRESS_REPORTER::m_maxProgress.
Referenced by AR_AUTOPLACER::AutoplaceFootprints(), ZONE_FILLER::Fill(), FOOTPRINT_LIST_IMPL::ReadFootprintFiles(), and CN_CONNECTIVITY_ALGO::searchConnections().
|
inherited |
sets the number of phases
Definition at line 85 of file progress_reporter.cpp.
References PROGRESS_REPORTER::m_numPhases.
|
inlineoverridevirtual |
change the title displayed on the window caption
Reimplemented from PROGRESS_REPORTER.
Definition at line 153 of file progress_reporter.h.
|
overrideprivatevirtual |
Implements PROGRESS_REPORTER.
Definition at line 166 of file progress_reporter.cpp.
References PROGRESS_REPORTER::currentProgress(), PROGRESS_REPORTER::m_mutex, and PROGRESS_REPORTER::m_rptMessage.
|
protectedinherited |
Definition at line 124 of file progress_reporter.h.
Referenced by PROGRESS_REPORTER::IsCancelled(), PROGRESS_REPORTER::KeepRefreshing(), DIALOG_ERC::OnCancelClick(), DIALOG_ERC::OnRunERCClick(), and DIALOG_ERC::updateUI().
|
protectedinherited |
Definition at line 123 of file progress_reporter.h.
Referenced by PROGRESS_REPORTER::currentProgress(), PROGRESS_REPORTER::KeepRefreshing(), PROGRESS_REPORTER::SetCurrentProgress(), PROGRESS_REPORTER::SetMaxProgress(), DIALOG_DRC::updateUI(), and CONSOLE_PROGRESS_REPORTER::updateUI().
|
mutableprotectedinherited |
Definition at line 119 of file progress_reporter.h.
Referenced by PROGRESS_REPORTER::Report(), and updateUI().
|
protectedinherited |
Definition at line 121 of file progress_reporter.h.
Referenced by PROGRESS_REPORTER::AddPhases(), PROGRESS_REPORTER::currentProgress(), and PROGRESS_REPORTER::SetNumPhases().
|
protectedinherited |
Definition at line 120 of file progress_reporter.h.
Referenced by PROGRESS_REPORTER::AdvancePhase(), PROGRESS_REPORTER::BeginPhase(), and PROGRESS_REPORTER::currentProgress().
|
protectedinherited |
Definition at line 122 of file progress_reporter.h.
Referenced by PROGRESS_REPORTER::AdvancePhase(), PROGRESS_REPORTER::AdvanceProgress(), PROGRESS_REPORTER::BeginPhase(), PROGRESS_REPORTER::currentProgress(), PROGRESS_REPORTER::KeepRefreshing(), PROGRESS_REPORTER::SetCurrentProgress(), DIALOG_DRC::updateUI(), and CONSOLE_PROGRESS_REPORTER::updateUI().
|
protectedinherited |
Definition at line 118 of file progress_reporter.h.
Referenced by PROGRESS_REPORTER::Report(), CONSOLE_PROGRESS_REPORTER::updateUI(), and updateUI().