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