kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #23201
[PATCH 14/19] PinTypeComboBox: fully initialize in c'tor
---
eeschema/dialogs/dialog_lib_edit_pin.cpp | 13 -------------
eeschema/dialogs/dialog_lib_edit_pin.h | 1 -
eeschema/pinedit.cpp | 2 --
eeschema/widgets/pin_type_combobox.cpp | 15 +++++++++++++++
4 files changed, 15 insertions(+), 16 deletions(-)
diff --git a/eeschema/dialogs/dialog_lib_edit_pin.cpp b/eeschema/dialogs/dialog_lib_edit_pin.cpp
index ae12e34..ce78fda 100644
--- a/eeschema/dialogs/dialog_lib_edit_pin.cpp
+++ b/eeschema/dialogs/dialog_lib_edit_pin.cpp
@@ -161,16 +161,3 @@ void DIALOG_LIB_EDIT_PIN::SetOrientationList( const wxArrayString& list,
m_choiceOrientation->Insert( list[ii], KiBitmap( aBitmaps[ii] ), ii );
}
}
-
-
-void DIALOG_LIB_EDIT_PIN::SetElectricalTypeList( const wxArrayString& list,
- const BITMAP_DEF* aBitmaps )
-{
- for ( unsigned ii = 0; ii < list.GetCount(); ii++ )
- {
- if( aBitmaps == NULL )
- m_choiceElectricalType->Append( list[ii] );
- else
- m_choiceElectricalType->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 ab23264..ebbcb4e 100644
--- a/eeschema/dialogs/dialog_lib_edit_pin.h
+++ b/eeschema/dialogs/dialog_lib_edit_pin.h
@@ -61,7 +61,6 @@ public:
}
int GetOrientation( void ) { return m_choiceOrientation->GetSelection(); }
- void SetElectricalTypeList( const wxArrayString& list, const BITMAP_DEF* aBitmaps );
void SetElectricalType( ElectricPinType type )
{
m_choiceElectricalType->SetSelection( type );
diff --git a/eeschema/pinedit.cpp b/eeschema/pinedit.cpp
index dd31c93..86432fc 100644
--- a/eeschema/pinedit.cpp
+++ b/eeschema/pinedit.cpp
@@ -105,8 +105,6 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
dlg.SetOrientationList( LIB_PIN::GetOrientationNames(), LIB_PIN::GetOrientationSymbols() );
dlg.SetOrientation( LIB_PIN::GetOrientationCodeIndex( pin->GetOrientation() ) );
dlg.SetStyle( pin->GetShape() );
- dlg.SetElectricalTypeList( LIB_PIN::GetElectricalTypeNames(),
- LIB_PIN::GetElectricalTypeSymbols() );
dlg.SetElectricalType( pin->GetType() );
dlg.SetPinName( pin->GetName() );
dlg.SetPinNameTextSize( StringFromValue( g_UserUnit, pin->GetNameTextSize() ) );
diff --git a/eeschema/widgets/pin_type_combobox.cpp b/eeschema/widgets/pin_type_combobox.cpp
index 3c2ac7e..c83d14f 100644
--- a/eeschema/widgets/pin_type_combobox.cpp
+++ b/eeschema/widgets/pin_type_combobox.cpp
@@ -28,6 +28,8 @@
#include "pin_type_combobox.h"
+#include <lib_pin.h>
+
PinTypeComboBox::PinTypeComboBox( wxWindow* parent,
wxWindowID id,
const wxString& value,
@@ -40,4 +42,17 @@ PinTypeComboBox::PinTypeComboBox( wxWindow* parent,
const wxString& name ) :
wxBitmapComboBox( parent, id, value, pos, size, n, choices, style, validator, name )
{
+ wxArrayString texts = LIB_PIN::GetElectricalTypeNames();
+ const BITMAP_DEF* bitmaps = LIB_PIN::GetElectricalTypeSymbols();
+
+ for( unsigned ii = 0; ii < PINTYPE_COUNT; ++ii )
+ {
+ wxString text = texts[ ii ];
+ BITMAP_DEF bitmap = bitmaps[ ii ];
+
+ if( bitmap == NULL )
+ Append( text );
+ else
+ Insert( text, KiBitmap( bitmap ), ii );
+ }
}
Follow ups
References
-
[PATCH 00/19] Pin shape and type refactoring
From: Simon Richter, 2016-02-17
-
[PATCH 01/19] Replace DrawPinShape enum with PinShape
From: Simon Richter, 2016-02-17
-
[PATCH 02/19] PinShapeComboBox: Introduce widget
From: Simon Richter, 2016-02-17
-
[PATCH 03/19] PinShapeComboBox: Fully initialize in c'tor
From: Simon Richter, 2016-02-17
-
[PATCH 04/19] PinShapeComboBox: typesafe Get/Set
From: Simon Richter, 2016-02-17
-
[PATCH 05/19] PinShape: move enum to own header
From: Simon Richter, 2016-02-17
-
[PATCH 06/19] PinShape: move text lookup
From: Simon Richter, 2016-02-17
-
[PATCH 07/19] PinShape: drop list interfaces
From: Simon Richter, 2016-02-17
-
[PATCH 08/19] PinShape: move bitmap lookup
From: Simon Richter, 2016-02-17
-
[PATCH 09/19] ElectricPinType: move definition to pin_type.h
From: Simon Richter, 2016-02-17
-
[PATCH 10/19] ElectricPinType: Use enum rather than int where possible
From: Simon Richter, 2016-02-17
-
[PATCH 11/19] ElectricPinType: Rename PIN_NMAX to PINTYPE_COUNT
From: Simon Richter, 2016-02-17
-
[PATCH 12/19] ElectricPinType: Separate PINTYPE_COUNT from enum
From: Simon Richter, 2016-02-17
-
[PATCH 13/19] PinTypeComboBox: Introduce widget
From: Simon Richter, 2016-02-17