LibrePCB Developers Documentation
schematiceditor.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_SCHEMATICEDITOR_H
21 #define LIBREPCB_PROJECT_SCHEMATICEDITOR_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
27 
28 #include <QtCore>
29 #include <QtWidgets>
30 
31 /*******************************************************************************
32  * Namespace / Forward Declarations
33  ******************************************************************************/
34 namespace librepcb {
35 
36 class GraphicsView;
37 class UndoStackActionGroup;
38 class ExclusiveActionGroup;
39 
40 namespace project {
41 
42 class Project;
43 class Schematic;
44 
45 namespace editor {
46 
47 class ProjectEditor;
48 class SchematicPagesDock;
49 class ErcMsgDock;
50 class SES_FSM;
51 
52 namespace Ui {
53 class SchematicEditor;
54 }
55 
56 /*******************************************************************************
57  * Class SchematicEditor
58  ******************************************************************************/
59 
63 class SchematicEditor final : public QMainWindow,
65  Q_OBJECT
66 
67 public:
68  // Constructors / Destructor
69  explicit SchematicEditor(ProjectEditor& projectEditor, Project& project);
70  ~SchematicEditor();
71 
72  // Getters
73  ProjectEditor& getProjectEditor() const noexcept { return mProjectEditor; }
74  Project& getProject() const noexcept { return mProject; }
75  int getActiveSchematicIndex() const noexcept { return mActiveSchematicIndex; }
76  Schematic* getActiveSchematic() const noexcept;
77 
78  // Setters
79  bool setActiveSchematicIndex(int index) noexcept;
80 
81  // General Methods
82  void abortAllCommands() noexcept;
83 
84 protected:
85  void closeEvent(QCloseEvent* event);
86 
87 private slots:
88 
89  // Actions
90  void on_actionClose_Project_triggered();
91  void on_actionRenameSheet_triggered();
92  void on_actionGrid_triggered();
93  void on_actionPrint_triggered();
94  void on_actionPDF_Export_triggered();
95  void on_actionExportAsSvg_triggered();
96  void on_actionGenerateBom_triggered();
97  void on_actionAddComp_Resistor_triggered();
98  void on_actionAddComp_BipolarCapacitor_triggered();
99  void on_actionAddComp_UnipolarCapacitor_triggered();
100  void on_actionAddComp_Inductor_triggered();
101  void on_actionAddComp_gnd_triggered();
102  void on_actionAddComp_vcc_triggered();
103  void on_actionProjectProperties_triggered();
104  void on_actionUpdateLibrary_triggered();
105 
106 signals:
107  void activeSchematicChanged(int index);
108 
109 private:
110  // make some methods inaccessible...
111  SchematicEditor();
112  SchematicEditor(const SchematicEditor& other);
113  SchematicEditor& operator=(const SchematicEditor& rhs);
114 
115  // Private Methods
116  bool graphicsViewEventHandler(QEvent* event);
117  void toolActionGroupChangeTriggered(const QVariant& newTool) noexcept;
118  void addSchematic() noexcept;
119  void removeSchematic(int index) noexcept;
120  void renameSchematic(int index) noexcept;
121  QStringList getSearchToolBarCompleterList() noexcept;
122  void goToSymbol(const QString& name) noexcept;
123 
124  // General Attributes
127  Ui::SchematicEditor* mUi;
129  QScopedPointer<UndoStackActionGroup> mUndoStackActionGroup;
130  QScopedPointer<ExclusiveActionGroup> mToolsActionGroup;
131 
133 
134  // Docks
137 
138  // Finite State Machine
140 };
141 
142 /*******************************************************************************
143  * End of File
144  ******************************************************************************/
145 
146 } // namespace editor
147 } // namespace project
148 } // namespace librepcb
149 
150 #endif // LIBREPCB_PROJECT_SCHEMATICEDITOR_H
ProjectEditor & mProjectEditor
Definition: schematiceditor.h:125
Definition: mainwindow.h:10
Project & getProject() const noexcept
Definition: schematiceditor.h:74
Definition: airwiresbuilder.cpp:32
The Schematic class represents one schematic page of a project and is always part of a circuit...
Definition: schematic.h:83
The GraphicsView class.
Definition: graphicsview.h:47
The Project class represents a whole (opened) project with all its content.
Definition: project.h:80
The ErcMsgDock class.
Definition: ercmsgdock.h:52
The ProjectEditor class.
Definition: projecteditor.h:63
Project & mProject
Definition: schematiceditor.h:126
ErcMsgDock * mErcMsgDock
Definition: schematiceditor.h:136
QScopedPointer< ExclusiveActionGroup > mToolsActionGroup
Definition: schematiceditor.h:130
SES_FSM * mFsm
Definition: schematiceditor.h:139
int mActiveSchematicIndex
Definition: schematiceditor.h:132
GraphicsView * mGraphicsView
Definition: schematiceditor.h:128
The SES_FSM (Schematic Editor Finite State Machine) class.
Definition: ses_fsm.h:44
The SchematicPagesDock class.
Definition: schematicpagesdock.h:50
int getActiveSchematicIndex() const noexcept
Definition: schematiceditor.h:75
The IF_GraphicsViewEventHandler class.
Definition: if_graphicsvieweventhandler.h:40
Ui::SchematicEditor * mUi
Definition: schematiceditor.h:127
The SchematicEditor class.
Definition: schematiceditor.h:63
ProjectEditor & getProjectEditor() const noexcept
Definition: schematiceditor.h:73
SchematicPagesDock * mPagesDock
Definition: schematiceditor.h:135
QScopedPointer< UndoStackActionGroup > mUndoStackActionGroup
Definition: schematiceditor.h:129