X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FNewGeom%2FNewGeom_Module.cpp;h=c9d875f1373ed6781255f440c61e6cfbdc2e6a38;hb=3f19a9c3fb9c6fc844229db1f925a8a2b0b8a96f;hp=9f8bc4543a6ee76012b5b0515195bd9c35e7f6ff;hpb=d22fc665c79c31c9eea0625e04c2e941adfdf7be;p=modules%2Fshaper.git diff --git a/src/NewGeom/NewGeom_Module.cpp b/src/NewGeom/NewGeom_Module.cpp index 9f8bc4543..c9d875f13 100644 --- a/src/NewGeom/NewGeom_Module.cpp +++ b/src/NewGeom/NewGeom_Module.cpp @@ -1,3 +1,5 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + #include "NewGeom_Module.h" #include "NewGeom_DataModel.h" @@ -6,15 +8,16 @@ #include #include #include -#include #include #include #include +#include #include #include #include +#include #include #include @@ -45,7 +48,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 +60,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: @@ -73,10 +84,13 @@ NewGeom_Module::NewGeom_Module() mySelector(0), myIsOpened(0), myPopupMgr(0) { myWorkshop = new XGUI_Workshop(this); + connect(myWorkshop, SIGNAL(commandStatusUpdated()), + this, SLOT(onUpdateCommandStatus())); + myProxyViewer = new NewGeom_SalomeViewer(this); - XGUI_Preferences::setResourceMgr(application()->resourceMgr()); - XGUI_Preferences::loadCustomProps(); + ModuleBase_Preferences::setResourceMgr(application()->resourceMgr()); + ModuleBase_Preferences::loadCustomProps(); } //****************************************************** @@ -139,9 +153,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 +207,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,14 +231,20 @@ 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) pref->retrieve(); } +//****************************************************** +void NewGeom_Module::onUpdateCommandStatus() +{ + getApp()->updateActions(); +} + //****************************************************** NewGeom_OCCSelector* NewGeom_Module::createSelector(SUIT_ViewManager* theMgr) { @@ -242,7 +267,13 @@ NewGeom_OCCSelector* NewGeom_Module::createSelector(SUIT_ViewManager* theMgr) //****************************************************** CAM_DataModel* NewGeom_Module::createDataModel() { - return new NewGeom_DataModel(this); + NewGeom_DataModel* aDataModel = new NewGeom_DataModel(this); + + // Calling addComponent() for persistent functionality work in the SalomeApp_Study + LightApp_Study* aStudy = dynamic_cast(application()->activeStudy() ); + aStudy->addComponent(aDataModel); + + return aDataModel; } //****************************************************** @@ -386,7 +417,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 +430,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(); }