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
21 #include "SALOME_ResourcesManager.hxx"
22 #include "SALOME_LifeCycleCORBA.hxx"
24 #include "RuntimeSALOME.hxx"
26 #include "InputPort.hxx"
27 #include "ServiceNode.hxx"
28 #include "parsers.hxx"
30 #include "YACSGuiLoader.hxx"
31 #include "ComponentInstance.hxx"
33 #include "SALOME_NamingService.hxx"
34 #include "SALOME_ModuleCatalog.hxx"
35 #include "SALOME_ModuleCatalog.hh"
36 #include "SALOMEDS_Tool.hxx"
38 #include "QtGuiContext.hxx"
40 #include "GuiEditor.hxx"
41 #include "GraphicsView.hxx"
43 #include "GenericGui.hxx"
44 #include "SceneItem.hxx"
45 #include "SceneNodeItem.hxx"
46 #include "SceneComposedNodeItem.hxx"
47 #include "ItemEdition.hxx"
48 #include "CatalogWidget.hxx"
49 #include "TreeView.hxx"
50 #include "VisitorSaveGuiSchema.hxx"
51 #include "TypeCode.hxx"
52 #include "LinkInfo.hxx"
53 #include "LogViewer.hxx"
55 #include "Resource.hxx"
56 #include "Message.hxx"
57 #include "ListJobs_GUI.hxx"
59 #include <QFileDialog>
63 #include <QMessageBox>
71 #define WEXITSTATUS(w) ((int) ((w) & 0x40000000))
75 #include "YacsTrace.hxx"
78 using namespace YACS::HMI;
80 GenericGui::GenericGui(YACS::HMI::SuitWrapper* wrapper, QMainWindow *parent)
91 _mapViewContext.clear();
95 QtGuiContext::_counters = new counters(100);
96 srand((unsigned)time(0));
98 GuiObserver::setEventMap();
100 string iconPath = getenv("YACS_ROOT_DIR");
101 iconPath += "/share/salome/resources/yacs";
103 QDir::addSearchPath("icons", iconPath.c_str());
105 _guiEditor = new GuiEditor();
107 YACS::ENGINE::RuntimeSALOME::setRuntime();
108 _loader = new YACSGuiLoader();
109 _loader->registerProcCataLoader();
110 _builtinCatalog = YACS::ENGINE::getSALOMERuntime()->getBuiltinCatalog();
114 YACS::ENGINE::RuntimeSALOME* runTime = YACS::ENGINE::getSALOMERuntime();
115 CORBA::ORB_ptr orb = runTime->getOrb();
118 SALOME_NamingService namingService(orb);
119 CORBA::Object_ptr obj = namingService.Resolve("/Kernel/ModulCatalog");
120 SALOME_ModuleCatalog::ModuleCatalog_var aModuleCatalog =
121 SALOME_ModuleCatalog::ModuleCatalog::_narrow(obj);
122 if (! CORBA::is_nil(aModuleCatalog))
124 DEBTRACE("SALOME_ModuleCatalog::ModuleCatalog found");
125 std::string anIOR = orb->object_to_string( aModuleCatalog );
126 _sessionCatalog = runTime->loadCatalog( "session", anIOR );
127 runTime->addCatalog(_sessionCatalog);
129 std::map< std::string, YACS::ENGINE::ComponentDefinition * >::iterator it;
130 for (it = _sessionCatalog->_componentMap.begin();
131 it != _sessionCatalog->_componentMap.end(); ++it)
132 DEBTRACE("Component: " <<(*it).first);
135 std::map< std::string, YACS::ENGINE::TypeCode*>::iterator it;
136 for (it = _sessionCatalog->_typeMap.begin();
137 it != _sessionCatalog->_typeMap.end(); ++it)
138 DEBTRACE("Type : " <<(*it).first
139 << " " << (*it).second->getKindRepr()
140 << " " << (*it).second->name()
141 << " " << (*it).second->shortName()
142 << " " << (*it).second->id() );
144 DEBTRACE("_sessionCatalog " << _sessionCatalog);
148 catch(ServiceUnreachable& e)
150 DEBTRACE("Caught Exception. "<<e);
153 _dwTree = new QDockWidget(_parent);
154 _dwTree->setVisible(false);
155 _dwTree->setWindowTitle("Tree View: edition mode");
156 _parent->addDockWidget(Qt::LeftDockWidgetArea, _dwTree);
157 _dwStacked = new QDockWidget(_parent);
158 _dwStacked->setVisible(false);
159 _dwStacked->setWindowTitle("Input Panel");
160 _dwStacked->setMinimumWidth(270); // --- force a minimum until display
161 _parent->addDockWidget(Qt::RightDockWidgetArea, _dwStacked);
162 _dwCatalogs = new QDockWidget(_parent);
163 _dwCatalogs->setVisible(false);
164 _dwCatalogs->setWindowTitle("Catalogs");
165 _parent->addDockWidget(Qt::RightDockWidgetArea, _dwCatalogs);
166 _catalogsWidget = new CatalogWidget(_dwCatalogs,
169 _dwCatalogs->setWidget(_catalogsWidget);
171 _parent->tabifyDockWidget(_dwStacked, _dwCatalogs);
172 _parent->tabifyDockWidget(_dwTree, _wrapper->objectBrowser());
173 #if QT_VERSION >= 0x040500
174 _parent->setTabPosition(Qt::AllDockWidgetAreas, Resource::tabPanelsUp? QTabWidget::North: QTabWidget::South);
176 //Import user catalog
177 std::string usercata=Resource::userCatalog.toStdString();
178 _catalogsWidget->addCatalogFromFile(usercata);
181 GenericGui::~GenericGui()
183 if(_BJLdialog) delete _BJLdialog;
186 void GenericGui::createActions()
188 // QAction* createAction(const int id,
189 // const QString& toolTip,
190 // const QIcon& icon,
191 // const QString& menu,
192 // const QString& status,
193 // const int shortCut,
194 // QObject* parent =0,
195 // bool checkable = false,
196 // QObject* receiver =0,
197 // const char* member =0);
199 _newSchemaAct = _wrapper->createAction(getMenuId(), tr("Create a new YACS Schema"), QIcon("icons:schema.png"),
200 tr("New Schema"), tr("Create a new YACS Schema"),
201 0, _parent, false, this, SLOT(onNewSchema()));
202 _newSchemaAct->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_N); // --- QKeySequence::New ambiguous in SALOME
204 _importSchemaAct = _wrapper->createAction(getMenuId(), tr("Import a YACS Schema for edition"), QIcon("icons:import_dataflow.png"),
205 tr("Import Schema"), tr("Import a YACS Schema for edition"),
206 0, _parent, false, this, SLOT(onImportSchema()));
207 _importSchemaAct->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_O); // --- QKeySequence::Open ambiguous in SALOME
209 _importSupervSchemaAct = _wrapper->createAction(getMenuId(), tr("Import a SUPERV Schema for edition"), QIcon("icons:import_superv_dataflow.png"),
210 tr("Import SUPERV Schema"), tr("Import a SUPERV Schema for edition"),
211 0, _parent, false, this, SLOT(onImportSupervSchema()));
213 _exportSchemaAct = _wrapper->createAction(getMenuId(), tr("Save the current YACS Schema"), QIcon("icons:save_dataflow.png"),
214 tr("Save Schema"), tr("Save the current YACS Schema"),
215 0, _parent, false, this, SLOT(onExportSchema()));
216 _exportSchemaAct->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_S); // --- QKeySequence::Save ambiguous in SALOME
218 _exportSchemaAsAct = _wrapper->createAction(getMenuId(), tr("Save the current YACS Schema As..."), QIcon("icons:export_dataflow.png"),
219 tr("Save Schema As"), tr("Save the current YACS Schema As..."),
220 0, _parent, false, this, SLOT(onExportSchemaAs()));
221 //_exportSchemaAsAct->setShortcut(QKeySequence::SaveAs); // --- ambiguous in SALOME
223 _importCatalogAct = _wrapper->createAction(getMenuId(), tr("Import a Schema as a Catalog"), QIcon("icons:insert_file.png"),
224 tr("Import Catalog"), tr("Import a Schema as a Catalog"),
225 0, _parent, false, this, SLOT(onImportCatalog()));
228 _runLoadedSchemaAct = _wrapper->createAction(getMenuId(), tr("Prepare the current edited schema for run"), QIcon("icons:run_active.png"),
229 tr("Run Current Schema"), tr("Prepare the current edited schema for run"),
230 0, _parent, false, this, SLOT(onRunLoadedSchema()));
232 _loadRunStateSchemaAct = _wrapper->createAction(getMenuId(), tr("Load a previous run state for this schema, prepare to run"), QIcon("icons:load_execution_state.png"),
233 tr("Load Run State"), tr("Load a previous run state for this schema, prepare to run"),
234 0, _parent, false, this, SLOT(onLoadRunStateSchema()));
236 _loadAndRunSchemaAct = _wrapper->createAction(getMenuId(), tr("Load a schema for run"), QIcon("icons:run.png"),
237 tr("Load Schema to run"), tr("Load a schema for run"),
238 0, _parent, false, this, SLOT(onLoadAndRunSchema()));
240 _chooseBatchJobAct = _wrapper->createAction(getMenuId(), tr("Choose Batch Job for watch"), QIcon("icons:batch.png"),
241 tr("Choose Batch Job for watch"), tr("Choose Batch Job for watch"),
242 0, _parent, false, this, SLOT(onChooseBatchJob()));
244 _startResumeAct = _wrapper->createAction(getMenuId(), tr("Start or Resume Schema execution"), QIcon("icons:suspend_resume.png"),
245 tr("Start/Resume execution"), tr("Start or Resume Schema execution"),
246 0, _parent, false, this, SLOT(onStartResume()));
248 _abortAct = _wrapper->createAction(getMenuId(), tr("Abort the current execution"), QIcon("icons:kill.png"),
249 tr("Abort execution"), tr("Abort the current execution"),
250 0, _parent, false, this, SLOT(onAbort()));
252 _pauseAct = _wrapper->createAction(getMenuId(), tr("Suspend the current execution"), QIcon("icons:pause.png"),
253 tr("Suspend execution"), tr("Suspend the current execution"),
254 0, _parent, false, this, SLOT(onPause()));
256 _resetAct = _wrapper->createAction(getMenuId(), tr("Reset error nodes and restart the current execution"), QIcon("icons:reset.png"),
257 tr("Restart execution"), tr("Restart the current execution with reset of error nodes"),
258 0, _parent, false, this, SLOT(onReset()));
261 _saveRunStateAct = _wrapper->createAction(getMenuId(), tr("Save the current run state"), QIcon("icons:save_dataflow_state.png"),
262 tr("Save State"), tr("Save the current run state"),
263 0, _parent, false, this, SLOT(onSaveRunState()));
265 _newEditionAct = _wrapper->createAction(getMenuId(), tr("Edit again the current schema in a new context"), QIcon("icons:new_edition.png"),
266 tr("Edit Again"), tr("Edit again the current schema in a new context"),
267 0, _parent, false, this, SLOT(onNewEdition()));
270 _getYacsContainerLogAct = _wrapper->createAction(getMenuId(), tr("get YACS container log"), QIcon("icons:change_informations.png"),
271 tr("YACS Container Log"), tr("get YACS container log"),
272 0, _parent, false, this, SLOT(onGetYacsContainerLog()));
274 _getErrorReportAct = _wrapper->createAction(getMenuId(), tr("get Node Error Report"), QIcon("icons:filter_notification.png"),
275 tr("Node Error Report"), tr("get Node Error Report"),
276 0, _parent, false, this, SLOT(onGetErrorReport()));
278 _getErrorDetailsAct = _wrapper->createAction(getMenuId(), tr("get Node Error Details"), QIcon("icons:icon_text.png"),
279 tr("Node Error Details"), tr("get Node Error Details"),
280 0, _parent, false, this, SLOT(onGetErrorDetails()));
282 _getContainerLogAct = _wrapper->createAction(getMenuId(), tr("get Node Container Log"), QIcon("icons:change_informations.png"),
283 tr("Node Container Log"), tr("get Node Container Log"),
284 0, _parent, false, this, SLOT(onGetContainerLog()));
286 _shutdownProcAct = _wrapper->createAction(getMenuId(), tr("Shutdown Proc"), QIcon("icons:kill.png"),
287 tr("Shutdown Proc"), tr("Shutdown Proc"),
288 0, _parent, false, this, SLOT(onShutdownProc()));
291 _editDataTypesAct = _wrapper->createAction(getMenuId(), tr("Edit Data Types"), QIcon("icons:kill.png"),
292 tr("Edit Data Types"), tr("Edit Data Types"),
293 0, _parent, false, this, SLOT(onEditDataTypes()));
295 _createDataTypeAct = _wrapper->createAction(getMenuId(), tr("Create Data Types"), QIcon("icons:kill.png"),
296 tr("Create Data Types"), tr("Create Data Types"),
297 0, _parent, false, this, SLOT(onCreateDataType()));
299 _importDataTypeAct = _wrapper->createAction(getMenuId(), tr("Import Data Types, use drag and drop from catalog"), QIcon("icons:folder_cyan.png"),
300 tr("Import Data Types"), tr("Import Data Types, use drag and drop from catalog"),
301 0, _parent, false, this, SLOT(onImportDataType()));
303 _newContainerAct = _wrapper->createAction(getMenuId(), tr("Create a New Container"), QIcon("icons:container.png"),
304 tr("Create Container"), tr("Create a New Container"),
305 0, _parent, false, this, SLOT(onNewContainer()));
307 _selectComponentInstanceAct = _wrapper->createAction(getMenuId(), tr("Select a Component Instance"), QIcon("icons:icon_select.png"),
308 tr("Select a Component Instance"), tr("Select a Component Instance"),
309 0, _parent, false, this, SLOT(onSelectComponentInstance()));
311 _newSalomeComponentAct = _wrapper->createAction(getMenuId(), tr("Create a New SALOME Component Instance"), QIcon("icons:new_salome_component.png"),
312 tr("Create Component Instance"), tr("Create a New SALOME Component Instance"),
313 0, _parent, false, this, SLOT(onNewSalomeComponent()));
315 _newSalomePythonComponentAct = _wrapper->createAction(getMenuId(), tr("Create a New SALOME Python Component"), QIcon("icons:new_salomepy_component.png"),
316 tr("SALOME Python Component"), tr("Create a New SALOME Python Component"),
317 0, _parent, false, this, SLOT(onNewSalomePythonComponent()));
319 _newCorbaComponentAct = _wrapper->createAction(getMenuId(), tr("Create a New CORBA Component"), QIcon("icons:new_corba_component.png"),
320 tr("CORBA Component"), tr("Create a New CORBA Component"),
321 0, _parent, false, this, SLOT(onNewCorbaComponent()));
323 _salomeServiceNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New SALOME Service Node"), QIcon("icons:new_salome_service_node.png"),
324 tr("SALOME Service Node"), tr("Create a New SALOME Service Node"),
325 0, _parent, false, this, SLOT(onSalomeServiceNode()));
327 _serviceInlineNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Inline Service Node"), QIcon("icons:new_service_inline_node.png"),
328 tr("Inline Service Node"), tr("Create a New Inline Service Node"),
329 0, _parent, false, this, SLOT(onServiceInlineNode()));
331 _CORBAServiceNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New CORBA Service Node"), QIcon("icons:new_corba_service_node.png"),
332 tr("CORBA Node"), tr("Create a New CORBA Service Node"),
333 0, _parent, false, this, SLOT(onCORBAServiceNode()));
335 _nodeNodeServiceNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Node referencing a Node"), QIcon("icons:new_nodenode_service_node.png"),
336 tr("Ref on Node"), tr("Create a New Node referencing a Node"),
337 0, _parent, false, this, SLOT(onNodeNodeServiceNode()));
339 _cppNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New C++ Node"), QIcon("icons:new_cpp_node.png"),
340 tr("Cpp Node"), tr("Create a New C++ Node"),
341 0, _parent, false, this, SLOT(onCppNode()));
343 _inDataNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Input data Node"), QIcon("icons:node.png"),
344 tr("Input Data Node"), tr("Create a New Input data Node"),
345 0, _parent, false, this, SLOT(onInDataNode()));
347 _outDataNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Output data Node"), QIcon("icons:node.png"),
348 tr("Output Data Node"), tr("Create a New Output data Node"),
349 0, _parent, false, this, SLOT(onOutDataNode()));
351 _inStudyNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Input Study Node"), QIcon("icons:node.png"),
352 tr("Input Study Node"), tr("Create a New Input Study Node"),
353 0, _parent, false, this, SLOT(onInStudyNode()));
355 _outStudyNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Output Study Node"), QIcon("icons:node.png"),
356 tr("Output Study Node"), tr("Create a New Output Study Node"),
357 0, _parent, false, this, SLOT(onOutStudyNode()));
359 _inlineScriptNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Inline Python Script Node"), QIcon("icons:new_inline_script_node.png"),
360 tr("Inline Script Node"), tr("Create a New Inline Python Script Node"),
361 0, _parent, false, this, SLOT(onInlineScriptNode()));
363 _inlineFunctionNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Inline Python Function Node"), QIcon("icons:new_inline_function_node.png"),
364 tr("Inline Function Node"), tr("Create a New Inline Python Function Node"),
365 0, _parent, false, this, SLOT(onInlineFunctionNode()));
367 _blockNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Bloc Node"), QIcon("icons:new_block_node.png"),
368 tr("bloc Node"), tr("Create a New Bloc Node"),
369 0, _parent, false, this, SLOT(onBlockNode()));
371 _FORNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New For Loop Node"), QIcon("icons:new_for_loop_node.png"),
372 tr("For Loop Node"), tr("Create a New For Loop Node"),
373 0, _parent, false, this, SLOT(onFORNode()));
375 _FOREACHNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New For Each Loop Node"), QIcon("icons:new_foreach_loop_node.png"),
376 tr("For Each Loop Node"), tr("Create a New For Each Loop Node"),
377 0, _parent, false, this, SLOT(onFOREACHNode()));
379 _WHILENodeAct = _wrapper->createAction(getMenuId(), tr("Create a New While Loop Node"), QIcon("icons:new_while_loop_node.png"),
380 tr("While Loop Node"), tr("Create a New While Loop Node"),
381 0, _parent, false, this, SLOT(onWHILENode()));
383 _SWITCHNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Switch Node"), QIcon("icons:new_switch_loop_node.png"),
384 tr("Switch Node"), tr("Create a New Switch Node"),
385 0, _parent, false, this, SLOT(onSWITCHNode()));
387 _OptimizerLoopAct = _wrapper->createAction(getMenuId(), tr("Create a New Optimizer Loop Node"), QIcon("icons:new_for_loop_node.png"),
388 tr("Optimizer Loop"), tr("Create a New Optimizer Loop"),
389 0, _parent, false, this, SLOT(onOptimizerLoop()));
391 _nodeFromCatalogAct = _wrapper->createAction(getMenuId(), tr("Create a New Node from Catalog, use drag and drop from catalog"), QIcon("icons:new_from_library_node.png"),
392 tr("Node from Catalog"), tr("Create a New Node from Catalog, use drag and drop from catalog"),
393 0, _parent, false, this, SLOT(onNodeFromCatalog()));
395 _deleteItemAct = _wrapper->createAction(getMenuId(), tr("Delete a Schema Item"), QIcon("icons:delete.png"),
396 tr("Delete Item"), tr("Delete a Schema Item"),
397 0, _parent, false, this, SLOT(onDeleteItem()));
398 _deleteItemAct->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_D); // --- QKeySequence::Delete dangerous...
400 _cutItemAct = _wrapper->createAction(getMenuId(), tr("Cut a Schema Item"), QIcon("icons:cut.png"),
401 tr("Cut Item"), tr("Cut a Schema Item"),
402 0, _parent, false, this, SLOT(onCutItem()));
403 _cutItemAct->setShortcut(QKeySequence::Cut);
405 _copyItemAct = _wrapper->createAction(getMenuId(), tr("Copy a Schema Item"), QIcon("icons:copy.png"),
406 tr("Copy Item"), tr("Copy a Schema Item"),
407 0, _parent, false, this, SLOT(onCopyItem()));
408 _copyItemAct->setShortcut(QKeySequence::Copy);
410 _pasteItemAct = _wrapper->createAction(getMenuId(), tr("Paste a Schema Item"), QIcon("icons:paste.png"),
411 tr("Paste Item"), tr("Paste a Schema Item"),
412 0, _parent, false, this, SLOT(onPasteItem()));
413 _pasteItemAct->setShortcut(QKeySequence::Paste);
415 _putInBlocAct = _wrapper->createAction(getMenuId(), tr("Put node in block"), QIcon("icons:paste.png"),
416 tr("Put node in block"), tr("Put node in block"),
417 0, _parent, false, this, SLOT(onPutInBloc()));
419 _putGraphInOptimizerLoopAct = _wrapper->createAction(getMenuId(), tr("Optimizer Loop"), QIcon("icons:paste.png"),
420 tr("Optimizer Loop"), tr("Optimizer Loop"),
421 0, _parent, false, this, SLOT(onPutGraphInOptimizerLoop()));
423 _arrangeLocalNodesAct = _wrapper->createAction(getMenuId(), tr("arrange nodes on that bloc level, without recursion"), QIcon("icons:arrange_nodes.png"),
424 tr("arrange local nodes"), tr("arrange nodes on that bloc level, without recursion"),
425 0, _parent, false, this, SLOT(onArrangeLocalNodes()));
427 _arrangeRecurseNodesAct = _wrapper->createAction(getMenuId(), tr("arrange nodes on that bloc level, with recursion"), QIcon("icons:sample.png"),
428 tr("arrange nodes recursion"), tr("arrange nodes on that bloc level, with recursion"),
429 0, _parent, false, this, SLOT(onArrangeRecurseNodes()));
431 _computeLinkAct = _wrapper->createAction(getMenuId(), tr("compute orthogonal links"), QIcon("icons:rebuild_links.png"),
432 tr("compute links"), tr("compute orthogonal links"),
433 0, _parent, false, this, SLOT(onRebuildLinks()));
435 _zoomToBlocAct = _wrapper->createAction(getMenuId(), tr("zoom 2D view to selected bloc"), QIcon("icons:zoomToBloc.png"),
436 tr("zoom to bloc"), tr("zoom 2D view to the selected composed node"),
437 0, _parent, false, this, SLOT(onZoomToBloc()));
439 _centerOnNodeAct = _wrapper->createAction(getMenuId(), tr("center 2D view on selected node"), QIcon("icons:centerOnNode.png"),
440 tr("center on node"), tr("center 2D view on selected node"),
441 0, _parent, false, this, SLOT(onCenterOnNode()));
442 _centerOnNodeAct->setShortcut(QKeySequence::Find);
444 _shrinkExpand = _wrapper->createAction(getMenuId(), tr("shrink or expand the selected node"), QIcon("icons:shrinkExpand.png"),
445 tr("shrink/expand"), tr("shrink or expand the selected node"),
446 0, _parent, false, this, SLOT(onShrinkExpand()));
448 _toggleStraightLinksAct = _wrapper->createAction(getMenuId(), tr("draw straight or orthogonal links"), QIcon("icons:straightLink.png"),
449 tr("straight/orthogonal"), tr("draw straight or orthogonal links"),
450 0, _parent, true, this, SLOT(onToggleStraightLinks(bool)));
452 _toggleStraightLinksAct->setChecked(Resource::straightLinks);
453 onToggleStraightLinks(Resource::straightLinks);
455 _toggleAutomaticComputeLinkAct = _wrapper->createAction(getMenuId(), tr("compute othogonal links automatically when nodes move"), QIcon("icons:autoComputeLink.png"),
456 tr("automatic link"), tr("compute othogonal links automatically when nodes move"),
457 0, _parent, true, this, SLOT(onToggleAutomaticComputeLinks(bool)));
459 _toggleAutomaticComputeLinkAct->setChecked(Resource::autoComputeLinks);
460 onToggleAutomaticComputeLinks(Resource::autoComputeLinks); // Why is this needed ?
462 _toggleSimplifyLinkAct = _wrapper->createAction(getMenuId(), tr("simplify links by removing unnecessary direction changes"), QIcon("icons:simplifyLink.png"),
463 tr("simplify links"), tr("simplify links by removing unnecessary direction changes"),
464 0, _parent, true, this, SLOT(onToggleSimplifyLinks(bool)));
465 _toggleSimplifyLinkAct->setChecked(Resource::simplifyLink);
466 onToggleSimplifyLinks(Resource::simplifyLink);
468 _toggleForce2NodesLinkAct = _wrapper->createAction(getMenuId(), tr("force orthogonal links by adding an edge on simples links"), QIcon("icons:force2nodeLink.png"),
469 tr("force ortho links"), tr("force orthogonal links by adding an edge on simples links"),
470 0, _parent, true, this, SLOT(onToggleForce2NodesLinks(bool)));
471 _toggleForce2NodesLinkAct->setChecked(true);
473 _toggleAddRowColsAct = _wrapper->createAction(getMenuId(), tr("allow more path for the links, for a better separation"), QIcon("icons:addRowCols.png"),
474 tr("separate links"), tr("allow more path for the links, for a better separation"),
475 0, _parent, true, this, SLOT(onToggleAddRowCols(bool)));
476 _toggleAddRowColsAct->setChecked(Resource::addRowCols);
477 onToggleAddRowCols(Resource::addRowCols);
479 _selectReferenceAct = _wrapper->createAction(getMenuId(), tr("select reference"), QIcon("icons:ob_service_node.png"),
480 tr("select reference"), tr("select reference"),
481 0, _parent, false, this, SLOT(onSelectReference()));
483 _whatsThisAct = _wrapper->createAction(getMenuId(), tr("active whatsThis Mode to get help on widgets"), QIcon("icons:whatsThis.png"),
484 tr("whatsThis Mode"), tr("active whatsThis Mode to get help on widgets"),
485 0, _parent, false, this, SLOT(onWhatsThis()));
486 _whatsThisAct->setShortcut(QKeySequence::WhatsThis);
488 _withoutStopModeAct = _wrapper->createAction(getMenuId(), tr("set execution mode without stop"), QIcon("icons:run_active.png"),
489 tr("mode without stop"), tr("set execution mode without stop"),
490 0, _parent, true, this, SLOT(onWithoutStopMode(bool)));
492 _breakpointsModeAct = _wrapper->createAction(getMenuId(), tr("set execution mode with stop on breakpoints"), QIcon("icons:breakpoints_active.png"),
493 tr("mode breakpoints"), tr("set execution mode with stop on breakpoints"),
494 0, _parent, true, this, SLOT(onBreakpointsMode(bool)));
496 _stepByStepModeAct = _wrapper->createAction(getMenuId(), tr("set execution mode step by step"), QIcon("icons:step_by_step_active.png"),
497 tr("mode step by step"), tr("set execution mode step by step"),
498 0, _parent, true, this, SLOT(onStepByStepMode(bool)));
500 _toggleStopOnErrorAct = _wrapper->createAction(getMenuId(), tr("Force stop on first error during execution"), QIcon("icons:toggle_stop_on_error.png"),
501 tr("stop on error"), tr("Force stop on first error during execution"),
502 0, _parent, true, this, SLOT(onToggleStopOnError(bool)));
504 _toggleSceneItemVisibleAct = _wrapper->createAction(getMenuId(), tr("toggle 2D scene item visibility"), QIcon("icons:toggleVisibility.png"),
505 tr("visible/hidden"), tr("toggle 2D scene item visibility"),
506 0, _parent, true, this, SLOT(onToggleSceneItemVisible(bool)));
510 _showAllLinksAct = _wrapper->createAction(getMenuId(), tr("Show all the links"), QIcon("icons:showLink.png"),
511 tr("show all links"), tr("Show all the links"),
512 0, _parent, false, this, SLOT(onShowAllLinks()));
514 _hideAllLinksAct = _wrapper->createAction(getMenuId(), tr("Hide all the links"), QIcon("icons:hideLink.png"),
515 tr("hide all links"), tr("Hide all the links"),
516 0, _parent, false, this, SLOT(onHideAllLinks()));
519 _showOnlyPortLinksAct = _wrapper->createAction(getMenuId(), tr("Show only links from/to this port"), QIcon("icons:showLink.png"),
520 tr("show only links"), tr("Show only links from/to this port"),
521 0, _parent, false, this, SLOT(onShowOnlyPortLinks()));
523 _showPortLinksAct = _wrapper->createAction(getMenuId(), tr("Show links from/to this port"), QIcon("icons:showLink.png"),
524 tr("show links"), tr("Show links from/to this port"),
525 0, _parent, false, this, SLOT(onShowPortLinks()));
527 _hidePortLinksAct = _wrapper->createAction(getMenuId(), tr("Hide links from/to this port"), QIcon("icons:hideLink.png"),
528 tr("hide links"), tr("Hide links from/to this port"),
529 0, _parent, false, this, SLOT(onHidePortLinks()));
532 _showOnlyCtrlLinksAct = _wrapper->createAction(getMenuId(), tr("Show only control links from/to this node"), QIcon("icons:showLink.png"),
533 tr("show only Control links"), tr("Show only control links from/to this node"),
534 0, _parent, false, this, SLOT(onShowOnlyCtrlLinks()));
536 _showCtrlLinksAct = _wrapper->createAction(getMenuId(), tr("Show control links from/to this node"), QIcon("icons:showLink.png"),
537 tr("show control links"), tr("Show control links from/to this node"),
538 0, _parent, false, this, SLOT(onShowCtrlLinks()));
540 _hideCtrlLinksAct = _wrapper->createAction(getMenuId(), tr("Hide control links from/to this node"), QIcon("icons:hideLink.png"),
541 tr("hide control links"), tr("Hide control links from/to this node"),
542 0, _parent, false, this, SLOT(onHideCtrlLinks()));
545 _showOnlyLinkAct = _wrapper->createAction(getMenuId(), tr("Show only this link"), QIcon("icons:showLink.png"),
546 tr("show only"), tr("Show only this link"),
547 0, _parent, false, this, SLOT(onShowOnlyLink()));
549 _showLinkAct = _wrapper->createAction(getMenuId(), tr("Show this link"), QIcon("icons:showLink.png"),
550 tr("show"), tr("Show this link"),
551 0, _parent, false, this, SLOT(onShowLink()));
553 _hideLinkAct = _wrapper->createAction(getMenuId(), tr("Hide this link"), QIcon("icons:hideLink.png"),
554 tr("hide"), tr("Hide this link"),
555 0, _parent, false, this, SLOT(onHideLink()));
558 _emphasisPortLinksAct = _wrapper->createAction(getMenuId(), tr("emphasis on links from/to this port"), QIcon("icons:emphasisLink.png"),
559 tr("emphasize links"), tr("emphasis on links from/to this port"),
560 0, _parent, false, this, SLOT(onEmphasisPortLinks()));
562 _emphasisCtrlLinksAct = _wrapper->createAction(getMenuId(), tr("emphasis on control links from/to this node"), QIcon("icons:emphasisLink.png"),
563 tr("emphasize control links"), tr("emphasis on control links from/to this node"),
564 0, _parent, false, this, SLOT(onEmphasisCtrlLinks()));
566 _emphasisLinkAct = _wrapper->createAction(getMenuId(), tr("emphasis on this link"), QIcon("icons:emphasisLink.png"),
567 tr("emphasize"), tr("emphasis on this link"),
568 0, _parent, false, this, SLOT(onEmphasisLink()));
570 _deEmphasizeAllAct = _wrapper->createAction(getMenuId(), tr("remove all emphasis"), QIcon("icons:deEmphasisLink.png"),
571 tr("remove all emphasis"), tr("remove all emphasis"),
572 0, _parent, false, this, SLOT(onDeEmphasizeAll()));
575 _undoAct = _wrapper->createAction(getMenuId(), tr("undo last action"), QIcon("icons:undo.png"),
576 tr("undo"), tr("undo last action"),
577 0, _parent, false, this, SLOT(onUndo()));
578 _undoAct->setShortcut(QKeySequence::Undo);
580 _redoAct = _wrapper->createAction(getMenuId(), tr("redo last action"), QIcon("icons:redo.png"),
581 tr("redo"), tr("redo last action"),
582 0, _parent, false, this, SLOT(onRedo()));
583 _redoAct->setShortcut(QKeySequence::Redo);
585 _showUndoAct = _wrapper->createAction(getMenuId(), tr("show undo commands"), QIcon("icons:undo.png"),
586 tr("show undo"), tr("show undo commands"),
587 0, _parent, false, this, SLOT(onShowUndo()));
589 _showRedoAct = _wrapper->createAction(getMenuId(), tr("show redo commands"), QIcon("icons:redo.png"),
590 tr("show redo"), tr("show redo commands"),
591 0, _parent, false, this, SLOT(onShowRedo()));
594 _execModeGroup = new QActionGroup(this);
595 _execModeGroup->addAction(_withoutStopModeAct);
596 _execModeGroup->addAction(_breakpointsModeAct);
597 _execModeGroup->addAction(_stepByStepModeAct);
598 _withoutStopModeAct->setChecked(true);
601 void GenericGui::createMenus()
604 aMenuId = _wrapper->createMenu( tr( "File" ), -1, -1 );
605 _wrapper->createMenu( _wrapper->separator(), aMenuId, -1, 10 );
606 aMenuId = _wrapper->createMenu( "YACS", aMenuId, -1, 10 );
607 _wrapper->createMenu( _newSchemaAct, aMenuId );
608 _wrapper->createMenu( _importSchemaAct, aMenuId );
610 aMenuId = _wrapper->createMenu( "YACS", -1, -1, 30 );
611 _wrapper->createMenu( _newSchemaAct, aMenuId );//, 10
612 _wrapper->createMenu( _importSchemaAct, aMenuId );
613 _wrapper->createMenu( _importSupervSchemaAct, aMenuId );
614 _wrapper->createMenu( _wrapper->separator(), aMenuId);
615 _wrapper->createMenu( _exportSchemaAct, aMenuId );
616 _wrapper->createMenu( _exportSchemaAsAct, aMenuId );
617 _wrapper->createMenu( _wrapper->separator(), aMenuId);
618 _wrapper->createMenu( _runLoadedSchemaAct, aMenuId );
619 _wrapper->createMenu( _loadRunStateSchemaAct, aMenuId );
620 _wrapper->createMenu( _loadAndRunSchemaAct, aMenuId );
621 _wrapper->createMenu( _chooseBatchJobAct, aMenuId );
622 _wrapper->createMenu( _wrapper->separator(), aMenuId);
623 _wrapper->createMenu( _undoAct, aMenuId );
624 _wrapper->createMenu( _redoAct, aMenuId );
625 _wrapper->createMenu( _showUndoAct, aMenuId );
626 _wrapper->createMenu( _showRedoAct, aMenuId );
627 _wrapper->createMenu( _wrapper->separator(), aMenuId);
628 _wrapper->createMenu( _startResumeAct, aMenuId );
629 _wrapper->createMenu( _abortAct, aMenuId );
630 _wrapper->createMenu( _pauseAct, aMenuId );
631 _wrapper->createMenu( _resetAct, aMenuId );
632 _wrapper->createMenu( _wrapper->separator(), aMenuId);
633 _wrapper->createMenu( _saveRunStateAct, aMenuId );
634 //_wrapper->createMenu( _newEditionAct, aMenuId );
635 _wrapper->createMenu( _wrapper->separator(), aMenuId);
636 _wrapper->createMenu( _withoutStopModeAct, aMenuId );
637 _wrapper->createMenu( _breakpointsModeAct, aMenuId );
638 _wrapper->createMenu( _stepByStepModeAct, aMenuId );
639 _wrapper->createMenu( _wrapper->separator(), aMenuId);
640 _wrapper->createMenu( _toggleStopOnErrorAct, aMenuId );
641 _wrapper->createMenu( _wrapper->separator(), aMenuId);
642 _wrapper->createMenu( _importCatalogAct, aMenuId );
643 _wrapper->createMenu( _wrapper->separator(), aMenuId);
644 _wrapper->createMenu( _toggleStraightLinksAct, aMenuId );
645 _wrapper->createMenu( _toggleAutomaticComputeLinkAct, aMenuId );
646 _wrapper->createMenu( _toggleSimplifyLinkAct, aMenuId );
647 _wrapper->createMenu( _toggleForce2NodesLinkAct, aMenuId );
648 _wrapper->createMenu( _toggleAddRowColsAct, aMenuId );
649 _wrapper->createMenu( _wrapper->separator(), aMenuId);
650 _wrapper->createMenu( _showAllLinksAct, aMenuId );
651 _wrapper->createMenu( _hideAllLinksAct, aMenuId );
652 _wrapper->createMenu( _wrapper->separator(), aMenuId);
653 _wrapper->createMenu( _whatsThisAct, aMenuId );
656 void GenericGui::createTools()
658 int aToolId = _wrapper->createTool ( tr( "YACS Toolbar" ) );
659 _wrapper->createTool( _newSchemaAct, aToolId );
660 _wrapper->createTool( _importSchemaAct, aToolId );
661 _wrapper->createTool( _wrapper->separator(), aToolId );
662 _wrapper->createTool( _exportSchemaAct, aToolId );
663 _wrapper->createTool( _exportSchemaAsAct, aToolId );
664 _wrapper->createTool( _wrapper->separator(), aToolId);
665 _wrapper->createTool( _runLoadedSchemaAct, aToolId );
666 _wrapper->createTool( _loadRunStateSchemaAct, aToolId );
667 _wrapper->createTool( _loadAndRunSchemaAct, aToolId );
668 _wrapper->createTool( _chooseBatchJobAct, aToolId );
669 _wrapper->createTool( _wrapper->separator(), aToolId );
670 _wrapper->createTool( _undoAct, aToolId );
671 _wrapper->createTool( _redoAct, aToolId );
672 _wrapper->createTool( _wrapper->separator(), aToolId );
673 _wrapper->createTool( _startResumeAct, aToolId );
674 _wrapper->createTool( _abortAct, aToolId );
675 _wrapper->createTool( _pauseAct, aToolId );
676 _wrapper->createTool( _resetAct, aToolId );
677 _wrapper->createTool( _wrapper->separator(), aToolId );
678 _wrapper->createTool( _saveRunStateAct, aToolId );
679 //_wrapper->createTool( _newEditionAct, aToolId );
680 _wrapper->createTool( _withoutStopModeAct, aToolId );
681 _wrapper->createTool( _breakpointsModeAct, aToolId );
682 _wrapper->createTool( _stepByStepModeAct, aToolId );
683 _wrapper->createTool( _wrapper->separator(), aToolId );
684 _wrapper->createTool( _toggleStopOnErrorAct, aToolId );
685 _wrapper->createTool( _wrapper->separator(), aToolId );
686 _wrapper->createTool( _importCatalogAct, aToolId );
687 _wrapper->createTool( _wrapper->separator(), aToolId );
688 _wrapper->createTool( _toggleStraightLinksAct, aToolId );
689 _wrapper->createTool( _toggleAutomaticComputeLinkAct, aToolId );
690 _wrapper->createTool( _toggleSimplifyLinkAct, aToolId );
691 //_wrapper->createTool( _toggleForce2NodesLinkAct, aToolId );
692 _wrapper->createTool( _toggleAddRowColsAct, aToolId );
693 _wrapper->createTool( _wrapper->separator(), aToolId );
694 _wrapper->createTool( _showAllLinksAct, aToolId );
695 _wrapper->createTool( _hideAllLinksAct, aToolId );
696 _wrapper->createTool( _wrapper->separator(), aToolId );
697 _wrapper->createTool( _whatsThisAct, aToolId );
700 void GenericGui::initialMenus()
702 showEditionMenus(false);
703 showExecMenus(false);
704 showCommonMenus(false);
708 void GenericGui::showBaseMenus(bool show)
710 DEBTRACE("GenericGui::showBaseMenus " << show);
711 _wrapper->setMenuShown(_newSchemaAct, show);
712 _wrapper->setToolShown(_newSchemaAct, show);
713 _wrapper->setMenuShown(_importSchemaAct, show);
714 _wrapper->setToolShown(_importSchemaAct, show);
715 _wrapper->setMenuShown(_importSupervSchemaAct, show);
716 _wrapper->setMenuShown(_loadAndRunSchemaAct, show);
717 _wrapper->setToolShown(_loadAndRunSchemaAct, show);
718 _wrapper->setMenuShown(_chooseBatchJobAct, show);
719 _wrapper->setToolShown(_chooseBatchJobAct, show);
720 _wrapper->setMenuShown(_whatsThisAct, show);
721 _wrapper->setToolShown(_whatsThisAct, show);
724 void GenericGui::showEditionMenus(bool show)
726 DEBTRACE("GenericGui::showEditionMenus " << show);
727 _wrapper->setMenuShown(_exportSchemaAct, show);
728 _wrapper->setToolShown(_exportSchemaAct, show);
729 _wrapper->setMenuShown(_exportSchemaAsAct, show);
730 _wrapper->setToolShown(_exportSchemaAsAct, show);
731 _wrapper->setMenuShown(_runLoadedSchemaAct, show);
732 _wrapper->setToolShown(_loadRunStateSchemaAct, show);
733 _wrapper->setMenuShown(_loadRunStateSchemaAct, show);
734 _wrapper->setToolShown(_runLoadedSchemaAct, show);
735 _wrapper->setMenuShown(_undoAct, show);
736 _wrapper->setToolShown(_undoAct, show);
737 _wrapper->setMenuShown(_redoAct, show);
738 _wrapper->setToolShown(_redoAct, show);
739 _wrapper->setMenuShown(_showUndoAct, show);
740 _wrapper->setMenuShown(_showRedoAct, show);
741 _wrapper->setMenuShown(_importCatalogAct, show);
742 _wrapper->setToolShown(_importCatalogAct, show);
745 void GenericGui::showExecMenus(bool show)
747 DEBTRACE("GenericGui::showExecMenus " << show);
748 _wrapper->setMenuShown(_startResumeAct, show);
749 _wrapper->setToolShown(_startResumeAct, show);
750 _wrapper->setMenuShown(_abortAct, show);
751 _wrapper->setToolShown(_abortAct, show);
752 _wrapper->setMenuShown(_pauseAct, show);
753 _wrapper->setToolShown(_pauseAct, show);
754 _wrapper->setMenuShown(_resetAct, show);
755 _wrapper->setToolShown(_resetAct, show);
756 _wrapper->setMenuShown(_saveRunStateAct, show);
757 _wrapper->setToolShown(_saveRunStateAct, show);
758 //_wrapper->setMenuShown(_newEditionAct, show);
759 //_wrapper->setToolShown(_newEditionAct, show);
760 _wrapper->setMenuShown(_withoutStopModeAct, show);
761 _wrapper->setToolShown(_withoutStopModeAct, show);
762 _wrapper->setMenuShown(_breakpointsModeAct, show);
763 _wrapper->setToolShown(_breakpointsModeAct, show);
764 _wrapper->setMenuShown(_stepByStepModeAct, show);
765 _wrapper->setToolShown(_stepByStepModeAct, show);
766 _wrapper->setMenuShown(_toggleStopOnErrorAct, show);
767 _wrapper->setToolShown(_toggleStopOnErrorAct, show);
770 void GenericGui::showCommonMenus(bool show)
772 DEBTRACE("GenericGui::showCommonMenus " << show);
773 _wrapper->setMenuShown(_toggleStraightLinksAct, show);
774 _wrapper->setToolShown(_toggleStraightLinksAct, show);
775 _wrapper->setMenuShown(_toggleAutomaticComputeLinkAct, show);
776 _wrapper->setToolShown(_toggleAutomaticComputeLinkAct, show);
777 _wrapper->setMenuShown(_toggleSimplifyLinkAct, show);
778 _wrapper->setToolShown(_toggleSimplifyLinkAct, show);
779 _wrapper->setMenuShown(_toggleForce2NodesLinkAct, show);
780 //_wrapper->setToolShown(_toggleForce2NodesLinkAct, show);
781 _wrapper->setMenuShown(_toggleAddRowColsAct, show);
782 _wrapper->setToolShown(_toggleAddRowColsAct, show);
783 _wrapper->setMenuShown(_showAllLinksAct, show);
784 _wrapper->setToolShown(_showAllLinksAct, show);
785 _wrapper->setMenuShown(_hideAllLinksAct, show);
786 _wrapper->setToolShown(_hideAllLinksAct, show);
789 void GenericGui::switchContext(QWidget *view)
791 DEBTRACE("GenericGui::switchContext " << view);
792 if (! _mapViewContext.count(view))
795 _dwTree->setWidget(0);
796 _dwStacked->setWidget(0);
799 QtGuiContext* newContext = _mapViewContext[view];
801 _dwTree->setWidget(newContext->getEditTree());
802 _dwTree->widget()->show();
804 _dwStacked->setWidget(newContext->getStackedWidget());
806 QtGuiContext::setQtCurrent(newContext);
808 if (newContext->isEdition())
810 showExecMenus(false);
812 showEditionMenus(true);
813 showCommonMenus(true);
814 if (_dwTree) _dwTree->setWindowTitle("Tree View: edition mode");
818 showEditionMenus(false);
821 showCommonMenus(true);
822 _withoutStopModeAct->setChecked(true);
823 if (_dwTree) _dwTree->setWindowTitle("Tree View: execution mode");
825 _dwStacked->setMinimumWidth(10);
828 bool GenericGui::closeContext(QWidget *view, bool onExit)
830 DEBTRACE("GenericGui::closeContext " << onExit);
831 if (! _mapViewContext.count(view))
833 QtGuiContext* context = _mapViewContext[view];
836 bool tryToSave = false;
838 if (QtGuiContext::getQtCurrent()->isEdition())
840 if (!QtGuiContext::getQtCurrent()->_setOfModifiedSubjects.empty())
843 msgBox.setText("Some elements are modified and not taken into account.");
844 string info = "do you want to apply your changes ?\n";
845 info += " - Save : do not take into account edition in progress,\n";
846 info += " but if there are other modifications, select a file name for save\n";
847 info += " - Discard : discard all modifications and close the schema";
849 info += "\n - Cancel : do not close the schema, return to edition";
850 msgBox.setInformativeText(info.c_str());
853 msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
854 msgBox.setDefaultButton(QMessageBox::Cancel);
858 msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard);
859 msgBox.setDefaultButton(QMessageBox::Save);
861 int ret = msgBox.exec();
864 case QMessageBox::Save:
867 case QMessageBox::Discard:
870 case QMessageBox::Cancel:
872 DEBTRACE("Cancel or default");
878 if (QtGuiContext::getQtCurrent()->isNotSaved())
881 msgBox.setWindowTitle("Close the active schema");
882 msgBox.setText("The schema has been modified");
883 string info = "do you want to save the schema ?\n";
884 info += " - Save : select a file name for save\n";
885 info += " - Discard : discard all modifications and close the schema";
887 info += "\n - Cancel : do not close the schema, return to edition";
888 msgBox.setInformativeText(info.c_str());
891 msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
892 msgBox.setDefaultButton(QMessageBox::Cancel);
896 msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard);
897 msgBox.setDefaultButton(QMessageBox::Save);
899 int ret = msgBox.exec();
902 case QMessageBox::Save:
905 case QMessageBox::Discard:
908 case QMessageBox::Cancel:
909 DEBTRACE("Cancel or default");
919 if ((!onExit) && (!_isSaved)) // --- probably, user has cancelled the save dialog. Do not close
924 map<QWidget*, YACS::HMI::QtGuiContext*>::iterator it = _mapViewContext.begin();
925 QtGuiContext* newContext = 0;
926 QWidget* newView = 0;
927 for (; it != _mapViewContext.end(); ++it)
929 if ((*it).second != context)
931 newView = (*it).first;
932 newContext = (*it).second;
936 int studyId = _wrapper->activeStudyId();
937 if (context->getStudyId() == studyId)
939 _wrapper->deleteSchema(view);
940 DEBTRACE("delete context");
941 if (GuiExecutor* exec = context->getGuiExecutor())
943 exec->closeContext();
946 _mapViewContext.erase(view);
947 switchContext(newView);
952 void GenericGui::showDockWidgets(bool isVisible)
954 DEBTRACE("GenericGui::showDockWidgets " << isVisible);
955 if (_dwTree) _dwTree->setVisible(isVisible);
956 if (_dwTree) _dwTree->toggleViewAction()->setVisible(isVisible);
957 if (_dwStacked) _dwStacked->setVisible(isVisible);
958 if (_dwStacked) _dwStacked->toggleViewAction()->setVisible(isVisible);
959 if (_dwCatalogs) _dwCatalogs->setVisible(isVisible);
960 if (_dwCatalogs) _dwCatalogs->toggleViewAction()->setVisible(isVisible);
963 void GenericGui::raiseStacked()
965 if (_dwStacked) _dwStacked->raise();
968 std::list<std::string> GenericGui::getMachineList()
970 if (!_machineList.empty()) return _machineList;
972 YACS::ENGINE::RuntimeSALOME* runTime = YACS::ENGINE::getSALOMERuntime();
973 CORBA::ORB_ptr orb = runTime->getOrb();
974 if (!orb) return _machineList;
976 SALOME_NamingService namingService(orb);
977 SALOME_LifeCycleCORBA lcc(&namingService);
979 CORBA::Object_var obj =
980 namingService.Resolve(SALOME_ResourcesManager::_ResourcesManagerNameInNS);
981 if (CORBA::is_nil(obj)) return _machineList;
983 Engines::ResourcesManager_var resManager = Engines::ResourcesManager::_narrow(obj);
984 if(!resManager) return _machineList;
986 Engines::ResourceParameters params;
989 Engines::ResourceList* resourceList =
990 resManager->GetFittingResources(params);
992 for (int i = 0; i < resourceList->length(); i++)
994 const char* aResource = (*resourceList)[i];
995 _machineList.push_back(aResource);
1001 // -----------------------------------------------------------------------------
1003 /*! a QtGuiContext instance is created for each schema in edition or each execution or run
1004 * of a schema. The context stores references of a lot of objects related to the edition
1006 * \param proc the schema to run or edit, loaded from file or just created empty.
1007 * \param schemaName filename of the schema in edition, also used in execution to publish
1008 * a run under the edition name in Salome object browser.
1009 * \param runName filename of the schema in execution, not used in edition.
1010 * \param forEdition if true, edition mode, if false, execution mode.
1012 void GenericGui::createContext(YACS::ENGINE::Proc* proc,
1013 const QString& schemaName,
1014 const QString& runName,
1017 DEBTRACE("GenericGui::createContext");
1023 QWidget* central = _parent->centralWidget();
1025 central->setFocus();
1027 DEBTRACE("No Central Widget");
1030 QWidget* refWindow = 0; // --- used only on run to refer to the schema in edition
1033 fileName = schemaName;
1038 if (QtGuiContext::getQtCurrent())
1039 refWindow = QtGuiContext::getQtCurrent()->getWindow();
1042 QtGuiContext* context = new QtGuiContext(this);
1043 QtGuiContext::setQtCurrent(context);
1047 context->setEdition(forEdition);
1048 context->setSessionCatalog(_sessionCatalog);
1049 context->setFileName(fileName);
1050 context->setCurrentCatalog(_builtinCatalog);
1052 // --- scene, viewWindow & GraphicsView
1054 Scene *scene = new Scene();
1055 QWidget *viewWindow = _wrapper->getNewWindow(scene);
1056 _mapViewContext[viewWindow] = context;
1057 GraphicsView* gView = new GraphicsView(viewWindow);
1058 gView->setScene(scene);
1059 gView->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
1060 int studyId = _wrapper->AssociateViewToWindow(gView, viewWindow);
1061 context->setStudyId(studyId);
1062 std::ostringstream value;
1064 proc->setProperty("DefaultStudyID",value.str());
1065 context->setScene(scene);
1066 context->setView(gView);
1067 context->setWindow(viewWindow);
1072 SchemaModel *schemaModel = new SchemaModel(context, viewWindow);
1073 schemaModel->setEdition(forEdition);
1074 context->setSchemaModel(schemaModel);
1075 RootSceneItem *rootSceneItem = new RootSceneItem(context);
1077 // --- tree associated to model
1079 FormEditTree *editTree = new FormEditTree(_dwTree);
1080 editTree->setMinimumHeight(400);
1081 _dwTree->setWidget(editTree);
1083 context->setEditTree(editTree);
1084 editTree->tv_schema->setModel(schemaModel);
1085 context->setSelectionModel(editTree->tv_schema->selectionModel());
1088 QObject::connect(editTree->tv_schema->selectionModel(),
1089 SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
1091 SLOT(updateSelection(const QItemSelection &, const QItemSelection &)));
1093 // --- stacked widget
1095 QStackedWidget *stacked = new QStackedWidget(_dwStacked);
1096 _dwStacked->setWidget(stacked);
1097 context->setStackedWidget(stacked);
1098 YACS::HMI::ItemEditionRoot* rootEdit = new YACS::HMI::ItemEditionRoot(context,
1100 context->getName().c_str());
1101 context->setEditionRoot(rootEdit);
1103 QObject::connect(schemaModel,
1104 SIGNAL(signalSelection(const QModelIndex &)),
1105 editTree->tv_schema,
1106 SLOT(viewSelection(const QModelIndex &)));
1110 proc->setEdition(forEdition);
1114 double passe = (end_t -start_t);
1115 passe = passe/CLOCKS_PER_SEC;
1116 DEBTRACE("create context -1- : " << passe);
1120 context->setLoading(true);
1122 context->setProc(proc);
1123 setLoadedPresentation(proc);
1127 double passe = (end_t -start_t);
1128 passe = passe/CLOCKS_PER_SEC;
1129 DEBTRACE("create context - load proc- : " << passe);
1133 context->setLoading(false);
1135 if (forEdition && _wrapper) // --- Edition mode
1137 _wrapper->createNewSchema(fileName, viewWindow);
1139 else if (_wrapper) // --- Execution Mode
1141 GuiExecutor *guiExec = new GuiExecutor(proc);
1142 context->setGuiExecutor(guiExec);
1143 _wrapper->createNewRun(schemaName, fileName, refWindow, viewWindow);
1147 QtGuiContext::getQtCurrent()->getSubjectProc()->update(UPDATE,
1148 ProcInvoc::getTypeOfNode(proc),
1149 0); // --- force validity check
1151 // --- adjust widgets
1153 TreeView *vtree = dynamic_cast<TreeView*>(editTree->tv_schema);
1155 vtree->resizeColumns();
1156 _catalogsWidget->setMinimumWidth(10); // --- reset the constraint on width
1157 editTree->setMinimumHeight(40);
1158 _dwStacked->setMinimumWidth(10);
1163 showExecMenus(false);
1164 showEditionMenus(true);
1165 showCommonMenus(true);
1166 if (_dwTree) _dwTree->setWindowTitle("Tree View: edition mode");
1170 showEditionMenus(false);
1171 showExecMenus(true);
1172 showCommonMenus(true);
1173 _withoutStopModeAct->setChecked(true);
1174 if (_dwTree) _dwTree->setWindowTitle("Tree View: execution mode");
1177 QtGuiContext::getQtCurrent()->setNotSaved(false);
1180 double passe = (end_t -start_t);
1181 passe = passe/CLOCKS_PER_SEC;
1182 DEBTRACE("create context - end - : " << passe);
1187 // -----------------------------------------------------------------------------
1189 void GenericGui::setLoadedPresentation(YACS::ENGINE::Proc* proc)
1191 DEBTRACE("GenericGui::setLoadedPresentation");
1192 QtGuiContext::getQtCurrent()->setLoadingPresentation(true);
1193 map<YACS::ENGINE::Node*, PrsData> presNodes = _loader->getPrsData(proc);
1194 if (!presNodes.empty())
1196 map<YACS::ENGINE::Node*, PrsData>::iterator it = presNodes.begin();
1197 for (; it!= presNodes.end(); ++it)
1199 YACS::ENGINE::Node* node = (*it).first;
1200 PrsData pres = (*it).second;
1201 SubjectNode *snode = QtGuiContext::getQtCurrent()->_mapOfSubjectNode[node];
1202 SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[snode];
1204 SceneNodeItem *inode = dynamic_cast<SceneNodeItem*>(item);
1206 inode->setPos(QPointF(pres._x, pres._y));
1207 inode->setWidth(pres._width);
1208 inode->setHeight(pres._height);
1209 inode->setExpanded(pres._expanded);
1210 inode->setExpandedPos(QPointF(pres._expx, pres._expy));
1211 inode->setExpandedWH(pres._expWidth, pres._expHeight);
1212 inode->setShownState(shownState(pres._shownState));
1215 if (Scene::_autoComputeLinks)
1216 _guiEditor->rebuildLinks();
1219 YACS::HMI::SubjectProc* subproc = QtGuiContext::getQtCurrent()->getSubjectProc();
1220 SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[subproc];
1221 SceneComposedNodeItem *proc = dynamic_cast<SceneComposedNodeItem*>(item);
1222 proc->updateLinks();
1225 QtGuiContext::getQtCurrent()->setLoadingPresentation(false);
1228 // -----------------------------------------------------------------------------
1230 void GenericGui::onNewSchema()
1232 DEBTRACE("GenericGui::onNewSchema");
1234 std::stringstream name;
1235 name << "newSchema_" << ++_schemaCnt;
1237 YACS::ENGINE::RuntimeSALOME* runTime = YACS::ENGINE::getSALOMERuntime();
1238 YACS::ENGINE::Proc *proc = runTime->createProc(name.str());
1242 QString fileName = name.str().c_str();
1243 createContext(proc, fileName, "", true);
1246 void GenericGui::loadSchema(const std::string& filename,bool edit, bool arrangeLocalNodes)
1248 YACS::ENGINE::Proc *proc = _loader->load(filename.c_str());
1251 YACS::ENGINE::Logger* logger= proc->getLogger("parser");
1252 if(!logger->isEmpty())
1254 DEBTRACE(logger->getStr());
1256 QString fn=QString::fromStdString(filename);
1258 createContext(proc, fn, "", true);
1260 createContext(proc, fn, fn, false);
1261 if (arrangeLocalNodes)
1263 _guiEditor->arrangeProc();
1267 void GenericGui::onImportSchema()
1272 DEBTRACE("GenericGui::onImportSchema");
1273 QFileDialog dialog(_parent,
1274 "Choose a filename to load" ,
1276 tr( "XML-Files (*.xml);;All Files (*)" ));
1278 dialog.setHistory(_wrapper->getQuickDirList());
1281 QStringList fileNames;
1284 fileNames = dialog.selectedFiles();
1285 if (!fileNames.isEmpty())
1286 fn = fileNames.first();
1289 if ( !fn.isEmpty() )
1291 // add ".xml" suffix
1293 if (!fi.exists() && fi.suffix() != "xml")
1296 DEBTRACE("file loaded : " <<fn.toStdString());
1297 YACS::ENGINE::Proc *proc = 0;
1300 proc = _loader->load(fn.toLatin1());
1307 double passe = (end_t -start_t);
1308 passe = passe/CLOCKS_PER_SEC;
1309 DEBTRACE("load xml file : " << passe);
1315 QMessageBox msgBox(QMessageBox::Critical,
1316 "Import YACS Schema, native YACS XML format",
1317 "The file has not the native YACS XML format or is not readable.");
1321 YACS::ENGINE::Logger* logger= proc->getLogger("parser");
1322 if(!logger->isEmpty())
1324 DEBTRACE(logger->getStr());
1326 createContext(proc, fn, "", true);
1330 void GenericGui::onImportSupervSchema()
1332 DEBTRACE("GenericGui::onImportSupervSchema");
1333 QFileDialog dialog(_parent,
1334 "Choose a SUPERV filename to load" ,
1336 tr( "XML-Files (*.xml);;All Files (*)" ));
1338 dialog.setHistory(_wrapper->getQuickDirList());
1341 QStringList fileNames;
1344 fileNames = dialog.selectedFiles();
1345 if (!fileNames.isEmpty())
1346 fn = fileNames.first();
1349 if (fn.isEmpty()) return;
1351 // add ".xml" suffix
1353 if (!fi.exists() && fi.suffix() != "xml")
1356 DEBTRACE("file loaded : " <<fn.toStdString());
1357 QString tmpFileName;
1361 QString tmpDir = getenv("TEMP");
1362 QString fileExt = "bat";
1364 QString tmpDir = "/tmp";
1365 QString fileExt = "sh";
1367 QDir aTmpDir(tmpDir);
1368 aTmpDir.mkdir(QString("YACS_") + getenv("USER"));
1369 YASSERT(aTmpDir.cd(QString("YACS_") + getenv("USER")));
1370 QDateTime curTime = QDateTime::currentDateTime();
1371 tmpFileName = "SUPERV_import_" + curTime.toString("yyyyMMdd_hhmmss") + ".xml";
1372 QString tmpOutput = "salomeloader_output";
1373 tmpFileName = aTmpDir.absoluteFilePath(tmpFileName);
1374 DEBTRACE(tmpFileName.toStdString());
1376 QString aCall = "salomeloader."+ fileExt+ " "+ fn + " " + tmpFileName + " > " + tmpOutput;
1377 DEBTRACE(aCall.toStdString());
1379 int ret = system(aCall.toAscii());
1382 // --- read file with logs
1383 fstream f(tmpOutput.toAscii());
1388 // --- Problem in execution
1389 int status=WEXITSTATUS(ret);
1392 QString mes = "Problems in conversion: some errors but an incomplete proc has nevertheless been created.\n\n";
1393 mes += QString(hfile.str().c_str());
1394 QMessageBox msgBox(QMessageBox::Warning,
1395 "Import YACS Schema, SUPERV XML format",
1399 else if(status == 2)
1401 QString mes = "Problems in conversion: a fatal error has been encountered. The proc can't be created.\n\n";
1402 mes += QString(hfile.str().c_str());
1403 QMessageBox msgBox(QMessageBox::Critical,
1404 "Import YACS Schema, SUPERV XML format",
1411 DEBTRACE("Unknown problem: " << ret );
1412 QMessageBox msgBox(QMessageBox::Critical,
1413 "Import YACS Schema, SUPERV XML format",
1414 "Unexpected exception in salomeloader.");
1422 QMessageBox msgBox(QMessageBox::Critical,
1423 "Import YACS Schema, SUPERV XML format",
1424 "Unexpected exception in convertSupervFile");
1430 if (fn.isEmpty()) return; // must not happen
1432 DEBTRACE("file loaded : " <<fn.toStdString());
1433 YACS::ENGINE::Proc *proc = _loader->load(fn.toLatin1());
1436 QMessageBox msgBox(QMessageBox::Critical,
1437 "Import YACS Schema, SUPERV file converted in native YACS XML format",
1438 "The file has not the native YACS XML format or is not readable.");
1442 YACS::ENGINE::Logger* logger= proc->getLogger("parser");
1443 if(!logger->isEmpty())
1445 DEBTRACE(logger->getStr());
1447 createContext(proc, fn, "", true);
1450 //! bug confirmOverwrite : correction Qt 4.3.5
1451 QString GenericGui::getSaveFileName(const QString& fileName)
1453 QFileDialog dialog(_parent, "Save schema", fileName);
1454 QStringList filters;
1455 filters << "XML files (*.xml)"
1457 dialog.setFileMode(QFileDialog::AnyFile);
1458 dialog.setFilters(filters);
1459 dialog.selectFilter("(*.xml)");
1460 dialog.setDefaultSuffix("xml");
1461 dialog.setConfirmOverwrite(true);
1462 //dialog.setConfirmOverwrite(false); // bug Qt4.3.3
1463 dialog.setAcceptMode(QFileDialog::AcceptSave);
1464 QString selectedFile;
1465 QStringList fileNames;
1467 if (bool ret = dialog.exec())
1469 DEBTRACE(ret << " " << dialog.confirmOverwrite());
1470 fileNames = dialog.selectedFiles();
1471 if (!fileNames.isEmpty())
1472 selectedFile = fileNames.first();
1474 QString filteredName = _guiEditor->asciiFilter(selectedFile);
1475 DEBTRACE(filteredName.toStdString());
1476 return filteredName;
1479 void GenericGui::onExportSchema()
1481 DEBTRACE("GenericGui::onExportSchema");
1482 if (!QtGuiContext::getQtCurrent()) return;
1483 YACS::ENGINE::Proc* proc = QtGuiContext::getQtCurrent()->getProc();
1484 QString fo = QtGuiContext::getQtCurrent()->getFileName();
1487 if (fo.startsWith("newSchema_"))
1490 fn = getSaveFileName(fo);
1492 if (fn.isEmpty()) return;
1494 DEBTRACE("GenericGui::onExportSchema: " << fn.toStdString());
1495 //to be sure that all pending changes are effective
1496 _parent->setFocus();
1497 QtGuiContext::getQtCurrent()->setFileName(fn);
1498 VisitorSaveGuiSchema aWriter(proc);
1499 aWriter.openFileSchema( fn.toStdString() );
1500 aWriter.visitProc();
1501 aWriter.closeFileSchema();
1502 QtGuiContext::getQtCurrent()->setNotSaved(false);
1504 if (fn.compare(foo) && _wrapper)
1505 _wrapper->renameSchema(foo, fn, QtGuiContext::getQtCurrent()->getWindow());
1508 void GenericGui::onExportSchemaAs()
1510 DEBTRACE("GenericGui::onExportSchemaAs");
1512 if (!QtGuiContext::getQtCurrent()) return;
1513 YACS::ENGINE::Proc* proc = QtGuiContext::getQtCurrent()->getProc();
1514 QString fo = QtGuiContext::getQtCurrent()->getFileName();
1516 if (fo.startsWith("newSchema_")) fo.clear();
1517 QString fn = getSaveFileName(fo);
1518 if (fn.isEmpty()) return;
1520 DEBTRACE("GenericGui::onExportSchemaAs: " << fn.toStdString());
1521 QtGuiContext::getQtCurrent()->setFileName(fn);
1522 VisitorSaveGuiSchema aWriter(proc);
1523 aWriter.openFileSchema(fn.toStdString());
1524 aWriter.visitProc();
1525 aWriter.closeFileSchema();
1527 QtGuiContext::getQtCurrent()->setNotSaved(false);
1529 if (fn.compare(foo) && _wrapper)
1530 _wrapper->renameSchema(foo, fn, QtGuiContext::getQtCurrent()->getWindow());
1533 void GenericGui::onImportCatalog()
1535 DEBTRACE("GenericGui::onImportCatalog");
1536 QFileDialog dialog(_parent,
1537 "Choose a YACS Schema to load as a Catalog" ,
1539 tr( "XML-Files (*.xml);;All Files (*)" ));
1541 dialog.setHistory(_wrapper->getQuickDirList());
1544 QStringList fileNames;
1547 fileNames = dialog.selectedFiles();
1548 if (!fileNames.isEmpty())
1549 fn = fileNames.first();
1552 if ( !fn.isEmpty() )
1553 _catalogsWidget->addCatalogFromFile(fn.toStdString());
1556 void GenericGui::onRunLoadedSchema(bool withState)
1558 DEBTRACE("GenericGui::onRunLoadedSchema");
1559 if (!QtGuiContext::getQtCurrent()) return;
1565 // --- check proc state (cf. editionProc)
1567 if (!QtGuiContext::getQtCurrent()->_setOfModifiedSubjects.empty())
1569 set<Subject*>::iterator it = QtGuiContext::getQtCurrent()->_setOfModifiedSubjects.begin();
1570 (*it)->select(true);
1574 YACS::ENGINE::Proc* proc = QtGuiContext::getQtCurrent()->getProc();
1575 if (!proc->isValid())
1577 QtGuiContext::getQtCurrent()->getSubjectProc()->select(true);
1581 YACS::ENGINE::LinkInfo info(YACS::ENGINE::LinkInfo::ALL_STOP_ASAP);
1584 proc->checkConsistency(info);
1586 catch (Exception &ex)
1588 DEBTRACE(ex.what());
1589 QtGuiContext::getQtCurrent()->getSubjectProc()->select(true);
1592 if (info.areWarningsOrErrors()) return;
1596 double passe = (end_t -start_t);
1597 passe = passe/CLOCKS_PER_SEC;
1598 cerr <<"run schema -1- : " << passe << endl;
1601 // --- save proc under a run name
1603 QFileInfo fo = QtGuiContext::getQtCurrent()->getFileName();
1604 QString procName = fo.baseName();
1605 //QString tmpDir = SALOMEDS_Tool::GetTmpDir().c_str();
1607 QString tmpDir = getenv("TEMP");
1609 QString tmpDir = "/tmp";
1611 QDir aTmpDir(tmpDir);
1612 aTmpDir.mkdir(QString("YACS_") + getenv("USER"));
1613 YASSERT(aTmpDir.cd(QString("YACS_") + getenv("USER")));
1614 QDateTime curTime = QDateTime::currentDateTime();
1615 QString aRunName = procName + "_" + curTime.toString("yyyyMMdd_hhmmss") + ".xml";
1616 aRunName = aTmpDir.absoluteFilePath(aRunName);
1617 DEBTRACE(aRunName.toStdString());
1619 VisitorSaveGuiSchema aWriter(proc);
1620 aWriter.openFileSchema(aRunName.toStdString());
1621 aWriter.visitProc();
1622 aWriter.closeFileSchema();
1624 // --- create a run context
1626 YACS::ENGINE::Proc *procrun = _loader->load(aRunName.toLatin1());
1629 double passe = (end_t -start_t);
1630 passe = passe/CLOCKS_PER_SEC;
1631 cerr <<"run schema -2- : " << passe << endl;
1634 createContext(procrun, QtGuiContext::getQtCurrent()->getFileName(), aRunName, false);
1636 // load state if required
1638 GuiExecutor *executor = QtGuiContext::getQtCurrent()->getGuiExecutor();
1639 if (!executor) return;
1642 QString fn = QFileDialog::getOpenFileName( _parent,
1643 "Choose a previous run state to load" ,
1645 tr( "XML-Files (*.xml);;All Files (*)" ));
1648 DEBTRACE("run state to load: " <<fn.toStdString());
1649 executor->setLoadStateFile(fn.toStdString());
1652 executor->startResumeDataflow(true); // --- initialise gui state
1653 if(_toggleStopOnErrorAct->isChecked())
1654 executor->setStopOnError(false);
1657 void GenericGui::onLoadRunStateSchema()
1659 DEBTRACE("GenericGui::onLoadRunStateSchema");
1660 onRunLoadedSchema(true);
1663 void GenericGui::onLoadAndRunSchema()
1665 DEBTRACE("GenericGui::onLoadAndRunSchema");
1666 QString fn = QFileDialog::getOpenFileName( _parent,
1667 "Choose a filename to load" ,
1669 tr( "XML-Files (*.xml);;All Files (*)" ));
1670 if ( !fn.isEmpty() )
1672 // add ".xml" suffix
1674 if (!fi.exists() && fi.suffix() != "xml")
1677 DEBTRACE("file loaded : " <<fn.toStdString());
1678 YACS::ENGINE::Proc *proc =0;
1681 proc = _loader->load(fn.toLatin1());
1688 QMessageBox msgBox(QMessageBox::Critical,
1689 "Import YACS Schema, native YACS XML format",
1690 "The file has not the native YACS XML format or is not readable.");
1694 YACS::ENGINE::Logger* logger= proc->getLogger("parser");
1695 if(!logger->isEmpty())
1697 DEBTRACE(logger->getStr());
1699 createContext(proc, fn, "", true);
1700 onRunLoadedSchema();
1704 void GenericGui::onChooseBatchJob() {
1705 DEBTRACE("GenericGui::onChooseBatchJob");
1707 // Show the Batch Jobs list
1708 if(_BJLdialog) delete _BJLdialog;
1709 _BJLdialog = new BatchJobsListDialog(tr("Select one Batch Job to watch"),this);
1711 _BJLdialog->move(300,200);
1712 _BJLdialog->resize(450,200);
1716 void GenericGui::onStartResume()
1718 DEBTRACE("GenericGui::onStartResume");
1719 if (!QtGuiContext::getQtCurrent()) return;
1720 if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
1721 QtGuiContext::getQtCurrent()->getGuiExecutor()->startResumeDataflow();
1724 void GenericGui::onAbort()
1726 DEBTRACE("GenericGui::onAbort");
1727 if (!QtGuiContext::getQtCurrent()) return;
1728 if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
1729 QtGuiContext::getQtCurrent()->getGuiExecutor()->killDataflow();
1732 void GenericGui::onPause()
1734 DEBTRACE("GenericGui::onPause");
1735 if (!QtGuiContext::getQtCurrent()) return;
1736 if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
1737 QtGuiContext::getQtCurrent()->getGuiExecutor()->suspendDataflow();
1740 void GenericGui::onReset()
1742 DEBTRACE("GenericGui::onReset");
1743 if (!QtGuiContext::getQtCurrent()) return;
1744 if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
1745 QtGuiContext::getQtCurrent()->getGuiExecutor()->resetDataflow();
1748 void GenericGui::onSaveRunState()
1750 DEBTRACE("GenericGui::onSaveRunState");
1751 if (!QtGuiContext::getQtCurrent()) return;
1752 if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
1753 QDateTime curTime = QDateTime::currentDateTime();
1754 QFileInfo procName = QtGuiContext::getQtCurrent()->getFileName();
1755 QString stateName = procName.baseName();
1756 DEBTRACE(stateName.toStdString());
1757 stateName += "_state_" + curTime.toString("yyyyMMdd_hhmmss") + ".xml";
1758 DEBTRACE(stateName.toStdString());
1759 stateName = getSaveFileName(stateName);
1760 DEBTRACE(stateName.toStdString());
1761 if (!stateName.isEmpty())
1762 QtGuiContext::getQtCurrent()->getGuiExecutor()->saveState(stateName.toStdString());
1765 void GenericGui::onNewEdition()
1767 DEBTRACE("GenericGui::onNewEdition");
1768 // if (!QtGuiContext::getQtCurrent()) return;
1769 // if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
1770 // QtGuiContext::getQtCurrent()->getGuiExecutor()->resetDataflow();
1773 void GenericGui::onGetYacsContainerLog()
1775 DEBTRACE("GenericGui::onGetYacsContainerLog");
1776 if (!QtGuiContext::getQtCurrent()) return;
1777 if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
1778 string log = QtGuiContext::getQtCurrent()->getGuiExecutor()->getContainerLog();
1779 ContainerLogViewer *lv = new ContainerLogViewer("YACS Container Log", _parent);
1784 void GenericGui::onGetErrorReport()
1786 DEBTRACE("GenericGui::onGetErrorReport");
1787 if (!QtGuiContext::getQtCurrent()) return;
1788 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
1789 SubjectNode *snode = dynamic_cast<SubjectNode*>(sub);
1792 if (QtGuiContext::getQtCurrent()->getGuiExecutor())
1794 log = QtGuiContext::getQtCurrent()->getGuiExecutor()->getErrorReport(snode->getNode());
1798 log = snode->getNode()->getErrorReport();
1801 LogViewer *lv = new LogViewer("Node error report", _parent);
1806 void GenericGui::onGetErrorDetails()
1808 DEBTRACE("GenericGui::onGetErrorDetails");
1809 if (!QtGuiContext::getQtCurrent()) return;
1810 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
1811 SubjectNode *snode = dynamic_cast<SubjectNode*>(sub);
1814 if (QtGuiContext::getQtCurrent()->getGuiExecutor())
1816 log = QtGuiContext::getQtCurrent()->getGuiExecutor()->getErrorDetails(snode->getNode());
1820 log = snode->getNode()->getErrorDetails();
1823 LogViewer *lv = new LogViewer("Node Error Details", _parent);
1828 void GenericGui::onGetContainerLog()
1830 DEBTRACE("GenericGui::onGetContainerLog");
1831 if (!QtGuiContext::getQtCurrent()) return;
1832 if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
1833 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
1834 SubjectElementaryNode *snode = dynamic_cast<SubjectElementaryNode*>(sub);
1836 string log = QtGuiContext::getQtCurrent()->getGuiExecutor()->getContainerLog(snode->getNode());
1838 LogViewer *lv = new LogViewer("Node Container Log", _parent);
1842 if (dynamic_cast<YACS::ENGINE::ServiceNode*>(snode->getNode()))
1844 info +="The container log of this node\n";
1845 info += "is not stored in a file and \n";
1846 info += "can't be displayed here, \n";
1847 info += "but you can have a look at \n";
1848 info += "the SALOME standard output,\n";
1849 info += "on your terminal...";
1853 info += "See YACS Container log \n";
1854 info += "(on main proc menu) \n";
1855 info += "for all inline nodes";
1864 void GenericGui::onShutdownProc()
1866 DEBTRACE("GenericGui::onShutdownProc");
1867 if (!QtGuiContext::getQtCurrent()) return;
1868 if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
1869 QtGuiContext::getQtCurrent()->getGuiExecutor()->shutdownProc();
1872 void GenericGui::onEditDataTypes()
1874 DEBTRACE("GenericGui::onEditDataTypes");
1877 void GenericGui::onCreateDataType()
1879 DEBTRACE("GenericGui::onCreateDataType");
1882 void GenericGui::onImportDataType()
1884 DEBTRACE("GenericGui::onImportDataType");
1885 if (_dwCatalogs) _dwCatalogs->raise();
1888 void GenericGui::onSelectComponentInstance()
1890 DEBTRACE("GenericGui::onSelectComponentInstance");
1891 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
1893 SubjectComponent *ref = dynamic_cast<SubjectComponent*>(sub);
1895 YACS::ENGINE::ComponentInstance* compo=ref->getComponent();
1896 QtGuiContext::getQtCurrent()->_mapOfLastComponentInstance[compo->getCompoName()]=compo;
1899 void GenericGui::onNewContainer()
1901 DEBTRACE("GenericGui::onNewContainer");
1902 _guiEditor->CreateContainer();
1905 void GenericGui::onNewSalomeComponent()
1907 DEBTRACE("GenericGui::onNewSalomeComponent");
1908 _guiEditor->CreateComponentInstance();
1911 void GenericGui::onNewSalomePythonComponent()
1913 DEBTRACE("GenericGui::onNewSalomePythonComponent");
1916 void GenericGui::onNewCorbaComponent()
1918 DEBTRACE("GenericGui::onNewCorbaComponent");
1922 void GenericGui::onSalomeServiceNode()
1924 DEBTRACE("GenericGui::onSalomeServiceNode");
1925 _guiEditor->CreateNode("SalomeNode");
1928 void GenericGui::onServiceInlineNode()
1930 DEBTRACE("GenericGui::onServiceInlineNode");
1931 _guiEditor->CreateNode("SalomePythonNode");
1934 void GenericGui::onCORBAServiceNode()
1936 DEBTRACE("GenericGui::onCORBAServiceNode");
1937 _guiEditor->CreateNode("CORBANode");
1940 void GenericGui::onNodeNodeServiceNode()
1942 DEBTRACE("GenericGui::onNodeNodeServiceNode");
1945 void GenericGui::onCppNode()
1947 DEBTRACE("GenericGui::onCppNode");
1948 _guiEditor->CreateNode("CppNode");
1951 void GenericGui::onXMLNode()
1953 DEBTRACE("GenericGui::onXMLNode");
1954 _guiEditor->CreateNode("XmlNode");
1957 void GenericGui::onInDataNode()
1959 DEBTRACE("GenericGui::onInDataNode");
1960 _guiEditor->CreateNode("PresetNode");
1963 void GenericGui::onOutDataNode()
1965 DEBTRACE("GenericGui::onOutDataNode");
1966 _guiEditor->CreateNode("OutNode");
1969 void GenericGui::onInStudyNode()
1971 DEBTRACE("GenericGui::onInStudyNode");
1972 _guiEditor->CreateNode("StudyInNode");
1975 void GenericGui::onOutStudyNode()
1977 DEBTRACE("GenericGui::onOutStudyNode");
1978 _guiEditor->CreateNode("StudyOutNode");
1981 void GenericGui::onInlineScriptNode()
1983 DEBTRACE("GenericGui::onInlineScriptNode");
1984 _guiEditor->CreateNode("PyScript");
1987 void GenericGui::onInlineFunctionNode()
1989 DEBTRACE("GenericGui::onInlineFunctionNode");
1990 _guiEditor->CreateNode("PyFunction");
1993 void GenericGui::onBlockNode()
1995 DEBTRACE("GenericGui::onBlockNode");
1996 _guiEditor->CreateBloc();
1999 void GenericGui::onFORNode()
2001 DEBTRACE("GenericGui::onFORNode");
2002 _guiEditor->CreateForLoop();
2005 void GenericGui::onFOREACHNode()
2007 DEBTRACE("GenericGui::onFOREACHNode");
2008 createForEachLoop("double");
2011 void GenericGui::createForEachLoop(std::string type)
2013 DEBTRACE("GenericGui::createForEachLoop");
2014 _guiEditor->CreateForEachLoop(type);
2017 void GenericGui::onWHILENode()
2019 DEBTRACE("GenericGui::onWHILENode");
2020 _guiEditor->CreateWhileLoop();
2023 void GenericGui::onSWITCHNode()
2025 DEBTRACE("GenericGui::onSWITCHNode");
2026 _guiEditor->CreateSwitch();
2029 void GenericGui::onOptimizerLoop()
2031 DEBTRACE("GenericGui::onOptimizerLoop");
2032 _guiEditor->CreateOptimizerLoop();
2035 void GenericGui::onNodeFromCatalog()
2037 DEBTRACE("GenericGui::onNodeFromCatalog");
2038 if (_dwCatalogs) _dwCatalogs->raise();
2041 void GenericGui::onDeleteItem()
2043 DEBTRACE("GenericGui::onDeleteItem");
2044 _guiEditor->DeleteSubject();
2047 void GenericGui::onCutItem()
2049 DEBTRACE("GenericGui::onCutItem");
2050 _guiEditor->CutSubject();
2053 void GenericGui::onCopyItem()
2055 DEBTRACE("GenericGui::onCopyItem");
2056 _guiEditor->CopySubject();
2059 void GenericGui::onPasteItem()
2061 DEBTRACE("GenericGui::onPasteItem");
2062 _guiEditor->PasteSubject();
2065 void GenericGui::onPutInBloc()
2067 _guiEditor->PutSubjectInBloc();
2070 void GenericGui::putGraphInForeachLoop(std::string type)
2072 DEBTRACE("GenericGui::PutGraphInForeachLoop");
2073 _guiEditor->PutGraphInForeachLoop(type);
2076 void GenericGui::onPutGraphInOptimizerLoop()
2078 DEBTRACE("GenericGui::onPutGraphInOptimizerLoop");
2079 _guiEditor->PutGraphInOptimizerLoop();
2082 void GenericGui::onArrangeLocalNodes()
2084 DEBTRACE("GenericGui::onArrangeLocalNodes");
2085 _guiEditor->arrangeNodes(false);
2088 void GenericGui::onArrangeRecurseNodes()
2090 DEBTRACE("GenericGui::onArrangeRecurseNodes");
2091 _guiEditor->arrangeNodes(true);
2094 void GenericGui::onRebuildLinks()
2096 DEBTRACE("GenericGui::onRebuildLinks");
2097 _guiEditor->rebuildLinks();
2100 void GenericGui::onZoomToBloc()
2102 DEBTRACE("GenericGui::onZoomToBloc");
2103 QtGuiContext::getQtCurrent()->getView()->onZoomToBloc();
2106 void GenericGui::onCenterOnNode()
2108 DEBTRACE("GenericGui::onCenterOnNode");
2109 QtGuiContext::getQtCurrent()->getView()->onCenterOnNode();
2112 void GenericGui::onShrinkExpand() {
2113 DEBTRACE("GenericGui::onShrinkExpand");
2114 _guiEditor->shrinkExpand();
2117 void GenericGui::onToggleStraightLinks(bool checked)
2119 Scene::_straightLinks = checked;
2120 DEBTRACE("Scene::_straightLinks=" << checked);
2121 if (!QtGuiContext::getQtCurrent())
2123 map<Subject*, SchemaItem*>::const_iterator it = QtGuiContext::getQtCurrent()->_mapOfSchemaItem.begin();
2124 for( ; it != QtGuiContext::getQtCurrent()->_mapOfSchemaItem.end(); ++it)
2126 Subject* sub = (*it).first;
2127 sub->update(SWITCHSHAPE, 0, 0);
2131 void GenericGui::onToggleAutomaticComputeLinks(bool checked)
2133 Scene::_autoComputeLinks = checked;
2134 DEBTRACE("Scene::_autoComputeLinks=" << checked);
2137 void GenericGui::onToggleSimplifyLinks(bool checked)
2139 Scene::_simplifyLinks = checked;
2140 DEBTRACE("Scene::_simplifyLinks=" << checked);
2143 void GenericGui::onToggleForce2NodesLinks(bool checked)
2145 Scene::_force2NodesLink = checked;
2146 DEBTRACE("Scene::_force2NodesLink=" << checked);
2149 void GenericGui::onToggleAddRowCols(bool checked)
2151 Scene::_addRowCols = checked;
2152 DEBTRACE("Scene::_addRowCols=" << checked);
2155 void GenericGui::onSelectReference()
2157 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
2159 SubjectReference *ref = dynamic_cast<SubjectReference*>(sub);
2161 SubjectServiceNode *snode = dynamic_cast<SubjectServiceNode*>(ref->getReference());
2162 snode->select(true);
2165 void GenericGui::onWhatsThis()
2167 DEBTRACE("GenericGui::onWhatsThis");
2168 QWhatsThis::enterWhatsThisMode();
2171 void GenericGui::onWithoutStopMode(bool checked)
2173 DEBTRACE("GenericGui::onWithoutStopMode " << checked);
2174 if (!QtGuiContext::getQtCurrent()) return;
2175 if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
2176 if (checked) QtGuiContext::getQtCurrent()->getGuiExecutor()->setContinueMode();
2179 void GenericGui::onBreakpointsMode(bool checked)
2181 DEBTRACE("GenericGui::onWithoutStopMode " << checked);
2182 if (!QtGuiContext::getQtCurrent()) return;
2183 if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
2184 if (checked) QtGuiContext::getQtCurrent()->getGuiExecutor()->setBreakpointMode();
2187 void GenericGui::onStepByStepMode(bool checked)
2189 DEBTRACE("GenericGui::onWithoutStopMode " << checked);
2190 if (!QtGuiContext::getQtCurrent()) return;
2191 if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
2192 if (checked) QtGuiContext::getQtCurrent()->getGuiExecutor()->setStepByStepMode();
2195 void GenericGui::onToggleStopOnError(bool checked)
2197 DEBTRACE("GenericGui::onToggleStopOnError " << checked);
2198 if (!QtGuiContext::getQtCurrent()) return;
2199 if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
2201 QtGuiContext::getQtCurrent()->getGuiExecutor()->setStopOnError(false);
2203 QtGuiContext::getQtCurrent()->getGuiExecutor()->unsetStopOnError();
2206 void GenericGui::onToggleSceneItemVisible(bool checked)
2208 DEBTRACE("GenericGui::onToggleSceneItemVisible " << checked);
2209 if (!QtGuiContext::getQtCurrent()) return;
2210 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
2211 SubjectNode *snode = dynamic_cast<SubjectNode*>(sub);
2214 if (!QtGuiContext::getQtCurrent()->_mapOfSceneItem.count(sub)) return;
2216 SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sub];
2217 item->setVisible(checked);
2220 void GenericGui::displayLinks(bool isShown)
2222 if (!QtGuiContext::getQtCurrent()) return;
2223 map<pair<YACS::ENGINE::OutPort*, YACS::ENGINE::InPort*>,YACS::HMI::SubjectLink*>::const_iterator it;
2224 for (it = QtGuiContext::getQtCurrent()->_mapOfSubjectLink.begin();
2225 it != QtGuiContext::getQtCurrent()->_mapOfSubjectLink.end();
2228 YACS::HMI::SubjectLink* sub = (*it).second;
2230 SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sub];
2231 item->setVisible(isShown);
2235 void GenericGui::displayControlLinks(bool isShown)
2237 if (!QtGuiContext::getQtCurrent()) return;
2238 map<pair<YACS::ENGINE::Node*, YACS::ENGINE::Node*>,YACS::HMI::SubjectControlLink*>::const_iterator it;
2239 for (it = QtGuiContext::getQtCurrent()->_mapOfSubjectControlLink.begin();
2240 it != QtGuiContext::getQtCurrent()->_mapOfSubjectControlLink.end();
2243 YACS::HMI::SubjectControlLink* sub = (*it).second;
2245 SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sub];
2246 item->setVisible(isShown);
2250 void GenericGui::displayPortLinks(bool isShown)
2252 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
2253 DEBTRACE("displayPortLinks, subject : " << sub->getName());
2254 SubjectDataPort *sport = dynamic_cast<SubjectDataPort*>(sub);
2257 DEBTRACE("dataPort : " << sport->getName());
2258 list<SubjectLink*> linkList = sport->getListOfSubjectLink();
2259 list<SubjectLink*>::const_iterator it = linkList.begin();
2260 for( ; it != linkList.end(); ++it)
2262 YACS::HMI::SubjectLink* sub = (*it);
2264 SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sub];
2265 item->setVisible(isShown);
2269 SubjectNode *snode = dynamic_cast<SubjectNode*>(sub);
2272 DEBTRACE("Node : " << snode->getName());
2273 list<SubjectControlLink*> linkList = snode->getSubjectControlLinks();
2274 list<SubjectControlLink*>::const_iterator it = linkList.begin();
2275 for( ; it != linkList.end(); ++it)
2277 YACS::HMI::SubjectControlLink* sub = (*it);
2279 SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sub];
2280 item->setVisible(isShown);
2286 void GenericGui::displayALink(bool isShown)
2288 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
2289 if (! QtGuiContext::getQtCurrent()->_mapOfSceneItem.count(sub)) return;
2290 SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sub];
2291 item->setVisible(isShown);
2294 void GenericGui::onShowAllLinks()
2296 DEBTRACE("GenericGui::onShowAllLinks");
2298 displayControlLinks(true);
2301 void GenericGui::onHideAllLinks()
2303 DEBTRACE("GenericGui::onHideAllLinks");
2304 displayLinks(false);
2305 displayControlLinks(false);
2308 void GenericGui::onShowOnlyPortLinks()
2310 DEBTRACE("GenericGui::onShowOnlyPortLinks");
2312 displayPortLinks(true);
2315 void GenericGui::onShowPortLinks()
2317 DEBTRACE("GenericGui::onShowPortLinks");
2318 displayPortLinks(true);
2321 void GenericGui::onHidePortLinks()
2323 DEBTRACE("GenericGui::onHidePortLinks");
2324 displayPortLinks(false);
2327 void GenericGui::onEmphasisPortLinks()
2329 DEBTRACE("GenericGui::onEmphasisPortLinks");
2330 if (!QtGuiContext::getQtCurrent()) return;
2331 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
2332 DEBTRACE("EmphasizePortLinks, subject : " << sub->getName());
2336 SubjectDataPort *sport = dynamic_cast<SubjectDataPort*>(sub);
2339 emphasizePortLink(sport, true);
2343 // --- if a Node, explore all data ports
2345 SubjectNode *snode = dynamic_cast<SubjectNode*>(sub);
2348 DEBTRACE("Node : " << snode->getName());
2350 list<SubjectInputPort*> linkList = snode->getSubjectInputPorts();
2351 list<SubjectInputPort*>::const_iterator it = linkList.begin();
2352 for( ; it != linkList.end(); ++it)
2354 YACS::HMI::SubjectInputPort* sub = (*it);
2356 emphasizePortLink(sub, true);
2360 list<SubjectOutputPort*> linkList = snode->getSubjectOutputPorts();
2361 list<SubjectOutputPort*>::const_iterator it = linkList.begin();
2362 for( ; it != linkList.end(); ++it)
2364 YACS::HMI::SubjectOutputPort* sub = (*it);
2366 emphasizePortLink(sub, true);
2373 void GenericGui::onShowOnlyCtrlLinks()
2375 DEBTRACE("GenericGui::onShowOnlyCtrlLinks");
2377 displayPortLinks(true);
2380 void GenericGui::onShowCtrlLinks()
2382 DEBTRACE("GenericGui::onShowCtrlLinks");
2383 displayPortLinks(true);
2386 void GenericGui::onHideCtrlLinks()
2388 DEBTRACE("GenericGui::onHideCtrlLinks");
2389 displayPortLinks(false);
2392 void GenericGui::onEmphasisCtrlLinks()
2394 DEBTRACE("GenericGui::onEmphasisCtrlLinks");
2395 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
2396 DEBTRACE("Emphasize Ctrl Links, subject : " << sub->getName());
2399 SubjectNode *snode = dynamic_cast<SubjectNode*>(sub);
2402 DEBTRACE("Node : " << snode->getName());
2403 list<SubjectControlLink*> linkList = snode->getSubjectControlLinks();
2404 list<SubjectControlLink*>::const_iterator it = linkList.begin();
2405 for( ; it != linkList.end(); ++it)
2407 YACS::HMI::SubjectControlLink* sub = (*it);
2409 sub->update(EMPHASIZE, true, sub);
2410 Subject *sin = sub->getSubjectInNode();
2411 Subject *sout = sub->getSubjectOutNode();
2412 sin->update(EMPHASIZE, true, sub);
2413 sout->update(EMPHASIZE, true, sub);
2419 void GenericGui::onShowOnlyLink()
2421 DEBTRACE("GenericGui::onShowOnlyLink");
2426 void GenericGui::onShowLink()
2428 DEBTRACE("GenericGui::onShowLink");
2432 void GenericGui::onHideLink()
2434 DEBTRACE("GenericGui::onHideLink");
2435 displayALink(false);
2438 void GenericGui::onEmphasisLink()
2440 DEBTRACE("GenericGui::onEmphasisLink");
2441 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
2444 sub->update(EMPHASIZE, true, sub);
2447 void GenericGui::onDeEmphasizeAll()
2449 DEBTRACE("GenericGui::onDeEmphasizeAll");
2450 map<Subject*, SchemaItem*>::const_iterator it = QtGuiContext::getQtCurrent()->_mapOfSchemaItem.begin();
2451 for( ; it != QtGuiContext::getQtCurrent()->_mapOfSchemaItem.end(); ++it)
2453 Subject* sub = (*it).first;
2454 sub->update(EMPHASIZE, false, sub);
2458 void GenericGui::onUndo()
2460 DEBTRACE("GenericGui::onUndo");
2461 if (QtGuiContext::getQtCurrent()->_setOfModifiedSubjects.empty())
2462 QtGuiContext::getQtCurrent()->getInvoc()->undo();
2463 else Message("undo not possible when there are local modifications not confirmed");
2466 void GenericGui::onRedo()
2468 DEBTRACE("GenericGui::onRedo");
2469 if (QtGuiContext::getQtCurrent()->_setOfModifiedSubjects.empty())
2470 QtGuiContext::getQtCurrent()->getInvoc()->redo();
2471 else Message("redo not possible when there are local modifications not confirmed");
2474 void GenericGui::onShowUndo()
2476 _guiEditor->showUndo(_parent);
2479 void GenericGui::onShowRedo()
2481 _guiEditor->showRedo(_parent);
2484 void GenericGui::onCleanOnExit()
2486 DEBTRACE("GenericGui::onCleanOnExit");
2487 int studyId = _wrapper->activeStudyId();
2488 map<QWidget*, YACS::HMI::QtGuiContext*> mapViewContextCopy = _mapViewContext;
2489 map<QWidget*, YACS::HMI::QtGuiContext*>::iterator it = mapViewContextCopy.begin();
2490 for (; it != mapViewContextCopy.end(); ++it)
2492 closeContext((*it).first, true);
2496 void GenericGui::emphasizePortLink(YACS::HMI::SubjectDataPort* sub, bool emphasize)
2498 DEBTRACE("dataPort : " << sub->getName());
2499 list<SubjectLink*> linkList = sub->getListOfSubjectLink();
2500 list<SubjectLink*>::const_iterator it = linkList.begin();
2501 for( ; it != linkList.end(); ++it)
2503 YACS::HMI::SubjectLink* subli = (*it);
2504 if (!subli) continue;
2505 subli->update(EMPHASIZE, emphasize, sub);
2506 Subject *sin = subli->getSubjectInPort();
2507 Subject *sout = subli->getSubjectOutPort();
2508 sin->update(EMPHASIZE, emphasize, sub);
2509 sout->update(EMPHASIZE, emphasize, sub);
2513 void GenericGui::onHelpContextModule( const QString& theComponentName, const QString& theFileName, const QString& theContext)
2515 _wrapper->onHelpContextModule(theComponentName,theFileName,theContext);