Salome HOME
Porting to salome 7.5.x
[modules/shaper.git] / src / NewGeom / NewGeom_Module.cpp
index 9f8bc4543a6ee76012b5b0515195bd9c35e7f6ff..2103ed5ef9ee872c1a1853e0a9ca64741e4b3bc0 100644 (file)
@@ -1,3 +1,5 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
 
 #include "NewGeom_Module.h"
 #include "NewGeom_DataModel.h"
@@ -6,11 +8,11 @@
 #include <XGUI_Workshop.h>
 #include <XGUI_PropertyPanel.h>
 #include <XGUI_ContextMenuMgr.h>
-#include <XGUI_Preferences.h>
 #include <XGUI_ObjectsBrowser.h>
 #include <XGUI_OperationMgr.h>
 
 #include <ModuleBase_Operation.h>
+#include <ModuleBase_Preferences.h>
 
 #include <LightApp_Application.h>
 #include <LightApp_SelectionMgr.h>
@@ -45,7 +47,7 @@ NewGeom_EXPORT char* getModuleVersion()
 }
 }
 
-class NewGeom_PrefMgr: public XGUI_IPrefMgr
+class NewGeom_PrefMgr: public ModuleBase_IPrefMgr
 {
 public:
   NewGeom_PrefMgr(LightApp_Preferences* theMgr, const QString& theModName):myMgr(theMgr), myModName(theModName) {}
@@ -57,6 +59,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:
@@ -75,8 +85,8 @@ NewGeom_Module::NewGeom_Module()
   myWorkshop = new XGUI_Workshop(this);
   myProxyViewer = new NewGeom_SalomeViewer(this);
 
-  XGUI_Preferences::setResourceMgr(application()->resourceMgr());
-  XGUI_Preferences::loadCustomProps();
+  ModuleBase_Preferences::setResourceMgr(application()->resourceMgr());
+  ModuleBase_Preferences::loadCustomProps();
 }
 
 //******************************************************
@@ -139,9 +149,13 @@ bool NewGeom_Module::activateModule(SUIT_Study* theStudy)
       myIsOpened = false;
       QTimer::singleShot(1000, myWorkshop, SLOT(displayAllResults()));
     }
+    else
+      myWorkshop->updateCommandStatus();
   }
   SUIT_ResourceMgr* aResMgr = application()->resourceMgr();
   myIsStorePositions = aResMgr->booleanValue("Study", "store_positions", true);
+  myIsEditEnabled = getApp()->isEditEnabled();
+  getApp()->setEditEnabled(false);
 
   // this following row is caused by #187 bug.
   // SALOME saves the dock widget positions before deactivateModule() and
@@ -189,6 +203,7 @@ bool NewGeom_Module::deactivateModule(SUIT_Study* theStudy)
 
   SUIT_ResourceMgr* aResMgr = application()->resourceMgr();
   aResMgr->setValue("Study", "store_positions", myIsStorePositions);
+  getApp()->setEditEnabled(myIsEditEnabled);
 
   return LightApp_Module::deactivateModule(theStudy);
 }
@@ -212,8 +227,8 @@ QtxPopupMgr* NewGeom_Module::popupMgr()
 //******************************************************
 void NewGeom_Module::onDefaultPreferences()
 {
-  XGUI_Preferences::resetConfig();
-  XGUI_Preferences::updateResourcesByConfig();
+  ModuleBase_Preferences::resetConfig();
+  ModuleBase_Preferences::updateResourcesByConfig();
 
   LightApp_Preferences* pref = preferences();
   if (pref)
@@ -386,7 +401,7 @@ void NewGeom_Module::createPreferences()
   LightApp_Preferences* pref = preferences();
   if (!pref)
     return;
-  XGUI_Preferences::updateConfigByResources();
+  ModuleBase_Preferences::updateConfigByResources();
   QString aModName = moduleName();
 
   QtxPreferenceItem* item = pref->findItem(aModName, true );
@@ -399,7 +414,7 @@ void NewGeom_Module::createPreferences()
   if ( catId == -1 )
     return;
   NewGeom_PrefMgr aMgr(pref, aModName);
-  XGUI_Preferences::createEditContent(&aMgr, catId);
+  ModuleBase_Preferences::createEditContent(&aMgr, catId);
   pref->retrieve();
 }