LibrePCB Developers Documentation
Loading...
Searching...
No Matches
boardeditorfsmadapter.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_BOARDEDITORFSMADAPTER_H
21#define LIBREPCB_EDITOR_BOARDEDITORFSMADAPTER_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 {
37
38class Board;
39class NetSignal;
40
41namespace editor {
42
43class BoardEditorState;
44class BoardEditorState_AddDevice;
45class BoardEditorState_AddHole;
46class BoardEditorState_AddStrokeText;
47class BoardEditorState_AddVia;
48class BoardEditorState_DrawPlane;
49class BoardEditorState_DrawPolygon;
50class BoardEditorState_DrawTrace;
51class BoardEditorState_DrawZone;
52class BoardEditorState_Measure;
53class BoardEditorState_Select;
54class BoardGraphicsScene;
55
56/*******************************************************************************
57 * Class BoardEditorFsmAdapter
58 ******************************************************************************/
59
64public:
65 enum class Feature : quint32 {
66 Select = (1 << 0),
67 Cut = (1 << 1),
68 Copy = (1 << 2),
69 Paste = (1 << 3),
70 Remove = (1 << 4),
71 Rotate = (1 << 5),
72 Flip = (1 << 6),
73 // MoveAlign = (1 << 7),
74 SnapToGrid = (1 << 8),
75 ResetTexts = (1 << 9),
76 Lock = (1 << 10),
77 Unlock = (1 << 11),
78 Properties = (1 << 12),
79 ModifyLineWidth = (1 << 13),
80 ImportGraphics = (1 << 14),
81 };
82 Q_DECLARE_FLAGS(Features, Feature)
83
84 virtual BoardGraphicsScene* fsmGetGraphicsScene() noexcept = 0;
85 virtual bool fsmGetIgnoreLocks() const noexcept = 0;
86 virtual void fsmSetViewCursor(
87 const std::optional<Qt::CursorShape>& shape) noexcept = 0;
88 virtual void fsmSetViewGrayOut(bool grayOut) noexcept = 0;
89 virtual void fsmSetViewInfoBoxText(const QString& text) noexcept = 0;
90 virtual void fsmSetViewRuler(
91 const std::optional<std::pair<Point, Point>>& pos) noexcept = 0;
92 virtual void fsmSetSceneCursor(const Point& pos, bool cross,
93 bool circle) noexcept = 0;
94 virtual QPainterPath fsmCalcPosWithTolerance(
95 const Point& pos, qreal multiplier) const noexcept = 0;
96 virtual Point fsmMapGlobalPosToScenePos(const QPoint& pos) const noexcept = 0;
98 const QSet<const NetSignal*>& sigs) noexcept = 0;
99 virtual void fsmAbortBlockingToolsInOtherEditors() noexcept = 0;
100 virtual void fsmSetStatusBarMessage(const QString& message,
101 int timeoutMs = -1) noexcept = 0;
102 virtual void fsmSetFeatures(Features features) noexcept = 0;
103
104 virtual void fsmToolLeave() noexcept = 0;
105 virtual void fsmToolEnter(BoardEditorState_Select& state) noexcept = 0;
106 virtual void fsmToolEnter(BoardEditorState_DrawTrace& state) noexcept = 0;
107 virtual void fsmToolEnter(BoardEditorState_AddVia& state) noexcept = 0;
108 virtual void fsmToolEnter(BoardEditorState_DrawPolygon& state) noexcept = 0;
109 virtual void fsmToolEnter(BoardEditorState_AddStrokeText& state) noexcept = 0;
110 virtual void fsmToolEnter(BoardEditorState_DrawPlane& state) noexcept = 0;
111 virtual void fsmToolEnter(BoardEditorState_DrawZone& state) noexcept = 0;
112 virtual void fsmToolEnter(BoardEditorState_AddHole& state) noexcept = 0;
113 virtual void fsmToolEnter(BoardEditorState_AddDevice& state) noexcept = 0;
114 virtual void fsmToolEnter(BoardEditorState_Measure& state) noexcept = 0;
115};
116
117/*******************************************************************************
118 * End of File
119 ******************************************************************************/
120
121} // namespace editor
122} // namespace librepcb
123
124Q_DECLARE_METATYPE(librepcb::editor::BoardEditorFsmAdapter::Feature)
125Q_DECLARE_OPERATORS_FOR_FLAGS(librepcb::editor::BoardEditorFsmAdapter::Features)
126
127#endif
The NetSignal class.
Definition netsignal.h:50
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition point.h:78
Interface for the integration of the board editor FSM.
Definition boardeditorfsmadapter.h:63
virtual void fsmToolEnter(BoardEditorState_Select &state) noexcept=0
virtual bool fsmGetIgnoreLocks() const noexcept=0
virtual void fsmSetHighlightedNetSignals(const QSet< const NetSignal * > &sigs) noexcept=0
virtual void fsmToolLeave() noexcept=0
virtual void fsmSetViewRuler(const std::optional< std::pair< Point, Point > > &pos) noexcept=0
virtual void fsmSetViewInfoBoxText(const QString &text) noexcept=0
virtual void fsmAbortBlockingToolsInOtherEditors() 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 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 BoardGraphicsScene * fsmGetGraphicsScene() noexcept=0
Feature
Definition boardeditorfsmadapter.h:65
The "add device" state/tool of the board editor.
Definition boardeditorstate_adddevice.h:53
The "add hole" state/tool of the board editor.
Definition boardeditorstate_addhole.h:52
The "add stroke text" state/tool of the board editor.
Definition boardeditorstate_addstroketext.h:52
The "add via" state/tool of the board editor.
Definition boardeditorstate_addvia.h:54
The "draw plane" state/tool of the board editor.
Definition boardeditorstate_drawplane.h:54
The "draw polygon" state/tool of the board editor.
Definition boardeditorstate_drawpolygon.h:52
The "draw trace" state/tool of the board editor.
Definition boardeditorstate_drawtrace.h:55
The "draw zone" state/tool of the board editor.
Definition boardeditorstate_drawzone.h:55
The "measure" state/tool of the board editor.
Definition boardeditorstate_measure.h:45
The "select" state/tool of the board editor (default state)
Definition boardeditorstate_select.h:69
The BoardGraphicsScene class.
Definition boardgraphicsscene.h:77
Definition occmodel.cpp:77
Definition uuid.h:186