105 #define SEXPR_BOARD_FILE_VERSION 20211014 // Arc formatting 107 #define BOARD_FILE_HOST_VERSION 20200825 108 #define LEGACY_ARC_FORMATTING 20210925 110 #define CTL_OMIT_PAD_NETS (1 << 1) 111 #define CTL_OMIT_TSTAMPS (1 << 2) 112 #define CTL_OMIT_INITIAL_COMMENTS (1 << 3) 113 #define CTL_OMIT_PATH (1 << 4) 114 #define CTL_OMIT_AT (1 << 5) 115 //#define CTL_OMIT_HIDE (1 << 6) // found and defined in eda_text.h 117 #define CTL_OMIT_LIBNAME (1 << 7) 118 #define CTL_OMIT_FOOTPRINT_VERSION (1 << 8) 125 #define CTL_FOR_CLIPBOARD (CTL_OMIT_INITIAL_COMMENTS) // (CTL_OMIT_NETS) 128 #define CTL_FOR_LIBRARY \ 129 ( CTL_OMIT_PAD_NETS | CTL_OMIT_TSTAMPS | CTL_OMIT_PATH | CTL_OMIT_AT | CTL_OMIT_LIBNAME ) 133 #define CTL_FOR_BOARD (CTL_OMIT_INITIAL_COMMENTS|CTL_OMIT_FOOTPRINT_VERSION) 146 return wxT(
"KiCad" );
155 return wxT(
"kicad_pcb" );
158 virtual void Save(
const wxString& aFileName,
BOARD* aBoard,
159 const PROPERTIES* aProperties =
nullptr )
override;
168 void FootprintEnumerate( wxArrayString& aFootprintNames,
const wxString& aLibraryPath,
169 bool aBestEfforts,
const PROPERTIES* aProperties =
nullptr )
override;
172 const wxString& aFootprintName,
173 const PROPERTIES* aProperties =
nullptr )
override;
175 bool FootprintExists(
const wxString& aLibraryPath,
const wxString& aFootprintName,
176 const PROPERTIES* aProperties =
nullptr )
override;
179 bool aKeepUUID =
false,
180 const PROPERTIES* aProperties =
nullptr )
override;
183 const PROPERTIES* aProperties =
nullptr )
override;
185 void FootprintDelete(
const wxString& aLibraryPath,
const wxString& aFootprintName,
186 const PROPERTIES* aProperties =
nullptr )
override;
191 const PROPERTIES* aProperties =
nullptr)
override;
194 const PROPERTIES* aProperties =
nullptr )
override;
226 void validateCache(
const wxString& aLibraryPath,
bool checkModified =
true );
229 const PROPERTIES* aProperties,
bool checkModified );
252 void format(
const BOARD* aBoard,
int aNestLevel = 0 )
const;
256 void format(
const FP_SHAPE* aFPShape,
int aNestLevel = 0 )
const;
266 void format(
const PAD* aPad,
int aNestLevel = 0 )
const;
270 void format(
const FP_TEXT* aText,
int aNestLevel = 0 )
const;
274 void format(
const ZONE* aZone,
int aNestLevel = 0 )
const;
301 #endif // PCB_PLUGIN_H
const FOOTPRINT * GetEnumeratedFootprint(const wxString &aLibraryPath, const wxString &aFootprintName, const PROPERTIES *aProperties=nullptr) override
A version of FootprintLoad() for use after FootprintEnumerate() for more efficient cache management.
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
void formatSetup(const BOARD *aBoard, int aNestLevel=0) const
formats the board setup information
Container for project specific data.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
bool IsFootprintLibWritable(const wxString &aLibraryPath) override
Return true if the library at aLibraryPath is writable.
A set of BOARD_ITEMs (i.e., without duplicates).
Read a Pcbnew s-expression formatted LINE_READER object and returns the appropriate BOARD_ITEM object...
A progress reporter interface for use in multi-threaded environments.
#define CTL_FOR_BOARD
The zero arg constructor when PCB_PLUGIN is used for PLUGIN::Load() and PLUGIN::Save()ing a BOARD fil...
virtual void Save(const wxString &aFileName, BOARD *aBoard, const PROPERTIES *aProperties=nullptr) override
Write aBoard to a storage file in a format that this PLUGIN implementation knows about or it can be u...
void init(const PROPERTIES *aProperties)
long long GetLibraryTimestamp(const wxString &aLibraryPath) const override
Generate a timestamp representing all the files in the library (including the library directory).
void FootprintDelete(const wxString &aLibraryPath, const wxString &aFootprintName, const PROPERTIES *aProperties=nullptr) override
Delete aFootprintName from the library at aLibraryPath.
A PLUGIN derivation for saving and loading Pcbnew s-expression formatted files.
A name/value tuple with unique names and optional values.
const wxString PluginName() const override
Return a brief hard coded name for this PLUGIN.
BOARD_ITEM * Parse(const wxString &aClipboardSourceInput)
void format(const BOARD *aBoard, int aNestLevel=0) const
BOARD * DoLoad(LINE_READER &aReader, BOARD *aAppendToMe, const PROPERTIES *aProperties, PROGRESS_REPORTER *aProgressReporter, unsigned aLineCount)
LSET is a set of PCB_LAYER_IDs.
bool FootprintExists(const wxString &aLibraryPath, const wxString &aFootprintName, const PROPERTIES *aProperties=nullptr) override
Check for the existence of a footprint.
OUTPUTFORMATTER * m_out
output any Format()s to this, no ownership
void formatHeader(const BOARD *aBoard, int aNestLevel=0) const
writes everything that comes before the board_items, like settings and layers etc
Handle a list of polygons defining a copper zone.
const PROPERTIES * m_props
passed via Save() or Load(), no ownership, may be NULL.
bool FootprintLibDelete(const wxString &aLibraryPath, const PROPERTIES *aProperties=nullptr) override
Delete an existing footprint library and returns true, or if library does not exist returns false,...
BOARD * m_board
which BOARD, no ownership here
void validateCache(const wxString &aLibraryPath, bool checkModified=true)
void Format(const BOARD_ITEM *aItem, int aNestLevel=0) const
Output aItem to aFormatter in s-expression format.
NETINFO_MAPPING * m_mapping
mapping for net codes, so only not empty net codes are stored with consecutive integers as net codes
void FootprintSave(const wxString &aLibraryPath, const FOOTPRINT *aFootprint, const PROPERTIES *aProperties=nullptr) override
Write aFootprint to an existing library located at aLibraryPath.
std::string GetStringOutput(bool doClear)
BOARD * Load(const wxString &aFileName, BOARD *aAppendToMe, const PROPERTIES *aProperties=nullptr, PROJECT *aProject=nullptr, PROGRESS_REPORTER *aProgressReporter=nullptr) override
Load information from some input file format that this PLUGIN implementation knows about into either ...
const wxString GetFileExtension() const override
Returns the file extension for the PLUGIN.
void formatGeneral(const BOARD *aBoard, int aNestLevel=0) const
formats the General section of the file
PCB_PLUGIN(int aControlFlags=CTL_FOR_BOARD)
void FootprintEnumerate(wxArrayString &aFootprintNames, const wxString &aLibraryPath, bool aBestEfforts, const PROPERTIES *aProperties=nullptr) override
Return a list of footprint names contained within the library at aLibraryPath.
Information pertinent to a Pcbnew printed circuit board.
void formatBoardLayers(const BOARD *aBoard, int aNestLevel=0) const
formats the board layer information
void SetOutputFormatter(OUTPUTFORMATTER *aFormatter)
A base class that BOARD loading and saving plugins should derive from.
void formatProperties(const BOARD *aBoard, int aNestLevel=0) const
formats the Nets and Netclasses
void FootprintLibCreate(const wxString &aLibraryPath, const PROPERTIES *aProperties=nullptr) override
Create a new empty footprint library at aLibraryPath empty.
LINE_READER * m_reader
no ownership here.
void formatNetInformation(const BOARD *aBoard, int aNestLevel=0) const
formats the Nets and Netclasses
void formatLayer(const BOARD_ITEM *aItem) const
FP_CACHE * m_cache
Footprint library cache.
wxString m_error
for throwing exceptions
FOOTPRINT * FootprintLoad(const wxString &aLibraryPath, const wxString &aFootprintName, bool aKeepUUID=false, const PROPERTIES *aProperties=nullptr) override
Load a footprint having aFootprintName from the aLibraryPath containing a library format that this PL...
void formatLayers(LSET aLayerMask, int aNestLevel=0) const
wxString m_filename
for saves only, name is in m_reader for loads
const FOOTPRINT * getFootprint(const wxString &aLibraryPath, const wxString &aFootprintName, const PROPERTIES *aProperties, bool checkModified)
Container for design settings for a BOARD object.