LibrePCB Developers Documentation
Loading...
Searching...
No Matches
symboleditorfsmadapter.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_SYMBOLEDITORFSMADAPTER_H
21#define LIBREPCB_EDITOR_SYMBOLEDITORFSMADAPTER_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
27
28#include <QtCore>
29#include <QtGui>
30
31#include <optional>
32
33/*******************************************************************************
34 * Namespace / Forward Declarations
35 ******************************************************************************/
36namespace librepcb {
37namespace editor {
38
39class GraphicsScene;
40class SymbolEditorState;
41class SymbolEditorState_AddNames;
42class SymbolEditorState_AddPins;
43class SymbolEditorState_AddValues;
44class SymbolEditorState_DrawArc;
45class SymbolEditorState_DrawCircle;
46class SymbolEditorState_DrawLine;
47class SymbolEditorState_DrawPolygon;
48class SymbolEditorState_DrawRect;
49class SymbolEditorState_DrawText;
50class SymbolEditorState_Measure;
51class SymbolEditorState_Select;
52class SymbolGraphicsItem;
53
54/*******************************************************************************
55 * Class SymbolEditorFsmAdapter
56 ******************************************************************************/
57
62public:
63 enum class Feature : quint32 {
64 Select = (1 << 0),
65 Cut = (1 << 1),
66 Copy = (1 << 2),
67 Paste = (1 << 3),
68 Remove = (1 << 4),
69 Rotate = (1 << 5),
70 Mirror = (1 << 6),
71 SnapToGrid = (1 << 7),
72 Properties = (1 << 8),
73 ImportGraphics = (1 << 9),
74 };
75 Q_DECLARE_FLAGS(Features, Feature)
76
77 virtual GraphicsScene* fsmGetGraphicsScene() noexcept = 0;
78 virtual SymbolGraphicsItem* fsmGetGraphicsItem() noexcept = 0;
79 virtual PositiveLength fsmGetGridInterval() const noexcept = 0;
80 virtual void fsmSetViewCursor(
81 const std::optional<Qt::CursorShape>& shape) noexcept = 0;
82 virtual void fsmSetViewGrayOut(bool grayOut) noexcept = 0;
83 virtual void fsmSetViewInfoBoxText(const QString& text) noexcept = 0;
84 virtual void fsmSetViewRuler(
85 const std::optional<std::pair<Point, Point>>& pos) noexcept = 0;
86 virtual void fsmSetSceneCursor(const Point& pos, bool cross,
87 bool circle) noexcept = 0;
88 virtual QPainterPath fsmCalcPosWithTolerance(
89 const Point& pos, qreal multiplier) const noexcept = 0;
90 virtual Point fsmMapGlobalPosToScenePos(const QPoint& pos) const noexcept = 0;
91 virtual void fsmSetStatusBarMessage(const QString& message,
92 int timeoutMs = -1) noexcept = 0;
93 virtual void fsmSetFeatures(Features features) noexcept = 0;
94
95 virtual void fsmToolLeave() noexcept = 0;
96 virtual void fsmToolEnter(SymbolEditorState_Select& state) noexcept = 0;
97 virtual void fsmToolEnter(SymbolEditorState_DrawLine& state) noexcept = 0;
98 virtual void fsmToolEnter(SymbolEditorState_DrawRect& state) noexcept = 0;
99 virtual void fsmToolEnter(SymbolEditorState_DrawPolygon& state) noexcept = 0;
100 virtual void fsmToolEnter(SymbolEditorState_DrawCircle& state) noexcept = 0;
101 virtual void fsmToolEnter(SymbolEditorState_DrawArc& state) noexcept = 0;
102 virtual void fsmToolEnter(SymbolEditorState_AddNames& state) noexcept = 0;
103 virtual void fsmToolEnter(SymbolEditorState_AddValues& state) noexcept = 0;
104 virtual void fsmToolEnter(SymbolEditorState_DrawText& state) noexcept = 0;
105 virtual void fsmToolEnter(SymbolEditorState_AddPins& state) noexcept = 0;
106 virtual void fsmToolEnter(SymbolEditorState_Measure& state) noexcept = 0;
107};
108
109/*******************************************************************************
110 * End of File
111 ******************************************************************************/
112
113} // namespace editor
114} // namespace librepcb
115
116Q_DECLARE_METATYPE(librepcb::editor::SymbolEditorFsmAdapter::Feature)
117Q_DECLARE_OPERATORS_FOR_FLAGS(
118 librepcb::editor::SymbolEditorFsmAdapter::Features)
119
120#endif
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
Interface for the integration of the Symbol editor FSM.
Definition symboleditorfsmadapter.h:61
virtual void fsmToolLeave() noexcept=0
virtual void fsmSetViewRuler(const std::optional< std::pair< Point, Point > > &pos) noexcept=0
virtual PositiveLength fsmGetGridInterval() const noexcept=0
virtual void fsmSetViewInfoBoxText(const QString &text) noexcept=0
virtual QPainterPath fsmCalcPosWithTolerance(const Point &pos, qreal multiplier) const noexcept=0
virtual void fsmSetViewGrayOut(bool grayOut) noexcept=0
virtual void fsmSetViewCursor(const std::optional< Qt::CursorShape > &shape) noexcept=0
virtual SymbolGraphicsItem * fsmGetGraphicsItem() noexcept=0
virtual void fsmSetFeatures(Features features) noexcept=0
virtual void fsmSetStatusBarMessage(const QString &message, int timeoutMs=-1) noexcept=0
virtual void fsmSetSceneCursor(const Point &pos, bool cross, bool circle) noexcept=0
virtual Point fsmMapGlobalPosToScenePos(const QPoint &pos) const noexcept=0
virtual GraphicsScene * fsmGetGraphicsScene() noexcept=0
Feature
Definition symboleditorfsmadapter.h:63
virtual void fsmToolEnter(SymbolEditorState_Select &state) noexcept=0
The SymbolEditorState_AddNames class.
Definition symboleditorstate_addnames.h:43
The SymbolEditorState_AddPins class.
Definition symboleditorstate_addpins.h:50
The SymbolEditorState_AddValues class.
Definition symboleditorstate_addvalues.h:44
The SymbolEditorState_DrawArc class.
Definition symboleditorstate_drawarc.h:44
The SymbolEditorState_DrawCircle class.
Definition symboleditorstate_drawcircle.h:50
The SymbolEditorState_DrawLine class.
Definition symboleditorstate_drawline.h:44
The SymbolEditorState_DrawPolygon class.
Definition symboleditorstate_drawpolygon.h:44
The SymbolEditorState_DrawRect class.
Definition symboleditorstate_drawrect.h:44
The SymbolEditorState_DrawText class.
Definition symboleditorstate_drawtext.h:43
The SymbolEditorState_Measure class.
Definition symboleditorstate_measure.h:45
The SymbolEditorState_Select class.
Definition symboleditorstate_select.h:56
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