KiCad PCB EDA Suite
base_struct.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, jaen-pierre.charras@gipsa-lab.inpg.com
5  * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
30 #include <fctsys.h>
31 #include <trigo.h>
32 #include <common.h>
33 #include <macros.h>
34 #include <kicad_string.h>
35 #include <wxstruct.h>
36 #include <class_drawpanel.h>
37 #include <class_base_screen.h>
38 #include <bitmaps.h>
39 
40 #include "../eeschema/dialogs/dialog_schematic_find.h"
41 
42 
43 static const unsigned char dummy_png[] = {
44  0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
45  0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff,
46  0x61, 0x00, 0x00, 0x00, 0x5f, 0x49, 0x44, 0x41, 0x54, 0x38, 0xcb, 0x63, 0xf8, 0xff, 0xff, 0x3f,
47  0x03, 0x25, 0x98, 0x61, 0x68, 0x1a, 0x00, 0x04, 0x46, 0x40, 0xfc, 0x02, 0x88, 0x45, 0x41, 0x1c,
48  0x76, 0x20, 0xfe, 0x01, 0xc4, 0xbe, 0x24, 0x18, 0x60, 0x01, 0xc4, 0x20, 0x86, 0x04, 0x88, 0xc3,
49  0x01, 0xe5, 0x04, 0x0c, 0xb8, 0x01, 0x37, 0x81, 0xf8, 0x04, 0x91, 0xf8, 0x0a, 0x54, 0x8f, 0x06,
50  0xb2, 0x01, 0x9b, 0x81, 0x78, 0x02, 0x91, 0x78, 0x05, 0x54, 0x8f, 0xca, 0xe0, 0x08, 0x03, 0x36,
51  0xa8, 0xbf, 0xec, 0xc8, 0x32, 0x80, 0xcc, 0x84, 0x04, 0x0a, 0xbc, 0x1d, 0x40, 0x2c, 0xc8, 0x30,
52  0xf4, 0x33, 0x13, 0x00, 0x6b, 0x1a, 0x46, 0x7b, 0x68, 0xe7, 0x0f, 0x0b, 0x00, 0x00, 0x00, 0x00,
53  0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
54 };
55 
56 static const BITMAP_OPAQUE dummy_xpm[1] = {{ dummy_png, sizeof( dummy_png ), "dummy_xpm" }};
57 
58 const wxString traceFindReplace( wxT( "KicadFindReplace" ) );
59 
60 
61 enum textbox {
63 };
64 
65 
67 {
68  initVars();
69  m_StructType = idType;
70  m_Parent = parent;
71 }
72 
73 
75 {
76  initVars();
77  m_StructType = idType;
78 }
79 
80 
82 {
83  initVars();
84  *this = base;
85 }
86 
87 
89 {
91  Pnext = NULL; // Linked list: Link (next struct)
92  Pback = NULL; // Linked list: Link (previous struct)
93  m_Parent = NULL; // Linked list: Link (parent struct)
94  m_List = NULL; // I am not on any list yet
95  m_Flags = 0; // flags for editions and other
96  SetTimeStamp( 0 ); // Time stamp used for logical links
97  m_Status = 0;
98  m_forceVisible = false; // true to override the visibility setting of the item.
99 }
100 
101 
103 {
104  SetFlags( IS_CHANGED );
105 
106  // If this a child object, then the parent modification state also needs to be set.
107  if( m_Parent )
109 }
110 
111 
113 {
114 #if defined(DEBUG)
115  printf( "Missing GetBoundingBox()\n" );
116  Show( 0, std::cout ); // tell me which classes still need GetBoundingBox support
117 #endif
118 
119  // return a zero-sized box per default. derived classes should override
120  // this
121  return EDA_RECT( wxPoint( 0, 0 ), wxSize( 0, 0 ) );
122 }
123 
124 
126 {
127  wxCHECK_MSG( false, NULL, wxT( "Clone not implemented in derived class " ) + GetClass() +
128  wxT( ". Bad programmer!" ) );
129 }
130 
131 
133  INSPECTOR inspector,
134  void* testData,
135  const KICAD_T scanTypes[] )
136 {
137  EDA_ITEM* p = listStart;
138 
139  for( ; p; p = p->Pnext )
140  {
141  if( SEARCH_QUIT == p->Visit( inspector, testData, scanTypes ) )
142  return SEARCH_QUIT;
143  }
144 
145  return SEARCH_CONTINUE;
146 }
147 
148 
149 // see base_struct.h
150 // many classes inherit this method, be careful:
151 SEARCH_RESULT EDA_ITEM::Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] )
152 {
153  KICAD_T stype;
154 
155 #if 0 && defined(DEBUG)
156  std::cout << GetClass().mb_str() << ' ';
157 #endif
158 
159  for( const KICAD_T* p = scanTypes; (stype = *p) != EOT; ++p )
160  {
161  // If caller wants to inspect my type
162  if( stype == Type() )
163  {
164  if( SEARCH_QUIT == inspector( this, testData ) )
165  return SEARCH_QUIT;
166 
167  break;
168  }
169  }
170 
171  return SEARCH_CONTINUE;
172 }
173 
174 
176 {
177  wxFAIL_MSG( wxT( "GetSelectMenuText() was not overridden for schematic item type " ) +
178  GetClass() );
179 
180  return wxString( wxT( "Undefined menu text for " ) + GetClass() );
181 }
182 
183 
184 bool EDA_ITEM::Matches( const wxString& aText, wxFindReplaceData& aSearchData )
185 {
186  wxString text = aText;
187  wxString searchText = aSearchData.GetFindString();
188 
189  // Don't match if searching for replaceable item and the item doesn't support text replace.
190  if( (aSearchData.GetFlags() & FR_SEARCH_REPLACE) && !IsReplaceable() )
191  return false;
192 
193  if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
194  return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );
195 
196  if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
197  {
198  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
199  return text.Matches( searchText );
200 
201  return text.MakeUpper().Matches( searchText.MakeUpper() );
202  }
203 
204  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
205  return aText.Find( searchText ) != wxNOT_FOUND;
206 
207  return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
208 }
209 
210 
211 bool EDA_ITEM::Replace( wxFindReplaceData& aSearchData, wxString& aText )
212 {
213  wxCHECK_MSG( IsReplaceable(), false,
214  wxT( "Attempt to replace text in <" ) + GetClass() + wxT( "> item." ) );
215 
216  wxString searchString = (aSearchData.GetFlags() & wxFR_MATCHCASE) ? aText : aText.Upper();
217 
218  int result = searchString.Find( (aSearchData.GetFlags() & wxFR_MATCHCASE) ?
219  aSearchData.GetFindString() :
220  aSearchData.GetFindString().Upper() );
221 
222  if( result == wxNOT_FOUND )
223  return false;
224 
225  wxString prefix = aText.Left( result );
226  wxString suffix;
227 
228  if( aSearchData.GetFindString().length() + result < aText.length() )
229  suffix = aText.Right( aText.length() - ( aSearchData.GetFindString().length() + result ) );
230 
231  wxLogTrace( traceFindReplace, wxT( "Replacing '%s', prefix '%s', replace '%s', suffix '%s'." ),
232  GetChars( aText ), GetChars( prefix ), GetChars( aSearchData.GetReplaceString() ),
233  GetChars( suffix ) );
234 
235  aText = prefix + aSearchData.GetReplaceString() + suffix;
236 
237  return true;
238 }
239 
240 
241 bool EDA_ITEM::operator<( const EDA_ITEM& aItem ) const
242 {
243  wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
244  GetChars( GetClass() ) ) );
245 
246  return false;
247 }
248 
250 {
251  // do not call initVars()
252 
253  m_StructType = aItem.m_StructType;
254  m_Flags = aItem.m_Flags;
255  m_Status = aItem.m_Status;
256  m_Parent = aItem.m_Parent;
258 
259  // A copy of an item cannot have the same time stamp as the original item.
261 
262  // do not copy list related fields (Pnext, Pback, m_List)
263 
264  return *this;
265 }
266 
268 {
269  // Basic fallback
270  return BOX2I( VECTOR2I( GetBoundingBox().GetOrigin() ),
271  VECTOR2I( GetBoundingBox().GetSize() ) );
272 }
273 
274 
275 void EDA_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const
276 {
277  // Basic fallback
278  aCount = 1;
279  aLayers[0] = 0;
280 }
281 
283 {
284  return dummy_xpm;
285 }
286 
287 #if defined(DEBUG)
288 
289 // A function that should have been in wxWidgets
290 std::ostream& operator<<( std::ostream& out, const wxSize& size )
291 {
292  out << " width=\"" << size.GetWidth() << "\" height=\"" << size.GetHeight() << "\"";
293  return out;
294 }
295 
296 
297 // A function that should have been in wxWidgets
298 std::ostream& operator<<( std::ostream& out, const wxPoint& pt )
299 {
300  out << " x=\"" << pt.x << "\" y=\"" << pt.y << "\"";
301  return out;
302 }
303 
304 
305 void EDA_ITEM::ShowDummy( std::ostream& os ) const
306 {
307  // XML output:
308  wxString s = GetClass();
309 
310  os << '<' << s.Lower().mb_str() << ">"
311  << " Need ::Show() override for this class "
312  << "</" << s.Lower().mb_str() << ">\n";
313 }
314 
315 
316 std::ostream& EDA_ITEM::NestedSpace( int nestLevel, std::ostream& os )
317 {
318  for( int i = 0; i<nestLevel; ++i )
319  os << " ";
320 
321  // number of spaces here controls indent per nest level
322 
323  return os;
324 }
325 
326 #endif
327 
328 
329 /******************/
330 /* Class EDA_RECT */
331 /******************/
332 
334 {
335  if( m_Size.y < 0 )
336  {
337  m_Size.y = -m_Size.y;
338  m_Pos.y -= m_Size.y;
339  }
340 
341  if( m_Size.x < 0 )
342  {
343  m_Size.x = -m_Size.x;
344  m_Pos.x -= m_Size.x;
345  }
346 }
347 
348 
349 void EDA_RECT::Move( const wxPoint& aMoveVector )
350 {
351  m_Pos += aMoveVector;
352 }
353 
354 
355 bool EDA_RECT::Contains( const wxPoint& aPoint ) const
356 {
357  wxPoint rel_pos = aPoint - m_Pos;
358  wxSize size = m_Size;
359 
360  if( size.x < 0 )
361  {
362  size.x = -size.x;
363  rel_pos.x += size.x;
364  }
365 
366  if( size.y < 0 )
367  {
368  size.y = -size.y;
369  rel_pos.y += size.y;
370  }
371 
372  return (rel_pos.x >= 0) && (rel_pos.y >= 0) && ( rel_pos.y <= size.y) && ( rel_pos.x <= size.x);
373 }
374 
375 
376 /*
377  * return true if aRect is inside me (or on boundaries)
378  */
379 bool EDA_RECT::Contains( const EDA_RECT& aRect ) const
380 {
381  return Contains( aRect.GetOrigin() ) && Contains( aRect.GetEnd() );
382 }
383 
384 
385 /* Intersects
386  * test for a common area between segment and rect.
387  * return true if at least a common point is found
388  */
389 bool EDA_RECT::Intersects( const wxPoint& aPoint1, const wxPoint& aPoint2 ) const
390 {
391  wxPoint point2, point4;
392 
393  if( Contains( aPoint1 ) || Contains( aPoint2 ) )
394  return true;
395 
396  point2.x = GetEnd().x;
397  point2.y = GetOrigin().y;
398  point4.x = GetOrigin().x;
399  point4.y = GetEnd().y;
400 
401  //Only need to test 3 sides since a straight line cant enter and exit on same side
402  if( SegmentIntersectsSegment( aPoint1, aPoint2, GetOrigin() , point2 ) )
403  return true;
404 
405  if( SegmentIntersectsSegment( aPoint1, aPoint2, point2 , GetEnd() ) )
406  return true;
407 
408  if( SegmentIntersectsSegment( aPoint1, aPoint2, GetEnd() , point4 ) )
409  return true;
410 
411  return false;
412 }
413 
414 
415 /* Intersects
416  * test for a common area between 2 rect.
417  * return true if at least a common point is found
418  */
419 bool EDA_RECT::Intersects( const EDA_RECT& aRect ) const
420 {
421  // this logic taken from wxWidgets' geometry.cpp file:
422  bool rc;
423  EDA_RECT me(*this);
424  EDA_RECT rect(aRect);
425  me.Normalize(); // ensure size is >= 0
426  rect.Normalize(); // ensure size is >= 0
427 
428  // calculate the left common area coordinate:
429  int left = std::max( me.m_Pos.x, rect.m_Pos.x );
430  // calculate the right common area coordinate:
431  int right = std::min( me.m_Pos.x + me.m_Size.x, rect.m_Pos.x + rect.m_Size.x );
432  // calculate the upper common area coordinate:
433  int top = std::max( me.m_Pos.y, aRect.m_Pos.y );
434  // calculate the lower common area coordinate:
435  int bottom = std::min( me.m_Pos.y + me.m_Size.y, rect.m_Pos.y + rect.m_Size.y );
436 
437  // if a common area exists, it must have a positive (null accepted) size
438  if( left <= right && top <= bottom )
439  rc = true;
440  else
441  rc = false;
442 
443  return rc;
444 }
445 
446 
448 {
449  Inflate( aDelta, aDelta );
450  return *this;
451 }
452 
453 
454 EDA_RECT& EDA_RECT::Inflate( wxCoord dx, wxCoord dy )
455 {
456  if( m_Size.x >= 0 )
457  {
458  if( m_Size.x < -2 * dx )
459  {
460  // Don't allow deflate to eat more width than we have,
461  m_Pos.x += m_Size.x / 2;
462  m_Size.x = 0;
463  }
464  else
465  {
466  // The inflate is valid.
467  m_Pos.x -= dx;
468  m_Size.x += 2 * dx;
469  }
470  }
471  else // size.x < 0:
472  {
473  if( m_Size.x > -2 * dx )
474  {
475  // Don't allow deflate to eat more width than we have,
476  m_Pos.x -= m_Size.x / 2;
477  m_Size.x = 0;
478  }
479  else
480  {
481  // The inflate is valid.
482  m_Pos.x += dx;
483  m_Size.x -= 2 * dx; // m_Size.x <0: inflate when dx > 0
484  }
485  }
486 
487  if( m_Size.y >= 0 )
488  {
489  if( m_Size.y < -2 * dy )
490  {
491  // Don't allow deflate to eat more height than we have,
492  m_Pos.y += m_Size.y / 2;
493  m_Size.y = 0;
494  }
495  else
496  {
497  // The inflate is valid.
498  m_Pos.y -= dy;
499  m_Size.y += 2 * dy;
500  }
501  }
502  else // size.y < 0:
503  {
504  if( m_Size.y > 2 * dy )
505  {
506  // Don't allow deflate to eat more height than we have,
507  m_Pos.y -= m_Size.y / 2;
508  m_Size.y = 0;
509  }
510  else
511  {
512  // The inflate is valid.
513  m_Pos.y += dy;
514  m_Size.y -= 2 * dy; // m_Size.y <0: inflate when dy > 0
515  }
516  }
517 
518  return *this;
519 }
520 
521 
522 void EDA_RECT::Merge( const EDA_RECT& aRect )
523 {
524  Normalize(); // ensure width and height >= 0
525  EDA_RECT rect = aRect;
526  rect.Normalize(); // ensure width and height >= 0
527  wxPoint end = GetEnd();
528  wxPoint rect_end = rect.GetEnd();
529 
530  // Change origin and size in order to contain the given rect
531  m_Pos.x = std::min( m_Pos.x, rect.m_Pos.x );
532  m_Pos.y = std::min( m_Pos.y, rect.m_Pos.y );
533  end.x = std::max( end.x, rect_end.x );
534  end.y = std::max( end.y, rect_end.y );
535  SetEnd( end );
536 }
537 
538 
539 void EDA_RECT::Merge( const wxPoint& aPoint )
540 {
541  Normalize(); // ensure width and height >= 0
542 
543  wxPoint end = GetEnd();
544  // Change origin and size in order to contain the given rect
545  m_Pos.x = std::min( m_Pos.x, aPoint.x );
546  m_Pos.y = std::min( m_Pos.y, aPoint.y );
547  end.x = std::max( end.x, aPoint.x );
548  end.y = std::max( end.y, aPoint.y );
549  SetEnd( end );
550 }
551 
552 
553 double EDA_RECT::GetArea() const
554 {
555  return (double) GetWidth() * (double) GetHeight();
556 }
557 
558 
559 EDA_RECT EDA_RECT::Common( const EDA_RECT& aRect ) const
560 {
561  EDA_RECT r;
562 
563  if( Intersects( aRect ) )
564  {
565  wxPoint originA( std::min( GetOrigin().x, GetEnd().x ),
566  std::min( GetOrigin().y, GetEnd().y ) );
567  wxPoint originB( std::min( aRect.GetOrigin().x, aRect.GetEnd().x ),
568  std::min( aRect.GetOrigin().y, aRect.GetEnd().y ) );
569  wxPoint endA( std::max( GetOrigin().x, GetEnd().x ),
570  std::max( GetOrigin().y, GetEnd().y ) );
571  wxPoint endB( std::max( aRect.GetOrigin().x, aRect.GetEnd().x ),
572  std::max( aRect.GetOrigin().y, aRect.GetEnd().y ) );
573 
574  r.SetOrigin( wxPoint( std::max( originA.x, originB.x ), std::max( originA.y, originB.y ) ) );
575  r.SetEnd ( wxPoint( std::min( endA.x, endB.x ), std::min( endA.y, endB.y ) ) );
576  }
577 
578  return r;
579 }
580 
581 
582 /* Calculate the bounding box of this, when rotated
583  */
584 const EDA_RECT EDA_RECT::GetBoundingBoxRotated( wxPoint aRotCenter, double aAngle )
585 {
586  wxPoint corners[4];
587 
588  // Build the corners list
589  corners[0] = GetOrigin();
590  corners[2] = GetEnd();
591  corners[1].x = corners[0].x;
592  corners[1].y = corners[2].y;
593  corners[3].x = corners[2].x;
594  corners[3].y = corners[0].y;
595 
596  // Rotate all corners, to find the bounding box
597  for( int ii = 0; ii < 4; ii ++ )
598  RotatePoint( &corners[ii], aRotCenter, aAngle );
599 
600  // Find the corners bounding box
601  wxPoint start = corners[0];
602  wxPoint end = corners[0];
603 
604  for( int ii = 1; ii < 4; ii ++ )
605  {
606  start.x = std::min( start.x, corners[ii].x);
607  start.y = std::min( start.y, corners[ii].y);
608  end.x = std::max( end.x, corners[ii].x);
609  end.y = std::max( end.y, corners[ii].y);
610  }
611 
612  EDA_RECT bbox;
613  bbox.SetOrigin( start );
614  bbox.SetEnd( end );
615 
616  return bbox;
617 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
virtual bool IsReplaceable() const
Function IsReplaceable.
Definition: base_struct.h:444
long y
Definition: auxiliary.h:25
void SetModified()
const wxString traceFindReplace(wxT("KicadFindReplace"))
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
Function Visit may be re-implemented for each derived class in order to handle all the types given by...
virtual const EDA_RECT GetBoundingBox() const
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
static SEARCH_RESULT IterateForward(EDA_ITEM *listStart, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
Function IterateForward walks through the object tree calling the inspector() on each object type req...
EDA_ITEM * Pback
previous in linked list
Definition: base_struct.h:165
BOX2< VECTOR2I > BOX2I
Definition: box2.h:468
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:168
void Move(const wxPoint &aMoveVector)
Function Move moves the rectangle by the aMoveVector.
void Merge(const EDA_RECT &aRect)
Function Merge modifies the position and size of the rectangle in order to contain aRect...
PNG memory record (file in memory).
Definition: bitmap_types.h:38
bool operator<(const EDA_ITEM &aItem) const
Test if another item is less than this object.
KICAD_T m_StructType
Run time identification, keep private so it can never be changed after a constructor sets it...
Definition: base_struct.h:160
bool Replace(wxFindReplaceData &aSearchData, wxString &aText)
Helper function used in search and replace dialog Function Replace performs a text replace on aText u...
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
bool Contains(const wxPoint &aPoint) const
Function Contains.
virtual bool Matches(wxFindReplaceData &aSearchData, void *aAuxData, wxPoint *aFindLocation)
Function Matches compares the item against the search criteria in aSearchData.
Definition: base_struct.h:400
EDA_RECT Common(const EDA_RECT &aRect) const
Function Common returns the area that is common with another rectangle.
time_t GetNewTimeStamp()
Definition: common.cpp:166
int GetHeight() const
void SetOrigin(const wxPoint &pos)
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:317
VECTOR2< int > VECTOR2I
Definition: vector2d.h:590
virtual wxString GetSelectMenuText() const
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
search types array terminator (End Of Types)
Definition: typeinfo.h:94
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:90
void SetTimeStamp(time_t aNewTimeStamp)
Definition: base_struct.h:203
This file contains miscellaneous commonly used macros and functions.
const INSPECTOR_FUNC & INSPECTOR
Definition: base_struct.h:104
const wxPoint & GetOrigin() const
#define IS_CHANGED
std::function passed to nested users by ref, avoids copying std::function
Definition: base_struct.h:109
wxSize m_Size
double GetArea() const
Function GetArea returns the area of the rectangle.
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:253
bool SegmentIntersectsSegment(const wxPoint &a_p1_l1, const wxPoint &a_p2_l1, const wxPoint &a_p1_l2, const wxPoint &a_p2_l2)
Function SegmentIntersectsSegment.
Definition: trigo.cpp:58
long x
Definition: auxiliary.h:24
virtual void ViewGetLayers(int aLayers[], int &aCount) const override
Base window classes and related definitions.
void SetEnd(int x, int y)
STATUS_FLAGS m_Status
Definition: base_struct.h:161
const EDA_RECT GetBoundingBoxRotated(wxPoint aRotCenter, double aAngle)
Function GetBoundingBoxRotated.
Perform search using simple wild card matching (* & ?).
EDA_ITEM & operator=(const EDA_ITEM &aItem)
Operator assignment is used to assign the members of aItem to another object.
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType)
Definition: base_struct.cpp:66
const wxPoint GetEnd() const
void Normalize()
Function Normalize ensures that the height ant width are positive.
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
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
virtual wxString GetClass() const =0
Function GetClass returns the class name.
BASE_SCREEN class implementation.
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
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:175
Perform a search for a item that has replaceable text.
Class EDA_RECT handles the component boundary box.
wxPoint m_Pos
static const BITMAP_OPAQUE dummy_xpm[1]
Definition: base_struct.cpp:56
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:151
The common library.
int GetWidth() const
static const unsigned char dummy_png[]
Definition: base_struct.cpp:43
SEARCH_RESULT
Definition: base_struct.h:68
virtual const BOX2I ViewBBox() const override
bool m_forceVisible
Set to true to override the visibility setting of the item.
Definition: base_struct.h:172
void initVars()
Definition: base_struct.cpp:88
DHEAD * m_List
which DLIST I am on.
Definition: base_struct.h:166
EDA_ITEM * Pnext
next in linked list
Definition: base_struct.h:164
virtual BITMAP_DEF GetMenuImage() const
Function GetMenuImage returns a pointer to an image to be used in menus.
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
wxString & operator<<(wxString &aString, const wxPoint &aPos)
Operator << overload outputs a point to the argument string in a format resembling "@ (x...
Definition: base_units.cpp:395
#define min(a, b)
Definition: auxiliary.h:85
textbox
Definition: base_struct.cpp:61