LibrePCB Developers Documentation
schematiceditorstate_addnetlabel.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_SCHEMATICEDITORSTATE_ADDNETLABEL_H
21 #define LIBREPCB_EDITOR_SCHEMATICEDITORSTATE_ADDNETLABEL_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "schematiceditorstate.h"
27 
28 #include <QtCore>
29 #include <QtWidgets>
30 
31 /*******************************************************************************
32  * Namespace / Forward Declarations
33  ******************************************************************************/
34 namespace librepcb {
35 
36 class Point;
37 class SI_NetLabel;
38 class Schematic;
39 
40 namespace editor {
41 
42 class CmdSchematicNetLabelEdit;
43 
44 /*******************************************************************************
45  * Class SchematicEditorState_AddNetLabel
46  ******************************************************************************/
47 
52  Q_OBJECT
53 
54 public:
55  // Constructors / Destructor
58  const SchematicEditorState_AddNetLabel& other) = delete;
59  explicit SchematicEditorState_AddNetLabel(const Context& context) noexcept;
60  virtual ~SchematicEditorState_AddNetLabel() noexcept;
61 
62  // General Methods
63  virtual bool entry() noexcept override;
64  virtual bool exit() noexcept override;
65 
66  // Event Handlers
67  virtual bool processGraphicsSceneMouseMoved(
68  QGraphicsSceneMouseEvent& e) noexcept override;
70  QGraphicsSceneMouseEvent& e) noexcept override;
72  QGraphicsSceneMouseEvent& e) noexcept override;
74  QGraphicsSceneMouseEvent& e) noexcept override;
75  virtual bool processSwitchToSchematicPage(int index) noexcept override;
76  virtual bool processRotate(const Angle& rotation) noexcept override;
77  virtual bool processMirror(Qt::Orientation orientation) noexcept override;
78 
79  // Operator Overloadings
81  const SchematicEditorState_AddNetLabel& rhs) = delete;
82 
83 private: // Methods
84  bool addLabel(const Point& pos) noexcept;
85  bool updateLabel(const Point& pos) noexcept;
86  bool fixLabel(const Point& pos) noexcept;
87  bool abortCommand(bool showErrMsgBox) noexcept;
88 
89 private: // Data
93 };
94 
95 /*******************************************************************************
96  * End of File
97  ******************************************************************************/
98 
99 } // namespace editor
100 } // namespace librepcb
101 
102 #endif
virtual bool processGraphicsSceneMouseMoved(QGraphicsSceneMouseEvent &e) noexcept override
Definition: schematiceditorstate_addnetlabel.cpp:86
The schematic editor state base class.
Definition: schematiceditorstate.h:57
virtual bool processGraphicsSceneLeftMouseButtonPressed(QGraphicsSceneMouseEvent &e) noexcept override
Definition: schematiceditorstate_addnetlabel.cpp:95
The CmdSchematicNetLabelEdit class.
Definition: cmdschematicnetlabeledit.h:50
virtual bool exit() noexcept override
Definition: schematiceditorstate_addnetlabel.cpp:73
Definition: occmodel.cpp:77
virtual bool processSwitchToSchematicPage(int index) noexcept override
Definition: schematiceditorstate_addnetlabel.cpp:135
virtual ~SchematicEditorState_AddNetLabel() noexcept
Definition: schematiceditorstate_addnetlabel.cpp:58
bool addLabel(const Point &pos) noexcept
Definition: schematiceditorstate_addnetlabel.cpp:165
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition: angle.h:78
bool mUndoCmdActive
Definition: schematiceditorstate_addnetlabel.h:90
The SchematicEditorState_AddNetLabel class.
Definition: schematiceditorstate_addnetlabel.h:51
bool updateLabel(const Point &pos) noexcept
Definition: schematiceditorstate_addnetlabel.cpp:204
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5...
Definition: point.h:79
bool abortCommand(bool showErrMsgBox) noexcept
Definition: schematiceditorstate_addnetlabel.cpp:230
virtual bool processRotate(const Angle &rotation) noexcept override
Definition: schematiceditorstate_addnetlabel.cpp:141
FSM Context.
Definition: schematiceditorfsm.h:81
CmdSchematicNetLabelEdit * mEditCmd
Definition: schematiceditorstate_addnetlabel.h:92
SchematicEditorState_AddNetLabel & operator=(const SchematicEditorState_AddNetLabel &rhs)=delete
virtual bool processGraphicsSceneLeftMouseButtonDoubleClicked(QGraphicsSceneMouseEvent &e) noexcept override
Definition: schematiceditorstate_addnetlabel.cpp:107
The SI_NetLabel class.
Definition: si_netlabel.h:49
SI_NetLabel * mCurrentNetLabel
Definition: schematiceditorstate_addnetlabel.h:91
bool fixLabel(const Point &pos) noexcept
Definition: schematiceditorstate_addnetlabel.cpp:213
virtual bool processGraphicsSceneRightMouseButtonReleased(QGraphicsSceneMouseEvent &e) noexcept override
Definition: schematiceditorstate_addnetlabel.cpp:119
virtual bool processMirror(Qt::Orientation orientation) noexcept override
Definition: schematiceditorstate_addnetlabel.cpp:151
virtual bool entry() noexcept override
Definition: schematiceditorstate_addnetlabel.cpp:66