Salome HOME
643c440eeceb50e02cc7cddc862b0265bbdcd60a
[modules/yacs.git] / src / genericgui / GenericGui.hxx
1 //  Copyright (C) 2006-2008  CEA/DEN, EDF R&D
2 //
3 //  This library is free software; you can redistribute it and/or
4 //  modify it under the terms of the GNU Lesser General Public
5 //  License as published by the Free Software Foundation; either
6 //  version 2.1 of the License.
7 //
8 //  This library is distributed in the hope that it will be useful,
9 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
10 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 //  Lesser General Public License for more details.
12 //
13 //  You should have received a copy of the GNU Lesser General Public
14 //  License along with this library; if not, write to the Free Software
15 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 #ifndef _GENERICGUI_HXX_
20 #define _GENERICGUI_HXX_
21
22 #include <QAction>
23 #include <QActionGroup>
24 #include <QObject>
25 #include <QMainWindow>
26 #include <QDockWidget>
27 #include <QString>
28
29 #include "SuitWrapper.hxx"
30
31 #include <map>
32 #include <list>
33 #include <string>
34
35 namespace YACS
36 {
37
38   namespace ENGINE
39   {
40     class Proc;
41     class Catalog;
42   }
43   namespace HMI
44   {
45     class QtGuiContext;
46     class GuiEditor;
47     class SuitWrapper;
48     class CatalogWidget;
49     class YACSGuiLoader;
50
51     class GenericGui: public QObject
52     {
53       Q_OBJECT
54
55     public:
56       GenericGui(YACS::HMI::SuitWrapper* wrapper, QMainWindow *parent = 0);
57       virtual ~GenericGui();
58
59       void createActions();
60       void createMenus();
61       void createTools();
62       void initialMenus();
63       void showBaseMenus(bool show);
64       void showEditionMenus(bool show);
65       void showExecMenus(bool show);
66       void switchContext(QWidget *view);
67       void showDockWidgets(bool isVisible);
68       void raiseStacked();
69       CatalogWidget* getCatalogWidget() { return _catalogsWidget; };
70       std::list<std::string> getMachineList();
71
72       QAction *_newSchemaAct;
73       QAction *_importSchemaAct;
74       QAction *_importSupervSchemaAct;
75       QAction *_exportSchemaAct;
76       QAction *_exportSchemaAsAct;
77       QAction *_importCatalogAct;
78
79       QAction *_runLoadedSchemaAct;
80       QAction *_loadRunStateSchemaAct;
81       QAction *_loadAndRunSchemaAct;
82
83       QAction *_startResumeAct;
84       QAction *_abortAct;
85       QAction *_pauseAct;
86       QAction *_resetAct;
87
88       QAction *_saveRunStateAct;
89       QAction *_newEditionAct;
90
91       QActionGroup *_execModeGroup;
92       QAction *_withoutStopModeAct;
93       QAction *_breakpointsModeAct;
94       QAction *_stepByStepModeAct;
95
96       QAction *_toggleStopOnErrorAct;
97
98       QAction *_getYacsContainerLogAct;
99       QAction *_getErrorReportAct;
100       QAction *_getErrorDetailsAct;
101       QAction *_getContainerLogAct;
102
103       QAction *_editDataTypesAct;
104       QAction *_createDataTypeAct;
105       QAction *_importDataTypeAct;
106       QAction *_newContainerAct;
107       QAction *_newSalomeComponentAct;
108       QAction *_newSalomePythonComponentAct;
109       QAction *_newCorbaComponentAct;
110       QAction *_salomeServiceNodeAct;
111       QAction *_serviceInlineNodeAct;
112       QAction *_CORBAServiceNodeAct;
113       QAction *_nodeNodeServiceNodeAct;
114       QAction *_cppNodeAct;
115       QAction *_XMLNodeAct;
116       QAction *_inDataNodeAct;
117       QAction *_outDataNodeAct;
118       QAction *_inStudyNodeAct;
119       QAction *_outStudyNodeAct;
120       QAction *_inlineScriptNodeAct;
121       QAction *_inlineFunctionNodeAct;
122       QAction *_blockNodeAct;
123       QAction *_FORNodeAct;
124       QAction *_FOREACHNodeAct;
125       QAction *_WHILENodeAct;
126       QAction *_SWITCHNodeAct;
127       QAction *_nodeFromCatalogAct;
128       QAction *_deleteItemAct;
129       QAction *_cutItemAct;
130       QAction *_copyItemAct;
131       QAction *_pasteItemAct;
132       QAction *_arrangeLocalNodesAct;
133       QAction *_arrangeRecurseNodesAct;
134       QAction *_computeLinkAct;
135       QAction *_toggleAutomaticComputeLinkAct;
136       QAction *_toggleSimplifyLinkAct;
137       QAction *_toggleForce2NodesLinkAct;
138       QAction *_toggleSceneItemVisibleAct;
139       QAction *_selectReferenceAct;
140       QAction *_whatsThisAct;
141
142       YACS::HMI::GuiEditor *_guiEditor;
143
144     public slots:
145       void onCleanOnExit();
146
147     protected:
148       int getMenuId() { return _menuId++; }
149       void createContext(YACS::ENGINE::Proc* proc,
150                          const QString& schemaName,
151                          const QString& runName,
152                          bool forEdition);
153       void setLoadedPresentation(YACS::ENGINE::Proc* proc);
154       QString getSaveFileName(const QString& fileName = QString());
155
156       YACSGuiLoader *_loader;
157       SuitWrapper* _wrapper;
158       QMainWindow* _parent;
159       QDockWidget* _dwTree;
160       QDockWidget* _dwStacked;
161       QDockWidget* _dwCatalogs;
162       YACS::ENGINE::Catalog* _builtinCatalog;
163       YACS::ENGINE::Catalog* _sessionCatalog;
164       CatalogWidget* _catalogsWidget;
165       std::map<QWidget*, YACS::HMI::QtGuiContext*> _mapViewContext;
166       int _menuId;
167       int _toolId;
168       int _schemaCnt;
169       std::list<std::string> _machineList;
170
171     private slots:
172
173       void onNewSchema();
174       void onImportSchema();
175       void onImportSupervSchema();
176       void onExportSchema();
177       void onExportSchemaAs();
178       void onImportCatalog();
179
180       void onRunLoadedSchema(bool withState = false);
181       void onLoadRunStateSchema();
182       void onLoadAndRunSchema();
183
184       void onStartResume();
185       void onAbort();
186       void onPause();
187       void onReset();
188       void onSaveRunState();
189       void onNewEdition();
190
191       void onWithoutStopMode(bool checked);
192       void onBreakpointsMode(bool checked);
193       void onStepByStepMode(bool checked);
194
195       void onToggleStopOnError(bool checked);
196
197       void onGetYacsContainerLog();
198       void onGetErrorReport();
199       void onGetErrorDetails();
200       void onGetContainerLog();
201
202       void onEditDataTypes();
203       void onCreateDataType();
204       void onImportDataType();
205
206       void onNewContainer();
207       void onNewSalomeComponent();
208       void onNewSalomePythonComponent();
209       void onNewCorbaComponent();
210
211       void onSalomeServiceNode();
212       void onServiceInlineNode();
213       void onCORBAServiceNode();
214       void onNodeNodeServiceNode();
215       void onCppNode();
216       void onXMLNode();
217       void onInDataNode();
218       void onOutDataNode();
219       void onInStudyNode();
220       void onOutStudyNode();
221       void onInlineScriptNode();
222       void onInlineFunctionNode();
223       void onBlockNode();
224       void onFORNode();
225       void onFOREACHNode();
226       void onWHILENode();
227       void onSWITCHNode();
228       void onNodeFromCatalog();
229
230       void onDeleteItem();
231       void onCutItem();
232       void onCopyItem();
233       void onPasteItem();
234
235       void onArrangeLocalNodes();
236       void onArrangeRecurseNodes();
237       void onRebuildLinks();
238       void onToggleAutomaticComputeLinks(bool checked);
239       void onToggleSimplifyLinks(bool checked);
240       void onToggleForce2NodesLinks(bool checked);
241
242       void onToggleSceneItemVisible(bool checked);
243
244       void onSelectReference();
245       void onWhatsThis();
246
247     private:
248     };
249
250   }
251 }
252
253 #endif