LibrePCB Developers Documentation
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_EDITOR_CMDSYMBOLPINEDIT_H
21#define LIBREPCB_EDITOR_CMDSYMBOLPINEDIT_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
32
33#include <QtCore>
34
35/*******************************************************************************
36 * Namespace / Forward Declarations
37 ******************************************************************************/
38namespace librepcb {
39namespace editor {
40
41/*******************************************************************************
42 * Class CmdSymbolPinEdit
43 ******************************************************************************/
44
48class CmdSymbolPinEdit final : public UndoCommand {
49public:
50 // Constructors / Destructor
51 CmdSymbolPinEdit() = delete;
52 CmdSymbolPinEdit(const CmdSymbolPinEdit& other) = delete;
53 explicit CmdSymbolPinEdit(std::shared_ptr<SymbolPin> pin) noexcept;
54 ~CmdSymbolPinEdit() noexcept;
55
56 // Setters
57 void setName(const CircuitIdentifier& name, bool immediate) noexcept;
58 void setLength(const UnsignedLength& length, bool immediate) noexcept;
59 void setNamePosition(const Point& position, bool immediate) noexcept;
60 void setNameRotation(const Angle& rotation, bool immediate) noexcept;
61 void setNameHeight(const PositiveLength& height, bool immediate) noexcept;
62 void setNameAlignment(const Alignment& align, bool immediate) noexcept;
63 void setPosition(const Point& pos, bool immediate) noexcept;
64 void translate(const Point& deltaPos, bool immediate) noexcept;
65 void snapToGrid(const PositiveLength& gridInterval, bool immediate) noexcept;
66 void setRotation(const Angle& angle, bool immediate) noexcept;
67 void rotate(const Angle& angle, const Point& center, bool immediate) noexcept;
68 void mirror(Qt::Orientation orientation, const Point& center,
69 bool immediate) noexcept;
70
71 // Operator Overloadings
72 CmdSymbolPinEdit& operator=(const CmdSymbolPinEdit& rhs) = delete;
73
74private:
75 // Private Methods
76
78 bool performExecute() override;
79
81 void performUndo() override;
82
84 void performRedo() override;
85
86 // Private Member Variables
87
88 // Attributes from the constructor
89 std::shared_ptr<SymbolPin> mPin;
90
91 // General Attributes
108};
109
110/*******************************************************************************
111 * Undo Commands
112 ******************************************************************************/
113
116 SymbolPin::Event>;
119 SymbolPin::Event>;
122
123/*******************************************************************************
124 * End of File
125 ******************************************************************************/
126
127} // namespace editor
128} // namespace librepcb
129
130#endif
The Alignment class.
Definition: alignment.h:115
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition: angle.h:78
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition: point.h:79
The SymbolPin class represents one pin of a symbol.
Definition: symbolpin.h:51
The CmdListElementInsert class.
Definition: cmdlistelementinsert.h:46
The CmdListElementRemove class.
Definition: cmdlistelementremove.h:46
The CmdListElementsSwap class.
Definition: cmdlistelementsswap.h:46
The CmdSymbolPinEdit class.
Definition: cmdsymbolpinedit.h:48
void performRedo() override
Redo the command.
Definition: cmdsymbolpinedit.cpp:195
Alignment mNewNameAlignment
Definition: cmdsymbolpinedit.h:107
PositiveLength mNewNameHeight
Definition: cmdsymbolpinedit.h:105
void setPosition(const Point &pos, bool immediate) noexcept
Definition: cmdsymbolpinedit.cpp:115
void translate(const Point &deltaPos, bool immediate) noexcept
Definition: cmdsymbolpinedit.cpp:121
Angle mNewNameRotation
Definition: cmdsymbolpinedit.h:103
Point mOldPos
Definition: cmdsymbolpinedit.h:96
CircuitIdentifier mOldName
Definition: cmdsymbolpinedit.h:92
void setName(const CircuitIdentifier &name, bool immediate) noexcept
Definition: cmdsymbolpinedit.cpp:73
PositiveLength mOldNameHeight
Definition: cmdsymbolpinedit.h:104
std::shared_ptr< SymbolPin > mPin
Definition: cmdsymbolpinedit.h:89
Angle mNewRotation
Definition: cmdsymbolpinedit.h:99
void setLength(const UnsignedLength &length, bool immediate) noexcept
Definition: cmdsymbolpinedit.cpp:80
~CmdSymbolPinEdit() noexcept
Definition: cmdsymbolpinedit.cpp:59
void performUndo() override
Undo the command.
Definition: cmdsymbolpinedit.cpp:184
UnsignedLength mOldLength
Definition: cmdsymbolpinedit.h:94
Alignment mOldNameAlignment
Definition: cmdsymbolpinedit.h:106
Point mOldNamePosition
Definition: cmdsymbolpinedit.h:100
CmdSymbolPinEdit(const CmdSymbolPinEdit &other)=delete
void setNameHeight(const PositiveLength &height, bool immediate) noexcept
Definition: cmdsymbolpinedit.cpp:101
Angle mOldNameRotation
Definition: cmdsymbolpinedit.h:102
Point mNewPos
Definition: cmdsymbolpinedit.h:97
void snapToGrid(const PositiveLength &gridInterval, bool immediate) noexcept
Definition: cmdsymbolpinedit.cpp:128
void mirror(Qt::Orientation orientation, const Point &center, bool immediate) noexcept
Definition: cmdsymbolpinedit.cpp:151
Point mNewNamePosition
Definition: cmdsymbolpinedit.h:101
void setNameRotation(const Angle &rotation, bool immediate) noexcept
Definition: cmdsymbolpinedit.cpp:94
bool performExecute() override
Execute the command the first time.
Definition: cmdsymbolpinedit.cpp:170
void rotate(const Angle &angle, const Point &center, bool immediate) noexcept
Definition: cmdsymbolpinedit.cpp:140
void setNameAlignment(const Alignment &align, bool immediate) noexcept
Definition: cmdsymbolpinedit.cpp:108
Angle mOldRotation
Definition: cmdsymbolpinedit.h:98
void setNamePosition(const Point &position, bool immediate) noexcept
Definition: cmdsymbolpinedit.cpp:87
UnsignedLength mNewLength
Definition: cmdsymbolpinedit.h:95
CircuitIdentifier mNewName
Definition: cmdsymbolpinedit.h:93
void setRotation(const Angle &angle, bool immediate) noexcept
Definition: cmdsymbolpinedit.cpp:133
The UndoCommand class represents a command which you can undo/redo.
Definition: undocommand.h:46
Definition: occmodel.cpp:77
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition: length.h:812
type_safe::constrained_type< QString, CircuitIdentifierConstraint, CircuitIdentifierVerifier > CircuitIdentifier
Definition: circuitidentifier.h:96
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition: length.h:696
Definition: symbolpin.h:153