KiCad PCB EDA Suite
lib_pin.cpp File Reference
#include <wx/tokenzr.h>
#include <fctsys.h>
#include <pgm_base.h>
#include <gr_basic.h>
#include <macros.h>
#include <trigo.h>
#include <sch_draw_panel.h>
#include <gr_text.h>
#include <plotter.h>
#include <sch_edit_frame.h>
#include <base_units.h>
#include <msgpanel.h>
#include <math/util.h>
#include <general.h>
#include <lib_edit_frame.h>
#include <class_libentry.h>
#include <lib_pin.h>
#include <transform.h>
#include <sch_component.h>
#include <sch_sheet_path.h>
#include <settings/settings_manager.h>
#include <settings/color_settings.h>
#include <trace_helpers.h>
#include <libedit/libedit_settings.h>
#include <default_values.h>
#include "sch_painter.h"

Go to the source code of this file.

Macros

#define PIN_ORIENTATION_CNT   arrayDim( pin_orientation_codes )
 
#define PIN_TEXT_MARGIN   4
 
#define ETXT_MAX_SIZE   Millimeter2iu( 0.7 )
 

Functions

static const wxString getPinOrientationName (unsigned aPinOrientationCode)
 
static int internalPinDecoSize (RENDER_SETTINGS *aSettings, const LIB_PIN &aPin)
 Utility for getting the size of the 'internal' pin decorators (as a radius) More...
 
static int externalPinDecoSize (RENDER_SETTINGS *aSettings, const LIB_PIN &aPin)
 Utility for getting the size of the 'external' pin decorators (as a radius) More...
 

Variables

static const int pin_orientation_codes []
 
static const BITMAP_DEF iconsPinsOrientations []
 

Macro Definition Documentation

◆ ETXT_MAX_SIZE

#define ETXT_MAX_SIZE   Millimeter2iu( 0.7 )

◆ PIN_ORIENTATION_CNT

#define PIN_ORIENTATION_CNT   arrayDim( pin_orientation_codes )

Definition at line 67 of file lib_pin.cpp.

◆ PIN_TEXT_MARGIN

#define PIN_TEXT_MARGIN   4

Definition at line 70 of file lib_pin.cpp.

Function Documentation

◆ externalPinDecoSize()

static int externalPinDecoSize ( RENDER_SETTINGS aSettings,
const LIB_PIN aPin 
)
static

Utility for getting the size of the 'external' pin decorators (as a radius)

Definition at line 150 of file lib_pin.cpp.

151 {
152  KIGFX::SCH_RENDER_SETTINGS* settings = static_cast<KIGFX::SCH_RENDER_SETTINGS*>( aSettings );
153 
154  if( settings && settings->m_PinSymbolSize )
155  return settings->m_PinSymbolSize;
156 
157  return aPin.GetNumberTextSize() / 2;
158 }
int GetNumberTextSize() const
Definition: lib_pin.h:204
SCH_RENDER_SETTINGS Stores schematic-specific render settings.
Definition: sch_painter.h:70

References LIB_PIN::GetNumberTextSize(), and KIGFX::SCH_RENDER_SETTINGS::m_PinSymbolSize.

Referenced by LIB_PIN::GetBoundingBox(), LIB_PIN::PlotSymbol(), and LIB_PIN::printPinSymbol().

◆ getPinOrientationName()

static const wxString getPinOrientationName ( unsigned  aPinOrientationCode)
static

Definition at line 112 of file lib_pin.cpp.

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

References _, and PIN_ORIENTATION_CNT.

Referenced by LIB_PIN::getMsgPanelInfoBase(), and LIB_PIN::GetOrientationNames().

◆ internalPinDecoSize()

static int internalPinDecoSize ( RENDER_SETTINGS aSettings,
const LIB_PIN aPin 
)
static

Utility for getting the size of the 'internal' pin decorators (as a radius)

Definition at line 137 of file lib_pin.cpp.

138 {
139  KIGFX::SCH_RENDER_SETTINGS* settings = static_cast<KIGFX::SCH_RENDER_SETTINGS*>( aSettings );
140 
141  if( settings && settings->m_PinSymbolSize )
142  return settings->m_PinSymbolSize;
143 
144  return aPin.GetNameTextSize() != 0 ? aPin.GetNameTextSize() / 2 : aPin.GetNumberTextSize() / 2;
145 }
int GetNameTextSize() const
Definition: lib_pin.h:201
int GetNumberTextSize() const
Definition: lib_pin.h:204
SCH_RENDER_SETTINGS Stores schematic-specific render settings.
Definition: sch_painter.h:70

References LIB_PIN::GetNameTextSize(), LIB_PIN::GetNumberTextSize(), and KIGFX::SCH_RENDER_SETTINGS::m_PinSymbolSize.

Referenced by LIB_PIN::PlotSymbol(), and LIB_PIN::printPinSymbol().

Variable Documentation

◆ 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 74 of file lib_pin.cpp.

Referenced by LIB_PIN::GetOrientationSymbols().

◆ pin_orientation_codes

const int pin_orientation_codes[]
static
Initial value:

Definition at line 60 of file lib_pin.cpp.

Referenced by LIB_PIN::GetOrientationCode(), and LIB_PIN::GetOrientationIndex().