LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
cmdfootprintpadedit.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_LIBRARY_CMDFOOTPRINTPADEDIT_H
21 #define LIBREPCB_LIBRARY_CMDFOOTPRINTPADEDIT_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "../footprintpad.h"
27 
29 
30 #include <QtCore>
31 
32 /*******************************************************************************
33  * Namespace / Forward Declarations
34  ******************************************************************************/
35 namespace librepcb {
36 namespace library {
37 
38 /*******************************************************************************
39  * Class CmdFootprintPadEdit
40  ******************************************************************************/
41 
45 class CmdFootprintPadEdit final : public UndoCommand {
46 public:
47  // Constructors / Destructor
48  CmdFootprintPadEdit() = delete;
49  CmdFootprintPadEdit(const CmdFootprintPadEdit& other) = delete;
50  explicit CmdFootprintPadEdit(FootprintPad& pad) noexcept;
51  ~CmdFootprintPadEdit() noexcept;
52 
53  // Setters
54  void setPackagePadUuid(const Uuid& pad, bool immediate) noexcept;
55  void setBoardSide(FootprintPad::BoardSide side, bool immediate) noexcept;
56  void setShape(FootprintPad::Shape shape, bool immediate) noexcept;
57  void setWidth(const PositiveLength& width, bool immediate) noexcept;
58  void setHeight(const PositiveLength& height, bool immediate) noexcept;
59  void setDrillDiameter(const UnsignedLength& dia, bool immediate) noexcept;
60  void setPosition(const Point& pos, bool immediate) noexcept;
61  void setDeltaToStartPos(const Point& deltaPos, bool immediate) noexcept;
62  void setRotation(const Angle& angle, bool immediate) noexcept;
63  void rotate(const Angle& angle, const Point& center, bool immediate) noexcept;
64 
65  // Operator Overloadings
67 
68 private:
69  // Private Methods
70 
72  bool performExecute() override;
73 
75  void performUndo() override;
76 
78  void performRedo() override;
79 
80  // Private Member Variables
81 
82  // Attributes from the constructor
84 
85  // General Attributes
102 };
103 
104 /*******************************************************************************
105  * End of File
106  ******************************************************************************/
107 
108 } // namespace library
109 } // namespace librepcb
110 
111 #endif // LIBREPCB_LIBRARY_CMDFOOTPRINTPADEDIT_H
void setDrillDiameter(const UnsignedLength &dia, bool immediate) noexcept
Definition: cmdfootprintpadedit.cpp:109
UnsignedLength mNewDrillDiameter
Definition: cmdfootprintpadedit.h:101
void setWidth(const PositiveLength &width, bool immediate) noexcept
Definition: cmdfootprintpadedit.cpp:95
void setDeltaToStartPos(const Point &deltaPos, bool immediate) noexcept
Definition: cmdfootprintpadedit.cpp:123
PositiveLength mNewHeight
Definition: cmdfootprintpadedit.h:95
The CmdFootprintPadEdit class.
Definition: cmdfootprintpadedit.h:45
BoardSide
Definition: footprintpad.h:58
FootprintPad::Shape mNewShape
Definition: cmdfootprintpadedit.h:91
FootprintPad::BoardSide mNewBoardSide
Definition: cmdfootprintpadedit.h:89
void setHeight(const PositiveLength &height, bool immediate) noexcept
Definition: cmdfootprintpadedit.cpp:102
PositiveLength mOldHeight
Definition: cmdfootprintpadedit.h:94
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition: angle.h:81
Angle mOldRotation
Definition: cmdfootprintpadedit.h:98
void setShape(FootprintPad::Shape shape, bool immediate) noexcept
Definition: cmdfootprintpadedit.cpp:88
void setPackagePadUuid(const Uuid &pad, bool immediate) noexcept
Definition: cmdfootprintpadedit.cpp:74
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5...
Definition: point.h:81
Point mOldPos
Definition: cmdfootprintpadedit.h:96
void setBoardSide(FootprintPad::BoardSide side, bool immediate) noexcept
Definition: cmdfootprintpadedit.cpp:81
Shape
Definition: footprintpad.h:57
Angle mNewRotation
Definition: cmdfootprintpadedit.h:99
void performUndo() override
Undo the command.
Definition: cmdfootprintpadedit.cpp:166
void setPosition(const Point &pos, bool immediate) noexcept
Definition: cmdfootprintpadedit.cpp:116
~CmdFootprintPadEdit() noexcept
Definition: cmdfootprintpadedit.cpp:60
CmdFootprintPadEdit & operator=(const CmdFootprintPadEdit &rhs)=delete
The FootprintPad class represents a pad of a footprint.
Definition: footprintpad.h:52
void performRedo() override
Redo the command.
Definition: cmdfootprintpadedit.cpp:177
FootprintPad::Shape mOldShape
Definition: cmdfootprintpadedit.h:90
void rotate(const Angle &angle, const Point &center, bool immediate) noexcept
Definition: cmdfootprintpadedit.cpp:137
bool performExecute() override
Execute the command the first time.
Definition: cmdfootprintpadedit.cpp:152
PositiveLength mNewWidth
Definition: cmdfootprintpadedit.h:93
The UndoCommand class represents a command which you can undo/redo.
Definition: undocommand.h:52
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition: length.h:783
FootprintPad & mPad
Definition: cmdfootprintpadedit.h:83
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
Uuid mNewPackagePadUuid
Definition: cmdfootprintpadedit.h:87
void setRotation(const Angle &angle, bool immediate) noexcept
Definition: cmdfootprintpadedit.cpp:130
PositiveLength mOldWidth
Definition: cmdfootprintpadedit.h:92
Point mNewPos
Definition: cmdfootprintpadedit.h:97
UnsignedLength mOldDrillDiameter
Definition: cmdfootprintpadedit.h:100
Uuid mOldPackagePadUuid
Definition: cmdfootprintpadedit.h:86
FootprintPad::BoardSide mOldBoardSide
Definition: cmdfootprintpadedit.h:88
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition: length.h:662