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-2021 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 <eda_item.h>
26 #include <string_utils.h>
27 #include <sch_draw_panel.h>
28 #include <eda_draw_frame.h>
29 #include <plotters/plotter.h>
30 #include <trigo.h>
31 #include <base_units.h>
32 #include <widgets/msgpanel.h>
33 #include <bitmaps.h>
34 #include <general.h>
35 #include <lib_symbol.h>
36 #include <transform.h>
37 #include <lib_field.h>
38 #include <template_fieldnames.h>
40 
41 
42 LIB_FIELD::LIB_FIELD( LIB_SYMBOL* aParent, int aId ) :
43  LIB_ITEM( LIB_FIELD_T, aParent )
44 {
45  Init( aId );
46 }
47 
48 
50  LIB_ITEM( LIB_FIELD_T, nullptr )
51 {
52  Init( aId );
53 }
54 
55 
56 LIB_FIELD::LIB_FIELD( int aId, const wxString& aName ) :
57  LIB_ITEM( LIB_FIELD_T, nullptr )
58 {
59  Init( aId );
60  m_name = aName;
61 }
62 
63 
65 {
66 }
67 
68 
70 {
71  m_id = field.m_id;
72  m_name = field.m_name;
73  m_parent = field.m_parent;
74 
75  SetText( field.GetText() );
76  SetEffects( field );
77 
78  return *this;
79 }
80 
81 
82 void LIB_FIELD::Init( int aId )
83 {
84  wxCHECK2( aId >= 0, aId = MANDATORY_FIELDS );
85 
86  m_id = aId;
87 
88  SetTextAngle( TEXT_ANGLE_HORIZ ); // constructor already did this.
89 
90  // Fields in RAM must always have names, because we are trying to get less dependent on
91  // field ids and more dependent on names. Plus assumptions are made in the field editors.
93 
94  // By contrast, VALUE and REFERENCE are are always constructed as initially visible, and
95  // template fieldsnames' initial visibility is controlled by the template fieldname config.
96  if( aId == DATASHEET_FIELD || aId == FOOTPRINT_FIELD )
97  SetVisible( false );
98 }
99 
100 
101 void LIB_FIELD::SetId( int aId )
102 {
103  wxCHECK2( aId >= 0, aId = MANDATORY_FIELDS );
104  m_id = aId;
105 }
106 
107 
109 {
110  return GetEffectiveTextPenWidth();
111 }
112 
113 
114 void LIB_FIELD::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
115  const TRANSFORM& aTransform )
116 {
117  wxDC* DC = aSettings->GetPrintDC();
119  int penWidth = GetEffectivePenWidth( aSettings );
120  wxPoint text_pos = aTransform.TransformCoordinate( GetTextPos() ) + aOffset;
121  wxString text = aData ? *static_cast<wxString*>( aData ) : GetText();
122 
123  GRText( DC, text_pos, color, text, GetTextAngle(), GetTextSize(), GetHorizJustify(),
124  GetVertJustify(), penWidth, IsItalic(), IsBold() );
125 }
126 
127 
128 bool LIB_FIELD::HitTest( const wxPoint& aPosition, int aAccuracy ) const
129 {
130  // Because HitTest is mainly used to select the field return false if it is empty
131  if( GetText().IsEmpty() )
132  return false;
133 
134  // Build a temporary copy of the text for hit testing
135  EDA_TEXT tmp_text( *this );
136 
137  // Reference designator text has one or 2 additional character (displays U? or U?A)
138  if( m_id == REFERENCE_FIELD )
139  {
140  const LIB_SYMBOL* parent = dynamic_cast<const LIB_SYMBOL*>( m_parent );
141 
142  wxString extended_text = tmp_text.GetText();
143  extended_text.Append('?');
144 
145  if ( parent && parent->GetUnitCount() > 1 )
146  extended_text.Append('A');
147 
148  tmp_text.SetText( extended_text );
149  }
150 
152 
153  // The text orientation may need to be flipped if the transformation matrix causes xy axes
154  // to be flipped. This simple algo works only for schematic matrix (rot 90 or/and mirror)
155  bool t1 = ( DefaultTransform.x1 != 0 ) ^ ( GetTextAngle() != 0 );
156  tmp_text.SetTextAngle( t1 ? TEXT_ANGLE_HORIZ : TEXT_ANGLE_VERT );
157 
158  return tmp_text.TextHitTest( aPosition, aAccuracy );
159 }
160 
161 
163 {
164  LIB_FIELD* newfield = new LIB_FIELD( m_id );
165 
166  Copy( newfield );
167 
168  return (EDA_ITEM*) newfield;
169 }
170 
171 
172 void LIB_FIELD::Copy( LIB_FIELD* aTarget ) const
173 {
174  aTarget->m_name = m_name;
175 
176  aTarget->CopyText( *this );
177  aTarget->SetEffects( *this );
178  aTarget->SetParent( m_parent );
179 }
180 
181 
182 int LIB_FIELD::compare( const LIB_ITEM& aOther, LIB_ITEM::COMPARE_FLAGS aCompareFlags ) const
183 {
184  wxASSERT( aOther.Type() == LIB_FIELD_T );
185 
186  int retv = LIB_ITEM::compare( aOther, aCompareFlags );
187 
188  if( retv )
189  return retv;
190 
191  const LIB_FIELD* tmp = ( LIB_FIELD* ) &aOther;
192 
193  // Equality test will vary depending whether or not the field is mandatory. Otherwise,
194  // sorting is done by ordinal.
195  if( aCompareFlags & LIB_ITEM::COMPARE_FLAGS::EQUALITY )
196  {
197  // Mandatory fields have fixed ordinals and their names can vary due to translated field
198  // names. Optional fields have fixed names and their ordinals can vary.
199  if( IsMandatory() )
200  {
201  if( m_id != tmp->m_id )
202  return m_id - tmp->m_id;
203  }
204  else
205  {
206  retv = m_name.Cmp( tmp->m_name );
207 
208  if( retv )
209  return retv;
210  }
211  }
212  else
213  {
214  if( m_id != tmp->m_id )
215  return m_id - tmp->m_id;
216  }
217 
218  retv = GetText().CmpNoCase( tmp->GetText() );
219 
220  if( retv != 0 )
221  return retv;
222 
223  if( GetTextPos().x != tmp->GetTextPos().x )
224  return GetTextPos().x - tmp->GetTextPos().x;
225 
226  if( GetTextPos().y != tmp->GetTextPos().y )
227  return GetTextPos().y - tmp->GetTextPos().y;
228 
229  if( GetTextWidth() != tmp->GetTextWidth() )
230  return GetTextWidth() - tmp->GetTextWidth();
231 
232  if( GetTextHeight() != tmp->GetTextHeight() )
233  return GetTextHeight() - tmp->GetTextHeight();
234 
235  return 0;
236 }
237 
238 
239 void LIB_FIELD::Offset( const wxPoint& aOffset )
240 {
241  EDA_TEXT::Offset( aOffset );
242 }
243 
244 
245 void LIB_FIELD::MoveTo( const wxPoint& newPosition )
246 {
247  EDA_TEXT::SetTextPos( newPosition );
248 }
249 
250 
251 void LIB_FIELD::MirrorHorizontal( const wxPoint& center )
252 {
253  int x = GetTextPos().x;
254 
255  x -= center.x;
256  x *= -1;
257  x += center.x;
258 
259  SetTextX( x );
260 }
261 
262 
263 void LIB_FIELD::MirrorVertical( const wxPoint& center )
264 {
265  int y = GetTextPos().y;
266 
267  y -= center.y;
268  y *= -1;
269  y += center.y;
270 
271  SetTextY( y );
272 }
273 
274 
275 void LIB_FIELD::Rotate( const wxPoint& center, bool aRotateCCW )
276 {
277  int rot_angle = aRotateCCW ? -900 : 900;
278 
279  wxPoint pt = GetTextPos();
280  RotatePoint( &pt, center, rot_angle );
281  SetTextPos( pt );
282 
283  SetTextAngle( GetTextAngle() != 0.0 ? 0 : 900 );
284 }
285 
286 
287 void LIB_FIELD::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
288  const TRANSFORM& aTransform ) const
289 {
290  if( GetText().IsEmpty() )
291  return;
292 
293  // Calculate the text orientation, according to the symbol orientation/mirror.
294  int orient = (int) GetTextAngle();
295 
296  if( aTransform.y1 ) // Rotate symbol 90 deg.
297  {
298  if( orient == TEXT_ANGLE_HORIZ )
299  orient = TEXT_ANGLE_VERT;
300  else
301  orient = TEXT_ANGLE_HORIZ;
302  }
303 
304  EDA_RECT bbox = GetBoundingBox();
305  bbox.RevertYAxis();
306 
309  wxPoint textpos = aTransform.TransformCoordinate( bbox.Centre() ) + aOffset;
310 
311  COLOR4D color;
312 
313  if( aPlotter->GetColorMode() )
315  else
317 
318  int penWidth = GetEffectivePenWidth( aPlotter->RenderSettings() );
319 
320  aPlotter->Text( textpos, color, GetShownText(), orient, GetTextSize(), hjustify, vjustify,
321  penWidth, IsItalic(), IsBold() );
322 }
323 
324 
325 wxString LIB_FIELD::GetFullText( int unit ) const
326 {
327  if( m_id != REFERENCE_FIELD )
328  return GetText();
329 
330  wxString text = GetText();
331  text << wxT( "?" );
332 
333  wxCHECK( GetParent(), text );
334 
335  if( GetParent()->IsMulti() )
336  text << LIB_SYMBOL::SubReference( unit );
337 
338  return text;
339 }
340 
341 
343 {
344  /* Y coordinates for LIB_ITEMS are bottom to top, so we must invert the Y position when
345  * calling GetTextBox() that works using top to bottom Y axis orientation.
346  */
347  EDA_RECT rect = GetTextBox( -1, true );
348  rect.RevertYAxis();
349 
350  // We are using now a bottom to top Y axis.
351  wxPoint orig = rect.GetOrigin();
352  wxPoint end = rect.GetEnd();
353 
354  RotatePoint( &orig, GetTextPos(), -GetTextAngle() );
355  RotatePoint( &end, GetTextPos(), -GetTextAngle() );
356 
357  rect.SetOrigin( orig );
358  rect.SetEnd( end );
359 
360  // We are using now a top to bottom Y axis:
361  rect.RevertYAxis();
362 
363  return rect;
364 }
365 
366 
367 void LIB_FIELD::ViewGetLayers( int aLayers[], int& aCount ) const
368 {
369  aCount = 2;
370 
371  switch( m_id )
372  {
373  case REFERENCE_FIELD: aLayers[0] = LAYER_REFERENCEPART; break;
374  case VALUE_FIELD: aLayers[0] = LAYER_VALUEPART; break;
375  default: aLayers[0] = LAYER_FIELDS; break;
376  }
377 
378  aLayers[1] = LAYER_SELECTION_SHADOWS;
379 }
380 
381 
383 {
384  switch( m_id )
385  {
387  case VALUE_FIELD: return LAYER_VALUEPART;
388  default: return LAYER_FIELDS;
389  }
390 }
391 
392 
393 wxString LIB_FIELD::GetName( bool aUseDefaultName ) const
394 {
395  if( m_name.IsEmpty() && aUseDefaultName )
397 
398  return m_name;
399 }
400 
401 
403 {
404  switch( m_id )
405  {
406  case REFERENCE_FIELD: return wxT( "Reference" );
407  case VALUE_FIELD: return wxT( "Value" );
408  case FOOTPRINT_FIELD: return wxT( "Footprint" );
409  case DATASHEET_FIELD: return wxT( "Datasheet" );
410  }
411 
412  return m_name;
413 }
414 
415 
416 void LIB_FIELD::SetName( const wxString& aName )
417 {
418  // Mandatory field names are fixed.
419  if( IsMandatory() )
420  {
421  wxFAIL_MSG( "trying to set a MANDATORY_FIELD's name\n" );
422  return;
423  }
424 
425  if( m_name != aName )
426  {
427  m_name = aName;
428  SetModified();
429  }
430 }
431 
432 
433 wxString LIB_FIELD::GetSelectMenuText( EDA_UNITS aUnits ) const
434 {
435  return wxString::Format( "%s '%s'", GetName(), ShortenedShownText() );
436 }
437 
438 
439 void LIB_FIELD::BeginEdit( const wxPoint& aPosition )
440 {
441  SetTextPos( aPosition );
442 }
443 
444 
445 void LIB_FIELD::CalcEdit( const wxPoint& aPosition )
446 {
447  SetTextPos( aPosition );
448 }
449 
450 
451 void LIB_FIELD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
452 {
453  wxString msg;
454 
455  LIB_ITEM::GetMsgPanelInfo( aFrame, aList );
456 
457  aList.emplace_back( _( "Field" ), GetName() );
458 
459  // Don't use GetShownText() here; we want to show the user the variable references
460  aList.emplace_back( _( "Text" ), UnescapeString( GetText() ) );
461 
462  aList.emplace_back( _( "Visible" ), IsVisible() ? _( "Yes" ) : _( "No" ) );
463 
464  aList.emplace_back( _( "Style" ), GetTextStyleName() );
465 
466  aList.emplace_back( _( "Text Size" ), MessageTextFromValue( aFrame->GetUserUnits(),
467  GetTextWidth() ) );
468 
469  switch ( GetHorizJustify() )
470  {
471  case GR_TEXT_HJUSTIFY_LEFT: msg = _( "Left" ); break;
472  case GR_TEXT_HJUSTIFY_CENTER: msg = _( "Center" ); break;
473  case GR_TEXT_HJUSTIFY_RIGHT: msg = _( "Right" ); break;
474  }
475 
476  aList.emplace_back( _( "H Justification" ), msg );
477 
478  switch ( GetVertJustify() )
479  {
480  case GR_TEXT_VJUSTIFY_TOP: msg = _( "Top" ); break;
481  case GR_TEXT_VJUSTIFY_CENTER: msg = _( "Center" ); break;
482  case GR_TEXT_VJUSTIFY_BOTTOM: msg = _( "Bottom" ); break;
483  }
484 
485  aList.emplace_back( _( "V Justification" ), msg );
486 }
487 
488 
490 {
491  return BITMAPS::move;
492 }
493 
494 
496 {
497  return m_id >= 0 && m_id < MANDATORY_FIELDS;
498 }
Field Reference of part, i.e. "IC21".
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.
Definition: lib_field.cpp:451
#define TEXT_ANGLE_HORIZ
Frequent text rotations, used with {Set,Get}TextAngle(), in 0.1 degrees for now, hoping to migrate to...
Definition: eda_text.h:71
bool IsBold() const
Definition: eda_text.h:204
void MirrorVertical(const wxPoint &aCenter) override
Mirror the draw object along the MirrorVertical (Y) axis about aCenter point.
Definition: lib_field.cpp:263
void Offset(const wxPoint &aOffset)
Definition: eda_text.h:273
void SetModified()
Definition: eda_item.cpp:65
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:478
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aAddUnitLabel, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
Definition: base_units.cpp:104
void print(const RENDER_SETTINGS *aSettings, const wxPoint &aOffset, void *aData, const TRANSFORM &aTransform) override
Print the field.
Definition: lib_field.cpp:114
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
Definition: lib_field.cpp:433
Plot settings, and plotting engines (PostScript, Gerber, HPGL and DXF)
EDA_TEXT_HJUSTIFY_T
Definition: eda_text.h:82
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:220
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
Definition: lib_field.cpp:128
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
void CopyText(const EDA_TEXT &aSrc)
Definition: eda_text.cpp:131
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:445
void SetEffects(const EDA_TEXT &aSrc)
Set the text effects from another instance.
Definition: eda_text.cpp:139
int color
Definition: DXF_plotter.cpp:57
Field object used in symbol libraries.
Definition: lib_field.h:59
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,...
Definition: eda_text.cpp:239
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:267
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
double GetTextAngle() const
Definition: eda_text.h:195
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:121
LIB_FIELD(int aId=2)
Definition: lib_field.cpp:49
virtual int GetEffectivePenWidth(const RENDER_SETTINGS *aSettings) const
Definition: lib_item.h:145
int x1
Definition: transform.h:48
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).
Definition: gr_text.cpp:129
void MirrorHorizontal(const wxPoint &aCenter) override
Mirror the draw object along the horizontal (X) axis about aCenter point.
Definition: lib_field.cpp:251
static wxString SubReference(int aUnit, bool aAddSeparator=true)
Definition: lib_symbol.cpp:480
Definition: color4d.h:44
void MoveTo(const wxPoint &aPosition) override
Move a draw object to aPosition.
Definition: lib_field.cpp:245
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: lib_field.cpp:342
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:229
The base class for create windows for drawing purpose.
void SetName(const wxString &aName)
Set a user definable field name to aName.
Definition: lib_field.cpp:416
Define a library symbol object.
Definition: lib_symbol.h:96
void RevertYAxis()
Mirror the rectangle from the X axis (negate Y pos and size).
Definition: eda_rect.h:198
int GetPenWidth() const override
Definition: lib_field.cpp:108
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:115
wxString GetName(bool aUseDefaultName=true) const
Return the field name.
Definition: lib_field.cpp:393
name of datasheet
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 symbols.
Definition: lib_item.h:61
int GetEffectiveTextPenWidth(int aDefaultWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultWidth.
Definition: eda_text.cpp:159
void Offset(const wxPoint &aOffset) override
Set the drawing object by aOffset from the current position.
Definition: lib_field.cpp:239
int GetTextHeight() const
Definition: eda_text.h:265
void SetTextX(int aX)
Definition: eda_text.h:270
bool IsItalic() const
Definition: eda_text.h:201
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:140
int y1
Definition: transform.h:49
const wxPoint GetEnd() const
Definition: eda_rect.h:103
virtual void SetVisible(bool aVisible)
Definition: eda_text.h:206
wxString GetTextStyleName() const
Definition: eda_text.cpp:501
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
Definition: lib_field.cpp:367
for transforming drawing coordinates for a wxDC device context.
Definition: transform.h:45
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:219
Field Value of part, i.e. "3.3K".
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:124
SCH_LAYER_ID
Eeschema drawing layers.
Definition: layer_ids.h:324
COMPARE_FLAGS
The list of flags used by the compare function.
Definition: lib_item.h:80
virtual bool IsVisible() const
Definition: eda_text.h:207
const wxPoint GetOrigin() const
Definition: eda_rect.h:101
void SetEnd(int x, int y)
Definition: eda_rect.h:182
const wxSize & GetTextSize() const
Definition: eda_text.h:259
int GetUnitCount() const override
For items with units, return the number of units.
void Copy(LIB_FIELD *aTarget) const
Copy parameters of this field to another field.
Definition: lib_field.cpp:172
void Rotate(const wxPoint &aCenter, bool aRotateCCW=true) override
Rotate the object about aCenter point.
Definition: lib_field.cpp:275
wxString GetCanonicalName() const
Get a non-language-specific name for a field which can be used for storage, variable look-up,...
Definition: lib_field.cpp:402
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: lib_field.cpp:162
wxString ShortenedShownText() const
Returns a shortened version (max 15 characters) of the shown text.
Definition: eda_text.cpp:218
LIB_FIELD & operator=(const LIB_FIELD &field)
Definition: lib_field.cpp:69
#define _(s)
wxDC * GetPrintDC() const
static const wxString GetDefaultFieldName(int aFieldNdx, bool aTranslate=true)
Return a default symbol field name for field aFieldNdx for all components.
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, 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:43
wxString UnescapeString(const wxString &aSource)
void BeginEdit(const wxPoint &aStartPoint) override
Begin drawing a symbol library draw item at aPosition.
Definition: lib_field.cpp:439
EDA_TEXT_VJUSTIFY_T
Definition: eda_text.h:89
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
EDA_UNITS
Definition: eda_units.h:38
int m_id
Definition: lib_field.h:209
void Plot(PLOTTER *aPlotter, const wxPoint &aOffset, bool aFill, const TRANSFORM &aTransform) const override
Plot the draw item using the plot object.
Definition: lib_field.cpp:287
LIB_SYMBOL * GetParent() const
Definition: lib_item.h:156
Base plotter engine class.
Definition: plotter.h:121
RENDER_SETTINGS * RenderSettings()
Definition: plotter.h:156
int GetTextWidth() const
Definition: eda_text.h:262
TRANSFORM DefaultTransform
Definition: eeschema.cpp:56
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:32
Handle the component boundary box.
Definition: eda_rect.h:42
wxString GetFullText(int unit=1) const
Return the text of a field.
Definition: lib_field.cpp:325
virtual bool TextHitTest(const wxPoint &aPoint, int aAccuracy=0) const
Test if aPoint is within the bounds of this object.
Definition: eda_text.cpp:392
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
SCH_LAYER_ID GetDefaultLayer() const
Definition: lib_field.cpp:382
wxPoint Centre() const
Definition: eda_rect.h:55
const wxPoint & GetTextPos() const
Definition: eda_text.h:268
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.
Definition: gr_text.cpp:219
#define TEXT_ANGLE_VERT
Definition: eda_text.h:72
virtual void SetTextAngle(double aAngle)
Definition: eda_text.h:188
wxString m_name
Name (not the field text value itself, that is #EDA_TEXT::m_Text)
Definition: lib_field.h:210
void Init(int aId)
Object constructor initialization helper.
Definition: lib_field.cpp:82
Message panel definition file.
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: lib_field.cpp:489
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:67
void SetId(int aId)
Definition: lib_field.cpp:101
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:154
virtual wxString GetShownText(int aDepth=0) const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:162
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
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:182
void SetTextY(int aY)
Definition: eda_text.h:271
bool IsMandatory() const
Definition: lib_field.cpp:495
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103
Field Name Module PCB, i.e. "16DIP300".
bool GetColorMode() const
Definition: plotter.h:153