Fields: Description now mandatory

Propagate from symbols to footprints, footprints keep a library
description, too. (GetLibDescription())
This commit is contained in:
Mike Williams 2023-06-19 13:08:18 -04:00
parent 636db607c1
commit 85f889bc19
33 changed files with 106 additions and 258 deletions

View File

@ -35,11 +35,13 @@ using namespace TFIELD_T;
#define VALUE_CANONICAL "Value"
#define FOOTPRINT_CANONICAL "Footprint"
#define DATASHEET_CANONICAL "Datasheet"
#define DESCRIPTION_CANONICAL "Description"
static wxString s_CanonicalReference( REFERENCE_CANONICAL );
static wxString s_CanonicalValue( VALUE_CANONICAL );
static wxString s_CanonicalFootprint( FOOTPRINT_CANONICAL );
static wxString s_CanonicalDatasheet( DATASHEET_CANONICAL );
static wxString s_CanonicalDescription( DESCRIPTION_CANONICAL );
const wxString TEMPLATE_FIELDNAME::GetDefaultFieldName( int aFieldNdx, bool aTranslateForHI )
{
@ -47,21 +49,23 @@ const wxString TEMPLATE_FIELDNAME::GetDefaultFieldName( int aFieldNdx, bool aTra
{
switch( aFieldNdx )
{
case REFERENCE_FIELD: return s_CanonicalReference; // The symbol reference, R1, C1, etc.
case VALUE_FIELD: return s_CanonicalValue; // The symbol value
case FOOTPRINT_FIELD: return s_CanonicalFootprint; // The footprint for use with Pcbnew
case DATASHEET_FIELD: return s_CanonicalDatasheet; // Link to a datasheet for symbol
default: return wxString::Format( wxT( "Field%d" ), aFieldNdx );
case REFERENCE_FIELD: return s_CanonicalReference; // The symbol reference, R1, C1, etc.
case VALUE_FIELD: return s_CanonicalValue; // The symbol value
case FOOTPRINT_FIELD: return s_CanonicalFootprint; // The footprint for use with Pcbnew
case DATASHEET_FIELD: return s_CanonicalDatasheet; // Link to a datasheet for symbol
case DESCRIPTION_FIELD: return s_CanonicalDescription; // The symbol description
default: return wxString::Format( wxT( "Field%d" ), aFieldNdx );
}
}
switch( aFieldNdx )
{
case REFERENCE_FIELD: return _( REFERENCE_CANONICAL ); // The symbol reference, R1, C1, etc.
case VALUE_FIELD: return _( VALUE_CANONICAL ); // The symbol value
case FOOTPRINT_FIELD: return _( FOOTPRINT_CANONICAL ); // The footprint for use with Pcbnew
case DATASHEET_FIELD: return _( DATASHEET_CANONICAL ); // Link to a datasheet for symbol
default: return wxString::Format( _( "Field%d" ), aFieldNdx );
case REFERENCE_FIELD: return _( REFERENCE_CANONICAL ); // The symbol reference, R1, C1, etc.
case VALUE_FIELD: return _( VALUE_CANONICAL ); // The symbol value
case FOOTPRINT_FIELD: return _( FOOTPRINT_CANONICAL ); // The footprint for use with Pcbnew
case DATASHEET_FIELD: return _( DATASHEET_CANONICAL ); // Link to a datasheet for symbol
case DESCRIPTION_FIELD: return _( DESCRIPTION_CANONICAL ); // The symbol description
default: return wxString::Format( _( "Field%d" ), aFieldNdx );
}
}

View File

@ -166,7 +166,6 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataToWindow()
m_SymbolNameCtrl->ChangeValue( UnescapeString( m_libEntry->GetName() ) );
m_DescCtrl->ChangeValue( m_libEntry->GetDescription() );
m_KeywordCtrl->ChangeValue( m_libEntry->GetKeyWords() );
m_SelNumberOfUnits->SetValue( m_libEntry->GetUnitCount() );
m_OptionPartsInterchangeable->SetValue( !m_libEntry->UnitsLocked() ||
@ -420,7 +419,6 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataFromWindow()
}
m_libEntry->SetName( newName );
m_libEntry->SetDescription( m_DescCtrl->GetValue() );
m_libEntry->SetKeyWords( m_KeywordCtrl->GetValue() );
m_libEntry->SetUnitCount( m_SelNumberOfUnits->GetValue() );
m_libEntry->LockUnits( m_libEntry->GetUnitCount() > 1 &&

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -134,14 +134,6 @@ DIALOG_LIB_SYMBOL_PROPERTIES_BASE::DIALOG_LIB_SYMBOL_PROPERTIES_BASE( wxWindow*
m_SymbolNameCtrl = new wxTextCtrl( m_PanelBasic, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerFPID->Add( m_SymbolNameCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT, 8 );
wxStaticText* staticDescriptionLabel;
staticDescriptionLabel = new wxStaticText( m_PanelBasic, wxID_ANY, _("Description:"), wxDefaultPosition, wxDefaultSize, 0 );
staticDescriptionLabel->Wrap( -1 );
fgSizerFPID->Add( staticDescriptionLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 8 );
m_DescCtrl = new wxTextCtrl( m_PanelBasic, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerFPID->Add( m_DescCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT, 8 );
staticKeywordsLabel = new wxStaticText( m_PanelBasic, wxID_ANY, _("Keywords:"), wxDefaultPosition, wxDefaultSize, 0 );
staticKeywordsLabel->Wrap( -1 );
fgSizerFPID->Add( staticKeywordsLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 8 );
@ -393,7 +385,6 @@ DIALOG_LIB_SYMBOL_PROPERTIES_BASE::DIALOG_LIB_SYMBOL_PROPERTIES_BASE( wxWindow*
m_bpDelete->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnDeleteField ), NULL, this );
m_SymbolNameCtrl->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnSymbolNameKillFocus ), NULL, this );
m_SymbolNameCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnSymbolNameText ), NULL, this );
m_DescCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnText ), NULL, this );
m_KeywordCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnText ), NULL, this );
m_inheritanceSelectCombo->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnCombobox ), NULL, this );
m_inheritanceSelectCombo->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnText ), NULL, this );
@ -429,7 +420,6 @@ DIALOG_LIB_SYMBOL_PROPERTIES_BASE::~DIALOG_LIB_SYMBOL_PROPERTIES_BASE()
m_bpDelete->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnDeleteField ), NULL, this );
m_SymbolNameCtrl->Disconnect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnSymbolNameKillFocus ), NULL, this );
m_SymbolNameCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnSymbolNameText ), NULL, this );
m_DescCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnText ), NULL, this );
m_KeywordCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnText ), NULL, this );
m_inheritanceSelectCombo->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnCombobox ), NULL, this );
m_inheritanceSelectCombo->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnText ), NULL, this );

View File

@ -760,132 +760,6 @@
<event name="OnText">OnSymbolNameText</event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">8</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Description:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">staticDescriptionLabel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">none</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">8</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_DescCtrl</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnText">OnText</event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">8</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -58,7 +58,6 @@ class DIALOG_LIB_SYMBOL_PROPERTIES_BASE : public DIALOG_SHIM
STD_BITMAP_BUTTON* m_bpMoveDown;
STD_BITMAP_BUTTON* m_bpDelete;
wxTextCtrl* m_SymbolNameCtrl;
wxTextCtrl* m_DescCtrl;
wxStaticText* staticKeywordsLabel;
wxTextCtrl* m_KeywordCtrl;
wxStaticText* m_inheritsStaticText;

View File

@ -93,7 +93,7 @@ void LIB_FIELD::Init( int aId )
// By contrast, VALUE and REFERENCE are are always constructed as initially visible, and
// template fieldsnames' initial visibility is controlled by the template fieldname config.
if( aId == DATASHEET_FIELD || aId == FOOTPRINT_FIELD )
if( aId != VALUE_FIELD && aId != REFERENCE_FIELD && aId < MANDATORY_FIELDS )
SetVisible( false );
m_autoAdded = false;
@ -496,14 +496,8 @@ wxString LIB_FIELD::GetName( bool aUseDefaultName ) const
wxString LIB_FIELD::GetCanonicalName() const
{
switch( m_id )
{
case REFERENCE_FIELD:
case VALUE_FIELD:
case FOOTPRINT_FIELD:
case DATASHEET_FIELD:
if( m_id < MANDATORY_FIELDS )
return TEMPLATE_FIELDNAME::GetDefaultFieldName( m_id );
}
return m_name;
}

View File

@ -45,12 +45,13 @@ class SCH_LEGACY_PLUGIN_CACHE;
* A field is a string linked to a symbol. Unlike purely graphical text, fields can be used in
* netlist generation and other tools (BOM).
*
* The first 4 fields have a special meaning:
* The first 5 fields have a special meaning:
*
* 0 = REFERENCE_FIELD
* 1 = VALUE_FIELD
* 2 = FOOTPRINT_FIELD (default Footprint)
* 3 = DATASHEET_FIELD (user doc link)
* 4 = DESCRIPTION_FIELD
*
* others = free fields
* </p>

View File

@ -121,11 +121,9 @@ LIB_SYMBOL::LIB_SYMBOL( const wxString& aName, LIB_SYMBOL* aParent, SYMBOL_LIB*
// Add the MANDATORY_FIELDS in RAM only. These are assumed to be present
// when the field editors are invoked.
m_drawings[LIB_FIELD_T].reserve( 4 );
m_drawings[LIB_FIELD_T].push_back( new LIB_FIELD( this, VALUE_FIELD ) );
m_drawings[LIB_FIELD_T].push_back( new LIB_FIELD( this, REFERENCE_FIELD ) );
m_drawings[LIB_FIELD_T].push_back( new LIB_FIELD( this, FOOTPRINT_FIELD ) );
m_drawings[LIB_FIELD_T].push_back( new LIB_FIELD( this, DATASHEET_FIELD ) );
m_drawings[LIB_FIELD_T].reserve( MANDATORY_FIELDS );
for( int i = 0; i < MANDATORY_FIELDS; i++ )
m_drawings[LIB_FIELD_T].push_back( new LIB_FIELD( this, i ) );
SetName( aName );
@ -155,7 +153,6 @@ LIB_SYMBOL::LIB_SYMBOL( const LIB_SYMBOL& aSymbol, SYMBOL_LIB* aLibrary ) :
m_lastModDate = aSymbol.m_lastModDate;
m_options = aSymbol.m_options;
m_libId = aSymbol.m_libId;
m_description = aSymbol.m_description;
m_keyWords = aSymbol.m_keyWords;
aSymbol.CopyUnitDisplayNames( m_unitDisplayNames );
@ -208,7 +205,6 @@ const LIB_SYMBOL& LIB_SYMBOL::operator=( const LIB_SYMBOL& aSymbol )
m_lastModDate = aSymbol.m_lastModDate;
m_options = aSymbol.m_options;
m_libId = aSymbol.m_libId;
m_description = aSymbol.m_description;
m_keyWords = aSymbol.m_keyWords;
m_unitDisplayNames.clear();
@ -433,15 +429,6 @@ int LIB_SYMBOL::Compare( const LIB_SYMBOL& aRhs, int aCompareFlags, REPORTER* aR
}
}
if( int tmp = m_description.Cmp( aRhs.m_description ) )
{
retv = tmp;
REPORT( _( "Symbol descriptions differ." ) );
if( !aReporter )
return retv;
}
if( int tmp = m_keyWords.Cmp( aRhs.m_keyWords ) )
{
retv = tmp;
@ -645,7 +632,6 @@ std::unique_ptr< LIB_SYMBOL > LIB_SYMBOL::Flatten() const
}
retv->SetKeyWords( m_keyWords.IsEmpty() ? parent->GetKeyWords() : m_keyWords );
retv->SetDescription( m_description.IsEmpty() ? parent->GetDescription() : m_description );
retv->SetFPFilters( m_fpFilters.IsEmpty() ? parent->GetFPFilters() : m_fpFilters );
retv->SetIncludeInBom( parent->GetIncludeInBom() );
@ -1313,6 +1299,14 @@ LIB_FIELD& LIB_SYMBOL::GetDatasheetField()
}
LIB_FIELD& LIB_SYMBOL::GetDescriptionField()
{
LIB_FIELD* field = GetFieldById( DESCRIPTION_FIELD );
wxASSERT( field != nullptr );
return *field;
}
wxString LIB_SYMBOL::GetPrefix()
{
wxString refDesignator = GetFieldById( REFERENCE_FIELD )->GetText();

View File

@ -151,17 +151,22 @@ public:
wxString GetLibNickname() const override { return GetLibraryName(); }
void SetDescription( const wxString& aDescription ) { m_description = aDescription; }
///< Sets the Description field text value
void SetDescription( const wxString& aDescription )
{
GetDescriptionField().SetText( aDescription );
}
///< Gets the Description field text value */
wxString GetDescription() override
{
if( m_description.IsEmpty() && IsAlias() )
if( GetDescriptionField().GetText().IsEmpty() && IsAlias() )
{
if( LIB_SYMBOL_SPTR parent = m_parent.lock() )
return parent->GetDescription();
}
return m_description;
return GetDescriptionField().GetText();
}
void SetKeyWords( const wxString& aKeyWords ) { m_keyWords = aKeyWords; }
@ -312,6 +317,9 @@ public:
/** Return reference to the datasheet field. */
LIB_FIELD& GetDatasheetField();
/** Return reference to the description field. */
LIB_FIELD& GetDescriptionField();
wxString GetPrefix();
void RunOnChildren( const std::function<void( LIB_ITEM* )>& aFunction );
@ -754,7 +762,6 @@ private:
SYMBOL_LIB* m_library;
wxString m_name;
wxString m_description;
wxString m_keyWords; ///< Search keywords
wxArrayString m_fpFilters; ///< List of suitable footprint names for the
///< symbol (wild card names accepted).

View File

@ -374,13 +374,6 @@ XNODE* NETLIST_EXPORTER_XML::makeSymbols( unsigned aCtl )
if( const std::unique_ptr<LIB_SYMBOL>& part = symbol->GetLibSymbolRef() )
{
if( part->GetDescription().size() )
{
xcomp->AddChild( xproperty = node( wxT( "property" ) ) );
xproperty->AddAttribute( wxT( "name" ), wxT( "ki_description" ) );
xproperty->AddAttribute( wxT( "value" ), part->GetDescription() );
}
if( part->GetKeyWords().size() )
{
xcomp->AddChild( xproperty = node( wxT( "property" ) ) );

View File

@ -869,14 +869,10 @@ wxString SCH_FIELD::GetCanonicalName() const
{
if( m_parent && m_parent->Type() == SCH_SYMBOL_T )
{
switch( m_id )
{
case REFERENCE_FIELD: return wxT( "Reference" );
case VALUE_FIELD: return wxT( "Value" );
case FOOTPRINT_FIELD: return wxT( "Footprint" );
case DATASHEET_FIELD: return wxT( "Datasheet" );
default: return m_name;
}
if( m_id < MANDATORY_FIELDS )
return TEMPLATE_FIELDNAME::GetDefaultFieldName( m_id, true );
else
return m_name;
}
else if( m_parent && m_parent->Type() == SCH_SHEET_T )
{

View File

@ -292,15 +292,6 @@ void SCH_SEXPR_PLUGIN_CACHE::saveDcmInfoAsFields( LIB_SYMBOL* aSymbol, OUTPUTFOR
aNextFreeFieldId += 1;
}
if( !aSymbol->GetDescription().IsEmpty() )
{
LIB_FIELD description( aNextFreeFieldId, wxString( "ki_description" ) );
description.SetVisible( false );
description.SetText( aSymbol->GetDescription() );
saveField( &description, aFormatter, aNestLevel + 1 );
aNextFreeFieldId += 1;
}
wxArrayString fpFilters = aSymbol->GetFPFilters();
if( !fpFilters.IsEmpty() )

View File

@ -895,9 +895,9 @@ LIB_FIELD* SCH_SEXPR_PARSER::parseProperty( std::unique_ptr<LIB_SYMBOL>& aSymbol
aSymbol->SetKeyWords( value );
return nullptr;
}
// In v7 and earlier the description field didn't exist and was a key/value
else if( name == "ki_description" )
{
// Not a LIB_FIELD object yet.
aSymbol->SetDescription( value );
return nullptr;
}

View File

@ -44,8 +44,9 @@ enum MANDATORY_FIELD_T {
VALUE_FIELD, ///< Field Value of part, i.e. "3.3K"
FOOTPRINT_FIELD, ///< Field Name Module PCB, i.e. "16DIP300"
DATASHEET_FIELD, ///< name of datasheet
DESCRIPTION_FIELD, ///< Field Description of part, i.e. "1/4W 1% Metal Film Resistor"
/// The first 4 are mandatory, and must be instantiated in SCH_COMPONENT
/// The first 5 are mandatory, and must be instantiated in SCH_COMPONENT
/// and LIB_PART constructors
MANDATORY_FIELDS
};

View File

@ -254,7 +254,7 @@ bool DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataToWindow()
m_FootprintNameCtrl->ChangeValue( footprintName );
m_DocCtrl->SetValue( m_footprint->GetDescription() );
m_DocCtrl->SetValue( m_footprint->GetLibDescription() );
m_KeywordCtrl->SetValue( m_footprint->GetKeywords() );
if( !wxDialog::TransferDataToWindow() )
@ -492,7 +492,7 @@ bool DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataFromWindow()
fpID.SetLibItemName( m_FootprintNameCtrl->GetValue() );
m_footprint->SetFPID( fpID );
m_footprint->SetDescription( m_DocCtrl->GetValue() );
m_footprint->SetLibDescription( m_DocCtrl->GetValue() );
m_footprint->SetKeywords( m_KeywordCtrl->GetValue() );
// Update fields

View File

@ -498,7 +498,7 @@ bool FOOTPRINT::FootprintNeedsUpdate( const FOOTPRINT* aLibFootprint, REPORTER*
return diff;
}
TEST( GetDescription(), aLibFootprint->GetDescription(),
TEST( GetLibDescription(), aLibFootprint->GetLibDescription(),
_( "Footprint descriptions differ." ) );
TEST( GetKeywords(), aLibFootprint->GetKeywords(),
_( "Footprint keywords differ." ) );

View File

@ -200,7 +200,7 @@ FOOTPRINT::FOOTPRINT( const FOOTPRINT& aFootprint ) :
// Copy auxiliary data
m_3D_Drawings = aFootprint.m_3D_Drawings;
m_doc = aFootprint.m_doc;
m_libDescription = aFootprint.m_libDescription;
m_keywords = aFootprint.m_keywords;
m_privateLayers = aFootprint.m_privateLayers;
@ -477,7 +477,7 @@ FOOTPRINT& FOOTPRINT::operator=( FOOTPRINT&& aOther )
// Copy auxiliary data
m_3D_Drawings = aOther.m_3D_Drawings;
m_doc = aOther.m_doc;
m_libDescription = aOther.m_libDescription;
m_keywords = aOther.m_keywords;
m_privateLayers = aOther.m_privateLayers;
@ -587,7 +587,7 @@ FOOTPRINT& FOOTPRINT::operator=( const FOOTPRINT& aOther )
// Copy auxiliary data
m_3D_Drawings = aOther.m_3D_Drawings;
m_doc = aOther.m_doc;
m_libDescription = aOther.m_libDescription;
m_keywords = aOther.m_keywords;
m_privateLayers = aOther.m_privateLayers;
@ -1189,7 +1189,7 @@ void FOOTPRINT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
aList.emplace_back( _( "Pads" ), wxString::Format( wxT( "%zu" ), padCount ) );
aList.emplace_back( wxString::Format( _( "Doc: %s" ), GetDescription() ),
aList.emplace_back( wxString::Format( _( "Doc: %s" ), GetLibDescription() ),
wxString::Format( _( "Keywords: %s" ), GetKeywords() ) );
return;
@ -1237,7 +1237,7 @@ void FOOTPRINT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
: m_3D_Drawings.front().m_Filename );
aList.emplace_back( msg, msg2 );
msg.Printf( _( "Doc: %s" ), m_doc );
msg.Printf( _( "Doc: %s" ), m_libDescription );
msg2.Printf( _( "Keywords: %s" ), m_keywords );
aList.emplace_back( msg, msg2 );
}
@ -2984,8 +2984,8 @@ static struct FOOTPRINT_DESC
propMgr.AddProperty( new PROPERTY<FOOTPRINT, wxString>( _HKI( "Library link" ),
NO_SETTER( FOOTPRINT, wxString ), &FOOTPRINT::GetFPIDAsString ),
groupFootprint );
propMgr.AddProperty( new PROPERTY<FOOTPRINT, wxString>( _HKI( "Description" ),
NO_SETTER( FOOTPRINT, wxString ), &FOOTPRINT::GetDescription ),
propMgr.AddProperty( new PROPERTY<FOOTPRINT, wxString>( _HKI( "Library description" ),
NO_SETTER( FOOTPRINT, wxString ), &FOOTPRINT::GetLibDescription ),
groupFootprint );
propMgr.AddProperty( new PROPERTY<FOOTPRINT, wxString>( _HKI( "Keywords" ),
NO_SETTER( FOOTPRINT, wxString ), &FOOTPRINT::GetKeywords ),

View File

@ -223,8 +223,8 @@ public:
wxString GetFPIDAsString() const { return m_fpid.Format(); }
void SetFPIDAsString( const wxString& aFPID ) { m_fpid.Parse( aFPID ); }
wxString GetDescription() const { return m_doc; }
void SetDescription( const wxString& aDoc ) { m_doc = aDoc; }
wxString GetLibDescription() const { return m_libDescription; }
void SetLibDescription( const wxString& aDesc ) { m_libDescription = aDesc; }
wxString GetKeywords() const { return m_keywords; }
void SetKeywords( const wxString& aKeywords ) { m_keywords = aKeywords; }
@ -962,7 +962,7 @@ private:
int m_localSolderPasteMargin; // Solder paste margin absolute value
double m_localSolderPasteMarginRatio; // Solder mask margin ratio value of pad size
wxString m_doc; // File name and path for documentation file.
wxString m_libDescription; // File name and path for documentation file.
wxString m_keywords; // Search keywords to find footprint in library.
KIID_PATH m_path; // Path to associated symbol ([sheetUUID, .., symbolUUID]).
wxString m_sheetname; // Name of the sheet containing the symbol for this footprint

View File

@ -138,7 +138,7 @@ public:
m_pad_count = aFootprint->GetPadCount( DO_NOT_INCLUDE_NPTH );
m_unique_pad_count = aFootprint->GetUniquePadCount( DO_NOT_INCLUDE_NPTH );
m_keywords = aFootprint->GetKeywords();
m_doc = aFootprint->GetDescription();
m_doc = aFootprint->GetLibDescription();
m_loaded = true;
}
};

View File

@ -59,7 +59,7 @@ void FOOTPRINT_INFO_IMPL::load()
m_pad_count = footprint->GetPadCount( DO_NOT_INCLUDE_NPTH );
m_unique_pad_count = footprint->GetUniquePadCount( DO_NOT_INCLUDE_NPTH );
m_keywords = footprint->GetKeywords();
m_doc = footprint->GetDescription();
m_doc = footprint->GetLibDescription();
}
m_loaded = true;

View File

@ -214,7 +214,7 @@ void FP_TREE_SYNCHRONIZING_ADAPTER::GetValue( wxVariant& aVariant, wxDataViewIte
case DESC_COL:
if( node->m_LibId == m_frame->GetLoadedFPID() && !m_frame->IsCurrentFPFromBoard() )
{
node->m_Desc = m_frame->GetBoard()->GetFirstFootprint()->GetDescription();
node->m_Desc = m_frame->GetBoard()->GetFirstFootprint()->GetLibDescription();
}
else if( node->m_Type == LIB_TREE_NODE::LIB )
{

View File

@ -88,7 +88,7 @@ public:
if( m_footprint )
{
wxString name = m_lib_id.GetLibItemName();
wxString desc = m_footprint->GetDescription();
wxString desc = m_footprint->GetLibDescription();
wxString keywords = m_footprint->GetKeywords();
wxString doc;

View File

@ -72,14 +72,10 @@ wxString PCB_FIELD::GetCanonicalName() const
{
if( m_parent && m_parent->Type() == PCB_FOOTPRINT_T )
{
switch( m_id )
{
case REFERENCE_FIELD: return wxT( "Reference" );
case VALUE_FIELD: return wxT( "Value" );
case FOOTPRINT_FIELD: return wxT( "Footprint" );
case DATASHEET_FIELD: return wxT( "Datasheet" );
default: return m_name;
}
if( m_id < MANDATORY_FIELDS )
return TEMPLATE_FIELDNAME::GetDefaultFieldName( m_id, true );
else
return m_name;
}
else
{
@ -96,14 +92,10 @@ wxString PCB_FIELD::GetCanonicalName() const
wxString PCB_FIELD::GetTextTypeDescription() const
{
switch( m_id )
{
case REFERENCE_FIELD: return _( "Reference" );
case VALUE_FIELD: return _( "Value" );
case FOOTPRINT_FIELD: return _( "Footprint" );
case DATASHEET_FIELD: return _( "Datasheet" );
default: return _( "User Field" );
}
if( m_id < MANDATORY_FIELDS )
return TEMPLATE_FIELDNAME::GetDefaultFieldName( m_id, false );
else
return _( "User Field" );
}

View File

@ -104,9 +104,8 @@ void PlotInteractiveLayer( BOARD* aBoard, PLOTTER* aPlotter, const PCB_PLOT_PARA
_( "Footprint" ),
fp->GetFPIDAsString() ) );
properties.emplace_back( wxString::Format( wxT( "!%s = %s" ),
_( "Description" ),
fp->GetDescription() ) );
properties.emplace_back( wxString::Format( wxT( "!%s = %s" ), _( "Library Description" ),
fp->GetLibDescription() ) );
properties.emplace_back( wxString::Format( wxT( "!%s = %s" ),
_( "Keywords" ),

View File

@ -660,12 +660,12 @@ FOOTPRINT* ALTIUM_PCB::ParseFootprint( const ALTIUM_COMPOUND_FILE& altiumLibFile
wxString description = ALTIUM_PARSER::ReadString( parameterProperties,
wxT( "DESCRIPTION" ),
wxT( "" ) );
footprint->SetDescription( description );
footprint->SetLibDescription( description );
}
else
{
wxLogError( _( "File not found: '%s'." ), FormatPath( parametersStreamName ) );
footprint->SetDescription( wxT( "" ) );
footprint->SetLibDescription( wxT( "" ) );
}
const std::vector<std::string> extendedPrimitiveInformationStreamName{

View File

@ -1823,7 +1823,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadComponents()
loadComponentAttributes( comp, footprint );
if( !comp.PartID.IsEmpty() && comp.PartID != wxT( "NO_PART" ) )
footprint->SetDescription( getPart( comp.PartID ).Definition.Name );
footprint->SetLibDescription( getPart( comp.PartID ).Definition.Name );
m_componentMap.insert( { comp.ID, footprint } );
}

View File

@ -1741,7 +1741,7 @@ FOOTPRINT* EAGLE_PLUGIN::makeFootprint( wxXmlNode* aPackage, const wxString& aPk
const wxString& itemName = packageItem->GetName();
if( itemName == wxT( "description" ) )
m->SetDescription( packageItem->GetNodeContent() );
m->SetLibDescription( packageItem->GetNodeContent() );
else if( itemName == wxT( "wire" ) )
packageWire( m.get(), packageItem );
else if( itemName == wxT( "pad" ) )

View File

@ -361,12 +361,12 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader )
if( paramCnt > 10 )
{
footprint->SetDescription( parameters[3] );
footprint->SetLibDescription( parameters[3] );
footprint->SetReference( parameters[4] );
}
else
{
footprint->SetDescription( parameters[2] );
footprint->SetLibDescription( parameters[2] );
footprint->SetReference( parameters[3] );
}

View File

@ -3796,7 +3796,7 @@ FOOTPRINT* PCB_PARSER::parseFOOTPRINT_unchecked( wxArrayString* aInitialComments
case T_descr:
NeedSYMBOLorNUMBER(); // some symbols can be 0508, so a number is also a symbol here
footprint->SetDescription( FromUTF8() );
footprint->SetLibDescription( FromUTF8() );
NeedRIGHT();
break;
@ -3815,13 +3815,23 @@ FOOTPRINT* PCB_PARSER::parseFOOTPRINT_unchecked( wxArrayString* aInitialComments
NeedSYMBOL();
wxString pValue = FromUTF8();
// Skip non-field properties that should be hidden
if( pName == "ki_description" || pName == "ki_keywords" )
// Skip legacy non-field properties sent from symbols that should not be kept
// in footprints.
if( pName == "ki_keywords" || pName == "ki_fp_filters" || pName == "ki_locked" )
{
NeedRIGHT();
break;
}
// Description from symbol (not the fooprint library description stored in (descr) )
// used to be stored as a reserved key value
if( pName == "ki_description" )
{
footprint->GetFieldById( DESCRIPTION_FIELD )->SetText( pValue );
NeedRIGHT();
break;
}
// Sheet file and name used to be stored as properties invisible to the user
if( pName == "Sheetfile" || pName == "Sheet file" )
{

View File

@ -1110,10 +1110,10 @@ void PCB_PLUGIN::format( const FOOTPRINT* aFootprint, int aNestLevel ) const
m_out->Print( 0, ")\n" );
}
if( !aFootprint->GetDescription().IsEmpty() )
if( !aFootprint->GetLibDescription().IsEmpty() )
{
m_out->Print( aNestLevel+1, "(descr %s)\n",
m_out->Quotew( aFootprint->GetDescription() ).c_str() );
m_out->Print( aNestLevel + 1, "(descr %s)\n",
m_out->Quotew( aFootprint->GetLibDescription() ).c_str() );
}
if( !aFootprint->GetKeywords().IsEmpty() )

View File

@ -1239,7 +1239,7 @@ void LEGACY_PLUGIN::loadFOOTPRINT( FOOTPRINT* aFootprint )
else if( TESTLINE( "Cd" ) )
{
// e.g. "Cd Double rangee de contacts 2 x 4 pins\r\n"
aFootprint->SetDescription( FROM_UTF8( StrPurge( line + SZ( "Cd" ) ) ) );
aFootprint->SetLibDescription( FROM_UTF8( StrPurge( line + SZ( "Cd" ) ) ) );
}
else if( TESTLINE( "Kw" ) ) // Key words
{

View File

@ -172,7 +172,7 @@ void CheckFootprint( const FOOTPRINT* expected, const FOOTPRINT* fp )
BOOST_CHECK_EQUAL( expected->GetReference(), fp->GetReference() );
BOOST_CHECK_EQUAL( expected->GetValue(), fp->GetValue() );
BOOST_CHECK_EQUAL( expected->GetDescription(), fp->GetDescription() );
BOOST_CHECK_EQUAL( expected->GetLibDescription(), fp->GetLibDescription() );
BOOST_CHECK_EQUAL( expected->GetKeywords(), fp->GetKeywords() );
BOOST_CHECK_EQUAL( expected->GetAttributes(), fp->GetAttributes() );
BOOST_CHECK_EQUAL( expected->GetFlag(), fp->GetFlag() );
@ -180,6 +180,7 @@ void CheckFootprint( const FOOTPRINT* expected, const FOOTPRINT* fp )
BOOST_CHECK_EQUAL( expected->GetTypeName(), fp->GetTypeName() );
// simple test if count matches
BOOST_CHECK_EQUAL( expected->Fields().size(), fp->Fields().size() );
BOOST_CHECK_EQUAL( expected->Pads().size(), fp->Pads().size() );
BOOST_CHECK_EQUAL( expected->GraphicalItems().size(), fp->GraphicalItems().size() );
BOOST_CHECK_EQUAL( expected->Zones().size(), fp->Zones().size() );

View File

@ -84,7 +84,7 @@ BOOST_AUTO_TEST_CASE( DefaultProperties )
BOOST_AUTO_TEST_CASE( DefaultDrawings )
{
// default drawings exist
BOOST_CHECK_EQUAL( m_part_no_data.GetDrawItems().size(), 4 );
BOOST_CHECK_EQUAL( m_part_no_data.GetDrawItems().size(), MANDATORY_FIELDS );
BOOST_CHECK_EQUAL( m_part_no_data.GetAllLibPins().size(), 0 );
}
@ -110,6 +110,10 @@ BOOST_AUTO_TEST_CASE( DefaultFields )
( m_part_no_data.GetValueField() )( "Value" )( MANDATORY_FIELD_T::VALUE_FIELD ) );
BOOST_CHECK_PREDICATE( KI_TEST::FieldNameIdMatches,
( m_part_no_data.GetFootprintField() )( "Footprint" )( MANDATORY_FIELD_T::FOOTPRINT_FIELD ) );
BOOST_CHECK_PREDICATE( KI_TEST::FieldNameIdMatches,
( m_part_no_data.GetDatasheetField() )( "Datasheet" )( MANDATORY_FIELD_T::DATASHEET_FIELD) );
BOOST_CHECK_PREDICATE( KI_TEST::FieldNameIdMatches,
( m_part_no_data.GetDescriptionField() )( "Description" )( MANDATORY_FIELD_T::DESCRIPTION_FIELD) );
}