Salome HOME
Merge from V6_main_20120808 08Aug12
[modules/yacs.git] / src / genericgui / GenericGui.cxx
index 00a9f95017d935341b9ed1ccb13a4445896a19ef..4975ee469933aecb6794cec2f06c68492caccdcc 100644 (file)
@@ -1,30 +1,34 @@
-//  Copyright (C) 2006-2008  CEA/DEN, EDF R&D
+// Copyright (C) 2006-2012  CEA/DEN, EDF R&D
 //
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
 //
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 #include <Python.h>
 #include "SALOME_ResourcesManager.hxx"
 #include "SALOME_LifeCycleCORBA.hxx"
 
 #include "RuntimeSALOME.hxx"
 #include "Proc.hxx"
+#include "InputPort.hxx"
+#include "ServiceNode.hxx"
 #include "parsers.hxx"
 #include "Logger.hxx"
 #include "YACSGuiLoader.hxx"
+#include "ComponentInstance.hxx"
 
 #include "SALOME_NamingService.hxx"
 #include "SALOME_ModuleCatalog.hxx"
@@ -38,6 +42,8 @@
 #include "Scene.hxx"
 #include "GenericGui.hxx"
 #include "SceneItem.hxx"
+#include "SceneNodeItem.hxx"
+#include "SceneComposedNodeItem.hxx"
 #include "ItemEdition.hxx"
 #include "CatalogWidget.hxx"
 #include "TreeView.hxx"
 #include "TypeCode.hxx"
 #include "LinkInfo.hxx"
 #include "LogViewer.hxx"
+#include "chrono.hxx"
+#include "Resource.hxx"
+#include "Message.hxx"
+#include "ListJobs_GUI.hxx"
 
 #include <QFileDialog>
 #include <sstream>
 
 #include <ctime>
 
+#ifdef WNT
+#define WEXITSTATUS(w)  ((int) ((w) & 0x40000000))
+#endif
+
 //#define _DEVDEBUG_
 #include "YacsTrace.hxx"
 
@@ -73,9 +87,13 @@ GenericGui::GenericGui(YACS::HMI::SuitWrapper* wrapper, QMainWindow *parent)
   _catalogsWidget = 0;
   _sessionCatalog = 0;
   _schemaCnt = 0;
+  _isSaved = false;
   _mapViewContext.clear();
   _machineList.clear();
   _menuId = 190;
+  _BJLdialog = NULL;
+  QtGuiContext::_counters = new counters(100);
+  srand((unsigned)time(0)); 
 
   GuiObserver::setEventMap();
 
@@ -83,6 +101,8 @@ GenericGui::GenericGui(YACS::HMI::SuitWrapper* wrapper, QMainWindow *parent)
   iconPath += "/share/salome/resources/yacs";
   DEBTRACE(iconPath);
   QDir::addSearchPath("icons", iconPath.c_str());
+  
+  _guiEditor = new GuiEditor();
 
   YACS::ENGINE::RuntimeSALOME::setRuntime();
   _loader = new YACSGuiLoader();
@@ -104,6 +124,7 @@ GenericGui::GenericGui(YACS::HMI::SuitWrapper* wrapper, QMainWindow *parent)
               DEBTRACE("SALOME_ModuleCatalog::ModuleCatalog found");
               std::string anIOR = orb->object_to_string( aModuleCatalog );
               _sessionCatalog = runTime->loadCatalog( "session", anIOR );
+              runTime->addCatalog(_sessionCatalog);
               {
                 std::map< std::string, YACS::ENGINE::ComponentDefinition * >::iterator it;
                 for (it = _sessionCatalog->_componentMap.begin();
@@ -130,384 +151,459 @@ GenericGui::GenericGui(YACS::HMI::SuitWrapper* wrapper, QMainWindow *parent)
     }
 
   _dwTree = new QDockWidget(_parent);
+  _dwTree->setVisible(false);
   _dwTree->setWindowTitle("Tree View: edition mode");
   _parent->addDockWidget(Qt::LeftDockWidgetArea, _dwTree);
   _dwStacked = new QDockWidget(_parent);
+  _dwStacked->setVisible(false);
   _dwStacked->setWindowTitle("Input Panel");
+  _dwStacked->setMinimumWidth(270); // --- force a minimum until display
   _parent->addDockWidget(Qt::RightDockWidgetArea, _dwStacked);
   _dwCatalogs = new QDockWidget(_parent);
+  _dwCatalogs->setVisible(false);
   _dwCatalogs->setWindowTitle("Catalogs");
   _parent->addDockWidget(Qt::RightDockWidgetArea, _dwCatalogs);
   _catalogsWidget = new CatalogWidget(_dwCatalogs,
                                       _builtinCatalog,
                                       _sessionCatalog);
-  _catalogsWidget->setMinimumWidth(350); // --- force a minimum until display
   _dwCatalogs->setWidget(_catalogsWidget);
+
   _parent->tabifyDockWidget(_dwStacked, _dwCatalogs);
+  _parent->tabifyDockWidget(_dwTree, _wrapper->objectBrowser());
+#if QT_VERSION >= 0x040500
+  _parent->setTabPosition(Qt::AllDockWidgetAreas, Resource::tabPanelsUp? QTabWidget::North: QTabWidget::South);
+#endif
+  //Import user catalog
+  std::string usercata=Resource::userCatalog.toStdString();
+  _catalogsWidget->addCatalogFromFile(usercata);
 }
 
 GenericGui::~GenericGui()
 {
+  if(_BJLdialog) delete _BJLdialog;
 }
 
 void GenericGui::createActions()
 {
-//       QAction* createAction(const int id,
-//                             const QString& toolTip,
-//                             const QIcon& icon,
-//                             const QString& menu,
-//                             const QString& status,
-//                             const int shortCut,
-//                             QObject* parent =0,
-//                             bool checkable = false,
-//                             QObject* receiver =0,
-//                             const char* member =0);
-
-  QPixmap pixmap;
-
-  pixmap.load("icons:new_dataflow.png");
-  _newSchemaAct = _wrapper->createAction(getMenuId(), tr("Create a new YACS Schema"), QIcon(pixmap),
+  //       QAction* createAction(const int id,
+  //                             const QString& toolTip,
+  //                             const QIcon& icon,
+  //                             const QString& menu,
+  //                             const QString& status,
+  //                             const int shortCut,
+  //                             QObject* parent =0,
+  //                             bool checkable = false,
+  //                             QObject* receiver =0,
+  //                             const char* member =0);
+
+  _newSchemaAct = _wrapper->createAction(getMenuId(), tr("Create a new YACS Schema"), QIcon("icons:schema.png"),
                                          tr("New Schema"), tr("Create a new YACS Schema"),
                                          0, _parent, false, this,  SLOT(onNewSchema()));
-  
-  pixmap.load("icons:import_dataflow.png");
-  _importSchemaAct = _wrapper->createAction(getMenuId(), tr("Import a YACS Schema for edition"), QIcon(pixmap),
+  _newSchemaAct->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_N); // --- QKeySequence::New ambiguous in SALOME
+
+  _importSchemaAct = _wrapper->createAction(getMenuId(), tr("Import a YACS Schema for edition"), QIcon("icons:import_dataflow.png"),
                                             tr("Import Schema"), tr("Import a YACS Schema for edition"),
                                             0, _parent, false, this,  SLOT(onImportSchema()));
+  _importSchemaAct->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_O); // --- QKeySequence::Open ambiguous in SALOME
   
-  pixmap.load("icons:import_superv_dataflow.png");
-  _importSupervSchemaAct = _wrapper->createAction(getMenuId(), tr("Import a SUPERV Schema for edition"), QIcon(pixmap),
+  _importSupervSchemaAct = _wrapper->createAction(getMenuId(), tr("Import a SUPERV Schema for edition"), QIcon("icons:import_superv_dataflow.png"),
                                                   tr("Import SUPERV Schema"), tr("Import a SUPERV Schema for edition"),
                                                   0, _parent, false, this,  SLOT(onImportSupervSchema()));
   
-  pixmap.load("icons:save_dataflow.png");
-  _exportSchemaAct = _wrapper->createAction(getMenuId(), tr("Save the current YACS Schema"), QIcon(pixmap),
+  _exportSchemaAct = _wrapper->createAction(getMenuId(), tr("Save the current YACS Schema"), QIcon("icons:save_dataflow.png"),
                                             tr("Save Schema"), tr("Save the current YACS Schema"),
                                             0, _parent, false, this,  SLOT(onExportSchema()));
+  _exportSchemaAct->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_S); // --- QKeySequence::Save ambiguous in SALOME
   
-  pixmap.load("icons:export_dataflow.png");
-  _exportSchemaAsAct = _wrapper->createAction(getMenuId(), tr("Save the current YACS Schema As..."), QIcon(pixmap),
+  _exportSchemaAsAct = _wrapper->createAction(getMenuId(), tr("Save the current YACS Schema As..."), QIcon("icons:export_dataflow.png"),
                                               tr("Save Schema As"), tr("Save the current YACS Schema As..."),
                                               0, _parent, false, this,  SLOT(onExportSchemaAs()));
+  //_exportSchemaAsAct->setShortcut(QKeySequence::SaveAs); // --- ambiguous in SALOME
 
-  pixmap.load("icons:insert_file.png");
-  _importCatalogAct = _wrapper->createAction(getMenuId(), tr("Import a Schema as a Catalog"), QIcon(pixmap),
-                                              tr("Import Catalog"), tr("Import a Schema as a Catalog"),
-                                              0, _parent, false, this,  SLOT(onImportCatalog()));
+  _importCatalogAct = _wrapper->createAction(getMenuId(), tr("Import a Schema as a Catalog"), QIcon("icons:insert_file.png"),
+                                             tr("Import Catalog"), tr("Import a Schema as a Catalog"),
+                                             0, _parent, false, this,  SLOT(onImportCatalog()));
 
 
-  pixmap.load("icons:run_active.png");
-  _runLoadedSchemaAct = _wrapper->createAction(getMenuId(), tr("Prepare the current edited schema for run"), QIcon(pixmap),
-                                              tr("Run Current Schema"), tr("Prepare the current edited schema for run"),
-                                              0, _parent, false, this,  SLOT(onRunLoadedSchema()));
+  _runLoadedSchemaAct = _wrapper->createAction(getMenuId(), tr("Prepare the current edited schema for run"), QIcon("icons:run_active.png"),
+                                               tr("Run Current Schema"), tr("Prepare the current edited schema for run"),
+                                               0, _parent, false, this,  SLOT(onRunLoadedSchema()));
 
-  pixmap.load("icons:load_execution_state.png");
-  _loadRunStateSchemaAct = _wrapper->createAction(getMenuId(), tr("Load a previous run state for this schema, prepare to run"), QIcon(pixmap),
+  _loadRunStateSchemaAct = _wrapper->createAction(getMenuId(), tr("Load a previous run state for this schema, prepare to run"), QIcon("icons:load_execution_state.png"),
                                                   tr("Load Run State"), tr("Load a previous run state for this schema, prepare to run"),
                                                   0, _parent, false, this,  SLOT(onLoadRunStateSchema()));
 
-  pixmap.load("icons:run.png");
-  _loadAndRunSchemaAct = _wrapper->createAction(getMenuId(), tr("Load a schema for run"), QIcon(pixmap),
-                                              tr("Load Schema to run"), tr("Load a schema for run"),
-                                              0, _parent, false, this,  SLOT(onLoadAndRunSchema()));
+  _loadAndRunSchemaAct = _wrapper->createAction(getMenuId(), tr("Load a schema for run"), QIcon("icons:run.png"),
+                                                tr("Load Schema to run"), tr("Load a schema for run"),
+                                                0, _parent, false, this,  SLOT(onLoadAndRunSchema()));
 
+  _chooseBatchJobAct = _wrapper->createAction(getMenuId(), tr("Choose Batch Job for watch"), QIcon("icons:batch.png"),
+                                         tr("Choose Batch Job for watch"), tr("Choose Batch Job for watch"),
+                                         0, _parent, false, this,  SLOT(onChooseBatchJob()));
 
-  pixmap.load("icons:suspend_resume.png");
-  _startResumeAct = _wrapper->createAction(getMenuId(), tr("Start or Resume Schema execution"), QIcon(pixmap),
-                                       tr("Start/Resume execution"), tr("Start or Resume Schema execution"),
-                                       0, _parent, false, this,  SLOT(onStartResume()));
+  _startResumeAct = _wrapper->createAction(getMenuId(), tr("Start or Resume Schema execution"), QIcon("icons:suspend_resume.png"),
+                                           tr("Start/Resume execution"), tr("Start or Resume Schema execution"),
+                                           0, _parent, false, this,  SLOT(onStartResume()));
 
-  pixmap.load("icons:kill.png");
-  _abortAct = _wrapper->createAction(getMenuId(), tr("Abort the current execution"), QIcon(pixmap),
+  _abortAct = _wrapper->createAction(getMenuId(), tr("Abort the current execution"), QIcon("icons:kill.png"),
                                      tr("Abort execution"), tr("Abort the current execution"),
                                      0, _parent, false, this,  SLOT(onAbort()));
 
-  pixmap.load("icons:pause.png");
-  _pauseAct = _wrapper->createAction(getMenuId(), tr("Suspend the current execution"), QIcon(pixmap),
+  _pauseAct = _wrapper->createAction(getMenuId(), tr("Suspend the current execution"), QIcon("icons:pause.png"),
                                      tr("Suspend execution"), tr("Suspend the current execution"),
                                      0, _parent, false, this,  SLOT(onPause()));
 
-  pixmap.load("icons:reset.png");
-  _resetAct = _wrapper->createAction(getMenuId(), tr("Reset the current execution"), QIcon(pixmap),
-                                      tr("Reset execution"), tr("Reset the current execution"),
-                                      0, _parent, false, this,  SLOT(onReset()));
+  _resetAct = _wrapper->createAction(getMenuId(), tr("Reset error nodes and restart the current execution"), QIcon("icons:reset.png"),
+                                     tr("Restart execution"), tr("Restart the current execution with reset of error nodes"),
+                                     0, _parent, false, this,  SLOT(onReset()));
 
 
-  pixmap.load("icons:save_dataflow_state.png");
-  _saveRunStateAct = _wrapper->createAction(getMenuId(), tr("Save the current run state"), QIcon(pixmap),
+  _saveRunStateAct = _wrapper->createAction(getMenuId(), tr("Save the current run state"), QIcon("icons:save_dataflow_state.png"),
                                             tr("Save State"), tr("Save the current run state"),
                                             0, _parent, false, this,  SLOT(onSaveRunState()));
 
-  pixmap.load("icons:new_edition.png");
-  _newEditionAct = _wrapper->createAction(getMenuId(), tr("Edit again the current schema in a new context"), QIcon(pixmap),
+  _newEditionAct = _wrapper->createAction(getMenuId(), tr("Edit again the current schema in a new context"), QIcon("icons:new_edition.png"),
                                           tr("Edit Again"), tr("Edit again the current schema in a new context"),
                                           0, _parent, false, this,  SLOT(onNewEdition()));
 
 
-  pixmap.load("icons:change_informations.png");
-  _getYacsContainerLogAct = _wrapper->createAction(getMenuId(), tr("get YACS container log"), QIcon(pixmap),
-                                          tr("YACS Container Log"), tr("get YACS container log"),
-                                          0, _parent, false, this,  SLOT(onGetYacsContainerLog()));
+  _getYacsContainerLogAct = _wrapper->createAction(getMenuId(), tr("get YACS container log"), QIcon("icons:change_informations.png"),
+                                                   tr("YACS Container Log"), tr("get YACS container log"),
+                                                   0, _parent, false, this,  SLOT(onGetYacsContainerLog()));
 
-  pixmap.load("icons:filter_notification.png");
-  _getErrorReportAct = _wrapper->createAction(getMenuId(), tr("get Node Error Report"), QIcon(pixmap),
-                                          tr("Node Error Report"), tr("get Node Error Report"),
-                                          0, _parent, false, this,  SLOT(onGetErrorReport()));
+  _getErrorReportAct = _wrapper->createAction(getMenuId(), tr("get Node Error Report"), QIcon("icons:filter_notification.png"),
+                                              tr("Node Error Report"), tr("get Node Error Report"),
+                                              0, _parent, false, this,  SLOT(onGetErrorReport()));
 
-  pixmap.load("icons:icon_text.png");
-  _getErrorDetailsAct = _wrapper->createAction(getMenuId(), tr("get Node Error Details"), QIcon(pixmap),
-                                          tr("Node Error Details"), tr("get Node Error Details"),
-                                          0, _parent, false, this,  SLOT(onGetErrorDetails()));
+  _getErrorDetailsAct = _wrapper->createAction(getMenuId(), tr("get Node Error Details"), QIcon("icons:icon_text.png"),
+                                               tr("Node Error Details"), tr("get Node Error Details"),
+                                               0, _parent, false, this,  SLOT(onGetErrorDetails()));
 
-  pixmap.load("icons:change_informations.png");
-  _getContainerLogAct = _wrapper->createAction(getMenuId(), tr("get Node Container Log"), QIcon(pixmap),
-                                          tr("Node Container Log"), tr("get Node Container Log"),
-                                          0, _parent, false, this,  SLOT(onGetContainerLog()));
+  _getContainerLogAct = _wrapper->createAction(getMenuId(), tr("get Node Container Log"), QIcon("icons:change_informations.png"),
+                                               tr("Node Container Log"), tr("get Node Container Log"),
+                                               0, _parent, false, this,  SLOT(onGetContainerLog()));
 
+  _shutdownProcAct = _wrapper->createAction(getMenuId(), tr("Shutdown Proc"), QIcon("icons:kill.png"),
+                                             tr("Shutdown Proc"), tr("Shutdown Proc"),
+                                             0, _parent, false, this,  SLOT(onShutdownProc()));
 
 
-  pixmap.load("icons:kill.png");
-  _editDataTypesAct = _wrapper->createAction(getMenuId(), tr("Edit Data Types"), QIcon(pixmap),
-                                              tr("Edit Data Types"), tr("Edit Data Types"),
-                                              0, _parent, false, this,  SLOT(onEditDataTypes()));
+  _editDataTypesAct = _wrapper->createAction(getMenuId(), tr("Edit Data Types"), QIcon("icons:kill.png"),
+                                             tr("Edit Data Types"), tr("Edit Data Types"),
+                                             0, _parent, false, this,  SLOT(onEditDataTypes()));
 
-  pixmap.load("icons:kill.png");
-  _createDataTypeAct = _wrapper->createAction(getMenuId(), tr("Create Data Types"), QIcon(pixmap),
+  _createDataTypeAct = _wrapper->createAction(getMenuId(), tr("Create Data Types"), QIcon("icons:kill.png"),
                                               tr("Create Data Types"), tr("Create Data Types"),
                                               0, _parent, false, this,  SLOT(onCreateDataType()));
 
-  pixmap.load("icons:folder_cyan.png");
-  _importDataTypeAct = _wrapper->createAction(getMenuId(), tr("Import Data Types, use drag and drop from catalog"), QIcon(pixmap),
+  _importDataTypeAct = _wrapper->createAction(getMenuId(), tr("Import Data Types, use drag and drop from catalog"), QIcon("icons:folder_cyan.png"),
                                               tr("Import Data Types"), tr("Import Data Types, use drag and drop from catalog"),
                                               0, _parent, false, this,  SLOT(onImportDataType()));
 
-  pixmap.load("icons:container.png");
-  _newContainerAct = _wrapper->createAction(getMenuId(), tr("Create a New Container"), QIcon(pixmap),
-                                              tr("Create Container"), tr("Create a New Container"),
-                                              0, _parent, false, this,  SLOT(onNewContainer()));
-
-  pixmap.load("icons:new_salome_component.png");
-  _newSalomeComponentAct = _wrapper->createAction(getMenuId(), tr("Create a New SALOME Component"), QIcon(pixmap),
-                                              tr("SALOME Component"), tr("Create a New SALOME Component"),
-                                              0, _parent, false, this,  SLOT(onNewSalomeComponent()));
-
-  pixmap.load("icons:new_salomepy_component.png");
-  _newSalomePythonComponentAct = _wrapper->createAction(getMenuId(), tr("Create a New SALOME Python Component"), QIcon(pixmap),
-                                              tr("SALOME Python Component"), tr("Create a New SALOME Python Component"),
-                                              0, _parent, false, this,  SLOT(onNewSalomePythonComponent()));
-
-  pixmap.load("icons:new_corba_component.png");
-  _newCorbaComponentAct = _wrapper->createAction(getMenuId(), tr("Create a New CORBA Component"), QIcon(pixmap),
-                                              tr("CORBA Component"), tr("Create a New CORBA Component"),
-                                              0, _parent, false, this,  SLOT(onNewCorbaComponent()));
-
-  pixmap.load("icons:schema.png");
-  _newSchemaAct = _wrapper->createAction(getMenuId(), tr("New Schema"), QIcon(pixmap),
-                                              tr("New Schema"), tr("New Schema"),
-                                              0, _parent, false, this,  SLOT(onNewSchema()));
-
-  pixmap.load("icons:new_salome_service_node.png");
-  _salomeServiceNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New SALOME Service Node"), QIcon(pixmap),
-                                              tr("SALOME Service Node"), tr("Create a New SALOME Service Node"),
-                                              0, _parent, false, this,  SLOT(onSalomeServiceNode()));
-
-  pixmap.load("icons:new_service_inline_node.png");
-  _serviceInlineNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Inline Service Node"), QIcon(pixmap),
-                                              tr("Inline Service Node"), tr("Create a New Inline Service Node"),
-                                              0, _parent, false, this,  SLOT(onServiceInlineNode()));
-
-  pixmap.load("icons:new_corba_service_node.png");
-  _CORBAServiceNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New CORBA Service Node"), QIcon(pixmap),
-                                              tr("CORBA Node"), tr("Create a New CORBA Service Node"),
-                                              0, _parent, false, this,  SLOT(onCORBAServiceNode()));
-
-  pixmap.load("icons:new_nodenode_service_node.png");
-  _nodeNodeServiceNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Node referencing a Node"), QIcon(pixmap),
-                                              tr("Ref on Node"), tr("Create a New Node referencing a Node"),
-                                              0, _parent, false, this,  SLOT(onNodeNodeServiceNode()));
-
-  pixmap.load("icons:new_cpp_node.png");
-  _cppNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New C++ Node"), QIcon(pixmap),
-                                              tr("Cpp Node"), tr("Create a New C++ Node"),
-                                              0, _parent, false, this,  SLOT(onCppNode()));
-
-  pixmap.load("icons:kill.png");
-  _inDataNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Input data Node"), QIcon(pixmap),
-                                              tr("Input Data Node"), tr("Create a New Input data Node"),
-                                              0, _parent, false, this,  SLOT(onInDataNode()));
-
-  pixmap.load("icons:kill.png");
-  _outDataNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Output data Node"), QIcon(pixmap),
-                                              tr("Output Data Node"), tr("Create a New Output data Node"),
-                                              0, _parent, false, this,  SLOT(onOutDataNode()));
-
-  pixmap.load("icons:kill.png");
-  _inStudyNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Input Study Node"), QIcon(pixmap),
-                                              tr("Input Study Node"), tr("Create a New Input Study Node"),
-                                              0, _parent, false, this,  SLOT(onInStudyNode()));
-
-  pixmap.load("icons:kill.png");
-  _outStudyNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Output Study Node"), QIcon(pixmap),
-                                              tr("Output Study Node"), tr("Create a New Output Study Node"),
-                                              0, _parent, false, this,  SLOT(onOutStudyNode()));
-
-  pixmap.load("icons:new_inline_script_node.png");
-  _inlineScriptNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Inline Python Script Node"), QIcon(pixmap),
-                                              tr("Inline Script Node"), tr("Create a New Inline Python Script Node"),
-                                              0, _parent, false, this,  SLOT(onInlineScriptNode()));
-
-  pixmap.load("icons:new_inline_function_node.png");
-  _inlineFunctionNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Inline Python Function Node"), QIcon(pixmap),
-                                              tr("Inline Function Node"), tr("Create a New Inline Python Function Node"),
-                                              0, _parent, false, this,  SLOT(onInlineFunctionNode()));
-
-  pixmap.load("icons:new_block_node.png");
-  _blockNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Bloc Node"), QIcon(pixmap),
-                                              tr("bloc Node"), tr("Create a New Bloc Node"),
-                                              0, _parent, false, this,  SLOT(onBlockNode()));
-
-  pixmap.load("icons:new_for_loop_node.png");
-  _FORNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New For Loop Node"), QIcon(pixmap),
-                                              tr("For Loop Node"), tr("Create a New For Loop Node"),
-                                              0, _parent, false, this,  SLOT(onFORNode()));
-
-  pixmap.load("icons:new_foreach_loop_node.png");
-  _FOREACHNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New For Each Loop Node"), QIcon(pixmap),
-                                              tr("For Each Loop Node"), tr("Create a New For Each Loop Node"),
-                                              0, _parent, false, this,  SLOT(onFOREACHNode()));
-
-  pixmap.load("icons:new_while_loop_node.png");
-  _WHILENodeAct = _wrapper->createAction(getMenuId(), tr("Create a New While Loop Node"), QIcon(pixmap),
-                                              tr("While Loop Node"), tr("Create a New While Loop Node"),
-                                              0, _parent, false, this,  SLOT(onWHILENode()));
-
-  pixmap.load("icons:new_switch_loop_node.png");
-  _SWITCHNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Switch Node"), QIcon(pixmap),
-                                              tr("Switch Node"), tr("Create a New Switch Node"),
-                                              0, _parent, false, this,  SLOT(onSWITCHNode()));
-
-  pixmap.load("icons:new_from_library_node.png");
-  _nodeFromCatalogAct = _wrapper->createAction(getMenuId(), tr("Create a New Node from Catalog, use drag and drop from catalog"), QIcon(pixmap),
-                                              tr("Node from Catalog"), tr("Create a New Node from Catalog, use drag and drop from catalog"),
-                                              0, _parent, false, this,  SLOT(onNodeFromCatalog()));
-
-  pixmap.load("icons:delete.png");
-  _deleteItemAct = _wrapper->createAction(getMenuId(), tr("Delete a Schema Item"), QIcon(pixmap),
-                                              tr("Delete Item"), tr("Delete a Schema Item"),
-                                              0, _parent, false, this,  SLOT(onDeleteItem()));
-
-  pixmap.load("icons:cut.png");
-  _cutItemAct = _wrapper->createAction(getMenuId(), tr("Cut a Schema Item"), QIcon(pixmap),
+  _newContainerAct = _wrapper->createAction(getMenuId(), tr("Create a New Container"), QIcon("icons:container.png"),
+                                            tr("Create Container"), tr("Create a New Container"),
+                                            0, _parent, false, this,  SLOT(onNewContainer()));
+
+  _selectComponentInstanceAct = _wrapper->createAction(getMenuId(), tr("Select a Component Instance"), QIcon("icons:icon_select.png"),
+                                                       tr("Select a Component Instance"), tr("Select a Component Instance"),
+                                                       0, _parent, false, this,  SLOT(onSelectComponentInstance()));
+
+  _newSalomeComponentAct = _wrapper->createAction(getMenuId(), tr("Create a New SALOME Component Instance"), QIcon("icons:new_salome_component.png"),
+                                                  tr("Create Component Instance"), tr("Create a New SALOME Component Instance"),
+                                                  0, _parent, false, this,  SLOT(onNewSalomeComponent()));
+
+  _newSalomePythonComponentAct = _wrapper->createAction(getMenuId(), tr("Create a New SALOME Python Component"), QIcon("icons:new_salomepy_component.png"),
+                                                        tr("SALOME Python Component"), tr("Create a New SALOME Python Component"),
+                                                        0, _parent, false, this,  SLOT(onNewSalomePythonComponent()));
+
+  _newCorbaComponentAct = _wrapper->createAction(getMenuId(), tr("Create a New CORBA Component"), QIcon("icons:new_corba_component.png"),
+                                                 tr("CORBA Component"), tr("Create a New CORBA Component"),
+                                                 0, _parent, false, this,  SLOT(onNewCorbaComponent()));
+
+  _salomeServiceNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New SALOME Service Node"), QIcon("icons:new_salome_service_node.png"),
+                                                 tr("SALOME Service Node"), tr("Create a New SALOME Service Node"),
+                                                 0, _parent, false, this,  SLOT(onSalomeServiceNode()));
+
+  _serviceInlineNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Inline Service Node"), QIcon("icons:new_service_inline_node.png"),
+                                                 tr("Inline Service Node"), tr("Create a New Inline Service Node"),
+                                                 0, _parent, false, this,  SLOT(onServiceInlineNode()));
+
+  _CORBAServiceNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New CORBA Service Node"), QIcon("icons:new_corba_service_node.png"),
+                                                tr("CORBA Node"), tr("Create a New CORBA Service Node"),
+                                                0, _parent, false, this,  SLOT(onCORBAServiceNode()));
+
+  _nodeNodeServiceNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Node referencing a Node"), QIcon("icons:new_nodenode_service_node.png"),
+                                                   tr("Ref on Node"), tr("Create a New Node referencing a Node"),
+                                                   0, _parent, false, this,  SLOT(onNodeNodeServiceNode()));
+
+  _cppNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New C++ Node"), QIcon("icons:new_cpp_node.png"),
+                                       tr("Cpp Node"), tr("Create a New C++ Node"),
+                                       0, _parent, false, this,  SLOT(onCppNode()));
+
+  _inDataNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Input data Node"), QIcon("icons:node.png"),
+                                          tr("Input Data Node"), tr("Create a New Input data Node"),
+                                          0, _parent, false, this,  SLOT(onInDataNode()));
+
+  _outDataNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Output data Node"), QIcon("icons:node.png"),
+                                           tr("Output Data Node"), tr("Create a New Output data Node"),
+                                           0, _parent, false, this,  SLOT(onOutDataNode()));
+
+  _inStudyNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Input Study Node"), QIcon("icons:node.png"),
+                                           tr("Input Study Node"), tr("Create a New Input Study Node"),
+                                           0, _parent, false, this,  SLOT(onInStudyNode()));
+
+  _outStudyNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Output Study Node"), QIcon("icons:node.png"),
+                                            tr("Output Study Node"), tr("Create a New Output Study Node"),
+                                            0, _parent, false, this,  SLOT(onOutStudyNode()));
+
+  _inlineScriptNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Inline Python Script Node"), QIcon("icons:new_inline_script_node.png"),
+                                                tr("Inline Script Node"), tr("Create a New Inline Python Script Node"),
+                                                0, _parent, false, this,  SLOT(onInlineScriptNode()));
+
+  _inlineFunctionNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Inline Python Function Node"), QIcon("icons:new_inline_function_node.png"),
+                                                  tr("Inline Function Node"), tr("Create a New Inline Python Function Node"),
+                                                  0, _parent, false, this,  SLOT(onInlineFunctionNode()));
+
+  _blockNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Bloc Node"), QIcon("icons:new_block_node.png"),
+                                         tr("bloc Node"), tr("Create a New Bloc Node"),
+                                         0, _parent, false, this,  SLOT(onBlockNode()));
+
+  _FORNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New For Loop Node"), QIcon("icons:new_for_loop_node.png"),
+                                       tr("For Loop Node"), tr("Create a New For Loop Node"),
+                                       0, _parent, false, this,  SLOT(onFORNode()));
+
+  _FOREACHNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New For Each Loop Node"), QIcon("icons:new_foreach_loop_node.png"),
+                                           tr("For Each Loop Node"), tr("Create a New For Each Loop Node"),
+                                           0, _parent, false, this,  SLOT(onFOREACHNode()));
+
+  _WHILENodeAct = _wrapper->createAction(getMenuId(), tr("Create a New While Loop Node"), QIcon("icons:new_while_loop_node.png"),
+                                         tr("While Loop Node"), tr("Create a New While Loop Node"),
+                                         0, _parent, false, this,  SLOT(onWHILENode()));
+
+  _SWITCHNodeAct = _wrapper->createAction(getMenuId(), tr("Create a New Switch Node"), QIcon("icons:new_switch_loop_node.png"),
+                                          tr("Switch Node"), tr("Create a New Switch Node"),
+                                          0, _parent, false, this,  SLOT(onSWITCHNode()));
+
+  _OptimizerLoopAct = _wrapper->createAction(getMenuId(), tr("Create a New Optimizer Loop Node"), QIcon("icons:new_for_loop_node.png"),
+                                             tr("Optimizer Loop"), tr("Create a New Optimizer Loop"),
+                                             0, _parent, false, this,  SLOT(onOptimizerLoop()));
+
+  _nodeFromCatalogAct = _wrapper->createAction(getMenuId(), tr("Create a New Node from Catalog, use drag and drop from catalog"), QIcon("icons:new_from_library_node.png"),
+                                               tr("Node from Catalog"), tr("Create a New Node from Catalog, use drag and drop from catalog"),
+                                               0, _parent, false, this,  SLOT(onNodeFromCatalog()));
+
+  _deleteItemAct = _wrapper->createAction(getMenuId(), tr("Delete a Schema Item"), QIcon("icons:delete.png"),
+                                          tr("Delete Item"), tr("Delete a Schema Item"),
+                                          0, _parent, false, this,  SLOT(onDeleteItem()));
+  _deleteItemAct->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_D); // --- QKeySequence::Delete dangerous...
+
+  _cutItemAct = _wrapper->createAction(getMenuId(), tr("Cut a Schema Item"), QIcon("icons:cut.png"),
                                        tr("Cut Item"), tr("Cut a Schema Item"),
                                        0, _parent, false, this,  SLOT(onCutItem()));
+  _cutItemAct->setShortcut(QKeySequence::Cut);
 
-  pixmap.load("icons:copy.png");
-  _copyItemAct = _wrapper->createAction(getMenuId(), tr("Copy a Schema Item"), QIcon(pixmap),
+  _copyItemAct = _wrapper->createAction(getMenuId(), tr("Copy a Schema Item"), QIcon("icons:copy.png"),
                                         tr("Copy Item"), tr("Copy a Schema Item"),
                                         0, _parent, false, this,  SLOT(onCopyItem()));
+  _copyItemAct->setShortcut(QKeySequence::Copy);
 
-  pixmap.load("icons:paste.png");
-  _pasteItemAct = _wrapper->createAction(getMenuId(), tr("Paste a Schema Item"), QIcon(pixmap),
+  _pasteItemAct = _wrapper->createAction(getMenuId(), tr("Paste a Schema Item"), QIcon("icons:paste.png"),
                                          tr("Paste Item"), tr("Paste a Schema Item"),
                                          0, _parent, false, this,  SLOT(onPasteItem()));
+  _pasteItemAct->setShortcut(QKeySequence::Paste);
+
+  _putInBlocAct = _wrapper->createAction(getMenuId(), tr("Put node in block"), QIcon("icons:paste.png"),
+                                         tr("Put node in block"), tr("Put node in block"),
+                                         0, _parent, false, this,  SLOT(onPutInBloc()));
+
+  _arrangeLocalNodesAct = _wrapper->createAction(getMenuId(), tr("arrange nodes on that bloc level, without recursion"), QIcon("icons:arrange_nodes.png"),
+                                                 tr("arrange local nodes"), tr("arrange nodes on that bloc level, without recursion"),
+                                                 0, _parent, false, this,  SLOT(onArrangeLocalNodes()));
+
+  _arrangeRecurseNodesAct = _wrapper->createAction(getMenuId(), tr("arrange nodes on that bloc level, with recursion"), QIcon("icons:sample.png"),
+                                                   tr("arrange nodes recursion"), tr("arrange nodes on that bloc level, with recursion"),
+                                                   0, _parent, false, this,  SLOT(onArrangeRecurseNodes()));
+
+  _computeLinkAct = _wrapper->createAction(getMenuId(), tr("compute orthogonal links"), QIcon("icons:rebuild_links.png"),
+                                           tr("compute links"), tr("compute orthogonal links"),
+                                           0, _parent, false, this,  SLOT(onRebuildLinks()));
+
+  _zoomToBlocAct = _wrapper->createAction(getMenuId(), tr("zoom 2D view to selected bloc"), QIcon("icons:zoomToBloc.png"),
+                                          tr("zoom to bloc"), tr("zoom 2D view to the selected composed node"),
+                                          0, _parent, false, this,  SLOT(onZoomToBloc()));
+
+  _centerOnNodeAct = _wrapper->createAction(getMenuId(), tr("center 2D view on selected node"), QIcon("icons:centerOnNode.png"),
+                                            tr("center on node"), tr("center 2D view on selected node"),
+                                            0, _parent, false, this,  SLOT(onCenterOnNode()));
+  _centerOnNodeAct->setShortcut(QKeySequence::Find);
+
+  _shrinkExpand = _wrapper->createAction(getMenuId(), tr("shrink or expand the selected node"), QIcon("icons:shrinkExpand.png"),
+                                            tr("shrink/expand"), tr("shrink or expand the selected node"),
+                                            0, _parent, false, this,  SLOT(onShrinkExpand()));
+
+  _toggleStraightLinksAct = _wrapper->createAction(getMenuId(), tr("draw straight or orthogonal links"), QIcon("icons:straightLink.png"),
+                                                   tr("straight/orthogonal"), tr("draw straight or orthogonal links"),
+                                                   0, _parent, true, this,  SLOT(onToggleStraightLinks(bool)));
+  
+  _toggleStraightLinksAct->setChecked(Resource::straightLinks);
+  onToggleStraightLinks(Resource::straightLinks);
 
-  pixmap.load("icons:arrange_nodes.png");
-  _arrangeLocalNodesAct = _wrapper->createAction(getMenuId(), tr("arrange nodes on that bloc level, without recursion"), QIcon(pixmap),
-                                              tr("arrange local nodes"), tr("arrange nodes on that bloc level, without recursion"),
-                                              0, _parent, false, this,  SLOT(onArrangeLocalNodes()));
-
-  pixmap.load("icons:sample.png");
-  _arrangeRecurseNodesAct = _wrapper->createAction(getMenuId(), tr("arrange nodes on that bloc level, with recursion"), QIcon(pixmap),
-                                              tr("arrange nodes recursion"), tr("arrange nodes on that bloc level, with recursion"),
-                                              0, _parent, false, this,  SLOT(onArrangeRecurseNodes()));
-
-  pixmap.load("icons:rebuild_links.png");
-  _computeLinkAct = _wrapper->createAction(getMenuId(), tr("compute orthogonal links"), QIcon(pixmap),
-                                              tr("compute links"), tr("compute orthogonal links"),
-                                              0, _parent, false, this,  SLOT(onRebuildLinks()));
-
-  pixmap.load("icons:autoComputeLink.png");
-  _toggleAutomaticComputeLinkAct = _wrapper->createAction(getMenuId(), tr("compute othogonal links autoamtically when nodes move"), QIcon(pixmap),
-                                              tr("automatic link"), tr("compute othogonal links autoamtically when nodes move"),
-                                              0, _parent, true, this,  SLOT(onToggleAutomaticComputeLinks(bool)));
-
-  _toggleAutomaticComputeLinkAct->setChecked(true);
-
-  pixmap.load("icons:simplifyLink.png");
-  _toggleSimplifyLinkAct = _wrapper->createAction(getMenuId(), tr("simplify links by removing unnecessary direction changes"), QIcon(pixmap),
-                                              tr("simplify links"), tr("simplify links by removing unnecessary direction changes"),
-                                              0, _parent, true, this,  SLOT(onToggleSimplifyLinks(bool)));
-  _toggleSimplifyLinkAct->setChecked(true);
-
-  pixmap.load("icons:force2nodeLink.png");
-  _toggleForce2NodesLinkAct = _wrapper->createAction(getMenuId(), tr("force orthogonal links by adding an edge on simples links"), QIcon(pixmap),
-                                              tr("force ortho links"), tr("force orthogonal links by adding an edge on simples links"),
-                                              0, _parent, true, this,  SLOT(onToggleForce2NodesLinks(bool)));
+  _toggleAutomaticComputeLinkAct = _wrapper->createAction(getMenuId(), tr("compute othogonal links automatically when nodes move"), QIcon("icons:autoComputeLink.png"),
+                                                          tr("automatic link"), tr("compute othogonal links automatically when nodes move"),
+                                                          0, _parent, true, this,  SLOT(onToggleAutomaticComputeLinks(bool)));
+
+  _toggleAutomaticComputeLinkAct->setChecked(Resource::autoComputeLinks);
+  onToggleAutomaticComputeLinks(Resource::autoComputeLinks); // Why is this needed ?
+
+  _toggleSimplifyLinkAct = _wrapper->createAction(getMenuId(), tr("simplify links by removing unnecessary direction changes"), QIcon("icons:simplifyLink.png"),
+                                                  tr("simplify links"), tr("simplify links by removing unnecessary direction changes"),
+                                                  0, _parent, true, this,  SLOT(onToggleSimplifyLinks(bool)));
+  _toggleSimplifyLinkAct->setChecked(Resource::simplifyLink);
+  onToggleSimplifyLinks(Resource::simplifyLink);
+
+  _toggleForce2NodesLinkAct = _wrapper->createAction(getMenuId(), tr("force orthogonal links by adding an edge on simples links"), QIcon("icons:force2nodeLink.png"),
+                                                     tr("force ortho links"), tr("force orthogonal links by adding an edge on simples links"),
+                                                     0, _parent, true, this,  SLOT(onToggleForce2NodesLinks(bool)));
   _toggleForce2NodesLinkAct->setChecked(true);
 
-  pixmap.load("icons:ob_service_node.png");
-  _selectReferenceAct = _wrapper->createAction(getMenuId(), tr("select reference"), QIcon(pixmap),
-                                              tr("select reference"), tr("select reference"),
-                                              0, _parent, false, this,  SLOT(onSelectReference()));
+  _toggleAddRowColsAct = _wrapper->createAction(getMenuId(), tr("allow more path for the links, for a better separation"), QIcon("icons:addRowCols.png"),
+                                                tr("separate links"), tr("allow more path for the links, for a better separation"),
+                                                0, _parent, true, this,  SLOT(onToggleAddRowCols(bool)));
+  _toggleAddRowColsAct->setChecked(Resource::addRowCols);
+  onToggleAddRowCols(Resource::addRowCols);
+
+  _selectReferenceAct = _wrapper->createAction(getMenuId(), tr("select reference"), QIcon("icons:ob_service_node.png"),
+                                               tr("select reference"), tr("select reference"),
+                                               0, _parent, false, this,  SLOT(onSelectReference()));
 
-  pixmap.load("icons:whatsThis.png");
-  _whatsThisAct = _wrapper->createAction(getMenuId(), tr("active whatsThis Mode to get help on widgets"), QIcon(pixmap),
-                                              tr("whatsThis Mode"), tr("active whatsThis Mode to get help on widgets"),
-                                              0, _parent, false, this,  SLOT(onWhatsThis()));
+  _whatsThisAct = _wrapper->createAction(getMenuId(), tr("active whatsThis Mode to get help on widgets"), QIcon("icons:whatsThis.png"),
+                                         tr("whatsThis Mode"), tr("active whatsThis Mode to get help on widgets"),
+                                         0, _parent, false, this,  SLOT(onWhatsThis()));
+  _whatsThisAct->setShortcut(QKeySequence::WhatsThis);
 
-  pixmap.load("icons:run_active.png");
-  _withoutStopModeAct = _wrapper->createAction(getMenuId(), tr("set execution mode without stop"), QIcon(pixmap),
-                                              tr("mode without stop"), tr("set execution mode without stop"),
+  _withoutStopModeAct = _wrapper->createAction(getMenuId(), tr("set execution mode without stop"), QIcon("icons:run_active.png"),
+                                               tr("mode without stop"), tr("set execution mode without stop"),
                                                0, _parent, true, this,  SLOT(onWithoutStopMode(bool)));
 
-  pixmap.load("icons:breakpoints_active.png");
-  _breakpointsModeAct = _wrapper->createAction(getMenuId(), tr("set execution mode with stop on breakpoints"), QIcon(pixmap),
-                                              tr("mode breakpoints"), tr("set execution mode with stop on breakpoints"),
+  _breakpointsModeAct = _wrapper->createAction(getMenuId(), tr("set execution mode with stop on breakpoints"), QIcon("icons:breakpoints_active.png"),
+                                               tr("mode breakpoints"), tr("set execution mode with stop on breakpoints"),
                                                0, _parent, true, this,  SLOT(onBreakpointsMode(bool)));
 
-  pixmap.load("icons:step_by_step_active.png");
-  _stepByStepModeAct = _wrapper->createAction(getMenuId(), tr("set execution mode step by step"), QIcon(pixmap),
+  _stepByStepModeAct = _wrapper->createAction(getMenuId(), tr("set execution mode step by step"), QIcon("icons:step_by_step_active.png"),
                                               tr("mode step by step"), tr("set execution mode step by step"),
                                               0, _parent, true, this,  SLOT(onStepByStepMode(bool)));
 
-  pixmap.load("icons:toggle_stop_on_error.png");
-  _toggleStopOnErrorAct = _wrapper->createAction(getMenuId(), tr("Force stop on first error during execution"), QIcon(pixmap),
-                                              tr("stop on error"), tr("Force stop on first error during execution"),
-                                              0, _parent, true, this,  SLOT(onToggleStopOnError(bool)));
+  _toggleStopOnErrorAct = _wrapper->createAction(getMenuId(), tr("Force stop on first error during execution"), QIcon("icons:toggle_stop_on_error.png"),
+                                                 tr("stop on error"), tr("Force stop on first error during execution"),
+                                                 0, _parent, true, this,  SLOT(onToggleStopOnError(bool)));
+
+  _toggleSceneItemVisibleAct = _wrapper->createAction(getMenuId(), tr("toggle 2D scene item visibility"), QIcon("icons:toggleVisibility.png"),
+                                                      tr("visible/hidden"), tr("toggle 2D scene item visibility"),
+                                                      0, _parent, true, this,  SLOT(onToggleSceneItemVisible(bool)));
+
+
 
-  pixmap.load("icons:toggleVisibility.png");
-  _toggleSceneItemVisibleAct = _wrapper->createAction(getMenuId(), tr("toggle 2D scene item visibility"), QIcon(pixmap),
-                                              tr("visible/hidden"), tr("toggle 2D scene item visibility"),
-                                              0, _parent, true, this,  SLOT(onToggleSceneItemVisible(bool)));
+  _showAllLinksAct = _wrapper->createAction(getMenuId(), tr("Show all the links"), QIcon("icons:showLink.png"),
+                                            tr("show all links"), tr("Show all the links"),
+                                            0, _parent, false, this,  SLOT(onShowAllLinks()));
 
+  _hideAllLinksAct = _wrapper->createAction(getMenuId(), tr("Hide all the links"), QIcon("icons:hideLink.png"),
+                                            tr("hide all links"), tr("Hide all the links"),
+                                            0, _parent, false, this,  SLOT(onHideAllLinks()));
+  
+
+  _showOnlyPortLinksAct = _wrapper->createAction(getMenuId(), tr("Show only links from/to this port"), QIcon("icons:showLink.png"),
+                                                 tr("show only links"), tr("Show only links from/to this port"),
+                                                 0, _parent, false, this,  SLOT(onShowOnlyPortLinks()));
+
+  _showPortLinksAct = _wrapper->createAction(getMenuId(), tr("Show links from/to this port"), QIcon("icons:showLink.png"),
+                                             tr("show links"), tr("Show links from/to this port"),
+                                             0, _parent, false, this,  SLOT(onShowPortLinks()));
+
+  _hidePortLinksAct = _wrapper->createAction(getMenuId(), tr("Hide links from/to this port"), QIcon("icons:hideLink.png"),
+                                             tr("hide links"), tr("Hide links from/to this port"),
+                                             0, _parent, false, this,  SLOT(onHidePortLinks()));
+  
+  
+  _showOnlyCtrlLinksAct = _wrapper->createAction(getMenuId(), tr("Show only control links from/to this node"), QIcon("icons:showLink.png"),
+                                                 tr("show only Control links"), tr("Show only control links from/to this node"),
+                                                 0, _parent, false, this,  SLOT(onShowOnlyCtrlLinks()));
+
+  _showCtrlLinksAct = _wrapper->createAction(getMenuId(), tr("Show control links from/to this node"), QIcon("icons:showLink.png"),
+                                             tr("show control links"), tr("Show control links from/to this node"),
+                                             0, _parent, false, this,  SLOT(onShowCtrlLinks()));
+
+  _hideCtrlLinksAct = _wrapper->createAction(getMenuId(), tr("Hide control links from/to this node"), QIcon("icons:hideLink.png"),
+                                             tr("hide control links"), tr("Hide control links from/to this node"),
+                                             0, _parent, false, this,  SLOT(onHideCtrlLinks()));
+
+  
+  _showOnlyLinkAct = _wrapper->createAction(getMenuId(), tr("Show only this link"), QIcon("icons:showLink.png"),
+                                            tr("show only"), tr("Show only this link"),
+                                            0, _parent, false, this,  SLOT(onShowOnlyLink()));
+
+  _showLinkAct = _wrapper->createAction(getMenuId(), tr("Show this link"), QIcon("icons:showLink.png"),
+                                        tr("show"), tr("Show this link"),
+                                        0, _parent, false, this,  SLOT(onShowLink()));
+  
+  _hideLinkAct = _wrapper->createAction(getMenuId(), tr("Hide this link"), QIcon("icons:hideLink.png"),
+                                        tr("hide"), tr("Hide this link"),
+                                        0, _parent, false, this,  SLOT(onHideLink()));
+
+
+  _emphasisPortLinksAct = _wrapper->createAction(getMenuId(), tr("emphasis on links from/to this port"), QIcon("icons:emphasisLink.png"),
+                                                 tr("emphasize links"), tr("emphasis on links from/to this port"),
+                                                 0, _parent, false, this,  SLOT(onEmphasisPortLinks()));
+  
+  _emphasisCtrlLinksAct = _wrapper->createAction(getMenuId(), tr("emphasis on control links from/to this node"), QIcon("icons:emphasisLink.png"),
+                                                 tr("emphasize control links"), tr("emphasis on control links from/to this node"),
+                                                 0, _parent, false, this,  SLOT(onEmphasisCtrlLinks()));
+  
+  _emphasisLinkAct = _wrapper->createAction(getMenuId(), tr("emphasis on this link"), QIcon("icons:emphasisLink.png"),
+                                            tr("emphasize"), tr("emphasis on this link"),
+                                            0, _parent, false, this,  SLOT(onEmphasisLink()));
+
+  _deEmphasizeAllAct = _wrapper->createAction(getMenuId(), tr("remove all emphasis"), QIcon("icons:deEmphasisLink.png"),
+                                              tr("remove all emphasis"), tr("remove all emphasis"),
+                                              0, _parent, false, this,  SLOT(onDeEmphasizeAll()));
+  
+
+  _undoAct = _wrapper->createAction(getMenuId(), tr("undo last action"), QIcon("icons:undo.png"),
+                                    tr("undo"), tr("undo last action"),
+                                    0, _parent, false, this,  SLOT(onUndo()));
+  _undoAct->setShortcut(QKeySequence::Undo);
+  
+  _redoAct = _wrapper->createAction(getMenuId(), tr("redo last action"), QIcon("icons:redo.png"),
+                                    tr("redo"), tr("redo last action"),
+                                    0, _parent, false, this,  SLOT(onRedo()));
+  _redoAct->setShortcut(QKeySequence::Redo);
+  
+  _showUndoAct = _wrapper->createAction(getMenuId(), tr("show undo commands"), QIcon("icons:undo.png"),
+                                        tr("show undo"), tr("show undo commands"),
+                                        0, _parent, false, this,  SLOT(onShowUndo()));
+  
+  _showRedoAct = _wrapper->createAction(getMenuId(), tr("show redo commands"), QIcon("icons:redo.png"),
+                                        tr("show redo"), tr("show redo commands"),
+                                        0, _parent, false, this,  SLOT(onShowRedo()));
+  
 
   _execModeGroup = new QActionGroup(this);
   _execModeGroup->addAction(_withoutStopModeAct);
   _execModeGroup->addAction(_breakpointsModeAct);
   _execModeGroup->addAction(_stepByStepModeAct);
   _withoutStopModeAct->setChecked(true);
-
-  /*
-  pixmap.load("icons:.png");
-  _ = _wrapper->createAction(getMenuId(), tr(""), QIcon(pixmap),
-                                              tr(""), tr(""),
-                                              0, _parent, false, this,  SLOT());
-
-  */
-
-
 }
 
 void GenericGui::createMenus()
 {
   int aMenuId;
-  aMenuId = _wrapper->createMenu( "File", -1, -1 );
+  aMenuId = _wrapper->createMenu( tr( "File" ), -1, -1 );
   _wrapper->createMenu( _wrapper->separator(), aMenuId, -1, 10 );
-  aMenuId = _wrapper->createMenu( "YACS" , aMenuId, -1, 10 );
+  aMenuId = _wrapper->createMenu( "YACS", aMenuId, -1, 10 );
   _wrapper->createMenu( _newSchemaAct, aMenuId );
   _wrapper->createMenu( _importSchemaAct, aMenuId );
 
-  aMenuId = _wrapper->createMenu( tr( "YACS" ), -1, -1, 30 );
+  aMenuId = _wrapper->createMenu( "YACS", -1, -1, 30 );
   _wrapper->createMenu( _newSchemaAct, aMenuId );//, 10
   _wrapper->createMenu( _importSchemaAct, aMenuId );
   _wrapper->createMenu( _importSupervSchemaAct, aMenuId );
@@ -518,6 +614,12 @@ void GenericGui::createMenus()
   _wrapper->createMenu( _runLoadedSchemaAct, aMenuId );
   _wrapper->createMenu( _loadRunStateSchemaAct, aMenuId );
   _wrapper->createMenu( _loadAndRunSchemaAct, aMenuId );
+  _wrapper->createMenu( _chooseBatchJobAct, aMenuId );
+  _wrapper->createMenu( _wrapper->separator(), aMenuId);
+  _wrapper->createMenu( _undoAct, aMenuId );
+  _wrapper->createMenu( _redoAct, aMenuId );
+  _wrapper->createMenu( _showUndoAct, aMenuId );
+  _wrapper->createMenu( _showRedoAct, aMenuId );
   _wrapper->createMenu( _wrapper->separator(), aMenuId);
   _wrapper->createMenu( _startResumeAct, aMenuId );
   _wrapper->createMenu( _abortAct, aMenuId );
@@ -525,7 +627,7 @@ void GenericGui::createMenus()
   _wrapper->createMenu( _resetAct, aMenuId );
   _wrapper->createMenu( _wrapper->separator(), aMenuId);
   _wrapper->createMenu( _saveRunStateAct, aMenuId );
-  _wrapper->createMenu( _newEditionAct, aMenuId );
+  //_wrapper->createMenu( _newEditionAct, aMenuId );
   _wrapper->createMenu( _wrapper->separator(), aMenuId);
   _wrapper->createMenu( _withoutStopModeAct, aMenuId );
   _wrapper->createMenu( _breakpointsModeAct, aMenuId );
@@ -535,15 +637,23 @@ void GenericGui::createMenus()
   _wrapper->createMenu( _wrapper->separator(), aMenuId);
   _wrapper->createMenu( _importCatalogAct, aMenuId );
   _wrapper->createMenu( _wrapper->separator(), aMenuId);
+  _wrapper->createMenu( _toggleStraightLinksAct, aMenuId );
+  _wrapper->createMenu( _toggleAutomaticComputeLinkAct, aMenuId );
+  _wrapper->createMenu( _toggleSimplifyLinkAct, aMenuId );
+  _wrapper->createMenu( _toggleForce2NodesLinkAct, aMenuId );
+  _wrapper->createMenu( _toggleAddRowColsAct, aMenuId );
+  _wrapper->createMenu( _wrapper->separator(), aMenuId);
+  _wrapper->createMenu( _showAllLinksAct, aMenuId );
+  _wrapper->createMenu( _hideAllLinksAct, aMenuId );
+  _wrapper->createMenu( _wrapper->separator(), aMenuId);
   _wrapper->createMenu( _whatsThisAct, aMenuId );
 }
 
 void GenericGui::createTools()
 {
-  int aToolId = _wrapper->createTool ( tr( "TOOL_YACS" ) );
+  int aToolId = _wrapper->createTool ( tr( "YACS Toolbar" ) );
   _wrapper->createTool( _newSchemaAct, aToolId );
   _wrapper->createTool( _importSchemaAct, aToolId );
-  _wrapper->createTool( _importSupervSchemaAct, aToolId );
   _wrapper->createTool( _wrapper->separator(), aToolId );
   _wrapper->createTool( _exportSchemaAct, aToolId );
   _wrapper->createTool( _exportSchemaAsAct, aToolId );
@@ -551,15 +661,18 @@ void GenericGui::createTools()
   _wrapper->createTool( _runLoadedSchemaAct, aToolId );
   _wrapper->createTool( _loadRunStateSchemaAct, aToolId );
   _wrapper->createTool( _loadAndRunSchemaAct, aToolId );
+  _wrapper->createTool( _chooseBatchJobAct, aToolId );
+  _wrapper->createTool( _wrapper->separator(), aToolId );
+  _wrapper->createTool( _undoAct, aToolId );
+  _wrapper->createTool( _redoAct, aToolId );
   _wrapper->createTool( _wrapper->separator(), aToolId );
   _wrapper->createTool( _startResumeAct, aToolId );
   _wrapper->createTool( _abortAct, aToolId );
   _wrapper->createTool( _pauseAct, aToolId );
   _wrapper->createTool( _resetAct, aToolId );
   _wrapper->createTool( _wrapper->separator(), aToolId );
-  _wrapper->createTool( _wrapper->separator(), aToolId );
   _wrapper->createTool( _saveRunStateAct, aToolId );
-  _wrapper->createTool( _newEditionAct, aToolId );
+  //_wrapper->createTool( _newEditionAct, aToolId );
   _wrapper->createTool( _withoutStopModeAct, aToolId );
   _wrapper->createTool( _breakpointsModeAct, aToolId );
   _wrapper->createTool( _stepByStepModeAct, aToolId );
@@ -568,14 +681,24 @@ void GenericGui::createTools()
   _wrapper->createTool( _wrapper->separator(), aToolId );
   _wrapper->createTool( _importCatalogAct, aToolId );
   _wrapper->createTool( _wrapper->separator(), aToolId );
+  _wrapper->createTool( _toggleStraightLinksAct, aToolId );
+  _wrapper->createTool( _toggleAutomaticComputeLinkAct, aToolId );
+  _wrapper->createTool( _toggleSimplifyLinkAct, aToolId );
+  //_wrapper->createTool( _toggleForce2NodesLinkAct, aToolId );
+  _wrapper->createTool( _toggleAddRowColsAct, aToolId );
+  _wrapper->createTool( _wrapper->separator(), aToolId );
+  _wrapper->createTool( _showAllLinksAct, aToolId );
+  _wrapper->createTool( _hideAllLinksAct, aToolId );
+  _wrapper->createTool( _wrapper->separator(), aToolId );
   _wrapper->createTool( _whatsThisAct, aToolId );
 }
 
 void GenericGui::initialMenus()
 {
-  showBaseMenus(true);
   showEditionMenus(false);
   showExecMenus(false);
+  showCommonMenus(false);
+  showBaseMenus(true);
 }
 
 void GenericGui::showBaseMenus(bool show)
@@ -586,9 +709,10 @@ void GenericGui::showBaseMenus(bool show)
   _wrapper->setMenuShown(_importSchemaAct, show);
   _wrapper->setToolShown(_importSchemaAct, show);
   _wrapper->setMenuShown(_importSupervSchemaAct, show);
-  _wrapper->setToolShown(_importSupervSchemaAct, show);
   _wrapper->setMenuShown(_loadAndRunSchemaAct, show);
   _wrapper->setToolShown(_loadAndRunSchemaAct, show);
+  _wrapper->setMenuShown(_chooseBatchJobAct, show);
+  _wrapper->setToolShown(_chooseBatchJobAct, show);
   _wrapper->setMenuShown(_whatsThisAct, show);
   _wrapper->setToolShown(_whatsThisAct, show);
 }
@@ -604,6 +728,12 @@ void GenericGui::showEditionMenus(bool show)
   _wrapper->setToolShown(_loadRunStateSchemaAct, show);
   _wrapper->setMenuShown(_loadRunStateSchemaAct, show);
   _wrapper->setToolShown(_runLoadedSchemaAct, show);
+  _wrapper->setMenuShown(_undoAct, show);
+  _wrapper->setToolShown(_undoAct, show);
+  _wrapper->setMenuShown(_redoAct, show);
+  _wrapper->setToolShown(_redoAct, show);
+  _wrapper->setMenuShown(_showUndoAct, show);
+  _wrapper->setMenuShown(_showRedoAct, show);
   _wrapper->setMenuShown(_importCatalogAct, show);
   _wrapper->setToolShown(_importCatalogAct, show);
 }
@@ -621,8 +751,8 @@ void GenericGui::showExecMenus(bool show)
   _wrapper->setToolShown(_resetAct, show);
   _wrapper->setMenuShown(_saveRunStateAct, show);
   _wrapper->setToolShown(_saveRunStateAct, show);
-  _wrapper->setMenuShown(_newEditionAct, show);
-  _wrapper->setToolShown(_newEditionAct, show);
+  //_wrapper->setMenuShown(_newEditionAct, show);
+  //_wrapper->setToolShown(_newEditionAct, show);
   _wrapper->setMenuShown(_withoutStopModeAct, show);
   _wrapper->setToolShown(_withoutStopModeAct, show);
   _wrapper->setMenuShown(_breakpointsModeAct, show);
@@ -633,46 +763,197 @@ void GenericGui::showExecMenus(bool show)
   _wrapper->setToolShown(_toggleStopOnErrorAct, show);
 }
 
+void GenericGui::showCommonMenus(bool show)
+{
+  DEBTRACE("GenericGui::showCommonMenus " << show);
+  _wrapper->setMenuShown(_toggleStraightLinksAct, show);
+  _wrapper->setToolShown(_toggleStraightLinksAct, show);
+  _wrapper->setMenuShown(_toggleAutomaticComputeLinkAct, show);
+  _wrapper->setToolShown(_toggleAutomaticComputeLinkAct, show);
+  _wrapper->setMenuShown(_toggleSimplifyLinkAct, show);
+  _wrapper->setToolShown(_toggleSimplifyLinkAct, show);
+  _wrapper->setMenuShown(_toggleForce2NodesLinkAct, show);
+  //_wrapper->setToolShown(_toggleForce2NodesLinkAct, show);
+  _wrapper->setMenuShown(_toggleAddRowColsAct, show);
+  _wrapper->setToolShown(_toggleAddRowColsAct, show);
+  _wrapper->setMenuShown(_showAllLinksAct, show);
+  _wrapper->setToolShown(_showAllLinksAct, show);
+  _wrapper->setMenuShown(_hideAllLinksAct, show);
+  _wrapper->setToolShown(_hideAllLinksAct, show);
+}
+
 void GenericGui::switchContext(QWidget *view)
 {
-  DEBTRACE("GenericGui::switchContext");
+  DEBTRACE("GenericGui::switchContext " << view);
   if (! _mapViewContext.count(view))
     {
       initialMenus();
+      _dwTree->setWidget(0);
+      _dwStacked->setWidget(0);
       return;
     }
   QtGuiContext* newContext = _mapViewContext[view];
-  QtGuiContext* oldContext = QtGuiContext::getQtCurrent();
 
   _dwTree->setWidget(newContext->getEditTree());
   _dwTree->widget()->show();
+  _dwTree->raise();
   _dwStacked->setWidget(newContext->getStackedWidget());
 
   QtGuiContext::setQtCurrent(newContext);
 
   if (newContext->isEdition())
     {
+      showExecMenus(false);
       showBaseMenus(true);
       showEditionMenus(true);
-      showExecMenus(false);
+      showCommonMenus(true);
       if (_dwTree) _dwTree->setWindowTitle("Tree View: edition mode");
     }
   else
     {
-      showBaseMenus(true);
       showEditionMenus(false);
+      showBaseMenus(true);
       showExecMenus(true);
+      showCommonMenus(true);
       _withoutStopModeAct->setChecked(true);
       if (_dwTree) _dwTree->setWindowTitle("Tree View: execution mode");
     }
+  _dwStacked->setMinimumWidth(10);
+}
+
+bool GenericGui::closeContext(QWidget *view, bool onExit)
+{
+  DEBTRACE("GenericGui::closeContext " << onExit);
+  if (! _mapViewContext.count(view))
+    return true;
+  QtGuiContext* context = _mapViewContext[view];
+  switchContext(view);
+
+  bool tryToSave = false;
+
+  if (QtGuiContext::getQtCurrent()->isEdition())
+    {
+      if (!QtGuiContext::getQtCurrent()->_setOfModifiedSubjects.empty())
+        {
+          QMessageBox msgBox;
+          msgBox.setText("Some elements are modified and not taken into account.");
+          string info = "do you want to apply your changes ?\n";
+          info += " - Save    : do not take into account edition in progress,\n";
+          info += "             but if there are other modifications, select a file name for save\n";
+          info += " - Discard : discard all modifications and close the schema";
+          if (!onExit)
+            info += "\n - Cancel  : do not close the schema, return to edition";
+          msgBox.setInformativeText(info.c_str());
+          if (!onExit)
+            {
+              msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
+              msgBox.setDefaultButton(QMessageBox::Cancel);
+            }
+          else
+            {
+              msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard);
+              msgBox.setDefaultButton(QMessageBox::Save);
+            }
+          int ret = msgBox.exec();
+          switch (ret)
+            {
+            case QMessageBox::Save:
+              tryToSave = true;
+              break;
+            case QMessageBox::Discard:
+              tryToSave = false;
+              break;
+            case QMessageBox::Cancel:
+            default:
+              DEBTRACE("Cancel or default");
+              return false;
+              break;
+            }
+        }
+      else
+        if (QtGuiContext::getQtCurrent()->isNotSaved())
+          {
+            QMessageBox msgBox;
+            msgBox.setWindowTitle("Close the active schema");
+            msgBox.setText("The schema has been modified");
+            string info = "do you want to save the schema ?\n";
+            info += " - Save    : select a file name for save\n";
+            info += " - Discard : discard all modifications and close the schema";
+            if (!onExit)
+              info += "\n - Cancel  : do not close the schema, return to edition";
+            msgBox.setInformativeText(info.c_str());
+            if (!onExit)
+              {
+                msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
+                msgBox.setDefaultButton(QMessageBox::Cancel);
+              }
+            else
+              {
+                msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard);
+                msgBox.setDefaultButton(QMessageBox::Save);
+              }
+            int ret = msgBox.exec();
+            switch (ret)
+              {
+              case QMessageBox::Save:
+                tryToSave = true;
+                break;
+              case QMessageBox::Discard:
+                tryToSave = false;
+                break;
+              case QMessageBox::Cancel:
+                DEBTRACE("Cancel or default");
+              default:
+                return false;
+                break;
+              }
+          }
+
+      if (tryToSave)
+        {
+          onExportSchemaAs();
+          if ((!onExit) && (!_isSaved)) // --- probably, user has cancelled the save dialog. Do not close
+            return false;
+        }
+    }
+
+  map<QWidget*, YACS::HMI::QtGuiContext*>::iterator it = _mapViewContext.begin();
+  QtGuiContext* newContext = 0;
+  QWidget* newView = 0;
+  for (; it != _mapViewContext.end(); ++it)
+    {
+      if ((*it).second != context)
+        {
+          newView = (*it).first;
+          newContext = (*it).second;
+          break;
+        }
+    }
+  int studyId = _wrapper->activeStudyId();
+  if (context->getStudyId() == studyId)
+    {
+      _wrapper->deleteSchema(view);
+      DEBTRACE("delete context");
+      if (GuiExecutor* exec = context->getGuiExecutor())
+        {
+          exec->closeContext();
+        }
+      delete context;
+      _mapViewContext.erase(view);
+      switchContext(newView);
+    }
+  return true;
 }
 
 void GenericGui::showDockWidgets(bool isVisible)
 {
   DEBTRACE("GenericGui::showDockWidgets " << isVisible);
   if (_dwTree) _dwTree->setVisible(isVisible);
+  if (_dwTree) _dwTree->toggleViewAction()->setVisible(isVisible);
   if (_dwStacked) _dwStacked->setVisible(isVisible);
+  if (_dwStacked) _dwStacked->toggleViewAction()->setVisible(isVisible);
   if (_dwCatalogs) _dwCatalogs->setVisible(isVisible);
+  if (_dwCatalogs) _dwCatalogs->toggleViewAction()->setVisible(isVisible);
 }
 
 void GenericGui::raiseStacked()
@@ -698,18 +979,17 @@ std::list<std::string> GenericGui::getMachineList()
   Engines::ResourcesManager_var resManager = Engines::ResourcesManager::_narrow(obj);
   if(!resManager) return _machineList;
 
-  Engines::CompoList compoList ;
-  Engines::MachineParameters params;
+  Engines::ResourceParameters params;
   lcc.preSet(params);
 
-  Engines::MachineList* machineList =
-    resManager->GetFittingResources(params, compoList);
+  Engines::ResourceList* resourceList =
+    resManager->GetFittingResources(params);
 
-  for (int i = 0; i < machineList->length(); i++)
-    {
-      const char* aMachine = (*machineList)[i];
-      _machineList.push_back(aMachine);
-    }
+  for (int i = 0; i < resourceList->length(); i++)
+  {
+    const char* aResource = (*resourceList)[i];
+    _machineList.push_back(aResource);
+  }
 
   return _machineList;
 }
@@ -735,6 +1015,13 @@ void GenericGui::createContext(YACS::ENGINE::Proc* proc,
   clock_t  end_t;
   start_t = clock();
 
+
+  QWidget* central = _parent->centralWidget();
+  if (central)
+    central->setFocus();
+  else
+    DEBTRACE("No Central Widget");
+
   QString fileName;
   QWidget* refWindow = 0; // --- used only on run to refer to the schema in edition
   if (forEdition)
@@ -756,7 +1043,7 @@ void GenericGui::createContext(YACS::ENGINE::Proc* proc,
   context->setEdition(forEdition);
   context->setSessionCatalog(_sessionCatalog);
   context->setFileName(fileName);
-  context->setCurrentCatalog(YACS::ENGINE::getSALOMERuntime()->loadCatalog("proc", fileName.toStdString()));
+  context->setCurrentCatalog(_builtinCatalog);
 
   // --- scene, viewWindow & GraphicsView
 
@@ -768,6 +1055,9 @@ void GenericGui::createContext(YACS::ENGINE::Proc* proc,
   gView->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
   int studyId = _wrapper->AssociateViewToWindow(gView, viewWindow);
   context->setStudyId(studyId);
+  std::ostringstream value;
+  value << studyId;
+  proc->setProperty("DefaultStudyID",value.str());
   context->setScene(scene);
   context->setView(gView);
   context->setWindow(viewWindow);
@@ -789,6 +1079,7 @@ void GenericGui::createContext(YACS::ENGINE::Proc* proc,
   context->setEditTree(editTree);
   editTree->tv_schema->setModel(schemaModel);
   context->setSelectionModel(editTree->tv_schema->selectionModel());
+  _dwTree->raise();
 
   QObject::connect(editTree->tv_schema->selectionModel(),
                    SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
@@ -818,7 +1109,7 @@ void GenericGui::createContext(YACS::ENGINE::Proc* proc,
     end_t = clock();
     double passe =  (end_t -start_t);
     passe = passe/CLOCKS_PER_SEC;
-    cerr <<"create context -1- : " << passe << endl;
+    DEBTRACE("create context -1- : " << passe);
     start_t = end_t;
   }
 
@@ -831,7 +1122,7 @@ void GenericGui::createContext(YACS::ENGINE::Proc* proc,
     end_t = clock();
     double passe =  (end_t -start_t);
     passe = passe/CLOCKS_PER_SEC;
-    cerr <<"create context - load proc- : " << passe << endl;
+    DEBTRACE("create context - load proc- : " << passe);
     start_t = end_t;
   }
 
@@ -856,31 +1147,45 @@ void GenericGui::createContext(YACS::ENGINE::Proc* proc,
   // --- adjust widgets
 
   TreeView *vtree = dynamic_cast<TreeView*>(editTree->tv_schema);
-  assert(vtree);
+  YASSERT(vtree);
   vtree->resizeColumns();
-  _catalogsWidget->setMinimumWidth(40); // --- reset the constraint on width
+  _catalogsWidget->setMinimumWidth(10); // --- reset the constraint on width
   editTree->setMinimumHeight(40);
+  _dwStacked->setMinimumWidth(10);
   // --- show menus
 
   if (forEdition)
     {
-      showEditionMenus(true);
       showExecMenus(false);
+      showEditionMenus(true);
+      showCommonMenus(true);
       if (_dwTree) _dwTree->setWindowTitle("Tree View: edition mode");
     }
   else
     {
       showEditionMenus(false);
       showExecMenus(true);
+      showCommonMenus(true);
       _withoutStopModeAct->setChecked(true);
       if (_dwTree) _dwTree->setWindowTitle("Tree View: execution mode");
     }
+
+  QtGuiContext::getQtCurrent()->setNotSaved(false);
+  {
+    end_t = clock();
+    double passe =  (end_t -start_t);
+    passe = passe/CLOCKS_PER_SEC;
+    DEBTRACE("create context - end - : " << passe);
+    start_t = end_t;
+  }
 }
 
 // -----------------------------------------------------------------------------
 
 void GenericGui::setLoadedPresentation(YACS::ENGINE::Proc* proc)
 {
+  DEBTRACE("GenericGui::setLoadedPresentation");
+  QtGuiContext::getQtCurrent()->setLoadingPresentation(true);
   map<YACS::ENGINE::Node*, PrsData> presNodes = _loader->getPrsData(proc);
   if (!presNodes.empty())
     {
@@ -891,13 +1196,29 @@ void GenericGui::setLoadedPresentation(YACS::ENGINE::Proc* proc)
           PrsData pres = (*it).second;
           SubjectNode *snode = QtGuiContext::getQtCurrent()->_mapOfSubjectNode[node];
           SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[snode];
-          assert(item);
-          item->setPos(QPointF(pres._x, pres._y));
-          item->setWidth(pres._width);
-          item->setHeight(pres._height);
+          YASSERT(item);
+          SceneNodeItem *inode = dynamic_cast<SceneNodeItem*>(item);
+          YASSERT(inode);
+          inode->setPos(QPointF(pres._x, pres._y));
+          inode->setWidth(pres._width);
+          inode->setHeight(pres._height);
+          inode->setExpanded(pres._expanded);
+          inode->setExpandedPos(QPointF(pres._expx, pres._expy));
+          inode->setExpandedWH(pres._expWidth, pres._expHeight);
+          inode->setShownState(shownState(pres._shownState));
         }
-      _guiEditor->rebuildLinks();
     }
+  if (Scene::_autoComputeLinks)
+    _guiEditor->rebuildLinks();
+  else
+    {
+      YACS::HMI::SubjectProc* subproc = QtGuiContext::getQtCurrent()->getSubjectProc();
+      SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[subproc];
+      SceneComposedNodeItem *proc = dynamic_cast<SceneComposedNodeItem*>(item);
+      proc->updateLinks();
+    }
+
+  QtGuiContext::getQtCurrent()->setLoadingPresentation(false);
 }
 
 // -----------------------------------------------------------------------------
@@ -912,21 +1233,79 @@ void GenericGui::onNewSchema()
   YACS::ENGINE::RuntimeSALOME* runTime = YACS::ENGINE::getSALOMERuntime();
   YACS::ENGINE::Proc *proc = runTime->createProc(name.str());
 
+  _loader->reset();
+
   QString fileName = name.str().c_str();
   createContext(proc, fileName, "", true);
 }
 
+void GenericGui::loadSchema(const std::string& filename,bool edit, bool arrangeLocalNodes)
+{
+  YACS::ENGINE::Proc *proc = _loader->load(filename.c_str());
+  if (!proc)
+    return;
+  YACS::ENGINE::Logger* logger= proc->getLogger("parser");
+  if(!logger->isEmpty())
+    {
+      DEBTRACE(logger->getStr());
+    }
+  QString fn=QString::fromStdString(filename);
+  if(edit)
+    createContext(proc, fn, "", true);
+  else
+    createContext(proc, fn, fn, false);
+  if (arrangeLocalNodes)
+  {
+    _guiEditor->arrangeProc();
+  }
+}
+
 void GenericGui::onImportSchema()
 {
+  clock_t  start_t;
+  clock_t  end_t;
+  start_t = clock();
   DEBTRACE("GenericGui::onImportSchema");
-  QString fn = QFileDialog::getOpenFileName( _parent,
-                                             "Choose a filename to load" ,
-                                             QString::null,
-                                             tr( "XML-Files (*.xml);;All Files (*)" ));
+  QFileDialog dialog(_parent,
+                     "Choose a filename to load" ,
+                     QString::null,
+                     tr( "XML-Files (*.xml);;All Files (*)" ));
+
+  dialog.setHistory(_wrapper->getQuickDirList());
+
+  QString fn;
+  QStringList fileNames;
+  if (dialog.exec())
+    {
+      fileNames = dialog.selectedFiles();
+      if (!fileNames.isEmpty())
+        fn = fileNames.first();
+    }
+
   if ( !fn.isEmpty() )
     {
+      // add ".xml" suffix
+      QFileInfo fi(fn);
+      if (!fi.exists() && fi.suffix() != "xml")
+        fn += ".xml";
+
       DEBTRACE("file loaded : " <<fn.toStdString());
-      YACS::ENGINE::Proc *proc = _loader->load(fn.toLatin1());
+      YACS::ENGINE::Proc *proc = 0;
+
+      try {
+         proc = _loader->load(fn.toLatin1());
+      }
+      catch (...) {
+      }
+      
+      {
+        end_t = clock();
+        double passe =  (end_t -start_t);
+        passe = passe/CLOCKS_PER_SEC;
+        DEBTRACE("load xml file : " << passe);
+        start_t = end_t;
+      }
+
       if (!proc)
         {
           QMessageBox msgBox(QMessageBox::Critical,
@@ -947,27 +1326,50 @@ void GenericGui::onImportSchema()
 void GenericGui::onImportSupervSchema()
 {
   DEBTRACE("GenericGui::onImportSupervSchema");
-  QString fn = QFileDialog::getOpenFileName( _parent,
-                                             "Choose a  SUPERV filename to load" ,
-                                             QString::null,
-                                             tr( "XML-Files (*.xml);;All Files (*)" ));
+  QFileDialog dialog(_parent,
+                     "Choose a  SUPERV filename to load" ,
+                     QString::null,
+                     tr( "XML-Files (*.xml);;All Files (*)" ));
+
+  dialog.setHistory(_wrapper->getQuickDirList());
+
+  QString fn;
+  QStringList fileNames;
+  if (dialog.exec())
+    {
+      fileNames = dialog.selectedFiles();
+      if (!fileNames.isEmpty())
+        fn = fileNames.first();
+    }
+
   if (fn.isEmpty()) return;
 
+  // add ".xml" suffix
+  QFileInfo fi(fn);
+  if (!fi.exists() && fi.suffix() != "xml")
+    fn += ".xml";
+
   DEBTRACE("file loaded : " <<fn.toStdString());
   QString tmpFileName;
   try
     {
+#ifdef WNT
+      QString tmpDir = getenv("TEMP");
+         QString fileExt = "bat";
+#else
       QString tmpDir = "/tmp";
+         QString fileExt = "sh";
+#endif
       QDir aTmpDir(tmpDir);
       aTmpDir.mkdir(QString("YACS_") + getenv("USER"));
-      assert(aTmpDir.cd(QString("YACS_") + getenv("USER")));
+      YASSERT(aTmpDir.cd(QString("YACS_") + getenv("USER")));
       QDateTime curTime = QDateTime::currentDateTime();   
       tmpFileName = "SUPERV_import_" + curTime.toString("yyyyMMdd_hhmmss") + ".xml";
       QString tmpOutput = "salomeloader_output";
       tmpFileName = aTmpDir.absoluteFilePath(tmpFileName);
       DEBTRACE(tmpFileName.toStdString());
       
-      QString aCall = "salomeloader.sh " + fn + " " + tmpFileName + " > " + tmpOutput;
+      QString aCall = "salomeloader."+ fileExt+ " "+ fn + " " + tmpFileName + " > " + tmpOutput;
       DEBTRACE(aCall.toStdString());
       
       int ret = system(aCall.toAscii());
@@ -1065,7 +1467,9 @@ QString GenericGui::getSaveFileName(const QString& fileName)
       if (!fileNames.isEmpty())
         selectedFile = fileNames.first();
     }
-  return selectedFile;
+  QString filteredName = _guiEditor->asciiFilter(selectedFile);
+  DEBTRACE(filteredName.toStdString());
+  return filteredName;
 }
 
 void GenericGui::onExportSchema()
@@ -1084,11 +1488,14 @@ void GenericGui::onExportSchema()
   if (fn.isEmpty()) return;
 
   DEBTRACE("GenericGui::onExportSchema: " << fn.toStdString());
+  //to be sure that all pending changes are effective
+  _parent->setFocus();
   QtGuiContext::getQtCurrent()->setFileName(fn);
   VisitorSaveGuiSchema aWriter(proc);
   aWriter.openFileSchema( fn.toStdString() );
   aWriter.visitProc();
   aWriter.closeFileSchema();
+  QtGuiContext::getQtCurrent()->setNotSaved(false);
 
   if (fn.compare(foo) && _wrapper)
     _wrapper->renameSchema(foo, fn, QtGuiContext::getQtCurrent()->getWindow());
@@ -1097,11 +1504,12 @@ void GenericGui::onExportSchema()
 void GenericGui::onExportSchemaAs()
 {
   DEBTRACE("GenericGui::onExportSchemaAs");
+  _isSaved = false;
   if (!QtGuiContext::getQtCurrent()) return;
   YACS::ENGINE::Proc* proc = QtGuiContext::getQtCurrent()->getProc();
   QString fo = QtGuiContext::getQtCurrent()->getFileName();
   QString foo = fo;
-  if (fo.startsWith("newShema_")) fo.clear();
+  if (fo.startsWith("newSchema_")) fo.clear();
   QString fn = getSaveFileName(fo);
   if (fn.isEmpty()) return;
 
@@ -1111,6 +1519,8 @@ void GenericGui::onExportSchemaAs()
   aWriter.openFileSchema(fn.toStdString());
   aWriter.visitProc();
   aWriter.closeFileSchema();
+  _isSaved = true;
+  QtGuiContext::getQtCurrent()->setNotSaved(false);
 
   if (fn.compare(foo) && _wrapper)
     _wrapper->renameSchema(foo, fn, QtGuiContext::getQtCurrent()->getWindow());
@@ -1119,10 +1529,22 @@ void GenericGui::onExportSchemaAs()
 void GenericGui::onImportCatalog()
 {
   DEBTRACE("GenericGui::onImportCatalog");
-  QString fn = QFileDialog::getOpenFileName( _parent,
-                                             "Choose a YACS Schema to load as a Catalog" ,
-                                             QString::null,
-                                             tr( "XML-Files (*.xml);;All Files (*)" ));
+  QFileDialog dialog(_parent,
+                     "Choose a YACS Schema to load as a Catalog" ,
+                     QString::null,
+                     tr( "XML-Files (*.xml);;All Files (*)" ));
+
+  dialog.setHistory(_wrapper->getQuickDirList());
+
+  QString fn;
+  QStringList fileNames;
+  if (dialog.exec())
+    {
+      fileNames = dialog.selectedFiles();
+      if (!fileNames.isEmpty())
+        fn = fileNames.first();
+    }
+
   if ( !fn.isEmpty() )
     _catalogsWidget->addCatalogFromFile(fn.toStdString());
 }
@@ -1161,6 +1583,7 @@ void GenericGui::onRunLoadedSchema(bool withState)
     {
       DEBTRACE(ex.what());
       QtGuiContext::getQtCurrent()->getSubjectProc()->select(true);
+      return;
     }
   if (info.areWarningsOrErrors()) return;
  
@@ -1176,10 +1599,14 @@ void GenericGui::onRunLoadedSchema(bool withState)
   QFileInfo fo = QtGuiContext::getQtCurrent()->getFileName();
   QString procName = fo.baseName();
   //QString tmpDir = SALOMEDS_Tool::GetTmpDir().c_str();
+#ifdef WNT
+  QString tmpDir = getenv("TEMP");
+#else
   QString tmpDir = "/tmp";
+#endif
   QDir aTmpDir(tmpDir);
   aTmpDir.mkdir(QString("YACS_") + getenv("USER"));
-  assert(aTmpDir.cd(QString("YACS_") + getenv("USER")));
+  YASSERT(aTmpDir.cd(QString("YACS_") + getenv("USER")));
   QDateTime curTime = QDateTime::currentDateTime();   
   QString aRunName = procName + "_" + curTime.toString("yyyyMMdd_hhmmss") + ".xml";
   aRunName = aTmpDir.absoluteFilePath(aRunName);
@@ -1219,6 +1646,8 @@ void GenericGui::onRunLoadedSchema(bool withState)
         }
     }
   executor->startResumeDataflow(true); // --- initialise gui state
+  if(_toggleStopOnErrorAct->isChecked())
+    executor->setStopOnError(false);
 }
 
 void GenericGui::onLoadRunStateSchema()
@@ -1236,17 +1665,47 @@ void GenericGui::onLoadAndRunSchema()
                                              tr( "XML-Files (*.xml);;All Files (*)" ));
   if ( !fn.isEmpty() )
     {
-      DEBTRACE("***************************************************************************");
+      // add ".xml" suffix
+      QFileInfo fi(fn);
+      if (!fi.exists() && fi.suffix() != "xml")
+        fn += ".xml";
+
       DEBTRACE("file loaded : " <<fn.toStdString());
-      DEBTRACE("***************************************************************************");
-      YACS::ENGINE::Proc *proc = _loader->load(fn.toLatin1());
+      YACS::ENGINE::Proc *proc =0;
+      
+      try {
+         proc = _loader->load(fn.toLatin1());
+      }
+      catch (...) {
+      }
+      
+      if (!proc)
+        {
+          QMessageBox msgBox(QMessageBox::Critical,
+                             "Import YACS Schema, native YACS XML format",
+                             "The file has not the native YACS XML format or is not readable.");
+          msgBox.exec();
+          return;
+        }
       YACS::ENGINE::Logger* logger= proc->getLogger("parser");
       if(!logger->isEmpty())
         {
           DEBTRACE(logger->getStr());
         }
-      createContext(proc, fn, fn, false);
+      createContext(proc, fn, "", true);
+      onRunLoadedSchema();
     }
+}
+
+void GenericGui::onChooseBatchJob() {
+  DEBTRACE("GenericGui::onChooseBatchJob");
+
+  // Show the Batch Jobs list
+  if(_BJLdialog) delete _BJLdialog;
+  _BJLdialog = new BatchJobsListDialog(tr("Select one Batch Job to watch"),this);
+  _BJLdialog->show();
+  _BJLdialog->move(300,200);
+  _BJLdialog->resize(450,200);
 
 }
 
@@ -1302,9 +1761,9 @@ void GenericGui::onSaveRunState()
 void GenericGui::onNewEdition()
 {
   DEBTRACE("GenericGui::onNewEdition");
-//   if (!QtGuiContext::getQtCurrent()) return;
-//   if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
-//   QtGuiContext::getQtCurrent()->getGuiExecutor()->resetDataflow();
+  //   if (!QtGuiContext::getQtCurrent()) return;
+  //   if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
+  //   QtGuiContext::getQtCurrent()->getGuiExecutor()->resetDataflow();
 }
 
 void GenericGui::onGetYacsContainerLog()
@@ -1313,7 +1772,7 @@ void GenericGui::onGetYacsContainerLog()
   if (!QtGuiContext::getQtCurrent()) return;
   if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
   string log = QtGuiContext::getQtCurrent()->getGuiExecutor()->getContainerLog();
-  LogViewer *lv = new LogViewer("YACS Container Log", _parent);
+  ContainerLogViewer *lv = new ContainerLogViewer("YACS Container Log", _parent);
   lv->readFile(log);
   lv->show();
 }
@@ -1322,11 +1781,19 @@ void GenericGui::onGetErrorReport()
 {
   DEBTRACE("GenericGui::onGetErrorReport");
   if (!QtGuiContext::getQtCurrent()) return;
-  if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
   Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
-  SubjectElementaryNode *snode = dynamic_cast<SubjectElementaryNode*>(sub);
+  SubjectNode *snode = dynamic_cast<SubjectNode*>(sub);
   if (!snode) return;
-  string log = QtGuiContext::getQtCurrent()->getGuiExecutor()->getErrorReport(snode->getNode());
+  string log;
+  if (QtGuiContext::getQtCurrent()->getGuiExecutor())
+    {
+      log = QtGuiContext::getQtCurrent()->getGuiExecutor()->getErrorReport(snode->getNode());
+    }
+  else
+    {
+      log = snode->getNode()->getErrorReport();
+    }
+
   LogViewer *lv = new LogViewer("Node error report", _parent);
   lv->setText(log);
   lv->show();
@@ -1336,11 +1803,19 @@ void GenericGui::onGetErrorDetails()
 {
   DEBTRACE("GenericGui::onGetErrorDetails");
   if (!QtGuiContext::getQtCurrent()) return;
-  if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
   Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
-  SubjectElementaryNode *snode = dynamic_cast<SubjectElementaryNode*>(sub);
+  SubjectNode *snode = dynamic_cast<SubjectNode*>(sub);
   if (!snode) return;
-  string log = QtGuiContext::getQtCurrent()->getGuiExecutor()->getErrorDetails(snode->getNode());
+  string log;
+  if (QtGuiContext::getQtCurrent()->getGuiExecutor())
+    {
+      log = QtGuiContext::getQtCurrent()->getGuiExecutor()->getErrorDetails(snode->getNode());
+    }
+  else
+    {
+      log = snode->getNode()->getErrorDetails();
+    }
+
   LogViewer *lv = new LogViewer("Node Error Details", _parent);
   lv->setText(log);
   lv->show();
@@ -1355,12 +1830,40 @@ void GenericGui::onGetContainerLog()
   SubjectElementaryNode *snode = dynamic_cast<SubjectElementaryNode*>(sub);
   if (!snode) return;
   string log = QtGuiContext::getQtCurrent()->getGuiExecutor()->getContainerLog(snode->getNode());
+
   LogViewer *lv = new LogViewer("Node Container Log", _parent);
-  lv->readFile(log);
+  if (log.empty())
+    {
+      string info = "\n";
+      if (dynamic_cast<YACS::ENGINE::ServiceNode*>(snode->getNode()))
+        {
+          info +="The container log of this node\n";
+          info += "is not stored in a file and \n";
+          info += "can't be displayed here, \n";
+          info += "but you can have a look at \n";
+          info += "the SALOME standard output,\n";
+          info += "on your terminal...";
+        }
+      else
+        {
+          info += "See YACS Container log \n";
+          info += "(on main proc menu) \n";
+          info += "for all inline nodes";
+        }
+      lv->setText(info);
+    }
+  else
+    lv->readFile(log);
   lv->show();
 }
 
-
+void GenericGui::onShutdownProc()
+{
+  DEBTRACE("GenericGui::onShutdownProc");
+  if (!QtGuiContext::getQtCurrent()) return;
+  if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
+  QtGuiContext::getQtCurrent()->getGuiExecutor()->shutdownProc();
+}
 
 void GenericGui::onEditDataTypes()
 {
@@ -1378,6 +1881,16 @@ void GenericGui::onImportDataType()
   if (_dwCatalogs) _dwCatalogs->raise();
 }
 
+void GenericGui::onSelectComponentInstance()
+{
+  DEBTRACE("GenericGui::onSelectComponentInstance");
+  Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
+  if (!sub) return;
+  SubjectComponent *ref = dynamic_cast<SubjectComponent*>(sub);
+  YASSERT(ref);
+  YACS::ENGINE::ComponentInstance* compo=ref->getComponent();
+  QtGuiContext::getQtCurrent()->_mapOfLastComponentInstance[compo->getCompoName()]=compo;
+}
 
 void GenericGui::onNewContainer()
 {
@@ -1388,6 +1901,7 @@ void GenericGui::onNewContainer()
 void GenericGui::onNewSalomeComponent()
 {
   DEBTRACE("GenericGui::onNewSalomeComponent");
+  _guiEditor->CreateComponentInstance();
 }
 
 void GenericGui::onNewSalomePythonComponent()
@@ -1487,7 +2001,13 @@ void GenericGui::onFORNode()
 void GenericGui::onFOREACHNode()
 {
   DEBTRACE("GenericGui::onFOREACHNode");
-  _guiEditor->CreateForEachLoop();
+  createForEachLoop("double");
+}
+
+void GenericGui::createForEachLoop(std::string type)
+{
+  DEBTRACE("GenericGui::createForEachLoop");
+  _guiEditor->CreateForEachLoop(type);
 }
 
 void GenericGui::onWHILENode()
@@ -1502,6 +2022,12 @@ void GenericGui::onSWITCHNode()
   _guiEditor->CreateSwitch();
 }
 
+void GenericGui::onOptimizerLoop()
+{
+  DEBTRACE("GenericGui::onOptimizerLoop");
+  _guiEditor->CreateOptimizerLoop();
+}
+
 void GenericGui::onNodeFromCatalog()
 {
   DEBTRACE("GenericGui::onNodeFromCatalog");
@@ -1532,6 +2058,11 @@ void GenericGui::onPasteItem()
   _guiEditor->PasteSubject();
 }
 
+void GenericGui::onPutInBloc()
+{
+  _guiEditor->PutSubjectInBloc();
+}
+
 void GenericGui::onArrangeLocalNodes()
 {
   DEBTRACE("GenericGui::onArrangeLocalNodes");
@@ -1550,6 +2081,37 @@ void GenericGui::onRebuildLinks()
   _guiEditor->rebuildLinks();
 }
 
+void GenericGui::onZoomToBloc()
+{
+  DEBTRACE("GenericGui::onZoomToBloc");
+  QtGuiContext::getQtCurrent()->getView()->onZoomToBloc();
+}
+
+void GenericGui::onCenterOnNode()
+{
+  DEBTRACE("GenericGui::onCenterOnNode");
+  QtGuiContext::getQtCurrent()->getView()->onCenterOnNode();
+}
+
+void GenericGui::onShrinkExpand() {
+  DEBTRACE("GenericGui::onShrinkExpand");
+  _guiEditor->shrinkExpand();
+}
+
+void GenericGui::onToggleStraightLinks(bool checked)
+{
+  Scene::_straightLinks = checked;
+  DEBTRACE("Scene::_straightLinks=" << checked);
+  if (!QtGuiContext::getQtCurrent())
+    return;
+  map<Subject*, SchemaItem*>::const_iterator it = QtGuiContext::getQtCurrent()->_mapOfSchemaItem.begin();
+  for( ; it != QtGuiContext::getQtCurrent()->_mapOfSchemaItem.end(); ++it)
+    {
+      Subject* sub = (*it).first;
+      sub->update(SWITCHSHAPE, 0, 0);
+    }
+}
+
 void GenericGui::onToggleAutomaticComputeLinks(bool checked)
 {
   Scene::_autoComputeLinks = checked;
@@ -1568,12 +2130,18 @@ void GenericGui::onToggleForce2NodesLinks(bool checked)
   DEBTRACE("Scene::_force2NodesLink=" << checked);
 }
 
+void GenericGui::onToggleAddRowCols(bool checked)
+{
+  Scene::_addRowCols  = checked;
+  DEBTRACE("Scene::_addRowCols=" << checked);
+}
+
 void GenericGui::onSelectReference()
 {
   Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
   if (!sub) return;
   SubjectReference *ref = dynamic_cast<SubjectReference*>(sub);
-  assert(ref);
+  YASSERT(ref);
   SubjectServiceNode *snode = dynamic_cast<SubjectServiceNode*>(ref->getReference());
   snode->select(true);
 }
@@ -1613,6 +2181,10 @@ void GenericGui::onToggleStopOnError(bool checked)
   DEBTRACE("GenericGui::onToggleStopOnError " << checked);
   if (!QtGuiContext::getQtCurrent()) return;
   if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) return;
+  if(checked)
+    QtGuiContext::getQtCurrent()->getGuiExecutor()->setStopOnError(false);
+  else
+    QtGuiContext::getQtCurrent()->getGuiExecutor()->unsetStopOnError();
 }
 
 void GenericGui::onToggleSceneItemVisible(bool checked)
@@ -1629,16 +2201,300 @@ void GenericGui::onToggleSceneItemVisible(bool checked)
   item->setVisible(checked);
 }
 
+void GenericGui::displayLinks(bool isShown)
+{
+  if (!QtGuiContext::getQtCurrent()) return;
+  map<pair<YACS::ENGINE::OutPort*, YACS::ENGINE::InPort*>,YACS::HMI::SubjectLink*>::const_iterator it;
+  for (it = QtGuiContext::getQtCurrent()->_mapOfSubjectLink.begin();
+       it != QtGuiContext::getQtCurrent()->_mapOfSubjectLink.end();
+       ++it)
+    {
+      YACS::HMI::SubjectLink* sub = (*it).second;
+      if (!sub) continue;
+      SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sub];
+      item->setVisible(isShown);
+    }
+}
+
+void GenericGui::displayControlLinks(bool isShown)
+{
+  if (!QtGuiContext::getQtCurrent()) return;
+  map<pair<YACS::ENGINE::Node*, YACS::ENGINE::Node*>,YACS::HMI::SubjectControlLink*>::const_iterator it;
+  for (it = QtGuiContext::getQtCurrent()->_mapOfSubjectControlLink.begin();
+       it != QtGuiContext::getQtCurrent()->_mapOfSubjectControlLink.end();
+       ++it)
+    {
+      YACS::HMI::SubjectControlLink* sub = (*it).second;
+      if (!sub) continue;
+      SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sub];
+      item->setVisible(isShown);
+    }
+}
+
+void GenericGui::displayPortLinks(bool isShown)
+{
+  Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
+  DEBTRACE("displayPortLinks, subject : " << sub->getName());
+  SubjectDataPort *sport = dynamic_cast<SubjectDataPort*>(sub);
+  if (sport)
+    {
+      DEBTRACE("dataPort : " << sport->getName());
+      list<SubjectLink*> linkList = sport->getListOfSubjectLink();
+      list<SubjectLink*>::const_iterator it = linkList.begin();
+      for( ; it != linkList.end(); ++it)
+        {
+          YACS::HMI::SubjectLink* sub = (*it);
+          if (!sub) continue;
+          SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sub];
+          item->setVisible(isShown);
+        }
+      return;
+    }
+  SubjectNode *snode = dynamic_cast<SubjectNode*>(sub);
+  if (snode)
+    {
+      DEBTRACE("Node : " << snode->getName());
+      list<SubjectControlLink*> linkList = snode->getSubjectControlLinks();
+      list<SubjectControlLink*>::const_iterator it = linkList.begin();
+      for( ; it != linkList.end(); ++it)
+        {
+          YACS::HMI::SubjectControlLink* sub = (*it);
+          if (!sub) continue;
+          SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sub];
+          item->setVisible(isShown);
+        }
+      return;
+    }
+}
+
+void GenericGui::displayALink(bool isShown)
+{
+  Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
+  if (! QtGuiContext::getQtCurrent()->_mapOfSceneItem.count(sub)) return;
+  SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sub];
+  item->setVisible(isShown);
+}
+
+void GenericGui::onShowAllLinks()
+{
+  DEBTRACE("GenericGui::onShowAllLinks");
+  displayLinks(true);
+  displayControlLinks(true);
+}
+
+void GenericGui::onHideAllLinks()
+{
+  DEBTRACE("GenericGui::onHideAllLinks");
+  displayLinks(false);
+  displayControlLinks(false);
+}
+
+void GenericGui::onShowOnlyPortLinks()
+{
+  DEBTRACE("GenericGui::onShowOnlyPortLinks");
+  onHideAllLinks();
+  displayPortLinks(true);
+}
+
+void GenericGui::onShowPortLinks()
+{
+  DEBTRACE("GenericGui::onShowPortLinks");
+  displayPortLinks(true);
+}
+
+void GenericGui::onHidePortLinks()
+{
+  DEBTRACE("GenericGui::onHidePortLinks");
+  displayPortLinks(false);
+}
+
+void GenericGui::onEmphasisPortLinks()
+{
+  DEBTRACE("GenericGui::onEmphasisPortLinks");
+  if (!QtGuiContext::getQtCurrent()) return;
+  Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
+  DEBTRACE("EmphasizePortLinks, subject : " << sub->getName());
+  if (!sub)
+    return;
+
+  SubjectDataPort *sport = dynamic_cast<SubjectDataPort*>(sub);
+  if (sport)
+    {
+      emphasizePortLink(sport, true);
+      return;
+    }
+
+  // --- if a Node, explore all data ports
+
+  SubjectNode *snode = dynamic_cast<SubjectNode*>(sub);
+  if (snode)
+    {
+      DEBTRACE("Node : " << snode->getName());
+      {
+        list<SubjectInputPort*> linkList = snode->getSubjectInputPorts();
+        list<SubjectInputPort*>::const_iterator it = linkList.begin();
+        for( ; it != linkList.end(); ++it)
+          {
+            YACS::HMI::SubjectInputPort* sub = (*it);
+            if (!sub) continue;
+            emphasizePortLink(sub, true);
+          }
+      }
+      {
+        list<SubjectOutputPort*> linkList = snode->getSubjectOutputPorts();
+        list<SubjectOutputPort*>::const_iterator it = linkList.begin();
+        for( ; it != linkList.end(); ++it)
+          {
+            YACS::HMI::SubjectOutputPort* sub = (*it);
+            if (!sub) continue;
+            emphasizePortLink(sub, true);
+          }
+      }
+      return;
+    }
+}
+
+void GenericGui::onShowOnlyCtrlLinks()
+{
+  DEBTRACE("GenericGui::onShowOnlyCtrlLinks");
+  onHideAllLinks();
+  displayPortLinks(true);
+}
+
+void GenericGui::onShowCtrlLinks()
+{
+  DEBTRACE("GenericGui::onShowCtrlLinks");
+  displayPortLinks(true);
+}
+
+void GenericGui::onHideCtrlLinks()
+{
+  DEBTRACE("GenericGui::onHideCtrlLinks");
+  displayPortLinks(false);
+}
+
+void GenericGui::onEmphasisCtrlLinks()
+{
+  DEBTRACE("GenericGui::onEmphasisCtrlLinks");
+  Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
+  DEBTRACE("Emphasize Ctrl Links, subject : " << sub->getName());
+  if (!sub)
+    return;
+  SubjectNode *snode = dynamic_cast<SubjectNode*>(sub);
+  if (snode)
+    {
+      DEBTRACE("Node : " << snode->getName());
+      list<SubjectControlLink*> linkList = snode->getSubjectControlLinks();
+      list<SubjectControlLink*>::const_iterator it = linkList.begin();
+      for( ; it != linkList.end(); ++it)
+        {
+          YACS::HMI::SubjectControlLink* sub = (*it);
+          if (!sub) continue;
+          sub->update(EMPHASIZE, true, sub);
+          Subject *sin = sub->getSubjectInNode();
+          Subject *sout = sub->getSubjectOutNode();
+          sin->update(EMPHASIZE, true, sub);
+          sout->update(EMPHASIZE, true, sub);
+        }
+      return;
+    }
+}
+
+void GenericGui::onShowOnlyLink()
+{
+  DEBTRACE("GenericGui::onShowOnlyLink");
+  onHideAllLinks();
+  displayALink(true);
+}
+
+void GenericGui::onShowLink()
+{
+  DEBTRACE("GenericGui::onShowLink");
+  displayALink(true);
+}
+
+void GenericGui::onHideLink()
+{
+  DEBTRACE("GenericGui::onHideLink");
+  displayALink(false);
+}
+
+void GenericGui::onEmphasisLink()
+{
+  DEBTRACE("GenericGui::onEmphasisLink");
+  Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
+  if (!sub)
+    return;
+  sub->update(EMPHASIZE, true, sub);
+}
+
+void GenericGui::onDeEmphasizeAll()
+{
+  DEBTRACE("GenericGui::onDeEmphasizeAll");
+  map<Subject*, SchemaItem*>::const_iterator it = QtGuiContext::getQtCurrent()->_mapOfSchemaItem.begin();
+  for( ; it != QtGuiContext::getQtCurrent()->_mapOfSchemaItem.end(); ++it)
+    {
+      Subject* sub = (*it).first;
+      sub->update(EMPHASIZE, false, sub);
+    }
+}
+
+void GenericGui::onUndo()
+{
+  DEBTRACE("GenericGui::onUndo");
+  if (QtGuiContext::getQtCurrent()->_setOfModifiedSubjects.empty())
+    QtGuiContext::getQtCurrent()->getInvoc()->undo();
+  else Message("undo not possible when there are local modifications not confirmed");
+}
+
+void GenericGui::onRedo()
+{
+  DEBTRACE("GenericGui::onRedo");
+  if (QtGuiContext::getQtCurrent()->_setOfModifiedSubjects.empty())
+    QtGuiContext::getQtCurrent()->getInvoc()->redo();
+  else Message("redo not possible when there are local modifications not confirmed");
+}
+
+void GenericGui::onShowUndo()
+{
+  _guiEditor->showUndo(_parent);
+}
+
+void GenericGui::onShowRedo()
+{
+  _guiEditor->showRedo(_parent);
+}
+
 void GenericGui::onCleanOnExit()
 {
   DEBTRACE("GenericGui::onCleanOnExit");
   int studyId = _wrapper->activeStudyId();
-  set<QtGuiContext*> setcpy = QtGuiContext::_setOfContext;
-  set<QtGuiContext*>::iterator it = setcpy.begin();
-  for ( ; it != setcpy.end(); ++it)
-    if ((*it)->getStudyId() == studyId)
-      {
-        QtGuiContext::setQtCurrent(*it);
-        delete(*it);
-      }
+  map<QWidget*, YACS::HMI::QtGuiContext*> mapViewContextCopy = _mapViewContext;
+  map<QWidget*, YACS::HMI::QtGuiContext*>::iterator it = mapViewContextCopy.begin();
+  for (; it != mapViewContextCopy.end(); ++it)
+    {
+      closeContext((*it).first, true);
+    }
+}
+
+void GenericGui::emphasizePortLink(YACS::HMI::SubjectDataPort* sub, bool emphasize)
+{
+  DEBTRACE("dataPort : " << sub->getName());
+  list<SubjectLink*> linkList = sub->getListOfSubjectLink();
+  list<SubjectLink*>::const_iterator it = linkList.begin();
+  for( ; it != linkList.end(); ++it)
+    {
+      YACS::HMI::SubjectLink* subli = (*it);
+      if (!subli) continue;
+      subli->update(EMPHASIZE, emphasize, sub);
+      Subject *sin = subli->getSubjectInPort();
+      Subject *sout = subli->getSubjectOutPort();
+      sin->update(EMPHASIZE, emphasize, sub);
+      sout->update(EMPHASIZE, emphasize, sub);
+    }
+}
+
+void GenericGui::onHelpContextModule( const QString& theComponentName, const QString& theFileName, const QString& theContext)
+{
+  _wrapper->onHelpContextModule(theComponentName,theFileName,theContext);
 }