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_LIBRARY_EDITOR_PACKAGEEDITORSTATE_H
21 #define LIBREPCB_LIBRARY_EDITOR_PACKAGEEDITORSTATE_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "packageeditorfsm.h"
27 
30 
31 #include <QtCore>
32 #include <QtWidgets>
33 
34 /*******************************************************************************
35  * Namespace / Forward Declarations
36  ******************************************************************************/
37 namespace librepcb {
38 
39 class GraphicsLayer;
40 
41 namespace library {
42 namespace editor {
43 
44 /*******************************************************************************
45  * Class PackageEditorState
46  ******************************************************************************/
47 
52 class PackageEditorState : public QObject {
53  Q_OBJECT
54 
55 public:
57 
58  // Constructors / Destructor
59  PackageEditorState() = delete;
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 
68  // Event Handlers
70  QGraphicsSceneMouseEvent& e) noexcept {
71  Q_UNUSED(e);
72  return false;
73  }
75  QGraphicsSceneMouseEvent& 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  }
94  virtual bool processSelectAll() noexcept { return false; }
95  virtual bool processCut() noexcept { return false; }
96  virtual bool processCopy() noexcept { return false; }
97  virtual bool processPaste() noexcept { return false; }
98  virtual bool processRotateCw() noexcept { return false; }
99  virtual bool processRotateCcw() noexcept { return false; }
100  virtual bool processMirror() noexcept { return false; }
101  virtual bool processFlip() noexcept { return false; }
102  virtual bool processRemove() noexcept { return false; }
103  virtual bool processAbortCommand() noexcept { return false; }
104 
105  // Operator Overloadings
106  PackageEditorState& operator=(const PackageEditorState& rhs) = delete;
107 
108 protected: // Methods
109  const PositiveLength& getGridInterval() const noexcept;
110  const LengthUnit& getDefaultLengthUnit() const noexcept;
111  QList<GraphicsLayer*> getAllowedTextLayers() const noexcept;
112  QList<GraphicsLayer*> getAllowedCircleAndPolygonLayers() const noexcept;
113 
114 protected: // Data
116 };
117 
118 /*******************************************************************************
119  * End of File
120  ******************************************************************************/
121 
122 } // namespace editor
123 } // namespace library
124 } // namespace librepcb
125 
126 #endif // LIBREPCB_LIBRARY_EDITOR_PACKAGEEDITORSTATE_H
virtual bool processAbortCommand() noexcept
Definition: packageeditorstate.h:103
virtual bool processRotateCcw() noexcept
Definition: packageeditorstate.h:99
PackageEditorState & operator=(const PackageEditorState &rhs)=delete
Definition: airwiresbuilder.cpp:32
const LengthUnit & getDefaultLengthUnit() const noexcept
Definition: packageeditorstate.cpp:59
QList< GraphicsLayer * > getAllowedTextLayers() const noexcept
Definition: packageeditorstate.cpp:63
virtual bool processPaste() noexcept
Definition: packageeditorstate.h:97
virtual bool processMirror() noexcept
Definition: packageeditorstate.h:100
virtual ~PackageEditorState() noexcept
Definition: packageeditorstate.cpp:48
virtual bool processGraphicsSceneLeftMouseButtonDoubleClicked(QGraphicsSceneMouseEvent &e) noexcept
Definition: packageeditorstate.h:84
virtual bool processRotateCw() noexcept
Definition: packageeditorstate.h:98
Context & mContext
Definition: packageeditorstate.h:115
The PackageEditorState class is the base class of all package editor FSM states.
Definition: packageeditorstate.h:52
virtual bool processCut() noexcept
Definition: packageeditorstate.h:95
virtual bool exit() noexcept
Definition: packageeditorstate.h:66
virtual bool entry() noexcept
Definition: packageeditorstate.h:65
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition: length.h:792
virtual bool processGraphicsSceneMouseMoved(QGraphicsSceneMouseEvent &e) noexcept
Definition: packageeditorstate.h:69
const PositiveLength & getGridInterval() const noexcept
Definition: packageeditorstate.cpp:55
virtual bool processGraphicsSceneRightMouseButtonReleased(QGraphicsSceneMouseEvent &e) noexcept
Definition: packageeditorstate.h:89
virtual bool processGraphicsSceneLeftMouseButtonPressed(QGraphicsSceneMouseEvent &e) noexcept
Definition: packageeditorstate.h:74
virtual bool processFlip() noexcept
Definition: packageeditorstate.h:101
virtual bool processGraphicsSceneLeftMouseButtonReleased(QGraphicsSceneMouseEvent &e) noexcept
Definition: packageeditorstate.h:79
QList< GraphicsLayer * > getAllowedCircleAndPolygonLayers() const noexcept
Definition: packageeditorstate.cpp:97
virtual bool processSelectAll() noexcept
Definition: packageeditorstate.h:94
The LengthUnit class represents a length unit (millimeters, inches,...) and provides some useful meth...
Definition: lengthunit.h:62
virtual bool processCopy() noexcept
Definition: packageeditorstate.h:96
virtual bool processRemove() noexcept
Definition: packageeditorstate.h:102