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_keepUpright = true;
60 
61  // Set text thickness to a default value
62  SetThickness( Millimeter2iu( DEFAULT_TEXT_WIDTH ) );
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 editing
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_keepUpright )
345  {
346  // Keep angle between -90 .. 90 deg. Otherwise the text is not easy to read
347  while( rotation > 900 )
348  rotation -= 1800;
349 
350  while( rotation < -900 )
351  rotation += 1800;
352  }
353  else
354  {
355  NORMALIZE_ANGLE_POS( rotation );
356  }
357 
358  return rotation;
359 }
360 
361 
362 // see class_text_mod.h
363 void TEXTE_MODULE::GetMsgPanelInfo( EDA_UNITS_T aUnits, 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 
406  msg = MessageTextFromValue( aUnits, GetThickness(), true );
407  aList.push_back( MSG_PANEL_ITEM( _( "Thickness" ), msg, DARKGREEN ) );
408 
409  msg = MessageTextFromValue( aUnits, GetTextWidth(), true );
410  aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, RED ) );
411 
412  msg = MessageTextFromValue( aUnits, GetTextHeight(), true );
413  aList.push_back( MSG_PANEL_ITEM( _( "Height" ), msg, RED ) );
414 }
415 
416 
418 {
419  switch( m_Type )
420  {
421  case TEXT_is_REFERENCE:
422  return wxString::Format( _( "Reference %s" ),
423  static_cast<MODULE*>( GetParent() )->GetReference() );
424 
425  case TEXT_is_VALUE:
426  return wxString::Format( _( "Value %s of %s" ),
427  GetShownText(),
428  static_cast<MODULE*>( GetParent() )->GetReference() );
429 
430  default: // wrap this one in quotes:
431  return wxString::Format( _( "Text \"%s\" of %s on %s" ),
433  static_cast<MODULE*>( GetParent() )->GetReference(),
434  GetLayerName() );
435  }
436 }
437 
438 
440 {
441  return footprint_text_xpm;
442 }
443 
444 
446 {
447  return new TEXTE_MODULE( *this );
448 }
449 
450 
452 {
453  double angle = GetDrawRotation();
454  EDA_RECT text_area = GetTextBox( -1, -1 );
455 
456  if( angle )
457  text_area = text_area.GetBoundingBoxRotated( GetTextPos(), angle );
458 
459  return BOX2I( text_area.GetPosition(), text_area.GetSize() );
460 }
461 
462 
463 void TEXTE_MODULE::ViewGetLayers( int aLayers[], int& aCount ) const
464 {
465  if( IsVisible() )
466  aLayers[0] = GetLayer();
467  else
468  aLayers[0] = LAYER_MOD_TEXT_INVISIBLE;
469 
470  aCount = 1;
471 }
472 
473 
474 unsigned int TEXTE_MODULE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
475 {
476  const int HIDE = std::numeric_limits<unsigned int>::max();
477 
478  if( !aView )
479  return 0;
480 
481  // Hidden text gets put on the LAYER_MOD_TEXT_INVISIBLE for rendering, but
482  // should only render if its native layer is visible.
483  if( !aView->IsLayerVisible( GetLayer() ) )
484  return HIDE;
485 
486  // Handle Render tab switches
487  if( ( m_Type == TEXT_is_VALUE || m_Text == wxT( "%V" ) )
488  && !aView->IsLayerVisible( LAYER_MOD_VALUES ) )
489  return HIDE;
490 
491  if( ( m_Type == TEXT_is_REFERENCE || m_Text == wxT( "%R" ) )
492  && !aView->IsLayerVisible( LAYER_MOD_REFERENCES ) )
493  return HIDE;
494 
495  if( !IsParentFlipped() && !aView->IsLayerVisible( LAYER_MOD_FR ) )
496  return HIDE;
497 
498  if( IsParentFlipped() && !aView->IsLayerVisible( LAYER_MOD_BK ) )
499  return HIDE;
500 
502  return HIDE;
503 
504  if( IsBackLayer( m_Layer ) && !aView->IsLayerVisible( LAYER_MOD_TEXT_BK ) )
505  return HIDE;
506 
507  // Other layers are shown without any conditions
508  return 0;
509 }
510 
511 
513 {
514  /* First order optimization: no % means that no processing is
515  * needed; just hope that RVO and copy constructor implementation
516  * avoid to copy the whole block; anyway it should be better than
517  * rebuild the string one character at a time...
518  * Also it seems wise to only expand macros in user text (but there
519  * is no technical reason, probably) */
520 
521  if( (m_Type != TEXT_is_DIVERS) || (wxString::npos == m_Text.find('%')) )
522  return m_Text;
523 
524  wxString newbuf;
525  const MODULE *module = static_cast<MODULE*>( GetParent() );
526 
527  for( wxString::const_iterator it = m_Text.begin(); it != m_Text.end(); ++it )
528  {
529  // Process '%' and copy everything else
530  if( *it != '%' )
531  newbuf.append(*it);
532  else
533  {
534  /* Look at the next character (if is it there) and append
535  * its expansion */
536  ++it;
537 
538  if( it != m_Text.end() )
539  {
540  switch( char(*it) )
541  {
542  case '%':
543  newbuf.append( '%' );
544  break;
545 
546  case 'R':
547  if( module )
548  newbuf.append( module->GetReference() );
549  break;
550 
551  case 'V':
552  if( module )
553  newbuf.append( module->GetValue() );
554  break;
555 
556  default:
557  newbuf.append( '?' );
558  break;
559  }
560  }
561  else
562  break; // The string is over and we can't ++ anymore
563  }
564  }
565 
566  return newbuf;
567 }
void SetMirrored(bool isMirrored)
Definition: eda_text.h:191
virtual BASE_SCREEN * GetScreen()=0
void SetTextAngle(double aAngle)
Definition: eda_text.h:169
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
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:242
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:520
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:168
wxString m_Text
Definition: eda_text.h:374
double GetDrawRotation() const
wxString ShortenedShownText() const
Returns a shortened version (max 15 characters) of the shown text.
Definition: eda_text.cpp:80
PNG memory record (file in memory).
Definition: bitmap_types.h:41
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:223
const wxPoint & GetTextPos() const
Definition: eda_text.h:237
bool IsItalic() const
Definition: eda_text.h:183
bool IsLayerVisible(int aLayer) const
Function IsLayerVisible() Returns information about visibility of a particular layer.
Definition: view.h:429
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.
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:231
void Move(const wxPoint &aMoveVector) override
move text in move transform, in footprint editor
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:236
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:1193
bool IsParentFlipped() const
const wxString & GetValue() const
Function GetValue.
Definition: class_module.h:494
virtual EDA_RECT * GetClipBox()
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:179
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:203
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:186
double GetTextAngle() const
Definition: eda_text.h:177
int GetThickness() const
Function GetThickness returns pen width.
Definition: eda_text.h:167
This file contains miscellaneous commonly used macros and functions.
void SetTextX(int aX)
Definition: eda_text.h:239
show modules on front
wxString MessageTextFromValue(EDA_UNITS_T aUnits, int aValue, bool aUseMils)
Definition: base_units.cpp:125
Class EDA_TEXT is a mix-in class (via multiple inheritance) that handles texts such as labels...
Definition: eda_text.h:127
virtual EDA_DRAW_FRAME * GetParent() const =0
#define DEFAULT_TEXT_WIDTH
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:1003
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:103
double GetOrientation() const
Definition: class_module.h:189
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:143
const EDA_RECT GetBoundingBoxRotated(wxPoint aRotCenter, double aAngle)
Function GetBoundingBoxRotated.
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...
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:285
#define DIM_ANCRE_TEXTE
Definition: eda_text.h:88
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:204
wxString GetSelectMenuText(EDA_UNITS_T aUnits) const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
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.
void GetMsgPanelInfo(EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it&#39;s internal state for displ...
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 max(a, b)
Definition: auxiliary.h:86
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:170
const wxString & GetReference() const
Function GetReference.
Definition: class_module.h:460
bool IsMirrored() const
Definition: eda_text.h:192
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:189
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
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:151
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 editing the text itself is not mirrored, and the layer not modified...
int GetTextHeight() const
Definition: eda_text.h:234
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:228
virtual void * GetDisplayOptions()
Function GetDisplayOptions A way to pass info to draw functions.
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:61
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:184
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer...
EDA_UNITS_T
Definition: common.h:159
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:161
void SetTextY(int aY)
Definition: eda_text.h:240
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:457
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
Definition: colors.h:62