45#include <google/protobuf/any.pb.h>
47#include <api/schematic/schematic_types.pb.h>
63 static const std::vector<wxString> translations = {
64 wxString::FromUTF8(
"Net Class" ),
65 wxString::FromUTF8(
"صنف الشبكة" ),
66 wxString::FromUTF8(
"Верига Клас" ),
67 wxString::FromUTF8(
"Classe de xarxa" ),
68 wxString::FromUTF8(
"Třídy spojů" ),
69 wxString::FromUTF8(
"Netklasse" ),
70 wxString::FromUTF8(
"Netzklasse" ),
71 wxString::FromUTF8(
"Κλάση Δικτύου" ),
72 wxString::FromUTF8(
"Clase de red" ),
73 wxString::FromUTF8(
"Ühendusniidiklass" ),
74 wxString::FromUTF8(
"Verkkoluokka" ),
75 wxString::FromUTF8(
"Classe d'Equipot" ),
76 wxString::FromUTF8(
"מחלקת רשת" ),
77 wxString::FromUTF8(
"नेट क्लास" ),
78 wxString::FromUTF8(
"Hálózatosztály" ),
79 wxString::FromUTF8(
"Kelas Net" ),
80 wxString::FromUTF8(
"Netclass" ),
81 wxString::FromUTF8(
"ネットクラス" ),
82 wxString::FromUTF8(
"ქსელის კლასი" ),
83 wxString::FromUTF8(
"네트 클래스" ),
84 wxString::FromUTF8(
"Grandinių klasė" ),
85 wxString::FromUTF8(
"Tīklu klase" ),
86 wxString::FromUTF8(
"Nettklasse" ),
87 wxString::FromUTF8(
"Klasy sieci" ),
88 wxString::FromUTF8(
"Classes da rede" ),
89 wxString::FromUTF8(
"Classe de Rede" ),
90 wxString::FromUTF8(
"Класс цепей" ),
91 wxString::FromUTF8(
"Triedy spojov" ),
92 wxString::FromUTF8(
"Razred vozlišča" ),
93 wxString::FromUTF8(
"Класа везе" ),
94 wxString::FromUTF8(
"Nätklass" ),
95 wxString::FromUTF8(
"நிகர வகுப்பு" ),
96 wxString::FromUTF8(
"నెట్ క్లాస్" ),
97 wxString::FromUTF8(
"เน็ตคลาส" ),
98 wxString::FromUTF8(
"Ağ Sınıfı" ),
99 wxString::FromUTF8(
"Клас зв'язків" ),
100 wxString::FromUTF8(
"Lớp mạng" ),
101 wxString::FromUTF8(
"网络类" ),
102 wxString::FromUTF8(
"網路類" )
111 if( aName == wxT(
"Netclass" ) )
116 if( aName == candidate )
144 if( !aName.IsEmpty() )
160 wxASSERT_MSG( aParent->
Type() !=
SCH_SHEET_T, wxT(
"Sheets use FIELD_T::SHEET_USER, not FIELD_T::USER!" ) );
167 m_ordinal = label->GetNextFieldOrdinal();
206 field.set_name(
GetName(
false ).ToUTF8() );
224 kiapi::schematic::types::SchematicField field;
226 aContainer.PackFrom( field );
232 SetName( wxString::FromUTF8( field.name() ) );
250 kiapi::schematic::types::SchematicField field;
252 if( !aContainer.UnpackTo( &field ) )
305 const wxString& aVariantName,
int aDepth )
const
310 if( !aVariantName.IsEmpty() )
311 hasTextVars =
text.Contains( wxT(
"${" ) ) ||
text.Contains( wxT(
"@{" ) );
316 if( hasTextVars && aContext !=
RAW_VALUE )
331 wxString variantName = schematic->GetCurrentVariant();
337 "GetShownText (no path arg): field=%s, current sheet path='%s', variant='%s', "
338 "size=%zu, empty=%d",
340 currentSheet.
empty() ? 1 : 0 );
343 return GetShownText( ¤tSheet, aContext, variantName, aDepth );
347 return GetShownText(
nullptr, aContext, wxEmptyString, aDepth );
398std::vector<std::unique_ptr<KIFONT::GLYPH>>*
408 m_renderCache = std::make_unique<SCH_FIELD_RENDER_CACHE_DATA>();
424 for( std::unique_ptr<KIFONT::GLYPH>& glyph :
m_renderCache->glyphs )
426 if( glyph->IsOutline() )
453 wxCHECK_RET( aItem && aItem->
Type() ==
SCH_FIELD_T, wxT(
"Cannot swap with invalid item." ) );
575 return render_center.
y > pos.
y;
577 return render_center.
x < pos.
x;
581 return render_center.
y < pos.
y;
583 return render_center.
x > pos.
x;
622 return render_center.
x < pos.
x;
624 return render_center.
y < pos.
y;
628 return render_center.
x > pos.
x;
630 return render_center.
y > pos.
y;
662 bool replaceReferences =
false;
670 catch(
const std::bad_cast& )
676 if( !
IsVisible() && !searchHiddenFields )
681 if( searchAndReplace && !replaceReferences )
695 wxASSERT( aAuxData );
724 wxStyledTextCtrl* scintilla = aScintillaTricks->
Scintilla();
725 int key = aEvent.GetKey();
727 wxArrayString autocompleteTokens;
728 int pos = scintilla->GetCurrentPos();
729 int start = scintilla->WordStartPosition( pos,
true );
735 wxString
text = scintilla->GetText();
736 int currpos = scintilla->GetCurrentPos();
737 text.Replace( wxS(
"\n" ), wxS(
"" ) );
738 scintilla->SetText(
text );
739 scintilla->GotoPos( currpos - 1 );
746 return pt >= 2 && scintilla->GetCharAt( pt - 2 ) ==
'$' && scintilla->GetCharAt( pt - 1 ) ==
'{';
750 if( start > 1 && scintilla->GetCharAt( start - 1 ) ==
':' )
752 int refStart = scintilla->WordStartPosition( start - 1,
true );
754 if( textVarRef( refStart ) )
756 partial = scintilla->GetRange( start, pos );
758 wxString ref = scintilla->GetRange( refStart, start - 1 );
760 if( ref == wxS(
"OP" ) )
770 std::vector<EMBEDDED_FILES*> embeddedFilesStack;
773 if(
EMBEDDED_FILES* symbolEmbeddedFiles = symbol->GetEmbeddedFiles() )
775 embeddedFilesStack.push_back( symbolEmbeddedFiles );
776 symbol->GetLibSymbolRef()->AppendParentEmbeddedFiles( embeddedFilesStack );
783 for( wxString
pin :
model.GetPinNames() )
785 if(
pin.StartsWith(
'<' ) &&
pin.EndsWith(
'>' ) )
786 autocompleteTokens.push_back(
pin.Mid( 1,
pin.Length() - 2 ) );
788 autocompleteTokens.push_back(
pin );
792 autocompleteTokens.push_back( wxT(
"power" ) );
802 for(
size_t jj = 0; jj < refs.
GetCount(); jj++ )
804 if( refs[jj].GetSymbol()->GetRef( &refs[jj].GetSheetPath(),
true ) == ref )
806 refSymbol = refs[jj].GetSymbol();
816 else if( textVarRef( start ) )
818 partial = scintilla->GetTextRange( start, pos );
839 autocompleteTokens.push_back( entry.first );
843 scintilla->SetFocus();
861 if( parentSymbol->IsLocked() )
867 if( parentSheet->IsLocked() )
873 if( parentLabel->IsLocked() )
886 bool replaceReferences =
false;
893 catch(
const std::bad_cast& )
898 bool isReplaced =
false;
904 if( !replaceReferences )
907 wxCHECK_MSG( aAuxData,
false, wxT(
"Need sheetpath to replace in refdes." ) );
983 wxFAIL_MSG( wxString::Format( wxT(
"SCH_FIELD text angle is not horizontal or vertical: %f" ),
1033 if( content.IsEmpty() )
1049 aList.emplace_back(
_(
"Visible" ),
IsVisible() ?
_(
"Yes" ) :
_(
"No" ) );
1065 aList.emplace_back(
_(
"H Justification" ), msg );
1075 aList.emplace_back(
_(
"V Justification" ), msg );
1090 constexpr int START_ID = 1;
1100 std::vector<std::pair<wxString, wxString>> pages;
1104 for(
int i = 0; i < (int) pages.size(); ++i )
1106 menu.Append( i + START_ID,
1107 wxString::Format(
_(
"Go to Page %s (%s)" ), pages[i].first, pages[i].second ) );
1110 menu.AppendSeparator();
1111 menu.Append( 999 + START_ID,
_(
"Back to Previous Selected Sheet" ) );
1113 int sel = aFrame->GetPopupMenuSelectionFromUser( menu ) - START_ID;
1115 if( sel >= 0 && sel < (
int) pages.size() )
1116 href = wxT(
"#" ) + pages[sel].first;
1117 else if( sel == 999 )
1125 if( !href.IsEmpty() )
1155 const wxString
text =
IsMandatory() ? aText.Strip( wxString::both ) : aText;
1171 const wxString
text =
IsMandatory() ? aText.Strip( wxString::both ) : aText;
1210 wxCHECK( aPath &&
m_parent, retv );
1217 wxCHECK( symbol, retv );
1229 wxCHECK( sheet, retv );
1254 else if(
m_name.IsEmpty() && aUseDefaultName )
1268 return wxT(
"Netclass" );
1368 const VECTOR2I& aOffset,
bool aDimmed )
1398 color = color.
Mix( bg, 0.5f );
1401 penWidth = std::max( penWidth, renderSettings->
GetMinPenWidth() );
1457 color = nc->GetSchematicColor();
1474 std::vector<std::pair<wxString, wxString>> pages;
1475 std::vector<wxString> pageHrefs;
1477 label->GetIntersheetRefs( &
Schematic()->CurrentSheet(), &pages );
1479 for(
const auto& [pageNumber, sheetName] : pages )
1480 pageHrefs.push_back( wxT(
"#" ) + pageNumber );
1483 bbox.
Offset( label->GetSchematicTextOffset( renderSettings ) );
1546 auto field =
static_cast<const SCH_FIELD*
>( &aItem );
1548 if(
GetId() != field->GetId() )
1549 return GetId() < field->GetId();
1551 if(
GetText() != field->GetText() )
1552 return GetText() < field->GetText();
1560 return GetName() < field->GetName();
1571 return *
this == field;
1657 double similarity = 0.99;
1707 return (
int)
m_id - (int) tmp->
m_id;
1720 return (
int)
m_id - (int) tmp->
m_id;
1779 retv = symbol->GetRef( aPath,
true );
1784 else if( !aVariantName.IsEmpty() )
1787 if( std::optional<SCH_SYMBOL_VARIANT> variant = symbol->GetVariant( *aPath, aVariantName ) )
1791 if( variant->m_Fields.contains(
GetName() ) )
1793 retv = variant->m_Fields[
GetName()];
1795 else if(
LIB_SYMBOL* altSymbol = symbol->GetVariantLibSymbol( aVariantName, *aPath ) )
1799 if( altField && !altField->
GetText().IsEmpty() )
1811 if( !aVariantName.IsEmpty() )
1816 && instance->
m_Variants.contains( aVariantName )
1844 if( h_inst.Choices().GetCount() == 0 )
1853 if( v_inst.Choices().GetCount() == 0 )
1875 const wxString textProps =
_HKI(
"Text Properties" );
1902 _HKI(
"Text Properties" ) );
1910 return !field->IsGeneratedField();
1920 return !field->IsMandatory();
constexpr EDA_IU_SCALE schIUScale
BITMAPS
A list of all bitmap identifiers.
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
constexpr const Vec GetEnd() const
constexpr void SetOrigin(const Vec &pos)
constexpr BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
constexpr Vec Centre() const
constexpr bool Contains(const Vec &aPoint) const
constexpr void Move(const Vec &aMoveVector)
Move the rectangle by the aMoveVector.
constexpr const Vec & GetOrigin() const
constexpr void SetEnd(coord_type x, coord_type y)
constexpr void Offset(coord_type dx, coord_type dy)
constexpr bool Intersects(const BOX2< Vec > &aRect) const
static const COLOR4D WHITE
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
bool IsHorizontal() 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.
EDA_ITEM * GetParent() const
EDA_ITEM * m_parent
Owner.
bool IsForceVisible() const
static bool Replace(const EDA_SEARCH_DATA &aSearchData, wxString &aText)
Perform a text replace on aText using the find and replace criteria in aSearchData on items that supp...
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
virtual VECTOR2I GetTextSize() const
COLOR4D GetTextColor() const
wxString GetTextStyleName() const
virtual VECTOR2I GetTextPos() const
virtual void SetTextSize(VECTOR2I aNewSize, bool aEnforceMinTextSize=true)
virtual const wxString & GetText() const
Return the string associated with the text object.
virtual bool IsVisible() const
virtual void SetTextPos(const VECTOR2I &aPoint)
virtual void SetTextX(int aX)
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
KIFONT::FONT * GetFont() const
void SetAttributes(const EDA_TEXT &aSrc, bool aSetPosition=true)
Set the text attributes from another instance.
virtual void SetTextY(int aY)
EDA_TEXT & operator=(const EDA_TEXT &aItem)
BOX2I GetTextBox(const RENDER_SETTINGS *aSettings, int aLine=-1) const
Useful in multiline texts to calculate the full text or a line area (for zones filling,...
virtual wxString GetShownText(RESOLUTION_CONTEXT aContext, int aDepth=0) const
Return the string actually shown after processing of the base text.
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
virtual int GetTextWidth() const
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 SetVisible(bool aVisible)
EDA_TEXT(const EDA_IU_SCALE &aIuScale, const wxString &aText=wxEmptyString)
virtual void ClearBoundingBoxCache()
double Similarity(const EDA_TEXT &aOther) const
static GR_TEXT_H_ALIGN_T MapHorizJustify(int aHorizJustify)
virtual void ClearRenderCache()
virtual EDA_ANGLE GetTextAngle() const
const TEXT_ATTRIBUTES & GetAttributes() const
int GetEffectiveTextPenWidth(int aDefaultPenWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultPenWidth.
void SwapAttributes(EDA_TEXT &aTradingPartner)
Swap the text attributes of the two involved instances.
static GR_TEXT_V_ALIGN_T MapVertJustify(int aVertJustify)
GR_TEXT_V_ALIGN_T GetVertJustify() const
virtual void SetText(const wxString &aText)
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
void SwapText(EDA_TEXT &aTradingPartner)
bool operator==(const EDA_TEXT &aRhs) const
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
static ENUM_MAP< T > & Instance()
Class that other classes need to inherit from, in order to be inspectable.
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, const std::vector< wxString > *aEmbeddedFiles=nullptr, bool aForDrawingSheet=false)
virtual bool IsOutline() const
Implement outline font drawing.
void GetLinesAsGlyphs(std::vector< std::unique_ptr< GLYPH > > *aGlyphs, const wxString &aText, const VECTOR2I &aPosition, const TEXT_ATTRIBUTES &aAttrs, const METRICS &aFontMetrics) const
void Move(const VECTOR2I &aOffset)
A color representation with 4 components: red, green, blue, alpha.
std::shared_ptr< wxString > m_text
COLOR4D & Desaturate()
Removes color (in HSL model)
COLOR4D Mix(const COLOR4D &aColor, double aFactor) const
Return a color that is mixed with the input by a factor.
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
int GetDefaultPenWidth() const
int GetMinPenWidth() const
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
wxString AsString() const
COLOR4D GetSchematicColor(bool aIsForSave=false) const
A singleton reporter that reports to nowhere.
Base plotter engine class.
bool GetColorMode() const
virtual void PlotText(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const TEXT_ATTRIBUTES &aAttributes, KIFONT::FONT *aFont=nullptr, const KIFONT::METRICS &aFontMetrics=KIFONT::METRICS::Default(), void *aData=nullptr)
virtual void HyperlinkMenu(const BOX2I &aBox, const std::vector< wxString > &aDestURLs)
Create a clickable hyperlink menu with a rectangular click area.
virtual std::map< wxString, wxString > & GetTextVars() const
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()
PROPERTY_BASE & AddProperty(PROPERTY_BASE *aProperty, const wxString &aGroup=wxEmptyString)
Register a property.
void OverrideAvailability(TYPE_ID aDerived, TYPE_ID aBase, const wxString &aName, std::function< bool(INSPECTABLE *)> aFunc)
Sets an override availability functor for a base class property of a given derived class.
PROPERTY_BASE & ReplaceProperty(size_t aBase, const wxString &aName, PROPERTY_BASE *aNew, const wxString &aGroup=wxEmptyString)
Replace an existing property for a specific type.
void OverrideWriteability(TYPE_ID aDerived, TYPE_ID aBase, const wxString &aName, std::function< bool(INSPECTABLE *)> aFunc)
Sets an override writeability functor for a base class property of a given derived class.
void AddTypeCast(TYPE_CAST_BASE *aCast)
Register a type converter.
These are loaded from Eeschema settings but then overwritten by the project settings.
Holds all the data relating to one schematic.
SCHEMATIC_SETTINGS & Settings() const
SCH_SHEET_LIST Hierarchy() const
Return the full schematic flattened hierarchical sheet list.
PROJECT & Project() const
Return a reference to the project this schematic is part of.
wxString GetCurrentVariant() const
Return the current variant being edited.
EMBEDDED_FILES * GetEmbeddedFiles() override
SCH_SHEET_PATH & CurrentSheet() const
void ClearRenderCache() override
int compare(const SCH_ITEM &aOther, int aCompareFlags=0) const override
Provide the draw object specific comparison called by the == and < operators.
COLOR4D m_lastResolvedColor
GR_TEXT_V_ALIGN_T GetEffectiveVertJustify() const
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
bool HasSameContent(const SCH_FIELD &aOther) const
Test if this field has the same name, content and presentation as another field, ignoring the owning ...
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
wxString GetFullText(int unit=1) const
Return the text of a field.
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
bool IsLocked() const override
void swapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
VECTOR2I GetPosition() const override
void SetEffectiveHorizJustify(GR_TEXT_H_ALIGN_T)
int GetSchTextSize() const
bool Replace(const EDA_SEARCH_DATA &aSearchData, void *aAuxData=nullptr) override
Perform a text replace using the find and replace criteria in aSearchData on items that support text ...
bool m_showName
Render the field name in addition to its value.
void Plot(PLOTTER *aPlotter, bool aBackground, const SCH_PLOT_OPTS &aPlotOpts, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aDimmed) override
Plot the item to aPlotter.
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
bool m_autoAdded
Was this field automatically added to a LIB_SYMBOL?
double Similarity(const SCH_ITEM &aItem) const override
Return a measure of how likely the other object is to represent the same object.
std::unique_ptr< SCH_FIELD_RENDER_CACHE_DATA > m_renderCache
bool IsGeneratedField() const
Generated fields are fields whose names are variables like ${VAR}.
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
SCH_LAYER_ID GetDefaultLayer() const
bool HasHypertext() const override
Indicates that the item has at least one hypertext action.
bool IsHorizJustifyFlipped() const
Return whether the field will be rendered with the horizontal justification inverted due to rotation ...
bool IsVertJustifyFlipped() const
EDA_ANGLE GetDrawRotation() const override
Adjusters to allow EDA_TEXT to draw/print/etc.
void SetEffectiveVertJustify(GR_TEXT_V_ALIGN_T)
void CalcEdit(const VECTOR2I &aPosition) override
Calculate the attributes of an item at aPosition when it is being edited.
virtual const wxString & GetText() const override
Return the string associated with the text object.
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
void SetCanAutoplace(bool aCanPlace)
int GetPenWidth() const override
bool m_isGeneratedField
If the field name is a variable name (e.g.
int m_ordinal
Sort order for non-mandatory fields.
COLOR4D GetFieldColor() const
wxString getUnescapedText(const SCH_SHEET_PATH *aPath=nullptr, const wxString &aVariantName=wxEmptyString) const
bool operator==(const SCH_ITEM &aItem) const override
SCH_FIELD & operator=(const SCH_FIELD &aField)
void ImportValues(const SCH_FIELD &aSource)
Copy parameters from a SCH_FIELD source.
wxString GetUntranslatedName() const
Get the untranslated field name for storage, variable look-up, etc.
bool operator<(const SCH_ITEM &aItem) const override
void DoHypertextAction(EDA_DRAW_FRAME *aFrame, const VECTOR2I &aMousePos) const override
wxString GetShownName() const
Get the field's name as displayed on the schematic or in the symbol fields table.
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
VECTOR2I GetLibPosition() const
bool IsEmpty()
Return true if both the name and value of the field are empty.
KIFONT::FONT * GetDrawFont(const RENDER_SETTINGS *aSettings) const override
void BeginEdit(const VECTOR2I &aStartPoint) override
Begin drawing a symbol library draw item at aPosition.
bool IsReplaceable() const override
Override this method in any derived object that supports test find and replace.
void SetSchTextSize(int aSize)
wxString GetShownText(const SCH_SHEET_PATH *aPath, RESOLUTION_CONTEXT aContext, const wxString &aVariantName=wxEmptyString, int aDepth=0) const
GR_TEXT_H_ALIGN_T GetEffectiveHorizJustify() const
std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
wxString GetName(bool aUseDefaultName=true) const
Return the field name (not translated).
void SetPosition(const VECTOR2I &aPosition) override
void SetName(const wxString &aName)
bool CanAutoplace() const
std::vector< std::unique_ptr< KIFONT::GLYPH > > * GetRenderCache(const wxString &forResolvedText, const VECTOR2I &forPosition, TEXT_ATTRIBUTES &aAttrs) const
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.
void ClearCaches() override
void SetText(const wxString &aText) override
VECTOR2I GetParentPosition() const
bool m_showInChooser
This field is available as a data column for the chooser.
void OnScintillaCharAdded(SCINTILLA_TRICKS *aScintillaTricks, wxStyledTextEvent &aEvent) const
void SetNameShown(bool aShown=true)
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
static bool IsNetclassLabelFieldName(const wxString &aName)
Test whether aName is one of the known translations of the directive-label net class field name (used...
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
void Copy(SCH_FIELD *aTarget) const
Copy parameters of this field to another field.
bool m_allowAutoPlace
This field can be autoplaced.
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...
Base class for any item which can be embedded within the SCHEMATIC container class,...
SCH_ITEM & operator=(const SCH_ITEM &aPin)
const wxString & GetDefaultFont(const KIGFX::RENDER_SETTINGS *aSettings) const
void invalidateConnectivity(KICAD_T aChangedType=TYPE_NOT_INIT)
Bump the parent screen's connectivity revision when this item, or the item owning it as a child,...
SCH_RENDER_SETTINGS * getRenderSettings(PLOTTER *aPlotter) const
const SYMBOL * GetParentSymbol() const
void SetPrivate(bool aPrivate)
SCHEMATIC * Schematic() const
Search the item hierarchy to find a SCHEMATIC.
virtual wxString GetUnitDisplayName(int aUnit, bool aLabel) const
bool IsLocked() const override
std::shared_ptr< NETCLASS > GetEffectiveNetClass(const SCH_SHEET_PATH *aSheet=nullptr) const
void SetLayer(SCH_LAYER_ID aLayer)
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
bool IsConnectivityDirty() const
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType, int aUnit=0, int aBodyStyle=0)
wxString ResolveText(const wxString &aText, const SCH_SHEET_PATH *aPath, int aDepth=0) const
virtual int compare(const SCH_ITEM &aOther, int aCompareFlags=~COMPARE_FLAGS::UNIT) const
Provide the draw object specific comparison called by the == and < operators.
const KIFONT::METRICS & GetFontMetrics() const
double SimilarityBase(const SCH_ITEM &aItem) const
Calculate the boilerplate similarity for all LIB_ITEMs without preventing the use above of a pure vir...
void GetIntersheetRefs(const SCH_SHEET_PATH *aPath, std::vector< std::pair< wxString, wxString > > *pages)
Build an array of { pageNumber, pageName } pairs.
static const wxString GetDefaultFieldName(const wxString &aName, bool aUseDefaultName)
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars & fields for this label.
Container to create a flattened list of symbols because in a complex hierarchy, a symbol can be used ...
VECTOR2I TransformCoordinate(const VECTOR2I &aPoint) const
const KIGFX::COLOR4D & GetBackgroundColor() const override
Return current background color settings.
void GetSymbols(SCH_REFERENCE_LIST &aReferences, SYMBOL_FILTER aSymbolFilter, bool aForceIncludeOrphanSymbols=false) const
Add a SCH_REFERENCE object to aReferences for each symbol in the list of sheets.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
bool empty() const
Forwarded method from std::vector.
KIID_PATH Path() const
Get the sheet path as an KIID_PATH.
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
size_t size() const
Forwarded method from std::vector.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars & fields for this sheet.
wxString GetFieldText(const SCH_FIELD *aField, const wxString &aFieldName, const SCH_SHEET_PATH *aPath, const wxString &aVariantName) const
void SetFieldText(SCH_FIELD *aField, const wxString &aFieldName, const wxString &aFieldText, const SCH_SHEET_PATH *aPath, const wxString &aVariantName)
void SetFieldText(SCH_FIELD *aField, const wxString &aFieldName, const wxString &aFieldText, const SCH_SHEET_PATH *aPath, const wxString &aVariantName)
wxString SubReference(int aUnit, bool aAddSeparator=true) const
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
void SetRef(const SCH_SHEET_PATH *aSheet, const wxString &aReference)
Set the reference for the given sheet path for this symbol.
VECTOR2I GetPosition() const override
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars & fields for this symbol.
int GetUnitSelection(const SCH_SHEET_PATH *aSheet) const
Return the instance-specific unit selection for the given sheet path.
int GetUnitCount() const override
Return the number of units per package of the symbol.
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const override
wxString GetFieldText(const SCH_FIELD *aField, const wxString &aFieldName, const SCH_SHEET_PATH *aPath, const wxString &aVariantName) const
Add cut/copy/paste, dark theme, autocomplete and brace highlighting to a wxStyleTextCtrl instance.
wxStyledTextCtrl * Scintilla() const
void DoAutocomplete(const wxString &aPartial, const wxArrayString &aTokens)
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
void Move(const VECTOR2I &aVector) override
static constexpr auto LIBRARY_FIELD
SIM_MODEL & CreateModel(SIM_MODEL::TYPE aType, std::span< const wxString > aPins, REPORTER &aReporter)
void SetFilesStack(std::vector< EMBEDDED_FILES * > aFilesStack)
A base class for LIB_SYMBOL and SCH_SYMBOL.
const TRANSFORM & GetTransform() const
int Compare(const TEXT_ATTRIBUTES &aRhs) const
GR_TEXT_H_ALIGN_T m_Halign
GR_TEXT_V_ALIGN_T m_Valign
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
A lower-precision version of StringFromValue().
void FinalizeTextVarExpansion(wxString &aText, RESOLUTION_CONTEXT aContext)
wxString GetGeneratedFieldDisplayName(const wxString &aSource)
Returns any variables unexpanded, e.g.
static constexpr EDA_ANGLE ANGLE_90
static constexpr EDA_ANGLE ANGLE_VERTICAL
static constexpr EDA_ANGLE ANGLE_HORIZONTAL
static constexpr EDA_ANGLE ANGLE_270
#define STRUCT_DELETED
flag indication structures to be erased
#define SKIP_STRUCT
flag indicating that the structure should be ignored
a few functions useful in geometry calculations.
const wxChar *const traceSchFieldRendering
Flag to enable debug output of schematic field rendering and positioning.
@ USER
The main config directory (e.g. ~/.config/kicad/)
SCH_LAYER_ID
Eeschema drawing layers.
@ LAYER_SELECTION_SHADOWS
bool BoxHitTest(const VECTOR2I &aHitPoint, const BOX2I &aHittee, int aAccuracy)
Perform a point-to-box hit test.
KICOMMON_API wxString EllipsizeMenuText(const wxString &aString)
Ellipsize text (at the end) to be no more than 36 characters.
KICOMMON_API wxString EllipsizeStatusText(wxWindow *aWindow, const wxString &aString)
Ellipsize text (at the end) to be no more than 1/3 of the window width.
KICOMMON_API void PackCustomProperties(google::protobuf::RepeatedPtrField< types::CustomProperty > *aOutput, const EDA_ITEM &aItem)
KICOMMON_API VECTOR2I UnpackVector2(const types::Vector2 &aInput, const EDA_IU_SCALE &aScale)
KICOMMON_API void PackVector2(types::Vector2 &aOutput, const VECTOR2I &aInput, const EDA_IU_SCALE &aScale)
KICOMMON_API void UnpackCustomProperties(const google::protobuf::RepeatedPtrField< types::CustomProperty > &aInput, EDA_ITEM &aItem)
static GR_TEXT_H_ALIGN_T horizJustify(const char *horizontal)
#define TYPE_HASH(x)
Macro to generate unique identifier for a type.
#define DECLARE_ENUM_TO_WXANY(type)
@ PT_SIZE
Size expressed in distance units (mm/inch)
#define REGISTER_TYPE(x)
Helper macro to map type hashes to names.
static const std::vector< wxString > & GetKnownNetclassFieldTranslations()
Translations of "Net Class" extracted from KiCad's .po catalogs.
static const std::vector< KICAD_T > labelTypes
static struct SCH_FIELD_DESC _SCH_FIELD_DESC
@ SYMBOL_FILTER_NON_POWER
wxString UnescapeString(const wxString &aSource)
bool IsURL(wxString aStr)
Performs a URL sniff-test on a string.
A simple container for sheet instance information.
std::map< wxString, SCH_SHEET_VARIANT > m_Variants
A list of sheet variants.
wxString GetDefaultFieldName(FIELD_T aFieldId, TRANSLATION aTranslation)
Return a default symbol field name for a mandatory field type.
FIELD_T
The set of all field indices assuming an array like sequence that a SCH_COMPONENT or LIB_PART can hol...
@ USER
The field ID hasn't been set yet; field is invalid.
@ INTERSHEET_REFS
Global label cross-reference page numbers.
@ DESCRIPTION
Field Description of part, i.e. "1/4W 1% Metal Film Resistor".
@ FOOTPRINT
Field Name Module PCB, i.e. "16DIP300".
@ DATASHEET
name of datasheet
@ REFERENCE
Field Reference of part, i.e. "IC21".
@ VALUE
Field Value of part, i.e. "3.3K".
wxString result
Test unit parsing edge cases and error handling.
GR_TEXT_H_ALIGN_T
This is API surface mapped to common.types.HorizontalAlignment.
@ GR_TEXT_H_ALIGN_INDETERMINATE
GR_TEXT_V_ALIGN_T
This is API surface mapped to common.types.VertialAlignment.
@ GR_TEXT_V_ALIGN_INDETERMINATE
wxLogTrace helper definitions.
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
Casted dyn_cast(From aObject)
A lightweight dynamic downcast.
#define INDETERMINATE_STATE
Used for holding indeterminate values, such as with multiple selections holding different values or c...
VECTOR2< int32_t > VECTOR2I