LibrePCB Developers Documentation
ses_base.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_BASE_H
21 #define LIBREPCB_PROJECT_SES_BASE_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "../schematiceditor.h"
27 #include "schematiceditorevent.h"
28 #include "ui_schematiceditor.h"
29 
32 
33 #include <QtCore>
34 
35 /*******************************************************************************
36  * Namespace / Forward Declarations
37  ******************************************************************************/
38 namespace librepcb {
39 
40 class UndoStack;
41 
42 namespace workspace {
43 class Workspace;
44 }
45 
46 namespace project {
47 
48 class Project;
49 class Circuit;
50 
51 namespace editor {
52 
53 /*******************************************************************************
54  * Class SES_Base
55  ******************************************************************************/
56 
60 class SES_Base : public QObject {
61  Q_OBJECT
62 
63 public:
65  enum ProcRetVal {
69  };
70 
71  // Constructors / Destructor
72  explicit SES_Base(SchematicEditor& editor, Ui::SchematicEditor& editorUi,
73  GraphicsView& editorGraphicsView, UndoStack& undoStack);
74  virtual ~SES_Base();
75 
76  // General Methods
77  virtual ProcRetVal process(SEE_Base* event) noexcept = 0;
78  virtual bool entry(SEE_Base* event) noexcept {
79  Q_UNUSED(event);
80  return true;
81  }
82  virtual bool exit(SEE_Base* event) noexcept {
83  Q_UNUSED(event);
84  return true;
85  }
86 
87 protected: // Methods
88  const LengthUnit& getDefaultLengthUnit() const noexcept;
89 
90 protected:
91  // General Attributes which are needed by some state objects
96  Ui::SchematicEditor& mEditorUi;
98  UndoStack& mUndoStack;
100 };
101 
102 /*******************************************************************************
103  * End of File
104  ******************************************************************************/
105 
106 } // namespace editor
107 } // namespace project
108 } // namespace librepcb
109 
110 #endif // LIBREPCB_PROJECT_SES_BASE_H
The Circuit class represents all electrical connections in a project (drawed in the schematics) ...
Definition: circuit.h:73
event handled, leave the current state
Definition: ses_base.h:67
virtual bool exit(SEE_Base *event) noexcept
Definition: ses_base.h:82
The Workspace class represents a workspace with all its data (library, projects, settings, ...)
Definition: workspace.h:62
Definition: airwiresbuilder.cpp:32
event handled, stay in the current state
Definition: ses_base.h:66
Project & mProject
Definition: ses_base.h:93
The GraphicsView class.
Definition: graphicsview.h:47
The Project class represents a whole (opened) project with all its content.
Definition: project.h:80
The UndoStack class holds UndoCommand objects and provides undo/redo commands.
Definition: undostack.h:107
ProcRetVal
process() return values
Definition: ses_base.h:65
The SEE_Base (Schematic Editor Event Base) class.
Definition: schematiceditorevent.h:54
workspace::Workspace & mWorkspace
Definition: ses_base.h:92
The SES_Base (SchematicEditorState Base) class.
Definition: ses_base.h:60
GraphicsView & mEditorGraphicsView
Definition: ses_base.h:97
Ui::SchematicEditor & mEditorUi
allows access to SchematicEditor UI
Definition: ses_base.h:96
Circuit & mCircuit
Definition: ses_base.h:94
SchematicEditor & mEditor
Definition: ses_base.h:95
virtual bool entry(SEE_Base *event) noexcept
Definition: ses_base.h:78
event unhandled, pass it to the parent
Definition: ses_base.h:68
The SchematicEditor class.
Definition: schematiceditor.h:63
The LengthUnit class represents a length unit (millimeters, inches,...) and provides some useful meth...
Definition: lengthunit.h:62