diff --git a/eeschema/dialogs/dialog_choose_component.cpp b/eeschema/dialogs/dialog_choose_component.cpp index 7d9f83354a..90666d2089 100644 --- a/eeschema/dialogs/dialog_choose_component.cpp +++ b/eeschema/dialogs/dialog_choose_component.cpp @@ -246,7 +246,7 @@ bool DIALOG_CHOOSE_COMPONENT::updateSelection() return false; } - m_componentDetails->SetPage( GenerateAliasInfo( selection ) ); + m_componentDetails->SetPage( GenerateAliasInfo( selection, unit ) ); updateFootprint(); diff --git a/eeschema/generate_alias_info.cpp b/eeschema/generate_alias_info.cpp index d2510f1d2d..7d18b40af9 100644 --- a/eeschema/generate_alias_info.cpp +++ b/eeschema/generate_alias_info.cpp @@ -46,11 +46,13 @@ class ALIAS_INFO_GENERATOR { wxString m_html; LIB_ALIAS const * m_part; + int m_unit; public: - ALIAS_INFO_GENERATOR( LIB_ALIAS const * aAlias ) + ALIAS_INFO_GENERATOR( LIB_ALIAS const * aAlias, int aUnit ) : m_html( DescriptionFormat ), - m_part( aAlias ) + m_part( aAlias ), + m_unit( aUnit ) { } /** @@ -139,19 +141,22 @@ protected: wxString GetHtmlFieldRow( LIB_FIELD const & aField ) { wxString name = aField.GetName(); - wxString text = aField.GetFullText(); + wxString text = aField.GetFullText( m_unit > 0 ? m_unit : 1 ); wxString fieldhtml = FieldFormat; fieldhtml.Replace( "__NAME__", EscapedHTML( name ) ); - if( aField.GetId() == DATASHEET ) - { - wxString datasheetlink = DatasheetLinkFormat; - datasheetlink.Replace( "__VALUE__", EscapedHTML( text ) ); - fieldhtml.Replace( "__VALUE__", datasheetlink ); - } - else + switch( aField.GetId() ) { + case DATASHEET: + { + wxString datasheetlink = DatasheetLinkFormat; + datasheetlink.Replace( "__VALUE__", EscapedHTML( text ) ); + fieldhtml.Replace( "__VALUE__", datasheetlink ); + } + break; + + default: fieldhtml.Replace( "__VALUE__", EscapedHTML( text ) ); } @@ -175,9 +180,9 @@ protected: }; -wxString GenerateAliasInfo( LIB_ALIAS const * aAlias ) +wxString GenerateAliasInfo( LIB_ALIAS const * aAlias, int aUnit ) { - ALIAS_INFO_GENERATOR gen( aAlias ); + ALIAS_INFO_GENERATOR gen( aAlias, aUnit ); gen.GenerateHtml(); return gen.GetHtml(); } diff --git a/eeschema/generate_alias_info.h b/eeschema/generate_alias_info.h index b4ddfcce76..3cc64bf947 100644 --- a/eeschema/generate_alias_info.h +++ b/eeschema/generate_alias_info.h @@ -27,6 +27,6 @@ * Return an HTML page describing a LIB_ALIAS. This is suitable for inclusion * in a wxHtmlWindow. */ -wxString GenerateAliasInfo( LIB_ALIAS const * aAlias ); +wxString GenerateAliasInfo( LIB_ALIAS const * aAlias, int aUnit ); #endif // GENERATE_ALIAS_INFO_H