← Back to team overview

kicad-developers team mailing list archive

[PATCH 09/27] PinShapeComboBox: Fully initialize in c'tor

 

This makes the widget universally usable without special initialisation.
---
 eeschema/dialogs/dialog_lib_edit_pin.cpp | 12 ------------
 eeschema/dialogs/dialog_lib_edit_pin.h   |  1 -
 eeschema/pinedit.cpp                     |  1 -
 eeschema/widgets/pin_shape_combobox.cpp  | 12 ++++++++++++
 4 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/eeschema/dialogs/dialog_lib_edit_pin.cpp b/eeschema/dialogs/dialog_lib_edit_pin.cpp
index 85e5285..6c205d1 100644
--- a/eeschema/dialogs/dialog_lib_edit_pin.cpp
+++ b/eeschema/dialogs/dialog_lib_edit_pin.cpp
@@ -170,15 +170,3 @@ void DIALOG_LIB_EDIT_PIN::SetElectricalTypeList( const wxArrayString& list,
             m_choiceElectricalType->Insert( list[ii], KiBitmap( aBitmaps[ii] ), ii );
     }
 }
-
-
-void DIALOG_LIB_EDIT_PIN::SetStyleList( const wxArrayString& list, const BITMAP_DEF* aBitmaps )
-{
-    for ( unsigned ii = 0; ii < list.GetCount(); ii++ )
-    {
-        if( aBitmaps == NULL )
-            m_choiceStyle->Append( list[ii] );
-        else
-            m_choiceStyle->Insert( list[ii], KiBitmap( aBitmaps[ii] ), ii );
-    }
-}
diff --git a/eeschema/dialogs/dialog_lib_edit_pin.h b/eeschema/dialogs/dialog_lib_edit_pin.h
index a083e2c..a3a1ce1 100644
--- a/eeschema/dialogs/dialog_lib_edit_pin.h
+++ b/eeschema/dialogs/dialog_lib_edit_pin.h
@@ -68,7 +68,6 @@ public:
         return m_choiceElectricalType->GetSelection();
     }
 
-    void SetStyleList( const wxArrayString& list, const BITMAP_DEF* aBitmaps );
     void SetStyle( PinShape style ) { m_choiceStyle->SetSelection( style ); }
     PinShape GetStyle( void ) { return static_cast<PinShape>( m_choiceStyle->GetSelection() ); }
 
diff --git a/eeschema/pinedit.cpp b/eeschema/pinedit.cpp
index 9802599..7be4b3d 100644
--- a/eeschema/pinedit.cpp
+++ b/eeschema/pinedit.cpp
@@ -104,7 +104,6 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
     wxString units = GetUnitsLabel( g_UserUnit );
     dlg.SetOrientationList( LIB_PIN::GetOrientationNames(), LIB_PIN::GetOrientationSymbols() );
     dlg.SetOrientation( LIB_PIN::GetOrientationCodeIndex( pin->GetOrientation() ) );
-    dlg.SetStyleList( LIB_PIN::GetStyleNames(), LIB_PIN::GetStyleSymbols() );
     dlg.SetStyle( pin->GetShape() );
     dlg.SetElectricalTypeList( LIB_PIN::GetElectricalTypeNames(),
                                LIB_PIN::GetElectricalTypeSymbols() );
diff --git a/eeschema/widgets/pin_shape_combobox.cpp b/eeschema/widgets/pin_shape_combobox.cpp
index 0c69bb2..08f835c 100644
--- a/eeschema/widgets/pin_shape_combobox.cpp
+++ b/eeschema/widgets/pin_shape_combobox.cpp
@@ -28,6 +28,8 @@
 
 #include "pin_shape_combobox.h"
 
+#include <lib_pin.h>
+
 PinShapeComboBox::PinShapeComboBox( wxWindow* parent,
         wxWindowID id,
         const wxString& value,
@@ -40,4 +42,14 @@ 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++ )
+    {
+        if( bitmaps == NULL )
+            Append( list[ii] );
+        else
+            Insert( list[ii], KiBitmap( bitmaps[ii] ), ii );
+    }
 }

Follow ups

References