LibrePCB Developers Documentation
Loading...
Searching...
No Matches
boardeditorstate_addstroketext.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_BOARDEDITORSTATE_ADDSTROKETEXT_H
21#define LIBREPCB_EDITOR_BOARDEDITORSTATE_ADDSTROKETEXT_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "boardeditorstate.h"
27
29
30#include <QtCore>
31
32#include <memory>
33
34/*******************************************************************************
35 * Namespace / Forward Declarations
36 ******************************************************************************/
37namespace librepcb {
38
39class Board;
40class Layer;
41
42namespace editor {
43
44class CmdBoardStrokeTextEdit;
45class LayerComboBox;
46class PositiveLengthEdit;
47
48/*******************************************************************************
49 * Class BoardEditorState_AddStrokeText
50 ******************************************************************************/
51
56 Q_OBJECT
57
58public:
59 // Constructors / Destructor
62 delete;
63 explicit BoardEditorState_AddStrokeText(const Context& context) noexcept;
64 virtual ~BoardEditorState_AddStrokeText() noexcept;
65
66 // General Methods
67 virtual bool entry() noexcept override;
68 virtual bool exit() noexcept override;
69
70 // Event Handlers
71 virtual bool processRotate(const Angle& rotation) noexcept override;
72 virtual bool processFlip(Qt::Orientation orientation) noexcept override;
74 QGraphicsSceneMouseEvent& e) noexcept override;
76 QGraphicsSceneMouseEvent& e) noexcept override;
78 QGraphicsSceneMouseEvent& e) noexcept override;
80 QGraphicsSceneMouseEvent& e) noexcept override;
81
82 // Operator Overloadings
84 const BoardEditorState_AddStrokeText& rhs) = delete;
85
86private: // Methods
87 bool addText(const Point& pos) noexcept;
88 bool rotateText(const Angle& angle) noexcept;
89 bool flipText(Qt::Orientation orientation) noexcept;
90 bool updatePosition(const Point& pos) noexcept;
91 bool fixPosition(const Point& pos) noexcept;
92 bool abortCommand(bool showErrMsgBox) noexcept;
93 void layerComboBoxLayerChanged(const Layer& layer) noexcept;
94 void textComboBoxValueChanged(const QString& value) noexcept;
95 void heightEditValueChanged(const PositiveLength& value) noexcept;
96 void mirrorCheckBoxToggled(bool checked) noexcept;
97
98private: // Data
99 // State
101
102 // Parameter memory
108 QString mLastText;
110
111 // Information about the current text to place. Only valid if
112 // mIsUndoCmdActive == true.
115
116 // Widgets for the command toolbar
118 QPointer<QCheckBox> mMirrorCheckBox;
119};
120
121/*******************************************************************************
122 * End of File
123 ******************************************************************************/
124
125} // namespace editor
126} // namespace librepcb
127
128#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 BI_StrokeText class.
Definition bi_stroketext.h:49
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 "add stroke text" state/tool of the board editor.
Definition boardeditorstate_addstroketext.h:55
virtual bool processGraphicsSceneMouseMoved(QGraphicsSceneMouseEvent &e) noexcept override
Definition boardeditorstate_addstroketext.cpp:166
PositiveLength mLastHeight
Definition boardeditorstate_addstroketext.h:105
void layerComboBoxLayerChanged(const Layer &layer) noexcept
Definition boardeditorstate_addstroketext.cpp:310
virtual ~BoardEditorState_AddStrokeText() noexcept
Definition boardeditorstate_addstroketext.cpp:66
const Layer * mLastLayer
Definition boardeditorstate_addstroketext.h:103
QString mLastText
Definition boardeditorstate_addstroketext.h:108
void heightEditValueChanged(const PositiveLength &value) noexcept
Definition boardeditorstate_addstroketext.cpp:327
std::unique_ptr< CmdBoardStrokeTextEdit > mCurrentTextEditCmd
Definition boardeditorstate_addstroketext.h:114
bool updatePosition(const Point &pos) noexcept
Definition boardeditorstate_addstroketext.cpp:260
UnsignedLength mLastStrokeWidth
Definition boardeditorstate_addstroketext.h:106
bool mLastMirrored
Definition boardeditorstate_addstroketext.h:109
virtual bool processRotate(const Angle &rotation) noexcept override
Definition boardeditorstate_addstroketext.cpp:156
void textComboBoxValueChanged(const QString &value) noexcept
Definition boardeditorstate_addstroketext.cpp:319
void mirrorCheckBoxToggled(bool checked) noexcept
Definition boardeditorstate_addstroketext.cpp:335
bool abortCommand(bool showErrMsgBox) noexcept
Definition boardeditorstate_addstroketext.cpp:288
bool mIsUndoCmdActive
Definition boardeditorstate_addstroketext.h:100
Angle mLastRotation
Definition boardeditorstate_addstroketext.h:104
virtual bool exit() noexcept override
Definition boardeditorstate_addstroketext.cpp:141
QPointer< LayerComboBox > mLayerComboBox
Definition boardeditorstate_addstroketext.h:117
virtual bool processGraphicsSceneRightMouseButtonReleased(QGraphicsSceneMouseEvent &e) noexcept override
Definition boardeditorstate_addstroketext.cpp:187
bool fixPosition(const Point &pos) noexcept
Definition boardeditorstate_addstroketext.cpp:269
Alignment mLastAlignment
Definition boardeditorstate_addstroketext.h:107
virtual bool processFlip(Qt::Orientation orientation) noexcept override
Definition boardeditorstate_addstroketext.cpp:161
bool flipText(Qt::Orientation orientation) noexcept
Definition boardeditorstate_addstroketext.cpp:242
bool addText(const Point &pos) noexcept
Definition boardeditorstate_addstroketext.cpp:203
BoardEditorState_AddStrokeText(const BoardEditorState_AddStrokeText &other)=delete
QPointer< QCheckBox > mMirrorCheckBox
Definition boardeditorstate_addstroketext.h:118
virtual bool processGraphicsSceneLeftMouseButtonPressed(QGraphicsSceneMouseEvent &e) noexcept override
Definition boardeditorstate_addstroketext.cpp:172
bool rotateText(const Angle &angle) noexcept
Definition boardeditorstate_addstroketext.cpp:232
virtual bool entry() noexcept override
Definition boardeditorstate_addstroketext.cpp:73
virtual bool processGraphicsSceneLeftMouseButtonDoubleClicked(QGraphicsSceneMouseEvent &e) noexcept override
Definition boardeditorstate_addstroketext.cpp:181
BI_StrokeText * mCurrentTextToPlace
Definition boardeditorstate_addstroketext.h:113
The board editor state base class.
Definition boardeditorstate.h:59
The CmdBoardStrokeTextEdit class.
Definition cmdboardstroketextedit.h:48
The LayerComboBox class.
Definition layercombobox.h:45
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 uuid.h:186
FSM Context.
Definition boardeditorfsm.h:88