LibrePCB Developers Documentation
Loading...
Searching...
No Matches
schematiceditorfsmadapter.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_SCHEMATICEDITORFSMADAPTER_H
21#define LIBREPCB_EDITOR_SCHEMATICEDITORFSMADAPTER_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 NetSignal;
39class Schematic;
40
41namespace editor {
42
43class SchematicEditorState;
44class SchematicEditorState_AddComponent;
45class SchematicEditorState_AddNetLabel;
46class SchematicEditorState_AddText;
47class SchematicEditorState_DrawPolygon;
48class SchematicEditorState_DrawWire;
49class SchematicEditorState_Measure;
50class SchematicEditorState_Select;
51class SchematicGraphicsScene;
52
53/*******************************************************************************
54 * Class SchematicEditorFsmAdapter
55 ******************************************************************************/
56
61public:
62 enum class Feature : quint32 {
63 Select = (1 << 0),
64 Cut = (1 << 1),
65 Copy = (1 << 2),
66 Paste = (1 << 3),
67 Remove = (1 << 4),
68 Rotate = (1 << 5),
69 Mirror = (1 << 6),
70 SnapToGrid = (1 << 7),
71 ResetTexts = (1 << 8),
72 Properties = (1 << 9),
73 };
74 Q_DECLARE_FLAGS(Features, Feature)
75
77 virtual void fsmSetViewCursor(
78 const std::optional<Qt::CursorShape>& shape) noexcept = 0;
79 virtual void fsmSetViewGrayOut(bool grayOut) noexcept = 0;
80 virtual void fsmSetViewInfoBoxText(const QString& text) noexcept = 0;
81 virtual void fsmSetViewRuler(
82 const std::optional<std::pair<Point, Point>>& pos) noexcept = 0;
83 virtual void fsmSetSceneCursor(const Point& pos, bool cross,
84 bool circle) noexcept = 0;
85 virtual QPainterPath fsmCalcPosWithTolerance(
86 const Point& pos, qreal multiplier) const noexcept = 0;
87 virtual Point fsmMapGlobalPosToScenePos(const QPoint& pos) const noexcept = 0;
88 virtual void fsmZoomToSceneRect(const QRectF& r) noexcept = 0;
90 const QSet<const NetSignal*>& sigs) noexcept = 0;
91 virtual void fsmAbortBlockingToolsInOtherEditors() noexcept = 0;
92 virtual void fsmSetStatusBarMessage(const QString& message,
93 int timeoutMs = -1) noexcept = 0;
94 virtual void fsmSetFeatures(Features features) noexcept = 0;
95
96 virtual void fsmToolLeave() noexcept = 0;
97 virtual void fsmToolEnter(SchematicEditorState_Select& state) noexcept = 0;
98 virtual void fsmToolEnter(SchematicEditorState_DrawWire& state) noexcept = 0;
99 virtual void fsmToolEnter(
100 SchematicEditorState_AddNetLabel& state) noexcept = 0;
101 virtual void fsmToolEnter(
102 SchematicEditorState_AddComponent& state) noexcept = 0;
103 virtual void fsmToolEnter(
104 SchematicEditorState_DrawPolygon& state) noexcept = 0;
105 virtual void fsmToolEnter(SchematicEditorState_AddText& state) noexcept = 0;
106 virtual void fsmToolEnter(SchematicEditorState_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::SchematicEditorFsmAdapter::Feature)
117Q_DECLARE_OPERATORS_FOR_FLAGS(
118 librepcb::editor::SchematicEditorFsmAdapter::Features)
119
120#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 schematic editor FSM.
Definition schematiceditorfsmadapter.h:60
virtual void fsmToolEnter(SchematicEditorState_Select &state) 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 fsmZoomToSceneRect(const QRectF &r) 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 SchematicGraphicsScene * fsmGetGraphicsScene() noexcept=0
virtual Point fsmMapGlobalPosToScenePos(const QPoint &pos) const noexcept=0
Feature
Definition schematiceditorfsmadapter.h:62
The SchematicEditorState_AddComponent class.
Definition schematiceditorstate_addcomponent.h:58
The SchematicEditorState_AddNetLabel class.
Definition schematiceditorstate_addnetlabel.h:50
The SchematicEditorState_AddText class.
Definition schematiceditorstate_addtext.h:56
The SchematicEditorState_DrawPolygon class.
Definition schematiceditorstate_drawpolygon.h:56
The SchematicEditorState_DrawWire class.
Definition schematiceditorstate_drawwire.h:52
The "measure" state/tool of the schematic editor.
Definition schematiceditorstate_measure.h:45
The "select" state/tool of the schematic editor (default state)
Definition schematiceditorstate_select.h:60
The SchematicGraphicsScene class.
Definition schematicgraphicsscene.h:67
Definition occmodel.cpp:77
Definition uuid.h:186