KiCad PCB EDA Suite
sch_text.cpp File Reference

Code for handling schematic texts (texts, labels, hlabels and global labels). More...

#include <fctsys.h>
#include <sch_component.h>
#include <sch_edit_frame.h>
#include <plotter.h>
#include <msgpanel.h>
#include <gal/stroke_font.h>
#include <bitmaps.h>
#include <sch_text.h>
#include <schematic.h>
#include <netlist_object.h>
#include <settings/color_settings.h>
#include <sch_painter.h>
#include <default_values.h>
#include <wx/debug.h>
#include <html_messagebox.h>
#include <project/project_file.h>
#include <project/net_settings.h>

Go to the source code of this file.

Functions

void IncrementLabelMember (wxString &name, int aIncrement)
 
wxString getElectricalTypeLabel (PINSHEETLABEL_SHAPE aType)
 

Variables

static int TemplateIN_HN [] = { 6, 0, 0, -1, -1, -2, -1, -2, 1, -1, 1, 0, 0 }
 
static int TemplateIN_HI [] = { 6, 0, 0, 1, 1, 2, 1, 2, -1, 1, -1, 0, 0 }
 
static int TemplateIN_UP [] = { 6, 0, 0, 1, -1, 1, -2, -1, -2, -1, -1, 0, 0 }
 
static int TemplateIN_BOTTOM [] = { 6, 0, 0, 1, 1, 1, 2, -1, 2, -1, 1, 0, 0 }
 
static int TemplateOUT_HN [] = { 6, -2, 0, -1, 1, 0, 1, 0, -1, -1, -1, -2, 0 }
 
static int TemplateOUT_HI [] = { 6, 2, 0, 1, -1, 0, -1, 0, 1, 1, 1, 2, 0 }
 
static int TemplateOUT_UP [] = { 6, 0, -2, 1, -1, 1, 0, -1, 0, -1, -1, 0, -2 }
 
static int TemplateOUT_BOTTOM [] = { 6, 0, 2, 1, 1, 1, 0, -1, 0, -1, 1, 0, 2 }
 
static int TemplateUNSPC_HN [] = { 5, 0, -1, -2, -1, -2, 1, 0, 1, 0, -1 }
 
static int TemplateUNSPC_HI [] = { 5, 0, -1, 2, -1, 2, 1, 0, 1, 0, -1 }
 
static int TemplateUNSPC_UP [] = { 5, 1, 0, 1, -2, -1, -2, -1, 0, 1, 0 }
 
static int TemplateUNSPC_BOTTOM [] = { 5, 1, 0, 1, 2, -1, 2, -1, 0, 1, 0 }
 
static int TemplateBIDI_HN [] = { 5, 0, 0, -1, -1, -2, 0, -1, 1, 0, 0 }
 
static int TemplateBIDI_HI [] = { 5, 0, 0, 1, -1, 2, 0, 1, 1, 0, 0 }
 
static int TemplateBIDI_UP [] = { 5, 0, 0, -1, -1, 0, -2, 1, -1, 0, 0 }
 
static int TemplateBIDI_BOTTOM [] = { 5, 0, 0, -1, 1, 0, 2, 1, 1, 0, 0 }
 
static int Template3STATE_HN [] = { 5, 0, 0, -1, -1, -2, 0, -1, 1, 0, 0 }
 
static int Template3STATE_HI [] = { 5, 0, 0, 1, -1, 2, 0, 1, 1, 0, 0 }
 
static int Template3STATE_UP [] = { 5, 0, 0, -1, -1, 0, -2, 1, -1, 0, 0 }
 
static int Template3STATE_BOTTOM [] = { 5, 0, 0, -1, 1, 0, 2, 1, 1, 0, 0 }
 
static int * TemplateShape [5][4]
 

Detailed Description

Code for handling schematic texts (texts, labels, hlabels and global labels).

Definition in file sch_text.cpp.

Function Documentation

◆ getElectricalTypeLabel()

wxString getElectricalTypeLabel ( PINSHEETLABEL_SHAPE  aType)

Definition at line 460 of file sch_text.cpp.

461 {
462  switch( aType )
463  {
464  case PINSHEETLABEL_SHAPE::PS_INPUT: return _( "Input" );
465  case PINSHEETLABEL_SHAPE::PS_OUTPUT: return _( "Output" );
466  case PINSHEETLABEL_SHAPE::PS_BIDI: return _( "Bidirectional" );
467  case PINSHEETLABEL_SHAPE::PS_TRISTATE: return _( "Tri-State" );
468  case PINSHEETLABEL_SHAPE::PS_UNSPECIFIED: return _( "Passive" );
469  default: return wxT( "???" );
470  }
471 }
#define _(s)
Definition: 3d_actions.cpp:33

References _, PS_BIDI, PS_INPUT, PS_OUTPUT, PS_TRISTATE, and PS_UNSPECIFIED.

Referenced by SCH_TEXT::GetMsgPanelInfo(), and SCH_TEXT::GetShownText().

◆ IncrementLabelMember()

void IncrementLabelMember ( wxString &  name,
int  aIncrement 
)

Definition at line 52 of file sch_text.cpp.

53 {
54  int ii, nn;
55  long number = 0;
56 
57  ii = name.Len() - 1; nn = 0;
58 
59  if( !wxIsdigit( name.GetChar( ii ) ) )
60  return;
61 
62  while( ii >= 0 && wxIsdigit( name.GetChar( ii ) ) )
63  {
64  ii--;
65  nn++;
66  }
67 
68  ii++; /* digits are starting at ii position */
69  wxString litt_number = name.Right( nn );
70 
71  if( litt_number.ToLong( &number ) )
72  {
73  number += aIncrement;
74  name.Remove( ii ); name << number;
75  }
76 }
const char * name
Definition: DXF_plotter.cpp:60

References name.

Referenced by SCH_TEXT::IncrementLabel(), and LIB_PIN_TOOL::RepeatPin().

Variable Documentation

◆ Template3STATE_BOTTOM

int Template3STATE_BOTTOM[] = { 5, 0, 0, -1, 1, 0, 2, 1, 1, 0, 0 }
static

Definition at line 107 of file sch_text.cpp.

◆ Template3STATE_HI

int Template3STATE_HI[] = { 5, 0, 0, 1, -1, 2, 0, 1, 1, 0, 0 }
static

Definition at line 105 of file sch_text.cpp.

◆ Template3STATE_HN

int Template3STATE_HN[] = { 5, 0, 0, -1, -1, -2, 0, -1, 1, 0, 0 }
static

Definition at line 104 of file sch_text.cpp.

◆ Template3STATE_UP

int Template3STATE_UP[] = { 5, 0, 0, -1, -1, 0, -2, 1, -1, 0, 0 }
static

Definition at line 106 of file sch_text.cpp.

◆ TemplateBIDI_BOTTOM

int TemplateBIDI_BOTTOM[] = { 5, 0, 0, -1, 1, 0, 2, 1, 1, 0, 0 }
static

Definition at line 102 of file sch_text.cpp.

◆ TemplateBIDI_HI

int TemplateBIDI_HI[] = { 5, 0, 0, 1, -1, 2, 0, 1, 1, 0, 0 }
static

Definition at line 100 of file sch_text.cpp.

◆ TemplateBIDI_HN

int TemplateBIDI_HN[] = { 5, 0, 0, -1, -1, -2, 0, -1, 1, 0, 0 }
static

Definition at line 99 of file sch_text.cpp.

◆ TemplateBIDI_UP

int TemplateBIDI_UP[] = { 5, 0, 0, -1, -1, 0, -2, 1, -1, 0, 0 }
static

Definition at line 101 of file sch_text.cpp.

◆ TemplateIN_BOTTOM

int TemplateIN_BOTTOM[] = { 6, 0, 0, 1, 1, 1, 2, -1, 2, -1, 1, 0, 0 }
static

Definition at line 87 of file sch_text.cpp.

◆ TemplateIN_HI

int TemplateIN_HI[] = { 6, 0, 0, 1, 1, 2, 1, 2, -1, 1, -1, 0, 0 }
static

Definition at line 85 of file sch_text.cpp.

◆ TemplateIN_HN

int TemplateIN_HN[] = { 6, 0, 0, -1, -1, -2, -1, -2, 1, -1, 1, 0, 0 }
static

Definition at line 84 of file sch_text.cpp.

◆ TemplateIN_UP

int TemplateIN_UP[] = { 6, 0, 0, 1, -1, 1, -2, -1, -2, -1, -1, 0, 0 }
static

Definition at line 86 of file sch_text.cpp.

◆ TemplateOUT_BOTTOM

int TemplateOUT_BOTTOM[] = { 6, 0, 2, 1, 1, 1, 0, -1, 0, -1, 1, 0, 2 }
static

Definition at line 92 of file sch_text.cpp.

◆ TemplateOUT_HI

int TemplateOUT_HI[] = { 6, 2, 0, 1, -1, 0, -1, 0, 1, 1, 1, 2, 0 }
static

Definition at line 90 of file sch_text.cpp.

◆ TemplateOUT_HN

int TemplateOUT_HN[] = { 6, -2, 0, -1, 1, 0, 1, 0, -1, -1, -1, -2, 0 }
static

Definition at line 89 of file sch_text.cpp.

◆ TemplateOUT_UP

int TemplateOUT_UP[] = { 6, 0, -2, 1, -1, 1, 0, -1, 0, -1, -1, 0, -2 }
static

Definition at line 91 of file sch_text.cpp.

◆ TemplateShape

int* TemplateShape[5][4]
static
Initial value:
=
{
}
static int Template3STATE_HN[]
Definition: sch_text.cpp:104
static int TemplateUNSPC_HN[]
Definition: sch_text.cpp:94
static int Template3STATE_HI[]
Definition: sch_text.cpp:105
static int TemplateUNSPC_HI[]
Definition: sch_text.cpp:95
static int TemplateOUT_UP[]
Definition: sch_text.cpp:91
static int TemplateOUT_HN[]
Definition: sch_text.cpp:89
static int TemplateUNSPC_UP[]
Definition: sch_text.cpp:96
static int TemplateIN_UP[]
Definition: sch_text.cpp:86
static int TemplateOUT_HI[]
Definition: sch_text.cpp:90
static int TemplateBIDI_HI[]
Definition: sch_text.cpp:100
static int Template3STATE_BOTTOM[]
Definition: sch_text.cpp:107
static int TemplateIN_BOTTOM[]
Definition: sch_text.cpp:87
static int TemplateOUT_BOTTOM[]
Definition: sch_text.cpp:92
static int TemplateIN_HI[]
Definition: sch_text.cpp:85
static int Template3STATE_UP[]
Definition: sch_text.cpp:106
static int TemplateBIDI_HN[]
Definition: sch_text.cpp:99
static int TemplateBIDI_BOTTOM[]
Definition: sch_text.cpp:102
static int TemplateBIDI_UP[]
Definition: sch_text.cpp:101
static int TemplateUNSPC_BOTTOM[]
Definition: sch_text.cpp:97
static int TemplateIN_HN[]
Definition: sch_text.cpp:84

Definition at line 109 of file sch_text.cpp.

Referenced by SCH_HIERLABEL::CreateGraphicShape().

◆ TemplateUNSPC_BOTTOM

int TemplateUNSPC_BOTTOM[] = { 5, 1, 0, 1, 2, -1, 2, -1, 0, 1, 0 }
static

Definition at line 97 of file sch_text.cpp.

◆ TemplateUNSPC_HI

int TemplateUNSPC_HI[] = { 5, 0, -1, 2, -1, 2, 1, 0, 1, 0, -1 }
static

Definition at line 95 of file sch_text.cpp.

◆ TemplateUNSPC_HN

int TemplateUNSPC_HN[] = { 5, 0, -1, -2, -1, -2, 1, 0, 1, 0, -1 }
static

Definition at line 94 of file sch_text.cpp.

◆ TemplateUNSPC_UP

int TemplateUNSPC_UP[] = { 5, 1, 0, 1, -2, -1, -2, -1, 0, 1, 0 }
static

Definition at line 96 of file sch_text.cpp.