LibrePCB Developers Documentation
Loading...
Searching...
No Matches
packageeditorfsmadapter.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_PACKAGEEDITORFSMADAPTER_H
21#define LIBREPCB_EDITOR_PACKAGEEDITORFSMADAPTER_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 FootprintGraphicsItem;
40class GraphicsScene;
41class PackageEditorState;
42class PackageEditorState_AddHoles;
43class PackageEditorState_AddNames;
44class PackageEditorState_AddPads;
45class PackageEditorState_AddValues;
46class PackageEditorState_DrawArc;
47class PackageEditorState_DrawCircle;
48class PackageEditorState_DrawLine;
49class PackageEditorState_DrawPolygon;
50class PackageEditorState_DrawRect;
51class PackageEditorState_DrawText;
52class PackageEditorState_DrawZone;
53class PackageEditorState_Measure;
54class PackageEditorState_ReNumberPads;
55class PackageEditorState_Select;
56
57/*******************************************************************************
58 * Class PackageEditorFsmAdapter
59 ******************************************************************************/
60
65public:
66 enum class Feature : quint32 {
67 Select = (1 << 0),
68 Cut = (1 << 1),
69 Copy = (1 << 2),
70 Paste = (1 << 3),
71 Remove = (1 << 4),
72 Rotate = (1 << 5),
73 Mirror = (1 << 6),
74 Flip = (1 << 7),
75 MoveAlign = (1 << 8),
76 SnapToGrid = (1 << 9),
77 Properties = (1 << 10),
78 ImportGraphics = (1 << 11),
79 };
80 Q_DECLARE_FLAGS(Features, Feature)
81
82 virtual QWidget* fsmGetParentWidget() noexcept = 0;
83 virtual GraphicsScene* fsmGetGraphicsScene() noexcept = 0;
84 virtual PositiveLength fsmGetGridInterval() const noexcept = 0;
85 virtual void fsmSetViewCursor(
86 const std::optional<Qt::CursorShape>& shape) noexcept = 0;
87 virtual void fsmSetViewGrayOut(bool grayOut) noexcept = 0;
88 virtual void fsmSetViewInfoBoxText(const QString& text) noexcept = 0;
89 virtual void fsmSetViewRuler(
90 const std::optional<std::pair<Point, Point>>& pos) noexcept = 0;
91 virtual void fsmSetSceneCursor(const Point& pos, bool cross,
92 bool circle) noexcept = 0;
93 virtual QPainterPath fsmCalcPosWithTolerance(
94 const Point& pos, qreal multiplier) const noexcept = 0;
95 virtual Point fsmMapGlobalPosToScenePos(const QPoint& pos) const 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(PackageEditorState_Select& state) noexcept = 0;
102 virtual void fsmToolEnter(PackageEditorState_DrawLine& state) noexcept = 0;
103 virtual void fsmToolEnter(PackageEditorState_DrawRect& state) noexcept = 0;
104 virtual void fsmToolEnter(PackageEditorState_DrawPolygon& state) noexcept = 0;
105 virtual void fsmToolEnter(PackageEditorState_DrawCircle& state) noexcept = 0;
106 virtual void fsmToolEnter(PackageEditorState_DrawArc& state) noexcept = 0;
107 virtual void fsmToolEnter(PackageEditorState_AddNames& state) noexcept = 0;
108 virtual void fsmToolEnter(PackageEditorState_AddValues& state) noexcept = 0;
109 virtual void fsmToolEnter(PackageEditorState_DrawText& state) noexcept = 0;
110 virtual void fsmToolEnter(PackageEditorState_AddPads& state) noexcept = 0;
111 virtual void fsmToolEnter(PackageEditorState_DrawZone& state) noexcept = 0;
112 virtual void fsmToolEnter(PackageEditorState_AddHoles& state) noexcept = 0;
113 virtual void fsmToolEnter(
114 PackageEditorState_ReNumberPads& state) noexcept = 0;
115 virtual void fsmToolEnter(PackageEditorState_Measure& state) noexcept = 0;
116};
117
118/*******************************************************************************
119 * End of File
120 ******************************************************************************/
121
122} // namespace editor
123} // namespace librepcb
124
125Q_DECLARE_METATYPE(librepcb::editor::PackageEditorFsmAdapter::Feature)
126Q_DECLARE_OPERATORS_FOR_FLAGS(
127 librepcb::editor::PackageEditorFsmAdapter::Features)
128
129#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 Package editor FSM.
Definition packageeditorfsmadapter.h:64
virtual QWidget * fsmGetParentWidget() noexcept=0
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 void fsmToolEnter(PackageEditorState_Select &state) 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 GraphicsScene * fsmGetGraphicsScene() noexcept=0
Feature
Definition packageeditorfsmadapter.h:66
The PackageEditorState_AddHoles class.
Definition packageeditorstate_addholes.h:50
The PackageEditorState_AddNames class.
Definition packageeditorstate_addnames.h:44
The PackageEditorState_AddPads class.
Definition packageeditorstate_addpads.h:50
The PackageEditorState_AddValues class.
Definition packageeditorstate_addvalues.h:44
The PackageEditorState_DrawArc class.
Definition packageeditorstate_drawarc.h:44
The PackageEditorState_DrawCircle class.
Definition packageeditorstate_drawcircle.h:50
The PackageEditorState_DrawLine class.
Definition packageeditorstate_drawline.h:44
The PackageEditorState_DrawPolygon class.
Definition packageeditorstate_drawpolygon.h:44
The PackageEditorState_DrawRect class.
Definition packageeditorstate_drawrect.h:44
The PackageEditorState_DrawText class.
Definition packageeditorstate_drawtext.h:44
The PackageEditorState_DrawZone class.
Definition packageeditorstate_drawzone.h:50
The PackageEditorState_Measure class.
Definition packageeditorstate_measure.h:45
The PackageEditorState_ReNumberPads class.
Definition packageeditorstate_renumberpads.h:51
The PackageEditorState_Select class.
Definition packageeditorstate_select.h:58
Definition occmodel.cpp:77
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition length.h:810
Definition uuid.h:186