Rename PCB IO classes/files

This commit is contained in:
Ian McInerney 2023-12-24 01:21:58 +00:00
parent 85f62c1fde
commit e6632bb983
70 changed files with 614 additions and 629 deletions

View File

@ -722,11 +722,11 @@ set( PCB_COMMON_SRCS
# IO files # IO files
${CMAKE_SOURCE_DIR}/pcbnew/pcb_io/pcb_io.cpp ${CMAKE_SOURCE_DIR}/pcbnew/pcb_io/pcb_io.cpp
${CMAKE_SOURCE_DIR}/pcbnew/pcb_io/pcb_io_mgr.cpp ${CMAKE_SOURCE_DIR}/pcbnew/pcb_io/pcb_io_mgr.cpp
${CMAKE_SOURCE_DIR}/pcbnew/pcb_io/legacy/legacy_plugin.cpp ${CMAKE_SOURCE_DIR}/pcbnew/pcb_io/kicad_legacy/pcb_io_kicad_legacy.cpp
${CMAKE_SOURCE_DIR}/pcbnew/pcb_io/kicad/pcb_plugin.cpp ${CMAKE_SOURCE_DIR}/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.cpp
${CMAKE_SOURCE_DIR}/pcbnew/pcb_io/kicad/pcb_parser.cpp ${CMAKE_SOURCE_DIR}/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.cpp
${CMAKE_SOURCE_DIR}/pcbnew/pcb_io/eagle/eagle_plugin.cpp ${CMAKE_SOURCE_DIR}/pcbnew/pcb_io/eagle/pcb_io_eagle.cpp
${CMAKE_SOURCE_DIR}/pcbnew/pcb_io/geda/gpcb_plugin.cpp ${CMAKE_SOURCE_DIR}/pcbnew/pcb_io/geda/pcb_io_geda.cpp
${CMAKE_SOURCE_DIR}/pcbnew/tools/pcb_grid_helper.cpp ${CMAKE_SOURCE_DIR}/pcbnew/tools/pcb_grid_helper.cpp
${CMAKE_SOURCE_DIR}/pcbnew/tools/pcb_actions.cpp ${CMAKE_SOURCE_DIR}/pcbnew/tools/pcb_actions.cpp

View File

@ -193,7 +193,7 @@ private:
for( int i = 0; i < aCount; ++i ) for( int i = 0; i < aCount; ++i )
{ {
// this fires on some eagle board after EAGLE_PLUGIN::Load() // this fires on some eagle board after PCB_IO_EAGLE::Load()
wxASSERT( unsigned( aLayers[i] ) <= unsigned( VIEW::VIEW_MAX_LAYERS ) ); wxASSERT( unsigned( aLayers[i] ) <= unsigned( VIEW::VIEW_MAX_LAYERS ) );
m_layers.push_back( aLayers[i] ); m_layers.push_back( aLayers[i] );

View File

@ -29,7 +29,7 @@
/** /**
* The set of pad shapes, used with PAD::{Set,Get}Shape() * The set of pad shapes, used with PAD::{Set,Get}Shape()
* *
* --> DO NOT REORDER, legacy_plugin is dependent on the integer values <-- * --> DO NOT REORDER, PCB_IO_KICAD_LEGACY is dependent on the integer values <--
*/ */
enum class PAD_SHAPE : int enum class PAD_SHAPE : int
{ {

View File

@ -40,7 +40,7 @@ grammar. The tipping point depends on whether you want to read only a small
portion of a much larger document. If so, then using the ptree will likely be a portion of a much larger document. If so, then using the ptree will likely be a
"faster to code" route. Documentation on how to navigate a ptree can be found on "faster to code" route. Documentation on how to navigate a ptree can be found on
the boost website and there are a number of examples in the the boost website and there are a number of examples in the
pcbnew/eagle_plugin.cpp file in this project. Powerful path navigation support pcbnew/pcb_io_eagle.cpp file in this project. Powerful path navigation support
makes it easy to extract a subset of a ptree. makes it easy to extract a subset of a ptree.
*/ */

View File

@ -70,7 +70,7 @@
#include <update_manager.h> #include <update_manager.h>
#include <../pcbnew/pcb_io/kicad/pcb_plugin.h> // for SEXPR_BOARD_FILE_VERSION def #include <../pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h> // for SEXPR_BOARD_FILE_VERSION def
#ifdef __WXMAC__ #ifdef __WXMAC__

View File

@ -32,7 +32,7 @@
#include <footprint_preview_panel.h> #include <footprint_preview_panel.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 <pcb_io/kicad/pcb_plugin.h> #include <pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h>
#include <wx/treebook.h> #include <wx/treebook.h>
@ -793,7 +793,7 @@ void PANEL_PCBNEW_COLOR_SETTINGS::createPreviewItems()
m_page->SetWidthMils( 6000 ); m_page->SetWidthMils( 6000 );
STRING_LINE_READER reader( g_previewBoard, wxT( "preview" ) ); STRING_LINE_READER reader( g_previewBoard, wxT( "preview" ) );
PCB_PLUGIN pi; PCB_IO_KICAD_SEXPR pi;
try try
{ {

View File

@ -58,8 +58,8 @@
#include <project/net_settings.h> #include <project/net_settings.h>
#include <io/common/plugin_common_choose_project.h> #include <io/common/plugin_common_choose_project.h>
#include <pcb_io/pcb_io_mgr.h> #include <pcb_io/pcb_io_mgr.h>
#include <pcb_io/cadstar/cadstar_pcb_archive_plugin.h> #include <pcb_io/cadstar/pcb_io_cadstar_archive.h>
#include <pcb_io/kicad/pcb_plugin.h> #include <pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h>
#include <dialogs/dialog_export_2581.h> #include <dialogs/dialog_export_2581.h>
#include <dialogs/dialog_imported_layers.h> #include <dialogs/dialog_imported_layers.h>
#include <dialogs/dialog_import_choose_project.h> #include <dialogs/dialog_import_choose_project.h>
@ -653,7 +653,7 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
if( m_importProperties ) if( m_importProperties )
props.insert( m_importProperties->begin(), m_importProperties->end() ); props.insert( m_importProperties->begin(), m_importProperties->end() );
// EAGLE_PLUGIN can use this info to center the BOARD, but it does not yet. // PCB_IO_EAGLE can use this info to center the BOARD, but it does not yet.
props["page_width"] = std::to_string( GetPageSizeIU().x ); props["page_width"] = std::to_string( GetPageSizeIU().x );
props["page_height"] = std::to_string( GetPageSizeIU().y ); props["page_height"] = std::to_string( GetPageSizeIU().y );

View File

@ -42,8 +42,8 @@
#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 <pcb_io/kicad/pcb_plugin.h> #include <pcb_io/kicad_legacy/pcb_io_kicad_legacy.h>
#include <pcb_io/legacy/legacy_plugin.h> #include <pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h>
#include <env_paths.h> #include <env_paths.h>
#include <paths.h> #include <paths.h>
#include <settings/settings_manager.h> #include <settings/settings_manager.h>
@ -250,7 +250,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_PLUGIN pcb_io(CTL_FOR_LIBRARY ); PCB_IO_KICAD_SEXPR 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

@ -23,8 +23,8 @@
#include "kigit_pcb_merge.h" #include "kigit_pcb_merge.h"
#include <pcb_io/kicad/pcb_plugin.h> #include <pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h>
#include <pcb_io/kicad/pcb_parser.h> #include <pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.h>
#include <richio.h> #include <richio.h>
#include <board.h> #include <board.h>
@ -111,11 +111,11 @@ int KIGIT_PCB_MERGE::Merge()
// Get the raw data from the blobs // Get the raw data from the blobs
BLOB_READER ancestor_reader( ancestor_blob ); BLOB_READER ancestor_reader( ancestor_blob );
PCB_PARSER ancestor_parser( &ancestor_reader, nullptr, nullptr ); PCB_IO_KICAD_SEXPR_PARSER ancestor_parser( &ancestor_reader, nullptr, nullptr );
BLOB_READER ours_reader( ours_blob ); BLOB_READER ours_reader( ours_blob );
PCB_PARSER ours_parser( &ours_reader, nullptr, nullptr ); PCB_IO_KICAD_SEXPR_PARSER ours_parser( &ours_reader, nullptr, nullptr );
BLOB_READER theirs_reader( theirs_blob ); BLOB_READER theirs_reader( theirs_blob );
PCB_PARSER theirs_parser( &theirs_reader, nullptr, nullptr ); PCB_IO_KICAD_SEXPR_PARSER theirs_parser( &theirs_reader, nullptr, nullptr );
std::unique_ptr<BOARD> ancestor_board; std::unique_ptr<BOARD> ancestor_board;
std::unique_ptr<BOARD> ours_board; std::unique_ptr<BOARD> ours_board;
@ -167,7 +167,7 @@ std::unique_ptr<BOARD> readBoard( wxString& aFilename )
// Take input from stdin // Take input from stdin
FILE_LINE_READER reader( aFilename ); FILE_LINE_READER reader( aFilename );
PCB_PARSER parser( &reader, nullptr, nullptr ); PCB_IO_KICAD_SEXPR_PARSER parser( &reader, nullptr, nullptr );
std::unique_ptr<BOARD> board; std::unique_ptr<BOARD> board;
try try

View File

@ -37,13 +37,13 @@
#include <zone.h> #include <zone.h>
#include <locale_io.h> #include <locale_io.h>
#include <netinfo.h> #include <netinfo.h>
#include <pcb_io/kicad/pcb_parser.h> #include <pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h>
#include <pcb_io/kicad/pcb_plugin.h> #include <pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.h>
#include <kicad_clipboard.h> #include <kicad_clipboard.h>
#include "confirm.h" #include "confirm.h"
CLIPBOARD_IO::CLIPBOARD_IO(): CLIPBOARD_IO::CLIPBOARD_IO():
PCB_PLUGIN(CTL_FOR_CLIPBOARD ), PCB_IO_KICAD_SEXPR(CTL_FOR_CLIPBOARD ),
m_formatter() m_formatter()
{ {
m_out = &m_formatter; m_out = &m_formatter;
@ -318,7 +318,7 @@ BOARD_ITEM* CLIPBOARD_IO::Parse()
try try
{ {
item = PCB_PLUGIN::Parse( result ); item = PCB_IO_KICAD_SEXPR::Parse( result );
} }
catch (...) catch (...)
{ {
@ -411,7 +411,7 @@ BOARD* CLIPBOARD_IO::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
}; };
STRING_LINE_READER reader( result, wxT( "clipboard" ) ); STRING_LINE_READER reader( result, wxT( "clipboard" ) );
PCB_PARSER parser( &reader, aAppendToMe, queryUser ); PCB_IO_KICAD_SEXPR_PARSER parser( &reader, aAppendToMe, queryUser );
init( aProperties ); init( aProperties );

View File

@ -32,20 +32,20 @@
#include <board_item.h> #include <board_item.h>
#include <footprint.h> #include <footprint.h>
#include <pcb_io/kicad/pcb_plugin.h> #include <pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h>
#include <pcb_io/kicad/pcb_parser.h> #include <pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.h>
#include <memory.h> #include <memory.h>
#include <tools/pcb_selection.h> #include <tools/pcb_selection.h>
class CLIPBOARD_IO : public PCB_PLUGIN class CLIPBOARD_IO : public PCB_IO_KICAD_SEXPR
{ {
public: public:
CLIPBOARD_IO(); CLIPBOARD_IO();
~CLIPBOARD_IO(); ~CLIPBOARD_IO();
/* /*
* Saves the entire board to the clipboard formatted using the PCB_PLUGIN formatting * Saves the entire board to the clipboard formatted using the PCB_IO_KICAD_SEXPR formatting
*/ */
void SaveBoard( const wxString& aFileName, BOARD* aBoard, void SaveBoard( const wxString& aFileName, BOARD* aBoard,
const STRING_UTF8_MAP* aProperties = nullptr, const STRING_UTF8_MAP* aProperties = nullptr,
@ -53,7 +53,7 @@ public:
/* /*
* 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_PLUGIN to clipboard as sexpr text * BOARD_ITEMs found in selection formatted by PCB_IO_KICAD_SEXPR to clipboard as sexpr text
*/ */
void SaveSelection( const PCB_SELECTION& selected, bool isFootprintEditor ); void SaveSelection( const PCB_SELECTION& selected, bool isFootprintEditor );

View File

@ -2,13 +2,13 @@
# Sources for the pcbnew PLUGIN called ALTIUM_DESIGNER_PLUGIN, ALTIUM_CIRCUIT_STUDIO_PLUGIN and ALTIUM_CIRCUIT_MAKER_PLUGIN # Sources for the pcbnew PLUGIN called ALTIUM_DESIGNER_PLUGIN, ALTIUM_CIRCUIT_STUDIO_PLUGIN and ALTIUM_CIRCUIT_MAKER_PLUGIN
set( ALTIUM2PCBNEW_SRCS set( ALTIUM2PCBNEW_SRCS
altium_circuit_maker_plugin.cpp
altium_circuit_studio_plugin.cpp
altium_designer_plugin.cpp
altium_parser_pcb.cpp altium_parser_pcb.cpp
altium_pcb.cpp altium_pcb.cpp
altium_rule_transformer.cpp altium_rule_transformer.cpp
solidworks_pcb_plugin.cpp pcb_io_altium_circuit_maker.cpp
pcb_io_altium_circuit_studio.cpp
pcb_io_altium_designer.cpp
pcb_io_solidworks.cpp
) )
add_library( altium2pcbnew STATIC ${ALTIUM2PCBNEW_SRCS} ) add_library( altium2pcbnew STATIC ${ALTIUM2PCBNEW_SRCS} )

View File

@ -23,14 +23,13 @@
*/ */
/** /**
* @file altium_circuit_maker_plugin.cpp * @brief Pcbnew PLUGIN for Altium *.PcbDoc format.
* @brief Pcbnew PLUGIN for Altium *.PcbDoc format.
*/ */
#include <wx/string.h> #include <wx/string.h>
#include <altium_circuit_maker_plugin.h> #include <pcb_io_altium_circuit_maker.h>
#include <altium_designer_plugin.h> #include <pcb_io_altium_designer.h>
#include <altium_pcb.h> #include <altium_pcb.h>
#include <io/altium/altium_parser.h> #include <io/altium/altium_parser.h>
#include <pcb_io/pcb_io.h> #include <pcb_io/pcb_io.h>
@ -40,40 +39,40 @@
#include <compoundfilereader.h> #include <compoundfilereader.h>
#include <utf.h> #include <utf.h>
ALTIUM_CIRCUIT_MAKER_PLUGIN::ALTIUM_CIRCUIT_MAKER_PLUGIN() PCB_IO_ALTIUM_CIRCUIT_MAKER::PCB_IO_ALTIUM_CIRCUIT_MAKER()
{ {
m_board = nullptr; m_board = nullptr;
m_props = nullptr; m_props = nullptr;
} }
ALTIUM_CIRCUIT_MAKER_PLUGIN::~ALTIUM_CIRCUIT_MAKER_PLUGIN() PCB_IO_ALTIUM_CIRCUIT_MAKER::~PCB_IO_ALTIUM_CIRCUIT_MAKER()
{ {
} }
const wxString ALTIUM_CIRCUIT_MAKER_PLUGIN::PluginName() const const wxString PCB_IO_ALTIUM_CIRCUIT_MAKER::PluginName() const
{ {
return wxT( "Altium Circuit Maker" ); return wxT( "Altium Circuit Maker" );
} }
PLUGIN_FILE_DESC ALTIUM_CIRCUIT_MAKER_PLUGIN::GetBoardFileDesc() const PLUGIN_FILE_DESC PCB_IO_ALTIUM_CIRCUIT_MAKER::GetBoardFileDesc() const
{ {
return PLUGIN_FILE_DESC( _HKI( "Altium Circuit Maker PCB files" ), { "CMPcbDoc" } ); return PLUGIN_FILE_DESC( _HKI( "Altium Circuit Maker PCB files" ), { "CMPcbDoc" } );
} }
bool ALTIUM_CIRCUIT_MAKER_PLUGIN::CanReadBoard( const wxString& aFileName ) const bool PCB_IO_ALTIUM_CIRCUIT_MAKER::CanReadBoard( const wxString& aFileName ) const
{ {
if( !PCB_IO::CanReadBoard( aFileName ) ) if( !PCB_IO::CanReadBoard( aFileName ) )
return false; return false;
return ALTIUM_DESIGNER_PLUGIN::checkFileHeader( aFileName ); return PCB_IO_ALTIUM_DESIGNER::checkFileHeader( aFileName );
} }
BOARD* ALTIUM_CIRCUIT_MAKER_PLUGIN::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, BOARD* PCB_IO_ALTIUM_CIRCUIT_MAKER::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties, const STRING_UTF8_MAP* aProperties,
PROJECT* aProject, PROJECT* aProject,
PROGRESS_REPORTER* aProgressReporter ) PROGRESS_REPORTER* aProgressReporter )

View File

@ -22,14 +22,14 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#ifndef ALTIUM_CIRCUIT_MAKER_PLUGIN_H_ #ifndef PCB_IO_ALTIUM_CIRCUIT_MAKER_H_
#define ALTIUM_CIRCUIT_MAKER_PLUGIN_H_ #define PCB_IO_ALTIUM_CIRCUIT_MAKER_H_
#include <pcb_io/pcb_io.h> #include <pcb_io/pcb_io.h>
#include <pcb_io/pcb_io_mgr.h> #include <pcb_io/pcb_io_mgr.h>
class ALTIUM_CIRCUIT_MAKER_PLUGIN : public PCB_IO class PCB_IO_ALTIUM_CIRCUIT_MAKER : public PCB_IO
{ {
public: public:
const wxString PluginName() const override; const wxString PluginName() const override;
@ -48,12 +48,12 @@ public:
return 0; return 0;
} }
ALTIUM_CIRCUIT_MAKER_PLUGIN(); PCB_IO_ALTIUM_CIRCUIT_MAKER();
~ALTIUM_CIRCUIT_MAKER_PLUGIN(); ~PCB_IO_ALTIUM_CIRCUIT_MAKER();
private: private:
const STRING_UTF8_MAP* m_props; const STRING_UTF8_MAP* m_props;
BOARD* m_board; BOARD* m_board;
}; };
#endif // ALTIUM_CIRCUIT_MAKER_PLUGIN_H_ #endif // PCB_IO_ALTIUM_CIRCUIT_MAKER_H_

View File

@ -23,14 +23,13 @@
*/ */
/** /**
* @file altium_circuit_studio_plugin.cpp * @brief Pcbnew PLUGIN for Altium *.PcbDoc format.
* @brief Pcbnew PLUGIN for Altium *.PcbDoc format.
*/ */
#include <wx/string.h> #include <wx/string.h>
#include <altium_circuit_studio_plugin.h> #include <pcb_io_altium_circuit_studio.h>
#include <altium_designer_plugin.h> #include <pcb_io_altium_designer.h>
#include <altium_pcb.h> #include <altium_pcb.h>
#include <io/altium/altium_parser.h> #include <io/altium/altium_parser.h>
#include <pcb_io/pcb_io.h> #include <pcb_io/pcb_io.h>
@ -40,40 +39,40 @@
#include <compoundfilereader.h> #include <compoundfilereader.h>
#include <utf.h> #include <utf.h>
ALTIUM_CIRCUIT_STUDIO_PLUGIN::ALTIUM_CIRCUIT_STUDIO_PLUGIN() PCB_IO_ALTIUM_CIRCUIT_STUDIO::PCB_IO_ALTIUM_CIRCUIT_STUDIO()
{ {
m_board = nullptr; m_board = nullptr;
m_props = nullptr; m_props = nullptr;
} }
ALTIUM_CIRCUIT_STUDIO_PLUGIN::~ALTIUM_CIRCUIT_STUDIO_PLUGIN() PCB_IO_ALTIUM_CIRCUIT_STUDIO::~PCB_IO_ALTIUM_CIRCUIT_STUDIO()
{ {
} }
const wxString ALTIUM_CIRCUIT_STUDIO_PLUGIN::PluginName() const const wxString PCB_IO_ALTIUM_CIRCUIT_STUDIO::PluginName() const
{ {
return wxT( "Altium Circuit Studio" ); return wxT( "Altium Circuit Studio" );
} }
PLUGIN_FILE_DESC ALTIUM_CIRCUIT_STUDIO_PLUGIN::GetBoardFileDesc() const PLUGIN_FILE_DESC PCB_IO_ALTIUM_CIRCUIT_STUDIO::GetBoardFileDesc() const
{ {
return PLUGIN_FILE_DESC( _HKI( "Altium Circuit Studio PCB files" ), { "CSPcbDoc" } ); return PLUGIN_FILE_DESC( _HKI( "Altium Circuit Studio PCB files" ), { "CSPcbDoc" } );
} }
bool ALTIUM_CIRCUIT_STUDIO_PLUGIN::CanReadBoard( const wxString& aFileName ) const bool PCB_IO_ALTIUM_CIRCUIT_STUDIO::CanReadBoard( const wxString& aFileName ) const
{ {
if( !PCB_IO::CanReadBoard( aFileName ) ) if( !PCB_IO::CanReadBoard( aFileName ) )
return false; return false;
return ALTIUM_DESIGNER_PLUGIN::checkFileHeader( aFileName ); return PCB_IO_ALTIUM_DESIGNER::checkFileHeader( aFileName );
} }
BOARD* ALTIUM_CIRCUIT_STUDIO_PLUGIN::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, BOARD* PCB_IO_ALTIUM_CIRCUIT_STUDIO::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties, const STRING_UTF8_MAP* aProperties,
PROJECT* aProject, PROJECT* aProject,
PROGRESS_REPORTER* aProgressReporter ) PROGRESS_REPORTER* aProgressReporter )

View File

@ -22,13 +22,13 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#ifndef ALTIUM_CIRCUIT_STUDIO_PLUGIN_H_ #ifndef PCB_IO_ALTIUM_CIRCUIT_STUDIO_H_
#define ALTIUM_CIRCUIT_STUDIO_PLUGIN_H_ #define PCB_IO_ALTIUM_CIRCUIT_STUDIO_H_
#include <pcb_io/pcb_io.h> #include <pcb_io/pcb_io.h>
#include <pcb_io/pcb_io_mgr.h> #include <pcb_io/pcb_io_mgr.h>
class ALTIUM_CIRCUIT_STUDIO_PLUGIN : public PCB_IO class PCB_IO_ALTIUM_CIRCUIT_STUDIO : public PCB_IO
{ {
public: public:
const wxString PluginName() const override; const wxString PluginName() const override;
@ -47,12 +47,12 @@ public:
return 0; return 0;
} }
ALTIUM_CIRCUIT_STUDIO_PLUGIN(); PCB_IO_ALTIUM_CIRCUIT_STUDIO();
~ALTIUM_CIRCUIT_STUDIO_PLUGIN(); ~PCB_IO_ALTIUM_CIRCUIT_STUDIO();
private: private:
const STRING_UTF8_MAP* m_props; const STRING_UTF8_MAP* m_props;
BOARD* m_board; BOARD* m_board;
}; };
#endif // ALTIUM_CIRCUIT_STUDIO_PLUGIN_H_ #endif // PCB_IO_ALTIUM_CIRCUIT_STUDIO_H_

View File

@ -23,13 +23,12 @@
*/ */
/** /**
* @file altium_designer_plugin.cpp
* @brief Pcbnew PLUGIN for Altium *.PcbDoc format. * @brief Pcbnew PLUGIN for Altium *.PcbDoc format.
*/ */
#include <wx/string.h> #include <wx/string.h>
#include <altium_designer_plugin.h> #include <pcb_io_altium_designer.h>
#include <altium_pcb.h> #include <altium_pcb.h>
#include <io/io_utils.h> #include <io/io_utils.h>
#include <io/altium/altium_parser.h> #include <io/altium/altium_parser.h>
@ -40,26 +39,26 @@
#include <compoundfilereader.h> #include <compoundfilereader.h>
#include <utf.h> #include <utf.h>
ALTIUM_DESIGNER_PLUGIN::ALTIUM_DESIGNER_PLUGIN() PCB_IO_ALTIUM_DESIGNER::PCB_IO_ALTIUM_DESIGNER()
{ {
m_board = nullptr; m_board = nullptr;
m_props = nullptr; m_props = nullptr;
} }
ALTIUM_DESIGNER_PLUGIN::~ALTIUM_DESIGNER_PLUGIN() PCB_IO_ALTIUM_DESIGNER::~PCB_IO_ALTIUM_DESIGNER()
{ {
} }
bool ALTIUM_DESIGNER_PLUGIN::checkFileHeader( const wxString& aFileName ) bool PCB_IO_ALTIUM_DESIGNER::checkFileHeader( const wxString& aFileName )
{ {
// Compound File Binary Format header // Compound File Binary Format header
return IO_UTILS::fileStartsWithBinaryHeader( aFileName, IO_UTILS::COMPOUND_FILE_HEADER ); return IO_UTILS::fileStartsWithBinaryHeader( aFileName, IO_UTILS::COMPOUND_FILE_HEADER );
} }
bool ALTIUM_DESIGNER_PLUGIN::CanReadBoard( const wxString& aFileName ) const bool PCB_IO_ALTIUM_DESIGNER::CanReadBoard( const wxString& aFileName ) const
{ {
if( !PCB_IO::CanReadBoard( aFileName ) ) if( !PCB_IO::CanReadBoard( aFileName ) )
return false; return false;
@ -68,7 +67,7 @@ bool ALTIUM_DESIGNER_PLUGIN::CanReadBoard( const wxString& aFileName ) const
} }
bool ALTIUM_DESIGNER_PLUGIN::CanReadFootprintLib( const wxString& aFileName ) const bool PCB_IO_ALTIUM_DESIGNER::CanReadFootprintLib( const wxString& aFileName ) const
{ {
if( !PCB_IO::CanReadFootprintLib( aFileName ) ) if( !PCB_IO::CanReadFootprintLib( aFileName ) )
return false; return false;
@ -77,7 +76,7 @@ bool ALTIUM_DESIGNER_PLUGIN::CanReadFootprintLib( const wxString& aFileName ) co
} }
BOARD* ALTIUM_DESIGNER_PLUGIN::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, BOARD* PCB_IO_ALTIUM_DESIGNER::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties, PROJECT* aProject, const STRING_UTF8_MAP* aProperties, PROJECT* aProject,
PROGRESS_REPORTER* aProgressReporter ) PROGRESS_REPORTER* aProgressReporter )
{ {
@ -132,7 +131,7 @@ BOARD* ALTIUM_DESIGNER_PLUGIN::LoadBoard( const wxString& aFileName, BOARD* aApp
} }
long long ALTIUM_DESIGNER_PLUGIN::GetLibraryTimestamp( const wxString& aLibraryPath ) const long long PCB_IO_ALTIUM_DESIGNER::GetLibraryTimestamp( const wxString& aLibraryPath ) const
{ {
// File hasn't been loaded yet. // File hasn't been loaded yet.
if( aLibraryPath.IsEmpty() ) if( aLibraryPath.IsEmpty() )
@ -153,7 +152,7 @@ long long ALTIUM_DESIGNER_PLUGIN::GetLibraryTimestamp( const wxString& aLibraryP
} }
void ALTIUM_DESIGNER_PLUGIN::loadAltiumLibrary( const wxString& aLibraryPath ) void PCB_IO_ALTIUM_DESIGNER::loadAltiumLibrary( const wxString& aLibraryPath )
{ {
try try
{ {
@ -186,7 +185,7 @@ void ALTIUM_DESIGNER_PLUGIN::loadAltiumLibrary( const wxString& aLibraryPath )
} }
void ALTIUM_DESIGNER_PLUGIN::FootprintEnumerate( wxArrayString& aFootprintNames, void PCB_IO_ALTIUM_DESIGNER::FootprintEnumerate( wxArrayString& aFootprintNames,
const wxString& aLibraryPath, bool aBestEfforts, const wxString& aLibraryPath, bool aBestEfforts,
const STRING_UTF8_MAP* aProperties ) const STRING_UTF8_MAP* aProperties )
{ {
@ -261,7 +260,7 @@ void ALTIUM_DESIGNER_PLUGIN::FootprintEnumerate( wxArrayString& aFootprintNames
} }
FOOTPRINT* ALTIUM_DESIGNER_PLUGIN::FootprintLoad( const wxString& aLibraryPath, FOOTPRINT* PCB_IO_ALTIUM_DESIGNER::FootprintLoad( const wxString& aLibraryPath,
const wxString& aFootprintName, bool aKeepUUID, const wxString& aFootprintName, bool aKeepUUID,
const STRING_UTF8_MAP* aProperties ) const STRING_UTF8_MAP* aProperties )
{ {

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 ALTIUM_DESIGNER_PLUGIN_H_ #ifndef PCB_IO_ALTIUM_DESIGNER_H_
#define ALTIUM_DESIGNER_PLUGIN_H_ #define PCB_IO_ALTIUM_DESIGNER_H_
#include <pcb_io/pcb_io.h> #include <pcb_io/pcb_io.h>
#include <pcb_io/pcb_io_mgr.h> #include <pcb_io/pcb_io_mgr.h>
@ -33,7 +33,7 @@
class ALTIUM_COMPOUND_FILE; class ALTIUM_COMPOUND_FILE;
class ALTIUM_DESIGNER_PLUGIN : public PCB_IO class PCB_IO_ALTIUM_DESIGNER : public PCB_IO
{ {
public: public:
// -----<PUBLIC PCB_IO API>-------------------------------------------------- // -----<PUBLIC PCB_IO API>--------------------------------------------------
@ -75,8 +75,8 @@ public:
// -----</PUBLIC PCB_IO API>------------------------------------------------- // -----</PUBLIC PCB_IO API>-------------------------------------------------
ALTIUM_DESIGNER_PLUGIN(); PCB_IO_ALTIUM_DESIGNER();
~ALTIUM_DESIGNER_PLUGIN(); ~PCB_IO_ALTIUM_DESIGNER();
static bool checkFileHeader( const wxString& aFileName ); static bool checkFileHeader( const wxString& aFileName );
@ -89,4 +89,4 @@ private:
void loadAltiumLibrary( const wxString& aLibraryPath ); void loadAltiumLibrary( const wxString& aLibraryPath );
}; };
#endif // ALTIUM_DESIGNER_PLUGIN_H_ #endif // PCB_IO_ALTIUM_DESIGNER_H_

View File

@ -19,8 +19,8 @@
#include <wx/string.h> #include <wx/string.h>
#include <solidworks_pcb_plugin.h> #include <pcb_io_solidworks.h>
#include <altium_designer_plugin.h> #include <pcb_io_altium_designer.h>
#include <altium_pcb.h> #include <altium_pcb.h>
#include <io/altium/altium_parser.h> #include <io/altium/altium_parser.h>
#include <pcb_io/pcb_io.h> #include <pcb_io/pcb_io.h>
@ -30,40 +30,40 @@
#include <compoundfilereader.h> #include <compoundfilereader.h>
#include <utf.h> #include <utf.h>
SOLIDWORKS_PCB_PLUGIN::SOLIDWORKS_PCB_PLUGIN() PCB_IO_SOLIDWORKS::PCB_IO_SOLIDWORKS()
{ {
m_board = nullptr; m_board = nullptr;
m_props = nullptr; m_props = nullptr;
} }
SOLIDWORKS_PCB_PLUGIN::~SOLIDWORKS_PCB_PLUGIN() PCB_IO_SOLIDWORKS::~PCB_IO_SOLIDWORKS()
{ {
} }
const wxString SOLIDWORKS_PCB_PLUGIN::PluginName() const const wxString PCB_IO_SOLIDWORKS::PluginName() const
{ {
return wxT( "Solidworks PCB" ); return wxT( "Solidworks PCB" );
} }
PLUGIN_FILE_DESC SOLIDWORKS_PCB_PLUGIN::GetBoardFileDesc() const PLUGIN_FILE_DESC PCB_IO_SOLIDWORKS::GetBoardFileDesc() const
{ {
return PLUGIN_FILE_DESC( _HKI( "Solidworks PCB files" ), { "SWPcbDoc" } ); return PLUGIN_FILE_DESC( _HKI( "Solidworks PCB files" ), { "SWPcbDoc" } );
} }
bool SOLIDWORKS_PCB_PLUGIN::CanReadBoard( const wxString& aFileName ) const bool PCB_IO_SOLIDWORKS::CanReadBoard( const wxString& aFileName ) const
{ {
if( !PCB_IO::CanReadBoard( aFileName ) ) if( !PCB_IO::CanReadBoard( aFileName ) )
return false; return false;
return ALTIUM_DESIGNER_PLUGIN::checkFileHeader( aFileName ); return PCB_IO_ALTIUM_DESIGNER::checkFileHeader( aFileName );
} }
BOARD* SOLIDWORKS_PCB_PLUGIN::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, BOARD* PCB_IO_SOLIDWORKS::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties, PROJECT* aProject, const STRING_UTF8_MAP* aProperties, PROJECT* aProject,
PROGRESS_REPORTER* aProgressReporter ) PROGRESS_REPORTER* aProgressReporter )
{ {

View File

@ -17,13 +17,13 @@
* with this program. If not, see <http://www.gnu.org/licenses/>. * with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef KICAD_SOLIDWORKS_PCB_PLUGIN_H #ifndef PCB_IO_SOLIDWORKS_H_
#define KICAD_SOLIDWORKS_PCB_PLUGIN_H #define PCB_IO_SOLIDWORKS_H_
#include <pcb_io/pcb_io.h> #include <pcb_io/pcb_io.h>
#include <pcb_io/pcb_io_mgr.h> #include <pcb_io/pcb_io_mgr.h>
class SOLIDWORKS_PCB_PLUGIN : public PCB_IO class PCB_IO_SOLIDWORKS : public PCB_IO
{ {
public: public:
const wxString PluginName() const override; const wxString PluginName() const override;
@ -41,8 +41,8 @@ public:
return 0; return 0;
} }
SOLIDWORKS_PCB_PLUGIN(); PCB_IO_SOLIDWORKS();
~SOLIDWORKS_PCB_PLUGIN(); ~PCB_IO_SOLIDWORKS();
private: private:
const STRING_UTF8_MAP* m_props; const STRING_UTF8_MAP* m_props;
@ -51,4 +51,4 @@ private:
#endif //KICAD_SOLIDWORKS_PCB_PLUGIN_H #endif //PCB_IO_SOLIDWORKS_H_

View File

@ -2,9 +2,9 @@
include_directories( . ) include_directories( . )
set( CADSTAR2PCBNEW_SRCS set( CADSTAR2PCBNEW_SRCS
cadstar_pcb_archive_plugin.cpp
cadstar_pcb_archive_parser.cpp cadstar_pcb_archive_parser.cpp
cadstar_pcb_archive_loader.cpp cadstar_pcb_archive_loader.cpp
pcb_io_cadstar_archive.cpp
) )
add_library( cadstar2pcbnew STATIC ${CADSTAR2PCBNEW_SRCS} ) add_library( cadstar2pcbnew STATIC ${CADSTAR2PCBNEW_SRCS} )

View File

@ -27,7 +27,7 @@
#define CADSTAR_PCB_ARCHIVE_LOADER_H_ #define CADSTAR_PCB_ARCHIVE_LOADER_H_
#include <cadstar_pcb_archive_parser.h> #include <cadstar_pcb_archive_parser.h>
#include <cadstar_pcb_archive_plugin.h> #include <pcb_io_cadstar_archive.h>
#include <board.h> #include <board.h>
#include <footprint.h> #include <footprint.h>

View File

@ -19,13 +19,12 @@
*/ */
/** /**
* @file cadstar_pcb_archive_plugin.cpp
* @brief Pcbnew PLUGIN for CADSTAR PCB Archive (*.cpa) format: an ASCII format * @brief Pcbnew PLUGIN for CADSTAR PCB Archive (*.cpa) format: an ASCII format
* based on S-expressions. * based on S-expressions.
*/ */
#include <cadstar_pcb_archive_loader.h> #include <cadstar_pcb_archive_loader.h>
#include <cadstar_pcb_archive_plugin.h> #include <pcb_io_cadstar_archive.h>
#include <board.h> #include <board.h>
#include <footprint.h> #include <footprint.h>
#include <string_utf8_map.h> #include <string_utf8_map.h>
@ -33,7 +32,7 @@
#include <pcb_io/pcb_io.h> #include <pcb_io/pcb_io.h>
std::map<wxString, PCB_LAYER_ID> CADSTAR_PCB_ARCHIVE_PLUGIN::DefaultLayerMappingCallback( std::map<wxString, PCB_LAYER_ID> PCB_IO_CADSTAR_ARCHIVE::DefaultLayerMappingCallback(
const std::vector<INPUT_LAYER_DESC>& aInputLayerDescriptionVector ) const std::vector<INPUT_LAYER_DESC>& aInputLayerDescriptionVector )
{ {
std::map<wxString, PCB_LAYER_ID> retval; std::map<wxString, PCB_LAYER_ID> retval;
@ -48,7 +47,7 @@ std::map<wxString, PCB_LAYER_ID> CADSTAR_PCB_ARCHIVE_PLUGIN::DefaultLayerMapping
} }
void CADSTAR_PCB_ARCHIVE_PLUGIN::RegisterLayerMappingCallback( void PCB_IO_CADSTAR_ARCHIVE::RegisterLayerMappingCallback(
LAYER_MAPPING_HANDLER aLayerMappingHandler ) LAYER_MAPPING_HANDLER aLayerMappingHandler )
{ {
LAYER_REMAPPABLE_PLUGIN::RegisterLayerMappingCallback( aLayerMappingHandler ); LAYER_REMAPPABLE_PLUGIN::RegisterLayerMappingCallback( aLayerMappingHandler );
@ -56,23 +55,23 @@ void CADSTAR_PCB_ARCHIVE_PLUGIN::RegisterLayerMappingCallback(
} }
CADSTAR_PCB_ARCHIVE_PLUGIN::CADSTAR_PCB_ARCHIVE_PLUGIN() PCB_IO_CADSTAR_ARCHIVE::PCB_IO_CADSTAR_ARCHIVE()
{ {
m_board = nullptr; m_board = nullptr;
m_props = nullptr; m_props = nullptr;
m_show_layer_mapping_warnings = true; m_show_layer_mapping_warnings = true;
LAYER_REMAPPABLE_PLUGIN::RegisterLayerMappingCallback( LAYER_REMAPPABLE_PLUGIN::RegisterLayerMappingCallback(
CADSTAR_PCB_ARCHIVE_PLUGIN::DefaultLayerMappingCallback ); PCB_IO_CADSTAR_ARCHIVE::DefaultLayerMappingCallback );
} }
CADSTAR_PCB_ARCHIVE_PLUGIN::~CADSTAR_PCB_ARCHIVE_PLUGIN() PCB_IO_CADSTAR_ARCHIVE::~PCB_IO_CADSTAR_ARCHIVE()
{ {
clearLoadedFootprints(); clearLoadedFootprints();
} }
void CADSTAR_PCB_ARCHIVE_PLUGIN::clearLoadedFootprints() void PCB_IO_CADSTAR_ARCHIVE::clearLoadedFootprints()
{ {
for( FOOTPRINT* fp : m_loaded_footprints ) for( FOOTPRINT* fp : m_loaded_footprints )
{ {
@ -83,7 +82,7 @@ void CADSTAR_PCB_ARCHIVE_PLUGIN::clearLoadedFootprints()
} }
std::vector<FOOTPRINT*> CADSTAR_PCB_ARCHIVE_PLUGIN::GetImportedCachedLibraryFootprints() std::vector<FOOTPRINT*> PCB_IO_CADSTAR_ARCHIVE::GetImportedCachedLibraryFootprints()
{ {
std::vector<FOOTPRINT*> retval; std::vector<FOOTPRINT*> retval;
@ -96,7 +95,7 @@ std::vector<FOOTPRINT*> CADSTAR_PCB_ARCHIVE_PLUGIN::GetImportedCachedLibraryFoot
} }
BOARD* CADSTAR_PCB_ARCHIVE_PLUGIN::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, BOARD* PCB_IO_CADSTAR_ARCHIVE::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties, PROJECT* aProject, const STRING_UTF8_MAP* aProperties, PROJECT* aProject,
PROGRESS_REPORTER* aProgressReporter ) PROGRESS_REPORTER* aProgressReporter )
{ {
@ -139,13 +138,13 @@ BOARD* CADSTAR_PCB_ARCHIVE_PLUGIN::LoadBoard( const wxString& aFileName, BOARD*
} }
bool CADSTAR_PCB_ARCHIVE_PLUGIN::checkBoardHeader( const wxString& aFileName ) const bool PCB_IO_CADSTAR_ARCHIVE::checkBoardHeader( const wxString& aFileName ) const
{ {
return IO_UTILS::fileStartsWithPrefix( aFileName, wxT( "(CADSTARPCB" ), true ); return IO_UTILS::fileStartsWithPrefix( aFileName, wxT( "(CADSTARPCB" ), true );
} }
bool CADSTAR_PCB_ARCHIVE_PLUGIN::CanReadBoard( const wxString& aFileName ) const bool PCB_IO_CADSTAR_ARCHIVE::CanReadBoard( const wxString& aFileName ) const
{ {
if( !PCB_IO::CanReadBoard( aFileName ) ) if( !PCB_IO::CanReadBoard( aFileName ) )
return false; return false;
@ -154,7 +153,7 @@ bool CADSTAR_PCB_ARCHIVE_PLUGIN::CanReadBoard( const wxString& aFileName ) const
} }
bool CADSTAR_PCB_ARCHIVE_PLUGIN::CanReadFootprintLib( const wxString& aFileName ) const bool PCB_IO_CADSTAR_ARCHIVE::CanReadFootprintLib( const wxString& aFileName ) const
{ {
if( !PCB_IO::CanReadFootprintLib( aFileName ) ) if( !PCB_IO::CanReadFootprintLib( aFileName ) )
return false; return false;
@ -163,7 +162,7 @@ bool CADSTAR_PCB_ARCHIVE_PLUGIN::CanReadFootprintLib( const wxString& aFileName
} }
bool CADSTAR_PCB_ARCHIVE_PLUGIN::CanReadFootprint( const wxString& aFileName ) const bool PCB_IO_CADSTAR_ARCHIVE::CanReadFootprint( const wxString& aFileName ) const
{ {
if( !PCB_IO::CanReadFootprint( aFileName ) ) if( !PCB_IO::CanReadFootprint( aFileName ) )
return false; return false;
@ -172,7 +171,7 @@ bool CADSTAR_PCB_ARCHIVE_PLUGIN::CanReadFootprint( const wxString& aFileName ) c
} }
void CADSTAR_PCB_ARCHIVE_PLUGIN::FootprintEnumerate( wxArrayString& aFootprintNames, void PCB_IO_CADSTAR_ARCHIVE::FootprintEnumerate( wxArrayString& aFootprintNames,
const wxString& aLibraryPath, const wxString& aLibraryPath,
bool aBestEfforts, bool aBestEfforts,
const STRING_UTF8_MAP* aProperties ) const STRING_UTF8_MAP* aProperties )
@ -187,7 +186,7 @@ void CADSTAR_PCB_ARCHIVE_PLUGIN::FootprintEnumerate( wxArrayString& aFoo
} }
bool CADSTAR_PCB_ARCHIVE_PLUGIN::FootprintExists( const wxString& aLibraryPath, bool PCB_IO_CADSTAR_ARCHIVE::FootprintExists( const wxString& aLibraryPath,
const wxString& aFootprintName, const wxString& aFootprintName,
const STRING_UTF8_MAP* aProperties ) const STRING_UTF8_MAP* aProperties )
{ {
@ -203,7 +202,7 @@ bool CADSTAR_PCB_ARCHIVE_PLUGIN::FootprintExists( const wxString& aLibrar
} }
FOOTPRINT* CADSTAR_PCB_ARCHIVE_PLUGIN::FootprintLoad( const wxString& aLibraryPath, FOOTPRINT* PCB_IO_CADSTAR_ARCHIVE::FootprintLoad( const wxString& aLibraryPath,
const wxString& aFootprintName, const wxString& aFootprintName,
bool aKeepUUID, bool aKeepUUID,
const STRING_UTF8_MAP* aProperties ) const STRING_UTF8_MAP* aProperties )
@ -223,7 +222,7 @@ FOOTPRINT* CADSTAR_PCB_ARCHIVE_PLUGIN::FootprintLoad( const wxString& aLi
} }
long long CADSTAR_PCB_ARCHIVE_PLUGIN::GetLibraryTimestamp( const wxString& aLibraryPath ) const long long PCB_IO_CADSTAR_ARCHIVE::GetLibraryTimestamp( const wxString& aLibraryPath ) const
{ {
wxFileName fn( aLibraryPath ); wxFileName fn( aLibraryPath );
@ -234,7 +233,7 @@ long long CADSTAR_PCB_ARCHIVE_PLUGIN::GetLibraryTimestamp( const wxString& aLibr
} }
void CADSTAR_PCB_ARCHIVE_PLUGIN::ensureLoadedLibrary( const wxString& aLibraryPath ) void PCB_IO_CADSTAR_ARCHIVE::ensureLoadedLibrary( const wxString& aLibraryPath )
{ {
if( m_cache.count( aLibraryPath ) ) if( m_cache.count( aLibraryPath ) )
{ {

View File

@ -18,12 +18,6 @@
* with this program. If not, see <http://www.gnu.org/licenses/>. * with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/**
* @file cadstar_pcb_archive_plugin.h
* @brief Pcbnew #PLUGIN for CADSTAR PCB Archive (*.cpa) format: an ASCII format
* based on S-expressions.
*/
#ifndef CADSTAR_ARCHIVE_PLUGIN_H_ #ifndef CADSTAR_ARCHIVE_PLUGIN_H_
#define CADSTAR_ARCHIVE_PLUGIN_H_ #define CADSTAR_ARCHIVE_PLUGIN_H_
@ -35,7 +29,7 @@
#include <memory> #include <memory>
class CADSTAR_PCB_ARCHIVE_PLUGIN : public PCB_IO, public LAYER_REMAPPABLE_PLUGIN class PCB_IO_CADSTAR_ARCHIVE : public PCB_IO, public LAYER_REMAPPABLE_PLUGIN
{ {
public: public:
const wxString PluginName() const override { return wxT( "CADSTAR PCB Archive" ); } const wxString PluginName() const override { return wxT( "CADSTAR PCB Archive" ); }
@ -95,8 +89,8 @@ public:
*/ */
bool IsFootprintLibWritable( const wxString& aLibraryPath ) override { return false; } bool IsFootprintLibWritable( const wxString& aLibraryPath ) override { return false; }
CADSTAR_PCB_ARCHIVE_PLUGIN(); PCB_IO_CADSTAR_ARCHIVE();
~CADSTAR_PCB_ARCHIVE_PLUGIN(); ~PCB_IO_CADSTAR_ARCHIVE();
private: private:
void clearLoadedFootprints(); void clearLoadedFootprints();

View File

@ -79,7 +79,7 @@ Load() TODO's
#include <pcb_dimension.h> #include <pcb_dimension.h>
#include <pcb_io/pcb_io.h> #include <pcb_io/pcb_io.h>
#include <pcb_io/eagle/eagle_plugin.h> #include <pcb_io/eagle/pcb_io_eagle.h>
using namespace std; using namespace std;
@ -117,7 +117,7 @@ static wxString makeKey( const wxString& aFirst, const wxString& aSecond )
} }
void EAGLE_PLUGIN::setKeepoutSettingsToZone( ZONE* aZone, int aLayer ) const void PCB_IO_EAGLE::setKeepoutSettingsToZone( ZONE* aZone, int aLayer ) const
{ {
if( aLayer == EAGLE_LAYER::TRESTRICT || aLayer == EAGLE_LAYER::BRESTRICT ) if( aLayer == EAGLE_LAYER::TRESTRICT || aLayer == EAGLE_LAYER::BRESTRICT )
{ {
@ -220,7 +220,7 @@ void ERULES::parse( wxXmlNode* aRules, std::function<void()> aCheckpoint )
} }
EAGLE_PLUGIN::EAGLE_PLUGIN() : PCB_IO_EAGLE::PCB_IO_EAGLE() :
m_rules( new ERULES() ), m_rules( new ERULES() ),
m_xpath( new XPATH() ), m_xpath( new XPATH() ),
m_progressReporter( nullptr ), m_progressReporter( nullptr ),
@ -233,12 +233,12 @@ EAGLE_PLUGIN::EAGLE_PLUGIN() :
init( nullptr ); init( nullptr );
clear_cu_map(); clear_cu_map();
RegisterLayerMappingCallback( std::bind( &EAGLE_PLUGIN::DefaultLayerMappingCallback, RegisterLayerMappingCallback( std::bind( &PCB_IO_EAGLE::DefaultLayerMappingCallback,
this, _1 ) ); this, _1 ) );
} }
EAGLE_PLUGIN::~EAGLE_PLUGIN() PCB_IO_EAGLE::~PCB_IO_EAGLE()
{ {
deleteTemplates(); deleteTemplates();
delete m_rules; delete m_rules;
@ -246,7 +246,7 @@ EAGLE_PLUGIN::~EAGLE_PLUGIN()
} }
bool EAGLE_PLUGIN::CanReadBoard( const wxString& aFileName ) const bool PCB_IO_EAGLE::CanReadBoard( const wxString& aFileName ) const
{ {
if( !PCB_IO::CanReadBoard( aFileName ) ) if( !PCB_IO::CanReadBoard( aFileName ) )
return false; return false;
@ -255,7 +255,7 @@ bool EAGLE_PLUGIN::CanReadBoard( const wxString& aFileName ) const
} }
bool EAGLE_PLUGIN::CanReadFootprintLib( const wxString& aFileName ) const bool PCB_IO_EAGLE::CanReadFootprintLib( const wxString& aFileName ) const
{ {
if( !PCB_IO::CanReadFootprintLib( aFileName ) ) if( !PCB_IO::CanReadFootprintLib( aFileName ) )
return false; return false;
@ -264,13 +264,13 @@ bool EAGLE_PLUGIN::CanReadFootprintLib( const wxString& aFileName ) const
} }
bool EAGLE_PLUGIN::CanReadFootprint( const wxString& aFileName ) const bool PCB_IO_EAGLE::CanReadFootprint( const wxString& aFileName ) const
{ {
return CanReadFootprintLib( aFileName ); return CanReadFootprintLib( aFileName );
} }
bool EAGLE_PLUGIN::checkHeader(const wxString& aFileName) const bool PCB_IO_EAGLE::checkHeader(const wxString& aFileName) const
{ {
wxFileInputStream input( aFileName ); wxFileInputStream input( aFileName );
@ -292,7 +292,7 @@ bool EAGLE_PLUGIN::checkHeader(const wxString& aFileName) const
} }
void EAGLE_PLUGIN::checkpoint() void PCB_IO_EAGLE::checkpoint()
{ {
const unsigned PROGRESS_DELTA = 50; const unsigned PROGRESS_DELTA = 50;
@ -312,7 +312,7 @@ void EAGLE_PLUGIN::checkpoint()
} }
VECTOR2I inline EAGLE_PLUGIN::kicad_fontsize( const ECOORD& d, int aTextThickness ) const VECTOR2I inline PCB_IO_EAGLE::kicad_fontsize( const ECOORD& d, int aTextThickness ) const
{ {
// Eagle includes stroke thickness in the text size, KiCAD does not // Eagle includes stroke thickness in the text size, KiCAD does not
int kz = d.ToPcbUnits(); int kz = d.ToPcbUnits();
@ -320,7 +320,7 @@ VECTOR2I inline EAGLE_PLUGIN::kicad_fontsize( const ECOORD& d, int aTextThicknes
} }
BOARD* EAGLE_PLUGIN::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, BOARD* PCB_IO_EAGLE::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties, PROJECT* aProject, const STRING_UTF8_MAP* aProperties, PROJECT* aProject,
PROGRESS_REPORTER* aProgressReporter ) PROGRESS_REPORTER* aProgressReporter )
{ {
@ -443,7 +443,7 @@ BOARD* EAGLE_PLUGIN::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
} }
std::vector<FOOTPRINT*> EAGLE_PLUGIN::GetImportedCachedLibraryFootprints() std::vector<FOOTPRINT*> PCB_IO_EAGLE::GetImportedCachedLibraryFootprints()
{ {
std::vector<FOOTPRINT*> retval; std::vector<FOOTPRINT*> retval;
@ -454,7 +454,7 @@ std::vector<FOOTPRINT*> EAGLE_PLUGIN::GetImportedCachedLibraryFootprints()
} }
void EAGLE_PLUGIN::init( const STRING_UTF8_MAP* aProperties ) void PCB_IO_EAGLE::init( const STRING_UTF8_MAP* aProperties )
{ {
m_hole_count = 0; m_hole_count = 0;
m_min_trace = 0; m_min_trace = 0;
@ -473,7 +473,7 @@ void EAGLE_PLUGIN::init( const STRING_UTF8_MAP* aProperties )
} }
void EAGLE_PLUGIN::clear_cu_map() void PCB_IO_EAGLE::clear_cu_map()
{ {
// All cu layers are invalid until we see them in the <layers> section while // All cu layers are invalid until we see them in the <layers> section while
// loading either a board or library. See loadLayerDefs(). // loading either a board or library. See loadLayerDefs().
@ -482,7 +482,7 @@ void EAGLE_PLUGIN::clear_cu_map()
} }
void EAGLE_PLUGIN::loadAllSections( wxXmlNode* aDoc ) void PCB_IO_EAGLE::loadAllSections( wxXmlNode* aDoc )
{ {
wxXmlNode* drawing = MapChildren( aDoc )["drawing"]; wxXmlNode* drawing = MapChildren( aDoc )["drawing"];
NODE_MAP drawingChildren = MapChildren( drawing ); NODE_MAP drawingChildren = MapChildren( drawing );
@ -568,7 +568,7 @@ void EAGLE_PLUGIN::loadAllSections( wxXmlNode* aDoc )
} }
void EAGLE_PLUGIN::loadDesignRules( wxXmlNode* aDesignRules ) void PCB_IO_EAGLE::loadDesignRules( wxXmlNode* aDesignRules )
{ {
if( aDesignRules ) if( aDesignRules )
{ {
@ -579,7 +579,7 @@ void EAGLE_PLUGIN::loadDesignRules( wxXmlNode* aDesignRules )
} }
void EAGLE_PLUGIN::loadLayerDefs( wxXmlNode* aLayers ) void PCB_IO_EAGLE::loadLayerDefs( wxXmlNode* aLayers )
{ {
if( !aLayers ) if( !aLayers )
return; return;
@ -650,7 +650,7 @@ void EAGLE_PLUGIN::loadLayerDefs( wxXmlNode* aLayers )
#define DIMENSION_PRECISION DIM_PRECISION::X_XX // 0.01 mm #define DIMENSION_PRECISION DIM_PRECISION::X_XX // 0.01 mm
void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics ) void PCB_IO_EAGLE::loadPlain( wxXmlNode* aGraphics )
{ {
if( !aGraphics ) if( !aGraphics )
return; return;
@ -1089,7 +1089,7 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
} }
void EAGLE_PLUGIN::loadLibrary( wxXmlNode* aLib, const wxString* aLibName ) void PCB_IO_EAGLE::loadLibrary( wxXmlNode* aLib, const wxString* aLibName )
{ {
if( !aLib ) if( !aLib )
return; return;
@ -1147,7 +1147,7 @@ void EAGLE_PLUGIN::loadLibrary( wxXmlNode* aLib, const wxString* aLibName )
} }
void EAGLE_PLUGIN::loadLibraries( wxXmlNode* aLibs ) void PCB_IO_EAGLE::loadLibraries( wxXmlNode* aLibs )
{ {
if( !aLibs ) if( !aLibs )
return; return;
@ -1170,7 +1170,7 @@ void EAGLE_PLUGIN::loadLibraries( wxXmlNode* aLibs )
} }
void EAGLE_PLUGIN::loadElements( wxXmlNode* aElements ) void PCB_IO_EAGLE::loadElements( wxXmlNode* aElements )
{ {
if( !aElements ) if( !aElements )
return; return;
@ -1432,7 +1432,7 @@ void EAGLE_PLUGIN::loadElements( wxXmlNode* aElements )
} }
ZONE* EAGLE_PLUGIN::loadPolygon( wxXmlNode* aPolyNode ) ZONE* PCB_IO_EAGLE::loadPolygon( wxXmlNode* aPolyNode )
{ {
EPOLYGON p( aPolyNode ); EPOLYGON p( aPolyNode );
PCB_LAYER_ID layer = kicad_layer( p.layer ); PCB_LAYER_ID layer = kicad_layer( p.layer );
@ -1589,7 +1589,7 @@ ZONE* EAGLE_PLUGIN::loadPolygon( wxXmlNode* aPolyNode )
} }
void EAGLE_PLUGIN::orientFootprintAndText( FOOTPRINT* aFootprint, const EELEMENT& e, void PCB_IO_EAGLE::orientFootprintAndText( FOOTPRINT* aFootprint, const EELEMENT& e,
const EATTR* aNameAttr, const EATTR* aValueAttr ) const EATTR* aNameAttr, const EATTR* aValueAttr )
{ {
if( e.rot ) if( e.rot )
@ -1610,7 +1610,7 @@ void EAGLE_PLUGIN::orientFootprintAndText( FOOTPRINT* aFootprint, const EELEMENT
} }
void EAGLE_PLUGIN::orientFPText( FOOTPRINT* aFootprint, const EELEMENT& e, PCB_TEXT* aFPText, void PCB_IO_EAGLE::orientFPText( FOOTPRINT* aFootprint, const EELEMENT& e, PCB_TEXT* aFPText,
const EATTR* aAttr ) const EATTR* aAttr )
{ {
// Smashed part ? // Smashed part ?
@ -1758,7 +1758,7 @@ void EAGLE_PLUGIN::orientFPText( FOOTPRINT* aFootprint, const EELEMENT& e, PCB_T
} }
FOOTPRINT* EAGLE_PLUGIN::makeFootprint( wxXmlNode* aPackage, const wxString& aPkgName ) FOOTPRINT* PCB_IO_EAGLE::makeFootprint( wxXmlNode* aPackage, const wxString& aPkgName )
{ {
std::unique_ptr<FOOTPRINT> m = std::make_unique<FOOTPRINT>( m_board ); std::unique_ptr<FOOTPRINT> m = std::make_unique<FOOTPRINT>( m_board );
@ -1807,7 +1807,7 @@ FOOTPRINT* EAGLE_PLUGIN::makeFootprint( wxXmlNode* aPackage, const wxString& aPk
} }
void EAGLE_PLUGIN::packageWire( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const void PCB_IO_EAGLE::packageWire( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const
{ {
EWIRE w( aTree ); EWIRE w( aTree );
PCB_LAYER_ID layer = kicad_layer( w.layer ); PCB_LAYER_ID layer = kicad_layer( w.layer );
@ -1880,7 +1880,7 @@ void EAGLE_PLUGIN::packageWire( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const
} }
void EAGLE_PLUGIN::packagePad( FOOTPRINT* aFootprint, wxXmlNode* aTree ) void PCB_IO_EAGLE::packagePad( FOOTPRINT* aFootprint, wxXmlNode* aTree )
{ {
// this is thru hole technology here, no SMDs // this is thru hole technology here, no SMDs
EPAD e( aTree ); EPAD e( aTree );
@ -1987,7 +1987,7 @@ void EAGLE_PLUGIN::packagePad( FOOTPRINT* aFootprint, wxXmlNode* aTree )
} }
void EAGLE_PLUGIN::packageText( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const void PCB_IO_EAGLE::packageText( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const
{ {
ETEXT t( aTree ); ETEXT t( aTree );
PCB_LAYER_ID layer = kicad_layer( t.layer ); PCB_LAYER_ID layer = kicad_layer( t.layer );
@ -2110,7 +2110,7 @@ void EAGLE_PLUGIN::packageText( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const
} }
void EAGLE_PLUGIN::packageRectangle( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const void PCB_IO_EAGLE::packageRectangle( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const
{ {
ERECT r( aTree ); ERECT r( aTree );
@ -2179,7 +2179,7 @@ void EAGLE_PLUGIN::packageRectangle( FOOTPRINT* aFootprint, wxXmlNode* aTree ) c
} }
void EAGLE_PLUGIN::packagePolygon( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const void PCB_IO_EAGLE::packagePolygon( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const
{ {
EPOLYGON p( aTree ); EPOLYGON p( aTree );
@ -2284,7 +2284,7 @@ void EAGLE_PLUGIN::packagePolygon( FOOTPRINT* aFootprint, wxXmlNode* aTree ) con
} }
void EAGLE_PLUGIN::packageCircle( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const void PCB_IO_EAGLE::packageCircle( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const
{ {
ECIRCLE e( aTree ); ECIRCLE e( aTree );
@ -2374,7 +2374,7 @@ void EAGLE_PLUGIN::packageCircle( FOOTPRINT* aFootprint, wxXmlNode* aTree ) cons
} }
void EAGLE_PLUGIN::packageHole( FOOTPRINT* aFootprint, wxXmlNode* aTree, bool aCenter ) const void PCB_IO_EAGLE::packageHole( FOOTPRINT* aFootprint, wxXmlNode* aTree, bool aCenter ) const
{ {
EHOLE e( aTree ); EHOLE e( aTree );
@ -2416,7 +2416,7 @@ void EAGLE_PLUGIN::packageHole( FOOTPRINT* aFootprint, wxXmlNode* aTree, bool aC
} }
void EAGLE_PLUGIN::packageSMD( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const void PCB_IO_EAGLE::packageSMD( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const
{ {
ESMD e( aTree ); ESMD e( aTree );
PCB_LAYER_ID layer = kicad_layer( e.layer ); PCB_LAYER_ID layer = kicad_layer( e.layer );
@ -2494,7 +2494,7 @@ void EAGLE_PLUGIN::packageSMD( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const
} }
void EAGLE_PLUGIN::transferPad( const EPAD_COMMON& aEaglePad, PAD* aPad ) const void PCB_IO_EAGLE::transferPad( const EPAD_COMMON& aEaglePad, PAD* aPad ) const
{ {
aPad->SetNumber( aEaglePad.name ); aPad->SetNumber( aEaglePad.name );
@ -2519,7 +2519,7 @@ void EAGLE_PLUGIN::transferPad( const EPAD_COMMON& aEaglePad, PAD* aPad ) const
} }
void EAGLE_PLUGIN::deleteTemplates() void PCB_IO_EAGLE::deleteTemplates()
{ {
for( const auto& [ name, footprint ] : m_templates ) for( const auto& [ name, footprint ] : m_templates )
{ {
@ -2531,7 +2531,7 @@ void EAGLE_PLUGIN::deleteTemplates()
} }
void EAGLE_PLUGIN::loadClasses( wxXmlNode* aClasses ) void PCB_IO_EAGLE::loadClasses( wxXmlNode* aClasses )
{ {
BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings(); BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
@ -2595,7 +2595,7 @@ void EAGLE_PLUGIN::loadClasses( wxXmlNode* aClasses )
} }
void EAGLE_PLUGIN::loadSignals( wxXmlNode* aSignals ) void PCB_IO_EAGLE::loadSignals( wxXmlNode* aSignals )
{ {
ZONES zones; // per net ZONES zones; // per net
int netCode = 1; int netCode = 1;
@ -2855,7 +2855,7 @@ void EAGLE_PLUGIN::loadSignals( wxXmlNode* aSignals )
} }
std::map<wxString, PCB_LAYER_ID> EAGLE_PLUGIN::DefaultLayerMappingCallback( std::map<wxString, PCB_LAYER_ID> PCB_IO_EAGLE::DefaultLayerMappingCallback(
const std::vector<INPUT_LAYER_DESC>& aInputLayerDescriptionVector ) const std::vector<INPUT_LAYER_DESC>& aInputLayerDescriptionVector )
{ {
std::map<wxString, PCB_LAYER_ID> layer_map; std::map<wxString, PCB_LAYER_ID> layer_map;
@ -2870,7 +2870,7 @@ std::map<wxString, PCB_LAYER_ID> EAGLE_PLUGIN::DefaultLayerMappingCallback(
} }
void EAGLE_PLUGIN::mapEagleLayersToKicad( bool aIsLibraryCache ) void PCB_IO_EAGLE::mapEagleLayersToKicad( bool aIsLibraryCache )
{ {
std::vector<INPUT_LAYER_DESC> inputDescs; std::vector<INPUT_LAYER_DESC> inputDescs;
@ -2900,14 +2900,14 @@ void EAGLE_PLUGIN::mapEagleLayersToKicad( bool aIsLibraryCache )
} }
PCB_LAYER_ID EAGLE_PLUGIN::kicad_layer( int aEagleLayer ) const PCB_LAYER_ID PCB_IO_EAGLE::kicad_layer( int aEagleLayer ) const
{ {
auto result = m_layer_map.find( eagle_layer_name( aEagleLayer ) ); auto result = m_layer_map.find( eagle_layer_name( aEagleLayer ) );
return result == m_layer_map.end() ? UNDEFINED_LAYER : result->second; return result == m_layer_map.end() ? UNDEFINED_LAYER : result->second;
} }
std::tuple<PCB_LAYER_ID, LSET, bool> EAGLE_PLUGIN::defaultKicadLayer( int aEagleLayer, std::tuple<PCB_LAYER_ID, LSET, bool> PCB_IO_EAGLE::defaultKicadLayer( int aEagleLayer,
bool aIsLibraryCache ) const bool aIsLibraryCache ) const
{ {
// eagle copper layer: // eagle copper layer:
@ -3041,7 +3041,7 @@ std::tuple<PCB_LAYER_ID, LSET, bool> EAGLE_PLUGIN::defaultKicadLayer( int aEagle
} }
const wxString& EAGLE_PLUGIN::eagle_layer_name( int aLayer ) const const wxString& PCB_IO_EAGLE::eagle_layer_name( int aLayer ) const
{ {
static const wxString unknown( "unknown" ); static const wxString unknown( "unknown" );
auto it = m_eagleLayers.find( aLayer ); auto it = m_eagleLayers.find( aLayer );
@ -3049,7 +3049,7 @@ const wxString& EAGLE_PLUGIN::eagle_layer_name( int aLayer ) const
} }
int EAGLE_PLUGIN::eagle_layer_id( const wxString& aLayerName ) const int PCB_IO_EAGLE::eagle_layer_id( const wxString& aLayerName ) const
{ {
static const int unknown = -1; static const int unknown = -1;
auto it = m_eagleLayersIds.find( aLayerName ); auto it = m_eagleLayersIds.find( aLayerName );
@ -3057,7 +3057,7 @@ int EAGLE_PLUGIN::eagle_layer_id( const wxString& aLayerName ) const
} }
void EAGLE_PLUGIN::centerBoard() void PCB_IO_EAGLE::centerBoard()
{ {
if( m_props ) if( m_props )
{ {
@ -3081,7 +3081,7 @@ void EAGLE_PLUGIN::centerBoard()
} }
wxDateTime EAGLE_PLUGIN::getModificationTime( const wxString& aPath ) wxDateTime PCB_IO_EAGLE::getModificationTime( const wxString& aPath )
{ {
// File hasn't been loaded yet. // File hasn't been loaded yet.
if( aPath.IsEmpty() ) if( aPath.IsEmpty() )
@ -3096,7 +3096,7 @@ wxDateTime EAGLE_PLUGIN::getModificationTime( const wxString& aPath )
} }
void EAGLE_PLUGIN::cacheLib( const wxString& aLibPath ) void PCB_IO_EAGLE::cacheLib( const wxString& aLibPath )
{ {
try try
{ {
@ -3180,7 +3180,7 @@ void EAGLE_PLUGIN::cacheLib( const wxString& aLibPath )
} }
void EAGLE_PLUGIN::FootprintEnumerate( wxArrayString& aFootprintNames, const wxString& aLibraryPath, void PCB_IO_EAGLE::FootprintEnumerate( wxArrayString& aFootprintNames, const wxString& aLibraryPath,
bool aBestEfforts, const STRING_UTF8_MAP* aProperties ) bool aBestEfforts, const STRING_UTF8_MAP* aProperties )
{ {
wxString errorMsg; wxString errorMsg;
@ -3207,7 +3207,7 @@ void EAGLE_PLUGIN::FootprintEnumerate( wxArrayString& aFootprintNames, const wxS
} }
FOOTPRINT* EAGLE_PLUGIN::FootprintLoad( const wxString& aLibraryPath, FOOTPRINT* PCB_IO_EAGLE::FootprintLoad( const wxString& aLibraryPath,
const wxString& aFootprintName, bool aKeepUUID, const wxString& aFootprintName, bool aKeepUUID,
const STRING_UTF8_MAP* aProperties ) const STRING_UTF8_MAP* aProperties )
{ {
@ -3225,12 +3225,12 @@ FOOTPRINT* EAGLE_PLUGIN::FootprintLoad( const wxString& aLibraryPath,
} }
void EAGLE_PLUGIN::FootprintLibOptions( STRING_UTF8_MAP* aListToAppendTo ) const void PCB_IO_EAGLE::FootprintLibOptions( STRING_UTF8_MAP* aListToAppendTo ) const
{ {
PCB_IO::FootprintLibOptions( aListToAppendTo ); PCB_IO::FootprintLibOptions( aListToAppendTo );
} }
int EAGLE_PLUGIN::getMinimumCopperLayerCount() const int PCB_IO_EAGLE::getMinimumCopperLayerCount() const
{ {
int minLayerCount = 2; int minLayerCount = 2;

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 EAGLE_PLUGIN_H #ifndef PCB_IO_EAGLE_H_
#define EAGLE_PLUGIN_H #define PCB_IO_EAGLE_H_
#include <io/eagle/eagle_parser.h> #include <io/eagle/eagle_parser.h>
#include <pcb_io/pcb_io.h> #include <pcb_io/pcb_io.h>
@ -128,7 +128,7 @@ struct ERULES
* Works with Eagle 6.x XML board files and footprints to implement the Pcbnew #PLUGIN API * Works with Eagle 6.x XML board files and footprints to implement the Pcbnew #PLUGIN API
* or a portion of it. * or a portion of it.
*/ */
class EAGLE_PLUGIN : public PCB_IO, public LAYER_REMAPPABLE_PLUGIN class PCB_IO_EAGLE : public PCB_IO, public LAYER_REMAPPABLE_PLUGIN
{ {
public: public:
const wxString PluginName() const override { return wxT( "Eagle" ); } const wxString PluginName() const override { return wxT( "Eagle" ); }
@ -176,15 +176,15 @@ public:
typedef int BIU; typedef int BIU;
EAGLE_PLUGIN(); PCB_IO_EAGLE();
~EAGLE_PLUGIN(); ~PCB_IO_EAGLE();
/** /**
* Return the automapped layers. * Return the automapped layers.
* *
* The callback needs to have the context of the current board so it can * The callback needs to have the context of the current board so it can
* correctly determine copper layer mapping. Thus, it is not static and is * correctly determine copper layer mapping. Thus, it is not static and is
* expected to be bind to an instance of EAGLE_PLUGIN. * expected to be bind to an instance of PCB_IO_EAGLE.
* *
* @param aInputLayerDescriptionVector * @param aInputLayerDescriptionVector
* @return Auto-mapped layers * @return Auto-mapped layers
@ -373,4 +373,4 @@ private:
wxDateTime m_mod_time; wxDateTime m_mod_time;
}; };
#endif // EAGLE_PLUGIN_H #endif // PCB_IO_EAGLE_H_

View File

@ -5,8 +5,8 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR} )
set( EASYEDA_SRCS set( EASYEDA_SRCS
pcb_easyeda_plugin.cpp pcb_io_easyeda_plugin.cpp
pcb_easyeda_parser.cpp pcb_io_easyeda_parser.cpp
) )
add_library( easyeda STATIC ${EASYEDA_SRCS} ) add_library( easyeda STATIC ${EASYEDA_SRCS} )

View File

@ -22,7 +22,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "pcb_easyeda_parser.h" #include "pcb_io_easyeda_parser.h"
#include <memory> #include <memory>
@ -56,15 +56,15 @@ static const int SHAPE_JOIN_DISTANCE = pcbIUScale.mmToIU( 1.5 );
static const VECTOR2I HIDDEN_TEXT_SIZE( pcbIUScale.mmToIU( 0.5 ), pcbIUScale.mmToIU( 0.5 ) ); static const VECTOR2I HIDDEN_TEXT_SIZE( pcbIUScale.mmToIU( 0.5 ), pcbIUScale.mmToIU( 0.5 ) );
PCB_EASYEDA_PARSER::PCB_EASYEDA_PARSER( PROGRESS_REPORTER* aProgressReporter ) PCB_IO_EASYEDA_PARSER::PCB_IO_EASYEDA_PARSER( PROGRESS_REPORTER* aProgressReporter )
{ {
} }
PCB_EASYEDA_PARSER::~PCB_EASYEDA_PARSER() PCB_IO_EASYEDA_PARSER::~PCB_IO_EASYEDA_PARSER()
{ {
} }
PCB_LAYER_ID PCB_EASYEDA_PARSER::LayerToKi( const wxString& aLayer ) PCB_LAYER_ID PCB_IO_EASYEDA_PARSER::LayerToKi( const wxString& aLayer )
{ {
int elayer = wxAtoi( aLayer ); int elayer = wxAtoi( aLayer );
@ -143,7 +143,7 @@ static LIB_ID EasyEdaToKiCadLibID( const wxString& aLibName, const wxString& aLi
} }
void PCB_EASYEDA_PARSER::ParseToBoardItemContainer( void PCB_IO_EASYEDA_PARSER::ParseToBoardItemContainer(
BOARD_ITEM_CONTAINER* aContainer, BOARD* aParent, std::map<wxString, wxString> paramMap, BOARD_ITEM_CONTAINER* aContainer, BOARD* aParent, std::map<wxString, wxString> paramMap,
std::map<wxString, std::unique_ptr<FOOTPRINT>>& aFootprintMap, wxArrayString aShapes ) std::map<wxString, std::unique_ptr<FOOTPRINT>>& aFootprintMap, wxArrayString aShapes )
{ {
@ -1037,7 +1037,7 @@ void PCB_EASYEDA_PARSER::ParseToBoardItemContainer(
} }
FOOTPRINT* PCB_EASYEDA_PARSER::ParseFootprint( FOOTPRINT* PCB_IO_EASYEDA_PARSER::ParseFootprint(
const VECTOR2D& aOrigin, const EDA_ANGLE& aOrientation, int aLayer, BOARD* aParent, const VECTOR2D& aOrigin, const EDA_ANGLE& aOrientation, int aLayer, BOARD* aParent,
std::map<wxString, wxString> aParams, std::map<wxString, wxString> aParams,
std::map<wxString, std::unique_ptr<FOOTPRINT>>& aFootprintMap, wxArrayString aShapes ) std::map<wxString, std::unique_ptr<FOOTPRINT>>& aFootprintMap, wxArrayString aShapes )
@ -1083,7 +1083,7 @@ FOOTPRINT* PCB_EASYEDA_PARSER::ParseFootprint(
} }
void PCB_EASYEDA_PARSER::ParseBoard( BOARD* aBoard, const VECTOR2D& aOrigin, void PCB_IO_EASYEDA_PARSER::ParseBoard( BOARD* aBoard, const VECTOR2D& aOrigin,
std::map<wxString, std::unique_ptr<FOOTPRINT>>& aFootprintMap, std::map<wxString, std::unique_ptr<FOOTPRINT>>& aFootprintMap,
wxArrayString aShapes ) wxArrayString aShapes )
{ {

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 PCB_EASYEDA_PARSER_H_ #ifndef PCB_IO_EASYEDA_PARSER_H_
#define PCB_EASYEDA_PARSER_H_ #define PCB_IO_EASYEDA_PARSER_H_
#include <io/easyeda/easyeda_parser_base.h> #include <io/easyeda/easyeda_parser_base.h>
@ -43,11 +43,11 @@
class BOARD; class BOARD;
class PROGRESS_REPORTER; class PROGRESS_REPORTER;
class PCB_EASYEDA_PARSER : public EASYEDA_PARSER_BASE class PCB_IO_EASYEDA_PARSER : public EASYEDA_PARSER_BASE
{ {
public: public:
explicit PCB_EASYEDA_PARSER( PROGRESS_REPORTER* aProgressReporter ); explicit PCB_IO_EASYEDA_PARSER( PROGRESS_REPORTER* aProgressReporter );
~PCB_EASYEDA_PARSER(); ~PCB_IO_EASYEDA_PARSER();
PCB_LAYER_ID LayerToKi( const wxString& aLayer ); PCB_LAYER_ID LayerToKi( const wxString& aLayer );
@ -72,4 +72,4 @@ public:
}; };
#endif // PCB_EASYEDA_PARSER_H_ #endif // PCB_IO_EASYEDA_PARSER_H_

View File

@ -23,8 +23,8 @@
*/ */
#include <io/easyeda/easyeda_parser_structs.h> #include <io/easyeda/easyeda_parser_structs.h>
#include <pcb_io/easyeda/pcb_easyeda_plugin.h> #include <pcb_io/easyeda/pcb_io_easyeda_plugin.h>
#include <pcb_io/easyeda/pcb_easyeda_parser.h> #include <pcb_io/easyeda/pcb_io_easyeda_parser.h>
#include <pcb_io/pcb_io.h> #include <pcb_io/pcb_io.h>
#include <progress_reporter.h> #include <progress_reporter.h>
@ -43,14 +43,14 @@
#include <core/map_helpers.h> #include <core/map_helpers.h>
EASYEDA_PLUGIN::EASYEDA_PLUGIN() PCB_IO_EASYEDA::PCB_IO_EASYEDA()
{ {
m_board = nullptr; m_board = nullptr;
m_props = nullptr; m_props = nullptr;
} }
EASYEDA_PLUGIN::~EASYEDA_PLUGIN() PCB_IO_EASYEDA::~PCB_IO_EASYEDA()
{ {
} }
@ -98,7 +98,7 @@ static bool FindBoardInStream( const wxString& aName, wxInputStream& aStream, nl
} }
bool EASYEDA_PLUGIN::CanReadBoard( const wxString& aFileName ) const bool PCB_IO_EASYEDA::CanReadBoard( const wxString& aFileName ) const
{ {
if( !PCB_IO::CanReadBoard( aFileName ) ) if( !PCB_IO::CanReadBoard( aFileName ) )
return false; return false;
@ -122,19 +122,19 @@ bool EASYEDA_PLUGIN::CanReadBoard( const wxString& aFileName ) const
} }
bool EASYEDA_PLUGIN::CanReadFootprint( const wxString& aFileName ) const bool PCB_IO_EASYEDA::CanReadFootprint( const wxString& aFileName ) const
{ {
return CanReadBoard( aFileName ); return CanReadBoard( aFileName );
} }
bool EASYEDA_PLUGIN::CanReadFootprintLib( const wxString& aFileName ) const bool PCB_IO_EASYEDA::CanReadFootprintLib( const wxString& aFileName ) const
{ {
return CanReadBoard( aFileName ); return CanReadBoard( aFileName );
} }
BOARD* EASYEDA_PLUGIN::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, BOARD* PCB_IO_EASYEDA::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties, PROJECT* aProject, const STRING_UTF8_MAP* aProperties, PROJECT* aProject,
PROGRESS_REPORTER* aProgressReporter ) PROGRESS_REPORTER* aProgressReporter )
{ {
@ -155,7 +155,7 @@ BOARD* EASYEDA_PLUGIN::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
THROW_IO_ERROR( _( "Open cancelled by user." ) ); THROW_IO_ERROR( _( "Open cancelled by user." ) );
} }
PCB_EASYEDA_PARSER parser( nullptr ); PCB_IO_EASYEDA_PARSER parser( nullptr );
try try
{ {
@ -276,13 +276,13 @@ BOARD* EASYEDA_PLUGIN::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
} }
long long EASYEDA_PLUGIN::GetLibraryTimestamp( const wxString& aLibraryPath ) const long long PCB_IO_EASYEDA::GetLibraryTimestamp( const wxString& aLibraryPath ) const
{ {
return 0; return 0;
} }
void EASYEDA_PLUGIN::FootprintEnumerate( wxArrayString& aFootprintNames, void PCB_IO_EASYEDA::FootprintEnumerate( wxArrayString& aFootprintNames,
const wxString& aLibraryPath, bool aBestEfforts, const wxString& aLibraryPath, bool aBestEfforts,
const STRING_UTF8_MAP* aProperties ) const STRING_UTF8_MAP* aProperties )
{ {
@ -371,11 +371,11 @@ void EASYEDA_PLUGIN::FootprintEnumerate( wxArrayString& aFootprintNames,
} }
FOOTPRINT* EASYEDA_PLUGIN::FootprintLoad( const wxString& aLibraryPath, FOOTPRINT* PCB_IO_EASYEDA::FootprintLoad( const wxString& aLibraryPath,
const wxString& aFootprintName, bool aKeepUUID, const wxString& aFootprintName, bool aKeepUUID,
const STRING_UTF8_MAP* aProperties ) const STRING_UTF8_MAP* aProperties )
{ {
PCB_EASYEDA_PARSER parser( nullptr ); PCB_IO_EASYEDA_PARSER parser( nullptr );
m_loadedFootprints.clear(); m_loadedFootprints.clear();
@ -525,7 +525,7 @@ FOOTPRINT* EASYEDA_PLUGIN::FootprintLoad( const wxString& aLibraryPath,
} }
std::vector<FOOTPRINT*> EASYEDA_PLUGIN::GetImportedCachedLibraryFootprints() std::vector<FOOTPRINT*> PCB_IO_EASYEDA::GetImportedCachedLibraryFootprints()
{ {
std::vector<FOOTPRINT*> result; std::vector<FOOTPRINT*> result;

View File

@ -22,14 +22,14 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#ifndef PCB_EASYEDA_PLUGIN_H_ #ifndef PCB_IO_EASYEDA_PLUGIN_H_
#define PCB_EASYEDA_PLUGIN_H_ #define PCB_IO_EASYEDA_PLUGIN_H_
#include <footprint.h> #include <footprint.h>
#include <pcb_io/pcb_io.h> #include <pcb_io/pcb_io.h>
#include <pcb_io/pcb_io_mgr.h> #include <pcb_io/pcb_io_mgr.h>
class EASYEDA_PLUGIN : public PCB_IO class PCB_IO_EASYEDA : public PCB_IO
{ {
public: public:
const wxString PluginName() const override const wxString PluginName() const override
@ -70,8 +70,8 @@ public:
bool IsFootprintLibWritable( const wxString& aLibraryPath ) override { return false; } bool IsFootprintLibWritable( const wxString& aLibraryPath ) override { return false; }
EASYEDA_PLUGIN(); PCB_IO_EASYEDA();
~EASYEDA_PLUGIN(); ~PCB_IO_EASYEDA();
private: private:
const STRING_UTF8_MAP* m_props; const STRING_UTF8_MAP* m_props;
@ -81,4 +81,4 @@ private:
}; };
#endif // PCB_EASYEDA_PLUGIN_H_ #endif // PCB_IO_EASYEDA_PLUGIN_H_

View File

@ -5,8 +5,8 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR} )
set( EASYEDAPRO_SRCS set( EASYEDAPRO_SRCS
pcb_easyedapro_plugin.cpp pcb_io_easyedapro.cpp
pcb_easyedapro_parser.cpp pcb_io_easyedapro_parser.cpp
) )
add_library( easyedapro STATIC ${EASYEDAPRO_SRCS} ) add_library( easyedapro STATIC ${EASYEDAPRO_SRCS} )

View File

@ -24,8 +24,8 @@
#include <io/easyedapro/easyedapro_import_utils.h> #include <io/easyedapro/easyedapro_import_utils.h>
#include <io/easyedapro/easyedapro_parser.h> #include <io/easyedapro/easyedapro_parser.h>
#include <pcb_io/easyedapro/pcb_easyedapro_plugin.h> #include <pcb_io/easyedapro/pcb_io_easyedapro.h>
#include <pcb_io/easyedapro/pcb_easyedapro_parser.h> #include <pcb_io/easyedapro/pcb_io_easyedapro_parser.h>
#include <pcb_io/pcb_io.h> #include <pcb_io/pcb_io.h>
#include <board.h> #include <board.h>
@ -47,7 +47,7 @@
#include <string_utf8_map.h> #include <string_utf8_map.h>
struct EASYEDAPRO_PLUGIN::PRJ_DATA struct PCB_IO_EASYEDAPRO::PRJ_DATA
{ {
std::map<wxString, std::unique_ptr<FOOTPRINT>> m_Footprints; std::map<wxString, std::unique_ptr<FOOTPRINT>> m_Footprints;
std::map<wxString, EASYEDAPRO::BLOB> m_Blobs; std::map<wxString, EASYEDAPRO::BLOB> m_Blobs;
@ -55,21 +55,21 @@ struct EASYEDAPRO_PLUGIN::PRJ_DATA
}; };
EASYEDAPRO_PLUGIN::EASYEDAPRO_PLUGIN() PCB_IO_EASYEDAPRO::PCB_IO_EASYEDAPRO()
{ {
m_board = nullptr; m_board = nullptr;
m_props = nullptr; m_props = nullptr;
} }
EASYEDAPRO_PLUGIN::~EASYEDAPRO_PLUGIN() PCB_IO_EASYEDAPRO::~PCB_IO_EASYEDAPRO()
{ {
if( m_projectData ) if( m_projectData )
delete m_projectData; delete m_projectData;
} }
bool EASYEDAPRO_PLUGIN::CanReadBoard( const wxString& aFileName ) const bool PCB_IO_EASYEDAPRO::CanReadBoard( const wxString& aFileName ) const
{ {
if( aFileName.Lower().EndsWith( wxS( ".epro" ) ) ) if( aFileName.Lower().EndsWith( wxS( ".epro" ) ) )
{ {
@ -99,7 +99,7 @@ bool EASYEDAPRO_PLUGIN::CanReadBoard( const wxString& aFileName ) const
} }
BOARD* EASYEDAPRO_PLUGIN::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, BOARD* PCB_IO_EASYEDAPRO::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties, PROJECT* aProject, const STRING_UTF8_MAP* aProperties, PROJECT* aProject,
PROGRESS_REPORTER* aProgressReporter ) PROGRESS_REPORTER* aProgressReporter )
{ {
@ -119,7 +119,7 @@ BOARD* EASYEDAPRO_PLUGIN::LoadBoard( const wxString& aFileName, BOARD* aAppendTo
THROW_IO_ERROR( _( "Open cancelled by user." ) ); THROW_IO_ERROR( _( "Open cancelled by user." ) );
} }
PCB_EASYEDAPRO_PARSER parser( nullptr, nullptr ); PCB_IO_EASYEDAPRO_PARSER parser( nullptr, nullptr );
wxFileName fname( aFileName ); wxFileName fname( aFileName );
@ -189,13 +189,13 @@ BOARD* EASYEDAPRO_PLUGIN::LoadBoard( const wxString& aFileName, BOARD* aAppendTo
} }
long long EASYEDAPRO_PLUGIN::GetLibraryTimestamp( const wxString& aLibraryPath ) const long long PCB_IO_EASYEDAPRO::GetLibraryTimestamp( const wxString& aLibraryPath ) const
{ {
return 0; return 0;
} }
void EASYEDAPRO_PLUGIN::FootprintEnumerate( wxArrayString& aFootprintNames, void PCB_IO_EASYEDAPRO::FootprintEnumerate( wxArrayString& aFootprintNames,
const wxString& aLibraryPath, bool aBestEfforts, const wxString& aLibraryPath, bool aBestEfforts,
const STRING_UTF8_MAP* aProperties ) const STRING_UTF8_MAP* aProperties )
{ {
@ -231,7 +231,7 @@ void EASYEDAPRO_PLUGIN::FootprintEnumerate( wxArrayString& aFootprintNames,
} }
void EASYEDAPRO_PLUGIN::LoadAllDataFromProject( const wxString& aProjectPath, void PCB_IO_EASYEDAPRO::LoadAllDataFromProject( const wxString& aProjectPath,
const nlohmann::json& aProject ) const nlohmann::json& aProject )
{ {
if( m_projectData ) if( m_projectData )
@ -239,7 +239,7 @@ void EASYEDAPRO_PLUGIN::LoadAllDataFromProject( const wxString& aProjectPa
m_projectData = new PRJ_DATA(); m_projectData = new PRJ_DATA();
PCB_EASYEDAPRO_PARSER parser( nullptr, nullptr ); PCB_IO_EASYEDAPRO_PARSER parser( nullptr, nullptr );
wxFileName fname( aProjectPath ); wxFileName fname( aProjectPath );
wxString fpLibName = EASYEDAPRO::ShortenLibName( fname.GetName() ); wxString fpLibName = EASYEDAPRO::ShortenLibName( fname.GetName() );
@ -301,11 +301,11 @@ void EASYEDAPRO_PLUGIN::LoadAllDataFromProject( const wxString& aProjectPa
} }
FOOTPRINT* EASYEDAPRO_PLUGIN::FootprintLoad( const wxString& aLibraryPath, FOOTPRINT* PCB_IO_EASYEDAPRO::FootprintLoad( const wxString& aLibraryPath,
const wxString& aFootprintName, bool aKeepUUID, const wxString& aFootprintName, bool aKeepUUID,
const STRING_UTF8_MAP* aProperties ) const STRING_UTF8_MAP* aProperties )
{ {
PCB_EASYEDAPRO_PARSER parser( nullptr, nullptr ); PCB_IO_EASYEDAPRO_PARSER parser( nullptr, nullptr );
FOOTPRINT* footprint = nullptr; FOOTPRINT* footprint = nullptr;
wxFileName libFname( aLibraryPath ); wxFileName libFname( aLibraryPath );
@ -403,7 +403,7 @@ FOOTPRINT* EASYEDAPRO_PLUGIN::FootprintLoad( const wxString& aLibraryPath,
} }
std::vector<FOOTPRINT*> EASYEDAPRO_PLUGIN::GetImportedCachedLibraryFootprints() std::vector<FOOTPRINT*> PCB_IO_EASYEDAPRO::GetImportedCachedLibraryFootprints()
{ {
std::vector<FOOTPRINT*> result; std::vector<FOOTPRINT*> result;

View File

@ -32,7 +32,7 @@
#include <pcb_io/pcb_io_mgr.h> #include <pcb_io/pcb_io_mgr.h>
class EASYEDAPRO_PLUGIN : public PCB_IO, public PROJECT_CHOOSER_PLUGIN class PCB_IO_EASYEDAPRO : public PCB_IO, public PROJECT_CHOOSER_PLUGIN
{ {
public: public:
const wxString PluginName() const override const wxString PluginName() const override
@ -75,8 +75,8 @@ public:
bool IsFootprintLibWritable( const wxString& aLibraryPath ) override { return false; } bool IsFootprintLibWritable( const wxString& aLibraryPath ) override { return false; }
EASYEDAPRO_PLUGIN(); PCB_IO_EASYEDAPRO();
~EASYEDAPRO_PLUGIN(); ~PCB_IO_EASYEDAPRO();
private: private:
struct PRJ_DATA; // Opaque data structure struct PRJ_DATA; // Opaque data structure

View File

@ -22,7 +22,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "pcb_easyedapro_parser.h" #include "pcb_io_easyedapro_parser.h"
#include <io/easyedapro/easyedapro_import_utils.h> #include <io/easyedapro/easyedapro_import_utils.h>
#include <memory> #include <memory>
@ -65,7 +65,7 @@ static const wxString MODEL_SIZE_KEY = wxS( "JLC_3D_Size" );
static const int SHAPE_JOIN_DISTANCE = pcbIUScale.mmToIU( 1.5 ); static const int SHAPE_JOIN_DISTANCE = pcbIUScale.mmToIU( 1.5 );
double PCB_EASYEDAPRO_PARSER::Convert( wxString aValue ) double PCB_IO_EASYEDAPRO_PARSER::Convert( wxString aValue )
{ {
double value = 0; double value = 0;
@ -76,18 +76,18 @@ double PCB_EASYEDAPRO_PARSER::Convert( wxString aValue )
} }
PCB_EASYEDAPRO_PARSER::PCB_EASYEDAPRO_PARSER( BOARD* aBoard, PROGRESS_REPORTER* aProgressReporter ) PCB_IO_EASYEDAPRO_PARSER::PCB_IO_EASYEDAPRO_PARSER( BOARD* aBoard, PROGRESS_REPORTER* aProgressReporter )
{ {
m_board = aBoard; m_board = aBoard;
} }
PCB_EASYEDAPRO_PARSER::~PCB_EASYEDAPRO_PARSER() PCB_IO_EASYEDAPRO_PARSER::~PCB_IO_EASYEDAPRO_PARSER()
{ {
} }
PCB_LAYER_ID PCB_EASYEDAPRO_PARSER::LayerToKi( int aLayer ) PCB_LAYER_ID PCB_IO_EASYEDAPRO_PARSER::LayerToKi( int aLayer )
{ {
switch( aLayer ) switch( aLayer )
{ {
@ -198,7 +198,7 @@ static void AlignText( EDA_TEXT* text, int align )
} }
void PCB_EASYEDAPRO_PARSER::fillFootprintModelInfo( FOOTPRINT* footprint, const wxString& modelUuid, void PCB_IO_EASYEDAPRO_PARSER::fillFootprintModelInfo( FOOTPRINT* footprint, const wxString& modelUuid,
const wxString& modelTitle, const wxString& modelTitle,
const wxString& modelTransform ) const const wxString& modelTransform ) const
{ {
@ -257,7 +257,7 @@ void PCB_EASYEDAPRO_PARSER::fillFootprintModelInfo( FOOTPRINT* footprint, const
std::vector<std::unique_ptr<PCB_SHAPE>> std::vector<std::unique_ptr<PCB_SHAPE>>
PCB_EASYEDAPRO_PARSER::ParsePoly( BOARD_ITEM_CONTAINER* aContainer, nlohmann::json polyData, PCB_IO_EASYEDAPRO_PARSER::ParsePoly( BOARD_ITEM_CONTAINER* aContainer, nlohmann::json polyData,
bool aClosed, bool aInFill ) const bool aClosed, bool aInFill ) const
{ {
std::vector<std::unique_ptr<PCB_SHAPE>> results; std::vector<std::unique_ptr<PCB_SHAPE>> results;
@ -454,7 +454,7 @@ PCB_EASYEDAPRO_PARSER::ParsePoly( BOARD_ITEM_CONTAINER* aContainer, nlohmann::js
SHAPE_LINE_CHAIN SHAPE_LINE_CHAIN
PCB_EASYEDAPRO_PARSER::ParseContour( nlohmann::json polyData, bool aInFill, PCB_IO_EASYEDAPRO_PARSER::ParseContour( nlohmann::json polyData, bool aInFill,
double aArcAccuracy ) const double aArcAccuracy ) const
{ {
SHAPE_LINE_CHAIN result; SHAPE_LINE_CHAIN result;
@ -585,7 +585,7 @@ PCB_EASYEDAPRO_PARSER::ParseContour( nlohmann::json polyData, bool aInFill,
} }
std::unique_ptr<PAD> PCB_EASYEDAPRO_PARSER::createPAD( FOOTPRINT* aFootprint, std::unique_ptr<PAD> PCB_IO_EASYEDAPRO_PARSER::createPAD( FOOTPRINT* aFootprint,
const nlohmann::json& line ) const nlohmann::json& line )
{ {
wxString uuid = line.at( 1 ); wxString uuid = line.at( 1 );
@ -719,7 +719,7 @@ std::unique_ptr<PAD> PCB_EASYEDAPRO_PARSER::createPAD( FOOTPRINT* aFo
} }
FOOTPRINT* PCB_EASYEDAPRO_PARSER::ParseFootprint( const nlohmann::json& aProject, FOOTPRINT* PCB_IO_EASYEDAPRO_PARSER::ParseFootprint( const nlohmann::json& aProject,
const wxString& aFpUuid, const wxString& aFpUuid,
const std::vector<nlohmann::json>& aLines ) const std::vector<nlohmann::json>& aLines )
{ {
@ -929,7 +929,7 @@ FOOTPRINT* PCB_EASYEDAPRO_PARSER::ParseFootprint( const nlohmann::json&
} }
void PCB_EASYEDAPRO_PARSER::ParseBoard( void PCB_IO_EASYEDAPRO_PARSER::ParseBoard(
BOARD* aBoard, const nlohmann::json& aProject, BOARD* aBoard, const nlohmann::json& aProject,
std::map<wxString, std::unique_ptr<FOOTPRINT>>& aFootprintMap, std::map<wxString, std::unique_ptr<FOOTPRINT>>& aFootprintMap,
const std::map<wxString, EASYEDAPRO::BLOB>& aBlobMap, const std::map<wxString, EASYEDAPRO::BLOB>& aBlobMap,

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 PCB_EASYEDAPRO_PARSER_H_ #ifndef PCB_IO_EASYEDAPRO_PARSER_H_
#define PCB_EASYEDAPRO_PARSER_H_ #define PCB_IO_EASYEDAPRO_PARSER_H_
#include <io/easyedapro/easyedapro_parser.h> #include <io/easyedapro/easyedapro_parser.h>
@ -44,11 +44,11 @@
class BOARD; class BOARD;
class PROGRESS_REPORTER; class PROGRESS_REPORTER;
class PCB_EASYEDAPRO_PARSER class PCB_IO_EASYEDAPRO_PARSER
{ {
public: public:
explicit PCB_EASYEDAPRO_PARSER( BOARD* aBoard, PROGRESS_REPORTER* aProgressReporter ); explicit PCB_IO_EASYEDAPRO_PARSER( BOARD* aBoard, PROGRESS_REPORTER* aProgressReporter );
~PCB_EASYEDAPRO_PARSER(); ~PCB_IO_EASYEDAPRO_PARSER();
PCB_LAYER_ID LayerToKi( int aLayer ); PCB_LAYER_ID LayerToKi( int aLayer );
@ -99,4 +99,4 @@ private:
}; };
#endif // PCB_EASYEDAPRO_PARSER_H_ #endif // PCB_IO_EASYEDAPRO_PARSER_H_

View File

@ -5,7 +5,7 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR} )
set( FABMASTER_SRCS set( FABMASTER_SRCS
fabmaster_plugin.cpp pcb_io_fabmaster.cpp
import_fabmaster.cpp import_fabmaster.cpp
) )

View File

@ -26,38 +26,38 @@
* @brief Pcbnew PLUGIN for FABMASTER ASCII *.txt / *.fab format. * @brief Pcbnew PLUGIN for FABMASTER ASCII *.txt / *.fab format.
*/ */
#include "fabmaster_plugin.h" #include "pcb_io_fabmaster.h"
#include <board.h> #include <board.h>
#include <progress_reporter.h> #include <progress_reporter.h>
#include <common.h> #include <common.h>
#include <macros.h> #include <macros.h>
FABMASTER_PLUGIN::FABMASTER_PLUGIN() PCB_IO_FABMASTER::PCB_IO_FABMASTER()
{ {
m_board = nullptr; m_board = nullptr;
m_props = nullptr; m_props = nullptr;
} }
FABMASTER_PLUGIN::~FABMASTER_PLUGIN() PCB_IO_FABMASTER::~PCB_IO_FABMASTER()
{ {
} }
const wxString FABMASTER_PLUGIN::PluginName() const const wxString PCB_IO_FABMASTER::PluginName() const
{ {
return wxT( "Fabmaster" ); return wxT( "Fabmaster" );
} }
PLUGIN_FILE_DESC FABMASTER_PLUGIN::GetBoardFileDesc() const PLUGIN_FILE_DESC PCB_IO_FABMASTER::GetBoardFileDesc() const
{ {
return PLUGIN_FILE_DESC( _HKI( "Fabmaster PCB files" ), { "txt", "fab" } ); return PLUGIN_FILE_DESC( _HKI( "Fabmaster PCB files" ), { "txt", "fab" } );
} }
BOARD* FABMASTER_PLUGIN::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, BOARD* PCB_IO_FABMASTER::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties, PROJECT* aProject, const STRING_UTF8_MAP* aProperties, PROJECT* aProject,
PROGRESS_REPORTER* aProgressReporter ) PROGRESS_REPORTER* aProgressReporter )
{ {

View File

@ -21,12 +21,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
/** #ifndef PCB_IO_FABMASTER_H_
* @file fabmaster_plugin.h
* @brief Pcbnew PLUGIN for Fabmaster (Allegro) ASCII format.
*/
#ifndef FABMASTER_PLUGIN_H_
#define FABMASTER_PLUGIN_H_ #define FABMASTER_PLUGIN_H_
@ -35,7 +30,7 @@
#include <pcb_io/pcb_io.h> #include <pcb_io/pcb_io.h>
#include <pcb_io/pcb_io_mgr.h> #include <pcb_io/pcb_io_mgr.h>
class FABMASTER_PLUGIN : public PCB_IO class PCB_IO_FABMASTER : public PCB_IO
{ {
public: public:
const wxString PluginName() const override; const wxString PluginName() const override;
@ -52,8 +47,8 @@ public:
return 0; return 0;
} }
FABMASTER_PLUGIN(); PCB_IO_FABMASTER();
~FABMASTER_PLUGIN(); ~PCB_IO_FABMASTER();
private: private:
const STRING_UTF8_MAP* m_props; const STRING_UTF8_MAP* m_props;
@ -62,4 +57,4 @@ private:
FABMASTER m_fabmaster; FABMASTER m_fabmaster;
}; };
#endif // FABMASTER_PLUGIN_H_ #endif // PCB_IO_FABMASTER_H_

View File

@ -23,7 +23,7 @@
*/ */
/** /**
* @file gpcb_plugin.cpp * @file pcb_io_geda.cpp
* @brief Geda PCB file plugin implementation file. * @brief Geda PCB file plugin implementation file.
*/ */
@ -38,7 +38,7 @@
#include <macros.h> #include <macros.h>
#include <pcb_text.h> #include <pcb_text.h>
#include <pcb_shape.h> #include <pcb_shape.h>
#include <pcb_io/geda/gpcb_plugin.h> #include <pcb_io/geda/pcb_io_geda.h>
#include <wx_filename.h> #include <wx_filename.h>
#include <wx/dir.h> #include <wx/dir.h>
@ -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_PLUGIN plugin. It is * footprint portion of the PLUGIN API, and only for the #PCB_IO_KICAD_SEXPR 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
@ -132,7 +132,7 @@ typedef boost::ptr_map< std::string, GPCB_FPL_CACHE_ITEM > FOOTPRINT_MAP;
class GPCB_FPL_CACHE class GPCB_FPL_CACHE
{ {
public: public:
GPCB_FPL_CACHE( GPCB_PLUGIN* aOwner, const wxString& aLibraryPath ); GPCB_FPL_CACHE( PCB_IO_GEDA* aOwner, const wxString& aLibraryPath );
wxString GetPath() const { return m_lib_path.GetPath(); } wxString GetPath() const { return m_lib_path.GetPath(); }
bool IsWritable() const { return m_lib_path.IsOk() && m_lib_path.IsDirWritable(); } bool IsWritable() const { return m_lib_path.IsOk() && m_lib_path.IsDirWritable(); }
@ -193,7 +193,7 @@ private:
*/ */
void parseParameters( wxArrayString& aParameterList, LINE_READER* aLineReader ); void parseParameters( wxArrayString& aParameterList, LINE_READER* aLineReader );
GPCB_PLUGIN* m_owner; ///< Plugin object that owns the cache. PCB_IO_GEDA* 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.
FOOTPRINT_MAP m_footprints; ///< Map of footprint file name to FOOTPRINT*. FOOTPRINT_MAP m_footprints; ///< Map of footprint file name to FOOTPRINT*.
@ -204,7 +204,7 @@ private:
}; };
GPCB_FPL_CACHE::GPCB_FPL_CACHE( GPCB_PLUGIN* aOwner, const wxString& aLibraryPath ) GPCB_FPL_CACHE::GPCB_FPL_CACHE( PCB_IO_GEDA* aOwner, const wxString& aLibraryPath )
{ {
m_owner = aOwner; m_owner = aOwner;
m_lib_path.SetPath( aLibraryPath ); m_lib_path.SetPath( aLibraryPath );
@ -792,7 +792,7 @@ bool GPCB_FPL_CACHE::testFlags( const wxString& aFlag, long aMask, const wxChar*
} }
GPCB_PLUGIN::GPCB_PLUGIN() : PCB_IO_GEDA::PCB_IO_GEDA() :
m_cache( nullptr ), m_cache( nullptr ),
m_ctl( 0 ) m_ctl( 0 )
{ {
@ -801,7 +801,7 @@ GPCB_PLUGIN::GPCB_PLUGIN() :
} }
GPCB_PLUGIN::GPCB_PLUGIN( int aControlFlags ) : PCB_IO_GEDA::PCB_IO_GEDA( int aControlFlags ) :
m_cache( nullptr ), m_cache( nullptr ),
m_ctl( aControlFlags ) m_ctl( aControlFlags )
{ {
@ -810,19 +810,19 @@ GPCB_PLUGIN::GPCB_PLUGIN( int aControlFlags ) :
} }
GPCB_PLUGIN::~GPCB_PLUGIN() PCB_IO_GEDA::~PCB_IO_GEDA()
{ {
delete m_cache; delete m_cache;
} }
void GPCB_PLUGIN::init( const STRING_UTF8_MAP* aProperties ) void PCB_IO_GEDA::init( const STRING_UTF8_MAP* aProperties )
{ {
m_props = aProperties; m_props = aProperties;
} }
void GPCB_PLUGIN::validateCache( const wxString& aLibraryPath, bool checkModified ) void PCB_IO_GEDA::validateCache( const wxString& aLibraryPath, bool checkModified )
{ {
if( !m_cache || ( checkModified && m_cache->IsModified() ) ) if( !m_cache || ( checkModified && m_cache->IsModified() ) )
{ {
@ -834,7 +834,7 @@ void GPCB_PLUGIN::validateCache( const wxString& aLibraryPath, bool checkModifie
} }
FOOTPRINT* GPCB_PLUGIN::ImportFootprint( const wxString& aFootprintPath, FOOTPRINT* PCB_IO_GEDA::ImportFootprint( const wxString& aFootprintPath,
wxString& aFootprintNameOut, wxString& aFootprintNameOut,
const STRING_UTF8_MAP* aProperties ) const STRING_UTF8_MAP* aProperties )
{ {
@ -858,7 +858,7 @@ FOOTPRINT* GPCB_PLUGIN::ImportFootprint( const wxString& aFootprintPath,
} }
void GPCB_PLUGIN::FootprintEnumerate( wxArrayString& aFootprintNames, const wxString& aLibraryPath, void PCB_IO_GEDA::FootprintEnumerate( wxArrayString& aFootprintNames, const wxString& aLibraryPath,
bool aBestEfforts, const STRING_UTF8_MAP* aProperties ) bool aBestEfforts, const STRING_UTF8_MAP* aProperties )
{ {
LOCALE_IO toggle; // toggles on, then off, the C locale. LOCALE_IO toggle; // toggles on, then off, the C locale.
@ -898,7 +898,7 @@ void GPCB_PLUGIN::FootprintEnumerate( wxArrayString& aFootprintNames, const wxSt
} }
const FOOTPRINT* GPCB_PLUGIN::getFootprint( const wxString& aLibraryPath, const FOOTPRINT* PCB_IO_GEDA::getFootprint( const wxString& aLibraryPath,
const wxString& aFootprintName, const wxString& aFootprintName,
const STRING_UTF8_MAP* aProperties, const STRING_UTF8_MAP* aProperties,
bool checkModified ) bool checkModified )
@ -920,7 +920,7 @@ const FOOTPRINT* GPCB_PLUGIN::getFootprint( const wxString& aLibraryPath,
} }
const FOOTPRINT* GPCB_PLUGIN::GetEnumeratedFootprint( const wxString& aLibraryPath, const FOOTPRINT* PCB_IO_GEDA::GetEnumeratedFootprint( const wxString& aLibraryPath,
const wxString& aFootprintName, const wxString& aFootprintName,
const STRING_UTF8_MAP* aProperties ) const STRING_UTF8_MAP* aProperties )
{ {
@ -928,7 +928,7 @@ const FOOTPRINT* GPCB_PLUGIN::GetEnumeratedFootprint( const wxString& aLibraryPa
} }
FOOTPRINT* GPCB_PLUGIN::FootprintLoad( const wxString& aLibraryPath, FOOTPRINT* PCB_IO_GEDA::FootprintLoad( const wxString& aLibraryPath,
const wxString& aFootprintName, const wxString& aFootprintName,
bool aKeepUUID, bool aKeepUUID,
const STRING_UTF8_MAP* aProperties ) const STRING_UTF8_MAP* aProperties )
@ -946,7 +946,7 @@ FOOTPRINT* GPCB_PLUGIN::FootprintLoad( const wxString& aLibraryPath,
} }
void GPCB_PLUGIN::FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName, void PCB_IO_GEDA::FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName,
const STRING_UTF8_MAP* aProperties ) const STRING_UTF8_MAP* aProperties )
{ {
LOCALE_IO toggle; // toggles on, then off, the C locale. LOCALE_IO toggle; // toggles on, then off, the C locale.
@ -965,7 +965,7 @@ void GPCB_PLUGIN::FootprintDelete( const wxString& aLibraryPath, const wxString&
} }
bool GPCB_PLUGIN::FootprintLibDelete( const wxString& aLibraryPath, const STRING_UTF8_MAP* aProperties ) bool PCB_IO_GEDA::FootprintLibDelete( const wxString& aLibraryPath, const STRING_UTF8_MAP* aProperties )
{ {
wxFileName fn; wxFileName fn;
fn.SetPath( aLibraryPath ); fn.SetPath( aLibraryPath );
@ -1043,13 +1043,13 @@ bool GPCB_PLUGIN::FootprintLibDelete( const wxString& aLibraryPath, const STRING
} }
long long GPCB_PLUGIN::GetLibraryTimestamp( const wxString& aLibraryPath ) const long long PCB_IO_GEDA::GetLibraryTimestamp( const wxString& aLibraryPath ) const
{ {
return GPCB_FPL_CACHE::GetTimestamp( aLibraryPath ); return GPCB_FPL_CACHE::GetTimestamp( aLibraryPath );
} }
bool GPCB_PLUGIN::IsFootprintLibWritable( const wxString& aLibraryPath ) bool PCB_IO_GEDA::IsFootprintLibWritable( const wxString& aLibraryPath )
{ {
LOCALE_IO toggle; LOCALE_IO toggle;

View File

@ -23,12 +23,12 @@
*/ */
/** /**
* @file gpcb_plugin.cpp * @file pcb_io_geda.cpp
* @brief Geda PCB file plugin definition file. * @brief Geda PCB file plugin definition file.
*/ */
#ifndef _GPCB_PLUGIN_H_ #ifndef PCB_IO_GEDA_H_
#define _GPCB_PLUGIN_H_ #define PCB_IO_GEDA_H_
#include <string> #include <string>
@ -44,7 +44,7 @@ class GPCB_FPL_CACHE;
* @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.
* @note Currently only reading GPCB footprint files is implemented. * @note Currently only reading GPCB footprint files is implemented.
*/ */
class GPCB_PLUGIN : public PCB_IO class PCB_IO_GEDA : public PCB_IO
{ {
public: public:
const wxString PluginName() const override const wxString PluginName() const override
@ -90,11 +90,11 @@ public:
//-----</PLUGIN API>-------------------------------------------------------- //-----</PLUGIN API>--------------------------------------------------------
GPCB_PLUGIN(); PCB_IO_GEDA();
GPCB_PLUGIN( int aControlFlags ); PCB_IO_GEDA( int aControlFlags );
~GPCB_PLUGIN(); ~PCB_IO_GEDA();
private: private:
void validateCache( const wxString& aLibraryPath, bool checkModified = true ); void validateCache( const wxString& aLibraryPath, bool checkModified = true );
@ -115,4 +115,4 @@ protected:
wxString m_filename; ///< for saves only, name is in m_reader for loads wxString m_filename; ///< for saves only, name is in m_reader for loads
}; };
#endif // _GPCB_PLUGIN_H_ #endif // PCB_IO_GEDA_H_

View File

@ -5,7 +5,7 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR} )
set( IPC2581_SRCS set( IPC2581_SRCS
ipc2581_plugin.cpp pcb_io_ipc2581.cpp
) )
add_library( ipc2581 STATIC ${IPC2581_SRCS} ) add_library( ipc2581 STATIC ${IPC2581_SRCS} )

View File

@ -17,7 +17,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>. * with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "ipc2581_plugin.h" #include "pcb_io_ipc2581.h"
#include <base_units.h> #include <base_units.h>
#include <bezier_curves.h> #include <bezier_curves.h>
@ -55,13 +55,13 @@
#include <wx/mstream.h> #include <wx/mstream.h>
#include <wx/xml/xml.h> #include <wx/xml/xml.h>
IPC2581_PLUGIN::~IPC2581_PLUGIN() PCB_IO_IPC2581::~PCB_IO_IPC2581()
{ {
clearLoadedFootprints(); clearLoadedFootprints();
} }
void IPC2581_PLUGIN::clearLoadedFootprints() void PCB_IO_IPC2581::clearLoadedFootprints()
{ {
for( FOOTPRINT* fp : m_loaded_footprints ) for( FOOTPRINT* fp : m_loaded_footprints )
{ {
@ -72,13 +72,13 @@ void IPC2581_PLUGIN::clearLoadedFootprints()
} }
const wxString IPC2581_PLUGIN::PluginName() const const wxString PCB_IO_IPC2581::PluginName() const
{ {
return wxT( "IPC-2581" ); return wxT( "IPC-2581" );
} }
std::vector<FOOTPRINT*> IPC2581_PLUGIN::GetImportedCachedLibraryFootprints() std::vector<FOOTPRINT*> PCB_IO_IPC2581::GetImportedCachedLibraryFootprints()
{ {
std::vector<FOOTPRINT*> retval; std::vector<FOOTPRINT*> retval;
@ -91,7 +91,7 @@ std::vector<FOOTPRINT*> IPC2581_PLUGIN::GetImportedCachedLibraryFootprints()
} }
void IPC2581_PLUGIN::insertNode( wxXmlNode* aParent, wxXmlNode* aNode ) void PCB_IO_IPC2581::insertNode( wxXmlNode* aParent, wxXmlNode* aNode )
{ {
// insertNode places the node at the start of the list of children // insertNode places the node at the start of the list of children
@ -105,7 +105,7 @@ void IPC2581_PLUGIN::insertNode( wxXmlNode* aParent, wxXmlNode* aNode )
} }
void IPC2581_PLUGIN::insertNodeAfter( wxXmlNode* aPrev, wxXmlNode* aNode ) void PCB_IO_IPC2581::insertNodeAfter( wxXmlNode* aPrev, wxXmlNode* aNode )
{ {
// insertNode places the node directly after aPrev // insertNode places the node directly after aPrev
@ -115,7 +115,7 @@ void IPC2581_PLUGIN::insertNodeAfter( wxXmlNode* aPrev, wxXmlNode* aNode )
} }
wxXmlNode* IPC2581_PLUGIN::insertNode( wxXmlNode* aParent, const wxString& aName ) wxXmlNode* PCB_IO_IPC2581::insertNode( wxXmlNode* aParent, const wxString& aName )
{ {
// Opening tag, closing tag, brackets and the closing slash // Opening tag, closing tag, brackets and the closing slash
m_total_bytes += 2 * aName.size() + 5; m_total_bytes += 2 * aName.size() + 5;
@ -125,7 +125,7 @@ wxXmlNode* IPC2581_PLUGIN::insertNode( wxXmlNode* aParent, const wxString& aName
} }
wxXmlNode* IPC2581_PLUGIN::appendNode( wxXmlNode* aParent, const wxString& aName ) wxXmlNode* PCB_IO_IPC2581::appendNode( wxXmlNode* aParent, const wxString& aName )
{ {
// AddChild iterates through the entire list of children, so we want to avoid // AddChild iterates through the entire list of children, so we want to avoid
// that if possible. When we share a parent and our next sibling is null, // that if possible. When we share a parent and our next sibling is null,
@ -153,7 +153,7 @@ wxXmlNode* IPC2581_PLUGIN::appendNode( wxXmlNode* aParent, const wxString& aName
} }
wxString IPC2581_PLUGIN::genString( const wxString& aStr, const char* aPrefix ) const wxString PCB_IO_IPC2581::genString( const wxString& aStr, const char* aPrefix ) const
{ {
wxString str; wxString str;
@ -185,7 +185,7 @@ wxString IPC2581_PLUGIN::genString( const wxString& aStr, const char* aPrefix )
} }
wxString IPC2581_PLUGIN::pinName( const PAD* aPad ) const wxString PCB_IO_IPC2581::pinName( const PAD* aPad ) const
{ {
wxString name = aPad->GetNumber(); wxString name = aPad->GetNumber();
@ -212,7 +212,7 @@ wxString IPC2581_PLUGIN::pinName( const PAD* aPad ) const
} }
wxString IPC2581_PLUGIN::componentName( FOOTPRINT* aFootprint ) wxString PCB_IO_IPC2581::componentName( FOOTPRINT* aFootprint )
{ {
auto tryInsert = auto tryInsert =
[&]( const wxString& aName ) [&]( const wxString& aName )
@ -248,7 +248,7 @@ wxString IPC2581_PLUGIN::componentName( FOOTPRINT* aFootprint )
} }
wxString IPC2581_PLUGIN::floatVal( double aVal ) wxString PCB_IO_IPC2581::floatVal( double aVal )
{ {
wxString str = wxString::FromCDouble( aVal, m_sigfig ); wxString str = wxString::FromCDouble( aVal, m_sigfig );
@ -264,7 +264,7 @@ wxString IPC2581_PLUGIN::floatVal( double aVal )
} }
void IPC2581_PLUGIN::addXY( wxXmlNode* aNode, const VECTOR2I& aVec, const char* aXName, void PCB_IO_IPC2581::addXY( wxXmlNode* aNode, const VECTOR2I& aVec, const char* aXName,
const char* aYName ) const char* aYName )
{ {
if( aXName ) if( aXName )
@ -279,14 +279,14 @@ void IPC2581_PLUGIN::addXY( wxXmlNode* aNode, const VECTOR2I& aVec, const char*
} }
void IPC2581_PLUGIN::addAttribute( wxXmlNode* aNode, const wxString& aName, const wxString& aValue ) void PCB_IO_IPC2581::addAttribute( wxXmlNode* aNode, const wxString& aName, const wxString& aValue )
{ {
m_total_bytes += aName.size() + aValue.size() + 4; m_total_bytes += aName.size() + aValue.size() + 4;
aNode->AddAttribute( aName, aValue ); aNode->AddAttribute( aName, aValue );
} }
wxXmlNode* IPC2581_PLUGIN::generateXmlHeader() wxXmlNode* PCB_IO_IPC2581::generateXmlHeader()
{ {
wxXmlNode* xmlHeaderNode = new wxXmlNode(wxXML_ELEMENT_NODE, "IPC-2581"); wxXmlNode* xmlHeaderNode = new wxXmlNode(wxXML_ELEMENT_NODE, "IPC-2581");
@ -305,7 +305,7 @@ wxXmlNode* IPC2581_PLUGIN::generateXmlHeader()
return xmlHeaderNode; return xmlHeaderNode;
} }
wxXmlNode* IPC2581_PLUGIN::generateContentSection() wxXmlNode* PCB_IO_IPC2581::generateContentSection()
{ {
if( m_progress_reporter ) if( m_progress_reporter )
m_progress_reporter->AdvancePhase( _( "Generating content section" ) ); m_progress_reporter->AdvancePhase( _( "Generating content section" ) );
@ -359,13 +359,13 @@ wxXmlNode* IPC2581_PLUGIN::generateContentSection()
} }
void IPC2581_PLUGIN::addLocationNode( wxXmlNode* aNode, double aX, double aY ) void PCB_IO_IPC2581::addLocationNode( wxXmlNode* aNode, double aX, double aY )
{ {
wxXmlNode* location_node = appendNode( aNode, "Location" ); wxXmlNode* location_node = appendNode( aNode, "Location" );
addXY( location_node, VECTOR2I( aX, aY ) ); addXY( location_node, VECTOR2I( aX, aY ) );
} }
void IPC2581_PLUGIN::addLocationNode( wxXmlNode* aNode, const PAD& aPad, bool aRelative ) void PCB_IO_IPC2581::addLocationNode( wxXmlNode* aNode, const PAD& aPad, bool aRelative )
{ {
VECTOR2D pos{}; VECTOR2D pos{};
@ -381,7 +381,7 @@ void IPC2581_PLUGIN::addLocationNode( wxXmlNode* aNode, const PAD& aPad, bool aR
} }
void IPC2581_PLUGIN::addLocationNode( wxXmlNode* aNode, const PCB_SHAPE& aShape ) void PCB_IO_IPC2581::addLocationNode( wxXmlNode* aNode, const PCB_SHAPE& aShape )
{ {
VECTOR2D pos{}; VECTOR2D pos{};
@ -410,7 +410,7 @@ void IPC2581_PLUGIN::addLocationNode( wxXmlNode* aNode, const PCB_SHAPE& aShape
} }
size_t IPC2581_PLUGIN::lineHash( int aWidth, LINE_STYLE aDashType ) size_t PCB_IO_IPC2581::lineHash( int aWidth, LINE_STYLE aDashType )
{ {
size_t hash = hash_val( aWidth ); size_t hash = hash_val( aWidth );
hash_combine( hash, aDashType ); hash_combine( hash, aDashType );
@ -418,13 +418,13 @@ size_t IPC2581_PLUGIN::lineHash( int aWidth, LINE_STYLE aDashType )
return hash; return hash;
} }
size_t IPC2581_PLUGIN::shapeHash( const PCB_SHAPE& aShape ) size_t PCB_IO_IPC2581::shapeHash( const PCB_SHAPE& aShape )
{ {
return hash_fp_item( &aShape, HASH_POS | REL_COORD ); return hash_fp_item( &aShape, HASH_POS | REL_COORD );
} }
wxXmlNode* IPC2581_PLUGIN::generateContentStackup( wxXmlNode* aContentNode ) wxXmlNode* PCB_IO_IPC2581::generateContentStackup( wxXmlNode* aContentNode )
{ {
BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings(); BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
@ -501,7 +501,7 @@ wxXmlNode* IPC2581_PLUGIN::generateContentStackup( wxXmlNode* aContentNode )
} }
void IPC2581_PLUGIN::addFillDesc( wxXmlNode* aNode, FILL_T aFill, bool aForce ) void PCB_IO_IPC2581::addFillDesc( wxXmlNode* aNode, FILL_T aFill, bool aForce )
{ {
if( aFill == FILL_T::FILLED_SHAPE ) if( aFill == FILL_T::FILLED_SHAPE )
{ {
@ -521,7 +521,7 @@ void IPC2581_PLUGIN::addFillDesc( wxXmlNode* aNode, FILL_T aFill, bool aForce )
} }
void IPC2581_PLUGIN::addLineDesc( wxXmlNode* aNode, int aWidth, LINE_STYLE aDashType, bool aForce ) void PCB_IO_IPC2581::addLineDesc( wxXmlNode* aNode, int aWidth, LINE_STYLE aDashType, bool aForce )
{ {
wxCHECK_RET( aNode, "aNode is null" ); wxCHECK_RET( aNode, "aNode is null" );
@ -576,7 +576,7 @@ void IPC2581_PLUGIN::addLineDesc( wxXmlNode* aNode, int aWidth, LINE_STYLE aDash
} }
void IPC2581_PLUGIN::addText( wxXmlNode* aContentNode, EDA_TEXT* aText, const KIFONT::METRICS& aFontMetrics ) void PCB_IO_IPC2581::addText( wxXmlNode* aContentNode, EDA_TEXT* aText, const KIFONT::METRICS& aFontMetrics )
{ {
if( !aText->IsVisible() ) if( !aText->IsVisible() )
return; return;
@ -696,7 +696,7 @@ void IPC2581_PLUGIN::addText( wxXmlNode* aContentNode, EDA_TEXT* aText, const KI
} }
void IPC2581_PLUGIN::addShape( wxXmlNode* aContentNode, const PAD& aPad, PCB_LAYER_ID aLayer ) void PCB_IO_IPC2581::addShape( wxXmlNode* aContentNode, const PAD& aPad, PCB_LAYER_ID aLayer )
{ {
size_t hash = hash_fp_item( &aPad, 0 ); size_t hash = hash_fp_item( &aPad, 0 );
auto iter = m_std_shape_dict.find( hash ); auto iter = m_std_shape_dict.find( hash );
@ -890,7 +890,7 @@ void IPC2581_PLUGIN::addShape( wxXmlNode* aContentNode, const PAD& aPad, PCB_LAY
} }
void IPC2581_PLUGIN::addShape( wxXmlNode* aContentNode, const PCB_SHAPE& aShape ) void PCB_IO_IPC2581::addShape( wxXmlNode* aContentNode, const PCB_SHAPE& aShape )
{ {
size_t hash = shapeHash( aShape ); size_t hash = shapeHash( aShape );
auto iter = m_user_shape_dict.find( hash ); auto iter = m_user_shape_dict.find( hash );
@ -1081,7 +1081,7 @@ void IPC2581_PLUGIN::addShape( wxXmlNode* aContentNode, const PCB_SHAPE& aShape
} }
void IPC2581_PLUGIN::addSlotCavity( wxXmlNode* aNode, const PAD& aPad, const wxString& aName ) void PCB_IO_IPC2581::addSlotCavity( wxXmlNode* aNode, const PAD& aPad, const wxString& aName )
{ {
wxXmlNode* slotNode = appendNode( aNode, "SlotCavity" ); wxXmlNode* slotNode = appendNode( aNode, "SlotCavity" );
addAttribute( slotNode, "name", aName ); addAttribute( slotNode, "name", aName );
@ -1099,7 +1099,7 @@ void IPC2581_PLUGIN::addSlotCavity( wxXmlNode* aNode, const PAD& aPad, const wxS
} }
wxXmlNode* IPC2581_PLUGIN::generateLogisticSection() wxXmlNode* PCB_IO_IPC2581::generateLogisticSection()
{ {
wxXmlNode* logisticNode = appendNode( m_xml_root, "LogisticHeader" ); wxXmlNode* logisticNode = appendNode( m_xml_root, "LogisticHeader" );
@ -1120,7 +1120,7 @@ wxXmlNode* IPC2581_PLUGIN::generateLogisticSection()
} }
wxXmlNode* IPC2581_PLUGIN::generateHistorySection() wxXmlNode* PCB_IO_IPC2581::generateHistorySection()
{ {
if( m_progress_reporter ) if( m_progress_reporter )
m_progress_reporter->AdvancePhase( _( "Generating history section" ) ); m_progress_reporter->AdvancePhase( _( "Generating history section" ) );
@ -1147,7 +1147,7 @@ wxXmlNode* IPC2581_PLUGIN::generateHistorySection()
return historyNode; return historyNode;
} }
wxXmlNode* IPC2581_PLUGIN::generateBOMSection( wxXmlNode* aEcadNode ) wxXmlNode* PCB_IO_IPC2581::generateBOMSection( wxXmlNode* aEcadNode )
{ {
if( m_progress_reporter ) if( m_progress_reporter )
m_progress_reporter->AdvancePhase( _( "Generating BOM section" ) ); m_progress_reporter->AdvancePhase( _( "Generating BOM section" ) );
@ -1311,7 +1311,7 @@ wxXmlNode* IPC2581_PLUGIN::generateBOMSection( wxXmlNode* aEcadNode )
} }
wxXmlNode* IPC2581_PLUGIN::generateEcadSection() wxXmlNode* PCB_IO_IPC2581::generateEcadSection()
{ {
if( m_progress_reporter ) if( m_progress_reporter )
m_progress_reporter->AdvancePhase( _( "Generating CAD data" ) ); m_progress_reporter->AdvancePhase( _( "Generating CAD data" ) );
@ -1330,20 +1330,20 @@ wxXmlNode* IPC2581_PLUGIN::generateEcadSection()
} }
void IPC2581_PLUGIN::addCadHeader( wxXmlNode* aEcadNode ) void PCB_IO_IPC2581::addCadHeader( wxXmlNode* aEcadNode )
{ {
wxXmlNode* cadHeaderNode = appendNode( aEcadNode, "CadHeader" ); wxXmlNode* cadHeaderNode = appendNode( aEcadNode, "CadHeader" );
addAttribute( cadHeaderNode, "units", m_units_str ); addAttribute( cadHeaderNode, "units", m_units_str );
} }
bool IPC2581_PLUGIN::isValidLayerFor2581( PCB_LAYER_ID aLayer ) bool PCB_IO_IPC2581::isValidLayerFor2581( PCB_LAYER_ID aLayer )
{ {
return ( aLayer >= F_Cu && aLayer <= User_9 ) || aLayer == UNDEFINED_LAYER; return ( aLayer >= F_Cu && aLayer <= User_9 ) || aLayer == UNDEFINED_LAYER;
} }
void IPC2581_PLUGIN::addLayerAttributes( wxXmlNode* aNode, PCB_LAYER_ID aLayer ) void PCB_IO_IPC2581::addLayerAttributes( wxXmlNode* aNode, PCB_LAYER_ID aLayer )
{ {
switch( aLayer ) switch( aLayer )
{ {
@ -1423,7 +1423,7 @@ void IPC2581_PLUGIN::addLayerAttributes( wxXmlNode* aNode, PCB_LAYER_ID aLayer )
} }
void IPC2581_PLUGIN::generateCadLayers( wxXmlNode* aCadLayerNode ) void PCB_IO_IPC2581::generateCadLayers( wxXmlNode* aCadLayerNode )
{ {
BOARD_DESIGN_SETTINGS& dsnSettings = m_board->GetDesignSettings(); BOARD_DESIGN_SETTINGS& dsnSettings = m_board->GetDesignSettings();
@ -1497,7 +1497,7 @@ void IPC2581_PLUGIN::generateCadLayers( wxXmlNode* aCadLayerNode )
} }
void IPC2581_PLUGIN::generateDrillLayers( wxXmlNode* aCadLayerNode ) void PCB_IO_IPC2581::generateDrillLayers( wxXmlNode* aCadLayerNode )
{ {
for( BOARD_ITEM* item : m_board->Tracks() ) for( BOARD_ITEM* item : m_board->Tracks() )
{ {
@ -1552,7 +1552,7 @@ void IPC2581_PLUGIN::generateDrillLayers( wxXmlNode* aCadLayerNode )
} }
void IPC2581_PLUGIN::generateStepSection( wxXmlNode* aCadNode ) void PCB_IO_IPC2581::generateStepSection( wxXmlNode* aCadNode )
{ {
wxXmlNode* stepNode = appendNode( aCadNode, "Step" ); wxXmlNode* stepNode = appendNode( aCadNode, "Step" );
wxFileName fn( m_board->GetFileName() ); wxFileName fn( m_board->GetFileName() );
@ -1578,7 +1578,7 @@ void IPC2581_PLUGIN::generateStepSection( wxXmlNode* aCadNode )
} }
void IPC2581_PLUGIN::addPad( wxXmlNode* aContentNode, const PAD* aPad, PCB_LAYER_ID aLayer ) void PCB_IO_IPC2581::addPad( wxXmlNode* aContentNode, const PAD* aPad, PCB_LAYER_ID aLayer )
{ {
wxXmlNode* padNode = appendNode( aContentNode, "Pad" ); wxXmlNode* padNode = appendNode( aContentNode, "Pad" );
FOOTPRINT* fp = aPad->GetParentFootprint(); FOOTPRINT* fp = aPad->GetParentFootprint();
@ -1607,7 +1607,7 @@ void IPC2581_PLUGIN::addPad( wxXmlNode* aContentNode, const PAD* aPad, PCB_LAYER
} }
} }
void IPC2581_PLUGIN::addVia( wxXmlNode* aContentNode, const PCB_VIA* aVia, PCB_LAYER_ID aLayer ) void PCB_IO_IPC2581::addVia( wxXmlNode* aContentNode, const PCB_VIA* aVia, PCB_LAYER_ID aLayer )
{ {
if( !aVia->FlashLayer( aLayer ) ) if( !aVia->FlashLayer( aLayer ) )
return; return;
@ -1624,7 +1624,7 @@ void IPC2581_PLUGIN::addVia( wxXmlNode* aContentNode, const PCB_VIA* aVia, PCB_L
} }
void IPC2581_PLUGIN::addPadStack( wxXmlNode* aPadNode, const PAD* aPad ) void PCB_IO_IPC2581::addPadStack( wxXmlNode* aPadNode, const PAD* aPad )
{ {
size_t hash = hash_fp_item( aPad, 0 ); size_t hash = hash_fp_item( aPad, 0 );
wxString name = wxString::Format( "PADSTACK_%zu", m_padstack_dict.size() + 1 ); wxString name = wxString::Format( "PADSTACK_%zu", m_padstack_dict.size() + 1 );
@ -1686,7 +1686,7 @@ void IPC2581_PLUGIN::addPadStack( wxXmlNode* aPadNode, const PAD* aPad )
} }
} }
void IPC2581_PLUGIN::addPadStack( wxXmlNode* aContentNode, const PCB_VIA* aVia ) void PCB_IO_IPC2581::addPadStack( wxXmlNode* aContentNode, const PCB_VIA* aVia )
{ {
size_t hash = hash_fp_item( aVia, 0 ); size_t hash = hash_fp_item( aVia, 0 );
wxString name = wxString::Format( "PADSTACK_%zu", m_padstack_dict.size() + 1 ); wxString name = wxString::Format( "PADSTACK_%zu", m_padstack_dict.size() + 1 );
@ -1737,7 +1737,7 @@ void IPC2581_PLUGIN::addPadStack( wxXmlNode* aContentNode, const PCB_VIA* aVia )
} }
bool IPC2581_PLUGIN::addPolygonNode( wxXmlNode* aParentNode, bool PCB_IO_IPC2581::addPolygonNode( wxXmlNode* aParentNode,
const SHAPE_POLY_SET::POLYGON& aPolygon, FILL_T aFillType, const SHAPE_POLY_SET::POLYGON& aPolygon, FILL_T aFillType,
int aWidth, LINE_STYLE aDashType ) int aWidth, LINE_STYLE aDashType )
{ {
@ -1787,7 +1787,7 @@ bool IPC2581_PLUGIN::addPolygonNode( wxXmlNode* aParentNode,
} }
bool IPC2581_PLUGIN::addPolygonCutouts( wxXmlNode* aParentNode, const SHAPE_POLY_SET::POLYGON& aPolygon ) bool PCB_IO_IPC2581::addPolygonCutouts( wxXmlNode* aParentNode, const SHAPE_POLY_SET::POLYGON& aPolygon )
{ {
for( size_t ii = 1; ii < aPolygon.size(); ++ii ) for( size_t ii = 1; ii < aPolygon.size(); ++ii )
{ {
@ -1813,7 +1813,7 @@ bool IPC2581_PLUGIN::addPolygonCutouts( wxXmlNode* aParentNode, const SHAPE_POLY
} }
bool IPC2581_PLUGIN::addOutlineNode( wxXmlNode* aParentNode, const SHAPE_POLY_SET& aPolySet, int aWidth, LINE_STYLE aDashType ) bool PCB_IO_IPC2581::addOutlineNode( wxXmlNode* aParentNode, const SHAPE_POLY_SET& aPolySet, int aWidth, LINE_STYLE aDashType )
{ {
if( aPolySet.OutlineCount() == 0 ) if( aPolySet.OutlineCount() == 0 )
return false; return false;
@ -1841,7 +1841,7 @@ bool IPC2581_PLUGIN::addOutlineNode( wxXmlNode* aParentNode, const SHAPE_POLY_SE
} }
bool IPC2581_PLUGIN::addContourNode( wxXmlNode* aParentNode, const SHAPE_POLY_SET& aPolySet, bool PCB_IO_IPC2581::addContourNode( wxXmlNode* aParentNode, const SHAPE_POLY_SET& aPolySet,
int aOutline, FILL_T aFillType, int aWidth, int aOutline, FILL_T aFillType, int aWidth,
LINE_STYLE aDashType ) LINE_STYLE aDashType )
{ {
@ -1867,7 +1867,7 @@ bool IPC2581_PLUGIN::addContourNode( wxXmlNode* aParentNode, const SHAPE_POLY_SE
} }
void IPC2581_PLUGIN::generateProfile( wxXmlNode* aStepNode ) void PCB_IO_IPC2581::generateProfile( wxXmlNode* aStepNode )
{ {
SHAPE_POLY_SET board_outline; SHAPE_POLY_SET board_outline;
@ -1887,7 +1887,7 @@ void IPC2581_PLUGIN::generateProfile( wxXmlNode* aStepNode )
} }
wxXmlNode* IPC2581_PLUGIN::addPackage( wxXmlNode* aContentNode, FOOTPRINT* aFp ) wxXmlNode* PCB_IO_IPC2581::addPackage( wxXmlNode* aContentNode, FOOTPRINT* aFp )
{ {
std::unique_ptr<FOOTPRINT> fp( static_cast<FOOTPRINT*>( aFp->Clone() ) ); std::unique_ptr<FOOTPRINT> fp( static_cast<FOOTPRINT*>( aFp->Clone() ) );
fp->SetParentGroup( nullptr ); fp->SetParentGroup( nullptr );
@ -2175,7 +2175,7 @@ wxXmlNode* IPC2581_PLUGIN::addPackage( wxXmlNode* aContentNode, FOOTPRINT* aFp )
} }
void IPC2581_PLUGIN::generateComponents( wxXmlNode* aStepNode ) void PCB_IO_IPC2581::generateComponents( wxXmlNode* aStepNode )
{ {
std::vector<wxXmlNode*> componentNodes; std::vector<wxXmlNode*> componentNodes;
std::vector<wxXmlNode*> packageNodes; std::vector<wxXmlNode*> packageNodes;
@ -2252,7 +2252,7 @@ void IPC2581_PLUGIN::generateComponents( wxXmlNode* aStepNode )
aStepNode->AddChild( cmp ); aStepNode->AddChild( cmp );
} }
void IPC2581_PLUGIN::generateLogicalNets( wxXmlNode* aStepNode ) void PCB_IO_IPC2581::generateLogicalNets( wxXmlNode* aStepNode )
{ {
for( auto& [ net, pin_pair] : m_net_pin_dict ) for( auto& [ net, pin_pair] : m_net_pin_dict )
{ {
@ -2271,7 +2271,7 @@ void IPC2581_PLUGIN::generateLogicalNets( wxXmlNode* aStepNode )
//TODO: Add PhyNetGroup section //TODO: Add PhyNetGroup section
void IPC2581_PLUGIN::generateLayerFeatures( wxXmlNode* aStepNode ) void PCB_IO_IPC2581::generateLayerFeatures( wxXmlNode* aStepNode )
{ {
LSEQ layers = m_board->GetEnabledLayers().Seq(); LSEQ layers = m_board->GetEnabledLayers().Seq();
const NETINFO_LIST& nets = m_board->GetNetInfo(); const NETINFO_LIST& nets = m_board->GetNetInfo();
@ -2387,7 +2387,7 @@ void IPC2581_PLUGIN::generateLayerFeatures( wxXmlNode* aStepNode )
} }
void IPC2581_PLUGIN::generateLayerSetDrill( wxXmlNode* aLayerNode ) void PCB_IO_IPC2581::generateLayerSetDrill( wxXmlNode* aLayerNode )
{ {
int hole_count = 1; int hole_count = 1;
for( const auto& [layer_pair, vec] : m_drill_layers ) for( const auto& [layer_pair, vec] : m_drill_layers )
@ -2478,7 +2478,7 @@ void IPC2581_PLUGIN::generateLayerSetDrill( wxXmlNode* aLayerNode )
} }
void IPC2581_PLUGIN::generateLayerSetNet( wxXmlNode* aLayerNode, PCB_LAYER_ID aLayer, void PCB_IO_IPC2581::generateLayerSetNet( wxXmlNode* aLayerNode, PCB_LAYER_ID aLayer,
std::vector<BOARD_ITEM*>& aItems ) std::vector<BOARD_ITEM*>& aItems )
{ {
auto it = aItems.begin(); auto it = aItems.begin();
@ -2739,7 +2739,7 @@ void IPC2581_PLUGIN::generateLayerSetNet( wxXmlNode* aLayerNode, PCB_LAYER_ID aL
} }
wxXmlNode* IPC2581_PLUGIN::generateAvlSection() wxXmlNode* PCB_IO_IPC2581::generateAvlSection()
{ {
if( m_progress_reporter ) if( m_progress_reporter )
m_progress_reporter->AdvancePhase( _( "Generating BOM section" ) ); m_progress_reporter->AdvancePhase( _( "Generating BOM section" ) );
@ -2832,7 +2832,7 @@ wxXmlNode* IPC2581_PLUGIN::generateAvlSection()
} }
void IPC2581_PLUGIN::SaveBoard( const wxString& aFileName, BOARD* aBoard, void PCB_IO_IPC2581::SaveBoard( const wxString& aFileName, BOARD* aBoard,
const STRING_UTF8_MAP* aProperties, const STRING_UTF8_MAP* aProperties,
PROGRESS_REPORTER* aProgressReporter ) PROGRESS_REPORTER* aProgressReporter )
{ {

View File

@ -17,8 +17,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>. * with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef IPC2581_PLUGIN_H #ifndef PCB_IO_IPC2581_H_
#define IPC2581_PLUGIN_H #define PCB_IO_IPC2581_H_
#include <pcb_io/pcb_io.h> #include <pcb_io/pcb_io.h>
#include <pcb_io/pcb_io_mgr.h> #include <pcb_io/pcb_io_mgr.h>
@ -46,14 +46,14 @@ class PROGRESS_REPORTER;
class SHAPE_POLY_SET; class SHAPE_POLY_SET;
class SHAPE_SEGMENT; class SHAPE_SEGMENT;
class IPC2581_PLUGIN : public PCB_IO, public LAYER_REMAPPABLE_PLUGIN class PCB_IO_IPC2581 : public PCB_IO, public LAYER_REMAPPABLE_PLUGIN
{ {
public: public:
/** /**
* @brief IPC2581_PLUGIN * @brief PCB_IO_IPC2581
* *
*/ */
IPC2581_PLUGIN() PCB_IO_IPC2581()
{ {
m_show_layer_mapping_warnings = false; m_show_layer_mapping_warnings = false;
m_total_bytes = 0; m_total_bytes = 0;
@ -72,10 +72,10 @@ public:
m_xml_root = nullptr; m_xml_root = nullptr;
} }
~IPC2581_PLUGIN() override; ~PCB_IO_IPC2581() override;
/** /**
* @brief IPC2581_PLUGIN * @brief PCB_IO_IPC2581
*/ */
const wxString PluginName() const override; const wxString PluginName() const override;
@ -351,4 +351,4 @@ private:
wxXmlNode* m_xml_root; wxXmlNode* m_xml_root;
}; };
#endif // IPC2581_PLUGIN_H #endif // PCB_IO_IPC2581_H_

View File

@ -61,7 +61,7 @@
#include <cmath> #include <cmath>
#include <cstdio> #include <cstdio>
#include <cstring> #include <cstring>
#include <pcb_io/legacy/legacy_plugin.h> // implement this here #include <pcb_io/kicad_legacy/pcb_io_kicad_legacy.h> // implement this here
#include <wx/ffile.h> #include <wx/ffile.h>
#include <wx/log.h> #include <wx/log.h>
#include <wx/string.h> #include <wx/string.h>
@ -95,7 +95,7 @@
#include <math/util.h> // for KiROUND #include <math/util.h> // for KiROUND
#include <progress_reporter.h> #include <progress_reporter.h>
typedef LEGACY_PLUGIN::BIU BIU; typedef PCB_IO_KICAD_LEGACY::BIU BIU;
typedef unsigned LEG_MASK; typedef unsigned LEG_MASK;
@ -204,7 +204,7 @@ static bool inline isSpace( int c ) { return strchr( delims, c ) != nullptr; }
#define MASK(x) (1<<(x)) #define MASK(x) (1<<(x))
void LEGACY_PLUGIN::checkpoint() void PCB_IO_KICAD_LEGACY::checkpoint()
{ {
const unsigned PROGRESS_DELTA = 250; const unsigned PROGRESS_DELTA = 250;
@ -307,7 +307,7 @@ inline bool is_leg_copperlayer_valid( int aCu_Count, int aLegacyLayerNum )
} }
PCB_LAYER_ID LEGACY_PLUGIN::leg_layer2new( int cu_count, int aLayerNum ) PCB_LAYER_ID PCB_IO_KICAD_LEGACY::leg_layer2new( int cu_count, int aLayerNum )
{ {
int newid; int newid;
unsigned old = aLayerNum; unsigned old = aLayerNum;
@ -363,7 +363,7 @@ PCB_LAYER_ID LEGACY_PLUGIN::leg_layer2new( int cu_count, int aLayerNum )
} }
LSET LEGACY_PLUGIN::leg_mask2new( int cu_count, unsigned aMask ) LSET PCB_IO_KICAD_LEGACY::leg_mask2new( int cu_count, unsigned aMask )
{ {
LSET ret; LSET ret;
@ -410,7 +410,7 @@ static inline long hexParse( const char* next, const char** out = nullptr )
} }
bool LEGACY_PLUGIN::CanReadBoard( const wxString& aFileName ) const bool PCB_IO_KICAD_LEGACY::CanReadBoard( const wxString& aFileName ) const
{ {
if( !PCB_IO::CanReadBoard( aFileName ) ) if( !PCB_IO::CanReadBoard( aFileName ) )
return false; return false;
@ -429,7 +429,7 @@ bool LEGACY_PLUGIN::CanReadBoard( const wxString& aFileName ) const
} }
bool LEGACY_PLUGIN::CanReadFootprint( const wxString& aFileName ) const bool PCB_IO_KICAD_LEGACY::CanReadFootprint( const wxString& aFileName ) const
{ {
if( !PCB_IO::CanReadFootprint( aFileName ) ) if( !PCB_IO::CanReadFootprint( aFileName ) )
return false; return false;
@ -465,7 +465,7 @@ bool LEGACY_PLUGIN::CanReadFootprint( const wxString& aFileName ) const
} }
BOARD* LEGACY_PLUGIN::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, BOARD* PCB_IO_KICAD_LEGACY::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties, PROJECT* aProject, const STRING_UTF8_MAP* aProperties, PROJECT* aProject,
PROGRESS_REPORTER* aProgressReporter ) PROGRESS_REPORTER* aProgressReporter )
{ {
@ -520,7 +520,7 @@ BOARD* LEGACY_PLUGIN::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
} }
void LEGACY_PLUGIN::loadAllSections( bool doAppend ) void PCB_IO_KICAD_LEGACY::loadAllSections( bool doAppend )
{ {
// $GENERAL section is first // $GENERAL section is first
@ -627,7 +627,7 @@ void LEGACY_PLUGIN::loadAllSections( bool doAppend )
} }
int LEGACY_PLUGIN::getVersion( LINE_READER* aReader ) int PCB_IO_KICAD_LEGACY::getVersion( LINE_READER* aReader )
{ {
// Read first line and TEST if it is a PCB file format header like this: // Read first line and TEST if it is a PCB file format header like this:
// "PCBNEW-BOARD Version 1 ...." // "PCBNEW-BOARD Version 1 ...."
@ -661,7 +661,7 @@ int LEGACY_PLUGIN::getVersion( LINE_READER* aReader )
} }
void LEGACY_PLUGIN::loadGENERAL() void PCB_IO_KICAD_LEGACY::loadGENERAL()
{ {
char* line; char* line;
char* saveptr; char* saveptr;
@ -773,7 +773,7 @@ void LEGACY_PLUGIN::loadGENERAL()
} }
void LEGACY_PLUGIN::loadSHEET() void PCB_IO_KICAD_LEGACY::loadSHEET()
{ {
char buf[260]; char buf[260];
TITLE_BLOCK tb; TITLE_BLOCK tb;
@ -904,7 +904,7 @@ void LEGACY_PLUGIN::loadSHEET()
} }
void LEGACY_PLUGIN::loadSETUP() void PCB_IO_KICAD_LEGACY::loadSETUP()
{ {
BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings(); BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
ZONE_SETTINGS zoneSettings = m_board->GetZoneSettings(); ZONE_SETTINGS zoneSettings = m_board->GetZoneSettings();
@ -1192,7 +1192,7 @@ void LEGACY_PLUGIN::loadSETUP()
} }
void LEGACY_PLUGIN::loadFOOTPRINT( FOOTPRINT* aFootprint ) void PCB_IO_KICAD_LEGACY::loadFOOTPRINT( FOOTPRINT* aFootprint )
{ {
char* line; char* line;
@ -1367,7 +1367,7 @@ void LEGACY_PLUGIN::loadFOOTPRINT( FOOTPRINT* aFootprint )
} }
void LEGACY_PLUGIN::loadPAD( FOOTPRINT* aFootprint ) void PCB_IO_KICAD_LEGACY::loadPAD( FOOTPRINT* aFootprint )
{ {
std::unique_ptr<PAD> pad = std::make_unique<PAD>( aFootprint ); std::unique_ptr<PAD> pad = std::make_unique<PAD>( aFootprint );
char* line; char* line;
@ -1588,7 +1588,7 @@ void LEGACY_PLUGIN::loadPAD( FOOTPRINT* aFootprint )
} }
void LEGACY_PLUGIN::loadFP_SHAPE( FOOTPRINT* aFootprint ) void PCB_IO_KICAD_LEGACY::loadFP_SHAPE( FOOTPRINT* aFootprint )
{ {
SHAPE_T shape; SHAPE_T shape;
char* line = m_reader->Line(); // obtain current (old) line char* line = m_reader->Line(); // obtain current (old) line
@ -1712,7 +1712,7 @@ void LEGACY_PLUGIN::loadFP_SHAPE( FOOTPRINT* aFootprint )
} }
void LEGACY_PLUGIN::loadMODULE_TEXT( PCB_TEXT* aText ) void PCB_IO_KICAD_LEGACY::loadMODULE_TEXT( PCB_TEXT* aText )
{ {
const char* data; const char* data;
const char* txt_end; const char* txt_end;
@ -1795,7 +1795,7 @@ void LEGACY_PLUGIN::loadMODULE_TEXT( PCB_TEXT* aText )
} }
void LEGACY_PLUGIN::load3D( FOOTPRINT* aFootprint ) void PCB_IO_KICAD_LEGACY::load3D( FOOTPRINT* aFootprint )
{ {
FP_3DMODEL t3D; FP_3DMODEL t3D;
@ -1835,7 +1835,7 @@ void LEGACY_PLUGIN::load3D( FOOTPRINT* aFootprint )
} }
void LEGACY_PLUGIN::loadPCB_LINE() void PCB_IO_KICAD_LEGACY::loadPCB_LINE()
{ {
/* example: /* example:
$DRAWSEGMENT $DRAWSEGMENT
@ -1955,7 +1955,7 @@ void LEGACY_PLUGIN::loadPCB_LINE()
THROW_IO_ERROR( wxT( "Missing '$EndDRAWSEGMENT'" ) ); THROW_IO_ERROR( wxT( "Missing '$EndDRAWSEGMENT'" ) );
} }
void LEGACY_PLUGIN::loadNETINFO_ITEM() void PCB_IO_KICAD_LEGACY::loadNETINFO_ITEM()
{ {
/* a net description is something like /* a net description is something like
* $EQUIPOT * $EQUIPOT
@ -2023,7 +2023,7 @@ void LEGACY_PLUGIN::loadNETINFO_ITEM()
} }
void LEGACY_PLUGIN::loadPCB_TEXT() void PCB_IO_KICAD_LEGACY::loadPCB_TEXT()
{ {
/* examples: /* examples:
For a single line text: For a single line text:
@ -2133,7 +2133,7 @@ void LEGACY_PLUGIN::loadPCB_TEXT()
} }
void LEGACY_PLUGIN::loadTrackList( int aStructType ) void PCB_IO_KICAD_LEGACY::loadTrackList( int aStructType )
{ {
char* line; char* line;
@ -2286,7 +2286,7 @@ void LEGACY_PLUGIN::loadTrackList( int aStructType )
} }
void LEGACY_PLUGIN::loadNETCLASS() void PCB_IO_KICAD_LEGACY::loadNETCLASS()
{ {
char buf[1024]; char buf[1024];
wxString netname; wxString netname;
@ -2377,7 +2377,7 @@ void LEGACY_PLUGIN::loadNETCLASS()
} }
void LEGACY_PLUGIN::loadZONE_CONTAINER() void PCB_IO_KICAD_LEGACY::loadZONE_CONTAINER()
{ {
std::unique_ptr<ZONE> zc = std::make_unique<ZONE>( m_board ); std::unique_ptr<ZONE> zc = std::make_unique<ZONE>( m_board );
@ -2655,7 +2655,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER()
} }
void LEGACY_PLUGIN::loadDIMENSION() void PCB_IO_KICAD_LEGACY::loadDIMENSION()
{ {
std::unique_ptr<PCB_DIM_ALIGNED> dim = std::make_unique<PCB_DIM_ALIGNED>( m_board, std::unique_ptr<PCB_DIM_ALIGNED> dim = std::make_unique<PCB_DIM_ALIGNED>( m_board,
PCB_DIM_ALIGNED_T ); PCB_DIM_ALIGNED_T );
@ -2794,7 +2794,7 @@ void LEGACY_PLUGIN::loadDIMENSION()
} }
void LEGACY_PLUGIN::loadPCB_TARGET() void PCB_IO_KICAD_LEGACY::loadPCB_TARGET()
{ {
char* line; char* line;
@ -2833,7 +2833,7 @@ void LEGACY_PLUGIN::loadPCB_TARGET()
} }
BIU LEGACY_PLUGIN::biuParse( const char* aValue, const char** nptrptr ) BIU PCB_IO_KICAD_LEGACY::biuParse( const char* aValue, const char** nptrptr )
{ {
char* nptr; char* nptr;
@ -2872,7 +2872,7 @@ BIU LEGACY_PLUGIN::biuParse( const char* aValue, const char** nptrptr )
} }
EDA_ANGLE LEGACY_PLUGIN::degParse( const char* aValue, const char** nptrptr ) EDA_ANGLE PCB_IO_KICAD_LEGACY::degParse( const char* aValue, const char** nptrptr )
{ {
char* nptr; char* nptr;
@ -2907,7 +2907,7 @@ EDA_ANGLE LEGACY_PLUGIN::degParse( const char* aValue, const char** nptrptr )
} }
void LEGACY_PLUGIN::init( const STRING_UTF8_MAP* aProperties ) void PCB_IO_KICAD_LEGACY::init( const STRING_UTF8_MAP* aProperties )
{ {
m_loading_format_version = 0; m_loading_format_version = 0;
m_cu_count = 16; m_cu_count = 16;
@ -2950,12 +2950,12 @@ typedef boost::ptr_map< std::string, FOOTPRINT > FOOTPRINT_MAP;
/** /**
* The footprint portion of the PLUGIN API, and only for the LEGACY_PLUGIN, so therefore is * The footprint portion of the PLUGIN API, and only for the PCB_IO_KICAD_LEGACY, so therefore is
* private to this implementation file, i.e. not placed into a header. * private to this implementation file, i.e. not placed into a header.
*/ */
struct LP_CACHE struct LP_CACHE
{ {
LP_CACHE( LEGACY_PLUGIN* aOwner, const wxString& aLibraryPath ); LP_CACHE( PCB_IO_KICAD_LEGACY* aOwner, const wxString& aLibraryPath );
// Most all functions in this class throw IO_ERROR exceptions. There are no // Most all functions in this class throw IO_ERROR exceptions. There are no
// error codes nor user interface calls from here, nor in any PLUGIN. // error codes nor user interface calls from here, nor in any PLUGIN.
@ -2972,7 +2972,7 @@ struct LP_CACHE
bool IsModified(); bool IsModified();
static long long GetTimestamp( const wxString& aLibPath ); static long long GetTimestamp( const wxString& aLibPath );
LEGACY_PLUGIN* m_owner; // my owner, I need its LEGACY_PLUGIN::loadFOOTPRINT() PCB_IO_KICAD_LEGACY* m_owner; // my owner, I need its PCB_IO_KICAD_LEGACY::loadFOOTPRINT()
wxString m_lib_path; wxString m_lib_path;
FOOTPRINT_MAP m_footprints; // map or tuple of footprint_name vs. FOOTPRINT* FOOTPRINT_MAP m_footprints; // map or tuple of footprint_name vs. FOOTPRINT*
bool m_writable; bool m_writable;
@ -2984,7 +2984,7 @@ struct LP_CACHE
}; };
LP_CACHE::LP_CACHE( LEGACY_PLUGIN* aOwner, const wxString& aLibraryPath ) : LP_CACHE::LP_CACHE( PCB_IO_KICAD_LEGACY* aOwner, const wxString& aLibraryPath ) :
m_owner( aOwner ), m_owner( aOwner ),
m_lib_path( aLibraryPath ), m_lib_path( aLibraryPath ),
m_writable( true ), m_writable( true ),
@ -3117,7 +3117,7 @@ void LP_CACHE::LoadModules( LINE_READER* aReader )
/* /*
There was a bug in old legacy library management code There was a bug in old legacy library management code
(pre-LEGACY_PLUGIN) which was introducing duplicate footprint names (pre-PCB_IO_KICAD_LEGACY) which was introducing duplicate footprint names
in legacy libraries without notification. To best recover from such in legacy libraries without notification. To best recover from such
bad libraries, and use them to their fullest, there are a few bad libraries, and use them to their fullest, there are a few
strategies that could be used. (Note: footprints must have unique strategies that could be used. (Note: footprints must have unique
@ -3174,13 +3174,13 @@ void LP_CACHE::LoadModules( LINE_READER* aReader )
} }
long long LEGACY_PLUGIN::GetLibraryTimestamp( const wxString& aLibraryPath ) const long long PCB_IO_KICAD_LEGACY::GetLibraryTimestamp( const wxString& aLibraryPath ) const
{ {
return LP_CACHE::GetTimestamp( aLibraryPath ); return LP_CACHE::GetTimestamp( aLibraryPath );
} }
void LEGACY_PLUGIN::cacheLib( const wxString& aLibraryPath ) void PCB_IO_KICAD_LEGACY::cacheLib( const wxString& aLibraryPath )
{ {
if( !m_cache || m_cache->m_lib_path != aLibraryPath || m_cache->IsModified() ) if( !m_cache || m_cache->m_lib_path != aLibraryPath || m_cache->IsModified() )
{ {
@ -3192,7 +3192,7 @@ void LEGACY_PLUGIN::cacheLib( const wxString& aLibraryPath )
} }
void LEGACY_PLUGIN::FootprintEnumerate( wxArrayString& aFootprintNames, const wxString& aLibPath, void PCB_IO_KICAD_LEGACY::FootprintEnumerate( wxArrayString& aFootprintNames, const wxString& aLibPath,
bool aBestEfforts, const STRING_UTF8_MAP* aProperties ) bool aBestEfforts, const STRING_UTF8_MAP* aProperties )
{ {
LOCALE_IO toggle; // toggles on, then off, the C locale. LOCALE_IO toggle; // toggles on, then off, the C locale.
@ -3220,7 +3220,7 @@ void LEGACY_PLUGIN::FootprintEnumerate( wxArrayString& aFootprintNames, const wx
} }
FOOTPRINT* LEGACY_PLUGIN::FootprintLoad( const wxString& aLibraryPath, FOOTPRINT* PCB_IO_KICAD_LEGACY::FootprintLoad( const wxString& aLibraryPath,
const wxString& aFootprintName, bool aKeepUUID, const wxString& aFootprintName, bool aKeepUUID,
const STRING_UTF8_MAP* aProperties ) const STRING_UTF8_MAP* aProperties )
{ {
@ -3245,7 +3245,7 @@ FOOTPRINT* LEGACY_PLUGIN::FootprintLoad( const wxString& aLibraryPath,
} }
bool LEGACY_PLUGIN::FootprintLibDelete( const wxString& aLibraryPath, bool PCB_IO_KICAD_LEGACY::FootprintLibDelete( const wxString& aLibraryPath,
const STRING_UTF8_MAP* aProperties ) const STRING_UTF8_MAP* aProperties )
{ {
wxFileName fn = aLibraryPath; wxFileName fn = aLibraryPath;
@ -3271,7 +3271,7 @@ bool LEGACY_PLUGIN::FootprintLibDelete( const wxString& aLibraryPath,
} }
bool LEGACY_PLUGIN::IsFootprintLibWritable( const wxString& aLibraryPath ) bool PCB_IO_KICAD_LEGACY::IsFootprintLibWritable( const wxString& aLibraryPath )
{ {
#if 0 // no support for 32 Cu layers in legacy format #if 0 // no support for 32 Cu layers in legacy format
return false; return false;
@ -3287,7 +3287,7 @@ bool LEGACY_PLUGIN::IsFootprintLibWritable( const wxString& aLibraryPath )
} }
LEGACY_PLUGIN::LEGACY_PLUGIN() : PCB_IO_KICAD_LEGACY::PCB_IO_KICAD_LEGACY() :
m_cu_count( 16 ), // for FootprintLoad() m_cu_count( 16 ), // for FootprintLoad()
m_board( nullptr ), m_board( nullptr ),
m_props( nullptr ), m_props( nullptr ),
@ -3302,7 +3302,7 @@ LEGACY_PLUGIN::LEGACY_PLUGIN() :
} }
LEGACY_PLUGIN::~LEGACY_PLUGIN() PCB_IO_KICAD_LEGACY::~PCB_IO_KICAD_LEGACY()
{ {
delete m_cache; delete m_cache;
} }

View File

@ -1,6 +1,3 @@
#ifndef LEGACY_PLUGIN_H_
#define LEGACY_PLUGIN_H_
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
@ -25,6 +22,9 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#ifndef PCB_IO_KICAD_LEGACY_H_
#define PCB_IO_KICAD_LEGACY_H_
#include <pcb_io/pcb_io.h> #include <pcb_io/pcb_io.h>
#include <pcb_io/pcb_io_mgr.h> #include <pcb_io/pcb_io_mgr.h>
@ -58,13 +58,13 @@ struct LP_CACHE;
* *
* As with any PLUGIN, there is no UI, i.e. windowing calls allowed. * As with any PLUGIN, there is no UI, i.e. windowing calls allowed.
*/ */
class LEGACY_PLUGIN : public PCB_IO class PCB_IO_KICAD_LEGACY : public PCB_IO
{ {
friend struct LP_CACHE; friend struct LP_CACHE;
public: public:
LEGACY_PLUGIN(); PCB_IO_KICAD_LEGACY();
~LEGACY_PLUGIN(); ~PCB_IO_KICAD_LEGACY();
const wxString PluginName() const override const wxString PluginName() const override
{ {
@ -216,4 +216,4 @@ protected:
///< with this scale factor ///< with this scale factor
}; };
#endif // LEGACY_PLUGIN_H_ #endif // PCB_IO_KICAD_LEGACY_H_

View File

@ -48,8 +48,8 @@
#include <pcbnew_settings.h> #include <pcbnew_settings.h>
#include <pgm_base.h> #include <pgm_base.h>
#include <io/kicad/kicad_io_utils.h> #include <io/kicad/kicad_io_utils.h>
#include <pcb_io/kicad/pcb_plugin.h> #include <pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h>
#include <pcb_io/kicad/pcb_parser.h> #include <pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.h>
#include <trace_helpers.h> #include <trace_helpers.h>
#include <progress_reporter.h> #include <progress_reporter.h>
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
@ -75,7 +75,7 @@ FP_CACHE_ITEM::FP_CACHE_ITEM( FOOTPRINT* aFootprint, const WX_FILENAME& aFileNam
{ } { }
FP_CACHE::FP_CACHE( PCB_PLUGIN* aOwner, const wxString& aLibraryPath ) FP_CACHE::FP_CACHE( PCB_IO_KICAD_SEXPR* aOwner, const wxString& aLibraryPath )
{ {
m_owner = aOwner; m_owner = aOwner;
m_lib_raw_path = aLibraryPath; m_lib_raw_path = aLibraryPath;
@ -188,7 +188,7 @@ void FP_CACHE::Load()
try try
{ {
FILE_LINE_READER reader( fn.GetFullPath() ); FILE_LINE_READER reader( fn.GetFullPath() );
PCB_PARSER parser( &reader, nullptr, nullptr ); PCB_IO_KICAD_SEXPR_PARSER parser( &reader, nullptr, nullptr );
FOOTPRINT* footprint = dynamic_cast<FOOTPRINT*>( parser.Parse() ); FOOTPRINT* footprint = dynamic_cast<FOOTPRINT*>( parser.Parse() );
wxString fpName = fn.GetName(); wxString fpName = fn.GetName();
@ -273,7 +273,7 @@ long long FP_CACHE::GetTimestamp( const wxString& aLibPath )
} }
bool PCB_PLUGIN::CanReadBoard( const wxString& aFileName ) const bool PCB_IO_KICAD_SEXPR::CanReadBoard( const wxString& aFileName ) const
{ {
if( !PCB_IO::CanReadBoard( aFileName ) ) if( !PCB_IO::CanReadBoard( aFileName ) )
return false; return false;
@ -281,7 +281,7 @@ bool PCB_PLUGIN::CanReadBoard( const wxString& aFileName ) const
try try
{ {
FILE_LINE_READER reader( aFileName ); FILE_LINE_READER reader( aFileName );
PCB_PARSER parser( &reader, nullptr, m_queryUserCallback ); PCB_IO_KICAD_SEXPR_PARSER parser( &reader, nullptr, m_queryUserCallback );
return parser.IsValidBoardHeader(); return parser.IsValidBoardHeader();
} }
@ -293,7 +293,7 @@ bool PCB_PLUGIN::CanReadBoard( const wxString& aFileName ) const
} }
void PCB_PLUGIN::SaveBoard( const wxString& aFileName, BOARD* aBoard, void PCB_IO_KICAD_SEXPR::SaveBoard( const wxString& aFileName, BOARD* aBoard,
const STRING_UTF8_MAP* aProperties, const STRING_UTF8_MAP* aProperties,
PROGRESS_REPORTER* aProgressReporter ) PROGRESS_REPORTER* aProgressReporter )
{ {
@ -336,12 +336,12 @@ void PCB_PLUGIN::SaveBoard( const wxString& aFileName, BOARD* aBoard,
} }
BOARD_ITEM* PCB_PLUGIN::Parse( const wxString& aClipboardSourceInput ) BOARD_ITEM* PCB_IO_KICAD_SEXPR::Parse( const wxString& aClipboardSourceInput )
{ {
std::string input = TO_UTF8( aClipboardSourceInput ); std::string input = TO_UTF8( aClipboardSourceInput );
STRING_LINE_READER reader( input, wxT( "clipboard" ) ); STRING_LINE_READER reader( input, wxT( "clipboard" ) );
PCB_PARSER parser( &reader, nullptr, m_queryUserCallback ); PCB_IO_KICAD_SEXPR_PARSER parser( &reader, nullptr, m_queryUserCallback );
try try
{ {
@ -357,7 +357,7 @@ BOARD_ITEM* PCB_PLUGIN::Parse( const wxString& aClipboardSourceInput )
} }
void PCB_PLUGIN::Format( const BOARD_ITEM* aItem, int aNestLevel ) const void PCB_IO_KICAD_SEXPR::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
@ -456,7 +456,7 @@ std::string formatInternalUnits( const VECTOR2I& aCoord, const FOOTPRINT* aParen
} }
void PCB_PLUGIN::formatLayer( PCB_LAYER_ID aLayer, bool aIsKnockout ) const void PCB_IO_KICAD_SEXPR::formatLayer( PCB_LAYER_ID aLayer, bool aIsKnockout ) const
{ {
m_out->Print( 0, " (layer %s%s)", m_out->Print( 0, " (layer %s%s)",
m_out->Quotew( LSET::Name( aLayer ) ).c_str(), m_out->Quotew( LSET::Name( aLayer ) ).c_str(),
@ -464,7 +464,7 @@ void PCB_PLUGIN::formatLayer( PCB_LAYER_ID aLayer, bool aIsKnockout ) const
} }
void PCB_PLUGIN::formatPolyPts( const SHAPE_LINE_CHAIN& outline, int aNestLevel, void PCB_IO_KICAD_SEXPR::formatPolyPts( const SHAPE_LINE_CHAIN& outline, int aNestLevel,
bool aCompact, const FOOTPRINT* aParentFP ) const bool aCompact, const FOOTPRINT* aParentFP ) const
{ {
m_out->Print( aNestLevel + 1, "(pts\n" ); m_out->Print( aNestLevel + 1, "(pts\n" );
@ -517,7 +517,7 @@ void PCB_PLUGIN::formatPolyPts( const SHAPE_LINE_CHAIN& outline, int aNestLevel,
} }
void PCB_PLUGIN::formatRenderCache( const EDA_TEXT* aText, int aNestLevel ) const void PCB_IO_KICAD_SEXPR::formatRenderCache( const EDA_TEXT* aText, int aNestLevel ) const
{ {
wxString resolvedText( aText->GetShownText( true ) ); wxString resolvedText( aText->GetShownText( true ) );
std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache = aText->GetRenderCache( aText->GetFont(), std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache = aText->GetRenderCache( aText->GetFont(),
@ -545,7 +545,7 @@ void PCB_PLUGIN::formatRenderCache( const EDA_TEXT* aText, int aNestLevel ) cons
} }
void PCB_PLUGIN::formatSetup( const BOARD* aBoard, int aNestLevel ) const void PCB_IO_KICAD_SEXPR::formatSetup( const BOARD* aBoard, int aNestLevel ) const
{ {
// Setup // Setup
m_out->Print( aNestLevel, "(setup\n" ); m_out->Print( aNestLevel, "(setup\n" );
@ -606,7 +606,7 @@ void PCB_PLUGIN::formatSetup( const BOARD* aBoard, int aNestLevel ) const
} }
void PCB_PLUGIN::formatGeneral( const BOARD* aBoard, int aNestLevel ) const void PCB_IO_KICAD_SEXPR::formatGeneral( const BOARD* aBoard, int aNestLevel ) const
{ {
const BOARD_DESIGN_SETTINGS& dsnSettings = aBoard->GetDesignSettings(); const BOARD_DESIGN_SETTINGS& dsnSettings = aBoard->GetDesignSettings();
@ -626,7 +626,7 @@ void PCB_PLUGIN::formatGeneral( const BOARD* aBoard, int aNestLevel ) const
} }
void PCB_PLUGIN::formatBoardLayers( const BOARD* aBoard, int aNestLevel ) const void PCB_IO_KICAD_SEXPR::formatBoardLayers( const BOARD* aBoard, int aNestLevel ) const
{ {
m_out->Print( aNestLevel, "(layers\n" ); m_out->Print( aNestLevel, "(layers\n" );
@ -696,7 +696,7 @@ void PCB_PLUGIN::formatBoardLayers( const BOARD* aBoard, int aNestLevel ) const
} }
void PCB_PLUGIN::formatNetInformation( const BOARD* aBoard, int aNestLevel ) const void PCB_IO_KICAD_SEXPR::formatNetInformation( const BOARD* aBoard, int aNestLevel ) const
{ {
for( NETINFO_ITEM* net : *m_mapping ) for( NETINFO_ITEM* net : *m_mapping )
{ {
@ -712,7 +712,7 @@ void PCB_PLUGIN::formatNetInformation( const BOARD* aBoard, int aNestLevel ) con
} }
void PCB_PLUGIN::formatProperties( const BOARD* aBoard, int aNestLevel ) const void PCB_IO_KICAD_SEXPR::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() )
{ {
@ -726,7 +726,7 @@ void PCB_PLUGIN::formatProperties( const BOARD* aBoard, int aNestLevel ) const
} }
void PCB_PLUGIN::formatHeader( const BOARD* aBoard, int aNestLevel ) const void PCB_IO_KICAD_SEXPR::formatHeader( const BOARD* aBoard, int aNestLevel ) const
{ {
formatGeneral( aBoard, aNestLevel ); formatGeneral( aBoard, aNestLevel );
@ -760,7 +760,7 @@ bool isDefaultTeardropParameters( const TEARDROP_PARAMETERS& tdParams )
} }
void PCB_PLUGIN::formatTeardropParameters( const TEARDROP_PARAMETERS& tdParams, void PCB_IO_KICAD_SEXPR::formatTeardropParameters( const TEARDROP_PARAMETERS& tdParams,
int aNestLevel ) const int aNestLevel ) const
{ {
m_out->Print( aNestLevel, "(teardrops%s%s%s (best_length_ratio %s) (max_length %s) " m_out->Print( aNestLevel, "(teardrops%s%s%s (best_length_ratio %s) (max_length %s) "
@ -778,7 +778,7 @@ void PCB_PLUGIN::formatTeardropParameters( const TEARDROP_PARAMETERS& tdParams,
} }
void PCB_PLUGIN::format( const BOARD* aBoard, int aNestLevel ) const void PCB_IO_KICAD_SEXPR::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() );
@ -831,7 +831,7 @@ void PCB_PLUGIN::format( const BOARD* aBoard, int aNestLevel ) const
} }
void PCB_PLUGIN::format( const PCB_DIMENSION_BASE* aDimension, int aNestLevel ) const void PCB_IO_KICAD_SEXPR::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 );
@ -935,7 +935,7 @@ void PCB_PLUGIN::format( const PCB_DIMENSION_BASE* aDimension, int aNestLevel )
} }
void PCB_PLUGIN::format( const PCB_SHAPE* aShape, int aNestLevel ) const void PCB_IO_KICAD_SEXPR::format( const PCB_SHAPE* aShape, int aNestLevel ) const
{ {
FOOTPRINT* parentFP = aShape->GetParentFootprint(); FOOTPRINT* parentFP = aShape->GetParentFootprint();
std::string prefix = parentFP ? "fp" : "gr"; std::string prefix = parentFP ? "fp" : "gr";
@ -1026,7 +1026,7 @@ void PCB_PLUGIN::format( const PCB_SHAPE* aShape, int aNestLevel ) const
} }
void PCB_PLUGIN::format( const PCB_REFERENCE_IMAGE* aBitmap, int aNestLevel ) const void PCB_IO_KICAD_SEXPR::format( const PCB_REFERENCE_IMAGE* aBitmap, int aNestLevel ) const
{ {
wxCHECK_RET( aBitmap != nullptr && m_out != nullptr, "" ); wxCHECK_RET( aBitmap != nullptr && m_out != nullptr, "" );
@ -1072,7 +1072,7 @@ void PCB_PLUGIN::format( const PCB_REFERENCE_IMAGE* aBitmap, int aNestLevel ) co
} }
void PCB_PLUGIN::format( const PCB_TARGET* aTarget, int aNestLevel ) const void PCB_IO_KICAD_SEXPR::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",
@ -1090,7 +1090,7 @@ void PCB_PLUGIN::format( const PCB_TARGET* aTarget, int aNestLevel ) const
} }
void PCB_PLUGIN::format( const FOOTPRINT* aFootprint, int aNestLevel ) const void PCB_IO_KICAD_SEXPR::format( const FOOTPRINT* aFootprint, int aNestLevel ) const
{ {
if( !( m_ctl & CTL_OMIT_INITIAL_COMMENTS ) ) if( !( m_ctl & CTL_OMIT_INITIAL_COMMENTS ) )
{ {
@ -1351,7 +1351,7 @@ void PCB_PLUGIN::format( const FOOTPRINT* aFootprint, int aNestLevel ) const
} }
void PCB_PLUGIN::formatLayers( LSET aLayerMask, int aNestLevel ) const void PCB_IO_KICAD_SEXPR::formatLayers( LSET aLayerMask, int aNestLevel ) const
{ {
std::string output; std::string output;
@ -1437,7 +1437,7 @@ void PCB_PLUGIN::formatLayers( LSET aLayerMask, int aNestLevel ) const
} }
void PCB_PLUGIN::format( const PAD* aPad, int aNestLevel ) const void PCB_IO_KICAD_SEXPR::format( const PAD* aPad, int aNestLevel ) const
{ {
const BOARD* board = aPad->GetBoard(); const BOARD* board = aPad->GetBoard();
const char* shape; const char* shape;
@ -1817,7 +1817,7 @@ void PCB_PLUGIN::format( const PAD* aPad, int aNestLevel ) const
} }
void PCB_PLUGIN::format( const PCB_TEXT* aText, int aNestLevel ) const void PCB_IO_KICAD_SEXPR::format( const PCB_TEXT* aText, int aNestLevel ) const
{ {
FOOTPRINT* parentFP = aText->GetParentFootprint(); FOOTPRINT* parentFP = aText->GetParentFootprint();
std::string prefix; std::string prefix;
@ -1879,7 +1879,7 @@ void PCB_PLUGIN::format( const PCB_TEXT* aText, int aNestLevel ) const
} }
void PCB_PLUGIN::format( const PCB_TEXTBOX* aTextBox, int aNestLevel ) const void PCB_IO_KICAD_SEXPR::format( const PCB_TEXTBOX* aTextBox, int aNestLevel ) const
{ {
FOOTPRINT* parentFP = aTextBox->GetParentFootprint(); FOOTPRINT* parentFP = aTextBox->GetParentFootprint();
@ -1938,7 +1938,7 @@ void PCB_PLUGIN::format( const PCB_TEXTBOX* aTextBox, int aNestLevel ) const
} }
void PCB_PLUGIN::format( const PCB_GROUP* aGroup, int aNestLevel ) const void PCB_IO_KICAD_SEXPR::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() )
@ -1968,7 +1968,7 @@ void PCB_PLUGIN::format( const PCB_GROUP* aGroup, int aNestLevel ) const
} }
void PCB_PLUGIN::format( const PCB_GENERATOR* aGenerator, int aNestLevel ) const void PCB_IO_KICAD_SEXPR::format( const PCB_GENERATOR* aGenerator, int aNestLevel ) const
{ {
m_out->Print( aNestLevel, "(generated (id %s)\n", TO_UTF8( aGenerator->m_Uuid.AsString() ) ); m_out->Print( aNestLevel, "(generated (id %s)\n", TO_UTF8( aGenerator->m_Uuid.AsString() ) );
@ -2063,7 +2063,7 @@ void PCB_PLUGIN::format( const PCB_GENERATOR* aGenerator, int aNestLevel ) const
} }
void PCB_PLUGIN::format( const PCB_TRACK* aTrack, int aNestLevel ) const void PCB_IO_KICAD_SEXPR::format( const PCB_TRACK* aTrack, int aNestLevel ) const
{ {
if( aTrack->Type() == PCB_VIA_T ) if( aTrack->Type() == PCB_VIA_T )
{ {
@ -2182,7 +2182,7 @@ void PCB_PLUGIN::format( const PCB_TRACK* aTrack, int aNestLevel ) const
} }
void PCB_PLUGIN::format( const ZONE* aZone, int aNestLevel ) const void PCB_IO_KICAD_SEXPR::format( const ZONE* aZone, int aNestLevel ) const
{ {
// Save the NET info. // Save the NET info.
// For keepout and non copper zones, net code and net name are irrelevant // For keepout and non copper zones, net code and net name are irrelevant
@ -2397,7 +2397,7 @@ void PCB_PLUGIN::format( const ZONE* aZone, int aNestLevel ) const
} }
PCB_PLUGIN::PCB_PLUGIN( int aControlFlags ) : PCB_IO_KICAD_SEXPR::PCB_IO_KICAD_SEXPR( int aControlFlags ) :
m_cache( nullptr ), m_cache( nullptr ),
m_ctl( aControlFlags ), m_ctl( aControlFlags ),
m_mapping( new NETINFO_MAPPING() ) m_mapping( new NETINFO_MAPPING() )
@ -2407,14 +2407,14 @@ PCB_PLUGIN::PCB_PLUGIN( int aControlFlags ) :
} }
PCB_PLUGIN::~PCB_PLUGIN() PCB_IO_KICAD_SEXPR::~PCB_IO_KICAD_SEXPR()
{ {
delete m_cache; delete m_cache;
delete m_mapping; delete m_mapping;
} }
BOARD* PCB_PLUGIN::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, BOARD* PCB_IO_KICAD_SEXPR::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties, PROJECT* aProject, const STRING_UTF8_MAP* aProperties, PROJECT* aProject,
PROGRESS_REPORTER* aProgressReporter ) PROGRESS_REPORTER* aProgressReporter )
{ {
@ -2445,12 +2445,12 @@ BOARD* PCB_PLUGIN::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
} }
BOARD* PCB_PLUGIN::DoLoad( LINE_READER& aReader, BOARD* aAppendToMe, const STRING_UTF8_MAP* aProperties, BOARD* PCB_IO_KICAD_SEXPR::DoLoad( LINE_READER& aReader, BOARD* aAppendToMe, const STRING_UTF8_MAP* aProperties,
PROGRESS_REPORTER* aProgressReporter, unsigned aLineCount) PROGRESS_REPORTER* aProgressReporter, unsigned aLineCount)
{ {
init( aProperties ); init( aProperties );
PCB_PARSER parser( &aReader, aAppendToMe, m_queryUserCallback, aProgressReporter, aLineCount ); PCB_IO_KICAD_SEXPR_PARSER parser( &aReader, aAppendToMe, m_queryUserCallback, aProgressReporter, aLineCount );
BOARD* board; BOARD* board;
try try
@ -2481,7 +2481,7 @@ BOARD* PCB_PLUGIN::DoLoad( LINE_READER& aReader, BOARD* aAppendToMe, const STRIN
} }
void PCB_PLUGIN::init( const STRING_UTF8_MAP* aProperties ) void PCB_IO_KICAD_SEXPR::init( const STRING_UTF8_MAP* aProperties )
{ {
m_board = nullptr; m_board = nullptr;
m_reader = nullptr; m_reader = nullptr;
@ -2489,7 +2489,7 @@ void PCB_PLUGIN::init( const STRING_UTF8_MAP* aProperties )
} }
void PCB_PLUGIN::validateCache( const wxString& aLibraryPath, bool checkModified ) void PCB_IO_KICAD_SEXPR::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() ) )
{ {
@ -2501,7 +2501,7 @@ void PCB_PLUGIN::validateCache( const wxString& aLibraryPath, bool checkModified
} }
void PCB_PLUGIN::FootprintEnumerate( wxArrayString& aFootprintNames, const wxString& aLibPath, void PCB_IO_KICAD_SEXPR::FootprintEnumerate( wxArrayString& aFootprintNames, const wxString& aLibPath,
bool aBestEfforts, const STRING_UTF8_MAP* aProperties ) bool aBestEfforts, const STRING_UTF8_MAP* aProperties )
{ {
LOCALE_IO toggle; // toggles on, then off, the C locale. LOCALE_IO toggle; // toggles on, then off, the C locale.
@ -2530,7 +2530,7 @@ void PCB_PLUGIN::FootprintEnumerate( wxArrayString& aFootprintNames, const wxStr
} }
const FOOTPRINT* PCB_PLUGIN::getFootprint( const wxString& aLibraryPath, const FOOTPRINT* PCB_IO_KICAD_SEXPR::getFootprint( const wxString& aLibraryPath,
const wxString& aFootprintName, const wxString& aFootprintName,
const STRING_UTF8_MAP* aProperties, const STRING_UTF8_MAP* aProperties,
bool checkModified ) bool checkModified )
@ -2558,7 +2558,7 @@ const FOOTPRINT* PCB_PLUGIN::getFootprint( const wxString& aLibraryPath,
} }
const FOOTPRINT* PCB_PLUGIN::GetEnumeratedFootprint( const wxString& aLibraryPath, const FOOTPRINT* PCB_IO_KICAD_SEXPR::GetEnumeratedFootprint( const wxString& aLibraryPath,
const wxString& aFootprintName, const wxString& aFootprintName,
const STRING_UTF8_MAP* aProperties ) const STRING_UTF8_MAP* aProperties )
{ {
@ -2566,7 +2566,7 @@ const FOOTPRINT* PCB_PLUGIN::GetEnumeratedFootprint( const wxString& aLibraryPat
} }
bool PCB_PLUGIN::FootprintExists( const wxString& aLibraryPath, const wxString& aFootprintName, bool PCB_IO_KICAD_SEXPR::FootprintExists( const wxString& aLibraryPath, const wxString& aFootprintName,
const STRING_UTF8_MAP* aProperties ) const STRING_UTF8_MAP* 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
@ -2582,7 +2582,7 @@ bool PCB_PLUGIN::FootprintExists( const wxString& aLibraryPath, const wxString&
} }
FOOTPRINT* PCB_PLUGIN::ImportFootprint( const wxString& aFootprintPath, wxString& aFootprintNameOut, FOOTPRINT* PCB_IO_KICAD_SEXPR::ImportFootprint( const wxString& aFootprintPath, wxString& aFootprintNameOut,
const STRING_UTF8_MAP* aProperties ) const STRING_UTF8_MAP* aProperties )
{ {
wxString fcontents; wxString fcontents;
@ -2599,7 +2599,7 @@ FOOTPRINT* PCB_PLUGIN::ImportFootprint( const wxString& aFootprintPath, wxString
} }
FOOTPRINT* PCB_PLUGIN::FootprintLoad( const wxString& aLibraryPath, FOOTPRINT* PCB_IO_KICAD_SEXPR::FootprintLoad( const wxString& aLibraryPath,
const wxString& aFootprintName, const wxString& aFootprintName,
bool aKeepUUID, bool aKeepUUID,
const STRING_UTF8_MAP* aProperties ) const STRING_UTF8_MAP* aProperties )
@ -2623,7 +2623,7 @@ FOOTPRINT* PCB_PLUGIN::FootprintLoad( const wxString& aLibraryPath,
} }
void PCB_PLUGIN::FootprintSave( const wxString& aLibraryPath, const FOOTPRINT* aFootprint, void PCB_IO_KICAD_SEXPR::FootprintSave( const wxString& aLibraryPath, const FOOTPRINT* aFootprint,
const STRING_UTF8_MAP* aProperties ) const STRING_UTF8_MAP* aProperties )
{ {
LOCALE_IO toggle; // toggles on, then off, the C locale. LOCALE_IO toggle; // toggles on, then off, the C locale.
@ -2720,7 +2720,7 @@ void PCB_PLUGIN::FootprintSave( const wxString& aLibraryPath, const FOOTPRINT* a
} }
void PCB_PLUGIN::FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName, void PCB_IO_KICAD_SEXPR::FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName,
const STRING_UTF8_MAP* aProperties ) const STRING_UTF8_MAP* aProperties )
{ {
LOCALE_IO toggle; // toggles on, then off, the C locale. LOCALE_IO toggle; // toggles on, then off, the C locale.
@ -2740,13 +2740,13 @@ void PCB_PLUGIN::FootprintDelete( const wxString& aLibraryPath, const wxString&
long long PCB_PLUGIN::GetLibraryTimestamp( const wxString& aLibraryPath ) const long long PCB_IO_KICAD_SEXPR::GetLibraryTimestamp( const wxString& aLibraryPath ) const
{ {
return FP_CACHE::GetTimestamp( aLibraryPath ); return FP_CACHE::GetTimestamp( aLibraryPath );
} }
void PCB_PLUGIN::FootprintLibCreate( const wxString& aLibraryPath, const STRING_UTF8_MAP* aProperties ) void PCB_IO_KICAD_SEXPR::FootprintLibCreate( const wxString& aLibraryPath, const STRING_UTF8_MAP* aProperties )
{ {
if( wxDir::Exists( aLibraryPath ) ) if( wxDir::Exists( aLibraryPath ) )
{ {
@ -2764,7 +2764,7 @@ void PCB_PLUGIN::FootprintLibCreate( const wxString& aLibraryPath, const STRING_
} }
bool PCB_PLUGIN::FootprintLibDelete( const wxString& aLibraryPath, const STRING_UTF8_MAP* aProperties ) bool PCB_IO_KICAD_SEXPR::FootprintLibDelete( const wxString& aLibraryPath, const STRING_UTF8_MAP* aProperties )
{ {
wxFileName fn; wxFileName fn;
fn.SetPath( aLibraryPath ); fn.SetPath( aLibraryPath );
@ -2841,7 +2841,7 @@ bool PCB_PLUGIN::FootprintLibDelete( const wxString& aLibraryPath, const STRING_
} }
bool PCB_PLUGIN::IsFootprintLibWritable( const wxString& aLibraryPath ) bool PCB_IO_KICAD_SEXPR::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 PCB_PLUGIN_H #ifndef PCB_IO_KICAD_SEXPR_H_
#define PCB_PLUGIN_H #define PCB_IO_KICAD_SEXPR_H_
#include <pcb_io/pcb_io.h> #include <pcb_io/pcb_io.h>
#include <pcb_io/pcb_io_mgr.h> #include <pcb_io/pcb_io_mgr.h>
@ -38,7 +38,7 @@
class BOARD; class BOARD;
class BOARD_ITEM; class BOARD_ITEM;
class FP_CACHE; class FP_CACHE;
class PCB_PARSER; class PCB_IO_KICAD_SEXPR_PARSER;
class NETINFO_MAPPING; class NETINFO_MAPPING;
class BOARD_DESIGN_SETTINGS; class BOARD_DESIGN_SETTINGS;
class PCB_DIMENSION_BASE; class PCB_DIMENSION_BASE;
@ -55,7 +55,7 @@ class PCB_TEXTBOX;
class EDA_TEXT; class EDA_TEXT;
class SHAPE_LINE_CHAIN; class SHAPE_LINE_CHAIN;
class TEARDROP_PARAMETERS; class TEARDROP_PARAMETERS;
class PCB_PLUGIN; // forward decl class PCB_IO_KICAD_SEXPR; // forward decl
/// Current s-expression file format version. 2 was the last legacy format version. /// Current s-expression file format version. 2 was the last legacy format version.
@ -204,7 +204,7 @@ typedef boost::ptr_map<wxString, FP_CACHE_ITEM> FP_CACHE_FOOTPRINT_MAP;
class FP_CACHE class FP_CACHE
{ {
PCB_PLUGIN* m_owner; // Plugin object that owns the cache. PCB_IO_KICAD_SEXPR* 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.
FP_CACHE_FOOTPRINT_MAP m_footprints; // Map of footprint filename to FOOTPRINT*. FP_CACHE_FOOTPRINT_MAP m_footprints; // Map of footprint filename to FOOTPRINT*.
@ -215,7 +215,7 @@ class FP_CACHE
// files. // files.
public: public:
FP_CACHE( PCB_PLUGIN* aOwner, const wxString& aLibraryPath ); FP_CACHE( PCB_IO_KICAD_SEXPR* aOwner, const wxString& aLibraryPath );
wxString GetPath() const { return m_lib_raw_path; } wxString GetPath() const { return m_lib_raw_path; }
@ -274,7 +274,7 @@ public:
* *
* @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_PLUGIN : public PCB_IO class PCB_IO_KICAD_SEXPR : public PCB_IO
{ {
public: public:
const wxString PluginName() const override const wxString PluginName() const override
@ -353,9 +353,9 @@ public:
bool IsFootprintLibWritable( const wxString& aLibraryPath ) override; bool IsFootprintLibWritable( const wxString& aLibraryPath ) override;
PCB_PLUGIN( int aControlFlags = CTL_FOR_BOARD ); PCB_IO_KICAD_SEXPR( int aControlFlags = CTL_FOR_BOARD );
virtual ~PCB_PLUGIN(); virtual ~PCB_IO_KICAD_SEXPR();
/** /**
* Output \a aItem to \a aFormatter in s-expression format. * Output \a aItem to \a aFormatter in s-expression format.
@ -464,4 +464,4 @@ protected:
std::function<bool( wxString aTitle, int aIcon, wxString aMsg, wxString aAction )> m_queryUserCallback; std::function<bool( wxString aTitle, int aIcon, wxString aMsg, wxString aAction )> m_queryUserCallback;
}; };
#endif // PCB_PLUGIN_H #endif // PCB_IO_KICAD_SEXPR_H_

View File

@ -23,7 +23,7 @@
*/ */
/** /**
* @file pcb_parser.cpp * @file pcb_io_kicad_sexpr_parser.cpp
* @brief Pcbnew s-expression file format parser implementation. * @brief Pcbnew s-expression file format parser implementation.
*/ */
@ -53,12 +53,12 @@
#include <font/font.h> #include <font/font.h>
#include <core/ignore.h> #include <core/ignore.h>
#include <netclass.h> #include <netclass.h>
#include <pcb_io/kicad/pcb_plugin.h> #include <pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.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>
#include <zones.h> #include <zones.h>
#include <pcb_io/kicad/pcb_parser.h> #include <pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.h>
#include <convert_basic_shapes_to_polygon.h> // for RECT_CHAMFER_POSITIONS definition #include <convert_basic_shapes_to_polygon.h> // for RECT_CHAMFER_POSITIONS definition
#include <math/util.h> // KiROUND, Clamp #include <math/util.h> // KiROUND, Clamp
#include <string_utils.h> #include <string_utils.h>
@ -85,7 +85,7 @@ constexpr double INT_LIMIT = std::numeric_limits<int>::max() - 10;
using namespace PCB_KEYS_T; using namespace PCB_KEYS_T;
void PCB_PARSER::init() void PCB_IO_KICAD_SEXPR_PARSER::init()
{ {
m_showLegacySegmentZoneWarning = true; m_showLegacySegmentZoneWarning = true;
m_showLegacy5ZoneWarning = true; m_showLegacy5ZoneWarning = true;
@ -131,7 +131,7 @@ void PCB_PARSER::init()
} }
void PCB_PARSER::checkpoint() void PCB_IO_KICAD_SEXPR_PARSER::checkpoint()
{ {
if( m_progressReporter ) if( m_progressReporter )
{ {
@ -153,7 +153,7 @@ void PCB_PARSER::checkpoint()
} }
void PCB_PARSER::skipCurrent() void PCB_IO_KICAD_SEXPR_PARSER::skipCurrent()
{ {
int curr_level = 0; int curr_level = 0;
T token; T token;
@ -174,7 +174,7 @@ void PCB_PARSER::skipCurrent()
} }
void PCB_PARSER::pushValueIntoMap( int aIndex, int aValue ) void PCB_IO_KICAD_SEXPR_PARSER::pushValueIntoMap( int aIndex, int aValue )
{ {
// Add aValue in netcode mapping (m_netCodes) at index aNetCode // Add aValue in netcode mapping (m_netCodes) at index aNetCode
// ensure there is room in m_netCodes for that, and add room if needed. // ensure there is room in m_netCodes for that, and add room if needed.
@ -186,7 +186,7 @@ void PCB_PARSER::pushValueIntoMap( int aIndex, int aValue )
} }
int PCB_PARSER::parseBoardUnits() int PCB_IO_KICAD_SEXPR_PARSER::parseBoardUnits()
{ {
// There should be no major rounding issues here, since the values in // There should be no major rounding issues here, since the values in
// the file are in mm and get converted to nano-meters. // the file are in mm and get converted to nano-meters.
@ -203,7 +203,7 @@ int PCB_PARSER::parseBoardUnits()
} }
int PCB_PARSER::parseBoardUnits( const char* aExpected ) int PCB_IO_KICAD_SEXPR_PARSER::parseBoardUnits( const char* aExpected )
{ {
auto retval = parseDouble( aExpected ) * pcbIUScale.IU_PER_MM; auto retval = parseDouble( aExpected ) * pcbIUScale.IU_PER_MM;
@ -214,7 +214,7 @@ int PCB_PARSER::parseBoardUnits( const char* aExpected )
} }
bool PCB_PARSER::parseBool() bool PCB_IO_KICAD_SEXPR_PARSER::parseBool()
{ {
T token = NextTok(); T token = NextTok();
@ -232,7 +232,7 @@ bool PCB_PARSER::parseBool()
/* /*
* e.g. "hide", "hide)", "(hide yes)" * e.g. "hide", "hide)", "(hide yes)"
*/ */
bool PCB_PARSER::parseMaybeAbsentBool( bool aDefaultValue ) bool PCB_IO_KICAD_SEXPR_PARSER::parseMaybeAbsentBool( bool aDefaultValue )
{ {
bool ret = aDefaultValue; bool ret = aDefaultValue;
@ -263,7 +263,7 @@ bool PCB_PARSER::parseMaybeAbsentBool( bool aDefaultValue )
} }
wxString PCB_PARSER::GetRequiredVersion() wxString PCB_IO_KICAD_SEXPR_PARSER::GetRequiredVersion()
{ {
int year, month, day; int year, month, day;
@ -287,7 +287,7 @@ wxString PCB_PARSER::GetRequiredVersion()
} }
VECTOR2I PCB_PARSER::parseXY() VECTOR2I PCB_IO_KICAD_SEXPR_PARSER::parseXY()
{ {
if( CurTok() != T_LEFT ) if( CurTok() != T_LEFT )
NeedLEFT(); NeedLEFT();
@ -307,7 +307,7 @@ VECTOR2I PCB_PARSER::parseXY()
} }
void PCB_PARSER::parseOutlinePoints( SHAPE_LINE_CHAIN& aPoly ) void PCB_IO_KICAD_SEXPR_PARSER::parseOutlinePoints( SHAPE_LINE_CHAIN& aPoly )
{ {
if( CurTok() != T_LEFT ) if( CurTok() != T_LEFT )
NeedLEFT(); NeedLEFT();
@ -392,7 +392,7 @@ void PCB_PARSER::parseOutlinePoints( SHAPE_LINE_CHAIN& aPoly )
} }
void PCB_PARSER::parseXY( int* aX, int* aY ) void PCB_IO_KICAD_SEXPR_PARSER::parseXY( int* aX, int* aY )
{ {
VECTOR2I pt = parseXY(); VECTOR2I pt = parseXY();
@ -404,7 +404,7 @@ void PCB_PARSER::parseXY( int* aX, int* aY )
} }
std::pair<wxString, wxString> PCB_PARSER::parseBoardProperty() std::pair<wxString, wxString> PCB_IO_KICAD_SEXPR_PARSER::parseBoardProperty()
{ {
wxString pName; wxString pName;
wxString pValue; wxString pValue;
@ -419,7 +419,7 @@ std::pair<wxString, wxString> PCB_PARSER::parseBoardProperty()
} }
void PCB_PARSER::parseTEARDROP_PARAMETERS( TEARDROP_PARAMETERS* tdParams ) void PCB_IO_KICAD_SEXPR_PARSER::parseTEARDROP_PARAMETERS( TEARDROP_PARAMETERS* tdParams )
{ {
tdParams->m_Enabled = false; tdParams->m_Enabled = false;
tdParams->m_AllowUseTwoTracks = false; tdParams->m_AllowUseTwoTracks = false;
@ -482,7 +482,7 @@ void PCB_PARSER::parseTEARDROP_PARAMETERS( TEARDROP_PARAMETERS* tdParams )
} }
void PCB_PARSER::parseEDA_TEXT( EDA_TEXT* aText ) void PCB_IO_KICAD_SEXPR_PARSER::parseEDA_TEXT( EDA_TEXT* aText )
{ {
wxCHECK_RET( CurTok() == T_effects, wxCHECK_RET( CurTok() == T_effects,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as EDA_TEXT." ) ); wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as EDA_TEXT." ) );
@ -632,7 +632,7 @@ void PCB_PARSER::parseEDA_TEXT( EDA_TEXT* aText )
} }
void PCB_PARSER::parseRenderCache( EDA_TEXT* text ) void PCB_IO_KICAD_SEXPR_PARSER::parseRenderCache( EDA_TEXT* text )
{ {
T token; T token;
@ -682,7 +682,7 @@ void PCB_PARSER::parseRenderCache( EDA_TEXT* text )
} }
FP_3DMODEL* PCB_PARSER::parse3DModel() FP_3DMODEL* PCB_IO_KICAD_SEXPR_PARSER::parse3DModel()
{ {
wxCHECK_MSG( CurTok() == T_model, nullptr, wxCHECK_MSG( CurTok() == T_model, nullptr,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as FP_3DMODEL." ) ); wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as FP_3DMODEL." ) );
@ -791,7 +791,7 @@ FP_3DMODEL* PCB_PARSER::parse3DModel()
} }
bool PCB_PARSER::IsValidBoardHeader() bool PCB_IO_KICAD_SEXPR_PARSER::IsValidBoardHeader()
{ {
LOCALE_IO toggle; LOCALE_IO toggle;
@ -811,7 +811,7 @@ bool PCB_PARSER::IsValidBoardHeader()
} }
BOARD_ITEM* PCB_PARSER::Parse() BOARD_ITEM* PCB_IO_KICAD_SEXPR_PARSER::Parse()
{ {
T token; T token;
BOARD_ITEM* item; BOARD_ITEM* item;
@ -861,7 +861,7 @@ BOARD_ITEM* PCB_PARSER::Parse()
} }
BOARD* PCB_PARSER::parseBOARD() BOARD* PCB_IO_KICAD_SEXPR_PARSER::parseBOARD()
{ {
try try
{ {
@ -877,7 +877,7 @@ BOARD* PCB_PARSER::parseBOARD()
} }
BOARD* PCB_PARSER::parseBOARD_unchecked() BOARD* PCB_IO_KICAD_SEXPR_PARSER::parseBOARD_unchecked()
{ {
T token; T token;
std::map<wxString, wxString> properties; std::map<wxString, wxString> properties;
@ -1160,7 +1160,7 @@ BOARD* PCB_PARSER::parseBOARD_unchecked()
} }
void PCB_PARSER::resolveGroups( BOARD_ITEM* aParent ) void PCB_IO_KICAD_SEXPR_PARSER::resolveGroups( BOARD_ITEM* aParent )
{ {
auto getItem = [&]( const KIID& aId ) auto getItem = [&]( const KIID& aId )
{ {
@ -1269,7 +1269,7 @@ void PCB_PARSER::resolveGroups( BOARD_ITEM* aParent )
} }
void PCB_PARSER::parseHeader() void PCB_IO_KICAD_SEXPR_PARSER::parseHeader()
{ {
wxCHECK_RET( CurTok() == T_kicad_pcb, wxCHECK_RET( CurTok() == T_kicad_pcb,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as a header." ) ); wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as a header." ) );
@ -1295,7 +1295,7 @@ void PCB_PARSER::parseHeader()
} }
void PCB_PARSER::parseGeneralSection() void PCB_IO_KICAD_SEXPR_PARSER::parseGeneralSection()
{ {
wxCHECK_RET( CurTok() == T_general, wxCHECK_RET( CurTok() == T_general,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( "Cannot parse " ) + GetTokenString( CurTok() ) +
@ -1332,7 +1332,7 @@ void PCB_PARSER::parseGeneralSection()
} }
void PCB_PARSER::parsePAGE_INFO() void PCB_IO_KICAD_SEXPR_PARSER::parsePAGE_INFO()
{ {
wxCHECK_RET( ( CurTok() == T_page && m_requiredVersion <= 20200119 ) || CurTok() == T_paper, wxCHECK_RET( ( CurTok() == T_page && m_requiredVersion <= 20200119 ) || CurTok() == T_paper,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as a PAGE_INFO." ) ); wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as a PAGE_INFO." ) );
@ -1388,7 +1388,7 @@ void PCB_PARSER::parsePAGE_INFO()
} }
void PCB_PARSER::parseTITLE_BLOCK() void PCB_IO_KICAD_SEXPR_PARSER::parseTITLE_BLOCK()
{ {
wxCHECK_RET( CurTok() == T_title_block, wxCHECK_RET( CurTok() == T_title_block,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as TITLE_BLOCK." ) ); wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as TITLE_BLOCK." ) );
@ -1496,7 +1496,7 @@ void PCB_PARSER::parseTITLE_BLOCK()
} }
void PCB_PARSER::parseLayer( LAYER* aLayer ) void PCB_IO_KICAD_SEXPR_PARSER::parseLayer( LAYER* aLayer )
{ {
T token; T token;
@ -1553,7 +1553,7 @@ void PCB_PARSER::parseLayer( LAYER* aLayer )
} }
void PCB_PARSER::parseBoardStackup() void PCB_IO_KICAD_SEXPR_PARSER::parseBoardStackup()
{ {
T token; T token;
wxString name; wxString name;
@ -1774,7 +1774,7 @@ void PCB_PARSER::parseBoardStackup()
} }
void PCB_PARSER::createOldLayerMapping( std::unordered_map< std::string, std::string >& aMap ) void PCB_IO_KICAD_SEXPR_PARSER::createOldLayerMapping( std::unordered_map< std::string, std::string >& aMap )
{ {
// N.B. This mapping only includes Italian, Polish and French as they were the only languages // N.B. This mapping only includes Italian, Polish and French as they were the only languages
// that mapped the layer names as of cc2022b1ac739aa673d2a0b7a2047638aa7a47b3 (kicad-i18n) // that mapped the layer names as of cc2022b1ac739aa673d2a0b7a2047638aa7a47b3 (kicad-i18n)
@ -1824,7 +1824,7 @@ void PCB_PARSER::createOldLayerMapping( std::unordered_map< std::string, std::st
} }
void PCB_PARSER::parseLayers() void PCB_IO_KICAD_SEXPR_PARSER::parseLayers()
{ {
wxCHECK_RET( CurTok() == T_layers, wxCHECK_RET( CurTok() == T_layers,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as layers." ) ); wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as layers." ) );
@ -1956,7 +1956,7 @@ void PCB_PARSER::parseLayers()
template<class T, class M> template<class T, class M>
T PCB_PARSER::lookUpLayer( const M& aMap ) T PCB_IO_KICAD_SEXPR_PARSER::lookUpLayer( const M& aMap )
{ {
// avoid constructing another std::string, use lexer's directly // avoid constructing another std::string, use lexer's directly
typename M::const_iterator it = aMap.find( curText ); typename M::const_iterator it = aMap.find( curText );
@ -1975,7 +1975,7 @@ T PCB_PARSER::lookUpLayer( const M& aMap )
} }
PCB_LAYER_ID PCB_PARSER::parseBoardItemLayer() PCB_LAYER_ID PCB_IO_KICAD_SEXPR_PARSER::parseBoardItemLayer()
{ {
wxCHECK_MSG( CurTok() == T_layer, UNDEFINED_LAYER, wxCHECK_MSG( CurTok() == T_layer, UNDEFINED_LAYER,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as layer." ) ); wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as layer." ) );
@ -1990,7 +1990,7 @@ PCB_LAYER_ID PCB_PARSER::parseBoardItemLayer()
} }
LSET PCB_PARSER::parseBoardItemLayersAsMask() LSET PCB_IO_KICAD_SEXPR_PARSER::parseBoardItemLayersAsMask()
{ {
wxCHECK_MSG( CurTok() == T_layers, LSET(), wxCHECK_MSG( CurTok() == T_layers, LSET(),
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as item layers." ) ); wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as item layers." ) );
@ -2007,7 +2007,7 @@ LSET PCB_PARSER::parseBoardItemLayersAsMask()
} }
void PCB_PARSER::parseSetup() void PCB_IO_KICAD_SEXPR_PARSER::parseSetup()
{ {
wxCHECK_RET( CurTok() == T_setup, wxCHECK_RET( CurTok() == T_setup,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as setup." ) ); wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as setup." ) );
@ -2362,7 +2362,7 @@ void PCB_PARSER::parseSetup()
} }
void PCB_PARSER::parseDefaults( BOARD_DESIGN_SETTINGS& designSettings ) void PCB_IO_KICAD_SEXPR_PARSER::parseDefaults( BOARD_DESIGN_SETTINGS& designSettings )
{ {
T token; T token;
@ -2446,7 +2446,7 @@ void PCB_PARSER::parseDefaults( BOARD_DESIGN_SETTINGS& designSettings )
} }
void PCB_PARSER::parseDefaultTextDims( BOARD_DESIGN_SETTINGS& aSettings, int aLayer ) void PCB_IO_KICAD_SEXPR_PARSER::parseDefaultTextDims( BOARD_DESIGN_SETTINGS& aSettings, int aLayer )
{ {
T token; T token;
@ -2483,7 +2483,7 @@ void PCB_PARSER::parseDefaultTextDims( BOARD_DESIGN_SETTINGS& aSettings, int aLa
} }
void PCB_PARSER::parseNETINFO_ITEM() void PCB_IO_KICAD_SEXPR_PARSER::parseNETINFO_ITEM()
{ {
wxCHECK_RET( CurTok() == T_net, wxCHECK_RET( CurTok() == T_net,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as net." ) ); wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as net." ) );
@ -2514,7 +2514,7 @@ void PCB_PARSER::parseNETINFO_ITEM()
} }
void PCB_PARSER::parseNETCLASS() void PCB_IO_KICAD_SEXPR_PARSER::parseNETCLASS()
{ {
wxCHECK_RET( CurTok() == T_net_class, wxCHECK_RET( CurTok() == T_net_class,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as net class." ) ); wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as net class." ) );
@ -2621,7 +2621,7 @@ void PCB_PARSER::parseNETCLASS()
} }
PCB_SHAPE* PCB_PARSER::parsePCB_SHAPE( BOARD_ITEM* aParent ) PCB_SHAPE* PCB_IO_KICAD_SEXPR_PARSER::parsePCB_SHAPE( BOARD_ITEM* aParent )
{ {
wxCHECK_MSG( CurTok() == T_fp_arc || CurTok() == T_fp_circle || CurTok() == T_fp_curve || wxCHECK_MSG( CurTok() == T_fp_arc || CurTok() == T_fp_circle || CurTok() == T_fp_curve ||
CurTok() == T_fp_rect || CurTok() == T_fp_line || CurTok() == T_fp_poly || CurTok() == T_fp_rect || CurTok() == T_fp_line || CurTok() == T_fp_poly ||
@ -3031,7 +3031,7 @@ PCB_SHAPE* PCB_PARSER::parsePCB_SHAPE( BOARD_ITEM* aParent )
} }
PCB_REFERENCE_IMAGE* PCB_PARSER::parsePCB_REFERENCE_IMAGE( BOARD_ITEM* aParent ) PCB_REFERENCE_IMAGE* PCB_IO_KICAD_SEXPR_PARSER::parsePCB_REFERENCE_IMAGE( BOARD_ITEM* aParent )
{ {
wxCHECK_MSG( CurTok() == T_image, nullptr, wxCHECK_MSG( CurTok() == T_image, nullptr,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as a reference image." ) ); wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as a reference image." ) );
@ -3126,7 +3126,7 @@ PCB_REFERENCE_IMAGE* PCB_PARSER::parsePCB_REFERENCE_IMAGE( BOARD_ITEM* aParent )
} }
PCB_TEXT* PCB_PARSER::parsePCB_TEXT( BOARD_ITEM* aParent ) PCB_TEXT* PCB_IO_KICAD_SEXPR_PARSER::parsePCB_TEXT( BOARD_ITEM* aParent )
{ {
wxCHECK_MSG( CurTok() == T_gr_text || CurTok() == T_fp_text, nullptr, wxCHECK_MSG( CurTok() == T_gr_text || CurTok() == T_fp_text, nullptr,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as PCB_TEXT." ) ); wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as PCB_TEXT." ) );
@ -3181,7 +3181,7 @@ PCB_TEXT* PCB_PARSER::parsePCB_TEXT( BOARD_ITEM* aParent )
} }
void PCB_PARSER::parsePCB_TEXT_effects( PCB_TEXT* aText ) void PCB_IO_KICAD_SEXPR_PARSER::parsePCB_TEXT_effects( PCB_TEXT* aText )
{ {
FOOTPRINT* parentFP = dynamic_cast<FOOTPRINT*>( aText->GetParent() ); FOOTPRINT* parentFP = dynamic_cast<FOOTPRINT*>( aText->GetParent() );
bool hasAngle = false; // Old files do not have a angle specified. bool hasAngle = false; // Old files do not have a angle specified.
@ -3313,7 +3313,7 @@ void PCB_PARSER::parsePCB_TEXT_effects( PCB_TEXT* aText )
} }
PCB_TEXTBOX* PCB_PARSER::parsePCB_TEXTBOX( BOARD_ITEM* aParent ) PCB_TEXTBOX* PCB_IO_KICAD_SEXPR_PARSER::parsePCB_TEXTBOX( BOARD_ITEM* aParent )
{ {
wxCHECK_MSG( CurTok() == T_gr_text_box || CurTok() == T_fp_text_box, nullptr, wxCHECK_MSG( CurTok() == T_gr_text_box || CurTok() == T_fp_text_box, nullptr,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as PCB_TEXTBOX." ) ); wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as PCB_TEXTBOX." ) );
@ -3441,7 +3441,7 @@ PCB_TEXTBOX* PCB_PARSER::parsePCB_TEXTBOX( BOARD_ITEM* aParent )
} }
PCB_DIMENSION_BASE* PCB_PARSER::parseDIMENSION( BOARD_ITEM* aParent ) PCB_DIMENSION_BASE* PCB_IO_KICAD_SEXPR_PARSER::parseDIMENSION( BOARD_ITEM* aParent )
{ {
wxCHECK_MSG( CurTok() == T_dimension, nullptr, wxCHECK_MSG( CurTok() == T_dimension, nullptr,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as DIMENSION." ) ); wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as DIMENSION." ) );
@ -3873,7 +3873,7 @@ PCB_DIMENSION_BASE* PCB_PARSER::parseDIMENSION( BOARD_ITEM* aParent )
} }
FOOTPRINT* PCB_PARSER::parseFOOTPRINT( wxArrayString* aInitialComments ) FOOTPRINT* PCB_IO_KICAD_SEXPR_PARSER::parseFOOTPRINT( wxArrayString* aInitialComments )
{ {
try try
{ {
@ -3889,7 +3889,7 @@ FOOTPRINT* PCB_PARSER::parseFOOTPRINT( wxArrayString* aInitialComments )
} }
FOOTPRINT* PCB_PARSER::parseFOOTPRINT_unchecked( wxArrayString* aInitialComments ) FOOTPRINT* PCB_IO_KICAD_SEXPR_PARSER::parseFOOTPRINT_unchecked( wxArrayString* aInitialComments )
{ {
wxCHECK_MSG( CurTok() == T_module || CurTok() == T_footprint, nullptr, wxCHECK_MSG( CurTok() == T_module || CurTok() == T_footprint, nullptr,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as FOOTPRINT." ) ); wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as FOOTPRINT." ) );
@ -4378,7 +4378,7 @@ FOOTPRINT* PCB_PARSER::parseFOOTPRINT_unchecked( wxArrayString* aInitialComments
} }
PAD* PCB_PARSER::parsePAD( FOOTPRINT* aParent ) PAD* PCB_IO_KICAD_SEXPR_PARSER::parsePAD( FOOTPRINT* aParent )
{ {
wxCHECK_MSG( CurTok() == T_pad, nullptr, wxCHECK_MSG( CurTok() == T_pad, nullptr,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as PAD." ) ); wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as PAD." ) );
@ -4915,7 +4915,7 @@ PAD* PCB_PARSER::parsePAD( FOOTPRINT* aParent )
} }
bool PCB_PARSER::parsePAD_option( PAD* aPad ) bool PCB_IO_KICAD_SEXPR_PARSER::parsePAD_option( PAD* aPad )
{ {
// Parse only the (option ...) inside a pad description // Parse only the (option ...) inside a pad description
for( T token = NextTok(); token != T_RIGHT; token = NextTok() ) for( T token = NextTok(); token != T_RIGHT; token = NextTok() )
@ -4987,7 +4987,7 @@ bool PCB_PARSER::parsePAD_option( PAD* aPad )
} }
void PCB_PARSER::parseGROUP_members( GROUP_INFO& aGroupInfo ) void PCB_IO_KICAD_SEXPR_PARSER::parseGROUP_members( GROUP_INFO& aGroupInfo )
{ {
T token; T token;
@ -5002,7 +5002,7 @@ void PCB_PARSER::parseGROUP_members( GROUP_INFO& aGroupInfo )
} }
void PCB_PARSER::parseGROUP( BOARD_ITEM* aParent ) void PCB_IO_KICAD_SEXPR_PARSER::parseGROUP( BOARD_ITEM* aParent )
{ {
wxCHECK_RET( CurTok() == T_group, wxCHECK_RET( CurTok() == T_group,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as PCB_GROUP." ) ); wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as PCB_GROUP." ) );
@ -5057,7 +5057,7 @@ void PCB_PARSER::parseGROUP( BOARD_ITEM* aParent )
} }
void PCB_PARSER::parseGENERATOR( BOARD_ITEM* aParent ) void PCB_IO_KICAD_SEXPR_PARSER::parseGENERATOR( BOARD_ITEM* aParent )
{ {
wxCHECK_RET( CurTok() == T_generated, wxT( "Cannot parse " ) + GetTokenString( CurTok() ) wxCHECK_RET( CurTok() == T_generated, wxT( "Cannot parse " ) + GetTokenString( CurTok() )
+ wxT( " as PCB_GENERATOR." ) ); + wxT( " as PCB_GENERATOR." ) );
@ -5195,7 +5195,7 @@ void PCB_PARSER::parseGENERATOR( BOARD_ITEM* aParent )
} }
PCB_ARC* PCB_PARSER::parseARC() PCB_ARC* PCB_IO_KICAD_SEXPR_PARSER::parseARC()
{ {
wxCHECK_MSG( CurTok() == T_arc, nullptr, wxCHECK_MSG( CurTok() == T_arc, nullptr,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as ARC." ) ); wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as ARC." ) );
@ -5287,7 +5287,7 @@ PCB_ARC* PCB_PARSER::parseARC()
} }
PCB_TRACK* PCB_PARSER::parsePCB_TRACK() PCB_TRACK* PCB_IO_KICAD_SEXPR_PARSER::parsePCB_TRACK()
{ {
wxCHECK_MSG( CurTok() == T_segment, nullptr, wxCHECK_MSG( CurTok() == T_segment, nullptr,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as PCB_TRACK." ) ); wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as PCB_TRACK." ) );
@ -5372,7 +5372,7 @@ PCB_TRACK* PCB_PARSER::parsePCB_TRACK()
} }
PCB_VIA* PCB_PARSER::parsePCB_VIA() PCB_VIA* PCB_IO_KICAD_SEXPR_PARSER::parsePCB_VIA()
{ {
wxCHECK_MSG( CurTok() == T_via, nullptr, wxCHECK_MSG( CurTok() == T_via, nullptr,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as PCB_VIA." ) ); wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as PCB_VIA." ) );
@ -5519,7 +5519,7 @@ PCB_VIA* PCB_PARSER::parsePCB_VIA()
} }
ZONE* PCB_PARSER::parseZONE( BOARD_ITEM_CONTAINER* aParent ) ZONE* PCB_IO_KICAD_SEXPR_PARSER::parseZONE( BOARD_ITEM_CONTAINER* aParent )
{ {
wxCHECK_MSG( CurTok() == T_zone, nullptr, wxCHECK_MSG( CurTok() == T_zone, nullptr,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as ZONE." ) ); wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as ZONE." ) );
@ -6180,7 +6180,7 @@ ZONE* PCB_PARSER::parseZONE( BOARD_ITEM_CONTAINER* aParent )
} }
PCB_TARGET* PCB_PARSER::parsePCB_TARGET() PCB_TARGET* PCB_IO_KICAD_SEXPR_PARSER::parsePCB_TARGET()
{ {
wxCHECK_MSG( CurTok() == T_target, nullptr, wxCHECK_MSG( CurTok() == T_target, nullptr,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as PCB_TARGET." ) ); wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as PCB_TARGET." ) );
@ -6243,7 +6243,7 @@ PCB_TARGET* PCB_PARSER::parsePCB_TARGET()
} }
KIID PCB_PARSER::CurStrToKIID() KIID PCB_IO_KICAD_SEXPR_PARSER::CurStrToKIID()
{ {
KIID aId; KIID aId;
std::string idStr( CurStr() ); std::string idStr( CurStr() );

View File

@ -23,7 +23,7 @@
*/ */
/** /**
* @file pcb_parser.h * @file pcb_io_kicad_sexpr_parser.h
* @brief Pcbnew s-expression file format parser definition. * @brief Pcbnew s-expression file format parser definition.
*/ */
@ -71,10 +71,10 @@ class TEARDROP_PARAMETERS;
* Read a Pcbnew s-expression formatted #LINE_READER object and returns the appropriate * Read a Pcbnew s-expression formatted #LINE_READER object and returns the appropriate
* #BOARD_ITEM object. * #BOARD_ITEM object.
*/ */
class PCB_PARSER : public PCB_LEXER class PCB_IO_KICAD_SEXPR_PARSER : public PCB_LEXER
{ {
public: public:
PCB_PARSER( LINE_READER* aReader, BOARD* aAppendToMe, PCB_IO_KICAD_SEXPR_PARSER( LINE_READER* aReader, BOARD* aAppendToMe,
std::function<bool( wxString, int, wxString, wxString )> aQueryUserCallback, std::function<bool( wxString, int, wxString, wxString )> aQueryUserCallback,
PROGRESS_REPORTER* aProgressReporter = nullptr, unsigned aLineCount = 0 ) : PROGRESS_REPORTER* aProgressReporter = nullptr, unsigned aLineCount = 0 ) :
PCB_LEXER( aReader ), PCB_LEXER( aReader ),
@ -88,7 +88,7 @@ public:
init(); init();
} }
// ~PCB_PARSER() {} // ~PCB_IO_KICAD_SEXPR_PARSER() {}
BOARD_ITEM* Parse(); BOARD_ITEM* Parse();

View File

@ -4,8 +4,8 @@
# This CMakeLists.txt is included from pcbnew, so we are inheriting its include_directories(), # This CMakeLists.txt is included from pcbnew, so we are inheriting its include_directories(),
set( PCAD2PCBNEW_SRCS set( PCAD2PCBNEW_SRCS
pcb_io_pcad.cpp
pcad2kicad_common.cpp pcad2kicad_common.cpp
pcad_plugin.cpp
pcad_pcb.cpp pcad_pcb.cpp
pcad_arc.cpp pcad_arc.cpp
pcad_pcb_component.cpp pcad_pcb_component.cpp

View File

@ -23,11 +23,11 @@
*/ */
/** /**
* @file pcad_plugin.cpp * @file pcb_io_pcad.cpp
* @brief Pcbnew PLUGIN for P-Cad 200x ASCII *.pcb format. * @brief Pcbnew PLUGIN for P-Cad 200x ASCII *.pcb format.
*/ */
#include <pcad/pcad_plugin.h> #include <pcad/pcb_io_pcad.h>
#include <pcad/pcad_pcb.h> #include <pcad/pcad_pcb.h>
#include <pcad/s_expr_loader.h> #include <pcad/s_expr_loader.h>
#include <io/io_utils.h> #include <io/io_utils.h>
@ -43,19 +43,19 @@
using namespace PCAD2KICAD; using namespace PCAD2KICAD;
PCAD_PLUGIN::PCAD_PLUGIN() PCB_IO_PCAD::PCB_IO_PCAD()
{ {
m_board = nullptr; m_board = nullptr;
m_props = nullptr; m_props = nullptr;
} }
PCAD_PLUGIN::~PCAD_PLUGIN() PCB_IO_PCAD::~PCB_IO_PCAD()
{ {
} }
bool PCAD_PLUGIN::CanReadBoard( const wxString& aFileName ) const bool PCB_IO_PCAD::CanReadBoard( const wxString& aFileName ) const
{ {
if( !PCB_IO::CanReadBoard( aFileName ) ) if( !PCB_IO::CanReadBoard( aFileName ) )
return false; return false;
@ -64,7 +64,7 @@ bool PCAD_PLUGIN::CanReadBoard( const wxString& aFileName ) const
} }
BOARD* PCAD_PLUGIN::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, BOARD* PCB_IO_PCAD::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties, PROJECT* aProject, const STRING_UTF8_MAP* aProperties, PROJECT* aProject,
PROGRESS_REPORTER* aProgressReporter ) PROGRESS_REPORTER* aProgressReporter )
{ {

View File

@ -27,17 +27,17 @@
* @brief Pcbnew PLUGIN for P-Cad 200x ASCII *.pcb format. * @brief Pcbnew PLUGIN for P-Cad 200x ASCII *.pcb format.
*/ */
#ifndef PCAD_PLUGIN_H_ #ifndef PCB_IO_PCAD_H_
#define PCAD_PLUGIN_H_ #define PCB_IO_PCAD_H_
#include <pcb_io/pcb_io.h> #include <pcb_io/pcb_io.h>
#include <pcb_io/pcb_io_mgr.h> #include <pcb_io/pcb_io_mgr.h>
class PCAD_PLUGIN : public PCB_IO class PCB_IO_PCAD : public PCB_IO
{ {
public: public:
PCAD_PLUGIN(); PCB_IO_PCAD();
~PCAD_PLUGIN(); ~PCB_IO_PCAD();
const wxString PluginName() const override { return wxT( "P-Cad" ); } const wxString PluginName() const override { return wxT( "P-Cad" ); }
@ -63,4 +63,4 @@ private:
BOARD* m_board; BOARD* m_board;
}; };
#endif // PCAD_PLUGIN_H_ #endif // PCB_IO_PCAD_H_

View File

@ -31,20 +31,20 @@
#include <pcb_io/pcb_io_mgr.h> #include <pcb_io/pcb_io_mgr.h>
#include <pcb_io/eagle/eagle_plugin.h> #include <pcb_io/eagle/pcb_io_eagle.h>
#include <pcb_io/geda/gpcb_plugin.h> #include <pcb_io/geda/pcb_io_geda.h>
#include <pcb_io/kicad/pcb_plugin.h> #include <pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h>
#include <pcb_io/legacy/legacy_plugin.h> #include <pcb_io/kicad_legacy/pcb_io_kicad_legacy.h>
#include <pcb_io/pcad/pcad_plugin.h> #include <pcb_io/pcad/pcb_io_pcad.h>
#include <pcb_io/altium/altium_circuit_maker_plugin.h> #include <pcb_io/altium/pcb_io_altium_circuit_maker.h>
#include <pcb_io/altium/altium_circuit_studio_plugin.h> #include <pcb_io/altium/pcb_io_altium_circuit_studio.h>
#include <pcb_io/altium/altium_designer_plugin.h> #include <pcb_io/altium/pcb_io_altium_designer.h>
#include <pcb_io/altium/solidworks_pcb_plugin.h> #include <pcb_io/altium/pcb_io_solidworks.h>
#include <pcb_io/cadstar/cadstar_pcb_archive_plugin.h> #include <pcb_io/cadstar/pcb_io_cadstar_archive.h>
#include <pcb_io/fabmaster/fabmaster_plugin.h> #include <pcb_io/fabmaster/pcb_io_fabmaster.h>
#include <pcb_io/easyeda/pcb_easyeda_plugin.h> #include <pcb_io/easyeda/pcb_io_easyeda_plugin.h>
#include <pcb_io/easyedapro/pcb_easyedapro_plugin.h> #include <pcb_io/easyedapro/pcb_io_easyedapro.h>
#include <pcb_io/ipc2581/ipc2581_plugin.h> #include <pcb_io/ipc2581/pcb_io_ipc2581.h>
#define FMT_UNIMPLEMENTED _( "Plugin \"%s\" does not implement the \"%s\" function." ) #define FMT_UNIMPLEMENTED _( "Plugin \"%s\" does not implement the \"%s\" function." )
#define FMT_NOTFOUND _( "Plugin type \"%s\" is not found." ) #define FMT_NOTFOUND _( "Plugin type \"%s\" is not found." )
@ -201,72 +201,72 @@ void PCB_IO_MGR::Save( PCB_FILE_T aFileType, const wxString& aFileName, BOARD* a
static PCB_IO_MGR::REGISTER_PLUGIN registerKicadPlugin( static PCB_IO_MGR::REGISTER_PLUGIN registerKicadPlugin(
PCB_IO_MGR::KICAD_SEXP, PCB_IO_MGR::KICAD_SEXP,
wxT( "KiCad" ), wxT( "KiCad" ),
[]() -> PCB_IO* { return new PCB_PLUGIN; } ); []() -> PCB_IO* { return new PCB_IO_KICAD_SEXPR; } );
static PCB_IO_MGR::REGISTER_PLUGIN registerLegacyPlugin( static PCB_IO_MGR::REGISTER_PLUGIN registerLegacyPlugin(
PCB_IO_MGR::LEGACY, PCB_IO_MGR::LEGACY,
wxT( "Legacy" ), wxT( "Legacy" ),
[]() -> PCB_IO* { return new LEGACY_PLUGIN; } ); []() -> PCB_IO* { return new PCB_IO_KICAD_LEGACY; } );
// Keep non-KiCad plugins in alphabetical order // Keep non-KiCad plugins in alphabetical order
static PCB_IO_MGR::REGISTER_PLUGIN registerAltiumCircuitMakerPlugin( static PCB_IO_MGR::REGISTER_PLUGIN registerAltiumCircuitMakerPlugin(
PCB_IO_MGR::ALTIUM_CIRCUIT_MAKER, PCB_IO_MGR::ALTIUM_CIRCUIT_MAKER,
wxT( "Altium Circuit Maker" ), wxT( "Altium Circuit Maker" ),
[]() -> PCB_IO* { return new ALTIUM_CIRCUIT_MAKER_PLUGIN; } ); []() -> PCB_IO* { return new PCB_IO_ALTIUM_CIRCUIT_MAKER; } );
static PCB_IO_MGR::REGISTER_PLUGIN registerAltiumCircuitStudioPlugin( static PCB_IO_MGR::REGISTER_PLUGIN registerAltiumCircuitStudioPlugin(
PCB_IO_MGR::ALTIUM_CIRCUIT_STUDIO, PCB_IO_MGR::ALTIUM_CIRCUIT_STUDIO,
wxT( "Altium Circuit Studio" ), wxT( "Altium Circuit Studio" ),
[]() -> PCB_IO* { return new ALTIUM_CIRCUIT_STUDIO_PLUGIN; } ); []() -> PCB_IO* { return new PCB_IO_ALTIUM_CIRCUIT_STUDIO; } );
static PCB_IO_MGR::REGISTER_PLUGIN registerAltiumDesignerPlugin( static PCB_IO_MGR::REGISTER_PLUGIN registerAltiumDesignerPlugin(
PCB_IO_MGR::ALTIUM_DESIGNER, PCB_IO_MGR::ALTIUM_DESIGNER,
wxT( "Altium Designer" ), wxT( "Altium Designer" ),
[]() -> PCB_IO* { return new ALTIUM_DESIGNER_PLUGIN; } ); []() -> PCB_IO* { return new PCB_IO_ALTIUM_DESIGNER; } );
static PCB_IO_MGR::REGISTER_PLUGIN registerCadstarArchivePlugin( static PCB_IO_MGR::REGISTER_PLUGIN registerCadstarArchivePlugin(
PCB_IO_MGR::CADSTAR_PCB_ARCHIVE, PCB_IO_MGR::CADSTAR_PCB_ARCHIVE,
wxT( "CADSTAR PCB Archive" ), wxT( "CADSTAR PCB Archive" ),
[]() -> PCB_IO* { return new CADSTAR_PCB_ARCHIVE_PLUGIN; } ); []() -> PCB_IO* { return new PCB_IO_CADSTAR_ARCHIVE; } );
static PCB_IO_MGR::REGISTER_PLUGIN registerEaglePlugin( static PCB_IO_MGR::REGISTER_PLUGIN registerEaglePlugin(
PCB_IO_MGR::EAGLE, PCB_IO_MGR::EAGLE,
wxT( "Eagle" ), wxT( "Eagle" ),
[]() -> PCB_IO* { return new EAGLE_PLUGIN; } ); []() -> PCB_IO* { return new PCB_IO_EAGLE; } );
static PCB_IO_MGR::REGISTER_PLUGIN registerEasyEDAPlugin( static PCB_IO_MGR::REGISTER_PLUGIN registerEasyEDAPlugin(
PCB_IO_MGR::EASYEDA, PCB_IO_MGR::EASYEDA,
wxT( "EasyEDA / JLCEDA Std" ), wxT( "EasyEDA / JLCEDA Std" ),
[]() -> PCB_IO* { return new EASYEDA_PLUGIN; }); []() -> PCB_IO* { return new PCB_IO_EASYEDA; });
static PCB_IO_MGR::REGISTER_PLUGIN registerEasyEDAProPlugin( static PCB_IO_MGR::REGISTER_PLUGIN registerEasyEDAProPlugin(
PCB_IO_MGR::EASYEDAPRO, PCB_IO_MGR::EASYEDAPRO,
wxT( "EasyEDA / JLCEDA Pro" ), wxT( "EasyEDA / JLCEDA Pro" ),
[]() -> PCB_IO* { return new EASYEDAPRO_PLUGIN; }); []() -> PCB_IO* { return new PCB_IO_EASYEDAPRO; });
static PCB_IO_MGR::REGISTER_PLUGIN registerFabmasterPlugin( static PCB_IO_MGR::REGISTER_PLUGIN registerFabmasterPlugin(
PCB_IO_MGR::FABMASTER, PCB_IO_MGR::FABMASTER,
wxT( "Fabmaster" ), wxT( "Fabmaster" ),
[]() -> PCB_IO* { return new FABMASTER_PLUGIN; } ); []() -> PCB_IO* { return new PCB_IO_FABMASTER; } );
static PCB_IO_MGR::REGISTER_PLUGIN registerGPCBPlugin( static PCB_IO_MGR::REGISTER_PLUGIN registerGPCBPlugin(
PCB_IO_MGR::GEDA_PCB, PCB_IO_MGR::GEDA_PCB,
wxT( "GEDA/Pcb" ), wxT( "GEDA/Pcb" ),
[]() -> PCB_IO* { return new GPCB_PLUGIN; } ); []() -> PCB_IO* { return new PCB_IO_GEDA; } );
static PCB_IO_MGR::REGISTER_PLUGIN registerPcadPlugin( static PCB_IO_MGR::REGISTER_PLUGIN registerPcadPlugin(
PCB_IO_MGR::PCAD, PCB_IO_MGR::PCAD,
wxT( "P-Cad" ), wxT( "P-Cad" ),
[]() -> PCB_IO* { return new PCAD_PLUGIN; } ); []() -> PCB_IO* { return new PCB_IO_PCAD; } );
static PCB_IO_MGR::REGISTER_PLUGIN registerSolidworksPCBPlugin( static PCB_IO_MGR::REGISTER_PLUGIN registerSolidworksPCBPlugin(
PCB_IO_MGR::SOLIDWORKS_PCB, PCB_IO_MGR::SOLIDWORKS_PCB,
wxT( "Solidworks PCB" ), wxT( "Solidworks PCB" ),
[]() -> PCB_IO* { return new SOLIDWORKS_PCB_PLUGIN; } ); []() -> PCB_IO* { return new PCB_IO_SOLIDWORKS; } );
static PCB_IO_MGR::REGISTER_PLUGIN registerIPC2581Plugin( static PCB_IO_MGR::REGISTER_PLUGIN registerIPC2581Plugin(
PCB_IO_MGR::IPC2581, PCB_IO_MGR::IPC2581,
wxT( "IPC-2581" ), wxT( "IPC-2581" ),
[]() -> PCB_IO* { return new IPC2581_PLUGIN; } ); []() -> PCB_IO* { return new PCB_IO_IPC2581; } );
// clang-format on // clang-format on

View File

@ -58,7 +58,7 @@
#include <pcbnew_settings.h> #include <pcbnew_settings.h>
#include <pcbplot.h> #include <pcbplot.h>
#include <pgm_base.h> #include <pgm_base.h>
#include <pcb_io/kicad/pcb_plugin.h> #include <pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h>
#include <reporter.h> #include <reporter.h>
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
#include <export_vrml.h> #include <export_vrml.h>
@ -750,7 +750,7 @@ int PCBNEW_JOBS_HANDLER::JobExportFpUpgrade( JOB* aJob )
} }
} }
PCB_PLUGIN pcb_io( CTL_FOR_LIBRARY ); PCB_IO_KICAD_SEXPR pcb_io( CTL_FOR_LIBRARY );
FP_CACHE fpLib( &pcb_io, upgradeJob->m_libraryPath ); FP_CACHE fpLib( &pcb_io, upgradeJob->m_libraryPath );
try try
@ -811,7 +811,7 @@ int PCBNEW_JOBS_HANDLER::JobExportFpSvg( JOB* aJob )
if( aJob->IsCli() ) if( aJob->IsCli() )
m_reporter->Report( _( "Loading footprint library\n" ), RPT_SEVERITY_INFO ); m_reporter->Report( _( "Loading footprint library\n" ), RPT_SEVERITY_INFO );
PCB_PLUGIN pcb_io( CTL_FOR_LIBRARY ); PCB_IO_KICAD_SEXPR pcb_io( CTL_FOR_LIBRARY );
FP_CACHE fpLib( &pcb_io, svgJob->m_libraryPath ); FP_CACHE fpLib( &pcb_io, svgJob->m_libraryPath );
try try

View File

@ -111,9 +111,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 <pcb_io/kicad/pcb_plugin.h> %include <pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h>
%{ %{
#include <pcb_io/kicad/pcb_plugin.h> #include <pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h>
%} %}

View File

@ -78,7 +78,7 @@ using namespace std::placeholders;
#include <ratsnest/ratsnest_data.h> #include <ratsnest/ratsnest_data.h>
#include <pcb_io/kicad/pcb_plugin.h> #include <pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h>
using namespace KIGFX; using namespace KIGFX;
@ -611,7 +611,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_PLUGIN pcb_io; PCB_IO_KICAD_SEXPR pcb_io;
pcb_io.SaveBoard( fname_dump.GetFullPath(), m_iface->GetBoard(), nullptr ); pcb_io.SaveBoard( fname_dump.GetFullPath(), m_iface->GetBoard(), nullptr );

View File

@ -1282,7 +1282,7 @@ int PCB_CONTROL::AppendBoard( PCB_IO& pi, wxString& fileName )
{ {
STRING_UTF8_MAP props; STRING_UTF8_MAP props;
// EAGLE_PLUGIN can use this info to center the BOARD, but it does not yet. // PCB_IO_EAGLE can use this info to center the BOARD, but it does not yet.
props["page_width"] = std::to_string( editFrame->GetPageSizeIU().x ); props["page_width"] = std::to_string( editFrame->GetPageSizeIU().x );
props["page_height"] = std::to_string( editFrame->GetPageSizeIU().y ); props["page_height"] = std::to_string( editFrame->GetPageSizeIU().y );

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 <pcb_io/kicad/pcb_plugin.h> #include <pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h>

View File

@ -24,8 +24,8 @@
#include <pcbnew_utils/board_file_utils.h> #include <pcbnew_utils/board_file_utils.h>
// For PCB parsing // For PCB parsing
#include <pcb_io/kicad/pcb_plugin.h> #include <pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h>
#include <pcb_io/kicad/pcb_parser.h> #include <pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.h>
#include <richio.h> #include <richio.h>
#include <board.h> #include <board.h>
@ -65,7 +65,7 @@ std::string GetPcbnewTestDataDir()
void DumpBoardToFile( BOARD& board, const std::string& aFilename ) void DumpBoardToFile( BOARD& board, const std::string& aFilename )
{ {
PCB_PLUGIN io; PCB_IO_KICAD_SEXPR io;
io.SaveBoard( aFilename, &board ); io.SaveBoard( aFilename, &board );
} }
@ -76,7 +76,7 @@ std::unique_ptr<BOARD_ITEM> ReadBoardItemFromStream( std::istream& aStream )
STDISTREAM_LINE_READER reader; STDISTREAM_LINE_READER reader;
reader.SetStream( aStream ); reader.SetStream( aStream );
PCB_PARSER parser( &reader, nullptr, nullptr ); PCB_IO_KICAD_SEXPR_PARSER parser( &reader, nullptr, nullptr );
std::unique_ptr<BOARD_ITEM> board; std::unique_ptr<BOARD_ITEM> board;
try try

View File

@ -48,9 +48,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_PLUGIN API. * write to disk without directly using the PCB_IO_KICAD_SEXPR API.
* *
* Note: The aBoard param is non-const because PCB_PLUGIN::Save demands it * Note: The aBoard param is non-const because PCB_IO_KICAD_SEXPR::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

@ -50,7 +50,7 @@
#include <connectivity/connectivity_data.h> #include <connectivity/connectivity_data.h>
#include <pcb_io/pcb_io_mgr.h> #include <pcb_io/pcb_io_mgr.h>
#include <pcb_io/kicad/pcb_plugin.h> #include <pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h>
#include <memory> #include <memory>
@ -101,7 +101,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_PLUGIN ); PLUGIN::RELEASER pi( new PCB_IO_KICAD_SEXPR );
BOARD* brd = nullptr; BOARD* brd = nullptr;
try try

View File

@ -30,8 +30,8 @@
#include <pcbnew_utils/board_file_utils.h> #include <pcbnew_utils/board_file_utils.h>
#include <qa_utils/wx_utils/unit_test_utils.h> #include <qa_utils/wx_utils/unit_test_utils.h>
#include <pcbnew/pcb_io/altium/altium_designer_plugin.h> #include <pcbnew/pcb_io/altium/pcb_io_altium_designer.h>
#include <pcbnew/pcb_io/kicad/pcb_plugin.h> #include <pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h>
#include <footprint.h> #include <footprint.h>
#include <pad.h> #include <pad.h>
@ -42,8 +42,8 @@ struct ALTIUM_PCBLIB_IMPORT_FIXTURE
{ {
ALTIUM_PCBLIB_IMPORT_FIXTURE() {} ALTIUM_PCBLIB_IMPORT_FIXTURE() {}
ALTIUM_DESIGNER_PLUGIN altiumPlugin; PCB_IO_ALTIUM_DESIGNER altiumPlugin;
PCB_PLUGIN kicadPlugin; PCB_IO_KICAD_SEXPR kicadPlugin;
}; };

View File

@ -27,8 +27,8 @@
#include <pcbnew_utils/board_file_utils.h> #include <pcbnew_utils/board_file_utils.h>
#include <qa_utils/wx_utils/unit_test_utils.h> #include <qa_utils/wx_utils/unit_test_utils.h>
#include <pcbnew/pcb_io/cadstar/cadstar_pcb_archive_plugin.h> #include <pcbnew/pcb_io/cadstar/pcb_io_cadstar_archive.h>
#include <pcbnew/pcb_io/kicad/pcb_plugin.h> #include <pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h>
#include <footprint.h> #include <footprint.h>
#include <pad.h> #include <pad.h>
@ -39,8 +39,8 @@ struct CADSTAR_IMPORT_FIXTURE
{ {
CADSTAR_IMPORT_FIXTURE() {} CADSTAR_IMPORT_FIXTURE() {}
CADSTAR_PCB_ARCHIVE_PLUGIN cstarPlugin; PCB_IO_CADSTAR_ARCHIVE cstarPlugin;
PCB_PLUGIN kicadPlugin; PCB_IO_KICAD_SEXPR kicadPlugin;
}; };

View File

@ -30,8 +30,8 @@
#include <pcbnew_utils/board_file_utils.h> #include <pcbnew_utils/board_file_utils.h>
#include <qa_utils/wx_utils/unit_test_utils.h> #include <qa_utils/wx_utils/unit_test_utils.h>
#include <pcbnew/pcb_io/eagle/eagle_plugin.h> #include <pcbnew/pcb_io/eagle/pcb_io_eagle.h>
#include <pcbnew/pcb_io/kicad/pcb_plugin.h> #include <pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h>
#include <footprint.h> #include <footprint.h>
#include <pad.h> #include <pad.h>
@ -42,8 +42,8 @@ struct EAGLE_LBR_IMPORT_FIXTURE
{ {
EAGLE_LBR_IMPORT_FIXTURE() {} EAGLE_LBR_IMPORT_FIXTURE() {}
EAGLE_PLUGIN eaglePlugin; PCB_IO_EAGLE eaglePlugin;
PCB_PLUGIN kicadPlugin; PCB_IO_KICAD_SEXPR kicadPlugin;
}; };

View File

@ -30,7 +30,7 @@
#include <qa_utils/wx_utils/unit_test_utils.h> #include <qa_utils/wx_utils/unit_test_utils.h>
#include <pcbnew_utils/board_test_utils.h> #include <pcbnew_utils/board_test_utils.h>
#include <pcbnew_utils/board_file_utils.h> #include <pcbnew_utils/board_file_utils.h>
#include <pcb_io/kicad/pcb_plugin.h> #include <pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h>
#include <board.h> #include <board.h>
#include <footprint.h> #include <footprint.h>
#include <settings/settings_manager.h> #include <settings/settings_manager.h>
@ -54,7 +54,7 @@ BOOST_FIXTURE_TEST_CASE( FootprintPrettifier, PRETTIFIER_TEST_FIXTURE )
}; };
std::unique_ptr<FOOTPRINT> original, converted; std::unique_ptr<FOOTPRINT> original, converted;
PCB_PLUGIN plugin; PCB_IO_KICAD_SEXPR plugin;
std::string tempLibPath = fmt::format( "{}/prettifier.pretty", std::string tempLibPath = fmt::format( "{}/prettifier.pretty",
std::filesystem::temp_directory_path() ); std::filesystem::temp_directory_path() );

View File

@ -7,7 +7,7 @@
#include <pcbexpr_evaluator.h> #include <pcbexpr_evaluator.h>
#include <pcb_io/pcb_io_mgr.h> #include <pcb_io/pcb_io_mgr.h>
#include <pcb_io/kicad/pcb_plugin.h> #include <pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h>
#include <unordered_set> #include <unordered_set>

View File

@ -32,8 +32,8 @@
#include <wx/msgout.h> #include <wx/msgout.h>
#include <board_item.h> #include <board_item.h>
#include <pcb_io/kicad/pcb_plugin.h> #include <pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h>
#include <pcb_io/kicad/pcb_parser.h> #include <pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.h>
#include <richio.h> #include <richio.h>
#include <qa_utils/stdstream_line_reader.h> #include <qa_utils/stdstream_line_reader.h>
@ -53,7 +53,7 @@ bool parse( std::istream& aStream, bool aVerbose )
STDISTREAM_LINE_READER reader; STDISTREAM_LINE_READER reader;
reader.SetStream( aStream ); reader.SetStream( aStream );
PCB_PARSER parser( &reader, nullptr, nullptr ); PCB_IO_KICAD_SEXPR_PARSER parser( &reader, nullptr, nullptr );
BOARD_ITEM* board = nullptr; BOARD_ITEM* board = nullptr;
PARSE_DURATION duration{}; PARSE_DURATION duration{};

View File

@ -31,7 +31,7 @@
#include <board_design_settings.h> #include <board_design_settings.h>
#include <pcbnew/plugins/kicad/pcb_plugin.h> #include <pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h>
#include <pcbnew/drc/drc_engine.h> #include <pcbnew/drc/drc_engine.h>
#include <project.h> #include <project.h>
@ -347,7 +347,7 @@ bool PNS_LOG_FILE::Load( const wxFileName& logFileName, REPORTER* aRpt )
try try
{ {
PCB_PLUGIN io; PCB_IO_KICAD_SEXPR io;
aRpt->Report( wxString::Format( wxT("Loading board snapshot from '%s'"), aRpt->Report( wxString::Format( wxT("Loading board snapshot from '%s'"),
fname_dump.GetFullPath() ) ); fname_dump.GetFullPath() ) );

View File

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