LibrePCB Developers Documentation
Loading...
Searching...
No Matches
packageeditorstate.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_PACKAGEEDITORSTATE_H
21#define LIBREPCB_EDITOR_PACKAGEEDITORSTATE_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../../graphics/graphicsscene.h"
27#include "../../../utils/toolbarproxy.h"
28#include "packageeditorfsm.h"
29
31
32#include <QtCore>
33#include <QtWidgets>
34
35/*******************************************************************************
36 * Namespace / Forward Declarations
37 ******************************************************************************/
38namespace librepcb {
39
40class Layer;
41class LengthUnit;
42
43namespace editor {
44
45/*******************************************************************************
46 * Class PackageEditorState
47 ******************************************************************************/
48
53class PackageEditorState : public QObject {
54 Q_OBJECT
55
56public:
58
59 // Constructors / Destructor
61 PackageEditorState(const PackageEditorState& other) = delete;
62 explicit PackageEditorState(Context& context) noexcept;
63 virtual ~PackageEditorState() noexcept;
64
65 // General Methods
66 virtual bool entry() noexcept { return true; }
67 virtual bool exit() noexcept { return true; }
68 virtual QSet<EditorWidgetBase::Feature> getAvailableFeatures()
69 const noexcept = 0;
70
71 // Event Handlers
72 virtual bool processKeyPressed(const GraphicsSceneKeyEvent& e) noexcept {
73 Q_UNUSED(e);
74 return false;
75 }
76 virtual bool processKeyReleased(const GraphicsSceneKeyEvent& e) noexcept {
77 Q_UNUSED(e);
78 return false;
79 }
81 const GraphicsSceneMouseEvent& e) noexcept {
82 Q_UNUSED(e);
83 return false;
84 }
86 const GraphicsSceneMouseEvent& e) noexcept {
87 Q_UNUSED(e);
88 return false;
89 }
91 const GraphicsSceneMouseEvent& e) noexcept {
92 Q_UNUSED(e);
93 return false;
94 }
96 const GraphicsSceneMouseEvent& e) noexcept {
97 Q_UNUSED(e);
98 return false;
99 }
101 const GraphicsSceneMouseEvent& e) noexcept {
102 Q_UNUSED(e);
103 return false;
104 }
105 virtual bool processSelectAll() noexcept { return false; }
106 virtual bool processCut() noexcept { return false; }
107 virtual bool processCopy() noexcept { return false; }
108 virtual bool processPaste() noexcept { return false; }
109 virtual bool processMove(const Point& delta) {
110 Q_UNUSED(delta);
111 return false;
112 }
113 virtual bool processRotate(const Angle& rotation) noexcept {
114 Q_UNUSED(rotation);
115 return false;
116 }
117 virtual bool processMirror(Qt::Orientation orientation) noexcept {
118 Q_UNUSED(orientation);
119 return false;
120 }
121 virtual bool processMoveAlign() noexcept { return false; }
122 virtual bool processSnapToGrid() noexcept { return false; }
123 virtual bool processFlip(Qt::Orientation orientation) noexcept {
124 Q_UNUSED(orientation);
125 return false;
126 }
127 virtual bool processRemove() noexcept { return false; }
128 virtual bool processEditProperties() noexcept { return false; }
129 virtual bool processGenerateOutline() noexcept { return false; }
130 virtual bool processGenerateCourtyard() noexcept { return false; }
131 virtual bool processImportDxf() noexcept { return false; }
132 virtual bool processAbortCommand() noexcept { return false; }
133
134 // Operator Overloadings
136
137signals:
140 void statusBarMessageChanged(const QString& message, int timeoutMs = -1);
141
142protected: // Methods
143 const PositiveLength& getGridInterval() const noexcept;
144 const LengthUnit& getLengthUnit() const noexcept;
145 static const QSet<const Layer*>& getAllowedTextLayers() noexcept;
146 static const QSet<const Layer*>& getAllowedCircleAndPolygonLayers() noexcept;
147
148protected: // Data
150};
151
152/*******************************************************************************
153 * End of File
154 ******************************************************************************/
155
156} // namespace editor
157} // namespace librepcb
158
159#endif
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition angle.h:76
The Layer class provides all supported geometry layers.
Definition layer.h:42
The LengthUnit class represents a length unit (millimeters, inches,...) and provides some useful meth...
Definition lengthunit.h:62
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition point.h:78
The PackageEditorState class is the base class of all package editor FSM states.
Definition packageeditorstate.h:53
virtual bool processEditProperties() noexcept
Definition packageeditorstate.h:128
const PositiveLength & getGridInterval() const noexcept
Definition packageeditorstate.cpp:52
virtual bool processAbortCommand() noexcept
Definition packageeditorstate.h:132
virtual bool exit() noexcept
Definition packageeditorstate.h:67
void statusBarMessageChanged(const QString &message, int timeoutMs=-1)
const LengthUnit & getLengthUnit() const noexcept
Definition packageeditorstate.cpp:56
virtual bool processGraphicsSceneLeftMouseButtonPressed(const GraphicsSceneMouseEvent &e) noexcept
Definition packageeditorstate.h:85
virtual bool processGenerateCourtyard() noexcept
Definition packageeditorstate.h:130
virtual bool processSnapToGrid() noexcept
Definition packageeditorstate.h:122
virtual QSet< EditorWidgetBase::Feature > getAvailableFeatures() const noexcept=0
virtual bool processMove(const Point &delta)
Definition packageeditorstate.h:109
PackageEditorState(const PackageEditorState &other)=delete
static const QSet< const Layer * > & getAllowedCircleAndPolygonLayers() noexcept
Definition packageeditorstate.cpp:96
virtual bool entry() noexcept
Definition packageeditorstate.h:66
virtual bool processMoveAlign() noexcept
Definition packageeditorstate.h:121
virtual bool processSelectAll() noexcept
Definition packageeditorstate.h:105
static const QSet< const Layer * > & getAllowedTextLayers() noexcept
Definition packageeditorstate.cpp:60
virtual bool processRotate(const Angle &rotation) noexcept
Definition packageeditorstate.h:113
virtual bool processGraphicsSceneMouseMoved(const GraphicsSceneMouseEvent &e) noexcept
Definition packageeditorstate.h:80
virtual bool processImportDxf() noexcept
Definition packageeditorstate.h:131
Context & mContext
Definition packageeditorstate.h:149
PackageEditorState & operator=(const PackageEditorState &rhs)=delete
virtual bool processKeyReleased(const GraphicsSceneKeyEvent &e) noexcept
Definition packageeditorstate.h:76
virtual bool processGraphicsSceneLeftMouseButtonDoubleClicked(const GraphicsSceneMouseEvent &e) noexcept
Definition packageeditorstate.h:95
virtual bool processKeyPressed(const GraphicsSceneKeyEvent &e) noexcept
Definition packageeditorstate.h:72
virtual bool processMirror(Qt::Orientation orientation) noexcept
Definition packageeditorstate.h:117
virtual bool processGenerateOutline() noexcept
Definition packageeditorstate.h:129
virtual ~PackageEditorState() noexcept
Definition packageeditorstate.cpp:45
virtual bool processGraphicsSceneLeftMouseButtonReleased(const GraphicsSceneMouseEvent &e) noexcept
Definition packageeditorstate.h:90
virtual bool processCopy() noexcept
Definition packageeditorstate.h:107
virtual bool processCut() noexcept
Definition packageeditorstate.h:106
virtual bool processFlip(Qt::Orientation orientation) noexcept
Definition packageeditorstate.h:123
virtual bool processPaste() noexcept
Definition packageeditorstate.h:108
virtual bool processGraphicsSceneRightMouseButtonReleased(const GraphicsSceneMouseEvent &e) noexcept
Definition packageeditorstate.h:100
virtual bool processRemove() noexcept
Definition packageeditorstate.h:127
Definition occmodel.cpp:77
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition length.h:810
Definition graphicsscene.h:52
Definition graphicsscene.h:45
Definition packageeditorfsm.h:92