KiCad PCB EDA Suite
sch_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) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2004-2019 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 /* Fields are texts attached to a component, having a special meaning
26  * Fields 0 and 1 are very important: reference and value
27  * Field 2 is used as default footprint name.
28  * Field 3 is reserved (not currently used
29  * Fields 4 and more are user fields.
30  * They can be renamed and can appear in reports
31  */
32 
33 #include <fctsys.h>
34 #include <sch_draw_panel.h>
35 #include <base_struct.h>
36 #include <gr_basic.h>
37 #include <gr_text.h>
38 #include <macros.h>
39 #include <sch_edit_frame.h>
40 #include <plotter.h>
41 #include <bitmaps.h>
42 
43 #include <general.h>
44 #include <class_library.h>
45 #include <sch_component.h>
46 #include <sch_field.h>
47 #include <kicad_string.h>
48 #include <trace_helpers.h>
49 
50 
51 SCH_FIELD::SCH_FIELD( const wxPoint& aPos, int aFieldId, SCH_COMPONENT* aParent, const wxString& aName ) :
52  SCH_ITEM( aParent, SCH_FIELD_T ),
53  EDA_TEXT()
54 {
55  SetTextPos( aPos );
56  m_id = aFieldId;
57  m_name = aName;
58 
59  SetVisible( false );
61 }
62 
63 
65 {
66 }
67 
68 
70 {
71  return new SCH_FIELD( *this );
72 }
73 
74 
75 const wxString SCH_FIELD::GetFullyQualifiedText() const
76 {
77  wxString text = GetText();
78 
79  /* For more than one part per package, we must add the part selection
80  * A, B, ... or 1, 2, .. to the reference. */
81  if( m_id == REFERENCE )
82  {
83  SCH_COMPONENT* component = (SCH_COMPONENT*) m_Parent;
84 
85  wxCHECK_MSG( component != NULL, text,
86  wxT( "No component associated with field" ) + text );
87 
88  if( component->GetUnitCount() > 1 )
89  text << LIB_PART::SubReference( component->GetUnit() );
90  }
91 
92  return text;
93 }
94 
95 
97 {
98  int pensize = GetThickness();
99 
100  if( pensize == 0 ) // Use default values for pen size
101  {
102  if( IsBold() )
103  pensize = GetPenSizeForBold( GetTextWidth() );
104  else
105  pensize = GetDefaultLineThickness();
106  }
107 
108  // Clip pen size for small texts:
109  pensize = Clamp_Text_PenSize( pensize, GetTextSize(), IsBold() );
110  return pensize;
111 }
112 
113 
114 void SCH_FIELD::Print( wxDC* aDC, const wxPoint& aOffset )
115 {
116  int orient;
117  COLOR4D color;
118  wxPoint textpos;
119  SCH_COMPONENT* parentComponent = (SCH_COMPONENT*) m_Parent;
120  int lineWidth = GetThickness();
121 
122  if( lineWidth == 0 ) // Use default values for pen size
123  {
124  if( IsBold() )
125  lineWidth = GetPenSizeForBold( GetTextWidth() );
126  else
127  lineWidth = GetDefaultLineThickness();
128  }
129 
130  // Clip pen size for small texts:
131  lineWidth = Clamp_Text_PenSize( lineWidth, GetTextSize(), IsBold() );
132 
133  if( ( !IsVisible() && !m_forceVisible) || IsVoid() )
134  return;
135 
136  // Calculate the text orientation according to the component orientation.
137  orient = GetTextAngle();
138 
139  if( parentComponent->GetTransform().y1 ) // Rotate component 90 degrees.
140  {
141  if( orient == TEXT_ANGLE_HORIZ )
142  orient = TEXT_ANGLE_VERT;
143  else
144  orient = TEXT_ANGLE_HORIZ;
145  }
146 
147  /* Calculate the text justification, according to the component
148  * orientation/mirror this is a bit complicated due to cumulative
149  * calculations:
150  * - numerous cases (mirrored or not, rotation)
151  * - the DrawGraphicText function recalculate also H and H justifications
152  * according to the text orientation.
153  * - When a component is mirrored, the text is not mirrored and
154  * justifications are complicated to calculate
155  * so the more easily way is to use no justifications ( Centered text )
156  * and use GetBoundaryBox to know the text coordinate considered as centered
157  */
158  EDA_RECT boundaryBox = GetBoundingBox();
159  textpos = boundaryBox.Centre() + aOffset;
160 
161  if( m_forceVisible )
162  color = COLOR4D( DARKGRAY );
163  else if( m_id == REFERENCE )
165  else if( m_id == VALUE )
167  else
169 
170  GRText( aDC, textpos, color, GetFullyQualifiedText(), orient, GetTextSize(),
172 }
173 
174 
175 void SCH_FIELD::ImportValues( const LIB_FIELD& aSource )
176 {
177  SetEffects( aSource );
178 }
179 
180 
182 {
183  wxCHECK_RET( (aItem != NULL) && (aItem->Type() == SCH_FIELD_T),
184  wxT( "Cannot swap field data with invalid item." ) );
185 
186  SCH_FIELD* item = (SCH_FIELD*) aItem;
187 
188  std::swap( m_Layer, item->m_Layer );
189  SwapText( *item );
190  SwapEffects( *item );
191 }
192 
193 
195 {
196  SCH_COMPONENT* parentComponent = (SCH_COMPONENT*) m_Parent;
197  int linewidth = GetThickness() == 0 ? GetDefaultLineThickness() : GetThickness();
198 
199  // We must pass the effective text thickness to GetTextBox
200  // when calculating the bounding box
201  linewidth = Clamp_Text_PenSize( linewidth, GetTextSize(), IsBold() );
202 
203  // Calculate the text bounding box:
204  EDA_RECT rect;
205 
206  if( m_id == REFERENCE ) // multi units have one letter or more added to reference
207  {
208  SCH_FIELD text( *this ); // Make a local copy to change text
209  // because GetBoundingBox() is const
210  text.SetText( GetFullyQualifiedText() );
211  rect = text.GetTextBox( -1, linewidth, false, GetTextMarkupFlags() );
212  }
213  else
214  rect = GetTextBox( -1, linewidth, false, GetTextMarkupFlags() );
215 
216  // Calculate the bounding box position relative to the component:
217  wxPoint origin = parentComponent->GetPosition();
218  wxPoint pos = GetTextPos() - origin;
219  wxPoint begin = rect.GetOrigin() - origin;
220  wxPoint end = rect.GetEnd() - origin;
221  RotatePoint( &begin, pos, GetTextAngle() );
222  RotatePoint( &end, pos, GetTextAngle() );
223 
224  // Due to the Y axis direction, we must mirror the bounding box,
225  // relative to the text position:
226  MIRROR( begin.y, pos.y );
227  MIRROR( end.y, pos.y );
228 
229  // Now, apply the component transform (mirror/rot)
230  begin = parentComponent->GetTransform().TransformCoordinate( begin );
231  end = parentComponent->GetTransform().TransformCoordinate( end );
232  rect.SetOrigin( begin);
233  rect.SetEnd( end);
234  rect.Move( origin );
235  rect.Normalize();
236  return rect;
237 }
238 
239 
241 {
242  wxPoint render_center = GetBoundingBox().Centre();
243  wxPoint pos = GetPosition();
244 
245  switch( GetHorizJustify() )
246  {
248  return render_center.x < pos.x;
250  return render_center.x > pos.x;
251  default:
252  return false;
253  }
254 }
255 
256 
257 bool SCH_FIELD::IsVoid() const
258 {
259  return GetText().Len() == 0;
260 }
261 
262 
263 void SCH_FIELD::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
264 {
265  SCH_COMPONENT* component = (SCH_COMPONENT*) GetParent();
266 
267  // save old cmp in undo list
268  frame->SaveUndoItemInUndoList( component );
269 
270  ClearEditFlags();
271  frame->OnModify();
272 }
273 
274 
275 bool SCH_FIELD::Matches( wxFindReplaceData& aSearchData, void* aAuxData )
276 {
277  wxString text = GetFullyQualifiedText();
278  int flags = aSearchData.GetFlags();
279 
280  // User defined fields have an ID of -1.
281  if( m_id != REFERENCE && m_id != VALUE && !( flags & FR_SEARCH_ALL_FIELDS ) )
282  return false;
283 
284  if( ( flags & FR_SEARCH_REPLACE ) && m_id == REFERENCE && !( flags & FR_REPLACE_REFERENCES ) )
285  return false;
286 
287  wxLogTrace(
288  traceFindItem, wxT( " child item " ) + GetSelectMenuText( EDA_UNITS::MILLIMETRES ) );
289 
290  // Take sheet path into account which effects the reference field and the unit for
291  // components with multiple parts.
292  if( m_id == REFERENCE && aAuxData != NULL )
293  {
294  SCH_COMPONENT* component = (SCH_COMPONENT*) m_Parent;
295 
296  wxCHECK_MSG( component != NULL, false, wxT( "No symbol associated with field" ) + text );
297 
298  text = component->GetRef( (SCH_SHEET_PATH*) aAuxData );
299 
300  if( component->GetUnitCount() > 1 )
301  text << LIB_PART::SubReference( component->GetUnit() );
302  }
303 
304  return SCH_ITEM::Matches( text, aSearchData );
305 }
306 
307 
309 {
310  if( m_id != VALUE )
311  return true;
312 
313  SCH_COMPONENT* component = dynamic_cast<SCH_COMPONENT*>( GetParent() );
314  LIB_PART* part = component ? component->GetPartRef().get() : nullptr;
315  bool isPower = part ? part->IsPower() : false;
316 
317  return !isPower;
318 }
319 
320 
321 bool SCH_FIELD::Replace( wxFindReplaceData& aSearchData, void* aAuxData )
322 {
323  bool isReplaced;
324  wxString text = GetFullyQualifiedText();
325 
326  if( m_id == REFERENCE )
327  {
328  wxCHECK_MSG( aAuxData != NULL, false,
329  wxT( "Cannot replace reference designator without valid sheet path." ) );
330 
331  wxCHECK_MSG( aSearchData.GetFlags() & FR_REPLACE_REFERENCES, false,
332  wxT( "Invalid replace symbol reference field call." ) ) ;
333 
334  SCH_COMPONENT* component = (SCH_COMPONENT*) m_Parent;
335 
336  wxCHECK_MSG( component != NULL, false, wxT( "No symbol associated with field" ) + text );
337 
338  text = component->GetRef( (SCH_SHEET_PATH*) aAuxData );
339 
340  // if( component->GetUnitCount() > 1 )
341  // text << LIB_PART::SubReference( component->GetUnit() );
342 
343  isReplaced = EDA_ITEM::Replace( aSearchData, text );
344 
345  if( isReplaced )
346  component->SetRef( (SCH_SHEET_PATH*) aAuxData, text );
347  }
348  else
349  {
350  isReplaced = EDA_TEXT::Replace( aSearchData );
351  }
352 
353  return isReplaced;
354 }
355 
356 
357 void SCH_FIELD::Rotate( wxPoint aPosition )
358 {
359  wxPoint pt = GetTextPos();
360  RotatePoint( &pt, aPosition, 900 );
361  SetTextPos( pt );
362 }
363 
364 
365 wxString SCH_FIELD::GetSelectMenuText( EDA_UNITS aUnits ) const
366 {
367  return wxString::Format( _( "Field %s" ), GetName() );
368 }
369 
370 
371 wxString SCH_FIELD::GetName( bool aUseDefaultName ) const
372 {
373  if( !m_name.IsEmpty() )
374  return m_name;
375  else if( aUseDefaultName )
377 
378  return wxEmptyString;
379 }
380 
381 
383 {
384  if( m_id == REFERENCE )
385  return edit_comp_ref_xpm;
386 
387  if( m_id == VALUE )
388  return edit_comp_value_xpm;
389 
390  if( m_id == FOOTPRINT )
392 
393  return edit_text_xpm;
394 }
395 
396 
397 bool SCH_FIELD::HitTest( const wxPoint& aPosition, int aAccuracy ) const
398 {
399  // Do not hit test hidden or empty fields.
400  if( !IsVisible() || IsVoid() )
401  return false;
402 
403  EDA_RECT rect = GetBoundingBox();
404 
405  rect.Inflate( aAccuracy );
406 
407  return rect.Contains( aPosition );
408 }
409 
410 
411 bool SCH_FIELD::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
412 {
413  // Do not hit test hidden fields.
414  if( !IsVisible() || IsVoid() )
415  return false;
416 
417  EDA_RECT rect = aRect;
418 
419  rect.Inflate( aAccuracy );
420 
421  if( aContained )
422  return rect.Contains( GetBoundingBox() );
423 
424  return rect.Intersects( GetBoundingBox() );
425 }
426 
427 
428 void SCH_FIELD::Plot( PLOTTER* aPlotter )
429 {
430  SCH_COMPONENT* parent = ( SCH_COMPONENT* ) GetParent();
431 
432  wxCHECK_RET( parent != NULL && parent->Type() == SCH_COMPONENT_T,
433  wxT( "Cannot plot field with invalid parent." ) );
434 
436 
437  if( !IsVisible() )
438  return;
439 
440  if( IsVoid() )
441  return;
442 
443  /* Calculate the text orientation, according to the component
444  * orientation/mirror */
445  int orient = GetTextAngle();
446 
447  if( parent->GetTransform().y1 ) // Rotate component 90 deg.
448  {
449  if( orient == TEXT_ANGLE_HORIZ )
450  orient = TEXT_ANGLE_VERT;
451  else
452  orient = TEXT_ANGLE_HORIZ;
453  }
454 
455  /* Calculate the text justification, according to the component
456  * orientation/mirror
457  * this is a bit complicated due to cumulative calculations:
458  * - numerous cases (mirrored or not, rotation)
459  * - the DrawGraphicText function recalculate also H and H justifications
460  * according to the text orientation.
461  * - When a component is mirrored, the text is not mirrored and
462  * justifications are complicated to calculate
463  * so the more easily way is to use no justifications ( Centered text )
464  * and use GetBoundaryBox to know the text coordinate considered as centered
465  */
466  EDA_RECT BoundaryBox = GetBoundingBox();
469  wxPoint textpos = BoundaryBox.Centre();
470 
471  int thickness = GetPenSize();
472 
473  aPlotter->Text( textpos, color, GetFullyQualifiedText(), orient, GetTextSize(),
474  hjustify, vjustify,
475  thickness, IsItalic(), IsBold() );
476 }
477 
478 
479 void SCH_FIELD::SetPosition( const wxPoint& aPosition )
480 {
481  SCH_COMPONENT* component = (SCH_COMPONENT*) GetParent();
482 
483  wxPoint pos = ( (SCH_COMPONENT*) GetParent() )->GetPosition();
484 
485  // Actual positions are calculated by the rotation/mirror transform of the
486  // parent component of the field. The inverse transform is used to calculate
487  // the position relative to the parent component.
488  wxPoint pt = aPosition - pos;
489 
490  SetTextPos( pos + component->GetTransform().InverseTransform().TransformCoordinate( pt ) );
491 }
492 
493 
495 {
496  SCH_COMPONENT* component = (SCH_COMPONENT*) GetParent();
497  wxPoint pos = GetTextPos() - component->GetPosition();
498 
499  return component->GetTransform().TransformCoordinate( pos ) + component->GetPosition();
500 }
#define TEXT_ANGLE_HORIZ
EDA_UNITS
Definition: common.h:72
bool IsBold() const
Definition: eda_text.h:167
SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
SCH_LAYER_ID m_Layer
Definition: sch_item.h:141
int GetPenSize() const override
Function GetPenSize virtual pure.
Definition: sch_field.cpp:96
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:177
void SwapEffects(EDA_TEXT &aTradingPartner)
Swap the text effects of the two involved instances.
Definition: eda_text.cpp:138
void Move(const wxPoint &aMoveVector)
Function Move moves the rectangle by the aMoveVector.
SCH_FIELD(const wxPoint &aPos, int aFieldId, SCH_COMPONENT *aParent, const wxString &aName=wxEmptyString)
Definition: sch_field.cpp:51
EDA_TEXT_HJUSTIFY_T
Definition: eda_text.h:44
PNG memory record (file in memory).
Definition: bitmap_def.h:29
int GetPenSizeForBold(int aTextSize)
Function GetPensizeForBold.
Definition: gr_text.cpp:66
#define TEXT_ANGLE_VERT
static bool Replace(wxFindReplaceData &aSearchData, wxString &aText)
Helper function used in search and replace dialog Function Replace performs a text replace on aText u...
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: sch_field.cpp:69
bool IsVisible() const
Definition: eda_text.h:170
void ImportValues(const LIB_FIELD &aSource)
Function ImportValues copy parameters from a LIB_FIELD source.
Definition: sch_field.cpp:175
void SetEffects(const EDA_TEXT &aSrc)
Set the text effects from another instance.
Definition: eda_text.cpp:125
const BITMAP_OPAQUE edit_comp_value_xpm[1]
wxPoint GetPosition() const override
Function GetPosition.
Definition: sch_field.cpp:494
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 Place(SCH_EDIT_FRAME *frame, wxDC *DC)
Definition: sch_field.cpp:263
TRANSFORM InverseTransform() const
Calculate the Inverse mirror/rotation transform.
Definition: transform.cpp:59
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:231
int GetUnitCount() const
Return the number of units per package of the symbol.
void SetVisible(bool aVisible)
Definition: eda_text.h:169
double GetTextAngle() const
Definition: eda_text.h:158
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:131
int GetThickness() const
Return the pen width.
Definition: eda_text.h:148
static const wxString GetDefaultFieldName(int aFieldNdx)
Function GetDefaultFieldName returns a default symbol field name for field aFieldNdx for all componen...
Schematic editor (Eeschema) main window.
const BITMAP_OPAQUE edit_comp_ref_xpm[1]
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
Definition: sch_field.cpp:365
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
wxString m_name
Definition: sch_field.h:56
Field Name Module PCB, i.e. "16DIP300".
Field Reference of part, i.e. "IC21".
bool Contains(const wxPoint &aPoint) const
Function Contains.
bool IsVoid() const
Function IsVoid returns true if the field is either empty or holds "~".
Definition: sch_field.cpp:257
wxPoint TransformCoordinate(const wxPoint &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition: transform.cpp:42
This file contains miscellaneous commonly used macros and functions.
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
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
void MIRROR(T &aPoint, const T &aMirrorRef)
Definition: macros.h:123
const wxPoint GetEnd() const
Definition: eda_rect.h:116
#define VALUE
int GetTextMarkupFlags()
Definition: gr_text.cpp:55
int GetUnit() const
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
const wxPoint GetOrigin() const
Definition: eda_rect.h:114
TRANSFORM & GetTransform() const
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 SetLayer(SCH_LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
Definition: sch_item.h:219
Define a library symbol object.
EDA_ITEM * GetParent() const
Definition: base_struct.h:215
wxLogTrace helper definitions.
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: sch_field.cpp:397
SCH_SHEET_PATH.
std::unique_ptr< LIB_PART > & GetPartRef()
BITMAP_DEF GetMenuImage() const override
Function GetMenuImage returns a pointer to an image to be used in menus.
Definition: sch_field.cpp:382
void SaveUndoItemInUndoList(SCH_ITEM *aItem, bool aAppend=false)
Swap the cloned item in member variable m_undoItem with aItem and saves it to the undo list then swap...
const wxString GetRef(const SCH_SHEET_PATH *aSheet)
Return the reference for the given sheet path.
void Print(wxDC *aDC, const wxPoint &aOffset) override
Function Print Print a schematic item.
Definition: sch_field.cpp:114
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
SCH_LAYER_ID GetLayer() const
Function GetLayer returns the layer this item is on.
Definition: sch_item.h:212
void Normalize()
Function Normalize ensures that the height ant width are positive.
Base plotter engine class.
Definition: plotter.h:103
void SwapText(EDA_TEXT &aTradingPartner)
Definition: eda_text.cpp:131
void Plot(PLOTTER *aPlotter) override
Function Plot plots the schematic item to aPlotter.
Definition: sch_field.cpp:428
int GetTextWidth() const
Definition: eda_text.h:226
bool IsPower() const
const wxChar *const traceFindItem
Flag to enable find debug tracing.
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
bool Replace(wxFindReplaceData &aSearchData, void *aAuxData=NULL) override
Function Replace performs a text replace using the find and replace criteria in aSearchData on items ...
Definition: sch_field.cpp:321
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
Definition: sch_field.cpp:194
bool Matches(wxFindReplaceData &aSearchData, void *aAuxData) override
Function Matches compares the item against the search criteria in aSearchData.
Definition: sch_field.cpp:275
bool Replace(wxFindReplaceData &aSearchData)
Helper function used in search and replace dialog.
Definition: eda_text.cpp:144
#define _(s)
Definition: 3d_actions.cpp:31
void SwapData(SCH_ITEM *aItem) override
Function SwapData swap the internal data structures aItem with the schematic item.
Definition: sch_field.cpp:181
const BITMAP_OPAQUE edit_comp_footprint_xpm[1]
wxString GetName(bool aUseDefaultName=true) const
Function GetName returns the field name.
Definition: sch_field.cpp:371
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
static wxString SubReference(int aUnit, bool aAddSeparator=true)
const wxString GetFullyQualifiedText() const
Function GetFullyQualifiedText returns the fully qualified field text by allowing for the part suffix...
Definition: sch_field.cpp:75
SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:89
wxPoint GetPosition() const override
Function GetPosition.
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:163
wxPoint Centre() const
Definition: eda_rect.h:62
bool IsHorizJustifyFlipped() const
Function IsHorizJustifyFlipped Returns whether the field will be rendered with the horizontal justifi...
Definition: sch_field.cpp:240
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
bool IsReplaceable() const override
Function IsReplaceable.
Definition: sch_field.cpp:308
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
void Rotate(wxPoint aPosition) override
Function Rotate rotates the item around aPosition 90 degrees in the clockwise direction.
Definition: sch_field.cpp:357
Definition for part library class.
void ClearEditFlags()
Definition: base_struct.h:273
int m_id
Field index,.
Definition: sch_field.h:54
bool m_forceVisible
Set to true to override the visibility setting of the item.
Definition: base_struct.h:181
void SetPosition(const wxPoint &aPosition) override
Function SetPosition set the schematic item position to aPosition.
Definition: sch_field.cpp:479
virtual bool Matches(wxFindReplaceData &aSearchData, void *aAuxData)
Function Matches compares the item against the search criteria in aSearchData.
Definition: base_struct.h:471
SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:136
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:123
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:207
const BITMAP_OPAQUE edit_text_xpm[1]
Definition: edit_text.cpp:59
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39