KiCad PCB EDA Suite
WORKSHEET_DATAITEM_TEXT Class Reference

#include <class_worksheet_dataitem.h>

Inheritance diagram for WORKSHEET_DATAITEM_TEXT:
WORKSHEET_DATAITEM

Public Types

enum  WS_ItemType {
  WS_TEXT, WS_SEGMENT, WS_RECT, WS_POLYPOLYGON,
  WS_BITMAP
}
 

Public Member Functions

 WORKSHEET_DATAITEM_TEXT (const wxString &aTextBase)
 
virtual bool HasEndPoint () override
 
virtual int GetPenSizeUi () override
 
void MoveTo (DPOINT aPosition)
 move item to a new position More...
 
void TransfertSetupToGraphicText (WS_DRAW_ITEM_TEXT *aGText)
 transfert the text justification and orientation to aGText More...
 
void IncrementLabel (int aIncr)
 Try to build text wihich is an increment of m_TextBase has meaning only if m_TextBase is a basic text (one char) If the basic char is a digit, build a number If the basic char is a letter, use the letter with ascii code aIncr + (basic char ascc code) More...
 
void SetConstrainedTextSize ()
 Calculates m_ConstrainedTextSize from m_TextSize to keep the X size and the full Y size of the text smaller than m_BoundingBoxSize if m_BoundingBoxSize.x or m_BoundingBoxSize.y > 0 if m_BoundingBoxSize.x or m_BoundingBoxSize.y == 0 the corresponding text size is not constrained. More...
 
bool ReplaceAntiSlashSequence ()
 Replace the '\''n' sequence by EOL and the sequence '\''\' by only one '\' inside m_FullText. More...
 
bool IsBold ()
 
void SetBold (bool aState)
 Function SetBold Toggles on/off the bold option flag. More...
 
bool IsItalic () const
 
void SetItalic (bool aState)
 Function SetItalic Toggles on/off the italic option flag. More...
 
void SetStart (double aPosx, double aPosy, enum corner_anchor aAnchor=RB_CORNER)
 
void SetEnd (double aPosx, double aPosy, enum corner_anchor aAnchor=RB_CORNER)
 
WS_ItemType GetType () const
 
int GetFlags () const
 
void SetFlags (int aMask)
 
void ClearFlags (int aMask)
 
int GetPage1Option ()
 
void SetPage1Option (int aChoice)
 Set the option for page 1. More...
 
const wxPoint GetStartPosUi (int ii=0) const
 
const wxPoint GetEndPosUi (int ii=0) const
 
const DPOINT GetStartPos (int ii=0) const
 
const DPOINT GetEndPos (int ii=0) const
 
void MoveToUi (wxPoint aPosition)
 move item to a new position More...
 
void MoveStartPointTo (DPOINT aPosition)
 move the starting point of the item to a new position More...
 
void MoveStartPointToUi (wxPoint aPosition)
 move the starting point of the item to a new position More...
 
void MoveEndPointTo (DPOINT aPosition)
 move the ending point of the item to a new position has meaning only for items defined by 2 points (segments and rectangles) More...
 
void MoveEndPointToUi (wxPoint aPosition)
 move the ending point of the item to a new position has meaning only for items defined by 2 points (segments and rectangles) More...
 
virtual bool IsInsidePage (int ii) const
 
const wxString GetClassName () const
 
bool IsSelected ()
 
void SetSelected (bool aState)
 Function SetSelected Toggles on/off the selected flag (used in edition functions. More...
 
bool UseAltColor ()
 
COLOR4D GetItemColor ()
 

Static Public Member Functions

static int GetMarkerSizeUi ()
 

Public Attributes

wxString m_TextBase
 
wxString m_FullText
 
double m_Orient
 
EDA_TEXT_HJUSTIFY_T m_Hjustify
 
EDA_TEXT_VJUSTIFY_T m_Vjustify
 
DSIZE m_TextSize
 
DSIZE m_BoundingBoxSize
 
DSIZE m_ConstrainedTextSize
 
wxString m_Name
 
wxString m_Info
 
POINT_COORD m_Pos
 
POINT_COORD m_End
 
double m_LineWidth
 
int m_RepeatCount
 
DPOINT m_IncrementVector
 
int m_IncrementLabel
 

Static Public Attributes

static double m_WSunits2Iu = 1.0
 
static DPOINT m_RB_Corner
 
static DPOINT m_LT_Corner
 
static double m_DefaultLineWidth = 0.0
 
static DSIZE m_DefaultTextSize
 
static double m_DefaultTextThickness = 0.0
 
static bool m_SpecialMode = false
 
static COLOR4D m_Color = COLOR4D( RED )
 
static COLOR4D m_AltColor = COLOR4D( RED )
 
static COLOR4D m_SelectedColor = COLOR4D( BROWN )
 

Protected Attributes

WS_ItemType m_type
 
int m_flags
 

Detailed Description

Definition at line 384 of file class_worksheet_dataitem.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

Member Function Documentation

void WORKSHEET_DATAITEM::ClearFlags ( int  aMask)
inlineinherited
const wxString WORKSHEET_DATAITEM::GetClassName ( ) const
inherited

Definition at line 326 of file class_worksheet_dataitem.cpp.

References WORKSHEET_DATAITEM::GetType(), name, WORKSHEET_DATAITEM::WS_BITMAP, WORKSHEET_DATAITEM::WS_POLYPOLYGON, WORKSHEET_DATAITEM::WS_RECT, WORKSHEET_DATAITEM::WS_SEGMENT, and WORKSHEET_DATAITEM::WS_TEXT.

Referenced by PROPERTIES_FRAME::CopyPrmsFromItemToPanel(), and PL_EDITOR_FRAME::RebuildDesignTree().

327 {
328  wxString name;
329 
330  switch( GetType() )
331  {
332  case WS_TEXT: name = wxT( "Text" ); break;
333  case WS_SEGMENT: name = wxT( "Line" ); break;
334  case WS_RECT: name = wxT( "Rect" ); break;
335  case WS_POLYPOLYGON: name = wxT( "Poly" ); break;
336  case WS_BITMAP: name = wxT( "Bitmap" ); break;
337  }
338 
339  return name;
340 }
WS_ItemType GetType() const
const char * name
const DPOINT WORKSHEET_DATAITEM::GetEndPos ( int  ii = 0) const
inherited

Definition at line 268 of file class_worksheet_dataitem.cpp.

References LB_CORNER, LT_CORNER, POINT_COORD::m_Anchor, WORKSHEET_DATAITEM::m_End, WORKSHEET_DATAITEM::m_IncrementVector, WORKSHEET_DATAITEM::m_LT_Corner, POINT_COORD::m_Pos, WORKSHEET_DATAITEM::m_RB_Corner, RB_CORNER, RT_CORNER, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by WORKSHEET_DATAITEM::GetEndPosUi(), WORKSHEET_DATAITEM::IsInsidePage(), PL_EDITOR_FRAME::MoveItem(), WORKSHEET_DATAITEM::MoveTo(), and PL_EDITOR_FRAME::PlaceItem().

269 {
270  DPOINT pos;
271  pos.x = m_End.m_Pos.x + ( m_IncrementVector.x * ii );
272  pos.y = m_End.m_Pos.y + ( m_IncrementVector.y * ii );
273 
274  switch( m_End.m_Anchor )
275  {
276  case RB_CORNER: // right bottom corner
277  pos = m_RB_Corner - pos;
278  break;
279 
280  case RT_CORNER: // right top corner
281  pos.x = m_RB_Corner.x - pos.x;
282  pos.y = m_LT_Corner.y + pos.y;
283  break;
284 
285  case LB_CORNER: // left bottom corner
286  pos.x = m_LT_Corner.x + pos.x;
287  pos.y = m_RB_Corner.y - pos.y;
288  break;
289 
290  case LT_CORNER: // left top corner
291  pos = m_LT_Corner + pos;
292  break;
293  }
294 
295  return pos;
296 }
const wxPoint WORKSHEET_DATAITEM::GetEndPosUi ( int  ii = 0) const
inherited

Definition at line 299 of file class_worksheet_dataitem.cpp.

References WORKSHEET_DATAITEM::GetEndPos(), KiROUND(), WORKSHEET_DATAITEM::m_WSunits2Iu, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(), moveItem(), and PL_EDITOR_FRAME::MoveItem().

300 {
301  DPOINT pos = GetEndPos( ii );
302  pos = pos * m_WSunits2Iu;
303  return wxPoint( KiROUND( pos.x ), KiROUND( pos.y ) );
304 }
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
const DPOINT GetEndPos(int ii=0) const
int WORKSHEET_DATAITEM::GetFlags ( ) const
inlineinherited
COLOR4D WORKSHEET_DATAITEM::GetItemColor ( )
inlineinherited
static int WORKSHEET_DATAITEM::GetMarkerSizeUi ( )
inlinestaticinherited

Definition at line 208 of file class_worksheet_dataitem.h.

References KiROUND().

Referenced by WS_DRAW_ITEM_LIST::Draw(), WS_DRAW_ITEM_LINE::HitTestEndPoint(), WS_DRAW_ITEM_RECT::HitTestEndPoint(), WS_DRAW_ITEM_LINE::HitTestStartPoint(), WS_DRAW_ITEM_POLYGON::HitTestStartPoint(), WS_DRAW_ITEM_RECT::HitTestStartPoint(), WS_DRAW_ITEM_TEXT::HitTestStartPoint(), and WS_DRAW_ITEM_BITMAP::HitTestStartPoint().

209  {
210  return KiROUND( 0.5 * m_WSunits2Iu );
211  }
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
int WORKSHEET_DATAITEM::GetPage1Option ( )
inherited
Returns
0 if the item has no specific option for page 1 1 if the item is only on page 1 -1 if the item is not on page 1

Definition at line 347 of file class_worksheet_dataitem.cpp.

References WORKSHEET_DATAITEM::m_flags, PAGE1OPTION, PAGE1OPTION_NOTONPAGE1, and PAGE1OPTION_PAGE1ONLY.

Referenced by WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(), and PROPERTIES_FRAME::CopyPrmsFromItemToPanel().

348 {
350  return -1;
351 
352  if(( m_flags & PAGE1OPTION) == PAGE1OPTION_PAGE1ONLY )
353  return 1;
354 
355  return 0;
356 }
#define PAGE1OPTION_NOTONPAGE1
#define PAGE1OPTION_PAGE1ONLY
#define PAGE1OPTION
virtual int WORKSHEET_DATAITEM_TEXT::GetPenSizeUi ( )
inlineoverridevirtual

Reimplemented from WORKSHEET_DATAITEM.

Definition at line 410 of file class_worksheet_dataitem.h.

References KiROUND(), WORKSHEET_DATAITEM::m_DefaultTextThickness, WORKSHEET_DATAITEM::m_LineWidth, and WORKSHEET_DATAITEM::m_WSunits2Iu.

411  {
412  if( m_LineWidth )
413  return KiROUND( m_LineWidth * m_WSunits2Iu );
414  else
416  }
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
static double m_DefaultTextThickness
const DPOINT WORKSHEET_DATAITEM::GetStartPos ( int  ii = 0) const
inherited

Definition at line 229 of file class_worksheet_dataitem.cpp.

References LB_CORNER, LT_CORNER, POINT_COORD::m_Anchor, WORKSHEET_DATAITEM::m_IncrementVector, WORKSHEET_DATAITEM::m_LT_Corner, POINT_COORD::m_Pos, WORKSHEET_DATAITEM::m_Pos, WORKSHEET_DATAITEM::m_RB_Corner, RB_CORNER, RT_CORNER, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by WORKSHEET_DATAITEM_POLYPOLYGON::GetCornerPosition(), WORKSHEET_DATAITEM::GetStartPosUi(), WORKSHEET_DATAITEM::IsInsidePage(), WORKSHEET_DATAITEM_POLYPOLYGON::IsInsidePage(), PL_EDITOR_FRAME::MoveItem(), WORKSHEET_DATAITEM::MoveTo(), and PL_EDITOR_FRAME::PlaceItem().

230 {
231  DPOINT pos;
232  pos.x = m_Pos.m_Pos.x + ( m_IncrementVector.x * ii );
233  pos.y = m_Pos.m_Pos.y + ( m_IncrementVector.y * ii );
234 
235  switch( m_Pos.m_Anchor )
236  {
237  case RB_CORNER: // right bottom corner
238  pos = m_RB_Corner - pos;
239  break;
240 
241  case RT_CORNER: // right top corner
242  pos.x = m_RB_Corner.x - pos.x;
243  pos.y = m_LT_Corner.y + pos.y;
244  break;
245 
246  case LB_CORNER: // left bottom corner
247  pos.x = m_LT_Corner.x + pos.x;
248  pos.y = m_RB_Corner.y - pos.y;
249  break;
250 
251  case LT_CORNER: // left top corner
252  pos = m_LT_Corner + pos;
253  break;
254  }
255 
256  return pos;
257 }
const wxPoint WORKSHEET_DATAITEM::GetStartPosUi ( int  ii = 0) const
inherited

Definition at line 260 of file class_worksheet_dataitem.cpp.

References WORKSHEET_DATAITEM::GetStartPos(), KiROUND(), WORKSHEET_DATAITEM::m_WSunits2Iu, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(), EVT_MENU_RANGE(), moveItem(), PL_EDITOR_FRAME::MoveItem(), and PL_EDITOR_FRAME::UpdateStatusBar().

261 {
262  DPOINT pos = GetStartPos( ii );
263  pos = pos * m_WSunits2Iu;
264  return wxPoint( KiROUND( pos.x ), KiROUND( pos.y ) );
265 }
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
const DPOINT GetStartPos(int ii=0) const
virtual bool WORKSHEET_DATAITEM_TEXT::HasEndPoint ( )
inlineoverridevirtual
Returns
false (no end point)

Reimplemented from WORKSHEET_DATAITEM.

Definition at line 408 of file class_worksheet_dataitem.h.

408 { return false; }
void WORKSHEET_DATAITEM_TEXT::IncrementLabel ( int  aIncr)

Try to build text wihich is an increment of m_TextBase has meaning only if m_TextBase is a basic text (one char) If the basic char is a digit, build a number If the basic char is a letter, use the letter with ascii code aIncr + (basic char ascc code)

Parameters
aIncr= the increment value return the incremented label in m_FullText

Definition at line 477 of file class_worksheet_dataitem.cpp.

References m_FullText, and m_TextBase.

Referenced by WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList().

478 {
479  int last = m_TextBase.Len() -1;
480 
481  wxChar lbchar = m_TextBase[last];
483  m_FullText.RemoveLast();
484 
485  if( lbchar >= '0' && lbchar <= '9' )
486  // A number is expected:
487  m_FullText << (int)( aIncr + lbchar - '0' );
488  else
489  m_FullText << (wxChar) ( aIncr + lbchar );
490 }
bool WORKSHEET_DATAITEM_TEXT::IsBold ( )
inline
Returns
true is a bold font should be selected

Definition at line 462 of file class_worksheet_dataitem.h.

References WORKSHEET_DATAITEM::m_flags, and USE_BOLD.

Referenced by WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(), PROPERTIES_FRAME::CopyPrmsFromItemToPanel(), and SetConstrainedTextSize().

462 { return (m_flags & USE_BOLD) != 0; }
#define USE_BOLD
bool WORKSHEET_DATAITEM::IsInsidePage ( int  ii) const
virtualinherited
Returns
true if the item is inside the rectangle defined by the 4 corners, false otherwise.

Reimplemented in WORKSHEET_DATAITEM_POLYPOLYGON.

Definition at line 307 of file class_worksheet_dataitem.cpp.

References WORKSHEET_DATAITEM::GetEndPos(), WORKSHEET_DATAITEM::GetStartPos(), WORKSHEET_DATAITEM::m_LT_Corner, WORKSHEET_DATAITEM::m_RB_Corner, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList().

308 {
309  DPOINT pos = GetStartPos( ii );
310 
311  for( int kk = 0; kk < 1; kk++ )
312  {
313  if( m_RB_Corner.x < pos.x || m_LT_Corner.x > pos.x )
314  return false;
315 
316  if( m_RB_Corner.y < pos.y || m_LT_Corner.y > pos.y )
317  return false;
318 
319  pos = GetEndPos( ii );
320  }
321 
322  return true;
323 }
const DPOINT GetStartPos(int ii=0) const
const DPOINT GetEndPos(int ii=0) const
bool WORKSHEET_DATAITEM_TEXT::IsItalic ( ) const
inline
Returns
true is an italic font should be selected

Definition at line 480 of file class_worksheet_dataitem.h.

References WORKSHEET_DATAITEM::m_flags, and USE_ITALIC.

Referenced by WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(), PROPERTIES_FRAME::CopyPrmsFromItemToPanel(), and SetConstrainedTextSize().

480 { return (m_flags & USE_ITALIC) != 0; }
#define USE_ITALIC
bool WORKSHEET_DATAITEM::IsSelected ( )
inlineinherited
Returns
true if the selected state on ON

Definition at line 265 of file class_worksheet_dataitem.h.

References SELECTED_STATE.

Referenced by WORKSHEET_DATAITEM::GetItemColor().

265 { return (m_flags & SELECTED_STATE) != 0; }
#define SELECTED_STATE
void WORKSHEET_DATAITEM::MoveEndPointTo ( DPOINT  aPosition)
inherited

move the ending point of the item to a new position has meaning only for items defined by 2 points (segments and rectangles)

move the ending point of the item to a new position has meaning only for items defined by 2 points (segments and rectangles) aPosition = the new position of the ending point, in mm

Parameters
aPosition= the new position of the ending point, in mm

Definition at line 172 of file class_worksheet_dataitem.cpp.

References WORKSHEET_DATAITEM::GetType(), LB_CORNER, LT_CORNER, POINT_COORD::m_Anchor, WORKSHEET_DATAITEM::m_End, WORKSHEET_DATAITEM::m_LT_Corner, POINT_COORD::m_Pos, WORKSHEET_DATAITEM::m_RB_Corner, RB_CORNER, RT_CORNER, WORKSHEET_DATAITEM::WS_RECT, WORKSHEET_DATAITEM::WS_SEGMENT, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by abortMoveItem(), WORKSHEET_DATAITEM::MoveEndPointToUi(), WORKSHEET_DATAITEM::MoveTo(), and PL_EDITOR_FRAME::PlaceItem().

173 {
174  DPOINT position;
175 
176  // Calculate the position of the starting point
177  // relative to the reference corner
178  // aPosition is the position relative to the right top paper corner
179  switch( m_End.m_Anchor )
180  {
181  case RB_CORNER:
182  position = m_RB_Corner - aPosition;
183  break;
184 
185  case RT_CORNER:
186  position.x = m_RB_Corner.x - aPosition.x;
187  position.y = aPosition.y - m_LT_Corner.y;
188  break;
189 
190  case LB_CORNER:
191  position.x = aPosition.x - m_LT_Corner.x;
192  position.y = m_RB_Corner.y - aPosition.y;
193  break;
194 
195  case LT_CORNER:
196  position = aPosition - m_LT_Corner;
197  break;
198  }
199 
200  // Modify m_End only for items having 2 coordinates
201  switch( GetType() )
202  {
203  case WS_SEGMENT:
204  case WS_RECT:
205  m_End.m_Pos = position;
206  break;
207 
208  default:
209  break;
210  }
211 }
WS_ItemType GetType() const
void WORKSHEET_DATAITEM::MoveEndPointToUi ( wxPoint  aPosition)
inherited

move the ending point of the item to a new position has meaning only for items defined by 2 points (segments and rectangles)

Parameters
aPosition= the new position of the ending point in graphic units

Definition at line 219 of file class_worksheet_dataitem.cpp.

References WORKSHEET_DATAITEM::m_WSunits2Iu, WORKSHEET_DATAITEM::MoveEndPointTo(), wxPoint::x, VECTOR2< T >::x, wxPoint::y, and VECTOR2< T >::y.

Referenced by moveItem().

220 {
221  DPOINT pos_mm;
222  pos_mm.x = aPosition.x / m_WSunits2Iu;
223  pos_mm.y = aPosition.y / m_WSunits2Iu;
224 
225  MoveEndPointTo( pos_mm );
226 }
void MoveEndPointTo(DPOINT aPosition)
move the ending point of the item to a new position has meaning only for items defined by 2 points (s...
void WORKSHEET_DATAITEM::MoveStartPointTo ( DPOINT  aPosition)
inherited

move the starting point of the item to a new position

Parameters
aPosition= the new position of the starting point, in mm

Definition at line 121 of file class_worksheet_dataitem.cpp.

References LB_CORNER, LT_CORNER, POINT_COORD::m_Anchor, WORKSHEET_DATAITEM::m_LT_Corner, POINT_COORD::m_Pos, WORKSHEET_DATAITEM::m_Pos, WORKSHEET_DATAITEM::m_RB_Corner, RB_CORNER, RT_CORNER, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by abortMoveItem(), WORKSHEET_DATAITEM::MoveStartPointToUi(), WORKSHEET_DATAITEM::MoveTo(), and PL_EDITOR_FRAME::PlaceItem().

122 {
123  DPOINT position;
124 
125  // Calculate the position of the starting point
126  // relative to the reference corner
127  // aPosition is the position relative to the right top paper corner
128  switch( m_Pos.m_Anchor )
129  {
130  case RB_CORNER:
131  position = m_RB_Corner - aPosition;
132  break;
133 
134  case RT_CORNER:
135  position.x = m_RB_Corner.x - aPosition.x;
136  position.y = aPosition.y - m_LT_Corner.y;
137  break;
138 
139  case LB_CORNER:
140  position.x = aPosition.x - m_LT_Corner.x;
141  position.y = m_RB_Corner.y - aPosition.y;
142  break;
143 
144  case LT_CORNER:
145  position = aPosition - m_LT_Corner;
146  break;
147  }
148 
149  m_Pos.m_Pos = position;
150 }
void WORKSHEET_DATAITEM::MoveStartPointToUi ( wxPoint  aPosition)
inherited

move the starting point of the item to a new position

Parameters
aPosition= the new position of item in graphic units

Definition at line 156 of file class_worksheet_dataitem.cpp.

References WORKSHEET_DATAITEM::m_WSunits2Iu, WORKSHEET_DATAITEM::MoveStartPointTo(), wxPoint::x, VECTOR2< T >::x, wxPoint::y, and VECTOR2< T >::y.

Referenced by moveItem().

157 {
158  DPOINT pos_mm;
159  pos_mm.x = aPosition.x / m_WSunits2Iu;
160  pos_mm.y = aPosition.y / m_WSunits2Iu;
161 
162  MoveStartPointTo( pos_mm );
163 }
void MoveStartPointTo(DPOINT aPosition)
move the starting point of the item to a new position
void WORKSHEET_DATAITEM_TEXT::MoveTo ( DPOINT  aPosition)

move item to a new position

Parameters
aPosition= the new position of item
void WORKSHEET_DATAITEM::MoveToUi ( wxPoint  aPosition)
inherited

move item to a new position

Parameters
aPosition= the new position of the starting point in graphic units

Definition at line 98 of file class_worksheet_dataitem.cpp.

References WORKSHEET_DATAITEM::m_WSunits2Iu, WORKSHEET_DATAITEM::MoveTo(), wxPoint::x, VECTOR2< T >::x, wxPoint::y, and VECTOR2< T >::y.

Referenced by moveItem().

99 {
100  DPOINT pos_mm;
101  pos_mm.x = aPosition.x / m_WSunits2Iu;
102  pos_mm.y = aPosition.y / m_WSunits2Iu;
103 
104  MoveTo( pos_mm );
105 }
void MoveTo(DPOINT aPosition)
move item to a new position
bool WORKSHEET_DATAITEM_TEXT::ReplaceAntiSlashSequence ( )

Replace the '\''n' sequence by EOL and the sequence '\''\' by only one '\' inside m_FullText.

Returns
true if the EOL symbol is found or is inserted (multiline text)

Definition at line 496 of file class_worksheet_dataitem.cpp.

References m_FullText.

Referenced by WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(), and PROPERTIES_FRAME::CopyPrmsFromItemToPanel().

497 {
498  bool multiline = false;
499 
500  for( unsigned ii = 0; ii < m_FullText.Len(); ii++ )
501  {
502  if( m_FullText[ii] == '\n' )
503  multiline = true;
504 
505  else if( m_FullText[ii] == '\\' )
506  {
507  if( ++ii >= m_FullText.Len() )
508  break;
509 
510  if( m_FullText[ii] == '\\' )
511  {
512  // a double \\ sequence is replaced by a single \ char
513  m_FullText.Remove(ii, 1);
514  ii--;
515  }
516  else if( m_FullText[ii] == 'n' )
517  {
518  // Replace the "\n" sequence by a EOL char
519  multiline = true;
520  m_FullText[ii] = '\n';
521  m_FullText.Remove(ii-1, 1);
522  ii--;
523  }
524  }
525  }
526 
527  return multiline;
528 }
void WORKSHEET_DATAITEM_TEXT::SetBold ( bool  aState)
inline

Function SetBold Toggles on/off the bold option flag.

Parameters
aState= the bold option value

Definition at line 469 of file class_worksheet_dataitem.h.

References WORKSHEET_DATAITEM::m_flags, and USE_BOLD.

Referenced by PROPERTIES_FRAME::CopyPrmsFromPanelToItem().

470  {
471  if( aState )
472  m_flags |= USE_BOLD;
473  else
474  m_flags &= ~USE_BOLD;
475  }
#define USE_BOLD
void WORKSHEET_DATAITEM_TEXT::SetConstrainedTextSize ( )

Calculates m_ConstrainedTextSize from m_TextSize to keep the X size and the full Y size of the text smaller than m_BoundingBoxSize if m_BoundingBoxSize.x or m_BoundingBoxSize.y > 0 if m_BoundingBoxSize.x or m_BoundingBoxSize.y == 0 the corresponding text size is not constrained.

Definition at line 531 of file class_worksheet_dataitem.cpp.

References BLACK, dummy(), FSCALE, EDA_RECT::GetHeight(), EDA_TEXT::GetTextBox(), EDA_RECT::GetWidth(), IsBold(), IsItalic(), KiROUND(), m_BoundingBoxSize, m_ConstrainedTextSize, WORKSHEET_DATAITEM::m_DefaultTextSize, m_FullText, m_TextSize, EDA_TEXT::SetMultilineAllowed(), TransfertSetupToGraphicText(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList().

532 {
534 
535  if( m_ConstrainedTextSize.x == 0 )
537 
538  if( m_ConstrainedTextSize.y == 0 )
540 
542  {
543  // to know the X and Y size of the line, we should use
544  // EDA_TEXT::GetTextBox()
545  // but this function uses integers
546  // So, to avoid truncations with our unit in mm, use microns.
547  wxSize size_micron;
548  #define FSCALE 1000.0
549  int linewidth = 0;
550  size_micron.x = KiROUND( m_ConstrainedTextSize.x * FSCALE );
551  size_micron.y = KiROUND( m_ConstrainedTextSize.y * FSCALE );
553  wxPoint(0,0),
554  size_micron,
555  linewidth, BLACK,
556  IsItalic(), IsBold() ) );
557  dummy.SetMultilineAllowed( true );
559 
560  EDA_RECT rect = dummy.GetTextBox();
561  DSIZE size;
562  size.x = rect.GetWidth() / FSCALE;
563  size.y = rect.GetHeight() / FSCALE;
564 
565  if( m_BoundingBoxSize.x && size.x > m_BoundingBoxSize.x )
567 
568  if( m_BoundingBoxSize.y && size.y > m_BoundingBoxSize.y )
570  }
571 }
void TransfertSetupToGraphicText(WS_DRAW_ITEM_TEXT *aGText)
transfert the text justification and orientation to aGText
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
int GetHeight() const
#define FSCALE
static LIB_PART * dummy()
Used when a LIB_PART is not found in library to draw a dummy shape This component is a 400 mils squar...
Class EDA_RECT handles the component boundary box.
int GetWidth() const
Definition: colors.h:45
void WORKSHEET_DATAITEM::SetEnd ( double  aPosx,
double  aPosy,
enum corner_anchor  aAnchor = RB_CORNER 
)
inlineinherited

Definition at line 161 of file class_worksheet_dataitem.h.

References POINT_COORD::m_Anchor, POINT_COORD::m_Pos, VECTOR2< T >::x, and VECTOR2< T >::y.

162  {
163  m_End.m_Pos.x = aPosx;
164  m_End.m_Pos.y = aPosy;
165  m_End.m_Anchor = aAnchor;
166  }
void WORKSHEET_DATAITEM::SetFlags ( int  aMask)
inlineinherited
void WORKSHEET_DATAITEM_TEXT::SetItalic ( bool  aState)
inline

Function SetItalic Toggles on/off the italic option flag.

Parameters
aState= the italic option value

Definition at line 487 of file class_worksheet_dataitem.h.

References WORKSHEET_DATAITEM::m_flags, and USE_ITALIC.

Referenced by PROPERTIES_FRAME::CopyPrmsFromPanelToItem().

488  {
489  if( aState )
490  m_flags |= USE_ITALIC;
491  else
492  m_flags &= ~USE_ITALIC;
493  }
#define USE_ITALIC
void WORKSHEET_DATAITEM::SetPage1Option ( int  aChoice)
inherited

Set the option for page 1.

Parameters
aChoice= 0 if the item has no specific option for page 1

0 if the item is only on page 1

< 0 if the item is not on page 1

Definition at line 364 of file class_worksheet_dataitem.cpp.

References WORKSHEET_DATAITEM::ClearFlags(), PAGE1OPTION, PAGE1OPTION_NOTONPAGE1, PAGE1OPTION_PAGE1ONLY, and WORKSHEET_DATAITEM::SetFlags().

Referenced by PROPERTIES_FRAME::CopyPrmsFromPanelToItem().

365 {
367 
368  if( aChoice > 0 )
370 
371  else if( aChoice < 0 )
373 
374 }
#define PAGE1OPTION_NOTONPAGE1
#define PAGE1OPTION_PAGE1ONLY
#define PAGE1OPTION
void WORKSHEET_DATAITEM::SetSelected ( bool  aState)
inlineinherited

Function SetSelected Toggles on/off the selected flag (used in edition functions.

Parameters
aState= the flag value

Definition at line 272 of file class_worksheet_dataitem.h.

References SELECTED_STATE.

Referenced by PL_EDITOR_FRAME::RedrawActiveWindow().

273  {
274  if( aState )
276  else
278  }
#define SELECTED_STATE
void WORKSHEET_DATAITEM::SetStart ( double  aPosx,
double  aPosy,
enum corner_anchor  aAnchor = RB_CORNER 
)
inlineinherited

Definition at line 154 of file class_worksheet_dataitem.h.

References POINT_COORD::m_Anchor, POINT_COORD::m_Pos, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PL_EDITOR_FRAME::UpdateStatusBar().

155  {
156  m_Pos.m_Pos.x = aPosx;
157  m_Pos.m_Pos.y = aPosy;
158  m_Pos.m_Anchor = aAnchor;
159  }
void WORKSHEET_DATAITEM_TEXT::TransfertSetupToGraphicText ( WS_DRAW_ITEM_TEXT aGText)

transfert the text justification and orientation to aGText

Definition at line 469 of file class_worksheet_dataitem.cpp.

References m_Hjustify, m_Orient, m_Vjustify, EDA_TEXT::SetHorizJustify(), WS_DRAW_ITEM_TEXT::SetTextAngle(), and EDA_TEXT::SetVertJustify().

Referenced by WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(), and SetConstrainedTextSize().

470 {
471  aGText->SetHorizJustify( m_Hjustify ) ;
472  aGText->SetVertJustify( m_Vjustify );
473  aGText->SetTextAngle( m_Orient * 10 ); // graphic text orient unit = 0.1 degree
474 }
void SetVertJustify(EDA_TEXT_VJUSTIFY_T aType)
Definition: eda_text.h:194
void SetTextAngle(double aAngle)
void SetHorizJustify(EDA_TEXT_HJUSTIFY_T aType)
Definition: eda_text.h:193
bool WORKSHEET_DATAITEM::UseAltColor ( )
inlineinherited

Definition at line 280 of file class_worksheet_dataitem.h.

References USE_ALT_COLOR.

Referenced by WORKSHEET_DATAITEM::GetItemColor().

Member Data Documentation

COLOR4D WORKSHEET_DATAITEM::m_AltColor = COLOR4D( RED )
staticinherited
DSIZE WORKSHEET_DATAITEM_TEXT::m_BoundingBoxSize
COLOR4D WORKSHEET_DATAITEM::m_Color = COLOR4D( RED )
staticinherited
DSIZE WORKSHEET_DATAITEM_TEXT::m_ConstrainedTextSize
wxString WORKSHEET_DATAITEM::m_Info
inherited
wxString WORKSHEET_DATAITEM::m_Name
inherited
COLOR4D WORKSHEET_DATAITEM::m_SelectedColor = COLOR4D( BROWN )
staticinherited
WS_ItemType WORKSHEET_DATAITEM::m_type
protectedinherited

The documentation for this class was generated from the following files: