42 m_toolMgr( aToolMgr ),
43 m_isLibEditor( false )
71 wxCHECK( aItem, *
this );
78 SCH_LABEL_LOCATE_ANY_T } ) )
105 Stage( item, aChangeType, aScreen );
169 for(
size_t ii = 1; ii <
m_changes.size(); ++ii )
184 bool itemsDeselected =
false;
185 bool selectedModified =
false;
186 bool dirtyConnectivity =
false;
187 bool refreshHierarchy =
false;
196 std::vector<SCH_ITEM*> bulkAddedItems;
197 std::vector<SCH_ITEM*> bulkRemovedItems;
198 std::vector<SCH_ITEM*> itemsChanged;
202 int changeType = ent.m_type &
CHT_TYPE;
203 int changeFlags = ent.m_type &
CHT_FLAGS;
207 wxCHECK2( schItem && screen,
continue );
214 selectedModified =
true;
219 [&selectedModified](
SCH_ITEM* aChild )
222 selectedModified =
true;
226 auto updateConnectivityFlag = [&]()
230 dirtyConnectivity =
true;
246 updateConnectivityFlag();
254 screen->
Append( schItem );
257 view->
Add( schItem );
263 bulkAddedItems.push_back( schItem );
266 refreshHierarchy =
true;
273 updateConnectivityFlag();
283 itemsDeselected =
true;
288 static_cast<SCH_FIELD*
>( schItem )->SetVisible(
false );
294 screen->
Remove( schItem );
303 bulkRemovedItems.push_back( schItem );
306 refreshHierarchy =
true;
315 ITEM_PICKER itemWrapper( screen, schItem, UNDO_REDO::CHANGED );
316 wxASSERT( ent.m_copy );
317 itemWrapper.
SetLink( ent.m_copy );
321 wxCHECK2( itemCopy,
continue );
331 updateConnectivityFlag();
339 wxCHECK2( modifiedSheet && originalSheet,
continue );
342 refreshHierarchy =
true;
346 ent.m_copy =
nullptr;
352 itemsChanged.push_back( schItem );
358 ent.m_copy =
nullptr;
377 if( bulkAddedItems.size() > 0 )
380 if( bulkRemovedItems.size() > 0 )
383 if( itemsChanged.size() > 0 )
386 if( refreshHierarchy )
399 frame->
SaveCopyInUndoList( undoList, UNDO_REDO::UNSPECIFIED,
false, dirtyConnectivity );
401 if( dirtyConnectivity )
403 wxLogTrace( wxS(
"CONN_PROFILE" ),
404 wxS(
"SCH_COMMIT::pushSchEdit() %s clean up connectivity rebuild." ),
405 ( connectivityCleanUp ==
LOCAL_CLEANUP ) ? wxS(
"local" ) : wxS(
"global" ) );
413 if( itemsDeselected )
416 if( selectedModified )
461 std::vector<KIID> selected;
465 if( item.IsSelected() )
466 selected.push_back( item.m_Uuid );
480 return aItem->
Clone();
500 for(
size_t ii = 1; ii <
m_changes.size(); ++ii )
527 std::vector<SCH_ITEM*> bulkAddedItems;
528 std::vector<SCH_ITEM*> bulkRemovedItems;
529 std::vector<SCH_ITEM*> itemsChanged;
533 int changeType = ent.m_type &
CHT_TYPE;
534 int changeFlags = ent.m_type &
CHT_FLAGS;
539 wxCHECK2( item && screen,
continue );
554 bulkRemovedItems.push_back( item );
567 bulkAddedItems.push_back( item );
639 if( bulkAddedItems.size() > 0 )
642 if( bulkRemovedItems.size() > 0 )
645 if( itemsChanged.size() > 0 )
Handles how to draw a screen (a board, a schematic ...)
Represent a set of changes (additions, deletions or modifications) of a data model (e....
virtual COMMIT & Stage(EDA_ITEM *aItem, CHANGE_TYPE aChangeType, BASE_SCREEN *aScreen=nullptr)
bool Empty() const
Returns status of an item.
std::vector< COMMIT_LINE > m_changes
Calculate the connectivity of a schematic and generates netlists.
void RemoveItem(SCH_ITEM *aItem)
bool IsType(FRAME_T aType) const
The base class for create windows for drawing purpose.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
A base class for most all the KiCad significant classes used in schematics and boards.
KICAD_T Type() const
Returns the type of object.
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
EDA_ITEM * GetParent() const
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
bool HasFlag(EDA_ITEM_FLAGS aFlag) const
virtual const wxString & GetText() const
Return the string associated with the text object.
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
static const TOOL_EVENT UnselectedEvent
void SetLink(EDA_ITEM *aItem)
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
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...
Define a library symbol object.
void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction) override
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
A holder to handle information on schematic or board items.
void PushItem(const ITEM_PICKER &aItem)
Push aItem to the top of the list.
void SetDescription(const wxString &aDescription)
Holds all the data relating to one schematic.
void OnItemsAdded(std::vector< SCH_ITEM * > &aNewItems)
Must be used if Add() is used using a BULK_x ADD_MODE to generate a change event for listeners.
void OnItemsRemoved(std::vector< SCH_ITEM * > &aRemovedItems)
Must be used if Remove() is used using a BULK_x REMOVE_MODE to generate a change event for listeners.
CONNECTION_GRAPH * ConnectionGraph() const override
SCH_SHEET_LIST Hierarchy() const override
Return the full schematic flattened hierarchical sheet list.
void OnItemsChanged(std::vector< SCH_ITEM * > &aItems)
Notify the schematic and its listeners that an item on the schematic has been modified in some way.
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
virtual void Push(const wxString &aMessage=wxT("A commit"), int aCommitFlags=0) override
Revert the commit by restoring the modified items state.
COMMIT & Stage(EDA_ITEM *aItem, CHANGE_TYPE aChangeType, BASE_SCREEN *aScreen=nullptr) override
virtual void Revert() override
SCH_COMMIT(TOOL_MANAGER *aToolMgr)
void pushLibEdit(const wxString &aMessage, int aCommitFlags)
EDA_ITEM * makeImage(EDA_ITEM *aItem) const override
EDA_ITEM * parentObject(EDA_ITEM *aItem) const override
void pushSchEdit(const wxString &aMessage, int aCommitFlags)
Schematic editor (Eeschema) main window.
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag and update other data struc...
void UpdateHierarchyNavigator(bool aRefreshNetNavigator=true)
Update the hierarchy navigation tree and history.
void SaveCopyInUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO aTypeCommand, bool aAppend, bool aDirtyConnectivity=true)
Create a copy of the current schematic item, and put it in the undo list.
SCH_SHEET_PATH & GetCurrentSheet() const
void RecalculateConnections(SCH_COMMIT *aCommit, SCH_CLEANUP_FLAGS aCleanupFlags)
Generate the connection data for the entire schematic hierarchy.
void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false, bool aUpdateRtree=false) override
Mark an item for refresh.
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Base class for any item which can be embedded within the SCHEMATIC container class,...
virtual bool IsConnectable() const
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
virtual void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction)
virtual void SwapData(SCH_ITEM *aItem)
Swap the internal data structures aItem with the schematic item.
void SetConnectivityDirty(bool aDirty=true)
virtual bool HasConnectivityChanges(const SCH_ITEM *aItem, const SCH_SHEET_PATH *aInstance=nullptr) const
Check if aItem has connectivity changes against this object.
void Append(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
bool Remove(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
Remove aItem from the schematic associated with this screen.
void Update(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
Update aItem's bounding box in the tree.
bool CheckIfOnDrawList(const SCH_ITEM *aItem) const
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
bool HasPageNumberChanges(const SCH_SHEET &aOther) const
Check if the instance data of this sheet has any changes compared to aOther.
void UpdatePins()
Updates the cache of SCH_PIN objects for each pin.
void SetRef(const SCH_SHEET_PATH *aSheet, const wxString &aReference)
Set the reference for the given sheet path for this symbol.
std::vector< SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve a list of the SCH_PINs for the given sheet path.
The symbol library editor main window.
void PushSymbolToUndoList(const wxString &aDescription, LIB_SYMBOL *aSymbolCopy, UNDO_REDO aUndoType=UNDO_REDO::LIBEDIT)
void SetCurSymbol(LIB_SYMBOL *aSymbol, bool aUpdateZoom)
Take ownership of aSymbol and notes that it is the one currently being edited.
LIB_SYMBOL * GetCurSymbol() const
Return the current symbol being edited or NULL if none selected.
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current symbol.
CHANGE_TYPE
Types of changes.
@ CHT_DONE
Flag to indicate the change is already applied.
#define SELECTED
Item was manually selected by the user.
#define SELECTED_BY_DRAG
Item was algorithmically selected as a dragged item.
#define EDA_ITEM_ALL_FLAGS
#define ENDPOINT
ends. (Used to support dragging.)
#define STARTPOINT
When a line is selected, these flags indicate which.
@ FRAME_SCH_SYMBOL_EDITOR
This file contains miscellaneous commonly used macros and functions.
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
@ REFERENCE_FIELD
Field Reference of part, i.e. "IC21".
UNDO_REDO
Undo Redo considerations: Basically we have 3 cases New item Deleted item Modified item there is also...