1 // Copyright (C) 2006-2012 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 *_putGraphInOptimizerLoopAct;
154 QAction *_arrangeLocalNodesAct;
155 QAction *_arrangeRecurseNodesAct;
156 QAction *_computeLinkAct;
157 QAction *_zoomToBlocAct;
158 QAction *_centerOnNodeAct;
159 QAction *_shrinkExpand;
161 QAction *_toggleStraightLinksAct;
162 QAction *_toggleAutomaticComputeLinkAct;
163 QAction *_toggleSimplifyLinkAct;
164 QAction *_toggleForce2NodesLinkAct;
165 QAction *_toggleAddRowColsAct;
166 QAction *_toggleSceneItemVisibleAct;
167 QAction *_selectReferenceAct;
168 QAction *_whatsThisAct;
170 QAction *_showAllLinksAct;
171 QAction *_hideAllLinksAct;
173 QAction *_showOnlyPortLinksAct;
174 QAction *_showPortLinksAct;
175 QAction *_hidePortLinksAct;
176 QAction *_emphasisPortLinksAct;
178 QAction *_showOnlyCtrlLinksAct;
179 QAction *_showCtrlLinksAct;
180 QAction *_hideCtrlLinksAct;
181 QAction *_emphasisCtrlLinksAct;
183 QAction *_showOnlyLinkAct;
184 QAction *_showLinkAct;
185 QAction *_hideLinkAct;
186 QAction *_emphasisLinkAct;
187 QAction *_deEmphasizeAllAct;
191 QAction *_showUndoAct;
192 QAction *_showRedoAct;
194 YACS::HMI::GuiEditor *_guiEditor;
195 void setLoadedPresentation(YACS::ENGINE::Proc* proc);
198 void onCleanOnExit();
201 int getMenuId() { return _menuId++; }
202 QString getSaveFileName(const QString& fileName = QString());
204 YACSGuiLoader *_loader;
205 SuitWrapper* _wrapper;
206 QMainWindow* _parent;
207 QDockWidget* _dwTree;
208 QDockWidget* _dwStacked;
209 QDockWidget* _dwCatalogs;
210 BatchJobsListDialog* _BJLdialog;
211 YACS::ENGINE::Catalog* _builtinCatalog;
212 YACS::ENGINE::Catalog* _sessionCatalog;
213 CatalogWidget* _catalogsWidget;
214 std::map<QWidget*, YACS::HMI::QtGuiContext*> _mapViewContext;
219 std::list<std::string> _machineList;
224 void onImportSchema();
225 void onChooseBatchJob();
226 void onImportSupervSchema();
227 void onExportSchema();
228 void onExportSchemaAs();
229 void onImportCatalog();
231 void onRunLoadedSchema(bool withState = false);
232 void onLoadRunStateSchema();
233 void onLoadAndRunSchema();
235 void onStartResume();
239 void onSaveRunState();
242 void onWithoutStopMode(bool checked);
243 void onBreakpointsMode(bool checked);
244 void onStepByStepMode(bool checked);
246 void onToggleStopOnError(bool checked);
248 void onGetYacsContainerLog();
249 void onGetErrorReport();
250 void onGetErrorDetails();
251 void onGetContainerLog();
252 void onShutdownProc();
254 void onEditDataTypes();
255 void onCreateDataType();
256 void onImportDataType();
258 void onNewContainer();
259 void onSelectComponentInstance();
260 void onNewSalomeComponent();
261 void onNewSalomePythonComponent();
262 void onNewCorbaComponent();
264 void onSalomeServiceNode();
265 void onServiceInlineNode();
266 void onCORBAServiceNode();
267 void onNodeNodeServiceNode();
271 void onOutDataNode();
272 void onInStudyNode();
273 void onOutStudyNode();
274 void onInlineScriptNode();
275 void onInlineFunctionNode();
278 void onFOREACHNode();
281 void onOptimizerLoop();
282 void onNodeFromCatalog();
289 void onPutGraphInOptimizerLoop();
290 void onArrangeLocalNodes();
291 void onArrangeRecurseNodes();
292 void onRebuildLinks();
294 void onCenterOnNode();
295 void onShrinkExpand();
296 void onToggleStraightLinks(bool checked);
297 void onToggleAutomaticComputeLinks(bool checked);
298 void onToggleSimplifyLinks(bool checked);
299 void onToggleForce2NodesLinks(bool checked);
300 void onToggleAddRowCols(bool checked);
302 void onToggleSceneItemVisible(bool checked);
304 void onShowAllLinks();
305 void onHideAllLinks();
307 void onShowOnlyPortLinks();
308 void onShowPortLinks();
309 void onHidePortLinks();
310 void onEmphasisPortLinks();
312 void onShowOnlyCtrlLinks();
313 void onShowCtrlLinks();
314 void onHideCtrlLinks();
315 void onEmphasisCtrlLinks();
317 void onShowOnlyLink();
320 void onEmphasisLink();
321 void onDeEmphasizeAll();
323 void onSelectReference();
332 void displayLinks(bool isShown);
333 void displayControlLinks(bool isShown);
334 void displayPortLinks(bool isShown);
335 void displayALink(bool isShown);
336 void emphasizePortLink(YACS::HMI::SubjectDataPort* sub, bool emphasize);