1 // Copyright (C) 2006-2013 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef _GENERICGUI_HXX_
21 #define _GENERICGUI_HXX_
23 #include "GenericGuiExport.hxx"
26 #include <QActionGroup>
28 #include <QMainWindow>
29 #include <QDockWidget>
32 #include "SuitWrapper.hxx"
53 class SubjectDataPort;
54 class BatchJobsListDialog;
56 class GENERICGUI_EXPORT GenericGui: public QObject
61 GenericGui(YACS::HMI::SuitWrapper* wrapper, QMainWindow *parent = 0);
62 virtual ~GenericGui();
68 void showBaseMenus(bool show);
69 void showEditionMenus(bool show);
70 void showExecMenus(bool show);
71 void showCommonMenus(bool show);
72 void switchContext(QWidget *view);
73 bool closeContext(QWidget *view, bool onExit = false);
74 void showDockWidgets(bool isVisible);
76 CatalogWidget* getCatalogWidget() { return _catalogsWidget; };
77 std::list<std::string> getMachineList();
78 void createForEachLoop(std::string type="double");
79 void putGraphInForeachLoop(std::string type);
80 virtual void loadSchema(const std::string& filename,bool edit=true, bool arrangeLocalNodes=false);
81 virtual void onHelpContextModule( const QString&, const QString&, const QString& = QString() );
82 void createContext(YACS::ENGINE::Proc* proc,
83 const QString& schemaName,
84 const QString& runName,
86 YACSGuiLoader *getLoader() { return _loader; };
88 QAction *_newSchemaAct;
89 QAction *_importSchemaAct;
90 QAction *_chooseBatchJobAct;
91 QAction *_importSupervSchemaAct;
92 QAction *_exportSchemaAct;
93 QAction *_exportSchemaAsAct;
94 QAction *_importCatalogAct;
96 QAction *_runLoadedSchemaAct;
97 QAction *_loadRunStateSchemaAct;
98 QAction *_loadAndRunSchemaAct;
100 QAction *_startResumeAct;
105 QAction *_saveRunStateAct;
106 QAction *_newEditionAct;
108 QActionGroup *_execModeGroup;
109 QAction *_withoutStopModeAct;
110 QAction *_breakpointsModeAct;
111 QAction *_stepByStepModeAct;
113 QAction *_toggleStopOnErrorAct;
115 QAction *_getYacsContainerLogAct;
116 QAction *_getErrorReportAct;
117 QAction *_getErrorDetailsAct;
118 QAction *_getContainerLogAct;
119 QAction *_shutdownProcAct;
121 QAction *_editDataTypesAct;
122 QAction *_createDataTypeAct;
123 QAction *_importDataTypeAct;
124 QAction *_newContainerAct;
125 QAction *_selectComponentInstanceAct;
126 QAction *_newSalomeComponentAct;
127 QAction *_newSalomePythonComponentAct;
128 QAction *_newCorbaComponentAct;
129 QAction *_salomeServiceNodeAct;
130 QAction *_serviceInlineNodeAct;
131 QAction *_CORBAServiceNodeAct;
132 QAction *_nodeNodeServiceNodeAct;
133 QAction *_cppNodeAct;
134 QAction *_XMLNodeAct;
135 QAction *_inDataNodeAct;
136 QAction *_outDataNodeAct;
137 QAction *_inStudyNodeAct;
138 QAction *_outStudyNodeAct;
139 QAction *_inlineScriptNodeAct;
140 QAction *_inlineFunctionNodeAct;
141 QAction *_blockNodeAct;
142 QAction *_FORNodeAct;
143 QAction *_FOREACHNodeAct;
144 QAction *_WHILENodeAct;
145 QAction *_SWITCHNodeAct;
146 QAction *_OptimizerLoopAct;
147 QAction *_nodeFromCatalogAct;
148 QAction *_deleteItemAct;
149 QAction *_cutItemAct;
150 QAction *_copyItemAct;
151 QAction *_pasteItemAct;
152 QAction *_putInBlocAct;
153 QAction *_putGraphInBlocAct;
154 QAction *_putGraphInForLoopAct;
155 QAction *_putGraphInWhileLoopAct;
156 QAction *_putGraphInOptimizerLoopAct;
157 QAction *_arrangeLocalNodesAct;
158 QAction *_arrangeRecurseNodesAct;
159 QAction *_computeLinkAct;
160 QAction *_zoomToBlocAct;
161 QAction *_centerOnNodeAct;
162 QAction *_shrinkExpand;
164 QAction *_toggleStraightLinksAct;
165 QAction *_toggleAutomaticComputeLinkAct;
166 QAction *_toggleSimplifyLinkAct;
167 QAction *_toggleForce2NodesLinkAct;
168 QAction *_toggleAddRowColsAct;
169 QAction *_toggleSceneItemVisibleAct;
170 QAction *_selectReferenceAct;
171 QAction *_whatsThisAct;
173 QAction *_showAllLinksAct;
174 QAction *_hideAllLinksAct;
176 QAction *_showOnlyPortLinksAct;
177 QAction *_showPortLinksAct;
178 QAction *_hidePortLinksAct;
179 QAction *_emphasisPortLinksAct;
181 QAction *_showOnlyCtrlLinksAct;
182 QAction *_showCtrlLinksAct;
183 QAction *_hideCtrlLinksAct;
184 QAction *_emphasisCtrlLinksAct;
186 QAction *_showOnlyLinkAct;
187 QAction *_showLinkAct;
188 QAction *_hideLinkAct;
189 QAction *_emphasisLinkAct;
190 QAction *_deEmphasizeAllAct;
194 QAction *_showUndoAct;
195 QAction *_showRedoAct;
197 YACS::HMI::GuiEditor *_guiEditor;
198 void setLoadedPresentation(YACS::ENGINE::Proc* proc);
201 void onCleanOnExit();
204 int getMenuId() { return _menuId++; }
205 QString getSaveFileName(const QString& fileName = QString());
207 YACSGuiLoader *_loader;
208 SuitWrapper* _wrapper;
209 QMainWindow* _parent;
210 QDockWidget* _dwTree;
211 QDockWidget* _dwStacked;
212 QDockWidget* _dwCatalogs;
213 BatchJobsListDialog* _BJLdialog;
214 YACS::ENGINE::Catalog* _builtinCatalog;
215 YACS::ENGINE::Catalog* _sessionCatalog;
216 CatalogWidget* _catalogsWidget;
217 std::map<QWidget*, YACS::HMI::QtGuiContext*> _mapViewContext;
222 std::list<std::string> _machineList;
227 void onImportSchema();
228 void onChooseBatchJob();
229 void onImportSupervSchema();
230 void onExportSchema();
231 void onExportSchemaAs();
232 void onImportCatalog();
234 void onRunLoadedSchema(bool withState = false);
235 void onLoadRunStateSchema();
236 void onLoadAndRunSchema();
238 void onStartResume();
242 void onSaveRunState();
245 void onWithoutStopMode(bool checked);
246 void onBreakpointsMode(bool checked);
247 void onStepByStepMode(bool checked);
249 void onToggleStopOnError(bool checked);
251 void onGetYacsContainerLog();
252 void onGetErrorReport();
253 void onGetErrorDetails();
254 void onGetContainerLog();
255 void onShutdownProc();
257 void onEditDataTypes();
258 void onCreateDataType();
259 void onImportDataType();
261 void onNewContainer();
262 void onSelectComponentInstance();
263 void onNewSalomeComponent();
264 void onNewSalomePythonComponent();
265 void onNewCorbaComponent();
267 void onSalomeServiceNode();
268 void onServiceInlineNode();
269 void onCORBAServiceNode();
270 void onNodeNodeServiceNode();
274 void onOutDataNode();
275 void onInStudyNode();
276 void onOutStudyNode();
277 void onInlineScriptNode();
278 void onInlineFunctionNode();
281 void onFOREACHNode();
284 void onOptimizerLoop();
285 void onNodeFromCatalog();
292 void onPutGraphInBloc();
293 void onPutGraphInForLoop();
294 void onPutGraphInWhileLoop();
295 void onPutGraphInOptimizerLoop();
296 void onArrangeLocalNodes();
297 void onArrangeRecurseNodes();
298 void onRebuildLinks();
300 void onCenterOnNode();
301 void onShrinkExpand();
302 void onToggleStraightLinks(bool checked);
303 void onToggleAutomaticComputeLinks(bool checked);
304 void onToggleSimplifyLinks(bool checked);
305 void onToggleForce2NodesLinks(bool checked);
306 void onToggleAddRowCols(bool checked);
308 void onToggleSceneItemVisible(bool checked);
310 void onShowAllLinks();
311 void onHideAllLinks();
313 void onShowOnlyPortLinks();
314 void onShowPortLinks();
315 void onHidePortLinks();
316 void onEmphasisPortLinks();
318 void onShowOnlyCtrlLinks();
319 void onShowCtrlLinks();
320 void onHideCtrlLinks();
321 void onEmphasisCtrlLinks();
323 void onShowOnlyLink();
326 void onEmphasisLink();
327 void onDeEmphasizeAll();
329 void onSelectReference();
338 void displayLinks(bool isShown);
339 void displayControlLinks(bool isShown);
340 void displayPortLinks(bool isShown);
341 void displayALink(bool isShown);
342 void emphasizePortLink(YACS::HMI::SubjectDataPort* sub, bool emphasize);