LibrePCB Developers Documentation
Loading...
Searching...
No Matches
symboleditorstate.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_SYMBOLEDITORSTATE_H
21#define LIBREPCB_EDITOR_SYMBOLEDITORSTATE_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../../graphics/graphicsscene.h"
27#include "../../../utils/toolbarproxy.h"
28#include "symboleditorfsm.h"
30
32
33#include <QtCore>
34#include <QtWidgets>
35
36/*******************************************************************************
37 * Namespace / Forward Declarations
38 ******************************************************************************/
39namespace librepcb {
40
41class Layer;
42class LengthUnit;
43
44namespace editor {
45
46class SymbolClipboardData;
47
48/*******************************************************************************
49 * Class SymbolEditorState
50 ******************************************************************************/
51
56class SymbolEditorState : public QObject {
57 Q_OBJECT
58
59public:
61
62 // Constructors / Destructor
64 SymbolEditorState(const SymbolEditorState& other) = delete;
65 explicit SymbolEditorState(const Context& context) noexcept;
66 virtual ~SymbolEditorState() noexcept;
67
68 // General Methods
69 virtual bool entry() noexcept { return true; }
70 virtual bool exit() noexcept { return true; }
71 std::unique_ptr<SymbolClipboardData> takeDataToPaste() noexcept;
72
73 // Event Handlers
74 virtual bool processKeyPressed(const GraphicsSceneKeyEvent& e) noexcept {
75 Q_UNUSED(e);
76 return false;
77 }
78 virtual bool processKeyReleased(const GraphicsSceneKeyEvent& e) noexcept {
79 Q_UNUSED(e);
80 return false;
81 }
83 const GraphicsSceneMouseEvent& e) noexcept {
84 Q_UNUSED(e);
85 return false;
86 }
88 const GraphicsSceneMouseEvent& e) noexcept {
89 Q_UNUSED(e);
90 return false;
91 }
93 const GraphicsSceneMouseEvent& e) noexcept {
94 Q_UNUSED(e);
95 return false;
96 }
98 const GraphicsSceneMouseEvent& e) noexcept {
99 Q_UNUSED(e);
100 return false;
101 }
103 const GraphicsSceneMouseEvent& e) noexcept {
104 Q_UNUSED(e);
105 return false;
106 }
107 virtual bool processSelectAll() noexcept { return false; }
108 virtual bool processCut() noexcept { return false; }
109 virtual bool processCopy() noexcept { return false; }
110 virtual bool processPaste(
111 std::unique_ptr<SymbolClipboardData> data = nullptr) noexcept {
112 Q_UNUSED(data);
113 return false;
114 }
115 virtual bool processMove(const Point& delta) {
116 Q_UNUSED(delta);
117 return false;
118 }
119 virtual bool processRotate(const Angle& rotation) noexcept {
120 Q_UNUSED(rotation);
121 return false;
122 }
123 virtual bool processMirror(Qt::Orientation orientation) noexcept {
124 Q_UNUSED(orientation);
125 return false;
126 }
127 virtual bool processSnapToGrid() noexcept { return false; }
128 virtual bool processRemove() noexcept { return false; }
129 virtual bool processEditProperties() noexcept { return false; }
130 virtual bool processImportPins() noexcept { return false; }
131 virtual bool processImportDxf() noexcept { return false; }
132 virtual bool processAbortCommand() noexcept { return false; }
134 const PositiveLength& inverval) noexcept {
135 Q_UNUSED(inverval);
136 return false;
137 }
138
139 // Operator Overloadings
141
142signals:
144
145protected: // Methods
146 void requestPaste(std::unique_ptr<SymbolClipboardData> data) noexcept;
149 PositiveLength getGridInterval() const noexcept;
150 const LengthUnit& getLengthUnit() const noexcept;
151 QWidget* parentWidget() noexcept;
152 static const QSet<const Layer*>& getAllowedTextLayers() noexcept;
153 static const QSet<const Layer*>& getAllowedCircleAndPolygonLayers() noexcept;
154
155private: // Data
157
158protected: // Data
161};
162
163/*******************************************************************************
164 * End of File
165 ******************************************************************************/
166
167} // namespace editor
168} // namespace librepcb
169
170#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 LengthUnit class represents a length unit (millimeters, inches,...) and provides some useful meth...
Definition lengthunit.h:62
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition point.h:78
The GraphicsScene class.
Definition graphicsscene.h:64
The SymbolClipboardData class.
Definition symbolclipboarddata.h:49
Interface for the integration of the Symbol editor FSM.
Definition symboleditorfsmadapter.h:61
The SymbolEditorState class is the base class of all symbol editor FSM states.
Definition symboleditorstate.h:56
Context mContext
Definition symboleditorstate.h:159
GraphicsScene * getGraphicsScene() noexcept
Definition symboleditorstate.cpp:69
virtual bool processEditProperties() noexcept
Definition symboleditorstate.h:129
virtual bool processAbortCommand() noexcept
Definition symboleditorstate.h:132
void requestPaste(std::unique_ptr< SymbolClipboardData > data) noexcept
Definition symboleditorstate.cpp:63
virtual bool processGridIntervalChanged(const PositiveLength &inverval) noexcept
Definition symboleditorstate.h:133
SymbolEditorFsmAdapter & mAdapter
Definition symboleditorstate.h:160
virtual bool exit() noexcept
Definition symboleditorstate.h:70
const LengthUnit & getLengthUnit() const noexcept
Definition symboleditorstate.cpp:81
virtual bool processGraphicsSceneLeftMouseButtonPressed(const GraphicsSceneMouseEvent &e) noexcept
Definition symboleditorstate.h:87
std::unique_ptr< SymbolClipboardData > takeDataToPaste() noexcept
Definition symboleditorstate.cpp:55
virtual bool processSnapToGrid() noexcept
Definition symboleditorstate.h:127
virtual bool processMove(const Point &delta)
Definition symboleditorstate.h:115
static const QSet< const Layer * > & getAllowedCircleAndPolygonLayers() noexcept
Definition symboleditorstate.cpp:104
virtual bool entry() noexcept
Definition symboleditorstate.h:69
virtual bool processSelectAll() noexcept
Definition symboleditorstate.h:107
SymbolEditorState(const SymbolEditorState &other)=delete
virtual bool processPaste(std::unique_ptr< SymbolClipboardData > data=nullptr) noexcept
Definition symboleditorstate.h:110
QWidget * parentWidget() noexcept
Definition symboleditorstate.cpp:85
static const QSet< const Layer * > & getAllowedTextLayers() noexcept
Definition symboleditorstate.cpp:89
virtual bool processRotate(const Angle &rotation) noexcept
Definition symboleditorstate.h:119
SymbolGraphicsItem * getGraphicsItem() noexcept
Definition symboleditorstate.cpp:73
virtual bool processGraphicsSceneMouseMoved(const GraphicsSceneMouseEvent &e) noexcept
Definition symboleditorstate.h:82
virtual ~SymbolEditorState() noexcept
Definition symboleditorstate.cpp:47
virtual bool processImportDxf() noexcept
Definition symboleditorstate.h:131
SymbolEditorState & operator=(const SymbolEditorState &rhs)=delete
virtual bool processImportPins() noexcept
Definition symboleditorstate.h:130
virtual bool processKeyReleased(const GraphicsSceneKeyEvent &e) noexcept
Definition symboleditorstate.h:78
virtual bool processGraphicsSceneLeftMouseButtonDoubleClicked(const GraphicsSceneMouseEvent &e) noexcept
Definition symboleditorstate.h:97
virtual bool processKeyPressed(const GraphicsSceneKeyEvent &e) noexcept
Definition symboleditorstate.h:74
PositiveLength getGridInterval() const noexcept
Definition symboleditorstate.cpp:77
virtual bool processMirror(Qt::Orientation orientation) noexcept
Definition symboleditorstate.h:123
std::unique_ptr< SymbolClipboardData > mDataToPaste
Definition symboleditorstate.h:156
virtual bool processGraphicsSceneLeftMouseButtonReleased(const GraphicsSceneMouseEvent &e) noexcept
Definition symboleditorstate.h:92
virtual bool processCopy() noexcept
Definition symboleditorstate.h:109
virtual bool processCut() noexcept
Definition symboleditorstate.h:108
virtual bool processGraphicsSceneRightMouseButtonReleased(const GraphicsSceneMouseEvent &e) noexcept
Definition symboleditorstate.h:102
virtual bool processRemove() noexcept
Definition symboleditorstate.h:128
The SymbolGraphicsItem class.
Definition symbolgraphicsitem.h:56
Definition occmodel.cpp:77
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition length.h:810
Definition uuid.h:186
Definition graphicsscene.h:52
Definition graphicsscene.h:45
Definition symboleditorfsm.h:75