Browse Source

Harden progress reporter API against misuse.

Also, titles are nouns, not verbs.  (Messages
*inside* reporters are verbs.)

Also implements progress reporter for Altium
schematic import.
pull/18/head
Jeff Young 5 months ago
parent
commit
06dcb64ad8
  1. 4
      common/git/git_progress.h
  2. 4
      common/widgets/footprint_select_widget.cpp
  3. 9
      common/widgets/panel_design_block_chooser.cpp
  4. 10
      common/widgets/wx_progress_reporters.cpp
  5. 2
      cvpcb/cvpcb_mainframe.cpp
  6. 8
      eeschema/dialogs/dialog_schematic_setup.cpp
  7. 11
      eeschema/files-io.cpp
  8. 21
      eeschema/sch_io/altium/sch_io_altium.cpp
  9. 59
      eeschema/sch_io/altium/sch_io_altium.h
  10. 4
      eeschema/symbol_editor/symbol_edit_frame.cpp
  11. 5
      eeschema/symbol_tree_model_adapter.cpp
  12. 5
      eeschema/symbol_viewer_frame.cpp
  13. 3
      gerbview/files.cpp
  14. 9
      include/widgets/wx_progress_reporters.h
  15. 8
      kicad/dialogs/panel_jobset.cpp
  16. 2
      kicad/pcm/dialogs/dialog_manage_repositories.cpp
  17. 5
      kicad/pcm/dialogs/panel_packages_view.cpp
  18. 2
      kicad/pcm/pcm.cpp
  19. 14
      kicad/project_tree_pane.cpp
  20. 3
      kicad/tools/kicad_manager_control.cpp
  21. 13
      pcbnew/autorouter/autoplace_tool.cpp
  22. 2
      pcbnew/dialogs/dialog_board_setup.cpp
  23. 8
      pcbnew/files.cpp
  24. 4
      pcbnew/footprint_edit_frame.cpp
  25. 2
      pcbnew/tools/pcb_control.cpp
  26. 10
      pcbnew/tools/zone_filler_tool.cpp
  27. 4
      pcbnew/widgets/panel_footprint_chooser.cpp
  28. 2
      pcbnew/widgets/pcb_design_block_preview_widget.cpp
  29. 2
      pcbnew/zone_manager/dialog_zone_manager.cpp

4
common/git/git_progress.h

@ -31,12 +31,12 @@
class GIT_PROGRESS
{
public:
GIT_PROGRESS() : m_previousProgress( 0 )
GIT_PROGRESS() :
m_previousProgress( 0 )
{
m_progressReporter.reset();
}
void SetProgressReporter( std::unique_ptr<WX_PROGRESS_REPORTER> aProgressReporter )
{
m_progressReporter = std::move( aProgressReporter );

4
common/widgets/footprint_select_widget.cpp

@ -62,10 +62,12 @@ void FOOTPRINT_SELECT_WIDGET::Load( KIWAY& aKiway, PROJECT& aProject )
if( m_fp_list->GetCount() == 0 )
{
WX_PROGRESS_REPORTER progressReporter( m_frame, _( "Load Footprint Libraries" ), 1,
PR_CAN_ABORT );
// If the fp-info-cache is empty (or, more likely, hasn't been created in a new
// project yet), load footprints the hard way.
FP_LIB_TABLE* fpTable = aProject.PcbFootprintLibs( aKiway );
WX_PROGRESS_REPORTER progressReporter( m_frame, _( "Loading Footprint Libraries" ), 1 );
FOOTPRINT_LIST_IMPL& fpList = static_cast<FOOTPRINT_LIST_IMPL&>( *m_fp_list );
fpList.ReadFootprintFiles( fpTable, nullptr, &progressReporter );

9
common/widgets/panel_design_block_chooser.cpp

@ -68,8 +68,9 @@ PANEL_DESIGN_BLOCK_CHOOSER::PANEL_DESIGN_BLOCK_CHOOSER( EDA_DRAW_FRAME* aFrame,
DESIGN_BLOCK_LIB_TABLE* libs = m_frame->Prj().DesignBlockLibs();
// Load design block files:
WX_PROGRESS_REPORTER* progressReporter =
new WX_PROGRESS_REPORTER( aParent, _( "Loading Design Block Libraries" ), 1 );
auto* progressReporter = new WX_PROGRESS_REPORTER( aParent, _( "Load Design Block Libraries" ), 1,
PR_CAN_ABORT );
DESIGN_BLOCK_LIB_TABLE::GetGlobalList().ReadDesignBlockFiles( libs, nullptr, progressReporter );
// Force immediate deletion of the WX_PROGRESS_REPORTER. Do not use Destroy(), or use
@ -270,7 +271,9 @@ void PANEL_DESIGN_BLOCK_CHOOSER::RefreshLibs( bool aProgress )
// Sync FOOTPRINT_INFO list to the libraries on disk
if( aProgress )
{
WX_PROGRESS_REPORTER progressReporter( this, _( "Updating Design Block Libraries" ), 2 );
WX_PROGRESS_REPORTER progressReporter( this, _( "Update Design Block Libraries" ), 2,
PR_CAN_ABORT );
DESIGN_BLOCK_LIB_TABLE::GetGlobalList().ReadDesignBlockFiles( fpTable, nullptr, &progressReporter );
progressReporter.Show( false );
}

10
common/widgets/wx_progress_reporters.cpp

@ -30,16 +30,18 @@
WX_PROGRESS_REPORTER::WX_PROGRESS_REPORTER( wxWindow* aParent, const wxString& aTitle,
int aNumPhases, bool aCanAbort,
int aNumPhases, int aCanAbort,
bool aReserveSpaceForMessage ) :
PROGRESS_REPORTER_BASE( aNumPhases ),
wxProgressDialog( aTitle, ( aReserveSpaceForMessage ? wxT( " " ) : wxT( "" ) ), 1, aParent,
wxProgressDialog( aTitle,
( aReserveSpaceForMessage ? wxT( " " ) : wxT( "" ) ),
1, aParent,
// wxPD_APP_MODAL | // Don't use; messes up OSX when called from
// quasi-modal dialog
wxPD_AUTO_HIDE | // *MUST* use; otherwise wxWidgets will spin
// up another event loop on completion which
// causes all sorts of grief
( aCanAbort ? wxPD_CAN_ABORT : 0 ) | wxPD_ELAPSED_TIME ),
aCanAbort | wxPD_ELAPSED_TIME ),
m_appProgressIndicator( aParent ),
m_messageWidth( 0 )
{
@ -85,6 +87,8 @@ bool WX_PROGRESS_REPORTER::updateUI()
Fit();
}
Raise();
m_messageChanged = false;
}

2
cvpcb/cvpcb_mainframe.cpp

@ -900,7 +900,7 @@ bool CVPCB_MAINFRAME::LoadFootprintFiles()
return false;
}
WX_PROGRESS_REPORTER progressReporter( this, _( "Loading Footprint Libraries" ), 1 );
WX_PROGRESS_REPORTER progressReporter( this, _( "Load Footprint Libraries" ), 1, PR_CAN_ABORT );
m_FootprintsList->ReadFootprintFiles( fptbl, nullptr, &progressReporter );

8
eeschema/dialogs/dialog_schematic_setup.cpp

@ -252,10 +252,10 @@ void DIALOG_SCHEMATIC_SETUP::onAuxiliaryAction( wxCommandEvent& event )
wxFileName schematicFn( projectFn );
schematicFn.SetExt( FILEEXT::KiCadSchematicFileExtension );
wxString fullFileName = schematicFn.GetFullPath();
wxString msg;
IO_RELEASER<SCH_IO> pi( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_KICAD ) );
WX_PROGRESS_REPORTER progressReporter( this, _( "Loading Bus Aliases" ), 1 );
wxString fullFileName = schematicFn.GetFullPath();
wxString msg;
IO_RELEASER<SCH_IO> pi( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_KICAD ) );
WX_PROGRESS_REPORTER progressReporter( this, _( "Load Bus Aliases" ), 1, PR_CAN_ABORT );
pi->SetProgressReporter( &progressReporter );

11
eeschema/files-io.cpp

@ -155,8 +155,9 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
SetStatusText( wxEmptyString );
m_infoBar->Dismiss();
WX_PROGRESS_REPORTER progressReporter( this, is_new ? _( "Creating Schematic" )
: _( "Loading Schematic" ), 1 );
WX_PROGRESS_REPORTER progressReporter( this, is_new ? _( "Create Schematic" )
: _( "Load Schematic" ), 1,
PR_CAN_ABORT );
bool differentProject = pro.GetFullPath() != Prj().GetProjectFullName();
@ -271,7 +272,9 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
try
{
{
wxBusyCursor busy;
wxBusyCursor busy;
WINDOW_DISABLER raii( this );
Schematic().SetRoot( pi->LoadSchematicFile( fullFileName, &Schematic() ) );
// Make ${SHEETNAME} work on the root sheet until we properly support
@ -1335,7 +1338,7 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType,
{
IO_RELEASER<SCH_IO> pi( SCH_IO_MGR::FindPlugin( fileType ) );
DIALOG_HTML_REPORTER errorReporter( this );
WX_PROGRESS_REPORTER progressReporter( this, _( "Importing Schematic" ), 1 );
WX_PROGRESS_REPORTER progressReporter( this, _( "Import Schematic" ), 1, PR_CAN_ABORT );
if( PROJECT_CHOOSER_PLUGIN* c_pi = dynamic_cast<PROJECT_CHOOSER_PLUGIN*>( pi.get() ) )
{

21
eeschema/sch_io/altium/sch_io_altium.cpp

@ -31,6 +31,7 @@
#include <io/altium/altium_parser_utils.h>
#include <sch_io/altium/sch_io_altium.h>
#include <progress_reporter.h>
#include <schematic.h>
#include <project_sch.h>
#include <project/project_file.h>
@ -821,8 +822,22 @@ void SCH_IO_ALTIUM::CreateAliases()
void SCH_IO_ALTIUM::ParseAltiumSch( const wxString& aFileName )
{
if( m_rootFilepath.IsEmpty() )
m_rootFilepath = aFileName;
// Load path may be different from the project path.
wxFileName parentFileName = aFileName;
wxFileName parentFileName( aFileName );
if( m_progressReporter )
{
wxFileName relative = parentFileName;
relative.MakeRelativeTo( m_rootFilepath );
m_progressReporter->Report( wxString::Format( _( "Importing %s" ), relative.GetFullPath() ) );
if( !m_progressReporter->KeepRefreshing() )
THROW_IO_ERROR( _( "Open cancelled by user." ) );
}
if( isBinaryFile( aFileName ) )
{
@ -842,8 +857,8 @@ void SCH_IO_ALTIUM::ParseAltiumSch( const wxString& aFileName )
}
catch( const std::exception& exc )
{
wxLogTrace( traceAltiumSch, wxS( "Unhandled exception in Altium schematic "
"parsers: %s." ), exc.what() );
wxLogTrace( traceAltiumSch, wxS( "Unhandled exception in Altium schematic parser: %s." ),
exc.what() );
throw;
}
}

59
eeschema/sch_io/altium/sch_io_altium.h

@ -212,50 +212,51 @@ private:
void fixupSymbolPinNameNumbers( SYMBOL* aSymbol );
// Symbol caching
void ensureLoadedLibrary( const wxString& aLibraryPath, const std::map<std::string, UTF8>* aProperties );
long long getLibraryTimestamp( const wxString& aLibraryPath ) const;
static bool isBinaryFile( const wxString& aFileName );
static bool isASCIIFile( const wxString& aFileName );
static bool checkFileHeader( const wxString& aFileName );
private:
SCH_SHEET* m_rootSheet; // The root sheet of the schematic being loaded..
wxString m_rootFilepath; // The file path of the root sheet being imported
SCH_SHEET* m_rootSheet; // The root sheet of the schematic being loaded..
SCH_SHEET_PATH m_sheetPath;
SCHEMATIC* m_schematic; // Passed to Load(), the schematic object being loaded
wxString m_libName; // Library name to save symbols
bool m_isIntLib; // Flag to indicate Integrated Library
SCHEMATIC* m_schematic; // Passed to Load(), the schematic object being loaded
wxString m_libName; // Library name to save symbols
bool m_isIntLib; // Flag to indicate Integrated Library
IO_RELEASER<SCH_IO> m_pi; // Plugin to create KiCad symbol library.
std::unique_ptr<std::map<std::string, UTF8>> m_properties; // Library plugin properties.
IO_RELEASER<SCH_IO> m_pi; // Plugin to create KiCad symbol library.
std::unique_ptr<std::map<std::string, UTF8>> m_properties; // Library plugin properties.
std::unique_ptr<TITLE_BLOCK> m_currentTitleBlock; // Will be assigned at the end of parsing
// a sheet
std::unique_ptr<TITLE_BLOCK> m_currentTitleBlock; // Will be assigned at the end of parsing
// a sheet
VECTOR2I m_sheetOffset;
std::unique_ptr<ASCH_SHEET> m_altiumSheet;
std::map<int, SCH_SYMBOL*> m_symbols;
std::map<int, SCH_SHEET*> m_sheets;
std::map<int, LIB_SYMBOL*> m_libSymbols; // every symbol has its unique lib_symbol
VECTOR2I m_sheetOffset;
std::unique_ptr<ASCH_SHEET> m_altiumSheet;
std::map<int, SCH_SYMBOL*> m_symbols;
std::map<int, SCH_SHEET*> m_sheets;
std::map<int, LIB_SYMBOL*> m_libSymbols; // every symbol has its unique lib_symbol
std::map<wxString, LIB_SYMBOL*> m_powerSymbols;
std::vector<ASCH_STORAGE_FILE> m_altiumStorage;
std::map<wxString, LIB_SYMBOL*> m_powerSymbols;
std::vector<ASCH_STORAGE_FILE> m_altiumStorage;
std::vector<ASCH_ADDITIONAL_FILE> m_altiumAdditional;
std::map<int, ASCH_SYMBOL> m_altiumComponents;
std::map<int, ASCH_TEMPLATE> m_altiumTemplates;
std::map<int, int> m_altiumImplementationList;
std::vector<ASCH_PORT> m_altiumPortsCurrentSheet; // we require all connections first
std::map<int, ASCH_SYMBOL> m_altiumComponents;
std::map<int, ASCH_TEMPLATE> m_altiumTemplates;
std::map<int, int> m_altiumImplementationList;
std::vector<ASCH_PORT> m_altiumPortsCurrentSheet; // we require all connections first
// parse harness ports after "FileHeader" was parsed, in 2nd run.
std::vector<ASCH_PORT> m_altiumHarnessPortsCurrentSheet;
std::map<int, HARNESS> m_altiumHarnesses;
std::vector<ASCH_PORT> m_altiumHarnessPortsCurrentSheet;
std::map<int, HARNESS> m_altiumHarnesses;
// Add offset to all harness ownerIndex'es after parsing FileHeader.
int m_harnessOwnerIndexOffset;
int m_harnessEntryParent; // used to identify harness connector for harness entry element
// Symbol caching
void ensureLoadedLibrary( const wxString& aLibraryPath, const std::map<std::string, UTF8>* aProperties );
long long getLibraryTimestamp( const wxString& aLibraryPath ) const;
static bool isBinaryFile( const wxString& aFileName );
static bool isASCIIFile( const wxString& aFileName );
static bool checkFileHeader( const wxString& aFileName );
std::map<wxString, long long> m_timestamps;
std::map<wxString, CASE_INSENSITIVE_MAP<LIB_SYMBOL*>> m_libCache;

4
eeschema/symbol_editor/symbol_edit_frame.cpp

@ -147,8 +147,8 @@ SYMBOL_EDIT_FRAME::SYMBOL_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
{
// Preload libraries before using SyncLibraries the first time, as the preload is
// multi-threaded
WX_PROGRESS_REPORTER reporter( this, _( "Loading Symbol Libraries" ),
m_libMgr->GetLibraryCount(), true );
WX_PROGRESS_REPORTER reporter( this, _( "Load Symbol Libraries" ), m_libMgr->GetLibraryCount(),
PR_CAN_ABORT );
m_libMgr->Preload( reporter );
loadingCancelled = reporter.IsCancelled();

5
eeschema/symbol_tree_model_adapter.cpp

@ -70,9 +70,8 @@ bool SYMBOL_TREE_MODEL_ADAPTER::AddLibraries( const std::vector<wxString>& aNick
if( m_show_progress )
{
progressReporter = std::make_unique<WX_PROGRESS_REPORTER>( aFrame,
_( "Loading Symbol Libraries" ),
aNicknames.size(), true );
progressReporter = std::make_unique<WX_PROGRESS_REPORTER>( aFrame, _( "Load Symbol Libraries" ),
aNicknames.size(), PR_CAN_ABORT );
}
// Disable KIID generation: not needed for library parts; sometimes very slow

5
eeschema/symbol_viewer_frame.cpp

@ -274,9 +274,8 @@ void SYMBOL_VIEWER_FRAME::loadAllLibraries()
if( m_show_progress )
{
progressReporter = std::make_unique<WX_PROGRESS_REPORTER>( this,
_( "Loading Symbol Libraries" ),
libraryNames.size(), true );
progressReporter = std::make_unique<WX_PROGRESS_REPORTER>( this, _( "Load Symbol Libraries" ),
libraryNames.size(), PR_CAN_ABORT );
}
// Disable KIID generation: not needed for library parts; sometimes very slow

3
gerbview/files.cpp

@ -300,8 +300,7 @@ bool GERBVIEW_FRAME::LoadListOfGerberAndDrillFiles( const wxString& aPath,
if( !progress && ( aFilenameList.GetCount() > 1 ) )
{
progress = std::make_unique<WX_PROGRESS_REPORTER>( this, _( "Loading files..." ), 1,
false );
progress = std::make_unique<WX_PROGRESS_REPORTER>( this, _( "Load Files" ), 1, PR_CAN_ABORT );
progress->SetMaxProgress( aFilenameList.GetCount() - 1 );
progress->Report( wxString::Format( _("Loading %u/%zu %s..." ),
ii+1,

9
include/widgets/wx_progress_reporters.h

@ -33,6 +33,9 @@
#include <widgets/progress_reporter_base.h>
#define PR_NO_ABORT 0
#define PR_CAN_ABORT wxPD_CAN_ABORT
/**
* Multi-thread safe progress reporter dialog, intended for use of tasks that parallel reporting
* back of work status.
@ -53,12 +56,12 @@ public:
* 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
* @param aCanAbort is true if the abort button should be shown
* @param aCanAbort indicates if the Cancel button should be shown
* @param 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
*/
WX_PROGRESS_REPORTER( wxWindow* aParent, const wxString& aTitle, int aNumPhases,
bool aCanAbort = true, bool aReserveSpaceForMessage = true );
WX_PROGRESS_REPORTER( wxWindow* aParent, const wxString& aTitle, int aNumPhases, int aCanAbort,
bool aReserveSpaceForMessage = true );
~WX_PROGRESS_REPORTER();
/**

8
kicad/dialogs/panel_jobset.cpp

@ -274,8 +274,8 @@ public:
JOBS_RUNNER jobRunner( &( m_frame->Kiway() ), m_jobsFile, &project );
auto* progressReporter = new WX_PROGRESS_REPORTER( m_frame, _( "Running jobs" ),
1 );
auto* progressReporter = new WX_PROGRESS_REPORTER( m_frame, _( "Run Jobs" ), 1,
PR_NO_ABORT );
if( JOBSET_DESTINATION* destination = GetDestination() )
jobRunner.RunJobsForDestination( destination );
@ -992,8 +992,8 @@ void PANEL_JOBSET::OnGenerateAllDestinationsClick( wxCommandEvent& event )
JOBS_RUNNER jobRunner( &( m_frame->Kiway() ), m_jobsFile.get(), &project );
WX_PROGRESS_REPORTER* progressReporter =
new WX_PROGRESS_REPORTER( m_frame, _( "Running jobs" ), 1 );
auto* progressReporter = new WX_PROGRESS_REPORTER( m_frame, _( "Run Jobs" ), 1,
PR_NO_ABORT );
jobRunner.RunJobsAllDestinations();

2
kicad/pcm/dialogs/dialog_manage_repositories.cpp

@ -127,7 +127,7 @@ void DIALOG_MANAGE_REPOSITORIES::addRepository( const wxString& aUrl )
}
PCM_REPOSITORY repository;
WX_PROGRESS_REPORTER reporter( GetParent(), wxT( "" ), 1 );
WX_PROGRESS_REPORTER reporter( GetParent(), wxT( "" ), 1, PR_CAN_ABORT );
if( m_pcm->FetchRepository( aUrl, repository, &reporter ) )
{

5
kicad/pcm/dialogs/panel_packages_view.cpp

@ -539,10 +539,9 @@ void PANEL_PACKAGES_VIEW::OnDownloadVersionClicked( wxCommandEvent& event )
std::ofstream output( path.ToUTF8(), std::ios_base::binary );
std::unique_ptr<WX_PROGRESS_REPORTER> reporter =
std::make_unique<WX_PROGRESS_REPORTER>( this, _( "Downloading package" ), 1 );
WX_PROGRESS_REPORTER reporter( this, _( "Download Package" ), 1, PR_CAN_ABORT );
bool success = m_pcm->DownloadToStream( url, &output, reporter.get(), 0 );
bool success = m_pcm->DownloadToStream( url, &output, &reporter, 0 );
output.close();

2
kicad/pcm/pcm.cpp

@ -388,7 +388,7 @@ bool PLUGIN_CONTENT_MANAGER::CacheRepository( const wxString& aRepositoryId )
std::shared_ptr<PROGRESS_REPORTER> reporter;
if( m_dialog )
reporter = std::make_shared<WX_PROGRESS_REPORTER>( m_dialog, wxEmptyString, 1 );
reporter = std::make_shared<WX_PROGRESS_REPORTER>( m_dialog, wxT( "" ), 1, PR_CAN_ABORT );
else
reporter = m_updateBackgroundJob->m_reporter;

14
kicad/project_tree_pane.cpp

@ -1789,9 +1789,7 @@ void PROJECT_TREE_PANE::onGitInitializeProject( wxCommandEvent& aEvent )
GIT_PULL_HANDLER handler( m_TreeProject->GitCommon() );
handler.SetProgressReporter( std::make_unique<WX_PROGRESS_REPORTER>( this,
_( "Fetching Remote" ),
1 ) );
handler.SetProgressReporter( std::make_unique<WX_PROGRESS_REPORTER>( this, _( "Fetch Remote" ), 1, PR_NO_ABORT ) );
handler.PerformFetch();
@ -1823,9 +1821,8 @@ void PROJECT_TREE_PANE::onGitPullProject( wxCommandEvent& aEvent )
GIT_PULL_HANDLER handler( m_TreeProject->GitCommon() );
handler.SetProgressReporter( std::make_unique<WX_PROGRESS_REPORTER>( this,
_( "Fetching Remote" ),
1 ) );
handler.SetProgressReporter( std::make_unique<WX_PROGRESS_REPORTER>( this, _( "Fetch Remote" ), 1,
PR_NO_ABORT ) );
if( handler.PerformPull() < PullResult::Success )
{
@ -1847,9 +1844,8 @@ void PROJECT_TREE_PANE::onGitPushProject( wxCommandEvent& aEvent )
GIT_PUSH_HANDLER handler( m_TreeProject->GitCommon() );
handler.SetProgressReporter( std::make_unique<WX_PROGRESS_REPORTER>( this,
_( "Fetching Remote" ),
1 ) );
handler.SetProgressReporter( std::make_unique<WX_PROGRESS_REPORTER>( this, _( "Fetch Remote" ), 1,
PR_NO_ABORT ) );
if( handler.PerformPush() != PushResult::Success )
{

3
kicad/tools/kicad_manager_control.cpp

@ -178,7 +178,8 @@ int KICAD_MANAGER_CONTROL::NewFromRepository( const TOOL_EVENT& aEvent )
cloneHandler.SetPassword( dlg.GetPassword() );
cloneHandler.SetSSHKey( dlg.GetRepoSSHPath() );
cloneHandler.SetProgressReporter( std::make_unique<WX_PROGRESS_REPORTER>( m_frame, _( "Cloning Repository" ), 1 ) );
cloneHandler.SetProgressReporter( std::make_unique<WX_PROGRESS_REPORTER>( m_frame, _( "Clone Repository" ), 1,
PR_NO_ABORT ) );
if( !cloneHandler.PerformClone() )
{

13
pcbnew/autorouter/autoplace_tool.cpp

@ -77,8 +77,10 @@ int AUTOPLACE_TOOL::autoplace( std::vector<FOOTPRINT*>& aFootprints )
}
int locked_count = std::count_if( aFootprints.begin(), aFootprints.end(),
[](FOOTPRINT* fp) { return fp->IsLocked(); } );
[](FOOTPRINT* fp)
{
return fp->IsLocked();
} );
PCBNEW_SETTINGS* settings = frame()->GetPcbNewSettings();
@ -120,14 +122,13 @@ int AUTOPLACE_TOOL::autoplace( std::vector<FOOTPRINT*>& aFootprints )
std::function<int( FOOTPRINT* aFootprint )> callback = refreshCallback;
autoplacer.SetRefreshCallback( callback );
std::unique_ptr<WX_PROGRESS_REPORTER> progressReporter =
std::make_unique<WX_PROGRESS_REPORTER>( frame(), _( "Autoplace Components" ), 1 );
WX_PROGRESS_REPORTER progressReporter( frame(), _( "Autoplace Footprints" ), 1, PR_CAN_ABORT );
autoplacer.SetProgressReporter( &progressReporter );
autoplacer.SetProgressReporter( progressReporter.get() );
auto result = autoplacer.AutoplaceFootprints( aFootprints, &commit, false );
if( result == AR_COMPLETED )
commit.Push( _( "Autoplace Components" ) );
commit.Push( _( "Autoplace Footprints" ) );
else
commit.Revert();

2
pcbnew/dialogs/dialog_board_setup.cpp

@ -351,7 +351,7 @@ void DIALOG_BOARD_SETUP::onAuxiliaryAction( wxCommandEvent& aEvent )
try
{
WX_PROGRESS_REPORTER progressReporter( this, _( "Loading PCB" ), 1 );
WX_PROGRESS_REPORTER progressReporter( this, _( "Load PCB" ), 1, PR_CAN_ABORT );
pi->SetProgressReporter( &progressReporter );

8
pcbnew/files.cpp

@ -565,8 +565,8 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
// Get rid of any existing warnings about the old board
GetInfoBar()->Dismiss();
WX_PROGRESS_REPORTER progressReporter( this, is_new ? _( "Creating PCB" )
: _( "Loading PCB" ), 1 );
WX_PROGRESS_REPORTER progressReporter( this, is_new ? _( "Create PCB" ) : _( "Load PCB" ), 1,
PR_CAN_ABORT );
// No save prompt (we already prompted above), and only reset to a new blank board if new
Clear_Pcb( false, !is_new );
@ -1316,7 +1316,7 @@ int BOARD_EDITOR_CONTROL::GenIPC2581File( const TOOL_EVENT& aEvent )
wxString tempFile = wxFileName::CreateTempFileName( wxS( "pcbnew_ipc" ) );
wxString upperTxt;
wxString lowerTxt;
WX_PROGRESS_REPORTER reporter( m_frame, _( "Generating IPC-2581 file" ), 5 );
WX_PROGRESS_REPORTER reporter( m_frame, _( "Generate IPC-2581 File" ), 5, PR_CAN_ABORT );
std::map<std::string, UTF8> props;
props["units"] = dlg.GetUnitsString();
@ -1439,7 +1439,7 @@ int BOARD_EDITOR_CONTROL::GenerateODBPPFiles( const TOOL_EVENT& aEvent )
job.m_units = dlg.GetUnitsString() == "mm" ? JOB_EXPORT_PCB_ODB::ODB_UNITS::MM
: JOB_EXPORT_PCB_ODB::ODB_UNITS::INCH;
WX_PROGRESS_REPORTER progressReporter( m_frame, _( "Generating ODB++ output files" ), 3, false );
WX_PROGRESS_REPORTER progressReporter( m_frame, _( "Generate ODB++ Files" ), 3, PR_CAN_ABORT );
WX_STRING_REPORTER reporter;
DIALOG_EXPORT_ODBPP::GenerateODBPPFiles( job, m_frame->GetBoard(), m_frame, &progressReporter, &reporter );

4
pcbnew/footprint_edit_frame.cpp

@ -1086,7 +1086,7 @@ void FOOTPRINT_EDIT_FRAME::initLibraryTree()
{
FP_LIB_TABLE* fpTable = PROJECT_PCB::PcbFootprintLibs( &Prj() );
WX_PROGRESS_REPORTER progressReporter( this, _( "Loading Footprint Libraries" ), 1 );
WX_PROGRESS_REPORTER progressReporter( this, _( "Load Footprint Libraries" ), 1, PR_CAN_ABORT );
if( GFootprintList.GetCount() == 0 )
GFootprintList.ReadCacheFromFile( Prj().GetProjectPath() + wxT( "fp-info-cache" ) );
@ -1114,7 +1114,7 @@ void FOOTPRINT_EDIT_FRAME::SyncLibraryTree( bool aProgress )
// Sync FOOTPRINT_INFO list to the libraries on disk
if( aProgress )
{
WX_PROGRESS_REPORTER progressReporter( this, _( "Updating Footprint Libraries" ), 1 );
WX_PROGRESS_REPORTER progressReporter( this, _( "Update Footprint Libraries" ), 1, PR_CAN_ABORT );
GFootprintList.ReadFootprintFiles( fpTable, nullptr, &progressReporter );
progressReporter.Show( false );
}

2
pcbnew/tools/pcb_control.cpp

@ -1686,7 +1686,7 @@ int PCB_CONTROL::AppendBoard( PCB_IO& pi, const wxString& fileName, DESIGN_BLOCK
return dlg.ShowModal() == wxID_OK;
} );
WX_PROGRESS_REPORTER progressReporter( editFrame, _( "Loading PCB" ), 1 );
WX_PROGRESS_REPORTER progressReporter( editFrame, _( "Load PCB" ), 1, PR_CAN_ABORT );
editFrame->GetDesignSettings().m_NetSettings->ClearNetclasses();
pi.SetProgressReporter( &progressReporter );

10
pcbnew/tools/zone_filler_tool.cpp

@ -86,7 +86,8 @@ void ZONE_FILLER_TOOL::CheckAllZones( wxWindow* aCaller, PROGRESS_REPORTER* aRep
}
else
{
reporter = std::make_unique<WX_PROGRESS_REPORTER>( aCaller, _( "Checking Zones" ), 4 );
reporter = std::make_unique<WX_PROGRESS_REPORTER>( aCaller, _( "Check Zones" ), 4,
PR_CAN_ABORT );
m_filler->SetProgressReporter( reporter.get() );
}
@ -163,7 +164,8 @@ void ZONE_FILLER_TOOL::FillAllZones( wxWindow* aCaller, PROGRESS_REPORTER* aRepo
}
else
{
reporter = std::make_unique<WX_PROGRESS_REPORTER>( aCaller, _( "Fill All Zones" ), 5 );
reporter = std::make_unique<WX_PROGRESS_REPORTER>( aCaller, _( "Fill All Zones" ), 5,
PR_CAN_ABORT );
m_filler->SetProgressReporter( reporter.get() );
}
@ -256,7 +258,7 @@ int ZONE_FILLER_TOOL::ZoneFillDirty( const TOOL_EVENT& aEvent )
{
wxString title = wxString::Format( _( "Refill %d Zones" ), (int) toFill.size() );
reporter = std::make_unique<WX_PROGRESS_REPORTER>( frame, title, 5 );
reporter = std::make_unique<WX_PROGRESS_REPORTER>( frame, title, 5, PR_CAN_ABORT );
m_filler->SetProgressReporter( reporter.get() );
break;
}
@ -347,7 +349,7 @@ int ZONE_FILLER_TOOL::ZoneFill( const TOOL_EVENT& aEvent )
m_filler = std::make_unique<ZONE_FILLER>( board(), &commit );
reporter = std::make_unique<WX_PROGRESS_REPORTER>( frame(), _( "Fill Zone" ), 5 );
reporter = std::make_unique<WX_PROGRESS_REPORTER>( frame(), _( "Fill Zone" ), 5, PR_CAN_ABORT );
m_filler->SetProgressReporter( reporter.get() );
if( m_filler->Fill( toFill ) )

4
pcbnew/widgets/panel_footprint_chooser.cpp

@ -67,8 +67,8 @@ PANEL_FOOTPRINT_CHOOSER::PANEL_FOOTPRINT_CHOOSER( PCB_BASE_FRAME* aFrame, wxTopL
FP_LIB_TABLE* fpTable = PROJECT_PCB::PcbFootprintLibs( &aFrame->Prj() );
// Load footprint files:
WX_PROGRESS_REPORTER* progressReporter = new WX_PROGRESS_REPORTER( aParent,
_( "Loading Footprint Libraries" ), 1 );
auto* progressReporter = new WX_PROGRESS_REPORTER( aParent, _( "Load Footprint Libraries" ), 1,
PR_CAN_ABORT );
GFootprintList.ReadFootprintFiles( fpTable, nullptr, progressReporter );
// Force immediate deletion of the WX_PROGRESS_REPORTER. Do not use Destroy(), or use

2
pcbnew/widgets/pcb_design_block_preview_widget.cpp

@ -184,7 +184,7 @@ void PCB_DESIGN_BLOCK_PREVIEW_WIDGET::DisplayDesignBlock( DESIGN_BLOCK* aDesignB
try
{
IO_RELEASER<PCB_IO> pi( PCB_IO_MGR::PluginFind( PCB_IO_MGR::KICAD_SEXP ) );
WX_PROGRESS_REPORTER progressReporter( this, _( "Loading PCB" ), 1 );
WX_PROGRESS_REPORTER progressReporter( this, _( "Load PCB" ), 1, PR_CAN_ABORT );
pi->SetProgressReporter( &progressReporter );

2
pcbnew/zone_manager/dialog_zone_manager.cpp

@ -387,7 +387,7 @@ void DIALOG_ZONE_MANAGER::OnUpdateDisplayedZonesClick( wxCommandEvent& aEvent )
auto commit = std::make_unique<BOARD_COMMIT>( m_pcbFrame );
m_filler = std::make_unique<ZONE_FILLER>( board, commit.get() );
auto reporter = std::make_unique<WX_PROGRESS_REPORTER>( this, _( "Fill All Zones" ), 5 );
auto reporter = std::make_unique<WX_PROGRESS_REPORTER>( this, _( "Fill All Zones" ), 5, PR_CAN_ABORT );
m_filler->SetProgressReporter( reporter.get() );
// TODO: replace these const_cast calls with a different solution that avoids mutating the

Loading…
Cancel
Save