From 0d3d3e0d7ce6bf5d15fe670224ddd9afb0b92bbd Mon Sep 17 00:00:00 2001 From: Thomas Pointhuber Date: Fri, 23 Oct 2020 16:22:56 +0200 Subject: [PATCH] altium: parse symbol description, remove dependency on legacy plugin --- eeschema/sch_plugins/altium/altium_parser_sch.cpp | 9 ++++++++- eeschema/sch_plugins/altium/altium_parser_sch.h | 7 +++++++ eeschema/sch_plugins/altium/sch_altium_plugin.cpp | 6 ++---- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/eeschema/sch_plugins/altium/altium_parser_sch.cpp b/eeschema/sch_plugins/altium/altium_parser_sch.cpp index 23550b4706..494f63f6cc 100644 --- a/eeschema/sch_plugins/altium/altium_parser_sch.cpp +++ b/eeschema/sch_plugins/altium/altium_parser_sch.cpp @@ -73,11 +73,18 @@ ASCH_COMPONENT::ASCH_COMPONENT( const std::map& aProperties currentpartid = ALTIUM_PARSER::PropertiesReadInt( aProperties, "CURRENTPARTID", ALTIUM_COMPONENT_NONE ); libreference = ALTIUM_PARSER::PropertiesReadString( aProperties, "LIBREFERENCE", "" ); + sourcelibraryname = ALTIUM_PARSER::PropertiesReadString( aProperties, "SOURCELIBRARYNAME", "" ); + componentdescription = + ALTIUM_PARSER::PropertiesReadString( aProperties, "COMPONENTDESCRIPTION", "" ); orientation = ALTIUM_PARSER::PropertiesReadInt( aProperties, "ORIENTATION", 0 ); - + isMirrored = ALTIUM_PARSER::PropertiesReadBool( aProperties, "ISMIRRORED", false ); location = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ), -PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) ); + + partcount = ALTIUM_PARSER::PropertiesReadInt( aProperties, "PARTCOUNT", 0 ); + displaymodecount = ALTIUM_PARSER::PropertiesReadInt( aProperties, "DISPLAYMODECOUNT", 0 ); + displaymode = ALTIUM_PARSER::PropertiesReadInt( aProperties, "DISPLAYMODE", 0 ); } diff --git a/eeschema/sch_plugins/altium/altium_parser_sch.h b/eeschema/sch_plugins/altium/altium_parser_sch.h index c50881a29e..99320c98e4 100644 --- a/eeschema/sch_plugins/altium/altium_parser_sch.h +++ b/eeschema/sch_plugins/altium/altium_parser_sch.h @@ -98,10 +98,17 @@ struct ASCH_COMPONENT { int currentpartid; wxString libreference; + wxString sourcelibraryname; + wxString componentdescription; int orientation; + bool isMirrored; wxPoint location; + int partcount; + int displaymodecount; + int displaymode; + explicit ASCH_COMPONENT( const std::map& aProperties ); }; diff --git a/eeschema/sch_plugins/altium/sch_altium_plugin.cpp b/eeschema/sch_plugins/altium/sch_altium_plugin.cpp index a6b8181417..63edb5b865 100644 --- a/eeschema/sch_plugins/altium/sch_altium_plugin.cpp +++ b/eeschema/sch_plugins/altium/sch_altium_plugin.cpp @@ -27,7 +27,6 @@ #include #include #include -#include #include @@ -175,8 +174,6 @@ SCH_SHEET* SCH_ALTIUM_PLUGIN::Load( const wxString& aFileName, SCHEMATIC* aSchem wxCHECK_MSG( libTable, NULL, "Could not load symbol lib table." ); m_pi.set( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_KICAD ) ); - m_properties = std::make_unique(); - ( *m_properties )[SCH_LEGACY_PLUGIN::PropBuffering] = ""; /// @note No check is being done here to see if the existing symbol library exists so this /// will overwrite the existing one. @@ -200,7 +197,7 @@ SCH_SHEET* SCH_ALTIUM_PLUGIN::Load( const wxString& aFileName, SCHEMATIC* aSchem libTable->Format( &formatter, 0 ); } - // Relaod the symbol library table. + // Reload the symbol library table. m_schematic->Prj().SetElem( PROJECT::ELEM_SYMBOL_LIB_TABLE, NULL ); m_schematic->Prj().SchSymbolLibTable(); } @@ -454,6 +451,7 @@ void SCH_ALTIUM_PLUGIN::ParseComponent( int index, const std::mapSetName( elem.libreference ); + kpart->SetDescription( elem.componentdescription ); kpart->SetLibId( libId ); m_symbols.insert( { index, kpart } );