57 const wxString& aName ) :
107 std::function<bool( wxString* )> symbolResolver =
108 [&]( wxString* token ) ->
bool 110 if( token->Contains(
':' ) )
132 std::function<bool( wxString* )> sheetResolver =
133 [&]( wxString* token ) ->
bool 139 std::function<bool( wxString* )> globalLabelResolver =
140 [&]( wxString* token ) ->
bool 149 if(
text == wxT(
"~" ) )
255 wxT(
"Cannot swap field data with invalid item." ) );
259 std::swap(
m_layer, item->m_layer );
313 wxPoint begin = rect.
GetOrigin() - origin;
314 wxPoint end = rect.
GetEnd() - origin;
356 return render_center.y > pos.y;
358 return render_center.x < pos.x;
361 return render_center.y < pos.y;
363 return render_center.x > pos.x;
393 return render_center.x < pos.x;
395 return render_center.y < pos.y;
398 return render_center.x > pos.x;
400 return render_center.y > pos.y;
430 int flags = aSearchData.GetFlags();
438 if( !
IsVisible() && !searchHiddenFields )
443 if( searchAndReplace && !replaceReferences )
447 wxASSERT( aAuxData );
497 bool resolve =
false;
498 bool isReplaced =
false;
507 wxCHECK_MSG( aAuxData,
false, wxT(
"Need sheetpath to replace in refdes." ) );
521 wxCHECK_MSG( aAuxData,
false, wxT(
"Need sheetpath to replace in value field." ) );
532 wxCHECK_MSG( aAuxData,
false, wxT(
"Need sheetpath to replace in footprint field." ) );
580 aList.emplace_back(
_(
"Symbol Field" ),
GetName() );
585 aList.emplace_back(
_(
"Visible" ),
IsVisible() ?
_(
"Yes" ) :
_(
"No" ) );
599 aList.emplace_back(
_(
"H Justification" ), msg );
608 aList.emplace_back(
_(
"V Justification" ), msg );
614 constexpr
int START_ID = 1;
616 static wxString back = wxT(
"HYPERTEXT_BACK" );
626 std::map<wxString, wxString> sheetNames;
627 std::vector<wxString> pageListCopy;
629 pageListCopy.insert( pageListCopy.end(), it->second.begin(), it->second.end() );
635 if( pageListCopy.empty() )
639 std::sort( pageListCopy.begin(), pageListCopy.end(),
640 [](
const wxString& a,
const wxString& b ) ->
bool 647 if( sheet.size() == 1 )
648 sheetNames[ sheet.GetPageNumber() ] =
_(
"<root sheet>" );
650 sheetNames[ sheet.GetPageNumber() ] = sheet.Last()->GetName();
653 for(
int i = 0; i < (int) pageListCopy.size(); ++i )
657 sheetNames[ pageListCopy[i] ] ) );
660 menu.AppendSeparator();
661 menu.Append( 999,
_(
"Back to Previous Selected Sheet" ) );
663 int sel = aFrame->GetPopupMenuSelectionFromUser( menu ) - START_ID;
664 void* param =
nullptr;
666 if( sel >= 0 && sel < (
int) pageListCopy.size() )
667 param = (
void*) &pageListCopy[ sel ];
668 else if( sel == 999 )
669 param = (
void*) &back;
682 else if( aUseDefaultName )
689 return _(
"Intersheet References" );
692 return wxEmptyString;
712 case SHEETNAME:
return wxT(
"Sheetname" );
718 return wxT(
"Intersheet References" );
830 wxPoint relPos = aPosition - parentSymbol->
GetPosition();
869 auto field = static_cast<const SCH_FIELD*>( &aItem );
871 if(
GetId() != field->GetId() )
872 return GetId() < field->GetId();
874 if(
GetText() != field->GetText() )
875 return GetText() < field->GetText();
883 return GetName() < field->GetName();
Field Reference of part, i.e. "IC21".
#define TEXT_ANGLE_HORIZ
Frequent text rotations, used with {Set,Get}TextAngle(), in 0.1 degrees for now, hoping to migrate to...
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
EDA_ITEM * m_parent
Linked list: Link (parent struct)
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aAddUnitLabel, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
virtual bool Matches(const wxFindReplaceData &aSearchData, void *aAuxData) const
Compare the item against the search criteria in aSearchData.
void SwapEffects(EDA_TEXT &aTradingPartner)
Swap the text effects of the two involved instances.
Plot settings, and plotting engines (PostScript, Gerber, HPGL and DXF)
void Move(const wxPoint &aMoveVector)
Move the rectangle by the aMoveVector.
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Container for project specific data.
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject)
Holds all the data relating to one schematic.
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
int GetUnitCount() const
Return the number of units per package of the symbol.
bool m_IntersheetRefsListOwnPage
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
void ImportValues(const LIB_FIELD &aSource)
Copy parameters from a LIB_FIELD source.
void SetEffects(const EDA_TEXT &aSrc)
Set the text effects from another instance.
bool Replace(const wxFindReplaceData &aSearchData)
Helper function used in search and replace dialog.
wxPoint GetPosition() const override
SCHEMATIC_SETTINGS & Settings() const
Field object used in symbol libraries.
void SetValue(const SCH_SHEET_PATH *sheet, const wxString &aValue)
EDA_RECT GetTextBox(int aLine=-1, bool aInvertY=false) const
Useful in multiline texts to calculate the full text or a line area (for zones filling,...
wxPoint GetDrawPos() const override
bool ResolveTextVar(wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the symbol.
void SetTextPos(const wxPoint &aPoint)
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
bool IsVertJustifyFlipped() const
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
double GetTextAngle() const
static const wxString GetDefaultFieldName(int aFieldNdx, bool aTranslated=true)
void SetOrigin(const wxPoint &pos)
void GRText(wxDC *aDC, const wxPoint &aPos, const COLOR4D &aColor, const wxString &aText, double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold, void(*aCallback)(int x0, int y0, int xf, int yf, void *aData), void *aCallbackData, PLOTTER *aPlotter)
Draw a graphic text (like footprint texts).
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
static wxString SubReference(int aUnit, bool aAddSeparator=true)
virtual wxPoint GetPosition() const
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const
Return the reference for the given sheet path.
void RotatePoint(int *pX, int *pY, double angle)
The base class for create windows for drawing purpose.
void DoHypertextMenu(EDA_DRAW_FRAME *aFrame) override
void SetFootprint(const SCH_SHEET_PATH *sheet, const wxString &aFootprint)
TRANSFORM & GetTransform()
bool Contains(const wxPoint &aPoint) const
wxString GetShownText(int aDepth=0) const override
Return the string actually shown after processing of the base text.
int GetEffectiveTextPenWidth(int aDefaultWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultWidth.
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
void MIRROR(T &aPoint, const T &aMirrorRef)
Updates aPoint with the mirror of aPoint relative to the aMirrorRef.
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
bool operator<(const SCH_ITEM &aItem) const override
const wxPoint GetEnd() const
virtual void SetVisible(bool aVisible)
wxString GetTextStyleName() const
wxString GetCanonicalName() const
Get a non-language-specific name for a field which can be used for storage, variable look-up,...
bool ResolveTextVar(wxString *token, int aDepth) const
EDA_TEXT_VJUSTIFY_T GetEffectiveVertJustify() const
EDA_TEXT_VJUSTIFY_T GetDrawVertJustify() const override
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Field Value of part, i.e. "3.3K".
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
virtual bool IsVisible() const
const wxPoint GetOrigin() const
bool HasTextVars() const
Indicates the ShownText has text var references which need to be processed.
void SetEnd(int x, int y)
wxString GetPageNumber() const
const wxSize & GetTextSize() const
void SetLayer(SCH_LAYER_ID aLayer)
Set the layer this item is on.
SCH_FIELD(const wxPoint &aPos, int aFieldId, SCH_ITEM *aParent, const wxString &aName=wxEmptyString)
bool ResolveCrossReference(wxString *token, int aDepth) const
Resolves text vars that refer to other items.
wxString ShortenedShownText() const
Returns a shortened version (max 15 characters) of the shown text.
Definition for symbol library class.
wxLogTrace helper definitions.
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
wxDC * GetPrintDC() const
wxPoint GetLibPosition() const
static const wxString GetDefaultFieldName(int aFieldNdx, bool aTranslate=true)
Return a default symbol field name for field aFieldNdx for all components.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
static bool Replace(const wxFindReplaceData &aSearchData, wxString &aText)
Perform a text replace on aText using the find and replace criteria in aSearchData on items that supp...
const wxString GetValue(const SCH_SHEET_PATH *sheet, bool aResolve) const
Return the instance-specific value for the given sheet path.
void Rotate(const wxPoint &aCenter) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
wxString UnescapeString(const wxString &aSource)
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.
EDA_TEXT_HJUSTIFY_T GetEffectiveHorizJustify() const
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
PROJECT & Prj() const override
Return a reference to the project this schematic is part of.
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
double GetDrawRotation() const override
Adjusters to allow EDA_TEXT to draw/print/etc.
void Normalize()
Ensures that the height ant width are positive.
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Base plotter engine class.
void SwapText(EDA_TEXT &aTradingPartner)
bool IsForceVisible() const
RENDER_SETTINGS * RenderSettings()
const wxChar *const traceFindItem
Flag to enable find debug tracing.
BITMAPS
A list of all bitmap identifiers.
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
void SetRef(const SCH_SHEET_PATH *aSheet, const wxString &aReference)
Set the reference for the given sheet path for this symbol.
wxString GetName(bool aUseDefaultName=true) const
Return the field name.
Handle the component boundary box.
wxPoint GetPosition() const override
A base class for most all the KiCad significant classes used in schematics and boards.
bool IsHorizJustifyFlipped() const
Return whether the field will be rendered with the horizontal justification inverted due to rotation ...
bool Intersects(const EDA_RECT &aRect) const
Test for a common area between rectangles.
std::map< wxString, std::set< wxString > > & GetPageRefsMap()
int GetDefaultPenWidth() const
const wxPoint & GetTextPos() const
virtual void Text(const wxPoint &aPos, const COLOR4D &aColor, const wxString &aText, double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold, bool aMultilineAllowed=false, void *aData=nullptr)
Draw text with the plotter.
const wxString GetFootprint(const SCH_SHEET_PATH *sheet, bool aResolve) const
Return the instance-specific footprint assignment for the given sheet path.
int GetMinPenWidth() const
bool IsReplaceable() const override
Override this method in any derived object that supports test find and replace.
int StrNumCmp(const wxString &aString1, const wxString &aString2, bool aIgnoreCase)
Compare two strings with alphanumerical content.
bool ResolveTextVar(wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the sheet.
void delete_matching(_Container &__c, _Value __value)
Covers for the horrifically named std::remove and std::remove_if (neither of which remove anything).
SCH_SHEET_PATH & CurrentSheet() const override
wxPoint GetParentPosition() const
void Print(const RENDER_SETTINGS *aSettings, const wxPoint &aOffset) override
Print a schematic item.
bool Replace(const wxFindReplaceData &aSearchData, void *aAuxData=nullptr) override
Perform a text replace using the find and replace criteria in aSearchData on items that support text ...
void SetPosition(const wxPoint &aPosition) override
Base class for any item which can be embedded within the SCHEMATIC container class,...
virtual const wxString & GetText() const
Return the string associated with the text object.
static TOOL_ACTION hypertextCommand
virtual wxString GetShownText(int aDepth=0) const
Return the string actually shown after processing of the base text.
bool Matches(const wxFindReplaceData &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
void Plot(PLOTTER *aPlotter) const override
Plot the schematic item to aPlotter.
int GetPenWidth() const override
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
EDA_TEXT_HJUSTIFY_T GetDrawHorizJustify() const override
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
KICAD_T Type() const
Returns the type of object.
A color representation with 4 components: red, green, blue, alpha.
Field Name Module PCB, i.e. "16DIP300".