KiCad PCB EDA Suite
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
board_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 <tomasz.wlostowski@cern.ch>
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#ifndef BOARD_COMMIT_H
27#define BOARD_COMMIT_H
28
29#include <commit.h>
30
31class BOARD_ITEM;
32class PCB_SHAPE;
33class ZONE;
34class BOARD;
36class PCB_TOOL_BASE;
37class TOOL_MANAGER;
38class EDA_DRAW_FRAME;
39class TOOL_BASE;
40
41#define SKIP_UNDO 0x0001
42#define APPEND_UNDO 0x0002
43#define SKIP_SET_DIRTY 0x0004
44#define SKIP_CONNECTIVITY 0x0008
45#define ZONE_FILL_OP 0x0010
46#define SKIP_TEARDROPS 0x0020
47
48class BOARD_COMMIT : public COMMIT
49{
50public:
52 BOARD_COMMIT( TOOL_BASE* aTool );
54 BOARD_COMMIT( TOOL_MANAGER* aMgr, bool aIsBoardEditor );
55
56 virtual ~BOARD_COMMIT() {}
57
58 BOARD* GetBoard() const;
59
60 virtual void Push( const wxString& aMessage = wxEmptyString, int aCommitFlags = 0 ) override;
61
62 virtual void Revert() override;
63 COMMIT& Stage( EDA_ITEM* aItem, CHANGE_TYPE aChangeType,
64 BASE_SCREEN* aScreen = nullptr ) override;
65 COMMIT& Stage( std::vector<EDA_ITEM*>& container, CHANGE_TYPE aChangeType,
66 BASE_SCREEN* aScreen = nullptr ) override;
67 COMMIT& Stage( const PICKED_ITEMS_LIST& aItems,
68 UNDO_REDO aModFlag = UNDO_REDO::UNSPECIFIED,
69 BASE_SCREEN* aScreen = nullptr ) override;
70
71 static EDA_ITEM* MakeImage( EDA_ITEM* aItem );
72
73private:
74 EDA_ITEM* parentObject( EDA_ITEM* aItem ) const override;
75
76 EDA_ITEM* makeImage( EDA_ITEM* aItem ) const override;
77
78 void propagateDamage( BOARD_ITEM* aItem, std::vector<ZONE*>* aStaleZones,
79 std::vector<PCB_SHAPE*>* aStaleHatchedShapes );
80
81private:
85};
86
87#endif
Handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:41
virtual void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Execute the changes.
COMMIT & Stage(EDA_ITEM *aItem, CHANGE_TYPE aChangeType, BASE_SCREEN *aScreen=nullptr) override
Add a change of the item aItem of type aChangeType to the change list.
EDA_ITEM * parentObject(EDA_ITEM *aItem) const override
virtual ~BOARD_COMMIT()
Definition: board_commit.h:56
BOARD * GetBoard() const
virtual void Revert() override
Revert the commit by restoring the modified items state.
static EDA_ITEM * MakeImage(EDA_ITEM *aItem)
bool m_isBoardEditor
Definition: board_commit.h:83
EDA_ITEM * makeImage(EDA_ITEM *aItem) const override
TOOL_MANAGER * m_toolMgr
Definition: board_commit.h:82
bool m_isFootprintEditor
Definition: board_commit.h:84
void propagateDamage(BOARD_ITEM *aItem, std::vector< ZONE * > *aStaleZones, std::vector< PCB_SHAPE * > *aStaleHatchedShapes)
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:78
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:297
Represent a set of changes (additions, deletions or modifications) of a data model (e....
Definition: commit.h:74
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:95
A holder to handle information on schematic or board items.
Base abstract interface for all kinds of tools.
Definition: tool_base.h:66
Master controller class:
Definition: tool_manager.h:62
Handle a list of polygons defining a copper zone.
Definition: zone.h:74
CHANGE_TYPE
Types of changes.
Definition: commit.h:41
UNDO_REDO
Undo Redo considerations: Basically we have 3 cases New item Deleted item Modified item there is also...