LibrePCB Developers Documentation
Loading...
Searching...
No Matches
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#include <memory>
34
35/*******************************************************************************
36 * Namespace / Forward Declarations
37 ******************************************************************************/
38namespace librepcb {
39
40class Layer;
41class SI_Text;
42class Schematic;
43
44namespace editor {
45
46class CmdTextEdit;
47class LayerComboBox;
48class PositiveLengthEdit;
49
50/*******************************************************************************
51 * Class SchematicEditorState_AddText
52 ******************************************************************************/
53
58 Q_OBJECT
59
60public:
61 // Constructors / Destructor
64 delete;
65 explicit SchematicEditorState_AddText(const Context& context) noexcept;
66 virtual ~SchematicEditorState_AddText() noexcept;
67
68 // General Methods
69 virtual bool entry() noexcept override;
70 virtual bool exit() noexcept override;
71
72 // Event Handlers
73 virtual bool processRotate(const Angle& rotation) noexcept override;
74 virtual bool processMirror(Qt::Orientation orientation) noexcept override;
76 QGraphicsSceneMouseEvent& e) noexcept override;
78 QGraphicsSceneMouseEvent& e) noexcept override;
80 QGraphicsSceneMouseEvent& e) noexcept override;
82 QGraphicsSceneMouseEvent& e) noexcept override;
83 virtual bool processSwitchToSchematicPage(int index) noexcept override;
84
85 // Operator Overloadings
87 const SchematicEditorState_AddText& rhs) = delete;
88
89private: // Methods
90 bool addText(const Point& pos) noexcept;
91 bool rotateText(const Angle& angle) noexcept;
92 bool updatePosition(const Point& pos) noexcept;
93 bool fixPosition(const Point& pos) noexcept;
94 bool abortCommand(bool showErrMsgBox) noexcept;
95 void layerComboBoxLayerChanged(const Layer& layer) noexcept;
96 void textComboBoxValueChanged(const QString& value) noexcept;
97 void heightEditValueChanged(const PositiveLength& value) noexcept;
98
99private: // Data
100 // State
103
104 // Information about the current text to place. Only valid if
105 // mIsUndoCmdActive == true.
108};
109
110/*******************************************************************************
111 * End of File
112 ******************************************************************************/
113
114} // namespace editor
115} // namespace librepcb
116
117#endif
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 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:57
virtual bool processGraphicsSceneMouseMoved(QGraphicsSceneMouseEvent &e) noexcept override
Definition schematiceditorstate_addtext.cpp:163
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
std::unique_ptr< CmdTextEdit > mCurrentTextEditCmd
Definition schematiceditorstate_addtext.h:107
SI_Text * mCurrentTextToPlace
Definition schematiceditorstate_addtext.h:106
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:101
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:102
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:76
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition length.h:810
Definition uuid.h:186
FSM Context.
Definition schematiceditorfsm.h:81