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  DISPLAY_OPTIONS* displ_opts = (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  // Keep angle between -90 .. 90 deg. Otherwise the text is not easy to read
332  while( rotation > 900 )
333  rotation -= 1800;
334 
335  while( rotation < -900 )
336  rotation += 1800;
337 
338  return rotation;
339 }
340 
341 
342 // see class_text_mod.h
343 void TEXTE_MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
344 {
345  MODULE* module = (MODULE*) m_Parent;
346 
347  if( module == NULL ) // Happens in modedit, and for new texts
348  return;
349 
350  wxString msg, Line;
351 
352  static const wxString text_type_msg[3] =
353  {
354  _( "Ref." ), _( "Value" ), _( "Text" )
355  };
356 
357  Line = module->GetReference();
358  aList.push_back( MSG_PANEL_ITEM( _( "Footprint" ), Line, DARKCYAN ) );
359 
360  Line = GetShownText();
361  aList.push_back( MSG_PANEL_ITEM( _( "Text" ), Line, BROWN ) );
362 
363  wxASSERT( m_Type >= TEXT_is_REFERENCE && m_Type <= TEXT_is_DIVERS );
364  aList.push_back( MSG_PANEL_ITEM( _( "Type" ), text_type_msg[m_Type], DARKGREEN ) );
365 
366  if( !IsVisible() )
367  msg = _( "No" );
368  else
369  msg = _( "Yes" );
370 
371  aList.push_back( MSG_PANEL_ITEM( _( "Display" ), msg, DARKGREEN ) );
372 
373  // Display text layer
374  aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), GetLayerName(), DARKGREEN ) );
375 
376  if( IsMirrored() )
377  msg = _( " Yes" );
378  else
379  msg = _( " No" );
380 
381  aList.push_back( MSG_PANEL_ITEM( _( "Mirror" ), msg, DARKGREEN ) );
382 
383  msg.Printf( wxT( "%.1f" ), GetTextAngleDegrees() );
384  aList.push_back( MSG_PANEL_ITEM( _( "Angle" ), msg, DARKGREEN ) );
385 
387  aList.push_back( MSG_PANEL_ITEM( _( "Thickness" ), msg, DARKGREEN ) );
388 
390  aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, RED ) );
391 
393  aList.push_back( MSG_PANEL_ITEM( _( "Height" ), msg, RED ) );
394 }
395 
396 
398 {
399  wxString text;
400  const wxChar *reference = GetChars( static_cast<MODULE*>( GetParent() )->GetReference() );
401 
402  switch( m_Type )
403  {
404  case TEXT_is_REFERENCE:
405  text.Printf( _( "Reference %s" ), reference );
406  break;
407 
408  case TEXT_is_VALUE:
409  text.Printf( _( "Value %s of %s" ), GetChars( GetShownText() ), reference );
410  break;
411 
412  default: // wrap this one in quotes:
413  text.Printf( _( "Text \"%s\" on %s of %s" ), GetChars( ShortenedShownText() ),
414  GetChars( GetLayerName() ), reference );
415  break;
416  }
417 
418  return text;
419 }
420 
421 
423 {
424  return footprint_text_xpm;
425 }
426 
427 
429 {
430  return new TEXTE_MODULE( *this );
431 }
432 
433 
435 {
436  double angle = GetDrawRotation();
437  EDA_RECT text_area = GetTextBox( -1, -1 );
438 
439  if( angle )
440  text_area = text_area.GetBoundingBoxRotated( GetTextPos(), angle );
441 
442  return BOX2I( text_area.GetPosition(), text_area.GetSize() );
443 }
444 
445 
446 void TEXTE_MODULE::ViewGetLayers( int aLayers[], int& aCount ) const
447 {
448  if( !IsVisible() ) // Hidden text
449  aLayers[0] = LAYER_MOD_TEXT_INVISIBLE;
450  //else if( IsFrontLayer( m_Layer ) )
451  //aLayers[0] = LAYER_MOD_TEXT_FR;
452  //else if( IsBackLayer( m_Layer ) )
453  //aLayers[0] = LAYER_MOD_TEXT_BK;
454  else
455  aLayers[0] = GetLayer();
456 
457  aCount = 1;
458 }
459 
460 
461 unsigned int TEXTE_MODULE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
462 {
463  const int MAX = std::numeric_limits<unsigned int>::max();
464 
465  if( !aView )
466  return 0;
467 
468  if( m_Type == TEXT_is_VALUE && !aView->IsLayerVisible( LAYER_MOD_VALUES ) )
469  return MAX;
470 
472  return MAX;
473 
474  if( IsFrontLayer( m_Layer ) && ( !aView->IsLayerVisible( LAYER_MOD_TEXT_FR ) ||
475  !aView->IsLayerVisible( LAYER_MOD_FR ) ) )
476  return MAX;
477 
478  if( IsBackLayer( m_Layer ) && ( !aView->IsLayerVisible( LAYER_MOD_TEXT_BK ) ||
479  !aView->IsLayerVisible( LAYER_MOD_BK ) ) )
480  return MAX;
481 
482  return 0;
483 }
484 
485 
487 {
488  /* First order optimization: no % means that no processing is
489  * needed; just hope that RVO and copy constructor implementation
490  * avoid to copy the whole block; anyway it should be better than
491  * rebuild the string one character at a time...
492  * Also it seems wise to only expand macros in user text (but there
493  * is no technical reason, probably) */
494 
495  if( (m_Type != TEXT_is_DIVERS) || (wxString::npos == m_Text.find('%')) )
496  return m_Text;
497 
498  wxString newbuf;
499  const MODULE *module = static_cast<MODULE*>( GetParent() );
500 
501  for( wxString::const_iterator it = m_Text.begin(); it != m_Text.end(); ++it )
502  {
503  // Process '%' and copy everything else
504  if( *it != '%' )
505  newbuf.append(*it);
506  else
507  {
508  /* Look at the next character (if is it there) and append
509  * its expansion */
510  ++it;
511 
512  if( it != m_Text.end() )
513  {
514  switch( char(*it) )
515  {
516  case '%':
517  newbuf.append( '%' );
518  break;
519 
520  case 'R':
521  if( module )
522  newbuf.append( module->GetReference() );
523  break;
524 
525  case 'V':
526  if( module )
527  newbuf.append( module->GetValue() );
528  break;
529 
530  default:
531  newbuf.append( '?' );
532  break;
533  }
534  }
535  else
536  break; // The string is over and we can't ++ anymore
537  }
538  }
539 
540  return newbuf;
541 }
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 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
bool IsElementVisible(GAL_LAYER_ID LAYER_aPCB) const
Function IsElementVisible tests whether a given element category is visible.
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:92
PNG memory record (file in memory).
Definition: bitmap_types.h:38
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:290
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. ...
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.
void GRLine(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color)
Definition: gr_basic.cpp:352
Class BOARD to handle a board.
const wxPoint & GetPosition() const override
Definition: class_module.h:155
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:1267
const wxString & GetValue() const
Function GetValue.
Definition: class_module.h:447
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:317
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:101
#define UMBILICAL_COLOR
void GRRect(EDA_RECT *aClipBox, wxDC *aDC, int x1, int y1, int x2, int y2, COLOR4D aColor)
Definition: gr_basic.cpp:1077
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:115
double GetOrientation() const
Definition: class_module.h:160
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.
bool m_ContrastModeDisplay
Definition: pcbstruct.h:85
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.
#define DIM_ANCRE_TEXTE
Definition: eda_text.h:75
const wxPoint & GetPosition() const
Class DISPLAY_OPTIONS handles display options like enable/disable some optional drawings.
Definition: pcbstruct.h:62
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:105
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.
PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
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:419
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
Message panel definition file.
TEXT_TYPE m_Type
0=ref, 1=val, etc.
const wxSize & GetSize() const
bool m_DisplayModTextFill
Definition: pcbstruct.h:70
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
T NormalizeAngle360(T Angle)
Normalize angle to be in the -360.0 .. 360.0:
Definition: trigo.h:202
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