Push library management into IO_BASE
This commit is contained in:
parent
cad91312aa
commit
743e9d669a
|
@ -379,6 +379,7 @@ set( PLOTTERS_CONTROL_SRCS
|
||||||
|
|
||||||
set( COMMON_IO_SRCS
|
set( COMMON_IO_SRCS
|
||||||
io/plugin_file_desc.cpp
|
io/plugin_file_desc.cpp
|
||||||
|
io/io_base.cpp
|
||||||
io/io_utils.cpp
|
io/io_utils.cpp
|
||||||
|
|
||||||
# Altium
|
# Altium
|
||||||
|
|
|
@ -448,7 +448,7 @@ bool FP_LIB_TABLE::IsFootprintLibWritable( const wxString& aNickname )
|
||||||
{
|
{
|
||||||
const FP_LIB_TABLE_ROW* row = FindRow( aNickname, true );
|
const FP_LIB_TABLE_ROW* row = FindRow( aNickname, true );
|
||||||
wxASSERT( (PCB_IO*) row->plugin );
|
wxASSERT( (PCB_IO*) row->plugin );
|
||||||
return row->plugin->IsFootprintLibWritable( row->GetFullURI( true ) );
|
return row->plugin->IsLibraryWritable( row->GetFullURI( true ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -456,7 +456,7 @@ void FP_LIB_TABLE::FootprintLibDelete( const wxString& aNickname )
|
||||||
{
|
{
|
||||||
const FP_LIB_TABLE_ROW* row = FindRow( aNickname, true );
|
const FP_LIB_TABLE_ROW* row = FindRow( aNickname, true );
|
||||||
wxASSERT( (PCB_IO*) row->plugin );
|
wxASSERT( (PCB_IO*) row->plugin );
|
||||||
row->plugin->FootprintLibDelete( row->GetFullURI( true ), row->GetProperties() );
|
row->plugin->DeleteLibrary( row->GetFullURI( true ), row->GetProperties() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -464,7 +464,7 @@ void FP_LIB_TABLE::FootprintLibCreate( const wxString& aNickname )
|
||||||
{
|
{
|
||||||
const FP_LIB_TABLE_ROW* row = FindRow( aNickname, true );
|
const FP_LIB_TABLE_ROW* row = FindRow( aNickname, true );
|
||||||
wxASSERT( (PCB_IO*) row->plugin );
|
wxASSERT( (PCB_IO*) row->plugin );
|
||||||
row->plugin->FootprintLibCreate( row->GetFullURI( true ), row->GetProperties() );
|
row->plugin->CreateLibrary( row->GetFullURI( true ), row->GetProperties() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
/*
|
||||||
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the
|
||||||
|
* Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <io/io_base.h>
|
||||||
|
#include <ki_exception.h>
|
||||||
|
|
||||||
|
#define FMT_UNIMPLEMENTED wxT( "IO interface \"%s\" does not implement the \"%s\" function." )
|
||||||
|
#define NOT_IMPLEMENTED( aCaller ) \
|
||||||
|
THROW_IO_ERROR( wxString::Format( FMT_UNIMPLEMENTED, \
|
||||||
|
GetName(), \
|
||||||
|
wxString::FromUTF8( aCaller ) ) );
|
||||||
|
|
||||||
|
|
||||||
|
void IO_BASE::CreateLibrary( const wxString& aLibraryPath, const STRING_UTF8_MAP* aProperties )
|
||||||
|
{
|
||||||
|
NOT_IMPLEMENTED( __FUNCTION__ );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool IO_BASE::DeleteLibrary( const wxString& aLibraryPath, const STRING_UTF8_MAP* aProperties )
|
||||||
|
{
|
||||||
|
NOT_IMPLEMENTED( __FUNCTION__ );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool IO_BASE::IsLibraryWritable( const wxString& aLibraryPath )
|
||||||
|
{
|
||||||
|
NOT_IMPLEMENTED( __FUNCTION__ );
|
||||||
|
}
|
||||||
|
|
||||||
|
void IO_BASE::GetLibraryOptions( STRING_UTF8_MAP* aListToAppendTo ) const
|
||||||
|
{
|
||||||
|
// No global options to append
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool IO_BASE::CanReadLibrary( const wxString& aFileName ) const
|
||||||
|
{
|
||||||
|
// TODO: Push file extension based checks from PCB_IO and SCH_IO into this function
|
||||||
|
return false;
|
||||||
|
}
|
|
@ -173,7 +173,7 @@ protected:
|
||||||
|
|
||||||
SCH_IO_MGR::SCH_FILE_T pi_type = SCH_IO_MGR::EnumFromStr( row->GetType() );
|
SCH_IO_MGR::SCH_FILE_T pi_type = SCH_IO_MGR::EnumFromStr( row->GetType() );
|
||||||
SCH_IO::SCH_IO_RELEASER pi( SCH_IO_MGR::FindPlugin( pi_type ) );
|
SCH_IO::SCH_IO_RELEASER pi( SCH_IO_MGR::FindPlugin( pi_type ) );
|
||||||
pi->SymbolLibOptions( &choices );
|
pi->GetLibraryOptions( &choices );
|
||||||
|
|
||||||
DIALOG_PLUGIN_OPTIONS dlg( m_dialog, row->GetNickName(), choices, options, &result );
|
DIALOG_PLUGIN_OPTIONS dlg( m_dialog, row->GetNickName(), choices, options, &result );
|
||||||
dlg.ShowModal();
|
dlg.ShowModal();
|
||||||
|
|
|
@ -361,7 +361,7 @@ SCH_SHEET* SCH_IO_ALTIUM::LoadSchematicFile( const wxString& aFileName, SCHEMATI
|
||||||
if( !libTable->HasLibrary( getLibName() ) )
|
if( !libTable->HasLibrary( getLibName() ) )
|
||||||
{
|
{
|
||||||
// Create a new empty symbol library.
|
// Create a new empty symbol library.
|
||||||
m_pi->CreateSymbolLib( getLibFileName().GetFullPath() );
|
m_pi->CreateLibrary( getLibFileName().GetFullPath() );
|
||||||
wxString libTableUri = "${KIPRJMOD}/" + getLibFileName().GetFullName();
|
wxString libTableUri = "${KIPRJMOD}/" + getLibFileName().GetFullName();
|
||||||
|
|
||||||
// Add the new library to the project symbol library table.
|
// Add the new library to the project symbol library table.
|
||||||
|
|
|
@ -106,18 +106,7 @@ public:
|
||||||
//void DeleteSymbol( const wxString& aLibraryPath, const wxString& aAliasName,
|
//void DeleteSymbol( const wxString& aLibraryPath, const wxString& aAliasName,
|
||||||
// const PROPERTIES* aProperties = NULL ) override;
|
// const PROPERTIES* aProperties = NULL ) override;
|
||||||
|
|
||||||
//void CreateSymbolLib( const wxString& aLibraryPath,
|
bool IsLibraryWritable( const wxString& aLibraryPath ) override { return false; }
|
||||||
// const PROPERTIES* aProperties = NULL ) override;
|
|
||||||
|
|
||||||
// bool DeleteSymbolLib( const wxString& aLibraryPath,
|
|
||||||
// const PROPERTIES* aProperties = NULL ) override;
|
|
||||||
|
|
||||||
bool IsSymbolLibWritable( const wxString& aLibraryPath ) override
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//void SymbolLibOptions( PROPERTIES* aListToAppendTo ) const override;
|
|
||||||
|
|
||||||
wxString getLibName();
|
wxString getLibName();
|
||||||
wxFileName getLibFileName();
|
wxFileName getLibFileName();
|
||||||
|
|
|
@ -121,7 +121,7 @@ SCH_SHEET* SCH_IO_CADSTAR_ARCHIVE::LoadSchematicFile( const wxString& aFi
|
||||||
if( !libTable->HasLibrary( libName ) )
|
if( !libTable->HasLibrary( libName ) )
|
||||||
{
|
{
|
||||||
// Create a new empty symbol library.
|
// Create a new empty symbol library.
|
||||||
sch_plugin->CreateSymbolLib( libFileName.GetFullPath() );
|
sch_plugin->CreateLibrary( libFileName.GetFullPath() );
|
||||||
wxString libTableUri = "${KIPRJMOD}/" + libFileName.GetFullName();
|
wxString libTableUri = "${KIPRJMOD}/" + libFileName.GetFullName();
|
||||||
|
|
||||||
// Add the new library to the project symbol library table.
|
// Add the new library to the project symbol library table.
|
||||||
|
@ -232,7 +232,7 @@ void SCH_IO_CADSTAR_ARCHIVE::GetAvailableSymbolFields( std::vector<wxString>& aN
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_IO_CADSTAR_ARCHIVE::SymbolLibOptions( STRING_UTF8_MAP* aListToAppendTo ) const
|
void SCH_IO_CADSTAR_ARCHIVE::GetLibraryOptions( STRING_UTF8_MAP* aListToAppendTo ) const
|
||||||
{
|
{
|
||||||
( *aListToAppendTo )["csa"] =
|
( *aListToAppendTo )["csa"] =
|
||||||
UTF8( _( "Path to the CADSTAR schematic archive (*.csa) file related to this CADSTAR "
|
UTF8( _( "Path to the CADSTAR schematic archive (*.csa) file related to this CADSTAR "
|
||||||
|
|
|
@ -85,12 +85,9 @@ public:
|
||||||
|
|
||||||
|
|
||||||
// Writing to CADSTAR libraries is not supported
|
// Writing to CADSTAR libraries is not supported
|
||||||
bool IsSymbolLibWritable( const wxString& aLibraryPath ) override
|
bool IsLibraryWritable( const wxString& aLibraryPath ) override { return false; }
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SymbolLibOptions( STRING_UTF8_MAP* aListToAppendTo ) const override;
|
void GetLibraryOptions( STRING_UTF8_MAP* aListToAppendTo ) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Symbol caching
|
// Symbol caching
|
||||||
|
|
|
@ -73,10 +73,7 @@ public:
|
||||||
void GetDefaultSymbolFields( std::vector<wxString>& aNames ) override;
|
void GetDefaultSymbolFields( std::vector<wxString>& aNames ) override;
|
||||||
|
|
||||||
// Database libraries can never be written using the symbol editing API
|
// Database libraries can never be written using the symbol editing API
|
||||||
bool IsSymbolLibWritable( const wxString& aLibraryPath ) override
|
bool IsLibraryWritable( const wxString& aLibraryPath ) override { return false; }
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetLibTable( SYMBOL_LIB_TABLE* aTable ) override
|
void SetLibTable( SYMBOL_LIB_TABLE* aTable ) override
|
||||||
{
|
{
|
||||||
|
|
|
@ -463,7 +463,7 @@ SCH_SHEET* SCH_IO_EAGLE::LoadSchematicFile( const wxString& aFileName, SCHEMATIC
|
||||||
if( !libTable->HasLibrary( getLibName() ) )
|
if( !libTable->HasLibrary( getLibName() ) )
|
||||||
{
|
{
|
||||||
// Create a new empty symbol library.
|
// Create a new empty symbol library.
|
||||||
m_pi->CreateSymbolLib( getLibFileName().GetFullPath() );
|
m_pi->CreateLibrary( getLibFileName().GetFullPath() );
|
||||||
wxString libTableUri = wxT( "${KIPRJMOD}/" ) + getLibFileName().GetFullName();
|
wxString libTableUri = wxT( "${KIPRJMOD}/" ) + getLibFileName().GetFullName();
|
||||||
|
|
||||||
// Add the new library to the project symbol library table.
|
// Add the new library to the project symbol library table.
|
||||||
|
|
|
@ -114,7 +114,7 @@ public:
|
||||||
LIB_SYMBOL* LoadSymbol( const wxString& aLibraryPath, const wxString& aAliasName,
|
LIB_SYMBOL* LoadSymbol( const wxString& aLibraryPath, const wxString& aAliasName,
|
||||||
const STRING_UTF8_MAP* aProperties ) override;
|
const STRING_UTF8_MAP* aProperties ) override;
|
||||||
|
|
||||||
bool IsSymbolLibWritable( const wxString& aLibraryPath ) override { return false; }
|
bool IsLibraryWritable( const wxString& aLibraryPath ) override { return false; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void checkpoint();
|
void checkpoint();
|
||||||
|
|
|
@ -71,7 +71,7 @@ public:
|
||||||
LIB_SYMBOL* LoadSymbol( const wxString& aLibraryPath, const wxString& aAliasName,
|
LIB_SYMBOL* LoadSymbol( const wxString& aLibraryPath, const wxString& aAliasName,
|
||||||
const STRING_UTF8_MAP* aProperties = nullptr ) override;
|
const STRING_UTF8_MAP* aProperties = nullptr ) override;
|
||||||
|
|
||||||
bool IsSymbolLibWritable( const wxString& aLibraryPath ) override { return false; }
|
bool IsLibraryWritable( const wxString& aLibraryPath ) override { return false; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -546,7 +546,7 @@ SCH_SHEET* SCH_IO_EASYEDAPRO::LoadSchematicFile( const wxString& aFileName,
|
||||||
if( !libTable->HasLibrary( libName ) )
|
if( !libTable->HasLibrary( libName ) )
|
||||||
{
|
{
|
||||||
// Create a new empty symbol library.
|
// Create a new empty symbol library.
|
||||||
sch_plugin->CreateSymbolLib( libFileName.GetFullPath() );
|
sch_plugin->CreateLibrary( libFileName.GetFullPath() );
|
||||||
wxString libTableUri = wxS( "${KIPRJMOD}/" ) + libFileName.GetFullName();
|
wxString libTableUri = wxS( "${KIPRJMOD}/" ) + libFileName.GetFullName();
|
||||||
|
|
||||||
// Add the new library to the project symbol library table.
|
// Add the new library to the project symbol library table.
|
||||||
|
|
|
@ -70,7 +70,7 @@ public:
|
||||||
LIB_SYMBOL* LoadSymbol( const wxString& aLibraryPath, const wxString& aAliasName,
|
LIB_SYMBOL* LoadSymbol( const wxString& aLibraryPath, const wxString& aAliasName,
|
||||||
const STRING_UTF8_MAP* aProperties = nullptr ) override;
|
const STRING_UTF8_MAP* aProperties = nullptr ) override;
|
||||||
|
|
||||||
bool IsSymbolLibWritable( const wxString& aLibraryPath ) override { return false; }
|
bool IsLibraryWritable( const wxString& aLibraryPath ) override { return false; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct PRJ_DATA; // Opaque data structure
|
struct PRJ_DATA; // Opaque data structure
|
||||||
|
|
|
@ -69,7 +69,7 @@ public:
|
||||||
|
|
||||||
void GetDefaultSymbolFields( std::vector<wxString>& aNames ) override;
|
void GetDefaultSymbolFields( std::vector<wxString>& aNames ) override;
|
||||||
|
|
||||||
bool IsSymbolLibWritable( const wxString& aLibraryPath ) override
|
bool IsLibraryWritable( const wxString& aLibraryPath ) override
|
||||||
{
|
{
|
||||||
// TODO: HTTP libraries are well capabale of supporting this.
|
// TODO: HTTP libraries are well capabale of supporting this.
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -2176,7 +2176,7 @@ void SCH_IO_KICAD_LEGACY::DeleteSymbol( const wxString& aLibraryPath, const wxSt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_IO_KICAD_LEGACY::CreateSymbolLib( const wxString& aLibraryPath,
|
void SCH_IO_KICAD_LEGACY::CreateLibrary( const wxString& aLibraryPath,
|
||||||
const STRING_UTF8_MAP* aProperties )
|
const STRING_UTF8_MAP* aProperties )
|
||||||
{
|
{
|
||||||
if( wxFileExists( aLibraryPath ) )
|
if( wxFileExists( aLibraryPath ) )
|
||||||
|
@ -2195,7 +2195,7 @@ void SCH_IO_KICAD_LEGACY::CreateSymbolLib( const wxString& aLibraryPath,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SCH_IO_KICAD_LEGACY::DeleteSymbolLib( const wxString& aLibraryPath,
|
bool SCH_IO_KICAD_LEGACY::DeleteLibrary( const wxString& aLibraryPath,
|
||||||
const STRING_UTF8_MAP* aProperties )
|
const STRING_UTF8_MAP* aProperties )
|
||||||
{
|
{
|
||||||
wxFileName fn = aLibraryPath;
|
wxFileName fn = aLibraryPath;
|
||||||
|
@ -2258,7 +2258,7 @@ bool SCH_IO_KICAD_LEGACY::CanReadLibrary( const wxString& aFileName ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SCH_IO_KICAD_LEGACY::IsSymbolLibWritable( const wxString& aLibraryPath )
|
bool SCH_IO_KICAD_LEGACY::IsLibraryWritable( const wxString& aLibraryPath )
|
||||||
{
|
{
|
||||||
// Writing legacy symbol libraries is deprecated.
|
// Writing legacy symbol libraries is deprecated.
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -127,14 +127,14 @@ public:
|
||||||
const STRING_UTF8_MAP* aProperties = nullptr ) override;
|
const STRING_UTF8_MAP* aProperties = nullptr ) override;
|
||||||
void DeleteSymbol( const wxString& aLibraryPath, const wxString& aSymbolName,
|
void DeleteSymbol( const wxString& aLibraryPath, const wxString& aSymbolName,
|
||||||
const STRING_UTF8_MAP* aProperties = nullptr ) override;
|
const STRING_UTF8_MAP* aProperties = nullptr ) override;
|
||||||
void CreateSymbolLib( const wxString& aLibraryPath,
|
void CreateLibrary( const wxString& aLibraryPath,
|
||||||
const STRING_UTF8_MAP* aProperties = nullptr ) override;
|
const STRING_UTF8_MAP* aProperties = nullptr ) override;
|
||||||
bool DeleteSymbolLib( const wxString& aLibraryPath,
|
bool DeleteLibrary( const wxString& aLibraryPath,
|
||||||
const STRING_UTF8_MAP* aProperties = nullptr ) override;
|
const STRING_UTF8_MAP* aProperties = nullptr ) override;
|
||||||
void SaveLibrary( const wxString& aLibraryPath,
|
void SaveLibrary( const wxString& aLibraryPath,
|
||||||
const STRING_UTF8_MAP* aProperties = nullptr ) override;
|
const STRING_UTF8_MAP* aProperties = nullptr ) override;
|
||||||
|
|
||||||
bool IsSymbolLibWritable( const wxString& aLibraryPath ) override;
|
bool IsLibraryWritable( const wxString& aLibraryPath ) override;
|
||||||
|
|
||||||
const wxString& GetError() const override { return m_error; }
|
const wxString& GetError() const override { return m_error; }
|
||||||
|
|
||||||
|
|
|
@ -1535,7 +1535,7 @@ void SCH_IO_KICAD_SEXPR::DeleteSymbol( const wxString& aLibraryPath, const wxStr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_IO_KICAD_SEXPR::CreateSymbolLib( const wxString& aLibraryPath,
|
void SCH_IO_KICAD_SEXPR::CreateLibrary( const wxString& aLibraryPath,
|
||||||
const STRING_UTF8_MAP* aProperties )
|
const STRING_UTF8_MAP* aProperties )
|
||||||
{
|
{
|
||||||
if( wxFileExists( aLibraryPath ) )
|
if( wxFileExists( aLibraryPath ) )
|
||||||
|
@ -1554,7 +1554,7 @@ void SCH_IO_KICAD_SEXPR::CreateSymbolLib( const wxString& aLibraryPath,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SCH_IO_KICAD_SEXPR::DeleteSymbolLib( const wxString& aLibraryPath,
|
bool SCH_IO_KICAD_SEXPR::DeleteLibrary( const wxString& aLibraryPath,
|
||||||
const STRING_UTF8_MAP* aProperties )
|
const STRING_UTF8_MAP* aProperties )
|
||||||
{
|
{
|
||||||
wxFileName fn = aLibraryPath;
|
wxFileName fn = aLibraryPath;
|
||||||
|
@ -1599,7 +1599,7 @@ void SCH_IO_KICAD_SEXPR::SaveLibrary( const wxString& aLibraryPath, const STRING
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SCH_IO_KICAD_SEXPR::IsSymbolLibWritable( const wxString& aLibraryPath )
|
bool SCH_IO_KICAD_SEXPR::IsLibraryWritable( const wxString& aLibraryPath )
|
||||||
{
|
{
|
||||||
wxFileName fn( aLibraryPath );
|
wxFileName fn( aLibraryPath );
|
||||||
|
|
||||||
|
|
|
@ -117,14 +117,14 @@ public:
|
||||||
const STRING_UTF8_MAP* aProperties = nullptr ) override;
|
const STRING_UTF8_MAP* aProperties = nullptr ) override;
|
||||||
void DeleteSymbol( const wxString& aLibraryPath, const wxString& aSymbolName,
|
void DeleteSymbol( const wxString& aLibraryPath, const wxString& aSymbolName,
|
||||||
const STRING_UTF8_MAP* aProperties = nullptr ) override;
|
const STRING_UTF8_MAP* aProperties = nullptr ) override;
|
||||||
void CreateSymbolLib( const wxString& aLibraryPath,
|
void CreateLibrary( const wxString& aLibraryPath,
|
||||||
const STRING_UTF8_MAP* aProperties = nullptr ) override;
|
const STRING_UTF8_MAP* aProperties = nullptr ) override;
|
||||||
bool DeleteSymbolLib( const wxString& aLibraryPath,
|
bool DeleteLibrary( const wxString& aLibraryPath,
|
||||||
const STRING_UTF8_MAP* aProperties = nullptr ) override;
|
const STRING_UTF8_MAP* aProperties = nullptr ) override;
|
||||||
void SaveLibrary( const wxString& aLibraryPath,
|
void SaveLibrary( const wxString& aLibraryPath,
|
||||||
const STRING_UTF8_MAP* aProperties = nullptr ) override;
|
const STRING_UTF8_MAP* aProperties = nullptr ) override;
|
||||||
|
|
||||||
bool IsSymbolLibWritable( const wxString& aLibraryPath ) override;
|
bool IsLibraryWritable( const wxString& aLibraryPath ) override;
|
||||||
|
|
||||||
void GetAvailableSymbolFields( std::vector<wxString>& aNames ) override;
|
void GetAvailableSymbolFields( std::vector<wxString>& aNames ) override;
|
||||||
void GetDefaultSymbolFields( std::vector<wxString>& aNames ) override;
|
void GetDefaultSymbolFields( std::vector<wxString>& aNames ) override;
|
||||||
|
|
|
@ -179,29 +179,11 @@ void SCH_IO::DeleteSymbol( const wxString& aLibraryPath, const wxString& aSymbol
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_IO::CreateSymbolLib( const wxString& aLibraryPath, const STRING_UTF8_MAP* aProperties )
|
void SCH_IO::GetLibraryOptions( STRING_UTF8_MAP* aListToAppendTo ) const
|
||||||
{
|
{
|
||||||
// not pure virtual so that plugins only have to implement subset of the SCH_IO interface.
|
// Get base options first
|
||||||
NOT_IMPLEMENTED( __FUNCTION__ );
|
IO_BASE::GetLibraryOptions( aListToAppendTo );
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool SCH_IO::DeleteSymbolLib( const wxString& aLibraryPath, const STRING_UTF8_MAP* aProperties )
|
|
||||||
{
|
|
||||||
// not pure virtual so that plugins only have to implement subset of the SCH_IO interface.
|
|
||||||
NOT_IMPLEMENTED( __FUNCTION__ );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool SCH_IO::IsSymbolLibWritable( const wxString& aLibraryPath )
|
|
||||||
{
|
|
||||||
// not pure virtual so that plugins only have to implement subset of the SCH_IO interface.
|
|
||||||
NOT_IMPLEMENTED( __FUNCTION__ );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void SCH_IO::SymbolLibOptions( STRING_UTF8_MAP* aListToAppendTo ) const
|
|
||||||
{
|
|
||||||
// Empty for most plugins
|
// Empty for most plugins
|
||||||
//
|
//
|
||||||
// To add a new option override and use example code below:
|
// To add a new option override and use example code below:
|
||||||
|
|
|
@ -76,11 +76,7 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual bool CanReadSchematicFile( const wxString& aFileName ) const;
|
virtual bool CanReadSchematicFile( const wxString& aFileName ) const;
|
||||||
|
|
||||||
/**
|
bool CanReadLibrary( const wxString& aFileName ) const override;
|
||||||
* Checks if this SCH_IO can read the specified symbol library file.
|
|
||||||
* If not overriden, extension check is used.
|
|
||||||
*/
|
|
||||||
virtual bool CanReadLibrary( const wxString& aFileName ) const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the modification hash from the library cache.
|
* Return the modification hash from the library cache.
|
||||||
|
@ -267,57 +263,6 @@ public:
|
||||||
virtual void DeleteSymbol( const wxString& aLibraryPath, const wxString& aSymbolName,
|
virtual void DeleteSymbol( const wxString& aLibraryPath, const wxString& aSymbolName,
|
||||||
const STRING_UTF8_MAP* aProperties = nullptr );
|
const STRING_UTF8_MAP* aProperties = nullptr );
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new empty symbol library at \a aLibraryPath. It is an error to attempt
|
|
||||||
* to create an existing library or to attempt to create on a "read only" location.
|
|
||||||
*
|
|
||||||
* @param aLibraryPath is a locator for the "library", usually a directory, file,
|
|
||||||
* or URL containing several footprints.
|
|
||||||
*
|
|
||||||
* @param aProperties is an associative array that can be used to tell the library
|
|
||||||
* create function anything special, because it can take any number
|
|
||||||
* of additional named 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.
|
|
||||||
*
|
|
||||||
* @throw IO_ERROR if there is a problem finding the library, or creating it.
|
|
||||||
*/
|
|
||||||
virtual void CreateSymbolLib( const wxString& aLibraryPath,
|
|
||||||
const STRING_UTF8_MAP* aProperties = nullptr );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Delete an existing symbol library and returns true if successful, or if library
|
|
||||||
* does not exist returns false, or throws an exception if library exists but is read
|
|
||||||
* only or cannot be deleted for some other reason.
|
|
||||||
*
|
|
||||||
* @param aLibraryPath is a locator for the "library", usually a directory or file
|
|
||||||
* which will contain symbols.
|
|
||||||
*
|
|
||||||
* @param aProperties is an associative array that can be used to tell the library
|
|
||||||
* delete implementation function anything special, because it can
|
|
||||||
* take any number of additional named 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.
|
|
||||||
*
|
|
||||||
* @return true if library deleted or false if library did not exist.
|
|
||||||
*
|
|
||||||
* @throw IO_ERROR if there is a problem deleting an existing library.
|
|
||||||
*/
|
|
||||||
virtual bool DeleteSymbolLib( const wxString& aLibraryPath,
|
|
||||||
const STRING_UTF8_MAP* aProperties = nullptr );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return true if the library at \a aLibraryPath is writable. (Often
|
|
||||||
* system libraries are read only because of where they are installed.)
|
|
||||||
*
|
|
||||||
* @param aLibraryPath is a locator for the "library", usually a directory, file,
|
|
||||||
* or URL containing several symbols.
|
|
||||||
*
|
|
||||||
* @throw IO_ERROR if no library at aLibraryPath exists.
|
|
||||||
*/
|
|
||||||
virtual bool IsSymbolLibWritable( const wxString& aLibraryPath );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append supported #SCH_IO options to \a aListToAppenTo along with internationalized
|
* Append supported #SCH_IO options to \a aListToAppenTo along with internationalized
|
||||||
* descriptions. Options are typically appended so that a derived SCH_IO can call
|
* descriptions. Options are typically appended so that a derived SCH_IO can call
|
||||||
|
@ -342,7 +287,7 @@ public:
|
||||||
* This would require a 3 column list, and introducing wx GUI knowledge to
|
* This would require a 3 column list, and introducing wx GUI knowledge to
|
||||||
* #SCH_IO, which has been avoided to date.
|
* #SCH_IO, which has been avoided to date.
|
||||||
*/
|
*/
|
||||||
virtual void SymbolLibOptions( STRING_UTF8_MAP* aListToAppendTo ) const;
|
virtual void GetLibraryOptions( STRING_UTF8_MAP* aListToAppendTo ) const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true if this plugin supports libraries that contain sub-libraries.
|
* @return true if this plugin supports libraries that contain sub-libraries.
|
||||||
|
|
|
@ -215,7 +215,7 @@ void SYMBOL_EDIT_FRAME::ExportSymbol()
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if( !fn.FileExists() )
|
if( !fn.FileExists() )
|
||||||
pi->CreateSymbolLib( fn.GetFullPath() );
|
pi->CreateLibrary( fn.GetFullPath() );
|
||||||
|
|
||||||
// The flattened symbol is most likely what the user would want. As some point in
|
// The flattened symbol is most likely what the user would want. As some point in
|
||||||
// the future as more of the symbol library inheritance is implemented, this may have
|
// the future as more of the symbol library inheritance is implemented, this may have
|
||||||
|
|
|
@ -446,7 +446,7 @@ SYMBOL_LIB_TABLE::SAVE_T SYMBOL_LIB_TABLE::SaveSymbol( const wxString& aNickname
|
||||||
const SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname, true );
|
const SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname, true );
|
||||||
wxCHECK( row && row->plugin, SAVE_SKIPPED );
|
wxCHECK( row && row->plugin, SAVE_SKIPPED );
|
||||||
|
|
||||||
if( !row->plugin->IsSymbolLibWritable( row->GetFullURI( true ) ) )
|
if( !row->plugin->IsLibraryWritable( row->GetFullURI( true ) ) )
|
||||||
return SAVE_SKIPPED;
|
return SAVE_SKIPPED;
|
||||||
|
|
||||||
if( !aOverwrite )
|
if( !aOverwrite )
|
||||||
|
@ -488,7 +488,7 @@ bool SYMBOL_LIB_TABLE::IsSymbolLibWritable( const wxString& aNickname )
|
||||||
{
|
{
|
||||||
const SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname, true );
|
const SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname, true );
|
||||||
wxCHECK( row && row->plugin, false );
|
wxCHECK( row && row->plugin, false );
|
||||||
return row->plugin->IsSymbolLibWritable( row->GetFullURI( true ) );
|
return row->plugin->IsLibraryWritable( row->GetFullURI( true ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SYMBOL_LIB_TABLE::IsSymbolLibLoaded( const wxString& aNickname )
|
bool SYMBOL_LIB_TABLE::IsSymbolLibLoaded( const wxString& aNickname )
|
||||||
|
@ -503,7 +503,7 @@ void SYMBOL_LIB_TABLE::DeleteSymbolLib( const wxString& aNickname )
|
||||||
{
|
{
|
||||||
const SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname, true );
|
const SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname, true );
|
||||||
wxCHECK( row && row->plugin, /* void */ );
|
wxCHECK( row && row->plugin, /* void */ );
|
||||||
row->plugin->DeleteSymbolLib( row->GetFullURI( true ), row->GetProperties() );
|
row->plugin->DeleteLibrary( row->GetFullURI( true ), row->GetProperties() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -511,7 +511,7 @@ void SYMBOL_LIB_TABLE::CreateSymbolLib( const wxString& aNickname )
|
||||||
{
|
{
|
||||||
const SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname, true );
|
const SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname, true );
|
||||||
wxCHECK( row && row->plugin, /* void */ );
|
wxCHECK( row && row->plugin, /* void */ );
|
||||||
row->plugin->CreateSymbolLib( row->GetFullURI( true ), row->GetProperties() );
|
row->plugin->CreateLibrary( row->GetFullURI( true ), row->GetProperties() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ void SYMBOL_LIB::Create( const wxString& aFileName )
|
||||||
if( !aFileName.IsEmpty() )
|
if( !aFileName.IsEmpty() )
|
||||||
tmpFileName = aFileName;
|
tmpFileName = aFileName;
|
||||||
|
|
||||||
m_plugin->CreateSymbolLib( tmpFileName, m_properties.get() );
|
m_plugin->CreateLibrary( tmpFileName, m_properties.get() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
class REPORTER;
|
class REPORTER;
|
||||||
class PROGRESS_REPORTER;
|
class PROGRESS_REPORTER;
|
||||||
|
class STRING_UTF8_MAP;
|
||||||
|
|
||||||
class IO_BASE
|
class IO_BASE
|
||||||
{
|
{
|
||||||
|
@ -47,6 +48,97 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual void SetProgressReporter( PROGRESS_REPORTER* aReporter ) { m_progressReporter = aReporter; }
|
virtual void SetProgressReporter( PROGRESS_REPORTER* aReporter ) { m_progressReporter = aReporter; }
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////
|
||||||
|
// Library-related functions
|
||||||
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if this IO object can read the specified library file/directory.
|
||||||
|
* If not overriden, extension check is used.
|
||||||
|
*
|
||||||
|
* @note This is not a check that the file system object is readable by the user,
|
||||||
|
* but a check that this IO object can parse the given library.
|
||||||
|
*/
|
||||||
|
virtual bool CanReadLibrary( const wxString& aFileName ) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new empty library at @a aLibraryPath empty.
|
||||||
|
*
|
||||||
|
* It is an error to attempt to create an existing library or to attempt to create
|
||||||
|
* on a "read only" location.
|
||||||
|
*
|
||||||
|
* @param aLibraryPath is a locator for the "library", usually a directory, file, or URL
|
||||||
|
* containing several elements.
|
||||||
|
* @param aProperties is an associative array that can be used to tell the library create
|
||||||
|
* function anything special, because it can take any number of additional
|
||||||
|
* named tuning arguments that the IO is known to support. The caller
|
||||||
|
* continues to own this object (IO may not delete it), and IOs
|
||||||
|
* should expect it to be optionally NULL.
|
||||||
|
*
|
||||||
|
* @throw IO_ERROR if there is a problem finding the library, or creating it.
|
||||||
|
*/
|
||||||
|
virtual void CreateLibrary( const wxString& aLibraryPath,
|
||||||
|
const STRING_UTF8_MAP* aProperties = nullptr );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete an existing library and returns true, or if library does not
|
||||||
|
* exist returns false, or throws an exception if library exists but is read only or
|
||||||
|
* cannot be deleted for some other reason.
|
||||||
|
*
|
||||||
|
* @param aLibraryPath is a locator for the "library", usually a directory or file which
|
||||||
|
* will contain several elements.
|
||||||
|
* @param aProperties is an associative array that can be used to tell the library delete
|
||||||
|
* implementation function anything special, because it can take any
|
||||||
|
* number of additional named 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.
|
||||||
|
*
|
||||||
|
* @return true if library deleted, false if library did not exist.
|
||||||
|
*
|
||||||
|
* @throw IO_ERROR if there is a problem deleting an existing library.
|
||||||
|
*/
|
||||||
|
virtual bool DeleteLibrary( const wxString& aLibraryPath,
|
||||||
|
const STRING_UTF8_MAP* aProperties = nullptr );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if the library at @a aLibraryPath is writable.
|
||||||
|
*
|
||||||
|
* The system libraries are typically read only because of where they are installed..
|
||||||
|
*
|
||||||
|
* @param aLibraryPath is a locator for the "library", usually a directory, file, or URL
|
||||||
|
* containing several footprints.
|
||||||
|
*
|
||||||
|
* @throw IO_ERROR if no library at aLibraryPath exists.
|
||||||
|
*/
|
||||||
|
virtual bool IsLibraryWritable( const wxString& aLibraryPath );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append supported IO options to \a aListToAppenTo along with internationalized
|
||||||
|
* descriptions. Options are typically appended so that a derived IO_BASE can call
|
||||||
|
* its base class function by the same name first, thus inheriting options declared there.
|
||||||
|
* (Some base class options could pertain to all functions in all derived IOs.)
|
||||||
|
* Note that since aListToAppendTo is a PROPERTIES object, all options
|
||||||
|
* will be unique and last guy wins.
|
||||||
|
*
|
||||||
|
* @param aListToAppendTo holds a tuple of
|
||||||
|
* <dl>
|
||||||
|
* <dt>option</dt>
|
||||||
|
* <dd>This eventually is what shows up into the "options"
|
||||||
|
* field, possibly combined with others.</dd>
|
||||||
|
* <dt>internationalized description</dt>
|
||||||
|
* <dd>The internationalized description is displayed in DIALOG_PLUGIN_OPTIONS.
|
||||||
|
* It may be multi-line and be quite explanatory of the option.</dd>
|
||||||
|
* </dl>
|
||||||
|
* <br>
|
||||||
|
* In the future perhaps \a aListToAppendTo evolves to something capable of also
|
||||||
|
* holding a wxValidator for the cells in said dialog:
|
||||||
|
* http://forums.wxwidgets.org/viewtopic.php?t=23277&p=104180.
|
||||||
|
* This would require a 3 column list, and introducing wx GUI knowledge to
|
||||||
|
* #SCH_IO, which has been avoided to date.
|
||||||
|
*/
|
||||||
|
virtual void GetLibraryOptions( STRING_UTF8_MAP* aListToAppendTo ) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Delete the zero-argument base constructor to force proper construction
|
// Delete the zero-argument base constructor to force proper construction
|
||||||
IO_BASE() = delete;
|
IO_BASE() = delete;
|
||||||
|
|
|
@ -241,7 +241,7 @@ protected:
|
||||||
|
|
||||||
PCB_IO_MGR::PCB_FILE_T pi_type = PCB_IO_MGR::EnumFromStr( row->GetType() );
|
PCB_IO_MGR::PCB_FILE_T pi_type = PCB_IO_MGR::EnumFromStr( row->GetType() );
|
||||||
PCB_IO::RELEASER pi( PCB_IO_MGR::PluginFind( pi_type ) );
|
PCB_IO::RELEASER pi( PCB_IO_MGR::PluginFind( pi_type ) );
|
||||||
pi->FootprintLibOptions( &choices );
|
pi->GetLibraryOptions( &choices );
|
||||||
|
|
||||||
DIALOG_PLUGIN_OPTIONS dlg( m_dialog, row->GetNickName(), choices, options, &result );
|
DIALOG_PLUGIN_OPTIONS dlg( m_dialog, row->GetNickName(), choices, options, &result );
|
||||||
dlg.ShowModal();
|
dlg.ShowModal();
|
||||||
|
|
|
@ -145,7 +145,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Save a library to a new name and/or library type.
|
* Save a library to a new name and/or library type.
|
||||||
*
|
*
|
||||||
* @see #PLUGIN::FootprintSave and #PLUGIN::FootprintLibCreate
|
* @see #PCB_IO::FootprintSave and #IO_BASE::LibraryCreate
|
||||||
*
|
*
|
||||||
* @note Saving as a new library type requires the plug-in to support saving libraries
|
* @note Saving as a new library type requires the plug-in to support saving libraries
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -353,7 +353,7 @@ wxString PCB_BASE_EDIT_FRAME::createNewLibrary( const wxString& aLibName,
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
writable = pi->IsFootprintLibWritable( libPath );
|
writable = pi->IsLibraryWritable( libPath );
|
||||||
exists = true; // no exception was thrown, lib must exist.
|
exists = true; // no exception was thrown, lib must exist.
|
||||||
}
|
}
|
||||||
catch( const IO_ERROR& )
|
catch( const IO_ERROR& )
|
||||||
|
@ -379,11 +379,11 @@ wxString PCB_BASE_EDIT_FRAME::createNewLibrary( const wxString& aLibName,
|
||||||
if( dlg.ShowModal() == wxID_CANCEL )
|
if( dlg.ShowModal() == wxID_CANCEL )
|
||||||
return wxEmptyString;
|
return wxEmptyString;
|
||||||
|
|
||||||
pi->FootprintLibDelete( libPath );
|
pi->DeleteLibrary( libPath );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pi->FootprintLibCreate( libPath );
|
pi->CreateLibrary( libPath );
|
||||||
}
|
}
|
||||||
catch( const IO_ERROR& ioe )
|
catch( const IO_ERROR& ioe )
|
||||||
{
|
{
|
||||||
|
|
|
@ -65,9 +65,9 @@ bool PCB_IO_ALTIUM_DESIGNER::CanReadBoard( const wxString& aFileName ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool PCB_IO_ALTIUM_DESIGNER::CanReadFootprintLib( const wxString& aFileName ) const
|
bool PCB_IO_ALTIUM_DESIGNER::CanReadLibrary( const wxString& aFileName ) const
|
||||||
{
|
{
|
||||||
if( !PCB_IO::CanReadFootprintLib( aFileName ) )
|
if( !PCB_IO::CanReadLibrary( aFileName ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return checkFileHeader( aFileName );
|
return checkFileHeader( aFileName );
|
||||||
|
|
|
@ -51,7 +51,7 @@ public:
|
||||||
PLUGIN_FILE_DESC GetFootprintFileDesc() const override { return GetFootprintLibDesc(); }
|
PLUGIN_FILE_DESC GetFootprintFileDesc() const override { return GetFootprintLibDesc(); }
|
||||||
|
|
||||||
bool CanReadBoard( const wxString& aFileName ) const override;
|
bool CanReadBoard( const wxString& aFileName ) const override;
|
||||||
bool CanReadFootprintLib( const wxString& aFileName ) const override;
|
bool CanReadLibrary( const wxString& aFileName ) const override;
|
||||||
|
|
||||||
BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
|
BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
|
||||||
const STRING_UTF8_MAP* aProperties, PROJECT* aProject = nullptr,
|
const STRING_UTF8_MAP* aProperties, PROJECT* aProject = nullptr,
|
||||||
|
@ -68,7 +68,7 @@ public:
|
||||||
|
|
||||||
//bool FootprintExists( const wxString& aLibraryPath, const wxString& aFootprintName, const PROPERTIES* aProperties = nullptr );
|
//bool FootprintExists( const wxString& aLibraryPath, const wxString& aFootprintName, const PROPERTIES* aProperties = nullptr );
|
||||||
|
|
||||||
bool IsFootprintLibWritable( const wxString& aLibraryPath ) override { return false; }
|
bool IsLibraryWritable( const wxString& aLibraryPath ) override { return false; }
|
||||||
|
|
||||||
// -----</PUBLIC PCB_IO API>-------------------------------------------------
|
// -----</PUBLIC PCB_IO API>-------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -151,9 +151,9 @@ bool PCB_IO_CADSTAR_ARCHIVE::CanReadBoard( const wxString& aFileName ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool PCB_IO_CADSTAR_ARCHIVE::CanReadFootprintLib( const wxString& aFileName ) const
|
bool PCB_IO_CADSTAR_ARCHIVE::CanReadLibrary( const wxString& aFileName ) const
|
||||||
{
|
{
|
||||||
if( !PCB_IO::CanReadFootprintLib( aFileName ) )
|
if( !PCB_IO::CanReadLibrary( aFileName ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return checkBoardHeader( aFileName );
|
return checkBoardHeader( aFileName );
|
||||||
|
|
|
@ -42,7 +42,7 @@ public:
|
||||||
PLUGIN_FILE_DESC GetFootprintFileDesc() const override { return GetFootprintLibDesc(); }
|
PLUGIN_FILE_DESC GetFootprintFileDesc() const override { return GetFootprintLibDesc(); }
|
||||||
|
|
||||||
bool CanReadBoard( const wxString& aFileName ) const override;
|
bool CanReadBoard( const wxString& aFileName ) const override;
|
||||||
bool CanReadFootprintLib( const wxString& aFileName ) const override;
|
bool CanReadLibrary( const wxString& aFileName ) const override;
|
||||||
bool CanReadFootprint( const wxString& aFileName ) const override;
|
bool CanReadFootprint( const wxString& aFileName ) const override;
|
||||||
|
|
||||||
BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
|
BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
|
||||||
|
@ -85,7 +85,7 @@ public:
|
||||||
* CADSTAR Plugin is read-only
|
* CADSTAR Plugin is read-only
|
||||||
* @return Always false
|
* @return Always false
|
||||||
*/
|
*/
|
||||||
bool IsFootprintLibWritable( const wxString& aLibraryPath ) override { return false; }
|
bool IsLibraryWritable( const wxString& aLibraryPath ) override { return false; }
|
||||||
|
|
||||||
PCB_IO_CADSTAR_ARCHIVE();
|
PCB_IO_CADSTAR_ARCHIVE();
|
||||||
~PCB_IO_CADSTAR_ARCHIVE();
|
~PCB_IO_CADSTAR_ARCHIVE();
|
||||||
|
|
|
@ -255,9 +255,9 @@ bool PCB_IO_EAGLE::CanReadBoard( const wxString& aFileName ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool PCB_IO_EAGLE::CanReadFootprintLib( const wxString& aFileName ) const
|
bool PCB_IO_EAGLE::CanReadLibrary( const wxString& aFileName ) const
|
||||||
{
|
{
|
||||||
if( !PCB_IO::CanReadFootprintLib( aFileName ) )
|
if( !PCB_IO::CanReadLibrary( aFileName ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return checkHeader( aFileName );
|
return checkHeader( aFileName );
|
||||||
|
@ -266,7 +266,7 @@ bool PCB_IO_EAGLE::CanReadFootprintLib( const wxString& aFileName ) const
|
||||||
|
|
||||||
bool PCB_IO_EAGLE::CanReadFootprint( const wxString& aFileName ) const
|
bool PCB_IO_EAGLE::CanReadFootprint( const wxString& aFileName ) const
|
||||||
{
|
{
|
||||||
return CanReadFootprintLib( aFileName );
|
return CanReadLibrary( aFileName );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3225,11 +3225,6 @@ FOOTPRINT* PCB_IO_EAGLE::FootprintLoad( const wxString& aLibraryPath,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_IO_EAGLE::FootprintLibOptions( STRING_UTF8_MAP* aListToAppendTo ) const
|
|
||||||
{
|
|
||||||
PCB_IO::FootprintLibOptions( aListToAppendTo );
|
|
||||||
}
|
|
||||||
|
|
||||||
int PCB_IO_EAGLE::getMinimumCopperLayerCount() const
|
int PCB_IO_EAGLE::getMinimumCopperLayerCount() const
|
||||||
{
|
{
|
||||||
int minLayerCount = 2;
|
int minLayerCount = 2;
|
||||||
|
|
|
@ -144,7 +144,7 @@ public:
|
||||||
PLUGIN_FILE_DESC GetFootprintFileDesc() const override { return GetFootprintLibDesc(); }
|
PLUGIN_FILE_DESC GetFootprintFileDesc() const override { return GetFootprintLibDesc(); }
|
||||||
|
|
||||||
bool CanReadBoard( const wxString& aFileName ) const override;
|
bool CanReadBoard( const wxString& aFileName ) const override;
|
||||||
bool CanReadFootprintLib( const wxString& aFileName ) const override;
|
bool CanReadLibrary( const wxString& aFileName ) const override;
|
||||||
bool CanReadFootprint( const wxString& aFileName ) const override;
|
bool CanReadFootprint( const wxString& aFileName ) const override;
|
||||||
|
|
||||||
BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
|
BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
|
||||||
|
@ -165,13 +165,11 @@ public:
|
||||||
return getModificationTime( aLibraryPath ).GetValue().GetValue();
|
return getModificationTime( aLibraryPath ).GetValue().GetValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsFootprintLibWritable( const wxString& aLibraryPath ) override
|
bool IsLibraryWritable( const wxString& aLibraryPath ) override
|
||||||
{
|
{
|
||||||
return false; // until someone writes others like FootprintSave(), etc.
|
return false; // until someone writes others like FootprintSave(), etc.
|
||||||
}
|
}
|
||||||
|
|
||||||
void FootprintLibOptions( STRING_UTF8_MAP* aProperties ) const override;
|
|
||||||
|
|
||||||
typedef int BIU;
|
typedef int BIU;
|
||||||
|
|
||||||
PCB_IO_EAGLE();
|
PCB_IO_EAGLE();
|
||||||
|
|
|
@ -126,7 +126,7 @@ bool PCB_IO_EASYEDA::CanReadFootprint( const wxString& aFileName ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool PCB_IO_EASYEDA::CanReadFootprintLib( const wxString& aFileName ) const
|
bool PCB_IO_EASYEDA::CanReadLibrary( const wxString& aFileName ) const
|
||||||
{
|
{
|
||||||
return CanReadBoard( aFileName );
|
return CanReadBoard( aFileName );
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ public:
|
||||||
|
|
||||||
bool CanReadFootprint( const wxString& aFileName ) const override;
|
bool CanReadFootprint( const wxString& aFileName ) const override;
|
||||||
|
|
||||||
bool CanReadFootprintLib( const wxString& aFileName ) const override;
|
bool CanReadLibrary( const wxString& aFileName ) const override;
|
||||||
|
|
||||||
BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
|
BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
|
||||||
const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr,
|
const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr,
|
||||||
|
@ -63,7 +63,7 @@ public:
|
||||||
bool aKeepUUID = false,
|
bool aKeepUUID = false,
|
||||||
const STRING_UTF8_MAP* aProperties = nullptr ) override;
|
const STRING_UTF8_MAP* aProperties = nullptr ) override;
|
||||||
|
|
||||||
bool IsFootprintLibWritable( const wxString& aLibraryPath ) override { return false; }
|
bool IsLibraryWritable( const wxString& aLibraryPath ) override { return false; }
|
||||||
|
|
||||||
PCB_IO_EASYEDA();
|
PCB_IO_EASYEDA();
|
||||||
~PCB_IO_EASYEDA();
|
~PCB_IO_EASYEDA();
|
||||||
|
|
|
@ -70,7 +70,7 @@ public:
|
||||||
bool aKeepUUID = false,
|
bool aKeepUUID = false,
|
||||||
const STRING_UTF8_MAP* aProperties = nullptr ) override;
|
const STRING_UTF8_MAP* aProperties = nullptr ) override;
|
||||||
|
|
||||||
bool IsFootprintLibWritable( const wxString& aLibraryPath ) override { return false; }
|
bool IsLibraryWritable( const wxString& aLibraryPath ) override { return false; }
|
||||||
|
|
||||||
PCB_IO_EASYEDAPRO();
|
PCB_IO_EASYEDAPRO();
|
||||||
~PCB_IO_EASYEDAPRO();
|
~PCB_IO_EASYEDAPRO();
|
||||||
|
|
|
@ -965,7 +965,7 @@ void PCB_IO_GEDA::FootprintDelete( const wxString& aLibraryPath, const wxString&
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool PCB_IO_GEDA::FootprintLibDelete( const wxString& aLibraryPath, const STRING_UTF8_MAP* aProperties )
|
bool PCB_IO_GEDA::DeleteLibrary( const wxString& aLibraryPath, const STRING_UTF8_MAP* aProperties )
|
||||||
{
|
{
|
||||||
wxFileName fn;
|
wxFileName fn;
|
||||||
fn.SetPath( aLibraryPath );
|
fn.SetPath( aLibraryPath );
|
||||||
|
@ -1049,7 +1049,7 @@ long long PCB_IO_GEDA::GetLibraryTimestamp( const wxString& aLibraryPath ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool PCB_IO_GEDA::IsFootprintLibWritable( const wxString& aLibraryPath )
|
bool PCB_IO_GEDA::IsLibraryWritable( const wxString& aLibraryPath )
|
||||||
{
|
{
|
||||||
LOCALE_IO toggle;
|
LOCALE_IO toggle;
|
||||||
|
|
||||||
|
|
|
@ -76,12 +76,12 @@ public:
|
||||||
void FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName,
|
void FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName,
|
||||||
const STRING_UTF8_MAP* aProperties = nullptr ) override;
|
const STRING_UTF8_MAP* aProperties = nullptr ) override;
|
||||||
|
|
||||||
bool FootprintLibDelete( const wxString& aLibraryPath,
|
bool DeleteLibrary( const wxString& aLibraryPath,
|
||||||
const STRING_UTF8_MAP* aProperties = nullptr ) override;
|
const STRING_UTF8_MAP* aProperties = nullptr ) override;
|
||||||
|
|
||||||
long long GetLibraryTimestamp( const wxString& aLibraryPath ) const override;
|
long long GetLibraryTimestamp( const wxString& aLibraryPath ) const override;
|
||||||
|
|
||||||
bool IsFootprintLibWritable( const wxString& aLibraryPath ) override;
|
bool IsLibraryWritable( const wxString& aLibraryPath ) override;
|
||||||
|
|
||||||
//-----</PLUGIN API>--------------------------------------------------------
|
//-----</PLUGIN API>--------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reading currently disabled
|
// Reading currently disabled
|
||||||
bool CanReadFootprintLib( const wxString& aFileName ) const override
|
bool CanReadLibrary( const wxString& aFileName ) const override
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3245,7 +3245,7 @@ FOOTPRINT* PCB_IO_KICAD_LEGACY::FootprintLoad( const wxString& aLibraryPath,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool PCB_IO_KICAD_LEGACY::FootprintLibDelete( const wxString& aLibraryPath,
|
bool PCB_IO_KICAD_LEGACY::DeleteLibrary( const wxString& aLibraryPath,
|
||||||
const STRING_UTF8_MAP* aProperties )
|
const STRING_UTF8_MAP* aProperties )
|
||||||
{
|
{
|
||||||
wxFileName fn = aLibraryPath;
|
wxFileName fn = aLibraryPath;
|
||||||
|
@ -3271,7 +3271,7 @@ bool PCB_IO_KICAD_LEGACY::FootprintLibDelete( const wxString& aLibraryPath,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool PCB_IO_KICAD_LEGACY::IsFootprintLibWritable( const wxString& aLibraryPath )
|
bool PCB_IO_KICAD_LEGACY::IsLibraryWritable( const wxString& aLibraryPath )
|
||||||
{
|
{
|
||||||
#if 0 // no support for 32 Cu layers in legacy format
|
#if 0 // no support for 32 Cu layers in legacy format
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -93,12 +93,12 @@ public:
|
||||||
bool aKeepUUID = false,
|
bool aKeepUUID = false,
|
||||||
const STRING_UTF8_MAP* aProperties = nullptr ) override;
|
const STRING_UTF8_MAP* aProperties = nullptr ) override;
|
||||||
|
|
||||||
bool FootprintLibDelete( const wxString& aLibraryPath,
|
bool DeleteLibrary( const wxString& aLibraryPath,
|
||||||
const STRING_UTF8_MAP* aProperties = nullptr ) override;
|
const STRING_UTF8_MAP* aProperties = nullptr ) override;
|
||||||
|
|
||||||
long long GetLibraryTimestamp( const wxString& aLibraryPath ) const override;
|
long long GetLibraryTimestamp( const wxString& aLibraryPath ) const override;
|
||||||
|
|
||||||
bool IsFootprintLibWritable( const wxString& aLibraryPath ) override;
|
bool IsLibraryWritable( const wxString& aLibraryPath ) override;
|
||||||
|
|
||||||
typedef int BIU;
|
typedef int BIU;
|
||||||
|
|
||||||
|
|
|
@ -2746,7 +2746,7 @@ long long PCB_IO_KICAD_SEXPR::GetLibraryTimestamp( const wxString& aLibraryPath
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_IO_KICAD_SEXPR::FootprintLibCreate( const wxString& aLibraryPath, const STRING_UTF8_MAP* aProperties )
|
void PCB_IO_KICAD_SEXPR::CreateLibrary( const wxString& aLibraryPath, const STRING_UTF8_MAP* aProperties )
|
||||||
{
|
{
|
||||||
if( wxDir::Exists( aLibraryPath ) )
|
if( wxDir::Exists( aLibraryPath ) )
|
||||||
{
|
{
|
||||||
|
@ -2764,7 +2764,7 @@ void PCB_IO_KICAD_SEXPR::FootprintLibCreate( const wxString& aLibraryPath, const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool PCB_IO_KICAD_SEXPR::FootprintLibDelete( const wxString& aLibraryPath, const STRING_UTF8_MAP* aProperties )
|
bool PCB_IO_KICAD_SEXPR::DeleteLibrary( const wxString& aLibraryPath, const STRING_UTF8_MAP* aProperties )
|
||||||
{
|
{
|
||||||
wxFileName fn;
|
wxFileName fn;
|
||||||
fn.SetPath( aLibraryPath );
|
fn.SetPath( aLibraryPath );
|
||||||
|
@ -2841,7 +2841,7 @@ bool PCB_IO_KICAD_SEXPR::FootprintLibDelete( const wxString& aLibraryPath, const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool PCB_IO_KICAD_SEXPR::IsFootprintLibWritable( const wxString& aLibraryPath )
|
bool PCB_IO_KICAD_SEXPR::IsLibraryWritable( const wxString& aLibraryPath )
|
||||||
{
|
{
|
||||||
LOCALE_IO toggle;
|
LOCALE_IO toggle;
|
||||||
|
|
||||||
|
|
|
@ -340,13 +340,13 @@ public:
|
||||||
|
|
||||||
long long GetLibraryTimestamp( const wxString& aLibraryPath ) const override;
|
long long GetLibraryTimestamp( const wxString& aLibraryPath ) const override;
|
||||||
|
|
||||||
void FootprintLibCreate( const wxString& aLibraryPath,
|
void CreateLibrary( const wxString& aLibraryPath,
|
||||||
const STRING_UTF8_MAP* aProperties = nullptr) override;
|
const STRING_UTF8_MAP* aProperties = nullptr) override;
|
||||||
|
|
||||||
bool FootprintLibDelete( const wxString& aLibraryPath,
|
bool DeleteLibrary( const wxString& aLibraryPath,
|
||||||
const STRING_UTF8_MAP* aProperties = nullptr ) override;
|
const STRING_UTF8_MAP* aProperties = nullptr ) override;
|
||||||
|
|
||||||
bool IsFootprintLibWritable( const wxString& aLibraryPath ) override;
|
bool IsLibraryWritable( const wxString& aLibraryPath ) override;
|
||||||
|
|
||||||
PCB_IO_KICAD_SEXPR( int aControlFlags = CTL_FOR_BOARD );
|
PCB_IO_KICAD_SEXPR( int aControlFlags = CTL_FOR_BOARD );
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ bool PCB_IO::CanReadFootprint( const wxString& aFileName ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool PCB_IO::CanReadFootprintLib( const wxString& aFileName ) const
|
bool PCB_IO::CanReadLibrary( const wxString& aFileName ) const
|
||||||
{
|
{
|
||||||
const PLUGIN_FILE_DESC& desc = GetFootprintLibDesc();
|
const PLUGIN_FILE_DESC& desc = GetFootprintLibDesc();
|
||||||
|
|
||||||
|
@ -239,29 +239,11 @@ void PCB_IO::FootprintDelete( const wxString& aLibraryPath, const wxString& aFoo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_IO::FootprintLibCreate( const wxString& aLibraryPath, const STRING_UTF8_MAP* aProperties )
|
void PCB_IO::GetLibraryOptions( STRING_UTF8_MAP* aListToAppendTo ) const
|
||||||
{
|
{
|
||||||
// not pure virtual so that plugins only have to implement subset of the PLUGIN interface.
|
// Get base options first
|
||||||
NOT_IMPLEMENTED( __FUNCTION__ );
|
IO_BASE::GetLibraryOptions( aListToAppendTo );
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool PCB_IO::FootprintLibDelete( const wxString& aLibraryPath, const STRING_UTF8_MAP* aProperties )
|
|
||||||
{
|
|
||||||
// not pure virtual so that plugins only have to implement subset of the PLUGIN interface.
|
|
||||||
NOT_IMPLEMENTED( __FUNCTION__ );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool PCB_IO::IsFootprintLibWritable( const wxString& aLibraryPath )
|
|
||||||
{
|
|
||||||
// not pure virtual so that plugins only have to implement subset of the PLUGIN interface.
|
|
||||||
NOT_IMPLEMENTED( __FUNCTION__ );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PCB_IO::FootprintLibOptions( STRING_UTF8_MAP* aListToAppendTo ) const
|
|
||||||
{
|
|
||||||
// disable all these in another couple of months, after everyone has seen them:
|
// disable all these in another couple of months, after everyone has seen them:
|
||||||
#if 1
|
#if 1
|
||||||
(*aListToAppendTo)["debug_level"] = UTF8( _( "Enable <b>debug</b> logging for Footprint*() "
|
(*aListToAppendTo)["debug_level"] = UTF8( _( "Enable <b>debug</b> logging for Footprint*() "
|
||||||
|
|
|
@ -103,7 +103,7 @@ public:
|
||||||
* Checks if this PCB_IO can read footprint library from specified file or directory.
|
* Checks if this PCB_IO can read footprint library from specified file or directory.
|
||||||
* If not overriden, extension check is used.
|
* If not overriden, extension check is used.
|
||||||
*/
|
*/
|
||||||
virtual bool CanReadFootprintLib( const wxString& aFileName ) const;
|
bool CanReadLibrary( const wxString& aFileName ) const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers a KIDIALOG callback for collecting info from the user.
|
* Registers a KIDIALOG callback for collecting info from the user.
|
||||||
|
@ -319,56 +319,6 @@ public:
|
||||||
virtual void FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName,
|
virtual void FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName,
|
||||||
const STRING_UTF8_MAP* aProperties = nullptr );
|
const STRING_UTF8_MAP* aProperties = nullptr );
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new empty footprint library at @a aLibraryPath empty.
|
|
||||||
*
|
|
||||||
* It is an error to attempt to create an existing library or to attempt to create
|
|
||||||
* on a "read only" location.
|
|
||||||
*
|
|
||||||
* @param aLibraryPath is a locator for the "library", usually a directory, file, or URL
|
|
||||||
* containing several footprints.
|
|
||||||
* @param aProperties is an associative array that can be used to tell the library create
|
|
||||||
* function anything special, because it can take any number of additional
|
|
||||||
* named 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.
|
|
||||||
*
|
|
||||||
* @throw IO_ERROR if there is a problem finding the library, or creating it.
|
|
||||||
*/
|
|
||||||
virtual void FootprintLibCreate( const wxString& aLibraryPath,
|
|
||||||
const STRING_UTF8_MAP* aProperties = nullptr );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Delete an existing footprint library and returns true, or if library does not
|
|
||||||
* exist returns false, or throws an exception if library exists but is read only or
|
|
||||||
* cannot be deleted for some other reason.
|
|
||||||
*
|
|
||||||
* @param aLibraryPath is a locator for the "library", usually a directory or file which
|
|
||||||
* will contain footprints.
|
|
||||||
* @param aProperties is an associative array that can be used to tell the library delete
|
|
||||||
* implementation function anything special, because it can take any
|
|
||||||
* number of additional named 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.
|
|
||||||
* @return true if library deleted, false if library did not exist.
|
|
||||||
*
|
|
||||||
* @throw IO_ERROR if there is a problem deleting an existing library.
|
|
||||||
*/
|
|
||||||
virtual bool FootprintLibDelete( const wxString& aLibraryPath,
|
|
||||||
const STRING_UTF8_MAP* aProperties = nullptr );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return true if the library at @a aLibraryPath is writable.
|
|
||||||
*
|
|
||||||
* The system libraries are typically read only because of where they are installed..
|
|
||||||
*
|
|
||||||
* @param aLibraryPath is a locator for the "library", usually a directory, file, or URL
|
|
||||||
* containing several footprints.
|
|
||||||
*
|
|
||||||
* @throw IO_ERROR if no library at aLibraryPath exists.
|
|
||||||
*/
|
|
||||||
virtual bool IsFootprintLibWritable( const wxString& aLibraryPath );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append supported PLUGIN options to @a aListToAppenTo along with internationalized
|
* Append supported PLUGIN options to @a aListToAppenTo along with internationalized
|
||||||
* descriptions.
|
* descriptions.
|
||||||
|
@ -396,7 +346,7 @@ public:
|
||||||
* This would require a 3 column list, and introducing wx GUI knowledge to
|
* This would require a 3 column list, and introducing wx GUI knowledge to
|
||||||
* PLUGIN, which has been avoided to date.
|
* PLUGIN, which has been avoided to date.
|
||||||
*/
|
*/
|
||||||
virtual void FootprintLibOptions( STRING_UTF8_MAP* aListToAppendTo ) const;
|
virtual void GetLibraryOptions( STRING_UTF8_MAP* aListToAppendTo ) const override;
|
||||||
|
|
||||||
virtual ~PCB_IO()
|
virtual ~PCB_IO()
|
||||||
{};
|
{};
|
||||||
|
|
|
@ -155,7 +155,7 @@ PCB_IO_MGR::PCB_FILE_T PCB_IO_MGR::GuessPluginTypeFromLibPath( const wxString& a
|
||||||
|
|
||||||
PCB_IO::RELEASER pi( plugin.m_createFunc() );
|
PCB_IO::RELEASER pi( plugin.m_createFunc() );
|
||||||
|
|
||||||
if( pi->CanReadFootprintLib( aLibPath ) )
|
if( pi->CanReadLibrary( aLibPath ) )
|
||||||
return plugin.m_type;
|
return plugin.m_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,6 @@ dst_type = IO_MGR.GuessPluginTypeFromLibPath( lib_name );
|
||||||
dst_plugin = IO_MGR.PluginFind( dst_type )
|
dst_plugin = IO_MGR.PluginFind( dst_type )
|
||||||
|
|
||||||
if os.path.exists(lib_name) == False:
|
if os.path.exists(lib_name) == False:
|
||||||
dst_plugin.FootprintLibCreate(lib_name)
|
dst_plugin.CreateLibrary(lib_name)
|
||||||
|
|
||||||
dst_plugin.FootprintSave(lib_name,module)
|
dst_plugin.FootprintSave(lib_name,module)
|
||||||
|
|
|
@ -124,6 +124,18 @@
|
||||||
%{
|
%{
|
||||||
def FootprintEnumerate(self, libname):
|
def FootprintEnumerate(self, libname):
|
||||||
return self.footprintPyEnumerate( libname, True )
|
return self.footprintPyEnumerate( libname, True )
|
||||||
|
|
||||||
|
# Old function name for compatibility with pre-v8 scripts, use CreateLibrary() for new scripts.
|
||||||
|
def FootprintLibCreate(self, aLibraryPath, aProperties=None):
|
||||||
|
self.CreateLibrary(aLibraryPath, aProperties)
|
||||||
|
|
||||||
|
# Old function name for compatibility with pre-v8 scripts, use DeleteLibrary() for new scripts.
|
||||||
|
def FootprintLibDelete(self, aLibraryPath, aProperties=None):
|
||||||
|
return self.DeleteLibrary(aLibraryPath, aProperties)
|
||||||
|
|
||||||
|
# Old function name for compatibility with pre-v8 scripts, use IsLibraryWritable() for new scripts.
|
||||||
|
def IsFootprintLibWritable(self, aLibraryPath):
|
||||||
|
return self.IsLibraryWritable(aLibraryPath)
|
||||||
%}
|
%}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,11 +163,11 @@
|
||||||
|
|
||||||
def FootprintLibCreate(libname):
|
def FootprintLibCreate(libname):
|
||||||
plug = GetPluginForPath(libname)
|
plug = GetPluginForPath(libname)
|
||||||
plug.FootprintLibCreate(libname)
|
plug.CreateLibrary(libname)
|
||||||
|
|
||||||
def FootprintLibDelete(libname):
|
def FootprintLibDelete(libname):
|
||||||
plug = GetPluginForPath(libname)
|
plug = GetPluginForPath(libname)
|
||||||
plug.FootprintLibDelete(libname)
|
plug.DeleteLibrary(libname)
|
||||||
|
|
||||||
def FootprintIsWritable(libname):
|
def FootprintIsWritable(libname):
|
||||||
plug = GetPluginForPath(libname)
|
plug = GetPluginForPath(libname)
|
||||||
|
|
|
@ -28,11 +28,11 @@ src_plugin = IO_MGR.PluginFind( src_type )
|
||||||
dst_plugin = IO_MGR.PluginFind( dst_type )
|
dst_plugin = IO_MGR.PluginFind( dst_type )
|
||||||
|
|
||||||
try:
|
try:
|
||||||
dst_plugin.FootprintLibDelete( dst_libpath )
|
dst_plugin.DeleteLibrary( dst_libpath )
|
||||||
except:
|
except:
|
||||||
None # ignore, new may not exist if first run
|
None # ignore, new may not exist if first run
|
||||||
|
|
||||||
dst_plugin.FootprintLibCreate( dst_libpath )
|
dst_plugin.CreateLibrary( dst_libpath )
|
||||||
|
|
||||||
list_of_parts = src_plugin.FootprintEnumerate( src_libpath )
|
list_of_parts = src_plugin.FootprintEnumerate( src_libpath )
|
||||||
|
|
||||||
|
|
|
@ -27,20 +27,20 @@ plugin = IO_MGR.PluginFind( IO_MGR.KICAD_SEXP )
|
||||||
print( "Plugin Type: %s" % plugin.PluginName() )
|
print( "Plugin Type: %s" % plugin.PluginName() )
|
||||||
|
|
||||||
try:
|
try:
|
||||||
plugin.FootprintLibDelete( lib_path1 )
|
plugin.DeleteLibrary( lib_path1 )
|
||||||
except:
|
except:
|
||||||
pass # ignore, new may not exist if first run
|
pass # ignore, new may not exist if first run
|
||||||
|
|
||||||
try:
|
try:
|
||||||
plugin.FootprintLibDelete( lib_path2 )
|
plugin.DeleteLibrary( lib_path2 )
|
||||||
except:
|
except:
|
||||||
pass # ignore, new may not exist if first run
|
pass # ignore, new may not exist if first run
|
||||||
|
|
||||||
plugin.FootprintLibCreate( lib_path1 )
|
plugin.CreateLibrary( lib_path1 )
|
||||||
|
|
||||||
# Verify that the same plugin instance can edge trigger on a lib_path change
|
# Verify that the same plugin instance can edge trigger on a lib_path change
|
||||||
# for a FootprintLibCreate()
|
# for a CreateLibrary()
|
||||||
plugin.FootprintLibCreate( lib_path2 )
|
plugin.CreateLibrary( lib_path2 )
|
||||||
|
|
||||||
board = BOARD()
|
board = BOARD()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue