Rename Save -> SaveBoard, Load -> LoadBoard in PLUGIN.

This commit is contained in:
Alex Shvartzkop 2023-08-13 05:11:58 +03:00
parent 2e5430a874
commit a0d96cea9f
30 changed files with 94 additions and 87 deletions

View File

@ -750,7 +750,7 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
unsigned startTime = GetRunningMicroSecs();
#endif
loadedBoard = pi->Load( fullFileName, nullptr, &props, &Prj(), &progressReporter );
loadedBoard = pi->LoadBoard( fullFileName, nullptr, &props, &Prj(), &progressReporter );
#if USE_INSTRUMENTATION
unsigned stopTime = GetRunningMicroSecs();
@ -1068,7 +1068,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool addToHistory,
{
PLUGIN::RELEASER pi( IO_MGR::PluginFind( IO_MGR::KICAD_SEXP ) );
pi->Save( tempFile, GetBoard(), nullptr );
pi->SaveBoard( tempFile, GetBoard(), nullptr );
}
catch( const IO_ERROR& ioe )
{
@ -1170,7 +1170,7 @@ bool PCB_EDIT_FRAME::SavePcbCopy( const wxString& aFileName, bool aCreateProject
wxASSERT( pcbFileName.IsAbsolute() );
pi->Save( pcbFileName.GetFullPath(), GetBoard(), nullptr );
pi->SaveBoard( pcbFileName.GetFullPath(), GetBoard(), nullptr );
}
catch( const IO_ERROR& ioe )
{

View File

@ -169,7 +169,7 @@ BOARD* IO_MGR::Load( PCB_FILE_T aFileType, const wxString& aFileName, BOARD* aAp
if( (PLUGIN*) pi ) // test pi->plugin
{
return pi->Load( aFileName, aAppendToMe, aProperties, aProject, aProgressReporter );
return pi->LoadBoard( aFileName, aAppendToMe, aProperties, aProject, aProgressReporter );
}
THROW_IO_ERROR( wxString::Format( FMT_NOTFOUND, ShowType( aFileType ).GetData() ) );
@ -184,7 +184,7 @@ void IO_MGR::Save( PCB_FILE_T aFileType, const wxString& aFileName, BOARD* aBoar
if( (PLUGIN*) pi ) // test pi->plugin
{
pi->Save( aFileName, aBoard, aProperties ); // virtual
pi->SaveBoard( aFileName, aBoard, aProperties ); // virtual
return;
}

View File

@ -192,8 +192,8 @@ public:
static PCB_FILE_T GuessPluginTypeFromLibPath( const wxString& aLibPath );
/**
* Find the requested #PLUGIN and if found, calls the #PLUGIN::Load() function
* on it using the arguments passed to this function. After the #PLUGIN::Load()
* Find the requested #PLUGIN and if found, calls the #PLUGIN::LoadBoard() function
* on it using the arguments passed to this function. After the #PLUGIN::LoadBoard()
* function returns, the #PLUGIN is Released() as part of this call.
*
* @param aFileType is the #PCB_FILE_T of file to load.
@ -316,7 +316,7 @@ public:
* wrong, using line number and character offsets of the input file if
* possible.
*/
virtual BOARD* Load( const wxString& aFileName, BOARD* aAppendToMe,
virtual BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr,
PROGRESS_REPORTER* aProgressReporter = nullptr );
@ -348,7 +348,7 @@ public:
*
* @throw IO_ERROR if there is a problem saving or exporting.
*/
virtual void Save( const wxString& aFileName, BOARD* aBoard,
virtual void SaveBoard( const wxString& aFileName, BOARD* aBoard,
const STRING_UTF8_MAP* aProperties = nullptr );
/**

View File

@ -332,8 +332,8 @@ BOARD_ITEM* CLIPBOARD_IO::Parse()
}
void CLIPBOARD_IO::Save( const wxString& aFileName, BOARD* aBoard,
const STRING_UTF8_MAP* aProperties )
void CLIPBOARD_IO::SaveBoard( const wxString& aFileName, BOARD* aBoard,
const STRING_UTF8_MAP* aProperties )
{
init( aProperties );
@ -377,9 +377,9 @@ void CLIPBOARD_IO::Save( const wxString& aFileName, BOARD* aBoard,
}
BOARD* CLIPBOARD_IO::Load( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties, PROJECT* aProject,
PROGRESS_REPORTER* aProgressReporter )
BOARD* CLIPBOARD_IO::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties, PROJECT* aProject,
PROGRESS_REPORTER* aProgressReporter )
{
std::string result;

View File

@ -47,8 +47,8 @@ public:
/*
* Saves the entire board to the clipboard formatted using the PCB_PLUGIN formatting
*/
void Save( const wxString& aFileName, BOARD* aBoard,
const STRING_UTF8_MAP* aProperties = nullptr ) override;
void SaveBoard( const wxString& aFileName, BOARD* aBoard,
const STRING_UTF8_MAP* aProperties = nullptr ) override;
/*
* Write all the settings of the BOARD* set by setBoard() and then adds all the
@ -58,9 +58,9 @@ public:
BOARD_ITEM* Parse();
BOARD* Load( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr,
PROGRESS_REPORTER* aProgressReporter = nullptr ) override;
BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr,
PROGRESS_REPORTER* aProgressReporter = nullptr ) override;
void SetBoard( BOARD* aBoard );

View File

@ -35,8 +35,9 @@
BOARD* PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe, const STRING_UTF8_MAP* aProperties,
PROJECT* aProject, PROGRESS_REPORTER* aProgressReporter )
BOARD* PLUGIN::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties, PROJECT* aProject,
PROGRESS_REPORTER* aProgressReporter )
{
NOT_IMPLEMENTED( __FUNCTION__ );
}
@ -47,7 +48,8 @@ std::vector<FOOTPRINT*> PLUGIN::GetImportedCachedLibraryFootprints()
NOT_IMPLEMENTED( __FUNCTION__ );
}
void PLUGIN::Save( const wxString& aFileName, BOARD* aBoard, const STRING_UTF8_MAP* aProperties )
void PLUGIN::SaveBoard( const wxString& aFileName, BOARD* aBoard, 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

@ -62,9 +62,10 @@ const wxString ALTIUM_CIRCUIT_MAKER_PLUGIN::GetFileExtension() const
}
BOARD* ALTIUM_CIRCUIT_MAKER_PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties, PROJECT* aProject,
PROGRESS_REPORTER* aProgressReporter )
BOARD* ALTIUM_CIRCUIT_MAKER_PLUGIN::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties,
PROJECT* aProject,
PROGRESS_REPORTER* aProgressReporter )
{
m_props = aProperties;

View File

@ -33,9 +33,9 @@ class ALTIUM_CIRCUIT_MAKER_PLUGIN : public PLUGIN
public:
const wxString PluginName() const override;
BOARD* Load( const wxString& aFileName, BOARD* aAppendToMe, const STRING_UTF8_MAP* aProperties,
PROJECT* aProject = nullptr,
PROGRESS_REPORTER* aProgressReporter = nullptr ) override;
BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties, PROJECT* aProject = nullptr,
PROGRESS_REPORTER* aProgressReporter = nullptr ) override;
const wxString GetFileExtension() const override;

View File

@ -62,9 +62,10 @@ const wxString ALTIUM_CIRCUIT_STUDIO_PLUGIN::GetFileExtension() const
}
BOARD* ALTIUM_CIRCUIT_STUDIO_PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties, PROJECT* aProject,
PROGRESS_REPORTER* aProgressReporter )
BOARD* ALTIUM_CIRCUIT_STUDIO_PLUGIN::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties,
PROJECT* aProject,
PROGRESS_REPORTER* aProgressReporter )
{
m_props = aProperties;

View File

@ -33,8 +33,9 @@ class ALTIUM_CIRCUIT_STUDIO_PLUGIN : public PLUGIN
public:
const wxString PluginName() const override;
BOARD* Load( const wxString& aFileName, BOARD* aAppendToMe, const STRING_UTF8_MAP* aProperties,
PROJECT* aProject, PROGRESS_REPORTER* aProgressReporter = nullptr ) override;
BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties, PROJECT* aProject,
PROGRESS_REPORTER* aProgressReporter = nullptr ) override;
const wxString GetFileExtension() const override;

View File

@ -50,9 +50,9 @@ ALTIUM_DESIGNER_PLUGIN::~ALTIUM_DESIGNER_PLUGIN()
}
const wxString ALTIUM_DESIGNER_PLUGIN::PluginName() const
{
return wxT( "Altium Designer" );
BOARD* ALTIUM_DESIGNER_PLUGIN::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties, PROJECT* aProject,
PROGRESS_REPORTER* aProgressReporter )
}

View File

@ -35,9 +35,9 @@ public:
const wxString PluginName() const override;
BOARD* Load( const wxString& aFileName, BOARD* aAppendToMe, const STRING_UTF8_MAP* aProperties,
PROJECT* aProject = nullptr,
PROGRESS_REPORTER* aProgressReporter = nullptr ) override;
BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties, PROJECT* aProject = nullptr,
PROGRESS_REPORTER* aProgressReporter = nullptr ) override;
const wxString GetFileExtension() const override;

View File

@ -52,9 +52,9 @@ const wxString SOLIDWORKS_PCB_PLUGIN::GetFileExtension() const
}
BOARD* SOLIDWORKS_PCB_PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties, PROJECT* aProject,
PROGRESS_REPORTER* aProgressReporter )
BOARD* SOLIDWORKS_PCB_PLUGIN::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties, PROJECT* aProject,
PROGRESS_REPORTER* aProgressReporter )
{
m_props = aProperties;

View File

@ -28,9 +28,9 @@ class SOLIDWORKS_PCB_PLUGIN : public PLUGIN
public:
const wxString PluginName() const override;
BOARD* Load( const wxString& aFileName, BOARD* aAppendToMe, const STRING_UTF8_MAP* aProperties,
PROJECT* aProject = nullptr,
PROGRESS_REPORTER* aProgressReporter = nullptr ) override;
BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties, PROJECT* aProject = nullptr,
PROGRESS_REPORTER* aProgressReporter = nullptr ) override;
const wxString GetFileExtension() const override;

View File

@ -106,9 +106,9 @@ std::vector<FOOTPRINT*> CADSTAR_PCB_ARCHIVE_PLUGIN::GetImportedCachedLibraryFoot
}
BOARD* CADSTAR_PCB_ARCHIVE_PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties, PROJECT* aProject,
PROGRESS_REPORTER* aProgressReporter )
BOARD* CADSTAR_PCB_ARCHIVE_PLUGIN::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties, PROJECT* aProject,
PROGRESS_REPORTER* aProgressReporter )
{
m_props = aProperties;
m_board = aAppendToMe ? aAppendToMe : new BOARD();

View File

@ -46,6 +46,9 @@ public:
const wxString GetFileExtension() const override;
BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr,
PROGRESS_REPORTER* aProgressReporter = nullptr ) override;
std::vector<FOOTPRINT*> GetImportedCachedLibraryFootprints() override;

View File

@ -283,9 +283,9 @@ VECTOR2I inline EAGLE_PLUGIN::kicad_fontsize( const ECOORD& d, int aTextThicknes
}
BOARD* EAGLE_PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties, PROJECT* aProject,
PROGRESS_REPORTER* aProgressReporter )
BOARD* EAGLE_PLUGIN::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties, PROJECT* aProject,
PROGRESS_REPORTER* aProgressReporter )
{
LOCALE_IO toggle; // toggles on, then off, the C locale.
wxXmlNode* doc;

View File

@ -131,9 +131,9 @@ class EAGLE_PLUGIN : public PLUGIN, public LAYER_REMAPPABLE_PLUGIN
public:
const wxString PluginName() const override;
BOARD* Load( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr,
PROGRESS_REPORTER* aProgressReporter = nullptr ) override;
BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr,
PROGRESS_REPORTER* aProgressReporter = nullptr ) override;
std::vector<FOOTPRINT*> GetImportedCachedLibraryFootprints() override;

View File

@ -57,9 +57,9 @@ const wxString FABMASTER_PLUGIN::GetFileExtension() const
}
BOARD* FABMASTER_PLUGIN::Load( const wxString &aFileName, BOARD *aAppendToMe,
const STRING_UTF8_MAP* aProperties, PROJECT *aProject,
PROGRESS_REPORTER* aProgressReporter )
BOARD* FABMASTER_PLUGIN::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties, PROJECT* aProject,
PROGRESS_REPORTER* aProgressReporter )
{
m_props = aProperties;

View File

@ -38,9 +38,9 @@ class FABMASTER_PLUGIN : public PLUGIN
public:
const wxString PluginName() const override;
BOARD* Load( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr,
PROGRESS_REPORTER* aProgressReporter = nullptr ) override;
BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr,
PROGRESS_REPORTER* aProgressReporter = nullptr ) override;
const wxString GetFileExtension() const override;

View File

@ -267,7 +267,8 @@ long long FP_CACHE::GetTimestamp( const wxString& aLibPath )
}
void PCB_PLUGIN::Save( const wxString& aFileName, BOARD* aBoard, const STRING_UTF8_MAP* aProperties )
void PCB_PLUGIN::SaveBoard( const wxString& aFileName, BOARD* aBoard,
const STRING_UTF8_MAP* aProperties )
{
LOCALE_IO toggle; // toggles on, then off, the C locale.
@ -2255,9 +2256,9 @@ PCB_PLUGIN::~PCB_PLUGIN()
}
BOARD* PCB_PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties, PROJECT* aProject,
PROGRESS_REPORTER* aProgressReporter )
BOARD* PCB_PLUGIN::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties, PROJECT* aProject,
PROGRESS_REPORTER* aProgressReporter )
{
FILE_LINE_READER reader( aFileName );

View File

@ -282,12 +282,12 @@ public:
m_queryUserCallback = std::move( aCallback );
}
void Save( const wxString& aFileName, BOARD* aBoard,
const STRING_UTF8_MAP* aProperties = nullptr ) override;
void SaveBoard( const wxString& aFileName, BOARD* aBoard,
const STRING_UTF8_MAP* aProperties = nullptr ) override;
BOARD* Load( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr,
PROGRESS_REPORTER* aProgressReporter = nullptr ) override;
BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr,
PROGRESS_REPORTER* aProgressReporter = nullptr ) override;
BOARD* DoLoad( LINE_READER& aReader, BOARD* aAppendToMe, const STRING_UTF8_MAP* aProperties,
PROGRESS_REPORTER* aProgressReporter, unsigned aLineCount );

View File

@ -405,9 +405,9 @@ static inline long hexParse( const char* next, const char** out = nullptr )
}
BOARD* LEGACY_PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties, PROJECT* aProject,
PROGRESS_REPORTER* aProgressReporter )
BOARD* LEGACY_PLUGIN::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties, PROJECT* aProject,
PROGRESS_REPORTER* aProgressReporter )
{
LOCALE_IO toggle; // toggles on, then off, the C locale.

View File

@ -73,9 +73,9 @@ public:
return wxT( "brd" );
}
BOARD* Load( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr,
PROGRESS_REPORTER* aProgressReporter = nullptr ) override;
BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr,
PROGRESS_REPORTER* aProgressReporter = nullptr ) override;
void FootprintEnumerate( wxArrayString& aFootprintNames, const wxString& aLibraryPath,
bool aBestEfforts,

View File

@ -66,9 +66,9 @@ const wxString PCAD_PLUGIN::GetFileExtension() const
}
BOARD* PCAD_PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties, PROJECT* aProject,
PROGRESS_REPORTER* aProgressReporter )
BOARD* PCAD_PLUGIN::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties, PROJECT* aProject,
PROGRESS_REPORTER* aProgressReporter )
{
wxXmlDocument xmlDoc;

View File

@ -40,11 +40,9 @@ public:
const wxString PluginName() const override;
BOARD* Load( const wxString& aFileName,
BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties = nullptr,
PROJECT* aProject = nullptr,
PROGRESS_REPORTER* aProgressReporter = nullptr ) override;
BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr,
PROGRESS_REPORTER* aProgressReporter = nullptr ) override;
const wxString GetFileExtension() const override;

View File

@ -616,7 +616,7 @@ void ROUTER_TOOL::saveRouterDebugLog()
PCB_PLUGIN pcb_io;
pcb_io.Save( fname_dump.GetFullPath(), m_iface->GetBoard(), nullptr );
pcb_io.SaveBoard( fname_dump.GetFullPath(), m_iface->GetBoard(), nullptr );
PROJECT* prj = m_iface->GetBoard()->GetProject();
prj->GetProjectFile().SaveAs( cwd, "pns" );

View File

@ -1271,7 +1271,7 @@ int PCB_CONTROL::AppendBoard( PLUGIN& pi, wxString& fileName )
WX_PROGRESS_REPORTER progressReporter( editFrame, _( "Loading PCB" ), 1 );
editFrame->GetDesignSettings().m_NetSettings->m_NetClasses.clear();
pi.Load( fileName, brd, &props, nullptr, &progressReporter );
pi.LoadBoard( fileName, brd, &props, nullptr, &progressReporter );
}
catch( const IO_ERROR& ioe )
{

View File

@ -65,7 +65,7 @@ std::string GetPcbnewTestDataDir()
void DumpBoardToFile( BOARD& board, const std::string& aFilename )
{
PCB_PLUGIN io;
io.Save( aFilename, &board );
io.SaveBoard( aFilename, &board );
}

View File

@ -898,7 +898,7 @@ static BOARD* loadBoard( const std::string& filename )
try
{
brd = pi->Load( wxString( filename.c_str() ), nullptr, nullptr );
brd = pi->LoadBoard( wxString( filename.c_str() ), nullptr, nullptr );
}
catch( const IO_ERROR& )
{