23#include <wx/filename.h>
38#define FMT_UNIMPLEMENTED _( "Plugin \"%s\" does not implement the \"%s\" function." )
39#define FMT_NOTFOUND _( "Plugin type \"%s\" is not found." )
55SCH_PLUGIN* SCH_IO_MGR::FindPlugin( SCH_FILE_T aFileType )
69 default:
return nullptr;
92 case SCH_LEGACY:
return wxString( wxT(
"Legacy" ) );
93 case SCH_KICAD:
return wxString( wxT(
"KiCad" ) );
94 case SCH_ALTIUM:
return wxString( wxT(
"Altium" ) );
95 case SCH_CADSTAR_ARCHIVE:
return wxString( wxT(
"CADSTAR Schematic Archive" ) );
96 case SCH_EAGLE:
return wxString( wxT(
"EAGLE" ) );
97 case SCH_DATABASE:
return wxString( wxT(
"Database" ) );
98 case SCH_LTSPICE:
return wxString( wxT(
"LTSpice Schematic" ) );
99 default:
return wxString::Format(
_(
"Unknown SCH_FILE_T value: %d" ),
111 if( aType == wxT(
"Legacy" ) )
113 else if( aType == wxT(
"KiCad" ) )
115 else if( aType == wxT(
"Altium" ) )
117 else if( aType == wxT(
"CADSTAR Schematic Archive" ) )
118 return SCH_CADSTAR_ARCHIVE;
119 else if( aType == wxT(
"EAGLE" ) )
121 else if( aType == wxT(
"Database" ) )
126 return SCH_FILE_T( -1 );
132 wxString ext = wxEmptyString;
135 if( plugin !=
nullptr )
147 wxString ext = wxEmptyString;
150 if( plugin !=
nullptr )
162 SCH_FILE_T ret = SCH_KICAD;
163 wxFileName fn( aLibPath );
164 wxString ext = fn.GetExt().Lower();
173 if( !wxFileExists( fullName ) )
176 for( SCH_FILE_T pluginType : { SCH_LEGACY, SCH_CADSTAR_ARCHIVE } )
191 for( SCH_IO_MGR::SCH_FILE_T piType : SCH_IO_MGR::SCH_FILE_T_vector )
206 SCH_FILE_T ret = SCH_KICAD;
207 wxFileName fn( aSchematicPath );
SCH_ALTIUM_PLUGIN is a SCH_PLUGIN derivation for loading Altium .SchDoc schematic files.
A KiCad database library provides both symbol and footprint metadata, so there are "shim" plugins on ...
A SCH_PLUGIN derivation for loading 6.x+ Eagle schematic files.
static SCH_FILE_T EnumFromStr(const wxString &aFileType)
Return the #SCH_FILE_T from the corresponding plugin type name: "kicad", "legacy",...
static const wxString GetFileExtension(SCH_FILE_T aFileType)
Return the schematic file extension for aFileType.
static const wxString ShowType(SCH_FILE_T aFileType)
Return a brief name for a plugin, given aFileType enum.
static const wxString GetLibraryFileExtension(SCH_FILE_T aFileType)
Return the symbol library file extension (if any) for aFileType.
static void ReleasePlugin(SCH_PLUGIN *aPlugin)
Release a SCH_PLUGIN back to the system, and may cause it to be unloaded from memory.
static SCH_FILE_T GuessPluginTypeFromSchPath(const wxString &aSchematicPath)
Return a plugin type given a schematic using the file extension of aSchematicPath.
static SCH_FILE_T GuessPluginTypeFromLibPath(const wxString &aLibPath)
Return a plugin type given a symbol library using the file extension of aLibPath.
A SCH_PLUGIN derivation for loading schematic files created before the new s-expression file format.
Helper object to release a SCH_PLUGIN in the context of a potential thrown exception through its dest...
Base class that schematic file and library loading and saving plugins should derive from.
virtual const wxString GetLibraryFileExtension() const =0
Return the library file extension for the SCH_PLUGIN object.
virtual const wxString GetFileExtension() const =0
Return the file extension for the SCH_PLUGIN.
virtual bool CheckHeader(const wxString &aFileName)
Return true if the first line in aFileName begins with the expected header.
A SCH_PLUGIN derivation for loading schematic files using the new s-expression file format.
const wxString ExpandEnvVarSubstitutions(const wxString &aString, const PROJECT *aProject)
Replace any environment variable & text variable references with their values.
const std::string LegacySchematicFileExtension
const std::string KiCadSchematicFileExtension
const std::string LegacySymbolLibFileExtension
Definition of file extensions used in Kicad.