KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_commit.h
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) 2016 CERN
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 * @author Tomasz Wlostowski <[email protected]>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
22#pragma once
23
24#include <commit.h>
25
27class TOOL_MANAGER;
28class SCH_EDIT_FRAME;
29class SCH_BASE_FRAME;
30class SCH_ITEM;
31class SCH_SCREEN;
32class EDA_DRAW_FRAME;
33class TOOL_BASE;
34
35template<class T>
36class SCH_TOOL_BASE;
37
38#define SKIP_UNDO 0x0001
39#define APPEND_UNDO 0x0002
40#define SKIP_SET_DIRTY 0x0004
41#define SKIP_CONNECTIVITY 0x0008
42// With SKIP_UNDO (implicit headless), transfer ownership of removed items to the commit.
43#define DELETE_REMOVED_ITEMS 0x0010
44
53class SCH_COMMIT : public COMMIT
54{
55public:
56 SCH_COMMIT( TOOL_MANAGER* aToolMgr );
57 SCH_COMMIT( TOOL_MANAGER* aToolMgr, bool aIsLibEditor );
58 SCH_COMMIT( EDA_DRAW_FRAME* aFrame );
60
61 virtual ~SCH_COMMIT();
62
63 void Push( const wxString& aMessage = wxEmptyString, int aCommitFlags = 0 ) override;
64
65 void Revert() override;
66 void RevertToCheckpoint( int aCheckpoint ) override;
67
68 COMMIT& Stage( EDA_ITEM *aItem, CHANGE_TYPE aChangeType, BASE_SCREEN *aScreen = nullptr,
69 RECURSE_MODE aRecurse = RECURSE_MODE::NO_RECURSE ) override;
70 COMMIT& Stage( std::vector<EDA_ITEM*> &container, CHANGE_TYPE aChangeType,
71 BASE_SCREEN *aScreen = nullptr ) override;
72
73 EDA_ITEM* ResolveItem( KIID& aID ) override;
74
76 void RemovedForCleanup( SCH_ITEM* aItem, SCH_SCREEN* aScreen );
77
78protected:
79 EDA_ITEM* undoLevelItem( EDA_ITEM* aItem ) const override;
80
81 EDA_ITEM* makeImage( EDA_ITEM* aItem ) const override;
82
83private:
84 void pushLibEdit( const wxString& aMessage, int aCommitFlags );
85 void pushSchEdit( const wxString& aMessage, int aCommitFlags );
86
87 void revertLibEdit();
88
89private:
92};
Handles how to draw a screen (a board, a schematic ...)
Definition base_screen.h:37
COMMIT()
Definition commit.cpp:30
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h:98
Definition kiid.h:46
A holder to handle information on schematic or board items.
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
COMMIT & Stage(EDA_ITEM *aItem, CHANGE_TYPE aChangeType, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE) override
Add a change of the item aItem of type aChangeType to the change list.
bool m_isLibEditor
Definition sch_commit.h:91
EDA_ITEM * undoLevelItem(EDA_ITEM *aItem) const override
void Revert() override
Revert the commit by restoring the modified items state.
TOOL_MANAGER * m_toolMgr
Definition sch_commit.h:90
EDA_ITEM * ResolveItem(KIID &aID) override
Search for an item in this commit that matches the provided KIID.
void RemovedForCleanup(SCH_ITEM *aItem, SCH_SCREEN *aScreen)
Retain the pre-edit state of an item already removed from its screen by cleanup.
SCH_COMMIT(TOOL_MANAGER *aToolMgr)
virtual ~SCH_COMMIT()
void pushLibEdit(const wxString &aMessage, int aCommitFlags)
void revertLibEdit()
EDA_ITEM * makeImage(EDA_ITEM *aItem) const override
void pushSchEdit(const wxString &aMessage, int aCommitFlags)
void RevertToCheckpoint(int aCheckpoint) override
void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Execute the changes.
Schematic editor (Eeschema) main window.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition sch_item.h:170
A foundation class for a tool operating on a schematic or symbol.
Base abstract interface for all kinds of tools.
Definition tool_base.h:62
Master controller class:
CHANGE_TYPE
Types of changes.
Definition commit.h:37
RECURSE_MODE
Definition eda_item.h:50
@ NO_RECURSE
Definition eda_item.h:52