diff --git a/pcbnew/dialogs/dialog_board_setup.cpp b/pcbnew/dialogs/dialog_board_setup.cpp index e0bddc2c26..2fc1aec951 100644 --- a/pcbnew/dialogs/dialog_board_setup.cpp +++ b/pcbnew/dialogs/dialog_board_setup.cpp @@ -291,8 +291,9 @@ void DIALOG_BOARD_SETUP::onAuxiliaryAction( wxCommandEvent& aEvent ) { WX_PROGRESS_REPORTER progressReporter( this, _( "Loading PCB" ), 1 ); - otherBoard = pi->LoadBoard( boardFn.GetFullPath(), nullptr, nullptr, nullptr, - &progressReporter ); + pi->SetProgressReporter( &progressReporter ); + + otherBoard = pi->LoadBoard( boardFn.GetFullPath(), nullptr ); if( importDlg.m_LayersOpt->GetValue() ) { diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp index 1c2d11c470..dbedc9cc33 100644 --- a/pcbnew/files.cpp +++ b/pcbnew/files.cpp @@ -675,7 +675,8 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector& aFileSet, in unsigned startTime = GetRunningMicroSecs(); #endif - loadedBoard = pi->LoadBoard( fullFileName, nullptr, &props, &Prj(), &progressReporter ); + pi->SetProgressReporter( &progressReporter ); + loadedBoard = pi->LoadBoard( fullFileName, nullptr, &props, &Prj() ); #if USE_INSTRUMENTATION unsigned stopTime = GetRunningMicroSecs(); @@ -1273,8 +1274,8 @@ void PCB_EDIT_FRAME::GenIPC2581File( wxCommandEvent& event ) try { PCB_IO::RELEASER pi( PCB_IO_MGR::PluginFind( PCB_IO_MGR::IPC2581 ) ); - - pi->SaveBoard( tempFile, GetBoard(), &props, &reporter ); + pi->SetProgressReporter( &reporter ); + pi->SaveBoard( tempFile, GetBoard(), &props ); return true; } catch( const IO_ERROR& ioe ) diff --git a/pcbnew/kicad_clipboard.cpp b/pcbnew/kicad_clipboard.cpp index f17fee456c..ba19dfe93d 100644 --- a/pcbnew/kicad_clipboard.cpp +++ b/pcbnew/kicad_clipboard.cpp @@ -330,8 +330,7 @@ BOARD_ITEM* CLIPBOARD_IO::Parse() void CLIPBOARD_IO::SaveBoard( const wxString& aFileName, BOARD* aBoard, - const STRING_UTF8_MAP* aProperties, - PROGRESS_REPORTER* aProgressReporter ) + const STRING_UTF8_MAP* aProperties ) { init( aProperties ); @@ -376,8 +375,7 @@ void CLIPBOARD_IO::SaveBoard( const wxString& aFileName, BOARD* aBoard, BOARD* CLIPBOARD_IO::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, - const STRING_UTF8_MAP* aProperties, PROJECT* aProject, - PROGRESS_REPORTER* aProgressReporter ) + const STRING_UTF8_MAP* aProperties, PROJECT* aProject ) { std::string result; diff --git a/pcbnew/kicad_clipboard.h b/pcbnew/kicad_clipboard.h index b68983b562..cc6142e8b4 100644 --- a/pcbnew/kicad_clipboard.h +++ b/pcbnew/kicad_clipboard.h @@ -48,8 +48,7 @@ public: * Saves the entire board to the clipboard formatted using the PCB_IO_KICAD_SEXPR formatting */ void SaveBoard( const wxString& aFileName, BOARD* aBoard, - const STRING_UTF8_MAP* aProperties = nullptr, - PROGRESS_REPORTER* aProgressReporter = nullptr ) override; + const STRING_UTF8_MAP* aProperties = nullptr ) override; /* * Write all the settings of the BOARD* set by setBoard() and then adds all the @@ -60,8 +59,7 @@ public: BOARD_ITEM* Parse(); BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, - const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr, - PROGRESS_REPORTER* aProgressReporter = nullptr ) override; + const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr ) override; void SetBoard( BOARD* aBoard ); diff --git a/pcbnew/pcb_io/altium/pcb_io_altium_circuit_maker.cpp b/pcbnew/pcb_io/altium/pcb_io_altium_circuit_maker.cpp index 2090bb24a2..eb339bcaa7 100644 --- a/pcbnew/pcb_io/altium/pcb_io_altium_circuit_maker.cpp +++ b/pcbnew/pcb_io/altium/pcb_io_altium_circuit_maker.cpp @@ -60,8 +60,7 @@ bool PCB_IO_ALTIUM_CIRCUIT_MAKER::CanReadBoard( const wxString& aFileName ) cons BOARD* PCB_IO_ALTIUM_CIRCUIT_MAKER::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, const STRING_UTF8_MAP* aProperties, - PROJECT* aProject, - PROGRESS_REPORTER* aProgressReporter ) + PROJECT* aProject ) { m_props = aProperties; @@ -101,7 +100,7 @@ BOARD* PCB_IO_ALTIUM_CIRCUIT_MAKER::LoadBoard( const wxString& aFileName, BOARD* try { // Parse File - ALTIUM_PCB pcb( m_board, aProgressReporter ); + ALTIUM_PCB pcb( m_board, m_progressReporter ); pcb.Parse( altiumPcbFile, mapping ); } catch( CFB::CFBException& exception ) diff --git a/pcbnew/pcb_io/altium/pcb_io_altium_circuit_maker.h b/pcbnew/pcb_io/altium/pcb_io_altium_circuit_maker.h index e610c7e9a3..ba9193506b 100644 --- a/pcbnew/pcb_io/altium/pcb_io_altium_circuit_maker.h +++ b/pcbnew/pcb_io/altium/pcb_io_altium_circuit_maker.h @@ -46,8 +46,7 @@ public: bool CanReadBoard( const wxString& aFileName ) const override; BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, - const STRING_UTF8_MAP* aProperties, PROJECT* aProject = nullptr, - PROGRESS_REPORTER* aProgressReporter = nullptr ) override; + const STRING_UTF8_MAP* aProperties, PROJECT* aProject = nullptr ) override; long long GetLibraryTimestamp( const wxString& aLibraryPath ) const override { diff --git a/pcbnew/pcb_io/altium/pcb_io_altium_circuit_studio.cpp b/pcbnew/pcb_io/altium/pcb_io_altium_circuit_studio.cpp index b9e0754c7f..fff15cdcea 100644 --- a/pcbnew/pcb_io/altium/pcb_io_altium_circuit_studio.cpp +++ b/pcbnew/pcb_io/altium/pcb_io_altium_circuit_studio.cpp @@ -60,8 +60,7 @@ bool PCB_IO_ALTIUM_CIRCUIT_STUDIO::CanReadBoard( const wxString& aFileName ) con BOARD* PCB_IO_ALTIUM_CIRCUIT_STUDIO::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, const STRING_UTF8_MAP* aProperties, - PROJECT* aProject, - PROGRESS_REPORTER* aProgressReporter ) + PROJECT* aProject ) { m_props = aProperties; @@ -101,7 +100,7 @@ BOARD* PCB_IO_ALTIUM_CIRCUIT_STUDIO::LoadBoard( const wxString& aFileName, BOARD try { // Parse File - ALTIUM_PCB pcb( m_board, aProgressReporter ); + ALTIUM_PCB pcb( m_board, m_progressReporter ); pcb.Parse( altiumPcbFile, mapping ); } catch( CFB::CFBException& exception ) diff --git a/pcbnew/pcb_io/altium/pcb_io_altium_circuit_studio.h b/pcbnew/pcb_io/altium/pcb_io_altium_circuit_studio.h index 2e136f5085..3ac1da1f8a 100644 --- a/pcbnew/pcb_io/altium/pcb_io_altium_circuit_studio.h +++ b/pcbnew/pcb_io/altium/pcb_io_altium_circuit_studio.h @@ -45,8 +45,7 @@ public: bool CanReadBoard( const wxString& aFileName ) const override; BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, - const STRING_UTF8_MAP* aProperties, PROJECT* aProject, - PROGRESS_REPORTER* aProgressReporter = nullptr ) override; + const STRING_UTF8_MAP* aProperties, PROJECT* aProject ) override; long long GetLibraryTimestamp( const wxString& aLibraryPath ) const override { diff --git a/pcbnew/pcb_io/altium/pcb_io_altium_designer.cpp b/pcbnew/pcb_io/altium/pcb_io_altium_designer.cpp index 9893058791..b90b6a77bf 100644 --- a/pcbnew/pcb_io/altium/pcb_io_altium_designer.cpp +++ b/pcbnew/pcb_io/altium/pcb_io_altium_designer.cpp @@ -75,8 +75,7 @@ bool PCB_IO_ALTIUM_DESIGNER::CanReadLibrary( const wxString& aFileName ) const BOARD* PCB_IO_ALTIUM_DESIGNER::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, - const STRING_UTF8_MAP* aProperties, PROJECT* aProject, - PROGRESS_REPORTER* aProgressReporter ) + const STRING_UTF8_MAP* aProperties, PROJECT* aProject ) { m_props = aProperties; @@ -117,7 +116,7 @@ BOARD* PCB_IO_ALTIUM_DESIGNER::LoadBoard( const wxString& aFileName, BOARD* aApp try { // Parse File - ALTIUM_PCB pcb( m_board, aProgressReporter ); + ALTIUM_PCB pcb( m_board, m_progressReporter ); pcb.Parse( altiumPcbFile, mapping ); } catch( CFB::CFBException& exception ) diff --git a/pcbnew/pcb_io/altium/pcb_io_altium_designer.h b/pcbnew/pcb_io/altium/pcb_io_altium_designer.h index bb9bfa601f..3c7305ef3f 100644 --- a/pcbnew/pcb_io/altium/pcb_io_altium_designer.h +++ b/pcbnew/pcb_io/altium/pcb_io_altium_designer.h @@ -52,8 +52,7 @@ public: bool CanReadLibrary( const wxString& aFileName ) const override; BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, - const STRING_UTF8_MAP* aProperties, PROJECT* aProject = nullptr, - PROGRESS_REPORTER* aProgressReporter = nullptr ) override; + const STRING_UTF8_MAP* aProperties, PROJECT* aProject = nullptr ) override; long long GetLibraryTimestamp( const wxString& aLibraryPath ) const override; diff --git a/pcbnew/pcb_io/altium/pcb_io_solidworks.cpp b/pcbnew/pcb_io/altium/pcb_io_solidworks.cpp index 63f20aac0a..b4906b7274 100644 --- a/pcbnew/pcb_io/altium/pcb_io_solidworks.cpp +++ b/pcbnew/pcb_io/altium/pcb_io_solidworks.cpp @@ -50,8 +50,7 @@ bool PCB_IO_SOLIDWORKS::CanReadBoard( const wxString& aFileName ) const BOARD* PCB_IO_SOLIDWORKS::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, - const STRING_UTF8_MAP* aProperties, PROJECT* aProject, - PROGRESS_REPORTER* aProgressReporter ) + const STRING_UTF8_MAP* aProperties, PROJECT* aProject ) { m_props = aProperties; @@ -120,7 +119,7 @@ BOARD* PCB_IO_SOLIDWORKS::LoadBoard( const wxString& aFileName, BOARD* aAppendTo try { // Parse File - ALTIUM_PCB pcb( m_board, aProgressReporter ); + ALTIUM_PCB pcb( m_board, m_progressReporter ); pcb.Parse( altiumPcbFile, mapping ); } catch( CFB::CFBException& exception ) diff --git a/pcbnew/pcb_io/altium/pcb_io_solidworks.h b/pcbnew/pcb_io/altium/pcb_io_solidworks.h index f920f944e0..40516bfd04 100644 --- a/pcbnew/pcb_io/altium/pcb_io_solidworks.h +++ b/pcbnew/pcb_io/altium/pcb_io_solidworks.h @@ -40,8 +40,7 @@ public: bool CanReadBoard( const wxString& aFileName ) const override; BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, - const STRING_UTF8_MAP* aProperties, PROJECT* aProject = nullptr, - PROGRESS_REPORTER* aProgressReporter = nullptr ) override; + const STRING_UTF8_MAP* aProperties, PROJECT* aProject = nullptr ) override; long long GetLibraryTimestamp( const wxString& aLibraryPath ) const override { diff --git a/pcbnew/pcb_io/cadstar/pcb_io_cadstar_archive.cpp b/pcbnew/pcb_io/cadstar/pcb_io_cadstar_archive.cpp index e8ffa58528..29ca2acc36 100644 --- a/pcbnew/pcb_io/cadstar/pcb_io_cadstar_archive.cpp +++ b/pcbnew/pcb_io/cadstar/pcb_io_cadstar_archive.cpp @@ -94,15 +94,14 @@ std::vector PCB_IO_CADSTAR_ARCHIVE::GetImportedCachedLibraryFootprin BOARD* PCB_IO_CADSTAR_ARCHIVE::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, - const STRING_UTF8_MAP* aProperties, PROJECT* aProject, - PROGRESS_REPORTER* aProgressReporter ) + const STRING_UTF8_MAP* aProperties, PROJECT* aProject ) { m_props = aProperties; m_board = aAppendToMe ? aAppendToMe : new BOARD(); clearLoadedFootprints(); CADSTAR_PCB_ARCHIVE_LOADER tempPCB( aFileName, m_layer_mapping_handler, - m_show_layer_mapping_warnings, aProgressReporter ); + m_show_layer_mapping_warnings, m_progressReporter ); tempPCB.Load( m_board, aProject ); //center the board: diff --git a/pcbnew/pcb_io/cadstar/pcb_io_cadstar_archive.h b/pcbnew/pcb_io/cadstar/pcb_io_cadstar_archive.h index 258de19dff..31f4f9f94d 100644 --- a/pcbnew/pcb_io/cadstar/pcb_io_cadstar_archive.h +++ b/pcbnew/pcb_io/cadstar/pcb_io_cadstar_archive.h @@ -44,8 +44,7 @@ public: bool CanReadFootprint( const wxString& aFileName ) const override; BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, - const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr, - PROGRESS_REPORTER* aProgressReporter = nullptr ) override; + const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr ) override; std::vector GetImportedCachedLibraryFootprints() override; diff --git a/pcbnew/pcb_io/eagle/pcb_io_eagle.cpp b/pcbnew/pcb_io/eagle/pcb_io_eagle.cpp index 68120e2c1c..2a55a824ba 100644 --- a/pcbnew/pcb_io/eagle/pcb_io_eagle.cpp +++ b/pcbnew/pcb_io/eagle/pcb_io_eagle.cpp @@ -321,8 +321,7 @@ VECTOR2I inline PCB_IO_EAGLE::kicad_fontsize( const ECOORD& d, int aTextThicknes BOARD* PCB_IO_EAGLE::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, - const STRING_UTF8_MAP* aProperties, PROJECT* aProject, - PROGRESS_REPORTER* aProgressReporter ) + const STRING_UTF8_MAP* aProperties, PROJECT* aProject ) { LOCALE_IO toggle; // toggles on, then off, the C locale. wxXmlNode* doc; @@ -330,7 +329,6 @@ BOARD* PCB_IO_EAGLE::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, init( aProperties ); m_board = aAppendToMe ? aAppendToMe : new BOARD(); - m_progressReporter = aProgressReporter; // Give the filename to the board if it's new if( !aAppendToMe ) diff --git a/pcbnew/pcb_io/eagle/pcb_io_eagle.h b/pcbnew/pcb_io/eagle/pcb_io_eagle.h index bc72c7eb3b..6837265230 100644 --- a/pcbnew/pcb_io/eagle/pcb_io_eagle.h +++ b/pcbnew/pcb_io/eagle/pcb_io_eagle.h @@ -146,8 +146,7 @@ public: bool CanReadFootprint( const wxString& aFileName ) const override; BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, - const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr, - PROGRESS_REPORTER* aProgressReporter = nullptr ) override; + const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr ) override; std::vector GetImportedCachedLibraryFootprints() override; diff --git a/pcbnew/pcb_io/easyeda/pcb_io_easyeda_plugin.cpp b/pcbnew/pcb_io/easyeda/pcb_io_easyeda_plugin.cpp index 896d4dac85..650315078c 100644 --- a/pcbnew/pcb_io/easyeda/pcb_io_easyeda_plugin.cpp +++ b/pcbnew/pcb_io/easyeda/pcb_io_easyeda_plugin.cpp @@ -133,8 +133,7 @@ bool PCB_IO_EASYEDA::CanReadLibrary( const wxString& aFileName ) const BOARD* PCB_IO_EASYEDA::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, - const STRING_UTF8_MAP* aProperties, PROJECT* aProject, - PROGRESS_REPORTER* aProgressReporter ) + const STRING_UTF8_MAP* aProperties, PROJECT* aProject ) { m_loadedFootprints.clear(); @@ -145,11 +144,11 @@ BOARD* PCB_IO_EASYEDA::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, if( !aAppendToMe ) m_board->SetFileName( aFileName ); - if( aProgressReporter ) + if( m_progressReporter ) { - aProgressReporter->Report( wxString::Format( _( "Loading %s..." ), aFileName ) ); + m_progressReporter->Report( wxString::Format( _( "Loading %s..." ), aFileName ) ); - if( !aProgressReporter->KeepRefreshing() ) + if( !m_progressReporter->KeepRefreshing() ) THROW_IO_ERROR( _( "Open cancelled by user." ) ); } diff --git a/pcbnew/pcb_io/easyeda/pcb_io_easyeda_plugin.h b/pcbnew/pcb_io/easyeda/pcb_io_easyeda_plugin.h index 19d61fedba..decba50976 100644 --- a/pcbnew/pcb_io/easyeda/pcb_io_easyeda_plugin.h +++ b/pcbnew/pcb_io/easyeda/pcb_io_easyeda_plugin.h @@ -48,8 +48,7 @@ public: bool CanReadLibrary( const wxString& aFileName ) const override; BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, - const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr, - PROGRESS_REPORTER* aProgressReporter = nullptr ) override; + const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr ) override; long long GetLibraryTimestamp( const wxString& aLibraryPath ) const override; diff --git a/pcbnew/pcb_io/easyedapro/pcb_io_easyedapro.cpp b/pcbnew/pcb_io/easyedapro/pcb_io_easyedapro.cpp index 62ae10819f..3c0325ebde 100644 --- a/pcbnew/pcb_io/easyedapro/pcb_io_easyedapro.cpp +++ b/pcbnew/pcb_io/easyedapro/pcb_io_easyedapro.cpp @@ -98,8 +98,7 @@ bool PCB_IO_EASYEDAPRO::CanReadBoard( const wxString& aFileName ) const BOARD* PCB_IO_EASYEDAPRO::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, - const STRING_UTF8_MAP* aProperties, PROJECT* aProject, - PROGRESS_REPORTER* aProgressReporter ) + const STRING_UTF8_MAP* aProperties, PROJECT* aProject ) { m_props = aProperties; @@ -109,11 +108,11 @@ BOARD* PCB_IO_EASYEDAPRO::LoadBoard( const wxString& aFileName, BOARD* aAppendTo if( !aAppendToMe ) m_board->SetFileName( aFileName ); - if( aProgressReporter ) + if( m_progressReporter ) { - aProgressReporter->Report( wxString::Format( _( "Loading %s..." ), aFileName ) ); + m_progressReporter->Report( wxString::Format( _( "Loading %s..." ), aFileName ) ); - if( !aProgressReporter->KeepRefreshing() ) + if( !m_progressReporter->KeepRefreshing() ) THROW_IO_ERROR( _( "Open cancelled by user." ) ); } diff --git a/pcbnew/pcb_io/easyedapro/pcb_io_easyedapro.h b/pcbnew/pcb_io/easyedapro/pcb_io_easyedapro.h index e30deb5063..5a52fb71ab 100644 --- a/pcbnew/pcb_io/easyedapro/pcb_io_easyedapro.h +++ b/pcbnew/pcb_io/easyedapro/pcb_io_easyedapro.h @@ -55,8 +55,7 @@ public: bool CanReadBoard( const wxString& aFileName ) const override; BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, - const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr, - PROGRESS_REPORTER* aProgressReporter = nullptr ) override; + const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr ) override; long long GetLibraryTimestamp( const wxString& aLibraryPath ) const override; diff --git a/pcbnew/pcb_io/fabmaster/pcb_io_fabmaster.cpp b/pcbnew/pcb_io/fabmaster/pcb_io_fabmaster.cpp index 991d2ced11..3c2ecc068a 100644 --- a/pcbnew/pcb_io/fabmaster/pcb_io_fabmaster.cpp +++ b/pcbnew/pcb_io/fabmaster/pcb_io_fabmaster.cpp @@ -44,8 +44,7 @@ PCB_IO_FABMASTER::~PCB_IO_FABMASTER() BOARD* PCB_IO_FABMASTER::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, - const STRING_UTF8_MAP* aProperties, PROJECT* aProject, - PROGRESS_REPORTER* aProgressReporter ) + const STRING_UTF8_MAP* aProperties, PROJECT* aProject ) { m_props = aProperties; @@ -55,11 +54,11 @@ BOARD* PCB_IO_FABMASTER::LoadBoard( const wxString& aFileName, BOARD* aAppendToM if( !aAppendToMe ) m_board->SetFileName( aFileName ); - if( aProgressReporter ) + if( m_progressReporter ) { - aProgressReporter->Report( wxString::Format( _( "Loading %s..." ), aFileName ) ); + m_progressReporter->Report( wxString::Format( _( "Loading %s..." ), aFileName ) ); - if( !aProgressReporter->KeepRefreshing() ) + if( !m_progressReporter->KeepRefreshing() ) THROW_IO_ERROR( _( "Open cancelled by user." ) ); } @@ -72,7 +71,7 @@ BOARD* PCB_IO_FABMASTER::LoadBoard( const wxString& aFileName, BOARD* aAppendToM } m_fabmaster.Process(); - m_fabmaster.LoadBoard( m_board, aProgressReporter ); + m_fabmaster.LoadBoard( m_board, m_progressReporter ); return m_board; } diff --git a/pcbnew/pcb_io/fabmaster/pcb_io_fabmaster.h b/pcbnew/pcb_io/fabmaster/pcb_io_fabmaster.h index 117af297db..625e32fa00 100644 --- a/pcbnew/pcb_io/fabmaster/pcb_io_fabmaster.h +++ b/pcbnew/pcb_io/fabmaster/pcb_io_fabmaster.h @@ -45,8 +45,7 @@ public: } BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, - const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr, - PROGRESS_REPORTER* aProgressReporter = nullptr ) override; + const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr ) override; long long GetLibraryTimestamp( const wxString& aLibraryPath ) const override { diff --git a/pcbnew/pcb_io/ipc2581/pcb_io_ipc2581.cpp b/pcbnew/pcb_io/ipc2581/pcb_io_ipc2581.cpp index 801f36d72e..cd019db897 100644 --- a/pcbnew/pcb_io/ipc2581/pcb_io_ipc2581.cpp +++ b/pcbnew/pcb_io/ipc2581/pcb_io_ipc2581.cpp @@ -301,8 +301,8 @@ wxXmlNode* PCB_IO_IPC2581::generateXmlHeader() wxXmlNode* PCB_IO_IPC2581::generateContentSection() { - if( m_progress_reporter ) - m_progress_reporter->AdvancePhase( _( "Generating content section" ) ); + if( m_progressReporter ) + m_progressReporter->AdvancePhase( _( "Generating content section" ) ); wxXmlNode* contentNode = appendNode( m_xml_root, "Content" ); addAttribute( contentNode, "roleRef", "Owner" ); @@ -1116,8 +1116,8 @@ wxXmlNode* PCB_IO_IPC2581::generateLogisticSection() wxXmlNode* PCB_IO_IPC2581::generateHistorySection() { - if( m_progress_reporter ) - m_progress_reporter->AdvancePhase( _( "Generating history section" ) ); + if( m_progressReporter ) + m_progressReporter->AdvancePhase( _( "Generating history section" ) ); wxXmlNode* historyNode = appendNode( m_xml_root, "HistoryRecord" ); addAttribute( historyNode, "number", "1" ); @@ -1143,8 +1143,8 @@ wxXmlNode* PCB_IO_IPC2581::generateHistorySection() wxXmlNode* PCB_IO_IPC2581::generateBOMSection( wxXmlNode* aEcadNode ) { - if( m_progress_reporter ) - m_progress_reporter->AdvancePhase( _( "Generating BOM section" ) ); + if( m_progressReporter ) + m_progressReporter->AdvancePhase( _( "Generating BOM section" ) ); struct REFDES { @@ -1307,8 +1307,8 @@ wxXmlNode* PCB_IO_IPC2581::generateBOMSection( wxXmlNode* aEcadNode ) wxXmlNode* PCB_IO_IPC2581::generateEcadSection() { - if( m_progress_reporter ) - m_progress_reporter->AdvancePhase( _( "Generating CAD data" ) ); + if( m_progressReporter ) + m_progressReporter->AdvancePhase( _( "Generating CAD data" ) ); wxXmlNode* ecadNode = appendNode( m_xml_root, "Ecad" ); addAttribute( ecadNode, "name", "Design" ); @@ -2339,20 +2339,20 @@ void PCB_IO_IPC2581::generateLayerFeatures( wxXmlNode* aStepNode ) for( PCB_LAYER_ID layer : layers ) { - if( m_progress_reporter ) - m_progress_reporter->SetMaxProgress( nets.GetNetCount() * layers.size() ); + if( m_progressReporter ) + m_progressReporter->SetMaxProgress( nets.GetNetCount() * layers.size() ); wxXmlNode* layerNode = appendNode( aStepNode, "LayerFeature" ); addAttribute( layerNode, "layerRef", m_layer_name_map[layer] ); for( const NETINFO_ITEM* net : nets ) { - if( m_progress_reporter ) + if( m_progressReporter ) { - m_progress_reporter->Report( wxString::Format( _( "Exporting Layer %s, Net %s" ), + m_progressReporter->Report( wxString::Format( _( "Exporting Layer %s, Net %s" ), m_board->GetLayerName( layer ), net->GetNetname() ) ); - m_progress_reporter->AdvanceProgress(); + m_progressReporter->AdvanceProgress(); } std::vector& vec = elements[layer][net->GetNetCode()]; @@ -2735,8 +2735,8 @@ void PCB_IO_IPC2581::generateLayerSetNet( wxXmlNode* aLayerNode, PCB_LAYER_ID aL wxXmlNode* PCB_IO_IPC2581::generateAvlSection() { - if( m_progress_reporter ) - m_progress_reporter->AdvancePhase( _( "Generating BOM section" ) ); + if( m_progressReporter ) + m_progressReporter->AdvancePhase( _( "Generating BOM section" ) ); wxXmlNode* avl = appendNode( m_xml_root, "Avl" ); addAttribute( avl, "name", "Primary_Vendor_List" ); @@ -2827,14 +2827,12 @@ wxXmlNode* PCB_IO_IPC2581::generateAvlSection() void PCB_IO_IPC2581::SaveBoard( const wxString& aFileName, BOARD* aBoard, - const STRING_UTF8_MAP* aProperties, - PROGRESS_REPORTER* aProgressReporter ) + const STRING_UTF8_MAP* aProperties ) { m_board = aBoard; m_units_str = "MILLIMETER"; m_scale = 1.0 / PCB_IU_PER_MM; m_sigfig = 4; - m_progress_reporter = aProgressReporter; if( auto it = aProperties->find( "units" ); it != aProperties->end() ) { @@ -2889,11 +2887,11 @@ void PCB_IO_IPC2581::SaveBoard( const wxString& aFileName, BOARD* aBoard, generateContentSection(); - if( m_progress_reporter ) + if( m_progressReporter ) { - m_progress_reporter->SetNumPhases( 7 ); - m_progress_reporter->BeginPhase( 1 ); - m_progress_reporter->Report( _( "Generating logistic section" ) ); + m_progressReporter->SetNumPhases( 7 ); + m_progressReporter->BeginPhase( 1 ); + m_progressReporter->Report( _( "Generating logistic section" ) ); } generateLogisticSection(); @@ -2903,9 +2901,9 @@ void PCB_IO_IPC2581::SaveBoard( const wxString& aFileName, BOARD* aBoard, generateBOMSection( ecad_node ); generateAvlSection(); - if( m_progress_reporter ) + if( m_progressReporter ) { - m_progress_reporter->AdvancePhase( _( "Saving file" ) ); + m_progressReporter->AdvancePhase( _( "Saving file" ) ); } wxFileOutputStreamWithProgress out_stream( aFileName ); @@ -2922,13 +2920,13 @@ void PCB_IO_IPC2581::SaveBoard( const wxString& aFileName, BOARD* aBoard, written_bytes += aBytes; double percent = written_bytes / static_cast( m_total_bytes ); - if( m_progress_reporter ) + if( m_progressReporter ) { // Only update every percent if( last_yield + 0.01 < percent ) { last_yield = percent; - m_progress_reporter->SetCurrentProgress( percent ); + m_progressReporter->SetCurrentProgress( percent ); } } }; diff --git a/pcbnew/pcb_io/ipc2581/pcb_io_ipc2581.h b/pcbnew/pcb_io/ipc2581/pcb_io_ipc2581.h index ca927acf90..0052a5c14a 100644 --- a/pcbnew/pcb_io/ipc2581/pcb_io_ipc2581.h +++ b/pcbnew/pcb_io/ipc2581/pcb_io_ipc2581.h @@ -78,12 +78,10 @@ public: * */ // BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, - // const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr, - // PROGRESS_REPORTER* aProgressReporter = nullptr ) override; + // const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr ) override; void SaveBoard( const wxString& aFileName, BOARD* aBoard, - const STRING_UTF8_MAP* aProperties = nullptr, - PROGRESS_REPORTER* aProgressReporter = nullptr ) override; + const STRING_UTF8_MAP* aProperties = nullptr ) override; const IO_BASE::IO_FILE_DESC GetBoardFileDesc() const override { diff --git a/pcbnew/pcb_io/kicad_legacy/pcb_io_kicad_legacy.cpp b/pcbnew/pcb_io/kicad_legacy/pcb_io_kicad_legacy.cpp index b0f20f4c44..8e31188376 100644 --- a/pcbnew/pcb_io/kicad_legacy/pcb_io_kicad_legacy.cpp +++ b/pcbnew/pcb_io/kicad_legacy/pcb_io_kicad_legacy.cpp @@ -466,8 +466,7 @@ bool PCB_IO_KICAD_LEGACY::CanReadFootprint( const wxString& aFileName ) const BOARD* PCB_IO_KICAD_LEGACY::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, - const STRING_UTF8_MAP* aProperties, PROJECT* aProject, - PROGRESS_REPORTER* aProgressReporter ) + const STRING_UTF8_MAP* aProperties, PROJECT* aProject ) { LOCALE_IO toggle; // toggles on, then off, the C locale. @@ -492,7 +491,6 @@ BOARD* PCB_IO_KICAD_LEGACY::LoadBoard( const wxString& aFileName, BOARD* aAppend FILE_LINE_READER reader( aFileName ); m_reader = &reader; - m_progressReporter = aProgressReporter; m_loading_format_version = getVersion( m_reader ); m_board->SetFileFormatVersionAtLoad( m_loading_format_version ); diff --git a/pcbnew/pcb_io/kicad_legacy/pcb_io_kicad_legacy.h b/pcbnew/pcb_io/kicad_legacy/pcb_io_kicad_legacy.h index bbf87a2992..b2e676f26e 100644 --- a/pcbnew/pcb_io/kicad_legacy/pcb_io_kicad_legacy.h +++ b/pcbnew/pcb_io/kicad_legacy/pcb_io_kicad_legacy.h @@ -80,8 +80,7 @@ public: bool CanReadFootprint( const wxString& aFileName ) const override; BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, - const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr, - PROGRESS_REPORTER* aProgressReporter = nullptr ) override; + const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr ) override; void FootprintEnumerate( wxArrayString& aFootprintNames, const wxString& aLibraryPath, bool aBestEfforts, diff --git a/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.cpp b/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.cpp index 78ba1699b8..54b7646431 100644 --- a/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.cpp +++ b/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.cpp @@ -294,8 +294,7 @@ bool PCB_IO_KICAD_SEXPR::CanReadBoard( const wxString& aFileName ) const void PCB_IO_KICAD_SEXPR::SaveBoard( const wxString& aFileName, BOARD* aBoard, - const STRING_UTF8_MAP* aProperties, - PROGRESS_REPORTER* aProgressReporter ) + const STRING_UTF8_MAP* aProperties ) { LOCALE_IO toggle; // toggles on, then off, the C locale. @@ -2415,18 +2414,17 @@ PCB_IO_KICAD_SEXPR::~PCB_IO_KICAD_SEXPR() BOARD* PCB_IO_KICAD_SEXPR::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, - const STRING_UTF8_MAP* aProperties, PROJECT* aProject, - PROGRESS_REPORTER* aProgressReporter ) + const STRING_UTF8_MAP* aProperties, PROJECT* aProject ) { FILE_LINE_READER reader( aFileName ); unsigned lineCount = 0; - if( aProgressReporter ) + if( m_progressReporter ) { - aProgressReporter->Report( wxString::Format( _( "Loading %s..." ), aFileName ) ); + m_progressReporter->Report( wxString::Format( _( "Loading %s..." ), aFileName ) ); - if( !aProgressReporter->KeepRefreshing() ) + if( !m_progressReporter->KeepRefreshing() ) THROW_IO_ERROR( _( "Open cancelled by user." ) ); while( reader.ReadLine() ) @@ -2435,7 +2433,7 @@ BOARD* PCB_IO_KICAD_SEXPR::LoadBoard( const wxString& aFileName, BOARD* aAppendT reader.Rewind(); } - BOARD* board = DoLoad( reader, aAppendToMe, aProperties, aProgressReporter, lineCount ); + BOARD* board = DoLoad( reader, aAppendToMe, aProperties, m_progressReporter, lineCount ); // Give the filename to the board if it's new if( !aAppendToMe ) diff --git a/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h b/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h index 921e391fa0..c1cce85a45 100644 --- a/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h +++ b/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h @@ -305,12 +305,10 @@ public: bool CanReadBoard( const wxString& aFileName ) const override; void SaveBoard( const wxString& aFileName, BOARD* aBoard, - const STRING_UTF8_MAP* aProperties = nullptr, - PROGRESS_REPORTER* aProgressReporter = nullptr ) override; + const STRING_UTF8_MAP* aProperties = nullptr ) override; BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, - const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr, - PROGRESS_REPORTER* aProgressReporter = nullptr ) override; + const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr ) override; BOARD* DoLoad( LINE_READER& aReader, BOARD* aAppendToMe, const STRING_UTF8_MAP* aProperties, PROGRESS_REPORTER* aProgressReporter, unsigned aLineCount ); diff --git a/pcbnew/pcb_io/pcad/pcb_io_pcad.cpp b/pcbnew/pcb_io/pcad/pcb_io_pcad.cpp index ce89d087bb..ced34e2915 100644 --- a/pcbnew/pcb_io/pcad/pcb_io_pcad.cpp +++ b/pcbnew/pcb_io/pcad/pcb_io_pcad.cpp @@ -63,8 +63,7 @@ bool PCB_IO_PCAD::CanReadBoard( const wxString& aFileName ) const BOARD* PCB_IO_PCAD::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, - const STRING_UTF8_MAP* aProperties, PROJECT* aProject, - PROGRESS_REPORTER* aProgressReporter ) + const STRING_UTF8_MAP* aProperties, PROJECT* aProject ) { wxXmlDocument xmlDoc; diff --git a/pcbnew/pcb_io/pcad/pcb_io_pcad.h b/pcbnew/pcb_io/pcad/pcb_io_pcad.h index 84c9959c31..a37339d1c4 100644 --- a/pcbnew/pcb_io/pcad/pcb_io_pcad.h +++ b/pcbnew/pcb_io/pcad/pcb_io_pcad.h @@ -53,8 +53,7 @@ public: bool CanReadBoard( const wxString& aFileName ) const override; BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, - const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr, - PROGRESS_REPORTER* aProgressReporter = nullptr ) override; + const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr ) override; long long GetLibraryTimestamp( const wxString& aLibraryPath ) const override { diff --git a/pcbnew/pcb_io/pcb_io.cpp b/pcbnew/pcb_io/pcb_io.cpp index 63eb32e9fc..62ccf1f6c0 100644 --- a/pcbnew/pcb_io/pcb_io.cpp +++ b/pcbnew/pcb_io/pcb_io.cpp @@ -73,8 +73,7 @@ bool PCB_IO::CanReadFootprint( const wxString& aFileName ) const BOARD* PCB_IO::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, - const STRING_UTF8_MAP* aProperties, PROJECT* aProject, - PROGRESS_REPORTER* aProgressReporter ) + const STRING_UTF8_MAP* aProperties, PROJECT* aProject ) { NOT_IMPLEMENTED( __FUNCTION__ ); } @@ -87,7 +86,7 @@ std::vector PCB_IO::GetImportedCachedLibraryFootprints() void PCB_IO::SaveBoard( const wxString& aFileName, BOARD* aBoard, - const STRING_UTF8_MAP* aProperties, PROGRESS_REPORTER* aProgressReporter ) + const STRING_UTF8_MAP* aProperties ) { // not pure virtual so that plugins only have to implement subset of the PLUGIN interface. NOT_IMPLEMENTED( __FUNCTION__ ); diff --git a/pcbnew/pcb_io/pcb_io.h b/pcbnew/pcb_io/pcb_io.h index 133e140d2c..8be2f0de90 100644 --- a/pcbnew/pcb_io/pcb_io.h +++ b/pcbnew/pcb_io/pcb_io.h @@ -119,8 +119,6 @@ public: * it to be optionally NULL. * @param aProject is the optional #PROJECT object primarily used by third party * importers. - * @param aProgressReporter an optional progress reporter - * @param aLineCount a line count (necessary if a progress reporter is supplied) * @return the successfully loaded board, or the same one as \a aAppendToMe if aAppendToMe * was not NULL, and caller owns it. * @@ -129,8 +127,7 @@ public: * possible. */ virtual BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, - const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr, - PROGRESS_REPORTER* aProgressReporter = nullptr ); + const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr ); /** * Return a container with the cached library footprints generated in the last call to @@ -157,13 +154,11 @@ public: * tuning arguments that the plugin is known to support. The caller * continues to own this object (plugin may not delete it) and plugins * should expect it to be optionally NULL. - * @param aProgressReporter an optional progress reporter * * @throw IO_ERROR if there is a problem saving or exporting. */ virtual void SaveBoard( const wxString& aFileName, BOARD* aBoard, - const STRING_UTF8_MAP* aProperties = nullptr, - PROGRESS_REPORTER* aProgressReporter = nullptr ); + const STRING_UTF8_MAP* aProperties = nullptr ); /** * Return a list of footprint names contained within the library at @a aLibraryPath. diff --git a/pcbnew/pcb_io/pcb_io_mgr.cpp b/pcbnew/pcb_io/pcb_io_mgr.cpp index 2d1fa449ff..899729bd00 100644 --- a/pcbnew/pcb_io/pcb_io_mgr.cpp +++ b/pcbnew/pcb_io/pcb_io_mgr.cpp @@ -172,7 +172,8 @@ BOARD* PCB_IO_MGR::Load( PCB_FILE_T aFileType, const wxString& aFileName, BOARD* if( (PCB_IO*) pi ) // test pi->plugin { - return pi->LoadBoard( aFileName, aAppendToMe, aProperties, aProject, aProgressReporter ); + pi->SetProgressReporter( aProgressReporter ); + return pi->LoadBoard( aFileName, aAppendToMe, aProperties, aProject ); } THROW_IO_ERROR( wxString::Format( FMT_NOTFOUND, ShowType( aFileType ).GetData() ) ); diff --git a/pcbnew/tools/pcb_control.cpp b/pcbnew/tools/pcb_control.cpp index 9f39011147..4ad508651a 100644 --- a/pcbnew/tools/pcb_control.cpp +++ b/pcbnew/tools/pcb_control.cpp @@ -1303,7 +1303,8 @@ int PCB_CONTROL::AppendBoard( PCB_IO& pi, wxString& fileName ) WX_PROGRESS_REPORTER progressReporter( editFrame, _( "Loading PCB" ), 1 ); editFrame->GetDesignSettings().m_NetSettings->m_NetClasses.clear(); - pi.LoadBoard( fileName, brd, &props, nullptr, &progressReporter ); + pi.SetProgressReporter( &progressReporter ); + pi.LoadBoard( fileName, brd, &props, nullptr ); } catch( const IO_ERROR& ioe ) {