From dbd498f45117e7d13ee0c662c7303a7edd59c0db Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Wed, 9 Nov 2022 20:50:01 -0500 Subject: [PATCH] Re-add keyword mapping --- common/database/database_lib_settings.cpp | 3 +++ eeschema/sch_plugins/database/sch_database_plugin.cpp | 7 +++++++ include/database/database_lib_settings.h | 1 + 3 files changed, 11 insertions(+) diff --git a/common/database/database_lib_settings.cpp b/common/database/database_lib_settings.cpp index 5e74247f10..4b1e091258 100644 --- a/common/database/database_lib_settings.cpp +++ b/common/database/database_lib_settings.cpp @@ -87,6 +87,9 @@ DATABASE_LIB_SETTINGS::DATABASE_LIB_SETTINGS( const std::string& aFilename ) : pj["footprint_filters"].get(); } + if( pj.contains( "keywords" ) ) + table.properties.keywords = pj["keywords"].get(); + if( pj.contains( "exclude_from_bom" ) ) { table.properties.exclude_from_bom = diff --git a/eeschema/sch_plugins/database/sch_database_plugin.cpp b/eeschema/sch_plugins/database/sch_database_plugin.cpp index 4f9be2a1b3..4a25172b34 100644 --- a/eeschema/sch_plugins/database/sch_database_plugin.cpp +++ b/eeschema/sch_plugins/database/sch_database_plugin.cpp @@ -317,6 +317,13 @@ LIB_SYMBOL* SCH_DATABASE_PLUGIN::loadSymbolFromRow( const wxString& aSymbolName, symbol->SetDescription( value ); } + if( !aTable.properties.keywords.empty() && aRow.count( aTable.properties.keywords ) ) + { + wxString value( std::any_cast( aRow.at( aTable.properties.keywords ) ).c_str(), + wxConvUTF8 ); + symbol->SetKeyWords( value ); + } + if( !aTable.properties.footprint_filters.empty() && aRow.count( aTable.properties.footprint_filters ) ) { diff --git a/include/database/database_lib_settings.h b/include/database/database_lib_settings.h index ea0cb51c35..60b42ff059 100644 --- a/include/database/database_lib_settings.h +++ b/include/database/database_lib_settings.h @@ -56,6 +56,7 @@ struct MAPPABLE_SYMBOL_PROPERTIES { std::string description; std::string footprint_filters; + std::string keywords; std::string exclude_from_bom; std::string exclude_from_board; };