Salome HOME
Merge remote-tracking branch 'origin/Dev_0.6'
[modules/shaper.git] / src / NewGeom / NewGeom_Module.cpp
index 6bb769fdafa20b1bfe402eca040e8418232c6361..5755c626f5dd3911695f40f571080eaf67680ba4 100644 (file)
@@ -57,6 +57,14 @@ public:
     return myMgr->addPreference(myModName, theLbl, pId, theType, theSection, theName);
   }
 
+  virtual void setItemProperty(const QString& thePropName,
+                               const QVariant& theValue,
+                               const int theId = -1)
+  {
+    myMgr->setItemProperty(thePropName, theValue, theId);
+  }
+
+
   virtual SUIT_PreferenceMgr* prefMgr() const { return myMgr; }
 
 private:
@@ -70,7 +78,7 @@ private:
 //******************************************************
 NewGeom_Module::NewGeom_Module()
     : LightApp_Module("NewGeom"),
-      mySelector(0), myIsOpened(0)
+      mySelector(0), myIsOpened(0), myPopupMgr(0)
 {
   myWorkshop = new XGUI_Workshop(this);
   myProxyViewer = new NewGeom_SalomeViewer(this);
@@ -131,8 +139,7 @@ bool NewGeom_Module::activateModule(SUIT_Study* theStudy)
         mySelector = createSelector(OCCViewManagers.first());
       }
     }
-    QtxPopupMgr* aMgr = popupMgr();  // Create popup manager
-    action(myEraseAll)->setEnabled(false);
+    //action(myEraseAll)->setEnabled(false);
 
     if (myIsOpened) {
       myWorkshop->objectBrowser()->rebuildDataTree();
@@ -202,6 +209,14 @@ void NewGeom_Module::onViewManagerAdded(SUIT_ViewManager* theMgr)
   }
 }
 
+//******************************************************
+QtxPopupMgr* NewGeom_Module::popupMgr()
+{
+  if (!myPopupMgr)
+    myPopupMgr = new QtxPopupMgr( 0, this );
+  return myPopupMgr;
+}
+
 //******************************************************
 void NewGeom_Module::onDefaultPreferences()
 {
@@ -262,11 +277,12 @@ QAction* NewGeom_Module::addFeature(const QString& theWBName, const QString& the
 }
 
 //******************************************************
-QAction* NewGeom_Module::addEditCommand(const QString& theId, const QString& theTitle,
-                                        const QString& theTip, const QIcon& theIcon,
-                                        const QKeySequence& theKeys, bool isCheckable)
+QAction* NewGeom_Module::addDesktopCommand(const QString& theId, const QString& theTitle,
+                                           const QString& theTip, const QIcon& theIcon,
+                                           const QKeySequence& theKeys, bool isCheckable,
+                                           const char* theMenuSourceText, const int theMenuPosition)
 {
-  int aMenu = createMenu(tr("MEN_DESK_EDIT"), -1, -1);
+  int aMenu = createMenu(tr(theMenuSourceText), -1, -1);
 
   int aId = myActionsList.size();
   myActionsList.append(theId);
@@ -277,15 +293,15 @@ QAction* NewGeom_Module::addEditCommand(const QString& theId, const QString& the
   QAction* aAction = createAction(aId, theTip, theIcon, theTitle, theTip, aKeys, aDesk,
                                   isCheckable);
   aAction->setData(theId);
-  createMenu(aId, aMenu, 10);
+  createMenu(aId, aMenu, theMenuPosition);
   return aAction;
 }
 
 //******************************************************
-void NewGeom_Module::addEditMenuSeparator()
+void NewGeom_Module::addDesktopMenuSeparator(const char* theMenuSourceText, const int theMenuPosition)
 {
-  int aMenu = createMenu(tr("MEN_DESK_EDIT"), -1, -1);
-  createMenu(separator(), aMenu, -1, 10);
+  int aMenu = createMenu(tr(theMenuSourceText), -1, -1);
+  createMenu(separator(), aMenu, -1, theMenuPosition);
 }
 
 //******************************************************