KiCad PCB EDA Suite
pcb_plugin.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2012 CERN.
5 * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#ifndef PCB_PLUGIN_H
26#define PCB_PLUGIN_H
27
28#include <io_mgr.h>
29#include <string>
30#include <layer_ids.h>
31#include <boost/ptr_container/ptr_map.hpp>
32#include <wx_filename.h>
34
35class BOARD;
36class BOARD_ITEM;
37class FP_CACHE;
38class PCB_PARSER;
39class NETINFO_MAPPING;
42class FP_SHAPE;
43class PCB_SHAPE;
44class PCB_BITMAP;
45class PCB_TARGET;
46class PAD;
47class FP_TEXT;
48class FP_TEXTBOX;
49class PCB_GROUP;
50class PCB_TRACK;
51class ZONE;
52class PCB_TEXT;
53class PCB_TEXTBOX;
54class EDA_TEXT;
56class PCB_PLUGIN; // forward decl
57
59
60//#define SEXPR_BOARD_FILE_VERSION 3 // first s-expression format, used legacy cu stack
61//#define SEXPR_BOARD_FILE_VERSION 4 // reversed cu stack, changed Inner* to In* in reverse order
62// // went to 32 Cu layers from 16.
63//#define SEXPR_BOARD_FILE_VERSION 20160815 // differential pair settings per net class
64//#define SEXPR_BOARD_FILE_VERSION 20170123 // EDA_TEXT refactor, moved 'hide'
65//#define SEXPR_BOARD_FILE_VERSION 20170920 // long pad names and custom pad shape
66//#define SEXPR_BOARD_FILE_VERSION 20170922 // Keepout zones can exist on multiple layers
67//#define SEXPR_BOARD_FILE_VERSION 20171114 // Save 3D model offset in mm, instead of inches
68//#define SEXPR_BOARD_FILE_VERSION 20171125 // Locked/unlocked FP_TEXT
69//#define SEXPR_BOARD_FILE_VERSION 20171130 // 3D model offset written using "offset" parameter
70//#define SEXPR_BOARD_FILE_VERSION 20190331 // hatched zones and chamfered round rect pads
71//#define SEXPR_BOARD_FILE_VERSION 20190421 // curves in custom pads
72//#define SEXPR_BOARD_FILE_VERSION 20190516 // Remove segment count from zones
73//#define SEXPR_BOARD_FILE_VERSION 20190605 // Add layer defaults
74//#define SEXPR_BOARD_FILE_VERSION 20190905 // Add board physical stackup info in setup section
75//#define SEXPR_BOARD_FILE_VERSION 20190907 // Keepout areas in footprints
76//#define SEXPR_BOARD_FILE_VERSION 20191123 // pin function in pads
77//#define SEXPR_BOARD_FILE_VERSION 20200104 // pad property for fabrication
78//#define SEXPR_BOARD_FILE_VERSION 20200119 // arcs in tracks
79//#define SEXPR_BOARD_FILE_VERSION 20200512 // page -> paper
80//#define SEXPR_BOARD_FILE_VERSION 20200518 // save hole_to_hole_min
81//#define SEXPR_BOARD_FILE_VERSION 20200614 // Add support for fp_rects and gr_rects
82//#define SEXPR_BOARD_FILE_VERSION 20200625 // Multilayer zones, zone names, island controls
83//#define SEXPR_BOARD_FILE_VERSION 20200628 // remove visibility settings
84//#define SEXPR_BOARD_FILE_VERSION 20200724 // Add KIID to footprints
85//#define SEXPR_BOARD_FILE_VERSION 20200807 // Add zone hatch advanced settings
86//#define SEXPR_BOARD_FILE_VERSION 20200808 // Add properties to footprints
87//#define SEXPR_BOARD_FILE_VERSION 20200809 // Add REMOVE_UNUSED_LAYERS option to vias and THT pads
88//#define SEXPR_BOARD_FILE_VERSION 20200811 // Add groups
89//#define SEXPR_BOARD_FILE_VERSION 20200818 // Remove Status flag bitmap and setup counts
90//#define SEXPR_BOARD_FILE_VERSION 20200819 // Add board-level properties
91//#define SEXPR_BOARD_FILE_VERSION 20200825 // Remove host information
92//#define SEXPR_BOARD_FILE_VERSION 20200828 // Add new fabrication attributes
93//#define SEXPR_BOARD_FILE_VERSION 20200829 // Remove library name from exported footprints
94//#define SEXPR_BOARD_FILE_VERSION 20200909 // Change DIMENSION format
95//#define SEXPR_BOARD_FILE_VERSION 20200913 // Add leader dimension
96//#define SEXPR_BOARD_FILE_VERSION 20200916 // Add center dimension
97//#define SEXPR_BOARD_FILE_VERSION 20200921 // Add orthogonal dimension
98//#define SEXPR_BOARD_FILE_VERSION 20200922 // Add user name to layer definition.
99//#define SEXPR_BOARD_FILE_VERSION 20201002 // Add groups in footprints (for footprint editor).
100//#define SEXPR_BOARD_FILE_VERSION 20201114 // Add first-class support for filled shapes.
101//#define SEXPR_BOARD_FILE_VERSION 20201115 // module -> footprint and change fill syntax.
102//#define SEXPR_BOARD_FILE_VERSION 20201116 // Write version and generator string in footprint files.
103//#define SEXPR_BOARD_FILE_VERSION 20201220 // Add free via token
104//#define SEXPR_BOARD_FILE_VERSION 20210108 // Pad locking moved from footprint to pads
105//#define SEXPR_BOARD_FILE_VERSION 20210126 // Store pintype alongside pinfunction (in pads).
106//#define SEXPR_BOARD_FILE_VERSION 20210228 // Move global margins back to board file
107//#define SEXPR_BOARD_FILE_VERSION 20210424 // Correct locked flag syntax (remove parens).
108//#define SEXPR_BOARD_FILE_VERSION 20210606 // Change overbar syntax from `~...~` to `~{...}`.
109//#define SEXPR_BOARD_FILE_VERSION 20210623 // Add support for reading/writing arcs in polygons
110//#define SEXPR_BOARD_FILE_VERSION 20210722 // Reading/writing group locked flags
111//#define SEXPR_BOARD_FILE_VERSION 20210824 // Opacity in 3D colors
112//#define SEXPR_BOARD_FILE_VERSION 20210925 // Locked flag for fp_text
113//#define SEXPR_BOARD_FILE_VERSION 20211014 // Arc formatting
114//#define SEXPR_BOARD_FILE_VERSION 20211226 // Add radial dimension
115//#define SEXPR_BOARD_FILE_VERSION 20211227 // Add thermal relief spoke angle overrides
116//#define SEXPR_BOARD_FILE_VERSION 20211228 // Add allow_soldermask_bridges footprint attribute
117//#define SEXPR_BOARD_FILE_VERSION 20211229 // Stroke formatting
118//#define SEXPR_BOARD_FILE_VERSION 20211230 // Dimensions in footprints
119//#define SEXPR_BOARD_FILE_VERSION 20211231 // Private footprint layers
120//#define SEXPR_BOARD_FILE_VERSION 20211232 // Fonts
121//#define SEXPR_BOARD_FILE_VERSION 20220131 // Textboxes
122//#define SEXPR_BOARD_FILE_VERSION 20220211 // End support for V5 zone fill strategy
123//#define SEXPR_BOARD_FILE_VERSION 20220225 // Remove TEDIT
124//#define SEXPR_BOARD_FILE_VERSION 20220308 // Knockout text and Locked graphic text property saved
125//#define SEXPR_BOARD_FILE_VERSION 20220331 // Plot on all layers selection setting
126//#define SEXPR_BOARD_FILE_VERSION 20220417 // Automatic dimension precisions
127//#define SEXPR_BOARD_FILE_VERSION 20220427 // Exclude Edge.Cuts & Margin from fp private layers
128//#define SEXPR_BOARD_FILE_VERSION 20220609 // Add teardrop keywords to identify teardrop zones
129//#define SEXPR_BOARD_FILE_VERSION 20220621 // Add Image support
130//#define SEXPR_BOARD_FILE_VERSION 20220815 // Add allow-soldermask-bridges-in-FPs flag
131//#define SEXPR_BOARD_FILE_VERSION 20220818 // First-class storage for net-ties
132//#define SEXPR_BOARD_FILE_VERSION 20220914 // Number boxes for custom-shape pads
133#define SEXPR_BOARD_FILE_VERSION 20221018 // Via & pad zone-layer-connections
134
135#define BOARD_FILE_HOST_VERSION 20200825
136#define LEGACY_ARC_FORMATTING 20210925
137#define LEGACY_NET_TIES 20220815
139
140#define CTL_OMIT_PAD_NETS (1 << 1)
141#define CTL_OMIT_TSTAMPS (1 << 2)
142#define CTL_OMIT_INITIAL_COMMENTS (1 << 3)
143#define CTL_OMIT_PATH (1 << 4)
144#define CTL_OMIT_AT (1 << 5)
146//#define CTL_OMIT_HIDE (1 << 6) // found and defined in eda_text.h
147#define CTL_OMIT_LIBNAME (1 << 7)
149#define CTL_OMIT_FOOTPRINT_VERSION (1 << 8)
151
152// common combinations of the above:
153
155#define CTL_FOR_CLIPBOARD (CTL_OMIT_INITIAL_COMMENTS) // (CTL_OMIT_NETS)
156
158#define CTL_FOR_LIBRARY \
159 ( CTL_OMIT_PAD_NETS | CTL_OMIT_TSTAMPS | CTL_OMIT_PATH | CTL_OMIT_AT | CTL_OMIT_LIBNAME )
160
163#define CTL_FOR_BOARD (CTL_OMIT_INITIAL_COMMENTS|CTL_OMIT_FOOTPRINT_VERSION)
164
174{
176 std::unique_ptr<FOOTPRINT> m_footprint;
177
178public:
179 FP_CACHE_ITEM( FOOTPRINT* aFootprint, const WX_FILENAME& aFileName );
180
181 const WX_FILENAME& GetFileName() const { return m_filename; }
182 const FOOTPRINT* GetFootprint() const { return m_footprint.get(); }
183};
184
185typedef boost::ptr_map<wxString, FP_CACHE_ITEM> FP_CACHE_FOOTPRINT_MAP;
186
188{
189 PCB_PLUGIN* m_owner; // Plugin object that owns the cache.
190 wxFileName m_lib_path; // The path of the library.
191 wxString m_lib_raw_path; // For quick comparisons.
192 FP_CACHE_FOOTPRINT_MAP m_footprints; // Map of footprint filename to FOOTPRINT*.
193
194 bool m_cache_dirty; // Stored separately because it's expensive to check
195 // m_cache_timestamp against all the files.
196 long long m_cache_timestamp; // A hash of the timestamps for all the footprint
197 // files.
198
199public:
200 FP_CACHE( PCB_PLUGIN* aOwner, const wxString& aLibraryPath );
201
202 wxString GetPath() const { return m_lib_raw_path; }
203
204 bool IsWritable() const { return m_lib_path.IsOk() && m_lib_path.IsDirWritable(); }
205
206 bool Exists() const { return m_lib_path.IsOk() && m_lib_path.DirExists(); }
207
209
210 // Most all functions in this class throw IO_ERROR exceptions. There are no
211 // error codes nor user interface calls from here, nor in any PLUGIN.
212 // Catch these exceptions higher up please.
213
219 void Save( FOOTPRINT* aFootprint = nullptr );
220
221 void Load();
222
223 void Remove( const wxString& aFootprintName );
224
230 static long long GetTimestamp( const wxString& aLibPath );
231
235 bool IsModified();
236
248 bool IsPath( const wxString& aPath ) const;
249};
250
251
257class PCB_PLUGIN : public PLUGIN
258{
259public:
260 const wxString PluginName() const override
261 {
262 return wxT( "KiCad" );
263 }
264
265 const wxString GetFileExtension() const override
266 {
267 // Would have used wildcards_and_files_ext.cpp's KiCadPcbFileExtension,
268 // but to be pure, a plugin should not assume that it will always be linked
269 // with the core of the Pcbnew code. (Might someday be a DLL/DSO.) Besides,
270 // file extension policy should be controlled by the plugin.
271 return wxT( "kicad_pcb" );
272 }
273
274 void SetQueryUserCallback( std::function<bool( wxString aTitle, int aIcon, wxString aMessage,
275 wxString aOKButtonTitle )> aCallback ) override
276 {
277 m_queryUserCallback = &aCallback;
278 }
279
280 void Save( const wxString& aFileName, BOARD* aBoard,
281 const STRING_UTF8_MAP* aProperties = nullptr ) override;
282
283 BOARD* Load( const wxString& aFileName, BOARD* aAppendToMe,
284 const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr,
285 PROGRESS_REPORTER* aProgressReporter = nullptr ) override;
286
287 BOARD* DoLoad( LINE_READER& aReader, BOARD* aAppendToMe, const STRING_UTF8_MAP* aProperties,
288 PROGRESS_REPORTER* aProgressReporter, unsigned aLineCount );
289
290 void FootprintEnumerate( wxArrayString& aFootprintNames, const wxString& aLibraryPath,
291 bool aBestEfforts, const STRING_UTF8_MAP* aProperties = nullptr ) override;
292
293 const FOOTPRINT* GetEnumeratedFootprint( const wxString& aLibraryPath,
294 const wxString& aFootprintName,
295 const STRING_UTF8_MAP* aProperties = nullptr ) override;
296
297 bool FootprintExists( const wxString& aLibraryPath, const wxString& aFootprintName,
298 const STRING_UTF8_MAP* aProperties = nullptr ) override;
299
300 FOOTPRINT* FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName,
301 bool aKeepUUID = false,
302 const STRING_UTF8_MAP* aProperties = nullptr ) override;
303
304 void FootprintSave( const wxString& aLibraryPath, const FOOTPRINT* aFootprint,
305 const STRING_UTF8_MAP* aProperties = nullptr ) override;
306
307 void FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName,
308 const STRING_UTF8_MAP* aProperties = nullptr ) override;
309
310 long long GetLibraryTimestamp( const wxString& aLibraryPath ) const override;
311
312 void FootprintLibCreate( const wxString& aLibraryPath,
313 const STRING_UTF8_MAP* aProperties = nullptr) override;
314
315 bool FootprintLibDelete( const wxString& aLibraryPath,
316 const STRING_UTF8_MAP* aProperties = nullptr ) override;
317
318 bool IsFootprintLibWritable( const wxString& aLibraryPath ) override;
319
320 PCB_PLUGIN( int aControlFlags = CTL_FOR_BOARD );
321
322 virtual ~PCB_PLUGIN();
323
331 void Format( const BOARD_ITEM* aItem, int aNestLevel = 0 ) const;
332
333 std::string GetStringOutput( bool doClear )
334 {
335 std::string ret = m_sf.GetString();
336
337 if( doClear )
338 m_sf.Clear();
339
340 return ret;
341 }
342
343 void SetOutputFormatter( OUTPUTFORMATTER* aFormatter ) { m_out = aFormatter; }
344
345 BOARD_ITEM* Parse( const wxString& aClipboardSourceInput );
346
347protected:
348 void validateCache( const wxString& aLibraryPath, bool checkModified = true );
349
350 const FOOTPRINT* getFootprint( const wxString& aLibraryPath, const wxString& aFootprintName,
351 const STRING_UTF8_MAP* aProperties, bool checkModified );
352
353 void init( const STRING_UTF8_MAP* aProperties );
354
356 void formatSetup( const BOARD* aBoard, int aNestLevel = 0 ) const;
357
359 void formatGeneral( const BOARD* aBoard, int aNestLevel = 0 ) const;
360
362 void formatBoardLayers( const BOARD* aBoard, int aNestLevel = 0 ) const;
363
365 void formatNetInformation( const BOARD* aBoard, int aNestLevel = 0 ) const;
366
368 void formatProperties( const BOARD* aBoard, int aNestLevel = 0 ) const;
369
371 void formatHeader( const BOARD* aBoard, int aNestLevel = 0 ) const;
372
373private:
374 void format( const BOARD* aBoard, int aNestLevel = 0 ) const;
375
376 void format( const PCB_DIMENSION_BASE* aDimension, int aNestLevel = 0 ) const;
377
378 void format( const FP_SHAPE* aFPShape, int aNestLevel = 0 ) const;
379
380 void format( const PCB_BITMAP* aBitmap, int aNestLevel = 0 ) const;
381
382 void format( const PCB_GROUP* aGroup, int aNestLevel = 0 ) const;
383
384 void format( const PCB_SHAPE* aSegment, int aNestLevel = 0 ) const;
385
386 void format( const PCB_TARGET* aTarget, int aNestLevel = 0 ) const;
387
388 void format( const FOOTPRINT* aFootprint, int aNestLevel = 0 ) const;
389
390 void format( const PAD* aPad, int aNestLevel = 0 ) const;
391
392 void format( const PCB_TEXT* aText, int aNestLevel = 0 ) const;
393 void format( const PCB_TEXTBOX* aTextBox, int aNestLevel = 0 ) const;
394
395 void format( const FP_TEXT* aText, int aNestLevel = 0 ) const;
396 void format( const FP_TEXTBOX* aTextBox, int aNestLevel = 0 ) const;
397
398 void format( const PCB_TRACK* aTrack, int aNestLevel = 0 ) const;
399
400 void format( const ZONE* aZone, int aNestLevel = 0 ) const;
401
402 void formatPolyPts( const SHAPE_LINE_CHAIN& outline, int aNestLevel, bool aCompact ) const;
403
404 void formatRenderCache( const EDA_TEXT* aText, int aNestLevel ) const;
405
406 void formatLayer( PCB_LAYER_ID aLayer, bool aIsKnockout = false ) const;
407
408 void formatLayers( LSET aLayerMask, int aNestLevel = 0 ) const;
409
410 friend class FP_CACHE;
411
412protected:
413 wxString m_error;
415
418
420 wxString m_filename;
421
424 int m_ctl;
427
428 std::function<bool( wxString aTitle, int aIcon, wxString aMsg, wxString aAction )>* m_queryUserCallback;
429};
430
431#endif // PCB_PLUGIN_H
Container for design settings for a BOARD object.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:58
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:265
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:72
Helper class for creating a footprint library cache.
Definition: pcb_plugin.h:174
std::unique_ptr< FOOTPRINT > m_footprint
Definition: pcb_plugin.h:176
WX_FILENAME m_filename
Definition: pcb_plugin.h:175
FP_CACHE_ITEM(FOOTPRINT *aFootprint, const WX_FILENAME &aFileName)
Definition: pcb_plugin.cpp:69
const FOOTPRINT * GetFootprint() const
Definition: pcb_plugin.h:182
const WX_FILENAME & GetFileName() const
Definition: pcb_plugin.h:181
static long long GetTimestamp(const wxString &aLibPath)
Generate a timestamp representing all source files in the cache (including the parent directory).
Definition: pcb_plugin.cpp:243
FP_CACHE_FOOTPRINT_MAP & GetFootprints()
Definition: pcb_plugin.h:208
bool Exists() const
Definition: pcb_plugin.h:206
void Save(FOOTPRINT *aFootprint=nullptr)
Save the footprint cache or a single footprint from it to disk.
Definition: pcb_plugin.cpp:85
bool IsModified()
Return true if the cache is not up-to-date.
Definition: pcb_plugin.cpp:235
long long m_cache_timestamp
Definition: pcb_plugin.h:196
bool m_cache_dirty
Definition: pcb_plugin.h:194
wxString m_lib_raw_path
Definition: pcb_plugin.h:191
PCB_PLUGIN * m_owner
Definition: pcb_plugin.h:189
FP_CACHE(PCB_PLUGIN *aOwner, const wxString &aLibraryPath)
Definition: pcb_plugin.cpp:75
wxFileName m_lib_path
Definition: pcb_plugin.h:190
bool IsPath(const wxString &aPath) const
Check if aPath is the same as the current cache path.
Definition: pcb_plugin.cpp:229
void Load()
Definition: pcb_plugin.cpp:152
FP_CACHE_FOOTPRINT_MAP m_footprints
Definition: pcb_plugin.h:192
bool IsWritable() const
Definition: pcb_plugin.h:204
void Remove(const wxString &aFootprintName)
Definition: pcb_plugin.cpp:210
wxString GetPath() const
Definition: pcb_plugin.h:202
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
Definition: richio.h:81
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:530
An interface used to output 8 bit text in a convenient way.
Definition: richio.h:310
Definition: pad.h:59
Object to handle a bitmap image that can be inserted in a PCB.
Definition: pcb_bitmap.h:42
Abstract dimension API.
Definition: pcb_dimension.h:96
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:51
Read a Pcbnew s-expression formatted LINE_READER object and returns the appropriate BOARD_ITEM object...
Definition: pcb_parser.h:74
A PLUGIN derivation for saving and loading Pcbnew s-expression formatted files.
Definition: pcb_plugin.h:258
void formatSetup(const BOARD *aBoard, int aNestLevel=0) const
formats the board setup information
Definition: pcb_plugin.cpp:490
void FootprintSave(const wxString &aLibraryPath, const FOOTPRINT *aFootprint, const STRING_UTF8_MAP *aProperties=nullptr) override
Write aFootprint to an existing library located at aLibraryPath.
BOARD * m_board
which BOARD, no ownership here
Definition: pcb_plugin.h:414
LINE_READER * m_reader
no ownership here.
Definition: pcb_plugin.h:419
const wxString PluginName() const override
Return a brief hard coded name for this PLUGIN.
Definition: pcb_plugin.h:260
void formatPolyPts(const SHAPE_LINE_CHAIN &outline, int aNestLevel, bool aCompact) const
Definition: pcb_plugin.cpp:403
void init(const STRING_UTF8_MAP *aProperties)
bool FootprintLibDelete(const wxString &aLibraryPath, const STRING_UTF8_MAP *aProperties=nullptr) override
Delete an existing footprint library and returns true, or if library does not exist returns false,...
FP_CACHE * m_cache
Footprint library cache.
Definition: pcb_plugin.h:417
void formatLayer(PCB_LAYER_ID aLayer, bool aIsKnockout=false) const
Definition: pcb_plugin.cpp:395
BOARD_ITEM * Parse(const wxString &aClipboardSourceInput)
Definition: pcb_plugin.cpp:290
std::function< bool(wxString aTitle, int aIcon, wxString aMsg, wxString aAction)> * m_queryUserCallback
Definition: pcb_plugin.h:428
void formatHeader(const BOARD *aBoard, int aNestLevel=0) const
writes everything that comes before the board_items, like settings and layers etc
Definition: pcb_plugin.cpp:669
void formatLayers(LSET aLayerMask, int aNestLevel=0) const
void validateCache(const wxString &aLibraryPath, bool checkModified=true)
wxString m_error
for throwing exceptions
Definition: pcb_plugin.h:413
const wxString GetFileExtension() const override
Returns the file extension for the PLUGIN.
Definition: pcb_plugin.h:265
bool IsFootprintLibWritable(const wxString &aLibraryPath) override
Return true if the library at aLibraryPath is writable.
BOARD * Load(const wxString &aFileName, BOARD *aAppendToMe, const STRING_UTF8_MAP *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 ...
void SetOutputFormatter(OUTPUTFORMATTER *aFormatter)
Definition: pcb_plugin.h:343
void formatRenderCache(const EDA_TEXT *aText, int aNestLevel) const
Definition: pcb_plugin.cpp:456
wxString m_filename
for saves only, name is in m_reader for loads
Definition: pcb_plugin.h:420
STRING_FORMATTER m_sf
Definition: pcb_plugin.h:422
OUTPUTFORMATTER * m_out
output any Format()s to this, no ownership
Definition: pcb_plugin.h:423
const FOOTPRINT * GetEnumeratedFootprint(const wxString &aLibraryPath, const wxString &aFootprintName, const STRING_UTF8_MAP *aProperties=nullptr) override
A version of FootprintLoad() for use after FootprintEnumerate() for more efficient cache management.
const STRING_UTF8_MAP * m_props
passed via Save() or Load(), no ownership, may be NULL.
Definition: pcb_plugin.h:416
BOARD * DoLoad(LINE_READER &aReader, BOARD *aAppendToMe, const STRING_UTF8_MAP *aProperties, PROGRESS_REPORTER *aProgressReporter, unsigned aLineCount)
NETINFO_MAPPING * m_mapping
mapping for net codes, so only not empty net codes are stored with consecutive integers as net codes
Definition: pcb_plugin.h:425
void format(const BOARD *aBoard, int aNestLevel=0) const
Definition: pcb_plugin.cpp:687
void formatNetInformation(const BOARD *aBoard, int aNestLevel=0) const
formats the Nets and Netclasses
Definition: pcb_plugin.cpp:639
PCB_PLUGIN(int aControlFlags=CTL_FOR_BOARD)
void FootprintDelete(const wxString &aLibraryPath, const wxString &aFootprintName, const STRING_UTF8_MAP *aProperties=nullptr) override
Delete aFootprintName from the library at aLibraryPath.
std::string GetStringOutput(bool doClear)
Definition: pcb_plugin.h:333
void SetQueryUserCallback(std::function< bool(wxString aTitle, int aIcon, wxString aMessage, wxString aOKButtonTitle)> aCallback) override
Definition: pcb_plugin.h:274
bool FootprintExists(const wxString &aLibraryPath, const wxString &aFootprintName, const STRING_UTF8_MAP *aProperties=nullptr) override
Check for the existence of a footprint.
void FootprintLibCreate(const wxString &aLibraryPath, const STRING_UTF8_MAP *aProperties=nullptr) override
Create a new empty footprint library at aLibraryPath empty.
void formatProperties(const BOARD *aBoard, int aNestLevel=0) const
formats the Nets and Netclasses
Definition: pcb_plugin.cpp:655
FOOTPRINT * FootprintLoad(const wxString &aLibraryPath, const wxString &aFootprintName, bool aKeepUUID=false, const STRING_UTF8_MAP *aProperties=nullptr) override
Load a footprint having aFootprintName from the aLibraryPath containing a library format that this PL...
const FOOTPRINT * getFootprint(const wxString &aLibraryPath, const wxString &aFootprintName, const STRING_UTF8_MAP *aProperties, bool checkModified)
void formatBoardLayers(const BOARD *aBoard, int aNestLevel=0) const
formats the board layer information
Definition: pcb_plugin.cpp:569
void formatGeneral(const BOARD *aBoard, int aNestLevel=0) const
formats the General section of the file
Definition: pcb_plugin.cpp:553
long long GetLibraryTimestamp(const wxString &aLibraryPath) const override
Generate a timestamp representing all the files in the library (including the library directory).
void Save(const wxString &aFileName, BOARD *aBoard, const STRING_UTF8_MAP *aProperties=nullptr) override
Write aBoard to a storage file in a format that this PLUGIN implementation knows about or it can be u...
Definition: pcb_plugin.cpp:251
void Format(const BOARD_ITEM *aItem, int aNestLevel=0) const
Output aItem to aFormatter in s-expression format.
Definition: pcb_plugin.cpp:311
void FootprintEnumerate(wxArrayString &aFootprintNames, const wxString &aLibraryPath, bool aBestEfforts, const STRING_UTF8_MAP *aProperties=nullptr) override
Return a list of footprint names contained within the library at aLibraryPath.
virtual ~PCB_PLUGIN()
A base class that BOARD loading and saving plugins should derive from.
Definition: io_mgr.h:270
A progress reporter interface for use in multi-threaded environments.
Container for project specific data.
Definition: project.h:63
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
Implement an OUTPUTFORMATTER to a memory buffer.
Definition: richio.h:415
const std::string & GetString()
Definition: richio.h:438
void Clear()
Clear the buffer and empties the internal string.
Definition: richio.h:428
A name/value tuple with unique names and optional values.
A wrapper around a wxFileName which is much more performant with a subset of the API.
Definition: wx_filename.h:49
Handle a list of polygons defining a copper zone.
Definition: zone.h:57
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:59
#define CTL_FOR_BOARD
The zero arg constructor when PCB_PLUGIN is used for PLUGIN::Load() and PLUGIN::Save()ing a BOARD fil...
Definition: pcb_plugin.h:163
boost::ptr_map< wxString, FP_CACHE_ITEM > FP_CACHE_FOOTPRINT_MAP
Definition: pcb_plugin.h:185