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_AddImage;
46class SchematicEditorState_AddLabel;
47class SchematicEditorState_AddText;
48class SchematicEditorState_DrawBus;
49class SchematicEditorState_DrawPolygon;
50class SchematicEditorState_DrawWire;
51class SchematicEditorState_Measure;
52class SchematicEditorState_Select;
53class SchematicGraphicsScene;
54
55/*******************************************************************************
56 * Class SchematicEditorFsmAdapter
57 ******************************************************************************/
58
63public:
64 enum class Feature : quint32 {
65 Select = (1 << 0),
66 Cut = (1 << 1),
67 Copy = (1 << 2),
68 Paste = (1 << 3),
69 Remove = (1 << 4),
70 Rotate = (1 << 5),
71 Mirror = (1 << 6),
72 SnapToGrid = (1 << 7),
73 ResetTexts = (1 << 8),
74 Properties = (1 << 9),
75 };
76 Q_DECLARE_FLAGS(Features, Feature)
77
78 virtual QWidget* fsmGetParentWidget() noexcept = 0;
80 virtual bool fsmGetIgnoreLocks() const noexcept = 0;
81 virtual void fsmSetViewCursor(
82 const std::optional<Qt::CursorShape>& shape) noexcept = 0;
83 virtual void fsmSetViewGrayOut(bool grayOut) noexcept = 0;
84 virtual void fsmSetViewInfoBoxText(const QString& text) noexcept = 0;
85 virtual void fsmSetViewRuler(
86 const std::optional<std::pair<Point, Point>>& pos) noexcept = 0;
87 virtual void fsmSetSceneCursor(const Point& pos, bool cross,
88 bool circle) noexcept = 0;
89 virtual QPainterPath fsmCalcPosWithTolerance(
90 const Point& pos, qreal multiplier) const noexcept = 0;
91 virtual Point fsmMapGlobalPosToScenePos(const QPoint& pos) const noexcept = 0;
92 virtual void fsmZoomToSceneRect(const QRectF& r) noexcept = 0;
94 const QSet<const NetSignal*>& sigs) noexcept = 0;
95 virtual void fsmAbortBlockingToolsInOtherEditors() noexcept = 0;
96 virtual void fsmSetStatusBarMessage(const QString& message,
97 int timeoutMs = -1) noexcept = 0;
98 virtual void fsmSetFeatures(Features features) noexcept = 0;
99
100 virtual void fsmToolLeave() noexcept = 0;
101 virtual void fsmToolEnter(SchematicEditorState_Select& state) noexcept = 0;
102 virtual void fsmToolEnter(SchematicEditorState_DrawWire& state) noexcept = 0;
103 virtual void fsmToolEnter(SchematicEditorState_DrawBus& state) noexcept = 0;
104 virtual void fsmToolEnter(SchematicEditorState_AddLabel& state) noexcept = 0;
105 virtual void fsmToolEnter(
106 SchematicEditorState_AddComponent& state) noexcept = 0;
107 virtual void fsmToolEnter(
108 SchematicEditorState_DrawPolygon& state) noexcept = 0;
109 virtual void fsmToolEnter(SchematicEditorState_AddText& state) noexcept = 0;
110 virtual void fsmToolEnter(SchematicEditorState_AddImage& state) noexcept = 0;
111 virtual void fsmToolEnter(SchematicEditorState_Measure& state) noexcept = 0;
112};
113
114/*******************************************************************************
115 * End of File
116 ******************************************************************************/
117
118} // namespace editor
119} // namespace librepcb
120
121Q_DECLARE_METATYPE(librepcb::editor::SchematicEditorFsmAdapter::Feature)
122Q_DECLARE_OPERATORS_FOR_FLAGS(
123 librepcb::editor::SchematicEditorFsmAdapter::Features)
124
125#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:62
virtual QWidget * fsmGetParentWidget() noexcept=0
virtual bool fsmGetIgnoreLocks() const noexcept=0
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:64
The SchematicEditorState_AddComponent class.
Definition schematiceditorstate_addcomponent.h:58
The SchematicEditorState_AddImage class.
Definition schematiceditorstate_addimage.h:52
The SchematicEditorState_AddLabel class.
Definition schematiceditorstate_addlabel.h:52
The SchematicEditorState_AddText class.
Definition schematiceditorstate_addtext.h:56
The SchematicEditorState_DrawBus class.
Definition schematiceditorstate_drawbus.h:56
The SchematicEditorState_DrawPolygon class.
Definition schematiceditorstate_drawpolygon.h:56
The SchematicEditorState_DrawWire class.
Definition schematiceditorstate_drawwire.h:55
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:63
The SchematicGraphicsScene class.
Definition schematicgraphicsscene.h:76
Definition occmodel.cpp:77
Definition uuid.h:186