KiCad PCB EDA Suite
Loading...
Searching...
No Matches
PICKED_ITEMS_LIST Class Reference

A holder to handle information on schematic or board items. More...

#include <undo_redo_container.h>

Public Member Functions

 PICKED_ITEMS_LIST ()
 
 ~PICKED_ITEMS_LIST ()
 
void PushItem (const ITEM_PICKER &aItem)
 Push aItem to the top of the list. More...
 
ITEM_PICKER PopItem ()
 
bool ContainsItem (const EDA_ITEM *aItem) const
 
bool ContainsItemType (KICAD_T aItemType) const
 Check the undo/redo list for any EDA_ITEM of type aItemType. More...
 
int FindItem (const EDA_ITEM *aItem) const
 
void ClearItemsList ()
 Delete only the list of pickers NOT the picked data itself. More...
 
void ClearListAndDeleteItems (std::function< void(EDA_ITEM *)> aItemDeleter)
 Delete the list of pickers AND the data pointed by #m_PickedItem or #m_PickedItemLink according to the type of undo/redo command recorded. More...
 
unsigned GetCount () const
 
void ReversePickersListOrder ()
 Reverse the order of pickers stored in this list. More...
 
ITEM_PICKER GetItemWrapper (unsigned int aIdx) const
 
EDA_ITEMGetPickedItem (unsigned int aIdx) const
 
BASE_SCREENGetScreenForItem (unsigned int aIdx) const
 
EDA_ITEMGetPickedItemLink (unsigned int aIdx) const
 
UNDO_REDO GetPickedItemStatus (unsigned int aIdx) const
 
KIID GetPickedItemGroupId (unsigned int aIdx) const
 
EDA_ITEM_FLAGS GetPickerFlags (unsigned aIdx) const
 Return the value of the picker flag. More...
 
bool SetPickedItem (EDA_ITEM *aItem, unsigned aIdx)
 
bool SetPickedItem (EDA_ITEM *aItem, UNDO_REDO aStatus, unsigned aIdx)
 
bool SetPickedItemLink (EDA_ITEM *aLink, unsigned aIdx)
 Set the link associated to a given picked item. More...
 
bool SetPickedItemGroupId (KIID aId, unsigned aIdx)
 Set the group id associated to a given picked item. More...
 
bool SetPickedItemStatus (UNDO_REDO aStatus, unsigned aIdx)
 Set the type of undo/redo operation for a given picked item. More...
 
bool SetPickerFlags (EDA_ITEM_FLAGS aFlags, unsigned aIdx)
 Set the flags of the picker (usually to the picked item m_flags value). More...
 
bool RemovePicker (unsigned aIdx)
 Remove one entry (one picker) from the list of picked items. More...
 
void CopyList (const PICKED_ITEMS_LIST &aSource)
 Copy all data from aSource to the list. More...
 
wxString GetDescription () const
 
void SetDescription (const wxString &aDescription)
 

Private Attributes

wxString m_description
 
std::vector< ITEM_PICKERm_ItemsList
 

Detailed Description

A holder to handle information on schematic or board items.

The information held is a pointer on each item, and the command made.

Definition at line 137 of file undo_redo_container.h.

Constructor & Destructor Documentation

◆ PICKED_ITEMS_LIST()

PICKED_ITEMS_LIST::PICKED_ITEMS_LIST ( )

Definition at line 57 of file undo_redo_container.cpp.

◆ ~PICKED_ITEMS_LIST()

PICKED_ITEMS_LIST::~PICKED_ITEMS_LIST ( )

Definition at line 62 of file undo_redo_container.cpp.

Member Function Documentation

◆ ClearItemsList()

void PICKED_ITEMS_LIST::ClearItemsList ( )

Delete only the list of pickers NOT the picked data itself.

Definition at line 127 of file undo_redo_container.cpp.

References m_ItemsList.

Referenced by PCB_BASE_FRAME::PlaceFootprint(), and PCB_EDIT_FRAME::RunActionPlugin().

◆ ClearListAndDeleteItems()

void PICKED_ITEMS_LIST::ClearListAndDeleteItems ( std::function< void(EDA_ITEM *)>  aItemDeleter)

Delete the list of pickers AND the data pointed by #m_PickedItem or #m_PickedItemLink according to the type of undo/redo command recorded.

Definition at line 133 of file undo_redo_container.cpp.

References GetCount(), ITEM_PICKER::GetFlags(), ITEM_PICKER::GetItem(), ITEM_PICKER::GetLink(), ITEM_PICKER::GetStatus(), PopItem(), and UR_TRANSIENT.

Referenced by PCB_BASE_EDIT_FRAME::ClearListAndDeleteItems(), SCH_EDIT_FRAME::ClearUndoORRedoList(), SYMBOL_EDIT_FRAME::ClearUndoORRedoList(), and PL_EDITOR_FRAME::ClearUndoORRedoList().

◆ ContainsItem()

bool PICKED_ITEMS_LIST::ContainsItem ( const EDA_ITEM aItem) const
Returns
True if aItem is found in the pick list.

Definition at line 87 of file undo_redo_container.cpp.

References m_ItemsList.

Referenced by PCB_EDIT_FRAME::RunActionPlugin().

◆ ContainsItemType()

bool PICKED_ITEMS_LIST::ContainsItemType ( KICAD_T  aItemType) const

Check the undo/redo list for any EDA_ITEM of type aItemType.

Parameters
aItemTypeis an EDA_ITEM type from the list of KICAD_T types.
Returns
true if an item of aItemType is found in the pick list.

Definition at line 99 of file undo_redo_container.cpp.

References m_ItemsList, and EDA_ITEM::Type().

◆ CopyList()

void PICKED_ITEMS_LIST::CopyList ( const PICKED_ITEMS_LIST aSource)

Copy all data from aSource to the list.

Items picked are not copied. just pointer in them are copied.

Parameters
aSourceThe list of items to copy to the list.

Definition at line 308 of file undo_redo_container.cpp.

References m_ItemsList.

Referenced by SCH_EDIT_FRAME::SaveCopyInUndoList().

◆ FindItem()

int PICKED_ITEMS_LIST::FindItem ( const EDA_ITEM aItem) const
Returns
Index of the searched item. If the item is not stored in the list, negative value is returned.

Definition at line 115 of file undo_redo_container.cpp.

References m_ItemsList.

Referenced by DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem().

◆ GetCount()

◆ GetDescription()

◆ GetItemWrapper()

ITEM_PICKER PICKED_ITEMS_LIST::GetItemWrapper ( unsigned int  aIdx) const
Returns
The picker of a picked item.
Parameters
aIdxIndex of the picker in the picked list if this picker does not exist, a picker is returned, with its members set to 0 or NULL.

Definition at line 160 of file undo_redo_container.cpp.

References m_ItemsList.

Referenced by PCB_EDIT_FRAME::RunActionPlugin(), SCH_EDIT_FRAME::SaveCopyInUndoList(), and PCB_BASE_EDIT_FRAME::saveCopyInUndoList().

◆ GetPickedItem()

EDA_ITEM * PICKED_ITEMS_LIST::GetPickedItem ( unsigned int  aIdx) const

◆ GetPickedItemGroupId()

KIID PICKED_ITEMS_LIST::GetPickedItemGroupId ( unsigned int  aIdx) const
Returns
The group id of the picked item, or null KIID if does not exist.
Parameters
aIdxIndex of the picked item in the picked list.

Definition at line 216 of file undo_redo_container.cpp.

References m_ItemsList.

Referenced by PCB_BASE_EDIT_FRAME::PutDataInPreviousState().

◆ GetPickedItemLink()

EDA_ITEM * PICKED_ITEMS_LIST::GetPickedItemLink ( unsigned int  aIdx) const
Returns
link of the picked item, or null if does not exist.
Parameters
aIdxIndex of the picked item in the picked list.

Definition at line 189 of file undo_redo_container.cpp.

References m_ItemsList.

Referenced by SCH_EDIT_FRAME::PutDataInPreviousState(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_FRAME::SaveCopyInUndoList(), PCB_BASE_EDIT_FRAME::saveCopyInUndoList(), and COMMIT::Stage().

◆ GetPickedItemStatus()

UNDO_REDO PICKED_ITEMS_LIST::GetPickedItemStatus ( unsigned int  aIdx) const
Returns
The type of undo/redo operation associated to the picked item, or UNSPECIFIED if does not exist.
Parameters
aIdxIndex of the picked item in the picked list.

Definition at line 198 of file undo_redo_container.cpp.

References m_ItemsList.

Referenced by SCH_EDIT_FRAME::PutDataInPreviousState(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_FRAME::SaveCopyInUndoList(), PCB_BASE_EDIT_FRAME::saveCopyInUndoList(), and COMMIT::Stage().

◆ GetPickerFlags()

EDA_ITEM_FLAGS PICKED_ITEMS_LIST::GetPickerFlags ( unsigned  aIdx) const

Return the value of the picker flag.

Parameters
aIdxIndex of the picker in the picked list.
Returns
The value stored in the picker, if the picker exists, or 0 if does not exist.

Definition at line 207 of file undo_redo_container.cpp.

References m_ItemsList.

Referenced by SCH_EDIT_FRAME::PutDataInPreviousState().

◆ GetScreenForItem()

BASE_SCREEN * PICKED_ITEMS_LIST::GetScreenForItem ( unsigned int  aIdx) const
Returns
A pointer to the picked item's screen.
Parameters
aIdxIndex of the picked item in the picked list.

Definition at line 180 of file undo_redo_container.cpp.

References m_ItemsList.

Referenced by SCH_EDIT_FRAME::PutDataInPreviousState(), and SCH_EDIT_FRAME::RecalculateConnections().

◆ PopItem()

◆ PushItem()

◆ RemovePicker()

bool PICKED_ITEMS_LIST::RemovePicker ( unsigned  aIdx)

Remove one entry (one picker) from the list of picked items.

Parameters
aIdxIndex of the picker in the picked list.
Returns
True if ok or false if did not exist.

Definition at line 298 of file undo_redo_container.cpp.

References m_ItemsList.

Referenced by PCB_BASE_EDIT_FRAME::PutDataInPreviousState().

◆ ReversePickersListOrder()

void PICKED_ITEMS_LIST::ReversePickersListOrder ( )

Reverse the order of pickers stored in this list.

This is useful when pop a list from Undo to Redo (and vice-versa) because sometimes undo (or redo) a command needs to keep the order of successive changes. Obviously, undo and redo are in reverse order

Definition at line 314 of file undo_redo_container.cpp.

References m_ItemsList.

Referenced by SCH_EDITOR_CONTROL::Redo(), PCB_BASE_EDIT_FRAME::RestoreCopyFromRedoList(), PCB_BASE_EDIT_FRAME::RestoreCopyFromUndoList(), and SCH_EDITOR_CONTROL::Undo().

◆ SetDescription()

◆ SetPickedItem() [1/2]

bool PICKED_ITEMS_LIST::SetPickedItem ( EDA_ITEM aItem,
UNDO_REDO  aStatus,
unsigned  aIdx 
)
Parameters
aItemA pointer to the item to pick.
aStatusThe type of undo/redo operation associated to the item to pick.
aIdxIndex of the picker in the picked list.
Returns
True if the picker exists or false if does not exist.

Definition at line 261 of file undo_redo_container.cpp.

References m_ItemsList.

◆ SetPickedItem() [2/2]

bool PICKED_ITEMS_LIST::SetPickedItem ( EDA_ITEM aItem,
unsigned  aIdx 
)
Parameters
aItemA pointer to the item to pick.
aIdxIndex of the picker in the picked list.
Returns
True if the picker exists or false if does not exist.

Definition at line 237 of file undo_redo_container.cpp.

References m_ItemsList.

◆ SetPickedItemGroupId()

bool PICKED_ITEMS_LIST::SetPickedItemGroupId ( KIID  aId,
unsigned  aIdx 
)

Set the group id associated to a given picked item.

Parameters
aIdis the group id to associate to the picked item.
aIdxis index of the picker in the picked list.
Returns
true if the picker exists, or false if does not exist.

Definition at line 225 of file undo_redo_container.cpp.

References m_ItemsList.

Referenced by PCB_BASE_EDIT_FRAME::PutDataInPreviousState().

◆ SetPickedItemLink()

bool PICKED_ITEMS_LIST::SetPickedItemLink ( EDA_ITEM aLink,
unsigned  aIdx 
)

Set the link associated to a given picked item.

Parameters
aLinkis the link to the item associated to the picked item.
aIdxis index of the picker in the picked list.
Returns
true if the picker exists, or false if does not exist.

Definition at line 249 of file undo_redo_container.cpp.

References m_ItemsList.

Referenced by SCH_EDIT_FRAME::SaveCopyInUndoList(), and PCB_BASE_EDIT_FRAME::saveCopyInUndoList().

◆ SetPickedItemStatus()

bool PICKED_ITEMS_LIST::SetPickedItemStatus ( UNDO_REDO  aStatus,
unsigned  aIdx 
)

Set the type of undo/redo operation for a given picked item.

Parameters
aStatusThe type of undo/redo operation associated to the picked item
aIdxIndex of the picker in the picked list
Returns
True if the picker exists or false if does not exist

Definition at line 274 of file undo_redo_container.cpp.

References m_ItemsList.

Referenced by SCH_EDIT_FRAME::PutDataInPreviousState(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_FRAME::SaveCopyInUndoList(), and PCB_BASE_EDIT_FRAME::saveCopyInUndoList().

◆ SetPickerFlags()

bool PICKED_ITEMS_LIST::SetPickerFlags ( EDA_ITEM_FLAGS  aFlags,
unsigned  aIdx 
)

Set the flags of the picker (usually to the picked item m_flags value).

Parameters
aFlagsThe flag value to save in picker.
aIdxIndex of the picker in the picked list.
Returns
True if the picker exists or false if does not exist.

Definition at line 286 of file undo_redo_container.cpp.

References m_ItemsList.

Member Data Documentation

◆ m_description

wxString PICKED_ITEMS_LIST::m_description
private

Definition at line 320 of file undo_redo_container.h.

Referenced by GetDescription(), and SetDescription().

◆ m_ItemsList


The documentation for this class was generated from the following files: