KiCad PCB EDA Suite
|
Represent a set of changes (additions, deletions or modifications) of a data model (e.g. More...
#include <commit.h>
Classes | |
struct | COMMIT_LINE |
Public Member Functions | |
COMMIT () | |
virtual | ~COMMIT () |
Add a new item to the model. More... | |
COMMIT & | Add (EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr) |
Notify observers that aItem has been added. More... | |
COMMIT & | Added (EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr) |
Remove a new item from the model. More... | |
COMMIT & | Remove (EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr) |
Notify observers that aItem has been removed. More... | |
COMMIT & | Removed (EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr) |
Modify a given item in the model. More... | |
COMMIT & | Modify (EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr) |
Create an undo entry for an item that has been already modified. More... | |
COMMIT & | Modified (EDA_ITEM *aItem, EDA_ITEM *aCopy, BASE_SCREEN *aScreen=nullptr) |
template<class Range > | |
COMMIT & | StageItems (const Range &aRange, CHANGE_TYPE aChangeType) |
Add a change of the item aItem of type aChangeType to the change list. More... | |
virtual COMMIT & | Stage (EDA_ITEM *aItem, CHANGE_TYPE aChangeType, BASE_SCREEN *aScreen=nullptr) |
virtual COMMIT & | Stage (std::vector< EDA_ITEM * > &container, CHANGE_TYPE aChangeType, BASE_SCREEN *aScreen=nullptr) |
virtual COMMIT & | Stage (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 () |
COMMIT & | createModified (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_LINE * | findEntry (EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr) |
Search for an entry describing change for a particular item. More... | |
virtual EDA_ITEM * | parentObject (EDA_ITEM *aItem) const =0 |
virtual EDA_ITEM * | makeImage (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_LINE > | m_changes |
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.
COMMIT::COMMIT | ( | ) |
Definition at line 33 of file commit.cpp.
|
virtual |
|
inline |
Notify observers that aItem has been added.
Definition at line 79 of file commit.h.
References CHT_ADD, and Stage().
Referenced by PCB_GROUP::AddChildrenToCommit(), PCB_POINT_EDITOR::addCorner(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), BOARD_NETLIST_UPDATER::addNewFootprint(), ZONE_CREATE_HELPER::commitZone(), MICROWAVE_TOOL::createInductorBetween(), CONVERT_TOOL::CreatePolys(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawBoardCharacteristics(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawLine(), DRAWING_TOOL::DrawRectangle(), DRAWING_TOOL::drawShape(), DRAWING_TOOL::DrawSpecificationStackup(), DRAWING_TOOL::DrawVia(), PCB_EDIT_FRAME::ExchangeFootprint(), PAD_TOOL::explodePad(), DRAWING_TOOL::InteractivePlaceWithPreview(), ARRAY_CREATOR::Invoke(), GRAPHICS_CLEANER::mergeRects(), ZONE_CREATE_HELPER::performZoneCutout(), BOARD_EDITOR_CONTROL::PlaceFootprint(), DRAWING_TOOL::PlaceImportedGraphics(), INTERACTIVE_PLACER_BASE::PlaceItem(), PAD_TOOL::PlacePad(), DRAWING_TOOL::PlaceText(), PCB_EDIT_FRAME::ResolveDRCExclusions(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), BOARD_NETLIST_UPDATER::updateComponentPadConnections(), and BOARD_EDITOR_CONTROL::ZoneDuplicate().
|
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().
|
inlineprotected |
Definition at line 161 of file commit.h.
References m_changedItems, and m_changes.
Referenced by BOARD_COMMIT::Push(), SCHEMATIC_COMMIT::pushLibEdit(), SCHEMATIC_COMMIT::pushSchEdit(), SCHEMATIC_COMMIT::Revert(), BOARD_COMMIT::Revert(), and SCHEMATIC_COMMIT::revertLibEdit().
|
protected |
Definition at line 206 of file commit.cpp.
References CHT_ADD, CHT_MODIFY, CHT_REMOVE, and KI_FALLTHROUGH.
|
protected |
Definition at line 186 of file commit.cpp.
References CHT_ADD, CHT_MODIFY, CHT_REMOVE, and KI_FALLTHROUGH.
|
protected |
Definition at line 132 of file commit.cpp.
References CHT_MODIFY, m_changedItems, makeEntry(), and parentObject().
Referenced by Modified(), and Stage().
|
inline |
Returns status of an item.
Definition at line 143 of file commit.h.
References m_changes.
Referenced by DIALOG_CLEANUP_GRAPHICS::doCleanup(), DIALOG_CLEANUP_TRACKS_AND_VIAS::doCleanup(), BOARD_COMMIT::Push(), SCHEMATIC_COMMIT::pushLibEdit(), and SCHEMATIC_COMMIT::pushSchEdit().
|
protected |
Search for an entry describing change for a particular item.
Definition at line 174 of file commit.cpp.
References m_changes.
Referenced by GetStatus().
int COMMIT::GetStatus | ( | EDA_ITEM * | aItem, |
BASE_SCREEN * | aScreen = nullptr |
||
) |
Definition at line 124 of file commit.cpp.
References findEntry(), COMMIT::COMMIT_LINE::m_type, and parentObject().
Referenced by BOARD_NETLIST_UPDATER::updateComponentPadConnections(), and BOARD_NETLIST_UPDATER::updateFootprintParameters().
|
protectedvirtual |
Definition at line 149 of file commit.cpp.
References CHT_MODIFY, CHT_TYPE, alg::delete_if(), m_changedItems, m_changes, COMMIT::COMMIT_LINE::m_copy, COMMIT::COMMIT_LINE::m_item, COMMIT::COMMIT_LINE::m_screen, and COMMIT::COMMIT_LINE::m_type.
Referenced by createModified(), and Stage().
Implemented in SCHEMATIC_COMMIT, and BOARD_COMMIT.
Referenced by Stage().
|
inline |
Definition at line 111 of file commit.h.
References createModified().
Referenced by Stage(), BOARD_NETLIST_UPDATER::updateComponentPadConnections(), and BOARD_NETLIST_UPDATER::updateFootprintParameters().
|
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().
Implemented in SCHEMATIC_COMMIT, and BOARD_COMMIT.
Referenced by createModified(), GetStatus(), and Stage().
|
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().
|
inline |
Notify observers that aItem has been removed.
Definition at line 91 of file commit.h.
References CHT_REMOVE, and Stage().
Referenced by GRAPHICS_CLEANER::cleanupShapes(), CONVERT_TOOL::CreatePolys(), DIALOG_GLOBAL_DELETION::DoGlobalDeletions(), PCB_EDIT_FRAME::ExchangeFootprint(), GRAPHICS_CLEANER::mergeRects(), mergeZones(), ZONE_CREATE_HELPER::performZoneCutout(), PAD_TOOL::RecombinePad(), PCB_POINT_EDITOR::removeCorner(), and BOARD_NETLIST_UPDATER::UpdateNetlist().
|
inline |
Modify a given item in the model.
Must be called before modification is performed.
Definition at line 97 of file commit.h.
References CHT_DONE, CHT_REMOVE, and Stage().
Referenced by TRACKS_CLEANER::deleteDanglingTracks(), TEARDROP_MANAGER::DeleteTrackToTrackTeardrops(), TRACKS_CLEANER::mergeCollinearSegments(), TRACKS_CLEANER::removeItems(), PCB_EDIT_FRAME::RunActionPlugin(), BOARD_NETLIST_UPDATER::UpdateNetlist(), and TEARDROP_MANAGER::UpdateTeardrops().
|
pure virtual |
Implemented in SCHEMATIC_COMMIT, and BOARD_COMMIT.
|
virtual |
Execute the changes.
Reimplemented in SCHEMATIC_COMMIT, and BOARD_COMMIT.
Definition at line 97 of file commit.cpp.
References convert, copy, PICKED_ITEMS_LIST::GetCount(), PICKED_ITEMS_LIST::GetPickedItem(), PICKED_ITEMS_LIST::GetPickedItemLink(), PICKED_ITEMS_LIST::GetPickedItemStatus(), Modified(), and Stage().
|
virtual |
Reimplemented in SCHEMATIC_COMMIT, and BOARD_COMMIT.
Definition at line 48 of file commit.cpp.
References CHT_ADD, CHT_DONE, CHT_FLAGS, CHT_MODIFY, CHT_REMOVE, CHT_TYPE, createModified(), flag, m_changedItems, makeEntry(), makeImage(), and parentObject().
Referenced by Add(), Added(), Modify(), Remove(), Removed(), SCHEMATIC_COMMIT::Stage(), BOARD_COMMIT::Stage(), Stage(), and StageItems().
|
virtual |
Reimplemented in SCHEMATIC_COMMIT, and BOARD_COMMIT.
Definition at line 87 of file commit.cpp.
References Stage().
|
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().
|
protected |
Definition at line 188 of file commit.h.
Referenced by clear(), createModified(), makeEntry(), Stage(), and BOARD_COMMIT::Stage().
|
protected |
Definition at line 189 of file commit.h.
Referenced by clear(), Empty(), findEntry(), makeEntry(), BOARD_COMMIT::Push(), SCHEMATIC_COMMIT::pushLibEdit(), SCHEMATIC_COMMIT::pushSchEdit(), SCHEMATIC_COMMIT::Revert(), BOARD_COMMIT::Revert(), SCHEMATIC_COMMIT::revertLibEdit(), and ~COMMIT().