From 271a684a49642830452a3e9f1113a74fa906ab19 Mon Sep 17 00:00:00 2001 From: vsv Date: Fri, 7 Nov 2014 15:44:14 +0300 Subject: [PATCH] Issue #247: Provide show/hide for groups --- src/XGUI/XGUI_ContextMenuMgr.cpp | 72 ++++++++++++++++---------------- 1 file changed, 35 insertions(+), 37 deletions(-) diff --git a/src/XGUI/XGUI_ContextMenuMgr.cpp b/src/XGUI/XGUI_ContextMenuMgr.cpp index f951d7a27..706899ebb 100644 --- a/src/XGUI/XGUI_ContextMenuMgr.cpp +++ b/src/XGUI/XGUI_ContextMenuMgr.cpp @@ -126,55 +126,53 @@ QMenu* XGUI_ContextMenuMgr::objectBrowserMenu() const { FeaturePtr aFeature = boost::dynamic_pointer_cast(aObj); ResultPtr aResult = boost::dynamic_pointer_cast(aObj); - ResultGroupPtr aGroupRes = boost::dynamic_pointer_cast(aObj); + //ResultGroupPtr aGroupRes = boost::dynamic_pointer_cast(aObj); if (aResult) hasResult = true; if (aFeature) hasFeature = true; - if (aGroupRes) - hasGroup = true; - if (hasFeature && hasResult && hasGroup) + //if (aGroupRes) + // hasGroup = true; + if (hasFeature && hasResult) // && hasGroup) break; } //Process Feature - if (!hasGroup) { - if (aSelected == 1) { - ObjectPtr aObject = aObjects.first(); - if (aObject) { - ResultPartPtr aPart = boost::dynamic_pointer_cast(aObject); - if (aPart) { - if (aMgr->activeDocument() == aPart->partDoc()) - aMenu->addAction(action("DEACTIVATE_PART_CMD")); + if (aSelected == 1) { + ObjectPtr aObject = aObjects.first(); + if (aObject) { + ResultPartPtr aPart = boost::dynamic_pointer_cast(aObject); + if (aPart) { + if (aMgr->activeDocument() == aPart->partDoc()) + aMenu->addAction(action("DEACTIVATE_PART_CMD")); + else + aMenu->addAction(action("ACTIVATE_PART_CMD")); + } else if (hasFeature) { + aMenu->addAction(action("EDIT_CMD")); + } else { + if (aDisplayer->isVisible(aObject)) { + if (aDisplayer->displayMode(aObject) == XGUI_Displayer::Shading) + aMenu->addAction(action("WIREFRAME_CMD")); else - aMenu->addAction(action("ACTIVATE_PART_CMD")); - } else if (hasFeature) { - aMenu->addAction(action("EDIT_CMD")); + aMenu->addAction(action("SHADING_CMD")); + aMenu->addSeparator(); + aMenu->addAction(action("HIDE_CMD")); } else { - if (aDisplayer->isVisible(aObject)) { - if (aDisplayer->displayMode(aObject) == XGUI_Displayer::Shading) - aMenu->addAction(action("WIREFRAME_CMD")); - else - aMenu->addAction(action("SHADING_CMD")); - aMenu->addSeparator(); - aMenu->addAction(action("HIDE_CMD")); - } else { - aMenu->addAction(action("SHOW_CMD")); - } - aMenu->addAction(action("SHOW_ONLY_CMD")); + aMenu->addAction(action("SHOW_CMD")); } - } else { // If feature is 0 the it means that selected root object (document) - if (aMgr->activeDocument() != aMgr->moduleDocument()) - aMenu->addAction(action("ACTIVATE_PART_CMD")); - } - } else { - if (hasResult) { - aMenu->addAction(action("SHOW_CMD")); - aMenu->addAction(action("HIDE_CMD")); aMenu->addAction(action("SHOW_ONLY_CMD")); - aMenu->addSeparator(); - aMenu->addAction(action("SHADING_CMD")); - aMenu->addAction(action("WIREFRAME_CMD")); } + } else { // If feature is 0 the it means that selected root object (document) + if (aMgr->activeDocument() != aMgr->moduleDocument()) + aMenu->addAction(action("ACTIVATE_PART_CMD")); + } + + if (hasResult) { + aMenu->addAction(action("SHOW_CMD")); + aMenu->addAction(action("HIDE_CMD")); + aMenu->addAction(action("SHOW_ONLY_CMD")); + aMenu->addSeparator(); + aMenu->addAction(action("SHADING_CMD")); + aMenu->addAction(action("WIREFRAME_CMD")); } if (hasFeature) aMenu->addAction(action("DELETE_CMD")); -- 2.39.2