21 #include "SALOME_ResourcesManager.hxx"
22 #include "SALOME_LifeCycleCORBA.hxx"
33 #include "SALOME_NamingService.hxx"
34 #include "SALOME_ModuleCatalog.hxx"
35 #include "SALOME_ModuleCatalog.hh"
36 #include "SALOMEDS_Tool.hxx"
59 #include <QFileDialog>
63 #include <QMessageBox>
71 #define WEXITSTATUS(w) ((int) ((w) & 0x40000000))
78 using namespace YACS::HMI;
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());
109 _loader->registerProcCataLoader();
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 );
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)
139 <<
" " << (*it).second->getKindRepr()
140 <<
" " << (*it).second->name()
141 <<
" " << (*it).second->shortName()
142 <<
" " << (*it).second->id() );
144 DEBTRACE(
"_sessionCatalog " << _sessionCatalog);
148 catch(ServiceUnreachable& e)
153 _dwTree =
new QDockWidget(_parent);
154 _dwTree->setVisible(
false);
155 _dwTree->setWindowTitle(
"Tree View: edition mode");
156 _dwTree->setObjectName(
"yacsTreeViewDock");
157 _parent->addDockWidget(Qt::LeftDockWidgetArea, _dwTree);
158 _dwStacked =
new QDockWidget(_parent);
159 _dwStacked->setVisible(
false);
160 _dwStacked->setWindowTitle(
"Input Panel");
161 _dwStacked->setObjectName(
"yacsInputPanelDock");
162 _dwStacked->setMinimumWidth(270);
163 _parent->addDockWidget(Qt::RightDockWidgetArea, _dwStacked);
164 _dwCatalogs =
new QDockWidget(_parent);
165 _dwCatalogs->setVisible(
false);
166 _dwCatalogs->setWindowTitle(
"Catalogs");
167 _dwCatalogs->setObjectName(
"yacsCatalogsDock");
168 _parent->addDockWidget(Qt::RightDockWidgetArea, _dwCatalogs);
172 _dwCatalogs->setWidget(_catalogsWidget);
174 _parent->tabifyDockWidget(_dwStacked, _dwCatalogs);
175 if (_wrapper->objectBrowser())
176 _parent->tabifyDockWidget(_dwTree, _wrapper->objectBrowser());
177 #if QT_VERSION >= 0x040500
178 _parent->setTabPosition(Qt::AllDockWidgetAreas, Resource::tabPanelsUp? QTabWidget::North: QTabWidget::South);
181 std::string usercata=Resource::userCatalog.toStdString();
182 _catalogsWidget->addCatalogFromFile(usercata);
185 GenericGui::~GenericGui()
187 if(_BJLdialog)
delete _BJLdialog;
190 void GenericGui::createActions()
203 _newSchemaAct = _wrapper->createAction(getMenuId(), tr(
"Create a new YACS Schema"), QIcon(
"icons:schema.png"),
204 tr(
"New Schema"), tr(
"Create a new YACS Schema"),
205 0, _parent,
false,
this, SLOT(onNewSchema()));
206 _newSchemaAct->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_N);
208 _importSchemaAct = _wrapper->createAction(getMenuId(), tr(
"Import a YACS Schema for edition"), QIcon(
"icons:import_dataflow.png"),
209 tr(
"Import Schema"), tr(
"Import a YACS Schema for edition"),
210 0, _parent,
false,
this, SLOT(onImportSchema()));
211 _importSchemaAct->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_O);
213 _importSupervSchemaAct = _wrapper->createAction(getMenuId(), tr(
"Import a SUPERV Schema for edition"), QIcon(
"icons:import_superv_dataflow.png"),
214 tr(
"Import SUPERV Schema"), tr(
"Import a SUPERV Schema for edition"),
215 0, _parent,
false,
this, SLOT(onImportSupervSchema()));
217 _exportSchemaAct = _wrapper->createAction(getMenuId(), tr(
"Save the current YACS Schema"), QIcon(
"icons:save_dataflow.png"),
218 tr(
"Save Schema"), tr(
"Save the current YACS Schema"),
219 0, _parent,
false,
this, SLOT(onExportSchema()));
220 _exportSchemaAct->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_S);
222 _exportSchemaAsAct = _wrapper->createAction(getMenuId(), tr(
"Save the current YACS Schema As..."), QIcon(
"icons:export_dataflow.png"),
223 tr(
"Save Schema As"), tr(
"Save the current YACS Schema As..."),
224 0, _parent,
false,
this, SLOT(onExportSchemaAs()));
227 _importCatalogAct = _wrapper->createAction(getMenuId(), tr(
"Import a Schema as a Catalog"), QIcon(
"icons:insert_file.png"),
228 tr(
"Import Catalog"), tr(
"Import a Schema as a Catalog"),
229 0, _parent,
false,
this, SLOT(onImportCatalog()));
232 _runLoadedSchemaAct = _wrapper->createAction(getMenuId(), tr(
"Prepare the current edited schema for run"), QIcon(
"icons:run_active.png"),
233 tr(
"Run Current Schema"), tr(
"Prepare the current edited schema for run"),
234 0, _parent,
false,
this, SLOT(onRunLoadedSchema()));
236 _loadRunStateSchemaAct = _wrapper->createAction(getMenuId(), tr(
"Load a previous run state for this schema, prepare to run"), QIcon(
"icons:load_execution_state.png"),
237 tr(
"Load Run State"), tr(
"Load a previous run state for this schema, prepare to run"),
238 0, _parent,
false,
this, SLOT(onLoadRunStateSchema()));
240 _loadAndRunSchemaAct = _wrapper->createAction(getMenuId(), tr(
"Load a schema for run"), QIcon(
"icons:run.png"),
241 tr(
"Load Schema to run"), tr(
"Load a schema for run"),
242 0, _parent,
false,
this, SLOT(onLoadAndRunSchema()));
244 _chooseBatchJobAct = _wrapper->createAction(getMenuId(), tr(
"Choose Batch Job to watch"), QIcon(
"icons:batch.png"),
245 tr(
"Choose Batch Job to watch"), tr(
"Choose Batch Job to watch"),
246 0, _parent,
false,
this, SLOT(onChooseBatchJob()));
248 _startResumeAct = _wrapper->createAction(getMenuId(), tr(
"Start or Resume Schema execution"), QIcon(
"icons:suspend_resume.png"),
249 tr(
"Start/Resume execution"), tr(
"Start or Resume Schema execution"),
250 0, _parent,
false,
this, SLOT(onStartResume()));
252 _abortAct = _wrapper->createAction(getMenuId(), tr(
"Abort the current execution"), QIcon(
"icons:kill.png"),
253 tr(
"Abort execution"), tr(
"Abort the current execution"),
254 0, _parent,
false,
this, SLOT(onAbort()));
256 _pauseAct = _wrapper->createAction(getMenuId(), tr(
"Suspend the current execution"), QIcon(
"icons:pause.png"),
257 tr(
"Suspend execution"), tr(
"Suspend the current execution"),
258 0, _parent,
false,
this, SLOT(onPause()));
260 _resetAct = _wrapper->createAction(getMenuId(), tr(
"Reset error nodes and restart the current execution"), QIcon(
"icons:reset.png"),
261 tr(
"Restart execution"), tr(
"Restart the current execution with reset of error nodes"),
262 0, _parent,
false,
this, SLOT(onReset()));
265 _saveRunStateAct = _wrapper->createAction(getMenuId(), tr(
"Save the current run state"), QIcon(
"icons:save_dataflow_state.png"),
266 tr(
"Save State"), tr(
"Save the current run state"),
267 0, _parent,
false,
this, SLOT(onSaveRunState()));
269 _newEditionAct = _wrapper->createAction(getMenuId(), tr(
"Edit again the current schema in a new context"), QIcon(
"icons:new_edition.png"),
270 tr(
"Edit Again"), tr(
"Edit again the current schema in a new context"),
271 0, _parent,
false,
this, SLOT(onNewEdition()));
274 _getYacsContainerLogAct = _wrapper->createAction(getMenuId(), tr(
"get YACS container log"), QIcon(
"icons:change_informations.png"),
275 tr(
"YACS Container Log"), tr(
"get YACS container log"),
276 0, _parent,
false,
this, SLOT(onGetYacsContainerLog()));
278 _getErrorReportAct = _wrapper->createAction(getMenuId(), tr(
"get Node Error Report"), QIcon(
"icons:filter_notification.png"),
279 tr(
"Node Error Report"), tr(
"get Node Error Report"),
280 0, _parent,
false,
this, SLOT(onGetErrorReport()));
282 _getErrorDetailsAct = _wrapper->createAction(getMenuId(), tr(
"get Node Error Details"), QIcon(
"icons:icon_text.png"),
283 tr(
"Node Error Details"), tr(
"get Node Error Details"),
284 0, _parent,
false,
this, SLOT(onGetErrorDetails()));
286 _getContainerLogAct = _wrapper->createAction(getMenuId(), tr(
"get Node Container Log"), QIcon(
"icons:change_informations.png"),
287 tr(
"Node Container Log"), tr(
"get Node Container Log"),
288 0, _parent,
false,
this, SLOT(onGetContainerLog()));
290 _shutdownProcAct = _wrapper->createAction(getMenuId(), tr(
"Shutdown Proc"), QIcon(
"icons:kill.png"),
291 tr(
"Shutdown Proc"), tr(
"Shutdown Proc"),
292 0, _parent,
false,
this, SLOT(onShutdownProc()));
295 _editDataTypesAct = _wrapper->createAction(getMenuId(), tr(
"Edit Data Types"), QIcon(
"icons:kill.png"),
296 tr(
"Edit Data Types"), tr(
"Edit Data Types"),
297 0, _parent,
false,
this, SLOT(onEditDataTypes()));
299 _createDataTypeAct = _wrapper->createAction(getMenuId(), tr(
"Create Data Types"), QIcon(
"icons:kill.png"),
300 tr(
"Create Data Types"), tr(
"Create Data Types"),
301 0, _parent,
false,
this, SLOT(onCreateDataType()));
303 _importDataTypeAct = _wrapper->createAction(getMenuId(), tr(
"Import Data Types, use drag and drop from catalog"), QIcon(
"icons:folder_cyan.png"),
304 tr(
"Import Data Types"), tr(
"Import Data Types, use drag and drop from catalog"),
305 0, _parent,
false,
this, SLOT(onImportDataType()));
307 _newContainerAct = _wrapper->createAction(getMenuId(), tr(
"Create a New Container"), QIcon(
"icons:container.png"),
308 tr(
"Create Container"), tr(
"Create a New Container"),
309 0, _parent,
false,
this, SLOT(onNewContainer()));
311 _newHPContainerAct = _wrapper->createAction(getMenuId(), tr(
"Create a New HP Container"), QIcon(
"icons:container.png"),
312 tr(
"Create HP Container"), tr(
"Create a New Homogeneous Pool Container."),
313 0, _parent,
false,
this, SLOT(onNewHPContainer()));
315 _selectComponentInstanceAct = _wrapper->createAction(getMenuId(), tr(
"Select a Component Instance"), QIcon(
"icons:icon_select.png"),
316 tr(
"Select a Component Instance"), tr(
"Select a Component Instance"),
317 0, _parent,
false,
this, SLOT(onSelectComponentInstance()));
319 _newSalomeComponentAct = _wrapper->createAction(getMenuId(), tr(
"Create a New SALOME Component Instance"), QIcon(
"icons:new_salome_component.png"),
320 tr(
"Create Component Instance"), tr(
"Create a New SALOME Component Instance"),
321 0, _parent,
false,
this, SLOT(onNewSalomeComponent()));
323 _newSalomePythonComponentAct = _wrapper->createAction(getMenuId(), tr(
"Create a New SALOME Python Component"), QIcon(
"icons:new_salomepy_component.png"),
324 tr(
"SALOME Python Component"), tr(
"Create a New SALOME Python Component"),
325 0, _parent,
false,
this, SLOT(onNewSalomePythonComponent()));
327 _newCorbaComponentAct = _wrapper->createAction(getMenuId(), tr(
"Create a New CORBA Component"), QIcon(
"icons:new_corba_component.png"),
328 tr(
"CORBA Component"), tr(
"Create a New CORBA Component"),
329 0, _parent,
false,
this, SLOT(onNewCorbaComponent()));
331 _salomeServiceNodeAct = _wrapper->createAction(getMenuId(), tr(
"Create a New SALOME Service Node"), QIcon(
"icons:new_salome_service_node.png"),
332 tr(
"SALOME Service Node"), tr(
"Create a New SALOME Service Node"),
333 0, _parent,
false,
this, SLOT(onSalomeServiceNode()));
335 _serviceInlineNodeAct = _wrapper->createAction(getMenuId(), tr(
"Create a New Inline Service Node"), QIcon(
"icons:new_service_inline_node.png"),
336 tr(
"Inline Service Node"), tr(
"Create a New Inline Service Node"),
337 0, _parent,
false,
this, SLOT(onServiceInlineNode()));
339 _CORBAServiceNodeAct = _wrapper->createAction(getMenuId(), tr(
"Create a New CORBA Service Node"), QIcon(
"icons:new_corba_service_node.png"),
340 tr(
"CORBA Node"), tr(
"Create a New CORBA Service Node"),
341 0, _parent,
false,
this, SLOT(onCORBAServiceNode()));
343 _nodeNodeServiceNodeAct = _wrapper->createAction(getMenuId(), tr(
"Create a New Node referencing a Node"), QIcon(
"icons:new_nodenode_service_node.png"),
344 tr(
"Ref on Node"), tr(
"Create a New Node referencing a Node"),
345 0, _parent,
false,
this, SLOT(onNodeNodeServiceNode()));
347 _cppNodeAct = _wrapper->createAction(getMenuId(), tr(
"Create a New C++ Node"), QIcon(
"icons:new_cpp_node.png"),
348 tr(
"Cpp Node"), tr(
"Create a New C++ Node"),
349 0, _parent,
false,
this, SLOT(onCppNode()));
351 _inDataNodeAct = _wrapper->createAction(getMenuId(), tr(
"Create a New Input data Node"), QIcon(
"icons:node.png"),
352 tr(
"Input Data Node"), tr(
"Create a New Input data Node"),
353 0, _parent,
false,
this, SLOT(onInDataNode()));
355 _outDataNodeAct = _wrapper->createAction(getMenuId(), tr(
"Create a New Output data Node"), QIcon(
"icons:node.png"),
356 tr(
"Output Data Node"), tr(
"Create a New Output data Node"),
357 0, _parent,
false,
this, SLOT(onOutDataNode()));
359 _inStudyNodeAct = _wrapper->createAction(getMenuId(), tr(
"Create a New Input Study Node"), QIcon(
"icons:node.png"),
360 tr(
"Input Study Node"), tr(
"Create a New Input Study Node"),
361 0, _parent,
false,
this, SLOT(onInStudyNode()));
363 _outStudyNodeAct = _wrapper->createAction(getMenuId(), tr(
"Create a New Output Study Node"), QIcon(
"icons:node.png"),
364 tr(
"Output Study Node"), tr(
"Create a New Output Study Node"),
365 0, _parent,
false,
this, SLOT(onOutStudyNode()));
367 _inlineScriptNodeAct = _wrapper->createAction(getMenuId(), tr(
"Create a New Inline Python Script Node"), QIcon(
"icons:new_inline_script_node.png"),
368 tr(
"Inline Script Node"), tr(
"Create a New Inline Python Script Node"),
369 0, _parent,
false,
this, SLOT(onInlineScriptNode()));
371 _inlineFunctionNodeAct = _wrapper->createAction(getMenuId(), tr(
"Create a New Inline Python Function Node"), QIcon(
"icons:new_inline_function_node.png"),
372 tr(
"Inline Function Node"), tr(
"Create a New Inline Python Function Node"),
373 0, _parent,
false,
this, SLOT(onInlineFunctionNode()));
375 _blockNodeAct = _wrapper->createAction(getMenuId(), tr(
"Create a New Bloc Node"), QIcon(
"icons:new_block_node.png"),
376 tr(
"bloc Node"), tr(
"Create a New Bloc Node"),
377 0, _parent,
false,
this, SLOT(onBlockNode()));
379 _FORNodeAct = _wrapper->createAction(getMenuId(), tr(
"Create a New For Loop Node"), QIcon(
"icons:new_for_loop_node.png"),
380 tr(
"For Loop Node"), tr(
"Create a New For Loop Node"),
381 0, _parent,
false,
this, SLOT(onFORNode()));
383 _FOREACHNodeAct = _wrapper->createAction(getMenuId(), tr(
"Create a New For Each Loop Node"), QIcon(
"icons:new_foreach_loop_node.png"),
384 tr(
"For Each Loop Node"), tr(
"Create a New For Each Loop Node"),
385 0, _parent,
false,
this, SLOT(onFOREACHNode()));
387 _WHILENodeAct = _wrapper->createAction(getMenuId(), tr(
"Create a New While Loop Node"), QIcon(
"icons:new_while_loop_node.png"),
388 tr(
"While Loop Node"), tr(
"Create a New While Loop Node"),
389 0, _parent,
false,
this, SLOT(onWHILENode()));
391 _SWITCHNodeAct = _wrapper->createAction(getMenuId(), tr(
"Create a New Switch Node"), QIcon(
"icons:new_switch_loop_node.png"),
392 tr(
"Switch Node"), tr(
"Create a New Switch Node"),
393 0, _parent,
false,
this, SLOT(onSWITCHNode()));
395 _OptimizerLoopAct = _wrapper->createAction(getMenuId(), tr(
"Create a New Optimizer Loop Node"), QIcon(
"icons:new_for_loop_node.png"),
396 tr(
"Optimizer Loop"), tr(
"Create a New Optimizer Loop"),
397 0, _parent,
false,
this, SLOT(onOptimizerLoop()));
399 _nodeFromCatalogAct = _wrapper->createAction(getMenuId(), tr(
"Create a New Node from Catalog, use drag and drop from catalog"), QIcon(
"icons:new_from_library_node.png"),
400 tr(
"Node from Catalog"), tr(
"Create a New Node from Catalog, use drag and drop from catalog"),
401 0, _parent,
false,
this, SLOT(onNodeFromCatalog()));
403 _deleteItemAct = _wrapper->createAction(getMenuId(), tr(
"Delete a Schema Item"), QIcon(
"icons:delete.png"),
404 tr(
"Delete Item"), tr(
"Delete a Schema Item"),
405 0, _parent,
false,
this, SLOT(onDeleteItem()));
406 _deleteItemAct->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_D);
408 _cutItemAct = _wrapper->createAction(getMenuId(), tr(
"Cut a Schema Item"), QIcon(
"icons:cut.png"),
409 tr(
"Cut Item"), tr(
"Cut a Schema Item"),
410 0, _parent,
false,
this, SLOT(onCutItem()));
411 _cutItemAct->setShortcut(QKeySequence::Cut);
413 _copyItemAct = _wrapper->createAction(getMenuId(), tr(
"Copy a Schema Item"), QIcon(
"icons:copy.png"),
414 tr(
"Copy Item"), tr(
"Copy a Schema Item"),
415 0, _parent,
false,
this, SLOT(onCopyItem()));
416 _copyItemAct->setShortcut(QKeySequence::Copy);
418 _pasteItemAct = _wrapper->createAction(getMenuId(), tr(
"Paste a Schema Item"), QIcon(
"icons:paste.png"),
419 tr(
"Paste Item"), tr(
"Paste a Schema Item"),
420 0, _parent,
false,
this, SLOT(onPasteItem()));
421 _pasteItemAct->setShortcut(QKeySequence::Paste);
423 _putInBlocAct = _wrapper->createAction(getMenuId(), tr(
"Put node in block"), QIcon(
"icons:paste.png"),
424 tr(
"Put node in block"), tr(
"Put node in block"),
425 0, _parent,
false,
this, SLOT(onPutInBloc()));
427 _putGraphInBlocAct = _wrapper->createAction(getMenuId(), tr(
"Bloc"), QIcon(
"icons:new_block_node.png"),
428 tr(
"Bloc"), tr(
"Bloc"),
429 0, _parent,
false,
this, SLOT(onPutGraphInBloc()));
431 _putGraphInForLoopAct = _wrapper->createAction(getMenuId(), tr(
"For Loop"), QIcon(
"icons:new_for_loop_node.png"),
432 tr(
"For Loop"), tr(
"For Loop"),
433 0, _parent,
false,
this, SLOT(onPutGraphInForLoop()));
435 _putGraphInWhileLoopAct = _wrapper->createAction(getMenuId(), tr(
"While Loop"), QIcon(
"icons:new_while_loop_node.png"),
436 tr(
"While Loop"), tr(
"While Loop"),
437 0, _parent,
false,
this, SLOT(onPutGraphInWhileLoop()));
439 _putGraphInOptimizerLoopAct = _wrapper->createAction(getMenuId(), tr(
"Optimizer Loop"), QIcon(
"icons:new_for_loop_node.png"),
440 tr(
"Optimizer Loop"), tr(
"Optimizer Loop"),
441 0, _parent,
false,
this, SLOT(onPutGraphInOptimizerLoop()));
443 _arrangeLocalNodesAct = _wrapper->createAction(getMenuId(), tr(
"arrange nodes on that bloc level, without recursion"), QIcon(
"icons:arrange_nodes.png"),
444 tr(
"arrange local nodes"), tr(
"arrange nodes on that bloc level, without recursion"),
445 0, _parent,
false,
this, SLOT(onArrangeLocalNodes()));
447 _arrangeRecurseNodesAct = _wrapper->createAction(getMenuId(), tr(
"arrange nodes on that bloc level, with recursion"), QIcon(
"icons:sample.png"),
448 tr(
"arrange nodes recursion"), tr(
"arrange nodes on that bloc level, with recursion"),
449 0, _parent,
false,
this, SLOT(onArrangeRecurseNodes()));
451 _computeLinkAct = _wrapper->createAction(getMenuId(), tr(
"compute orthogonal links"), QIcon(
"icons:rebuild_links.png"),
452 tr(
"compute links"), tr(
"compute orthogonal links"),
453 0, _parent,
false,
this, SLOT(onRebuildLinks()));
455 _zoomToBlocAct = _wrapper->createAction(getMenuId(), tr(
"zoom 2D view to selected bloc"), QIcon(
"icons:zoomToBloc.png"),
456 tr(
"zoom to bloc"), tr(
"zoom 2D view to the selected composed node"),
457 0, _parent,
false,
this, SLOT(onZoomToBloc()));
459 _centerOnNodeAct = _wrapper->createAction(getMenuId(), tr(
"center 2D view on selected node"), QIcon(
"icons:centerOnNode.png"),
460 tr(
"center on node"), tr(
"center 2D view on selected node"),
461 0, _parent,
false,
this, SLOT(onCenterOnNode()));
462 _centerOnNodeAct->setShortcut(QKeySequence::Find);
464 _shrinkExpand = _wrapper->createAction(getMenuId(), tr(
"shrink or expand the selected node"), QIcon(
"icons:shrinkExpand.png"),
465 tr(
"shrink/expand"), tr(
"shrink or expand the selected node"),
466 0, _parent,
false,
this, SLOT(onShrinkExpand()));
468 _shrinkExpandChildren = _wrapper->createAction(getMenuId(), tr(
"shrink or expand direct children of the selected node"), QIcon(
"icons:shrinkExpand.png"),
469 tr(
"shrink/expand children"), tr(
"shrink or expand direct children of the selected node"),
470 0, _parent,
false,
this, SLOT(onShrinkExpandChildren()));
472 _shrinkExpandElementaryRecursively = _wrapper->createAction(getMenuId(), tr(
"shrink or expand elementary nodes of the selected node recursively"), QIcon(
"icons:shrinkExpand.png"),
473 tr(
"shrink/expand elementary"), tr(
"shrink or expand elementary nodes of the selected node recursively"),
474 0, _parent,
false,
this, SLOT(onShrinkExpandElementaryRecursively()));
476 _toggleStraightLinksAct = _wrapper->createAction(getMenuId(), tr(
"draw straight or orthogonal links"), QIcon(
"icons:straightLink.png"),
477 tr(
"straight/orthogonal"), tr(
"draw straight or orthogonal links"),
478 0, _parent,
true,
this, SLOT(onToggleStraightLinks(
bool)));
480 _toggleStraightLinksAct->setChecked(Resource::straightLinks);
481 onToggleStraightLinks(Resource::straightLinks);
483 _toggleAutomaticComputeLinkAct = _wrapper->createAction(getMenuId(), tr(
"compute othogonal links automatically when nodes move"), QIcon(
"icons:autoComputeLink.png"),
484 tr(
"automatic link"), tr(
"compute othogonal links automatically when nodes move"),
485 0, _parent,
true,
this, SLOT(onToggleAutomaticComputeLinks(
bool)));
487 _toggleAutomaticComputeLinkAct->setChecked(Resource::autoComputeLinks);
488 onToggleAutomaticComputeLinks(Resource::autoComputeLinks);
490 _toggleSimplifyLinkAct = _wrapper->createAction(getMenuId(), tr(
"simplify links by removing unnecessary direction changes"), QIcon(
"icons:simplifyLink.png"),
491 tr(
"simplify links"), tr(
"simplify links by removing unnecessary direction changes"),
492 0, _parent,
true,
this, SLOT(onToggleSimplifyLinks(
bool)));
493 _toggleSimplifyLinkAct->setChecked(Resource::simplifyLink);
494 onToggleSimplifyLinks(Resource::simplifyLink);
496 _toggleForce2NodesLinkAct = _wrapper->createAction(getMenuId(), tr(
"force orthogonal links by adding an edge on simples links"), QIcon(
"icons:force2nodeLink.png"),
497 tr(
"force ortho links"), tr(
"force orthogonal links by adding an edge on simples links"),
498 0, _parent,
true,
this, SLOT(onToggleForce2NodesLinks(
bool)));
499 _toggleForce2NodesLinkAct->setChecked(
true);
501 _toggleAddRowColsAct = _wrapper->createAction(getMenuId(), tr(
"allow more path for the links, for a better separation"), QIcon(
"icons:addRowCols.png"),
502 tr(
"separate links"), tr(
"allow more path for the links, for a better separation"),
503 0, _parent,
true,
this, SLOT(onToggleAddRowCols(
bool)));
504 _toggleAddRowColsAct->setChecked(Resource::addRowCols);
505 onToggleAddRowCols(Resource::addRowCols);
507 _selectReferenceAct = _wrapper->createAction(getMenuId(), tr(
"select reference"), QIcon(
"icons:ob_service_node.png"),
508 tr(
"select reference"), tr(
"select reference"),
509 0, _parent,
false,
this, SLOT(onSelectReference()));
511 _whatsThisAct = _wrapper->createAction(getMenuId(), tr(
"active whatsThis Mode to get help on widgets"), QIcon(
"icons:whatsThis.png"),
512 tr(
"whatsThis Mode"), tr(
"active whatsThis Mode to get help on widgets"),
513 0, _parent,
false,
this, SLOT(onWhatsThis()));
514 _whatsThisAct->setShortcut(QKeySequence::WhatsThis);
516 _withoutStopModeAct = _wrapper->createAction(getMenuId(), tr(
"set execution mode without stop"), QIcon(
"icons:run_active.png"),
517 tr(
"mode without stop"), tr(
"set execution mode without stop"),
518 0, _parent,
true,
this, SLOT(onWithoutStopMode(
bool)));
520 _breakpointsModeAct = _wrapper->createAction(getMenuId(), tr(
"set execution mode with stop on breakpoints"), QIcon(
"icons:breakpoints_active.png"),
521 tr(
"mode breakpoints"), tr(
"set execution mode with stop on breakpoints"),
522 0, _parent,
true,
this, SLOT(onBreakpointsMode(
bool)));
524 _stepByStepModeAct = _wrapper->createAction(getMenuId(), tr(
"set execution mode step by step"), QIcon(
"icons:step_by_step_active.png"),
525 tr(
"mode step by step"), tr(
"set execution mode step by step"),
526 0, _parent,
true,
this, SLOT(onStepByStepMode(
bool)));
528 _toggleStopOnErrorAct = _wrapper->createAction(getMenuId(), tr(
"Force stop on first error during execution"), QIcon(
"icons:toggle_stop_on_error.png"),
529 tr(
"stop on error"), tr(
"Force stop on first error during execution"),
530 0, _parent,
true,
this, SLOT(onToggleStopOnError(
bool)));
532 _toggleSceneItemVisibleAct = _wrapper->createAction(getMenuId(), tr(
"toggle 2D scene item visibility"), QIcon(
"icons:toggleVisibility.png"),
533 tr(
"visible/hidden"), tr(
"toggle 2D scene item visibility"),
534 0, _parent,
true,
this, SLOT(onToggleSceneItemVisible(
bool)));
538 _showAllLinksAct = _wrapper->createAction(getMenuId(), tr(
"Show all the links"), QIcon(
"icons:showLink.png"),
539 tr(
"show all links"), tr(
"Show all the links"),
540 0, _parent,
false,
this, SLOT(onShowAllLinks()));
542 _hideAllLinksAct = _wrapper->createAction(getMenuId(), tr(
"Hide all the links"), QIcon(
"icons:hideLink.png"),
543 tr(
"hide all links"), tr(
"Hide all the links"),
544 0, _parent,
false,
this, SLOT(onHideAllLinks()));
547 _showOnlyPortLinksAct = _wrapper->createAction(getMenuId(), tr(
"Show only links from/to this port"), QIcon(
"icons:showLink.png"),
548 tr(
"show only links"), tr(
"Show only links from/to this port"),
549 0, _parent,
false,
this, SLOT(onShowOnlyPortLinks()));
551 _showPortLinksAct = _wrapper->createAction(getMenuId(), tr(
"Show links from/to this port"), QIcon(
"icons:showLink.png"),
552 tr(
"show links"), tr(
"Show links from/to this port"),
553 0, _parent,
false,
this, SLOT(onShowPortLinks()));
555 _hidePortLinksAct = _wrapper->createAction(getMenuId(), tr(
"Hide links from/to this port"), QIcon(
"icons:hideLink.png"),
556 tr(
"hide links"), tr(
"Hide links from/to this port"),
557 0, _parent,
false,
this, SLOT(onHidePortLinks()));
560 _showOnlyCtrlLinksAct = _wrapper->createAction(getMenuId(), tr(
"Show only control links from/to this node"), QIcon(
"icons:showLink.png"),
561 tr(
"show only Control links"), tr(
"Show only control links from/to this node"),
562 0, _parent,
false,
this, SLOT(onShowOnlyCtrlLinks()));
564 _showCtrlLinksAct = _wrapper->createAction(getMenuId(), tr(
"Show control links from/to this node"), QIcon(
"icons:showLink.png"),
565 tr(
"show control links"), tr(
"Show control links from/to this node"),
566 0, _parent,
false,
this, SLOT(onShowCtrlLinks()));
568 _hideCtrlLinksAct = _wrapper->createAction(getMenuId(), tr(
"Hide control links from/to this node"), QIcon(
"icons:hideLink.png"),
569 tr(
"hide control links"), tr(
"Hide control links from/to this node"),
570 0, _parent,
false,
this, SLOT(onHideCtrlLinks()));
573 _showOnlyLinkAct = _wrapper->createAction(getMenuId(), tr(
"Show only this link"), QIcon(
"icons:showLink.png"),
574 tr(
"show only"), tr(
"Show only this link"),
575 0, _parent,
false,
this, SLOT(onShowOnlyLink()));
577 _showLinkAct = _wrapper->createAction(getMenuId(), tr(
"Show this link"), QIcon(
"icons:showLink.png"),
578 tr(
"show"), tr(
"Show this link"),
579 0, _parent,
false,
this, SLOT(onShowLink()));
581 _hideLinkAct = _wrapper->createAction(getMenuId(), tr(
"Hide this link"), QIcon(
"icons:hideLink.png"),
582 tr(
"hide"), tr(
"Hide this link"),
583 0, _parent,
false,
this, SLOT(onHideLink()));
586 _emphasisPortLinksAct = _wrapper->createAction(getMenuId(), tr(
"emphasis on links from/to this port"), QIcon(
"icons:emphasisLink.png"),
587 tr(
"emphasize links"), tr(
"emphasis on links from/to this port"),
588 0, _parent,
false,
this, SLOT(onEmphasisPortLinks()));
590 _emphasisCtrlLinksAct = _wrapper->createAction(getMenuId(), tr(
"emphasis on control links from/to this node"), QIcon(
"icons:emphasisLink.png"),
591 tr(
"emphasize control links"), tr(
"emphasis on control links from/to this node"),
592 0, _parent,
false,
this, SLOT(onEmphasisCtrlLinks()));
594 _emphasisLinkAct = _wrapper->createAction(getMenuId(), tr(
"emphasis on this link"), QIcon(
"icons:emphasisLink.png"),
595 tr(
"emphasize"), tr(
"emphasis on this link"),
596 0, _parent,
false,
this, SLOT(onEmphasisLink()));
598 _deEmphasizeAllAct = _wrapper->createAction(getMenuId(), tr(
"remove all emphasis"), QIcon(
"icons:deEmphasisLink.png"),
599 tr(
"remove all emphasis"), tr(
"remove all emphasis"),
600 0, _parent,
false,
this, SLOT(onDeEmphasizeAll()));
603 _undoAct = _wrapper->createAction(getMenuId(), tr(
"undo last action"), QIcon(
"icons:undo.png"),
604 tr(
"undo"), tr(
"undo last action"),
605 0, _parent,
false,
this, SLOT(onUndo()));
606 _undoAct->setShortcut(QKeySequence::Undo);
608 _redoAct = _wrapper->createAction(getMenuId(), tr(
"redo last action"), QIcon(
"icons:redo.png"),
609 tr(
"redo"), tr(
"redo last action"),
610 0, _parent,
false,
this, SLOT(onRedo()));
611 _redoAct->setShortcut(QKeySequence::Redo);
613 _showUndoAct = _wrapper->createAction(getMenuId(), tr(
"show undo commands"), QIcon(
"icons:undo.png"),
614 tr(
"show undo"), tr(
"show undo commands"),
615 0, _parent,
false,
this, SLOT(onShowUndo()));
617 _showRedoAct = _wrapper->createAction(getMenuId(), tr(
"show redo commands"), QIcon(
"icons:redo.png"),
618 tr(
"show redo"), tr(
"show redo commands"),
619 0, _parent,
false,
this, SLOT(onShowRedo()));
622 _execModeGroup =
new QActionGroup(
this);
623 _execModeGroup->addAction(_withoutStopModeAct);
624 _execModeGroup->addAction(_breakpointsModeAct);
625 _execModeGroup->addAction(_stepByStepModeAct);
626 _withoutStopModeAct->setChecked(
true);
629 void GenericGui::createMenus()
632 aMenuId = _wrapper->createMenu( tr(
"File" ), -1, -1 );
633 _wrapper->createMenu( _wrapper->separator(), aMenuId, -1, 10 );
634 aMenuId = _wrapper->createMenu(
"YACS", aMenuId, -1, 10 );
635 _wrapper->createMenu( _newSchemaAct, aMenuId );
636 _wrapper->createMenu( _importSchemaAct, aMenuId );
638 aMenuId = _wrapper->createMenu(
"YACS", -1, -1, 30 );
639 _wrapper->createMenu( _newSchemaAct, aMenuId );
640 _wrapper->createMenu( _importSchemaAct, aMenuId );
641 _wrapper->createMenu( _importSupervSchemaAct, aMenuId );
642 _wrapper->createMenu( _wrapper->separator(), aMenuId);
643 _wrapper->createMenu( _exportSchemaAct, aMenuId );
644 _wrapper->createMenu( _exportSchemaAsAct, aMenuId );
645 _wrapper->createMenu( _wrapper->separator(), aMenuId);
646 _wrapper->createMenu( _runLoadedSchemaAct, aMenuId );
647 _wrapper->createMenu( _loadRunStateSchemaAct, aMenuId );
648 _wrapper->createMenu( _loadAndRunSchemaAct, aMenuId );
649 _wrapper->createMenu( _chooseBatchJobAct, aMenuId );
650 _wrapper->createMenu( _wrapper->separator(), aMenuId);
651 _wrapper->createMenu( _undoAct, aMenuId );
652 _wrapper->createMenu( _redoAct, aMenuId );
653 _wrapper->createMenu( _showUndoAct, aMenuId );
654 _wrapper->createMenu( _showRedoAct, aMenuId );
655 _wrapper->createMenu( _wrapper->separator(), aMenuId);
656 _wrapper->createMenu( _startResumeAct, aMenuId );
657 _wrapper->createMenu( _abortAct, aMenuId );
658 _wrapper->createMenu( _pauseAct, aMenuId );
659 _wrapper->createMenu( _resetAct, aMenuId );
660 _wrapper->createMenu( _wrapper->separator(), aMenuId);
661 _wrapper->createMenu( _saveRunStateAct, aMenuId );
663 _wrapper->createMenu( _wrapper->separator(), aMenuId);
664 _wrapper->createMenu( _withoutStopModeAct, aMenuId );
665 _wrapper->createMenu( _breakpointsModeAct, aMenuId );
666 _wrapper->createMenu( _stepByStepModeAct, aMenuId );
667 _wrapper->createMenu( _wrapper->separator(), aMenuId);
668 _wrapper->createMenu( _toggleStopOnErrorAct, aMenuId );
669 _wrapper->createMenu( _wrapper->separator(), aMenuId);
670 _wrapper->createMenu( _importCatalogAct, aMenuId );
671 _wrapper->createMenu( _wrapper->separator(), aMenuId);
672 _wrapper->createMenu( _toggleStraightLinksAct, aMenuId );
673 _wrapper->createMenu( _toggleAutomaticComputeLinkAct, aMenuId );
674 _wrapper->createMenu( _toggleSimplifyLinkAct, aMenuId );
675 _wrapper->createMenu( _toggleForce2NodesLinkAct, aMenuId );
676 _wrapper->createMenu( _toggleAddRowColsAct, aMenuId );
677 _wrapper->createMenu( _wrapper->separator(), aMenuId);
678 _wrapper->createMenu( _showAllLinksAct, aMenuId );
679 _wrapper->createMenu( _hideAllLinksAct, aMenuId );
680 _wrapper->createMenu( _wrapper->separator(), aMenuId);
681 _wrapper->createMenu( _whatsThisAct, aMenuId );
684 void GenericGui::createTools()
686 int aToolId = _wrapper->createTool ( tr(
"YACS Toolbar" ), QString(
"YACSToolbar" ) );
687 _wrapper->createTool( _newSchemaAct, aToolId );
688 _wrapper->createTool( _importSchemaAct, aToolId );
689 _wrapper->createTool( _wrapper->separator(), aToolId );
690 _wrapper->createTool( _exportSchemaAct, aToolId );
691 _wrapper->createTool( _exportSchemaAsAct, aToolId );
692 _wrapper->createTool( _wrapper->separator(), aToolId);
693 _wrapper->createTool( _runLoadedSchemaAct, aToolId );
694 _wrapper->createTool( _loadRunStateSchemaAct, aToolId );
695 _wrapper->createTool( _loadAndRunSchemaAct, aToolId );
696 _wrapper->createTool( _chooseBatchJobAct, aToolId );
697 _wrapper->createTool( _wrapper->separator(), aToolId );
698 _wrapper->createTool( _undoAct, aToolId );
699 _wrapper->createTool( _redoAct, aToolId );
700 _wrapper->createTool( _wrapper->separator(), aToolId );
701 _wrapper->createTool( _startResumeAct, aToolId );
702 _wrapper->createTool( _abortAct, aToolId );
703 _wrapper->createTool( _pauseAct, aToolId );
704 _wrapper->createTool( _resetAct, aToolId );
705 _wrapper->createTool( _wrapper->separator(), aToolId );
706 _wrapper->createTool( _saveRunStateAct, aToolId );
708 _wrapper->createTool( _withoutStopModeAct, aToolId );
709 _wrapper->createTool( _breakpointsModeAct, aToolId );
710 _wrapper->createTool( _stepByStepModeAct, aToolId );
711 _wrapper->createTool( _wrapper->separator(), aToolId );
712 _wrapper->createTool( _toggleStopOnErrorAct, aToolId );
713 _wrapper->createTool( _wrapper->separator(), aToolId );
714 _wrapper->createTool( _importCatalogAct, aToolId );
715 _wrapper->createTool( _wrapper->separator(), aToolId );
716 _wrapper->createTool( _toggleStraightLinksAct, aToolId );
717 _wrapper->createTool( _toggleAutomaticComputeLinkAct, aToolId );
718 _wrapper->createTool( _toggleSimplifyLinkAct, aToolId );
720 _wrapper->createTool( _toggleAddRowColsAct, aToolId );
721 _wrapper->createTool( _wrapper->separator(), aToolId );
722 _wrapper->createTool( _showAllLinksAct, aToolId );
723 _wrapper->createTool( _hideAllLinksAct, aToolId );
724 _wrapper->createTool( _wrapper->separator(), aToolId );
725 _wrapper->createTool( _whatsThisAct, aToolId );
728 void GenericGui::initialMenus()
730 showEditionMenus(
false);
731 showExecMenus(
false);
732 showCommonMenus(
false);
736 void GenericGui::hideAllMenus()
738 showBaseMenus (
false);
739 showCommonMenus (
false);
740 showEditionMenus(
false);
741 showExecMenus (
false);
744 void GenericGui::showBaseMenus(
bool show)
746 DEBTRACE(
"GenericGui::showBaseMenus " << show);
747 _wrapper->setMenuShown(_newSchemaAct, show);
748 _wrapper->setToolShown(_newSchemaAct, show);
749 _wrapper->setMenuShown(_importSchemaAct, show);
750 _wrapper->setToolShown(_importSchemaAct, show);
751 _wrapper->setMenuShown(_importSupervSchemaAct, show);
752 _wrapper->setMenuShown(_loadAndRunSchemaAct, show);
753 _wrapper->setToolShown(_loadAndRunSchemaAct, show);
754 _wrapper->setMenuShown(_chooseBatchJobAct, show);
755 _wrapper->setToolShown(_chooseBatchJobAct, show);
756 _wrapper->setMenuShown(_whatsThisAct, show);
757 _wrapper->setToolShown(_whatsThisAct, show);
760 void GenericGui::showEditionMenus(
bool show)
762 DEBTRACE(
"GenericGui::showEditionMenus " << show);
763 _wrapper->setMenuShown(_exportSchemaAct, show);
764 _wrapper->setToolShown(_exportSchemaAct, show);
765 _wrapper->setMenuShown(_exportSchemaAsAct, show);
766 _wrapper->setToolShown(_exportSchemaAsAct, show);
767 _wrapper->setMenuShown(_runLoadedSchemaAct, show);
768 _wrapper->setToolShown(_loadRunStateSchemaAct, show);
769 _wrapper->setMenuShown(_loadRunStateSchemaAct, show);
770 _wrapper->setToolShown(_runLoadedSchemaAct, show);
771 _wrapper->setMenuShown(_undoAct, show);
772 _wrapper->setToolShown(_undoAct, show);
773 _wrapper->setMenuShown(_redoAct, show);
774 _wrapper->setToolShown(_redoAct, show);
775 _wrapper->setMenuShown(_showUndoAct, show);
776 _wrapper->setMenuShown(_showRedoAct, show);
777 _wrapper->setMenuShown(_importCatalogAct, show);
778 _wrapper->setToolShown(_importCatalogAct, show);
781 void GenericGui::showExecMenus(
bool show)
783 DEBTRACE(
"GenericGui::showExecMenus " << show);
784 _wrapper->setMenuShown(_startResumeAct, show);
785 _wrapper->setToolShown(_startResumeAct, show);
786 _wrapper->setMenuShown(_abortAct, show);
787 _wrapper->setToolShown(_abortAct, show);
788 _wrapper->setMenuShown(_pauseAct, show);
789 _wrapper->setToolShown(_pauseAct, show);
790 _wrapper->setMenuShown(_resetAct, show);
791 _wrapper->setToolShown(_resetAct, show);
792 _wrapper->setMenuShown(_saveRunStateAct, show);
793 _wrapper->setToolShown(_saveRunStateAct, show);
796 _wrapper->setMenuShown(_withoutStopModeAct, show);
797 _wrapper->setToolShown(_withoutStopModeAct, show);
798 _wrapper->setMenuShown(_breakpointsModeAct, show);
799 _wrapper->setToolShown(_breakpointsModeAct, show);
800 _wrapper->setMenuShown(_stepByStepModeAct, show);
801 _wrapper->setToolShown(_stepByStepModeAct, show);
802 _wrapper->setMenuShown(_toggleStopOnErrorAct, show);
803 _wrapper->setToolShown(_toggleStopOnErrorAct, show);
806 void GenericGui::showCommonMenus(
bool show)
808 DEBTRACE(
"GenericGui::showCommonMenus " << show);
809 _wrapper->setMenuShown(_toggleStraightLinksAct, show);
810 _wrapper->setToolShown(_toggleStraightLinksAct, show);
811 _wrapper->setMenuShown(_toggleAutomaticComputeLinkAct, show);
812 _wrapper->setToolShown(_toggleAutomaticComputeLinkAct, show);
813 _wrapper->setMenuShown(_toggleSimplifyLinkAct, show);
814 _wrapper->setToolShown(_toggleSimplifyLinkAct, show);
815 _wrapper->setMenuShown(_toggleForce2NodesLinkAct, show);
817 _wrapper->setMenuShown(_toggleAddRowColsAct, show);
818 _wrapper->setToolShown(_toggleAddRowColsAct, show);
819 _wrapper->setMenuShown(_showAllLinksAct, show);
820 _wrapper->setToolShown(_showAllLinksAct, show);
821 _wrapper->setMenuShown(_hideAllLinksAct, show);
822 _wrapper->setToolShown(_hideAllLinksAct, show);
825 void GenericGui::switchContext(
QWidget *view,
bool onExit)
827 DEBTRACE(
"GenericGui::switchContext " << view);
828 if (! _mapViewContext.count(view))
830 onExit ? hideAllMenus() : initialMenus();
831 _dwTree->setWidget(0);
832 _dwStacked->setWidget(0);
838 _dwTree->widget()->show();
842 QtGuiContext::setQtCurrent(newContext);
846 showExecMenus(
false);
848 showEditionMenus(
true);
849 showCommonMenus(
true);
850 if (_dwTree) _dwTree->setWindowTitle(
"Tree View: edition mode");
854 showEditionMenus(
false);
857 showCommonMenus(
true);
858 _withoutStopModeAct->setChecked(
true);
859 if (_dwTree) _dwTree->setWindowTitle(
"Tree View: execution mode");
861 _dwStacked->setMinimumWidth(10);
864 bool GenericGui::closeContext(
QWidget *view,
bool onExit)
866 DEBTRACE(
"GenericGui::closeContext " << onExit);
867 if (! _mapViewContext.count(view))
872 bool tryToSave =
false;
874 if (QtGuiContext::getQtCurrent()->isEdition())
876 if (!QtGuiContext::getQtCurrent()->_setOfModifiedSubjects.empty())
879 msgBox.setText(
"Some elements are modified and not taken into account.");
880 string info =
"do you want to apply your changes ?\n";
881 info +=
" - Save : do not take into account edition in progress,\n";
882 info +=
" but if there are other modifications, select a file name for save\n";
883 info +=
" - Discard : discard all modifications and close the schema";
885 info +=
"\n - Cancel : do not close the schema, return to edition";
886 msgBox.setInformativeText(info.c_str());
889 msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
890 msgBox.setDefaultButton(QMessageBox::Cancel);
894 msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard);
895 msgBox.setDefaultButton(QMessageBox::Save);
897 int ret = msgBox.exec();
900 case QMessageBox::Save:
903 case QMessageBox::Discard:
906 case QMessageBox::Cancel:
914 if (QtGuiContext::getQtCurrent()->isNotSaved())
917 msgBox.setWindowTitle(
"Close the active schema");
918 msgBox.setText(
"The schema has been modified");
919 string info =
"do you want to save the schema ?\n";
920 info +=
" - Save : select a file name for save\n";
921 info +=
" - Discard : discard all modifications and close the schema";
923 info +=
"\n - Cancel : do not close the schema, return to edition";
924 msgBox.setInformativeText(info.c_str());
927 msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
928 msgBox.setDefaultButton(QMessageBox::Cancel);
932 msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard);
933 msgBox.setDefaultButton(QMessageBox::Save);
935 int ret = msgBox.exec();
938 case QMessageBox::Save:
941 case QMessageBox::Discard:
944 case QMessageBox::Cancel:
955 if ((!onExit) && (!_isSaved))
960 map<QWidget*, YACS::HMI::QtGuiContext*>::iterator it = _mapViewContext.begin();
963 for (; it != _mapViewContext.end(); ++it)
965 if ((*it).second != context)
967 newView = (*it).first;
968 newContext = (*it).second;
972 int studyId = _wrapper->activeStudyId();
975 _wrapper->deleteSchema(view);
979 exec->closeContext();
982 _mapViewContext.
erase(view);
983 switchContext(newView, onExit);
988 void GenericGui::showDockWidgets(
bool isVisible)
990 DEBTRACE(
"GenericGui::showDockWidgets " << isVisible);
991 if (_dwTree) _dwTree->setVisible(isVisible);
992 if (_dwTree) _dwTree->toggleViewAction()->setVisible(isVisible);
993 if (_dwStacked) _dwStacked->setVisible(isVisible);
994 if (_dwStacked) _dwStacked->toggleViewAction()->setVisible(isVisible);
995 if (_dwCatalogs) _dwCatalogs->setVisible(isVisible);
996 if (_dwCatalogs) _dwCatalogs->toggleViewAction()->setVisible(isVisible);
999 void GenericGui::raiseStacked()
1001 if (_dwStacked) _dwStacked->raise();
1004 std::list<std::string> GenericGui::getMachineList()
1006 if (!_machineList.empty())
return _machineList;
1010 if (!orb)
return _machineList;
1012 SALOME_NamingService namingService(orb);
1013 SALOME_LifeCycleCORBA lcc(&namingService);
1015 CORBA::Object_var obj =
1016 namingService.Resolve(SALOME_ResourcesManager::_ResourcesManagerNameInNS);
1017 if (CORBA::is_nil(obj))
return _machineList;
1019 Engines::ResourcesManager_var resManager = Engines::ResourcesManager::_narrow(obj);
1020 if(!resManager)
return _machineList;
1022 Engines::ResourceParameters params;
1025 Engines::ResourceList* resourceList =
1026 resManager->GetFittingResources(params);
1028 for (
int i = 0;
i < resourceList->length();
i++)
1030 const char* aResource = (*resourceList)[
i];
1031 _machineList.push_back(aResource);
1034 return _machineList;
1049 const QString& schemaName,
1050 const QString& runName,
1053 DEBTRACE(
"GenericGui::createContext");
1059 QWidget* central = _parent->centralWidget();
1061 central->setFocus();
1069 fileName = schemaName;
1074 if (QtGuiContext::getQtCurrent())
1075 refWindow = QtGuiContext::getQtCurrent()->getWindow();
1079 QtGuiContext::setQtCurrent(context);
1091 QWidget *viewWindow = _wrapper->getNewWindow(scene);
1092 _mapViewContext[viewWindow] = context;
1094 gView->setScene(scene);
1095 gView->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
1096 int studyId = _wrapper->AssociateViewToWindow(gView, viewWindow);
1098 std::ostringstream value;
1116 editTree->setMinimumHeight(400);
1117 _dwTree->setWidget(editTree);
1120 editTree->tv_schema->setModel(schemaModel);
1124 QObject::connect(editTree->tv_schema->selectionModel(),
1125 SIGNAL(selectionChanged(
const QItemSelection &,
const QItemSelection &)),
1127 SLOT(updateSelection(
const QItemSelection &,
const QItemSelection &)));
1131 QStackedWidget *stacked =
new QStackedWidget(_dwStacked);
1132 _dwStacked->setWidget(stacked);
1139 QObject::connect(schemaModel,
1140 SIGNAL(signalSelection(
const QModelIndex &)),
1141 editTree->tv_schema,
1142 SLOT(viewSelection(
const QModelIndex &)));
1150 double passe = (end_t -start_t);
1151 passe = passe/CLOCKS_PER_SEC;
1152 DEBTRACE(
"create context -1- : " << passe);
1159 setLoadedPresentation(proc);
1163 double passe = (end_t -start_t);
1164 passe = passe/CLOCKS_PER_SEC;
1165 DEBTRACE(
"create context - load proc- : " << passe);
1171 if (forEdition && _wrapper)
1173 _wrapper->createNewSchema(fileName, viewWindow);
1179 _wrapper->createNewRun(schemaName, fileName, refWindow, viewWindow);
1183 QtGuiContext::getQtCurrent()->getSubjectProc()->update(
UPDATE,
1184 ProcInvoc::getTypeOfNode(proc),
1192 _catalogsWidget->setMinimumWidth(10);
1193 editTree->setMinimumHeight(40);
1194 _dwStacked->setMinimumWidth(10);
1199 showExecMenus(
false);
1200 showEditionMenus(
true);
1201 showCommonMenus(
true);
1202 if (_dwTree) _dwTree->setWindowTitle(
"Tree View: edition mode");
1206 showEditionMenus(
false);
1207 showExecMenus(
true);
1208 showCommonMenus(
true);
1209 _withoutStopModeAct->setChecked(
true);
1210 if (_dwTree) _dwTree->setWindowTitle(
"Tree View: execution mode");
1213 QtGuiContext::getQtCurrent()->setNotSaved(
false);
1216 double passe = (end_t -start_t);
1217 passe = passe/CLOCKS_PER_SEC;
1218 DEBTRACE(
"create context - end - : " << passe);
1227 DEBTRACE(
"GenericGui::setLoadedPresentation");
1228 QtGuiContext::getQtCurrent()->setLoadingPresentation(
true);
1229 map<SceneNodeItem*, QPointF> nodesToMove;
1230 map<YACS::ENGINE::Node*, PrsData> presNodes = _loader->getPrsData(proc);
1231 if (!presNodes.empty())
1233 map<YACS::ENGINE::Node*, PrsData>::iterator it = presNodes.begin();
1234 for (; it!= presNodes.end(); ++it)
1238 SubjectNode *snode = QtGuiContext::getQtCurrent()->_mapOfSubjectNode[node];
1239 SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[snode];
1243 inode->setPos(QPointF(pres.
_x, pres.
_y));
1247 QPointF anExpandedPos = QPointF(pres.
_expx, pres.
_expy);
1248 if (anExpandedPos.isNull())
1249 anExpandedPos = inode->pos();
1256 qreal anX = inode->x();
1257 qreal anY = inode->y();
1262 if (anY < inode->getParent()->getHeaderBottom())
1267 QtGuiContext::getQtCurrent()->setLoadingPresentation(
false);
1272 map<SceneNodeItem*, QPointF>::iterator it = nodesToMove.begin();
1273 for (; it!= nodesToMove.end(); ++it)
1275 (*it).first->setTopLeft((*it).second);
1279 if (Scene::_autoComputeLinks)
1280 _guiEditor->rebuildLinks();
1284 SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[subproc];
1292 void GenericGui::onNewSchema()
1294 DEBTRACE(
"GenericGui::onNewSchema");
1296 std::stringstream name;
1297 name <<
"newSchema_" << ++_schemaCnt;
1304 QString fileName = name.str().c_str();
1305 createContext(proc, fileName,
"",
true);
1308 void GenericGui::loadSchema(
const std::string& filename,
bool edit,
bool arrangeLocalNodes)
1318 QString fn=QString::fromUtf8(filename.c_str());
1320 createContext(proc, fn,
"",
true);
1322 createContext(proc, fn, fn,
false);
1323 if (arrangeLocalNodes)
1325 _guiEditor->arrangeProc();
1329 void GenericGui::onImportSchema()
1334 DEBTRACE(
"GenericGui::onImportSchema");
1335 QFileDialog dialog(_parent,
1336 "Choose a filename to load" ,
1338 tr(
"XML-Files (*.xml);;All Files (*)" ));
1340 dialog.setHistory(_wrapper->getQuickDirList());
1343 QStringList fileNames;
1346 fileNames = dialog.selectedFiles();
1347 if (!fileNames.isEmpty())
1348 fn = fileNames.first();
1351 if ( !fn.isEmpty() )
1355 if (!fi.exists() && fi.suffix() !=
"xml")
1358 DEBTRACE(
"file loaded : " <<fn.toUtf8().constData());
1362 proc = _loader->load(fn.toUtf8().constData());
1369 double passe = (end_t -start_t);
1370 passe = passe/CLOCKS_PER_SEC;
1371 DEBTRACE(
"load xml file : " << passe);
1377 QMessageBox msgBox(QMessageBox::Critical,
1378 "Import YACS Schema, native YACS XML format",
1379 "The file has not the native YACS XML format or is not readable.");
1388 createContext(proc, fn,
"",
true);
1392 void GenericGui::onImportSupervSchema()
1394 DEBTRACE(
"GenericGui::onImportSupervSchema");
1395 QFileDialog dialog(_parent,
1396 "Choose a SUPERV filename to load" ,
1398 tr(
"XML-Files (*.xml);;All Files (*)" ));
1400 dialog.setHistory(_wrapper->getQuickDirList());
1403 QStringList fileNames;
1406 fileNames = dialog.selectedFiles();
1407 if (!fileNames.isEmpty())
1408 fn = fileNames.first();
1411 if (fn.isEmpty())
return;
1415 if (!fi.exists() && fi.suffix() !=
"xml")
1418 DEBTRACE(
"file loaded : " <<fn.toStdString());
1419 QString tmpFileName;
1423 QString tmpDir = getenv(
"TEMP");
1424 QString fileExt =
"bat";
1426 QString tmpDir =
"/tmp";
1427 QString fileExt =
"sh";
1429 QDir aTmpDir(tmpDir);
1430 aTmpDir.mkdir(QString(
"YACS_") + getenv(
"USER"));
1431 YASSERT(aTmpDir.cd(QString(
"YACS_") + getenv(
"USER")));
1432 QDateTime curTime = QDateTime::currentDateTime();
1433 tmpFileName =
"SUPERV_import_" + curTime.toString(
"yyyyMMdd_hhmmss") +
".xml";
1434 QString tmpOutput =
"salomeloader_output";
1435 tmpFileName = aTmpDir.absoluteFilePath(tmpFileName);
1436 DEBTRACE(tmpFileName.toStdString());
1438 QString aCall =
"salomeloader."+ fileExt+
" "+ fn +
" " + tmpFileName +
" > " + tmpOutput;
1441 int ret = system(aCall.toLatin1());
1445 fstream
f(tmpOutput.toLatin1());
1451 int status=WEXITSTATUS(ret);
1454 QString mes =
"Problems in conversion: some errors but an incomplete proc has nevertheless been created.\n\n";
1455 mes += QString(hfile.str().c_str());
1456 QMessageBox msgBox(QMessageBox::Warning,
1457 "Import YACS Schema, SUPERV XML format",
1461 else if(status == 2)
1463 QString mes =
"Problems in conversion: a fatal error has been encountered. The proc can't be created.\n\n";
1464 mes += QString(hfile.str().c_str());
1465 QMessageBox msgBox(QMessageBox::Critical,
1466 "Import YACS Schema, SUPERV XML format",
1473 DEBTRACE(
"Unknown problem: " << ret );
1474 QMessageBox msgBox(QMessageBox::Critical,
1475 "Import YACS Schema, SUPERV XML format",
1476 "Unexpected exception in salomeloader.");
1484 QMessageBox msgBox(QMessageBox::Critical,
1485 "Import YACS Schema, SUPERV XML format",
1486 "Unexpected exception in convertSupervFile");
1492 if (fn.isEmpty())
return;
1494 DEBTRACE(
"file loaded : " <<fn.toStdString());
1498 QMessageBox msgBox(QMessageBox::Critical,
1499 "Import YACS Schema, SUPERV file converted in native YACS XML format",
1500 "The file has not the native YACS XML format or is not readable.");
1509 createContext(proc, fn,
"",
true);
1513 QString GenericGui::getSaveFileName(
const QString& fileName)
1515 QFileDialog dialog(_parent,
"Save schema", fileName);
1516 QStringList filters;
1517 filters <<
"XML files (*.xml)"
1519 dialog.setFileMode(QFileDialog::AnyFile);
1520 dialog.setNameFilters(filters);
1521 dialog.selectNameFilter(
"(*.xml)");
1522 dialog.setDefaultSuffix(
"xml");
1523 dialog.setConfirmOverwrite(
true);
1525 dialog.setAcceptMode(QFileDialog::AcceptSave);
1526 QString selectedFile;
1527 QStringList fileNames;
1529 if (
bool ret = dialog.exec())
1531 DEBTRACE(
ret <<
" " << dialog.confirmOverwrite());
1532 fileNames = dialog.selectedFiles();
1533 if (!fileNames.isEmpty())
1534 selectedFile = fileNames.first();
1536 QString filteredName = _guiEditor->asciiFilter(selectedFile);
1537 DEBTRACE(filteredName.toStdString());
1538 return filteredName;
1541 void GenericGui::onExportSchema()
1543 DEBTRACE(
"GenericGui::onExportSchema");
1544 if (!QtGuiContext::getQtCurrent())
return;
1546 QString fo = QtGuiContext::getQtCurrent()->getFileName();
1549 if (fo.startsWith(
"newSchema_"))
1552 fn = getSaveFileName(fo);
1554 if (fn.isEmpty())
return;
1556 DEBTRACE(
"GenericGui::onExportSchema: " << fn.toUtf8().constData());
1558 _parent->setFocus();
1559 QtGuiContext::getQtCurrent()->setFileName(fn);
1564 QtGuiContext::getQtCurrent()->setNotSaved(
false);
1566 if (fn.compare(foo) && _wrapper)
1567 _wrapper->renameSchema(foo, fn, QtGuiContext::getQtCurrent()->getWindow());
1570 void GenericGui::onExportSchemaAs()
1572 DEBTRACE(
"GenericGui::onExportSchemaAs");
1574 if (!QtGuiContext::getQtCurrent())
return;
1576 QString fo = QtGuiContext::getQtCurrent()->getFileName();
1578 if (fo.startsWith(
"newSchema_")) fo.clear();
1579 QString fn = getSaveFileName(fo);
1580 if (fn.isEmpty())
return;
1582 DEBTRACE(
"GenericGui::onExportSchemaAs: " << fn.toUtf8().constData());
1583 QtGuiContext::getQtCurrent()->setFileName(fn);
1589 QtGuiContext::getQtCurrent()->setNotSaved(
false);
1591 if (fn.compare(foo) && _wrapper)
1592 _wrapper->renameSchema(foo, fn, QtGuiContext::getQtCurrent()->getWindow());
1595 void GenericGui::onImportCatalog()
1597 DEBTRACE(
"GenericGui::onImportCatalog");
1598 QFileDialog dialog(_parent,
1599 "Choose a YACS Schema to load as a Catalog" ,
1601 tr(
"XML-Files (*.xml);;All Files (*)" ));
1603 dialog.setHistory(_wrapper->getQuickDirList());
1606 QStringList fileNames;
1609 fileNames = dialog.selectedFiles();
1610 if (!fileNames.isEmpty())
1611 fn = fileNames.first();
1614 if ( !fn.isEmpty() )
1615 _catalogsWidget->addCatalogFromFile(fn.toStdString());
1618 void GenericGui::onRunLoadedSchema(
bool withState)
1620 DEBTRACE(
"GenericGui::onRunLoadedSchema");
1621 if (!QtGuiContext::getQtCurrent())
return;
1629 if (!QtGuiContext::getQtCurrent()->_setOfModifiedSubjects.empty())
1631 set<Subject*>::iterator it = QtGuiContext::getQtCurrent()->_setOfModifiedSubjects.begin();
1632 (*it)->select(
true);
1639 QtGuiContext::getQtCurrent()->getSubjectProc()->select(
true);
1651 QtGuiContext::getQtCurrent()->getSubjectProc()->select(
true);
1658 double passe = (end_t -start_t);
1659 passe = passe/CLOCKS_PER_SEC;
1660 cerr <<
"run schema -1- : " << passe << endl;
1665 QFileInfo fo = QtGuiContext::getQtCurrent()->getFileName();
1666 QString procName = fo.baseName();
1669 QString tmpDir = getenv(
"TEMP");
1671 QString tmpDir =
"/tmp";
1673 QDir aTmpDir(tmpDir);
1674 aTmpDir.mkdir(QString(
"YACS_") + getenv(
"USER"));
1675 YASSERT(aTmpDir.cd(QString(
"YACS_") + getenv(
"USER")));
1676 QDateTime curTime = QDateTime::currentDateTime();
1677 QString aRunName = procName +
"_" + curTime.toString(
"yyyyMMdd_hhmmss") +
".xml";
1678 aRunName = aTmpDir.absoluteFilePath(aRunName);
1682 aWriter.openFileSchema(aRunName.toStdString());
1683 aWriter.visitProc();
1684 aWriter.closeFileSchema();
1691 double passe = (end_t -start_t);
1692 passe = passe/CLOCKS_PER_SEC;
1693 cerr <<
"run schema -2- : " << passe << endl;
1696 createContext(procrun, QtGuiContext::getQtCurrent()->getFileName(), aRunName,
false);
1700 GuiExecutor *executor = QtGuiContext::getQtCurrent()->getGuiExecutor();
1701 if (!executor)
return;
1704 QString fn = QFileDialog::getOpenFileName( _parent,
1705 "Choose a previous run state to load" ,
1707 tr(
"XML-Files (*.xml);;All Files (*)" ));
1710 DEBTRACE(
"run state to load: " <<fn.toStdString());
1715 if(_toggleStopOnErrorAct->isChecked())
1719 void GenericGui::onLoadRunStateSchema()
1721 DEBTRACE(
"GenericGui::onLoadRunStateSchema");
1722 onRunLoadedSchema(
true);
1725 void GenericGui::onLoadAndRunSchema()
1727 DEBTRACE(
"GenericGui::onLoadAndRunSchema");
1728 QString fn = QFileDialog::getOpenFileName( _parent,
1729 "Choose a filename to load" ,
1731 tr(
"XML-Files (*.xml);;All Files (*)" ));
1732 if ( !fn.isEmpty() )
1736 if (!fi.exists() && fi.suffix() !=
"xml")
1739 DEBTRACE(
"file loaded : " <<fn.toStdString());
1743 proc = _loader->load(fn.toLatin1());
1750 QMessageBox msgBox(QMessageBox::Critical,
1751 "Import YACS Schema, native YACS XML format",
1752 "The file has not the native YACS XML format or is not readable.");
1761 createContext(proc, fn,
"",
true);
1762 onRunLoadedSchema();
1766 void GenericGui::onChooseBatchJob() {
1767 DEBTRACE(
"GenericGui::onChooseBatchJob");
1770 if(_BJLdialog)
delete _BJLdialog;
1773 _BJLdialog->move(300,200);
1774 _BJLdialog->resize(450,200);
1778 void GenericGui::onStartResume()
1780 DEBTRACE(
"GenericGui::onStartResume");
1781 if (!QtGuiContext::getQtCurrent())
return;
1782 if (!QtGuiContext::getQtCurrent()->getGuiExecutor())
return;
1783 QtGuiContext::getQtCurrent()->getGuiExecutor()->startResumeDataflow();
1786 void GenericGui::onAbort()
1789 if (!QtGuiContext::getQtCurrent())
return;
1790 if (!QtGuiContext::getQtCurrent()->getGuiExecutor())
return;
1791 QtGuiContext::getQtCurrent()->getGuiExecutor()->killDataflow();
1794 void GenericGui::onPause()
1797 if (!QtGuiContext::getQtCurrent())
return;
1798 if (!QtGuiContext::getQtCurrent()->getGuiExecutor())
return;
1799 QtGuiContext::getQtCurrent()->getGuiExecutor()->suspendDataflow();
1802 void GenericGui::onReset()
1805 if (!QtGuiContext::getQtCurrent())
return;
1806 if (!QtGuiContext::getQtCurrent()->getGuiExecutor())
return;
1807 QtGuiContext::getQtCurrent()->getGuiExecutor()->resetDataflow();
1810 void GenericGui::onSaveRunState()
1812 DEBTRACE(
"GenericGui::onSaveRunState");
1813 if (!QtGuiContext::getQtCurrent())
return;
1814 if (!QtGuiContext::getQtCurrent()->getGuiExecutor())
return;
1815 QDateTime curTime = QDateTime::currentDateTime();
1816 QFileInfo procName = QtGuiContext::getQtCurrent()->getFileName();
1817 QString stateName = procName.baseName();
1819 stateName +=
"_state_" + curTime.toString(
"yyyyMMdd_hhmmss") +
".xml";
1821 stateName = getSaveFileName(stateName);
1823 if (!stateName.isEmpty())
1824 QtGuiContext::getQtCurrent()->getGuiExecutor()->saveState(stateName.toStdString());
1827 void GenericGui::onNewEdition()
1829 DEBTRACE(
"GenericGui::onNewEdition");
1835 void GenericGui::onGetYacsContainerLog()
1837 DEBTRACE(
"GenericGui::onGetYacsContainerLog");
1838 if (!QtGuiContext::getQtCurrent())
return;
1839 if (!QtGuiContext::getQtCurrent()->getGuiExecutor())
return;
1840 string log = QtGuiContext::getQtCurrent()->getGuiExecutor()->getContainerLog();
1846 void GenericGui::onGetErrorReport()
1848 DEBTRACE(
"GenericGui::onGetErrorReport");
1849 if (!QtGuiContext::getQtCurrent())
return;
1850 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
1854 if (QtGuiContext::getQtCurrent()->getGuiExecutor())
1856 log = QtGuiContext::getQtCurrent()->getGuiExecutor()->getErrorReport(snode->
getNode());
1868 void GenericGui::onGetErrorDetails()
1870 DEBTRACE(
"GenericGui::onGetErrorDetails");
1871 if (!QtGuiContext::getQtCurrent())
return;
1872 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
1876 if (QtGuiContext::getQtCurrent()->getGuiExecutor())
1878 log = QtGuiContext::getQtCurrent()->getGuiExecutor()->getErrorDetails(snode->
getNode());
1890 void GenericGui::onGetContainerLog()
1892 DEBTRACE(
"GenericGui::onGetContainerLog");
1893 if (!QtGuiContext::getQtCurrent())
return;
1894 if (!QtGuiContext::getQtCurrent()->getGuiExecutor())
return;
1895 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
1898 string log = QtGuiContext::getQtCurrent()->getGuiExecutor()->getContainerLog(snode->
getNode());
1904 if (dynamic_cast<YACS::ENGINE::ServiceNode*>(snode->
getNode()))
1906 info +=
"The container log of this node\n";
1907 info +=
"is not stored in a file and \n";
1908 info +=
"can't be displayed here, \n";
1909 info +=
"but you can have a look at \n";
1910 info +=
"the SALOME standard output,\n";
1911 info +=
"on your terminal...";
1915 info +=
"See YACS Container log \n";
1916 info +=
"(on main proc menu) \n";
1917 info +=
"for all inline nodes";
1926 void GenericGui::onShutdownProc()
1928 DEBTRACE(
"GenericGui::onShutdownProc");
1929 if (!QtGuiContext::getQtCurrent())
return;
1930 if (!QtGuiContext::getQtCurrent()->getGuiExecutor())
return;
1931 QtGuiContext::getQtCurrent()->getGuiExecutor()->shutdownProc();
1934 void GenericGui::onEditDataTypes()
1936 DEBTRACE(
"GenericGui::onEditDataTypes");
1939 void GenericGui::onCreateDataType()
1941 DEBTRACE(
"GenericGui::onCreateDataType");
1944 void GenericGui::onImportDataType()
1946 DEBTRACE(
"GenericGui::onImportDataType");
1947 if (_dwCatalogs) _dwCatalogs->raise();
1950 void GenericGui::onSelectComponentInstance()
1952 DEBTRACE(
"GenericGui::onSelectComponentInstance");
1953 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
1958 QtGuiContext::getQtCurrent()->_mapOfLastComponentInstance[compo->
getCompoName()]=compo;
1961 void GenericGui::onNewContainer()
1963 DEBTRACE(
"GenericGui::onNewContainer");
1964 _guiEditor->CreateContainer();
1967 void GenericGui::onNewHPContainer()
1969 DEBTRACE(
"GenericGui::onNewHPContainer");
1970 _guiEditor->CreateHPContainer();
1973 void GenericGui::onNewSalomeComponent()
1975 DEBTRACE(
"GenericGui::onNewSalomeComponent");
1976 _guiEditor->CreateComponentInstance();
1979 void GenericGui::onNewSalomePythonComponent()
1981 DEBTRACE(
"GenericGui::onNewSalomePythonComponent");
1984 void GenericGui::onNewCorbaComponent()
1986 DEBTRACE(
"GenericGui::onNewCorbaComponent");
1990 void GenericGui::onSalomeServiceNode()
1992 DEBTRACE(
"GenericGui::onSalomeServiceNode");
1993 _guiEditor->CreateNode(
"SalomeNode");
1996 void GenericGui::onServiceInlineNode()
1998 DEBTRACE(
"GenericGui::onServiceInlineNode");
1999 _guiEditor->CreateNode(
"SalomePythonNode");
2002 void GenericGui::onCORBAServiceNode()
2004 DEBTRACE(
"GenericGui::onCORBAServiceNode");
2005 _guiEditor->CreateNode(
"CORBANode");
2008 void GenericGui::onNodeNodeServiceNode()
2010 DEBTRACE(
"GenericGui::onNodeNodeServiceNode");
2013 void GenericGui::onCppNode()
2016 _guiEditor->CreateNode(
"CppNode");
2019 void GenericGui::onXMLNode()
2022 _guiEditor->CreateNode(
"XmlNode");
2025 void GenericGui::onInDataNode()
2027 DEBTRACE(
"GenericGui::onInDataNode");
2028 _guiEditor->CreateNode(
"PresetNode");
2031 void GenericGui::onOutDataNode()
2033 DEBTRACE(
"GenericGui::onOutDataNode");
2034 _guiEditor->CreateNode(
"OutNode");
2037 void GenericGui::onInStudyNode()
2039 DEBTRACE(
"GenericGui::onInStudyNode");
2040 _guiEditor->CreateNode(
"StudyInNode");
2043 void GenericGui::onOutStudyNode()
2045 DEBTRACE(
"GenericGui::onOutStudyNode");
2046 _guiEditor->CreateNode(
"StudyOutNode");
2049 void GenericGui::onInlineScriptNode()
2051 DEBTRACE(
"GenericGui::onInlineScriptNode");
2052 _guiEditor->CreateNode(
"PyScript");
2055 void GenericGui::onInlineFunctionNode()
2057 DEBTRACE(
"GenericGui::onInlineFunctionNode");
2058 _guiEditor->CreateNode(
"PyFunction");
2061 void GenericGui::onBlockNode()
2063 DEBTRACE(
"GenericGui::onBlockNode");
2064 _guiEditor->CreateBloc();
2067 void GenericGui::onFORNode()
2070 _guiEditor->CreateForLoop();
2073 void GenericGui::onFOREACHNode()
2075 DEBTRACE(
"GenericGui::onFOREACHNode");
2076 createForEachLoop(
"double");
2079 void GenericGui::createForEachLoop(std::string type)
2081 DEBTRACE(
"GenericGui::createForEachLoop");
2082 _guiEditor->CreateForEachLoop(type);
2085 void GenericGui::onWHILENode()
2087 DEBTRACE(
"GenericGui::onWHILENode");
2088 _guiEditor->CreateWhileLoop();
2091 void GenericGui::onSWITCHNode()
2093 DEBTRACE(
"GenericGui::onSWITCHNode");
2094 _guiEditor->CreateSwitch();
2097 void GenericGui::onOptimizerLoop()
2099 DEBTRACE(
"GenericGui::onOptimizerLoop");
2100 _guiEditor->CreateOptimizerLoop();
2103 void GenericGui::onNodeFromCatalog()
2105 DEBTRACE(
"GenericGui::onNodeFromCatalog");
2106 if (_dwCatalogs) _dwCatalogs->raise();
2109 void GenericGui::onDeleteItem()
2111 DEBTRACE(
"GenericGui::onDeleteItem");
2112 _guiEditor->DeleteSubject();
2115 void GenericGui::onCutItem()
2118 _guiEditor->CutSubject();
2121 void GenericGui::onCopyItem()
2123 DEBTRACE(
"GenericGui::onCopyItem");
2124 _guiEditor->CopySubject();
2127 void GenericGui::onPasteItem()
2129 DEBTRACE(
"GenericGui::onPasteItem");
2130 _guiEditor->PasteSubject();
2133 void GenericGui::onPutInBloc()
2135 _guiEditor->PutSubjectInBloc();
2138 void GenericGui::onPutGraphInBloc()
2140 DEBTRACE(
"GenericGui::onPutGraphInBloc");
2141 _guiEditor->PutGraphInBloc();
2142 _guiEditor->arrangeNodes(
false);
2145 void GenericGui::onPutGraphInForLoop()
2147 DEBTRACE(
"GenericGui::onPutGraphInForLoop");
2148 _guiEditor->PutGraphInNode(
"ForLoop");
2151 void GenericGui::putGraphInForeachLoop(std::string type)
2153 DEBTRACE(
"GenericGui::PutGraphInForeachLoop");
2154 _guiEditor->PutGraphInNode(
"ForEachLoop_"+type);
2157 void GenericGui::onPutGraphInWhileLoop()
2159 DEBTRACE(
"GenericGui::onPutGraphInWhileLoop");
2160 _guiEditor->PutGraphInNode(
"WhileLoop");
2163 void GenericGui::onPutGraphInOptimizerLoop()
2165 DEBTRACE(
"GenericGui::onPutGraphInOptimizerLoop");
2166 _guiEditor->PutGraphInNode(
"OptimizerLoop");
2169 void GenericGui::onArrangeLocalNodes()
2171 DEBTRACE(
"GenericGui::onArrangeLocalNodes");
2172 _guiEditor->arrangeNodes(
false);
2175 void GenericGui::onArrangeRecurseNodes()
2177 DEBTRACE(
"GenericGui::onArrangeRecurseNodes");
2178 _guiEditor->arrangeNodes(
true);
2181 void GenericGui::onRebuildLinks()
2183 DEBTRACE(
"GenericGui::onRebuildLinks");
2184 _guiEditor->rebuildLinks();
2187 void GenericGui::onZoomToBloc()
2189 DEBTRACE(
"GenericGui::onZoomToBloc");
2190 QtGuiContext::getQtCurrent()->getView()->onZoomToBloc();
2193 void GenericGui::onCenterOnNode()
2195 DEBTRACE(
"GenericGui::onCenterOnNode");
2196 QtGuiContext::getQtCurrent()->getView()->onCenterOnNode();
2199 void GenericGui::onShrinkExpand() {
2200 DEBTRACE(
"GenericGui::onShrinkExpand");
2201 _guiEditor->shrinkExpand();
2204 void GenericGui::onShrinkExpandChildren() {
2205 DEBTRACE(
"GenericGui::onShrinkExpandChildren");
2206 _guiEditor->shrinkExpand(Qt::ControlModifier|Qt::ShiftModifier);
2209 void GenericGui::onShrinkExpandElementaryRecursively() {
2210 DEBTRACE(
"GenericGui::onShrinkExpandElementaryRecursively");
2211 _guiEditor->shrinkExpand(Qt::ControlModifier);
2214 void GenericGui::onToggleStraightLinks(
bool checked)
2216 Scene::_straightLinks = checked;
2217 DEBTRACE(
"Scene::_straightLinks=" << checked);
2218 if (!QtGuiContext::getQtCurrent())
2220 map<Subject*, SchemaItem*>::const_iterator it = QtGuiContext::getQtCurrent()->_mapOfSchemaItem.begin();
2221 for( ; it != QtGuiContext::getQtCurrent()->_mapOfSchemaItem.end(); ++it)
2228 void GenericGui::onToggleAutomaticComputeLinks(
bool checked)
2230 Scene::_autoComputeLinks = checked;
2231 DEBTRACE(
"Scene::_autoComputeLinks=" << checked);
2234 void GenericGui::onToggleSimplifyLinks(
bool checked)
2236 Scene::_simplifyLinks = checked;
2237 DEBTRACE(
"Scene::_simplifyLinks=" << checked);
2240 void GenericGui::onToggleForce2NodesLinks(
bool checked)
2242 Scene::_force2NodesLink = checked;
2243 DEBTRACE(
"Scene::_force2NodesLink=" << checked);
2246 void GenericGui::onToggleAddRowCols(
bool checked)
2248 Scene::_addRowCols = checked;
2249 DEBTRACE(
"Scene::_addRowCols=" << checked);
2252 void GenericGui::onSelectReference()
2254 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
2262 void GenericGui::onWhatsThis()
2264 DEBTRACE(
"GenericGui::onWhatsThis");
2265 QWhatsThis::enterWhatsThisMode();
2268 void GenericGui::onWithoutStopMode(
bool checked)
2270 DEBTRACE(
"GenericGui::onWithoutStopMode " << checked);
2271 if (!QtGuiContext::getQtCurrent())
return;
2272 if (!QtGuiContext::getQtCurrent()->getGuiExecutor())
return;
2273 if (checked) QtGuiContext::getQtCurrent()->getGuiExecutor()->setContinueMode();
2276 void GenericGui::onBreakpointsMode(
bool checked)
2278 DEBTRACE(
"GenericGui::onWithoutStopMode " << checked);
2279 if (!QtGuiContext::getQtCurrent())
return;
2280 if (!QtGuiContext::getQtCurrent()->getGuiExecutor())
return;
2281 if (checked) QtGuiContext::getQtCurrent()->getGuiExecutor()->setBreakpointMode();
2284 void GenericGui::onStepByStepMode(
bool checked)
2286 DEBTRACE(
"GenericGui::onWithoutStopMode " << checked);
2287 if (!QtGuiContext::getQtCurrent())
return;
2288 if (!QtGuiContext::getQtCurrent()->getGuiExecutor())
return;
2289 if (checked) QtGuiContext::getQtCurrent()->getGuiExecutor()->setStepByStepMode();
2292 void GenericGui::onToggleStopOnError(
bool checked)
2294 DEBTRACE(
"GenericGui::onToggleStopOnError " << checked);
2295 if (!QtGuiContext::getQtCurrent())
return;
2296 if (!QtGuiContext::getQtCurrent()->getGuiExecutor())
return;
2298 QtGuiContext::getQtCurrent()->getGuiExecutor()->setStopOnError(
false);
2300 QtGuiContext::getQtCurrent()->getGuiExecutor()->unsetStopOnError();
2303 void GenericGui::onToggleSceneItemVisible(
bool checked)
2305 DEBTRACE(
"GenericGui::onToggleSceneItemVisible " << checked);
2306 if (!QtGuiContext::getQtCurrent())
return;
2307 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
2311 if (!QtGuiContext::getQtCurrent()->_mapOfSceneItem.count(sub))
return;
2313 SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sub];
2314 item->setVisible(checked);
2317 void GenericGui::displayLinks(
bool isShown)
2319 if (!QtGuiContext::getQtCurrent())
return;
2321 for (it = QtGuiContext::getQtCurrent()->_mapOfSubjectLink.begin();
2322 it != QtGuiContext::getQtCurrent()->_mapOfSubjectLink.end();
2327 SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sub];
2328 item->setVisible(isShown);
2332 void GenericGui::displayControlLinks(
bool isShown)
2334 if (!QtGuiContext::getQtCurrent())
return;
2336 for (it = QtGuiContext::getQtCurrent()->_mapOfSubjectControlLink.begin();
2337 it != QtGuiContext::getQtCurrent()->_mapOfSubjectControlLink.end();
2342 SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sub];
2343 item->setVisible(isShown);
2347 void GenericGui::displayPortLinks(
bool isShown)
2349 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
2354 DEBTRACE(
"dataPort : " << sport->getName());
2355 list<SubjectLink*> linkList = sport->getListOfSubjectLink();
2356 list<SubjectLink*>::const_iterator it = linkList.begin();
2357 for( ; it != linkList.end(); ++it)
2361 SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sub];
2362 item->setVisible(isShown);
2371 list<SubjectControlLink*>::const_iterator it = linkList.begin();
2372 for( ; it != linkList.end(); ++it)
2376 SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sub];
2377 item->setVisible(isShown);
2383 void GenericGui::displayALink(
bool isShown)
2385 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
2386 if (! QtGuiContext::getQtCurrent()->_mapOfSceneItem.count(sub))
return;
2387 SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sub];
2388 item->setVisible(isShown);
2391 void GenericGui::onShowAllLinks()
2393 DEBTRACE(
"GenericGui::onShowAllLinks");
2395 displayControlLinks(
true);
2398 void GenericGui::onHideAllLinks()
2400 DEBTRACE(
"GenericGui::onHideAllLinks");
2401 displayLinks(
false);
2402 displayControlLinks(
false);
2405 void GenericGui::onShowOnlyPortLinks()
2407 DEBTRACE(
"GenericGui::onShowOnlyPortLinks");
2409 displayPortLinks(
true);
2412 void GenericGui::onShowPortLinks()
2414 DEBTRACE(
"GenericGui::onShowPortLinks");
2415 displayPortLinks(
true);
2418 void GenericGui::onHidePortLinks()
2420 DEBTRACE(
"GenericGui::onHidePortLinks");
2421 displayPortLinks(
false);
2424 void GenericGui::onEmphasisPortLinks()
2426 DEBTRACE(
"GenericGui::onEmphasisPortLinks");
2427 if (!QtGuiContext::getQtCurrent())
return;
2428 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
2436 emphasizePortLink(sport,
true);
2448 list<SubjectInputPort*>::const_iterator it = linkList.begin();
2449 for( ; it != linkList.end(); ++it)
2453 emphasizePortLink(sub,
true);
2458 list<SubjectOutputPort*>::const_iterator it = linkList.begin();
2459 for( ; it != linkList.end(); ++it)
2463 emphasizePortLink(sub,
true);
2470 void GenericGui::onShowOnlyCtrlLinks()
2472 DEBTRACE(
"GenericGui::onShowOnlyCtrlLinks");
2474 displayPortLinks(
true);
2477 void GenericGui::onShowCtrlLinks()
2479 DEBTRACE(
"GenericGui::onShowCtrlLinks");
2480 displayPortLinks(
true);
2483 void GenericGui::onHideCtrlLinks()
2485 DEBTRACE(
"GenericGui::onHideCtrlLinks");
2486 displayPortLinks(
false);
2489 void GenericGui::onEmphasisCtrlLinks()
2491 DEBTRACE(
"GenericGui::onEmphasisCtrlLinks");
2492 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
2501 list<SubjectControlLink*>::const_iterator it = linkList.begin();
2502 for( ; it != linkList.end(); ++it)
2516 void GenericGui::onShowOnlyLink()
2518 DEBTRACE(
"GenericGui::onShowOnlyLink");
2523 void GenericGui::onShowLink()
2525 DEBTRACE(
"GenericGui::onShowLink");
2529 void GenericGui::onHideLink()
2531 DEBTRACE(
"GenericGui::onHideLink");
2532 displayALink(
false);
2535 void GenericGui::onEmphasisLink()
2537 DEBTRACE(
"GenericGui::onEmphasisLink");
2538 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
2544 void GenericGui::onDeEmphasizeAll()
2546 DEBTRACE(
"GenericGui::onDeEmphasizeAll");
2547 map<Subject*, SchemaItem*>::const_iterator it = QtGuiContext::getQtCurrent()->_mapOfSchemaItem.begin();
2548 for( ; it != QtGuiContext::getQtCurrent()->_mapOfSchemaItem.end(); ++it)
2555 void GenericGui::onUndo()
2558 if (QtGuiContext::getQtCurrent()->_setOfModifiedSubjects.empty())
2560 QtGuiContext::getQtCurrent()->getInvoc()->undo();
2562 QtGuiContext::getQtCurrent()->setSubjectToCopy(NULL);
2564 else Message(
"undo not possible when there are local modifications not confirmed");
2567 void GenericGui::onRedo()
2570 if (QtGuiContext::getQtCurrent()->_setOfModifiedSubjects.empty())
2572 QtGuiContext::getQtCurrent()->getInvoc()->redo();
2574 QtGuiContext::getQtCurrent()->setSubjectToCopy(NULL);
2576 else Message(
"redo not possible when there are local modifications not confirmed");
2579 void GenericGui::onShowUndo()
2581 _guiEditor->showUndo(_parent);
2584 void GenericGui::onShowRedo()
2586 _guiEditor->showRedo(_parent);
2589 void GenericGui::onCleanOnExit()
2591 DEBTRACE(
"GenericGui::onCleanOnExit");
2592 int studyId = _wrapper->activeStudyId();
2593 map<QWidget*, YACS::HMI::QtGuiContext*> mapViewContextCopy = _mapViewContext;
2594 map<QWidget*, YACS::HMI::QtGuiContext*>::iterator it = mapViewContextCopy.begin();
2595 for (; it != mapViewContextCopy.end(); ++it)
2597 closeContext((*it).first,
true);
2605 list<SubjectLink*>::const_iterator it = linkList.begin();
2606 for( ; it != linkList.end(); ++it)
2609 if (!subli)
continue;
2618 void GenericGui::onHelpContextModule(
const QString& theComponentName,
const QString& theFileName,
const QString& theContext)
2620 _wrapper->onHelpContextModule(theComponentName,theFileName,theContext);