CADSTAR PCB Archive Importer: Move code into common/plugins and pcbnew/plugins folders

This commit is contained in:
Roberto Fernandez Bautista 2020-08-29 19:09:48 +01:00 committed by Seth Hillbrand
parent fc76bdfeb2
commit 3b3af5327f
21 changed files with 68 additions and 70 deletions

View File

@ -275,6 +275,11 @@ set( PLUGINS_ALTIUM_SRCS
plugins/altium/altium_parser.cpp
)
set( PLUGINS_CADSTAR_SRCS
plugins/cadstar/cadstar_archive_parser.cpp
)
set( COMMON_SRCS
${LIB_KICAD_SRCS}
${COMMON_ABOUT_DLG_SRCS}
@ -284,6 +289,7 @@ set( COMMON_SRCS
${COMMON_PREVIEW_ITEMS_SRCS}
${PLOTTERS_CONTROL_SRCS}
${PLUGINS_ALTIUM_SRCS}
${PLUGINS_CADSTAR_SRCS}
advanced_config.cpp
array_axis.cpp
array_options.cpp

View File

@ -19,14 +19,14 @@
*/
/**
* @file cadstar_common.cpp
* @brief Helper functions and common defines
* @file cadstar_archive_parser.cpp
* @brief Helper functions and common defines between schematic and PCB Archive files
*/
#include <cadstar_archive_common.h>
#include <plugins/cadstar/cadstar_archive_parser.h>
void CADSTAR_ARCHIVE_COMMON::EVALUE::Parse( XNODE* aNode )
void CADSTAR_ARCHIVE_PARSER::EVALUE::Parse( XNODE* aNode )
{
wxASSERT( aNode->GetName() == wxT( "E" ) );
@ -38,7 +38,7 @@ void CADSTAR_ARCHIVE_COMMON::EVALUE::Parse( XNODE* aNode )
}
void CADSTAR_ARCHIVE_COMMON::POINT::Parse( XNODE* aNode )
void CADSTAR_ARCHIVE_PARSER::POINT::Parse( XNODE* aNode )
{
wxASSERT( aNode->GetName() == wxT( "PT" ) );
@ -47,7 +47,7 @@ void CADSTAR_ARCHIVE_COMMON::POINT::Parse( XNODE* aNode )
}
bool CADSTAR_ARCHIVE_COMMON::VERTEX::IsVertex( XNODE* aNode )
bool CADSTAR_ARCHIVE_PARSER::VERTEX::IsVertex( XNODE* aNode )
{
wxString aNodeName = aNode->GetName();
@ -59,7 +59,7 @@ bool CADSTAR_ARCHIVE_COMMON::VERTEX::IsVertex( XNODE* aNode )
}
void CADSTAR_ARCHIVE_COMMON::VERTEX::Parse( XNODE* aNode )
void CADSTAR_ARCHIVE_PARSER::VERTEX::Parse( XNODE* aNode )
{
wxASSERT( IsVertex( aNode ) );
@ -105,13 +105,13 @@ void CADSTAR_ARCHIVE_COMMON::VERTEX::Parse( XNODE* aNode )
}
double CADSTAR_ARCHIVE_COMMON::EVALUE::GetDouble()
double CADSTAR_ARCHIVE_PARSER::EVALUE::GetDouble()
{
return Base * std::pow( 10.0, Exponent );
}
void CADSTAR_ARCHIVE_COMMON::InsertAttributeAtEnd( XNODE* aNode, wxString aValue )
void CADSTAR_ARCHIVE_PARSER::InsertAttributeAtEnd( XNODE* aNode, wxString aValue )
{
wxString result, paramName = "attr0";
int i = 0;
@ -126,7 +126,7 @@ void CADSTAR_ARCHIVE_COMMON::InsertAttributeAtEnd( XNODE* aNode, wxString aValue
}
XNODE* CADSTAR_ARCHIVE_COMMON::LoadArchiveFile(
XNODE* CADSTAR_ARCHIVE_PARSER::LoadArchiveFile(
const wxString& aFileName, const wxString& aFileTypeIdentifier )
{
KEYWORD emptyKeywords[1] = {};
@ -215,7 +215,7 @@ XNODE* CADSTAR_ARCHIVE_COMMON::LoadArchiveFile(
return NULL;
}
wxString CADSTAR_ARCHIVE_COMMON::GetXmlAttributeIDString( XNODE* aNode, unsigned int aID )
wxString CADSTAR_ARCHIVE_PARSER::GetXmlAttributeIDString( XNODE* aNode, unsigned int aID )
{
wxString attrName, retVal;
attrName = "attr";
@ -228,7 +228,7 @@ wxString CADSTAR_ARCHIVE_COMMON::GetXmlAttributeIDString( XNODE* aNode, unsigned
}
long CADSTAR_ARCHIVE_COMMON::GetXmlAttributeIDLong( XNODE* aNode, unsigned int aID )
long CADSTAR_ARCHIVE_PARSER::GetXmlAttributeIDLong( XNODE* aNode, unsigned int aID )
{
long retVal;
@ -239,7 +239,7 @@ long CADSTAR_ARCHIVE_COMMON::GetXmlAttributeIDLong( XNODE* aNode, unsigned int a
}
void CADSTAR_ARCHIVE_COMMON::CheckNoChildNodes( XNODE* aNode )
void CADSTAR_ARCHIVE_PARSER::CheckNoChildNodes( XNODE* aNode )
{
if( aNode->GetChildren() )
{
@ -248,7 +248,7 @@ void CADSTAR_ARCHIVE_COMMON::CheckNoChildNodes( XNODE* aNode )
}
void CADSTAR_ARCHIVE_COMMON::CheckNoNextNodes( XNODE* aNode )
void CADSTAR_ARCHIVE_PARSER::CheckNoNextNodes( XNODE* aNode )
{
if( aNode->GetNext() )
{
@ -257,7 +257,7 @@ void CADSTAR_ARCHIVE_COMMON::CheckNoNextNodes( XNODE* aNode )
}
void CADSTAR_ARCHIVE_COMMON::ParseChildEValue( XNODE* aNode, EVALUE& aValueToParse )
void CADSTAR_ARCHIVE_PARSER::ParseChildEValue( XNODE* aNode, EVALUE& aValueToParse )
{
if( aNode->GetChildren()->GetName() == wxT( "E" ) )
{
@ -269,7 +269,7 @@ void CADSTAR_ARCHIVE_COMMON::ParseChildEValue( XNODE* aNode, EVALUE& aValueToPar
}
}
std::vector<CADSTAR_ARCHIVE_COMMON::POINT> CADSTAR_ARCHIVE_COMMON::ParseAllChildPoints(
std::vector<CADSTAR_ARCHIVE_PARSER::POINT> CADSTAR_ARCHIVE_PARSER::ParseAllChildPoints(
XNODE* aNode, bool aTestAllChildNodes, int aExpectedNumPoints )
{
std::vector<POINT> retVal;
@ -298,7 +298,7 @@ std::vector<CADSTAR_ARCHIVE_COMMON::POINT> CADSTAR_ARCHIVE_COMMON::ParseAllChild
}
std::vector<CADSTAR_ARCHIVE_COMMON::VERTEX> CADSTAR_ARCHIVE_COMMON::ParseAllChildVertices(
std::vector<CADSTAR_ARCHIVE_PARSER::VERTEX> CADSTAR_ARCHIVE_PARSER::ParseAllChildVertices(
XNODE* aNode, bool aTestAllChildNodes )
{
std::vector<VERTEX> retVal;
@ -322,7 +322,7 @@ std::vector<CADSTAR_ARCHIVE_COMMON::VERTEX> CADSTAR_ARCHIVE_COMMON::ParseAllChil
}
std::vector<CADSTAR_ARCHIVE_COMMON::CUTOUT> CADSTAR_ARCHIVE_COMMON::ParseAllChildCutouts(
std::vector<CADSTAR_ARCHIVE_PARSER::CUTOUT> CADSTAR_ARCHIVE_PARSER::ParseAllChildCutouts(
XNODE* aNode, bool aTestAllChildNodes )
{
std::vector<CUTOUT> retVal;
@ -345,7 +345,7 @@ std::vector<CADSTAR_ARCHIVE_COMMON::CUTOUT> CADSTAR_ARCHIVE_COMMON::ParseAllChil
return retVal;
}
void CADSTAR_ARCHIVE_COMMON::CUTOUT::Parse( XNODE* aNode )
void CADSTAR_ARCHIVE_PARSER::CUTOUT::Parse( XNODE* aNode )
{
wxASSERT( aNode->GetName() == wxT( "CUTOUT" ) );
@ -353,7 +353,7 @@ void CADSTAR_ARCHIVE_COMMON::CUTOUT::Parse( XNODE* aNode )
}
bool CADSTAR_ARCHIVE_COMMON::SHAPE::IsShape( XNODE* aNode )
bool CADSTAR_ARCHIVE_PARSER::SHAPE::IsShape( XNODE* aNode )
{
wxString aNodeName = aNode->GetName();
@ -364,7 +364,7 @@ bool CADSTAR_ARCHIVE_COMMON::SHAPE::IsShape( XNODE* aNode )
return false;
}
void CADSTAR_ARCHIVE_COMMON::SHAPE::Parse( XNODE* aNode )
void CADSTAR_ARCHIVE_PARSER::SHAPE::Parse( XNODE* aNode )
{
wxASSERT( IsShape( aNode ) );

View File

@ -19,14 +19,13 @@
*/
/**
* @file cadstar_common.h
* @brief Helper functions and common defines
* @file cadstar_archive_parser.h
* @brief Helper functions and common defines between schematic and PCB Archive files
*/
#ifndef CADSTAR_ARHIVE_COMMON_H_
#define CADSTAR_ARHIVE_COMMON_H_
#ifndef CADSTAR_ARHIVE_PARSER_H_
#define CADSTAR_ARHIVE_PARSER_H_
#include <class_board.h>
#include <dsnlexer.h>
#include <macros.h>
#include <vector>
@ -54,7 +53,7 @@
/**
* @brief Helper functions and common structures for CADSTAR PCB and Schematic archive files.
*/
class CADSTAR_ARCHIVE_COMMON
class CADSTAR_ARCHIVE_PARSER
{
public:
static const long UNDEFINED_VALUE = -1;
@ -247,6 +246,6 @@ public:
XNODE* aNode, bool aTestAllChildNodes = false );
}; // class CADSTAR_ARCHIVE_COMMON
}; // class CADSTAR_ARHIVE_PARSER
#endif // CADSTAR_COMMON_H_
#endif // CADSTAR_ARHIVE_PARSER_H_

View File

@ -67,7 +67,6 @@ set_target_properties( cvpcb_kiface PROPERTIES
)
target_link_libraries( cvpcb_kiface
pcbcommon
cadstar2kicadpcb
3d-viewer
gal
common

View File

@ -596,9 +596,9 @@ endif()
add_subdirectory( pcad2kicadpcb_plugin )
add_subdirectory( plugins/altium )
add_subdirectory( cadstar2kicadpcb_plugin )
add_subdirectory( plugins/cadstar )
set( PCBNEW_IO_LIBRARIES pcad2kicadpcb altium2pcbnew CACHE INTERNAL "")
set( PCBNEW_IO_LIBRARIES pcad2kicadpcb altium2pcbnew cadstar2pcbnew CACHE INTERNAL "")
if( BUILD_GITHUB_PLUGIN )
add_subdirectory( github )
@ -693,7 +693,6 @@ set( PCBNEW_KIFACE_LIBRARIES
connectivity
pcbcommon
pnsrouter
cadstar2kicadpcb
kiplatform
common
gal

View File

@ -1,14 +0,0 @@
# Sources for the pcbnew PLUGIN called CADSTAR_ARCHIVE_PLUGIN
include_directories( . )
set( CADSTAR2PCBNEW_SRCS
cadstar_pcb_archive_plugin.cpp
cadstar_pcb_archive_parser.cpp
cadstar_archive_common.cpp
cadstar_pcb.cpp
)
add_library( cadstar2kicadpcb STATIC ${CADSTAR2PCBNEW_SRCS} )
target_link_libraries( cadstar2kicadpcb pcbcommon )

View File

@ -89,7 +89,7 @@ bool AskLoadBoardFileName( wxWindow* aParent, int* aCtl, wxString* aFileName, bo
{ AltiumDesignerPcbFileWildcard(), IO_MGR::ALTIUM_DESIGNER }, // Import Altium Designer board files
{ AltiumCircuitStudioPcbFileWildcard(), IO_MGR::ALTIUM_CIRCUIT_STUDIO }, // Import Altium Circuit Studio board files
{ AltiumCircuitMakerPcbFileWildcard(), IO_MGR::ALTIUM_CIRCUIT_MAKER }, // Import Altium Circuit Maker board files
{ CadstarArchivePcbFileWildcard(), IO_MGR::CADSTAR_ARCHIVE }, // Import Cadstar PCB Archive board files
{ CadstarArchivePcbFileWildcard(), IO_MGR::CADSTAR_PCB_ARCHIVE }, // Import Cadstar PCB Archive board files
};
// clang-format on
@ -389,9 +389,9 @@ IO_MGR::PCB_FILE_T plugin_type( const wxString& aFileName, int aCtl )
{
pluginType = IO_MGR::ALTIUM_CIRCUIT_MAKER;
}
else if( fn.GetExt().CmpNoCase( IO_MGR::GetFileExtension( IO_MGR::CADSTAR_ARCHIVE ) ) == 0 )
else if( fn.GetExt().CmpNoCase( IO_MGR::GetFileExtension( IO_MGR::CADSTAR_PCB_ARCHIVE ) ) == 0 )
{
pluginType = IO_MGR::CADSTAR_ARCHIVE;
pluginType = IO_MGR::CADSTAR_PCB_ARCHIVE;
}
else
{

View File

@ -25,7 +25,6 @@
#include <wx/filename.h>
#include <wx/uri.h>
#include <cadstar2kicadpcb_plugin/cadstar_pcb_archive_plugin.h>
#include <config.h>
#include <eagle_plugin.h>
#include <gpcb_plugin.h>
@ -36,6 +35,7 @@
#include <plugins/altium/altium_circuit_maker_plugin.h>
#include <plugins/altium/altium_circuit_studio_plugin.h>
#include <plugins/altium/altium_designer_plugin.h>
#include <plugins/cadstar/cadstar_pcb_archive_plugin.h>
#if defined(BUILD_GITHUB_PLUGIN)
#include <github/github_plugin.h>
@ -216,7 +216,7 @@ static IO_MGR::REGISTER_PLUGIN registerAltiumCircuitStudioPlugin( IO_MGR::ALTIUM
static IO_MGR::REGISTER_PLUGIN registerAltiumCircuitMakerPlugin( IO_MGR::ALTIUM_CIRCUIT_MAKER,
wxT( "Altium Circuit Maker" ),
[]() -> PLUGIN* { return new ALTIUM_CIRCUIT_MAKER_PLUGIN; } );
static IO_MGR::REGISTER_PLUGIN registerCadstarArchivePlugin( IO_MGR::CADSTAR_ARCHIVE,
static IO_MGR::REGISTER_PLUGIN registerCadstarArchivePlugin( IO_MGR::CADSTAR_PCB_ARCHIVE,
wxT( "CADSTAR PCB Archive" ), []() -> PLUGIN* { return new CADSTAR_PCB_ARCHIVE_PLUGIN; } );
#ifdef BUILD_GITHUB_PLUGIN
static IO_MGR::REGISTER_PLUGIN registerGithubPlugin( IO_MGR::GITHUB, wxT("Github"), []() -> PLUGIN* { return new GITHUB_PLUGIN; } );

View File

@ -60,7 +60,7 @@ public:
ALTIUM_DESIGNER,
ALTIUM_CIRCUIT_STUDIO,
ALTIUM_CIRCUIT_MAKER,
CADSTAR_ARCHIVE,
CADSTAR_PCB_ARCHIVE,
GEDA_PCB, ///< Geda PCB file formats.
//N.B. This needs to be commented out to ensure compile-type errors

View File

@ -0,0 +1,13 @@
# Sources for the pcbnew PLUGIN called CADSTAR_PCB_ARCHIVE_PLUGIN
include_directories( . )
set( CADSTAR2PCBNEW_SRCS
cadstar_pcb_archive_plugin.cpp
cadstar_pcb_archive_parser.cpp
cadstar_pcb_archive_loader.cpp
)
add_library( cadstar2pcbnew STATIC ${CADSTAR2PCBNEW_SRCS} )
target_link_libraries( cadstar2pcbnew pcbcommon )

View File

@ -19,11 +19,11 @@
*/
/**
* @file cadstar_pcb.cpp
* @brief Converts a CADSTAR_PCB_ARCHIVE_PARSER object into a KiCad BOARD object
* @file cadstar_pcb_archive_loader.cpp
* @brief Loads a cpa file into a KiCad BOARD object
*/
#include <cadstar_pcb.h>
#include <cadstar_pcb_archive_loader.h>
#include <board_stackup_manager/stackup_predefined_prms.h> // KEY_COPPER, KEY_CORE, KEY_PREPREG
#include <class_drawsegment.h> // DRAWSEGMENT

View File

@ -19,14 +19,15 @@
*/
/**
* @file cadstar_pcb.h
* @brief Converts a CADSTAR_PCB_ARCHIVE_PARSER object into a KiCad BOARD object
* @file cadstar_pcb_archive_loader.h
* @brief Loads a cpa file into a KiCad BOARD object
*/
#ifndef CADSTAR_PCB_H_
#define CADSTAR_PCB_H_
#ifndef CADSTAR_PCB_ARCHIVE_LOADER_H_
#define CADSTAR_PCB_ARCHIVE_LOADER_H_
#include <cadstar_pcb_archive_parser.h>
#include <class_board.h>
class BOARD;
@ -258,4 +259,4 @@ private:
};
#endif // CADSTAR_PCB_H_
#endif // CADSTAR_PCB_ARCHIVE_LOADER_H_

View File

@ -27,7 +27,7 @@
#define CADSTAR_PCB_ARCHIVE_PARSER_H_
#include <boost/serialization/strong_typedef.hpp>
#include <cadstar_archive_common.h>
#include <plugins/cadstar/cadstar_archive_parser.h>
#include <map>
#include <vector>
@ -60,11 +60,11 @@
/**
* @brief Represents a CADSTAR PCB Archive (CPA) file
*/
class CADSTAR_PCB_ARCHIVE_PARSER : public CADSTAR_ARCHIVE_COMMON
class CADSTAR_PCB_ARCHIVE_PARSER : public CADSTAR_ARCHIVE_PARSER
{
public:
explicit CADSTAR_PCB_ARCHIVE_PARSER( wxString aFilename )
: Filename( aFilename ), CADSTAR_ARCHIVE_COMMON()
: Filename( aFilename ), CADSTAR_ARCHIVE_PARSER()
{
KiCadUnitMultiplier = 10; // assume hundredth micron
}

View File

@ -24,7 +24,7 @@
* based on S-expressions.
*/
#include <cadstar_pcb.h>
#include <cadstar_pcb_archive_loader.h>
#include <cadstar_pcb_archive_plugin.h>
#include <class_board.h>

View File

@ -103,7 +103,6 @@ target_link_libraries( drc_proto
pcbcommon
bitmaps
gal
cadstar2kicadpcb
common
pcbcommon
${PCBNEW_IO_LIBRARIES}

View File

@ -71,7 +71,6 @@ target_link_libraries( test_gal_pixel_alignment
kimath
pnsrouter
pcbcommon
cadstar2kicadpcb
bitmaps
3d-viewer
gal

View File

@ -75,7 +75,6 @@ target_link_libraries( libeval_compiler_test
pcbcommon
bitmaps
gal
cadstar2kicadpcb
common
pcbcommon
${PCBNEW_IO_LIBRARIES}

View File

@ -73,7 +73,6 @@ target_link_libraries( qa_pcbnew
connectivity
pcbcommon
pnsrouter
cadstar2kicadpcb
gal
common
gal

View File

@ -53,7 +53,6 @@ target_link_libraries( qa_pcbnew_tools
connectivity
pcbcommon
pnsrouter
cadstar2kicadpcb
gal
dxflib_qcad
tinyspline_lib