Push PCB_IOs to use the base progress reporter instead of per-function

This commit is contained in:
Ian McInerney 2023-12-27 17:06:23 +00:00
parent 4a67761d29
commit d7fe668d79
34 changed files with 90 additions and 128 deletions

View File

@ -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() )
{

View File

@ -675,7 +675,8 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& 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 )

View File

@ -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;

View File

@ -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 );

View File

@ -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 )

View File

@ -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
{

View File

@ -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 )

View File

@ -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
{

View File

@ -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 )

View File

@ -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;

View File

@ -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 )

View File

@ -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
{

View File

@ -94,15 +94,14 @@ std::vector<FOOTPRINT*> 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:

View File

@ -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<FOOTPRINT*> GetImportedCachedLibraryFootprints() override;

View File

@ -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 )

View File

@ -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<FOOTPRINT*> GetImportedCachedLibraryFootprints() override;

View File

@ -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." ) );
}

View File

@ -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;

View File

@ -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." ) );
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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
{

View File

@ -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<BOARD_ITEM*>& 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<double>( 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 );
}
}
};

View File

@ -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
{

View File

@ -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 );

View File

@ -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,

View File

@ -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 )

View File

@ -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 );

View File

@ -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;

View File

@ -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
{

View File

@ -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<FOOTPRINT*> 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__ );

View File

@ -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.

View File

@ -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() ) );

View File

@ -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 )
{