From: vsv Date: Wed, 16 Jul 2014 07:29:59 +0000 (+0400) Subject: Bug fixing after changes of ModelAPI X-Git-Tag: V_0.4.4~180 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b7abf2b1011c2babecbe7b4289e9e23d1001b1ff;p=modules%2Fshaper.git Bug fixing after changes of ModelAPI --- diff --git a/src/XGUI/XGUI_ContextMenuMgr.cpp b/src/XGUI/XGUI_ContextMenuMgr.cpp index 62d3ebe62..0cfd7e493 100644 --- a/src/XGUI/XGUI_ContextMenuMgr.cpp +++ b/src/XGUI/XGUI_ContextMenuMgr.cpp @@ -108,24 +108,22 @@ QMenu* XGUI_ContextMenuMgr::objectBrowserMenu() const if (aObject) { ResultPartPtr aPart = boost::dynamic_pointer_cast(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(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(aObject); - if (aResult) { + FeaturePtr aFeature = boost::dynamic_pointer_cast(aObject); + if (aFeature) { + aMenu->addAction(action("EDIT_CMD")); aMenu->addAction(action("DELETE_CMD")); } } diff --git a/src/XGUI/XGUI_PartDataModel.cpp b/src/XGUI/XGUI_PartDataModel.cpp index 82f8c132b..5a5af7888 100644 --- a/src/XGUI/XGUI_PartDataModel.cpp +++ b/src/XGUI/XGUI_PartDataModel.cpp @@ -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(aObject); + return aPart->partDoc(); } ObjectPtr XGUI_PartDataModel::object(const QModelIndex& theIndex) const diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 4671c0d50..084a800c9 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -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(theObj); + if (aPart) { + DocumentPtr aPartDoc = aPart->partDoc(); + if (aPartDoc) { + aMgr->setCurrentDocument(aPartDoc); + return; + } + } + } + aMgr->setCurrentDocument(aMgr->rootDocument()); } //******************************************************