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 virtual void loadSchema(const std::string& filename,bool edit=true, bool arrangeLocalNodes=false);
80 virtual void onHelpContextModule( const QString&, const QString&, const QString& = QString() );
81 void createContext(YACS::ENGINE::Proc* proc,
82 const QString& schemaName,
83 const QString& runName,
85 YACSGuiLoader *getLoader() { return _loader; };
87 QAction *_newSchemaAct;
88 QAction *_importSchemaAct;
89 QAction *_chooseBatchJobAct;
90 QAction *_importSupervSchemaAct;
91 QAction *_exportSchemaAct;
92 QAction *_exportSchemaAsAct;
93 QAction *_importCatalogAct;
95 QAction *_runLoadedSchemaAct;
96 QAction *_loadRunStateSchemaAct;
97 QAction *_loadAndRunSchemaAct;
99 QAction *_startResumeAct;
104 QAction *_saveRunStateAct;
105 QAction *_newEditionAct;
107 QActionGroup *_execModeGroup;
108 QAction *_withoutStopModeAct;
109 QAction *_breakpointsModeAct;
110 QAction *_stepByStepModeAct;
112 QAction *_toggleStopOnErrorAct;
114 QAction *_getYacsContainerLogAct;
115 QAction *_getErrorReportAct;
116 QAction *_getErrorDetailsAct;
117 QAction *_getContainerLogAct;
118 QAction *_shutdownProcAct;
120 QAction *_editDataTypesAct;
121 QAction *_createDataTypeAct;
122 QAction *_importDataTypeAct;
123 QAction *_newContainerAct;
124 QAction *_selectComponentInstanceAct;
125 QAction *_newSalomeComponentAct;
126 QAction *_newSalomePythonComponentAct;
127 QAction *_newCorbaComponentAct;
128 QAction *_salomeServiceNodeAct;
129 QAction *_serviceInlineNodeAct;
130 QAction *_CORBAServiceNodeAct;
131 QAction *_nodeNodeServiceNodeAct;
132 QAction *_cppNodeAct;
133 QAction *_XMLNodeAct;
134 QAction *_inDataNodeAct;
135 QAction *_outDataNodeAct;
136 QAction *_inStudyNodeAct;
137 QAction *_outStudyNodeAct;
138 QAction *_inlineScriptNodeAct;
139 QAction *_inlineFunctionNodeAct;
140 QAction *_blockNodeAct;
141 QAction *_FORNodeAct;
142 QAction *_FOREACHNodeAct;
143 QAction *_WHILENodeAct;
144 QAction *_SWITCHNodeAct;
145 QAction *_OptimizerLoopAct;
146 QAction *_nodeFromCatalogAct;
147 QAction *_deleteItemAct;
148 QAction *_cutItemAct;
149 QAction *_copyItemAct;
150 QAction *_pasteItemAct;
151 QAction *_putInBlocAct;
152 QAction *_arrangeLocalNodesAct;
153 QAction *_arrangeRecurseNodesAct;
154 QAction *_computeLinkAct;
155 QAction *_zoomToBlocAct;
156 QAction *_centerOnNodeAct;
157 QAction *_shrinkExpand;
159 QAction *_toggleStraightLinksAct;
160 QAction *_toggleAutomaticComputeLinkAct;
161 QAction *_toggleSimplifyLinkAct;
162 QAction *_toggleForce2NodesLinkAct;
163 QAction *_toggleAddRowColsAct;
164 QAction *_toggleSceneItemVisibleAct;
165 QAction *_selectReferenceAct;
166 QAction *_whatsThisAct;
168 QAction *_showAllLinksAct;
169 QAction *_hideAllLinksAct;
171 QAction *_showOnlyPortLinksAct;
172 QAction *_showPortLinksAct;
173 QAction *_hidePortLinksAct;
174 QAction *_emphasisPortLinksAct;
176 QAction *_showOnlyCtrlLinksAct;
177 QAction *_showCtrlLinksAct;
178 QAction *_hideCtrlLinksAct;
179 QAction *_emphasisCtrlLinksAct;
181 QAction *_showOnlyLinkAct;
182 QAction *_showLinkAct;
183 QAction *_hideLinkAct;
184 QAction *_emphasisLinkAct;
185 QAction *_deEmphasizeAllAct;
189 QAction *_showUndoAct;
190 QAction *_showRedoAct;
192 YACS::HMI::GuiEditor *_guiEditor;
193 void setLoadedPresentation(YACS::ENGINE::Proc* proc);
196 void onCleanOnExit();
199 int getMenuId() { return _menuId++; }
200 QString getSaveFileName(const QString& fileName = QString());
202 YACSGuiLoader *_loader;
203 SuitWrapper* _wrapper;
204 QMainWindow* _parent;
205 QDockWidget* _dwTree;
206 QDockWidget* _dwStacked;
207 QDockWidget* _dwCatalogs;
208 BatchJobsListDialog* _BJLdialog;
209 YACS::ENGINE::Catalog* _builtinCatalog;
210 YACS::ENGINE::Catalog* _sessionCatalog;
211 CatalogWidget* _catalogsWidget;
212 std::map<QWidget*, YACS::HMI::QtGuiContext*> _mapViewContext;
217 std::list<std::string> _machineList;
222 void onImportSchema();
223 void onChooseBatchJob();
224 void onImportSupervSchema();
225 void onExportSchema();
226 void onExportSchemaAs();
227 void onImportCatalog();
229 void onRunLoadedSchema(bool withState = false);
230 void onLoadRunStateSchema();
231 void onLoadAndRunSchema();
233 void onStartResume();
237 void onSaveRunState();
240 void onWithoutStopMode(bool checked);
241 void onBreakpointsMode(bool checked);
242 void onStepByStepMode(bool checked);
244 void onToggleStopOnError(bool checked);
246 void onGetYacsContainerLog();
247 void onGetErrorReport();
248 void onGetErrorDetails();
249 void onGetContainerLog();
250 void onShutdownProc();
252 void onEditDataTypes();
253 void onCreateDataType();
254 void onImportDataType();
256 void onNewContainer();
257 void onSelectComponentInstance();
258 void onNewSalomeComponent();
259 void onNewSalomePythonComponent();
260 void onNewCorbaComponent();
262 void onSalomeServiceNode();
263 void onServiceInlineNode();
264 void onCORBAServiceNode();
265 void onNodeNodeServiceNode();
269 void onOutDataNode();
270 void onInStudyNode();
271 void onOutStudyNode();
272 void onInlineScriptNode();
273 void onInlineFunctionNode();
276 void onFOREACHNode();
279 void onOptimizerLoop();
280 void onNodeFromCatalog();
288 void onArrangeLocalNodes();
289 void onArrangeRecurseNodes();
290 void onRebuildLinks();
292 void onCenterOnNode();
293 void onShrinkExpand();
294 void onToggleStraightLinks(bool checked);
295 void onToggleAutomaticComputeLinks(bool checked);
296 void onToggleSimplifyLinks(bool checked);
297 void onToggleForce2NodesLinks(bool checked);
298 void onToggleAddRowCols(bool checked);
300 void onToggleSceneItemVisible(bool checked);
302 void onShowAllLinks();
303 void onHideAllLinks();
305 void onShowOnlyPortLinks();
306 void onShowPortLinks();
307 void onHidePortLinks();
308 void onEmphasisPortLinks();
310 void onShowOnlyCtrlLinks();
311 void onShowCtrlLinks();
312 void onHideCtrlLinks();
313 void onEmphasisCtrlLinks();
315 void onShowOnlyLink();
318 void onEmphasisLink();
319 void onDeEmphasizeAll();
321 void onSelectReference();
330 void displayLinks(bool isShown);
331 void displayControlLinks(bool isShown);
332 void displayPortLinks(bool isShown);
333 void displayALink(bool isShown);
334 void emphasizePortLink(YACS::HMI::SubjectDataPort* sub, bool emphasize);