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, you may find one here:
20 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21 * or you may search the http://www.gnu.org website for the version 2 license,
22 * or you may write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24 */
25
26#pragma once
27
28#include <commit.h>
29
31class TOOL_MANAGER;
32class SCH_EDIT_FRAME;
33class SCH_BASE_FRAME;
34class EDA_DRAW_FRAME;
35class TOOL_BASE;
36
37template<class T>
38class SCH_TOOL_BASE;
39
40#define SKIP_UNDO 0x0001
41#define APPEND_UNDO 0x0002
42#define SKIP_SET_DIRTY 0x0004
43
44class SCH_COMMIT : public COMMIT
45{
46public:
47 SCH_COMMIT( TOOL_MANAGER* aToolMgr );
48 SCH_COMMIT( EDA_DRAW_FRAME* aFrame );
50
51 virtual ~SCH_COMMIT();
52
53 virtual void Push( const wxString& aMessage = wxT( "A commit" ), int aCommitFlags = 0 ) override;
54
55 virtual void Revert() override;
56 COMMIT& Stage( EDA_ITEM *aItem, CHANGE_TYPE aChangeType, BASE_SCREEN *aScreen = nullptr,
57 RECURSE_MODE aRecurse = RECURSE_MODE::NO_RECURSE ) override;
58 COMMIT& Stage( std::vector<EDA_ITEM*> &container, CHANGE_TYPE aChangeType,
59 BASE_SCREEN *aScreen = nullptr ) override;
60
61private:
62 EDA_ITEM* undoLevelItem( EDA_ITEM* aItem ) const override;
63
64 EDA_ITEM* makeImage( EDA_ITEM* aItem ) const override;
65
66 void pushLibEdit( const wxString& aMessage, int aCommitFlags );
67 void pushSchEdit( const wxString& aMessage, int aCommitFlags );
68
69 void revertLibEdit();
70
71private:
74};
Handles how to draw a screen (a board, a schematic ...)
Definition base_screen.h:41
COMMIT()
Definition commit.cpp:34
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
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:73
virtual void Push(const wxString &aMessage=wxT("A commit"), int aCommitFlags=0) override
Execute the changes.
EDA_ITEM * undoLevelItem(EDA_ITEM *aItem) const override
virtual void Revert() override
Revert the commit by restoring the modified items state.
TOOL_MANAGER * m_toolMgr
Definition sch_commit.h:72
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)
Schematic editor (Eeschema) main window.
A foundation class for a tool operating on a schematic or symbol.
Base abstract interface for all kinds of tools.
Definition tool_base.h:66
Master controller class:
CHANGE_TYPE
Types of changes.
Definition commit.h:41
RECURSE_MODE
Definition eda_item.h:50
@ NO_RECURSE
Definition eda_item.h:52