LibrePCB Developers Documentation
cmdboardstroketextedit.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_CMDBOARDSTROKETEXTEDIT_H
21#define LIBREPCB_EDITOR_CMDBOARDSTROKETEXTEDIT_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../undocommand.h"
27
29
30#include <QtCore>
31
32/*******************************************************************************
33 * Namespace / Forward Declarations
34 ******************************************************************************/
35namespace librepcb {
36
37class BI_StrokeText;
38
39namespace editor {
40
41/*******************************************************************************
42 * Class CmdBoardStrokeTextEdit
43 ******************************************************************************/
44
48class CmdBoardStrokeTextEdit final : public UndoCommand {
49public:
50 // Constructors / Destructor
51 explicit CmdBoardStrokeTextEdit(BI_StrokeText& text) noexcept;
52 ~CmdBoardStrokeTextEdit() noexcept;
53
54 // Getters
55 BI_StrokeText& getObj() const noexcept { return mText; }
56
57 // Setters
58 void setLayer(const Layer& layer, bool immediate) noexcept;
59 void setText(const QString& text, bool immediate) noexcept;
60 void setHeight(const PositiveLength& height, bool immediate) noexcept;
61 void setStrokeWidth(const UnsignedLength& strokeWidth,
62 bool immediate) noexcept;
63 void setLetterSpacing(const StrokeTextSpacing& spacing,
64 bool immediate) noexcept;
65 void setLineSpacing(const StrokeTextSpacing& spacing,
66 bool immediate) noexcept;
67 void setAlignment(const Alignment& align, bool immediate) noexcept;
68 void setPosition(const Point& pos, bool immediate) noexcept;
69 void translate(const Point& delta, bool immediate) noexcept;
70 void snapToGrid(const PositiveLength& gridInterval, bool immediate) noexcept;
71 void setRotation(const Angle& angle, bool immediate) noexcept;
72 void rotate(const Angle& angle, const Point& center, bool immediate) noexcept;
73 void setMirrored(bool mirrored, bool immediate) noexcept;
74 void mirrorGeometry(Qt::Orientation orientation, const Point& center,
75 bool immediate) noexcept;
76 void mirrorGeometry(const Angle& rotation, const Point& center,
77 bool immediate) noexcept;
78 void mirrorLayer(int innerLayerCount, bool immediate) noexcept;
79 void setAutoRotate(bool autoRotate, bool immediate) noexcept;
80 void setLocked(bool locked) noexcept;
81
82private: // Methods
84 bool performExecute() override;
85
87 void performUndo() override;
88
90 void performRedo() override;
91
92private: // Data
94
97};
98
99/*******************************************************************************
100 * End of File
101 ******************************************************************************/
102
103} // namespace editor
104} // namespace librepcb
105
106#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 BI_StrokeText class.
Definition: bi_stroketext.h:49
The BoardStrokeTextData class.
Definition: boardstroketextdata.h:49
The Layer class provides all supported geometry layers.
Definition: layer.h:40
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition: point.h:79
Represents the letter- or line spacing configuration of a stroke text.
Definition: stroketextspacing.h:44
The CmdBoardStrokeTextEdit class.
Definition: cmdboardstroketextedit.h:48
void performRedo() override
Redo the command.
Definition: cmdboardstroketextedit.cpp:227
void setHeight(const PositiveLength &height, bool immediate) noexcept
Definition: cmdboardstroketextedit.cpp:73
void mirrorLayer(int innerLayerCount, bool immediate) noexcept
Definition: cmdboardstroketextedit.cpp:182
BI_StrokeText & getObj() const noexcept
Definition: cmdboardstroketextedit.h:55
void setPosition(const Point &pos, bool immediate) noexcept
Definition: cmdboardstroketextedit.cpp:113
void setLayer(const Layer &layer, bool immediate) noexcept
Definition: cmdboardstroketextedit.cpp:57
void setMirrored(bool mirrored, bool immediate) noexcept
Definition: cmdboardstroketextedit.cpp:149
void translate(const Point &delta, bool immediate) noexcept
Definition: cmdboardstroketextedit.cpp:121
BI_StrokeText & mText
Definition: cmdboardstroketextedit.h:93
void setAutoRotate(bool autoRotate, bool immediate) noexcept
Definition: cmdboardstroketextedit.cpp:189
void performUndo() override
Undo the command.
Definition: cmdboardstroketextedit.cpp:212
void mirrorGeometry(Qt::Orientation orientation, const Point &center, bool immediate) noexcept
Definition: cmdboardstroketextedit.cpp:157
void setAlignment(const Alignment &align, bool immediate) noexcept
Definition: cmdboardstroketextedit.cpp:105
void setText(const QString &text, bool immediate) noexcept
Definition: cmdboardstroketextedit.cpp:65
void snapToGrid(const PositiveLength &gridInterval, bool immediate) noexcept
Definition: cmdboardstroketextedit.cpp:129
CmdBoardStrokeTextEdit(BI_StrokeText &text) noexcept
Definition: cmdboardstroketextedit.cpp:40
~CmdBoardStrokeTextEdit() noexcept
Definition: cmdboardstroketextedit.cpp:47
void setStrokeWidth(const UnsignedLength &strokeWidth, bool immediate) noexcept
Definition: cmdboardstroketextedit.cpp:81
void setLetterSpacing(const StrokeTextSpacing &spacing, bool immediate) noexcept
Definition: cmdboardstroketextedit.cpp:89
BoardStrokeTextData mOldData
Definition: cmdboardstroketextedit.h:95
BoardStrokeTextData mNewData
Definition: cmdboardstroketextedit.h:96
void setLineSpacing(const StrokeTextSpacing &spacing, bool immediate) noexcept
Definition: cmdboardstroketextedit.cpp:97
bool performExecute() override
Execute the command the first time.
Definition: cmdboardstroketextedit.cpp:206
void setLocked(bool locked) noexcept
Definition: cmdboardstroketextedit.cpp:197
void rotate(const Angle &angle, const Point &center, bool immediate) noexcept
Definition: cmdboardstroketextedit.cpp:142
void setRotation(const Angle &angle, bool immediate) noexcept
Definition: cmdboardstroketextedit.cpp:134
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< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition: length.h:696