Salome HOME
updated copyright message
[modules/shaper.git] / src / SHAPERGUI / SHAPERGUI.cpp
index 8577d8da136970b014b0e89103155d4cb52cc702..475b4933d71e1b9e4831a01199ad435ef3ce7780 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 #include <QtxActionMenuMgr.h>
 #include <QtxActionToolMgr.h>
 #include <QtxResourceMgr.h>
+#include <QtxInfoPanel.h>
 
 #include <Config_PropManager.h>
 #include <Config_ModuleReader.h>
 
 #include <AIS_ListOfInteractive.hxx>
 #include <AIS_ListIteratorOfListOfInteractive.hxx>
+#include <Standard_Version.hxx>
 
 #include <QDockWidget>
 #include <QAction>
 #include <QMenu>
 #include <QToolBar>
 
-#define SALOME_PATCH_FOR_CTRL_WHEEL
+#include <ModelAPI_Session.h>
+#include <Events_MessageBool.h>
+
+#if OCC_VERSION_HEX < 0x070400
+  #define SALOME_PATCH_FOR_CTRL_WHEEL
+#endif
 
 extern "C" {
 SHAPERGUI_EXPORT CAM_Module* createModule()
@@ -134,7 +141,8 @@ private:
 SHAPERGUI::SHAPERGUI()
     : LightApp_Module("SHAPER"),
       mySelector(0), myIsOpened(0), myPopupMgr(0), myIsInspectionVisible(false),
-  myInspectionPanel(0), myIsToolbarsModified(false)
+  myInspectionPanel(0), myIsFacesPanelVisible(false), myIsToolbarsModified(false),
+  myAxisArrowRate(-1)
 {
   myWorkshop = new XGUI_Workshop(this);
   connect(myWorkshop, SIGNAL(commandStatusUpdated()),
@@ -168,7 +176,6 @@ void SHAPERGUI::initialize(CAM_Application* theApp)
   }
 
   int aMenu = createMenu(tr("Inspection"), -1, -1, 30);
-  int aSubMenu = createMenu(tr("Information"), aMenu, -1, -1, 0);
 
   int aId = getNextCommandId();
   myActionsList.append(aId);
@@ -178,21 +185,37 @@ void SHAPERGUI::initialize(CAM_Application* theApp)
     aTip, QKeySequence(), aDesk, true, this, SLOT(onWhatIs(bool)));
   myWhatIsAction->setStatusTip(aTip);
   myWhatIsAction->setData("INSPECTION_CMD");
-  createMenu(aId, aSubMenu, 0);
+  createMenu(aId, aMenu, 0);
 
   QString aToolName = tr("Inspection");
   int aTool = createTool(aToolName);
-  int aToolId = createTool(myWhatIsAction, aTool);
+#ifdef _DEBUG
+  int aToolId =
+#endif
+    createTool(myWhatIsAction, aTool);
   registerCommandToolbar(aToolName, aId);
 
   // Define Edit toolbars command
   aId = getNextCommandId();
   //myActionsList.append(aId); Do not use it for editing of toolbars
   aTip = tr("Edit toolbars of the module");
-  QAction* aAction = createAction(aId, aTip, QIcon(":pictures/configure_toolbars.png"),
+#ifdef _DEBUG
+  QAction* aAction =
+#endif
+    createAction(aId, aTip, QIcon(":pictures/configure_toolbars.png"),
     tr("Edit toolbars..."), aTip, QKeySequence(), aDesk, false, this, SLOT(onEditToolbars()));
   int aEditMenu = createMenu(tr("MEN_DESK_EDIT"), -1, -1, 30);
-  int aEditItem = createMenu(aId, aEditMenu);
+#ifdef _DEBUG
+  int aEditItem =
+#endif
+    createMenu(aId, aEditMenu);
+
+  if (!myInspectionPanel) {
+    myInspectionPanel = myWorkshop->inspectionPanel();
+    connect(myInspectionPanel->toggleViewAction(), SIGNAL(toggled(bool)),
+      this, SLOT(onWhatIs(bool)));
+  }
+  hideInternalWindows();
 
   // Initialize viewer proxy if OCC viewer is already exist
   ViewManagerList aOCCViewManagers;
@@ -213,12 +236,15 @@ void SHAPERGUI::initialize(CAM_Application* theApp)
       }
     }
   }
+  SHAPERGUI_DataModel* aDataModel = dynamic_cast<SHAPERGUI_DataModel*>(dataModel());
+  aDataModel->initRootObject();
 }
 
 //******************************************************
 void SHAPERGUI::windows(QMap<int, int>& theWndMap) const
 {
   theWndMap.insert(LightApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea);
+  theWndMap.insert(LightApp_Application::WT_InfoPanel, Qt::RightDockWidgetArea);
 }
 
 //******************************************************
@@ -254,12 +280,17 @@ void SHAPERGUI::viewManagers(QStringList& theList) const
 //******************************************************
 bool SHAPERGUI::activateModule(SUIT_Study* theStudy)
 {
-  bool isDone = LightApp_Module::activateModule(theStudy);
-  loadToolbarsConfig();
+  ModelAPI_Session::get()->moduleDocument(); // initialize a root document if not done yet
 
+  // this must be done in the initialization and in activation (on the second activation
+  // initialization in not called, so SComponent must be added anyway
   SHAPERGUI_DataModel* aDataModel = dynamic_cast<SHAPERGUI_DataModel*>(dataModel());
   aDataModel->initRootObject();
 
+
+  bool isDone = LightApp_Module::activateModule(theStudy);
+  loadToolbarsConfig();
+
   if (isDone) {
     setMenuShown(true);
     setToolShown(true);
@@ -267,19 +298,18 @@ bool SHAPERGUI::activateModule(SUIT_Study* theStudy)
     QObject* aObj = myWorkshop->objectBrowser()->parent();
     QDockWidget* aObjDoc = dynamic_cast<QDockWidget*>(aObj);
     if (aObjDoc) {
-      QAction* aViewAct = aObjDoc->toggleViewAction();
-      aViewAct->setEnabled(true);
       myWorkshop->objectBrowser()->setVisible(true);
       aObjDoc->setVisible(true);
       desktop()->tabifyDockWidget(aObjDoc, myWorkshop->propertyPanel());
+      aObjDoc->toggleViewAction()->setVisible(true);
     }
 
-    if (!myInspectionPanel) {
-      myInspectionPanel = myWorkshop->inspectionPanel();
-      QAction* aViewAct = myInspectionPanel->toggleViewAction();
-      connect(aViewAct, SIGNAL(toggled(bool)), this, SLOT(onWhatIs(bool)));
-    }
-    myInspectionPanel->toggleViewAction()->setEnabled(true);
+    myInspectionPanel->toggleViewAction()->setVisible(true);
+
+    myWorkshop->facesPanel()->toggleViewAction()->setVisible(true);
+    if (myIsFacesPanelVisible)
+      myWorkshop->facesPanel()->show();
+    myWorkshop->propertyPanel()->toggleViewAction()->setVisible(true);
 
     if (!mySelector) {
       ViewManagerList OCCViewManagers;
@@ -300,19 +330,9 @@ bool SHAPERGUI::activateModule(SUIT_Study* theStudy)
     else
       myWorkshop->updateCommandStatus();
   }
-  SUIT_ResourceMgr* aResMgr = application()->resourceMgr();
-  myIsStorePositions = aResMgr->booleanValue("Study", "store_positions", true);
   myIsEditEnabled = getApp()->isEditEnabled();
   getApp()->setEditEnabled(false);
 
-  // this following row is caused by #187 bug.
-  // SALOME saves the dock widget positions before deactivateModule() and
-  // load it after the module activation. So, if the panel is visible before
-  // deactivate, it becomes visible after activate.
-  // In order to avoid the visible property panel, the widget position save is
-  // switch off in this module
-  aResMgr->setValue("Study", "store_positions", false);
-
   // Synchronize displayed objects
   Handle(AIS_InteractiveContext) aContext;
   if (mySelector && mySelector->viewer())
@@ -322,11 +342,6 @@ bool SHAPERGUI::activateModule(SUIT_Study* theStudy)
     XGUI_Displayer* aDisp = myWorkshop->displayer();
     QObjectPtrList aObjList = aDisp->displayedObjects();
 
-    //if (myHighlightPointAspect.IsNull()) {
-    //  Handle(AIS_Trihedron) aTrihedron = mySelector->viewer()->getTrihedron();
-    //  myHighlightPointAspect =
-    //    new Graphic3d_AspectMarker3d(aTrihedron->getHighlightPointAspect()->Aspect().operator*());
-    //}
     if (myOldSelectionColor.size() == 0)
       myOldSelectionColor = aDisp->selectionColor();
 
@@ -367,34 +382,48 @@ bool SHAPERGUI::activateModule(SUIT_Study* theStudy)
           this, SLOT(onSaveDocByShaper()));
   connect(getApp()->action(LightApp_Application::FileSaveAsId), SIGNAL(triggered(bool)),
           this, SLOT(onSaveAsDocByShaper()));
-
+  updateInfoPanel();
   return isDone;
 }
 
 //******************************************************
-bool SHAPERGUI::deactivateModule(SUIT_Study* theStudy)
+void SHAPERGUI::hideInternalWindows()
 {
-  saveToolbarsConfig();
-
   myProxyViewer->activateViewer(false);
   setMenuShown(false);
   setToolShown(false);
 
-  myWorkshop->deactivateModule();
-
   QObject* aObj = myWorkshop->objectBrowser()->parent();
   QDockWidget* aObjDoc = dynamic_cast<QDockWidget*>(aObj);
   if (aObjDoc) {
     aObjDoc->setVisible(false);
     myWorkshop->objectBrowser()->setVisible(false);
-    QAction* aViewAct = aObjDoc->toggleViewAction();
-    aViewAct->setEnabled(false);
+    aObjDoc->toggleViewAction()->setVisible(false);
   }
 
-  myIsInspectionVisible = myInspectionPanel->isVisible();
   myInspectionPanel->hide();
-  QAction* aViewAct = myInspectionPanel->toggleViewAction();
-  aViewAct->setEnabled(false);
+  myInspectionPanel->toggleViewAction()->setVisible(false);
+
+  myWorkshop->facesPanel()->hide();
+  myWorkshop->facesPanel()->toggleViewAction()->setVisible(false);
+
+  myWorkshop->propertyPanel()->hide();
+  myWorkshop->propertyPanel()->toggleViewAction()->setVisible(false);
+
+  myWorkshop->hidePanel(myWorkshop->facesPanel());
+}
+
+
+//******************************************************
+bool SHAPERGUI::deactivateModule(SUIT_Study* theStudy)
+{
+  saveToolbarsConfig();
+  myWorkshop->deactivateModule();
+
+  myIsInspectionVisible = myInspectionPanel->isVisible();
+  myIsFacesPanelVisible = myWorkshop->facesPanel()->isVisible();
+  hideInternalWindows();
+
 
   // the active operation should be stopped for the next activation.
   // There should not be active operation and visualized preview.
@@ -408,22 +437,30 @@ bool SHAPERGUI::deactivateModule(SUIT_Study* theStudy)
   }
   // Delete selector because it has to be redefined on next activation
   if (mySelector) {
-    //if (!myHighlightPointAspect.IsNull()) {
-    //  Handle(AIS_Trihedron) aTrihedron = mySelector->viewer()->getTrihedron();
-    //  aTrihedron->getHighlightPointAspect()->SetAspect(myHighlightPointAspect);
-    //  myHighlightPointAspect.Nullify();
-    //}
+    // Restore size of arrows of trihedron
+    if (myAxisArrowRate > 0) {
+      Handle(AIS_Trihedron) aTrihedron = mySelector->viewer()->getTrihedron();
+      Handle(Prs3d_DatumAspect) aDatumAspect = aTrihedron->Attributes()->DatumAspect();
+      aDatumAspect->SetAttribute(Prs3d_DP_ShadingConeLengthPercent, myAxisArrowRate);
+      Handle(AIS_InteractiveContext) aContext = mySelector->viewer()->getAISContext();
+      aContext->Redisplay(aTrihedron, false);
+    }
     myWorkshop->displayer()->setSelectionColor(myOldSelectionColor);
     myProxyViewer->setSelector(0);
+
+    LightApp_SelectionMgr* aMgr = getApp()->selectionMgr();
+    QList<SUIT_Selector*> aList;
+    aMgr->selectors(aList);
+    foreach(SUIT_Selector* aSel, aList) {
+      aSel->setEnabled(aSel != mySelector);
+    }
+
     delete mySelector;
     mySelector = 0;
   }
 
-  myWorkshop->hidePanel(myWorkshop->facesPanel());
   //myWorkshop->contextMenuMgr()->disconnectViewer();
 
-  SUIT_ResourceMgr* aResMgr = application()->resourceMgr();
-  aResMgr->setValue("Study", "store_positions", myIsStorePositions);
   getApp()->setEditEnabled(myIsEditEnabled);
 
   myOldSelectionColor.clear();
@@ -442,6 +479,8 @@ bool SHAPERGUI::deactivateModule(SUIT_Study* theStudy)
   connect(getApp()->action(LightApp_Application::FileSaveAsId), SIGNAL(triggered(bool)),
           getApp(), SLOT(onSaveAsDoc()));
 
+  publishToStudy();
+
   return LightApp_Module::deactivateModule(theStudy);
 }
 
@@ -542,6 +581,11 @@ void SHAPERGUI::onSaveAsDocByShaper()
 void SHAPERGUI::onUpdateCommandStatus()
 {
   getApp()->updateActions();
+
+  LightApp_Application* aApp = dynamic_cast<LightApp_Application*>(application());
+  QtxInfoPanel* aInfoPanel = aApp->infoPanel();
+  if (aInfoPanel->isVisible())
+    updateInfoPanel();
 }
 
 //******************************************************
@@ -550,11 +594,11 @@ SHAPERGUI_OCCSelector* SHAPERGUI::createSelector(SUIT_ViewManager* theMgr)
   if (theMgr->getType() == OCCViewer_Viewer::Type()) {
     OCCViewer_Viewer* aViewer = static_cast<OCCViewer_Viewer*>(theMgr->getViewModel());
 
-    //if (myHighlightPointAspect.IsNull()) {
-    //  Handle(AIS_Trihedron) aTrihedron = aViewer->getTrihedron();
-    //  myHighlightPointAspect =
-    //    new Graphic3d_AspectMarker3d(aTrihedron->getHighlightPointAspect()->Aspect().operator*());
-    //}
+    // Remember current length of arrow of axis
+    Handle(AIS_Trihedron) aTrihedron = aViewer->getTrihedron();
+    Handle(Prs3d_DatumAspect) aDatumAspect = aTrihedron->Attributes()->DatumAspect();
+    myAxisArrowRate = aDatumAspect->Attribute(Prs3d_DP_ShadingConeLengthPercent);
+
     SHAPERGUI_OCCSelector* aSelector = new SHAPERGUI_OCCSelector(aViewer,
                                                                  getApp()->selectionMgr());
 #ifdef SALOME_PATCH_FOR_CTRL_WHEEL
@@ -574,6 +618,10 @@ SHAPERGUI_OCCSelector* SHAPERGUI::createSelector(SUIT_ViewManager* theMgr)
 
     std::vector<int> aColor = Config_PropManager::color("Visualization", "selection_color");
     myWorkshop->displayer()->setSelectionColor(aColor);
+
+    // Cause scaling of arrows of axis and dimensions
+    myWorkshop->module()->onViewTransformed();
+
     return aSelector;
   }
   return 0;
@@ -634,12 +682,23 @@ QAction* SHAPERGUI::addFeature(const QString& theWBName, const QString& theTBNam
   aAction->setData(theId);
 
   int aWBMenu = createMenu(theWBName, -1, -1, 30/*10-Window, 1000 - Help*/);
-  int aItemId = createMenu(aId, aWBMenu);
+
+  if( theId == "PointCoordinates" )
+    createMenu(separator(), aWBMenu);
+
+#ifdef _DEBUG
+  int aItemId =
+#endif
+    createMenu(aId, aWBMenu);
+
   if (isAddSeparator)
     createMenu(separator(), aWBMenu);
 
   int aWBTool = createTool(theTBName, theTBName);
-  int aToolId = createTool(aId, aWBTool);
+#ifdef _DEBUG
+  int aToolId =
+#endif
+    createTool(aId, aWBTool);
   registerCommandToolbar(theTBName, aId);
   if (isAddSeparator) {
     createTool(separator(), aWBTool);
@@ -676,7 +735,10 @@ QAction* SHAPERGUI::addFeatureOfNested(const QString& theWBName,
   createMenu(separator(), aWBMenu); /// nested action is always separated of others
 
   int aWBTool = createTool(theWBName, theWBName);
-  int aToolId = createTool(anAction, aWBTool);
+#ifdef _DEBUG
+  int aToolId =
+#endif
+    createTool(anAction, aWBTool);
   registerCommandToolbar(theWBName, aItemId);
   createTool(separator(), aWBTool); /// nested action is always separated of others
   registerCommandToolbar(theWBName, -1);
@@ -689,9 +751,14 @@ QAction* SHAPERGUI::addFeatureOfNested(const QString& theWBName,
 QAction* SHAPERGUI::addDesktopCommand(const QString& theId, const QString& theTitle,
                                            const QString& theTip, const QIcon& theIcon,
                                            const QKeySequence& theKeys, bool isCheckable,
-                                           const char* theMenuSourceText, const int theMenuPosition)
+                                           const char* theMenuSourceText,
+                                           const QString& theSubMenu,
+                                           const int theMenuPosition,
+                                           const int theSuibMenuPosition)
 {
   int aMenu = createMenu(tr(theMenuSourceText), -1, -1);
+  if (!theSubMenu.isNull())
+    aMenu = createMenu(theSubMenu, aMenu, -1, theSuibMenuPosition);
 
   int aId = getNextCommandId();
   myActionsList.append(aId);
@@ -784,88 +851,94 @@ void SHAPERGUI::contextMenuPopup(const QString& theClient, QMenu* theMenu, QStri
 //******************************************************
 void SHAPERGUI::createPreferences()
 {
-  LightApp_Preferences* pref = preferences();
-  if (!pref)
+  LightApp_Preferences* aPref = preferences();
+  if (!aPref)
     return;
   ModuleBase_Preferences::updateConfigByResources();
   QString aModName = moduleName();
 
-  QtxPreferenceItem* item = pref->findItem(aModName, true );
+  QtxPreferenceItem* item = aPref->findItem(aModName, true );
   if ( item && (!item->isEmpty() )) {
     item->parentItem()->removeItem(item);
     delete item;
   }
 
-  int catId = pref->addPreference(aModName, -1 );
+  int catId = aPref->addPreference(aModName, -1 );
   if ( catId == -1 )
     return;
-  SHAPERGUI_PrefMgr aMgr(pref, aModName);
+  SHAPERGUI_PrefMgr aMgr(aPref, aModName);
   ModuleBase_Preferences::createEditContent(&aMgr, catId);
 
-  int viewTab = pref->addItem(tr("Viewer"), catId);
+  int viewTab = aPref->addItem(tr("Viewer"), catId);
   // Create other parameters group in viewer tab
-  int otherGroup = pref->addItem(tr("Default selection"), viewTab);
-  pref->setItemProperty("columns", 3, otherGroup);
-  pref->addItem(tr("Faces"), otherGroup,
+  int otherGroup = aPref->addItem(tr("Default selection"), viewTab);
+  aPref->setItemProperty("columns", 3, otherGroup);
+  aPref->addItem(tr("Faces"), otherGroup,
                          SUIT_PreferenceMgr::Bool,
                          ModuleBase_Preferences::VIEWER_SECTION, "face-selection");
-  pref->addItem(tr("Edges"), otherGroup,
+  aPref->addItem(tr("Edges"), otherGroup,
                          SUIT_PreferenceMgr::Bool,
                          ModuleBase_Preferences::VIEWER_SECTION, "edge-selection");
-  pref->addItem(tr("Vertices"), otherGroup,
+  aPref->addItem(tr("Vertices"), otherGroup,
                          SUIT_PreferenceMgr::Bool,
                          ModuleBase_Preferences::VIEWER_SECTION, "vertex-selection");
 
-  int sensitivityGroup = pref->addItem(tr("Selection sensitivity"), viewTab);
-  pref->setItemProperty("columns", 2, sensitivityGroup);
-  pref->addItem(tr("Vertex"), sensitivityGroup, SUIT_PreferenceMgr::DblSpin,
+  int sensitivityGroup = aPref->addItem(tr("Selection sensitivity"), viewTab);
+  aPref->setItemProperty("columns", 2, sensitivityGroup);
+  aPref->addItem(tr("Vertex"), sensitivityGroup, SUIT_PreferenceMgr::DblSpin,
                 ModuleBase_Preferences::VIEWER_SECTION, "point-selection-sensitivity");
-  pref->addItem(tr("Edge"), sensitivityGroup, SUIT_PreferenceMgr::DblSpin,
+  aPref->addItem(tr("Edge"), sensitivityGroup, SUIT_PreferenceMgr::DblSpin,
                 ModuleBase_Preferences::VIEWER_SECTION, "edge-selection-sensitivity");
 
-  int highlightGroup = pref->addItem(tr("Additional highlighting"), viewTab);
-  pref->setItemProperty("columns", 2, highlightGroup);
-  pref->addItem(tr("In 3d mode"), highlightGroup,
+  int highlightGroup = aPref->addItem(tr("Additional highlighting"), viewTab);
+  aPref->setItemProperty("columns", 2, highlightGroup);
+  aPref->addItem(tr("In 3d mode"), highlightGroup,
     SUIT_PreferenceMgr::Bool, ModuleBase_Preferences::VIEWER_SECTION, "highlighting-3d");
-  pref->addItem(tr("In 2d mode"), highlightGroup,
+  aPref->addItem(tr("In 2d mode"), highlightGroup,
     SUIT_PreferenceMgr::Bool, ModuleBase_Preferences::VIEWER_SECTION, "highlighting-2d");
 
-  int colorScaleGroup = pref->addItem(tr("Color scale"), viewTab);
-  pref->setItemProperty("columns", 4, colorScaleGroup);
+  int colorScaleGroup = aPref->addItem(tr("Color scale"), viewTab);
+  aPref->setItemProperty("columns", 4, colorScaleGroup);
   int aItem = aMgr.addPreference(tr("X position"), colorScaleGroup,
     SUIT_PreferenceMgr::Double, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_x_position");
-  pref->setItemProperty("min", 0, aItem);
-  pref->setItemProperty("max", 1, aItem);
-
+  aPref->setItemProperty("min", 0, aItem);
+  aPref->setItemProperty("max", 1, aItem);
   aItem = aMgr.addPreference(tr("Y position"), colorScaleGroup,
     SUIT_PreferenceMgr::Double, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_y_position");
-  pref->setItemProperty("min", 0, aItem);
-  pref->setItemProperty("max", 1, aItem);
-
+  aPref->setItemProperty("min", 0, aItem);
+  aPref->setItemProperty("max", 1, aItem);
   aItem = aMgr.addPreference(tr("Width"), colorScaleGroup,
     SUIT_PreferenceMgr::Double, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_width");
-  pref->setItemProperty("min", 0, aItem);
-  pref->setItemProperty("max", 1, aItem);
-
+  aPref->setItemProperty("min", 0, aItem);
+  aPref->setItemProperty("max", 1, aItem);
   aItem = aMgr.addPreference(tr("Height"), colorScaleGroup,
     SUIT_PreferenceMgr::Double, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_height");
-  pref->setItemProperty("min", 0, aItem);
-  pref->setItemProperty("max", 1, aItem);
-
+  aPref->setItemProperty("min", 0, aItem);
+  aPref->setItemProperty("max", 1, aItem);
   aItem = aMgr.addPreference(tr("Intervals number"), colorScaleGroup,
     SUIT_PreferenceMgr::Integer, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_nb_intervals");
-  pref->setItemProperty("min", 0, aItem);
-  pref->setItemProperty("max", 100, aItem);
-
+  aPref->setItemProperty("min", 0, aItem);
+  aPref->setItemProperty("max", 100, aItem);
   aItem = aMgr.addPreference(tr("Text height"), colorScaleGroup,
     SUIT_PreferenceMgr::Integer, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_text_height");
-  pref->setItemProperty("min", 0, aItem);
-  pref->setItemProperty("max", 100, aItem);
-
+  aPref->setItemProperty("min", 0, aItem);
+  aPref->setItemProperty("max", 100, aItem);
   aItem = aMgr.addPreference(tr("Text color"), colorScaleGroup,
     SUIT_PreferenceMgr::Color, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_text_color");
 
-  pref->retrieve();
+  int aGroupNamesGroup = aMgr.addPreference(tr("Group names display"), viewTab,
+    SUIT_PreferenceMgr::GroupBox , ModuleBase_Preferences::VIEWER_SECTION, "group_names_display");
+  aPref->setItemProperty("columns", 3, aGroupNamesGroup);
+  aMgr.addPreference(tr("Text font"), aGroupNamesGroup,
+    SUIT_PreferenceMgr::String, ModuleBase_Preferences::VIEWER_SECTION, "group_names_font");
+  aItem = aMgr.addPreference(tr("Text size"), aGroupNamesGroup,
+    SUIT_PreferenceMgr::Integer, ModuleBase_Preferences::VIEWER_SECTION, "group_names_size");
+  aPref->setItemProperty("min", 8, aItem);
+  aPref->setItemProperty("max", 100, aItem);
+  aItem = aMgr.addPreference(tr("Text color"), aGroupNamesGroup,
+    SUIT_PreferenceMgr::Color, ModuleBase_Preferences::VIEWER_SECTION, "group_names_color");
+
+  aPref->retrieve();
 }
 
 //******************************************************
@@ -875,22 +948,65 @@ void SHAPERGUI::preferencesChanged(const QString& theSection, const QString& the
   QString aVal = aResMgr->stringValue(theSection, theParam);
   Config_Prop* aProp = Config_PropManager::findProp(theSection.toStdString(),
                                                     theParam.toStdString());
+  if (!aProp)
+    return; // invalid case, the property default value must be registered in XML file
   std::string aValue = aVal.toStdString();
   if (aValue.empty()) {
     aValue = aProp->defaultValue();
     aResMgr->setValue(theSection, theParam, QString(aValue.c_str()));
 
-    LightApp_Preferences* pref = preferences();
-    if (pref)
-      pref->retrieve();
+    LightApp_Preferences* aPref = preferences();
+    if (aPref)
+      aPref->retrieve();
   }
   aProp->setValue(aValue);
 
-  if ((theSection == "Visualization") && (theParam == "selection_color")) {
-    std::vector<int> aColor = Config_PropManager::color("Visualization", "selection_color");
-    myWorkshop->displayer()->setSelectionColor(aColor);
-  }
+  if (theSection == "Visualization") {
+    if (theParam == "selection_color") {
+      std::vector<int> aColor = Config_PropManager::color("Visualization", "selection_color");
+      myWorkshop->displayer()->setSelectionColor(aColor);
+    }
+    if ((theParam == "zoom_trihedron_arrows") || (theParam == "axis_arrow_size")) {
+      if (mySelector) {
+        Handle(AIS_Trihedron) aTrihedron = mySelector->viewer()->getTrihedron();
+        if (!aTrihedron.IsNull()) {
+          bool aZoom = Config_PropManager::boolean("Visualization", "zoom_trihedron_arrows");
+          Handle(AIS_InteractiveContext) aContext = mySelector->viewer()->getAISContext();
+
+          ModuleBase_IViewer* aViewer = myWorkshop->viewer();
+          Handle(V3d_View) aView = aViewer->activeView();
+          if (aZoom) {
+            double aAxLen =
+              aView->Convert(Config_PropManager::integer("Visualization", "axis_arrow_size"));
+            Handle(Prs3d_DatumAspect) aDatumAspect = aTrihedron->Attributes()->DatumAspect();
+            double aAxisLen = aDatumAspect->AxisLength(Prs3d_DP_XAxis);
+            myAxisArrowRate = aDatumAspect->Attribute(Prs3d_DP_ShadingConeLengthPercent);
+            aDatumAspect->SetAttribute(Prs3d_DP_ShadingConeLengthPercent, aAxLen / aAxisLen);
+            aTrihedron->Attributes()->SetDatumAspect(aDatumAspect);
+            aContext->Redisplay(aTrihedron, true);
 
+          }
+          else if (myAxisArrowRate > 0) {
+            Handle(Prs3d_DatumAspect) aDatumAspect = aTrihedron->Attributes()->DatumAspect();
+            aDatumAspect->SetAttribute(Prs3d_DP_ShadingConeLengthPercent, myAxisArrowRate);
+            aContext->Redisplay(aTrihedron, true);
+          }
+        }
+      }
+    }
+  }
+  else if (theSection == ModuleBase_Preferences::GENERAL_SECTION && theParam == "create_init_part") {
+    bool aCreate = ModuleBase_Preferences::resourceMgr()->booleanValue(
+      ModuleBase_Preferences::GENERAL_SECTION, "create_init_part", true);
+    Events_MessageBool aCreateMsg(Events_Loop::eventByName(EVENT_CREATE_PART_ON_START), aCreate);
+    aCreateMsg.send();
+  }
+  else if (theSection == ModuleBase_Preferences::VIEWER_SECTION &&
+           theParam.startsWith("group_names_"))
+  { // one of the group names parameter changed, so, update the groups names vizualization
+    myWorkshop->updateGroupsText();
+    myWorkshop->displayer()->updateViewer();
+  }
   myWorkshop->displayer()->redisplayObjects();
 }
 
@@ -930,6 +1046,16 @@ void SHAPERGUI::updateModuleVisibilityState()
 {
   LightApp_Module::updateModuleVisibilityState();
   onWhatIs(myIsInspectionVisible);
+
+  // the following code is caused by #187 bug.
+  // SALOME saves the dock widget positions before deactivateModule() and
+  // load it after the module activation. So, if the panel is visible before
+  // deactivate, it becomes visible after activate.
+  // In order to avoid the visible property panel, we hide it here
+  ModuleBase_Operation* anOperation = myWorkshop->module()->currentOperation();
+  if (!anOperation) {
+    myWorkshop->hidePanel(myWorkshop->propertyPanel());
+  }
 }
 
 void SHAPERGUI::onEditToolbars()
@@ -1029,7 +1155,10 @@ void SHAPERGUI::saveToolbarsConfig()
     return;
   // Save toolbars configuration into map
   QMap<QString, QStringList> aToolbarsConfig;
-  QtxActionToolMgr* aMgr = toolMgr();
+#ifdef _DEBUG
+  QtxActionToolMgr* aMgr =
+#endif
+    toolMgr();
   QStringList aToolbars = myToolbars.keys();
   QIntList aActionsIds;
   foreach(QString aName, aToolbars) {
@@ -1176,3 +1305,102 @@ void SHAPERGUI::resetToolbars()
   SUIT_ResourceMgr* aResMgr = application()->resourceMgr();
   aResMgr->remove(ToolbarsSection);
 }
+
+void SHAPERGUI::publishToStudy()
+{
+  if (isActiveModule() && ModelAPI_Session::get()->hasModuleDocument()) {
+    myWorkshop->module()->launchOperation("PublishToStudy", false);
+
+    // update SHAPERSTUDY objects in OCC and VTK viewers
+    QStringList aVMList;
+    aVMList << "OCCViewer" << "VTKViewer";
+    getApp()->updatePresentations("SHAPERSTUDY", aVMList);
+  }
+}
+
+void SHAPERGUI::fillPartSetInfoPanel(QtxInfoPanel* theInfoPanel)
+{
+  QIntList aShaperActions = shaperActions();
+  theInfoPanel->addLabel(tr("Current mode: Part set mode"));
+
+  addActionsToInfoGroup(theInfoPanel, tr("Parts management"),
+    { "Part", "Duplicate", "Remove" });
+  addActionsToInfoGroup(theInfoPanel, tr("Import operations"),
+    { "OPEN_CMD", "IMPORT_PART_CMD", "IMPORT_SHAPE_CMD" });
+  addActionsToInfoGroup(theInfoPanel, tr("Export operations"),
+    { "SAVEAS_CMD", "EXPORT_PART_CMD", "EXPORT_SHAPE_CMD" });
+  addActionsToInfoGroup(theInfoPanel, tr("Arrangement of parts"),
+    { "Placement", "Translation", "Rotation" });
+}
+
+void SHAPERGUI::fillPartInfoPanel(QtxInfoPanel* theInfoPanel)
+{
+  QIntList aShaperActions = shaperActions();
+  theInfoPanel->addLabel(tr("Current mode: Part mode"));
+
+  addActionsToInfoGroup(theInfoPanel, tr("Primitives"),
+    { "Box", "Cylinder", "Sphere" });
+  addActionsToInfoGroup(theInfoPanel, tr("Geometry"),
+    { "Vertex", "Edge", "Wire", "Face" });
+  addActionsToInfoGroup(theInfoPanel, tr("Features"),
+    { "Extrusion", "Revolution", "Cut", "Fuse", "Fillet" });
+}
+
+void SHAPERGUI::fillSketcherInfoPanel(QtxInfoPanel* theInfoPanel)
+{
+  QIntList aShaperActions = shaperActions();
+  theInfoPanel->addLabel(tr("Current mode: Sketcher mode"));
+
+  addActionsToInfoGroup(theInfoPanel, tr("Primitives"),
+    { "SketchPoint", "SketchLine", "SketchCircle", "SketchRectangle" });
+  addActionsToInfoGroup(theInfoPanel, tr("Dimensions"),
+    { "SketchConstraintLength", "SketchConstraintRadius", "SketchConstraintAngle" });
+  addActionsToInfoGroup(theInfoPanel, tr("Constraints"),
+    { "SketchConstraintParallel", "SketchConstraintPerpendicular",
+    "SketchConstraintEqual", "SketchConstraintCoincidence" });
+}
+
+void SHAPERGUI::addActionsToInfoGroup(QtxInfoPanel* theInfoPanel,
+  const QString& theGroup, const QSet<QString>& theActions)
+{
+  QIntList aShaperActions = shaperActions();
+
+  int aGroup = theInfoPanel->addGroup(theGroup);
+  int aCount = 0;
+  foreach(int aCmd, aShaperActions) {
+    QAction* aAction = action(aCmd);
+    if (theActions.contains(aAction->data().toString()))
+    {
+      theInfoPanel->addAction(aAction, aGroup);
+      aCount++;
+    }
+    if (aCount >= theActions.size())
+      break;
+  }
+}
+
+void SHAPERGUI::updateInfoPanel()
+{
+  LightApp_Application* aApp = dynamic_cast<LightApp_Application*>(application());
+  QtxInfoPanel* aInfoPanel = aApp->infoPanel();
+  aInfoPanel->clear();
+  aInfoPanel->setTitle(tr("Welcome to SHAPER"));
+
+  SessionPtr aMgr = ModelAPI_Session::get();
+  QList<DocumentPtr> aDocs;
+  DocumentPtr aActiveDoc = aMgr->activeDocument();
+  DocumentPtr aModuleDoc = aMgr->moduleDocument();
+
+  XGUI_OperationMgr* aOpMgr = myWorkshop->operationMgr();
+  QStringList aOpList = aOpMgr->operationList();
+  bool isSketcher = false;
+  if (aOpList.size() > 0)
+    isSketcher = (aOpList.first() == "Sketch");
+
+  if (isSketcher) // Sketcher mode
+    fillSketcherInfoPanel(aInfoPanel);
+  else if (aActiveDoc == aModuleDoc) // Part set mode
+    fillPartSetInfoPanel(aInfoPanel);
+  else
+    fillPartInfoPanel(aInfoPanel);
+}