29 using namespace std::placeholders;
115 if( aItem == static_cast<BOARD_ITEM*>( item ) )
121 if( aItem == static_cast<BOARD_ITEM*>( item ) )
127 if( aItem == static_cast<BOARD_ITEM*>( item ) )
133 if( aItem == static_cast<BOARD_ITEM*>( item ) )
141 if( aItem == static_cast<BOARD_ITEM*>( *i ) )
147 if( aItem == static_cast<BOARD_ITEM*>( item ) )
160 wxASSERT( aItem->
Type() == aImage->
Type() );
181 SaveCopyInUndoList( commandToUndo, aCommandType );
193 for(
unsigned ii = 0; ii < aItemsList.
GetCount(); ii++ )
206 for(
unsigned j = 0; j < commandToUndo->
GetCount(); j++ )
219 FOOTPRINT* orig = static_cast<FOOTPRINT*>( item );
225 child->ClearEditFlags();
227 for(
auto pad : clone->
Pads() )
228 pad->ClearEditFlags();
247 commandToUndo->
PushItem( curr_picker );
251 for(
unsigned ii = 0; ii < commandToUndo->
GetCount(); ii++ )
258 command = aCommandType;
290 wxFAIL_MSG(
wxString::Format(
"SaveCopyInUndoList() error (unknown code %X)",
301 PushCommandToUndoList( commandToUndo );
304 ClearUndoORRedoList( REDO_LIST );
310 delete commandToUndo;
317 if( UndoRedoBlocked() )
320 if( GetUndoCommandCount() <= 0 )
330 PutDataInPreviousState( list );
334 PushCommandToRedoList( list );
340 GetCanvas()->Refresh();
346 if( UndoRedoBlocked() )
349 if( GetRedoCommandCount() == 0 )
359 PutDataInPreviousState( list );
363 PushCommandToUndoList( list );
369 GetCanvas()->Refresh();
375 bool not_found =
false;
376 bool reBuild_ratsnest =
false;
377 bool deep_reBuild_ratsnest =
false;
379 auto view = GetCanvas()->GetView();
388 for(
int ii = aList->
GetCount() - 1; ii >= 0 ; ii-- )
409 wxASSERT_MSG(
false,
"Item in the undo buffer does not exist" );
425 switch( eda_item->
Type() )
428 deep_reBuild_ratsnest =
true;
436 reBuild_ratsnest =
true;
440 reBuild_ratsnest =
true;
441 deep_reBuild_ratsnest =
true;
457 view->Remove( item );
458 connectivity->Remove( item );
463 view->Hide( item,
false );
464 connectivity->Add( item );
474 view->Remove( eda_item );
483 view->Add( eda_item );
486 group = static_cast<PCB_GROUP*>( eda_item );
492 static_cast<BOARD_ITEM*>( eda_item )->SetParentGroup(
nullptr );
499 group->
AddItem( static_cast<BOARD_ITEM*>( eda_item ) );
529 wxFAIL_MSG(
wxString::Format(
"PutDataInPreviousState() error (unknown code %X)",
536 wxMessageBox(
_(
"Incomplete undo/redo operation: some items not found" ) );
540 if( IsType(
FRAME_PCB_EDITOR ) && ( reBuild_ratsnest || deep_reBuild_ratsnest ) )
542 Compile_Ratsnest(
false );
554 if( aItemCount == 0 )
563 for(
unsigned ii = 0; ii < icnt; ii++ )
580 PutDataInPreviousState( undo );
585 GetCanvas()->Refresh();
void RollbackFromUndo()
Perform an undo of the last edit without logging a corresponding redo.
EDA_ITEM * GetPickedItemLink(unsigned int aIdx) const
void RestoreCopyFromUndoList(wxCommandEvent &aEvent)
Undo the last edit:
bool AddItem(BOARD_ITEM *aItem)
Add item to group.
void SaveCopyInUndoList(EDA_ITEM *aItemToCopy, UNDO_REDO aTypeCommand) override
Create a new entry in undo list of commands.
static bool TestForExistingItem(BOARD *aPcb, BOARD_ITEM *aItem)
Function TestForExistingItem Test if aItem exists somewhere in undo/redo lists of items.
void ReversePickersListOrder()
Reverse the order of pickers stored in this list.
virtual void SetPosition(const wxPoint &aPos)
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
static void DoSetDrillOrigin(KIGFX::VIEW *aView, PCB_BASE_FRAME *aFrame, EDA_ITEM *aItem, const VECTOR2D &aPoint)
class PCB_GROUP, a set of BOARD_ITEMs
GROUPS & Groups()
The groups must maintain the following invariants.
A set of BOARD_ITEMs (i.e., without duplicates).
void Restore(EDA_DRAW_FRAME *aFrame, KIGFX::VIEW *aView=nullptr)
class ARC, an arc track segment on a copper layer
const NETINFO_LIST & GetNetInfo() const
void PushItem(const ITEM_PICKER &aItem)
Push aItem to the top of the list.
class PAD, a pad in a footprint
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
virtual wxPoint GetPosition() const
void PutDataInPreviousState(PICKED_ITEMS_LIST *aList)
Used in undo or redo command.
void SetLink(EDA_ITEM *aItem)
UNDO_REDO
Undo Redo considerations: Basically we have 3 cases New item Deleted item Modified item there is also...
static void SwapItemData(BOARD_ITEM *aItem, BOARD_ITEM *aImage)
unsigned GetCount() const
virtual void SetParent(EDA_ITEM *aParent)
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
class TRACK, a track segment (segment on a copper layer)
This file contains miscellaneous commonly used macros and functions.
virtual void SwapData(BOARD_ITEM *aImage)
Swap data between aItem and aImage.
A holder to handle a list of undo (or redo) commands.
static void DoSetGridOrigin(KIGFX::VIEW *aView, PCB_BASE_FRAME *aFrame, EDA_ITEM *originViewItem, const VECTOR2D &aPoint)
std::vector< PICKED_ITEMS_LIST * > m_CommandsList
Container for NETINFO_ITEM elements, which are the nets.
FOOTPRINTS & Footprints()
void ClearUndoORRedoList(UNDO_REDO_LIST whichList, int aItemCount=-1) override
Free the undo or redo list from List element.
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
EDA_ITEM * GetPickedItem(unsigned int aIdx) const
ZONE handles a list of polygons defining a copper zone.
class ZONE, a copper pour area
bool RemovePicker(unsigned aIdx)
Remove one entry (one picker) from the list of picked items.
A holder to handle information on schematic or board items.
class FOOTPRINT, a footprint
UNDO_REDO_LIST
Remove the aItemCount of old commands from aList and delete commands, pickers and picked items if nee...
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
ITEM_PICKER GetItemWrapper(unsigned int aIdx) const
bool SetPickedItemStatus(UNDO_REDO aStatus, unsigned aIdx)
Set the type of undo/redo operation for a given picked item.
Information pertinent to a Pcbnew printed circuit board.
void RestoreCopyFromRedoList(wxCommandEvent &aEvent)
Redo the last edit:
class NETINFO_ITEM, a description of a net
void OnItemChanged(BOARD_ITEM *aItem)
Notify the board and its listeners that an item on the board has been modified in some way.
A base class for most all the KiCad significant classes used in schematics and boards.
bool SetPickedItemLink(EDA_ITEM *aLink, unsigned aIdx)
Set the link associated to a given picked item.
UNDO_REDO GetPickedItemStatus(unsigned int aIdx) const
class VIA, a via (like a track segment on a copper layer)
SGLIB_API S3DMODEL * GetModel(SCENEGRAPH *aNode)
Function GetModel creates an S3DMODEL representation of aNode (raw data, no transforms)
BOARD_ITEM_CONTAINER * GetParent() const
void ClearListAndDeleteItems()
Delete the list of pickers AND the data pointed by #m_PickedItem or #m_PickedItemLink according to th...
KICAD_T Type() const
Returns the type of object.