← Back to team overview

kicad-developers team mailing list archive

[PATCH 13/27] PinShape: drop list interfaces

 

This removes the list generation, and simply iterates over the allowed
values.
---
 eeschema/lib_pin.cpp                    | 11 -----------
 eeschema/lib_pin.h                      |  7 -------
 eeschema/widgets/pin_shape_combobox.cpp | 11 +++++++----
 3 files changed, 7 insertions(+), 22 deletions(-)

diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp
index 8a31e34..fe8f9c5 100644
--- a/eeschema/lib_pin.cpp
+++ b/eeschema/lib_pin.cpp
@@ -2224,17 +2224,6 @@ void LIB_PIN::Rotate()
 }
 
 
-wxArrayString LIB_PIN::GetStyleNames( void )
-{
-    wxArrayString tmp;
-
-    for( unsigned ii = 0; ii < PINSHAPE_COUNT; ii++ )
-        tmp.Add( GetText( static_cast<PinShape>( ii ) ) );
-
-    return tmp;
-}
-
-
 wxArrayString LIB_PIN::GetElectricalTypeNames( void )
 {
     wxArrayString tmp;
diff --git a/eeschema/lib_pin.h b/eeschema/lib_pin.h
index c2787ee..7338a83 100644
--- a/eeschema/lib_pin.h
+++ b/eeschema/lib_pin.h
@@ -443,13 +443,6 @@ public:
     static int GetOrientationCodeIndex( int aCode );
 
     /**
-     * Get a list of pin draw style names.
-     *
-     * @return  List of valid pin draw style names.
-     */
-    static wxArrayString GetStyleNames();
-
-    /**
      * Get a list of pin styles bitmaps for menus and dialogs.
      *
      * @return  List of valid pin electrical type bitmaps symbols in .xpm format.
diff --git a/eeschema/widgets/pin_shape_combobox.cpp b/eeschema/widgets/pin_shape_combobox.cpp
index e030534..6579f0d 100644
--- a/eeschema/widgets/pin_shape_combobox.cpp
+++ b/eeschema/widgets/pin_shape_combobox.cpp
@@ -42,15 +42,18 @@ PinShapeComboBox::PinShapeComboBox( wxWindow* parent,
         const wxString& name ) :
     wxBitmapComboBox( parent, id, value, pos, size, n, choices, style, validator, name )
 {
-    wxArrayString list = LIB_PIN::GetStyleNames();
     const BITMAP_DEF* bitmaps = LIB_PIN::GetStyleSymbols();
 
-    for ( unsigned ii = 0; ii < list.GetCount(); ii++ )
+    for( unsigned ii = 0; ii < PINSHAPE_COUNT; ++ii )
     {
+        PinShape shape = static_cast<PinShape>( ii );
+
+        wxString text = GetText( shape );
+
         if( bitmaps == NULL )
-            Append( list[ii] );
+            Append( text );
         else
-            Insert( list[ii], KiBitmap( bitmaps[ii] ), ii );
+            Insert( text, KiBitmap( bitmaps[ii] ), ii );
     }
 }
 

Follow ups

References