KiCad PCB EDA Suite
Loading...
Searching...
No Matches
COMMIT Class Referenceabstract

Represent a set of changes (additions, deletions or modifications) of a data model (e.g. More...

#include <commit.h>

Inheritance diagram for COMMIT:
BOARD_COMMIT SCHEMATIC_COMMIT

Classes

struct  COMMIT_LINE
 

Public Member Functions

 COMMIT ()
 
virtual ~COMMIT ()
 Add a new item to the model. More...
 
COMMITAdd (EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
 Notify observers that aItem has been added. More...
 
COMMITAdded (EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
 Remove a new item from the model. More...
 
COMMITRemove (EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
 Notify observers that aItem has been removed. More...
 
COMMITRemoved (EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
 Modify a given item in the model. More...
 
COMMITModify (EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
 Create an undo entry for an item that has been already modified. More...
 
COMMITModified (EDA_ITEM *aItem, EDA_ITEM *aCopy, BASE_SCREEN *aScreen=nullptr)
 
template<class Range >
COMMITStageItems (const Range &aRange, CHANGE_TYPE aChangeType)
 Add a change of the item aItem of type aChangeType to the change list. More...
 
virtual COMMITStage (EDA_ITEM *aItem, CHANGE_TYPE aChangeType, BASE_SCREEN *aScreen=nullptr)
 
virtual COMMITStage (std::vector< EDA_ITEM * > &container, CHANGE_TYPE aChangeType, BASE_SCREEN *aScreen=nullptr)
 
virtual COMMITStage (const PICKED_ITEMS_LIST &aItems, UNDO_REDO aModFlag=UNDO_REDO::UNSPECIFIED, BASE_SCREEN *aScreen=nullptr)
 Execute the changes. More...
 
virtual void Push (const wxString &aMessage=wxT("A commit"), int aFlags=0)=0
 Revert the commit by restoring the modified items state. More...
 
virtual void Revert ()=0
 
bool Empty () const
 Returns status of an item. More...
 
int GetStatus (EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
 

Protected Member Functions

void clear ()
 
COMMITcreateModified (EDA_ITEM *aItem, EDA_ITEM *aCopy, int aExtraFlags=0, BASE_SCREEN *aScreen=nullptr)
 
virtual void makeEntry (EDA_ITEM *aItem, CHANGE_TYPE aType, EDA_ITEM *aCopy=nullptr, BASE_SCREEN *aScreen=nullptr)
 
COMMIT_LINEfindEntry (EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
 Search for an entry describing change for a particular item. More...
 
virtual EDA_ITEMparentObject (EDA_ITEM *aItem) const =0
 
virtual EDA_ITEMmakeImage (EDA_ITEM *aItem) const =0
 
CHANGE_TYPE convert (UNDO_REDO aType) const
 
UNDO_REDO convert (CHANGE_TYPE aType) const
 

Protected Attributes

std::set< EDA_ITEM * > m_changedItems
 
std::vector< COMMIT_LINEm_changes
 

Detailed Description

Represent a set of changes (additions, deletions or modifications) of a data model (e.g.

the BOARD) class.

The class can be used to propagate changes to subscribed objects (e.g. views, ratsnest), and automatically create undo/redo points.

Definition at line 72 of file commit.h.

Constructor & Destructor Documentation

◆ COMMIT()

COMMIT::COMMIT ( )

Definition at line 33 of file commit.cpp.

◆ ~COMMIT()

COMMIT::~COMMIT ( )
virtual

Add a new item to the model.

Definition at line 38 of file commit.cpp.

References m_changes.

Member Function Documentation

◆ Add()

◆ Added()

COMMIT & COMMIT::Added ( EDA_ITEM aItem,
BASE_SCREEN aScreen = nullptr 
)
inline

Remove a new item from the model.

Definition at line 85 of file commit.h.

References CHT_ADD, CHT_DONE, and Stage().

Referenced by TEARDROP_MANAGER::AddTeardropsOnTracks(), PCB_EDIT_FRAME::RunActionPlugin(), and TEARDROP_MANAGER::UpdateTeardrops().

◆ clear()

◆ convert() [1/2]

UNDO_REDO COMMIT::convert ( CHANGE_TYPE  aType) const
protected

Definition at line 206 of file commit.cpp.

References CHT_ADD, CHT_MODIFY, CHT_REMOVE, and KI_FALLTHROUGH.

◆ convert() [2/2]

CHANGE_TYPE COMMIT::convert ( UNDO_REDO  aType) const
protected

Definition at line 186 of file commit.cpp.

References CHT_ADD, CHT_MODIFY, CHT_REMOVE, and KI_FALLTHROUGH.

◆ createModified()

COMMIT & COMMIT::createModified ( EDA_ITEM aItem,
EDA_ITEM aCopy,
int  aExtraFlags = 0,
BASE_SCREEN aScreen = nullptr 
)
protected

Definition at line 132 of file commit.cpp.

References CHT_MODIFY, m_changedItems, makeEntry(), and parentObject().

Referenced by Modified(), and Stage().

◆ Empty()

bool COMMIT::Empty ( ) const
inline

◆ findEntry()

COMMIT::COMMIT_LINE * COMMIT::findEntry ( EDA_ITEM aItem,
BASE_SCREEN aScreen = nullptr 
)
protected

Search for an entry describing change for a particular item.

Returns
null if there is no related entry.

Definition at line 174 of file commit.cpp.

References m_changes.

Referenced by GetStatus().

◆ GetStatus()

int COMMIT::GetStatus ( EDA_ITEM aItem,
BASE_SCREEN aScreen = nullptr 
)

◆ makeEntry()

void COMMIT::makeEntry ( EDA_ITEM aItem,
CHANGE_TYPE  aType,
EDA_ITEM aCopy = nullptr,
BASE_SCREEN aScreen = nullptr 
)
protectedvirtual

◆ makeImage()

virtual EDA_ITEM * COMMIT::makeImage ( EDA_ITEM aItem) const
protectedpure virtual

Implemented in SCHEMATIC_COMMIT, and BOARD_COMMIT.

Referenced by Stage().

◆ Modified()

COMMIT & COMMIT::Modified ( EDA_ITEM aItem,
EDA_ITEM aCopy,
BASE_SCREEN aScreen = nullptr 
)
inline

◆ Modify()

COMMIT & COMMIT::Modify ( EDA_ITEM aItem,
BASE_SCREEN aScreen = nullptr 
)
inline

Create an undo entry for an item that has been already modified.

Requires a copy done before the modification.

Definition at line 104 of file commit.h.

References CHT_MODIFY, and Stage().

Referenced by PCB_POINT_EDITOR::addCorner(), AR_AUTOPLACER::AutoplaceFootprints(), SCH_EDIT_FRAME::DeleteAnnotation(), doPushPadProperties(), DRAWING_TOOL::DrawVia(), PAD_TOOL::EnumeratePads(), PAD_TOOL::explodePad(), ZONE_FILLER::Fill(), ARRAY_CREATOR::Invoke(), TRACKS_CLEANER::mergeCollinearSegments(), mergeZones(), BOARD_EDITOR_CONTROL::modifyLockSelected(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), PAD_TOOL::pastePadProperties(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), CN_CONNECTIVITY_ALGO::propagateConnections(), DIALOG_BOARD_REANNOTATE::ReannotateBoard(), PAD_TOOL::RecombinePad(), PCB_POINT_EDITOR::removeCorner(), GROUP_TOOL::RemoveFromGroup(), DRAWING_TOOL::SetAnchor(), SCH_EDIT_TOOL::SetAttribute(), SCH_EDIT_TOOL::ToggleAttribute(), BOARD_EDITOR_CONTROL::TrackWidthDec(), BOARD_EDITOR_CONTROL::TrackWidthInc(), DIALOG_DIMENSION_PROPERTIES::TransferDataFromWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataFromWindow(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow(), DIALOG_GROUP_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXTBOX_PROPERTIES::TransferDataFromWindow(), DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow(), SCH_EDIT_TOOL::UnsetAttribute(), BOARD_NETLIST_UPDATER::updateCopperZoneNets(), DIALOG_UNUSED_PAD_LAYERS::updatePadsAndVias(), PCB_PROPERTIES_PANEL::valueChanged(), BOARD_EDITOR_CONTROL::ViaSizeDec(), BOARD_EDITOR_CONTROL::ViaSizeInc(), ZONE_FILLER_TOOL::ZoneUnfill(), and ZONE_FILLER_TOOL::ZoneUnfillAll().

◆ parentObject()

virtual EDA_ITEM * COMMIT::parentObject ( EDA_ITEM aItem) const
protectedpure virtual

Implemented in SCHEMATIC_COMMIT, and BOARD_COMMIT.

Referenced by createModified(), GetStatus(), and Stage().

◆ Push()

virtual void COMMIT::Push ( const wxString &  aMessage = wxT("A commit"),
int  aFlags = 0 
)
pure virtual

Revert the commit by restoring the modified items state.

Implemented in SCHEMATIC_COMMIT, and BOARD_COMMIT.

Referenced by DIALOG_UNUSED_PAD_LAYERS::updatePadsAndVias().

◆ Remove()

◆ Removed()

COMMIT & COMMIT::Removed ( EDA_ITEM aItem,
BASE_SCREEN aScreen = nullptr 
)
inline

◆ Revert()

virtual void COMMIT::Revert ( )
pure virtual

Implemented in SCHEMATIC_COMMIT, and BOARD_COMMIT.

◆ Stage() [1/3]

COMMIT & COMMIT::Stage ( const PICKED_ITEMS_LIST aItems,
UNDO_REDO  aModFlag = UNDO_REDO::UNSPECIFIED,
BASE_SCREEN aScreen = nullptr 
)
virtual

◆ Stage() [2/3]

COMMIT & COMMIT::Stage ( EDA_ITEM aItem,
CHANGE_TYPE  aChangeType,
BASE_SCREEN aScreen = nullptr 
)
virtual

◆ Stage() [3/3]

COMMIT & COMMIT::Stage ( std::vector< EDA_ITEM * > &  container,
CHANGE_TYPE  aChangeType,
BASE_SCREEN aScreen = nullptr 
)
virtual

Reimplemented in SCHEMATIC_COMMIT, and BOARD_COMMIT.

Definition at line 87 of file commit.cpp.

References Stage().

◆ StageItems()

template<class Range >
COMMIT & COMMIT::StageItems ( const Range &  aRange,
CHANGE_TYPE  aChangeType 
)
inline

Add a change of the item aItem of type aChangeType to the change list.

Definition at line 118 of file commit.h.

References Stage().

Referenced by PCB_POINT_EDITOR::OnSelectionChange().

Member Data Documentation

◆ m_changedItems

std::set<EDA_ITEM*> COMMIT::m_changedItems
protected

Definition at line 188 of file commit.h.

Referenced by clear(), createModified(), makeEntry(), Stage(), and BOARD_COMMIT::Stage().

◆ m_changes


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