← Back to team overview

kicad-developers team mailing list archive

[PATCH 07/19] 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 e4b9878..999e74e 100644
--- a/eeschema/lib_pin.cpp
+++ b/eeschema/lib_pin.cpp
@@ -2233,17 +2233,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 0cb5fa3..c7d6fba 100644
--- a/eeschema/lib_pin.h
+++ b/eeschema/lib_pin.h
@@ -466,13 +466,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