KiCad PCB EDA Suite
lib_field.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2004-2020 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 #include <fctsys.h>
26 #include <pgm_base.h>
27 #include <gr_basic.h>
28 #include <base_struct.h>
29 #include <gr_text.h>
30 #include <kicad_string.h>
31 #include <sch_draw_panel.h>
32 #include <plotter.h>
33 #include <trigo.h>
34 #include <base_units.h>
35 #include <msgpanel.h>
36 #include <bitmaps.h>
37 #include <general.h>
38 #include <class_libentry.h>
39 #include <transform.h>
40 #include <lib_field.h>
41 #include <template_fieldnames.h>
43 
44 
45 LIB_FIELD::LIB_FIELD(LIB_PART * aParent, int idfield ) :
46  LIB_ITEM( LIB_FIELD_T, aParent )
47 {
48  Init( idfield );
49 }
50 
51 
52 LIB_FIELD::LIB_FIELD( int idfield ) :
54 {
55  Init( idfield );
56 }
57 
58 
59 LIB_FIELD::LIB_FIELD( int aID, const wxString& aName ) :
61 {
62  Init( aID );
63  m_name = aName;
64 }
65 
66 
68 {
69 }
70 
71 
73 {
74  m_id = field.m_id;
75  m_name = field.m_name;
76  m_Parent = field.m_Parent;
77 
78  SetText( field.GetText() );
79  SetEffects( field );
80 
81  return *this;
82 }
83 
84 
85 void LIB_FIELD::Init( int id )
86 {
87  m_id = id;
88 
91 
92  SetTextAngle( TEXT_ANGLE_HORIZ ); // constructor already did this.
93 
94  // Fields in RAM must always have names, because we are trying to get less dependent on
95  // field ids and more dependent on names. Plus assumptions are made in the field editors.
97 
98  // By contrast, VALUE and REFERENCE are are always constructed as initially visible, and
99  // template fieldsnames' initial visibility is controlled by the template fieldname config.
100  if( id == DATASHEET || id == FOOTPRINT )
101  SetVisible( false );
102 }
103 
104 
106 {
107  int pensize = GetThickness();
108 
109  if( pensize == 0 ) // Use default values for pen size
110  {
111  if( IsBold() )
112  pensize = GetPenSizeForBold( GetTextWidth() );
113  else
114  pensize = GetDefaultLineThickness();
115  }
116 
117  // Clip pen size for small texts:
118  pensize = Clamp_Text_PenSize( pensize, GetTextSize(), IsBold() );
119  return pensize;
120 }
121 
122 
123 void LIB_FIELD::print( wxDC* aDC, const wxPoint& aOffset, void* aData,
124  const TRANSFORM& aTransform )
125 {
127  int linewidth = GetPenSize();
128  wxPoint text_pos = aTransform.TransformCoordinate( GetTextPos() ) + aOffset;
129  wxString text = aData ? *static_cast<wxString*>( aData ) : GetText();
130 
131  GRText( aDC, text_pos, color, text, GetTextAngle(), GetTextSize(), GetHorizJustify(),
132  GetVertJustify(), linewidth, IsItalic(), IsBold() );
133 }
134 
135 
136 bool LIB_FIELD::HitTest( const wxPoint& aPosition, int aAccuracy ) const
137 {
138  // Because HitTest is mainly used to select the field return false if it is empty
139  if( GetText().IsEmpty() )
140  return false;
141 
142  // Build a temporary copy of the text for hit testing
143  EDA_TEXT tmp_text( *this );
144 
145  // Reference designator text has one or 2 additional character (displays U? or U?A)
146  if( m_id == REFERENCE )
147  {
148  const LIB_PART* parent = dynamic_cast<const LIB_PART*>( m_Parent );
149 
150  wxString extended_text = tmp_text.GetText();
151  extended_text.Append('?');
152 
153  if ( parent && parent->GetUnitCount() > 1 )
154  extended_text.Append('A');
155 
156  tmp_text.SetText( extended_text );
157  }
158 
160 
161  // The text orientation may need to be flipped if the transformation matrix causes xy axes
162  // to be flipped. This simple algo works only for schematic matrix (rot 90 or/and mirror)
163  bool t1 = ( DefaultTransform.x1 != 0 ) ^ ( GetTextAngle() != 0 );
164  tmp_text.SetTextAngle( t1 ? TEXT_ANGLE_HORIZ : TEXT_ANGLE_VERT );
165 
166  return tmp_text.TextHitTest( aPosition, aAccuracy );
167 }
168 
169 
171 {
172  LIB_FIELD* newfield = new LIB_FIELD( m_id );
173 
174  Copy( newfield );
175 
176  return (EDA_ITEM*) newfield;
177 }
178 
179 
180 void LIB_FIELD::Copy( LIB_FIELD* aTarget ) const
181 {
182  aTarget->m_name = m_name;
183 
184  aTarget->CopyText( *this );
185  aTarget->SetEffects( *this );
186  aTarget->SetParent( m_Parent );
187 }
188 
189 
190 int LIB_FIELD::compare( const LIB_ITEM& aOther, LIB_ITEM::COMPARE_FLAGS aCompareFlags ) const
191 {
192  wxASSERT( aOther.Type() == LIB_FIELD_T );
193 
194  int retv = LIB_ITEM::compare( aOther, aCompareFlags );
195 
196  if( retv )
197  return retv;
198 
199  const LIB_FIELD* tmp = ( LIB_FIELD* ) &aOther;
200 
201  if( m_id != tmp->m_id )
202  return m_id - tmp->m_id;
203 
204  int result = GetText().CmpNoCase( tmp->GetText() );
205 
206  if( result != 0 )
207  return result;
208 
209  if( GetTextPos().x != tmp->GetTextPos().x )
210  return GetTextPos().x - tmp->GetTextPos().x;
211 
212  if( GetTextPos().y != tmp->GetTextPos().y )
213  return GetTextPos().y - tmp->GetTextPos().y;
214 
215  if( GetTextWidth() != tmp->GetTextWidth() )
216  return GetTextWidth() - tmp->GetTextWidth();
217 
218  if( GetTextHeight() != tmp->GetTextHeight() )
219  return GetTextHeight() - tmp->GetTextHeight();
220 
221  return 0;
222 }
223 
224 
225 void LIB_FIELD::Offset( const wxPoint& aOffset )
226 {
227  EDA_TEXT::Offset( aOffset );
228 }
229 
230 
231 bool LIB_FIELD::Inside( EDA_RECT& rect ) const
232 {
233  return rect.Intersects( GetBoundingBox() );
234 }
235 
236 
237 void LIB_FIELD::MoveTo( const wxPoint& newPosition )
238 {
239  EDA_TEXT::SetTextPos( newPosition );
240 }
241 
242 
244 {
245  int x = GetTextPos().x;
246 
247  x -= center.x;
248  x *= -1;
249  x += center.x;
250 
251  SetTextX( x );
252 }
253 
254 
255 void LIB_FIELD::MirrorVertical( const wxPoint& center )
256 {
257  int y = GetTextPos().y;
258 
259  y -= center.y;
260  y *= -1;
261  y += center.y;
262 
263  SetTextY( y );
264 }
265 
266 
267 void LIB_FIELD::Rotate( const wxPoint& center, bool aRotateCCW )
268 {
269  int rot_angle = aRotateCCW ? -900 : 900;
270 
271  wxPoint pt = GetTextPos();
272  RotatePoint( &pt, center, rot_angle );
273  SetTextPos( pt );
274 
275  SetTextAngle( GetTextAngle() != 0.0 ? 0 : 900 );
276 }
277 
278 
279 void LIB_FIELD::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
280  const TRANSFORM& aTransform )
281 {
282  if( GetText().IsEmpty() )
283  return;
284 
285  // Calculate the text orientation, according to the component orientation/mirror
286  int orient = (int) GetTextAngle();
287 
288  if( aTransform.y1 ) // Rotate component 90 deg.
289  {
290  if( orient == TEXT_ANGLE_HORIZ )
291  orient = TEXT_ANGLE_VERT;
292  else
293  orient = TEXT_ANGLE_HORIZ;
294  }
295 
296  EDA_RECT BoundaryBox = GetBoundingBox();
297  BoundaryBox.RevertYAxis();
298 
301  wxPoint textpos = aTransform.TransformCoordinate( BoundaryBox.Centre() ) + aOffset;
302 
303  COLOR4D color;
304 
305  if( aPlotter->GetColorMode() )
306  color = aPlotter->ColorSettings()->GetColor( GetDefaultLayer() );
307  else
309 
310  aPlotter->Text( textpos, color, GetShownText(), orient, GetTextSize(),
311  hjustify, vjustify, GetPenSize(), IsItalic(), IsBold() );
312 }
313 
314 
315 wxString LIB_FIELD::GetFullText( int unit ) const
316 {
317  if( m_id != REFERENCE )
318  return GetText();
319 
320  wxString text = GetText();
321  text << wxT( "?" );
322 
323  if( GetParent()->IsMulti() )
324  text << LIB_PART::SubReference( unit );
325 
326  return text;
327 }
328 
329 
331 {
332  /* Y coordinates for LIB_ITEMS are bottom to top, so we must invert the Y position when
333  * calling GetTextBox() that works using top to bottom Y axis orientation.
334  */
335  EDA_RECT rect = GetTextBox( -1, -1, true, GetTextMarkupFlags() );
336  rect.RevertYAxis();
337 
338  // We are using now a bottom to top Y axis.
339  wxPoint orig = rect.GetOrigin();
340  wxPoint end = rect.GetEnd();
341 
342  RotatePoint( &orig, GetTextPos(), -GetTextAngle() );
343  RotatePoint( &end, GetTextPos(), -GetTextAngle() );
344 
345  rect.SetOrigin( orig );
346  rect.SetEnd( end );
347 
348  // We are using now a top to bottom Y axis:
349  rect.RevertYAxis();
350 
351  return rect;
352 }
353 
354 
355 void LIB_FIELD::ViewGetLayers( int aLayers[], int& aCount ) const
356 {
357  aCount = 2;
358 
359  switch( m_id )
360  {
361  case REFERENCE: aLayers[0] = LAYER_REFERENCEPART; break;
362  case VALUE: aLayers[0] = LAYER_VALUEPART; break;
363  default: aLayers[0] = LAYER_FIELDS; break;
364  }
365 
366  aLayers[1] = LAYER_SELECTION_SHADOWS;
367 }
368 
369 
371 {
372  switch( m_id )
373  {
374  case REFERENCE: return LAYER_REFERENCEPART;
375  case VALUE: return LAYER_VALUEPART;
376  default: return LAYER_FIELDS;
377  }
378 }
379 
380 
382 {
383  return GetLayerColor( GetDefaultLayer() );
384 }
385 
386 
387 wxString LIB_FIELD::GetName( bool aTranslate ) const
388 {
389  switch( m_id )
390  {
391  case REFERENCE: return aTranslate ? _( "Reference" ) : wxT( "Reference" );
392  case VALUE: return aTranslate ? _( "Value" ) : wxT( "Value" );
393  case FOOTPRINT: return aTranslate ? _( "Footprint" ) : wxT( "Footprint" );
394  case DATASHEET: return aTranslate ? _( "Datasheet" ) : wxT( "Datasheet" );
395 
396  default:
397  if( m_name.IsEmpty() )
398  return aTranslate ? wxString::Format( _( "Field%d" ), m_id )
399  : wxString::Format( wxT( "Field%d" ), m_id );
400  else
401  return m_name;
402  }
403 }
404 
405 
406 void LIB_FIELD::SetName( const wxString& aName )
407 {
408  // Mandatory field names are fixed.
409 
410  // So what? Why should the low level code be in charge of such a policy issue?
411  // Besides, m_id is a relic that is untrustworthy now.
412  if( m_id >=0 && m_id < MANDATORY_FIELDS )
413  {
414  DBG(printf( "trying to set a MANDATORY_FIELD's name\n" );)
415  return;
416  }
417 
418  if( m_name != aName )
419  {
420  m_name = aName;
421  SetModified();
422  }
423 }
424 
425 
426 wxString LIB_FIELD::GetSelectMenuText( EDA_UNITS aUnits ) const
427 {
428  return wxString::Format( _( "Field %s \"%s\"" ), GetName( TRANSLATE_FIELD_NAME ),
429  ShortenedShownText() );
430 }
431 
432 
433 void LIB_FIELD::BeginEdit( const wxPoint aPosition )
434 {
435  SetTextPos( aPosition );
436 }
437 
438 
439 void LIB_FIELD::CalcEdit( const wxPoint& aPosition )
440 {
441  SetTextPos( aPosition );
442 }
443 
444 
446 {
447  wxString msg;
448 
449  LIB_ITEM::GetMsgPanelInfo( aUnits, aList );
450 
451  // Display style:
452  msg = GetTextStyleName();
453  aList.push_back( MSG_PANEL_ITEM( _( "Style" ), msg, MAGENTA ) );
454 
455  msg = MessageTextFromValue( aUnits, GetTextWidth(), true );
456  aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, BLUE ) );
457 
458  msg = MessageTextFromValue( aUnits, GetTextHeight(), true );
459  aList.push_back( MSG_PANEL_ITEM( _( "Height" ), msg, BLUE ) );
460 
461  // Display field name (ref, value ...)
462  aList.push_back( MSG_PANEL_ITEM( _( "Field" ), GetName( TRANSLATE_FIELD_NAME ), BROWN ) );
463 
464  // Display field text:
465  aList.push_back( MSG_PANEL_ITEM( _( "Value" ), GetShownText(), BROWN ) );
466 }
467 
468 
470 {
471  return move_xpm;
472 }
473 
474 
476 {
477  return m_id < MANDATORY_FIELDS;
478 }
void SetTextAngle(double aAngle)
Definition: eda_text.h:150
Definition: colors.h:57
#define TEXT_ANGLE_HORIZ
EDA_UNITS
Definition: common.h:184
bool IsBold() const
Definition: eda_text.h:167
void MirrorVertical(const wxPoint &aCenter) override
Mirror the draw object along the MirrorVertical (Y) axis about aCenter point.
Definition: lib_field.cpp:255
void Offset(const wxPoint &aOffset)
Definition: eda_text.h:237
void SetModified()
Definition: base_struct.cpp:94
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
Definition: lib_field.cpp:426
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:183
EDA_TEXT_HJUSTIFY_T
Definition: eda_text.h:44
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:184
name of datasheet
PNG memory record (file in memory).
Definition: bitmap_def.h:29
LIB_FIELD(int idfield=2)
Definition: lib_field.cpp:52
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Function HitTest tests if aPosition is contained within or on the bounding box of an item.
Definition: lib_field.cpp:136
void GetMsgPanelInfo(EDA_UNITS aUnits, std::vector< MSG_PANEL_ITEM > &aList) override
Display basic info (type, part and convert) about the current item in message panel.
Definition: lib_item.cpp:52
int GetPenSizeForBold(int aTextSize)
Function GetPensizeForBold.
Definition: gr_text.cpp:66
#define TEXT_ANGLE_VERT
void CopyText(const EDA_TEXT &aSrc)
Definition: eda_text.cpp:118
Implementation of conversion functions that require both schematic and board internal units.
void CalcEdit(const wxPoint &aPosition) override
Calculate the new circle at aPosition when editing.
Definition: lib_field.cpp:439
LIB_PART * GetParent() const
Definition: lib_item.h:185
bool IsVisible() const
Definition: eda_text.h:170
void SetEffects(const EDA_TEXT &aSrc)
Set the text effects from another instance.
Definition: eda_text.cpp:125
Definition: colors.h:61
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
int color
Definition: DXF_plotter.cpp:61
Field object used in symbol libraries.
Definition: lib_field.h:59
int GetDefaultLineThickness()
Default line thickness used to draw/plot items having a default thickness line value (i....
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:231
void SetVisible(bool aVisible)
Definition: eda_text.h:169
double GetTextAngle() const
Definition: eda_text.h:158
TRANSFORM DefaultTransform
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:131
int GetThickness() const
Return the pen width.
Definition: eda_text.h:148
void GetMsgPanelInfo(EDA_UNITS aUnits, std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for displ...
Definition: lib_field.cpp:445
int x1
Definition: transform.h:48
static const wxString GetDefaultFieldName(int aFieldNdx)
Function GetDefaultFieldName returns a default symbol field name for field aFieldNdx for all componen...
BITMAP_DEF GetMenuImage() const override
Function GetMenuImage returns a pointer to an image to be used in menus.
Definition: lib_field.cpp:469
void MirrorHorizontal(const wxPoint &aCenter) override
Mirror the draw object along the horizontal (X) axis about aCenter point.
Definition: lib_field.cpp:243
void MoveTo(const wxPoint &aPosition) override
Move a draw object to aPosition.
Definition: lib_field.cpp:237
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
Definition: lib_field.cpp:330
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
COLOR4D GetDefaultColor() override
Definition: lib_field.cpp:381
void SetName(const wxString &aName)
Set a user definable field name to aName.
Definition: lib_field.cpp:406
void RevertYAxis()
Function RevertYAxis Mirror the rectangle from the X axis (negate Y pos and size)
Definition: eda_rect.h:209
COLOR4D GetInvisibleItemColor()
#define TRANSLATE_FIELD_NAME
Returns the field name.
Definition: lib_field.h:124
Field Reference of part, i.e. "IC21".
wxPoint TransformCoordinate(const wxPoint &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition: transform.cpp:42
The base class for drawable items used by schematic library components.
Definition: lib_item.h:60
void Offset(const wxPoint &aOffset) override
Set the drawing object by aOffset from the current position.
Definition: lib_field.cpp:225
int GetTextHeight() const
Definition: eda_text.h:229
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.
Definition: gr_text.cpp:232
void SetTextX(int aX)
Definition: eda_text.h:234
bool IsItalic() const
Definition: eda_text.h:164
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:109
int y1
Definition: transform.h:49
const wxPoint GetEnd() const
Definition: eda_rect.h:116
void ViewGetLayers(int aLayers[], int &aCount) const override
Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on.
Definition: lib_field.cpp:355
#define VALUE
int GetTextMarkupFlags()
Definition: gr_text.cpp:55
for transforming drawing coordinates for a wxDC device context.
Definition: transform.h:45
int Clamp_Text_PenSize(int aPenSize, int aSize, bool aBold)
Function Clamp_Text_PenSize Don't allow text to become cluttered up in its own fatness.
Definition: gr_text.cpp:81
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:183
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:111
#define NULL
int GetUnitCount() const override
For items with units, return the number of units.
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:218
COMPARE_FLAGS
The list of flags used by the compare function.
Definition: lib_item.h:116
COLOR_SETTINGS * ColorSettings()
Definition: plotter.h:145
const wxPoint GetOrigin() const
Definition: eda_rect.h:114
Class LIB_PIN definition.
EDA_RECT GetTextBox(int aLine=-1, int aThickness=-1, bool aInvertY=false, int aMarkupFlags=0) const
Useful in multiline texts to calculate the full text or a line area (for zones filling,...
Definition: eda_text.cpp:184
void SetEnd(int x, int y)
Definition: eda_rect.h:192
const wxSize & GetTextSize() const
Definition: eda_text.h:223
void Copy(LIB_FIELD *aTarget) const
Copy parameters of this field to another field.
Definition: lib_field.cpp:180
bool Inside(EDA_RECT &aRect) const override
Test if any part of the draw object is inside rectangle bounds of aRect.
Definition: lib_field.cpp:231
void Rotate(const wxPoint &aCenter, bool aRotateCCW=true) override
Rotate the object about aCenter point.
Definition: lib_field.cpp:267
const BITMAP_OPAQUE move_xpm[1]
Definition: move.cpp:59
void Plot(PLOTTER *aPlotter, const wxPoint &aOffset, bool aFill, const TRANSFORM &aTransform) override
Plot the draw item using the plot object.
Definition: lib_field.cpp:279
Define a library symbol object.
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Helper for all the old plotting/printing code while it still exists.
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: lib_field.cpp:170
wxString ShortenedShownText() const
Returns a shortened version (max 15 characters) of the shown text.
Definition: eda_text.cpp:163
LIB_FIELD & operator=(const LIB_FIELD &field)
Definition: lib_field.cpp:72
void Init(int idfield)
Object constructor initialization helper.
Definition: lib_field.cpp:85
SCH_LAYER_ID GetDefaultLayer()
Definition: lib_field.cpp:370
SCH_LAYER_ID
Eeschema drawing layers.
void print(wxDC *aDC, const wxPoint &aOffset, void *aData, const TRANSFORM &aTransform) override
Print the field.
Definition: lib_field.cpp:123
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 module texts)
Definition: gr_text.cpp:143
EDA_TEXT_VJUSTIFY_T
Definition: eda_text.h:51
void SetTextWidth(int aWidth)
Definition: eda_text.h:225
int m_id
Definition: lib_field.h:61
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aUseMils, EDA_DATA_TYPE aType)
Definition: base_units.cpp:127
Base plotter engine class.
Definition: plotter.h:104
COLOR4D GetColor(int aLayer) const
void BeginEdit(const wxPoint aStartPoint) override
Begin drawing a component library draw item at aPosition.
Definition: lib_field.cpp:433
int GetTextWidth() const
Definition: eda_text.h:226
see class PGM_BASE
wxString GetTextStyleName()
Definition: eda_text.cpp:445
wxString GetName(bool aTranslate) const
Definition: lib_field.cpp:387
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#define _(s)
Definition: 3d_actions.cpp:33
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
wxString GetFullText(int unit=1) const
Return the text of a field.
Definition: lib_field.cpp:315
virtual bool TextHitTest(const wxPoint &aPoint, int aAccuracy=0) const
Test if aPoint is within the bounds of this object.
Definition: eda_text.cpp:336
static wxString SubReference(int aUnit, bool aAddSeparator=true)
void SetTextHeight(int aHeight)
Definition: eda_text.h:228
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:166
std::vector< MSG_PANEL_ITEM > MSG_PANEL_ITEMS
Definition: msgpanel.h:102
wxPoint Centre() const
Definition: eda_rect.h:62
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
const wxPoint & GetTextPos() const
Definition: eda_text.h:232
int GetPenSize() const override
Definition: lib_field.cpp:105
#define DBG(x)
Definition: fctsys.h:33
virtual wxString GetShownText() const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:129
Definition: colors.h:45
EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53
wxString m_name
Name (not the field text value itself, that is .m_Text)
Definition: lib_field.h:62
Message panel definition file.
virtual int compare(const LIB_ITEM &aOther, LIB_ITEM::COMPARE_FLAGS aCompareFlags=LIB_ITEM::COMPARE_FLAGS::NORMAL) const
Provide the draw object specific comparison called by the == and < operators.
Definition: lib_item.cpp:76
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:123
int compare(const LIB_ITEM &aOther, LIB_ITEM::COMPARE_FLAGS aCompareFlags=LIB_ITEM::COMPARE_FLAGS::NORMAL) const override
Provide the draw object specific comparison called by the == and < operators.
Definition: lib_field.cpp:190
void SetTextY(int aY)
Definition: eda_text.h:235
bool IsMandatory() const
Definition: lib_field.cpp:475
int GetDefaultTextSize()
Default size for text in general.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:40
bool GetColorMode() const
Definition: plotter.h:138
Definition: colors.h:62