130 m_spin_style( aText.m_spin_style )
197 wxFAIL_MSG(
"Bad spin style" );
243 auto other =
static_cast<const SCH_TEXT*
>( &aItem );
245 if(
GetLayer() != other->GetLayer() )
246 return GetLayer() < other->GetLayer();
254 return GetText() < other->GetText();
296 if( blackAndWhiteMode ||
color == COLOR4D::UNSPECIFIED )
310 int adjust =
KiROUND( sizeDiff * 0.4 );
311 VECTOR2I adjust_offset( 0, - adjust );
314 text_offset += adjust_offset;
344 std::function<bool( wxString* )> textResolver =
345 [&]( wxString* token ) ->
bool
349 if( sheet->ResolveTextVar( token, aDepth + 1 ) )
358 if(
text == wxS(
"~" ) )
375 "Calling a hypertext menu on a SCH_TEXT with no hyperlink?" );
451 int adjust =
KiROUND( sizeDiff * 0.4 );
452 VECTOR2I adjust_offset( 0, - adjust );
455 text_offset += adjust_offset;
458 std::vector<VECTOR2I> positions;
459 wxArrayString strings_list;
461 positions.reserve( strings_list.Count() );
469 for(
unsigned ii = 0; ii < strings_list.Count(); ii++ )
471 VECTOR2I textpos = positions[ii] + text_offset;
472 wxString& txt = strings_list.Item( ii );
488 aList.emplace_back(
_(
"Font" ),
GetFont() ?
GetFont()->GetName() :
_(
"Default" ) );
490 wxString textStyle[] = {
_(
"Normal" ),
_(
"Italic" ),
_(
"Bold" ),
_(
"Bold Italic" ) };
492 aList.emplace_back(
_(
"Style" ), textStyle[style] );
502 default: msg = wxT(
"???" );
break;
505 aList.emplace_back(
_(
"Justification" ), msg );
511void SCH_TEXT::Show(
int nestLevel, std::ostream& os )
const
516 NestedSpace( nestLevel, os ) <<
'<' << s.Lower().mb_str()
517 <<
" layer=\"" <<
m_layer <<
'"'
520 <<
"</" << s.Lower().mb_str() <<
">\n";
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
bool Intersects(const BOX2< Vec > &aRect) const
coord_type GetHeight() 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)
The base class for create windows for drawing purpose.
KICAD_T Type() const
Returns the type of object.
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
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
virtual EDA_ANGLE GetDrawRotation() const
wxString m_hyperlink
A hyperlink URL.
virtual bool HasHyperlink() const
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
wxString GetHyperlink() const
bool HasTextVars() const
Indicates the ShownText has text var references which need to be processed.
void GetLinePositions(std::vector< VECTOR2I > &aPositions, int aLineCount) const
Populate aPositions with the position of each line of a multiline text, according to the vertical jus...
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.
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
virtual wxString GetShownText(int aDepth=0, bool aAllowExtraText=true) const
Return the string actually shown after processing of the base text.
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 SwapText(EDA_TEXT &aTradingPartner)
void SetMultilineAllowed(bool aAllow)
VECTOR2I GetTextSize() const
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
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)
virtual bool IsOutline() const
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.
Store schematic specific render settings.
Base plotter engine class.
RENDER_SETTINGS * RenderSettings()
virtual void HyperlinkBox(const BOX2I &aBox, const wxString &aDestinationURL)
Create a clickable hyperlink with a rectangular click area.
virtual void PlotText(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const TEXT_ATTRIBUTES &aAttributes, KIFONT::FONT *aFont, void *aData=nullptr)
bool GetColorMode() const
virtual void SetCurrentLineWidth(int width, void *aData=nullptr)=0
Set the line width for the next drawing.
SCH_SHEET_PATH & CurrentSheet() const override
SCHEMATIC_SETTINGS & Settings() const
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
Base class for any item which can be embedded within the SCHEMATIC container class,...
const wxString & GetDefaultFont() const
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
SCH_CONNECTION * Connection(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve the connection associated with this object in the given sheet.
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
void DoHypertextAction(EDA_DRAW_FRAME *aFrame) const override
bool IsHypertext() const override
Allow items to support hypertext actions when hovered/clicked.
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
void Plot(PLOTTER *aPlotter, bool aBackground) const override
Plot the schematic item to aPlotter.
wxString GetShownText(int aDepth=0, bool aAllowExtraText=true) const override
Return the string actually shown after processing of the base text.
bool operator<(const SCH_ITEM &aItem) const override
VECTOR2I GetPosition() const override
virtual void Rotate90(bool aClockwise)
KIFONT::FONT * getDrawFont() const override
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
void Rotate(const VECTOR2I &aCenter) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
TEXT_SPIN_STYLE GetTextSpinStyle() const
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
virtual wxString GetClass() const override
Return the class name.
int GetPenWidth() const override
virtual void SetTextSpinStyle(TEXT_SPIN_STYLE aSpinStyle)
Set a spin or rotation angle, along with specific horizontal and vertical justification styles with e...
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the layers the item is drawn on (which may be more than its "home" layer)
TEXT_SPIN_STYLE m_spin_style
The orientation of text and any associated drawing elements of derived objects.
void Print(const RENDER_SETTINGS *aSettings, const VECTOR2I &offset) override
Print a schematic item.
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
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.
virtual VECTOR2I GetSchematicTextOffset(const RENDER_SETTINGS *aSettings) const
This offset depends on the orientation, the type of text, and the area required to draw the associate...
SCH_TEXT(const VECTOR2I &aPos={ 0, 0 }, const wxString &aText=wxEmptyString, KICAD_T aType=SCH_TEXT_T)
virtual void MirrorSpinStyle(bool aLeftRight)
int GetTextOffset(const RENDER_SETTINGS *aSettings=nullptr) const
TEXT_SPIN_STYLE RotateCW()
TEXT_SPIN_STYLE MirrorY()
Mirror the label spin style across the Y axis or simply swaps left and right.
TEXT_SPIN_STYLE RotateCCW()
TEXT_SPIN_STYLE()=default
TEXT_SPIN_STYLE MirrorX()
Mirror the label spin style across the X axis or simply swaps up and bottom.
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_TEXT_OFFSET_RATIO
Ratio of the font height to space around global labels.
static constexpr EDA_ANGLE & ANGLE_HORIZONTAL
static constexpr EDA_ANGLE & ANGLE_VERTICAL
static constexpr EDA_ANGLE & ANGLE_90
bool GetGRForceBlackPenState(void)
@ LAYER_SELECTION_SHADOWS
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
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.
wxString EllipsizeStatusText(wxWindow *aWindow, const wxString &aString)
Ellipsize text (at the end) to be no more than 1/3 of the window width.
Plot settings, and plotting engines (PostScript, Gerber, HPGL and DXF)
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Split aString to a string list separated at aSplitter.
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".