LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ses_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_PROJECT_SES_ADDNETLABEL_H
21 #define LIBREPCB_PROJECT_SES_ADDNETLABEL_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 namespace project {
35 
36 class Schematic;
37 class SI_NetLabel;
38 class CmdSchematicNetLabelEdit;
39 
40 namespace editor {
41 
42 /*******************************************************************************
43  * Class SES_AddNetLabel
44  ******************************************************************************/
45 
49 class SES_AddNetLabel final : public SES_Base {
50  Q_OBJECT
51 
52 public:
53  // Constructors / Destructor
54  explicit SES_AddNetLabel(SchematicEditor& editor,
55  Ui::SchematicEditor& editorUi,
56  GraphicsView& editorGraphicsView,
57  UndoStack& undoStack);
59 
60  // General Methods
61  ProcRetVal process(SEE_Base* event) noexcept override;
62  bool entry(SEE_Base* event) noexcept override;
63  bool exit(SEE_Base* event) noexcept override;
64 
65 private:
66  // Private Methods
67  ProcRetVal processSceneEvent(SEE_Base* event) noexcept;
68  bool addLabel(Schematic& schematic, const Point& pos) noexcept;
69  bool updateLabel(const Point& pos) noexcept;
70  bool fixLabel(const Point& pos) noexcept;
71 
72  // General Attributes
76 };
77 
78 /*******************************************************************************
79  * End of File
80  ******************************************************************************/
81 
82 } // namespace editor
83 } // namespace project
84 } // namespace librepcb
85 
86 #endif // LIBREPCB_PROJECT_SES_ADDNETLABEL_H
bool entry(SEE_Base *event) noexceptoverride
Definition: ses_addnetlabel.cpp:78
~SES_AddNetLabel()
Definition: ses_addnetlabel.cpp:61
The Schematic class represents one schematic page of a project and is always part of a circuit...
Definition: schematic.h:83
ProcRetVal process(SEE_Base *event) noexceptoverride
Definition: ses_addnetlabel.cpp:69
The GraphicsView class.
Definition: graphicsview.h:47
SES_AddNetLabel(SchematicEditor &editor, Ui::SchematicEditor &editorUi, GraphicsView &editorGraphicsView, UndoStack &undoStack)
Definition: ses_addnetlabel.cpp:51
The UndoStack class holds UndoCommand objects and provides undo/redo commands.
Definition: undostack.h:107
ProcRetVal
process() return values
Definition: ses_base.h:65
bool updateLabel(const Point &pos) noexcept
Definition: ses_addnetlabel.cpp:213
The SEE_Base (Schematic Editor Event Base) class.
Definition: schematiceditorevent.h:54
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5...
Definition: point.h:78
The SES_Base (SchematicEditorState Base) class.
Definition: ses_base.h:60
The CmdSchematicNetLabelEdit class.
Definition: cmdschematicnetlabeledit.h:47
bool mUndoCmdActive
Definition: ses_addnetlabel.h:73
bool addLabel(Schematic &schematic, const Point &pos) noexcept
Definition: ses_addnetlabel.cpp:182
The SES_AddNetLabel class.
Definition: ses_addnetlabel.h:49
bool fixLabel(const Point &pos) noexcept
Definition: ses_addnetlabel.cpp:222
CmdSchematicNetLabelEdit * mEditCmd
Definition: ses_addnetlabel.h:75
The SI_NetLabel class.
Definition: si_netlabel.h:51
ProcRetVal processSceneEvent(SEE_Base *event) noexcept
Definition: ses_addnetlabel.cpp:112
SI_NetLabel * mCurrentNetLabel
Definition: ses_addnetlabel.h:74
bool exit(SEE_Base *event) noexceptoverride
Definition: ses_addnetlabel.cpp:89
The SchematicEditor class.
Definition: schematiceditor.h:64