KiCad PCB EDA Suite
undo_redo.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) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
5  * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
6  * Copyright (C) 2016 CERN
7  * @author Maciej Suminski <maciej.suminski@cern.ch>
8  * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, you may find one here:
22  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
23  * or you may search the http://www.gnu.org website for the version 2 license,
24  * or you may write to the Free Software Foundation, Inc.,
25  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
26  */
27 
28 #include <functional>
29 using namespace std::placeholders;
30 #include <fctsys.h>
31 #include <class_drawpanel.h>
32 #include <class_draw_panel_gal.h>
33 #include <macros.h>
34 
35 #include <pcbnew.h>
36 #include <wxPcbStruct.h>
37 
38 #include <class_board.h>
39 #include <class_track.h>
40 #include <class_drawsegment.h>
41 #include <class_pcb_text.h>
42 #include <class_mire.h>
43 #include <class_module.h>
44 #include <class_dimension.h>
45 #include <class_zone.h>
46 #include <class_edge_mod.h>
47 
48 #include <ratsnest_data.h>
49 
50 #include <tools/selection_tool.h>
51 #include <tool/tool_manager.h>
52 
53 #include <view/view.h>
54 
55 /* Functions to undo and redo edit commands.
56  * commands to undo are stored in CurrentScreen->m_UndoList
57  * commands to redo are stored in CurrentScreen->m_RedoList
58  *
59  * m_UndoList and m_RedoList handle a std::vector of PICKED_ITEMS_LIST
60  * Each PICKED_ITEMS_LIST handle a std::vector of pickers (class ITEM_PICKER),
61  * that store the list of schematic items that are concerned by the command to undo or redo
62  * and is created for each command to undo (handle also a command to redo).
63  * each picker has a pointer pointing to an item to undo or redo (in fact: deleted, added or
64  * modified),
65  * and has a pointer to a copy of this item, when this item has been modified
66  * (the old values of parameters are therefore saved)
67  *
68  * there are 3 cases:
69  * - delete item(s) command
70  * - change item(s) command
71  * - add item(s) command
72  * and 3 cases for block:
73  * - move list of items
74  * - mirror (Y) list of items
75  * - Flip list of items
76  *
77  * Undo command
78  * - delete item(s) command:
79  * => deleted items are moved in undo list
80  *
81  * - change item(s) command
82  * => A copy of item(s) is made (a DrawPickedStruct list of wrappers)
83  * the .m_Link member of each wrapper points the modified item.
84  * the .m_Item member of each wrapper points the old copy of this item.
85  *
86  * - add item(s) command
87  * =>A list of item(s) is made. The .m_Item member of each wrapper points the new item.
88  *
89  * Redo command
90  * - delete item(s) old command:
91  * => deleted items are moved in EEDrawList list, and in
92  *
93  * - change item(s) command
94  * => the copy of item(s) is moved in Undo list
95  *
96  * - add item(s) command
97  * => The list of item(s) is used to create a deleted list in undo list(same as a delete
98  * command)
99  *
100  * Some block operations that change items can be undone without memorize items, just the
101  * coordinates of the transform:
102  * move list of items (undo/redo is made by moving with the opposite move vector)
103  * mirror (Y) and flip list of items (undo/redo is made by mirror or flip items)
104  * so they are handled specifically.
105  *
106  */
107 
108 
125 static bool TestForExistingItem( BOARD* aPcb, BOARD_ITEM* aItem )
126 {
127  static std::list<BOARD_ITEM*> itemsList;
128 
129  if( aItem == NULL ) // Build list
130  {
131  // Count items to store in itemsList:
132  BOARD_ITEM* item;
133  itemsList.clear();
134 
135  // Store items in list:
136  // Append tracks:
137  for( item = aPcb->m_Track; item != NULL; item = item->Next() )
138  itemsList.push_back( item );
139 
140  // Append modules:
141  for( item = aPcb->m_Modules; item != NULL; item = item->Next() )
142  itemsList.push_back( item );
143 
144  // Append drawings
145  for( item = aPcb->m_Drawings; item != NULL; item = item->Next() )
146  itemsList.push_back( item );
147 
148  // Append zones outlines
149  for( int ii = 0; ii < aPcb->GetAreaCount(); ii++ )
150  itemsList.push_back( aPcb->GetArea( ii ) );
151 
152  // Append zones segm:
153  for( item = aPcb->m_Zone; item != NULL; item = item->Next() )
154  itemsList.push_back( item );
155 
156  NETINFO_LIST& netInfo = aPcb->GetNetInfo();
157 
158  for( NETINFO_LIST::iterator i = netInfo.begin(); i != netInfo.end(); ++i )
159  itemsList.push_back( *i );
160 
161  // Sort list
162  itemsList.sort();
163 
164  return false;
165  }
166 
167  // search in list:
168  return std::binary_search( itemsList.begin(), itemsList.end(), aItem );
169 }
170 
171 
173  const wxPoint& aTransformPoint )
174 {
175  PICKED_ITEMS_LIST commandToUndo;
176  commandToUndo.PushItem( ITEM_PICKER( aItem, aCommandType ) );
177  SaveCopyInUndoList( commandToUndo, aCommandType, aTransformPoint );
178 }
179 
180 
182  UNDO_REDO_T aTypeCommand, const wxPoint& aTransformPoint )
183 {
184  PICKED_ITEMS_LIST* commandToUndo = new PICKED_ITEMS_LIST();
185 
186  commandToUndo->m_TransformPoint = aTransformPoint;
187 
188  // First, filter unnecessary stuff from the list (i.e. for multiple pads / labels modified),
189  // take the first occurence of the module (we save copies of modules when one of its subitems
190  // is changed).
191  for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
192  {
193  ITEM_PICKER curr_picker = aItemsList.GetItemWrapper(ii);
194  BOARD_ITEM* item = (BOARD_ITEM*) aItemsList.GetPickedItem( ii );
195 
196  // For items belonging to modules, we need to save state of the parent module
197  if( item->Type() == PCB_MODULE_TEXT_T || item->Type() == PCB_MODULE_EDGE_T
198  || item->Type() == PCB_PAD_T )
199  {
200  // Item to be stored in the undo buffer is the parent module
201  item = item->GetParent();
202  wxASSERT( item && item->Type() == PCB_MODULE_T );
203 
204  if( item == NULL )
205  continue;
206 
207  // Check if the parent module has already been saved in another entry
208  bool found = false;
209 
210  for( unsigned j = 0; j < commandToUndo->GetCount(); j++ )
211  {
212  if( commandToUndo->GetPickedItem( j ) == item && commandToUndo->GetPickedItemStatus( j ) == UR_CHANGED )
213  {
214  found = true;
215  break;
216  }
217  }
218 
219  if( !found )
220  {
221  // Create a clean copy of the parent module
222  MODULE* orig = static_cast<MODULE*>( item );
223  MODULE* clone = new MODULE( *orig );
224  clone->SetParent( GetBoard() );
225 
226  // Clear current flags (which can be temporary set by a current edit command)
227  for( EDA_ITEM* loc_item = clone->GraphicalItems(); loc_item;
228  loc_item = loc_item->Next() )
229  loc_item->ClearFlags();
230 
231  for( D_PAD* pad = clone->Pads(); pad; pad = pad->Next() )
232  pad->ClearFlags();
233 
234  clone->Reference().ClearFlags();
235  clone->Value().ClearFlags();
236 
237  ITEM_PICKER picker( item, UR_CHANGED );
238  picker.SetLink( clone );
239  commandToUndo->PushItem( picker );
240 
241  orig->SetLastEditTime();
242  }
243  else
244  {
245  continue;
246  }
247  }
248  else
249  {
250  // Normal case: all other BOARD_ITEMs, are simply copied to the new list
251  commandToUndo->PushItem( curr_picker );
252  }
253  }
254 
255  for( unsigned ii = 0; ii < commandToUndo->GetCount(); ii++ )
256  {
257  BOARD_ITEM* item = (BOARD_ITEM*) commandToUndo->GetPickedItem( ii );
258  UNDO_REDO_T command = commandToUndo->GetPickedItemStatus( ii );
259 
260  if( command == UR_UNSPECIFIED )
261  {
262  command = aTypeCommand;
263  commandToUndo->SetPickedItemStatus( command, ii );
264  }
265 
266  wxASSERT( item );
267 
268  switch( command )
269  {
270  case UR_CHANGED:
271 
272  /* If needed, create a copy of item, and put in undo list
273  * in the picker, as link
274  * If this link is not null, the copy is already done
275  */
276  if( commandToUndo->GetPickedItemLink( ii ) == NULL )
277  {
278  EDA_ITEM* cloned = item->Clone();
279  commandToUndo->SetPickedItemLink( cloned, ii );
280  }
281  break;
282 
283  case UR_MOVED:
284  case UR_ROTATED:
286  case UR_FLIPPED:
287  case UR_NEW:
288  case UR_DELETED:
289  break;
290 
291  default:
292  {
293  wxString msg;
294  msg.Printf( wxT( "SaveCopyInUndoList() error (unknown code %X)" ), command );
295  wxMessageBox( msg );
296  }
297  break;
298 
299  }
300  }
301 
302  if( commandToUndo->GetCount() )
303  {
304  /* Save the copy in undo list */
305  GetScreen()->PushCommandToUndoList( commandToUndo );
306 
307  /* Clear redo list, because after a new command one cannot redo a command */
308  GetScreen()->ClearUndoORRedoList( GetScreen()->m_RedoList );
309  }
310  else
311  {
312  // Should not occur
313  wxASSERT( false );
314  delete commandToUndo;
315  }
316 }
317 
318 
319 void PCB_BASE_EDIT_FRAME::RestoreCopyFromUndoList( wxCommandEvent& aEvent )
320 {
321  if( UndoRedoBlocked() )
322  return;
323 
324  if( GetScreen()->GetUndoCommandCount() <= 0 )
325  return;
326 
327  // Inform tools that undo command was issued
328  m_toolManager->ProcessEvent( { TC_MESSAGE, TA_UNDO_REDO_PRE, AS_GLOBAL } );
329 
330  // Get the old list
331  PICKED_ITEMS_LIST* List = GetScreen()->PopCommandFromUndoList();
332 
333  // Undo the command
334  PutDataInPreviousState( List, false );
335 
336  // Put the old list in RedoList
337  List->ReversePickersListOrder();
338  GetScreen()->PushCommandToRedoList( List );
339 
340  OnModify();
341 
342  m_toolManager->ProcessEvent( { TC_MESSAGE, TA_UNDO_REDO_POST, AS_GLOBAL } );
343 
344  m_canvas->Refresh();
345 }
346 
347 
348 void PCB_BASE_EDIT_FRAME::RestoreCopyFromRedoList( wxCommandEvent& aEvent )
349 {
350  if( UndoRedoBlocked() )
351  return;
352 
353  if( GetScreen()->GetRedoCommandCount() == 0 )
354  return;
355 
356  // Inform tools that redo command was issued
357  m_toolManager->ProcessEvent( { TC_MESSAGE, TA_UNDO_REDO_PRE, AS_GLOBAL } );
358 
359  // Get the old list
360  PICKED_ITEMS_LIST* List = GetScreen()->PopCommandFromRedoList();
361 
362  // Redo the command
363  PutDataInPreviousState( List, true );
364 
365  // Put the old list in UndoList
366  List->ReversePickersListOrder();
367  GetScreen()->PushCommandToUndoList( List );
368 
369  OnModify();
370 
371  m_toolManager->ProcessEvent( { TC_MESSAGE, TA_UNDO_REDO_POST, AS_GLOBAL } );
372 
373  m_canvas->Refresh();
374 }
375 
376 
378  bool aRebuildRatsnet )
379 {
380  BOARD_ITEM* item;
381  bool not_found = false;
382  bool reBuild_ratsnest = false;
383  bool deep_reBuild_ratsnest = false; // true later if pointers must be rebuilt
384 
385  KIGFX::VIEW* view = GetGalCanvas()->GetView();
386  RN_DATA* ratsnest = GetBoard()->GetRatsnest();
387 
388  // Undo in the reverse order of list creation: (this can allow stacked changes
389  // like the same item can be changes and deleted in the same complex command
390 
391  bool build_item_list = true; // if true the list of existing items must be rebuilt
392 
393  // Restore changes in reverse order
394  for( int ii = aList->GetCount() - 1; ii >= 0 ; ii-- )
395  {
396  item = (BOARD_ITEM*) aList->GetPickedItem( ii );
397  wxASSERT( item );
398 
399  /* Test for existence of item on board.
400  * It could be deleted, and no more on board:
401  * - if a call to SaveCopyInUndoList was forgotten in Pcbnew
402  * - in zones outlines, when a change in one zone merges this zone with an other
403  * This test avoids a Pcbnew crash
404  * Obviously, this test is not made for deleted items
405  */
406  UNDO_REDO_T status = aList->GetPickedItemStatus( ii );
407 
408  if( status != UR_DELETED )
409  {
410  if( build_item_list )
411  // Build list of existing items, for integrity test
412  TestForExistingItem( GetBoard(), NULL );
413 
414  build_item_list = false;
415 
416  if( !TestForExistingItem( GetBoard(), item ) )
417  {
418  // Checking if it ever happens
419  wxASSERT_MSG( false, "Item in the undo buffer does not exist" );
420 
421  // Remove this non existent item
422  aList->RemovePicker( ii );
423  ii++; // the current item was removed, ii points now the next item
424  // decrement it because it will be incremented later
425  not_found = true;
426  continue;
427  }
428  }
429 
430  item->ClearFlags();
431 
432  // see if we must rebuild ratsnets and pointers lists
433  switch( item->Type() )
434  {
435  case PCB_MODULE_T:
436  deep_reBuild_ratsnest = true; // Pointers on pads can be invalid
437  // Fall through
438  case PCB_ZONE_AREA_T:
439  case PCB_TRACE_T:
440  case PCB_VIA_T:
441  reBuild_ratsnest = true;
442  break;
443 
444  case PCB_NETINFO_T:
445  reBuild_ratsnest = true;
446  deep_reBuild_ratsnest = true;
447  break;
448 
449  default:
450  break;
451  }
452 
453  // It is possible that we are going to replace the selected item, so clear it
454  SetCurItem( NULL );
455 
456  switch( aList->GetPickedItemStatus( ii ) )
457  {
458  case UR_CHANGED: /* Exchange old and new data for each item */
459  {
460  BOARD_ITEM* image = (BOARD_ITEM*) aList->GetPickedItemLink( ii );
461 
462  // Remove all pads/drawings/texts, as they become invalid
463  // for the VIEW after SwapData() called for modules
464  if( item->Type() == PCB_MODULE_T )
465  {
466  MODULE* oldModule = static_cast<MODULE*>( item );
467  oldModule->RunOnChildren( std::bind( &KIGFX::VIEW::Remove, view, _1 ) );
468  }
469 
470  view->Remove( item );
471  ratsnest->Remove( item );
472 
473  item->SwapData( image );
474 
475  // Update all pads/drawings/texts, as they become invalid
476  // for the VIEW after SwapData() called for modules
477  if( item->Type() == PCB_MODULE_T )
478  {
479  MODULE* newModule = static_cast<MODULE*>( item );
480  newModule->RunOnChildren( std::bind( &KIGFX::VIEW::Add, view, _1, -1 ) );
481  newModule->RunOnChildren( std::bind( &BOARD_ITEM::ClearFlags, _1, EDA_ITEM_ALL_FLAGS ));
482  }
483 
484  view->Add( item );
485  ratsnest->Add( item );
486  item->ClearFlags();
487 
488  }
489  break;
490 
491  case UR_NEW: /* new items are deleted */
492  aList->SetPickedItemStatus( UR_DELETED, ii );
493  GetModel()->Remove( item );
494 
495  if( item->Type() == PCB_MODULE_T )
496  {
497  MODULE* module = static_cast<MODULE*>( item );
498  module->RunOnChildren( std::bind( &KIGFX::VIEW::Remove, view, _1 ) );
499  }
500 
501  view->Remove( item );
502  break;
503 
504  case UR_DELETED: /* deleted items are put in List, as new items */
505  aList->SetPickedItemStatus( UR_NEW, ii );
506  GetModel()->Add( item );
507 
508  if( item->Type() == PCB_MODULE_T )
509  {
510  MODULE* module = static_cast<MODULE*>( item );
511  module->RunOnChildren( std::bind( &KIGFX::VIEW::Add, view, _1, -1 ) );
512  }
513 
514  view->Add( item );
515  build_item_list = true;
516  break;
517 
518  case UR_MOVED:
519  item->Move( aRedoCommand ? aList->m_TransformPoint : -aList->m_TransformPoint );
520  view->Update( item, KIGFX::GEOMETRY );
521  ratsnest->Update( item );
522  break;
523 
524  case UR_ROTATED:
525  item->Rotate( aList->m_TransformPoint,
526  aRedoCommand ? m_rotationAngle : -m_rotationAngle );
527  view->Update( item, KIGFX::GEOMETRY );
528  ratsnest->Update( item );
529  break;
530 
532  item->Rotate( aList->m_TransformPoint,
533  aRedoCommand ? -m_rotationAngle : m_rotationAngle );
534  view->Update( item, KIGFX::GEOMETRY );
535  ratsnest->Update( item );
536  break;
537 
538  case UR_FLIPPED:
539  item->Flip( aList->m_TransformPoint );
540  view->Update( item, KIGFX::LAYERS );
541  ratsnest->Update( item );
542  break;
543 
544  default:
545  {
546  wxString msg;
547  msg.Printf( wxT( "PutDataInPreviousState() error (unknown code %X)" ),
548  aList->GetPickedItemStatus( ii ) );
549  wxMessageBox( msg );
550  }
551  break;
552  }
553  }
554 
555  if( not_found )
556  wxMessageBox( wxT( "Incomplete undo/redo operation: some items not found" ) );
557 
558  // Rebuild pointers and ratsnest that can be changed.
559  if( reBuild_ratsnest )
560  {
561  // Compile ratsnest propagates nets from pads to tracks
563  if( deep_reBuild_ratsnest )
564  Compile_Ratsnest( NULL, false );
565 
566  if( IsGalCanvasActive() )
567  {
568  if( deep_reBuild_ratsnest )
569  ratsnest->ProcessBoard();
570  else
571  ratsnest->Recalculate();
572  }
573  }
574 }
575 
576 
578 {
579  if( aImage == NULL )
580  return;
581 
582  wxASSERT( Type() == aImage->Type() );
583 
584  // Remark: to create images of edited items to undo, we are using Clone method
585  // which can duplication of items foe copy, but does not clone all members
586  // mainly pointers in chain and time stamp, which is set to new, unique value.
587  // So we have to use the current values of these parameters.
588 
589  EDA_ITEM* pnext = Next();
590  EDA_ITEM* pback = Back();
591  DHEAD* mylist = m_List;
592  time_t timestamp = GetTimeStamp();
593  EDA_ITEM* parent = GetParent();
594 
595  switch( Type() )
596  {
597  case PCB_MODULE_T:
598  std::swap( *((MODULE*) this), *((MODULE*) aImage) );
599  break;
600 
601  case PCB_ZONE_AREA_T:
602  std::swap( *((ZONE_CONTAINER*) this), *((ZONE_CONTAINER*) aImage) );
603  break;
604 
605  case PCB_LINE_T:
606  std::swap( *((DRAWSEGMENT*) this), *((DRAWSEGMENT*) aImage) );
607  break;
608 
609  case PCB_TRACE_T:
610  std::swap( *((TRACK*) this), *((TRACK*) aImage) );
611  break;
612 
613  case PCB_VIA_T:
614  std::swap( *((VIA*) this), *((VIA*) aImage) );
615  break;
616 
617  case PCB_TEXT_T:
618  std::swap( *((TEXTE_PCB*)this), *((TEXTE_PCB*)aImage) );
619  break;
620 
621  case PCB_TARGET_T:
622  std::swap( *((PCB_TARGET*)this), *((PCB_TARGET*)aImage) );
623  break;
624 
625  case PCB_DIMENSION_T:
626  std::swap( *((DIMENSION*)this), *((DIMENSION*)aImage) );
627  break;
628 
629  case PCB_ZONE_T:
630  default:
631  wxLogMessage( wxT( "SwapData() error: unexpected type %d" ), Type() );
632  break;
633  }
634 
635  // Restore pointers and time stamp, to be sure they are not broken
636  Pnext = pnext;
637  Pback = pback;
638  m_List = mylist;
639  SetTimeStamp( timestamp );
640  SetParent( parent );
641 }
642 
643 
645 {
646  if( aItemCount == 0 )
647  return;
648 
649  unsigned icnt = aList.m_CommandsList.size();
650 
651  if( aItemCount > 0 )
652  icnt = aItemCount;
653 
654  for( unsigned ii = 0; ii < icnt; ii++ )
655  {
656  if( aList.m_CommandsList.size() == 0 )
657  break;
658 
659  PICKED_ITEMS_LIST* curr_cmd = aList.m_CommandsList[0];
660  aList.m_CommandsList.erase( aList.m_CommandsList.begin() );
661 
662  curr_cmd->ClearListAndDeleteItems();
663  delete curr_cmd; // Delete command
664  }
665 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
Wrapper class, so you can iterate through NETINFO_ITEM*s, not std::pair
void RestoreCopyFromUndoList(wxCommandEvent &aEvent)
Function RestoreCopyFromUndoList Undo the last edition:
Definition: undo_redo.cpp:319
BOARD_ITEM_CONTAINER * GetParent() const
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:78
EDA_ITEM * Pback
previous in linked list
Definition: base_struct.h:165
void RunOnChildren(std::function< void(BOARD_ITEM *)> aFunction)
Function RunOnChildren.
TEXTE_MODULE & Reference()
Definition: class_module.h:455
PCB_TARGET class definition.
TEXTE_PCB class definition.
static bool TestForExistingItem(BOARD *aPcb, BOARD_ITEM *aItem)
Function TestForExistingItem test if aItem exists somewhere in lists of items This is a function used...
Definition: undo_redo.cpp:125
Class RN_DATA.
Class DHEAD is only for use by template class DLIST, use that instead.
Definition: dlist.h:40
void ReversePickersListOrder()
Function ReversePickersListOrder reverses the order of pickers stored in this list.
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
Class BOARD to handle a board.
EDA_ITEM * Back() const
Definition: base_struct.h:207
Class that computes missing connections on a PCB.
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:114
void Remove(VIEW_ITEM *aItem)
Function Remove() Removes a VIEW_ITEM from the view.
Definition: view.cpp:341
EDA_ITEM * GetParent() const
Definition: base_struct.h:208
class TEXTE_PCB, text on a layer
Definition: typeinfo.h:104
Classes to handle copper zones.
DLIST< SEGZONE > m_Zone
Definition: class_board.h:245
void PushItem(const ITEM_PICKER &aItem)
Function PushItem pushes aItem to the top of the list.
class D_PAD, a pad in a footprint
Definition: typeinfo.h:102
bool Update(const BOARD_ITEM *aItem)
Function Update() Updates the ratsnest data for an item.
EDA_ITEM * Next() const
Definition: base_struct.h:206
void SetLastEditTime(time_t aTime)
Definition: class_module.h:269
void SetLink(EDA_ITEM *aItem)
#define EDA_ITEM_ALL_FLAGS
Definition: base_struct.h:142
UNDO_REDO_T GetPickedItemStatus(unsigned int aIdx) const
Function GetPickedItemStatus.
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:106
DLIST< BOARD_ITEM > & GraphicalItems()
Definition: class_module.h:136
EDA_ITEM * GetPickedItemLink(unsigned int aIdx) const
Function GetPickedItemLink.
void SetTimeStamp(time_t aNewTimeStamp)
Definition: base_struct.h:203
Functions relatives to tracks, vias and segments used to fill zones.
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:107
This file contains miscellaneous commonly used macros and functions.
bool Remove(const BOARD_ITEM *aItem)
Function Remove() Removes an item from the ratsnest data.
BOARD_ITEM * Next() const
DIMENSION class definition.
void SwapData(BOARD_ITEM *aImage)
Swap data between aItem and aImage.
Definition: undo_redo.cpp:577
UNDO_REDO_T
Undo Redo considerations: Basically we have 3 cases New item Deleted item Modified item there is also...
Class UNDO_REDO_CONTAINER is a holder to handle alist of undo (or redo) command.
class MODULE, a footprint
Definition: typeinfo.h:101
void PutDataInPreviousState(PICKED_ITEMS_LIST *aList, bool aRedoCommand, bool aRebuildRatsnet=true)
Function PutDataInPreviousState Used in undo or redo command.
Definition: undo_redo.cpp:377
std::vector< PICKED_ITEMS_LIST * > m_CommandsList
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:213
Class NETINFO_LIST is a container class for NETINFO_ITEM elements, which are the nets.
virtual void Move(const wxPoint &aMoveVector)
Function Move move this object.
TEXTE_MODULE & Value()
read/write accessors:
Definition: class_module.h:454
void ProcessBoard()
Function ProcessBoard() Prepares data for computing (computes a list of current nodes and connections...
D_PAD * Next() const
Definition: class_pad.h:106
DLIST< BOARD_ITEM > m_Drawings
Definition: class_board.h:242
class SEGZONE, a segment used to fill a zone area (segment on a copper layer)
Definition: typeinfo.h:109
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:1051
virtual void Rotate(const wxPoint &aRotCentre, double aAngle)
Function Rotate Rotate this object.
bool RemovePicker(unsigned aIdx)
Function RemovePicker removes one entry (one picker) from the list of picked items.
Class PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
void SaveCopyInUndoList(BOARD_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, const wxPoint &aTransformPoint=wxPoint(0, 0)) override
Function SaveCopyInUndoList Creates a new entry in undo list of commands.
Definition: undo_redo.cpp:172
All active tools
Definition: tool_event.h:138
NETINFO_LIST & GetNetInfo()
Definition: class_board.h:785
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:112
void Update(VIEW_ITEM *aItem)
Function Update() For dynamic VIEWs, informs the associated VIEW that the graphical representation of...
Definition: view.cpp:1379
RN_DATA * GetRatsnest() const
Function GetRatsnest() returns list of missing connections between components/tracks.
Definition: class_board.h:287
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:113
time_t GetTimeStamp() const
Definition: base_struct.h:204
unsigned GetCount() const
Function GetCount.
void Recalculate(int aNet=-1)
Function Recalculate() Recomputes ratsnest for selected net number or all nets that need updating...
BOARD * GetBoard()
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:105
virtual void Flip(const wxPoint &aCentre)
Function Flip Flip this object, i.e.
iterator begin() const
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:1022
bool SetPickedItemStatus(UNDO_REDO_T aStatus, unsigned aIdx)
Function SetPickedItemStatus sets the type of undo/redo operation for a given picked item...
Class to handle a graphic segment.
EDA_ITEM * GetPickedItem(unsigned int aIdx) const
Function GetPickedItem.
iterator end() const
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:166
DLIST< MODULE > m_Modules
Definition: class_board.h:243
void RestoreCopyFromRedoList(wxCommandEvent &aEvent)
Function RestoreCopyFromRedoList Redo the last edition:
Definition: undo_redo.cpp:348
class NETINFO_ITEM, a description of a net
Definition: typeinfo.h:116
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:151
bool SetPickedItemLink(EDA_ITEM *aLink, unsigned aIdx)
Function SetPickedItemLink set the link associated to a given picked item.
bool Add(const BOARD_ITEM *aItem)
Function Add() Adds an item to the ratsnest data.
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:254
Position or shape has changed.
Definition: view_item.h:58
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:108
void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:311
DLIST< D_PAD > & Pads()
Definition: class_module.h:133
DLIST< TRACK > m_Track
Definition: class_board.h:244
Module description (excepted pads)
Class VIEW.
Definition: view.h:58
SGLIB_API S3DMODEL * GetModel(SCENEGRAPH *aNode)
Function GetModel creates an S3DMODEL representation of aNode (raw data, no transforms) ...
Definition: ifsg_api.cpp:478
EDGE_MODULE class definition.
class DRAWSEGMENT, a segment not on copper layers
Definition: typeinfo.h:103
void ClearUndoORRedoList(UNDO_REDO_CONTAINER &aList, int aItemCount=-1) override
Function ClearUndoORRedoList free the undo or redo list from List element Wrappers are deleted...
Definition: undo_redo.cpp:644
ITEM_PICKER GetItemWrapper(unsigned int aIdx) const
Function GetItemWrapper.
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
Class DIMENSION.
void ClearListAndDeleteItems()
Function ClearListAndDeleteItems deletes the list of pickers, AND the data pointed by m_PickedItem or...
Color has changed.
Definition: view_item.h:57