--- eeschema/lib_pin.cpp | 28 +--------------------- eeschema/lib_pin.h | 8 ------- eeschema/pin_type.cpp | 43 ++++++++++++++++++++++++++++++++++ eeschema/pin_type.h | 2 ++ eeschema/widgets/pin_type_combobox.cpp | 4 +--- 5 files changed, 47 insertions(+), 38 deletions(-)
diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp index d7a83f7..357b322 100644 --- a/eeschema/lib_pin.cpp +++ b/eeschema/lib_pin.cpp @@ -70,26 +70,6 @@ static const BITMAP_DEF iconsPinsOrientations[] = }; -// bitmaps to show pins electrical type in dialog editor -// must have same order than enum ElectricPinType (see lib_pin.h) -static const BITMAP_DEF iconsPinsElectricalType[] = -{ - pintype_input_xpm, - pintype_output_xpm, - pintype_bidi_xpm, - pintype_3states_xpm, - pintype_passive_xpm, - pintype_notspecif_xpm, - pintype_powerinput_xpm, - pintype_poweroutput_xpm, - pintype_opencoll_xpm, - pintype_openemit_xpm, - pintype_noconnect_xpm -}; - -#define PIN_ELECTRICAL_TYPE_CNT DIM( iconsPinsElectricalType ) - - const wxString LIB_PIN::GetCanonicalElectricalTypeName( ElectricPinType aType ) { assert( aType >= 0 && aType < (int) PINTYPE_COUNT ); @@ -2190,12 +2170,6 @@ void LIB_PIN::Rotate() } -const BITMAP_DEF* LIB_PIN::GetElectricalTypeSymbols() -{ - return iconsPinsElectricalType; -} - - const BITMAP_DEF* LIB_PIN::GetOrientationSymbols() { return iconsPinsOrientations; @@ -2204,7 +2178,7 @@ const BITMAP_DEF* LIB_PIN::GetOrientationSymbols() BITMAP_DEF LIB_PIN::GetMenuImage() const { - return iconsPinsElectricalType[m_type]; + return GetBitmap( m_type ); } diff --git a/eeschema/lib_pin.h b/eeschema/lib_pin.h index 95e241d..94390d8 100644 --- a/eeschema/lib_pin.h +++ b/eeschema/lib_pin.h @@ -440,14 +440,6 @@ public: */ static int GetOrientationCodeIndex( int aCode ); - - /** - * Get a list of pin electrical bitmaps for menus and dialogs. - * - * @return List of valid pin electrical type bitmaps symbols in .xpm format - */ - static const BITMAP_DEF* GetElectricalTypeSymbols(); - void SetOffset( const wxPoint& aOffset ); bool Inside( EDA_RECT& aRect ) const; diff --git a/eeschema/pin_type.cpp b/eeschema/pin_type.cpp index b80e257..42e4e55 100644 --- a/eeschema/pin_type.cpp +++ b/eeschema/pin_type.cpp @@ -71,3 +71,46 @@ wxString GetText( ElectricPinType aType ) assert( !"invalid pin type" ); return wxT( "???" ); } + + +BITMAP_DEF GetBitmap( ElectricPinType aType ) +{ + switch( aType ) + { + case PIN_INPUT: + return pintype_input_xpm; + + case PIN_OUTPUT: + return pintype_output_xpm; + + case PIN_BIDI: + return pintype_bidi_xpm; + + case PIN_TRISTATE: + return pintype_3states_xpm; + + case PIN_PASSIVE: + return pintype_passive_xpm; + + case PIN_UNSPECIFIED: + return pintype_notspecif_xpm; + + case PIN_POWER_IN: + return pintype_powerinput_xpm; + + case PIN_POWER_OUT: + return pintype_poweroutput_xpm; + + case PIN_OPENCOLLECTOR: + return pintype_opencoll_xpm; + + case PIN_OPENEMITTER: + return pintype_openemit_xpm; + + case PIN_NC: + return pintype_noconnect_xpm; + }; + + assert( !"invalid pin type" ); + return NULL; +} diff --git a/eeschema/pin_type.h b/eeschema/pin_type.h index 3910cb2..5c276fb 100644 --- a/eeschema/pin_type.h +++ b/eeschema/pin_type.h @@ -29,6 +29,7 @@ #define PIN_TYPE_H_ #include <wx/string.h> +#include <bitmaps.h> /** * The component library pin object electrical types used in ERC tests. @@ -53,5 +54,6 @@ enum { // UI wxString GetText( ElectricPinType ); +BITMAP_DEF GetBitmap( ElectricPinType ); #endif diff --git a/eeschema/widgets/pin_type_combobox.cpp b/eeschema/widgets/pin_type_combobox.cpp index 52dc5fb..2b64bbc 100644 --- a/eeschema/widgets/pin_type_combobox.cpp +++ b/eeschema/widgets/pin_type_combobox.cpp @@ -42,14 +42,12 @@ PinTypeComboBox::PinTypeComboBox( wxWindow* parent, const wxString& name ) : wxBitmapComboBox( parent, id, value, pos, size, n, choices, style, validator, name ) { - const BITMAP_DEF* bitmaps = LIB_PIN::GetElectricalTypeSymbols(); - for( unsigned ii = 0; ii < PINTYPE_COUNT; ++ii ) { ElectricPinType type = static_cast<ElectricPinType>( ii ); wxString text = GetText( type ); - BITMAP_DEF bitmap = bitmaps[ ii ]; + BITMAP_DEF bitmap = GetBitmap( type ); if( bitmap == NULL ) Append( text );
_______________________________________________ Mailing list: https://launchpad.net/~kicad-developers Post to : kicad-developers@lists.launchpad.net Unsubscribe : https://launchpad.net/~kicad-developers More help : https://help.launchpad.net/ListHelp