Kicad has many plugins. This one is for the pcb.

This commit is contained in:
Jeff Young 2021-11-25 12:22:40 +00:00
parent 5863bc0937
commit ba6ae4fa9b
24 changed files with 105 additions and 105 deletions

View File

@ -548,7 +548,7 @@ set( PCB_COMMON_SRCS
${CMAKE_SOURCE_DIR}/pcbnew/io_mgr.cpp ${CMAKE_SOURCE_DIR}/pcbnew/io_mgr.cpp
${CMAKE_SOURCE_DIR}/pcbnew/kicad_clipboard.cpp ${CMAKE_SOURCE_DIR}/pcbnew/kicad_clipboard.cpp
${CMAKE_SOURCE_DIR}/pcbnew/netlist_reader/kicad_netlist_reader.cpp ${CMAKE_SOURCE_DIR}/pcbnew/netlist_reader/kicad_netlist_reader.cpp
${CMAKE_SOURCE_DIR}/pcbnew/plugins/kicad/kicad_plugin.cpp ${CMAKE_SOURCE_DIR}/pcbnew/plugins/kicad/pcb_plugin.cpp
${CMAKE_SOURCE_DIR}/pcbnew/netlist_reader/legacy_netlist_reader.cpp ${CMAKE_SOURCE_DIR}/pcbnew/netlist_reader/legacy_netlist_reader.cpp
${CMAKE_SOURCE_DIR}/pcbnew/plugins/legacy/legacy_plugin.cpp ${CMAKE_SOURCE_DIR}/pcbnew/plugins/legacy/legacy_plugin.cpp
${CMAKE_SOURCE_DIR}/pcbnew/netlist_reader/netlist_reader.cpp ${CMAKE_SOURCE_DIR}/pcbnew/netlist_reader/netlist_reader.cpp

View File

@ -56,7 +56,7 @@
#include <atomic> #include <atomic>
#include <../pcbnew/plugins/kicad/kicad_plugin.h> // for SEXPR_BOARD_FILE_VERSION def #include <../pcbnew/plugins/kicad/pcb_plugin.h> // for SEXPR_BOARD_FILE_VERSION def
#ifdef __WXMAC__ #ifdef __WXMAC__

View File

@ -31,7 +31,7 @@
#include <widgets/appearance_controls.h> #include <widgets/appearance_controls.h>
#include <drawing_sheet/ds_proxy_view_item.h> #include <drawing_sheet/ds_proxy_view_item.h>
#include <pcb_painter.h> #include <pcb_painter.h>
#include <plugins/kicad/kicad_plugin.h> #include <plugins/kicad/pcb_plugin.h>
#include <wx/treebook.h> #include <wx/treebook.h>
@ -499,7 +499,7 @@ void PANEL_PCBNEW_COLOR_SETTINGS::createPreviewItems()
m_page->SetWidthMils( 6000 ); m_page->SetWidthMils( 6000 );
STRING_LINE_READER reader( g_previewBoard, "preview" ); STRING_LINE_READER reader( g_previewBoard, "preview" );
PCB_IO pi; PCB_PLUGIN pi;
try try
{ {

View File

@ -54,7 +54,7 @@
#include <project/project_local_settings.h> #include <project/project_local_settings.h>
#include <project/net_settings.h> #include <project/net_settings.h>
#include <plugins/cadstar/cadstar_pcb_archive_plugin.h> #include <plugins/cadstar/cadstar_pcb_archive_plugin.h>
#include <plugins/kicad/kicad_plugin.h> #include <plugins/kicad/pcb_plugin.h>
#include <dialogs/dialog_imported_layers.h> #include <dialogs/dialog_imported_layers.h>
#include <tools/pcb_actions.h> #include <tools/pcb_actions.h>
#include "footprint_info_impl.h" #include "footprint_info_impl.h"

View File

@ -46,7 +46,7 @@
#include <footprint_info_impl.h> #include <footprint_info_impl.h>
#include <footprint_tree_pane.h> #include <footprint_tree_pane.h>
#include <fp_lib_table.h> #include <fp_lib_table.h>
#include <plugins/kicad/kicad_plugin.h> #include <plugins/kicad/pcb_plugin.h>
#include <kiface_base.h> #include <kiface_base.h>
#include <kiplatform/app.h> #include <kiplatform/app.h>
#include <kiway.h> #include <kiway.h>

View File

@ -41,7 +41,7 @@
#include <board_commit.h> #include <board_commit.h>
#include <footprint_edit_frame.h> #include <footprint_edit_frame.h>
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
#include <plugins/kicad/kicad_plugin.h> #include <plugins/kicad/pcb_plugin.h>
#include <plugins/legacy/legacy_plugin.h> #include <plugins/legacy/legacy_plugin.h>
#include <env_paths.h> #include <env_paths.h>
#include <paths.h> #include <paths.h>
@ -187,7 +187,7 @@ static FOOTPRINT* parse_footprint_with_plugin( const wxFileName& aFileName,
static FOOTPRINT* parse_footprint_kicad( const wxFileName& aFileName ) static FOOTPRINT* parse_footprint_kicad( const wxFileName& aFileName )
{ {
wxString fcontents; wxString fcontents;
PCB_IO pcb_io; PCB_PLUGIN pcb_io;
wxFFile f( aFileName.GetFullPath() ); wxFFile f( aFileName.GetFullPath() );
if( !f.IsOpened() ) if( !f.IsOpened() )
@ -347,7 +347,7 @@ void FOOTPRINT_EDIT_FRAME::ExportFootprint( FOOTPRINT* aFootprint )
// Export as *.kicad_pcb format, using a strategy which is specifically chosen // Export as *.kicad_pcb format, using a strategy which is specifically chosen
// as an example on how it could also be used to send it to the system clipboard. // as an example on how it could also be used to send it to the system clipboard.
PCB_IO pcb_io( CTL_FOR_LIBRARY ); PCB_PLUGIN pcb_io(CTL_FOR_LIBRARY );
/* This footprint should *already* be "normalized" in a way such that /* This footprint should *already* be "normalized" in a way such that
orientation is zero, etc., since it came from the Footprint Editor. orientation is zero, etc., since it came from the Footprint Editor.

View File

@ -29,7 +29,7 @@
#include <plugins/eagle/eagle_plugin.h> #include <plugins/eagle/eagle_plugin.h>
#include <plugins/geda/gpcb_plugin.h> #include <plugins/geda/gpcb_plugin.h>
#include <io_mgr.h> #include <io_mgr.h>
#include <plugins/kicad/kicad_plugin.h> #include <plugins/kicad/pcb_plugin.h>
#include <plugins/legacy/legacy_plugin.h> #include <plugins/legacy/legacy_plugin.h>
#include <plugins/pcad/pcad_plugin.h> #include <plugins/pcad/pcad_plugin.h>
#include <plugins/altium/altium_circuit_maker_plugin.h> #include <plugins/altium/altium_circuit_maker_plugin.h>
@ -191,7 +191,7 @@ void IO_MGR::Save( PCB_FILE_T aFileType, const wxString& aFileName, BOARD* aBoar
static IO_MGR::REGISTER_PLUGIN registerEaglePlugin( IO_MGR::EAGLE, wxT("Eagle"), static IO_MGR::REGISTER_PLUGIN registerEaglePlugin( IO_MGR::EAGLE, wxT("Eagle"),
[]() -> PLUGIN* { return new EAGLE_PLUGIN; } ); []() -> PLUGIN* { return new EAGLE_PLUGIN; } );
static IO_MGR::REGISTER_PLUGIN registerKicadPlugin( IO_MGR::KICAD_SEXP, static IO_MGR::REGISTER_PLUGIN registerKicadPlugin( IO_MGR::KICAD_SEXP,
wxT("KiCad"), []() -> PLUGIN* { return new PCB_IO; } ); wxT("KiCad"), []() -> PLUGIN* { return new PCB_PLUGIN; } );
static IO_MGR::REGISTER_PLUGIN registerPcadPlugin( IO_MGR::PCAD, wxT("P-Cad"), static IO_MGR::REGISTER_PLUGIN registerPcadPlugin( IO_MGR::PCAD, wxT("P-Cad"),
[]() -> PLUGIN* { return new PCAD_PLUGIN; } ); []() -> PLUGIN* { return new PCAD_PLUGIN; } );
static IO_MGR::REGISTER_PLUGIN registerFabmasterPlugin( IO_MGR::FABMASTER, wxT( "Fabmaster" ), static IO_MGR::REGISTER_PLUGIN registerFabmasterPlugin( IO_MGR::FABMASTER, wxT( "Fabmaster" ),

View File

@ -38,11 +38,11 @@
#include <netinfo.h> #include <netinfo.h>
#include <plugins/kicad/pcb_parser.h> #include <plugins/kicad/pcb_parser.h>
#include <plugins/kicad/kicad_plugin.h> #include <plugins/kicad/pcb_plugin.h>
#include <kicad_clipboard.h> #include <kicad_clipboard.h>
CLIPBOARD_IO::CLIPBOARD_IO(): CLIPBOARD_IO::CLIPBOARD_IO():
PCB_IO( CTL_FOR_CLIPBOARD ), PCB_PLUGIN(CTL_FOR_CLIPBOARD ),
m_formatter() m_formatter()
{ {
m_out = &m_formatter; m_out = &m_formatter;
@ -323,7 +323,7 @@ BOARD_ITEM* CLIPBOARD_IO::Parse()
try try
{ {
item = PCB_IO::Parse( result ); item = PCB_PLUGIN::Parse( result );
} }
catch (...) catch (...)
{ {

View File

@ -30,7 +30,7 @@
#ifndef KICAD_CLIPBOARD_H #ifndef KICAD_CLIPBOARD_H
#define KICAD_CLIPBOARD_H #define KICAD_CLIPBOARD_H
#include <plugins/kicad/kicad_plugin.h> #include <plugins/kicad/pcb_plugin.h>
#include <board_item.h> #include <board_item.h>
#include <footprint.h> #include <footprint.h>
#include <plugins/kicad/pcb_parser.h> #include <plugins/kicad/pcb_parser.h>
@ -38,21 +38,21 @@
#include <tools/pcb_selection.h> #include <tools/pcb_selection.h>
class CLIPBOARD_IO : public PCB_IO class CLIPBOARD_IO : public PCB_PLUGIN
{ {
public: public:
CLIPBOARD_IO(); CLIPBOARD_IO();
~CLIPBOARD_IO(); ~CLIPBOARD_IO();
/* /*
* Saves the entire board to the clipboard formatted using the PCB_IO formatting * Saves the entire board to the clipboard formatted using the PCB_PLUGIN formatting
*/ */
void Save( const wxString& aFileName, BOARD* aBoard, void Save( const wxString& aFileName, BOARD* aBoard,
const PROPERTIES* aProperties = nullptr ) override; const PROPERTIES* aProperties = nullptr ) override;
/* /*
* Write all the settings of the BOARD* set by setBoard() and then adds all the * Write all the settings of the BOARD* set by setBoard() and then adds all the
* BOARD_ITEMs found in selection formatted by PCB_IO to clipboard as sexpr text * BOARD_ITEMs found in selection formatted by PCB_PLUGIN to clipboard as sexpr text
*/ */
void SaveSelection( const PCB_SELECTION& selected, bool isFootprintEditor ); void SaveSelection( const PCB_SELECTION& selected, bool isFootprintEditor );

View File

@ -102,7 +102,7 @@ static inline long parseInt( const wxString& aValue, double aScalar )
* *
* The new footprint library design is a file path of individual footprint files * The new footprint library design is a file path of individual footprint files
* that contain a single footprint per file. This class is a helper only for the * that contain a single footprint per file. This class is a helper only for the
* footprint portion of the PLUGIN API, and only for the #PCB_IO plugin. It is * footprint portion of the PLUGIN API, and only for the #PCB_PLUGIN plugin. It is
* private to this implementation file so it is not placed into a header. * private to this implementation file so it is not placed into a header.
*/ */
class GPCB_FPL_CACHE_ITEM class GPCB_FPL_CACHE_ITEM

View File

@ -48,7 +48,7 @@
#include <pad.h> #include <pad.h>
#include <pcb_track.h> #include <pcb_track.h>
#include <zone.h> #include <zone.h>
#include <plugins/kicad/kicad_plugin.h> #include <plugins/kicad/pcb_plugin.h>
#include <pcb_plot_params_parser.h> #include <pcb_plot_params_parser.h>
#include <pcb_plot_params.h> #include <pcb_plot_params.h>
#include <locale_io.h> #include <locale_io.h>

View File

@ -43,7 +43,7 @@
#include <pcb_target.h> #include <pcb_target.h>
#include <pcb_text.h> #include <pcb_text.h>
#include <pcbnew_settings.h> #include <pcbnew_settings.h>
#include <plugins/kicad/kicad_plugin.h> #include <plugins/kicad/pcb_plugin.h>
#include <plugins/kicad/pcb_parser.h> #include <plugins/kicad/pcb_parser.h>
#include <trace_helpers.h> #include <trace_helpers.h>
#include <pcb_track.h> #include <pcb_track.h>
@ -63,7 +63,7 @@ using namespace PCB_KEYS_T;
* *
* The new footprint library design is a file path of individual footprint files that contain * The new footprint library design is a file path of individual footprint files that contain
* a single footprint per file. This class is a helper only for the footprint portion of the * a single footprint per file. This class is a helper only for the footprint portion of the
* PLUGIN API, and only for the #PCB_IO plugin. It is private to this implementation file so * PLUGIN API, and only for the #PCB_PLUGIN plugin. It is private to this implementation file so
* it is not placed into a header. * it is not placed into a header.
*/ */
class FP_CACHE_ITEM class FP_CACHE_ITEM
@ -90,7 +90,7 @@ typedef boost::ptr_map< wxString, FP_CACHE_ITEM > FOOTPRINT_MAP;
class FP_CACHE class FP_CACHE
{ {
PCB_IO* m_owner; // Plugin object that owns the cache. PCB_PLUGIN* m_owner; // Plugin object that owns the cache.
wxFileName m_lib_path; // The path of the library. wxFileName m_lib_path; // The path of the library.
wxString m_lib_raw_path; // For quick comparisons. wxString m_lib_raw_path; // For quick comparisons.
FOOTPRINT_MAP m_footprints; // Map of footprint filename to FOOTPRINT*. FOOTPRINT_MAP m_footprints; // Map of footprint filename to FOOTPRINT*.
@ -101,7 +101,7 @@ class FP_CACHE
// files. // files.
public: public:
FP_CACHE( PCB_IO* aOwner, const wxString& aLibraryPath ); FP_CACHE( PCB_PLUGIN* aOwner, const wxString& aLibraryPath );
wxString GetPath() const { return m_lib_raw_path; } wxString GetPath() const { return m_lib_raw_path; }
@ -153,7 +153,7 @@ public:
}; };
FP_CACHE::FP_CACHE( PCB_IO* aOwner, const wxString& aLibraryPath ) FP_CACHE::FP_CACHE( PCB_PLUGIN* aOwner, const wxString& aLibraryPath )
{ {
m_owner = aOwner; m_owner = aOwner;
m_lib_raw_path = aLibraryPath; m_lib_raw_path = aLibraryPath;
@ -335,7 +335,7 @@ long long FP_CACHE::GetTimestamp( const wxString& aLibPath )
} }
void PCB_IO::Save( const wxString& aFileName, BOARD* aBoard, const PROPERTIES* aProperties ) void PCB_PLUGIN::Save( const wxString& aFileName, BOARD* aBoard, const PROPERTIES* aProperties )
{ {
LOCALE_IO toggle; // toggles on, then off, the C locale. LOCALE_IO toggle; // toggles on, then off, the C locale.
@ -375,7 +375,7 @@ void PCB_IO::Save( const wxString& aFileName, BOARD* aBoard, const PROPERTIES* a
} }
BOARD_ITEM* PCB_IO::Parse( const wxString& aClipboardSourceInput ) BOARD_ITEM* PCB_PLUGIN::Parse( const wxString& aClipboardSourceInput )
{ {
std::string input = TO_UTF8( aClipboardSourceInput ); std::string input = TO_UTF8( aClipboardSourceInput );
@ -397,7 +397,7 @@ BOARD_ITEM* PCB_IO::Parse( const wxString& aClipboardSourceInput )
} }
void PCB_IO::Format( const BOARD_ITEM* aItem, int aNestLevel ) const void PCB_PLUGIN::Format( const BOARD_ITEM* aItem, int aNestLevel ) const
{ {
LOCALE_IO toggle; // public API function, perform anything convenient for caller LOCALE_IO toggle; // public API function, perform anything convenient for caller
@ -463,7 +463,7 @@ void PCB_IO::Format( const BOARD_ITEM* aItem, int aNestLevel ) const
} }
void PCB_IO::formatLayer( const BOARD_ITEM* aItem ) const void PCB_PLUGIN::formatLayer( const BOARD_ITEM* aItem ) const
{ {
PCB_LAYER_ID layer = aItem->GetLayer(); PCB_LAYER_ID layer = aItem->GetLayer();
@ -471,7 +471,7 @@ void PCB_IO::formatLayer( const BOARD_ITEM* aItem ) const
} }
void PCB_IO::formatSetup( const BOARD* aBoard, int aNestLevel ) const void PCB_PLUGIN::formatSetup( const BOARD* aBoard, int aNestLevel ) const
{ {
// Setup // Setup
m_out->Print( aNestLevel, "(setup\n" ); m_out->Print( aNestLevel, "(setup\n" );
@ -523,7 +523,7 @@ void PCB_IO::formatSetup( const BOARD* aBoard, int aNestLevel ) const
} }
void PCB_IO::formatGeneral( const BOARD* aBoard, int aNestLevel ) const void PCB_PLUGIN::formatGeneral( const BOARD* aBoard, int aNestLevel ) const
{ {
const BOARD_DESIGN_SETTINGS& dsnSettings = aBoard->GetDesignSettings(); const BOARD_DESIGN_SETTINGS& dsnSettings = aBoard->GetDesignSettings();
@ -539,7 +539,7 @@ void PCB_IO::formatGeneral( const BOARD* aBoard, int aNestLevel ) const
} }
void PCB_IO::formatBoardLayers( const BOARD* aBoard, int aNestLevel ) const void PCB_PLUGIN::formatBoardLayers( const BOARD* aBoard, int aNestLevel ) const
{ {
m_out->Print( aNestLevel, "(layers\n" ); m_out->Print( aNestLevel, "(layers\n" );
@ -609,7 +609,7 @@ void PCB_IO::formatBoardLayers( const BOARD* aBoard, int aNestLevel ) const
} }
void PCB_IO::formatNetInformation( const BOARD* aBoard, int aNestLevel ) const void PCB_PLUGIN::formatNetInformation( const BOARD* aBoard, int aNestLevel ) const
{ {
for( NETINFO_ITEM* net : *m_mapping ) for( NETINFO_ITEM* net : *m_mapping )
{ {
@ -625,7 +625,7 @@ void PCB_IO::formatNetInformation( const BOARD* aBoard, int aNestLevel ) const
} }
void PCB_IO::formatProperties( const BOARD* aBoard, int aNestLevel ) const void PCB_PLUGIN::formatProperties( const BOARD* aBoard, int aNestLevel ) const
{ {
for( const std::pair<const wxString, wxString>& prop : aBoard->GetProperties() ) for( const std::pair<const wxString, wxString>& prop : aBoard->GetProperties() )
{ {
@ -639,7 +639,7 @@ void PCB_IO::formatProperties( const BOARD* aBoard, int aNestLevel ) const
} }
void PCB_IO::formatHeader( const BOARD* aBoard, int aNestLevel ) const void PCB_PLUGIN::formatHeader( const BOARD* aBoard, int aNestLevel ) const
{ {
formatGeneral( aBoard, aNestLevel ); formatGeneral( aBoard, aNestLevel );
@ -657,7 +657,7 @@ void PCB_IO::formatHeader( const BOARD* aBoard, int aNestLevel ) const
} }
void PCB_IO::format( const BOARD* aBoard, int aNestLevel ) const void PCB_PLUGIN::format( const BOARD* aBoard, int aNestLevel ) const
{ {
std::set<BOARD_ITEM*, BOARD_ITEM::ptr_cmp> sorted_footprints( aBoard->Footprints().begin(), std::set<BOARD_ITEM*, BOARD_ITEM::ptr_cmp> sorted_footprints( aBoard->Footprints().begin(),
aBoard->Footprints().end() ); aBoard->Footprints().end() );
@ -704,7 +704,7 @@ void PCB_IO::format( const BOARD* aBoard, int aNestLevel ) const
} }
void PCB_IO::format( const PCB_DIMENSION_BASE* aDimension, int aNestLevel ) const void PCB_PLUGIN::format( const PCB_DIMENSION_BASE* aDimension, int aNestLevel ) const
{ {
const PCB_DIM_ALIGNED* aligned = dynamic_cast<const PCB_DIM_ALIGNED*>( aDimension ); const PCB_DIM_ALIGNED* aligned = dynamic_cast<const PCB_DIM_ALIGNED*>( aDimension );
const PCB_DIM_ORTHOGONAL* ortho = dynamic_cast<const PCB_DIM_ORTHOGONAL*>( aDimension ); const PCB_DIM_ORTHOGONAL* ortho = dynamic_cast<const PCB_DIM_ORTHOGONAL*>( aDimension );
@ -803,7 +803,7 @@ void PCB_IO::format( const PCB_DIMENSION_BASE* aDimension, int aNestLevel ) cons
} }
void PCB_IO::format( const PCB_SHAPE* aShape, int aNestLevel ) const void PCB_PLUGIN::format( const PCB_SHAPE* aShape, int aNestLevel ) const
{ {
std::string locked = aShape->IsLocked() ? " locked" : ""; std::string locked = aShape->IsLocked() ? " locked" : "";
@ -937,7 +937,7 @@ void PCB_IO::format( const PCB_SHAPE* aShape, int aNestLevel ) const
} }
void PCB_IO::format( const FP_SHAPE* aFPShape, int aNestLevel ) const void PCB_PLUGIN::format( const FP_SHAPE* aFPShape, int aNestLevel ) const
{ {
std::string locked = aFPShape->IsLocked() ? " locked" : ""; std::string locked = aFPShape->IsLocked() ? " locked" : "";
@ -1045,7 +1045,7 @@ void PCB_IO::format( const FP_SHAPE* aFPShape, int aNestLevel ) const
break; break;
default: default:
wxFAIL_MSG( "PCB_IO::format not implemented for " + aFPShape->SHAPE_T_asString() ); wxFAIL_MSG( "PCB_PLUGIN::format not implemented for " + aFPShape->SHAPE_T_asString() );
return; return;
}; };
@ -1070,7 +1070,7 @@ void PCB_IO::format( const FP_SHAPE* aFPShape, int aNestLevel ) const
} }
void PCB_IO::format( const PCB_TARGET* aTarget, int aNestLevel ) const void PCB_PLUGIN::format( const PCB_TARGET* aTarget, int aNestLevel ) const
{ {
m_out->Print( aNestLevel, "(target %s (at %s) (size %s)", m_out->Print( aNestLevel, "(target %s (at %s) (size %s)",
( aTarget->GetShape() ) ? "x" : "plus", ( aTarget->GetShape() ) ? "x" : "plus",
@ -1088,7 +1088,7 @@ void PCB_IO::format( const PCB_TARGET* aTarget, int aNestLevel ) const
} }
void PCB_IO::format( const FOOTPRINT* aFootprint, int aNestLevel ) const void PCB_PLUGIN::format( const FOOTPRINT* aFootprint, int aNestLevel ) const
{ {
if( !( m_ctl & CTL_OMIT_INITIAL_COMMENTS ) ) if( !( m_ctl & CTL_OMIT_INITIAL_COMMENTS ) )
{ {
@ -1288,7 +1288,7 @@ void PCB_IO::format( const FOOTPRINT* aFootprint, int aNestLevel ) const
} }
void PCB_IO::formatLayers( LSET aLayerMask, int aNestLevel ) const void PCB_PLUGIN::formatLayers( LSET aLayerMask, int aNestLevel ) const
{ {
std::string output; std::string output;
@ -1374,7 +1374,7 @@ void PCB_IO::formatLayers( LSET aLayerMask, int aNestLevel ) const
} }
void PCB_IO::format( const PAD* aPad, int aNestLevel ) const void PCB_PLUGIN::format( const PAD* aPad, int aNestLevel ) const
{ {
const char* shape; const char* shape;
@ -1741,7 +1741,7 @@ void PCB_IO::format( const PAD* aPad, int aNestLevel ) const
} }
void PCB_IO::format( const PCB_TEXT* aText, int aNestLevel ) const void PCB_PLUGIN::format( const PCB_TEXT* aText, int aNestLevel ) const
{ {
m_out->Print( aNestLevel, "(gr_text %s (at %s", m_out->Print( aNestLevel, "(gr_text %s (at %s",
m_out->Quotew( aText->GetText() ).c_str(), m_out->Quotew( aText->GetText() ).c_str(),
@ -1765,7 +1765,7 @@ void PCB_IO::format( const PCB_TEXT* aText, int aNestLevel ) const
} }
void PCB_IO::format( const PCB_GROUP* aGroup, int aNestLevel ) const void PCB_PLUGIN::format( const PCB_GROUP* aGroup, int aNestLevel ) const
{ {
// Don't write empty groups // Don't write empty groups
if( aGroup->GetItems().empty() ) if( aGroup->GetItems().empty() )
@ -1793,7 +1793,7 @@ void PCB_IO::format( const PCB_GROUP* aGroup, int aNestLevel ) const
} }
void PCB_IO::format( const FP_TEXT* aText, int aNestLevel ) const void PCB_PLUGIN::format( const FP_TEXT* aText, int aNestLevel ) const
{ {
std::string type; std::string type;
@ -1858,7 +1858,7 @@ void PCB_IO::format( const FP_TEXT* aText, int aNestLevel ) const
} }
void PCB_IO::format( const PCB_TRACK* aTrack, int aNestLevel ) const void PCB_PLUGIN::format( const PCB_TRACK* aTrack, int aNestLevel ) const
{ {
if( aTrack->Type() == PCB_VIA_T ) if( aTrack->Type() == PCB_VIA_T )
{ {
@ -1958,7 +1958,7 @@ void PCB_IO::format( const PCB_TRACK* aTrack, int aNestLevel ) const
} }
void PCB_IO::format( const ZONE* aZone, int aNestLevel ) const void PCB_PLUGIN::format( const ZONE* aZone, int aNestLevel ) const
{ {
std::string locked = aZone->IsLocked() ? " locked" : ""; std::string locked = aZone->IsLocked() ? " locked" : "";
@ -2267,7 +2267,7 @@ void PCB_IO::format( const ZONE* aZone, int aNestLevel ) const
} }
PCB_IO::PCB_IO( int aControlFlags ) : PCB_PLUGIN::PCB_PLUGIN( int aControlFlags ) :
m_cache( nullptr ), m_cache( nullptr ),
m_ctl( aControlFlags ), m_ctl( aControlFlags ),
m_parser( new PCB_PARSER() ), m_parser( new PCB_PARSER() ),
@ -2278,7 +2278,7 @@ PCB_IO::PCB_IO( int aControlFlags ) :
} }
PCB_IO::~PCB_IO() PCB_PLUGIN::~PCB_PLUGIN()
{ {
delete m_cache; delete m_cache;
delete m_parser; delete m_parser;
@ -2286,7 +2286,7 @@ PCB_IO::~PCB_IO()
} }
BOARD* PCB_IO::Load( const wxString& aFileName, BOARD* aAppendToMe, const PROPERTIES* aProperties, BOARD* PCB_PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe, const PROPERTIES* aProperties,
PROJECT* aProject, PROGRESS_REPORTER* aProgressReporter ) PROJECT* aProject, PROGRESS_REPORTER* aProgressReporter )
{ {
FILE_LINE_READER reader( aFileName ); FILE_LINE_READER reader( aFileName );
@ -2316,7 +2316,7 @@ BOARD* PCB_IO::Load( const wxString& aFileName, BOARD* aAppendToMe, const PROPER
} }
BOARD* PCB_IO::DoLoad( LINE_READER& aReader, BOARD* aAppendToMe, const PROPERTIES* aProperties, BOARD* PCB_PLUGIN::DoLoad( LINE_READER& aReader, BOARD* aAppendToMe, const PROPERTIES* aProperties,
PROGRESS_REPORTER* aProgressReporter, unsigned aLineCount) PROGRESS_REPORTER* aProgressReporter, unsigned aLineCount)
{ {
init( aProperties ); init( aProperties );
@ -2355,7 +2355,7 @@ BOARD* PCB_IO::DoLoad( LINE_READER& aReader, BOARD* aAppendToMe, const PROPERTIE
} }
void PCB_IO::init( const PROPERTIES* aProperties ) void PCB_PLUGIN::init( const PROPERTIES* aProperties )
{ {
m_board = nullptr; m_board = nullptr;
m_reader = nullptr; m_reader = nullptr;
@ -2363,7 +2363,7 @@ void PCB_IO::init( const PROPERTIES* aProperties )
} }
void PCB_IO::validateCache( const wxString& aLibraryPath, bool checkModified ) void PCB_PLUGIN::validateCache( const wxString& aLibraryPath, bool checkModified )
{ {
if( !m_cache || !m_cache->IsPath( aLibraryPath ) || ( checkModified && m_cache->IsModified() ) ) if( !m_cache || !m_cache->IsPath( aLibraryPath ) || ( checkModified && m_cache->IsModified() ) )
{ {
@ -2375,7 +2375,7 @@ void PCB_IO::validateCache( const wxString& aLibraryPath, bool checkModified )
} }
void PCB_IO::FootprintEnumerate( wxArrayString& aFootprintNames, const wxString& aLibPath, void PCB_PLUGIN::FootprintEnumerate( wxArrayString& aFootprintNames, const wxString& aLibPath,
bool aBestEfforts, const PROPERTIES* aProperties ) bool aBestEfforts, const PROPERTIES* aProperties )
{ {
LOCALE_IO toggle; // toggles on, then off, the C locale. LOCALE_IO toggle; // toggles on, then off, the C locale.
@ -2404,7 +2404,7 @@ void PCB_IO::FootprintEnumerate( wxArrayString& aFootprintNames, const wxString&
} }
const FOOTPRINT* PCB_IO::getFootprint( const wxString& aLibraryPath, const FOOTPRINT* PCB_PLUGIN::getFootprint( const wxString& aLibraryPath,
const wxString& aFootprintName, const wxString& aFootprintName,
const PROPERTIES* aProperties, const PROPERTIES* aProperties,
bool checkModified ) bool checkModified )
@ -2432,7 +2432,7 @@ const FOOTPRINT* PCB_IO::getFootprint( const wxString& aLibraryPath,
} }
const FOOTPRINT* PCB_IO::GetEnumeratedFootprint( const wxString& aLibraryPath, const FOOTPRINT* PCB_PLUGIN::GetEnumeratedFootprint( const wxString& aLibraryPath,
const wxString& aFootprintName, const wxString& aFootprintName,
const PROPERTIES* aProperties ) const PROPERTIES* aProperties )
{ {
@ -2440,7 +2440,7 @@ const FOOTPRINT* PCB_IO::GetEnumeratedFootprint( const wxString& aLibraryPath,
} }
bool PCB_IO::FootprintExists( const wxString& aLibraryPath, const wxString& aFootprintName, bool PCB_PLUGIN::FootprintExists( const wxString& aLibraryPath, const wxString& aFootprintName,
const PROPERTIES* aProperties ) const PROPERTIES* aProperties )
{ {
// Note: checking the cache sounds like a good idea, but won't catch files which differ // Note: checking the cache sounds like a good idea, but won't catch files which differ
@ -2456,7 +2456,7 @@ bool PCB_IO::FootprintExists( const wxString& aLibraryPath, const wxString& aFoo
} }
FOOTPRINT* PCB_IO::FootprintLoad( const wxString& aLibraryPath, FOOTPRINT* PCB_PLUGIN::FootprintLoad( const wxString& aLibraryPath,
const wxString& aFootprintName, const wxString& aFootprintName,
bool aKeepUUID, bool aKeepUUID,
const PROPERTIES* aProperties ) const PROPERTIES* aProperties )
@ -2480,7 +2480,7 @@ FOOTPRINT* PCB_IO::FootprintLoad( const wxString& aLibraryPath,
} }
void PCB_IO::FootprintSave( const wxString& aLibraryPath, const FOOTPRINT* aFootprint, void PCB_PLUGIN::FootprintSave( const wxString& aLibraryPath, const FOOTPRINT* aFootprint,
const PROPERTIES* aProperties ) const PROPERTIES* aProperties )
{ {
LOCALE_IO toggle; // toggles on, then off, the C locale. LOCALE_IO toggle; // toggles on, then off, the C locale.
@ -2574,7 +2574,7 @@ void PCB_IO::FootprintSave( const wxString& aLibraryPath, const FOOTPRINT* aFoot
} }
void PCB_IO::FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName, void PCB_PLUGIN::FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName,
const PROPERTIES* aProperties ) const PROPERTIES* aProperties )
{ {
LOCALE_IO toggle; // toggles on, then off, the C locale. LOCALE_IO toggle; // toggles on, then off, the C locale.
@ -2594,13 +2594,13 @@ void PCB_IO::FootprintDelete( const wxString& aLibraryPath, const wxString& aFoo
long long PCB_IO::GetLibraryTimestamp( const wxString& aLibraryPath ) const long long PCB_PLUGIN::GetLibraryTimestamp( const wxString& aLibraryPath ) const
{ {
return FP_CACHE::GetTimestamp( aLibraryPath ); return FP_CACHE::GetTimestamp( aLibraryPath );
} }
void PCB_IO::FootprintLibCreate( const wxString& aLibraryPath, const PROPERTIES* aProperties ) void PCB_PLUGIN::FootprintLibCreate( const wxString& aLibraryPath, const PROPERTIES* aProperties )
{ {
if( wxDir::Exists( aLibraryPath ) ) if( wxDir::Exists( aLibraryPath ) )
{ {
@ -2618,7 +2618,7 @@ void PCB_IO::FootprintLibCreate( const wxString& aLibraryPath, const PROPERTIES*
} }
bool PCB_IO::FootprintLibDelete( const wxString& aLibraryPath, const PROPERTIES* aProperties ) bool PCB_PLUGIN::FootprintLibDelete( const wxString& aLibraryPath, const PROPERTIES* aProperties )
{ {
wxFileName fn; wxFileName fn;
fn.SetPath( aLibraryPath ); fn.SetPath( aLibraryPath );
@ -2695,7 +2695,7 @@ bool PCB_IO::FootprintLibDelete( const wxString& aLibraryPath, const PROPERTIES*
} }
bool PCB_IO::IsFootprintLibWritable( const wxString& aLibraryPath ) bool PCB_PLUGIN::IsFootprintLibWritable( const wxString& aLibraryPath )
{ {
LOCALE_IO toggle; LOCALE_IO toggle;

View File

@ -22,8 +22,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#ifndef KICAD_PLUGIN_H_ #ifndef PCB_PLUGIN_H
#define KICAD_PLUGIN_H_ #define PCB_PLUGIN_H
#include <io_mgr.h> #include <io_mgr.h>
#include <string> #include <string>
@ -128,7 +128,7 @@ class PCB_TEXT;
#define CTL_FOR_LIBRARY \ #define CTL_FOR_LIBRARY \
( CTL_OMIT_PAD_NETS | CTL_OMIT_TSTAMPS | CTL_OMIT_PATH | CTL_OMIT_AT | CTL_OMIT_LIBNAME ) ( CTL_OMIT_PAD_NETS | CTL_OMIT_TSTAMPS | CTL_OMIT_PATH | CTL_OMIT_AT | CTL_OMIT_LIBNAME )
/// The zero arg constructor when PCB_IO is used for PLUGIN::Load() and PLUGIN::Save()ing /// The zero arg constructor when PCB_PLUGIN is used for PLUGIN::Load() and PLUGIN::Save()ing
/// a BOARD file underneath IO_MGR. /// a BOARD file underneath IO_MGR.
#define CTL_FOR_BOARD (CTL_OMIT_INITIAL_COMMENTS|CTL_OMIT_FOOTPRINT_VERSION) #define CTL_FOR_BOARD (CTL_OMIT_INITIAL_COMMENTS|CTL_OMIT_FOOTPRINT_VERSION)
@ -138,7 +138,7 @@ class PCB_TEXT;
* *
* @note This class is not thread safe, but it is re-entrant multiple times in sequence. * @note This class is not thread safe, but it is re-entrant multiple times in sequence.
*/ */
class PCB_IO : public PLUGIN class PCB_PLUGIN : public PLUGIN
{ {
public: public:
const wxString PluginName() const override const wxString PluginName() const override
@ -195,9 +195,9 @@ public:
bool IsFootprintLibWritable( const wxString& aLibraryPath ) override; bool IsFootprintLibWritable( const wxString& aLibraryPath ) override;
PCB_IO( int aControlFlags = CTL_FOR_BOARD ); PCB_PLUGIN( int aControlFlags = CTL_FOR_BOARD );
virtual ~PCB_IO(); virtual ~PCB_PLUGIN();
/** /**
* Output \a aItem to \a aFormatter in s-expression format. * Output \a aItem to \a aFormatter in s-expression format.
@ -298,4 +298,4 @@ protected:
///< are stored with consecutive integers as net codes ///< are stored with consecutive integers as net codes
}; };
#endif // KICAD_PLUGIN_H_ #endif // PCB_PLUGIN_H

View File

@ -106,9 +106,9 @@ HANDLE_EXCEPTIONS(PLUGIN::FootprintEnumerate)
HANDLE_EXCEPTIONS(PLUGIN::FootprintLoad) HANDLE_EXCEPTIONS(PLUGIN::FootprintLoad)
HANDLE_EXCEPTIONS(PLUGIN::FootprintSave) HANDLE_EXCEPTIONS(PLUGIN::FootprintSave)
HANDLE_EXCEPTIONS(PLUGIN::FootprintDelete) HANDLE_EXCEPTIONS(PLUGIN::FootprintDelete)
%include <plugins/kicad/kicad_plugin.h> %include <plugins/kicad/pcb_plugin.h>
%{ %{
#include <plugins/kicad/kicad_plugin.h> #include <plugins/kicad/pcb_plugin.h>
%} %}

View File

@ -58,7 +58,7 @@ using namespace std::placeholders;
#include "pns_kicad_iface.h" #include "pns_kicad_iface.h"
#include <plugins/kicad/kicad_plugin.h> #include <plugins/kicad/pcb_plugin.h>
using namespace KIGFX; using namespace KIGFX;
@ -548,7 +548,7 @@ void ROUTER_TOOL::saveRouterDebugLog()
// Export as *.kicad_pcb format, using a strategy which is specifically chosen // Export as *.kicad_pcb format, using a strategy which is specifically chosen
// as an example on how it could also be used to send it to the system clipboard. // as an example on how it could also be used to send it to the system clipboard.
PCB_IO pcb_io; PCB_PLUGIN pcb_io;
pcb_io.Save( fname_dump.GetFullPath(), m_iface->GetBoard(), nullptr ); pcb_io.Save( fname_dump.GetFullPath(), m_iface->GetBoard(), nullptr );
} }

View File

@ -44,7 +44,7 @@ using namespace std::placeholders;
#include "pcb_selection_tool.h" #include "pcb_selection_tool.h"
#include "pcb_actions.h" #include "pcb_actions.h"
#include "plugins/kicad/kicad_plugin.h" #include "plugins/kicad/pcb_plugin.h"

View File

@ -7,7 +7,7 @@
#include <pcb_expr_evaluator.h> #include <pcb_expr_evaluator.h>
#include <io_mgr.h> #include <io_mgr.h>
#include <plugins/kicad/kicad_plugin.h> #include <plugins/kicad/pcb_plugin.h>
#include <unordered_set> #include <unordered_set>

View File

@ -32,7 +32,7 @@
#include <wx/cmdline.h> #include <wx/cmdline.h>
#include <board_item.h> #include <board_item.h>
#include <plugins/kicad/kicad_plugin.h> #include <plugins/kicad/pcb_plugin.h>
#include <plugins/kicad/pcb_parser.h> #include <plugins/kicad/pcb_parser.h>
#include <richio.h> #include <richio.h>

View File

@ -24,7 +24,7 @@
#include <pcbnew_utils/board_file_utils.h> #include <pcbnew_utils/board_file_utils.h>
// For PCB parsing // For PCB parsing
#include <plugins/kicad/kicad_plugin.h> #include <plugins/kicad/pcb_plugin.h>
#include <plugins/kicad/pcb_parser.h> #include <plugins/kicad/pcb_parser.h>
#include <richio.h> #include <richio.h>
@ -64,7 +64,7 @@ std::string GetPcbnewTestDataDir()
void DumpBoardToFile( BOARD& board, const std::string& aFilename ) void DumpBoardToFile( BOARD& board, const std::string& aFilename )
{ {
PCB_IO io; PCB_PLUGIN io;
io.Save( aFilename, &board ); io.Save( aFilename, &board );
} }

View File

@ -47,9 +47,9 @@ std::string GetPcbnewTestDataDir();
* Utility function to simply write a Board out to a file. * Utility function to simply write a Board out to a file.
* *
* Helps debug tests and utility programs by making it easy to quickly * Helps debug tests and utility programs by making it easy to quickly
* write to disk without directly using the PCB_IO API. * write to disk without directly using the PCB_PLUGIN API.
* *
* Note: The aBoard param is non-const because PCB_IO::Save demands it * Note: The aBoard param is non-const because PCB_PLUGIN::Save demands it
* and I am not confident a const_cast will be a true assurance. * and I am not confident a const_cast will be a true assurance.
* *
* @param aBoard the board to write out * @param aBoard the board to write out

View File

@ -88,7 +88,7 @@ bool PNS_LOG_FILE::Load( const std::string& logName, const std::string boardName
try try
{ {
PCB_IO io; PCB_PLUGIN io;
m_board.reset( io.Load( boardName.c_str(), nullptr, nullptr ) ); m_board.reset( io.Load( boardName.c_str(), nullptr, nullptr ) );
std::shared_ptr<DRC_ENGINE> drcEngine( new DRC_ENGINE ); std::shared_ptr<DRC_ENGINE> drcEngine( new DRC_ENGINE );

View File

@ -52,7 +52,7 @@
#include <pcbnew/board.h> #include <pcbnew/board.h>
#include <pcbnew/plugins/kicad/kicad_plugin.h> #include <pcbnew/plugins/kicad/pcb_plugin.h>
#include <pcbnew/plugins/kicad/pcb_parser.h> #include <pcbnew/plugins/kicad/pcb_parser.h>
#include <wx/treelist.h> #include <wx/treelist.h>

View File

@ -432,7 +432,7 @@ void PNS_LOG_VIEWER_FRAME::drawLoggedItems( int iter )
static BOARD* loadBoard( const std::string& filename ) static BOARD* loadBoard( const std::string& filename )
{ {
PLUGIN::RELEASER pi( new PCB_IO ); PLUGIN::RELEASER pi( new PCB_PLUGIN );
BOARD* brd = nullptr; BOARD* brd = nullptr;
try try

View File

@ -91,7 +91,7 @@ void PCB_TEST_FRAME_BASE::SetBoard( std::shared_ptr<BOARD> b )
BOARD* PCB_TEST_FRAME_BASE::LoadAndDisplayBoard( const std::string& filename ) BOARD* PCB_TEST_FRAME_BASE::LoadAndDisplayBoard( const std::string& filename )
{ {
PLUGIN::RELEASER pi( new PCB_IO ); PLUGIN::RELEASER pi( new PCB_PLUGIN );
BOARD* brd = nullptr; BOARD* brd = nullptr;
try try