LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
symboleditorstate_select.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_SYMBOLEDITORSTATE_SELECT_H
21 #define LIBREPCB_LIBRARY_EDITOR_SYMBOLEDITORSTATE_SELECT_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "symboleditorstate.h"
27 
28 #include <QtCore>
29 #include <QtWidgets>
30 
31 /*******************************************************************************
32  * Namespace / Forward Declarations
33  ******************************************************************************/
34 namespace librepcb {
35 namespace library {
36 namespace editor {
37 
38 class CmdMoveSelectedSymbolItems;
39 
40 /*******************************************************************************
41  * Class SymbolEditorState_Select
42  ******************************************************************************/
43 
51  Q_OBJECT
52 
53 public:
54  // Constructors / Destructor
55  SymbolEditorState_Select() = delete;
57  explicit SymbolEditorState_Select(const Context& context) noexcept;
58  ~SymbolEditorState_Select() noexcept;
59 
60  // Event Handlers
62  QGraphicsSceneMouseEvent& e) noexcept override;
64  QGraphicsSceneMouseEvent& e) noexcept override;
66  QGraphicsSceneMouseEvent& e) noexcept override;
68  QGraphicsSceneMouseEvent& e) noexcept override;
70  QGraphicsSceneMouseEvent& e) noexcept override;
71  bool processRotateCw() noexcept override;
72  bool processRotateCcw() noexcept override;
73  bool processRemove() noexcept override;
74 
75  // Operator Overloadings
77  delete;
78 
79 private: // Methods
80  bool openContextMenuAtPos(const Point& pos) noexcept;
81  bool openPropertiesDialogOfItemAtPos(const Point& pos) noexcept;
82  bool rotateSelectedItems(const Angle& angle) noexcept;
83  bool removeSelectedItems() noexcept;
84  void setSelectionRect(const Point& p1, const Point& p2) noexcept;
85  void clearSelectionRect(bool updateItemsSelectionState) noexcept;
86 
87 private: // Types / Data
88  enum class SubState { IDLE, SELECTING, MOVING };
90  QScopedPointer<CmdMoveSelectedSymbolItems> mCmdMoveSelectedItems;
91 };
92 
93 /*******************************************************************************
94  * End of File
95  ******************************************************************************/
96 
97 } // namespace editor
98 } // namespace library
99 } // namespace librepcb
100 
101 #endif // LIBREPCB_LIBRARY_EDITOR_SYMBOLEDITORSTATE_SELECT_H
bool processGraphicsSceneMouseMoved(QGraphicsSceneMouseEvent &e) noexceptoverride
Definition: symboleditorstate_select.cpp:68
bool openPropertiesDialogOfItemAtPos(const Point &pos) noexcept
Definition: symboleditorstate_select.cpp:259
The SymbolEditorState class is the base class of all symbol editor FSM states.
Definition: symboleditorstate.h:52
QScopedPointer< CmdMoveSelectedSymbolItems > mCmdMoveSelectedItems
Definition: symboleditorstate_select.h:90
SubState mState
Definition: symboleditorstate_select.h:89
bool openContextMenuAtPos(const Point &pos) noexcept
Definition: symboleditorstate_select.cpp:236
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition: angle.h:81
bool processRemove() noexceptoverride
Definition: symboleditorstate_select.cpp:223
SubState
Definition: symboleditorstate_select.h:88
The SymbolEditorState_Select class.
Definition: symboleditorstate_select.h:50
void clearSelectionRect(bool updateItemsSelectionState) noexcept
Definition: symboleditorstate_select.cpp:338
bool processRotateCw() noexceptoverride
Definition: symboleditorstate_select.cpp:205
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5...
Definition: point.h:81
bool processRotateCcw() noexceptoverride
Definition: symboleditorstate_select.cpp:214
bool processGraphicsSceneLeftMouseButtonDoubleClicked(QGraphicsSceneMouseEvent &e) noexceptoverride
Definition: symboleditorstate_select.cpp:179
SymbolEditorState_Select & operator=(const SymbolEditorState_Select &rhs)=delete
bool rotateSelectedItems(const Angle &angle) noexcept
Definition: symboleditorstate_select.cpp:311
bool processGraphicsSceneLeftMouseButtonPressed(QGraphicsSceneMouseEvent &e) noexceptoverride
Definition: symboleditorstate_select.cpp:89
bool removeSelectedItems() noexcept
Definition: symboleditorstate_select.cpp:322
bool processGraphicsSceneRightMouseButtonReleased(QGraphicsSceneMouseEvent &e) noexceptoverride
Definition: symboleditorstate_select.cpp:196
void setSelectionRect(const Point &p1, const Point &p2) noexcept
Definition: symboleditorstate_select.cpp:331
bool processGraphicsSceneLeftMouseButtonReleased(QGraphicsSceneMouseEvent &e) noexceptoverride
Definition: symboleditorstate_select.cpp:154
~SymbolEditorState_Select() noexcept
Definition: symboleditorstate_select.cpp:60