Salome HOME
Issue #3233:Resize thrihedron arrows on zooming to avoid "big arrows".
[modules/shaper.git] / src / SHAPERGUI / SHAPERGUI.cpp
1 // Copyright (C) 2014-2019  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #include "SHAPERGUI.h"
21 #include "SHAPERGUI_DataModel.h"
22 #include "SHAPERGUI_OCCSelector.h"
23 #include "SHAPERGUI_NestedButton.h"
24 #include "SHAPERGUI_ToolbarsMgr.h"
25
26 #include <XGUI_Workshop.h>
27 #include <XGUI_PropertyPanel.h>
28 #include <XGUI_ContextMenuMgr.h>
29 #include <XGUI_ObjectsBrowser.h>
30 #include <XGUI_OperationMgr.h>
31 #include <XGUI_Displayer.h>
32 #include <XGUI_MenuMgr.h>
33 #include <XGUI_FacesPanel.h>
34 #include <XGUI_SelectionActivate.h>
35 #include <XGUI_InspectionPanel.h>
36 #include <XGUI_ViewerProxy.h>
37
38 #include <ModuleBase_Operation.h>
39 #include <ModuleBase_Preferences.h>
40 #include <ModuleBase_ActionInfo.h>
41 #include <ModuleBase_IModule.h>
42
43 #include <ModelAPI_Tools.h>
44
45 #include <LightApp_Application.h>
46 #include <LightApp_SelectionMgr.h>
47 #include <LightApp_OCCSelector.h>
48 #include <LightApp_Study.h>
49
50 #include <OCCViewer_ViewModel.h>
51 #include <OCCViewer_ViewPort3d.h>
52
53 #include <SUIT_Selector.h>
54 #include <SUIT_Desktop.h>
55 #include <SUIT_ViewManager.h>
56 #include <SUIT_ViewWindow.h>
57 #include <SUIT_ResourceMgr.h>
58 #include <SUIT_DataBrowser.h>
59
60 #include <QtxPopupMgr.h>
61 #include <QtxActionMenuMgr.h>
62 #include <QtxActionToolMgr.h>
63 #include <QtxResourceMgr.h>
64
65 #include <Config_PropManager.h>
66 #include <Config_ModuleReader.h>
67
68 #include <AIS_ListOfInteractive.hxx>
69 #include <AIS_ListIteratorOfListOfInteractive.hxx>
70
71 #include <QDockWidget>
72 #include <QAction>
73 #include <QTimer>
74 #include <QMenu>
75 #include <QToolBar>
76
77 #if OCC_VERSION_HEX < 0x070400
78   #define SALOME_PATCH_FOR_CTRL_WHEEL
79 #endif
80
81 extern "C" {
82 SHAPERGUI_EXPORT CAM_Module* createModule()
83 {
84   return new SHAPERGUI();
85 }
86
87 SHAPERGUI_EXPORT char* getModuleVersion()
88 {
89   return (char*)"0.0";
90 }
91 } // extern "C"
92
93
94 static const QString ToolbarsSection("SHAPER_Toolbars");
95 static const QString FreeCommandsParam("OutOFToolbars");
96
97
98 /** 
99 * Class for preferences management
100 */
101 class SHAPERGUI_PrefMgr: public ModuleBase_IPrefMgr
102 {
103 public:
104   /// Constructor
105   /// \param theMgr preferences manager of SALOME
106   /// \param theModName name of the module
107   SHAPERGUI_PrefMgr(LightApp_Preferences* theMgr, const QString& theModName):
108     myMgr(theMgr), myModName(theModName) {}
109
110   virtual int addPreference(const QString& theLbl, int pId,
111                             SUIT_PreferenceMgr::PrefItemType theType,
112                             const QString& theSection, const QString& theName )
113   {
114     return myMgr->addPreference(myModName, theLbl, pId, theType, theSection, theName);
115   }
116
117   virtual void setItemProperty(const QString& thePropName,
118                                const QVariant& theValue,
119                                const int theId = -1)
120   {
121     myMgr->setItemProperty(thePropName, theValue, theId);
122   }
123
124
125   virtual SUIT_PreferenceMgr* prefMgr() const { return myMgr; }
126
127 private:
128   LightApp_Preferences* myMgr;
129   QString myModName;
130 };
131
132
133
134
135 //******************************************************
136 SHAPERGUI::SHAPERGUI()
137     : LightApp_Module("SHAPER"),
138       mySelector(0), myIsOpened(0), myPopupMgr(0), myIsInspectionVisible(false),
139   myInspectionPanel(0), myIsFacesPanelVisible(false), myIsToolbarsModified(false),
140   myAxisArrowRate(-1)
141 {
142   myWorkshop = new XGUI_Workshop(this);
143   connect(myWorkshop, SIGNAL(commandStatusUpdated()),
144           this, SLOT(onUpdateCommandStatus()));
145
146   myProxyViewer = new SHAPERGUI_SalomeViewer(this);
147
148   ModuleBase_Preferences::setResourceMgr(application()->resourceMgr());
149
150   // It will be called in XGUI_Workshop::startApplication
151   // ModuleBase_Preferences::loadCustomProps();
152 }
153
154 //******************************************************
155 SHAPERGUI::~SHAPERGUI()
156 {
157   delete myWorkshop;
158   delete myProxyViewer;
159 }
160
161 //******************************************************
162 void SHAPERGUI::initialize(CAM_Application* theApp)
163 {
164   LightApp_Module::initialize(theApp);
165
166   myWorkshop->startApplication();
167   LightApp_Application* anApp = dynamic_cast<LightApp_Application*>(theApp);
168   if (anApp)
169   {
170     connect(anApp, SIGNAL(preferenceResetToDefaults()), this, SLOT(onDefaultPreferences()));
171   }
172
173   int aMenu = createMenu(tr("Inspection"), -1, -1, 30);
174   int aSubMenu = createMenu(tr("Information"), aMenu, -1, -1, 0);
175
176   int aId = getNextCommandId();
177   myActionsList.append(aId);
178   SUIT_Desktop* aDesk = application()->desktop();
179   QString aTip = tr("Show inspection window");
180   myWhatIsAction = createAction(aId, aTip, QIcon(":pictures/whatis.png"), tr("What Is"),
181     aTip, QKeySequence(), aDesk, true, this, SLOT(onWhatIs(bool)));
182   myWhatIsAction->setStatusTip(aTip);
183   myWhatIsAction->setData("INSPECTION_CMD");
184   createMenu(aId, aSubMenu, 0);
185
186   QString aToolName = tr("Inspection");
187   int aTool = createTool(aToolName);
188   int aToolId = createTool(myWhatIsAction, aTool);
189   registerCommandToolbar(aToolName, aId);
190
191   // Define Edit toolbars command
192   aId = getNextCommandId();
193   //myActionsList.append(aId); Do not use it for editing of toolbars
194   aTip = tr("Edit toolbars of the module");
195   QAction* aAction = createAction(aId, aTip, QIcon(":pictures/configure_toolbars.png"),
196     tr("Edit toolbars..."), aTip, QKeySequence(), aDesk, false, this, SLOT(onEditToolbars()));
197   int aEditMenu = createMenu(tr("MEN_DESK_EDIT"), -1, -1, 30);
198   int aEditItem = createMenu(aId, aEditMenu);
199
200   // Initialize viewer proxy if OCC viewer is already exist
201   ViewManagerList aOCCViewManagers;
202   application()->viewManagers(OCCViewer_Viewer::Type(), aOCCViewManagers);
203   if (aOCCViewManagers.size() > 0) {
204     SUIT_ViewManager* aMgr = aOCCViewManagers.first();
205     SUIT_ViewWindow* aWnd = aMgr->getActiveView();
206     if (aWnd) {
207       OCCViewer_ViewWindow* aOccWnd = static_cast<OCCViewer_ViewWindow*>(aWnd);
208       OCCViewer_ViewPort3d* aViewPort = aOccWnd->getViewPort();
209       if (aViewPort) {
210         XGUI_ViewerProxy* aViewer = myWorkshop->viewer();
211         aViewPort->installEventFilter(aViewer);
212         Handle(V3d_View) aView = aViewPort->getView();
213         aViewer->SetScale(aView, aView->Camera()->Scale());
214         // We can not create selector here because other modules will be deactivated later
215         //onViewManagerAdded(aMgr);
216       }
217     }
218   }
219 }
220
221 //******************************************************
222 void SHAPERGUI::windows(QMap<int, int>& theWndMap) const
223 {
224   theWndMap.insert(LightApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea);
225 }
226
227 //******************************************************
228 void SHAPERGUI::viewManagers(QStringList& theList) const
229 {
230   theList.append(OCCViewer_Viewer::Type());
231 }
232
233 //******************************************************
234 // We can not create selector in this method because it can be called when
235 // SHAPER module is not active. Take into account that creation of our selector
236 // leads to switching OFF all other selectors
237 //void SHAPERGUI::connectToStudy(CAM_Study* theStudy)
238 //{
239 //  // if there are created viewer managers, we should try to create viewer
240 //  // selector and initialize viewer with it. It sets interactive context to the
241 //  // proxy viewer. If study is opened, CAM application calls this method before the open()
242 //  // of data model
243 //  // the SHAPER data model is specific and during open(load) redisplay signals are flushed, so
244 //  // we need to connect to the viewer before it. Here,
245 //  // it seems the most appropriate place for this
246 //  // according to SALOME architecture.
247 //  if (!mySelector) {
248 //    ViewManagerList OCCViewManagers;
249 //    application()->viewManagers(OCCViewer_Viewer::Type(), OCCViewManagers);
250 //    if (OCCViewManagers.size() > 0) {
251 //      mySelector = createSelector(OCCViewManagers.first());
252 //    }
253 //  }
254 //  LightApp_Module::connectToStudy(theStudy);
255 //}
256
257 //******************************************************
258 bool SHAPERGUI::activateModule(SUIT_Study* theStudy)
259 {
260   bool isDone = LightApp_Module::activateModule(theStudy);
261   loadToolbarsConfig();
262
263   SHAPERGUI_DataModel* aDataModel = dynamic_cast<SHAPERGUI_DataModel*>(dataModel());
264   aDataModel->initRootObject();
265
266   if (isDone) {
267     setMenuShown(true);
268     setToolShown(true);
269
270     QObject* aObj = myWorkshop->objectBrowser()->parent();
271     QDockWidget* aObjDoc = dynamic_cast<QDockWidget*>(aObj);
272     if (aObjDoc) {
273       myWorkshop->objectBrowser()->setVisible(true);
274       aObjDoc->setVisible(true);
275       desktop()->tabifyDockWidget(aObjDoc, myWorkshop->propertyPanel());
276       aObjDoc->toggleViewAction()->setVisible(true);
277     }
278
279     if (!myInspectionPanel) {
280       myInspectionPanel = myWorkshop->inspectionPanel();
281       connect(myInspectionPanel->toggleViewAction(), SIGNAL(toggled(bool)),
282               this, SLOT(onWhatIs(bool)));
283     }
284     myInspectionPanel->toggleViewAction()->setVisible(true);
285
286     myWorkshop->facesPanel()->toggleViewAction()->setVisible(true);
287     if (myIsFacesPanelVisible)
288       myWorkshop->facesPanel()->show();
289     myWorkshop->propertyPanel()->toggleViewAction()->setVisible(true);
290
291     if (!mySelector) {
292       ViewManagerList OCCViewManagers;
293       application()->viewManagers(OCCViewer_Viewer::Type(), OCCViewManagers);
294       if (OCCViewManagers.size() > 0) {
295         onViewManagerAdded(OCCViewManagers.first());
296       }
297     }
298     // it should be performed after the selector creation in order to have AISContext
299     myWorkshop->activateModule();
300     //action(myEraseAll)->setEnabled(false);
301
302     if (myIsOpened) {
303       myWorkshop->objectBrowser()->rebuildDataTree();
304       myWorkshop->updateCommandStatus();
305       myIsOpened = false;
306     }
307     else
308       myWorkshop->updateCommandStatus();
309   }
310   SUIT_ResourceMgr* aResMgr = application()->resourceMgr();
311   myIsStorePositions = aResMgr->booleanValue("Study", "store_positions", true);
312   myIsEditEnabled = getApp()->isEditEnabled();
313   getApp()->setEditEnabled(false);
314
315   // this following row is caused by #187 bug.
316   // SALOME saves the dock widget positions before deactivateModule() and
317   // load it after the module activation. So, if the panel is visible before
318   // deactivate, it becomes visible after activate.
319   // In order to avoid the visible property panel, the widget position save is
320   // switch off in this module
321   aResMgr->setValue("Study", "store_positions", false);
322
323   // Synchronize displayed objects
324   Handle(AIS_InteractiveContext) aContext;
325   if (mySelector && mySelector->viewer())
326     aContext = mySelector->viewer()->getAISContext();
327
328   if (!aContext.IsNull()) {
329     XGUI_Displayer* aDisp = myWorkshop->displayer();
330     QObjectPtrList aObjList = aDisp->displayedObjects();
331
332     if (myOldSelectionColor.size() == 0)
333       myOldSelectionColor = aDisp->selectionColor();
334
335     AIS_ListOfInteractive aList;
336     aContext->DisplayedObjects(aList);
337     AIS_ListIteratorOfListOfInteractive aLIt;
338     Handle(AIS_InteractiveObject) anAISIO;
339     foreach (ObjectPtr aObj, aObjList) {
340       AISObjectPtr aPrs = aDisp->getAISObject(aObj);
341       Handle(AIS_InteractiveObject) aAIS = aPrs->impl<Handle(AIS_InteractiveObject)>();
342       bool aFound = false;
343       for (aLIt.Initialize(aList); aLIt.More(); aLIt.Next()) {
344         anAISIO = aLIt.Value();
345         if (anAISIO.get() == aAIS.get()) {
346           aFound = true;
347           break;
348         }
349       }
350       if (!aFound) {
351         aObj->setDisplayed(false);
352         //aDisp->erase(aObj, false);
353       }
354     }
355     Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
356   }
357   myProxyViewer->activateViewer(true);
358
359   // Post-processing for LoadScriptId to remove created(if it was created) SALOME Object Browser
360   connect(getApp()->action(LightApp_Application::UserID+1), SIGNAL(triggered(bool)),
361           this, SLOT(onScriptLoaded()));
362
363   disconnect(getApp()->action(LightApp_Application::FileSaveId), SIGNAL(triggered(bool)),
364              getApp(), SLOT(onSaveDoc()));
365   disconnect(getApp()->action(LightApp_Application::FileSaveAsId), SIGNAL(triggered(bool)),
366              getApp(), SLOT(onSaveAsDoc()));
367
368   connect(getApp()->action(LightApp_Application::FileSaveId), SIGNAL(triggered(bool)),
369           this, SLOT(onSaveDocByShaper()));
370   connect(getApp()->action(LightApp_Application::FileSaveAsId), SIGNAL(triggered(bool)),
371           this, SLOT(onSaveAsDocByShaper()));
372
373   return isDone;
374 }
375
376 //******************************************************
377 bool SHAPERGUI::deactivateModule(SUIT_Study* theStudy)
378 {
379   saveToolbarsConfig();
380
381   myProxyViewer->activateViewer(false);
382   setMenuShown(false);
383   setToolShown(false);
384
385   myWorkshop->deactivateModule();
386
387   QObject* aObj = myWorkshop->objectBrowser()->parent();
388   QDockWidget* aObjDoc = dynamic_cast<QDockWidget*>(aObj);
389   if (aObjDoc) {
390     aObjDoc->setVisible(false);
391     myWorkshop->objectBrowser()->setVisible(false);
392     aObjDoc->toggleViewAction()->setVisible(false);
393   }
394
395   myIsInspectionVisible = myInspectionPanel->isVisible();
396   myInspectionPanel->hide();
397   myInspectionPanel->toggleViewAction()->setVisible(false);
398
399   myIsFacesPanelVisible = myWorkshop->facesPanel()->isVisible();
400   myWorkshop->facesPanel()->hide();
401   myWorkshop->facesPanel()->toggleViewAction()->setVisible(false);
402
403   myWorkshop->propertyPanel()->hide();
404   myWorkshop->propertyPanel()->toggleViewAction()->setVisible(false);
405
406   // the active operation should be stopped for the next activation.
407   // There should not be active operation and visualized preview.
408   // Abort operation should be performed before the selection's remove
409   // because the displayed objects should be removed from the viewer, but
410   // the AIS context is obtained from the selector.
411   ModuleBase_Operation* anOperation = myWorkshop->operationMgr()->currentOperation();
412   while (anOperation) {
413     anOperation->abort();
414     anOperation = myWorkshop->operationMgr()->currentOperation();
415   }
416   // Delete selector because it has to be redefined on next activation
417   if (mySelector) {
418     // Restore size of arrows of trihedron
419     if (myAxisArrowRate > 0) {
420       Handle(AIS_Trihedron) aTrihedron = mySelector->viewer()->getTrihedron();
421       Handle(Prs3d_DatumAspect) aDatumAspect = aTrihedron->Attributes()->DatumAspect();
422       aDatumAspect->SetAttribute(Prs3d_DP_ShadingConeLengthPercent, myAxisArrowRate);
423       Handle(AIS_InteractiveContext) aContext = mySelector->viewer()->getAISContext();
424       aContext->Redisplay(aTrihedron, false);
425     }
426     myWorkshop->displayer()->setSelectionColor(myOldSelectionColor);
427     myProxyViewer->setSelector(0);
428
429     LightApp_SelectionMgr* aMgr = getApp()->selectionMgr();
430     QList<SUIT_Selector*> aList;
431     aMgr->selectors(aList);
432     foreach(SUIT_Selector* aSel, aList) {
433       aSel->setEnabled(aSel != mySelector);
434     }
435
436     delete mySelector;
437     mySelector = 0;
438   }
439
440   myWorkshop->hidePanel(myWorkshop->facesPanel());
441   //myWorkshop->contextMenuMgr()->disconnectViewer();
442
443   SUIT_ResourceMgr* aResMgr = application()->resourceMgr();
444   aResMgr->setValue("Study", "store_positions", myIsStorePositions);
445   getApp()->setEditEnabled(myIsEditEnabled);
446
447   myOldSelectionColor.clear();
448
449   // Post-processing for LoadScriptId to remove created(if it was created) SALOME Object Browser
450   disconnect(getApp()->action(LightApp_Application::UserID+1), SIGNAL(triggered(bool)),
451              this, SLOT(onScriptLoaded()));
452
453   disconnect(getApp()->action(LightApp_Application::FileSaveId), SIGNAL(triggered(bool)),
454              this, SLOT(onSaveDocByShaper()));
455   disconnect(getApp()->action(LightApp_Application::FileSaveAsId), SIGNAL(triggered(bool)),
456              this, SLOT(onSaveAsDocByShaper()));
457
458   connect(getApp()->action(LightApp_Application::FileSaveId), SIGNAL(triggered(bool)),
459           getApp(), SLOT(onSaveDoc()));
460   connect(getApp()->action(LightApp_Application::FileSaveAsId), SIGNAL(triggered(bool)),
461           getApp(), SLOT(onSaveAsDoc()));
462
463   publishToStudy();
464
465   return LightApp_Module::deactivateModule(theStudy);
466 }
467
468 //******************************************************
469 void SHAPERGUI::onViewManagerAdded(SUIT_ViewManager* theMgr)
470 {
471   if (!mySelector) {
472     mySelector = createSelector(theMgr);
473     myWorkshop->selectionActivate()->updateSelectionFilters();
474     myWorkshop->selectionActivate()->updateSelectionModes();
475     myWorkshop->synchronizeViewer();
476   }
477 }
478
479 //******************************************************
480 void SHAPERGUI::onViewManagerRemoved(SUIT_ViewManager* theMgr)
481 {
482   if (mySelector) {
483     if (theMgr->getType() == OCCViewer_Viewer::Type()) {
484       OCCViewer_Viewer* aViewer = static_cast<OCCViewer_Viewer*>(theMgr->getViewModel());
485       if (mySelector->viewer() == aViewer) {
486         XGUI_Displayer* aDisp = myWorkshop->displayer();
487         QObjectPtrList aObjects = aDisp->displayedObjects();
488         ResultPtr aRes;
489         foreach(ObjectPtr aObj, aObjects) {
490           aObj->setDisplayed(false);
491           aRes = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);
492           if (aRes.get()) {
493             while (aRes = ModelAPI_Tools::bodyOwner(aRes)) {
494               aRes->setDisplayed(false);
495             }
496           }
497         }
498         Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
499         myProxyViewer->setSelector(0);
500         delete mySelector;
501         mySelector = 0;
502
503         myWorkshop->module()->clearViewer();
504       }
505     }
506   }
507 }
508
509 //******************************************************
510 QtxPopupMgr* SHAPERGUI::popupMgr()
511 {
512   if (!myPopupMgr)
513     myPopupMgr = new QtxPopupMgr( 0, this );
514   return myPopupMgr;
515 }
516
517 //******************************************************
518 void SHAPERGUI::onDefaultPreferences()
519 {
520   // reset main resources
521   ModuleBase_Preferences::resetResourcePreferences(preferences());
522   // reset plugin's resources
523   ModuleBase_Preferences::resetConfigPropPreferences(preferences());
524
525   myWorkshop->displayer()->redisplayObjects();
526 }
527
528 //******************************************************
529 void SHAPERGUI::onScriptLoaded()
530 {
531   // this slot is called after processing of the LoadScriptId action of SalomeApp Application
532   // Each dumped script contains updateObjBrowser() that creates a new instance of Object
533   // Browser. When SHAPER module is active, this browser should not be used. It might be removed
534   // as hidden by means of updateWindows() of SalomeApp_Application or to remove
535   // it manually (because this method of application is protected)
536   SUIT_DataBrowser* aBrowser = getApp()->objectBrowser();
537   if (aBrowser)
538     delete aBrowser;
539   myWorkshop->displayer()->updateViewer();
540   myWorkshop->updateCommandStatus();
541 }
542
543 //******************************************************
544 void SHAPERGUI::onSaveDocByShaper()
545 {
546   if(!workshop()->operationMgr()->abortAllOperations(XGUI_OperationMgr::XGUI_InformationMessage))
547     return;
548
549   getApp()->onSaveDoc();
550 }
551
552 //******************************************************
553 void SHAPERGUI::onSaveAsDocByShaper()
554 {
555   if(!workshop()->operationMgr()->abortAllOperations(XGUI_OperationMgr::XGUI_InformationMessage))
556     return;
557
558   getApp()->onSaveAsDoc();
559 }
560
561 //******************************************************
562 void SHAPERGUI::onUpdateCommandStatus()
563 {
564   getApp()->updateActions();
565 }
566
567 //******************************************************
568 SHAPERGUI_OCCSelector* SHAPERGUI::createSelector(SUIT_ViewManager* theMgr)
569 {
570   if (theMgr->getType() == OCCViewer_Viewer::Type()) {
571     OCCViewer_Viewer* aViewer = static_cast<OCCViewer_Viewer*>(theMgr->getViewModel());
572
573     // Remember current length of arrow of axis
574     Handle(AIS_Trihedron) aTrihedron = aViewer->getTrihedron();
575     Handle(Prs3d_DatumAspect) aDatumAspect = aTrihedron->Attributes()->DatumAspect();
576     myAxisArrowRate = aDatumAspect->Attribute(Prs3d_DP_ShadingConeLengthPercent);
577
578     SHAPERGUI_OCCSelector* aSelector = new SHAPERGUI_OCCSelector(aViewer,
579                                                                  getApp()->selectionMgr());
580 #ifdef SALOME_PATCH_FOR_CTRL_WHEEL
581     aViewer->setUseLocalSelection(true);
582 #endif
583     LightApp_SelectionMgr* aMgr = getApp()->selectionMgr();
584     QList<SUIT_Selector*> aList;
585     aMgr->selectors(aList);
586     foreach(SUIT_Selector* aSel, aList)
587     {
588       aSel->setEnabled(aSel == aSelector);
589     }
590     myProxyViewer->setSelector(aSelector);
591
592     if (myOldSelectionColor.size() == 0)
593       myOldSelectionColor = myWorkshop->displayer()->selectionColor();
594
595     std::vector<int> aColor = Config_PropManager::color("Visualization", "selection_color");
596     myWorkshop->displayer()->setSelectionColor(aColor);
597
598     // Cause scaling of arrows of axis and dimensions
599     myWorkshop->module()->onViewTransformed();
600
601     return aSelector;
602   }
603   return 0;
604 }
605
606 //******************************************************
607 CAM_DataModel* SHAPERGUI::createDataModel()
608 {
609   return new SHAPERGUI_DataModel(this);
610 }
611
612 QAction* SHAPERGUI::addFeature(const QString& theWBName, const ActionInfo& theInfo,
613                                const bool isAddSeparator)
614 {
615   return addFeature(theWBName,
616                     theInfo.toolBar,
617                     theInfo.id,
618                     theInfo.text,
619                     //Issue #650: in the SALOME mode the tooltip should be same as text
620                     theInfo.text,
621                     theInfo.icon,
622                     theInfo.shortcut,
623                     theInfo.checkable,
624                     isAddSeparator,
625                     theInfo.toolTip);
626 }
627
628 //******************************************************
629 QAction* SHAPERGUI::addFeature(const QString& theWBName, const QString& theTBName,
630                                const QString& theId, const QString& theTitle, const QString& theTip,
631                                const QIcon& theIcon, const QKeySequence& theKeys,
632                                bool isCheckable, const bool isAddSeparator,
633                                const QString& theStatusTip)
634 {
635   static QString aLastTool = "";
636   static int aNb = 0;
637   if (aLastTool.isEmpty())
638     aLastTool = theWBName;
639   else if (theWBName != aLastTool) {
640     aLastTool = theWBName;
641     if (aNb > 20) {
642       desktop()->addToolBarBreak();
643       aNb = 0;
644     }
645   }
646   aNb++;
647
648   int aId = getNextCommandId();
649   myActionsList.append(aId);
650   SUIT_Desktop* aDesk = application()->desktop();
651   int aKeys = 0;
652   for (int i = 0; i < theKeys.count(); i++)
653     aKeys += theKeys[i];
654   QAction* aAction = createAction(aId, theTip, theIcon, theTitle, theTip, aKeys, aDesk,
655                                   isCheckable);
656   aAction->setStatusTip(theStatusTip);
657
658   aAction->setData(theId);
659
660   int aWBMenu = createMenu(theWBName, -1, -1, 30/*10-Window, 1000 - Help*/);
661   int aItemId = createMenu(aId, aWBMenu);
662   if (isAddSeparator)
663     createMenu(separator(), aWBMenu);
664
665   int aWBTool = createTool(theTBName, theTBName);
666   int aToolId = createTool(aId, aWBTool);
667   registerCommandToolbar(theTBName, aId);
668   if (isAddSeparator) {
669     createTool(separator(), aWBTool);
670     registerCommandToolbar(theTBName, -1);
671   }
672   return aAction;
673 }
674
675 bool SHAPERGUI::isFeatureOfNested(const QAction* theAction)
676 {
677   return dynamic_cast<const SHAPERGUI_NestedButton*>(theAction);
678 }
679
680 QAction* SHAPERGUI::addFeatureOfNested(const QString& theWBName,
681                                        const ActionInfo& theInfo,
682                                        const QList<QAction*>& theNestedActions)
683 {
684   SUIT_Desktop* aDesk = application()->desktop();
685   SHAPERGUI_NestedButton* anAction = new SHAPERGUI_NestedButton(aDesk, theNestedActions);
686   anAction->setData(theInfo.id);
687   anAction->setCheckable(theInfo.checkable);
688   anAction->setChecked(theInfo.checked);
689   anAction->setEnabled(theInfo.enabled);
690   anAction->setVisible(theInfo.visible);
691   anAction->setIcon(theInfo.icon);
692   anAction->setText(theInfo.text);
693   anAction->setToolTip(theInfo.toolTip);
694   anAction->setShortcut(theInfo.shortcut);
695   anAction->setFont(theInfo.font);
696
697   int aWBMenu = createMenu(theWBName, -1, -1, 30);
698   int aItemId = createMenu(anAction, aWBMenu);
699   myActionsList.append(aItemId);
700   createMenu(separator(), aWBMenu); /// nested action is always separated of others
701
702   int aWBTool = createTool(theWBName, theWBName);
703   int aToolId = createTool(anAction, aWBTool);
704   registerCommandToolbar(theWBName, aItemId);
705   createTool(separator(), aWBTool); /// nested action is always separated of others
706   registerCommandToolbar(theWBName, -1);
707
708   return anAction;
709 }
710
711
712 //******************************************************
713 QAction* SHAPERGUI::addDesktopCommand(const QString& theId, const QString& theTitle,
714                                            const QString& theTip, const QIcon& theIcon,
715                                            const QKeySequence& theKeys, bool isCheckable,
716                                            const char* theMenuSourceText,
717                                            const QString& theSubMenu,
718                                            const int theMenuPosition,
719                                            const int theSuibMenuPosition)
720 {
721   int aMenu = createMenu(tr(theMenuSourceText), -1, -1);
722   if (!theSubMenu.isNull())
723     aMenu = createMenu(theSubMenu, aMenu, -1, theSuibMenuPosition);
724
725   int aId = getNextCommandId();
726   myActionsList.append(aId);
727   SUIT_Desktop* aDesk = application()->desktop();
728   int aKeys = 0;
729   for (int i = 0; i < theKeys.count(); i++)
730     aKeys += theKeys[i];
731   QAction* aAction = createAction(aId, theTip, theIcon, theTitle, theTip, aKeys, aDesk,
732                                   isCheckable);
733   aAction->setStatusTip(theTip);
734   aAction->setData(theId);
735   createMenu(aId, aMenu, theMenuPosition);
736   return aAction;
737 }
738
739 //******************************************************
740 void SHAPERGUI::addDesktopMenuSeparator(const char* theMenuSourceText, const int theMenuPosition)
741 {
742   int aMenu = createMenu(tr(theMenuSourceText), -1, -1);
743   createMenu(separator(), aMenu, -1, theMenuPosition);
744 }
745
746 //******************************************************
747 bool SHAPERGUI::addActionInToolbar( QAction* theAction, const QString& theToolBarTitle )
748 {
749   if( !theAction )
750     return false;
751
752   SUIT_Desktop* aDesktop = application()->desktop();
753   if( !aDesktop )
754     return false;
755
756   QtxActionToolMgr* aToolMgr = aDesktop->toolMgr();
757   if( !aToolMgr )
758     return false;
759
760   aToolMgr->append( theAction, theToolBarTitle );
761   return true;
762 }
763
764 //******************************************************
765 QList<QAction*> SHAPERGUI::commandList() const
766 {
767   QList<QAction*> aActions;
768   foreach (int aId, myActionsList) {
769     QAction* aCmd = action(aId);
770     if (aCmd)
771       aActions.append(aCmd);
772   }
773
774   return aActions;
775 }
776
777 //******************************************************
778 QMainWindow* SHAPERGUI::desktop() const
779 {
780   return application()->desktop();
781 }
782
783 void SHAPERGUI::setFeatureInfo(const QString& theFeatureId,
784                                const std::shared_ptr<Config_FeatureMessage>& theMessage)
785 {
786   myFeaturesInfo.insert(theFeatureId, theMessage);
787 }
788
789 std::shared_ptr<Config_FeatureMessage> SHAPERGUI::featureInfo(const QString& theFeatureId)
790 {
791   std::shared_ptr<Config_FeatureMessage> aMessage;
792   if (myFeaturesInfo.contains(theFeatureId))
793     aMessage =  myFeaturesInfo[theFeatureId];
794   return aMessage;
795 }
796
797 //******************************************************
798 void SHAPERGUI::selectionChanged()
799 {
800   LightApp_Module::selectionChanged();
801   myWorkshop->salomeViewerSelectionChanged();
802 }
803
804 //******************************************************
805 void SHAPERGUI::contextMenuPopup(const QString& theClient, QMenu* theMenu, QString& theTitle)
806 {
807   myWorkshop->contextMenuMgr()->updateViewerMenu();
808   myWorkshop->contextMenuMgr()->addViewerMenu(theMenu);
809   LightApp_Module::contextMenuPopup(theClient, theMenu, theTitle);
810 }
811
812
813 //******************************************************
814 void SHAPERGUI::createPreferences()
815 {
816   LightApp_Preferences* pref = preferences();
817   if (!pref)
818     return;
819   ModuleBase_Preferences::updateConfigByResources();
820   QString aModName = moduleName();
821
822   QtxPreferenceItem* item = pref->findItem(aModName, true );
823   if ( item && (!item->isEmpty() )) {
824     item->parentItem()->removeItem(item);
825     delete item;
826   }
827
828   int catId = pref->addPreference(aModName, -1 );
829   if ( catId == -1 )
830     return;
831   SHAPERGUI_PrefMgr aMgr(pref, aModName);
832   ModuleBase_Preferences::createEditContent(&aMgr, catId);
833
834   int viewTab = pref->addItem(tr("Viewer"), catId);
835   // Create other parameters group in viewer tab
836   int otherGroup = pref->addItem(tr("Default selection"), viewTab);
837   pref->setItemProperty("columns", 3, otherGroup);
838   pref->addItem(tr("Faces"), otherGroup,
839                          SUIT_PreferenceMgr::Bool,
840                          ModuleBase_Preferences::VIEWER_SECTION, "face-selection");
841   pref->addItem(tr("Edges"), otherGroup,
842                          SUIT_PreferenceMgr::Bool,
843                          ModuleBase_Preferences::VIEWER_SECTION, "edge-selection");
844   pref->addItem(tr("Vertices"), otherGroup,
845                          SUIT_PreferenceMgr::Bool,
846                          ModuleBase_Preferences::VIEWER_SECTION, "vertex-selection");
847
848   int sensitivityGroup = pref->addItem(tr("Selection sensitivity"), viewTab);
849   pref->setItemProperty("columns", 2, sensitivityGroup);
850   pref->addItem(tr("Vertex"), sensitivityGroup, SUIT_PreferenceMgr::DblSpin,
851                 ModuleBase_Preferences::VIEWER_SECTION, "point-selection-sensitivity");
852   pref->addItem(tr("Edge"), sensitivityGroup, SUIT_PreferenceMgr::DblSpin,
853                 ModuleBase_Preferences::VIEWER_SECTION, "edge-selection-sensitivity");
854
855   int highlightGroup = pref->addItem(tr("Additional highlighting"), viewTab);
856   pref->setItemProperty("columns", 2, highlightGroup);
857   pref->addItem(tr("In 3d mode"), highlightGroup,
858     SUIT_PreferenceMgr::Bool, ModuleBase_Preferences::VIEWER_SECTION, "highlighting-3d");
859   pref->addItem(tr("In 2d mode"), highlightGroup,
860     SUIT_PreferenceMgr::Bool, ModuleBase_Preferences::VIEWER_SECTION, "highlighting-2d");
861
862   int colorScaleGroup = pref->addItem(tr("Color scale"), viewTab);
863   pref->setItemProperty("columns", 4, colorScaleGroup);
864   int aItem = aMgr.addPreference(tr("X position"), colorScaleGroup,
865     SUIT_PreferenceMgr::Double, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_x_position");
866   pref->setItemProperty("min", 0, aItem);
867   pref->setItemProperty("max", 1, aItem);
868
869   aItem = aMgr.addPreference(tr("Y position"), colorScaleGroup,
870     SUIT_PreferenceMgr::Double, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_y_position");
871   pref->setItemProperty("min", 0, aItem);
872   pref->setItemProperty("max", 1, aItem);
873
874   aItem = aMgr.addPreference(tr("Width"), colorScaleGroup,
875     SUIT_PreferenceMgr::Double, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_width");
876   pref->setItemProperty("min", 0, aItem);
877   pref->setItemProperty("max", 1, aItem);
878
879   aItem = aMgr.addPreference(tr("Height"), colorScaleGroup,
880     SUIT_PreferenceMgr::Double, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_height");
881   pref->setItemProperty("min", 0, aItem);
882   pref->setItemProperty("max", 1, aItem);
883
884   aItem = aMgr.addPreference(tr("Intervals number"), colorScaleGroup,
885     SUIT_PreferenceMgr::Integer, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_nb_intervals");
886   pref->setItemProperty("min", 0, aItem);
887   pref->setItemProperty("max", 100, aItem);
888
889   aItem = aMgr.addPreference(tr("Text height"), colorScaleGroup,
890     SUIT_PreferenceMgr::Integer, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_text_height");
891   pref->setItemProperty("min", 0, aItem);
892   pref->setItemProperty("max", 100, aItem);
893
894   aItem = aMgr.addPreference(tr("Text color"), colorScaleGroup,
895     SUIT_PreferenceMgr::Color, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_text_color");
896
897   pref->retrieve();
898 }
899
900 //******************************************************
901 void SHAPERGUI::preferencesChanged(const QString& theSection, const QString& theParam)
902 {
903   SUIT_ResourceMgr* aResMgr = application()->resourceMgr();
904   QString aVal = aResMgr->stringValue(theSection, theParam);
905   Config_Prop* aProp = Config_PropManager::findProp(theSection.toStdString(),
906                                                     theParam.toStdString());
907   std::string aValue = aVal.toStdString();
908   if (aValue.empty()) {
909     aValue = aProp->defaultValue();
910     aResMgr->setValue(theSection, theParam, QString(aValue.c_str()));
911
912     LightApp_Preferences* pref = preferences();
913     if (pref)
914       pref->retrieve();
915   }
916   aProp->setValue(aValue);
917
918   if ((theSection == "Visualization") && (theParam == "selection_color")) {
919     std::vector<int> aColor = Config_PropManager::color("Visualization", "selection_color");
920     myWorkshop->displayer()->setSelectionColor(aColor);
921   }
922
923   myWorkshop->displayer()->redisplayObjects();
924 }
925
926 void SHAPERGUI::putInfo(const QString& theInfo, const int theMSecs)
927 {
928   application()->putInfo(theInfo, theMSecs);
929 }
930
931 bool SHAPERGUI::abortAllOperations()
932 {
933   return workshop()->operationMgr()->abortAllOperations();
934 }
935
936 void SHAPERGUI::createFeatureActions()
937 {
938   myWorkshop->menuMgr()->createFeatureActions();
939 }
940
941 void SHAPERGUI::onWhatIs(bool isToggled)
942 {
943   if (sender() == myWhatIsAction) {
944     QAction* aViewAct = myInspectionPanel->toggleViewAction();
945     aViewAct->blockSignals(true);
946     aViewAct->setChecked(isToggled);
947     aViewAct->blockSignals(false);
948     myInspectionPanel->setVisible(isToggled);
949   }
950   else {
951     myWhatIsAction->blockSignals(true);
952     myWhatIsAction->setChecked(isToggled);
953     myWhatIsAction->blockSignals(false);
954     myInspectionPanel->setVisible(isToggled);
955   }
956 }
957
958 void SHAPERGUI::updateModuleVisibilityState()
959 {
960   LightApp_Module::updateModuleVisibilityState();
961   onWhatIs(myIsInspectionVisible);
962 }
963
964 void SHAPERGUI::onEditToolbars()
965 {
966   SHAPERGUI_ToolbarsDlg aDlg(this);
967   if (aDlg.exec() == QDialog::Accepted) {
968     if (aDlg.isReset())
969       resetToolbars();
970     else
971       updateToolbars(aDlg.result());
972   }
973 }
974
975 void SHAPERGUI::registerCommandToolbar(const QString& theToolName, int theCommandId)
976 {
977   if (!myToolbars.contains(theToolName))
978     myToolbars[theToolName] = QList<int>();
979   myToolbars[theToolName].append(theCommandId);
980 }
981
982 int SHAPERGUI::getNextCommandId() const
983 {
984   QtxActionMenuMgr* aMenuMgr = menuMgr();
985   QIntList aIds = aMenuMgr->idList();
986   int aId = aIds.count();
987   while (action(aId) || myActionsList.contains(aId))
988     aId++;
989   return aId;
990 }
991
992 void SHAPERGUI::updateToolbars(const QMap<QString, QIntList>& theNewToolbars)
993 {
994   // Store default toolbars
995   if (myDefaultToolbars.size() == 0)
996     myDefaultToolbars = myToolbars;
997
998   QtxActionToolMgr* aMgr = toolMgr();
999   QStringList aToolbars = theNewToolbars.keys();
1000   QIntList aCommands, aOldCmd;
1001   int aToolbarId;
1002   QAction* aAction;
1003   int aActionId;
1004   foreach(QString aName, aToolbars) {
1005     aCommands = theNewToolbars[aName];
1006     // Find or create toolbar
1007     if (aMgr->hasToolBar(aName)) {
1008       aToolbarId = aMgr->find(aMgr->toolBar(aName));
1009       aOldCmd = myToolbars[aName];
1010     }
1011     else {
1012       aToolbarId = aMgr->createToolBar(aName);
1013     }
1014     int aPos = 0;
1015     foreach(int aCmd, aCommands) {
1016       // Find action
1017       if (aCmd == -1)
1018         aAction = separator();
1019       else
1020         aAction = action(aCmd);
1021       aActionId = aMgr->actionId(aAction);
1022       if (aActionId == -1) {
1023         // Add new action
1024         aMgr->insert(aAction, aToolbarId, aPos);
1025       }
1026       else {
1027         // Change position of action
1028         if (aMgr->index(aActionId, aToolbarId) != aPos) {
1029           if (aMgr->containsAction(aActionId, aToolbarId))
1030             aMgr->remove(aActionId, aToolbarId);
1031           aMgr->insert(aActionId, aToolbarId, aPos);
1032         }
1033       }
1034       aOldCmd.removeAll(aCmd);
1035       aPos++;
1036     }
1037     // remove extra actions
1038     foreach(int aCmd, aOldCmd) {
1039       aAction = action(aCmd);
1040       aActionId = aMgr->actionId(aAction);
1041       aMgr->remove(aActionId, aToolbarId);
1042     }
1043     myToolbars.remove(aName);
1044   }
1045   // Remove extra toolbars
1046   aToolbars = myToolbars.keys();
1047   foreach(QString aName, aToolbars) {
1048     aMgr->removeToolBar(aName);
1049   }
1050   // Set new toolbars structure
1051   myToolbars = theNewToolbars;
1052   myIsToolbarsModified = true;
1053 }
1054
1055 void SHAPERGUI::saveToolbarsConfig()
1056 {
1057   if (!myIsToolbarsModified)
1058     return;
1059   // Save toolbars configuration into map
1060   QMap<QString, QStringList> aToolbarsConfig;
1061   QtxActionToolMgr* aMgr = toolMgr();
1062   QStringList aToolbars = myToolbars.keys();
1063   QIntList aActionsIds;
1064   foreach(QString aName, aToolbars) {
1065     aActionsIds = myToolbars[aName];
1066     QStringList aContent;
1067     foreach(int aId, aActionsIds) {
1068       if (aId == -1)
1069         aContent.append("");
1070       else
1071         aContent.append(action(aId)->data().toString());
1072     }
1073     aToolbarsConfig[aName] = aContent;
1074   }
1075   // Store the configuration into resources
1076   SUIT_ResourceMgr* aResMgr = application()->resourceMgr();
1077   QStringList aNames = aToolbarsConfig.keys();
1078   QStringList aValues;
1079   foreach(QString aToolbar, aNames) {
1080     aResMgr->setValue(ToolbarsSection, aToolbar, aToolbarsConfig[aToolbar].join(","));
1081   }
1082   // Remove obsolete parameters from resources
1083   QStringList aOldParams = aResMgr->parameters(ToolbarsSection);
1084   foreach(QString aName, aOldParams) {
1085     if (!aToolbars.contains(aName))
1086       aResMgr->remove(ToolbarsSection, aName);
1087   }
1088   // Store current list of free commands
1089   QIntList aFreeCommands = getFreeCommands();
1090   QStringList aFreeList;
1091   foreach(int aId, aFreeCommands) {
1092     aFreeList.append(action(aId)->data().toString());
1093   }
1094   if (aFreeList.size() > 0)
1095     aResMgr->setValue(ToolbarsSection, FreeCommandsParam, aFreeList.join(","));
1096
1097   myIsToolbarsModified = false;
1098 }
1099
1100 void SHAPERGUI::loadToolbarsConfig()
1101 {
1102   SUIT_ResourceMgr* aResMgr = application()->resourceMgr();
1103   QStringList aToolbarNames = aResMgr->parameters(ToolbarsSection);
1104   if (aToolbarNames.size() == 0)
1105     return;
1106
1107   // Create commands map
1108   QMap<QString, int> aCommandsMap;
1109   QString aCmdIdStr;
1110   foreach(int aId, myActionsList) {
1111     aCmdIdStr = action(aId)->data().toString();
1112     aCommandsMap[aCmdIdStr] = aId;
1113   }
1114
1115   // Create new toolbars structure
1116   QMap<QString, QIntList> aToolbars;
1117   QStringList aCommands;
1118   QIntList aKnownCommands;
1119   QList<QAction*> aActions;
1120   foreach(QString aName, aToolbarNames) {
1121     aCommands = aResMgr->stringValue(ToolbarsSection, aName).split(",");
1122     if (aName == FreeCommandsParam) {
1123       // The value is a list of free commands
1124       foreach(QString aCommand, aCommands) {
1125         aKnownCommands.append(aCommandsMap[aCommand]);
1126       }
1127     }
1128     else {
1129       aToolbars[aName] = QIntList();
1130       if (aCommands.size() > 0) {
1131         foreach(QString aCommand, aCommands) {
1132           if (aCommand.isEmpty())
1133             aToolbars[aName].append(-1);
1134           else if (aCommandsMap.contains(aCommand)) {
1135             int aId = aCommandsMap[aCommand];
1136             aToolbars[aName].append(aId);
1137             aKnownCommands.append(aId);
1138           }
1139         }
1140       }
1141     }
1142   }
1143   // Find new and obsolete commands
1144   QIntList aNewCommands = myActionsList;
1145   foreach(int aId, myActionsList) {
1146     if (aKnownCommands.contains(aId)) {
1147       aKnownCommands.removeAll(aId);
1148       aNewCommands.removeAll(aId);
1149     }
1150   }
1151   if (aNewCommands.size() > 0) {
1152     // Add new commands to toolbars structure
1153     QStringList aKeys = myToolbars.keys();
1154     foreach(int aNewId, aNewCommands) {
1155       foreach(QString aName, aKeys) {
1156         if (myToolbars[aName].contains(aNewId)) {
1157           if (!aToolbars.contains(aName)) {
1158             aToolbars[aName] = QIntList();
1159           }
1160           aToolbars[aName].append(aNewId);
1161         }
1162       }
1163     }
1164   }
1165   if (aKnownCommands.size() > 0) {
1166     // Remove obsolete commands from the toolbars structure
1167     QStringList aKeys = aToolbars.keys();
1168     foreach(int aOldId, aKnownCommands) {
1169       foreach(QString aName, aKeys) {
1170         if (aToolbars[aName].contains(aOldId)) {
1171           aToolbars[aName].removeAll(aOldId);
1172           if (aToolbars[aName].size() == 0)
1173             aToolbars.remove(aName);
1174         }
1175       }
1176     }
1177   }
1178   updateToolbars(aToolbars);
1179   myIsToolbarsModified = false;
1180 }
1181
1182
1183 QIntList SHAPERGUI::getFreeCommands() const
1184 {
1185   QIntList aFreeCommands;
1186   QtxActionToolMgr* aMgr = toolMgr();
1187   QAction* anAction;
1188   int aId;
1189   QMap<QString, QIntList>::const_iterator aIt;
1190   QIntList aShaperActions = shaperActions();
1191   foreach(int aCmd, aShaperActions) {
1192     anAction = action(aCmd);
1193     aId = aMgr->actionId(anAction);
1194     if (!aMgr->containsAction(aId))
1195       aFreeCommands.append(aCmd);
1196   }
1197   return aFreeCommands;
1198 }
1199
1200 void SHAPERGUI::resetToolbars()
1201 {
1202   if (!myDefaultToolbars.isEmpty())
1203     updateToolbars(myDefaultToolbars);
1204   myIsToolbarsModified = false;
1205   SUIT_ResourceMgr* aResMgr = application()->resourceMgr();
1206   aResMgr->remove(ToolbarsSection);
1207 }
1208
1209 void SHAPERGUI::publishToStudy()
1210 {
1211   if (isActiveModule())
1212     myWorkshop->module()->launchOperation("PublishToStudy", false);
1213 }