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 SCH_COMMIT

Classes

struct  COMMIT_LINE
 

Public Member Functions

 COMMIT ()
 
virtual ~COMMIT ()
 Add a new item to the model.
 
COMMITAdd (EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
 Notify observers that aItem has been added.
 
COMMITAdded (EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
 Remove a new item from the model.
 
COMMITRemove (EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
 Notify observers that aItem has been removed.
 
COMMITRemoved (EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
 Modify a given item in the model.
 
COMMITModify (EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
 Create an undo entry for an item that has been already modified.
 
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.
 
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.
 
virtual void Push (const wxString &aMessage=wxT("A commit"), int aFlags=0)=0
 Revert the commit by restoring the modified items state.
 
virtual void Revert ()=0
 
bool Empty () const
 Returns status of an item.
 
int GetStatus (EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
 
EDA_ITEMGetFirst () const
 

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.
 
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::set< EDA_ITEM * > m_deletedItems
 
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 73 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()

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

Notify observers that aItem has been added.

Definition at line 80 of file commit.h.

References CHT_ADD, and Stage().

Referenced by PCB_POINT_EDITOR::addCorner(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), BOARD_NETLIST_UPDATER::addNewFootprint(), RULE_AREA_CREATE_HELPER::commitRuleArea(), ZONE_CREATE_HELPER::commitZone(), CONVERT_TOOL::CreatePolys(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawBoardCharacteristics(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawLine(), DRAWING_TOOL::DrawRectangle(), SCH_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::drawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawSpecificationStackup(), SCH_DRAWING_TOOLS::DrawTable(), DRAWING_TOOL::DrawTable(), DRAWING_TOOL::DrawVia(), EDIT_TOOL::Duplicate(), PCB_TUNING_PATTERN::EditPush(), PCB_TUNING_PATTERN::EditStart(), PCB_EDIT_FRAME::ExchangeFootprint(), PAD_TOOL::explodePad(), EDIT_TOOL::FilletTracks(), GRAPHICS_CLEANER::fixBoardOutlines(), GROUP_TOOL::Group(), API_HANDLER_SCH::handleCreateUpdateItemsInternal(), API_HANDLER_PCB::handleCreateUpdateItemsInternal(), SCH_DRAWING_TOOLS::ImportGraphics(), DRAWING_TOOL::InteractivePlaceWithPreview(), ARRAY_CREATOR::Invoke(), PCBNEW_JOBS_HANDLER::JobExportDrc(), EE_SELECTION_TOOL::Main(), GRAPHICS_CLEANER::mergeRects(), ZONE_CREATE_HELPER::performZoneCutout(), PCB_CONTROL::placeBoardItems(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), INTERACTIVE_PLACER_BASE::PlaceItem(), PAD_TOOL::PlacePad(), DRAWING_TOOL::PlaceText(), BACK_ANNOTATE::processNetNameChange(), PCB_TUNING_PATTERN::Remove(), PCB_EDIT_FRAME::ResolveDRCExclusions(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), BOARD_NETLIST_UPDATER::updateComponentPadConnections(), and BOARD_EDITOR_CONTROL::ZoneDuplicate().

◆ Added()

◆ clear()

◆ convert() [1/2]

UNDO_REDO COMMIT::convert ( CHANGE_TYPE  aType) const
protected

Definition at line 196 of file commit.cpp.

References CHT_ADD, CHT_GROUP, CHT_MODIFY, CHT_REMOVE, and CHT_UNGROUP.

◆ convert() [2/2]

CHANGE_TYPE COMMIT::convert ( UNDO_REDO  aType) const
protected

Definition at line 182 of file commit.cpp.

References CHT_ADD, CHT_GROUP, CHT_MODIFY, CHT_REMOVE, and CHT_UNGROUP.

◆ createModified()

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

Definition at line 137 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 170 of file commit.cpp.

References m_changes.

Referenced by GetStatus().

◆ GetFirst()

EDA_ITEM * COMMIT::GetFirst ( ) const
inline

Definition at line 152 of file commit.h.

References m_changes.

◆ GetStatus()

◆ 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 SCH_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 105 of file commit.h.

References CHT_MODIFY, and Stage().

Referenced by EE_POINT_EDITOR::addCorner(), PCB_POINT_EDITOR::addCorner(), SYMBOL_EDITOR_MOVE_TOOL::AlignElements(), SCH_MOVE_TOOL::AlignToGrid(), SCH_EDIT_FRAME::AnnotateSymbols(), BACK_ANNOTATE::applyChangelist(), SCH_EDIT_TOOL::AutoplaceFields(), AR_AUTOPLACER::AutoplaceFootprints(), SCH_EDIT_FRAME::BreakSegment(), SCH_EDIT_TOOL::ChangeBodyStyle(), EDIT_TOOL::ChangeTrackWidth(), SCH_EDIT_TOOL::CleanupSheetPins(), SCH_EDIT_FRAME::DeleteAnnotation(), EDIT_TOOL::DeleteItems(), SCH_EDIT_TOOL::DoDelete(), SYMBOL_EDITOR_EDIT_TOOL::DoDelete(), SYMBOL_EDITOR_DRAWING_TOOLS::doDrawShape(), EDIT_TOOL::doMoveSelection(), SYMBOL_EDITOR_MOVE_TOOL::doMoveSelection(), SCH_MOVE_TOOL::doMoveSelection(), doPushPadProperties(), SCH_DRAWING_TOOLS::doSyncSheetsPins(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::DrawVia(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PCB_EDIT_FRAME::Edit_Zone_Params(), SYMBOL_EDITOR_EDIT_TOOL::editFieldProperties(), SCH_EDIT_TOOL::editFieldText(), PAD_TOOL::EditPad(), SYMBOL_EDITOR_PIN_TOOL::EditPinProperties(), PCB_GENERATOR::EditStart(), PCB_TUNING_PATTERN::EditStart(), PAD_TOOL::EnumeratePads(), ZONE_FILLER::Fill(), EDIT_TOOL::FilletTracks(), GRAPHICS_CLEANER::fixBoardOutlines(), EDIT_TOOL::Flip(), SCH_EDIT_FRAME::FlipBodyStyle(), GENERATOR_TOOL::GENERATOR_TOOL(), SCH_MOVE_TOOL::getConnectedDragItems(), API_HANDLER_SCH::handleCreateUpdateItemsInternal(), API_HANDLER_PCB::handleCreateUpdateItemsInternal(), SYMBOL_EDITOR_DRAWING_TOOLS::ImportGraphics(), ARRAY_CREATOR::Invoke(), SCH_EDIT_TOOL::JustifyText(), EDIT_TOOL::JustifyText(), EE_POINT_EDITOR::Main(), TRACKS_CLEANER::mergeCollinearSegments(), GRAPHICS_CLEANER::mergePads(), mergeZones(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::Mirror(), BOARD_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), DIALOG_UPDATE_SYMBOL_FIELDS::onOkButtonClicked(), PCB_POINT_EDITOR::OnSelectionChange(), HIERARCHY_PANE::onTreeEditFinished(), SCH_MOVE_TOOL::orthoLineDrag(), EDIT_TOOL::PackAndMoveFootprints(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), PAD_TOOL::pastePadProperties(), SYMBOL_EDITOR_EDIT_TOOL::PinTable(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), BACK_ANNOTATE::processNetNameChange(), CN_CONNECTIVITY_ALGO::propagateConnections(), SCH_EDIT_TOOL::Properties(), DIALOG_BOARD_REANNOTATE::ReannotateBoard(), EE_POINT_EDITOR::removeCorner(), PCB_POINT_EDITOR::removeCorner(), HIERARCHY_PANE::renameIdenticalSheets(), SCH_EDIT_TOOL::Rotate(), SYMBOL_EDITOR_EDIT_TOOL::Rotate(), EDIT_TOOL::Rotate(), SCH_EDIT_FRAME::SaveSymbolToSchematic(), SCHEMATIC::SCHEMATIC(), SCH_EDIT_FRAME::SelectUnit(), SCH_EDIT_FRAME::SetAltPinFunction(), DRAWING_TOOL::SetAnchor(), SCH_EDIT_TOOL::SetAttribute(), PCB_TUNING_PATTERN::ShowPropertiesDialog(), EDIT_TOOL::Swap(), SCH_EDIT_TOOL::ToggleAttribute(), BOARD_EDITOR_CONTROL::TrackWidthDec(), BOARD_EDITOR_CONTROL::TrackWidthInc(), DIALOG_IMAGE_PROPERTIES::TransferDataFromWindow(), DIALOG_JUNCTION_PROPS::TransferDataFromWindow(), DIALOG_LABEL_PROPERTIES::TransferDataFromWindow(), DIALOG_LINE_PROPERTIES::TransferDataFromWindow(), DIALOG_SHAPE_PROPERTIES::TransferDataFromWindow(), DIALOG_SHEET_PIN_PROPERTIES::TransferDataFromWindow(), DIALOG_SHEET_PROPERTIES::TransferDataFromWindow(), DIALOG_SYMBOL_FIELDS_TABLE::TransferDataFromWindow(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_TABLE_PROPERTIES::TransferDataFromWindow(), DIALOG_TABLECELL_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_WIRE_BUS_PROPERTIES::TransferDataFromWindow(), DIALOG_DIMENSION_PROPERTIES::TransferDataFromWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataFromWindow(), DIALOG_GROUP_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXTBOX_PROPERTIES::TransferDataFromWindow(), DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_EDIT_TOOL::UnsetAttribute(), BOARD_NETLIST_UPDATER::updateCopperZoneNets(), DIALOG_FIELD_PROPERTIES::UpdateField(), DIALOG_UNUSED_PAD_LAYERS::updatePadsAndVias(), SCH_PROPERTIES_PANEL::valueChanged(), PCB_PROPERTIES_PANEL::valueChanged(), BOARD_EDITOR_CONTROL::ViaSizeDec(), BOARD_EDITOR_CONTROL::ViaSizeInc(), GLOBAL_EDIT_TOOL::ZonesManager(), ZONE_FILLER_TOOL::ZoneUnfill(), and ZONE_FILLER_TOOL::ZoneUnfillAll().

◆ parentObject()

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

Implemented in SCH_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 BOARD_COMMIT, and SCH_COMMIT.

Referenced by DIALOG_UNUSED_PAD_LAYERS::updatePadsAndVias().

◆ Remove()

◆ Removed()

◆ Revert()

virtual void COMMIT::Revert ( )
pure virtual

Implemented in SCH_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 SCH_COMMIT, and BOARD_COMMIT.

Definition at line 92 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 119 of file commit.h.

References Stage().

Member Data Documentation

◆ m_changedItems

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

Definition at line 193 of file commit.h.

Referenced by clear(), createModified(), and makeEntry().

◆ m_changes

◆ m_deletedItems

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

Definition at line 194 of file commit.h.

Referenced by clear(), and Stage().


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