LibrePCB Developers Documentation
schematiceditorstate_addtext.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_SCHEMATICEDITORSTATE_ADDTEXT_H
21#define LIBREPCB_EDITOR_SCHEMATICEDITORSTATE_ADDTEXT_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
27
29
30#include <QtCore>
31#include <QtWidgets>
32
33/*******************************************************************************
34 * Namespace / Forward Declarations
35 ******************************************************************************/
36namespace librepcb {
37
38class Layer;
39class SI_Text;
40class Schematic;
41
42namespace editor {
43
44class CmdTextEdit;
45class LayerComboBox;
46class PositiveLengthEdit;
47
48/*******************************************************************************
49 * Class SchematicEditorState_AddText
50 ******************************************************************************/
51
56 Q_OBJECT
57
58public:
59 // Constructors / Destructor
62 delete;
63 explicit SchematicEditorState_AddText(const Context& context) noexcept;
64 virtual ~SchematicEditorState_AddText() 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 processMirror(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 virtual bool processSwitchToSchematicPage(int index) noexcept override;
82
83 // Operator Overloadings
85 const SchematicEditorState_AddText& rhs) = delete;
86
87private: // Methods
88 bool addText(const Point& pos) noexcept;
89 bool rotateText(const Angle& angle) 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
97private: // Data
98 // State
101
102 // Information about the current text to place. Only valid if
103 // mIsUndoCmdActive == true.
106};
107
108/*******************************************************************************
109 * End of File
110 ******************************************************************************/
111
112} // namespace editor
113} // namespace librepcb
114
115#endif
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition: angle.h:78
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
The SI_Text class represents a text label in a schematic.
Definition: si_text.h:48
The Text class.
Definition: text.h:48
The CmdTextEdit class.
Definition: cmdtextedit.h:51
The SchematicEditorState_AddText class.
Definition: schematiceditorstate_addtext.h:55
virtual bool processGraphicsSceneMouseMoved(QGraphicsSceneMouseEvent &e) noexcept override
Definition: schematiceditorstate_addtext.cpp:163
QScopedPointer< CmdTextEdit > mCurrentTextEditCmd
Definition: schematiceditorstate_addtext.h:105
void layerComboBoxLayerChanged(const Layer &layer) noexcept
Definition: schematiceditorstate_addtext.cpp:291
void heightEditValueChanged(const PositiveLength &value) noexcept
Definition: schematiceditorstate_addtext.cpp:307
bool updatePosition(const Point &pos) noexcept
Definition: schematiceditorstate_addtext.cpp:241
SchematicEditorState_AddText(const SchematicEditorState_AddText &other)=delete
virtual bool processRotate(const Angle &rotation) noexcept override
Definition: schematiceditorstate_addtext.cpp:148
SI_Text * mCurrentTextToPlace
Definition: schematiceditorstate_addtext.h:104
void textComboBoxValueChanged(const QString &value) noexcept
Definition: schematiceditorstate_addtext.cpp:299
bool abortCommand(bool showErrMsgBox) noexcept
Definition: schematiceditorstate_addtext.cpp:269
bool mIsUndoCmdActive
Definition: schematiceditorstate_addtext.h:99
virtual bool processSwitchToSchematicPage(int index) noexcept override
Definition: schematiceditorstate_addtext.cpp:195
virtual bool exit() noexcept override
Definition: schematiceditorstate_addtext.cpp:133
Text mLastTextProperties
Definition: schematiceditorstate_addtext.h:100
virtual bool processGraphicsSceneRightMouseButtonReleased(QGraphicsSceneMouseEvent &e) noexcept override
Definition: schematiceditorstate_addtext.cpp:183
bool fixPosition(const Point &pos) noexcept
Definition: schematiceditorstate_addtext.cpp:250
virtual bool processMirror(Qt::Orientation orientation) noexcept override
Definition: schematiceditorstate_addtext.cpp:153
bool addText(const Point &pos) noexcept
Definition: schematiceditorstate_addtext.cpp:205
virtual bool processGraphicsSceneLeftMouseButtonPressed(QGraphicsSceneMouseEvent &e) noexcept override
Definition: schematiceditorstate_addtext.cpp:169
bool rotateText(const Angle &angle) noexcept
Definition: schematiceditorstate_addtext.cpp:232
virtual ~SchematicEditorState_AddText() noexcept
Definition: schematiceditorstate_addtext.cpp:68
virtual bool entry() noexcept override
Definition: schematiceditorstate_addtext.cpp:75
virtual bool processGraphicsSceneLeftMouseButtonDoubleClicked(QGraphicsSceneMouseEvent &e) noexcept override
Definition: schematiceditorstate_addtext.cpp:178
The schematic editor state base class.
Definition: schematiceditorstate.h:57
Definition: occmodel.cpp:77
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition: length.h:812
FSM Context.
Definition: schematiceditorfsm.h:81