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-2016 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 <wxstruct.h>
34 #include <trigo.h>
35 #include <class_drawpanel.h>
36 #include <drawtxt.h>
37 #include <kicad_string.h>
38 #include <richio.h>
39 #include <macros.h>
40 #include <wxPcbStruct.h>
41 #include <msgpanel.h>
42 #include <base_units.h>
43 #include <bitmaps.h>
44 
45 #include <class_board.h>
46 #include <class_module.h>
47 
48 #include <view/view.h>
49 
50 #include <pcbnew.h>
51 
52 
54  BOARD_ITEM( parent, PCB_MODULE_TEXT_T ),
55  EDA_TEXT()
56 {
57  MODULE* module = static_cast<MODULE*>( m_Parent );
58 
59  m_Type = text_type;
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 
148 
149 void TEXTE_MODULE::Mirror( const wxPoint& aCentre, bool aMirrorAroundXAxis )
150 {
151  // Used in modedit, to transform the footprint
152  // the mirror is around the Y axis or X axis if aMirrorAroundXAxis = true
153  // the position is mirrored, but the text itself is not mirrored
154  if( aMirrorAroundXAxis )
155  SetTextY( ::Mirror( GetTextPos().y, aCentre.y ) );
156  else
157  SetTextX( ::Mirror( GetTextPos().x, aCentre.x ) );
158 
159  SetLocalCoord();
160 }
161 
162 
163 void TEXTE_MODULE::Move( const wxPoint& aMoveVector )
164 {
165  Offset( aMoveVector );
166  SetLocalCoord();
167 }
168 
169 
171 {
172  return m_Text.Len();
173 }
174 
175 
177 {
178  const MODULE* module = static_cast<const MODULE*>( m_Parent );
179 
180  SetTextPos( m_Pos0 );
181 
182  if( module )
183  {
184  double angle = module->GetOrientation();
185 
186  wxPoint pt = GetTextPos();
187  RotatePoint( &pt, angle );
188  SetTextPos( pt );
189 
190  Offset( module->GetPosition() );
191  }
192 }
193 
194 
196 {
197  const MODULE* module = static_cast<const MODULE*>( m_Parent );
198 
199  if( module )
200  {
201  m_Pos0 = GetTextPos() - module->GetPosition();
202 
203  double angle = module->GetOrientation();
204 
205  RotatePoint( &m_Pos0.x, &m_Pos0.y, -angle );
206  }
207  else
208  {
209  m_Pos0 = GetTextPos();
210  }
211 }
212 
214 {
215  double angle = GetDrawRotation();
216  EDA_RECT text_area = GetTextBox( -1, -1 );
217 
218  if( angle )
219  text_area = text_area.GetBoundingBoxRotated( GetTextPos(), angle );
220 
221  return text_area;
222 }
223 
224 
225 void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
226  const wxPoint& aOffset )
227 {
228  if( aPanel == NULL )
229  return;
230 
231  /* parent must *not* be NULL (a footprint text without a footprint
232  parent has no sense) */
233  wxASSERT( m_Parent );
234 
235  BOARD* brd = GetBoard( );
236 
237  auto frame = static_cast<PCB_BASE_FRAME*> ( aPanel->GetParent() );
238  auto color = frame->Settings().Colors().GetLayerColor( GetLayer() );
239 
240  PCB_LAYER_ID text_layer = GetLayer();
241 
242  if( !brd->IsLayerVisible( m_Layer )
243  || ( IsFrontLayer( text_layer ) && !brd->IsElementVisible( LAYER_MOD_TEXT_FR ) )
244  || ( IsBackLayer( text_layer ) && !brd->IsElementVisible( LAYER_MOD_TEXT_BK ) ) )
245  return;
246 
247  // Invisible texts are still drawn (not plotted) in LAYER_MOD_TEXT_INVISIBLE
248  // Just because we must have to edit them (at least to make them visible)
249  if( !IsVisible() )
250  {
252  return;
253 
254  color = frame->Settings().Colors().GetItemColor( LAYER_MOD_TEXT_INVISIBLE );
255  }
256 
257  auto displ_opts = (PCB_DISPLAY_OPTIONS*)( aPanel->GetDisplayOptions() );
258 
259  // shade text if high contrast mode is active
260  if( ( aDrawMode & GR_ALLOW_HIGHCONTRAST ) && displ_opts && displ_opts->m_ContrastModeDisplay )
261  {
262  PCB_LAYER_ID curr_layer = ( (PCB_SCREEN*) aPanel->GetScreen() )->m_Active_Layer;
263 
264  if( !IsOnLayer( curr_layer ) )
266  }
267 
268  // Draw mode compensation for the width
269  int width = GetThickness();
270 
271  if( displ_opts && displ_opts->m_DisplayModTextFill == SKETCH )
272  width = -width;
273 
274  GRSetDrawMode( aDC, aDrawMode );
275  wxPoint pos = GetTextPos() - aOffset;
276 
277  // Draw the text anchor point
278  if( brd->IsElementVisible( LAYER_ANCHOR ) )
279  {
280  COLOR4D anchor_color = frame->Settings().Colors().GetItemColor( LAYER_ANCHOR );
281  GRDrawAnchor( aPanel->GetClipBox(), aDC, pos.x, pos.y, DIM_ANCRE_TEXTE, anchor_color );
282  }
283 
284  // Draw the text proper, with the right attributes
285  wxSize size = GetTextSize();
286  double orient = GetDrawRotation();
287 
288  // If the text is mirrored : negate size.x (mirror / Y axis)
289  if( IsMirrored() )
290  size.x = -size.x;
291 
292  DrawGraphicText( aPanel->GetClipBox(), aDC, pos, color, GetShownText(), orient,
293  size, GetHorizJustify(), GetVertJustify(),
294  width, IsItalic(), IsBold() );
295 
296  // Enable these line to draw the bounding box (debug test purpose only)
297 #if 0
298  {
299  EDA_RECT BoundaryBox = GetBoundingBox();
300  GRRect( aPanel->GetClipBox(), aDC, BoundaryBox, 0, BROWN );
301  }
302 #endif
303 }
304 
305 
307  wxDC* aDC,
308  GR_DRAWMODE aDrawMode,
309  const wxPoint& aOffset )
310 {
311  MODULE* parent = static_cast<MODULE*>( GetParent() );
312 
313  if( !parent )
314  return;
315 
316  GRSetDrawMode( aDC, GR_XOR );
317  GRLine( aPanel->GetClipBox(), aDC,
318  parent->GetPosition(), GetTextPos() + aOffset,
319  0, UMBILICAL_COLOR);
320 }
321 
322 
324 {
325  MODULE* module = (MODULE*) m_Parent;
326  double rotation = GetTextAngle();
327 
328  if( module )
329  rotation += module->GetOrientation();
330 
331  NORMALIZE_ANGLE_POS( rotation );
332 
333  return rotation;
334 }
335 
336 
337 // see class_text_mod.h
338 void TEXTE_MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
339 {
340  MODULE* module = (MODULE*) m_Parent;
341 
342  if( module == NULL ) // Happens in modedit, and for new texts
343  return;
344 
345  wxString msg, Line;
346 
347  static const wxString text_type_msg[3] =
348  {
349  _( "Ref." ), _( "Value" ), _( "Text" )
350  };
351 
352  Line = module->GetReference();
353  aList.push_back( MSG_PANEL_ITEM( _( "Footprint" ), Line, DARKCYAN ) );
354 
355  Line = GetShownText();
356  aList.push_back( MSG_PANEL_ITEM( _( "Text" ), Line, BROWN ) );
357 
358  wxASSERT( m_Type >= TEXT_is_REFERENCE && m_Type <= TEXT_is_DIVERS );
359  aList.push_back( MSG_PANEL_ITEM( _( "Type" ), text_type_msg[m_Type], DARKGREEN ) );
360 
361  if( !IsVisible() )
362  msg = _( "No" );
363  else
364  msg = _( "Yes" );
365 
366  aList.push_back( MSG_PANEL_ITEM( _( "Display" ), msg, DARKGREEN ) );
367 
368  // Display text layer
369  aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), GetLayerName(), DARKGREEN ) );
370 
371  if( IsMirrored() )
372  msg = _( " Yes" );
373  else
374  msg = _( " No" );
375 
376  aList.push_back( MSG_PANEL_ITEM( _( "Mirror" ), msg, DARKGREEN ) );
377 
378  msg.Printf( wxT( "%.1f" ), GetTextAngleDegrees() );
379  aList.push_back( MSG_PANEL_ITEM( _( "Angle" ), msg, DARKGREEN ) );
380 
382  aList.push_back( MSG_PANEL_ITEM( _( "Thickness" ), msg, DARKGREEN ) );
383 
385  aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, RED ) );
386 
388  aList.push_back( MSG_PANEL_ITEM( _( "Height" ), msg, RED ) );
389 }
390 
391 
393 {
394  wxString text;
395  const wxChar *reference = GetChars( static_cast<MODULE*>( GetParent() )->GetReference() );
396 
397  switch( m_Type )
398  {
399  case TEXT_is_REFERENCE:
400  text.Printf( _( "Reference %s" ), reference );
401  break;
402 
403  case TEXT_is_VALUE:
404  text.Printf( _( "Value %s of %s" ), GetChars( GetShownText() ), reference );
405  break;
406 
407  default: // wrap this one in quotes:
408  text.Printf( _( "Text \"%s\" on %s of %s" ), GetChars( ShortenedShownText() ),
409  GetChars( GetLayerName() ), reference );
410  break;
411  }
412 
413  return text;
414 }
415 
416 
418 {
419  return footprint_text_xpm;
420 }
421 
422 
424 {
425  return new TEXTE_MODULE( *this );
426 }
427 
428 
430 {
431  double angle = GetDrawRotation();
432  EDA_RECT text_area = GetTextBox( -1, -1 );
433 
434  if( angle )
435  text_area = text_area.GetBoundingBoxRotated( GetTextPos(), angle );
436 
437  return BOX2I( text_area.GetPosition(), text_area.GetSize() );
438 }
439 
440 
441 void TEXTE_MODULE::ViewGetLayers( int aLayers[], int& aCount ) const
442 {
443  if( !IsVisible() ) // Hidden text
444  aLayers[0] = LAYER_MOD_TEXT_INVISIBLE;
445  //else if( IsFrontLayer( m_Layer ) )
446  //aLayers[0] = LAYER_MOD_TEXT_FR;
447  //else if( IsBackLayer( m_Layer ) )
448  //aLayers[0] = LAYER_MOD_TEXT_BK;
449  else
450  aLayers[0] = GetLayer();
451 
452  aCount = 1;
453 }
454 
455 
456 unsigned int TEXTE_MODULE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
457 {
458  const int MAX = std::numeric_limits<unsigned int>::max();
459 
460  if( !aView )
461  return 0;
462 
463  if( m_Type == TEXT_is_VALUE && !aView->IsLayerVisible( LAYER_MOD_VALUES ) )
464  return MAX;
465 
467  return MAX;
468 
469  if( IsFrontLayer( m_Layer ) && ( !aView->IsLayerVisible( LAYER_MOD_TEXT_FR ) ||
470  !aView->IsLayerVisible( LAYER_MOD_FR ) ) )
471  return MAX;
472 
473  if( IsBackLayer( m_Layer ) && ( !aView->IsLayerVisible( LAYER_MOD_TEXT_BK ) ||
474  !aView->IsLayerVisible( LAYER_MOD_BK ) ) )
475  return MAX;
476 
477  return 0;
478 }
479 
480 
482 {
483  /* First order optimization: no % means that no processing is
484  * needed; just hope that RVO and copy constructor implementation
485  * avoid to copy the whole block; anyway it should be better than
486  * rebuild the string one character at a time...
487  * Also it seems wise to only expand macros in user text (but there
488  * is no technical reason, probably) */
489 
490  if( (m_Type != TEXT_is_DIVERS) || (wxString::npos == m_Text.find('%')) )
491  return m_Text;
492 
493  wxString newbuf;
494  const MODULE *module = static_cast<MODULE*>( GetParent() );
495 
496  for( wxString::const_iterator it = m_Text.begin(); it != m_Text.end(); ++it )
497  {
498  // Process '%' and copy everything else
499  if( *it != '%' )
500  newbuf.append(*it);
501  else
502  {
503  /* Look at the next character (if is it there) and append
504  * its expansion */
505  ++it;
506 
507  if( it != m_Text.end() )
508  {
509  switch( char(*it) )
510  {
511  case '%':
512  newbuf.append( '%' );
513  break;
514 
515  case 'R':
516  if( module )
517  newbuf.append( module->GetReference() );
518  break;
519 
520  case 'V':
521  if( module )
522  newbuf.append( module->GetValue() );
523  break;
524 
525  default:
526  newbuf.append( '?' );
527  break;
528  }
529  }
530  else
531  break; // The string is over and we can't ++ anymore
532  }
533  }
534 
535  return newbuf;
536 }
void SetMirrored(bool isMirrored)
Definition: eda_text.h:178
void SetTextAngle(double aAngle)
Definition: eda_text.h:156
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:117
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
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:229
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
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), PLOTTER *aPlotter)
Function DrawGraphicText Draw a graphic text (like module texts)
Definition: drawtxt.cpp:122
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:182
wxString m_Text
Definition: eda_text.h:346
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:38
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:296
const wxPoint & GetTextPos() const
Definition: eda_text.h:224
bool IsItalic() const
Definition: eda_text.h:170
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. ...
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's a back layer.
Class BOARD to handle a board.
const wxPoint & GetPosition() const override
Definition: class_module.h:175
wxString GetSelectMenuText() const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
Function FlippedLayerNumber.
Definition: lset.cpp:445
int GetTextWidth() const
Definition: eda_text.h:218
void Move(const wxPoint &aMoveVector) override
move text in move transform, in footprint editor
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:223
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:1266
const wxString & GetValue() const
Function GetValue.
Definition: class_module.h:467
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:317
void NORMALIZE_ANGLE_POS(T &Angle)
Definition: trigo.h:241
double GetTextAngleDegrees() const
Definition: eda_text.h:166
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:190
wxString GetLayerName() const
Function GetLayerName returns the name of the PCB layer on which the item resides.
bool IsBold() const
Definition: eda_text.h:173
double GetTextAngle() const
Definition: eda_text.h:164
int GetThickness() const
Function GetThickness returns pen width.
Definition: eda_text.h:154
This file contains miscellaneous commonly used macros and functions.
void SetTextX(int aX)
Definition: eda_text.h:226
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:114
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:1076
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:180
GR_DRAWMODE
Drawmode. Compositing mode plus a flag or two.
Definition: gr_basic.h:41
Base window classes and related definitions.
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'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:174
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:358
#define DIM_ANCRE_TEXTE
Definition: eda_text.h:75
const wxPoint & GetPosition() const
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
bool IsFrontLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a front layer.
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:191
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:439
bool IsMirrored() const
Definition: eda_text.h:179
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:176
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.
BASE_SCREEN * GetScreen()
Definition: draw_panel.cpp:187
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:165
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:221
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
This file is part of the common libary.
void SetTextAngle(double aAngle)
Module description (excepted pads)
const wxSize & GetTextSize() const
Definition: eda_text.h:215
void * GetDisplayOptions()
Function GetDisplayOptions A way to pass info to draw functions.
Definition: draw_panel.cpp:181
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 wxSize & GetSize() const
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:148
void SetTextY(int aY)
Definition: eda_text.h:227
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:451
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
Definition: colors.h:62