KiCad PCB EDA Suite
pin_type.cpp File Reference
#include <pin_type.h>
#include <lib_pin.h>
#include <core/arraydim.h>

Go to the source code of this file.

Classes

struct  pinTypeStruct
 
struct  pinShapeStruct
 

Macros

#define PIN_ORIENTATION_CNT   arrayDim( pin_orientation_codes )
 

Functions

wxString PinOrientationName (unsigned aPinOrientationCode)
 
int PinOrientationCode (int index)
 
int PinOrientationIndex (int code)
 
void InitTables ()
 
const wxArrayString & PinTypeNames ()
 
const std::vector< BITMAP_DEF > & PinTypeIcons ()
 
const wxArrayString & PinShapeNames ()
 
const std::vector< BITMAP_DEF > & PinShapeIcons ()
 
const wxArrayString & PinOrientationNames ()
 
const std::vector< BITMAP_DEF > & PinOrientationIcons ()
 
wxString ElectricalPinTypeGetText (ELECTRICAL_PINTYPE aType)
 
BITMAP_DEF ElectricalPinTypeGetBitmap (ELECTRICAL_PINTYPE aType)
 
wxString PinShapeGetText (GRAPHIC_PINSHAPE aShape)
 
BITMAP_DEF PinShapeGetBitmap (GRAPHIC_PINSHAPE aShape)
 

Variables

static std::vector< BITMAP_DEFg_typeIcons
 
static wxArrayString g_typeNames
 
static std::vector< BITMAP_DEFg_shapeIcons
 
static wxArrayString g_shapeNames
 
static std::vector< BITMAP_DEFg_orientationIcons
 
static wxArrayString g_orientationNames
 
const std::map< ELECTRICAL_PINTYPE, struct pinTypeStructpinTypes
 
const std::map< GRAPHIC_PINSHAPE, struct pinShapeStructpinShapes
 
static const int pin_orientation_codes []
 
static const BITMAP_DEF iconsPinsOrientations []
 

Macro Definition Documentation

◆ PIN_ORIENTATION_CNT

#define PIN_ORIENTATION_CNT   arrayDim( pin_orientation_codes )

Definition at line 107 of file pin_type.cpp.

Function Documentation

◆ ElectricalPinTypeGetBitmap()

BITMAP_DEF ElectricalPinTypeGetBitmap ( ELECTRICAL_PINTYPE  aType)

Definition at line 245 of file pin_type.cpp.

246 {
247  auto findIt = pinTypes.find( aType );
248 
249  wxCHECK_MSG( findIt != pinTypes.end(), nullptr, "Could not find pin type in lookup map" );
250 
251  return findIt->second.bitmap;
252 }
const std::map< ELECTRICAL_PINTYPE, struct pinTypeStruct > pinTypes
Definition: pin_type.cpp:48

References pinTypes.

Referenced by LIB_PIN::GetMenuImage(), InitTables(), and PinTypeComboBox::PinTypeComboBox().

◆ ElectricalPinTypeGetText()

wxString ElectricalPinTypeGetText ( ELECTRICAL_PINTYPE  aType)

Definition at line 235 of file pin_type.cpp.

236 {
237  auto findIt = pinTypes.find( aType );
238 
239  wxCHECK_MSG( findIt != pinTypes.end(), wxT( "???" ), "Could not find pin type in lookup map" );
240 
241  return findIt->second.name;
242 }
const std::map< ELECTRICAL_PINTYPE, struct pinTypeStruct > pinTypes
Definition: pin_type.cpp:48

References pinTypes.

Referenced by LIB_PIN::GetElectricalTypeName(), SCH_PIN::GetMsgPanelInfo(), LIB_PIN::GetMsgPanelInfo(), InitTables(), PinTypeComboBox::PinTypeComboBox(), and ERC_TESTER::TestPinToPin().

◆ InitTables()

void InitTables ( )

Definition at line 159 of file pin_type.cpp.

160 {
161  for( unsigned i = 0; i < ELECTRICAL_PINTYPES_TOTAL; ++i )
162  {
163  g_typeIcons.push_back( ElectricalPinTypeGetBitmap( static_cast<ELECTRICAL_PINTYPE>( i ) ) );
164  g_typeNames.push_back( ElectricalPinTypeGetText( static_cast<ELECTRICAL_PINTYPE>( i ) ) );
165  }
166 
167  for( unsigned i = 0; i < GRAPHIC_PINSHAPES_TOTAL; ++i )
168  {
169  g_shapeIcons.push_back( PinShapeGetBitmap( static_cast<GRAPHIC_PINSHAPE>( i ) ) );
170  g_shapeNames.push_back( PinShapeGetText( static_cast<GRAPHIC_PINSHAPE>( i ) ) );
171  }
172 
173  for( unsigned i = 0; i < PIN_ORIENTATION_CNT; ++i )
174  {
175  g_orientationIcons.push_back( iconsPinsOrientations[ i ] );
176  g_orientationNames.push_back( PinOrientationName( i ) );
177  }
178 }
#define PIN_ORIENTATION_CNT
Definition: pin_type.cpp:107
wxString ElectricalPinTypeGetText(ELECTRICAL_PINTYPE aType)
Definition: pin_type.cpp:235
wxString PinShapeGetText(GRAPHIC_PINSHAPE aShape)
Definition: pin_type.cpp:255
static std::vector< BITMAP_DEF > g_orientationIcons
Definition: pin_type.cpp:37
wxString PinOrientationName(unsigned aPinOrientationCode)
Definition: pin_type.cpp:114
static std::vector< BITMAP_DEF > g_shapeIcons
Definition: pin_type.cpp:34
#define GRAPHIC_PINSHAPES_TOTAL
Definition: pin_type.h:69
static wxArrayString g_shapeNames
Definition: pin_type.cpp:35
static const BITMAP_DEF iconsPinsOrientations[]
Definition: pin_type.cpp:98
BITMAP_DEF ElectricalPinTypeGetBitmap(ELECTRICAL_PINTYPE aType)
Definition: pin_type.cpp:245
static wxArrayString g_orientationNames
Definition: pin_type.cpp:38
BITMAP_DEF PinShapeGetBitmap(GRAPHIC_PINSHAPE aShape)
Definition: pin_type.cpp:265
static std::vector< BITMAP_DEF > g_typeIcons
Definition: pin_type.cpp:31
static wxArrayString g_typeNames
Definition: pin_type.cpp:32
#define ELECTRICAL_PINTYPES_TOTAL
Definition: pin_type.h:52

References ELECTRICAL_PINTYPES_TOTAL, ElectricalPinTypeGetBitmap(), ElectricalPinTypeGetText(), g_orientationIcons, g_orientationNames, g_shapeIcons, g_shapeNames, g_typeIcons, g_typeNames, GRAPHIC_PINSHAPES_TOTAL, iconsPinsOrientations, PIN_ORIENTATION_CNT, PinOrientationName(), PinShapeGetBitmap(), and PinShapeGetText().

Referenced by PinOrientationIcons(), PinOrientationNames(), PinShapeIcons(), PinShapeNames(), PinTypeIcons(), and PinTypeNames().

◆ PinOrientationCode()

int PinOrientationCode ( int  index)

Definition at line 136 of file pin_type.cpp.

137 {
138  if( index >= 0 && index < (int) PIN_ORIENTATION_CNT )
139  return pin_orientation_codes[ index ];
140 
141  return PIN_RIGHT;
142 }
#define PIN_ORIENTATION_CNT
Definition: pin_type.cpp:107
static const int pin_orientation_codes[]
Definition: pin_type.cpp:87

References PIN_ORIENTATION_CNT, pin_orientation_codes, and PIN_RIGHT.

Referenced by DIALOG_PIN_PROPERTIES::OnPropertiesChange(), PIN_TABLE_DATA_MODEL::SetValue(), and DIALOG_PIN_PROPERTIES::TransferDataFromWindow().

◆ PinOrientationIcons()

const std::vector<BITMAP_DEF>& PinOrientationIcons ( )

Definition at line 226 of file pin_type.cpp.

227 {
228  if( g_orientationIcons.empty() )
229  InitTables();
230 
231  return g_orientationIcons;
232 }
void InitTables()
Definition: pin_type.cpp:159
static std::vector< BITMAP_DEF > g_orientationIcons
Definition: pin_type.cpp:37

References g_orientationIcons, and InitTables().

Referenced by DIALOG_LIB_EDIT_PIN_TABLE::DIALOG_LIB_EDIT_PIN_TABLE(), and DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES().

◆ PinOrientationIndex()

int PinOrientationIndex ( int  code)

Definition at line 145 of file pin_type.cpp.

146 {
147  size_t i;
148 
149  for( i = 0; i < PIN_ORIENTATION_CNT; i++ )
150  {
151  if( pin_orientation_codes[i] == code )
152  return (int) i;
153  }
154 
155  return wxNOT_FOUND;
156 }
#define PIN_ORIENTATION_CNT
Definition: pin_type.cpp:107
static const int pin_orientation_codes[]
Definition: pin_type.cpp:87

References PIN_ORIENTATION_CNT, and pin_orientation_codes.

Referenced by SCH_PIN::GetMsgPanelInfo(), LIB_PIN::GetMsgPanelInfo(), PIN_TABLE_DATA_MODEL::GetValue(), and DIALOG_PIN_PROPERTIES::TransferDataToWindow().

◆ PinOrientationName()

wxString PinOrientationName ( unsigned  aPinOrientationCode)

Definition at line 114 of file pin_type.cpp.

115 {
116  /* Note: The following name lists are sentence capitalized per the GNOME UI
117  * standards for list controls. Please do not change the capitalization
118  * of these strings unless the GNOME UI standards are changed.
119  */
120  const wxString pin_orientation_names[] =
121  {
122  _( "Right" ),
123  _( "Left" ),
124  _( "Up" ),
125  _( "Down" ),
126  wxT( "???" )
127  };
128 
129  if( aPinOrientationCode > PIN_ORIENTATION_CNT )
130  aPinOrientationCode = PIN_ORIENTATION_CNT;
131 
132  return pin_orientation_names[ aPinOrientationCode ];
133 }
#define PIN_ORIENTATION_CNT
Definition: pin_type.cpp:107
#define _(s)
Definition: 3d_actions.cpp:33

References _, and PIN_ORIENTATION_CNT.

Referenced by SCH_PIN::GetMsgPanelInfo(), LIB_PIN::GetMsgPanelInfo(), and InitTables().

◆ PinOrientationNames()

const wxArrayString& PinOrientationNames ( )

Definition at line 217 of file pin_type.cpp.

218 {
219  if( g_orientationNames.empty() )
220  InitTables();
221 
222  return g_orientationNames;
223 }
void InitTables()
Definition: pin_type.cpp:159
static wxArrayString g_orientationNames
Definition: pin_type.cpp:38

References g_orientationNames, and InitTables().

Referenced by DIALOG_LIB_EDIT_PIN_TABLE::DIALOG_LIB_EDIT_PIN_TABLE(), DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES(), PIN_TABLE_DATA_MODEL::GetValue(), and PIN_TABLE_DATA_MODEL::SetValue().

◆ PinShapeGetBitmap()

BITMAP_DEF PinShapeGetBitmap ( GRAPHIC_PINSHAPE  aShape)

Definition at line 265 of file pin_type.cpp.

266 {
267  auto findIt = pinShapes.find( aShape );
268 
269  wxCHECK_MSG( findIt != pinShapes.end(), nullptr, "Could not find pinshape in lookup map" );
270 
271  return findIt->second.bitmap;
272 }
const std::map< GRAPHIC_PINSHAPE, struct pinShapeStruct > pinShapes
Definition: pin_type.cpp:73

References pinShapes.

Referenced by InitTables(), and PinShapeComboBox::PinShapeComboBox().

◆ PinShapeGetText()

wxString PinShapeGetText ( GRAPHIC_PINSHAPE  aShape)

Definition at line 255 of file pin_type.cpp.

256 {
257  auto findIt = pinShapes.find( aShape );
258 
259  wxCHECK_MSG( findIt != pinShapes.end(), wxT( "?" ), "Could not find pinshape in lookup map" );
260 
261  return findIt->second.name;
262 }
const std::map< GRAPHIC_PINSHAPE, struct pinShapeStruct > pinShapes
Definition: pin_type.cpp:73

References pinShapes.

Referenced by SCH_PIN::GetMsgPanelInfo(), LIB_PIN::GetMsgPanelInfo(), LIB_PIN::GetSelectMenuText(), InitTables(), and PinShapeComboBox::PinShapeComboBox().

◆ PinShapeIcons()

const std::vector<BITMAP_DEF>& PinShapeIcons ( )

Definition at line 208 of file pin_type.cpp.

209 {
210  if( g_shapeIcons.empty() )
211  InitTables();
212 
213  return g_shapeIcons;
214 }
void InitTables()
Definition: pin_type.cpp:159
static std::vector< BITMAP_DEF > g_shapeIcons
Definition: pin_type.cpp:34

References g_shapeIcons, and InitTables().

Referenced by SCH_PIN_TABLE_DATA_MODEL::BuildAttrs(), DIALOG_LIB_EDIT_PIN_TABLE::DIALOG_LIB_EDIT_PIN_TABLE(), and DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES().

◆ PinShapeNames()

◆ PinTypeIcons()

const std::vector<BITMAP_DEF>& PinTypeIcons ( )

Definition at line 190 of file pin_type.cpp.

191 {
192  if( g_typeIcons.empty() )
193  InitTables();
194 
195  return g_typeIcons;
196 }
void InitTables()
Definition: pin_type.cpp:159
static std::vector< BITMAP_DEF > g_typeIcons
Definition: pin_type.cpp:31

References g_typeIcons, and InitTables().

Referenced by SCH_PIN_TABLE_DATA_MODEL::BuildAttrs(), DIALOG_LIB_EDIT_PIN_TABLE::DIALOG_LIB_EDIT_PIN_TABLE(), and DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES().

◆ PinTypeNames()

Variable Documentation

◆ g_orientationIcons

std::vector<BITMAP_DEF> g_orientationIcons
static

Definition at line 37 of file pin_type.cpp.

Referenced by InitTables(), and PinOrientationIcons().

◆ g_orientationNames

wxArrayString g_orientationNames
static

Definition at line 38 of file pin_type.cpp.

Referenced by InitTables(), and PinOrientationNames().

◆ g_shapeIcons

std::vector<BITMAP_DEF> g_shapeIcons
static

Definition at line 34 of file pin_type.cpp.

Referenced by InitTables(), and PinShapeIcons().

◆ g_shapeNames

wxArrayString g_shapeNames
static

Definition at line 35 of file pin_type.cpp.

Referenced by InitTables(), and PinShapeNames().

◆ g_typeIcons

std::vector<BITMAP_DEF> g_typeIcons
static

Definition at line 31 of file pin_type.cpp.

Referenced by InitTables(), and PinTypeIcons().

◆ g_typeNames

wxArrayString g_typeNames
static

Definition at line 32 of file pin_type.cpp.

Referenced by InitTables(), and PinTypeNames().

◆ iconsPinsOrientations

const BITMAP_DEF iconsPinsOrientations[]
static
Initial value:
=
{
}
const BITMAP_OPAQUE pinorient_up_xpm[1]
const BITMAP_OPAQUE pinorient_right_xpm[1]
const BITMAP_OPAQUE pinorient_down_xpm[1]
const BITMAP_OPAQUE pinorient_left_xpm[1]

Definition at line 98 of file pin_type.cpp.

Referenced by InitTables().

◆ pin_orientation_codes

const int pin_orientation_codes[]
static
Initial value:

Definition at line 87 of file pin_type.cpp.

Referenced by PinOrientationCode(), and PinOrientationIndex().

◆ pinShapes

const std::map<GRAPHIC_PINSHAPE, struct pinShapeStruct> pinShapes
Initial value:
= {
}
const BITMAP_OPAQUE pinshape_active_low_input_xpm[1]
const BITMAP_OPAQUE pinshape_normal_xpm[1]
const BITMAP_OPAQUE pinshape_active_low_output_xpm[1]
const BITMAP_OPAQUE pinshape_clock_invert_xpm[1]
const BITMAP_OPAQUE pinshape_clock_fall_xpm[1]
const BITMAP_OPAQUE pinshape_invert_xpm[1]
const BITMAP_OPAQUE pinshape_clock_normal_xpm[1]
const BITMAP_OPAQUE pinshape_clock_active_low_xpm[1]
const BITMAP_OPAQUE pinshape_nonlogic_xpm[1]
#define _(s)
Definition: 3d_actions.cpp:33

Definition at line 73 of file pin_type.cpp.

Referenced by PinShapeGetBitmap(), and PinShapeGetText().

◆ pinTypes

const std::map<ELECTRICAL_PINTYPE, struct pinTypeStruct> pinTypes
Initial value:
= {
{ ELECTRICAL_PINTYPE::PT_BIDI, { _( "Bidirectional" ), pintype_bidi_xpm } },
}
const BITMAP_OPAQUE pintype_bidi_xpm[1]
power input (GND, VCC for ICs). Must be connected to a power output.
const BITMAP_OPAQUE pintype_openemit_xpm[1]
pin for passive components: must be connected, and can be connected to any pin
unknown electrical properties: creates always a warning when connected
const BITMAP_OPAQUE pintype_notspecif_xpm[1]
not internally connected (may be connected to anything)
const BITMAP_OPAQUE pintype_noconnect_xpm[1]
const BITMAP_OPAQUE pintype_powerinput_xpm[1]
const BITMAP_OPAQUE pintype_nic_xpm[1]
Definition: pintype_nic.cpp:18
const BITMAP_OPAQUE pintype_passive_xpm[1]
const BITMAP_OPAQUE pintype_3states_xpm[1]
#define _(s)
Definition: 3d_actions.cpp:33
usual pin input: must be connected
input or output (like port for a microprocessor)
const BITMAP_OPAQUE pintype_poweroutput_xpm[1]
const BITMAP_OPAQUE pintype_opencoll_xpm[1]
not connected (must be left open)
const BITMAP_OPAQUE pintype_input_xpm[1]
output of a regulator: intended to be connected to power input pins
const BITMAP_OPAQUE pintype_output_xpm[1]

Definition at line 48 of file pin_type.cpp.

Referenced by ElectricalPinTypeGetBitmap(), and ElectricalPinTypeGetText().