KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_commit.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2023 KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#include <macros.h>
25#include <tool/tool_manager.h>
26#include <tools/ee_tool_base.h>
27
28#include <lib_item.h>
29#include <lib_symbol.h>
30
31#include <sch_screen.h>
32#include <schematic.h>
33
34#include <view/view.h>
35#include <sch_commit.h>
36
37#include <functional>
38
39
41 m_toolMgr( aToolMgr ),
42 m_isLibEditor( false )
43{
44 SCH_BASE_FRAME* frame = static_cast<SCH_BASE_FRAME*>( m_toolMgr->GetToolHolder() );
45 m_isLibEditor = frame && frame->IsType( FRAME_SCH_SYMBOL_EDITOR );
46}
47
48
50{
51 m_toolMgr = aTool->GetManager();
53}
54
55
57{
58 m_toolMgr = aFrame->GetToolManager();
60}
61
62
64{
65}
66
67
68COMMIT& SCH_COMMIT::Stage( EDA_ITEM *aItem, CHANGE_TYPE aChangeType, BASE_SCREEN *aScreen )
69{
70 wxCHECK( aItem, *this );
71
72 // If aItem belongs a symbol, sheet or label, the full parent will be saved because undo/redo
73 // does not handle "sub items" modifications.
74 if( aItem->Type() != SCH_SHEET_T
75 && aItem->GetParent() && aItem->GetParent()->IsType( { SCH_SYMBOL_T, LIB_SYMBOL_T,
76 SCH_SHEET_T,
77 SCH_LABEL_LOCATE_ANY_T } ) )
78 {
79 aItem = aItem->GetParent();
80 aChangeType = CHT_MODIFY;
81 }
82
83 // IS_SELECTED flag should not be set on undo items which were added for
84 // a drag operation.
85 if( aItem->IsSelected() && aItem->HasFlag( SELECTED_BY_DRAG ) )
86 {
87 aItem->ClearSelected();
88 COMMIT::Stage( aItem, aChangeType, aScreen );
89 aItem->SetSelected();
90 }
91 else
92 {
93 COMMIT::Stage( aItem, aChangeType, aScreen );
94 }
95
96 return *this;
97}
98
99
100COMMIT& SCH_COMMIT::Stage( std::vector<EDA_ITEM*> &container, CHANGE_TYPE aChangeType,
101 BASE_SCREEN *aScreen )
102{
103 for( EDA_ITEM* item : container )
104 Stage( item, aChangeType, aScreen );
105
106 return *this;
107}
108
109
111 BASE_SCREEN *aScreen )
112{
113 return COMMIT::Stage( aItems, aModFlag, aScreen );
114}
115
116
117void SCH_COMMIT::pushLibEdit( const wxString& aMessage, int aCommitFlags )
118{
119 KIGFX::VIEW* view = m_toolMgr->GetView();
120 SYMBOL_EDIT_FRAME* frame = static_cast<SYMBOL_EDIT_FRAME*>( m_toolMgr->GetToolHolder() );
121
122 if( Empty() )
123 return;
124
125 // Symbol editor just saves copies of the whole symbol, so grab the first and discard the rest
126 LIB_SYMBOL* symbol = dynamic_cast<LIB_SYMBOL*>( m_changes.front().m_item );
127 LIB_SYMBOL* copy = dynamic_cast<LIB_SYMBOL*>( m_changes.front().m_copy );
128
129 if( symbol )
130 {
131 if( view )
132 {
133 view->Update( symbol );
134
135 symbol->RunOnChildren(
136 [&]( LIB_ITEM* aChild )
137 {
138 view->Update( aChild );
139 });
140 }
141
142 if( !( aCommitFlags & SKIP_UNDO ) )
143 {
144 if( frame && copy )
145 {
146 frame->SaveCopyInUndoList( aMessage, copy );
147 copy = nullptr; // we've transferred ownership to the undo stack
148 }
149 }
150
151 if( copy )
152 {
153 // if no undo entry was needed, the copy would create a memory leak
154 delete copy;
155 copy = nullptr;
156 }
157 }
158
161
162 if( !( aCommitFlags & SKIP_SET_DIRTY ) )
163 {
164 if( frame )
165 frame->OnModify();
166 }
167
168 for( size_t ii = 1; ii < m_changes.size(); ++ii )
169 delete m_changes[ii].m_copy;
170
171 clear();
172}
173
174
175void SCH_COMMIT::pushSchEdit( const wxString& aMessage, int aCommitFlags )
176{
177 // Objects potentially interested in changes:
178 PICKED_ITEMS_LIST undoList;
179 KIGFX::VIEW* view = m_toolMgr->GetView();
180
181 SCH_EDIT_FRAME* frame = static_cast<SCH_EDIT_FRAME*>( m_toolMgr->GetToolHolder() );
183 bool itemsDeselected = false;
184 bool selectedModified = false;
185 bool dirtyConnectivity = false;
186
187 if( Empty() )
188 return;
189
190 undoList.SetDescription( aMessage );
191
192 SCHEMATIC* schematic = nullptr;
193 std::vector<SCH_ITEM*> bulkAddedItems;
194 std::vector<SCH_ITEM*> bulkRemovedItems;
195 std::vector<SCH_ITEM*> itemsChanged;
196
197 for( COMMIT_LINE& ent : m_changes )
198 {
199 int changeType = ent.m_type & CHT_TYPE;
200 int changeFlags = ent.m_type & CHT_FLAGS;
201 SCH_ITEM* schItem = dynamic_cast<SCH_ITEM*>( ent.m_item );
202 SCH_SCREEN* screen = dynamic_cast<SCH_SCREEN*>( ent.m_screen );
203
204 wxCHECK2( schItem && screen, continue );
205
206 if( !schematic )
207 schematic = schItem->Schematic();
208
209 if( schItem->IsSelected() )
210 selectedModified = true;
211
212 if( !( aCommitFlags & SKIP_CONNECTIVITY ) )
213 dirtyConnectivity = true;
214
215 switch( changeType )
216 {
217 case CHT_ADD:
218 {
219 if( !( aCommitFlags & SKIP_UNDO ) )
220 undoList.PushItem( ITEM_PICKER( screen, schItem, UNDO_REDO::NEWITEM ) );
221
222 if( !( changeFlags & CHT_DONE ) )
223 {
224 if( !screen->CheckIfOnDrawList( schItem ) ) // don't want a loop!
225 screen->Append( schItem );
226
227 if( view )
228 view->Add( schItem );
229 }
230
231 if( frame )
232 frame->UpdateItem( schItem, true, true );
233
234 bulkAddedItems.push_back( schItem );
235
236 break;
237 }
238
239 case CHT_REMOVE:
240 {
241 if( !( aCommitFlags & SKIP_UNDO ) )
242 undoList.PushItem( ITEM_PICKER( screen, schItem, UNDO_REDO::DELETED ) );
243
244 if( schItem->IsSelected() )
245 {
246 if( selTool )
247 selTool->RemoveItemFromSel( schItem, true /* quiet mode */ );
248
249 itemsDeselected = true;
250 }
251
252 if( schItem->Type() == SCH_FIELD_T )
253 {
254 static_cast<SCH_FIELD*>( schItem )->SetVisible( false );
255 break;
256 }
257
258 if( !( changeFlags & CHT_DONE ) )
259 {
260 screen->Remove( schItem );
261
262 if( view )
263 view->Remove( schItem );
264 }
265
266 if( frame )
267 frame->UpdateItem( schItem, true, true );
268
269 bulkRemovedItems.push_back( schItem );
270
271 break;
272 }
273
274 case CHT_MODIFY:
275 {
276 if( !( aCommitFlags & SKIP_UNDO ) )
277 {
278 ITEM_PICKER itemWrapper( screen, schItem, UNDO_REDO::CHANGED );
279 wxASSERT( ent.m_copy );
280 itemWrapper.SetLink( ent.m_copy );
281 undoList.PushItem( itemWrapper );
282 ent.m_copy = nullptr; // We've transferred ownership to the undo list
283 }
284
285 if( frame )
286 frame->UpdateItem( schItem, false, true );
287
288 itemsChanged.push_back( schItem );
289
290 if( ent.m_copy )
291 {
292 // if no undo entry is needed, the copy would create a memory leak
293 delete ent.m_copy;
294 ent.m_copy = nullptr;
295 }
296
297 break;
298 }
299
300 default:
301 wxASSERT( false );
302 break;
303 }
304
305 // Clear all flags but SELECTED, after edition
306 // (selected items must keep their selection flag).
307 const int selected_mask = ( SELECTED | SELECTED_BY_DRAG );
308 schItem->ClearFlags( EDA_ITEM_ALL_FLAGS - selected_mask );
309 }
310
311 if( schematic )
312 {
313 if( bulkAddedItems.size() > 0 )
314 schematic->OnItemsAdded( bulkAddedItems );
315
316 if( bulkRemovedItems.size() > 0 )
317 schematic->OnItemsRemoved( bulkRemovedItems );
318
319 if( itemsChanged.size() > 0 )
320 schematic->OnItemsChanged( itemsChanged );
321 }
322
323 if( !( aCommitFlags & SKIP_UNDO ) )
324 {
325 if( frame )
326 {
327 frame->SaveCopyInUndoList( undoList, UNDO_REDO::UNSPECIFIED, false, dirtyConnectivity );
328 frame->RecalculateConnections( this, NO_CLEANUP );
329 }
330 }
331
333
334 if( itemsDeselected )
336
337 if( selectedModified )
339
340 if( frame && frame->GetCanvas() )
341 frame->GetCanvas()->Refresh();
342
343 if( !( aCommitFlags & SKIP_SET_DIRTY ) )
344 {
345 if( frame )
346 frame->OnModify();
347 }
348
349 clear();
350}
351
352
353void SCH_COMMIT::Push( const wxString& aMessage, int aCommitFlags )
354{
355 if( m_isLibEditor )
356 pushLibEdit( aMessage, aCommitFlags );
357 else
358 pushSchEdit( aMessage, aCommitFlags );
359}
360
361
363{
364 EDA_ITEM* parent = aItem->GetParent();
365
366 if( parent && parent->Type() == SCH_SYMBOL_T )
367 return parent;
368
369 if( parent && parent->Type() == LIB_SYMBOL_T )
370 return parent;
371
372 if( m_isLibEditor )
373 return static_cast<SYMBOL_EDIT_FRAME*>( m_toolMgr->GetToolHolder() )->GetCurSymbol();
374
375 return aItem;
376}
377
378
380{
381 if( m_isLibEditor )
382 {
383 SYMBOL_EDIT_FRAME* frame = static_cast<SYMBOL_EDIT_FRAME*>( m_toolMgr->GetToolHolder() );
384 return new LIB_SYMBOL( *frame->GetCurSymbol() );
385 }
386
387 return aItem->Clone();
388}
389
390
392{
393 if( Empty() )
394 return;
395
396 // Symbol editor just saves copies of the whole symbol, so grab the first and discard the rest
397 SYMBOL_EDIT_FRAME* frame = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_toolMgr->GetToolHolder() );
398 LIB_SYMBOL* copy = dynamic_cast<LIB_SYMBOL*>( m_changes.front().m_copy );
400
401 if( frame && copy )
402 {
403 frame->SetCurSymbol( copy, false );
405 }
406
407 for( size_t ii = 1; ii < m_changes.size(); ++ii )
408 delete m_changes[ii].m_copy;
409
410 if( selTool )
411 selTool->RebuildSelection();
412
413 clear();
414}
415
416
418{
419 KIGFX::VIEW* view = m_toolMgr->GetView();
420 SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( m_toolMgr->GetToolHolder() );
422
423 if( m_changes.empty() )
424 return;
425
426 if( m_isLibEditor )
427 {
429 return;
430 }
431
432 SCHEMATIC* schematic = nullptr;
433 std::vector<SCH_ITEM*> bulkAddedItems;
434 std::vector<SCH_ITEM*> bulkRemovedItems;
435 std::vector<SCH_ITEM*> itemsChanged;
436
437 for( COMMIT_LINE& ent : m_changes )
438 {
439 int changeType = ent.m_type & CHT_TYPE;
440 int changeFlags = ent.m_type & CHT_FLAGS;
441 SCH_ITEM* item = dynamic_cast<SCH_ITEM*>( ent.m_item );
442 SCH_ITEM* copy = dynamic_cast<SCH_ITEM*>( ent.m_copy );
443 SCH_SCREEN* screen = dynamic_cast<SCH_SCREEN*>( ent.m_screen );
444
445 wxCHECK2( item && screen, continue );
446
447 if( !schematic )
448 schematic = item->Schematic();
449
450 switch( changeType )
451 {
452 case CHT_ADD:
453 if( !( changeFlags & CHT_DONE ) )
454 break;
455
456 if( view )
457 view->Remove( item );
458
459 screen->Remove( item );
460 bulkRemovedItems.push_back( item );
461 break;
462
463 case CHT_REMOVE:
464 item->SetConnectivityDirty();
465
466 if( !( changeFlags & CHT_DONE ) )
467 break;
468
469 if( view )
470 view->Add( item );
471
472 screen->Append( item );
473 bulkAddedItems.push_back( item );
474 break;
475
476 case CHT_MODIFY:
477 {
478 if( view )
479 view->Remove( item );
480
481 item->SwapData( copy );
482 item->SetConnectivityDirty();
483
484 // Special cases for items which have instance data
485 if( item->GetParent() && item->GetParent()->Type() == SCH_SYMBOL_T
486 && item->Type() == SCH_FIELD_T )
487 {
488 SCH_FIELD* field = static_cast<SCH_FIELD*>( item );
489 SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item->GetParent() );
490
491 if( field->GetId() == REFERENCE_FIELD )
492 {
493 SCH_SHEET_PATH sheet = schematic->GetSheets().FindSheetForScreen( screen );
494 symbol->SetRef( &sheet, field->GetText() );
495 }
496 }
497
498 if( view )
499 view->Add( item );
500
501 screen->Update( item );
502
503 delete copy;
504 break;
505 }
506
507 default:
508 wxASSERT( false );
509 break;
510 }
511 }
512
513 if( schematic )
514 {
515 if( bulkAddedItems.size() > 0 )
516 schematic->OnItemsAdded( bulkAddedItems );
517
518 if( bulkRemovedItems.size() > 0 )
519 schematic->OnItemsRemoved( bulkRemovedItems );
520
521 if( itemsChanged.size() > 0 )
522 schematic->OnItemsChanged( itemsChanged );
523 }
524
525 if( selTool )
526 selTool->RebuildSelection();
527
528 if( frame )
529 {
530 frame->RecalculateConnections( nullptr, NO_CLEANUP );
531 }
532
533 clear();
534}
535
Handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:41
Represent a set of changes (additions, deletions or modifications) of a data model (e....
Definition: commit.h:72
virtual COMMIT & Stage(EDA_ITEM *aItem, CHANGE_TYPE aChangeType, BASE_SCREEN *aScreen=nullptr)
Definition: commit.cpp:48
bool Empty() const
Returns status of an item.
Definition: commit.h:142
void clear()
Definition: commit.h:161
std::vector< COMMIT_LINE > m_changes
Definition: commit.h:189
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.
Definition: eda_item.h:85
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
void ClearSelected()
Definition: eda_item.h:118
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:125
bool IsSelected() const
Definition: eda_item.h:106
void SetSelected()
Definition: eda_item.h:115
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
Definition: eda_item.h:172
EDA_ITEM * GetParent() const
Definition: eda_item.h:99
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
Definition: eda_item.cpp:82
bool HasFlag(EDA_ITEM_FLAGS aFlag) const
Definition: eda_item.h:127
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:95
void RebuildSelection()
Rebuild the selection from the EDA_ITEMs' selection flags.
A foundation class for a tool operating on a schematic or symbol.
Definition: ee_tool_base.h:48
bool IsSymbolEditor() const
Returns true if the tool is running in the symbol editor.
Definition: ee_tool_base.h:99
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
Definition: actions.h:239
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:233
void SetLink(EDA_ITEM *aItem)
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:68
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:313
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition: view.cpp:350
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...
Definition: view.cpp:1607
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:68
Define a library symbol object.
Definition: lib_symbol.h:99
void RunOnChildren(const std::function< void(LIB_ITEM *)> &aFunction)
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.
Definition: schematic.h:75
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.
Definition: schematic.cpp:682
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.
Definition: schematic.cpp:688
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:100
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.
Definition: schematic.cpp:694
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.
bool m_isLibEditor
Definition: sch_commit.h:77
virtual void Push(const wxString &aMessage=wxT("A commit"), int aCommitFlags=0) override
Revert the commit by restoring the modified items state.
Definition: sch_commit.cpp:353
COMMIT & Stage(EDA_ITEM *aItem, CHANGE_TYPE aChangeType, BASE_SCREEN *aScreen=nullptr) override
Definition: sch_commit.cpp:68
virtual void Revert() override
Definition: sch_commit.cpp:417
TOOL_MANAGER * m_toolMgr
Definition: sch_commit.h:76
SCH_COMMIT(TOOL_MANAGER *aToolMgr)
Definition: sch_commit.cpp:40
virtual ~SCH_COMMIT()
Definition: sch_commit.cpp:63
void pushLibEdit(const wxString &aMessage, int aCommitFlags)
Definition: sch_commit.cpp:117
void revertLibEdit()
Definition: sch_commit.cpp:391
EDA_ITEM * makeImage(EDA_ITEM *aItem) const override
Definition: sch_commit.cpp:379
EDA_ITEM * parentObject(EDA_ITEM *aItem) const override
Definition: sch_commit.cpp:362
void pushSchEdit(const wxString &aMessage, int aCommitFlags)
Definition: sch_commit.cpp:175
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 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.
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,...
Definition: sch_field.h:52
int GetId() const
Definition: sch_field.h:128
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:150
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:113
virtual void SwapData(SCH_ITEM *aItem)
Swap the internal data structures aItem with the schematic item.
Definition: sch_item.cpp:261
void SetConnectivityDirty(bool aDirty=true)
Definition: sch_item.h:428
void Append(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
Definition: sch_screen.cpp:152
bool Remove(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
Remove aItem from the schematic associated with this screen.
Definition: sch_screen.cpp:322
void Update(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
Update aItem's bounding box in the tree.
Definition: sch_screen.cpp:315
bool CheckIfOnDrawList(const SCH_ITEM *aItem) const
Definition: sch_screen.cpp:385
SCH_SHEET_PATH FindSheetForScreen(const SCH_SCREEN *aScreen)
Return the first SCH_SHEET_PATH object (not necessarily the only one) using a particular screen.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Schematic symbol object.
Definition: sch_symbol.h:81
void SetRef(const SCH_SHEET_PATH *aSheet, const wxString &aReference)
Set the reference for the given sheet path for this symbol.
Definition: sch_symbol.cpp:762
int RemoveItemFromSel(const TOOL_EVENT &aEvent)
The symbol library editor main window.
void SaveCopyInUndoList(const wxString &aDescription, EDA_ITEM *aItem, UNDO_REDO aUndoType=UNDO_REDO::LIBEDIT)
Create a copy of the current symbol, and save it in the undo list.
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.
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:55
TOOL_MANAGER * GetManager() const
Return the instance of TOOL_MANAGER that takes care of the tool.
Definition: tool_base.h:145
@ MODEL_RELOAD
Model changes (the sheet for a schematic)
Definition: tool_base.h:80
Master controller class:
Definition: tool_manager.h:57
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).
void PostEvent(const TOOL_EVENT &aEvent)
Put an event to the event queue to be processed at the end of event processing cycle.
TOOLS_HOLDER * GetToolHolder() const
Definition: tool_manager.h:389
void ResetTools(TOOL_BASE::RESET_REASON aReason)
Reset all tools (i.e.
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:378
CHANGE_TYPE
Types of changes.
Definition: commit.h:41
@ CHT_MODIFY
Definition: commit.h:44
@ CHT_REMOVE
Definition: commit.h:43
@ CHT_DONE
Flag to indicate the change is already applied.
Definition: commit.h:47
@ CHT_TYPE
Definition: commit.h:45
@ CHT_ADD
Definition: commit.h:42
@ CHT_FLAGS
Definition: commit.h:48
#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
@ FRAME_SCH_SYMBOL_EDITOR
Definition: frame_type.h:35
This file contains miscellaneous commonly used macros and functions.
#define SKIP_CONNECTIVITY
Definition: sch_commit.h:43
#define SKIP_SET_DIRTY
Definition: sch_commit.h:42
#define SKIP_UNDO
Definition: sch_commit.h:40
@ NO_CLEANUP
@ REFERENCE_FIELD
Field Reference of part, i.e. "IC21".
@ AS_GLOBAL
Global action (toolbar/main menu event, global shortcut)
Definition: tool_action.h:48
@ TA_MODEL_CHANGE
Definition: tool_event.h:120
@ TC_MESSAGE
Definition: tool_event.h:57
@ LIB_SYMBOL_T
Definition: typeinfo.h:197
@ SCH_SYMBOL_T
Definition: typeinfo.h:155
@ SCH_FIELD_T
Definition: typeinfo.h:154
@ SCH_SHEET_T
Definition: typeinfo.h:157
UNDO_REDO
Undo Redo considerations: Basically we have 3 cases New item Deleted item Modified item there is also...