]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Bug fixing after changes of ModelAPI
authorvsv <vitaly.smetannikov@opencascade.com>
Wed, 16 Jul 2014 07:29:59 +0000 (11:29 +0400)
committervsv <vitaly.smetannikov@opencascade.com>
Wed, 16 Jul 2014 07:29:59 +0000 (11:29 +0400)
src/XGUI/XGUI_ContextMenuMgr.cpp
src/XGUI/XGUI_PartDataModel.cpp
src/XGUI/XGUI_Workshop.cpp

index 62d3ebe62a2e4a68d760e6440ccb2996e748d9a7..0cfd7e493742e9e90dd6f0537ef8060287824ff7 100644 (file)
@@ -108,24 +108,22 @@ QMenu* XGUI_ContextMenuMgr::objectBrowserMenu() const
     if (aObject) {
       ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aObject);
       if (aPart) {
-        DocumentPtr aFeaDoc = aPart->partDoc();
-        if (aMgr->currentDocument() == aFeaDoc)
+        if (aMgr->currentDocument() == aPart->partDoc())
           aMenu->addAction(action("DEACTIVATE_PART_CMD"));
         else 
           aMenu->addAction(action("ACTIVATE_PART_CMD"));
       } else {
         ResultPtr aResult = boost::dynamic_pointer_cast<ModelAPI_Result>(aObject);
         if (aResult) {
-          aMenu->addAction(action("EDIT_CMD"));
-
           XGUI_Displayer* aDisplayer = myWorkshop->displayer();
           if (aDisplayer->isVisible(aResult))
             aMenu->addAction(action("HIDE_CMD"));
           else
             aMenu->addAction(action("SHOW_CMD"));
         } else {
-          FeaturePtr aResult = boost::dynamic_pointer_cast<ModelAPI_Feature>(aObject);
-          if (aResult) {
+          FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(aObject);
+          if (aFeature) {
+            aMenu->addAction(action("EDIT_CMD"));
             aMenu->addAction(action("DELETE_CMD"));
           }
         }
index 82f8c132bb298b478dc280e8bb1ceb77bf40a016..5a5af7888dd51a5bae986913fc2c50960a9f85bb 100644 (file)
@@ -390,7 +390,8 @@ DocumentPtr XGUI_PartDataModel::partDocument() const
 {
   DocumentPtr aRootDoc = ModelAPI_PluginManager::get()->rootDocument();
   ObjectPtr aObject = aRootDoc->object(ModelAPI_ResultPart::group(), myId);
-  return aObject->document();
+  ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aObject);
+  return aPart->partDoc();
 }
  
 ObjectPtr XGUI_PartDataModel::object(const QModelIndex& theIndex) const
index 4671c0d50fea90927f88fb4011e2f22d0e9cefa6..084a800c935ab24b055d55fe0143140adcf7707a 100644 (file)
@@ -854,12 +854,16 @@ void XGUI_Workshop::changeCurrentDocument(ObjectPtr theObj)
 {
   PluginManagerPtr aMgr = ModelAPI_PluginManager::get();
   if (theObj) {
-    DocumentPtr aPartDoc = theObj->document();
-    if (aPartDoc)
-      aMgr->setCurrentDocument(aPartDoc);
-  } else {
-    aMgr->setCurrentDocument(aMgr->rootDocument());
-  }
+    ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(theObj);
+    if (aPart) {
+      DocumentPtr aPartDoc = aPart->partDoc();
+      if (aPartDoc) {
+        aMgr->setCurrentDocument(aPartDoc);
+        return;
+      }
+    }
+  } 
+  aMgr->setCurrentDocument(aMgr->rootDocument());
 }
 
 //******************************************************