diff --git a/eeschema/dialogs/dialog_symbol_properties.cpp b/eeschema/dialogs/dialog_symbol_properties.cpp index 657ae2ed91..e25e1f511b 100644 --- a/eeschema/dialogs/dialog_symbol_properties.cpp +++ b/eeschema/dialogs/dialog_symbol_properties.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2004-2020 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2004-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -109,7 +110,7 @@ public: choices.push_back( alt.first ); attr = new wxGridCellAttr(); - attr->SetEditor( new wxGridCellChoiceEditor( choices ) ); + attr->SetEditor( new GRID_CELL_COMBOBOX( choices ) ); } m_nameAttrs.push_back( attr ); @@ -195,7 +196,7 @@ public: switch( aCol ) { case COL_ALT_NAME: - if( aValue == at( aRow ).GetName() ) + if( aValue == at( aRow ).GetLibPin()->GetName() ) at( aRow ).SetAlt( wxEmptyString ); else at( aRow ).SetAlt( aValue ); diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp index 178e7f21eb..59f7eb3cc5 100644 --- a/eeschema/lib_pin.cpp +++ b/eeschema/lib_pin.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2015 Wayne Stambaugh - * Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -879,6 +879,32 @@ int LIB_PIN::compare( const LIB_ITEM& aOther, LIB_ITEM::COMPARE_FLAGS aCompareFl if( m_nameTextSize != tmp->m_nameTextSize ) return m_nameTextSize - tmp->m_nameTextSize; + if( m_alternates.size() != tmp->m_alternates.size() ) + return m_alternates.size() - tmp->m_alternates.size(); + + auto lhsItem = m_alternates.begin(); + auto rhsItem = tmp->m_alternates.begin(); + + while( lhsItem != m_alternates.end() ) + { + const ALT& lhsAlt = lhsItem->second; + const ALT& rhsAlt = rhsItem->second; + + retv = lhsAlt.m_Name.Cmp( rhsAlt.m_Name ); + + if( retv ) + return retv; + + if( lhsAlt.m_Type != rhsAlt.m_Type ) + return static_cast( lhsAlt.m_Type ) - static_cast( rhsAlt.m_Type ); + + if( lhsAlt.m_Shape != rhsAlt.m_Shape ) + return static_cast( lhsAlt.m_Shape ) - static_cast( rhsAlt.m_Shape ); + + ++lhsItem; + ++rhsItem; + } + return 0; }