![]() |
KiCad PCB EDA Suite
|
#include <board_commit.h>
Public Member Functions | |
BOARD_COMMIT (TOOL_MANAGER *aToolMgr) | |
BOARD_COMMIT (EDA_DRAW_FRAME *aFrame) | |
BOARD_COMMIT (PCB_TOOL_BASE *aTool) | |
virtual | ~BOARD_COMMIT () |
BOARD * | GetBoard () const |
virtual void | Push (const wxString &aMessage=wxT("A commit"), bool aCreateUndoEntry=true, bool aSetDirtyBit=true) override |
Revert the commit by restoring the modified items state. More... | |
virtual void | Revert () override |
COMMIT & | Stage (EDA_ITEM *aItem, CHANGE_TYPE aChangeType) override |
COMMIT & | Stage (std::vector< EDA_ITEM * > &container, CHANGE_TYPE aChangeType) override |
COMMIT & | Stage (const PICKED_ITEMS_LIST &aItems, UNDO_REDO aModFlag=UNDO_REDO::UNSPECIFIED) override |
Execute the changes. More... | |
void | SetResolveNetConflicts (bool aResolve=true) |
Sets a flag that will cause Push() to resolve net conflicts on track/via clusters instead of the default behavior which is to skip updating track/via clusters that have conflicts. More... | |
COMMIT & | Add (EDA_ITEM *aItem) |
Notify observers that aItem has been added. More... | |
COMMIT & | Added (EDA_ITEM *aItem) |
Remove a new item from the model. More... | |
COMMIT & | Remove (EDA_ITEM *aItem) |
Notify observers that aItem has been removed. More... | |
COMMIT & | Removed (EDA_ITEM *aItem) |
Modify a given item in the model. More... | |
COMMIT & | Modify (EDA_ITEM *aItem) |
Create an undo entry for an item that has been already modified. More... | |
COMMIT & | Modified (EDA_ITEM *aItem, EDA_ITEM *aCopy) |
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... | |
bool | Empty () const |
Returns status of an item. More... | |
int | GetStatus (EDA_ITEM *aItem) |
Protected Member Functions | |
void | clear () |
COMMIT & | createModified (EDA_ITEM *aItem, EDA_ITEM *aCopy, int aExtraFlags=0) |
virtual void | makeEntry (EDA_ITEM *aItem, CHANGE_TYPE aType, EDA_ITEM *aCopy=nullptr) |
COMMIT_LINE * | findEntry (EDA_ITEM *aItem) |
Search for an entry describing change for a particular item. More... | |
CHANGE_TYPE | convert (UNDO_REDO aType) const |
Protected Attributes | |
std::set< EDA_ITEM * > | m_changedItems |
std::vector< COMMIT_LINE > | m_changes |
Private Member Functions | |
virtual EDA_ITEM * | parentObject (EDA_ITEM *aItem) const override |
Private Attributes | |
TOOL_MANAGER * | m_toolMgr |
bool | m_isFootprintEditor |
bool | m_resolveNetConflicts |
Definition at line 38 of file board_commit.h.
BOARD_COMMIT::BOARD_COMMIT | ( | TOOL_MANAGER * | aToolMgr | ) |
Definition at line 40 of file board_commit.cpp.
BOARD_COMMIT::BOARD_COMMIT | ( | EDA_DRAW_FRAME * | aFrame | ) |
Definition at line 56 of file board_commit.cpp.
References FRAME_FOOTPRINT_EDITOR, TOOLS_HOLDER::GetToolManager(), EDA_BASE_FRAME::IsType(), m_isFootprintEditor, and m_toolMgr.
BOARD_COMMIT::BOARD_COMMIT | ( | PCB_TOOL_BASE * | aTool | ) |
Definition at line 48 of file board_commit.cpp.
References TOOL_BASE::GetManager(), PCB_TOOL_BASE::IsFootprintEditor(), m_isFootprintEditor, and m_toolMgr.
|
virtual |
Definition at line 64 of file board_commit.cpp.
Notify observers that aItem has been added.
Definition at line 78 of file commit.h.
References CHT_ADD, and COMMIT::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::CreateLines(), CONVERT_TOOL::CreatePolys(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawBoardCharacteristics(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawLine(), DRAWING_TOOL::DrawRectangle(), DRAWING_TOOL::drawSegment(), 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(), CONVERT_TOOL::SegmentToArc(), BOARD_NETLIST_UPDATER::updateComponentPadConnections(), and BOARD_EDITOR_CONTROL::ZoneDuplicate().
Remove a new item from the model.
Definition at line 84 of file commit.h.
References CHT_ADD, CHT_DONE, and COMMIT::Stage().
Referenced by PCB_EDIT_FRAME::RunActionPlugin().
|
inlineprotectedinherited |
|
protectedinherited |
Definition at line 192 of file commit.cpp.
References CHANGED, CHT_ADD, CHT_MODIFY, CHT_REMOVE, DELETED, KI_FALLTHROUGH, and NEWITEM.
Referenced by COMMIT::Stage().
|
protectedinherited |
Definition at line 139 of file commit.cpp.
References CHT_MODIFY, COMMIT::m_changedItems, COMMIT::makeEntry(), and COMMIT::parentObject().
Referenced by COMMIT::Modified(), and COMMIT::Stage().
|
inlineinherited |
Returns status of an item.
Definition at line 140 of file commit.h.
References COMMIT::m_changes.
Referenced by DIALOG_CLEANUP_GRAPHICS::doCleanup(), DIALOG_CLEANUP_TRACKS_AND_VIAS::doCleanup(), and Push().
|
protectedinherited |
Search for an entry describing change for a particular item.
Definition at line 180 of file commit.cpp.
References COMMIT::m_changes.
Referenced by COMMIT::GetStatus().
BOARD * BOARD_COMMIT::GetBoard | ( | ) | const |
Definition at line 69 of file board_commit.cpp.
References TOOL_MANAGER::GetModel(), and m_toolMgr.
Referenced by GRAPHICS_CLEANER::CleanupBoard().
|
inherited |
Definition at line 131 of file commit.cpp.
References COMMIT::findEntry(), COMMIT::COMMIT_LINE::m_type, and COMMIT::parentObject().
Referenced by BOARD_NETLIST_UPDATER::updateComponentPadConnections(), and BOARD_NETLIST_UPDATER::updateFootprintParameters().
|
protectedvirtualinherited |
Definition at line 156 of file commit.cpp.
References CHT_MODIFY, CHT_TYPE, alg::delete_if(), COMMIT::m_changedItems, COMMIT::m_changes, COMMIT::COMMIT_LINE::m_copy, COMMIT::COMMIT_LINE::m_item, and COMMIT::COMMIT_LINE::m_type.
Referenced by COMMIT::createModified(), and COMMIT::Stage().
Definition at line 110 of file commit.h.
References COMMIT::createModified().
Referenced by COMMIT::Stage(), BOARD_NETLIST_UPDATER::updateComponentPadConnections(), and BOARD_NETLIST_UPDATER::updateFootprintParameters().
Create an undo entry for an item that has been already modified.
Requires a copy done before the modification.
Definition at line 103 of file commit.h.
References CHT_MODIFY, and COMMIT::Stage().
Referenced by PCB_POINT_EDITOR::addCorner(), AR_AUTOPLACER::AutoplaceFootprints(), 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(), BOARD_EDITOR_CONTROL::TrackWidthDec(), BOARD_EDITOR_CONTROL::TrackWidthInc(), DIALOG_UNUSED_PAD_LAYERS::TransferDataFromWindow(), DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow(), DIALOG_DIMENSION_PROPERTIES::TransferDataFromWindow(), DIALOG_GROUP_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataFromWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), BOARD_NETLIST_UPDATER::updateCopperZoneNets(), BOARD_EDITOR_CONTROL::ViaSizeDec(), BOARD_EDITOR_CONTROL::ViaSizeInc(), ZONE_FILLER_TOOL::ZoneUnfill(), and ZONE_FILLER_TOOL::ZoneUnfillAll().
Implements COMMIT.
Definition at line 442 of file board_commit.cpp.
References EDA_ITEM::GetParent(), PCB_FP_SHAPE_T, PCB_FP_TEXT_T, PCB_FP_ZONE_T, PCB_PAD_T, PCB_ZONE_T, and EDA_ITEM::Type().
|
overridevirtual |
Revert the commit by restoring the modified items state.
Implements COMMIT.
Definition at line 103 of file board_commit.cpp.
References KIGFX::VIEW::Add(), BOARD::Add(), AS_GLOBAL, BULK, BULK_INSERT, CHANGED, CHT_ADD, CHT_DONE, CHT_FLAGS, CHT_MODIFY, CHT_REMOVE, CHT_TYPE, COMMIT::clear(), EDA_ITEM::ClearFlags(), BOARD_ITEM_CONTAINER::Delete(), DELETED, COMMIT::Empty(), BOARD::FinalizeBulkAdd(), BOARD::FinalizeBulkRemove(), BOARD::Footprints(), PCB_BASE_FRAME::GetCanvas(), BOARD::GetConnectivity(), PCB_BASE_FRAME::GetDisplayOptions(), BOARD::GetFirstFootprint(), EDA_ITEM::GetFlags(), TOOL_MANAGER::GetModel(), BOARD_ITEM::GetParent(), BOARD_ITEM::GetParentGroup(), TOOL_MANAGER::GetTool(), TOOL_MANAGER::GetToolHolder(), TOOL_MANAGER::GetView(), EDA_ITEM::IsSelected(), COMMIT::m_changes, COMMIT::COMMIT_LINE::m_copy, m_isFootprintEditor, COMMIT::COMMIT_LINE::m_item, PCB_DISPLAY_OPTIONS::m_Live3DRefresh, m_resolveNetConflicts, m_toolMgr, COMMIT::COMMIT_LINE::m_type, TOOL_BASE::m_type, NEWITEM, BOARD::OnItemsChanged(), PCB_BASE_FRAME::OnModify(), PCB_ARC_T, PCB_DIM_ALIGNED_T, PCB_DIM_CENTER_T, PCB_DIM_LEADER_T, PCB_DIM_ORTHOGONAL_T, PCB_FOOTPRINT_T, PCB_FP_SHAPE_T, PCB_FP_TEXT_T, PCB_FP_ZONE_T, PCB_GROUP_T, PCB_MARKER_T, PCB_NETINFO_T, PCB_PAD_T, PCB_SHAPE_T, PCB_TARGET_T, PCB_TEXT_T, PCB_TRACE_T, PCB_VIA_T, PCB_ZONE_T, TOOL_MANAGER::PostEvent(), PICKED_ITEMS_LIST::PushItem(), PCB_DRAW_PANEL_GAL::RedrawRatsnest(), KIGFX::VIEW::Remove(), FOOTPRINT::Remove(), BOARD::Remove(), PCB_GROUP::RemoveItem(), PCB_SELECTION_TOOL::RemoveItemFromSel(), RESOLVE_CONFLICTS, PCB_BASE_FRAME::SaveCopyInUndoList(), ITEM_PICKER::SetLink(), EDA_ITEM::SetParent(), STRUCT_DELETED, TA_MODEL_CHANGE, TC_MESSAGE, text, FP_TEXT::TEXT_is_DIVERS, EDA_ITEM::Type(), EVENTS::UnselectedEvent, UNSPECIFIED, KIGFX::VIEW::Update(), and PCB_BASE_FRAME::Update3DView().
Referenced by PCB_POINT_EDITOR::addCorner(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), AUTOPLACE_TOOL::autoplace(), ZONE_FILLER_TOOL::CheckAllZones(), ZONE_CREATE_HELPER::commitZone(), MICROWAVE_TOOL::createInductorBetween(), CONVERT_TOOL::CreateLines(), CONVERT_TOOL::CreatePolys(), ALIGN_DISTRIBUTE_TOOL::DistributeHorizontally(), ALIGN_DISTRIBUTE_TOOL::DistributeVertically(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), DIALOG_CLEANUP_TRACKS_AND_VIAS::doCleanup(), DIALOG_CLEANUP_GRAPHICS::doCleanup(), DIALOG_GLOBAL_DELETION::DoGlobalDeletions(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawBoardCharacteristics(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawLine(), DRAWING_TOOL::DrawRectangle(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::DrawSpecificationStackup(), PCB_EDIT_FRAME::Edit_Zone_Params(), PAD_TOOL::EnumeratePads(), PAD_TOOL::explodePad(), ZONE_FILLER_TOOL::FillAllZones(), KI_TEST::FillZones(), DRAWING_TOOL::InteractivePlaceWithPreview(), ARRAY_CREATOR::Invoke(), BOARD_EDITOR_CONTROL::modifyLockSelected(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), DIALOG_EXCHANGE_FOOTPRINTS::OnOKClicked(), PCB_POINT_EDITOR::OnSelectionChange(), PAD_TOOL::pastePadProperties(), ZONE_CREATE_HELPER::performZoneCutout(), BOARD_EDITOR_CONTROL::PlaceFootprint(), DRAWING_TOOL::PlaceImportedGraphics(), DRAWING_TOOL::PlaceText(), PAD_TOOL::pushPadSettings(), DIALOG_BOARD_REANNOTATE::ReannotateBoard(), PAD_TOOL::recombinePad(), PCB_POINT_EDITOR::removeCorner(), GROUP_TOOL::RemoveFromGroup(), PCB_EDIT_FRAME::ResolveDRCExclusions(), PCB_EDIT_FRAME::RunActionPlugin(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), CONVERT_TOOL::SegmentToArc(), DRAWING_TOOL::SetAnchor(), BOARD_EDITOR_CONTROL::TrackWidthDec(), BOARD_EDITOR_CONTROL::TrackWidthInc(), DIALOG_DIMENSION_PROPERTIES::TransferDataFromWindow(), DIALOG_GROUP_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), BOARD_NETLIST_UPDATER::UpdateNetlist(), BOARD_EDITOR_CONTROL::ViaSizeDec(), BOARD_EDITOR_CONTROL::ViaSizeInc(), BOARD_EDITOR_CONTROL::ZoneDuplicate(), ZONE_FILLER_TOOL::ZoneFill(), BOARD_EDITOR_CONTROL::ZoneMerge(), ZONE_FILLER_TOOL::ZoneUnfill(), and ZONE_FILLER_TOOL::ZoneUnfillAll().
Notify observers that aItem has been removed.
Definition at line 90 of file commit.h.
References CHT_REMOVE, and COMMIT::Stage().
Referenced by GRAPHICS_CLEANER::cleanupShapes(), 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().
Modify a given item in the model.
Must be called before modification is performed.
Definition at line 96 of file commit.h.
References CHT_DONE, CHT_REMOVE, and COMMIT::Stage().
Referenced by TRACKS_CLEANER::deleteDanglingTracks(), TRACKS_CLEANER::mergeCollinearSegments(), TRACKS_CLEANER::removeItems(), PCB_EDIT_FRAME::RunActionPlugin(), and BOARD_NETLIST_UPDATER::UpdateNetlist().
|
overridevirtual |
Implements COMMIT.
Definition at line 464 of file board_commit.cpp.
References KIGFX::VIEW::Add(), BOARD::Add(), BULK, CHT_ADD, CHT_DONE, CHT_FLAGS, CHT_MODIFY, CHT_REMOVE, CHT_TYPE, COMMIT::clear(), copy, BOARD::FinalizeBulkAdd(), BOARD::FinalizeBulkRemove(), BOARD::GetConnectivity(), TOOL_MANAGER::GetModel(), TOOL_MANAGER::GetTool(), TOOL_MANAGER::GetView(), INSERT, COMMIT::m_changes, COMMIT::COMMIT_LINE::m_copy, m_isFootprintEditor, COMMIT::COMMIT_LINE::m_item, m_toolMgr, COMMIT::COMMIT_LINE::m_type, BOARD::OnItemChanged(), BOARD::OnItemsChanged(), PCB_SELECTION_TOOL::RebuildSelection(), KIGFX::VIEW::Remove(), BOARD::Remove(), and BOARD_ITEM::SwapData().
Referenced by AUTOPLACE_TOOL::autoplace(), ZONE_FILLER_TOOL::CheckAllZones(), PAD_TOOL::EnumeratePads(), ZONE_FILLER_TOOL::FillAllZones(), mergeZones(), PCB_POINT_EDITOR::OnSelectionChange(), BOARD_EDITOR_CONTROL::PlaceFootprint(), and ZONE_FILLER_TOOL::ZoneFill().
|
inline |
Sets a flag that will cause Push() to resolve net conflicts on track/via clusters instead of the default behavior which is to skip updating track/via clusters that have conflicts.
This is used in the netlist updater to update any clusters that were changed due to pad nets changing, but should not be used for other changes as you typically don't want to change track/via nets due to temporary conflicts created by board editing operations.
aResolve | is true if this commit should resolve conflicting track/via net assignments |
Definition at line 66 of file board_commit.h.
References m_resolveNetConflicts.
Referenced by BOARD_NETLIST_UPDATER::UpdateNetlist().
|
overridevirtual |
Reimplemented from COMMIT.
Definition at line 75 of file board_commit.cpp.
References CHT_MODIFY, EDA_ITEM::GetParent(), PCB_FOOTPRINT_T, COMMIT::Stage(), and EDA_ITEM::Type().
Referenced by ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically(), and PCB_EDIT_FRAME::Edit_Zone_Params().
|
overridevirtual |
Reimplemented from COMMIT.
Definition at line 91 of file board_commit.cpp.
References COMMIT::Stage().
|
overridevirtual |
Execute the changes.
Reimplemented from COMMIT.
Definition at line 97 of file board_commit.cpp.
References COMMIT::Stage().
|
inlineinherited |
Add a change of the item aItem of type aChangeType to the change list.
Definition at line 117 of file commit.h.
References COMMIT::Stage().
Referenced by PCB_POINT_EDITOR::OnSelectionChange().
|
protectedinherited |
Definition at line 178 of file commit.h.
Referenced by COMMIT::clear(), COMMIT::createModified(), COMMIT::makeEntry(), and COMMIT::Stage().
|
protectedinherited |
Definition at line 179 of file commit.h.
Referenced by COMMIT::clear(), COMMIT::Empty(), COMMIT::findEntry(), COMMIT::makeEntry(), Push(), Revert(), and COMMIT::~COMMIT().
|
private |
Definition at line 73 of file board_commit.h.
Referenced by BOARD_COMMIT(), Push(), and Revert().
|
private |
Definition at line 74 of file board_commit.h.
Referenced by Push(), and SetResolveNetConflicts().
|
private |
Definition at line 72 of file board_commit.h.
Referenced by BOARD_COMMIT(), GetBoard(), Push(), and Revert().