LibrePCB Developers Documentation
cmdfootprintedit.h
Go to the documentation of this file.
1 /*
2  * LibrePCB - Professional EDA for everyone!
3  * Copyright (C) 2013 LibrePCB Developers, see AUTHORS.md for contributors.
4  * https://librepcb.org/
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (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, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef LIBREPCB_EDITOR_CMDFOOTPRINTEDIT_H
21 #define LIBREPCB_EDITOR_CMDFOOTPRINTEDIT_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "../../cmd/cmdlistelementinsert.h"
27 #include "../../cmd/cmdlistelementremove.h"
28 #include "../../cmd/cmdlistelementsswap.h"
29 #include "../../undocommand.h"
30 
33 
34 #include <QtCore>
35 
36 /*******************************************************************************
37  * Namespace / Forward Declarations
38  ******************************************************************************/
39 namespace librepcb {
40 namespace editor {
41 
42 /*******************************************************************************
43  * Class CmdFootprintEdit
44  ******************************************************************************/
45 
49 class CmdFootprintEdit final : public UndoCommand {
50 public:
51  // Constructors / Destructor
52  CmdFootprintEdit() = delete;
53  CmdFootprintEdit(const CmdFootprintEdit& other) = delete;
54  explicit CmdFootprintEdit(Footprint& fpt) noexcept;
55  ~CmdFootprintEdit() noexcept;
56 
57  // Setters
58  void setName(const ElementName& name) noexcept;
59  void setModelPosition(const Point3D& pos) noexcept;
60  void setModelRotation(const Angle3D& rot) noexcept;
61  void setModels(const QSet<Uuid>& models) noexcept;
62 
63  // Operator Overloadings
64  CmdFootprintEdit& operator=(const CmdFootprintEdit& rhs) = delete;
65 
66 private:
67  // Private Methods
68 
70  bool performExecute() override;
71 
73  void performUndo() override;
74 
76  void performRedo() override;
77 
78  // Private Member Variables
79 
80  // Attributes from the constructor
82 
83  // General Attributes
90  QSet<Uuid> mOldModels;
91  QSet<Uuid> mNewModels;
92 };
93 
94 /*******************************************************************************
95  * Undo Commands
96  ******************************************************************************/
97 
98 using CmdFootprintInsert =
101 using CmdFootprintRemove =
102  CmdListElementRemove<Footprint, FootprintListNameProvider,
104 using CmdFootprintsSwap =
106 
107 /*******************************************************************************
108  * End of File
109  ******************************************************************************/
110 
111 } // namespace editor
112 } // namespace librepcb
113 
114 #endif
void setModelPosition(const Point3D &pos) noexcept
Definition: cmdfootprintedit.cpp:62
ElementName mOldName
Definition: cmdfootprintedit.h:84
The CmdListElementRemove class.
Definition: cmdlistelementremove.h:46
Angle3D mOldModelRotation
Definition: cmdfootprintedit.h:88
Definition: occmodel.cpp:77
Angle3D mNewModelRotation
Definition: cmdfootprintedit.h:89
The CmdFootprintEdit class.
Definition: cmdfootprintedit.h:49
void setModelRotation(const Angle3D &rot) noexcept
Definition: cmdfootprintedit.cpp:67
The Footprint class represents one footprint variant of a package.
Definition: footprint.h:55
void setModels(const QSet< Uuid > &models) noexcept
Definition: cmdfootprintedit.cpp:72
void performRedo() override
Redo the command.
Definition: cmdfootprintedit.cpp:98
The CmdListElementInsert class.
Definition: cmdlistelementinsert.h:46
The UndoCommand class represents a command which you can undo/redo.
Definition: undocommand.h:46
~CmdFootprintEdit() noexcept
Definition: cmdfootprintedit.cpp:50
Definition: footprint.h:186
Event
Definition: footprint.h:60
QSet< Uuid > mOldModels
Definition: cmdfootprintedit.h:90
bool performExecute() override
Execute the command the first time.
Definition: cmdfootprintedit.cpp:81
The CmdListElementsSwap class.
Definition: cmdlistelementsswap.h:46
void setName(const ElementName &name) noexcept
Definition: cmdfootprintedit.cpp:57
Point3D mOldModelPosition
Definition: cmdfootprintedit.h:86
QSet< Uuid > mNewModels
Definition: cmdfootprintedit.h:91
Point3D mNewModelPosition
Definition: cmdfootprintedit.h:87
ElementName mNewName
Definition: cmdfootprintedit.h:85
std::tuple< Length, Length, Length > Point3D
Definition: length.h:989
std::tuple< Angle, Angle, Angle > Angle3D
Definition: angle.h:461
Footprint & mFootprint
Definition: cmdfootprintedit.h:81
void performUndo() override
Undo the command.
Definition: cmdfootprintedit.cpp:91
CmdFootprintEdit & operator=(const CmdFootprintEdit &rhs)=delete
type_safe::constrained_type< QString, ElementNameConstraint, ElementNameVerifier > ElementName
Definition: elementname.h:84