1 // Copyright (C) 2006-2014 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, or (at your option) any later version.
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();
69 void showBaseMenus(bool show);
70 void showEditionMenus(bool show);
71 void showExecMenus(bool show);
72 void showCommonMenus(bool show);
73 void switchContext(QWidget *view, bool onExit = false);
74 bool closeContext(QWidget *view, bool onExit = false);
75 void showDockWidgets(bool isVisible);
77 CatalogWidget* getCatalogWidget() { return _catalogsWidget; };
78 std::list<std::string> getMachineList();
79 void createForEachLoop(std::string type="double");
80 void putGraphInForeachLoop(std::string type);
81 virtual void loadSchema(const std::string& filename,bool edit=true, bool arrangeLocalNodes=false);
82 virtual void onHelpContextModule( const QString&, const QString&, const QString& = QString() );
83 void createContext(YACS::ENGINE::Proc* proc,
84 const QString& schemaName,
85 const QString& runName,
87 YACSGuiLoader *getLoader() { return _loader; };
89 QAction *_newSchemaAct;
90 QAction *_importSchemaAct;
91 QAction *_chooseBatchJobAct;
92 QAction *_importSupervSchemaAct;
93 QAction *_exportSchemaAct;
94 QAction *_exportSchemaAsAct;
95 QAction *_importCatalogAct;
97 QAction *_runLoadedSchemaAct;
98 QAction *_loadRunStateSchemaAct;
99 QAction *_loadAndRunSchemaAct;
101 QAction *_startResumeAct;
106 QAction *_saveRunStateAct;
107 QAction *_newEditionAct;
109 QActionGroup *_execModeGroup;
110 QAction *_withoutStopModeAct;
111 QAction *_breakpointsModeAct;
112 QAction *_stepByStepModeAct;
114 QAction *_toggleStopOnErrorAct;
116 QAction *_getYacsContainerLogAct;
117 QAction *_getErrorReportAct;
118 QAction *_getErrorDetailsAct;
119 QAction *_getContainerLogAct;
120 QAction *_shutdownProcAct;
122 QAction *_editDataTypesAct;
123 QAction *_createDataTypeAct;
124 QAction *_importDataTypeAct;
125 QAction *_newContainerAct;
126 QAction *_selectComponentInstanceAct;
127 QAction *_newSalomeComponentAct;
128 QAction *_newSalomePythonComponentAct;
129 QAction *_newCorbaComponentAct;
130 QAction *_salomeServiceNodeAct;
131 QAction *_serviceInlineNodeAct;
132 QAction *_CORBAServiceNodeAct;
133 QAction *_nodeNodeServiceNodeAct;
134 QAction *_cppNodeAct;
135 QAction *_XMLNodeAct;
136 QAction *_inDataNodeAct;
137 QAction *_outDataNodeAct;
138 QAction *_inStudyNodeAct;
139 QAction *_outStudyNodeAct;
140 QAction *_inlineScriptNodeAct;
141 QAction *_inlineFunctionNodeAct;
142 QAction *_blockNodeAct;
143 QAction *_FORNodeAct;
144 QAction *_FOREACHNodeAct;
145 QAction *_WHILENodeAct;
146 QAction *_SWITCHNodeAct;
147 QAction *_OptimizerLoopAct;
148 QAction *_nodeFromCatalogAct;
149 QAction *_deleteItemAct;
150 QAction *_cutItemAct;
151 QAction *_copyItemAct;
152 QAction *_pasteItemAct;
153 QAction *_putInBlocAct;
154 QAction *_putGraphInBlocAct;
155 QAction *_putGraphInForLoopAct;
156 QAction *_putGraphInWhileLoopAct;
157 QAction *_putGraphInOptimizerLoopAct;
158 QAction *_arrangeLocalNodesAct;
159 QAction *_arrangeRecurseNodesAct;
160 QAction *_computeLinkAct;
161 QAction *_zoomToBlocAct;
162 QAction *_centerOnNodeAct;
163 QAction *_shrinkExpand;
164 QAction *_shrinkExpandChildren;
165 QAction *_shrinkExpandElementaryRecursively;
167 QAction *_toggleStraightLinksAct;
168 QAction *_toggleAutomaticComputeLinkAct;
169 QAction *_toggleSimplifyLinkAct;
170 QAction *_toggleForce2NodesLinkAct;
171 QAction *_toggleAddRowColsAct;
172 QAction *_toggleSceneItemVisibleAct;
173 QAction *_selectReferenceAct;
174 QAction *_whatsThisAct;
176 QAction *_showAllLinksAct;
177 QAction *_hideAllLinksAct;
179 QAction *_showOnlyPortLinksAct;
180 QAction *_showPortLinksAct;
181 QAction *_hidePortLinksAct;
182 QAction *_emphasisPortLinksAct;
184 QAction *_showOnlyCtrlLinksAct;
185 QAction *_showCtrlLinksAct;
186 QAction *_hideCtrlLinksAct;
187 QAction *_emphasisCtrlLinksAct;
189 QAction *_showOnlyLinkAct;
190 QAction *_showLinkAct;
191 QAction *_hideLinkAct;
192 QAction *_emphasisLinkAct;
193 QAction *_deEmphasizeAllAct;
197 QAction *_showUndoAct;
198 QAction *_showRedoAct;
200 YACS::HMI::GuiEditor *_guiEditor;
201 void setLoadedPresentation(YACS::ENGINE::Proc* proc);
204 void onCleanOnExit();
207 int getMenuId() { return _menuId++; }
208 QString getSaveFileName(const QString& fileName = QString());
210 YACSGuiLoader *_loader;
211 SuitWrapper* _wrapper;
212 QMainWindow* _parent;
213 QDockWidget* _dwTree;
214 QDockWidget* _dwStacked;
215 QDockWidget* _dwCatalogs;
216 BatchJobsListDialog* _BJLdialog;
217 YACS::ENGINE::Catalog* _builtinCatalog;
218 YACS::ENGINE::Catalog* _sessionCatalog;
219 CatalogWidget* _catalogsWidget;
220 std::map<QWidget*, YACS::HMI::QtGuiContext*> _mapViewContext;
225 std::list<std::string> _machineList;
230 void onImportSchema();
231 void onChooseBatchJob();
232 void onImportSupervSchema();
233 void onExportSchema();
234 void onExportSchemaAs();
235 void onImportCatalog();
237 void onRunLoadedSchema(bool withState = false);
238 void onLoadRunStateSchema();
239 void onLoadAndRunSchema();
241 void onStartResume();
245 void onSaveRunState();
248 void onWithoutStopMode(bool checked);
249 void onBreakpointsMode(bool checked);
250 void onStepByStepMode(bool checked);
252 void onToggleStopOnError(bool checked);
254 void onGetYacsContainerLog();
255 void onGetErrorReport();
256 void onGetErrorDetails();
257 void onGetContainerLog();
258 void onShutdownProc();
260 void onEditDataTypes();
261 void onCreateDataType();
262 void onImportDataType();
264 void onNewContainer();
265 void onSelectComponentInstance();
266 void onNewSalomeComponent();
267 void onNewSalomePythonComponent();
268 void onNewCorbaComponent();
270 void onSalomeServiceNode();
271 void onServiceInlineNode();
272 void onCORBAServiceNode();
273 void onNodeNodeServiceNode();
277 void onOutDataNode();
278 void onInStudyNode();
279 void onOutStudyNode();
280 void onInlineScriptNode();
281 void onInlineFunctionNode();
284 void onFOREACHNode();
287 void onOptimizerLoop();
288 void onNodeFromCatalog();
295 void onPutGraphInBloc();
296 void onPutGraphInForLoop();
297 void onPutGraphInWhileLoop();
298 void onPutGraphInOptimizerLoop();
299 void onArrangeLocalNodes();
300 void onArrangeRecurseNodes();
301 void onRebuildLinks();
303 void onCenterOnNode();
304 void onShrinkExpand();
305 void onShrinkExpandChildren();
306 void onShrinkExpandElementaryRecursively();
307 void onToggleStraightLinks(bool checked);
308 void onToggleAutomaticComputeLinks(bool checked);
309 void onToggleSimplifyLinks(bool checked);
310 void onToggleForce2NodesLinks(bool checked);
311 void onToggleAddRowCols(bool checked);
313 void onToggleSceneItemVisible(bool checked);
315 void onShowAllLinks();
316 void onHideAllLinks();
318 void onShowOnlyPortLinks();
319 void onShowPortLinks();
320 void onHidePortLinks();
321 void onEmphasisPortLinks();
323 void onShowOnlyCtrlLinks();
324 void onShowCtrlLinks();
325 void onHideCtrlLinks();
326 void onEmphasisCtrlLinks();
328 void onShowOnlyLink();
331 void onEmphasisLink();
332 void onDeEmphasizeAll();
334 void onSelectReference();
343 void displayLinks(bool isShown);
344 void displayControlLinks(bool isShown);
345 void displayPortLinks(bool isShown);
346 void displayALink(bool isShown);
347 void emphasizePortLink(YACS::HMI::SubjectDataPort* sub, bool emphasize);