From b19a1d5b4bb0c85fd9affcec4ed08b2290bfe98e Mon Sep 17 00:00:00 2001 From: vsv Date: Thu, 1 Aug 2019 17:17:23 +0300 Subject: [PATCH] Issue #2973: Make "Show only" mode more feasible for using in bug groups --- src/ModuleBase/ModuleBase_IModule.h | 7 +++++++ src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp | 6 ++++++ src/PartSet/PartSet_CustomPrs.cpp | 8 ++++++-- src/PartSet/PartSet_CustomPrs.h | 12 ++++++++++++ src/PartSet/PartSet_Module.cpp | 10 ++++++++++ src/PartSet/PartSet_Module.h | 7 +++++++ src/PartSet/PartSet_OperationPrs.cpp | 5 +++-- 7 files changed, 51 insertions(+), 4 deletions(-) diff --git a/src/ModuleBase/ModuleBase_IModule.h b/src/ModuleBase/ModuleBase_IModule.h index 165828fd0..529c1f153 100644 --- a/src/ModuleBase/ModuleBase_IModule.h +++ b/src/ModuleBase/ModuleBase_IModule.h @@ -290,6 +290,13 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject virtual bool customizeObject(ObjectPtr theObject, const ModuleBase_CustomizeFlag& theFlag, const bool theUpdateViewer); + /// Disable displaying of custom mode + /// \param theMode a mode to disable + virtual void disableCustomMode(ModuleBase_CustomizeFlag theMode) {} + + /// Enables disabled custom mode + virtual void enableCustomModes() {} + /// This method is called on object browser creation for customization of module specific features /// \param theObjectBrowser a pinter on Object Browser widget virtual void customizeObjectBrowser(QWidget* theObjectBrowser) {} diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp index c403a8780..349b61502 100644 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp @@ -223,6 +223,8 @@ void ModuleBase_WidgetMultiSelector::activateCustom() //******************************************************************** void ModuleBase_WidgetMultiSelector::deactivate() { + myWorkshop->module()->enableCustomModes(); + ModuleBase_WidgetSelector::deactivate(); if (myVisibleObjects.size()) onShowOnly(false); @@ -1102,7 +1104,11 @@ void ModuleBase_WidgetMultiSelector::onShowOnly(bool theChecked) for (aIt = aResults.cbegin(); aIt != aResults.cend(); aIt++) { myVisibleObjects.removeAll(*aIt); } + myWorkshop->module()->disableCustomMode(ModuleBase_IModule::CustomizeArguments); } + else + myWorkshop->module()->enableCustomModes(); + foreach(ObjectPtr aObj, myVisibleObjects) { aObj->setDisplayed(!theChecked); } diff --git a/src/PartSet/PartSet_CustomPrs.cpp b/src/PartSet/PartSet_CustomPrs.cpp index 7b4ab82a2..549a5395e 100644 --- a/src/PartSet/PartSet_CustomPrs.cpp +++ b/src/PartSet/PartSet_CustomPrs.cpp @@ -41,7 +41,8 @@ //#define DO_NOT_VISUALIZE_CUSTOM_PRESENTATION PartSet_CustomPrs::PartSet_CustomPrs(ModuleBase_IWorkshop* theWorkshop) - : myWorkshop(theWorkshop), myFeature(FeaturePtr()), myPresentationIsEmpty(false) + : myWorkshop(theWorkshop), myFeature(FeaturePtr()), myPresentationIsEmpty(false), + myDisabledMode(-1) { Events_Loop* aLoop = Events_Loop::loop(); aLoop->registerListener(this, Events_Loop::eventByName(EVENT_EMPTY_OPERATION_PRESENTATION)); @@ -93,6 +94,9 @@ bool PartSet_CustomPrs::displayPresentation( { bool isModified = false; + if (myDisabledMode == theFlag) + return isModified; + // update the AIS objects content AISObjectPtr aPresentation = getPresentation(theFlag, true); Handle(AIS_InteractiveObject) anAISIO = aPresentation->impl(); @@ -243,7 +247,7 @@ void PartSet_CustomPrs::initPresentation( if (theFlag == ModuleBase_IModule::CustomizeArguments || theFlag == ModuleBase_IModule::CustomizeResults) { anOperationPrs->setPointMarker(5, 2.); - anOperationPrs->setWidth(1); + anOperationPrs->setWidth((theFlag == ModuleBase_IModule::CustomizeHighlightedObjects)? 2 : 1); } else if (theFlag == ModuleBase_IModule::CustomizeHighlightedObjects) anAISPrs->useAISWidth(); diff --git a/src/PartSet/PartSet_CustomPrs.h b/src/PartSet/PartSet_CustomPrs.h index 6b31fdabe..75638bc5b 100644 --- a/src/PartSet/PartSet_CustomPrs.h +++ b/src/PartSet/PartSet_CustomPrs.h @@ -98,6 +98,16 @@ public: /// it caused erroneus case because the presentation has linkage to the previous context. void clearPrs(); + /// Disable displaying of custom mode + /// \param theMode a mode to disable + void disableCustomMode(ModuleBase_IModule::ModuleBase_CustomizeFlag theMode) { + myDisabledMode = theMode; + erasePresentation(theMode, false); + } + + /// Enables disabled custom mode + void enableCustomModes() { myDisabledMode = -1; } + //! Redefinition of Events_Listener method to listen a moment that the presentation becomes empty virtual void processEvent(const std::shared_ptr& theMessage); @@ -149,6 +159,8 @@ private: QMap myPresentations; /// State whether the presentation is activated/deactivated QMap myIsActive; + + int myDisabledMode; }; #endif diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 62987b497..e9dbb6a38 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -1711,3 +1711,13 @@ ModuleBase_ITreeNode* PartSet_Module::rootNode() const { return myRoot; } + +//****************************************************** +void PartSet_Module::disableCustomMode(ModuleBase_CustomizeFlag theMode) { + myCustomPrs->disableCustomMode(theMode); +} + +//****************************************************** +void PartSet_Module::enableCustomModes() { + myCustomPrs->enableCustomModes(); +} diff --git a/src/PartSet/PartSet_Module.h b/src/PartSet/PartSet_Module.h index 25c269059..66264e3ec 100644 --- a/src/PartSet/PartSet_Module.h +++ b/src/PartSet/PartSet_Module.h @@ -325,6 +325,13 @@ public: virtual bool customizeObject(ObjectPtr theObject, const ModuleBase_CustomizeFlag& theFlag, const bool theUpdateViewer); + /// Disable displaying of custom mode + /// \param theMode a mode to disable + virtual void disableCustomMode(ModuleBase_CustomizeFlag theMode); + + /// Enables disabled custom mode + virtual void enableCustomModes(); + /// This method is called on object browser creation for customisation of module specific features /// \param theObjectBrowser a pinter on Object Browser widget virtual void customizeObjectBrowser(QWidget* theObjectBrowser); diff --git a/src/PartSet/PartSet_OperationPrs.cpp b/src/PartSet/PartSet_OperationPrs.cpp index f31b1b404..f9d91312c 100644 --- a/src/PartSet/PartSet_OperationPrs.cpp +++ b/src/PartSet/PartSet_OperationPrs.cpp @@ -235,7 +235,8 @@ void PartSet_OperationPrs::appendShapeIfVisible(ModuleBase_IWorkshop* theWorksho QMap >& theObjectShapes) { XGUI_Displayer* aDisplayer = XGUI_Tools::workshop(theWorkshop)->displayer(); - if (XGUI_Displayer::isVisible(aDisplayer, theObject)) { + // VSV: Do not use isVisible checking because it can be used when state "Show Only" is ON + //if (XGUI_Displayer::isVisible(aDisplayer, theObject)) { if (theGeomShape.get()) { if (theObjectShapes.contains(theObject)) theObjectShapes[theObject].append(theGeomShape); @@ -250,7 +251,7 @@ void PartSet_OperationPrs::appendShapeIfVisible(ModuleBase_IWorkshop* theWorksho .arg(ModuleBase_Tools::objectInfo(theObject)).toStdString().c_str()); #endif } - } + //} } void PartSet_OperationPrs::getFeatureShapes(const FeaturePtr& theFeature, -- 2.39.2