56 const wxString& aName ) :
106 std::function<bool( wxString* )> symbolResolver =
107 [&]( wxString* token ) ->
bool 109 if( token->Contains(
':' ) )
131 std::function<bool( wxString* )> sheetResolver =
132 [&]( wxString* token ) ->
bool 138 std::function<bool( wxString* )> globalLabelResolver =
139 [&]( wxString* token ) ->
bool 146 bool processTextVars =
false;
149 if( processTextVars )
161 text =
ExpandTextVars( text, &globalLabelResolver,
nullptr, project );
185 text =
_(
"File:" ) + wxS(
" " )+ text;
236 textpos = boundaryBox.
Centre() + aOffset;
252 wxT(
"Cannot swap field data with invalid item." ) );
256 std::swap(
m_layer, item->m_layer );
270 wxPoint begin = rect.
GetOrigin() - origin;
271 wxPoint end = rect.
GetEnd() - origin;
312 return render_center.x < pos.x;
314 return render_center.x > pos.x;
330 int flags = aSearchData.GetFlags();
338 if( !
IsVisible() && !searchHiddenFields )
343 if( searchAndReplace && !replaceReferences )
347 wxASSERT( aAuxData );
396 bool isReplaced =
false;
404 wxCHECK_MSG( aAuxData !=
NULL,
false,
405 wxT(
"Cannot replace reference designator without valid sheet path." ) );
456 static wxString back =
"HYPERTEXT_BACK";
466 std::map<wxString, wxString> sheetNames;
467 std::vector<wxString> pageListCopy;
469 pageListCopy.insert( pageListCopy.end(), it->second.begin(), it->second.end() );
470 std::sort( pageListCopy.begin(), pageListCopy.end() );
474 if( sheet.size() == 1 )
475 sheetNames[ sheet.GetPageNumber() ] =
_(
"<root sheet>" );
477 sheetNames[ sheet.GetPageNumber() ] = sheet.Last()->GetName();
480 for(
int i = 0; i < (int) pageListCopy.size(); ++i )
484 sheetNames[ pageListCopy[i] ] ) );
487 menu.AppendSeparator();
488 menu.Append( 999,
_(
"Back" ) );
490 int sel = aFrame->GetPopupMenuSelectionFromUser( menu );
491 void* param =
nullptr;
493 if( sel >= 0 && sel < (
int) pageListCopy.size() )
494 param = (
void*) &pageListCopy[ sel ];
495 else if( sel == 999 )
496 param = (
void*) &back;
509 else if( aUseDefaultName )
516 return _(
"Intersheet References" );
519 return wxEmptyString;
539 case SHEETNAME:
return wxT(
"Sheetname" );
545 return wxT(
"Intersheet References" );
643 wxPoint textpos = BoundaryBox.
Centre();
658 wxPoint relativePos = aPosition - parentComponent->
GetPosition();
680 return relativePos + parentComponent->
GetPosition();
698 auto field = static_cast<const SCH_FIELD*>( &aItem );
700 if(
GetId() != field->GetId() )
701 return GetId() < field->GetId();
703 if(
GetText() != field->GetText() )
704 return GetText() < field->GetText();
712 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...
SCH_FIELD instances are attached to a component and provide a place for the component's value,...
EDA_ITEM * m_parent
Linked list: Link (parent struct)
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.
Container for project specific data.
PNG memory record (file in memory).
bool ResolveTextVar(wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the component.
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 A schematic may consist of one or more sheets (and one r...
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
void ImportValues(const LIB_FIELD &aSource)
Function ImportValues 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.
const BITMAP_OPAQUE edit_comp_value_xpm[1]
wxPoint GetPosition() const override
Field object used in symbol libraries.
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,...
void SetTextPos(const wxPoint &aPoint)
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
int GetUnitCount() const
Return the number of units per package of the symbol.
void SetVisible(bool aVisible)
const BITMAP_OPAQUE text_xpm[1]
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
double GetTextAngle() const
void SetOrigin(const wxPoint &pos)
const BITMAP_OPAQUE edit_comp_ref_xpm[1]
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
virtual wxPoint GetPosition() const
void RotatePoint(int *pX, int *pY, double angle)
The base class for create windows for drawing purpose.
void DoHypertextMenu(EDA_DRAW_FRAME *aFrame) override
bool Contains(const wxPoint &aPoint) const
wxString GetShownText(int aDepth=0) const override
Return the string actually shown after processing of the base text.
bool IsVoid() const
Function IsVoid returns true if the field is either empty or holds "~".
bool Replace(const wxFindReplaceData &aSearchData, void *aAuxData=NULL) override
Perform a text replace using the find and replace criteria in aSearchData on items that support text ...
int GetEffectiveTextPenWidth(int aDefaultWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultWidth.
void MIRROR(T &aPoint, const T &aMirrorRef)
Updates aPoint with the mirror of aPoint relative to the aMirrorRef.
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=NULL)
Draws text with the plotter.
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
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_HJUSTIFY_T GetHorizJustify() const
Field Value of part, i.e. "3.3K".
const wxPoint GetOrigin() const
void SetEnd(int x, int y)
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.
wxLogTrace helper definitions.
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Test if aPosition is contained within or on the bounding box of an item.
wxDC * GetPrintDC() const
static const wxString GetDefaultFieldName(int aFieldNdx)
wxPoint GetLibPosition() const
static const wxString GetDefaultFieldName(int aFieldNdx, bool aTranslate=true)
Return a default symbol field name for field aFieldNdx for all components.
TRANSFORM & GetTransform()
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
std::unique_ptr< LIB_PART > & GetPartRef()
BITMAP_DEF GetMenuImage() const override
Return a pointer to an image to be used in menus.
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...
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.
void GRText(wxDC *aDC, const wxPoint &aPos, 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)
Function GRText Draw a graphic text (like footprint texts)
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.
void Normalize()
Ensures that the height ant width are positive.
void SetRef(const SCH_SHEET_PATH *aSheet, const wxString &aReference)
Set the reference for the given sheet path for this symbol.
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)
void Plot(PLOTTER *aPlotter) override
Plot the schematic item to aPlotter.
bool IsForceVisible() const
RENDER_SETTINGS * RenderSettings()
const wxChar *const traceFindItem
Flag to enable find debug tracing.
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.
wxString GetName(bool aUseDefaultName=true) const
Function GetName returns the field name.
Handle the component boundary box.
static wxString SubReference(int aUnit, bool aAddSeparator=true)
wxPoint GetPosition() const override
A base class for most all the KiCad significant classes used in schematics and boards.
bool IsHorizJustifyFlipped() const
Function IsHorizJustifyFlipped Returns whether the field will be rendered with the horizontal justifi...
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
int GetMinPenWidth() const
bool IsReplaceable() const override
Override this method in any derived object that supports test find and replace.
bool ResolveTextVar(wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the sheet.
void Rotate(wxPoint aPosition) override
Rotate the item around aPosition 90 degrees in the clockwise direction.
Definition for part library class.
SCH_SHEET_PATH & CurrentSheet() const override
wxPoint GetParentPosition() const
void Print(const RENDER_SETTINGS *aSettings, const wxPoint &aOffset) override
Print a schematic item.
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.
int GetPenWidth() 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.
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const
Return the reference for the given sheet path.
A color representation with 4 components: red, green, blue, alpha.
Field Name Module PCB, i.e. "16DIP300".