KiCad PCB EDA Suite
class_text_mod.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) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
6  * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, you may find one here:
20  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21  * or you may search the http://www.gnu.org website for the version 2 license,
22  * or you may write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24  */
25 
31 #include <fctsys.h>
32 #include <gr_basic.h>
33 #include <trigo.h>
34 #include <class_drawpanel.h>
35 #include <draw_graphic_text.h>
36 #include <kicad_string.h>
37 #include <richio.h>
38 #include <macros.h>
39 #include <pcb_edit_frame.h>
40 #include <msgpanel.h>
41 #include <base_units.h>
42 #include <bitmaps.h>
43 
44 #include <class_board.h>
45 #include <class_module.h>
46 
47 #include <view/view.h>
48 
49 #include <pcbnew.h>
50 
51 
53  BOARD_ITEM( parent, PCB_MODULE_TEXT_T ),
54  EDA_TEXT()
55 {
56  MODULE* module = static_cast<MODULE*>( m_Parent );
57 
58  m_Type = text_type;
59  m_unlocked = false;
60 
61  // Set text thickness to a default value
62  SetThickness( Millimeter2iu( 0.15 ) );
63  SetLayer( F_SilkS );
64 
65  // Set position and give a default layer if a valid parent footprint exists
66  if( module && ( module->Type() == PCB_MODULE_T ) )
67  {
68  SetTextPos( module->GetPosition() );
69 
70  if( IsBackLayer( module->GetLayer() ) )
71  {
72  SetLayer( B_SilkS );
73  SetMirrored( true );
74  }
75  }
76 
77  SetDrawCoord();
78 }
79 
80 
82 {
83 }
84 
85 
86 void TEXTE_MODULE::SetTextAngle( double aAngle )
87 {
89 }
90 
91 
92 bool TEXTE_MODULE::TextHitTest( const wxPoint& aPoint, int aAccuracy ) const
93 {
94  EDA_RECT rect = GetTextBox( -1 );
95  wxPoint location = aPoint;
96 
97  rect.Inflate( aAccuracy );
98 
99  RotatePoint( &location, GetTextPos(), -GetDrawRotation() );
100 
101  return rect.Contains( location );
102 }
103 
104 
105 bool TEXTE_MODULE::TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy ) const
106 {
107  EDA_RECT rect = aRect;
108 
109  rect.Inflate( aAccuracy );
110 
111  if( aContains )
112  {
113  return rect.Contains( GetBoundingBox() );
114  }
115  else
116  {
117  return rect.Intersects( GetTextBox( -1 ), GetDrawRotation() );
118  }
119 }
120 
121 
122 void TEXTE_MODULE::Rotate( const wxPoint& aRotCentre, double aAngle )
123 {
124  // Used in footprint edition
125  // Note also in module editor, m_Pos0 = m_Pos
126 
127  wxPoint pt = GetTextPos();
128  RotatePoint( &pt, aRotCentre, aAngle );
129  SetTextPos( pt );
130 
131  SetTextAngle( GetTextAngle() + aAngle );
132  SetLocalCoord();
133 }
134 
135 
136 void TEXTE_MODULE::Flip( const wxPoint& aCentre )
137 {
138  // flipping the footprint is relative to the X axis
139  SetTextY( ::Mirror( GetTextPos().y, aCentre.y ) );
140 
142 
143  SetLayer( FlipLayer( GetLayer() ) );
145  SetLocalCoord();
146 }
147 
149 {
150  if( GetParent() && GetParent()->GetLayer() == B_Cu )
151  return true;
152  return false;
153 }
154 
155 
156 void TEXTE_MODULE::Mirror( const wxPoint& aCentre, bool aMirrorAroundXAxis )
157 {
158  // Used in modedit, to transform the footprint
159  // the mirror is around the Y axis or X axis if aMirrorAroundXAxis = true
160  // the position is mirrored, but the text itself is not mirrored
161  if( aMirrorAroundXAxis )
162  SetTextY( ::Mirror( GetTextPos().y, aCentre.y ) );
163  else
164  SetTextX( ::Mirror( GetTextPos().x, aCentre.x ) );
165 
166  SetLocalCoord();
167 }
168 
169 
170 void TEXTE_MODULE::Move( const wxPoint& aMoveVector )
171 {
172  Offset( aMoveVector );
173  SetLocalCoord();
174 }
175 
176 
178 {
179  return m_Text.Len();
180 }
181 
182 
184 {
185  const MODULE* module = static_cast<const MODULE*>( m_Parent );
186 
187  SetTextPos( m_Pos0 );
188 
189  if( module )
190  {
191  double angle = module->GetOrientation();
192 
193  wxPoint pt = GetTextPos();
194  RotatePoint( &pt, angle );
195  SetTextPos( pt );
196 
197  Offset( module->GetPosition() );
198  }
199 }
200 
201 
203 {
204  const MODULE* module = static_cast<const MODULE*>( m_Parent );
205 
206  if( module )
207  {
208  m_Pos0 = GetTextPos() - module->GetPosition();
209 
210  double angle = module->GetOrientation();
211 
212  RotatePoint( &m_Pos0.x, &m_Pos0.y, -angle );
213  }
214  else
215  {
216  m_Pos0 = GetTextPos();
217  }
218 }
219 
221 {
222  double angle = GetDrawRotation();
223  EDA_RECT text_area = GetTextBox( -1, -1 );
224 
225  if( angle )
226  text_area = text_area.GetBoundingBoxRotated( GetTextPos(), angle );
227 
228  return text_area;
229 }
230 
231 
232 void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
233  const wxPoint& aOffset )
234 {
235  if( aPanel == NULL )
236  return;
237 
238  /* parent must *not* be NULL (a footprint text without a footprint
239  parent has no sense) */
240  wxASSERT( m_Parent );
241 
242  BOARD* brd = GetBoard( );
243 
244  auto frame = static_cast<PCB_BASE_FRAME*> ( aPanel->GetParent() );
245  auto color = frame->Settings().Colors().GetLayerColor( GetLayer() );
246 
247  PCB_LAYER_ID text_layer = GetLayer();
248 
249  if( !brd->IsLayerVisible( m_Layer )
250  || ( IsFrontLayer( text_layer ) && !brd->IsElementVisible( LAYER_MOD_TEXT_FR ) )
251  || ( IsBackLayer( text_layer ) && !brd->IsElementVisible( LAYER_MOD_TEXT_BK ) ) )
252  return;
253 
254  if( !brd->IsElementVisible( LAYER_MOD_REFERENCES ) && GetText() == wxT( "%R" ) )
255  return;
256 
257  if( !brd->IsElementVisible( LAYER_MOD_VALUES ) && GetText() == wxT( "%V" ) )
258  return;
259 
260  // Invisible texts are still drawn (not plotted) in LAYER_MOD_TEXT_INVISIBLE
261  // Just because we must have to edit them (at least to make them visible)
262  if( !IsVisible() )
263  {
265  return;
266 
267  color = frame->Settings().Colors().GetItemColor( LAYER_MOD_TEXT_INVISIBLE );
268  }
269 
270  auto displ_opts = (PCB_DISPLAY_OPTIONS*)( aPanel->GetDisplayOptions() );
271 
272  // shade text if high contrast mode is active
273  if( ( aDrawMode & GR_ALLOW_HIGHCONTRAST ) && displ_opts && displ_opts->m_ContrastModeDisplay )
274  {
275  PCB_LAYER_ID curr_layer = ( (PCB_SCREEN*) aPanel->GetScreen() )->m_Active_Layer;
276 
277  if( !IsOnLayer( curr_layer ) )
279  }
280 
281  // Draw mode compensation for the width
282  int width = GetThickness();
283 
284  if( displ_opts && displ_opts->m_DisplayModTextFill == SKETCH )
285  width = -width;
286 
287  GRSetDrawMode( aDC, aDrawMode );
288  wxPoint pos = GetTextPos() - aOffset;
289 
290  // Draw the text anchor point
291  if( brd->IsElementVisible( LAYER_ANCHOR ) )
292  {
293  COLOR4D anchor_color = frame->Settings().Colors().GetItemColor( LAYER_ANCHOR );
294  GRDrawAnchor( aPanel->GetClipBox(), aDC, pos.x, pos.y, DIM_ANCRE_TEXTE, anchor_color );
295  }
296 
297  // Draw the text proper, with the right attributes
298  wxSize size = GetTextSize();
299  double orient = GetDrawRotation();
300 
301  // If the text is mirrored : negate size.x (mirror / Y axis)
302  if( IsMirrored() )
303  size.x = -size.x;
304 
305  DrawGraphicText( aPanel->GetClipBox(), aDC, pos, color, GetShownText(), orient,
306  size, GetHorizJustify(), GetVertJustify(),
307  width, IsItalic(), IsBold() );
308 
309  // Enable these line to draw the bounding box (debug test purpose only)
310 #if 0
311  {
312  EDA_RECT BoundaryBox = GetBoundingBox();
313  GRRect( aPanel->GetClipBox(), aDC, BoundaryBox, 0, BROWN );
314  }
315 #endif
316 }
317 
318 
320  wxDC* aDC,
321  GR_DRAWMODE aDrawMode,
322  const wxPoint& aOffset )
323 {
324  MODULE* parent = static_cast<MODULE*>( GetParent() );
325 
326  if( !parent )
327  return;
328 
329  GRSetDrawMode( aDC, GR_XOR );
330  GRLine( aPanel->GetClipBox(), aDC,
331  parent->GetPosition(), GetTextPos() + aOffset,
332  0, UMBILICAL_COLOR);
333 }
334 
335 
337 {
338  MODULE* module = (MODULE*) m_Parent;
339  double rotation = GetTextAngle();
340 
341  if( module )
342  rotation += module->GetOrientation();
343 
344  if( m_unlocked )
345  {
346  NORMALIZE_ANGLE_POS( rotation );
347  }
348  else
349  {
350  // Keep angle between -90 .. 90 deg. Otherwise the text is not easy to read
351  while( rotation > 900 )
352  rotation -= 1800;
353 
354  while( rotation < -900 )
355  rotation += 1800;
356  }
357 
358  return rotation;
359 }
360 
361 
362 // see class_text_mod.h
363 void TEXTE_MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
364 {
365  MODULE* module = (MODULE*) m_Parent;
366 
367  if( module == NULL ) // Happens in modedit, and for new texts
368  return;
369 
370  wxString msg, Line;
371 
372  static const wxString text_type_msg[3] =
373  {
374  _( "Ref." ), _( "Value" ), _( "Text" )
375  };
376 
377  Line = module->GetReference();
378  aList.push_back( MSG_PANEL_ITEM( _( "Footprint" ), Line, DARKCYAN ) );
379 
380  Line = GetShownText();
381  aList.push_back( MSG_PANEL_ITEM( _( "Text" ), Line, BROWN ) );
382 
383  wxASSERT( m_Type >= TEXT_is_REFERENCE && m_Type <= TEXT_is_DIVERS );
384  aList.push_back( MSG_PANEL_ITEM( _( "Type" ), text_type_msg[m_Type], DARKGREEN ) );
385 
386  if( !IsVisible() )
387  msg = _( "No" );
388  else
389  msg = _( "Yes" );
390 
391  aList.push_back( MSG_PANEL_ITEM( _( "Display" ), msg, DARKGREEN ) );
392 
393  // Display text layer
394  aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), GetLayerName(), DARKGREEN ) );
395 
396  if( IsMirrored() )
397  msg = _( "Yes" );
398  else
399  msg = _( "No" );
400 
401  aList.push_back( MSG_PANEL_ITEM( _( "Mirror" ), msg, DARKGREEN ) );
402 
403  msg.Printf( wxT( "%.1f" ), GetTextAngleDegrees() );
404  aList.push_back( MSG_PANEL_ITEM( _( "Angle" ), msg, DARKGREEN ) );
405 
407  aList.push_back( MSG_PANEL_ITEM( _( "Thickness" ), msg, DARKGREEN ) );
408 
410  aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, RED ) );
411 
413  aList.push_back( MSG_PANEL_ITEM( _( "Height" ), msg, RED ) );
414 }
415 
416 
418 {
419  wxString text;
420  const wxChar *reference = GetChars( static_cast<MODULE*>( GetParent() )->GetReference() );
421 
422  switch( m_Type )
423  {
424  case TEXT_is_REFERENCE:
425  text.Printf( _( "Reference %s" ), reference );
426  break;
427 
428  case TEXT_is_VALUE:
429  text.Printf( _( "Value %s of %s" ), GetChars( GetShownText() ), reference );
430  break;
431 
432  default: // wrap this one in quotes:
433  text.Printf( _( "Text \"%s\" on %s of %s" ), GetChars( ShortenedShownText() ),
434  GetChars( GetLayerName() ), reference );
435  break;
436  }
437 
438  return text;
439 }
440 
441 
443 {
444  return footprint_text_xpm;
445 }
446 
447 
449 {
450  return new TEXTE_MODULE( *this );
451 }
452 
453 
455 {
456  double angle = GetDrawRotation();
457  EDA_RECT text_area = GetTextBox( -1, -1 );
458 
459  if( angle )
460  text_area = text_area.GetBoundingBoxRotated( GetTextPos(), angle );
461 
462  return BOX2I( text_area.GetPosition(), text_area.GetSize() );
463 }
464 
465 
466 void TEXTE_MODULE::ViewGetLayers( int aLayers[], int& aCount ) const
467 {
468  if( IsVisible() )
469  aLayers[0] = GetLayer();
470  else
471  aLayers[0] = LAYER_MOD_TEXT_INVISIBLE;
472 
473  aCount = 1;
474 }
475 
476 
477 unsigned int TEXTE_MODULE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
478 {
479  const int HIDE = std::numeric_limits<unsigned int>::max();
480 
481  if( !aView )
482  return 0;
483 
484  // Hidden text gets put on the LAYER_MOD_TEXT_INVISIBLE for rendering, but
485  // should only render if its native layer is visible.
486  if( !aView->IsLayerVisible( GetLayer() ) )
487  return HIDE;
488 
489  // Handle Render tab switches
490  if( ( m_Type == TEXT_is_VALUE || m_Text == wxT( "%V" ) )
491  && !aView->IsLayerVisible( LAYER_MOD_VALUES ) )
492  return HIDE;
493 
494  if( ( m_Type == TEXT_is_REFERENCE || m_Text == wxT( "%R" ) )
495  && !aView->IsLayerVisible( LAYER_MOD_REFERENCES ) )
496  return HIDE;
497 
498  if( !IsParentFlipped() && !aView->IsLayerVisible( LAYER_MOD_FR ) )
499  return HIDE;
500 
501  if( IsParentFlipped() && !aView->IsLayerVisible( LAYER_MOD_BK ) )
502  return HIDE;
503 
505  return HIDE;
506 
507  if( IsBackLayer( m_Layer ) && !aView->IsLayerVisible( LAYER_MOD_TEXT_BK ) )
508  return HIDE;
509 
510  // Other layers are shown without any conditions
511  return 0;
512 }
513 
514 
516 {
517  /* First order optimization: no % means that no processing is
518  * needed; just hope that RVO and copy constructor implementation
519  * avoid to copy the whole block; anyway it should be better than
520  * rebuild the string one character at a time...
521  * Also it seems wise to only expand macros in user text (but there
522  * is no technical reason, probably) */
523 
524  if( (m_Type != TEXT_is_DIVERS) || (wxString::npos == m_Text.find('%')) )
525  return m_Text;
526 
527  wxString newbuf;
528  const MODULE *module = static_cast<MODULE*>( GetParent() );
529 
530  for( wxString::const_iterator it = m_Text.begin(); it != m_Text.end(); ++it )
531  {
532  // Process '%' and copy everything else
533  if( *it != '%' )
534  newbuf.append(*it);
535  else
536  {
537  /* Look at the next character (if is it there) and append
538  * its expansion */
539  ++it;
540 
541  if( it != m_Text.end() )
542  {
543  switch( char(*it) )
544  {
545  case '%':
546  newbuf.append( '%' );
547  break;
548 
549  case 'R':
550  if( module )
551  newbuf.append( module->GetReference() );
552  break;
553 
554  case 'V':
555  if( module )
556  newbuf.append( module->GetValue() );
557  break;
558 
559  default:
560  newbuf.append( '?' );
561  break;
562  }
563  }
564  else
565  break; // The string is over and we can't ++ anymore
566  }
567  }
568 
569  return newbuf;
570 }
void SetMirrored(bool isMirrored)
Definition: eda_text.h:176
void SetTextAngle(double aAngle)
Definition: eda_text.h:154
wxString CoordinateToString(int aValue, bool aConvertToMils)
Function CoordinateToString is a helper to convert the integer coordinate aValue to a string in inche...
Definition: base_units.cpp:118
KICAD_T Type() const
Function Type()
Definition: base_struct.h:209
TEXT_TYPE
Text module type: there must be only one (and only one) for each of the reference and value texts in ...
int GetLength() const
BITMAP_DEF GetMenuImage() const override
Function GetMenuImage returns a pointer to an image to be used in menus.
void Offset(const wxPoint &aOffset)
Definition: eda_text.h:227
BOARD_ITEM_CONTAINER * GetParent() const
virtual unsigned int ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Function ViewGetLOD() Returns the level of detail (LOD) of the item.
BOX2< VECTOR2I > BOX2I
Definition: box2.h:468
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:179
wxString m_Text
Definition: eda_text.h:344
double GetDrawRotation() const
wxString ShortenedShownText() const
Returns a shortened version (max 15 characters) of the shown text.
Definition: eda_text.cpp:79
PNG memory record (file in memory).
Definition: bitmap_types.h:41
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:318
const wxPoint & GetTextPos() const
Definition: eda_text.h:222
bool IsItalic() const
Definition: eda_text.h:168
bool IsLayerVisible(int aLayer) const
Function IsLayerVisible() Returns information about visibility of a particular layer.
Definition: view.h:404
virtual bool IsOnLayer(PCB_LAYER_ID aLayer) const
Function IsOnLayer tests to see if this object is on the given layer.
virtual void SetLayer(PCB_LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
Implementation of conversion functions that require both schematic and board internal units...
TEXTE_MODULE(MODULE *parent, TEXT_TYPE text_type=TEXT_is_DIVERS)
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
virtual const BOX2I ViewBBox() const override
Function ViewBBox() returns the bounding box of the item covering all its layers. ...
const wxSize GetSize() const
Definition: eda_rect.h:101
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
bool Contains(const wxPoint &aPoint) const
Function Contains.
void Rotate(const wxPoint &aOffset, double aAngle) override
Rotate text, in footprint editor (for instance in footprint rotation transform)
anchor of items having an anchor point (texts, footprints)
bool IsBackLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it&#39;s a back layer.
Class BOARD to handle a board.
wxString GetSelectMenuText() const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
int color
Definition: DXF_plotter.cpp:62
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
Function FlippedLayerNumber.
Definition: lset.cpp:472
int GetTextWidth() const
Definition: eda_text.h:216
void Move(const wxPoint &aMoveVector) override
move text in move transform, in footprint editor
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:221
show modules on back
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
show modules values (when texts are visibles)
void GRDrawAnchor(EDA_RECT *aClipBox, wxDC *aDC, int x, int y, int aSize, COLOR4D aColor)
Definition: gr_basic.cpp:1288
bool IsParentFlipped() const
const wxString & GetValue() const
Function GetValue.
Definition: class_module.h:486
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:216
void NORMALIZE_ANGLE_POS(T &Angle)
Definition: trigo.h:241
double GetTextAngleDegrees() const
Definition: eda_text.h:164
virtual wxString GetShownText() const override
Returns the string actually shown after processing of the base text.
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:188
wxString GetLayerName() const
Function GetLayerName returns the name of the PCB layer on which the item resides.
void DrawGraphicText(EDA_RECT *aClipBox, 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 DrawGraphicText Draw a graphic text (like module texts)
bool IsBold() const
Definition: eda_text.h:171
double GetTextAngle() const
Definition: eda_text.h:162
int GetThickness() const
Function GetThickness returns pen width.
Definition: eda_text.h:152
This file contains miscellaneous commonly used macros and functions.
void SetTextX(int aX)
Definition: eda_text.h:224
show modules on front
Class EDA_TEXT is a mix-in class (via multiple inheritance) that handles texts such as labels...
Definition: eda_text.h:112
PCB_LAYER_ID m_Layer
class MODULE, a footprint
Definition: typeinfo.h:89
#define UMBILICAL_COLOR
void GRRect(EDA_RECT *aClipBox, wxDC *aDC, int x1, int y1, int x2, int y2, COLOR4D aColor)
Definition: gr_basic.cpp:1098
Class PCB_DISPLAY_OPTIONS handles display options like enable/disable some optional drawings...
PCB_LAYER_ID
A quick note on layer IDs:
EDA_RECT GetTextBox(int aLine=-1, int aThickness=-1, bool aInvertY=false) const
Function GetTextBox useful in multiline texts to calculate the full text or a line area (for zones fi...
Definition: eda_text.cpp:102
double GetOrientation() const
Definition: class_module.h:187
GR_DRAWMODE
Drawmode. Compositing mode plus a flag or two.
Definition: gr_basic.h:37
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:128
const EDA_RECT GetBoundingBoxRotated(wxPoint aRotCenter, double aAngle)
Function GetBoundingBoxRotated.
void GetMsgPanelInfo(std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it&#39;s internal state for displ...
EDA_RECT * GetClipBox()
Definition: colors.h:60
void Flip(const wxPoint &aCentre) override
Flip entity during module flip.
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
EDA_DRAW_FRAME * GetParent() const
Definition: draw_panel.cpp:180
void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDC, GR_DRAWMODE aDrawMode, const wxPoint &aOffset=ZeroOffset) override
Function Draw Draw the text according to the footprint pos and orient.
void GRLine(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color, wxPenStyle aStyle)
Definition: gr_basic.cpp:380
#define DIM_ANCRE_TEXTE
Definition: eda_text.h:73
const wxPoint GetPosition() const
Definition: eda_rect.h:113
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
bool IsFrontLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it&#39;s a front layer.
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:189
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Function IsElementVisible tests whether a given element category is visible.
void SetLocalCoord()
Set relative coordinates.
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
#define max(a, b)
Definition: auxiliary.h:86
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:169
const wxString & GetReference() const
Function GetReference.
Definition: class_module.h:458
bool IsMirrored() const
Definition: eda_text.h:177
virtual void ViewGetLayers(int aLayers[], int &aCount) const override
Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on...
bool IsVisible() const
Definition: eda_text.h:174
wxPoint m_Pos0
text coordinates relative to the footprint anchor, orient 0.
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
virtual bool TextHitTest(const wxPoint &aPoint, int aAccuracy=0) const override
Function TextHitTest Test if aPoint is within the bounds of this object.
void SetDrawCoord()
Set absolute coordinates.
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
BASE_SCREEN * GetScreen()
Definition: draw_panel.cpp:193
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:162
void DrawUmbilical(EDA_DRAW_PANEL *aPanel, wxDC *aDC, GR_DRAWMODE aDrawMode, const wxPoint &aOffset=ZeroOffset)
Function DrawUmbilical draws a line from the TEXTE_MODULE origin to parent MODULE origin...
void Mirror(const wxPoint &aCentre, bool aMirrorAroundXAxis)
Mirror text position in footprint edition the text itself is not mirrored, and the layer not modified...
int GetTextHeight() const
Definition: eda_text.h:219
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
void SetTextAngle(double aAngle)
Module description (excepted pads)
const wxSize & GetTextSize() const
Definition: eda_text.h:213
void * GetDisplayOptions()
Function GetDisplayOptions A way to pass info to draw functions.
Definition: draw_panel.cpp:187
Class EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53
Class VIEW.
Definition: view.h:58
T NormalizeAngle360Min(T Angle)
Normalize angle to be > -360.0 and < 360.0 Angle equal to -360 or +360 are set to 0...
Definition: trigo.h:222
Message panel definition file.
TEXT_TYPE m_Type
0=ref, 1=val, etc.
const wxPoint GetPosition() const override
Definition: class_module.h:182
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer...
show modules references (when texts are visibles)
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
void SetThickness(int aNewThickness)
Function SetThickness sets pen width.
Definition: eda_text.h:146
void SetTextY(int aY)
Definition: eda_text.h:225
bool IsLayerVisible(PCB_LAYER_ID aLayer) const
Function IsLayerVisible is a proxy function that calls the correspondent function in m_BoardSettings ...
Definition: class_board.h:454
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
Definition: colors.h:62