KiCad PCB EDA Suite
bus-wire-junction.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) 2004 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.fr
5  * Copyright (C) 2004-2016 KiCad Developers, see change_log.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 <gr_basic.h>
32 #include <class_drawpanel.h>
33 #include <schframe.h>
34 
35 #include <lib_draw_item.h>
36 #include <lib_pin.h>
37 #include <general.h>
38 #include <sch_bus_entry.h>
39 #include <sch_junction.h>
40 #include <sch_line.h>
41 #include <sch_no_connect.h>
42 #include <sch_text.h>
43 #include <sch_component.h>
44 #include <sch_sheet.h>
45 
46 
47 static void AbortCreateNewLine( EDA_DRAW_PANEL* aPanel, wxDC* aDC );
48 static void ComputeBreakPoint( SCH_LINE* segment, const wxPoint& new_pos );
49 
50 static DLIST< SCH_ITEM > s_wires; // when creating a new set of wires,
51  // stores here the new wires.
52 
53 
67 static void RemoveBacktracks( DLIST<SCH_ITEM>& aWires )
68 {
69  EDA_ITEM* first = aWires.GetFirst();
70  std::vector<SCH_LINE*> last_lines;
71 
72  for( EDA_ITEM* p = first; p; )
73  {
74  SCH_LINE *line = static_cast<SCH_LINE*>( p );
75  p = line->Next();
76 
77  if( !last_lines.empty() )
78  {
79  SCH_LINE* last_line = last_lines[last_lines.size() - 1];
80  bool contiguous = ( last_line->GetEndPoint() == line->GetStartPoint() );
81  bool backtracks = IsPointOnSegment( last_line->GetStartPoint(),
82  last_line->GetEndPoint(), line->GetEndPoint() );
83  bool total_backtrack = ( last_line->GetStartPoint() == line->GetEndPoint() );
84 
85  if( contiguous && backtracks )
86  {
87  if( total_backtrack )
88  {
89  delete s_wires.Remove( last_line );
90  delete s_wires.Remove( line );
91  last_lines.pop_back();
92  }
93  else
94  {
95  last_line->SetEndPoint( line->GetEndPoint() );
96  delete s_wires.Remove( line );
97  }
98  }
99  else
100  {
101  last_lines.push_back( line );
102  }
103  }
104  else
105  {
106  last_lines.push_back( line );
107  }
108  }
109 }
110 
111 
115 static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
116  bool aErase )
117 {
118  SCH_LINE* segment;
119 
120  if( s_wires.GetCount() == 0 )
121  return;
122 
123  segment = (SCH_LINE*) s_wires.begin();
124  COLOR4D color = GetLayerColor( segment->GetLayer() );
125 
126  if( aErase )
127  {
128  while( segment )
129  {
130  if( !segment->IsNull() ) // Redraw if segment length != 0
131  segment->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, color );
132 
133  segment = segment->Next();
134  }
135  }
136 
137  SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) aPanel->GetParent();
138 
139  wxPoint endpos = frame->GetCrossHairPosition();
140 
141  if( frame->GetForceHVLines() ) /* Coerce the line to vertical or horizontal one: */
142  ComputeBreakPoint( (SCH_LINE*) s_wires.GetLast()->Back(), endpos );
143  else
144  ( (SCH_LINE*) s_wires.GetLast() )->SetEndPoint( endpos );
145 
146  segment = (SCH_LINE*) s_wires.begin();
147 
148  while( segment )
149  {
150  if( !segment->IsNull() ) // Redraw if segment length != 0
151  segment->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, color );
152 
153  segment = segment->Next();
154  }
155 }
156 
157 
158 void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
159 {
160  SCH_LINE* segment;
161  SCH_LINE* nextSegment;
162  wxPoint cursorpos = GetCrossHairPosition();
163 
164  // We should know if a segment is currently in progress
165  segment = (SCH_LINE*) GetScreen()->GetCurItem();
166  if( segment ) // a current item exists, but not necessary a currently edited item
167  {
168  if( !segment->GetFlags() || ( segment->Type() != SCH_LINE_T ) )
169  {
170  if( segment->GetFlags() )
171  {
172  wxLogDebug( wxT( "BeginSegment: item->GetFlags()== %X" ),
173  segment->GetFlags() );
174  }
175  // no wire, bus or graphic line in progress
176  segment = NULL;
177  }
178  }
179 
180  if( !segment ) // first point : Create the first wire or bus segment
181  {
182  switch( type )
183  {
184  default:
185  segment = new SCH_LINE( cursorpos, LAYER_NOTES );
186  break;
187 
188  case LAYER_WIRE:
189  segment = new SCH_LINE( cursorpos, LAYER_WIRE );
190 
191  /* A junction will be created later, when we'll know the
192  * segment end position, and if the junction is really needed */
193  break;
194 
195  case LAYER_BUS:
196  segment = new SCH_LINE( cursorpos, LAYER_BUS );
197  break;
198  }
199 
200  segment->SetFlags( IS_NEW );
201  s_wires.PushBack( segment );
202  GetScreen()->SetCurItem( segment );
203 
204  // We need 2 segments to go from a given start pin to an end point when the horizontal
205  // and vertical lines only switch is on.
206  if( GetForceHVLines() )
207  {
208  nextSegment = new SCH_LINE( *segment );
209  nextSegment->SetFlags( IS_NEW );
210  s_wires.PushBack( nextSegment );
211  GetScreen()->SetCurItem( nextSegment );
212  }
213 
215  SetRepeatItem( NULL );
216  }
217  else // A segment is in progress: terminates the current segment and add a new segment.
218  {
219  SCH_LINE* prevSegment = segment->Back();
220 
221  // Be aware prevSegment can be null when the horizontal and vertical lines only switch is off
222  // when we create the first segment.
223 
224  if( !GetForceHVLines() )
225  {
226  // If only one segment is needed and it has a zero length, do not create a new one.
227  if( segment->IsNull() )
228  return;
229  }
230  else
231  {
232  wxCHECK_RET( prevSegment != NULL, wxT( "Failed to create second line segment." ) );
233 
234  // If two segments are required and they both have zero length, do not
235  // create a new one.
236  if( prevSegment && prevSegment->IsNull() && segment->IsNull() )
237  return;
238  }
239 
240  m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
241 
242  // Terminate the command if the end point is on a pin, junction, or another wire or bus.
243  if( GetScreen()->IsTerminalPoint( cursorpos, segment->GetLayer() ) )
244  {
245  EndSegment( DC );
246  return;
247  }
248 
249  // Create a new segment, and chain it after the current new segment.
250  nextSegment = new SCH_LINE( *segment );
251  nextSegment->SetStartPoint( cursorpos );
252  s_wires.PushBack( nextSegment );
253 
254  segment->SetEndPoint( cursorpos );
255  segment->ClearFlags( IS_NEW );
256  segment->SetFlags( SELECTED );
257  nextSegment->SetFlags( IS_NEW );
258  GetScreen()->SetCurItem( nextSegment );
259  m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
260  }
261 }
262 
263 
265 {
266  SCH_SCREEN* screen = GetScreen();
267  SCH_LINE* segment = (SCH_LINE*) screen->GetCurItem();
268 
269  if( segment == NULL || segment->Type() != SCH_LINE_T || !segment->IsNew() )
270  return;
271 
272  // Delete zero length segments and clear item flags.
273  SCH_ITEM* item = s_wires.begin();
274 
275  while( item )
276  {
277  item->ClearFlags();
278 
279  wxCHECK_RET( item->Type() == SCH_LINE_T, wxT( "Unexpected object type in wire list." ) );
280 
281  segment = (SCH_LINE*) item;
282  item = item->Next();
283 
284  if( segment->IsNull() )
285  delete s_wires.Remove( segment );
286  }
287 
288  if( s_wires.GetCount() == 0 )
289  return;
290 
291  // Get the last non-null wire (this is the last created segment).
292  SetRepeatItem( segment = (SCH_LINE*) s_wires.GetLast() );
293 
294  screen->SetCurItem( NULL );
295  m_canvas->EndMouseCapture( -1, -1, wxEmptyString, false );
296 
297  // store the terminal point of this last segment: a junction could be needed
298  // (the last wire could be merged/deleted/modified, and lost)
299  wxPoint endpoint = segment->GetEndPoint();
300 
301  // store the starting point of this first segment: a junction could be needed
302  SCH_LINE* firstsegment = (SCH_LINE*) s_wires.GetFirst();
303  wxPoint startPoint = firstsegment->GetStartPoint();
304 
305  // Save the old wires for the undo command
306  DLIST< SCH_ITEM > oldWires; // stores here the old wires
307  GetScreen()->ExtractWires( oldWires, true ); // Save them in oldWires list
308  // Put the snap shot of the previous wire, buses, and junctions in the undo/redo list.
309  PICKED_ITEMS_LIST oldItems;
310  oldItems.m_Status = UR_WIRE_IMAGE;
311 
312  while( oldWires.GetCount() != 0 )
313  {
314  ITEM_PICKER picker = ITEM_PICKER( oldWires.PopFront(), UR_WIRE_IMAGE );
315  oldItems.PushItem( picker );
316  }
317 
318  SaveCopyInUndoList( oldItems, UR_WIRE_IMAGE );
319 
320  // Remove segments backtracking over others
321  RemoveBacktracks( s_wires );
322 
323  // Add the new wires
324  screen->Append( s_wires );
325 
326  // Correct and remove segments that need to be merged.
327  screen->SchematicCleanUp();
328 
329  // A junction could be needed to connect the end point of the last created segment.
330  if( screen->IsJunctionNeeded( endpoint ) )
331  screen->Append( AddJunction( DC, endpoint ) );
332 
333  // A junction could be needed to connect the start point of the set of new created wires
334  if( screen->IsJunctionNeeded( startPoint ) )
335  screen->Append( AddJunction( DC, startPoint ) );
336 
337  m_canvas->Refresh();
338 
339  OnModify();
340 }
341 
342 
353 static void ComputeBreakPoint( SCH_LINE* aSegment, const wxPoint& aPosition )
354 {
355  wxCHECK_RET( aSegment != NULL, wxT( "Cannot compute break point of NULL line segment." ) );
356 
357  SCH_LINE* nextSegment = aSegment->Next();
358  wxPoint midPoint = aPosition;
359 
360  wxCHECK_RET( nextSegment != NULL,
361  wxT( "Cannot compute break point of NULL second line segment." ) );
362 
363 #if 0
364  if( ABS( midPoint.x - aSegment->GetStartPoint().x ) <
365  ABS( midPoint.y - aSegment->GetStartPoint().y ) )
366  midPoint.x = aSegment->GetStartPoint().x;
367  else
368  midPoint.y = aSegment->GetStartPoint().y;
369 #else
370  int iDx = aSegment->GetEndPoint().x - aSegment->GetStartPoint().x;
371  int iDy = aSegment->GetEndPoint().y - aSegment->GetStartPoint().y;
372 
373  if( iDy != 0 ) // keep the first segment orientation (currently horizontal)
374  {
375  midPoint.x = aSegment->GetStartPoint().x;
376  }
377  else if( iDx != 0 ) // keep the first segment orientation (currently vertical)
378  {
379  midPoint.y = aSegment->GetStartPoint().y;
380  }
381  else
382  {
383  if( std::abs( midPoint.x - aSegment->GetStartPoint().x ) <
384  std::abs( midPoint.y - aSegment->GetStartPoint().y ) )
385  midPoint.x = aSegment->GetStartPoint().x;
386  else
387  midPoint.y = aSegment->GetStartPoint().y;
388  }
389 #endif
390 
391  aSegment->SetEndPoint( midPoint );
392  nextSegment->SetStartPoint( midPoint );
393  nextSegment->SetEndPoint( aPosition );
394 }
395 
396 
398 {
399  SCH_SCREEN* screen = GetScreen();
400 
401  SetRepeatItem( NULL );
402 
403  if( ( screen->GetCurItem() == NULL ) || !screen->GetCurItem()->IsNew() )
404  return;
405 
406  DrawSegment( m_canvas, DC, wxDefaultPosition, false );
407 
408  screen->Remove( screen->GetCurItem() );
410  screen->SetCurItem( NULL );
411 }
412 
413 
414 SCH_JUNCTION* SCH_EDIT_FRAME::AddJunction( wxDC* aDC, const wxPoint& aPosition,
415  bool aPutInUndoList )
416 {
417  SCH_JUNCTION* junction = new SCH_JUNCTION( aPosition );
418 
419  SetRepeatItem( junction );
420 
421  m_canvas->CrossHairOff( aDC ); // Erase schematic cursor
422  junction->Draw( m_canvas, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
423  m_canvas->CrossHairOn( aDC ); // Display schematic cursor
424 
425  if( aPutInUndoList )
426  {
427  GetScreen()->Append( junction );
428  SaveCopyInUndoList( junction, UR_NEW );
429  OnModify();
430  }
431 
432  return junction;
433 }
434 
435 
436 SCH_NO_CONNECT* SCH_EDIT_FRAME::AddNoConnect( wxDC* aDC, const wxPoint& aPosition )
437 {
438  SCH_NO_CONNECT* no_connect = new SCH_NO_CONNECT( aPosition );
439 
440  SetRepeatItem( no_connect );
441  GetScreen()->Append( no_connect );
443  OnModify();
444  m_canvas->Refresh();
445  SaveCopyInUndoList( no_connect, UR_NEW );
446  return no_connect;
447 }
448 
449 
450 /* Abort function for wire, bus or line creation
451  */
452 static void AbortCreateNewLine( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
453 {
454  SCH_SCREEN* screen = (SCH_SCREEN*) aPanel->GetScreen();
455 
456  if( screen->GetCurItem() )
457  {
458  s_wires.DeleteAll(); // Free the list, for a future usage
459  screen->SetCurItem( NULL );
460  aPanel->Refresh();
461  }
462  else
463  {
464  SCH_EDIT_FRAME* parent = ( SCH_EDIT_FRAME* ) aPanel->GetParent();
465  parent->SetRepeatItem( NULL );
466  }
467 
468  // Clear flags used in edit functions.
469  screen->ClearDrawingState();
470 }
471 
472 
474 {
475  SCH_ITEM* repeater = GetRepeatItem();
476 
477  if( !repeater )
478  return;
479 
480  //D( repeater>Show( 0, std::cout ); )
481 
482  // clone the repeater, move it, insert into display list, then save a copy
483  // via SetRepeatItem();
484 
485  SCH_ITEM* my_clone = (SCH_ITEM*) repeater->Clone();
486 
487  // If cloning a component then put into 'move' mode.
488  if( my_clone->Type() == SCH_COMPONENT_T )
489  {
490  wxPoint pos = GetCrossHairPosition() -
491  ( (SCH_COMPONENT*) my_clone )->GetPosition();
492 
493  my_clone->SetFlags( IS_NEW );
494  ( (SCH_COMPONENT*) my_clone )->SetTimeStamp( GetNewTimeStamp() );
495  my_clone->Move( pos );
496  my_clone->Draw( m_canvas, DC, wxPoint( 0, 0 ), g_XorMode );
497  PrepareMoveItem( my_clone, DC );
498  }
499  else
500  {
501  my_clone->Move( GetRepeatStep() );
502 
503  if( my_clone->CanIncrementLabel() )
504  ( (SCH_TEXT*) my_clone )->IncrementLabel( GetRepeatDeltaLabel() );
505 
506  GetScreen()->Append( my_clone );
507 
508  if( my_clone->IsConnectable() )
509  {
511  m_canvas->Refresh();
512  }
513  else
514  {
515  my_clone->Draw( m_canvas, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
516  }
517 
518  SaveCopyInUndoList( my_clone, UR_NEW );
519  my_clone->ClearFlags();
520  }
521 
522  // clone my_clone, now that it has been moved, thus saving new position.
523  SetRepeatItem( my_clone );
524 }
Definition of the SCH_SHEET class for Eeschema.
SCH_NO_CONNECT * AddNoConnect(wxDC *aDC, const wxPoint &aPosition)
Function AddNoConnect add a no connect item to the current schematic sheet at aPosition.
GR_DRAWMODE g_XorMode
Definition: gr_basic.cpp:51
void RepeatDrawItem(wxDC *DC)
Function RepeatDrawItem repeats the last item placement if the last item was a bus, bus entry, label, or component.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
bool IsPointOnSegment(const wxPoint &aSegStart, const wxPoint &aSegEnd, const wxPoint &aTestPoint)
Function IsPointOnSegment.
Definition: trigo.cpp:39
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:255
virtual bool CanIncrementLabel() const
void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aOffset, GR_DRAWMODE aDrawMode, COLOR4D aColor=COLOR4D::UNSPECIFIED) override
Function Draw Draw a schematic item.
SCH_JUNCTION * AddJunction(wxDC *aDC, const wxPoint &aPosition, bool aPutInUndoList=false)
Function AddJunction adds a new junction at aPosition.
T * Remove(T *aElement)
Function Remove removes aElement from the list, but does not delete it.
Definition: dlist.h:211
void SaveCopyInUndoList(SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, const wxPoint &aTransformPoint=wxPoint(0, 0))
Function SaveCopyInUndoList.
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Definition: draw_panel.cpp:326
SCH_ITEM * GetRepeatItem() const
Function GetRepeatItem returns the item which is to be repeated with the insert key.
Definition: schframe.h:1297
static void RemoveBacktracks(DLIST< SCH_ITEM > &aWires)
In a contiguous list of wires, remove wires that backtrack over the previous wire.
bool IsNew() const
Definition: base_struct.h:216
bool GetForceHVLines() const
Definition: schframe.h:239
void OnModify()
Function OnModify Must be called after a schematic change in order to set the "modify" flag of the cu...
Definition: schframe.cpp:762
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
const wxPoint GetRepeatStep() const
static void DrawSegment(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
Mouse capture callback for drawing line segments.
time_t GetNewTimeStamp()
Definition: common.cpp:166
void EndMouseCapture(int aId=-1, int aCursorId=-1, const wxString &aTitle=wxEmptyString, bool aCallEndFunc=true)
Function EndMouseCapture ends mouse a capture.
T * begin() const
Definition: dlist.h:218
void BeginSegment(wxDC *DC, int type)
Function BeginSegment creates a new segment ( WIRE, BUS ) or terminates the current segment in progre...
void PushItem(const ITEM_PICKER &aItem)
Function PushItem pushes aItem to the top of the list.
wxPoint GetEndPoint() const
Definition: sch_line.h:75
Schematic editor (Eeschema) main window.
Definition: schframe.h:117
SCH_LINE * Next() const
Definition: sch_line.h:56
SCH_LAYER_ID GetLayer() const
Function GetLayer returns the layer this item is on.
void Remove(SCH_ITEM *aItem)
Function Remove removes aItem from the schematic associated with this screen.
Definition: sch_screen.cpp:158
int GetRepeatDeltaLabel() const
void DeleteAll()
Function DeleteAll deletes all items on the list and leaves the list empty.
Definition: dlist.cpp:41
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Definition: eeschema.cpp:166
#define abs(a)
Definition: auxiliary.h:84
SCH_ITEM * Next() const
void PrepareMoveItem(SCH_ITEM *aItem, wxDC *aDC)
Function PrepareMoveItem start moving aItem using the mouse.
Definition: schedit.cpp:783
void SetRepeatItem(SCH_ITEM *aItem)
Function SetRepeatItem clones aItem and owns that clone in this container.
Definition: schframe.cpp:460
void SetEndPoint(const wxPoint &aPosition)
Definition: sch_line.h:77
SCH_ITEM * Back() const
void PushBack(T *aNewElement)
Function PushBack puts aNewElement at the end of the list sequence.
Definition: dlist.h:250
wxPoint GetStartPoint() const
Definition: sch_line.h:71
#define IS_NEW
New item, just created.
Definition: base_struct.h:113
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: schframe.cpp:521
void EndSegment(wxDC *DC)
Function EndSegment called to terminate a bus, wire, or line creation.
#define SELECTED
Definition: base_struct.h:120
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:253
void DeleteCurrentSegment(wxDC *DC)
Function DeleteCurrentSegment erases the last segment at the current mouse position.
bool SchematicCleanUp()
Function SchematicCleanUp performs routine schematic cleaning including breaking wire and buses and d...
Definition: sch_screen.cpp:426
T * GetLast() const
Function GetLast returns the last T* in the list without removing it, or NULL if the list is empty...
Definition: dlist.h:170
SCH_ITEM * GetCurItem() const
Function GetCurItem returns the currently selected SCH_ITEM, overriding BASE_SCREEN::GetCurItem().
virtual bool IsConnectable() const
Function IsConnectable returns true if the schematic item can connect to another schematic item...
void SetStartPoint(const wxPoint &aPosition)
Definition: sch_line.h:73
void CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
T * GetFirst() const
Function GetFirst returns the first T* in the list without removing it, or NULL if the list is empty...
Definition: dlist.h:163
EDA_DRAW_FRAME * GetParent() const
Definition: draw_panel.cpp:175
Class PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
void SetMouseCaptureCallback(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback)
void CrossHairOff(wxDC *DC)
Definition: draw_panel.cpp:253
bool IsNull() const
Definition: sch_line.h:69
static void AbortCreateNewLine(EDA_DRAW_PANEL *aPanel, wxDC *aDC)
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
#define GR_DEFAULT_DRAWMODE
Definition: general.h:70
Definition the SCH_COMPONENT class for Eeschema.
void CrossHairOn(wxDC *DC)
Definition: draw_panel.cpp:260
Class SCH_LINE is a segment description base class to describe items which have 2 end points (track...
Definition: sch_line.h:42
void Append(SCH_ITEM *aItem)
bool TestDanglingEnds()
Function TestDanglingEnds tests all of the connectible objects in the schematic for unused connection...
Definition: sch_screen.cpp:915
void SetCurItem(SCH_ITEM *aItem)
Function SetCurItem sets the currently selected object, m_CurrentItem.
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:69
BASE_SCREEN * GetScreen()
Definition: draw_panel.cpp:188
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:151
void ExtractWires(DLIST< SCH_ITEM > &aList, bool aCreateCopy)
Function ExtractWires extracts the old wires, junctions and buses.
Definition: sch_screen.cpp:241
SCH_LINE * Back() const
Definition: sch_line.h:57
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:254
unsigned GetCount() const
Function GetCount returns the number of elements in the list.
Definition: dlist.h:126
void ClearDrawingState()
Clear the state flags of all the items in the screen.
Definition: sch_screen.cpp:621
void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aOffset, GR_DRAWMODE aDrawMode, COLOR4D aColor=COLOR4D::UNSPECIFIED) override
Function Draw Draw a schematic item.
Definition: sch_line.cpp:214
bool IsJunctionNeeded(const wxPoint &aPosition)
Function IsJunctionNeeded tests if a junction is required for the items at aPosition on the screen...
Definition: sch_screen.cpp:337
void SetMouseCapture(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback, END_MOUSE_CAPTURE_CALLBACK aEndMouseCaptureCallback)
Function SetMouseCapture sets the mouse capture and end mouse capture callbacks to aMouseCaptureCallb...
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
Implementation of the label properties dialog.
static void ComputeBreakPoint(SCH_LINE *segment, const wxPoint &new_pos)
Function ComputeBreakPoint computes the middle coordinate for 2 segments from the start point to aPos...
virtual void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aOffset, GR_DRAWMODE aDrawMode, COLOR4D aColor=COLOR4D::UNSPECIFIED)=0
Function Draw Draw a schematic item.
T * PopFront()
Definition: dlist.h:221
static DLIST< SCH_ITEM > s_wires
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
virtual void Move(const wxPoint &aMoveVector)=0
Function Move moves the item by aMoveVector to a new position.