LibrePCB Developers Documentation
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/*******************************************************************************
33 * Namespace / Forward Declarations
34 ******************************************************************************/
35namespace librepcb {
36
37class Board;
38class Layer;
39
40namespace editor {
41
42class CmdBoardStrokeTextEdit;
43class LayerComboBox;
44class PositiveLengthEdit;
45
46/*******************************************************************************
47 * Class BoardEditorState_AddStrokeText
48 ******************************************************************************/
49
54 Q_OBJECT
55
56public:
57 // Constructors / Destructor
60 delete;
61 explicit BoardEditorState_AddStrokeText(const Context& context) noexcept;
62 virtual ~BoardEditorState_AddStrokeText() noexcept;
63
64 // General Methods
65 virtual bool entry() noexcept override;
66 virtual bool exit() noexcept override;
67
68 // Event Handlers
69 virtual bool processRotate(const Angle& rotation) noexcept override;
70 virtual bool processFlip(Qt::Orientation orientation) noexcept override;
72 QGraphicsSceneMouseEvent& e) noexcept override;
74 QGraphicsSceneMouseEvent& e) noexcept override;
76 QGraphicsSceneMouseEvent& e) noexcept override;
78 QGraphicsSceneMouseEvent& e) noexcept override;
79
80 // Operator Overloadings
82 const BoardEditorState_AddStrokeText& rhs) = delete;
83
84private: // Methods
85 bool addText(const Point& pos) noexcept;
86 bool rotateText(const Angle& angle) noexcept;
87 bool flipText(Qt::Orientation orientation) noexcept;
88 bool updatePosition(const Point& pos) noexcept;
89 bool fixPosition(const Point& pos) noexcept;
90 bool abortCommand(bool showErrMsgBox) noexcept;
91 void layerComboBoxLayerChanged(const Layer& layer) noexcept;
92 void textComboBoxValueChanged(const QString& value) noexcept;
93 void heightEditValueChanged(const PositiveLength& value) noexcept;
94 void mirrorCheckBoxToggled(bool checked) noexcept;
95
96private: // Data
97 // State
99
100 // Parameter memory
106 QString mLastText;
108
109 // Information about the current text to place. Only valid if
110 // mIsUndoCmdActive == true.
113
114 // Widgets for the command toolbar
116 QPointer<QCheckBox> mMirrorCheckBox;
117};
118
119/*******************************************************************************
120 * End of File
121 ******************************************************************************/
122
123} // namespace editor
124} // namespace librepcb
125
126#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 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:79
The "add stroke text" state/tool of the board editor.
Definition: boardeditorstate_addstroketext.h:53
virtual bool processGraphicsSceneMouseMoved(QGraphicsSceneMouseEvent &e) noexcept override
Definition: boardeditorstate_addstroketext.cpp:166
PositiveLength mLastHeight
Definition: boardeditorstate_addstroketext.h:103
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:101
QString mLastText
Definition: boardeditorstate_addstroketext.h:106
void heightEditValueChanged(const PositiveLength &value) noexcept
Definition: boardeditorstate_addstroketext.cpp:327
bool updatePosition(const Point &pos) noexcept
Definition: boardeditorstate_addstroketext.cpp:260
UnsignedLength mLastStrokeWidth
Definition: boardeditorstate_addstroketext.h:104
bool mLastMirrored
Definition: boardeditorstate_addstroketext.h:107
virtual bool processRotate(const Angle &rotation) noexcept override
Definition: boardeditorstate_addstroketext.cpp:156
QScopedPointer< CmdBoardStrokeTextEdit > mCurrentTextEditCmd
Definition: boardeditorstate_addstroketext.h:112
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:98
Angle mLastRotation
Definition: boardeditorstate_addstroketext.h:102
virtual bool exit() noexcept override
Definition: boardeditorstate_addstroketext.cpp:141
QPointer< LayerComboBox > mLayerComboBox
Definition: boardeditorstate_addstroketext.h:115
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:105
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:116
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:111
The board editor state base class.
Definition: boardeditorstate.h:59
The CmdBoardStrokeTextEdit class.
Definition: cmdboardstroketextedit.h:48
The LayerComboBox class.
Definition: layercombobox.h:47
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
FSM Context.
Definition: boardeditorfsm.h:88