LibrePCB Developers Documentation
ses_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_PROJECT_SES_SELECT_H
21 #define LIBREPCB_PROJECT_SES_SELECT_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "ses_base.h"
27 
28 #include <QtCore>
29 
30 /*******************************************************************************
31  * Namespace / Forward Declarations
32  ******************************************************************************/
33 namespace librepcb {
34 
35 class UndoCommandGroup;
36 
37 namespace project {
38 
39 class SI_Symbol;
40 class SI_NetLabel;
41 
42 namespace editor {
43 
44 class CmdMoveSelectedSchematicItems;
45 
46 /*******************************************************************************
47  * Class SES_Select
48  ******************************************************************************/
49 
53 class SES_Select final : public SES_Base {
54  Q_OBJECT
55 
56 public:
57  // Constructors / Destructor
58  explicit SES_Select(SchematicEditor& editor, Ui::SchematicEditor& editorUi,
59  GraphicsView& editorGraphicsView, UndoStack& undoStack);
60  ~SES_Select();
61 
62  // General Methods
63  ProcRetVal process(SEE_Base* event) noexcept override;
64  bool entry(SEE_Base* event) noexcept override;
65  bool exit(SEE_Base* event) noexcept override;
66 
67 private:
68  // Private Methods
69  ProcRetVal processSubStateIdle(SEE_Base* event) noexcept;
71  ProcRetVal processSubStateMoving(SEE_Base* event) noexcept;
73  ProcRetVal processIdleSceneLeftClick(QGraphicsSceneMouseEvent* mouseEvent,
74  Schematic& schematic) noexcept;
76  QGraphicsSceneMouseEvent* mouseEvent, Schematic* schematic) noexcept;
77  ProcRetVal processIdleSceneDoubleClick(QGraphicsSceneMouseEvent* mouseEvent,
78  Schematic* schematic) noexcept;
79  bool startMovingSelectedItems(Schematic& schematic,
80  const Point& startPos) noexcept;
81  bool rotateSelectedItems(const Angle& angle) noexcept;
82  bool mirrorSelectedItems() noexcept;
83  bool removeSelectedItems() noexcept;
84  void openSymbolPropertiesDialog(SI_Symbol& symbol) noexcept;
85  void openNetLabelPropertiesDialog(SI_NetLabel& netlabel) noexcept;
86 
87  // Types
89  enum SubState {
92  };
93 
94  // Attributes
96  QScopedPointer<CmdMoveSelectedSchematicItems> mSelectedItemsMoveCommand;
97 };
98 
99 /*******************************************************************************
100  * End of File
101  ******************************************************************************/
102 
103 } // namespace editor
104 } // namespace project
105 } // namespace librepcb
106 
107 #endif // LIBREPCB_PROJECT_SES_SELECT_H
The SI_Symbol class.
Definition: si_symbol.h:57
SubState
enum for all possible substates
Definition: ses_select.h:89
SES_Select(SchematicEditor &editor, Ui::SchematicEditor &editorUi, GraphicsView &editorGraphicsView, UndoStack &undoStack)
Definition: ses_select.cpp:56
Definition: airwiresbuilder.cpp:32
bool exit(SEE_Base *event) noexcept override
Definition: ses_select.cpp:86
QScopedPointer< CmdMoveSelectedSchematicItems > mSelectedItemsMoveCommand
Definition: ses_select.h:96
The Schematic class represents one schematic page of a project and is always part of a circuit...
Definition: schematic.h:83
ProcRetVal processSubStateIdle(SEE_Base *event) noexcept
Definition: ses_select.cpp:95
The GraphicsView class.
Definition: graphicsview.h:47
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition: angle.h:78
left mouse button is not pressed (default state)
Definition: ses_select.h:90
The UndoStack class holds UndoCommand objects and provides undo/redo commands.
Definition: undostack.h:107
ProcRetVal
process() return values
Definition: ses_base.h:65
left mouse button is pressed
Definition: ses_select.h:91
ProcRetVal processIdleSceneLeftClick(QGraphicsSceneMouseEvent *mouseEvent, Schematic &schematic) noexcept
Definition: ses_select.cpp:195
ProcRetVal processSubStateMoving(SEE_Base *event) noexcept
Definition: ses_select.cpp:323
The SEE_Base (Schematic Editor Event Base) class.
Definition: schematiceditorevent.h:54
bool rotateSelectedItems(const Angle &angle) noexcept
Definition: ses_select.cpp:413
ProcRetVal processSubStateIdleSceneEvent(SEE_Base *event) noexcept
Definition: ses_select.cpp:125
ProcRetVal processSubStateMovingSceneEvent(SEE_Base *event) noexcept
Definition: ses_select.cpp:333
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5...
Definition: point.h:78
ProcRetVal processIdleSceneRightMouseButtonReleased(QGraphicsSceneMouseEvent *mouseEvent, Schematic *schematic) noexcept
Definition: ses_select.cpp:225
The SES_Base (SchematicEditorState Base) class.
Definition: ses_base.h:60
bool mirrorSelectedItems() noexcept
Definition: ses_select.cpp:429
bool removeSelectedItems() noexcept
Definition: ses_select.cpp:445
~SES_Select()
Definition: ses_select.cpp:62
ProcRetVal processIdleSceneDoubleClick(QGraphicsSceneMouseEvent *mouseEvent, Schematic *schematic) noexcept
Definition: ses_select.cpp:295
The SES_Select class (default state of the schematic editor FSM)
Definition: ses_select.h:53
ProcRetVal process(SEE_Base *event) noexcept override
Definition: ses_select.cpp:70
The SI_NetLabel class.
Definition: si_netlabel.h:51
void openNetLabelPropertiesDialog(SI_NetLabel &netlabel) noexcept
Definition: ses_select.cpp:469
SubState mSubState
the current substate
Definition: ses_select.h:95
The SchematicEditor class.
Definition: schematiceditor.h:63
void openSymbolPropertiesDialog(SI_Symbol &symbol) noexcept
Definition: ses_select.cpp:461
bool startMovingSelectedItems(Schematic &schematic, const Point &startPos) noexcept
Definition: ses_select.cpp:404
bool entry(SEE_Base *event) noexcept override
Definition: ses_select.cpp:81