37 using namespace std::placeholders;
41 m_toolMgr( aToolMgr ),
42 m_isFootprintEditor( false ),
43 m_resolveNetConflicts( false )
49 m_resolveNetConflicts( false )
57 m_resolveNetConflicts( false )
111 std::set<EDA_ITEM*> savedModules;
113 bool itemsDeselected =
false;
115 std::vector<BOARD_ITEM*> bulkAddedItems;
116 std::vector<BOARD_ITEM*> bulkRemovedItems;
117 std::vector<BOARD_ITEM*> itemsChanged;
125 int changeFlags = ent.m_type &
CHT_FLAGS;
126 BOARD_ITEM* boardItem = static_cast<BOARD_ITEM*>( ent.m_item );
128 wxASSERT( ent.m_item );
136 ent.m_item = ent.m_item->GetParent();
137 wxASSERT( ent.m_item );
141 if( savedModules.count( ent.m_item ) == 0 )
146 ent.m_copy = ent.m_item->Clone();
152 if( aCreateUndoEntry && frame )
155 itemWrapper.
SetLink( ent.m_copy );
160 savedModules.insert( ent.m_item );
176 board->
Footprints().front()->Add( boardItem );
188 if( aCreateUndoEntry )
194 bulkAddedItems.push_back( boardItem );
199 view->
Add( boardItem );
214 itemsDeselected =
true;
217 switch( boardItem->
Type() )
231 FP_TEXT*
text = static_cast<FP_TEXT*>( boardItem );
242 view->
Remove( boardItem );
248 footprint->
Delete( boardItem );
267 view->
Remove( boardItem );
272 bulkRemovedItems.push_back( boardItem );
282 FOOTPRINT* footprint = static_cast<FOOTPRINT*>( boardItem );
285 view->
Remove( footprint );
292 bulkRemovedItems.push_back( footprint );
299 view->
Remove( boardItem );
308 bulkRemovedItems.push_back( boardItem );
316 bulkRemovedItems.push_back( boardItem );
332 wxASSERT( ent.m_copy );
333 itemWrapper.
SetLink( ent.m_copy );
338 connectivity->MarkItemNetAsDirty( static_cast<BOARD_ITEM*>( ent.m_copy ) );
340 connectivity->Update( boardItem );
344 view->
Update( boardItem );
348 static_cast<FOOTPRINT*>( boardItem )->RunOnChildren(
356 itemsChanged.push_back( boardItem );
359 if( !aCreateUndoEntry )
371 if( bulkAddedItems.size() > 0 )
374 if( bulkRemovedItems.size() > 0 )
377 if( itemsChanged.size() > 0 )
387 connectivity->RecalculateRatsnest(
this );
388 connectivity->ClearDynamicRatsnest();
395 for(
size_t i = num_changes; i <
m_changes.size(); ++i )
404 if( aCreateUndoEntry )
417 view->
Update( boardItem );
427 if( itemsDeselected )
444 switch( aItem->
Type() )
453 wxASSERT( !dynamic_cast<FOOTPRINT*>( aItem->
GetParent() ) );
471 std::vector<BOARD_ITEM*> bulkAddedItems;
472 std::vector<BOARD_ITEM*> bulkRemovedItems;
473 std::vector<BOARD_ITEM*> itemsChanged;
490 connectivity->Remove( item );
492 bulkRemovedItems.push_back( item );
500 connectivity->Add( item );
502 bulkAddedItems.push_back( item );
508 connectivity->Remove( item );
513 connectivity->Add( item );
515 itemsChanged.push_back( item );
527 if( bulkAddedItems.size() > 0 )
530 if( bulkRemovedItems.size() > 0 )
533 if( itemsChanged.size() > 0 )
537 connectivity->RecalculateRatsnest();
PCB_GROUP * GetParentGroup() const
virtual COMMIT & Stage(EDA_ITEM *aItem, CHANGE_TYPE aChangeType)
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
class PCB_DIM_LEADER, a leader dimension (graphic item)
class FP_TEXT, text in a footprint
static const TOOL_EVENT UnselectedEvent
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
class PCB_GROUP, a set of BOARD_ITEMs
A set of BOARD_ITEMs (i.e., without duplicates).
class PCB_DIM_CENTER, a center point marking (graphic item)
Flag to indicate the change is already applied, just notify observers (not compatible with CHT_MODIFY...
virtual void Revert() override
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
CHANGE_TYPE m_type
Modification type.
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
class PCB_TEXT, text on a layer
class PCB_ARC, an arc track segment on a copper layer
Represent a set of changes (additions, deletions or modifications) of a data model (e....
void PushItem(const ITEM_PICKER &aItem)
Push aItem to the top of the list.
class FP_SHAPE, a footprint edge
class PAD, a pad in a footprint
EDA_ITEM * m_item
Main item that is added/deleted/modified.
The base class for create windows for drawing purpose.
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Display options control the way tracks, vias, outlines and other things are shown (for instance solid...
void SetLink(EDA_ITEM *aItem)
UNDO_REDO
Undo Redo considerations: Basically we have 3 cases New item Deleted item Modified item there is also...
Clusters with conflicting drivers are not updated (default)
virtual EDA_ITEM * parentObject(EDA_ITEM *aItem) const override
void RedrawRatsnest()
Return the bounding box of the view that should be used if model is not valid.
virtual void SetParent(EDA_ITEM *aParent)
class PCB_TRACK, a track segment (segment on a copper layer)
void FinalizeBulkRemove(std::vector< BOARD_ITEM * > &aRemovedItems)
Must be used if Remove() is used using a BULK_x REMOVE_MODE to generate a change event for listeners.
virtual void SwapData(BOARD_ITEM *aImage)
Swap data between aItem and aImage.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
Adds an item to the container.
bool m_resolveNetConflicts
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
FOOTPRINTS & Footprints()
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
void OnItemsChanged(std::vector< BOARD_ITEM * > &aItems)
Notify the board and its listeners that an item on the board has been modified in some way.
EDA_ITEM * GetParent() const
#define STRUCT_DELETED
flag indication structures to be erased
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
bool RemoveItem(BOARD_ITEM *aItem)
Remove item from group.
class ZONE, a copper pour area
A holder to handle information on schematic or board items.
bool Empty() const
Returns status of an item.
class PCB_TARGET, a target (graphic item)
EDA_ITEM_FLAGS GetFlags() const
class FOOTPRINT, a footprint
void FinalizeBulkAdd(std::vector< BOARD_ITEM * > &aNewItems)
Must be used if Add() is used using a BULK_x ADD_MODE to generate a change event for listeners.
CHANGE_TYPE
Types of changes.
virtual void OnModify()
Must be called after a change in order to set the "modify" flag of the current screen and update the ...
class PCB_MARKER, a marker used to show something
bool IsType(FRAME_T aType) const
Information pertinent to a Pcbnew printed circuit board.
bool m_Live3DRefresh
If true, 3D viewer will redraw on every modification operation.
virtual void Update3DView(bool aMarkDirty, bool aRefresh, const wxString *aTitle=nullptr)
Update the 3D view, if the viewer is opened by this frame.
class NETINFO_ITEM, a description of a net
std::vector< COMMIT_LINE > m_changes
class ZONE, managed by a footprint
void OnItemChanged(BOARD_ITEM *aItem)
Notify the board and its listeners that an item on the board has been modified in some way.
A base class for most all the KiCad significant classes used in schematics and boards.
void Remove(BOARD_ITEM *aBoardItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL) override
Removes an item from the container.
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.
virtual void SaveCopyInUndoList(EDA_ITEM *aItemToCopy, UNDO_REDO aTypeCommand)=0
Create a new entry in undo list of commands.
virtual void Delete(BOARD_ITEM *aItem)
Removes an item from the container and deletes it.
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
BOARD_COMMIT(TOOL_MANAGER *aToolMgr)
class PCB_VIA, a via (like a track segment on a copper layer)
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
EDA_ITEM * m_copy
Optional copy of the item.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
BOARD_ITEM_CONTAINER * GetParent() const
class PCB_SHAPE, a segment not on copper layers
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
COMMIT & Stage(EDA_ITEM *aItem, CHANGE_TYPE aChangeType) override
KICAD_T Type() const
Returns the type of object.