26#ifndef CLASS_SCH_FIELD_H
27#define CLASS_SCH_FIELD_H
47 const wxString& aName = wxEmptyString );
50 const wxString& aName = wxEmptyString );
68 return wxT(
"SCH_FIELD" );
71 bool IsType(
const std::vector<KICAD_T>& aScanTypes )
const override
76 for(
KICAD_T scanType : aScanTypes )
98 if(
m_id == FIELD_T::INTERSHEET_REFS )
112 wxString
GetName(
bool aUseDefaultName =
true )
const;
120 void SetName(
const wxString& aName );
122 void SetText(
const wxString& aText )
override;
132 m_id = FIELD_T::USER;
143 int aDepth = 0 )
const;
145 wxString
GetShownText(
bool aAllowExtraText,
int aDepth = 0 )
const override;
168 return name.Trim().empty() && value.Trim().empty();
235 std::vector<std::unique_ptr<KIFONT::GLYPH>>*
253 wxStyledTextEvent &aEvent )
const;
273 bool HitTest(
const VECTOR2I& aPosition,
int aAccuracy = 0 )
const override;
274 bool HitTest(
const BOX2I& aRect,
bool aContained,
int aAccuracy = 0 )
const override;
277 int aUnit,
int aBodyStyle,
const VECTOR2I& aOffset,
bool aDimmed )
override;
309 void Show(
int nestLevel, std::ostream& os )
const override { ShowDummy( os ); }
331 int compare(
const SCH_ITEM& aOther,
int aCompareFlags = 0 )
const override;
361 ordinal = std::max( ordinal, field.GetOrdinal() + 1 );
371 if( field.GetId() == aFieldId )
381 auto& constFields =
const_cast<const std::vector<SCH_FIELD>&
>( aFields );
387 const wxString& aFieldName )
391 if( field.GetName() == aFieldName )
401 auto& constFields =
const_cast<const std::vector<SCH_FIELD>&
>( aFields );
409 return wxEmptyString;
412 return field->GetText();
414 return wxEmptyString;
419 const wxString& aFieldName,
bool aResolve =
false )
425 return ( aResolve ? field->GetShownText(
false ) : field->GetText() ).ToStdString();
431inline void SetFieldValue( std::vector<SCH_FIELD>& aFields,
const wxString& aFieldName,
432 const std::string& aValue,
bool aIsVisible =
true )
438 return field.
GetName() == aFieldName;
445 field->SetText( aValue );
451 aFields.back().SetText( aValue );
452 aFields.back().SetVisible( aIsVisible );
BITMAPS
A list of all bitmap identifiers.
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
KICAD_T Type() const
Returns the type of object.
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
const VECTOR2I & GetTextPos() const
void SetTextSize(VECTOR2I aNewSize, bool aEnforceMinTextSize=true)
virtual const wxString & GetText() const
Return the string associated with the text object.
void Offset(const VECTOR2I &aOffset)
FONT is an abstract base class for both outline and stroke fonts.
A color representation with 4 components: red, green, blue, alpha.
Base plotter engine class.
Schematic editor (Eeschema) main window.
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.
wxString GetClass() const override
Return the class name.
void SetOrdinal(int aOrdinal)
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.
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.
std::vector< std::unique_ptr< KIFONT::GLYPH > > m_renderCache
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 ...
void SetLastResolvedState(const SCH_ITEM *aItem) override
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.
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
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.
static bool ClassOf(const EDA_ITEM *aItem)
bool IsHypertext() const override
Allow items to support hypertext actions when hovered/clicked.
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.
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 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.
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)
bool m_isNamedVariable
If the field name is a variable name, e.g.
void DoHypertextAction(EDA_DRAW_FRAME *aFrame) const override
int GetPenWidth() const override
wxString GetCanonicalName() const
Get a non-language-specific name for a field which can be used for storage, variable look-up,...
int m_ordinal
Sort order for non-mandatory fields.
COLOR4D GetFieldColor() const
bool IsNamedVariable() const
Named variables are fields whose names are variables like ${VAR}.
wxString GetFriendlyName() const override
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.
void SetAutoAdded(bool aAutoAdded)
bool operator<(const SCH_ITEM &aItem) const override
wxString GetShownName() const
Get the field's name as displayed on the schematic or in the symbol fields table.
VECTOR2I GetLibPosition() const
bool IsEmpty()
Return true if both the name and value of the field are empty.
void BeginEdit(const VECTOR2I &aStartPoint) override
Begin drawing a symbol library draw item at aPosition.
void SetShowInChooser(bool aShow=true)
bool IsReplaceable() const override
Override this method in any derived object that supports test find and replace.
void SetSchTextSize(int aSize)
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)
wxString GetShownText(const SCH_SHEET_PATH *aPath, bool aAllowExtraText, int aDepth=0) const
void Move(const VECTOR2I &aMoveVector) override
Move the item by aMoveVector to a new position.
VECTOR2I m_renderCachePos
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.
bool ShowInChooser() const
void ClearCaches() override
void SetText(const wxString &aText) override
VECTOR2I GetParentPosition() const
const KIFONT::METRICS & getFontMetrics() const override
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 MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
void Copy(SCH_FIELD *aTarget) const
Copy parameters of this field to another field.
KIFONT::FONT * getDrawFont() const override
bool m_allowAutoPlace
This field can be autoplaced.
Object to parser s-expression symbol library and schematic file formats.
Base class for any item which can be embedded within the SCHEMATIC container class,...
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.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Add cut/copy/paste, dark theme, autocomplete and brace highlighting to a wxStyleTextCtrl instance.
SCH_LAYER_ID
Eeschema drawing layers.
void delete_if(_Container &__c, _Function &&__f)
Deletes all values from __c for which __f returns true.
wxString GetFieldValue(const std::vector< SCH_FIELD > *aFields, FIELD_T aFieldType)
const SCH_FIELD * FindField(const std::vector< SCH_FIELD > &aFields, FIELD_T aFieldId)
int NextFieldOrdinal(const std::vector< SCH_FIELD > &aFields)
void SetFieldValue(std::vector< SCH_FIELD > &aFields, const wxString &aFieldName, const std::string &aValue, bool aIsVisible=true)
bool IsURL(wxString aStr)
Performs a URL sniff-test on a string.
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.
GR_TEXT_H_ALIGN_T
This is API surface mapped to common.types.HorizontalAlignment.
GR_TEXT_V_ALIGN_T
This is API surface mapped to common.types.VertialAlignment.
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
@ SCH_FIELD_LOCATE_REFERENCE_T
@ SCH_FIELD_LOCATE_FOOTPRINT_T
@ SCH_FIELD_LOCATE_VALUE_T
@ SCH_FIELD_LOCATE_DATASHEET_T
VECTOR2< int32_t > VECTOR2I