79 wxPoint location = aPoint;
113 bool isFlipped = currentAngle >= 1800.0;
114 bool needsFlipped = newAngle >= 1800.0;
116 if( isFlipped != needsFlipped )
177 if( aMirrorAroundXAxis )
205 if( parentFootprint )
222 if( parentFootprint )
253 if( parentFootprint )
259 while( rotation > 900 )
262 while( rotation < 0 )
279 static const wxString text_type_msg[3] =
281 _(
"Ref." ),
_(
"Value" ),
_(
"Text" )
284 aList.emplace_back(
_(
"Footprint" ), fp ? fp->
GetReference() :
_(
"<invalid>" ) );
290 aList.emplace_back(
_(
"Type" ), text_type_msg[
m_Type] );
293 aList.emplace_back(
_(
"Status" ),
_(
"locked" ) );
295 aList.emplace_back(
_(
"Display" ),
IsVisible() ?
_(
"Yes" ) :
_(
"No" ) );
300 aList.emplace_back(
_(
"Mirror" ),
IsMirrored() ?
_(
"Yes" ) :
_(
"No" ) );
303 aList.emplace_back(
_(
"Angle" ), msg );
306 aList.emplace_back(
_(
"Thickness" ), msg );
309 aList.emplace_back(
_(
"Width" ), msg );
312 aList.emplace_back(
_(
"Height" ), msg );
322 static_cast<FOOTPRINT*>(
GetParent() )->GetReference() );
327 static_cast<FOOTPRINT*>(
GetParent() )->GetReference() );
332 static_cast<FOOTPRINT*>(
GetParent() )->GetReference() );
374 constexpr
double HIDE = (double)std::numeric_limits<double>::max();
413 wxASSERT( parentFootprint );
416 std::function<bool( wxString* )> footprintResolver =
417 [&]( wxString* token ) ->
bool 419 return parentFootprint && parentFootprint->
ResolveTextVar( token, aDepth );
422 std::function<bool( wxString* )> boardTextResolver =
423 [&]( wxString* token ) ->
bool 428 bool processTextVars =
false;
431 if( processTextVars )
435 if( parentFootprint && parentFootprint->
GetParent() )
436 project = static_cast<BOARD*>( parentFootprint->
GetParent() )->GetProject();
439 text =
ExpandTextVars( text, &footprintResolver, &boardTextResolver, project );
void SetMirrored(bool isMirrored)
virtual double GetDrawRotation() const override
void Offset(const wxPoint &aOffset)
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
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.
void KeepUpright(double aOldOrientation, double aNewOrientation)
Called when rotating the parent footprint.
static PROPERTY_MANAGER & Instance()
class FP_TEXT, text in a footprint
Container for project specific data.
PNG memory record (file in memory).
const EDA_RECT GetBoundingBoxRotated(wxPoint aRotCenter, double aAngle) const
Useful to calculate bounding box of rotated items, when rotation if not k*90 degrees.
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject)
virtual const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Implementation of conversion functions that require both schematic and board internal units.
bool IsKeepUpright() const
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
void Move(const wxPoint &aMoveVector) override
move text in move transform, in footprint editor
bool IsBackLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a back layer.
void SetTextAngle(double aAngle) override
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
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)
const BITMAP_OPAQUE text_xpm[1]
double GetTextAngle() const
void SetDrawCoord()
Set relative coordinates.
show footprints values (when texts are visibles)
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.
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
virtual std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER) const override
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
void Rotate(const wxPoint &aOffset, double aAngle) override
Rotate text, in footprint editor (for instance in footprint rotation transform)
void RotatePoint(int *pX, int *pY, double angle)
void NORMALIZE_ANGLE_POS(T &Angle)
int GetTextThickness() const
The base class for create windows for drawing purpose.
#define NO_SETTER(owner, type)
void Mirror(const wxPoint &aCentre, bool aMirrorAroundXAxis)
Mirror text position in footprint editing the text itself is not mirrored, and the layer not modified...
virtual void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
bool Contains(const wxPoint &aPoint) const
int GetTextHeight() const
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
#define DEFAULT_TEXT_WIDTH
PCB_LAYER_ID
A quick note on layer IDs:
wxPoint m_Pos0
text coordinates relative to the footprint anchor, orient 0.
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
void Flip(const wxPoint &aCentre, bool aFlipLeftRight) override
Flip entity during footprint flip.
static struct FP_TEXT_DESC _FP_TEXT_DESC
FP_TEXT(FOOTPRINT *aParentFootprint, TEXT_TYPE text_type=TEXT_is_DIVERS)
const wxPoint GetPosition() const
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
void InheritsAfter(TYPE_ID aDerived, TYPE_ID aBase)
Declare an inheritance relationship between types.
wxString ShortenedShownText() const
Returns a shortened version (max 15 characters) of the shown text.
bool m_keepUpright
if true, keep rotation angle between -90 .
TEXT_TYPE
Footprint text type: there must be only one (and only one) for each of the reference value texts in o...
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
TEXT_TYPE m_Type
0=ref, 1=val, etc.
class FOOTPRINT, a footprint
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
bool IsFrontLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a front layer.
BITMAP_DEF GetMenuImage() const override
Return a pointer to an image to be used in menus.
const EDA_RECT GetBoundingBox() const override
Set absolute coordinates.
virtual bool IsLocked() const
double GetTextAngleDegrees() const
std::shared_ptr< SHAPE_COMPOUND > GetEffectiveTextShape() const
Information pertinent to a Pcbnew printed circuit board.
void SetHorizJustify(EDA_TEXT_HJUSTIFY_T aType)
wxString UnescapeString(const wxString &aSource)
bool IsParentFlipped() const
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
void AddTypeCast(TYPE_CAST_BASE *aCast)
Register a type converter.
void AddProperty(PROPERTY_BASE *aProperty)
Register a property.
Handle the component boundary box.
T MIRRORVAL(T aPoint, T aMirrorRef)
Returns the mirror of aPoint relative to the aMirrorRef.
wxString GetParentAsString() const
A base class for most all the KiCad significant classes used in schematics and boards.
bool Intersects(const EDA_RECT &aRect) const
Test for a common area between rectangles.
const wxPoint & GetTextPos() const
bool TextHitTest(const wxPoint &aPoint, int aAccuracy=0) const override
Test if aPoint is within the bounds of this object.
Provide class metadata.Helper macro to map type hashes to names.
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
virtual void SetTextAngle(double aAngle)
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
T NormalizeAngle360Min(T Angle)
Normalize angle to be > -360.0 and < 360.0 Angle equal to -360 or +360 are set to 0.
bool ResolveTextVar(wxString *token, int aDepth) const
BOARD_ITEM_CONTAINER * GetParent() const
virtual wxString GetShownText(int aDepth=0) const override
Return the string actually shown after processing of the base text.
wxString GetLayerName() const
Return the name of the PCB layer on which the item resides.
static constexpr int Millimeter2iu(double mm)
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
virtual const wxString & GetText() const
Return the string associated with the text object.
virtual wxString GetShownText(int aDepth=0) const
Return the string actually shown after processing of the base text.
show footprints references (when texts are visibles)
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
const wxSize GetSize() const
KICAD_T Type() const
Returns the type of object.
bool IsLayerVisible(int aLayer) const
Return information about visibility of a particular layer.