57 wxString outputFormat;
58 wxString outputNumber;
59 int ii =
name.Len() - 1;
62 while( ii >= 0 && !wxIsdigit(
name.GetChar( ii ) ) )
64 suffix =
name.GetChar( ii ) + suffix;
68 while( ii >= 0 && wxIsdigit(
name.GetChar( ii ) ) )
70 digits =
name.GetChar( ii ) + digits;
75 if( digits.IsEmpty() )
80 if( digits.ToLong( &number ) )
88 name.Remove( ii + 1 );
90 outputFormat.Printf( wxS(
"%%0%dld" ), dCount );
92 outputNumber.Printf( outputFormat, number );
93 name << outputNumber << suffix;
107static int TemplateIN_HN[] = { 6, 0, 0, -1, -1, -2, -1, -2, 1, -1, 1, 0, 0 };
108static int TemplateIN_HI[] = { 6, 0, 0, 1, 1, 2, 1, 2, -1, 1, -1, 0, 0 };
109static int TemplateIN_UP[] = { 6, 0, 0, 1, -1, 1, -2, -1, -2, -1, -1, 0, 0 };
110static int TemplateIN_BOTTOM[] = { 6, 0, 0, 1, 1, 1, 2, -1, 2, -1, 1, 0, 0 };
112static int TemplateOUT_HN[] = { 6, -2, 0, -1, 1, 0, 1, 0, -1, -1, -1, -2, 0 };
113static int TemplateOUT_HI[] = { 6, 2, 0, 1, -1, 0, -1, 0, 1, 1, 1, 2, 0 };
114static int TemplateOUT_UP[] = { 6, 0, -2, 1, -1, 1, 0, -1, 0, -1, -1, 0, -2 };
115static int TemplateOUT_BOTTOM[] = { 6, 0, 2, 1, 1, 1, 0, -1, 0, -1, 1, 0, 2 };
117static int TemplateUNSPC_HN[] = { 5, 0, -1, -2, -1, -2, 1, 0, 1, 0, -1 };
118static int TemplateUNSPC_HI[] = { 5, 0, -1, 2, -1, 2, 1, 0, 1, 0, -1 };
119static int TemplateUNSPC_UP[] = { 5, 1, 0, 1, -2, -1, -2, -1, 0, 1, 0 };
120static int TemplateUNSPC_BOTTOM[] = { 5, 1, 0, 1, 2, -1, 2, -1, 0, 1, 0 };
122static int TemplateBIDI_HN[] = { 5, 0, 0, -1, -1, -2, 0, -1, 1, 0, 0 };
123static int TemplateBIDI_HI[] = { 5, 0, 0, 1, -1, 2, 0, 1, 1, 0, 0 };
124static int TemplateBIDI_UP[] = { 5, 0, 0, -1, -1, 0, -2, 1, -1, 0, 0 };
125static int TemplateBIDI_BOTTOM[] = { 5, 0, 0, -1, 1, 0, 2, 1, 1, 0, 0 };
127static int Template3STATE_HN[] = { 5, 0, 0, -1, -1, -2, 0, -1, 1, 0, 0 };
128static int Template3STATE_HI[] = { 5, 0, 0, 1, -1, 2, 0, 1, 1, 0, 0 };
129static int Template3STATE_UP[] = { 5, 0, 0, -1, -1, 0, -2, 1, -1, 0, 0 };
130static int Template3STATE_BOTTOM[] = { 5, 0, 0, -1, 1, 0, 2, 1, 1, 0, 0 };
151 default:
return wxT(
"???" );
208 m_isDangling( true ),
221 m_shape( aLabel.m_shape ),
222 m_connectionType( aLabel.m_connectionType ),
223 m_isDangling( aLabel.m_isDangling ),
224 m_lastResolvedColor( aLabel.m_lastResolvedColor ),
225 m_cached_driver_name( aLabel.m_cached_driver_name )
232 field.SetParent(
this );
248 if( aName == wxT(
"Intersheetrefs" ) )
249 return _(
"Sheet References" );
250 else if( aName == wxT(
"Netclass" ) )
251 return _(
"Net Class" );
252 else if( aName.IsEmpty() && aUseDefaultName )
264 for(
KICAD_T scanType : aScanTypes )
270 wxCHECK_MSG(
Schematic(),
false, wxT(
"No parent SCHEMATIC set for SCH_LABEL!" ) );
279 for(
KICAD_T scanType : aScanTypes )
283 for(
SCH_ITEM* connection : item_set )
285 if( connection->IsType( { SCH_ITEM_LOCATE_WIRE_T, SCH_PIN_T } ) )
292 for(
SCH_ITEM* connection : item_set )
294 if( connection->IsType( { SCH_ITEM_LOCATE_BUS_T } ) )
314 field.SetParent(
this );
344 wxFAIL_MSG(
"Bad spin style" );
422 field.Offset( aMoveVector );
437 field.SetTextPos( field.GetTextPos() + offset );
453 if( field.GetTextAngle().IsVertical()
461 else if( field.GetTextAngle().IsVertical()
469 else if( field.GetTextAngle().IsHorizontal()
477 else if( field.GetTextAngle().IsHorizontal()
488 field.SetTextPos( pos );
500 if( ( aLeftRight && field.GetTextAngle().IsHorizontal() )
501 || ( !aLeftRight && field.GetTextAngle().IsVertical() ) )
517 field.SetTextPos( pos );
529 switch( field.GetHorizJustify() )
547 field.SetPosition( pos );
563 field.SetPosition( pos );
602 if( field.GetCanonicalName() == wxT(
"Intersheetrefs" ) )
603 offset.
x = - ( labelLen + margin );
605 offset.
y = accumulated + field.GetTextHeight() / 2;
613 if( field.GetCanonicalName() == wxT(
"Intersheetrefs" ) )
614 offset.
y = - ( labelLen + margin );
616 offset.
x = accumulated + field.GetTextHeight() / 2;
624 if( field.GetCanonicalName() == wxT(
"Intersheetrefs" ) )
625 offset.
x = labelLen + margin;
627 offset.
y = accumulated + field.GetTextHeight() / 2;
635 if( field.GetCanonicalName() == wxT(
"Intersheetrefs" ) )
636 offset.
y = labelLen + margin;
638 offset.
x = accumulated + field.GetTextHeight() / 2;
645 if( field.GetCanonicalName() != wxT(
"Intersheetrefs" ) )
646 accumulated += field.GetTextHeight() + margin;
661 if( it !=
Schematic()->GetPageRefsMap().end() )
663 std::vector<int> pageListCopy;
665 pageListCopy.insert( pageListCopy.end(), it->second.begin(), it->second.end() );
667 if( !
Schematic()->Settings().m_IntersheetRefsListOwnPage )
672 if( pageListCopy.empty() )
676 std::sort( pageListCopy.begin(), pageListCopy.end() );
681 for(
int pageNum : pageListCopy )
682 pages->push_back( { sheetPages[ pageNum ], sheetNames[ pageNum ] } );
691 aVars->push_back( field.GetCanonicalName().Upper() );
693 aVars->push_back( wxT(
"OP" ) );
694 aVars->push_back( wxT(
"CONNECTION_TYPE" ) );
695 aVars->push_back( wxT(
"SHORT_NET_NAME" ) );
696 aVars->push_back( wxT(
"NET_NAME" ) );
697 aVars->push_back( wxT(
"NET_CLASS" ) );
704 static wxRegEx operatingPoint( wxT(
"^"
706 "(.([0-9])?([a-zA-Z]*))?"
712 if( operatingPoint.Matches( *token ) )
715 wxString precisionStr( operatingPoint.GetMatch( *token, 2 ) );
716 wxString range( operatingPoint.GetMatch( *token, 3 ) );
718 if( !precisionStr.IsEmpty() )
719 precision = precisionStr[0] -
'0';
721 if( range.IsEmpty() )
733 if( token->Contains(
':' ) )
735 if(
Schematic()->ResolveCrossReference( token, aDepth + 1 ) )
740 && token->IsSameAs( wxT(
"CONNECTION_TYPE" ) ) )
746 else if( token->IsSameAs( wxT(
"SHORT_NET_NAME" ) ) )
749 *token = wxEmptyString;
756 else if( token->IsSameAs( wxT(
"NET_NAME" ) ) )
759 *token = wxEmptyString;
762 *token = connection->
Name();
766 else if( token->IsSameAs( wxT(
"NET_CLASS" ) ) )
769 *token = wxEmptyString;
779 if( token->IsSameAs( field.GetName() ) )
781 *token = field.GetShownText(
false, aDepth + 1 );
795 else if( aPath && aPath->
Last() )
802 if( sheet->ResolveTextVar( aPath, token, aDepth + 1 ) )
834 std::function<bool( wxString* )> textResolver =
835 [&]( wxString* token ) ->
bool
842 if(
text == wxS(
"~" ) )
880 const std::vector<KICAD_T>& aScanTypes )
882 if(
IsType( aScanTypes ) )
884 if( INSPECT_RESULT::QUIT == aInspector(
this,
nullptr ) )
885 return INSPECT_RESULT::QUIT;
888 for(
KICAD_T scanType : aScanTypes )
894 if( INSPECT_RESULT::QUIT == aInspector( &field,
this ) )
895 return INSPECT_RESULT::QUIT;
900 return INSPECT_RESULT::CONTINUE;
907 aItemList.push_back( item );
948 std::vector<VECTOR2I> pts;
969 if( field.IsVisible() )
971 BOX2I fieldBBox = field.GetBoundingBox();
976 box.
Merge( fieldBBox );
996 if( field.IsVisible() )
998 BOX2I fieldBBox = field.GetBoundingBox();
999 fieldBBox.
Inflate( aAccuracy );
1004 if( fieldBBox.
Contains( aPosition ) )
1030 if( field.IsVisible() )
1032 BOX2I fieldBBox = field.GetBoundingBox();
1054 for(
unsigned ii = 0; ii < aItemList.size(); ii++ )
1101 sch_item->AddConnectionTo( *aPath,
this );
1143 aList.emplace_back(
_(
"Font" ),
GetFont() ?
GetFont()->GetName() :
_(
"Default" ) );
1145 wxString textStyle[] = {
_(
"Normal" ),
_(
"Italic" ),
_(
"Bold" ),
_(
"Bold Italic" ) };
1147 aList.emplace_back(
_(
"Style" ), textStyle[style] );
1157 default: msg = wxT(
"???" );
break;
1160 aList.emplace_back(
_(
"Justification" ), msg );
1171 if( !conn->
IsBus() )
1173 aList.emplace_back(
_(
"Resolved Netclass" ),
1182 static std::vector<VECTOR2I> s_poly;
1216 if(
GetShape() == LABEL_FLAG_SHAPE::F_DOT )
1218 aPlotter->
MoveTo( s_poly[0] );
1219 aPlotter->
LineTo( s_poly[1] );
1222 int diameter = ( s_poly[2] - s_poly[1] ).
EuclideanNorm() * 2;
1225 else if(
GetShape() == LABEL_FLAG_SHAPE::F_ROUND )
1227 aPlotter->
MoveTo( s_poly[0] );
1228 aPlotter->
LineTo( s_poly[1] );
1231 int diameter = ( s_poly[2] - s_poly[1] ).
EuclideanNorm() * 2;
1236 if( !s_poly.empty() )
1237 aPlotter->
PlotPoly( s_poly, FILL_T::NO_FILL, penWidth );
1241 std::vector<wxString> properties;
1245 properties.emplace_back( wxString::Format( wxT(
"!%s = %s" ),
_(
"Net" ),
1246 connection->
Name() ) );
1248 properties.emplace_back( wxString::Format( wxT(
"!%s = %s" ),
_(
"Resolved netclass" ),
1254 properties.emplace_back( wxString::Format( wxT(
"!%s = %s" ), field.GetName(),
1255 field.GetShownText(
false ) ) );
1258 if( !properties.empty() )
1264 _(
"Hierarchical Labels" ) );
1269 field.Plot( aPlotter, aBackground );
1275 static std::vector<VECTOR2I> s_poly;
1285 if( !blackAndWhiteMode &&
GetTextColor() != COLOR4D::UNSPECIFIED )
1292 if(
GetShape() == LABEL_FLAG_SHAPE::F_DOT )
1294 GRLine( DC, s_poly[0], s_poly[1], penWidth,
color );
1299 else if(
GetShape() == LABEL_FLAG_SHAPE::F_ROUND )
1301 GRLine( DC, s_poly[0], s_poly[1], penWidth,
color );
1308 if( !s_poly.empty() )
1313 field.Print( aSettings, aOffset );
1330 m_shape = LABEL_FLAG_SHAPE::L_INPUT;
1372 return BITMAPS::add_line_label;
1380 m_shape = LABEL_FLAG_SHAPE::F_ROUND;
1426 if( ( aLeftRight && field.GetTextAngle().IsHorizontal() )
1427 || ( !aLeftRight && field.GetTextAngle().IsVertical() ) )
1443 field.SetTextPos( pos );
1461 switch( field.GetHorizJustify() )
1479 field.SetPosition( pos );
1501 field.SetPosition( pos );
1507 std::vector<VECTOR2I>& aPoints,
1516 case LABEL_FLAG_SHAPE::F_DOT:
1517 symbolSize =
KiROUND( symbolSize * 0.7 );
1520 case LABEL_FLAG_SHAPE::F_ROUND:
1522 aPoints.emplace_back(
VECTOR2I( 0, 0 ) );
1531 case LABEL_FLAG_SHAPE::F_DIAMOND:
1532 aPoints.emplace_back(
VECTOR2I( 0, 0 ) );
1538 aPoints.emplace_back(
VECTOR2I( 0, 0 ) );
1541 case LABEL_FLAG_SHAPE::F_RECTANGLE:
1542 symbolSize =
KiROUND( symbolSize * 0.8 );
1544 aPoints.emplace_back(
VECTOR2I( 0, 0 ) );
1551 aPoints.emplace_back(
VECTOR2I( 0, 0 ) );
1581 if(
m_shape == LABEL_FLAG_SHAPE::F_DIAMOND ||
m_shape == LABEL_FLAG_SHAPE::F_RECTANGLE )
1585 margin =
KiROUND( margin * 1.5 );
1596 offset = { symbolWidth + margin, origin };
1601 offset = { -origin, -( symbolWidth + margin ) };
1606 offset = { symbolWidth + margin, -origin };
1611 offset = { origin, -( symbolWidth + margin ) };
1618 origin -= field.GetTextHeight() + margin;
1629 return _(
"Directive Label" );
1633 return wxString::Format(
_(
"Directive Label [%s %s]" ),
1644 m_shape = LABEL_FLAG_SHAPE::L_BIDI;
1650 m_fields[0].SetText( wxT(
"${INTERSHEET_REFS}" ) );
1672 case LABEL_FLAG_SHAPE::L_INPUT:
1673 case LABEL_FLAG_SHAPE::L_BIDI:
1674 case LABEL_FLAG_SHAPE::L_TRISTATE:
1678 case LABEL_FLAG_SHAPE::L_OUTPUT:
1679 case LABEL_FLAG_SHAPE::L_UNSPECIFIED:
1705 if( token->IsSameAs( wxT(
"INTERSHEET_REFS" ) ) &&
Schematic() )
1711 if( it ==
Schematic()->GetPageRefsMap().end() )
1717 std::vector<int> pageListCopy;
1719 pageListCopy.insert( pageListCopy.end(), it->second.begin(), it->second.end() );
1720 std::sort( pageListCopy.begin(), pageListCopy.end() );
1732 ref.Append( wxString::Format( wxT(
"%s..%s" ),
1733 sheetPages[pageListCopy.front()],
1734 sheetPages[pageListCopy.back()] ) );
1738 for(
const int& pageNo : pageListCopy )
1739 ref.Append( wxString::Format( wxT(
"%s," ), sheetPages[pageNo] ) );
1741 if( !ref.IsEmpty() && ref.Last() ==
',' )
1767 std::vector<VECTOR2I>& aPoints,
1775 int x = symb_len + linewidth + 3;
1776 int y = halfSize + linewidth + 3;
1781 aPoints.emplace_back(
VECTOR2I( 0, 0 ) );
1782 aPoints.emplace_back(
VECTOR2I( 0, -y ) );
1783 aPoints.emplace_back(
VECTOR2I( -x, -y ) );
1784 aPoints.emplace_back(
VECTOR2I( -x, 0 ) );
1785 aPoints.emplace_back(
VECTOR2I( -x, y ) );
1786 aPoints.emplace_back(
VECTOR2I( 0, y ) );
1792 case LABEL_FLAG_SHAPE::L_INPUT:
1793 x_offset = -halfSize;
1794 aPoints[0].x += halfSize;
1797 case LABEL_FLAG_SHAPE::L_OUTPUT:
1798 aPoints[3].x -= halfSize;
1801 case LABEL_FLAG_SHAPE::L_BIDI:
1802 case LABEL_FLAG_SHAPE::L_TRISTATE:
1803 x_offset = -halfSize;
1804 aPoints[0].x += halfSize;
1805 aPoints[3].x -= halfSize;
1808 case LABEL_FLAG_SHAPE::L_UNSPECIFIED:
1816 aPoint.x += x_offset;
1830 aPoints.push_back( aPoints[0] );
1842 return BITMAPS::add_glabel;
1850 m_shape = LABEL_FLAG_SHAPE::L_INPUT;
1863 std::vector<VECTOR2I>& aPoints,
const VECTOR2I& aPos )
const
1870 std::vector<VECTOR2I>& aPoints,
const VECTOR2I& aPos,
1875 int imax = *Template;
1880 for(
int ii = 0; ii < imax; ii++ )
1883 corner.
x = ( halfSize * (*Template) ) + aPos.
x;
1886 corner.
y = ( halfSize * (*Template) ) + aPos.
y;
1889 aPoints.push_back( corner );
1969 return wxString::Format(
_(
"Hierarchical Label '%s'" ),
1976 return BITMAPS::add_hierarchical_label;
1987 wxSize sz( 320, 320 );
1989 dlg->SetMinSize( dlg->ConvertDialogToPixels( sz ) );
constexpr EDA_IU_SCALE schIUScale
BITMAPS
A list of all bitmap identifiers.
void SetOrigin(const Vec &pos)
BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
const Vec & GetOrigin() const
void Offset(coord_type dx, coord_type dy)
bool Intersects(const BOX2< Vec > &aRect) const
coord_type GetWidth() const
bool Contains(const Vec &aPoint) const
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
void SetEnd(coord_type x, coord_type y)
BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Helper class used to store the state of schematic items that can be connected to other schematic item...
DANGLING_END_T GetType() const
EDA_ITEM * GetItem() const
VECTOR2I GetPosition() const
The base class for create windows for drawing purpose.
KICAD_T Type() const
Returns the type of object.
virtual bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const
Compare the item against the search criteria in aSearchData.
virtual void SetParent(EDA_ITEM *aParent)
EDA_ITEM * m_parent
Linked list: Link (parent struct)
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
int GetTextHeight() const
BOX2I GetTextBox(int aLine=-1, bool aInvertY=false) const
Useful in multiline texts to calculate the full text or a line area (for zones filling,...
const VECTOR2I & GetTextPos() const
COLOR4D GetTextColor() const
const EDA_ANGLE & GetTextAngle() const
virtual const wxString & GetText() const
Return the string associated with the text object.
void SetTextPos(const VECTOR2I &aPoint)
KIFONT::FONT * GetFont() const
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
GR_TEXT_H_ALIGN_T GetHorizJustify() const
bool Replace(const EDA_SEARCH_DATA &aSearchData)
Helper function used in search and replace dialog.
bool HasTextVars() const
Indicates the ShownText has text var references which need to be processed.
virtual void cacheShownText()
const TEXT_ATTRIBUTES & GetAttributes() const
int GetEffectiveTextPenWidth(int aDefaultPenWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultPenWidth.
virtual wxString GetShownText(bool aAllowExtraText, int aDepth=0) const
Return the string actually shown after processing of the base text.
virtual void SetText(const wxString &aText)
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
void Print(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset, const COLOR4D &aColor, OUTLINE_MODE aDisplay_mode=FILLED)
Print this text object to the device context aDC.
void SetMultilineAllowed(bool aAllow)
VECTOR2I GetTextSize() const
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
void SetDialogSizeInDU(int aWidth, int aHeight)
Set the dialog size, using a "logical" value.
void AddHTML_Text(const wxString &message)
Add HTML text (without any change) to message list.
void ShowModeless()
Show a modeless version of the dialog (without an OK button).
FONT is an abstract base class for both outline and stroke fonts.
static FONT * GetFont(const wxString &aFontName=wxEmptyString, bool aBold=false, bool aItalic=false)
A color representation with 4 components: red, green, blue, alpha.
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
int GetDefaultPenWidth() const
int GetMinPenWidth() const
const wxString & GetDefaultFont() const
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
wxDC * GetPrintDC() const
Store schematic specific render settings.
Base plotter engine class.
virtual void ThickCircle(const VECTOR2I &pos, int diametre, int width, OUTLINE_MODE tracemode, void *aData)
virtual void FilledCircle(const VECTOR2I &pos, int diametre, OUTLINE_MODE tracemode, void *aData)
void MoveTo(const VECTOR2I &pos)
RENDER_SETTINGS * RenderSettings()
virtual void Bookmark(const BOX2I &aBox, const wxString &aName, const wxString &aGroupName=wxEmptyString)
Create a bookmark to a symbol.
bool GetColorMode() const
virtual void SetCurrentLineWidth(int width, void *aData=nullptr)=0
Set the line width for the next drawing.
void LineTo(const VECTOR2I &pos)
virtual void PlotPoly(const std::vector< VECTOR2I > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=nullptr)=0
Draw a polygon ( filled or not ).
virtual void HyperlinkMenu(const BOX2I &aBox, const std::vector< wxString > &aDestURLs)
Create a clickable hyperlink menu with a rectangular click area.
virtual void PlotText(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const TEXT_ATTRIBUTES &aAttributes, KIFONT::FONT *aFont, const KIFONT::METRICS &aFontMetrics, void *aData=nullptr)
Provide class metadata.Helper macro to map type hashes to names.
void InheritsAfter(TYPE_ID aDerived, TYPE_ID aBase)
Declare an inheritance relationship between types.
void Mask(TYPE_ID aDerived, TYPE_ID aBase, const wxString &aName)
Sets a base class property as masked in a derived class.
static PROPERTY_MANAGER & Instance()
void AddTypeCast(TYPE_CAST_BASE *aCast)
Register a type converter.
These settings were stored in SCH_BASE_FRAME previously.
wxString m_IntersheetRefsPrefix
wxString m_IntersheetRefsSuffix
bool m_IntersheetRefsFormatShort
bool m_IntersheetRefsListOwnPage
SCH_SHEET_PATH & CurrentSheet() const override
wxString GetOperatingPoint(const wxString &aNetName, int aPrecision, const wxString &aRange)
SCHEMATIC_SETTINGS & Settings() const
std::map< wxString, std::set< int > > & GetPageRefsMap()
std::map< int, wxString > GetVirtualPageToSheetPagesMap() const
std::map< int, wxString > GetVirtualPageToSheetNamesMap() const
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
wxString LocalName() const
wxString Name(bool aIgnoreSheet=false) const
void AppendInfoToMsgPanel(std::vector< MSG_PANEL_ITEM > &aList) const
Adds information about the connection object to aList.
void MirrorSpinStyle(bool aLeftRight) override
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
SCH_DIRECTIVE_LABEL(const VECTOR2I &aPos=VECTOR2I(0, 0))
void CreateGraphicShape(const RENDER_SETTINGS *aSettings, std::vector< VECTOR2I > &aPoints, const VECTOR2I &aPos) const override
Calculate the graphic shape (a polygon) associated to the text.
int GetPenWidth() const override
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
Schematic editor (Eeschema) main window.
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the layers the item is drawn on (which may be more than its "home" layer)
void CreateGraphicShape(const RENDER_SETTINGS *aRenderSettings, std::vector< VECTOR2I > &aPoints, const VECTOR2I &aPos) const override
Calculate the graphic shape (a polygon) associated to the text.
bool ResolveTextVar(const SCH_SHEET_PATH *aPath, wxString *token, int aDepth) const override
Resolve any references to system tokens supported by the label.
VECTOR2I GetSchematicTextOffset(const RENDER_SETTINGS *aSettings) const override
This offset depends on the orientation, the type of text, and the area required to draw the associate...
void SetSpinStyle(SPIN_STYLE aSpinStyle) override
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
SCH_GLOBALLABEL(const VECTOR2I &aPos=VECTOR2I(0, 0), const wxString &aText=wxEmptyString)
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
const BOX2I GetBodyBoundingBox() const override
Return the bounding box of the label only, without taking in account its fields.
void SetSpinStyle(SPIN_STYLE aSpinStyle) override
void CreateGraphicShape(const RENDER_SETTINGS *aSettings, std::vector< VECTOR2I > &aPoints, const VECTOR2I &aPos) const override
Calculate the graphic shape (a polygon) associated to the text.
SCH_HIERLABEL(const VECTOR2I &aPos=VECTOR2I(0, 0), const wxString &aText=wxEmptyString, KICAD_T aType=SCH_HIER_LABEL_T)
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
VECTOR2I GetSchematicTextOffset(const RENDER_SETTINGS *aSettings) const override
This offset depends on the orientation, the type of text, and the area required to draw the associate...
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
Base class for any item which can be embedded within the SCHEMATIC container class,...
SCH_ITEM & operator=(const SCH_ITEM &aPin)
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
void AddConnectionTo(const SCH_SHEET_PATH &aPath, SCH_ITEM *aItem)
Add a connection link between this item and another.
std::map< SCH_SHEET_PATH, SCH_ITEM_SET, SHEET_PATH_CMP > m_connected_items
Store pointers to other items that are connected to this one, per sheet.
std::shared_ptr< NETCLASS > GetEffectiveNetClass(const SCH_SHEET_PATH *aSheet=nullptr) const
void ClearFieldsAutoplaced()
FIELDS_AUTOPLACED m_fieldsAutoplaced
bool IsConnectivityDirty() const
SCH_CONNECTION * Connection(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve the connection associated with this object in the given sheet.
const KIFONT::METRICS & GetFontMetrics() const
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
const wxString & GetCachedDriverName() const override
SCH_LABEL_BASE(const VECTOR2I &aPos, const wxString &aText, KICAD_T aType)
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the layers the item is drawn on (which may be more than its "home" layer)
COLOR4D m_lastResolvedColor
wxString GetShownText(const SCH_SHEET_PATH *aPath, bool aAllowExtraText, int aDepth=0) const override
void Move(const VECTOR2I &aMoveVector) override
Move the item by aMoveVector to a new position.
INSPECT_RESULT Visit(INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &scanTypes) override
May be re-implemented for each derived class in order to handle all the types given by its member dat...
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
bool HasCachedDriverName() const override
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
void GetEndPoints(std::vector< DANGLING_END_ITEM > &aItemList) override
Add the schematic item end points to aItemList if the item has end points.
bool AutoRotateOnPlacement() const
autoRotateOnPlacement
void Rotate(const VECTOR2I &aCenter) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
SCH_LABEL_BASE & operator=(const SCH_LABEL_BASE &aLabel)
std::vector< SCH_FIELD > m_fields
CONNECTION_TYPE m_connectionType
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
SPIN_STYLE GetSpinStyle() const
void GetIntersheetRefs(std::vector< std::pair< wxString, wxString > > *pages)
Builds an array of { pageNumber, pageName } pairs.
void MirrorSpinStyle(bool aLeftRight) override
std::vector< VECTOR2I > GetConnectionPoints() const override
Add all the connection points for this item to aPoints.
COLOR4D GetLabelColor() const
LABEL_FLAG_SHAPE GetShape() const
const BOX2I GetBoundingBox() const override
Return the bounding box of the label including its fields.
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
void SetPosition(const VECTOR2I &aPosition) override
virtual bool ResolveTextVar(const SCH_SHEET_PATH *aPath, wxString *token, int aDepth) const
Resolve any references to system tokens supported by the label.
bool m_autoRotateOnPlacement
wxString m_cached_driver_name
void Print(const RENDER_SETTINGS *aSettings, const VECTOR2I &offset) override
Print a schematic item.
int GetLabelBoxExpansion(const RENDER_SETTINGS *aSettings=nullptr) const
bool IncrementLabel(int aIncrement)
Increment the label text, if it ends with a number.
void SetAutoRotateOnPlacement(bool autoRotate=true)
setAutoRotateOnPlacement
void cacheShownText() override
void Rotate90(bool aClockwise) override
bool UpdateDanglingState(std::vector< DANGLING_END_ITEM > &aItemList, const SCH_SHEET_PATH *aPath=nullptr) override
Test the schematic item to aItemList to check if it's dangling state has changed.
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
static const wxString GetDefaultFieldName(const wxString &aName, bool aUseDefaultName)
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction) override
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars & fields for this label.
virtual const BOX2I GetBodyBoundingBox() const
Return the bounding box of the label only, without taking in account its fields.
virtual void CreateGraphicShape(const RENDER_SETTINGS *aSettings, std::vector< VECTOR2I > &aPoints, const VECTOR2I &Pos) const
Calculate the graphic shape (a polygon) associated to the text.
std::vector< SCH_FIELD > & GetFields()
VECTOR2I GetSchematicTextOffset(const RENDER_SETTINGS *aSettings) const override
This offset depends on the orientation, the type of text, and the area required to draw the associate...
virtual void SetSpinStyle(SPIN_STYLE aSpinStyle)
void Plot(PLOTTER *aPlotter, bool aBackground) const override
Plot the schematic item to aPlotter.
bool Replace(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) override
Perform a text replace using the find and replace criteria in aSearchData on items that support text ...
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
SCH_LABEL(const VECTOR2I &aPos=VECTOR2I(0, 0), const wxString &aText=wxEmptyString)
const BOX2I GetBodyBoundingBox() const override
Return the bounding box of the label only, without taking in account its fields.
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
int GetVirtualPageNumber() const
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
bool ResolveTextVar(const SCH_SHEET_PATH *aPath, wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the sheet.
void Move(const VECTOR2I &aMoveVector) override
Move the item by aMoveVector to a new position.
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
static HTML_MESSAGE_BOX * ShowSyntaxHelp(wxWindow *aParentWindow)
VECTOR2I GetPosition() const override
virtual void Rotate90(bool aClockwise)
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
int GetPenWidth() const override
virtual void MirrorSpinStyle(bool aLeftRight)
int GetTextOffset(const RENDER_SETTINGS *aSettings=nullptr) const
SPIN_STYLE MirrorX()
Mirror the label spin style across the X axis or simply swaps up and bottom.
SPIN_STYLE MirrorY()
Mirror the label spin style across the Y axis or simply swaps left and right.
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
A lower-precision version of StringFromValue().
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject)
#define DEFAULT_LABEL_SIZE_RATIO
The offset of the pin name string from the end of the pin in mils.
#define DANGLING_SYMBOL_SIZE
< The size of the rectangle indicating an unconnected wire or label
static constexpr EDA_ANGLE & ANGLE_180
static constexpr EDA_ANGLE & ANGLE_HORIZONTAL
static constexpr EDA_ANGLE & ANGLE_VERTICAL
static constexpr EDA_ANGLE & ANGLE_90
const INSPECTOR_FUNC & INSPECTOR
void GRCircle(wxDC *aDC, const VECTOR2I &aPos, int aRadius, int aWidth, const COLOR4D &aColor)
void GRLine(wxDC *DC, int x1, int y1, int x2, int y2, int width, const COLOR4D &Color, wxPenStyle aStyle)
void GRPoly(wxDC *DC, int n, const VECTOR2I *Points, bool Fill, int width, const COLOR4D &Color, const COLOR4D &BgColor)
Draw a new polyline and fill it if Fill, in drawing space.
bool GetGRForceBlackPenState(void)
void GRFilledCircle(wxDC *aDC, const VECTOR2I &aPos, int aRadius, int aWidth, const COLOR4D &aStrokeColor, const COLOR4D &aFillColor)
Draw a circle onto the drawing context aDC centered at the user coordinates (x,y).
@ LAYER_SELECTION_SHADOWS
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
T MIRRORVAL(T aPoint, T aMirrorRef)
Returns the mirror of aPoint relative to the aMirrorRef.
Message panel definition file.
wxString EllipsizeMenuText(const wxString &aString)
Ellipsize text (at the end) to be no more than 36 characters.
void delete_matching(_Container &__c, _Value __value)
Covers for the horrifically named std::remove and std::remove_if (neither of which remove anything).
std::vector< SCH_ITEM * > SCH_ITEM_SET
static int TemplateIN_HI[]
static int TemplateUNSPC_HI[]
static int TemplateOUT_HN[]
static int Template3STATE_HN[]
static int TemplateBIDI_HN[]
static int * TemplateShape[5][4]
bool IncrementLabelMember(wxString &name, int aIncrement)
static int TemplateIN_HN[]
static int TemplateIN_BOTTOM[]
static int TemplateUNSPC_HN[]
static int Template3STATE_BOTTOM[]
static int TemplateBIDI_BOTTOM[]
static struct SCH_LABEL_DESC _SCH_LABEL_DESC
static int Template3STATE_UP[]
static int TemplateOUT_UP[]
static int TemplateOUT_HI[]
static int TemplateUNSPC_UP[]
static int TemplateUNSPC_BOTTOM[]
static int TemplateOUT_BOTTOM[]
static int Template3STATE_HI[]
static int TemplateIN_UP[]
wxString getElectricalTypeLabel(LABEL_FLAG_SHAPE aType)
static int TemplateBIDI_UP[]
static int TemplateBIDI_HI[]
wxString UnescapeString(const wxString &aSource)
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
void ConvertMarkdown2Html(const wxString &aMarkdownInput, wxString &aHtmlOutput)
constexpr int MilsToIU(int mils) const
bool TestSegmentHit(const VECTOR2I &aRefPoint, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aDist)
Test if aRefPoint is with aDistance on the line defined by aStart and aEnd.
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
double EuclideanNorm(const VECTOR2I &vector)
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
@ SCH_LABEL_LOCATE_WIRE_T
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".