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  NETINFO_LIST& netInfo = aPcb->GetNetInfo();
156 
157  for( NETINFO_LIST::iterator i = netInfo.begin(); i != netInfo.end(); ++i )
158  itemsList.push_back( *i );
159 
160  // Sort list
161  itemsList.sort();
162 
163  return false;
164  }
165 
166  // search in list:
167  return std::binary_search( itemsList.begin(), itemsList.end(), aItem );
168 }
169 
170 static void SwapItemData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
171 {
172  if( aImage == NULL )
173  return;
174 
175  wxASSERT( aItem->Type() == aImage->Type() );
176 
177  // Remark: to create images of edited items to undo, we are using Clone method
178  // which can duplication of items foe copy, but does not clone all members
179  // mainly pointers in chain and time stamp, which is set to new, unique value.
180  // So we have to use the current values of these parameters.
181 
182  EDA_ITEM* pnext = aItem->Next();
183  EDA_ITEM* pback = aItem->Back();
184  DHEAD* mylist = aItem->GetList();
185  timestamp_t timestamp = aItem->GetTimeStamp();
186  EDA_ITEM* parent = aItem->GetParent();
187 
188  aItem->SwapData( aImage );
189 
190  // Restore pointers and time stamp, to be sure they are not broken
191  aItem->SetNext( pnext );
192  aItem->SetBack( pback );
193  aItem->SetList( mylist );
194  aItem->SetTimeStamp( timestamp );
195  aItem->SetParent( parent );
196 }
197 
199  const wxPoint& aTransformPoint )
200 {
201  PICKED_ITEMS_LIST commandToUndo;
202  commandToUndo.PushItem( ITEM_PICKER( aItem, aCommandType ) );
203  SaveCopyInUndoList( commandToUndo, aCommandType, aTransformPoint );
204 }
205 
206 
208  UNDO_REDO_T aTypeCommand,
209  const wxPoint& aTransformPoint )
210 {
211  PICKED_ITEMS_LIST* commandToUndo = new PICKED_ITEMS_LIST();
212 
213  commandToUndo->m_TransformPoint = aTransformPoint;
214 
215  // First, filter unnecessary stuff from the list (i.e. for multiple pads / labels modified),
216  // take the first occurence of the module (we save copies of modules when one of its subitems
217  // is changed).
218  for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
219  {
220  ITEM_PICKER curr_picker = aItemsList.GetItemWrapper(ii);
221  BOARD_ITEM* item = (BOARD_ITEM*) aItemsList.GetPickedItem( ii );
222 
223  // For items belonging to modules, we need to save state of the parent module
224  if( item->Type() == PCB_MODULE_TEXT_T || item->Type() == PCB_MODULE_EDGE_T
225  || item->Type() == PCB_PAD_T )
226  {
227  // Item to be stored in the undo buffer is the parent module
228  item = item->GetParent();
229  wxASSERT( item && item->Type() == PCB_MODULE_T );
230 
231  if( item == NULL )
232  continue;
233 
234  // Check if the parent module has already been saved in another entry
235  bool found = false;
236 
237  for( unsigned j = 0; j < commandToUndo->GetCount(); j++ )
238  {
239  if( commandToUndo->GetPickedItem( j ) == item
240  && commandToUndo->GetPickedItemStatus( j ) == UR_CHANGED )
241  {
242  found = true;
243  break;
244  }
245  }
246 
247  if( !found )
248  {
249  // Create a clean copy of the parent module
250  MODULE* orig = static_cast<MODULE*>( item );
251  MODULE* clone = new MODULE( *orig );
252  clone->SetParent( GetBoard() );
253 
254  // Clear current flags (which can be temporary set by a current edit command)
255  for( EDA_ITEM* child = clone->GraphicalItemsList(); child; child = child->Next() )
256  child->ClearEditFlags();
257 
258  for( D_PAD* pad = clone->PadsList(); pad; pad = pad->Next() )
259  pad->ClearEditFlags();
260 
261  clone->Reference().ClearEditFlags();
262  clone->Value().ClearEditFlags();
263 
264  ITEM_PICKER picker( item, UR_CHANGED );
265  picker.SetLink( clone );
266  commandToUndo->PushItem( picker );
267 
268  orig->SetLastEditTime();
269  }
270  else
271  {
272  continue;
273  }
274  }
275  else
276  {
277  // Normal case: all other BOARD_ITEMs, are simply copied to the new list
278  commandToUndo->PushItem( curr_picker );
279  }
280  }
281 
282  for( unsigned ii = 0; ii < commandToUndo->GetCount(); ii++ )
283  {
284  BOARD_ITEM* item = (BOARD_ITEM*) commandToUndo->GetPickedItem( ii );
285  UNDO_REDO_T command = commandToUndo->GetPickedItemStatus( ii );
286 
287  if( command == UR_UNSPECIFIED )
288  {
289  command = aTypeCommand;
290  commandToUndo->SetPickedItemStatus( command, ii );
291  }
292 
293  wxASSERT( item );
294 
295  switch( command )
296  {
297  case UR_CHANGED:
298  case UR_DRILLORIGIN:
299  case UR_GRIDORIGIN:
300 
301  /* If needed, create a copy of item, and put in undo list
302  * in the picker, as link
303  * If this link is not null, the copy is already done
304  */
305  if( commandToUndo->GetPickedItemLink( ii ) == NULL )
306  {
307  EDA_ITEM* cloned = item->Clone();
308  commandToUndo->SetPickedItemLink( cloned, ii );
309  }
310  break;
311 
312  case UR_MOVED:
313  case UR_ROTATED:
315  case UR_FLIPPED:
316  case UR_NEW:
317  case UR_DELETED:
318  break;
319 
320  default:
321  {
322  wxLogDebug( wxT( "SaveCopyInUndoList() error (unknown code %X)" ), command );
323  }
324  break;
325 
326  }
327  }
328 
329  if( commandToUndo->GetCount() )
330  {
331  /* Save the copy in undo list */
332  GetScreen()->PushCommandToUndoList( commandToUndo );
333 
334  /* Clear redo list, because after a new command one cannot redo a command */
335  GetScreen()->ClearUndoORRedoList( GetScreen()->m_RedoList );
336  }
337  else
338  {
339  // Should not occur
340  wxASSERT( false );
341  delete commandToUndo;
342  }
343 }
344 
345 
346 void PCB_BASE_EDIT_FRAME::RestoreCopyFromUndoList( wxCommandEvent& aEvent )
347 {
348  if( UndoRedoBlocked() )
349  return;
350 
351  if( GetScreen()->GetUndoCommandCount() <= 0 )
352  return;
353 
354  // Inform tools that undo command was issued
355  m_toolManager->ProcessEvent( { TC_MESSAGE, TA_UNDO_REDO_PRE, AS_GLOBAL } );
356 
357  // Get the old list
358  PICKED_ITEMS_LIST* List = GetScreen()->PopCommandFromUndoList();
359 
360  // Undo the command
361  PutDataInPreviousState( List, false );
362 
363  // Put the old list in RedoList
364  List->ReversePickersListOrder();
365  GetScreen()->PushCommandToRedoList( List );
366 
367  OnModify();
368 
369  m_toolManager->ProcessEvent( { TC_MESSAGE, TA_UNDO_REDO_POST, AS_GLOBAL } );
370 
371  m_canvas->Refresh();
372 }
373 
374 
375 void PCB_BASE_EDIT_FRAME::RestoreCopyFromRedoList( wxCommandEvent& aEvent )
376 {
377  if( UndoRedoBlocked() )
378  return;
379 
380  if( GetScreen()->GetRedoCommandCount() == 0 )
381  return;
382 
383  // Inform tools that redo command was issued
384  m_toolManager->ProcessEvent( { TC_MESSAGE, TA_UNDO_REDO_PRE, AS_GLOBAL } );
385 
386  // Get the old list
387  PICKED_ITEMS_LIST* List = GetScreen()->PopCommandFromRedoList();
388 
389  // Redo the command
390  PutDataInPreviousState( List, true );
391 
392  // Put the old list in UndoList
393  List->ReversePickersListOrder();
394  GetScreen()->PushCommandToUndoList( List );
395 
396  OnModify();
397 
398  m_toolManager->ProcessEvent( { TC_MESSAGE, TA_UNDO_REDO_POST, AS_GLOBAL } );
399 
400  m_canvas->Refresh();
401 }
402 
403 
405  bool aRebuildRatsnet )
406 {
407  BOARD_ITEM* item;
408  bool not_found = false;
409  bool reBuild_ratsnest = false;
410  bool deep_reBuild_ratsnest = false; // true later if pointers must be rebuilt
411 
412  auto view = GetGalCanvas()->GetView();
413  auto connectivity = GetBoard()->GetConnectivity();
414 
415  // Undo in the reverse order of list creation: (this can allow stacked changes
416  // like the same item can be changes and deleted in the same complex command
417 
418  bool build_item_list = true; // if true the list of existing items must be rebuilt
419 
420  // Restore changes in reverse order
421  for( int ii = aList->GetCount() - 1; ii >= 0 ; ii-- )
422  {
423  item = (BOARD_ITEM*) aList->GetPickedItem( ii );
424  wxASSERT( item );
425 
426  /* Test for existence of item on board.
427  * It could be deleted, and no more on board:
428  * - if a call to SaveCopyInUndoList was forgotten in Pcbnew
429  * - in zones outlines, when a change in one zone merges this zone with an other
430  * This test avoids a Pcbnew crash
431  * Obviously, this test is not made for deleted items
432  */
433  UNDO_REDO_T status = aList->GetPickedItemStatus( ii );
434 
435  if( status != UR_DELETED
436  && status != UR_DRILLORIGIN // origin markers never on board
437  && status != UR_GRIDORIGIN ) // origin markers never on board
438  {
439  if( build_item_list )
440  // Build list of existing items, for integrity test
441  TestForExistingItem( GetBoard(), NULL );
442 
443  build_item_list = false;
444 
445  if( !TestForExistingItem( GetBoard(), item ) )
446  {
447  // Checking if it ever happens
448  wxASSERT_MSG( false, "Item in the undo buffer does not exist" );
449 
450  // Remove this non existent item
451  aList->RemovePicker( ii );
452  ii++; // the current item was removed, ii points now the next item
453  // decrement it because it will be incremented later
454  not_found = true;
455  continue;
456  }
457  }
458 
459  // see if we must rebuild ratsnets and pointers lists
460  switch( item->Type() )
461  {
462  case PCB_MODULE_T:
463  deep_reBuild_ratsnest = true; // Pointers on pads can be invalid
464  // Fall through
465  case PCB_ZONE_AREA_T:
466  case PCB_TRACE_T:
467  case PCB_VIA_T:
468  reBuild_ratsnest = true;
469  break;
470 
471  case PCB_NETINFO_T:
472  reBuild_ratsnest = true;
473  deep_reBuild_ratsnest = true;
474  break;
475 
476  default:
477  break;
478  }
479 
480  // It is possible that we are going to replace the selected item, so clear it
481  SetCurItem( NULL );
482 
483  switch( aList->GetPickedItemStatus( ii ) )
484  {
485  case UR_CHANGED: /* Exchange old and new data for each item */
486  {
487  BOARD_ITEM* image = (BOARD_ITEM*) aList->GetPickedItemLink( ii );
488 
489  // Remove all pads/drawings/texts, as they become invalid
490  // for the VIEW after SwapData() called for modules
491  view->Remove( item );
492  connectivity->Remove( item );
493 
494  SwapItemData( item, image );
495 
496  view->Add( item );
497  connectivity->Add( item );
498  }
499  break;
500 
501  case UR_NEW: /* new items are deleted */
502  aList->SetPickedItemStatus( UR_DELETED, ii );
503  GetModel()->Remove( item );
504  view->Remove( item );
505  break;
506 
507  case UR_DELETED: /* deleted items are put in List, as new items */
508  aList->SetPickedItemStatus( UR_NEW, ii );
509  GetModel()->Add( item );
510  view->Add( item );
511  build_item_list = true;
512  break;
513 
514  case UR_MOVED:
515  item->Move( aRedoCommand ? aList->m_TransformPoint : -aList->m_TransformPoint );
516  view->Update( item, KIGFX::GEOMETRY );
517  connectivity->Update( item );
518  break;
519 
520  case UR_ROTATED:
521  item->Rotate( aList->m_TransformPoint,
522  aRedoCommand ? m_rotationAngle : -m_rotationAngle );
523  view->Update( item, KIGFX::GEOMETRY );
524  connectivity->Update( item );
525  break;
526 
528  item->Rotate( aList->m_TransformPoint,
529  aRedoCommand ? -m_rotationAngle : m_rotationAngle );
530  view->Update( item, KIGFX::GEOMETRY );
531  connectivity->Update( item );
532  break;
533 
534  case UR_FLIPPED:
535  item->Flip( aList->m_TransformPoint );
536  view->Update( item, KIGFX::LAYERS );
537  connectivity->Update( item );
538  break;
539 
540  case UR_DRILLORIGIN:
541  case UR_GRIDORIGIN:
542  {
543  BOARD_ITEM* image = (BOARD_ITEM*) aList->GetPickedItemLink( ii );
544  VECTOR2D origin = image->GetPosition();
545  image->SetPosition( item->GetPosition() );
546 
547  if( aList->GetPickedItemStatus( ii ) == UR_DRILLORIGIN )
548  PCB_EDITOR_CONTROL::DoSetDrillOrigin( view, this, item, origin );
549  else
550  PCBNEW_CONTROL::DoSetGridOrigin( view, this, item, origin );
551  }
552  break;
553 
554  default:
555  {
556  wxLogDebug( wxT( "PutDataInPreviousState() error (unknown code %X)" ),
557  aList->GetPickedItemStatus( ii ) );
558  }
559  break;
560  }
561  }
562 
563  if( not_found )
564  wxMessageBox( _( "Incomplete undo/redo operation: some items not found" ) );
565 
566  // Rebuild pointers and connectivity that can be changed.
567  // connectivity can be rebuilt only in the board editor frame
568  if( IsType( FRAME_PCB ) && ( reBuild_ratsnest || deep_reBuild_ratsnest ) )
569  {
570  Compile_Ratsnest( NULL, false );
571  }
572 
573  SELECTION_TOOL* selTool = m_toolManager->GetTool<SELECTION_TOOL>();
574  selTool->RebuildSelection();
575 
577 }
578 
579 
580 
581 
583 {
584  if( aItemCount == 0 )
585  return;
586 
587  unsigned icnt = aList.m_CommandsList.size();
588 
589  if( aItemCount > 0 )
590  icnt = aItemCount;
591 
592  for( unsigned ii = 0; ii < icnt; ii++ )
593  {
594  if( aList.m_CommandsList.size() == 0 )
595  break;
596 
597  PICKED_ITEMS_LIST* curr_cmd = aList.m_CommandsList[0];
598  aList.m_CommandsList.erase( aList.m_CommandsList.begin() );
599 
600  curr_cmd->ClearListAndDeleteItems();
601  delete curr_cmd; // Delete command
602  }
603 }
iterator end() const
Definition: netinfo.h:533
Wrapper class, so you can iterate through NETINFO_ITEM*s, not std::pair<int/wxString,...
Definition: netinfo.h:482
EDA_ITEM * GetPickedItemLink(unsigned int aIdx) const
Function GetPickedItemLink.
DHEAD * GetList() const
Definition: base_struct.h:215
void RestoreCopyFromUndoList(wxCommandEvent &aEvent)
Function RestoreCopyFromUndoList Undo the last edit:
Definition: undo_redo.cpp:346
TEXTE_MODULE & Reference()
Definition: class_module.h:503
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:218
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,...
Class SELECTION_TOOL.
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:100
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:220
void SetLink(EDA_ITEM *aItem)
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
static void SwapItemData(BOARD_ITEM *aItem, BOARD_ITEM *aImage)
Definition: undo_redo.cpp:170
unsigned GetCount() const
Function GetCount.
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
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.
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
BOARD_ITEM * Back() const
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:981
void PutDataInPreviousState(PICKED_ITEMS_LIST *aList, bool aRedoCommand, bool aRebuildRatsnet=true)
Function PutDataInPreviousState Used in undo or redo command.
Definition: undo_redo.cpp:404
std::vector< PICKED_ITEMS_LIST * > m_CommandsList
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:219
Class NETINFO_LIST is a container class for NETINFO_ITEM elements, which are the nets.
Definition: netinfo.h:411
virtual void Move(const wxPoint &aMoveVector)
Function Move move this object.
TEXTE_MODULE & Value()
read/write accessors:
Definition: class_module.h:502
iterator begin() const
Definition: netinfo.h:528
void SetLastEditTime(timestamp_t aTime)
Definition: class_module.h:313
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:292
EDA_ITEM * GetPickedItem(unsigned int aIdx) const
Function GetPickedItem.
timestamp_t GetTimeStamp() const
Definition: base_struct.h:210
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:198
All active tools
Definition: tool_event.h:143
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:748
virtual const wxPoint GetPosition() const =0
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.
ITEM_PICKER GetItemWrapper(unsigned int aIdx) const
Function GetItemWrapper.
void SetNext(EDA_ITEM *aNext)
Definition: base_struct.h:217
BOARD_ITEM * Next() const
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.
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:375
UNDO_REDO_T GetPickedItemStatus(unsigned int aIdx) const
Function GetPickedItemStatus.
class NETINFO_ITEM, a description of a net
Definition: typeinfo.h:102
size_t i
Definition: json11.cpp:597
void SanitizeNetcodes()
void RebuildSelection()
Rebuilds the selection from the EDA_ITEMs' selection flags.
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:157
bool SetPickedItemLink(EDA_ITEM *aLink, unsigned aIdx)
Function SetPickedItemLink set the link associated to a given picked item.
Position or shape has changed.
Definition: view_item.h:58
PCB_TARGET class definition.
DLIST< BOARD_ITEM > & GraphicalItemsList()
Definition: class_module.h:165
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
uint32_t timestamp_t
timestamp_t is our type to represent unique IDs for all kinds of elements; historically simply the ti...
Definition: common.h:53
DLIST< D_PAD > & PadsList()
Definition: class_module.h:162
DLIST< TRACK > m_Track
Definition: class_board.h:249
Module description (excepted pads)
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:952
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 ClearEditFlags()
Definition: base_struct.h:276
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:582
BOARD_ITEM_CONTAINER * GetParent() 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:253
KICAD_T Type() const
Function Type()
Definition: base_struct.h:204
void SetTimeStamp(timestamp_t aNewTimeStamp)
Definition: base_struct.h:209
Color has changed.
Definition: view_item.h:57