2012-06-09 17:00:13 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2012 CERN.
|
2022-03-08 13:16:39 +00:00
|
|
|
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
2012-06-09 17:00:13 +00:00
|
|
|
*
|
|
|
|
* 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 2
|
|
|
|
* 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, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2021-11-25 12:22:40 +00:00
|
|
|
#ifndef PCB_PLUGIN_H
|
|
|
|
#define PCB_PLUGIN_H
|
2012-06-09 17:00:13 +00:00
|
|
|
|
|
|
|
#include <io_mgr.h>
|
|
|
|
#include <string>
|
2021-07-29 09:47:43 +00:00
|
|
|
#include <layer_ids.h>
|
2022-02-11 21:38:31 +00:00
|
|
|
#include "widgets/report_severity.h"
|
2012-06-09 17:00:13 +00:00
|
|
|
|
|
|
|
class BOARD;
|
|
|
|
class BOARD_ITEM;
|
2012-10-07 15:37:25 +00:00
|
|
|
class FP_CACHE;
|
2012-10-24 18:20:33 +00:00
|
|
|
class PCB_PARSER;
|
Added NETINFO_MAPPING, to ease saving nets with consecutive net codes (without modifying the net codes during the run time).
Now, nets are saved with consecutive net codes (both modern & legacy plugins).
Zones are saved together with their nets, without depending on the fact if there are any pads with such net. Therefore validation of zone net names was removed (pcbnew/class_board.cpp).
Performed tests:
- Changed a pad's net name from empty to existent - ok, name was changed.
- Changed a pad's net name from empty to nonexistent - ok, error message is displayed, net name stays empty.
- Changed a pad's net name from existent to empty - ok, net name became empty
- Changed a pad's net name from existent to nonexistent - ok, error message is displayed, net name is not changed.
- Drawn a zone that belongs to a net, then modified schematics so the net does not exist anymore. After reloading the net list, all pads/tracks are updated. Zones still belongs to the net that does not exist in the schematic (but still exists in .kicad_pcb file). After running DRC, the zone becomes not filled.
- Undo & redo affects assignment of a polygon to a specific net (you may change net of a polygon, refill it and undo/redo the changes).
- KiCad s-expr & legacy, Eagle, P-CAD boards seem to load without any problem (they also contain correct net names assigned to the appropriate pads). All types of board file formats were loaded, then saved in sexpr format and reopened with a KiCad built from the master branch (without my modifications).
- A few boards were also saved using the legacy format and were opened with the master KiCad without any issues.
- Change a net name for a pad, restore with undo/redo - ok
- Remove everything, restore with undo - ok
- Remove everything, reload netlist - ok
Differences observed between files saved by the master branch KiCad and this one:
- list of nets are not saved in any particular order, so net codes may differ
- the default net class does not contain the unconnected net
2014-01-28 09:19:51 +00:00
|
|
|
class NETINFO_MAPPING;
|
2019-07-03 21:19:09 +00:00
|
|
|
class BOARD_DESIGN_SETTINGS;
|
2021-06-11 16:59:28 +00:00
|
|
|
class PCB_DIMENSION_BASE;
|
2020-10-04 23:34:59 +00:00
|
|
|
class FP_SHAPE;
|
|
|
|
class PCB_SHAPE;
|
2022-02-08 19:29:54 +00:00
|
|
|
class PCB_BITMAP;
|
2019-07-03 21:19:09 +00:00
|
|
|
class PCB_TARGET;
|
2020-11-12 22:30:02 +00:00
|
|
|
class PAD;
|
2020-10-04 23:34:59 +00:00
|
|
|
class FP_TEXT;
|
2022-01-30 10:52:52 +00:00
|
|
|
class FP_TEXTBOX;
|
2020-08-12 11:23:30 +00:00
|
|
|
class PCB_GROUP;
|
2021-06-11 21:07:02 +00:00
|
|
|
class PCB_TRACK;
|
2020-11-11 23:05:59 +00:00
|
|
|
class ZONE;
|
2020-10-04 23:34:59 +00:00
|
|
|
class PCB_TEXT;
|
2022-01-30 10:52:52 +00:00
|
|
|
class PCB_TEXTBOX;
|
2022-01-04 23:00:00 +00:00
|
|
|
class EDA_TEXT;
|
|
|
|
class SHAPE_LINE_CHAIN;
|
2012-06-09 17:00:13 +00:00
|
|
|
|
|
|
|
|
2012-11-10 06:39:18 +00:00
|
|
|
/// Current s-expression file format version. 2 was the last legacy format version.
|
2012-06-09 17:00:13 +00:00
|
|
|
|
2016-08-15 15:55:36 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 3 // first s-expression format, used legacy cu stack
|
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 4 // reversed cu stack, changed Inner* to In* in reverse order
|
|
|
|
// // went to 32 Cu layers from 16.
|
2017-01-27 12:26:42 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20160815 // differential pair settings per net class
|
2017-09-19 11:21:38 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20170123 // EDA_TEXT refactor, moved 'hide'
|
2018-02-05 20:55:00 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20170920 // long pad names and custom pad shape
|
2017-11-14 09:53:59 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20170922 // Keepout zones can exist on multiple layers
|
2017-11-25 19:55:32 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20171114 // Save 3D model offset in mm, instead of inches
|
2020-10-04 23:34:59 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20171125 // Locked/unlocked FP_TEXT
|
2019-03-31 06:46:36 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20171130 // 3D model offset written using "offset" parameter
|
2019-04-14 17:58:35 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20190331 // hatched zones and chamfered round rect pads
|
2019-05-16 13:46:54 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20190421 // curves in custom pads
|
2019-07-03 21:19:09 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20190516 // Remove segment count from zones
|
2019-07-27 19:09:43 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20190605 // Add layer defaults
|
2019-11-23 09:07:56 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20190905 // Add board physical stackup info in setup section
|
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20190907 // Keepout areas in footprints
|
2019-12-11 10:36:45 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20191123 // pin function in pads
|
2020-05-12 19:38:29 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20200104 // pad property for fabrication
|
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20200119 // arcs in tracks
|
2020-05-18 22:55:10 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20200512 // page -> paper
|
2020-06-15 19:50:20 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20200518 // save hole_to_hole_min
|
2020-06-24 01:09:15 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20200614 // Add support for fp_rects and gr_rects
|
2020-05-31 21:42:04 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20200625 // Multilayer zones, zone names, island controls
|
2020-07-24 22:42:23 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20200628 // remove visibility settings
|
2020-11-14 21:21:54 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20200724 // Add KIID to footprints
|
2020-08-08 21:47:57 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20200807 // Add zone hatch advanced settings
|
2020-10-21 03:48:06 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20200808 // Add properties to footprints
|
2020-08-11 19:37:07 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20200809 // Add REMOVE_UNUSED_LAYERS option to vias and THT pads
|
2020-08-18 13:08:32 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20200811 // Add groups
|
2020-08-19 18:21:24 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20200818 // Remove Status flag bitmap and setup counts
|
2020-08-25 22:25:08 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20200819 // Add board-level properties
|
2020-08-26 21:43:38 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20200825 // Remove host information
|
2020-08-28 19:32:11 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20200828 // Add new fabrication attributes
|
2020-09-09 03:17:08 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20200829 // Remove library name from exported footprints
|
2020-09-12 20:09:40 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20200909 // Change DIMENSION format
|
2020-09-17 00:54:58 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20200913 // Add leader dimension
|
2020-09-22 02:32:40 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20200916 // Add center dimension
|
2020-10-03 11:16:29 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20200921 // Add orthogonal dimension
|
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20200922 // Add user name to layer definition.
|
2020-11-14 01:16:02 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20201002 // Add groups in footprints (for footprint editor).
|
2020-11-15 12:20:59 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20201114 // Add first-class support for filled shapes.
|
2020-11-16 23:19:09 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20201115 // module -> footprint and change fill syntax.
|
2020-12-20 21:29:43 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20201116 // Write version and generator string in footprint files.
|
2021-01-08 16:32:28 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20201220 // Add free via token
|
2021-01-26 15:27:42 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20210108 // Pad locking moved from footprint to pads
|
2021-02-28 19:04:28 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20210126 // Store pintype alongside pinfunction (in pads).
|
2020-08-14 00:10:40 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20210228 // Move global margins back to board file
|
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20210424 // Correct locked flag syntax (remove parens).
|
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20210606 // Change overbar syntax from `~...~` to `~{...}`.
|
2021-07-22 11:45:33 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20210623 // Add support for reading/writing arcs in polygons
|
2021-08-24 10:17:28 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20210722 // Reading/writing group locked flags
|
2021-09-25 19:37:34 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20210824 // Opacity in 3D colors
|
2021-10-14 23:39:31 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20210925 // Locked flag for fp_text
|
2021-07-13 18:46:33 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20211014 // Arc formatting
|
2021-08-08 13:37:14 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20211226 // Add radial dimension
|
2021-08-12 16:58:30 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20211227 // Add thermal relief spoke angle overrides
|
2021-08-25 23:14:36 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20211228 // Add allow_soldermask_bridges footprint attribute
|
2021-12-04 23:52:00 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20211229 // Stroke formatting
|
2021-12-05 21:56:55 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20211230 // Dimensions in footprints
|
2022-01-20 21:01:50 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20211231 // Private footprint layers
|
2022-01-31 19:11:21 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20211232 // Fonts
|
2022-02-11 12:42:09 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20220131 // Textboxes
|
2022-02-25 23:09:27 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20220211 // End support for V5 zone fill strategy
|
2022-03-08 13:16:39 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20220225 // Remove TEDIT
|
2022-04-02 13:36:20 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20220308 // Knockout text and Locked graphic text property saved
|
2022-04-17 13:02:19 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20220331 // Plot on all layers selection setting
|
2022-04-27 16:13:50 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20220417 // Automatic dimension precisions
|
2022-06-17 17:41:53 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20220427 // Exclude Edge.Cuts & Margin from fp private layers
|
2022-02-08 19:29:54 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20220609 // Add teardrop keywords to identify teardrop zones
|
2022-08-15 17:02:31 +00:00
|
|
|
//#define SEXPR_BOARD_FILE_VERSION 20220621 // Add Image support
|
|
|
|
#define SEXPR_BOARD_FILE_VERSION 20220815 // Add allow-soldermask-bridges-in-FPs flag
|
2020-09-22 21:50:59 +00:00
|
|
|
|
|
|
|
#define BOARD_FILE_HOST_VERSION 20200825 ///< Earlier files than this include the host tag
|
2021-10-14 23:39:31 +00:00
|
|
|
#define LEGACY_ARC_FORMATTING 20210925 ///< These were the last to use old arc formatting
|
2012-11-10 06:39:18 +00:00
|
|
|
|
2020-12-28 00:42:04 +00:00
|
|
|
#define CTL_OMIT_PAD_NETS (1 << 1) ///< Omit pads net names (useless in library)
|
2014-06-02 10:46:29 +00:00
|
|
|
#define CTL_OMIT_TSTAMPS (1 << 2) ///< Omit component time stamp (useless in library)
|
2020-11-13 21:07:01 +00:00
|
|
|
#define CTL_OMIT_INITIAL_COMMENTS (1 << 3) ///< omit FOOTPRINT initial comments
|
2014-06-02 10:46:29 +00:00
|
|
|
#define CTL_OMIT_PATH (1 << 4) ///< Omit component sheet time stamp (useless in library)
|
2020-12-18 15:40:13 +00:00
|
|
|
#define CTL_OMIT_AT (1 << 5) ///< Omit position and rotation. (always saved
|
Fix typos in pcbnew sub-directory
Found via `codespell -q 3 -S *.po,./thirdparty,./Documentation/changelogs -L aactual,acount,aline,alocation,alog,anormal,anumber,aother,apoints,aparent,aray,ba,busses,dout,einstance,leaded,modul,ontext,ot,overide,serie,te,,tesselate,tesselator,tht`
2022-06-29 20:21:10 +00:00
|
|
|
///< with position 0,0 and rotation = 0 in library).
|
2017-01-29 08:29:49 +00:00
|
|
|
//#define CTL_OMIT_HIDE (1 << 6) // found and defined in eda_text.h
|
2020-12-18 15:40:13 +00:00
|
|
|
#define CTL_OMIT_LIBNAME (1 << 7) ///< Omit lib alias when saving (used for
|
|
|
|
///< board/not library).
|
|
|
|
#define CTL_OMIT_FOOTPRINT_VERSION (1 << 8) ///< Omit the version string from the (footprint)
|
|
|
|
///<sexpr group
|
2012-06-09 17:00:13 +00:00
|
|
|
|
2012-11-14 07:15:59 +00:00
|
|
|
// common combinations of the above:
|
|
|
|
|
|
|
|
/// Format output for the clipboard instead of footprint library or BOARD
|
2020-11-16 23:19:09 +00:00
|
|
|
#define CTL_FOR_CLIPBOARD (CTL_OMIT_INITIAL_COMMENTS) // (CTL_OMIT_NETS)
|
2012-11-14 07:15:59 +00:00
|
|
|
|
|
|
|
/// Format output for a footprint library instead of clipboard or BOARD
|
2020-12-18 15:40:13 +00:00
|
|
|
#define CTL_FOR_LIBRARY \
|
2020-12-28 00:42:04 +00:00
|
|
|
( CTL_OMIT_PAD_NETS | CTL_OMIT_TSTAMPS | CTL_OMIT_PATH | CTL_OMIT_AT | CTL_OMIT_LIBNAME )
|
2012-06-09 17:00:13 +00:00
|
|
|
|
2021-11-25 12:22:40 +00:00
|
|
|
/// The zero arg constructor when PCB_PLUGIN is used for PLUGIN::Load() and PLUGIN::Save()ing
|
2013-06-24 05:30:22 +00:00
|
|
|
/// a BOARD file underneath IO_MGR.
|
2020-11-16 23:19:09 +00:00
|
|
|
#define CTL_FOR_BOARD (CTL_OMIT_INITIAL_COMMENTS|CTL_OMIT_FOOTPRINT_VERSION)
|
2013-06-24 05:30:22 +00:00
|
|
|
|
2013-09-21 07:30:23 +00:00
|
|
|
|
2012-06-09 17:00:13 +00:00
|
|
|
/**
|
2020-12-18 15:40:13 +00:00
|
|
|
* A #PLUGIN derivation for saving and loading Pcbnew s-expression formatted files.
|
2012-06-09 17:00:13 +00:00
|
|
|
*
|
|
|
|
* @note This class is not thread safe, but it is re-entrant multiple times in sequence.
|
|
|
|
*/
|
2021-11-25 12:22:40 +00:00
|
|
|
class PCB_PLUGIN : public PLUGIN
|
2012-06-09 17:00:13 +00:00
|
|
|
{
|
|
|
|
public:
|
2016-09-25 17:06:49 +00:00
|
|
|
const wxString PluginName() const override
|
2012-06-09 17:00:13 +00:00
|
|
|
{
|
2013-11-27 06:04:04 +00:00
|
|
|
return wxT( "KiCad" );
|
2012-06-09 17:00:13 +00:00
|
|
|
}
|
|
|
|
|
2016-09-25 17:06:49 +00:00
|
|
|
const wxString GetFileExtension() const override
|
2012-06-09 17:00:13 +00:00
|
|
|
{
|
2012-12-14 16:54:54 +00:00
|
|
|
// Would have used wildcards_and_files_ext.cpp's KiCadPcbFileExtension,
|
|
|
|
// but to be pure, a plugin should not assume that it will always be linked
|
2020-09-22 21:50:59 +00:00
|
|
|
// with the core of the Pcbnew code. (Might someday be a DLL/DSO.) Besides,
|
2012-12-14 16:54:54 +00:00
|
|
|
// file extension policy should be controlled by the plugin.
|
2013-11-27 06:04:04 +00:00
|
|
|
return wxT( "kicad_pcb" );
|
2012-06-09 17:00:13 +00:00
|
|
|
}
|
|
|
|
|
2022-02-11 21:38:31 +00:00
|
|
|
void SetQueryUserCallback( std::function<bool( wxString aTitle, int aIcon, wxString aMessage,
|
|
|
|
wxString aOKButtonTitle )> aCallback ) override
|
|
|
|
{
|
|
|
|
m_queryUserCallback = &aCallback;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Save( const wxString& aFileName, BOARD* aBoard,
|
|
|
|
const PROPERTIES* aProperties = nullptr ) override;
|
2012-06-09 17:00:13 +00:00
|
|
|
|
2017-06-11 20:20:44 +00:00
|
|
|
BOARD* Load( const wxString& aFileName, BOARD* aAppendToMe,
|
2021-06-23 22:53:08 +00:00
|
|
|
const PROPERTIES* aProperties = nullptr, PROJECT* aProject = nullptr,
|
|
|
|
PROGRESS_REPORTER* aProgressReporter = nullptr ) override;
|
2012-06-09 17:00:13 +00:00
|
|
|
|
2021-06-23 22:53:08 +00:00
|
|
|
BOARD* DoLoad( LINE_READER& aReader, BOARD* aAppendToMe, const PROPERTIES* aProperties,
|
|
|
|
PROGRESS_REPORTER* aProgressReporter, unsigned aLineCount );
|
2020-08-06 18:37:43 +00:00
|
|
|
|
2017-06-11 20:20:44 +00:00
|
|
|
void FootprintEnumerate( wxArrayString& aFootprintNames, const wxString& aLibraryPath,
|
2020-12-18 15:40:13 +00:00
|
|
|
bool aBestEfforts, const PROPERTIES* aProperties = nullptr ) override;
|
2012-10-07 15:37:25 +00:00
|
|
|
|
2020-11-13 15:15:52 +00:00
|
|
|
const FOOTPRINT* GetEnumeratedFootprint( const wxString& aLibraryPath,
|
|
|
|
const wxString& aFootprintName,
|
2020-12-18 15:40:13 +00:00
|
|
|
const PROPERTIES* aProperties = nullptr ) override;
|
2018-02-23 12:21:06 +00:00
|
|
|
|
2019-07-11 21:59:14 +00:00
|
|
|
bool FootprintExists( const wxString& aLibraryPath, const wxString& aFootprintName,
|
2020-12-18 15:40:13 +00:00
|
|
|
const PROPERTIES* aProperties = nullptr ) override;
|
2019-07-11 21:59:14 +00:00
|
|
|
|
2020-11-13 15:15:52 +00:00
|
|
|
FOOTPRINT* FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName,
|
2021-03-30 09:38:03 +00:00
|
|
|
bool aKeepUUID = false,
|
2020-12-18 15:40:13 +00:00
|
|
|
const PROPERTIES* aProperties = nullptr ) override;
|
2012-10-07 15:37:25 +00:00
|
|
|
|
2020-11-13 15:15:52 +00:00
|
|
|
void FootprintSave( const wxString& aLibraryPath, const FOOTPRINT* aFootprint,
|
2020-12-18 15:40:13 +00:00
|
|
|
const PROPERTIES* aProperties = nullptr ) override;
|
2012-10-07 15:37:25 +00:00
|
|
|
|
2017-06-11 20:20:44 +00:00
|
|
|
void FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName,
|
2020-12-18 15:40:13 +00:00
|
|
|
const PROPERTIES* aProperties = nullptr ) override;
|
2012-10-07 15:37:25 +00:00
|
|
|
|
2018-03-04 01:13:09 +00:00
|
|
|
long long GetLibraryTimestamp( const wxString& aLibraryPath ) const override;
|
2018-02-05 20:55:00 +00:00
|
|
|
|
2020-09-22 21:50:59 +00:00
|
|
|
void FootprintLibCreate( const wxString& aLibraryPath,
|
2020-12-18 15:40:13 +00:00
|
|
|
const PROPERTIES* aProperties = nullptr) override;
|
2012-10-07 15:37:25 +00:00
|
|
|
|
2020-09-22 21:50:59 +00:00
|
|
|
bool FootprintLibDelete( const wxString& aLibraryPath,
|
2020-12-18 15:40:13 +00:00
|
|
|
const PROPERTIES* aProperties = nullptr ) override;
|
2012-10-07 15:37:25 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
bool IsFootprintLibWritable( const wxString& aLibraryPath ) override;
|
2012-10-07 15:37:25 +00:00
|
|
|
|
2021-11-25 12:22:40 +00:00
|
|
|
PCB_PLUGIN( int aControlFlags = CTL_FOR_BOARD );
|
2012-10-22 20:41:26 +00:00
|
|
|
|
2021-11-25 12:22:40 +00:00
|
|
|
virtual ~PCB_PLUGIN();
|
2012-10-07 15:37:25 +00:00
|
|
|
|
2012-06-09 17:00:13 +00:00
|
|
|
/**
|
2020-09-22 21:50:59 +00:00
|
|
|
* Output \a aItem to \a aFormatter in s-expression format.
|
2012-06-09 17:00:13 +00:00
|
|
|
*
|
|
|
|
* @param aItem A pointer the an #BOARD_ITEM object to format.
|
|
|
|
* @param aNestLevel The indentation nest level.
|
|
|
|
* @throw IO_ERROR on write error.
|
|
|
|
*/
|
2020-12-20 18:44:13 +00:00
|
|
|
void Format( const BOARD_ITEM* aItem, int aNestLevel = 0 ) const;
|
2012-06-09 17:00:13 +00:00
|
|
|
|
|
|
|
std::string GetStringOutput( bool doClear )
|
|
|
|
{
|
|
|
|
std::string ret = m_sf.GetString();
|
2020-11-15 12:20:59 +00:00
|
|
|
|
2012-06-09 17:00:13 +00:00
|
|
|
if( doClear )
|
|
|
|
m_sf.Clear();
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2012-10-07 15:37:25 +00:00
|
|
|
void SetOutputFormatter( OUTPUTFORMATTER* aFormatter ) { m_out = aFormatter; }
|
2012-06-09 17:00:13 +00:00
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
BOARD_ITEM* Parse( const wxString& aClipboardSourceInput );
|
2012-10-22 20:41:26 +00:00
|
|
|
|
2012-06-09 17:00:13 +00:00
|
|
|
protected:
|
2018-02-24 17:41:44 +00:00
|
|
|
void validateCache( const wxString& aLibraryPath, bool checkModified = true );
|
|
|
|
|
2020-11-13 15:15:52 +00:00
|
|
|
const FOOTPRINT* getFootprint( const wxString& aLibraryPath, const wxString& aFootprintName,
|
|
|
|
const PROPERTIES* aProperties, bool checkModified );
|
2013-11-27 06:04:04 +00:00
|
|
|
|
|
|
|
void init( const PROPERTIES* aProperties );
|
2012-06-09 17:00:13 +00:00
|
|
|
|
2017-05-18 17:21:30 +00:00
|
|
|
/// formats the board setup information
|
2020-12-20 18:44:13 +00:00
|
|
|
void formatSetup( const BOARD* aBoard, int aNestLevel = 0 ) const;
|
2017-05-18 16:43:01 +00:00
|
|
|
|
2017-05-18 17:21:30 +00:00
|
|
|
/// formats the General section of the file
|
2020-12-20 18:44:13 +00:00
|
|
|
void formatGeneral( const BOARD* aBoard, int aNestLevel = 0 ) const;
|
2017-05-18 16:43:01 +00:00
|
|
|
|
2017-05-18 17:21:30 +00:00
|
|
|
/// formats the board layer information
|
2020-12-20 18:44:13 +00:00
|
|
|
void formatBoardLayers( const BOARD* aBoard, int aNestLevel = 0 ) const;
|
2017-05-18 16:43:01 +00:00
|
|
|
|
2017-05-18 17:21:30 +00:00
|
|
|
/// formats the Nets and Netclasses
|
2020-12-20 18:44:13 +00:00
|
|
|
void formatNetInformation( const BOARD* aBoard, int aNestLevel = 0 ) const;
|
2017-05-18 16:43:01 +00:00
|
|
|
|
2020-08-19 18:21:24 +00:00
|
|
|
/// formats the Nets and Netclasses
|
2020-12-20 18:44:13 +00:00
|
|
|
void formatProperties( const BOARD* aBoard, int aNestLevel = 0 ) const;
|
2020-08-19 18:21:24 +00:00
|
|
|
|
2017-04-15 16:08:23 +00:00
|
|
|
/// writes everything that comes before the board_items, like settings and layers etc
|
2020-12-20 18:44:13 +00:00
|
|
|
void formatHeader( const BOARD* aBoard, int aNestLevel = 0 ) const;
|
2017-04-15 16:08:23 +00:00
|
|
|
|
2012-06-09 17:00:13 +00:00
|
|
|
private:
|
2020-12-20 18:44:13 +00:00
|
|
|
void format( const BOARD* aBoard, int aNestLevel = 0 ) const;
|
2012-06-09 17:00:13 +00:00
|
|
|
|
2021-06-11 16:59:28 +00:00
|
|
|
void format( const PCB_DIMENSION_BASE* aDimension, int aNestLevel = 0 ) const;
|
2012-06-09 17:00:13 +00:00
|
|
|
|
2020-12-20 18:44:13 +00:00
|
|
|
void format( const FP_SHAPE* aFPShape, int aNestLevel = 0 ) const;
|
2012-06-09 17:00:13 +00:00
|
|
|
|
2022-02-08 19:29:54 +00:00
|
|
|
void format( const PCB_BITMAP* aBitmap, int aNestLevel = 0 ) const;
|
|
|
|
|
2020-12-20 18:44:13 +00:00
|
|
|
void format( const PCB_GROUP* aGroup, int aNestLevel = 0 ) const;
|
2020-08-11 19:37:07 +00:00
|
|
|
|
2020-12-20 18:44:13 +00:00
|
|
|
void format( const PCB_SHAPE* aSegment, int aNestLevel = 0 ) const;
|
2012-06-09 17:00:13 +00:00
|
|
|
|
2020-12-20 18:44:13 +00:00
|
|
|
void format( const PCB_TARGET* aTarget, int aNestLevel = 0 ) const;
|
2012-06-09 17:00:13 +00:00
|
|
|
|
2020-12-20 18:44:13 +00:00
|
|
|
void format( const FOOTPRINT* aFootprint, int aNestLevel = 0 ) const;
|
2012-06-09 17:00:13 +00:00
|
|
|
|
2020-12-20 18:44:13 +00:00
|
|
|
void format( const PAD* aPad, int aNestLevel = 0 ) const;
|
2012-06-09 17:00:13 +00:00
|
|
|
|
2020-12-20 18:44:13 +00:00
|
|
|
void format( const PCB_TEXT* aText, int aNestLevel = 0 ) const;
|
2022-01-30 10:52:52 +00:00
|
|
|
void format( const PCB_TEXTBOX* aTextBox, int aNestLevel = 0 ) const;
|
2012-06-09 17:00:13 +00:00
|
|
|
|
2020-12-20 18:44:13 +00:00
|
|
|
void format( const FP_TEXT* aText, int aNestLevel = 0 ) const;
|
2022-01-30 10:52:52 +00:00
|
|
|
void format( const FP_TEXTBOX* aTextBox, int aNestLevel = 0 ) const;
|
2012-06-09 17:00:13 +00:00
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
void format( const PCB_TRACK* aTrack, int aNestLevel = 0 ) const;
|
2012-06-09 17:00:13 +00:00
|
|
|
|
2020-12-20 18:44:13 +00:00
|
|
|
void format( const ZONE* aZone, int aNestLevel = 0 ) const;
|
2012-06-09 17:00:13 +00:00
|
|
|
|
2022-01-04 23:00:00 +00:00
|
|
|
void formatPolyPts( const SHAPE_LINE_CHAIN& outline, int aNestLevel, bool aCompact ) const;
|
|
|
|
|
|
|
|
void formatRenderCache( const EDA_TEXT* aText, int aNestLevel ) const;
|
|
|
|
|
2022-03-08 13:16:39 +00:00
|
|
|
void formatLayer( PCB_LAYER_ID aLayer, bool aIsKnockout = false ) const;
|
2012-10-07 15:37:25 +00:00
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void formatLayers( LSET aLayerMask, int aNestLevel = 0 ) const;
|
2020-12-18 15:40:13 +00:00
|
|
|
|
|
|
|
friend class FP_CACHE;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
wxString m_error; ///< for throwing exceptions
|
|
|
|
BOARD* m_board; ///< which BOARD, no ownership here
|
|
|
|
|
|
|
|
const
|
|
|
|
PROPERTIES* m_props; ///< passed via Save() or Load(), no ownership, may be NULL.
|
|
|
|
FP_CACHE* m_cache; ///< Footprint library cache.
|
|
|
|
|
|
|
|
LINE_READER* m_reader; ///< no ownership here.
|
|
|
|
wxString m_filename; ///< for saves only, name is in m_reader for loads
|
|
|
|
|
|
|
|
STRING_FORMATTER m_sf;
|
|
|
|
OUTPUTFORMATTER* m_out; ///< output any Format()s to this, no ownership
|
|
|
|
int m_ctl;
|
|
|
|
NETINFO_MAPPING* m_mapping; ///< mapping for net codes, so only not empty net codes
|
|
|
|
///< are stored with consecutive integers as net codes
|
2022-02-11 21:38:31 +00:00
|
|
|
|
|
|
|
std::function<bool( wxString aTitle, int aIcon, wxString aMsg, wxString aAction )>* m_queryUserCallback;
|
2012-06-09 17:00:13 +00:00
|
|
|
};
|
|
|
|
|
2021-11-25 12:22:40 +00:00
|
|
|
#endif // PCB_PLUGIN_H
|