LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
cmdsymbolpinedit.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_CMDSYMBOLPINEDIT_H
21 #define LIBREPCB_LIBRARY_CMDSYMBOLPINEDIT_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "../symbolpin.h"
27 
29 
30 #include <QtCore>
31 
32 /*******************************************************************************
33  * Namespace / Forward Declarations
34  ******************************************************************************/
35 namespace librepcb {
36 namespace library {
37 
38 /*******************************************************************************
39  * Class CmdSymbolPinEdit
40  ******************************************************************************/
41 
45 class CmdSymbolPinEdit final : public UndoCommand {
46 public:
47  // Constructors / Destructor
48  CmdSymbolPinEdit() = delete;
49  CmdSymbolPinEdit(const CmdSymbolPinEdit& other) = delete;
50  explicit CmdSymbolPinEdit(SymbolPin& pin) noexcept;
51  ~CmdSymbolPinEdit() noexcept;
52 
53  // Setters
54  void setName(const CircuitIdentifier& name, bool immediate) noexcept;
55  void setLength(const UnsignedLength& length, bool immediate) noexcept;
56  void setPosition(const Point& pos, bool immediate) noexcept;
57  void translate(const Point& deltaPos, bool immediate) noexcept;
58  void setRotation(const Angle& angle, bool immediate) noexcept;
59  void rotate(const Angle& angle, const Point& center, bool immediate) noexcept;
60 
61  // Operator Overloadings
62  CmdSymbolPinEdit& operator=(const CmdSymbolPinEdit& rhs) = delete;
63 
64 private:
65  // Private Methods
66 
68  bool performExecute() override;
69 
71  void performUndo() override;
72 
74  void performRedo() override;
75 
76  // Private Member Variables
77 
78  // Attributes from the constructor
80 
81  // General Attributes
90 };
91 
92 /*******************************************************************************
93  * End of File
94  ******************************************************************************/
95 
96 } // namespace library
97 } // namespace librepcb
98 
99 #endif // LIBREPCB_LIBRARY_CMDSYMBOLPINEDIT_H
UnsignedLength mOldLength
Definition: cmdsymbolpinedit.h:84
Point mNewPos
Definition: cmdsymbolpinedit.h:87
Point mOldPos
Definition: cmdsymbolpinedit.h:86
Angle mOldRotation
Definition: cmdsymbolpinedit.h:88
void performRedo() override
Redo the command.
Definition: cmdsymbolpinedit.cpp:130
void rotate(const Angle &angle, const Point &center, bool immediate) noexcept
Definition: cmdsymbolpinedit.cpp:98
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition: angle.h:78
CmdSymbolPinEdit & operator=(const CmdSymbolPinEdit &rhs)=delete
Angle mNewRotation
Definition: cmdsymbolpinedit.h:89
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5...
Definition: point.h:78
SymbolPin & mPin
Definition: cmdsymbolpinedit.h:79
void setName(const CircuitIdentifier &name, bool immediate) noexcept
Definition: cmdsymbolpinedit.cpp:64
type_safe::constrained_type< QString, CircuitIdentifierConstraint, CircuitIdentifierVerifier > CircuitIdentifier
Definition: circuitidentifier.h:89
CircuitIdentifier mNewName
Definition: cmdsymbolpinedit.h:83
void performUndo() override
Undo the command.
Definition: cmdsymbolpinedit.cpp:123
The CmdSymbolPinEdit class.
Definition: cmdsymbolpinedit.h:45
The UndoCommand class represents a command which you can undo/redo.
Definition: undocommand.h:47
void setPosition(const Point &pos, bool immediate) noexcept
Definition: cmdsymbolpinedit.cpp:78
UnsignedLength mNewLength
Definition: cmdsymbolpinedit.h:85
bool performExecute() override
Execute the command the first time.
Definition: cmdsymbolpinedit.cpp:113
The SymbolPin class represents one pin of a symbol.
Definition: symbolpin.h:54
void setRotation(const Angle &angle, bool immediate) noexcept
Definition: cmdsymbolpinedit.cpp:91
void setLength(const UnsignedLength &length, bool immediate) noexcept
Definition: cmdsymbolpinedit.cpp:71
CircuitIdentifier mOldName
Definition: cmdsymbolpinedit.h:82
void translate(const Point &deltaPos, bool immediate) noexcept
Definition: cmdsymbolpinedit.cpp:84
~CmdSymbolPinEdit() noexcept
Definition: cmdsymbolpinedit.cpp:50
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition: length.h:659