1 // Copyright (C) 2006-2023 CEA, EDF
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 *_newHPContainerAct;
127 QAction *_selectComponentInstanceAct;
128 QAction *_newSalomeComponentAct;
129 QAction *_newSalomePythonComponentAct;
130 QAction *_newCorbaComponentAct;
131 QAction *_salomeServiceNodeAct;
132 QAction *_serviceInlineNodeAct;
133 QAction *_CORBAServiceNodeAct;
134 QAction *_nodeNodeServiceNodeAct;
135 QAction *_cppNodeAct;
136 QAction *_XMLNodeAct;
137 QAction *_inDataNodeAct;
138 QAction *_outDataNodeAct;
139 QAction *_inStudyNodeAct;
140 QAction *_outStudyNodeAct;
141 QAction *_inlineScriptNodeAct;
142 QAction *_inlineFunctionNodeAct;
143 QAction *_blockNodeAct;
144 QAction *_FORNodeAct;
145 QAction *_FOREACHNodeAct;
146 QAction *_WHILENodeAct;
147 QAction *_SWITCHNodeAct;
148 QAction *_OptimizerLoopAct;
149 QAction *_nodeFromCatalogAct;
150 QAction *_deleteItemAct;
151 QAction *_cutItemAct;
152 QAction *_copyItemAct;
153 QAction *_pasteItemAct;
154 QAction *_putInBlocAct;
155 QAction *_putGraphInBlocAct;
156 QAction *_putGraphInForLoopAct;
157 QAction *_putGraphInWhileLoopAct;
158 QAction *_putGraphInOptimizerLoopAct;
159 QAction *_arrangeLocalNodesAct;
160 QAction *_arrangeRecurseNodesAct;
161 QAction *_computeLinkAct;
162 QAction *_zoomToBlocAct;
163 QAction *_centerOnNodeAct;
164 QAction *_shrinkExpand;
165 QAction *_shrinkExpandChildren;
166 QAction *_shrinkExpandElementaryRecursively;
168 QAction *_toggleStraightLinksAct;
169 QAction *_toggleAutomaticComputeLinkAct;
170 QAction *_toggleSimplifyLinkAct;
171 QAction *_toggleForce2NodesLinkAct;
172 QAction *_toggleAddRowColsAct;
173 QAction *_toggleSceneItemVisibleAct;
174 QAction *_selectReferenceAct;
175 QAction *_whatsThisAct;
177 QAction *_showAllLinksAct;
178 QAction *_hideAllLinksAct;
180 QAction *_showOnlyPortLinksAct;
181 QAction *_showPortLinksAct;
182 QAction *_hidePortLinksAct;
183 QAction *_emphasisPortLinksAct;
185 QAction *_showOnlyCtrlLinksAct;
186 QAction *_showCtrlLinksAct;
187 QAction *_hideCtrlLinksAct;
188 QAction *_emphasisCtrlLinksAct;
190 QAction *_showOnlyLinkAct;
191 QAction *_showLinkAct;
192 QAction *_hideLinkAct;
193 QAction *_emphasisLinkAct;
194 QAction *_deEmphasizeAllAct;
198 QAction *_showUndoAct;
199 QAction *_showRedoAct;
201 YACS::HMI::GuiEditor *_guiEditor;
202 void setLoadedPresentation(YACS::ENGINE::Proc* proc);
205 void onCleanOnExit();
208 int getMenuId() { return _menuId++; }
209 QString getSaveFileName(const QString& fileName = QString());
211 YACSGuiLoader *_loader;
212 SuitWrapper* _wrapper;
213 QMainWindow* _parent;
214 QDockWidget* _dwTree;
215 QDockWidget* _dwStacked;
216 QDockWidget* _dwCatalogs;
217 BatchJobsListDialog* _BJLdialog;
218 YACS::ENGINE::Catalog* _builtinCatalog;
219 YACS::ENGINE::Catalog* _sessionCatalog;
220 CatalogWidget* _catalogsWidget;
221 std::map<QWidget*, YACS::HMI::QtGuiContext*> _mapViewContext;
226 std::list<std::string> _machineList;
231 void onImportSchema();
232 void onChooseBatchJob();
233 void onImportSupervSchema();
234 void onExportSchema();
235 void onExportSchemaAs();
236 void onImportCatalog();
238 void onRunLoadedSchema(bool withState = false);
239 void onLoadRunStateSchema();
240 void onLoadAndRunSchema();
242 void onStartResume();
246 void onSaveRunState();
249 void onWithoutStopMode(bool checked);
250 void onBreakpointsMode(bool checked);
251 void onStepByStepMode(bool checked);
253 void onToggleStopOnError(bool checked);
255 void onGetYacsContainerLog();
256 void onGetErrorReport();
257 void onGetErrorDetails();
258 void onGetContainerLog();
259 void onShutdownProc();
261 void onEditDataTypes();
262 void onCreateDataType();
263 void onImportDataType();
265 void onNewContainer();
266 void onNewHPContainer();
267 void onSelectComponentInstance();
268 void onNewSalomeComponent();
269 void onNewSalomePythonComponent();
270 void onNewCorbaComponent();
272 void onSalomeServiceNode();
273 void onServiceInlineNode();
274 void onCORBAServiceNode();
275 void onNodeNodeServiceNode();
279 void onOutDataNode();
280 void onInStudyNode();
281 void onOutStudyNode();
282 void onInlineScriptNode();
283 void onInlineFunctionNode();
286 void onFOREACHNode();
289 void onOptimizerLoop();
290 void onNodeFromCatalog();
297 void onPutGraphInBloc();
298 void onPutGraphInForLoop();
299 void onPutGraphInWhileLoop();
300 void onPutGraphInOptimizerLoop();
301 void onArrangeLocalNodes();
302 void onArrangeRecurseNodes();
303 void onRebuildLinks();
305 void onCenterOnNode();
306 void onShrinkExpand();
307 void onShrinkExpandChildren();
308 void onShrinkExpandElementaryRecursively();
309 void onToggleStraightLinks(bool checked);
310 void onToggleAutomaticComputeLinks(bool checked);
311 void onToggleSimplifyLinks(bool checked);
312 void onToggleForce2NodesLinks(bool checked);
313 void onToggleAddRowCols(bool checked);
315 void onToggleSceneItemVisible(bool checked);
317 void onShowAllLinks();
318 void onHideAllLinks();
320 void onShowOnlyPortLinks();
321 void onShowPortLinks();
322 void onHidePortLinks();
323 void onEmphasisPortLinks();
325 void onShowOnlyCtrlLinks();
326 void onShowCtrlLinks();
327 void onHideCtrlLinks();
328 void onEmphasisCtrlLinks();
330 void onShowOnlyLink();
333 void onEmphasisLink();
334 void onDeEmphasizeAll();
336 void onSelectReference();
345 void displayLinks(bool isShown);
346 void displayControlLinks(bool isShown);
347 void displayPortLinks(bool isShown);
348 void displayALink(bool isShown);
349 void emphasizePortLink(YACS::HMI::SubjectDataPort* sub, bool emphasize);