LibrePCB Developers Documentation
Loading...
Searching...
No Matches
cmdstroketextedit.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_CMDSTROKETEXTEDIT_H
21#define LIBREPCB_EDITOR_CMDSTROKETEXTEDIT_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../undocommand.h"
29#include "cmdlistelementsswap.h"
30
32
33#include <QtCore>
34
35/*******************************************************************************
36 * Namespace / Forward Declarations
37 ******************************************************************************/
38namespace librepcb {
39
40class Layer;
41
42namespace editor {
43
44/*******************************************************************************
45 * Class CmdStrokeTextEdit
46 ******************************************************************************/
47
51class CmdStrokeTextEdit final : public UndoCommand {
52public:
53 // Constructors / Destructor
55 CmdStrokeTextEdit(const CmdStrokeTextEdit& other) = delete;
56 explicit CmdStrokeTextEdit(StrokeText& text) noexcept;
57 ~CmdStrokeTextEdit() noexcept;
58
59 // Setters
60 void setLayer(const Layer& layer, bool immediate) noexcept;
61 void setText(const QString& text, bool immediate) noexcept;
62 void setHeight(const PositiveLength& height, bool immediate) noexcept;
63 void setStrokeWidth(const UnsignedLength& strokeWidth,
64 bool immediate) noexcept;
65 void setLetterSpacing(const StrokeTextSpacing& spacing,
66 bool immediate) noexcept;
67 void setLineSpacing(const StrokeTextSpacing& spacing,
68 bool immediate) noexcept;
69 void setAlignment(const Alignment& align, bool immediate) noexcept;
70 void setPosition(const Point& pos, bool immediate) noexcept;
71 void translate(const Point& delta, bool immediate) noexcept;
72 void snapToGrid(const PositiveLength& gridInterval, bool immediate) noexcept;
73 void setRotation(const Angle& angle, bool immediate) noexcept;
74 void rotate(const Angle& angle, const Point& center, bool immediate) noexcept;
75 void setMirrored(bool mirrored, bool immediate) noexcept;
76 void mirrorGeometry(Qt::Orientation orientation, const Point& center,
77 bool immediate) noexcept;
78 void mirrorLayer(bool immediate) noexcept;
79 void setAutoRotate(bool autoRotate, bool immediate) noexcept;
80
81 // Operator Overloadings
82 CmdStrokeTextEdit& operator=(const CmdStrokeTextEdit& rhs) = delete;
83
84private:
85 // Private Methods
86
88 bool performExecute() override;
89
91 void performUndo() override;
92
94 void performRedo() override;
95
96 // Private Member Variables
97
98 // Attributes from the constructor
100
101 // General Attributes
104 QString mOldText;
105 QString mNewText;
124};
125
126/*******************************************************************************
127 * Undo Commands
128 ******************************************************************************/
129
132 StrokeText::Event>;
135 StrokeText::Event>;
138 StrokeText::Event>;
139
140/*******************************************************************************
141 * End of File
142 ******************************************************************************/
143
144} // namespace editor
145} // namespace librepcb
146
147#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:76
The Layer class provides all supported geometry layers.
Definition layer.h:42
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition point.h:78
The StrokeText class.
Definition stroketext.h:51
Represents the letter- or line spacing configuration of a stroke text.
Definition stroketextspacing.h:44
The CmdListElementInsert class.
Definition cmdlistelementinsert.h:46
The CmdListElementRemove class.
Definition cmdlistelementremove.h:46
The CmdListElementsSwap class.
Definition cmdlistelementsswap.h:46
The CmdStrokeTextEdit class.
Definition cmdstroketextedit.h:51
void performRedo() override
Redo the command.
Definition cmdstroketextedit.cpp:219
UnsignedLength mNewStrokeWidth
Definition cmdstroketextedit.h:113
void setHeight(const PositiveLength &height, bool immediate) noexcept
Definition cmdstroketextedit.cpp:88
void setPosition(const Point &pos, bool immediate) noexcept
Definition cmdstroketextedit.cpp:123
void setLayer(const Layer &layer, bool immediate) noexcept
Definition cmdstroketextedit.cpp:76
bool mNewAutoRotate
Definition cmdstroketextedit.h:123
Point mOldPosition
Definition cmdstroketextedit.h:106
StrokeTextSpacing mOldLineSpacing
Definition cmdstroketextedit.h:116
bool mOldMirrored
Definition cmdstroketextedit.h:120
void setMirrored(bool mirrored, bool immediate) noexcept
Definition cmdstroketextedit.cpp:153
void translate(const Point &delta, bool immediate) noexcept
Definition cmdstroketextedit.cpp:129
Angle mNewRotation
Definition cmdstroketextedit.h:109
void setAutoRotate(bool autoRotate, bool immediate) noexcept
Definition cmdstroketextedit.cpp:177
void performUndo() override
Undo the command.
Definition cmdstroketextedit.cpp:205
PositiveLength mNewHeight
Definition cmdstroketextedit.h:111
bool mNewMirrored
Definition cmdstroketextedit.h:121
StrokeTextSpacing mOldLetterSpacing
Definition cmdstroketextedit.h:114
void mirrorGeometry(Qt::Orientation orientation, const Point &center, bool immediate) noexcept
Definition cmdstroketextedit.cpp:159
void setAlignment(const Alignment &align, bool immediate) noexcept
Definition cmdstroketextedit.cpp:116
void setText(const QString &text, bool immediate) noexcept
Definition cmdstroketextedit.cpp:82
Alignment mNewAlign
Definition cmdstroketextedit.h:119
bool mOldAutoRotate
Definition cmdstroketextedit.h:122
PositiveLength mOldHeight
Definition cmdstroketextedit.h:110
Alignment mOldAlign
Definition cmdstroketextedit.h:118
void snapToGrid(const PositiveLength &gridInterval, bool immediate) noexcept
Definition cmdstroketextedit.cpp:135
StrokeTextSpacing mNewLineSpacing
Definition cmdstroketextedit.h:117
QString mNewText
Definition cmdstroketextedit.h:105
CmdStrokeTextEdit(const CmdStrokeTextEdit &other)=delete
const Layer * mNewLayer
Definition cmdstroketextedit.h:103
StrokeTextSpacing mNewLetterSpacing
Definition cmdstroketextedit.h:115
void mirrorLayer(bool immediate) noexcept
Definition cmdstroketextedit.cpp:171
Point mNewPosition
Definition cmdstroketextedit.h:107
void setStrokeWidth(const UnsignedLength &strokeWidth, bool immediate) noexcept
Definition cmdstroketextedit.cpp:95
void setLetterSpacing(const StrokeTextSpacing &spacing, bool immediate) noexcept
Definition cmdstroketextedit.cpp:102
void setLineSpacing(const StrokeTextSpacing &spacing, bool immediate) noexcept
Definition cmdstroketextedit.cpp:109
~CmdStrokeTextEdit() noexcept
Definition cmdstroketextedit.cpp:66
bool performExecute() override
Execute the command the first time.
Definition cmdstroketextedit.cpp:188
UnsignedLength mOldStrokeWidth
Definition cmdstroketextedit.h:112
void rotate(const Angle &angle, const Point &center, bool immediate) noexcept
Definition cmdstroketextedit.cpp:147
Angle mOldRotation
Definition cmdstroketextedit.h:108
const Layer * mOldLayer
Definition cmdstroketextedit.h:102
StrokeText & mText
Definition cmdstroketextedit.h:99
QString mOldText
Definition cmdstroketextedit.h:104
void setRotation(const Angle &angle, bool immediate) noexcept
Definition cmdstroketextedit.cpp:140
The UndoCommand class represents a command which you can undo/redo.
Definition undocommand.h:46
CmdListElementsSwap< StrokeText, StrokeTextListNameProvider, StrokeText::Event > CmdStrokeTextsSwap
Definition cmdstroketextedit.h:138
CmdListElementRemove< StrokeText, StrokeTextListNameProvider, StrokeText::Event > CmdStrokeTextRemove
Definition cmdstroketextedit.h:135
CmdListElementInsert< StrokeText, StrokeTextListNameProvider, StrokeText::Event > CmdStrokeTextInsert
Definition cmdstroketextedit.h:132
Definition occmodel.cpp:76
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition length.h:810
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition length.h:694
Definition stroketext.h:155