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