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 <pcb_edit_frame.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_pcb_target.h>
43 #include <class_module.h>
44 #include <class_dimension.h>
45 #include <class_zone.h>
46 #include <class_edge_mod.h>
47 #include <origin_viewitem.h>
48 
50 
51 #include <tools/selection_tool.h>
52 #include <tools/pcbnew_control.h>
54 #include <tool/tool_manager.h>
55 
56 #include <view/view.h>
57 
58 /* Functions to undo and redo edit commands.
59  * commands to undo are stored in CurrentScreen->m_UndoList
60  * commands to redo are stored in CurrentScreen->m_RedoList
61  *
62  * m_UndoList and m_RedoList handle a std::vector of PICKED_ITEMS_LIST
63  * Each PICKED_ITEMS_LIST handle a std::vector of pickers (class ITEM_PICKER),
64  * that store the list of schematic items that are concerned by the command to undo or redo
65  * and is created for each command to undo (handle also a command to redo).
66  * each picker has a pointer pointing to an item to undo or redo (in fact: deleted, added or
67  * modified),
68  * and has a pointer to a copy of this item, when this item has been modified
69  * (the old values of parameters are therefore saved)
70  *
71  * there are 3 cases:
72  * - delete item(s) command
73  * - change item(s) command
74  * - add item(s) command
75  * and 3 cases for block:
76  * - move list of items
77  * - mirror (Y) list of items
78  * - Flip list of items
79  *
80  * Undo command
81  * - delete item(s) command:
82  * => deleted items are moved in undo list
83  *
84  * - change item(s) command
85  * => A copy of item(s) is made (a DrawPickedStruct list of wrappers)
86  * the .m_Link member of each wrapper points the modified item.
87  * the .m_Item member of each wrapper points the old copy of this item.
88  *
89  * - add item(s) command
90  * =>A list of item(s) is made. The .m_Item member of each wrapper points the new item.
91  *
92  * Redo command
93  * - delete item(s) old command:
94  * => deleted items are moved in EEDrawList list, and in
95  *
96  * - change item(s) command
97  * => the copy of item(s) is moved in Undo list
98  *
99  * - add item(s) command
100  * => The list of item(s) is used to create a deleted list in undo list(same as a delete
101  * command)
102  *
103  * Some block operations that change items can be undone without memorize items, just the
104  * coordinates of the transform:
105  * move list of items (undo/redo is made by moving with the opposite move vector)
106  * mirror (Y) and flip list of items (undo/redo is made by mirror or flip items)
107  * so they are handled specifically.
108  *
109  */
110 
111 
128 static bool TestForExistingItem( BOARD* aPcb, BOARD_ITEM* aItem )
129 {
130  static std::list<BOARD_ITEM*> itemsList;
131 
132  if( aItem == NULL ) // Build list
133  {
134  // Count items to store in itemsList:
135  BOARD_ITEM* item;
136  itemsList.clear();
137 
138  // Store items in list:
139  // Append tracks:
140  for( item = aPcb->m_Track; item != NULL; item = item->Next() )
141  itemsList.push_back( item );
142 
143  // Append modules:
144  for( item = aPcb->m_Modules; item != NULL; item = item->Next() )
145  itemsList.push_back( item );
146 
147  // Append drawings
148  for( auto ditem : aPcb->Drawings() )
149  itemsList.push_back( ditem );
150 
151  // Append zones outlines
152  for( int ii = 0; ii < aPcb->GetAreaCount(); ii++ )
153  itemsList.push_back( aPcb->GetArea( ii ) );
154 
155  // Append zones segm (deprecated items):
156  for( item = aPcb->m_SegZoneDeprecated; item != NULL; item = item->Next() )
157  itemsList.push_back( item );
158 
159  NETINFO_LIST& netInfo = aPcb->GetNetInfo();
160 
161  for( NETINFO_LIST::iterator i = netInfo.begin(); i != netInfo.end(); ++i )
162  itemsList.push_back( *i );
163 
164  // Sort list
165  itemsList.sort();
166 
167  return false;
168  }
169 
170  // search in list:
171  return std::binary_search( itemsList.begin(), itemsList.end(), aItem );
172 }
173 
174 static void SwapItemData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
175 {
176  if( aImage == NULL )
177  return;
178 
179  wxASSERT( aItem->Type() == aImage->Type() );
180 
181  // Remark: to create images of edited items to undo, we are using Clone method
182  // which can duplication of items foe copy, but does not clone all members
183  // mainly pointers in chain and time stamp, which is set to new, unique value.
184  // So we have to use the current values of these parameters.
185 
186  EDA_ITEM* pnext = aItem->Next();
187  EDA_ITEM* pback = aItem->Back();
188  DHEAD* mylist = aItem->GetList();
189  timestamp_t timestamp = aItem->GetTimeStamp();
190  EDA_ITEM* parent = aItem->GetParent();
191 
192  aItem->SwapData( aImage );
193 
194  // Restore pointers and time stamp, to be sure they are not broken
195  aItem->SetNext( pnext );
196  aItem->SetBack( pback );
197  aItem->SetList( mylist );
198  aItem->SetTimeStamp( timestamp );
199  aItem->SetParent( parent );
200 }
201 
203  const wxPoint& aTransformPoint )
204 {
205  PICKED_ITEMS_LIST commandToUndo;
206  commandToUndo.PushItem( ITEM_PICKER( aItem, aCommandType ) );
207  SaveCopyInUndoList( commandToUndo, aCommandType, aTransformPoint );
208 }
209 
210 
212  UNDO_REDO_T aTypeCommand, const wxPoint& aTransformPoint )
213 {
214  PICKED_ITEMS_LIST* commandToUndo = new PICKED_ITEMS_LIST();
215 
216  commandToUndo->m_TransformPoint = aTransformPoint;
217 
218  // First, filter unnecessary stuff from the list (i.e. for multiple pads / labels modified),
219  // take the first occurence of the module (we save copies of modules when one of its subitems
220  // is changed).
221  for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
222  {
223  ITEM_PICKER curr_picker = aItemsList.GetItemWrapper(ii);
224  BOARD_ITEM* item = (BOARD_ITEM*) aItemsList.GetPickedItem( ii );
225 
226  // For items belonging to modules, we need to save state of the parent module
227  if( item->Type() == PCB_MODULE_TEXT_T || item->Type() == PCB_MODULE_EDGE_T
228  || item->Type() == PCB_PAD_T )
229  {
230  // Item to be stored in the undo buffer is the parent module
231  item = item->GetParent();
232  wxASSERT( item && item->Type() == PCB_MODULE_T );
233 
234  if( item == NULL )
235  continue;
236 
237  // Check if the parent module has already been saved in another entry
238  bool found = false;
239 
240  for( unsigned j = 0; j < commandToUndo->GetCount(); j++ )
241  {
242  if( commandToUndo->GetPickedItem( j ) == item && commandToUndo->GetPickedItemStatus( j ) == UR_CHANGED )
243  {
244  found = true;
245  break;
246  }
247  }
248 
249  if( !found )
250  {
251  // Create a clean copy of the parent module
252  MODULE* orig = static_cast<MODULE*>( item );
253  MODULE* clone = new MODULE( *orig );
254  clone->SetParent( GetBoard() );
255 
256  // Clear current flags (which can be temporary set by a current edit command)
257  for( EDA_ITEM* loc_item = clone->GraphicalItemsList(); loc_item;
258  loc_item = loc_item->Next() )
259  loc_item->ClearFlags();
260 
261  for( D_PAD* pad = clone->PadsList(); pad; pad = pad->Next() )
262  pad->ClearFlags();
263 
264  clone->Reference().ClearFlags();
265  clone->Value().ClearFlags();
266 
267  ITEM_PICKER picker( item, UR_CHANGED );
268  picker.SetLink( clone );
269  commandToUndo->PushItem( picker );
270 
271  orig->SetLastEditTime();
272  }
273  else
274  {
275  continue;
276  }
277  }
278  else
279  {
280  // Normal case: all other BOARD_ITEMs, are simply copied to the new list
281  commandToUndo->PushItem( curr_picker );
282  }
283  }
284 
285  for( unsigned ii = 0; ii < commandToUndo->GetCount(); ii++ )
286  {
287  BOARD_ITEM* item = (BOARD_ITEM*) commandToUndo->GetPickedItem( ii );
288  UNDO_REDO_T command = commandToUndo->GetPickedItemStatus( ii );
289 
290  if( command == UR_UNSPECIFIED )
291  {
292  command = aTypeCommand;
293  commandToUndo->SetPickedItemStatus( command, ii );
294  }
295 
296  wxASSERT( item );
297 
298  switch( command )
299  {
300  case UR_CHANGED:
301  case UR_DRILLORIGIN:
302  case UR_GRIDORIGIN:
303 
304  /* If needed, create a copy of item, and put in undo list
305  * in the picker, as link
306  * If this link is not null, the copy is already done
307  */
308  if( commandToUndo->GetPickedItemLink( ii ) == NULL )
309  {
310  EDA_ITEM* cloned = item->Clone();
311  commandToUndo->SetPickedItemLink( cloned, ii );
312  }
313  break;
314 
315  case UR_MOVED:
316  case UR_ROTATED:
318  case UR_FLIPPED:
319  case UR_NEW:
320  case UR_DELETED:
321  break;
322 
323  default:
324  {
325  wxString msg;
326  msg.Printf( wxT( "SaveCopyInUndoList() error (unknown code %X)" ), command );
327  wxMessageBox( msg );
328  }
329  break;
330 
331  }
332  }
333 
334  if( commandToUndo->GetCount() )
335  {
336  /* Save the copy in undo list */
337  GetScreen()->PushCommandToUndoList( commandToUndo );
338 
339  /* Clear redo list, because after a new command one cannot redo a command */
340  GetScreen()->ClearUndoORRedoList( GetScreen()->m_RedoList );
341  }
342  else
343  {
344  // Should not occur
345  wxASSERT( false );
346  delete commandToUndo;
347  }
348 }
349 
350 
351 void PCB_BASE_EDIT_FRAME::RestoreCopyFromUndoList( wxCommandEvent& aEvent )
352 {
353  if( UndoRedoBlocked() )
354  return;
355 
356  if( GetScreen()->GetUndoCommandCount() <= 0 )
357  return;
358 
359  // Inform tools that undo command was issued
360  m_toolManager->ProcessEvent( { TC_MESSAGE, TA_UNDO_REDO_PRE, AS_GLOBAL } );
361 
362  // Get the old list
363  PICKED_ITEMS_LIST* List = GetScreen()->PopCommandFromUndoList();
364 
365  // Undo the command
366  PutDataInPreviousState( List, false );
367 
368  // Put the old list in RedoList
369  List->ReversePickersListOrder();
370  GetScreen()->PushCommandToRedoList( List );
371 
372  OnModify();
373 
374  m_toolManager->ProcessEvent( { TC_MESSAGE, TA_UNDO_REDO_POST, AS_GLOBAL } );
375 
376  m_canvas->Refresh();
377 }
378 
379 
380 void PCB_BASE_EDIT_FRAME::RestoreCopyFromRedoList( wxCommandEvent& aEvent )
381 {
382  if( UndoRedoBlocked() )
383  return;
384 
385  if( GetScreen()->GetRedoCommandCount() == 0 )
386  return;
387 
388  // Inform tools that redo command was issued
389  m_toolManager->ProcessEvent( { TC_MESSAGE, TA_UNDO_REDO_PRE, AS_GLOBAL } );
390 
391  // Get the old list
392  PICKED_ITEMS_LIST* List = GetScreen()->PopCommandFromRedoList();
393 
394  // Redo the command
395  PutDataInPreviousState( List, true );
396 
397  // Put the old list in UndoList
398  List->ReversePickersListOrder();
399  GetScreen()->PushCommandToUndoList( List );
400 
401  OnModify();
402 
403  m_toolManager->ProcessEvent( { TC_MESSAGE, TA_UNDO_REDO_POST, AS_GLOBAL } );
404 
405  m_canvas->Refresh();
406 }
407 
408 
410  bool aRebuildRatsnet )
411 {
412  BOARD_ITEM* item;
413  bool not_found = false;
414  bool reBuild_ratsnest = false;
415  bool deep_reBuild_ratsnest = false; // true later if pointers must be rebuilt
416 
417  auto view = GetGalCanvas()->GetView();
418  auto connectivity = GetBoard()->GetConnectivity();
419 
420  // Undo in the reverse order of list creation: (this can allow stacked changes
421  // like the same item can be changes and deleted in the same complex command
422 
423  bool build_item_list = true; // if true the list of existing items must be rebuilt
424 
425  // Restore changes in reverse order
426  for( int ii = aList->GetCount() - 1; ii >= 0 ; ii-- )
427  {
428  item = (BOARD_ITEM*) aList->GetPickedItem( ii );
429  wxASSERT( item );
430 
431  /* Test for existence of item on board.
432  * It could be deleted, and no more on board:
433  * - if a call to SaveCopyInUndoList was forgotten in Pcbnew
434  * - in zones outlines, when a change in one zone merges this zone with an other
435  * This test avoids a Pcbnew crash
436  * Obviously, this test is not made for deleted items
437  */
438  UNDO_REDO_T status = aList->GetPickedItemStatus( ii );
439 
440  if( status != UR_DELETED
441  && status != UR_DRILLORIGIN // origin markers never on board
442  && status != UR_GRIDORIGIN ) // origin markers never on board
443  {
444  if( build_item_list )
445  // Build list of existing items, for integrity test
446  TestForExistingItem( GetBoard(), NULL );
447 
448  build_item_list = false;
449 
450  if( !TestForExistingItem( GetBoard(), item ) )
451  {
452  // Checking if it ever happens
453  wxASSERT_MSG( false, "Item in the undo buffer does not exist" );
454 
455  // Remove this non existent item
456  aList->RemovePicker( ii );
457  ii++; // the current item was removed, ii points now the next item
458  // decrement it because it will be incremented later
459  not_found = true;
460  continue;
461  }
462  }
463 
464  item->ClearFlags();
465 
466  // see if we must rebuild ratsnets and pointers lists
467  switch( item->Type() )
468  {
469  case PCB_MODULE_T:
470  deep_reBuild_ratsnest = true; // Pointers on pads can be invalid
471  // Fall through
472  case PCB_ZONE_AREA_T:
473  case PCB_TRACE_T:
474  case PCB_VIA_T:
475  reBuild_ratsnest = true;
476  break;
477 
478  case PCB_NETINFO_T:
479  reBuild_ratsnest = true;
480  deep_reBuild_ratsnest = true;
481  break;
482 
483  default:
484  break;
485  }
486 
487  // It is possible that we are going to replace the selected item, so clear it
488  SetCurItem( NULL );
489 
490  switch( aList->GetPickedItemStatus( ii ) )
491  {
492  case UR_CHANGED: /* Exchange old and new data for each item */
493  {
494  BOARD_ITEM* image = (BOARD_ITEM*) aList->GetPickedItemLink( ii );
495 
496  // Remove all pads/drawings/texts, as they become invalid
497  // for the VIEW after SwapData() called for modules
498  view->Remove( item );
499  connectivity->Remove( item );
500 
501  SwapItemData( item, image );
502 
503  // Update all pads/drawings/texts, as they become invalid
504  // for the VIEW after SwapData() called for modules
505  if( item->Type() == PCB_MODULE_T )
506  {
507  MODULE* newModule = static_cast<MODULE*>( item );
508  newModule->RunOnChildren( std::bind( &BOARD_ITEM::ClearFlags, _1, EDA_ITEM_ALL_FLAGS ));
509  }
510 
511  view->Add( item );
512  connectivity->Add( item );
513  item->ClearFlags();
514 
515  }
516  break;
517 
518  case UR_NEW: /* new items are deleted */
519  aList->SetPickedItemStatus( UR_DELETED, ii );
520  GetModel()->Remove( item );
521  view->Remove( item );
522  break;
523 
524  case UR_DELETED: /* deleted items are put in List, as new items */
525  aList->SetPickedItemStatus( UR_NEW, ii );
526  GetModel()->Add( item );
527  view->Add( item );
528  build_item_list = true;
529  break;
530 
531  case UR_MOVED:
532  item->Move( aRedoCommand ? aList->m_TransformPoint : -aList->m_TransformPoint );
533  view->Update( item, KIGFX::GEOMETRY );
534  connectivity->Update( item );
535  break;
536 
537  case UR_ROTATED:
538  item->Rotate( aList->m_TransformPoint,
539  aRedoCommand ? m_rotationAngle : -m_rotationAngle );
540  view->Update( item, KIGFX::GEOMETRY );
541  connectivity->Update( item );
542  break;
543 
545  item->Rotate( aList->m_TransformPoint,
546  aRedoCommand ? -m_rotationAngle : m_rotationAngle );
547  view->Update( item, KIGFX::GEOMETRY );
548  connectivity->Update( item );
549  break;
550 
551  case UR_FLIPPED:
552  item->Flip( aList->m_TransformPoint );
553  view->Update( item, KIGFX::LAYERS );
554  connectivity->Update( item );
555  break;
556 
557  case UR_DRILLORIGIN:
558  case UR_GRIDORIGIN:
559  {
560  BOARD_ITEM* image = (BOARD_ITEM*) aList->GetPickedItemLink( ii );
561  VECTOR2D origin = image->GetPosition();
562  image->SetPosition( item->GetPosition() );
563 
564  if( aList->GetPickedItemStatus( ii ) == UR_DRILLORIGIN )
565  PCB_EDITOR_CONTROL::DoSetDrillOrigin( view, this, item, origin );
566  else
567  PCBNEW_CONTROL::DoSetGridOrigin( view, this, item, origin );
568  }
569  break;
570 
571  default:
572  {
573  wxString msg;
574  msg.Printf( wxT( "PutDataInPreviousState() error (unknown code %X)" ),
575  aList->GetPickedItemStatus( ii ) );
576  wxMessageBox( msg );
577  }
578  break;
579  }
580  }
581 
582  if( not_found )
583  wxMessageBox( wxT( "Incomplete undo/redo operation: some items not found" ) );
584 
585  // Rebuild pointers and connectivity that can be changed.
586  // connectivity can be rebuilt only in the board editor frame
587  if( IsType( FRAME_PCB ) && ( reBuild_ratsnest || deep_reBuild_ratsnest ) )
588  {
589  Compile_Ratsnest( NULL, false );
590  }
591 
593 }
594 
595 
596 
597 
599 {
600  if( aItemCount == 0 )
601  return;
602 
603  unsigned icnt = aList.m_CommandsList.size();
604 
605  if( aItemCount > 0 )
606  icnt = aItemCount;
607 
608  for( unsigned ii = 0; ii < icnt; ii++ )
609  {
610  if( aList.m_CommandsList.size() == 0 )
611  break;
612 
613  PICKED_ITEMS_LIST* curr_cmd = aList.m_CommandsList[0];
614  aList.m_CommandsList.erase( aList.m_CommandsList.begin() );
615 
616  curr_cmd->ClearListAndDeleteItems();
617  delete curr_cmd; // Delete command
618  }
619 }
DHEAD * GetList() const
Definition: base_struct.h:212
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
Wrapper class, so you can iterate through NETINFO_ITEM*s, not std::pair<int/wxString, NETINFO_ITEM*>
Definition: netinfo.h:486
void RestoreCopyFromUndoList(wxCommandEvent &aEvent)
Function RestoreCopyFromUndoList Undo the last edit:
Definition: undo_redo.cpp:351
BOARD_ITEM_CONTAINER * GetParent() const
TEXTE_MODULE & Reference()
Definition: class_module.h:513
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction)
Function RunOnChildren.
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:128
void SetBack(EDA_ITEM *aBack)
Definition: base_struct.h:215
long timestamp_t
timestamp_t is our type to represent unique IDs for all kinds of elements; historically simply the ti...
Definition: common.h:52
virtual void SetPosition(const wxPoint &aPos)=0
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.
UNDO_REDO_T
Undo Redo considerations: Basically we have 3 cases New item Deleted item Modified item there is also...
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:102
Classes to handle copper zones.
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:90
void SetList(DHEAD *aList)
Definition: base_struct.h:217
void SetLink(EDA_ITEM *aItem)
#define EDA_ITEM_ALL_FLAGS
Definition: base_struct.h:145
UNDO_REDO_T GetPickedItemStatus(unsigned int aIdx) const
Function GetPickedItemStatus.
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
static void SwapItemData(BOARD_ITEM *aItem, BOARD_ITEM *aImage)
Definition: undo_redo.cpp:174
EDA_ITEM * GetPickedItemLink(unsigned int aIdx) const
Function GetPickedItemLink.
Functions relatives to tracks, vias and segments used to fill zones.
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
This file contains miscellaneous commonly used macros and functions.
BOARD_ITEM * Next() const
DIMENSION class definition.
virtual void SwapData(BOARD_ITEM *aImage)
Swap data between aItem and aImage.
Class UNDO_REDO_CONTAINER is a holder to handle alist of undo (or redo) command.
class MODULE, a footprint
Definition: typeinfo.h:89
void PutDataInPreviousState(PICKED_ITEMS_LIST *aList, bool aRedoCommand, bool aRebuildRatsnet=true)
Function PutDataInPreviousState Used in undo or redo command.
Definition: undo_redo.cpp:409
std::vector< PICKED_ITEMS_LIST * > m_CommandsList
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:216
Class NETINFO_LIST is a container class for NETINFO_ITEM elements, which are the nets.
Definition: netinfo.h:415
virtual void Move(const wxPoint &aMoveVector)
Function Move move this object.
TEXTE_MODULE & Value()
read/write accessors:
Definition: class_module.h:512
DLIST< SEGZONE > m_SegZoneDeprecated
Definition: class_board.h:250
void SetLastEditTime(timestamp_t aTime)
Definition: class_module.h:314
D_PAD * Next() const
Definition: class_pad.h:160
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:1020
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:202
All active tools
Definition: tool_event.h:144
static bool DoSetDrillOrigin(KIGFX::VIEW *aView, PCB_BASE_FRAME *aFrame, BOARD_ITEM *aItem, const VECTOR2D &aPoint)
Low-level access (below undo) to setting the drill origin
NETINFO_LIST & GetNetInfo()
Definition: class_board.h:750
virtual const wxPoint GetPosition() const =0
unsigned GetCount() const
Function GetCount.
BOARD * GetBoard()
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
static bool DoSetGridOrigin(KIGFX::VIEW *aView, PCB_BASE_FRAME *aFrame, BOARD_ITEM *originViewItem, const VECTOR2D &aPoint)
virtual void Flip(const wxPoint &aCentre)
Function Flip Flip this object, i.e.
iterator begin() const
Definition: netinfo.h:532
void SetNext(EDA_ITEM *aNext)
Definition: base_struct.h:214
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:991
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
Definition: netinfo.h:537
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:170
DLIST< MODULE > m_Modules
Definition: class_board.h:248
void RestoreCopyFromRedoList(wxCommandEvent &aEvent)
Function RestoreCopyFromRedoList Redo the last edit:
Definition: undo_redo.cpp:380
class NETINFO_ITEM, a description of a net
Definition: typeinfo.h:104
size_t i
Definition: json11.cpp:597
void SanitizeNetcodes()
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:154
bool SetPickedItemLink(EDA_ITEM *aLink, unsigned aIdx)
Function SetPickedItemLink set the link associated to a given picked item.
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:257
Position or shape has changed.
Definition: view_item.h:58
PCB_TARGET class definition.
DLIST< BOARD_ITEM > & GraphicalItemsList()
Definition: class_module.h:166
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
DLIST< D_PAD > & PadsList()
Definition: class_module.h:163
DLIST< TRACK > m_Track
Definition: class_board.h:249
Module description (excepted pads)
SGLIB_API S3DMODEL * GetModel(SCENEGRAPH *aNode)
Function GetModel creates an S3DMODEL representation of aNode (raw data, no transforms) ...
Definition: ifsg_api.cpp:471
EDGE_MODULE class definition.
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:598
ITEM_PICKER GetItemWrapper(unsigned int aIdx) const
Function GetItemWrapper.
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:296
BOARD_ITEM * Back() const
void ClearListAndDeleteItems()
Function ClearListAndDeleteItems deletes the list of pickers, AND the data pointed by m_PickedItem or...
DLIST_ITERATOR_WRAPPER< BOARD_ITEM > Drawings()
Definition: class_board.h:255
timestamp_t GetTimeStamp() const
Definition: base_struct.h:207
void SetTimeStamp(timestamp_t aNewTimeStamp)
Definition: base_struct.h:206
Color has changed.
Definition: view_item.h:57