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 _arrangeLocalNodesAct = _wrapper->createAction(getMenuId(), tr("arrange nodes on that bloc level, without recursion"), QIcon("icons:arrange_nodes.png"),
420 tr("arrange local nodes"), tr("arrange nodes on that bloc level, without recursion"),
421 0, _parent, false, this, SLOT(onArrangeLocalNodes()));
423 _arrangeRecurseNodesAct = _wrapper->createAction(getMenuId(), tr("arrange nodes on that bloc level, with recursion"), QIcon("icons:sample.png"),
424 tr("arrange nodes recursion"), tr("arrange nodes on that bloc level, with recursion"),
425 0, _parent, false, this, SLOT(onArrangeRecurseNodes()));
427 _computeLinkAct = _wrapper->createAction(getMenuId(), tr("compute orthogonal links"), QIcon("icons:rebuild_links.png"),
428 tr("compute links"), tr("compute orthogonal links"),
429 0, _parent, false, this, SLOT(onRebuildLinks()));
431 _zoomToBlocAct = _wrapper->createAction(getMenuId(), tr("zoom 2D view to selected bloc"), QIcon("icons:zoomToBloc.png"),
432 tr("zoom to bloc"), tr("zoom 2D view to the selected composed node"),
433 0, _parent, false, this, SLOT(onZoomToBloc()));
435 _centerOnNodeAct = _wrapper->createAction(getMenuId(), tr("center 2D view on selected node"), QIcon("icons:centerOnNode.png"),
436 tr("center on node"), tr("center 2D view on selected node"),
437 0, _parent, false, this, SLOT(onCenterOnNode()));
438 _centerOnNodeAct->setShortcut(QKeySequence::Find);
440 _shrinkExpand = _wrapper->createAction(getMenuId(), tr("shrink or expand the selected node"), QIcon("icons:shrinkExpand.png"),
441 tr("shrink/expand"), tr("shrink or expand the selected node"),
442 0, _parent, false, this, SLOT(onShrinkExpand()));
444 _toggleStraightLinksAct = _wrapper->createAction(getMenuId(), tr("draw straight or orthogonal links"), QIcon("icons:straightLink.png"),
445 tr("straight/orthogonal"), tr("draw straight or orthogonal links"),
446 0, _parent, true, this, SLOT(onToggleStraightLinks(bool)));
448 _toggleStraightLinksAct->setChecked(Resource::straightLinks);
449 onToggleStraightLinks(Resource::straightLinks);
451 _toggleAutomaticComputeLinkAct = _wrapper->createAction(getMenuId(), tr("compute othogonal links automatically when nodes move"), QIcon("icons:autoComputeLink.png"),
452 tr("automatic link"), tr("compute othogonal links automatically when nodes move"),
453 0, _parent, true, this, SLOT(onToggleAutomaticComputeLinks(bool)));
455 _toggleAutomaticComputeLinkAct->setChecked(Resource::autoComputeLinks);
456 onToggleAutomaticComputeLinks(Resource::autoComputeLinks); // Why is this needed ?
458 _toggleSimplifyLinkAct = _wrapper->createAction(getMenuId(), tr("simplify links by removing unnecessary direction changes"), QIcon("icons:simplifyLink.png"),
459 tr("simplify links"), tr("simplify links by removing unnecessary direction changes"),
460 0, _parent, true, this, SLOT(onToggleSimplifyLinks(bool)));
461 _toggleSimplifyLinkAct->setChecked(Resource::simplifyLink);
462 onToggleSimplifyLinks(Resource::simplifyLink);
464 _toggleForce2NodesLinkAct = _wrapper->createAction(getMenuId(), tr("force orthogonal links by adding an edge on simples links"), QIcon("icons:force2nodeLink.png"),
465 tr("force ortho links"), tr("force orthogonal links by adding an edge on simples links"),
466 0, _parent, true, this, SLOT(onToggleForce2NodesLinks(bool)));
467 _toggleForce2NodesLinkAct->setChecked(true);
469 _toggleAddRowColsAct = _wrapper->createAction(getMenuId(), tr("allow more path for the links, for a better separation"), QIcon("icons:addRowCols.png"),
470 tr("separate links"), tr("allow more path for the links, for a better separation"),
471 0, _parent, true, this, SLOT(onToggleAddRowCols(bool)));
472 _toggleAddRowColsAct->setChecked(Resource::addRowCols);
473 onToggleAddRowCols(Resource::addRowCols);
475 _selectReferenceAct = _wrapper->createAction(getMenuId(), tr("select reference"), QIcon("icons:ob_service_node.png"),
476 tr("select reference"), tr("select reference"),
477 0, _parent, false, this, SLOT(onSelectReference()));
479 _whatsThisAct = _wrapper->createAction(getMenuId(), tr("active whatsThis Mode to get help on widgets"), QIcon("icons:whatsThis.png"),
480 tr("whatsThis Mode"), tr("active whatsThis Mode to get help on widgets"),
481 0, _parent, false, this, SLOT(onWhatsThis()));
482 _whatsThisAct->setShortcut(QKeySequence::WhatsThis);
484 _withoutStopModeAct = _wrapper->createAction(getMenuId(), tr("set execution mode without stop"), QIcon("icons:run_active.png"),
485 tr("mode without stop"), tr("set execution mode without stop"),
486 0, _parent, true, this, SLOT(onWithoutStopMode(bool)));
488 _breakpointsModeAct = _wrapper->createAction(getMenuId(), tr("set execution mode with stop on breakpoints"), QIcon("icons:breakpoints_active.png"),
489 tr("mode breakpoints"), tr("set execution mode with stop on breakpoints"),
490 0, _parent, true, this, SLOT(onBreakpointsMode(bool)));
492 _stepByStepModeAct = _wrapper->createAction(getMenuId(), tr("set execution mode step by step"), QIcon("icons:step_by_step_active.png"),
493 tr("mode step by step"), tr("set execution mode step by step"),
494 0, _parent, true, this, SLOT(onStepByStepMode(bool)));
496 _toggleStopOnErrorAct = _wrapper->createAction(getMenuId(), tr("Force stop on first error during execution"), QIcon("icons:toggle_stop_on_error.png"),
497 tr("stop on error"), tr("Force stop on first error during execution"),
498 0, _parent, true, this, SLOT(onToggleStopOnError(bool)));
500 _toggleSceneItemVisibleAct = _wrapper->createAction(getMenuId(), tr("toggle 2D scene item visibility"), QIcon("icons:toggleVisibility.png"),
501 tr("visible/hidden"), tr("toggle 2D scene item visibility"),
502 0, _parent, true, this, SLOT(onToggleSceneItemVisible(bool)));
506 _showAllLinksAct = _wrapper->createAction(getMenuId(), tr("Show all the links"), QIcon("icons:showLink.png"),
507 tr("show all links"), tr("Show all the links"),
508 0, _parent, false, this, SLOT(onShowAllLinks()));
510 _hideAllLinksAct = _wrapper->createAction(getMenuId(), tr("Hide all the links"), QIcon("icons:hideLink.png"),
511 tr("hide all links"), tr("Hide all the links"),
512 0, _parent, false, this, SLOT(onHideAllLinks()));
515 _showOnlyPortLinksAct = _wrapper->createAction(getMenuId(), tr("Show only links from/to this port"), QIcon("icons:showLink.png"),
516 tr("show only links"), tr("Show only links from/to this port"),
517 0, _parent, false, this, SLOT(onShowOnlyPortLinks()));
519 _showPortLinksAct = _wrapper->createAction(getMenuId(), tr("Show links from/to this port"), QIcon("icons:showLink.png"),
520 tr("show links"), tr("Show links from/to this port"),
521 0, _parent, false, this, SLOT(onShowPortLinks()));
523 _hidePortLinksAct = _wrapper->createAction(getMenuId(), tr("Hide links from/to this port"), QIcon("icons:hideLink.png"),
524 tr("hide links"), tr("Hide links from/to this port"),
525 0, _parent, false, this, SLOT(onHidePortLinks()));
528 _showOnlyCtrlLinksAct = _wrapper->createAction(getMenuId(), tr("Show only control links from/to this node"), QIcon("icons:showLink.png"),
529 tr("show only Control links"), tr("Show only control links from/to this node"),
530 0, _parent, false, this, SLOT(onShowOnlyCtrlLinks()));
532 _showCtrlLinksAct = _wrapper->createAction(getMenuId(), tr("Show control links from/to this node"), QIcon("icons:showLink.png"),
533 tr("show control links"), tr("Show control links from/to this node"),
534 0, _parent, false, this, SLOT(onShowCtrlLinks()));
536 _hideCtrlLinksAct = _wrapper->createAction(getMenuId(), tr("Hide control links from/to this node"), QIcon("icons:hideLink.png"),
537 tr("hide control links"), tr("Hide control links from/to this node"),
538 0, _parent, false, this, SLOT(onHideCtrlLinks()));
541 _showOnlyLinkAct = _wrapper->createAction(getMenuId(), tr("Show only this link"), QIcon("icons:showLink.png"),
542 tr("show only"), tr("Show only this link"),
543 0, _parent, false, this, SLOT(onShowOnlyLink()));
545 _showLinkAct = _wrapper->createAction(getMenuId(), tr("Show this link"), QIcon("icons:showLink.png"),
546 tr("show"), tr("Show this link"),
547 0, _parent, false, this, SLOT(onShowLink()));
549 _hideLinkAct = _wrapper->createAction(getMenuId(), tr("Hide this link"), QIcon("icons:hideLink.png"),
550 tr("hide"), tr("Hide this link"),
551 0, _parent, false, this, SLOT(onHideLink()));
554 _emphasisPortLinksAct = _wrapper->createAction(getMenuId(), tr("emphasis on links from/to this port"), QIcon("icons:emphasisLink.png"),
555 tr("emphasize links"), tr("emphasis on links from/to this port"),
556 0, _parent, false, this, SLOT(onEmphasisPortLinks()));
558 _emphasisCtrlLinksAct = _wrapper->createAction(getMenuId(), tr("emphasis on control links from/to this node"), QIcon("icons:emphasisLink.png"),
559 tr("emphasize control links"), tr("emphasis on control links from/to this node"),
560 0, _parent, false, this, SLOT(onEmphasisCtrlLinks()));
562 _emphasisLinkAct = _wrapper->createAction(getMenuId(), tr("emphasis on this link"), QIcon("icons:emphasisLink.png"),
563 tr("emphasize"), tr("emphasis on this link"),
564 0, _parent, false, this, SLOT(onEmphasisLink()));
566 _deEmphasizeAllAct = _wrapper->createAction(getMenuId(), tr("remove all emphasis"), QIcon("icons:deEmphasisLink.png"),
567 tr("remove all emphasis"), tr("remove all emphasis"),
568 0, _parent, false, this, SLOT(onDeEmphasizeAll()));
571 _undoAct = _wrapper->createAction(getMenuId(), tr("undo last action"), QIcon("icons:undo.png"),
572 tr("undo"), tr("undo last action"),
573 0, _parent, false, this, SLOT(onUndo()));
574 _undoAct->setShortcut(QKeySequence::Undo);
576 _redoAct = _wrapper->createAction(getMenuId(), tr("redo last action"), QIcon("icons:redo.png"),
577 tr("redo"), tr("redo last action"),
578 0, _parent, false, this, SLOT(onRedo()));
579 _redoAct->setShortcut(QKeySequence::Redo);
581 _showUndoAct = _wrapper->createAction(getMenuId(), tr("show undo commands"), QIcon("icons:undo.png"),
582 tr("show undo"), tr("show undo commands"),
583 0, _parent, false, this, SLOT(onShowUndo()));
585 _showRedoAct = _wrapper->createAction(getMenuId(), tr("show redo commands"), QIcon("icons:redo.png"),
586 tr("show redo"), tr("show redo commands"),
587 0, _parent, false, this, SLOT(onShowRedo()));
590 _execModeGroup = new QActionGroup(this);
591 _execModeGroup->addAction(_withoutStopModeAct);
592 _execModeGroup->addAction(_breakpointsModeAct);
593 _execModeGroup->addAction(_stepByStepModeAct);
594 _withoutStopModeAct->setChecked(true);
597 void GenericGui::createMenus()
600 aMenuId = _wrapper->createMenu( tr( "File" ), -1, -1 );
601 _wrapper->createMenu( _wrapper->separator(), aMenuId, -1, 10 );
602 aMenuId = _wrapper->createMenu( "YACS", aMenuId, -1, 10 );
603 _wrapper->createMenu( _newSchemaAct, aMenuId );
604 _wrapper->createMenu( _importSchemaAct, aMenuId );
606 aMenuId = _wrapper->createMenu( "YACS", -1, -1, 30 );
607 _wrapper->createMenu( _newSchemaAct, aMenuId );//, 10
608 _wrapper->createMenu( _importSchemaAct, aMenuId );
609 _wrapper->createMenu( _importSupervSchemaAct, aMenuId );
610 _wrapper->createMenu( _wrapper->separator(), aMenuId);
611 _wrapper->createMenu( _exportSchemaAct, aMenuId );
612 _wrapper->createMenu( _exportSchemaAsAct, aMenuId );
613 _wrapper->createMenu( _wrapper->separator(), aMenuId);
614 _wrapper->createMenu( _runLoadedSchemaAct, aMenuId );
615 _wrapper->createMenu( _loadRunStateSchemaAct, aMenuId );
616 _wrapper->createMenu( _loadAndRunSchemaAct, aMenuId );
617 _wrapper->createMenu( _chooseBatchJobAct, aMenuId );
618 _wrapper->createMenu( _wrapper->separator(), aMenuId);
619 _wrapper->createMenu( _undoAct, aMenuId );
620 _wrapper->createMenu( _redoAct, aMenuId );
621 _wrapper->createMenu( _showUndoAct, aMenuId );
622 _wrapper->createMenu( _showRedoAct, aMenuId );
623 _wrapper->createMenu( _wrapper->separator(), aMenuId);
624 _wrapper->createMenu( _startResumeAct, aMenuId );
625 _wrapper->createMenu( _abortAct, aMenuId );
626 _wrapper->createMenu( _pauseAct, aMenuId );
627 _wrapper->createMenu( _resetAct, aMenuId );
628 _wrapper->createMenu( _wrapper->separator(), aMenuId);
629 _wrapper->createMenu( _saveRunStateAct, aMenuId );
630 //_wrapper->createMenu( _newEditionAct, aMenuId );
631 _wrapper->createMenu( _wrapper->separator(), aMenuId);
632 _wrapper->createMenu( _withoutStopModeAct, aMenuId );
633 _wrapper->createMenu( _breakpointsModeAct, aMenuId );
634 _wrapper->createMenu( _stepByStepModeAct, aMenuId );
635 _wrapper->createMenu( _wrapper->separator(), aMenuId);
636 _wrapper->createMenu( _toggleStopOnErrorAct, aMenuId );
637 _wrapper->createMenu( _wrapper->separator(), aMenuId);
638 _wrapper->createMenu( _importCatalogAct, aMenuId );
639 _wrapper->createMenu( _wrapper->separator(), aMenuId);
640 _wrapper->createMenu( _toggleStraightLinksAct, aMenuId );
641 _wrapper->createMenu( _toggleAutomaticComputeLinkAct, aMenuId );
642 _wrapper->createMenu( _toggleSimplifyLinkAct, aMenuId );
643 _wrapper->createMenu( _toggleForce2NodesLinkAct, aMenuId );
644 _wrapper->createMenu( _toggleAddRowColsAct, aMenuId );
645 _wrapper->createMenu( _wrapper->separator(), aMenuId);
646 _wrapper->createMenu( _showAllLinksAct, aMenuId );
647 _wrapper->createMenu( _hideAllLinksAct, aMenuId );
648 _wrapper->createMenu( _wrapper->separator(), aMenuId);
649 _wrapper->createMenu( _whatsThisAct, aMenuId );
652 void GenericGui::createTools()
654 int aToolId = _wrapper->createTool ( tr( "YACS Toolbar" ) );
655 _wrapper->createTool( _newSchemaAct, aToolId );
656 _wrapper->createTool( _importSchemaAct, aToolId );
657 _wrapper->createTool( _wrapper->separator(), aToolId );
658 _wrapper->createTool( _exportSchemaAct, aToolId );
659 _wrapper->createTool( _exportSchemaAsAct, aToolId );
660 _wrapper->createTool( _wrapper->separator(), aToolId);
661 _wrapper->createTool( _runLoadedSchemaAct, aToolId );
662 _wrapper->createTool( _loadRunStateSchemaAct, aToolId );
663 _wrapper->createTool( _loadAndRunSchemaAct, aToolId );
664 _wrapper->createTool( _chooseBatchJobAct, aToolId );
665 _wrapper->createTool( _wrapper->separator(), aToolId );
666 _wrapper->createTool( _undoAct, aToolId );
667 _wrapper->createTool( _redoAct, aToolId );
668 _wrapper->createTool( _wrapper->separator(), aToolId );
669 _wrapper->createTool( _startResumeAct, aToolId );
670 _wrapper->createTool( _abortAct, aToolId );
671 _wrapper->createTool( _pauseAct, aToolId );
672 _wrapper->createTool( _resetAct, aToolId );
673 _wrapper->createTool( _wrapper->separator(), aToolId );
674 _wrapper->createTool( _saveRunStateAct, aToolId );
675 //_wrapper->createTool( _newEditionAct, aToolId );
676 _wrapper->createTool( _withoutStopModeAct, aToolId );
677 _wrapper->createTool( _breakpointsModeAct, aToolId );
678 _wrapper->createTool( _stepByStepModeAct, aToolId );
679 _wrapper->createTool( _wrapper->separator(), aToolId );
680 _wrapper->createTool( _toggleStopOnErrorAct, aToolId );
681 _wrapper->createTool( _wrapper->separator(), aToolId );
682 _wrapper->createTool( _importCatalogAct, aToolId );
683 _wrapper->createTool( _wrapper->separator(), aToolId );
684 _wrapper->createTool( _toggleStraightLinksAct, aToolId );
685 _wrapper->createTool( _toggleAutomaticComputeLinkAct, aToolId );
686 _wrapper->createTool( _toggleSimplifyLinkAct, aToolId );
687 //_wrapper->createTool( _toggleForce2NodesLinkAct, aToolId );
688 _wrapper->createTool( _toggleAddRowColsAct, aToolId );
689 _wrapper->createTool( _wrapper->separator(), aToolId );
690 _wrapper->createTool( _showAllLinksAct, aToolId );
691 _wrapper->createTool( _hideAllLinksAct, aToolId );
692 _wrapper->createTool( _wrapper->separator(), aToolId );
693 _wrapper->createTool( _whatsThisAct, aToolId );
696 void GenericGui::initialMenus()
698 showEditionMenus(false);
699 showExecMenus(false);
700 showCommonMenus(false);
704 void GenericGui::showBaseMenus(bool show)
706 DEBTRACE("GenericGui::showBaseMenus " << show);
707 _wrapper->setMenuShown(_newSchemaAct, show);
708 _wrapper->setToolShown(_newSchemaAct, show);
709 _wrapper->setMenuShown(_importSchemaAct, show);
710 _wrapper->setToolShown(_importSchemaAct, show);
711 _wrapper->setMenuShown(_importSupervSchemaAct, show);
712 _wrapper->setMenuShown(_loadAndRunSchemaAct, show);
713 _wrapper->setToolShown(_loadAndRunSchemaAct, show);
714 _wrapper->setMenuShown(_chooseBatchJobAct, show);
715 _wrapper->setToolShown(_chooseBatchJobAct, show);
716 _wrapper->setMenuShown(_whatsThisAct, show);
717 _wrapper->setToolShown(_whatsThisAct, show);
720 void GenericGui::showEditionMenus(bool show)
722 DEBTRACE("GenericGui::showEditionMenus " << show);
723 _wrapper->setMenuShown(_exportSchemaAct, show);
724 _wrapper->setToolShown(_exportSchemaAct, show);
725 _wrapper->setMenuShown(_exportSchemaAsAct, show);
726 _wrapper->setToolShown(_exportSchemaAsAct, show);
727 _wrapper->setMenuShown(_runLoadedSchemaAct, show);
728 _wrapper->setToolShown(_loadRunStateSchemaAct, show);
729 _wrapper->setMenuShown(_loadRunStateSchemaAct, show);
730 _wrapper->setToolShown(_runLoadedSchemaAct, show);
731 _wrapper->setMenuShown(_undoAct, show);
732 _wrapper->setToolShown(_undoAct, show);
733 _wrapper->setMenuShown(_redoAct, show);
734 _wrapper->setToolShown(_redoAct, show);
735 _wrapper->setMenuShown(_showUndoAct, show);
736 _wrapper->setMenuShown(_showRedoAct, show);
737 _wrapper->setMenuShown(_importCatalogAct, show);
738 _wrapper->setToolShown(_importCatalogAct, show);
741 void GenericGui::showExecMenus(bool show)
743 DEBTRACE("GenericGui::showExecMenus " << show);
744 _wrapper->setMenuShown(_startResumeAct, show);
745 _wrapper->setToolShown(_startResumeAct, show);
746 _wrapper->setMenuShown(_abortAct, show);
747 _wrapper->setToolShown(_abortAct, show);
748 _wrapper->setMenuShown(_pauseAct, show);
749 _wrapper->setToolShown(_pauseAct, show);
750 _wrapper->setMenuShown(_resetAct, show);
751 _wrapper->setToolShown(_resetAct, show);
752 _wrapper->setMenuShown(_saveRunStateAct, show);
753 _wrapper->setToolShown(_saveRunStateAct, show);
754 //_wrapper->setMenuShown(_newEditionAct, show);
755 //_wrapper->setToolShown(_newEditionAct, show);
756 _wrapper->setMenuShown(_withoutStopModeAct, show);
757 _wrapper->setToolShown(_withoutStopModeAct, show);
758 _wrapper->setMenuShown(_breakpointsModeAct, show);
759 _wrapper->setToolShown(_breakpointsModeAct, show);
760 _wrapper->setMenuShown(_stepByStepModeAct, show);
761 _wrapper->setToolShown(_stepByStepModeAct, show);
762 _wrapper->setMenuShown(_toggleStopOnErrorAct, show);
763 _wrapper->setToolShown(_toggleStopOnErrorAct, show);
766 void GenericGui::showCommonMenus(bool show)
768 DEBTRACE("GenericGui::showCommonMenus " << show);
769 _wrapper->setMenuShown(_toggleStraightLinksAct, show);
770 _wrapper->setToolShown(_toggleStraightLinksAct, show);
771 _wrapper->setMenuShown(_toggleAutomaticComputeLinkAct, show);
772 _wrapper->setToolShown(_toggleAutomaticComputeLinkAct, show);
773 _wrapper->setMenuShown(_toggleSimplifyLinkAct, show);
774 _wrapper->setToolShown(_toggleSimplifyLinkAct, show);
775 _wrapper->setMenuShown(_toggleForce2NodesLinkAct, show);
776 //_wrapper->setToolShown(_toggleForce2NodesLinkAct, show);
777 _wrapper->setMenuShown(_toggleAddRowColsAct, show);
778 _wrapper->setToolShown(_toggleAddRowColsAct, show);
779 _wrapper->setMenuShown(_showAllLinksAct, show);
780 _wrapper->setToolShown(_showAllLinksAct, show);
781 _wrapper->setMenuShown(_hideAllLinksAct, show);
782 _wrapper->setToolShown(_hideAllLinksAct, show);
785 void GenericGui::switchContext(QWidget *view)
787 DEBTRACE("GenericGui::switchContext " << view);
788 if (! _mapViewContext.count(view))
791 _dwTree->setWidget(0);
792 _dwStacked->setWidget(0);
795 QtGuiContext* newContext = _mapViewContext[view];
797 _dwTree->setWidget(newContext->getEditTree());
798 _dwTree->widget()->show();
800 _dwStacked->setWidget(newContext->getStackedWidget());
802 QtGuiContext::setQtCurrent(newContext);
804 if (newContext->isEdition())
806 showExecMenus(false);
808 showEditionMenus(true);
809 showCommonMenus(true);
810 if (_dwTree) _dwTree->setWindowTitle("Tree View: edition mode");
814 showEditionMenus(false);
817 showCommonMenus(true);
818 _withoutStopModeAct->setChecked(true);
819 if (_dwTree) _dwTree->setWindowTitle("Tree View: execution mode");
821 _dwStacked->setMinimumWidth(10);
824 bool GenericGui::closeContext(QWidget *view, bool onExit)
826 DEBTRACE("GenericGui::closeContext " << onExit);
827 if (! _mapViewContext.count(view))
829 QtGuiContext* context = _mapViewContext[view];
832 bool tryToSave = false;
834 if (QtGuiContext::getQtCurrent()->isEdition())
836 if (!QtGuiContext::getQtCurrent()->_setOfModifiedSubjects.empty())
839 msgBox.setText("Some elements are modified and not taken into account.");
840 string info = "do you want to apply your changes ?\n";
841 info += " - Save : do not take into account edition in progress,\n";
842 info += " but if there are other modifications, select a file name for save\n";
843 info += " - Discard : discard all modifications and close the schema";
845 info += "\n - Cancel : do not close the schema, return to edition";
846 msgBox.setInformativeText(info.c_str());
849 msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
850 msgBox.setDefaultButton(QMessageBox::Cancel);
854 msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard);
855 msgBox.setDefaultButton(QMessageBox::Save);
857 int ret = msgBox.exec();
860 case QMessageBox::Save:
863 case QMessageBox::Discard:
866 case QMessageBox::Cancel:
868 DEBTRACE("Cancel or default");
874 if (QtGuiContext::getQtCurrent()->isNotSaved())
877 msgBox.setWindowTitle("Close the active schema");
878 msgBox.setText("The schema has been modified");
879 string info = "do you want to save the schema ?\n";
880 info += " - Save : select a file name for save\n";
881 info += " - Discard : discard all modifications and close the schema";
883 info += "\n - Cancel : do not close the schema, return to edition";
884 msgBox.setInformativeText(info.c_str());
887 msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
888 msgBox.setDefaultButton(QMessageBox::Cancel);
892 msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard);
893 msgBox.setDefaultButton(QMessageBox::Save);
895 int ret = msgBox.exec();
898 case QMessageBox::Save:
901 case QMessageBox::Discard:
904 case QMessageBox::Cancel:
905 DEBTRACE("Cancel or default");
915 if ((!onExit) && (!_isSaved)) // --- probably, user has cancelled the save dialog. Do not close
920 map<QWidget*, YACS::HMI::QtGuiContext*>::iterator it = _mapViewContext.begin();
921 QtGuiContext* newContext = 0;
922 QWidget* newView = 0;
923 for (; it != _mapViewContext.end(); ++it)
925 if ((*it).second != context)
927 newView = (*it).first;
928 newContext = (*it).second;
932 int studyId = _wrapper->activeStudyId();
933 if (context->getStudyId() == studyId)
935 _wrapper->deleteSchema(view);
936 DEBTRACE("delete context");
937 if (GuiExecutor* exec = context->getGuiExecutor())
939 exec->closeContext();
942 _mapViewContext.erase(view);
943 switchContext(newView);
948 void GenericGui::showDockWidgets(bool isVisible)
950 DEBTRACE("GenericGui::showDockWidgets " << isVisible);
951 if (_dwTree) _dwTree->setVisible(isVisible);
952 if (_dwTree) _dwTree->toggleViewAction()->setVisible(isVisible);
953 if (_dwStacked) _dwStacked->setVisible(isVisible);
954 if (_dwStacked) _dwStacked->toggleViewAction()->setVisible(isVisible);
955 if (_dwCatalogs) _dwCatalogs->setVisible(isVisible);
956 if (_dwCatalogs) _dwCatalogs->toggleViewAction()->setVisible(isVisible);
959 void GenericGui::raiseStacked()
961 if (_dwStacked) _dwStacked->raise();
964 std::list<std::string> GenericGui::getMachineList()
966 if (!_machineList.empty()) return _machineList;
968 YACS::ENGINE::RuntimeSALOME* runTime = YACS::ENGINE::getSALOMERuntime();
969 CORBA::ORB_ptr orb = runTime->getOrb();
970 if (!orb) return _machineList;
972 SALOME_NamingService namingService(orb);
973 SALOME_LifeCycleCORBA lcc(&namingService);
975 CORBA::Object_var obj =
976 namingService.Resolve(SALOME_ResourcesManager::_ResourcesManagerNameInNS);
977 if (CORBA::is_nil(obj)) return _machineList;
979 Engines::ResourcesManager_var resManager = Engines::ResourcesManager::_narrow(obj);
980 if(!resManager) return _machineList;
982 Engines::ResourceParameters params;
985 Engines::ResourceList* resourceList =
986 resManager->GetFittingResources(params);
988 for (int i = 0; i < resourceList->length(); i++)
990 const char* aResource = (*resourceList)[i];
991 _machineList.push_back(aResource);
997 // -----------------------------------------------------------------------------
999 /*! a QtGuiContext instance is created for each schema in edition or each execution or run
1000 * of a schema. The context stores references of a lot of objects related to the edition
1002 * \param proc the schema to run or edit, loaded from file or just created empty.
1003 * \param schemaName filename of the schema in edition, also used in execution to publish
1004 * a run under the edition name in Salome object browser.
1005 * \param runName filename of the schema in execution, not used in edition.
1006 * \param forEdition if true, edition mode, if false, execution mode.
1008 void GenericGui::createContext(YACS::ENGINE::Proc* proc,
1009 const QString& schemaName,
1010 const QString& runName,
1013 DEBTRACE("GenericGui::createContext");
1019 QWidget* central = _parent->centralWidget();
1021 central->setFocus();
1023 DEBTRACE("No Central Widget");
1026 QWidget* refWindow = 0; // --- used only on run to refer to the schema in edition
1029 fileName = schemaName;
1034 if (QtGuiContext::getQtCurrent())
1035 refWindow = QtGuiContext::getQtCurrent()->getWindow();
1038 QtGuiContext* context = new QtGuiContext(this);
1039 QtGuiContext::setQtCurrent(context);
1043 context->setEdition(forEdition);
1044 context->setSessionCatalog(_sessionCatalog);
1045 context->setFileName(fileName);
1046 context->setCurrentCatalog(_builtinCatalog);
1048 // --- scene, viewWindow & GraphicsView
1050 Scene *scene = new Scene();
1051 QWidget *viewWindow = _wrapper->getNewWindow(scene);
1052 _mapViewContext[viewWindow] = context;
1053 GraphicsView* gView = new GraphicsView(viewWindow);
1054 gView->setScene(scene);
1055 gView->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
1056 int studyId = _wrapper->AssociateViewToWindow(gView, viewWindow);
1057 context->setStudyId(studyId);
1058 std::ostringstream value;
1060 proc->setProperty("DefaultStudyID",value.str());
1061 context->setScene(scene);
1062 context->setView(gView);
1063 context->setWindow(viewWindow);
1068 SchemaModel *schemaModel = new SchemaModel(context, viewWindow);
1069 schemaModel->setEdition(forEdition);
1070 context->setSchemaModel(schemaModel);
1071 RootSceneItem *rootSceneItem = new RootSceneItem(context);
1073 // --- tree associated to model
1075 FormEditTree *editTree = new FormEditTree(_dwTree);
1076 editTree->setMinimumHeight(400);
1077 _dwTree->setWidget(editTree);
1079 context->setEditTree(editTree);
1080 editTree->tv_schema->setModel(schemaModel);
1081 context->setSelectionModel(editTree->tv_schema->selectionModel());
1084 QObject::connect(editTree->tv_schema->selectionModel(),
1085 SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
1087 SLOT(updateSelection(const QItemSelection &, const QItemSelection &)));
1089 // --- stacked widget
1091 QStackedWidget *stacked = new QStackedWidget(_dwStacked);
1092 _dwStacked->setWidget(stacked);
1093 context->setStackedWidget(stacked);
1094 YACS::HMI::ItemEditionRoot* rootEdit = new YACS::HMI::ItemEditionRoot(context,
1096 context->getName().c_str());
1097 context->setEditionRoot(rootEdit);
1099 QObject::connect(schemaModel,
1100 SIGNAL(signalSelection(const QModelIndex &)),
1101 editTree->tv_schema,
1102 SLOT(viewSelection(const QModelIndex &)));
1106 proc->setEdition(forEdition);
1110 double passe = (end_t -start_t);
1111 passe = passe/CLOCKS_PER_SEC;
1112 DEBTRACE("create context -1- : " << passe);
1116 context->setLoading(true);
1118 context->setProc(proc);
1119 setLoadedPresentation(proc);
1123 double passe = (end_t -start_t);
1124 passe = passe/CLOCKS_PER_SEC;
1125 DEBTRACE("create context - load proc- : " << passe);
1129 context->setLoading(false);
1131 if (forEdition && _wrapper) // --- Edition mode
1133 _wrapper->createNewSchema(fileName, viewWindow);
1135 else if (_wrapper) // --- Execution Mode
1137 GuiExecutor *guiExec = new GuiExecutor(proc);
1138 context->setGuiExecutor(guiExec);
1139 _wrapper->createNewRun(schemaName, fileName, refWindow, viewWindow);
1143 QtGuiContext::getQtCurrent()->getSubjectProc()->update(UPDATE,
1144 ProcInvoc::getTypeOfNode(proc),
1145 0); // --- force validity check
1147 // --- adjust widgets
1149 TreeView *vtree = dynamic_cast<TreeView*>(editTree->tv_schema);
1151 vtree->resizeColumns();
1152 _catalogsWidget->setMinimumWidth(10); // --- reset the constraint on width
1153 editTree->setMinimumHeight(40);
1154 _dwStacked->setMinimumWidth(10);
1159 showExecMenus(false);
1160 showEditionMenus(true);
1161 showCommonMenus(true);
1162 if (_dwTree) _dwTree->setWindowTitle("Tree View: edition mode");
1166 showEditionMenus(false);
1167 showExecMenus(true);
1168 showCommonMenus(true);
1169 _withoutStopModeAct->setChecked(true);
1170 if (_dwTree) _dwTree->setWindowTitle("Tree View: execution mode");
1173 QtGuiContext::getQtCurrent()->setNotSaved(false);
1176 double passe = (end_t -start_t);
1177 passe = passe/CLOCKS_PER_SEC;
1178 DEBTRACE("create context - end - : " << passe);
1183 // -----------------------------------------------------------------------------
1185 void GenericGui::setLoadedPresentation(YACS::ENGINE::Proc* proc)
1187 DEBTRACE("GenericGui::setLoadedPresentation");
1188 QtGuiContext::getQtCurrent()->setLoadingPresentation(true);
1189 map<YACS::ENGINE::Node*, PrsData> presNodes = _loader->getPrsData(proc);
1190 if (!presNodes.empty())
1192 map<YACS::ENGINE::Node*, PrsData>::iterator it = presNodes.begin();
1193 for (; it!= presNodes.end(); ++it)
1195 YACS::ENGINE::Node* node = (*it).first;
1196 PrsData pres = (*it).second;
1197 SubjectNode *snode = QtGuiContext::getQtCurrent()->_mapOfSubjectNode[node];
1198 SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[snode];
1200 SceneNodeItem *inode = dynamic_cast<SceneNodeItem*>(item);
1202 inode->setPos(QPointF(pres._x, pres._y));
1203 inode->setWidth(pres._width);
1204 inode->setHeight(pres._height);
1205 inode->setExpanded(pres._expanded);
1206 inode->setExpandedPos(QPointF(pres._expx, pres._expy));
1207 inode->setExpandedWH(pres._expWidth, pres._expHeight);
1208 inode->setShownState(shownState(pres._shownState));
1211 if (Scene::_autoComputeLinks)
1212 _guiEditor->rebuildLinks();
1215 YACS::HMI::SubjectProc* subproc = QtGuiContext::getQtCurrent()->getSubjectProc();
1216 SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[subproc];
1217 SceneComposedNodeItem *proc = dynamic_cast<SceneComposedNodeItem*>(item);
1218 proc->updateLinks();
1221 QtGuiContext::getQtCurrent()->setLoadingPresentation(false);
1224 // -----------------------------------------------------------------------------
1226 void GenericGui::onNewSchema()
1228 DEBTRACE("GenericGui::onNewSchema");
1230 std::stringstream name;
1231 name << "newSchema_" << ++_schemaCnt;
1233 YACS::ENGINE::RuntimeSALOME* runTime = YACS::ENGINE::getSALOMERuntime();
1234 YACS::ENGINE::Proc *proc = runTime->createProc(name.str());
1238 QString fileName = name.str().c_str();
1239 createContext(proc, fileName, "", true);
1242 void GenericGui::loadSchema(const std::string& filename,bool edit, bool arrangeLocalNodes)
1244 YACS::ENGINE::Proc *proc = _loader->load(filename.c_str());
1247 YACS::ENGINE::Logger* logger= proc->getLogger("parser");
1248 if(!logger->isEmpty())
1250 DEBTRACE(logger->getStr());
1252 QString fn=QString::fromStdString(filename);
1254 createContext(proc, fn, "", true);
1256 createContext(proc, fn, fn, false);
1257 if (arrangeLocalNodes)
1259 _guiEditor->arrangeProc();
1263 void GenericGui::onImportSchema()
1268 DEBTRACE("GenericGui::onImportSchema");
1269 QFileDialog dialog(_parent,
1270 "Choose a filename to load" ,
1272 tr( "XML-Files (*.xml);;All Files (*)" ));
1274 dialog.setHistory(_wrapper->getQuickDirList());
1277 QStringList fileNames;
1280 fileNames = dialog.selectedFiles();
1281 if (!fileNames.isEmpty())
1282 fn = fileNames.first();
1285 if ( !fn.isEmpty() )
1287 // add ".xml" suffix
1289 if (!fi.exists() && fi.suffix() != "xml")
1292 DEBTRACE("file loaded : " <<fn.toStdString());
1293 YACS::ENGINE::Proc *proc = 0;
1296 proc = _loader->load(fn.toLatin1());
1303 double passe = (end_t -start_t);
1304 passe = passe/CLOCKS_PER_SEC;
1305 DEBTRACE("load xml file : " << passe);
1311 QMessageBox msgBox(QMessageBox::Critical,
1312 "Import YACS Schema, native YACS XML format",
1313 "The file has not the native YACS XML format or is not readable.");
1317 YACS::ENGINE::Logger* logger= proc->getLogger("parser");
1318 if(!logger->isEmpty())
1320 DEBTRACE(logger->getStr());
1322 createContext(proc, fn, "", true);
1326 void GenericGui::onImportSupervSchema()
1328 DEBTRACE("GenericGui::onImportSupervSchema");
1329 QFileDialog dialog(_parent,
1330 "Choose a SUPERV filename to load" ,
1332 tr( "XML-Files (*.xml);;All Files (*)" ));
1334 dialog.setHistory(_wrapper->getQuickDirList());
1337 QStringList fileNames;
1340 fileNames = dialog.selectedFiles();
1341 if (!fileNames.isEmpty())
1342 fn = fileNames.first();
1345 if (fn.isEmpty()) return;
1347 // add ".xml" suffix
1349 if (!fi.exists() && fi.suffix() != "xml")
1352 DEBTRACE("file loaded : " <<fn.toStdString());
1353 QString tmpFileName;
1357 QString tmpDir = getenv("TEMP");
1358 QString fileExt = "bat";
1360 QString tmpDir = "/tmp";
1361 QString fileExt = "sh";
1363 QDir aTmpDir(tmpDir);
1364 aTmpDir.mkdir(QString("YACS_") + getenv("USER"));
1365 YASSERT(aTmpDir.cd(QString("YACS_") + getenv("USER")));
1366 QDateTime curTime = QDateTime::currentDateTime();
1367 tmpFileName = "SUPERV_import_" + curTime.toString("yyyyMMdd_hhmmss") + ".xml";
1368 QString tmpOutput = "salomeloader_output";
1369 tmpFileName = aTmpDir.absoluteFilePath(tmpFileName);
1370 DEBTRACE(tmpFileName.toStdString());
1372 QString aCall = "salomeloader."+ fileExt+ " "+ fn + " " + tmpFileName + " > " + tmpOutput;
1373 DEBTRACE(aCall.toStdString());
1375 int ret = system(aCall.toAscii());
1378 // --- read file with logs
1379 fstream f(tmpOutput.toAscii());
1384 // --- Problem in execution
1385 int status=WEXITSTATUS(ret);
1388 QString mes = "Problems in conversion: some errors but an incomplete proc has nevertheless been created.\n\n";
1389 mes += QString(hfile.str().c_str());
1390 QMessageBox msgBox(QMessageBox::Warning,
1391 "Import YACS Schema, SUPERV XML format",
1395 else if(status == 2)
1397 QString mes = "Problems in conversion: a fatal error has been encountered. The proc can't be created.\n\n";
1398 mes += QString(hfile.str().c_str());
1399 QMessageBox msgBox(QMessageBox::Critical,
1400 "Import YACS Schema, SUPERV XML format",
1407 DEBTRACE("Unknown problem: " << ret );
1408 QMessageBox msgBox(QMessageBox::Critical,
1409 "Import YACS Schema, SUPERV XML format",
1410 "Unexpected exception in salomeloader.");
1418 QMessageBox msgBox(QMessageBox::Critical,
1419 "Import YACS Schema, SUPERV XML format",
1420 "Unexpected exception in convertSupervFile");
1426 if (fn.isEmpty()) return; // must not happen
1428 DEBTRACE("file loaded : " <<fn.toStdString());
1429 YACS::ENGINE::Proc *proc = _loader->load(fn.toLatin1());
1432 QMessageBox msgBox(QMessageBox::Critical,
1433 "Import YACS Schema, SUPERV file converted in native YACS XML format",
1434 "The file has not the native YACS XML format or is not readable.");
1438 YACS::ENGINE::Logger* logger= proc->getLogger("parser");
1439 if(!logger->isEmpty())
1441 DEBTRACE(logger->getStr());
1443 createContext(proc, fn, "", true);
1446 //! bug confirmOverwrite : correction Qt 4.3.5
1447 QString GenericGui::getSaveFileName(const QString& fileName)
1449 QFileDialog dialog(_parent, "Save schema", fileName);
1450 QStringList filters;
1451 filters << "XML files (*.xml)"
1453 dialog.setFileMode(QFileDialog::AnyFile);
1454 dialog.setFilters(filters);
1455 dialog.selectFilter("(*.xml)");
1456 dialog.setDefaultSuffix("xml");
1457 dialog.setConfirmOverwrite(true);
1458 //dialog.setConfirmOverwrite(false); // bug Qt4.3.3
1459 dialog.setAcceptMode(QFileDialog::AcceptSave);
1460 QString selectedFile;
1461 QStringList fileNames;
1463 if (bool ret = dialog.exec())
1465 DEBTRACE(ret << " " << dialog.confirmOverwrite());
1466 fileNames = dialog.selectedFiles();
1467 if (!fileNames.isEmpty())
1468 selectedFile = fileNames.first();
1470 QString filteredName = _guiEditor->asciiFilter(selectedFile);
1471 DEBTRACE(filteredName.toStdString());
1472 return filteredName;
1475 void GenericGui::onExportSchema()
1477 DEBTRACE("GenericGui::onExportSchema");
1478 if (!QtGuiContext::getQtCurrent()) return;
1479 YACS::ENGINE::Proc* proc = QtGuiContext::getQtCurrent()->getProc();
1480 QString fo = QtGuiContext::getQtCurrent()->getFileName();
1483 if (fo.startsWith("newSchema_"))
1486 fn = getSaveFileName(fo);
1488 if (fn.isEmpty()) return;
1490 DEBTRACE("GenericGui::onExportSchema: " << fn.toStdString());
1491 //to be sure that all pending changes are effective
1492 _parent->setFocus();
1493 QtGuiContext::getQtCurrent()->setFileName(fn);
1494 VisitorSaveGuiSchema aWriter(proc);
1495 aWriter.openFileSchema( fn.toStdString() );
1496 aWriter.visitProc();
1497 aWriter.closeFileSchema();
1498 QtGuiContext::getQtCurrent()->setNotSaved(false);
1500 if (fn.compare(foo) && _wrapper)
1501 _wrapper->renameSchema(foo, fn, QtGuiContext::getQtCurrent()->getWindow());
1504 void GenericGui::onExportSchemaAs()
1506 DEBTRACE("GenericGui::onExportSchemaAs");
1508 if (!QtGuiContext::getQtCurrent()) return;
1509 YACS::ENGINE::Proc* proc = QtGuiContext::getQtCurrent()->getProc();
1510 QString fo = QtGuiContext::getQtCurrent()->getFileName();
1512 if (fo.startsWith("newSchema_")) fo.clear();
1513 QString fn = getSaveFileName(fo);
1514 if (fn.isEmpty()) return;
1516 DEBTRACE("GenericGui::onExportSchemaAs: " << fn.toStdString());
1517 QtGuiContext::getQtCurrent()->setFileName(fn);
1518 VisitorSaveGuiSchema aWriter(proc);
1519 aWriter.openFileSchema(fn.toStdString());
1520 aWriter.visitProc();
1521 aWriter.closeFileSchema();
1523 QtGuiContext::getQtCurrent()->setNotSaved(false);
1525 if (fn.compare(foo) && _wrapper)
1526 _wrapper->renameSchema(foo, fn, QtGuiContext::getQtCurrent()->getWindow());
1529 void GenericGui::onImportCatalog()
1531 DEBTRACE("GenericGui::onImportCatalog");
1532 QFileDialog dialog(_parent,
1533 "Choose a YACS Schema to load as a Catalog" ,
1535 tr( "XML-Files (*.xml);;All Files (*)" ));
1537 dialog.setHistory(_wrapper->getQuickDirList());
1540 QStringList fileNames;
1543 fileNames = dialog.selectedFiles();
1544 if (!fileNames.isEmpty())
1545 fn = fileNames.first();
1548 if ( !fn.isEmpty() )
1549 _catalogsWidget->addCatalogFromFile(fn.toStdString());
1552 void GenericGui::onRunLoadedSchema(bool withState)
1554 DEBTRACE("GenericGui::onRunLoadedSchema");
1555 if (!QtGuiContext::getQtCurrent()) return;
1561 // --- check proc state (cf. editionProc)
1563 if (!QtGuiContext::getQtCurrent()->_setOfModifiedSubjects.empty())
1565 set<Subject*>::iterator it = QtGuiContext::getQtCurrent()->_setOfModifiedSubjects.begin();
1566 (*it)->select(true);
1570 YACS::ENGINE::Proc* proc = QtGuiContext::getQtCurrent()->getProc();
1571 if (!proc->isValid())
1573 QtGuiContext::getQtCurrent()->getSubjectProc()->select(true);
1577 YACS::ENGINE::LinkInfo info(YACS::ENGINE::LinkInfo::ALL_STOP_ASAP);
1580 proc->checkConsistency(info);
1582 catch (Exception &ex)
1584 DEBTRACE(ex.what());
1585 QtGuiContext::getQtCurrent()->getSubjectProc()->select(true);
1588 if (info.areWarningsOrErrors()) return;
1592 double passe = (end_t -start_t);
1593 passe = passe/CLOCKS_PER_SEC;
1594 cerr <<"run schema -1- : " << passe << endl;
1597 // --- save proc under a run name
1599 QFileInfo fo = QtGuiContext::getQtCurrent()->getFileName();
1600 QString procName = fo.baseName();
1601 //QString tmpDir = SALOMEDS_Tool::GetTmpDir().c_str();
1603 QString tmpDir = getenv("TEMP");
1605 QString tmpDir = "/tmp";
1607 QDir aTmpDir(tmpDir);
1608 aTmpDir.mkdir(QString("YACS_") + getenv("USER"));
1609 YASSERT(aTmpDir.cd(QString("YACS_") + getenv("USER")));
1610 QDateTime curTime = QDateTime::currentDateTime();
1611 QString aRunName = procName + "_" + curTime.toString("yyyyMMdd_hhmmss") + ".xml";
1612 aRunName = aTmpDir.absoluteFilePath(aRunName);
1613 DEBTRACE(aRunName.toStdString());
1615 VisitorSaveGuiSchema aWriter(proc);
1616 aWriter.openFileSchema(aRunName.toStdString());
1617 aWriter.visitProc();
1618 aWriter.closeFileSchema();
1620 // --- create a run context
1622 YACS::ENGINE::Proc *procrun = _loader->load(aRunName.toLatin1());
1625 double passe = (end_t -start_t);
1626 passe = passe/CLOCKS_PER_SEC;
1627 cerr <<"run schema -2- : " << passe << endl;
1630 createContext(procrun, QtGuiContext::getQtCurrent()->getFileName(), aRunName, false);
1632 // load state if required
1634 GuiExecutor *executor = QtGuiContext::getQtCurrent()->getGuiExecutor();
1635 if (!executor) return;
1638 QString fn = QFileDialog::getOpenFileName( _parent,
1639 "Choose a previous run state to load" ,
1641 tr( "XML-Files (*.xml);;All Files (*)" ));
1644 DEBTRACE("run state to load: " <<fn.toStdString());
1645 executor->setLoadStateFile(fn.toStdString());
1648 executor->startResumeDataflow(true); // --- initialise gui state
1649 if(_toggleStopOnErrorAct->isChecked())
1650 executor->setStopOnError(false);
1653 void GenericGui::onLoadRunStateSchema()
1655 DEBTRACE("GenericGui::onLoadRunStateSchema");
1656 onRunLoadedSchema(true);
1659 void GenericGui::onLoadAndRunSchema()
1661 DEBTRACE("GenericGui::onLoadAndRunSchema");
1662 QString fn = QFileDialog::getOpenFileName( _parent,
1663 "Choose a filename to load" ,
1665 tr( "XML-Files (*.xml);;All Files (*)" ));
1666 if ( !fn.isEmpty() )
1668 // add ".xml" suffix
1670 if (!fi.exists() && fi.suffix() != "xml")
1673 DEBTRACE("file loaded : " <<fn.toStdString());
1674 YACS::ENGINE::Proc *proc =0;
1677 proc = _loader->load(fn.toLatin1());
1684 QMessageBox msgBox(QMessageBox::Critical,
1685 "Import YACS Schema, native YACS XML format",
1686 "The file has not the native YACS XML format or is not readable.");
1690 YACS::ENGINE::Logger* logger= proc->getLogger("parser");
1691 if(!logger->isEmpty())
1693 DEBTRACE(logger->getStr());
1695 createContext(proc, fn, "", true);
1696 onRunLoadedSchema();
1700 void GenericGui::onChooseBatchJob() {
1701 DEBTRACE("GenericGui::onChooseBatchJob");
1703 // Show the Batch Jobs list
1704 if(_BJLdialog) delete _BJLdialog;
1705 _BJLdialog = new BatchJobsListDialog(tr("Select one Batch Job to watch"),this);
1707 _BJLdialog->move(300,200);
1708 _BJLdialog->resize(450,200);
1712 void GenericGui::onStartResume()
1714 DEBTRACE("GenericGui::onStartResume");
1715 if (!QtGuiContext::getQtCurrent()) return;
1716 if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
1717 QtGuiContext::getQtCurrent()->getGuiExecutor()->startResumeDataflow();
1720 void GenericGui::onAbort()
1722 DEBTRACE("GenericGui::onAbort");
1723 if (!QtGuiContext::getQtCurrent()) return;
1724 if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
1725 QtGuiContext::getQtCurrent()->getGuiExecutor()->killDataflow();
1728 void GenericGui::onPause()
1730 DEBTRACE("GenericGui::onPause");
1731 if (!QtGuiContext::getQtCurrent()) return;
1732 if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
1733 QtGuiContext::getQtCurrent()->getGuiExecutor()->suspendDataflow();
1736 void GenericGui::onReset()
1738 DEBTRACE("GenericGui::onReset");
1739 if (!QtGuiContext::getQtCurrent()) return;
1740 if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
1741 QtGuiContext::getQtCurrent()->getGuiExecutor()->resetDataflow();
1744 void GenericGui::onSaveRunState()
1746 DEBTRACE("GenericGui::onSaveRunState");
1747 if (!QtGuiContext::getQtCurrent()) return;
1748 if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
1749 QDateTime curTime = QDateTime::currentDateTime();
1750 QFileInfo procName = QtGuiContext::getQtCurrent()->getFileName();
1751 QString stateName = procName.baseName();
1752 DEBTRACE(stateName.toStdString());
1753 stateName += "_state_" + curTime.toString("yyyyMMdd_hhmmss") + ".xml";
1754 DEBTRACE(stateName.toStdString());
1755 stateName = getSaveFileName(stateName);
1756 DEBTRACE(stateName.toStdString());
1757 if (!stateName.isEmpty())
1758 QtGuiContext::getQtCurrent()->getGuiExecutor()->saveState(stateName.toStdString());
1761 void GenericGui::onNewEdition()
1763 DEBTRACE("GenericGui::onNewEdition");
1764 // if (!QtGuiContext::getQtCurrent()) return;
1765 // if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
1766 // QtGuiContext::getQtCurrent()->getGuiExecutor()->resetDataflow();
1769 void GenericGui::onGetYacsContainerLog()
1771 DEBTRACE("GenericGui::onGetYacsContainerLog");
1772 if (!QtGuiContext::getQtCurrent()) return;
1773 if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
1774 string log = QtGuiContext::getQtCurrent()->getGuiExecutor()->getContainerLog();
1775 ContainerLogViewer *lv = new ContainerLogViewer("YACS Container Log", _parent);
1780 void GenericGui::onGetErrorReport()
1782 DEBTRACE("GenericGui::onGetErrorReport");
1783 if (!QtGuiContext::getQtCurrent()) return;
1784 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
1785 SubjectNode *snode = dynamic_cast<SubjectNode*>(sub);
1788 if (QtGuiContext::getQtCurrent()->getGuiExecutor())
1790 log = QtGuiContext::getQtCurrent()->getGuiExecutor()->getErrorReport(snode->getNode());
1794 log = snode->getNode()->getErrorReport();
1797 LogViewer *lv = new LogViewer("Node error report", _parent);
1802 void GenericGui::onGetErrorDetails()
1804 DEBTRACE("GenericGui::onGetErrorDetails");
1805 if (!QtGuiContext::getQtCurrent()) return;
1806 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
1807 SubjectNode *snode = dynamic_cast<SubjectNode*>(sub);
1810 if (QtGuiContext::getQtCurrent()->getGuiExecutor())
1812 log = QtGuiContext::getQtCurrent()->getGuiExecutor()->getErrorDetails(snode->getNode());
1816 log = snode->getNode()->getErrorDetails();
1819 LogViewer *lv = new LogViewer("Node Error Details", _parent);
1824 void GenericGui::onGetContainerLog()
1826 DEBTRACE("GenericGui::onGetContainerLog");
1827 if (!QtGuiContext::getQtCurrent()) return;
1828 if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
1829 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
1830 SubjectElementaryNode *snode = dynamic_cast<SubjectElementaryNode*>(sub);
1832 string log = QtGuiContext::getQtCurrent()->getGuiExecutor()->getContainerLog(snode->getNode());
1834 LogViewer *lv = new LogViewer("Node Container Log", _parent);
1838 if (dynamic_cast<YACS::ENGINE::ServiceNode*>(snode->getNode()))
1840 info +="The container log of this node\n";
1841 info += "is not stored in a file and \n";
1842 info += "can't be displayed here, \n";
1843 info += "but you can have a look at \n";
1844 info += "the SALOME standard output,\n";
1845 info += "on your terminal...";
1849 info += "See YACS Container log \n";
1850 info += "(on main proc menu) \n";
1851 info += "for all inline nodes";
1860 void GenericGui::onShutdownProc()
1862 DEBTRACE("GenericGui::onShutdownProc");
1863 if (!QtGuiContext::getQtCurrent()) return;
1864 if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
1865 QtGuiContext::getQtCurrent()->getGuiExecutor()->shutdownProc();
1868 void GenericGui::onEditDataTypes()
1870 DEBTRACE("GenericGui::onEditDataTypes");
1873 void GenericGui::onCreateDataType()
1875 DEBTRACE("GenericGui::onCreateDataType");
1878 void GenericGui::onImportDataType()
1880 DEBTRACE("GenericGui::onImportDataType");
1881 if (_dwCatalogs) _dwCatalogs->raise();
1884 void GenericGui::onSelectComponentInstance()
1886 DEBTRACE("GenericGui::onSelectComponentInstance");
1887 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
1889 SubjectComponent *ref = dynamic_cast<SubjectComponent*>(sub);
1891 YACS::ENGINE::ComponentInstance* compo=ref->getComponent();
1892 QtGuiContext::getQtCurrent()->_mapOfLastComponentInstance[compo->getCompoName()]=compo;
1895 void GenericGui::onNewContainer()
1897 DEBTRACE("GenericGui::onNewContainer");
1898 _guiEditor->CreateContainer();
1901 void GenericGui::onNewSalomeComponent()
1903 DEBTRACE("GenericGui::onNewSalomeComponent");
1904 _guiEditor->CreateComponentInstance();
1907 void GenericGui::onNewSalomePythonComponent()
1909 DEBTRACE("GenericGui::onNewSalomePythonComponent");
1912 void GenericGui::onNewCorbaComponent()
1914 DEBTRACE("GenericGui::onNewCorbaComponent");
1918 void GenericGui::onSalomeServiceNode()
1920 DEBTRACE("GenericGui::onSalomeServiceNode");
1921 _guiEditor->CreateNode("SalomeNode");
1924 void GenericGui::onServiceInlineNode()
1926 DEBTRACE("GenericGui::onServiceInlineNode");
1927 _guiEditor->CreateNode("SalomePythonNode");
1930 void GenericGui::onCORBAServiceNode()
1932 DEBTRACE("GenericGui::onCORBAServiceNode");
1933 _guiEditor->CreateNode("CORBANode");
1936 void GenericGui::onNodeNodeServiceNode()
1938 DEBTRACE("GenericGui::onNodeNodeServiceNode");
1941 void GenericGui::onCppNode()
1943 DEBTRACE("GenericGui::onCppNode");
1944 _guiEditor->CreateNode("CppNode");
1947 void GenericGui::onXMLNode()
1949 DEBTRACE("GenericGui::onXMLNode");
1950 _guiEditor->CreateNode("XmlNode");
1953 void GenericGui::onInDataNode()
1955 DEBTRACE("GenericGui::onInDataNode");
1956 _guiEditor->CreateNode("PresetNode");
1959 void GenericGui::onOutDataNode()
1961 DEBTRACE("GenericGui::onOutDataNode");
1962 _guiEditor->CreateNode("OutNode");
1965 void GenericGui::onInStudyNode()
1967 DEBTRACE("GenericGui::onInStudyNode");
1968 _guiEditor->CreateNode("StudyInNode");
1971 void GenericGui::onOutStudyNode()
1973 DEBTRACE("GenericGui::onOutStudyNode");
1974 _guiEditor->CreateNode("StudyOutNode");
1977 void GenericGui::onInlineScriptNode()
1979 DEBTRACE("GenericGui::onInlineScriptNode");
1980 _guiEditor->CreateNode("PyScript");
1983 void GenericGui::onInlineFunctionNode()
1985 DEBTRACE("GenericGui::onInlineFunctionNode");
1986 _guiEditor->CreateNode("PyFunction");
1989 void GenericGui::onBlockNode()
1991 DEBTRACE("GenericGui::onBlockNode");
1992 _guiEditor->CreateBloc();
1995 void GenericGui::onFORNode()
1997 DEBTRACE("GenericGui::onFORNode");
1998 _guiEditor->CreateForLoop();
2001 void GenericGui::onFOREACHNode()
2003 DEBTRACE("GenericGui::onFOREACHNode");
2004 createForEachLoop("double");
2007 void GenericGui::createForEachLoop(std::string type)
2009 DEBTRACE("GenericGui::createForEachLoop");
2010 _guiEditor->CreateForEachLoop(type);
2013 void GenericGui::onWHILENode()
2015 DEBTRACE("GenericGui::onWHILENode");
2016 _guiEditor->CreateWhileLoop();
2019 void GenericGui::onSWITCHNode()
2021 DEBTRACE("GenericGui::onSWITCHNode");
2022 _guiEditor->CreateSwitch();
2025 void GenericGui::onOptimizerLoop()
2027 DEBTRACE("GenericGui::onOptimizerLoop");
2028 _guiEditor->CreateOptimizerLoop();
2031 void GenericGui::onNodeFromCatalog()
2033 DEBTRACE("GenericGui::onNodeFromCatalog");
2034 if (_dwCatalogs) _dwCatalogs->raise();
2037 void GenericGui::onDeleteItem()
2039 DEBTRACE("GenericGui::onDeleteItem");
2040 _guiEditor->DeleteSubject();
2043 void GenericGui::onCutItem()
2045 DEBTRACE("GenericGui::onCutItem");
2046 _guiEditor->CutSubject();
2049 void GenericGui::onCopyItem()
2051 DEBTRACE("GenericGui::onCopyItem");
2052 _guiEditor->CopySubject();
2055 void GenericGui::onPasteItem()
2057 DEBTRACE("GenericGui::onPasteItem");
2058 _guiEditor->PasteSubject();
2061 void GenericGui::onPutInBloc()
2063 _guiEditor->PutSubjectInBloc();
2066 void GenericGui::onArrangeLocalNodes()
2068 DEBTRACE("GenericGui::onArrangeLocalNodes");
2069 _guiEditor->arrangeNodes(false);
2072 void GenericGui::onArrangeRecurseNodes()
2074 DEBTRACE("GenericGui::onArrangeRecurseNodes");
2075 _guiEditor->arrangeNodes(true);
2078 void GenericGui::onRebuildLinks()
2080 DEBTRACE("GenericGui::onRebuildLinks");
2081 _guiEditor->rebuildLinks();
2084 void GenericGui::onZoomToBloc()
2086 DEBTRACE("GenericGui::onZoomToBloc");
2087 QtGuiContext::getQtCurrent()->getView()->onZoomToBloc();
2090 void GenericGui::onCenterOnNode()
2092 DEBTRACE("GenericGui::onCenterOnNode");
2093 QtGuiContext::getQtCurrent()->getView()->onCenterOnNode();
2096 void GenericGui::onShrinkExpand() {
2097 DEBTRACE("GenericGui::onShrinkExpand");
2098 _guiEditor->shrinkExpand();
2101 void GenericGui::onToggleStraightLinks(bool checked)
2103 Scene::_straightLinks = checked;
2104 DEBTRACE("Scene::_straightLinks=" << checked);
2105 if (!QtGuiContext::getQtCurrent())
2107 map<Subject*, SchemaItem*>::const_iterator it = QtGuiContext::getQtCurrent()->_mapOfSchemaItem.begin();
2108 for( ; it != QtGuiContext::getQtCurrent()->_mapOfSchemaItem.end(); ++it)
2110 Subject* sub = (*it).first;
2111 sub->update(SWITCHSHAPE, 0, 0);
2115 void GenericGui::onToggleAutomaticComputeLinks(bool checked)
2117 Scene::_autoComputeLinks = checked;
2118 DEBTRACE("Scene::_autoComputeLinks=" << checked);
2121 void GenericGui::onToggleSimplifyLinks(bool checked)
2123 Scene::_simplifyLinks = checked;
2124 DEBTRACE("Scene::_simplifyLinks=" << checked);
2127 void GenericGui::onToggleForce2NodesLinks(bool checked)
2129 Scene::_force2NodesLink = checked;
2130 DEBTRACE("Scene::_force2NodesLink=" << checked);
2133 void GenericGui::onToggleAddRowCols(bool checked)
2135 Scene::_addRowCols = checked;
2136 DEBTRACE("Scene::_addRowCols=" << checked);
2139 void GenericGui::onSelectReference()
2141 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
2143 SubjectReference *ref = dynamic_cast<SubjectReference*>(sub);
2145 SubjectServiceNode *snode = dynamic_cast<SubjectServiceNode*>(ref->getReference());
2146 snode->select(true);
2149 void GenericGui::onWhatsThis()
2151 DEBTRACE("GenericGui::onWhatsThis");
2152 QWhatsThis::enterWhatsThisMode();
2155 void GenericGui::onWithoutStopMode(bool checked)
2157 DEBTRACE("GenericGui::onWithoutStopMode " << checked);
2158 if (!QtGuiContext::getQtCurrent()) return;
2159 if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
2160 if (checked) QtGuiContext::getQtCurrent()->getGuiExecutor()->setContinueMode();
2163 void GenericGui::onBreakpointsMode(bool checked)
2165 DEBTRACE("GenericGui::onWithoutStopMode " << checked);
2166 if (!QtGuiContext::getQtCurrent()) return;
2167 if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
2168 if (checked) QtGuiContext::getQtCurrent()->getGuiExecutor()->setBreakpointMode();
2171 void GenericGui::onStepByStepMode(bool checked)
2173 DEBTRACE("GenericGui::onWithoutStopMode " << checked);
2174 if (!QtGuiContext::getQtCurrent()) return;
2175 if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
2176 if (checked) QtGuiContext::getQtCurrent()->getGuiExecutor()->setStepByStepMode();
2179 void GenericGui::onToggleStopOnError(bool checked)
2181 DEBTRACE("GenericGui::onToggleStopOnError " << checked);
2182 if (!QtGuiContext::getQtCurrent()) return;
2183 if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
2185 QtGuiContext::getQtCurrent()->getGuiExecutor()->setStopOnError(false);
2187 QtGuiContext::getQtCurrent()->getGuiExecutor()->unsetStopOnError();
2190 void GenericGui::onToggleSceneItemVisible(bool checked)
2192 DEBTRACE("GenericGui::onToggleSceneItemVisible " << checked);
2193 if (!QtGuiContext::getQtCurrent()) return;
2194 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
2195 SubjectNode *snode = dynamic_cast<SubjectNode*>(sub);
2198 if (!QtGuiContext::getQtCurrent()->_mapOfSceneItem.count(sub)) return;
2200 SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sub];
2201 item->setVisible(checked);
2204 void GenericGui::displayLinks(bool isShown)
2206 if (!QtGuiContext::getQtCurrent()) return;
2207 map<pair<YACS::ENGINE::OutPort*, YACS::ENGINE::InPort*>,YACS::HMI::SubjectLink*>::const_iterator it;
2208 for (it = QtGuiContext::getQtCurrent()->_mapOfSubjectLink.begin();
2209 it != QtGuiContext::getQtCurrent()->_mapOfSubjectLink.end();
2212 YACS::HMI::SubjectLink* sub = (*it).second;
2214 SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sub];
2215 item->setVisible(isShown);
2219 void GenericGui::displayControlLinks(bool isShown)
2221 if (!QtGuiContext::getQtCurrent()) return;
2222 map<pair<YACS::ENGINE::Node*, YACS::ENGINE::Node*>,YACS::HMI::SubjectControlLink*>::const_iterator it;
2223 for (it = QtGuiContext::getQtCurrent()->_mapOfSubjectControlLink.begin();
2224 it != QtGuiContext::getQtCurrent()->_mapOfSubjectControlLink.end();
2227 YACS::HMI::SubjectControlLink* sub = (*it).second;
2229 SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sub];
2230 item->setVisible(isShown);
2234 void GenericGui::displayPortLinks(bool isShown)
2236 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
2237 DEBTRACE("displayPortLinks, subject : " << sub->getName());
2238 SubjectDataPort *sport = dynamic_cast<SubjectDataPort*>(sub);
2241 DEBTRACE("dataPort : " << sport->getName());
2242 list<SubjectLink*> linkList = sport->getListOfSubjectLink();
2243 list<SubjectLink*>::const_iterator it = linkList.begin();
2244 for( ; it != linkList.end(); ++it)
2246 YACS::HMI::SubjectLink* sub = (*it);
2248 SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sub];
2249 item->setVisible(isShown);
2253 SubjectNode *snode = dynamic_cast<SubjectNode*>(sub);
2256 DEBTRACE("Node : " << snode->getName());
2257 list<SubjectControlLink*> linkList = snode->getSubjectControlLinks();
2258 list<SubjectControlLink*>::const_iterator it = linkList.begin();
2259 for( ; it != linkList.end(); ++it)
2261 YACS::HMI::SubjectControlLink* sub = (*it);
2263 SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sub];
2264 item->setVisible(isShown);
2270 void GenericGui::displayALink(bool isShown)
2272 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
2273 if (! QtGuiContext::getQtCurrent()->_mapOfSceneItem.count(sub)) return;
2274 SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sub];
2275 item->setVisible(isShown);
2278 void GenericGui::onShowAllLinks()
2280 DEBTRACE("GenericGui::onShowAllLinks");
2282 displayControlLinks(true);
2285 void GenericGui::onHideAllLinks()
2287 DEBTRACE("GenericGui::onHideAllLinks");
2288 displayLinks(false);
2289 displayControlLinks(false);
2292 void GenericGui::onShowOnlyPortLinks()
2294 DEBTRACE("GenericGui::onShowOnlyPortLinks");
2296 displayPortLinks(true);
2299 void GenericGui::onShowPortLinks()
2301 DEBTRACE("GenericGui::onShowPortLinks");
2302 displayPortLinks(true);
2305 void GenericGui::onHidePortLinks()
2307 DEBTRACE("GenericGui::onHidePortLinks");
2308 displayPortLinks(false);
2311 void GenericGui::onEmphasisPortLinks()
2313 DEBTRACE("GenericGui::onEmphasisPortLinks");
2314 if (!QtGuiContext::getQtCurrent()) return;
2315 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
2316 DEBTRACE("EmphasizePortLinks, subject : " << sub->getName());
2320 SubjectDataPort *sport = dynamic_cast<SubjectDataPort*>(sub);
2323 emphasizePortLink(sport, true);
2327 // --- if a Node, explore all data ports
2329 SubjectNode *snode = dynamic_cast<SubjectNode*>(sub);
2332 DEBTRACE("Node : " << snode->getName());
2334 list<SubjectInputPort*> linkList = snode->getSubjectInputPorts();
2335 list<SubjectInputPort*>::const_iterator it = linkList.begin();
2336 for( ; it != linkList.end(); ++it)
2338 YACS::HMI::SubjectInputPort* sub = (*it);
2340 emphasizePortLink(sub, true);
2344 list<SubjectOutputPort*> linkList = snode->getSubjectOutputPorts();
2345 list<SubjectOutputPort*>::const_iterator it = linkList.begin();
2346 for( ; it != linkList.end(); ++it)
2348 YACS::HMI::SubjectOutputPort* sub = (*it);
2350 emphasizePortLink(sub, true);
2357 void GenericGui::onShowOnlyCtrlLinks()
2359 DEBTRACE("GenericGui::onShowOnlyCtrlLinks");
2361 displayPortLinks(true);
2364 void GenericGui::onShowCtrlLinks()
2366 DEBTRACE("GenericGui::onShowCtrlLinks");
2367 displayPortLinks(true);
2370 void GenericGui::onHideCtrlLinks()
2372 DEBTRACE("GenericGui::onHideCtrlLinks");
2373 displayPortLinks(false);
2376 void GenericGui::onEmphasisCtrlLinks()
2378 DEBTRACE("GenericGui::onEmphasisCtrlLinks");
2379 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
2380 DEBTRACE("Emphasize Ctrl Links, subject : " << sub->getName());
2383 SubjectNode *snode = dynamic_cast<SubjectNode*>(sub);
2386 DEBTRACE("Node : " << snode->getName());
2387 list<SubjectControlLink*> linkList = snode->getSubjectControlLinks();
2388 list<SubjectControlLink*>::const_iterator it = linkList.begin();
2389 for( ; it != linkList.end(); ++it)
2391 YACS::HMI::SubjectControlLink* sub = (*it);
2393 sub->update(EMPHASIZE, true, sub);
2394 Subject *sin = sub->getSubjectInNode();
2395 Subject *sout = sub->getSubjectOutNode();
2396 sin->update(EMPHASIZE, true, sub);
2397 sout->update(EMPHASIZE, true, sub);
2403 void GenericGui::onShowOnlyLink()
2405 DEBTRACE("GenericGui::onShowOnlyLink");
2410 void GenericGui::onShowLink()
2412 DEBTRACE("GenericGui::onShowLink");
2416 void GenericGui::onHideLink()
2418 DEBTRACE("GenericGui::onHideLink");
2419 displayALink(false);
2422 void GenericGui::onEmphasisLink()
2424 DEBTRACE("GenericGui::onEmphasisLink");
2425 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
2428 sub->update(EMPHASIZE, true, sub);
2431 void GenericGui::onDeEmphasizeAll()
2433 DEBTRACE("GenericGui::onDeEmphasizeAll");
2434 map<Subject*, SchemaItem*>::const_iterator it = QtGuiContext::getQtCurrent()->_mapOfSchemaItem.begin();
2435 for( ; it != QtGuiContext::getQtCurrent()->_mapOfSchemaItem.end(); ++it)
2437 Subject* sub = (*it).first;
2438 sub->update(EMPHASIZE, false, sub);
2442 void GenericGui::onUndo()
2444 DEBTRACE("GenericGui::onUndo");
2445 if (QtGuiContext::getQtCurrent()->_setOfModifiedSubjects.empty())
2446 QtGuiContext::getQtCurrent()->getInvoc()->undo();
2447 else Message("undo not possible when there are local modifications not confirmed");
2450 void GenericGui::onRedo()
2452 DEBTRACE("GenericGui::onRedo");
2453 if (QtGuiContext::getQtCurrent()->_setOfModifiedSubjects.empty())
2454 QtGuiContext::getQtCurrent()->getInvoc()->redo();
2455 else Message("redo not possible when there are local modifications not confirmed");
2458 void GenericGui::onShowUndo()
2460 _guiEditor->showUndo(_parent);
2463 void GenericGui::onShowRedo()
2465 _guiEditor->showRedo(_parent);
2468 void GenericGui::onCleanOnExit()
2470 DEBTRACE("GenericGui::onCleanOnExit");
2471 int studyId = _wrapper->activeStudyId();
2472 map<QWidget*, YACS::HMI::QtGuiContext*> mapViewContextCopy = _mapViewContext;
2473 map<QWidget*, YACS::HMI::QtGuiContext*>::iterator it = mapViewContextCopy.begin();
2474 for (; it != mapViewContextCopy.end(); ++it)
2476 closeContext((*it).first, true);
2480 void GenericGui::emphasizePortLink(YACS::HMI::SubjectDataPort* sub, bool emphasize)
2482 DEBTRACE("dataPort : " << sub->getName());
2483 list<SubjectLink*> linkList = sub->getListOfSubjectLink();
2484 list<SubjectLink*>::const_iterator it = linkList.begin();
2485 for( ; it != linkList.end(); ++it)
2487 YACS::HMI::SubjectLink* subli = (*it);
2488 if (!subli) continue;
2489 subli->update(EMPHASIZE, emphasize, sub);
2490 Subject *sin = subli->getSubjectInPort();
2491 Subject *sout = subli->getSubjectOutPort();
2492 sin->update(EMPHASIZE, emphasize, sub);
2493 sout->update(EMPHASIZE, emphasize, sub);
2497 void GenericGui::onHelpContextModule( const QString& theComponentName, const QString& theFileName, const QString& theContext)
2499 _wrapper->onHelpContextModule(theComponentName,theFileName,theContext);