From: nds Date: Tue, 15 Nov 2016 18:20:03 +0000 (+0300) Subject: Edit/Delete popup menues enable on presentation selected in OCC viewer. X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8aa2876800a3e7376c5bae660556375877a52edd;p=modules%2Fgeom.git Edit/Delete popup menues enable on presentation selected in OCC viewer. --- diff --git a/src/GEOMGUI/GEOMGUI_Selection.cxx b/src/GEOMGUI/GEOMGUI_Selection.cxx index 48ac374d6..87026424e 100644 --- a/src/GEOMGUI/GEOMGUI_Selection.cxx +++ b/src/GEOMGUI/GEOMGUI_Selection.cxx @@ -26,6 +26,7 @@ #include "GEOMGUI_Selection.h" #include #include +#include #include "GeometryGUI.h" #include "GEOM_Displayer.h" @@ -152,6 +153,8 @@ QVariant GEOMGUI_Selection::parameter( const QString& p ) const v = hasImported(); else if ( p == "allImported" ) v = allImported(); + else if (p == "annotationsCount") + v = annotationsCount(); else v = LightApp_Selection::parameter( p ); return v; @@ -212,6 +215,9 @@ QVariant GEOMGUI_Selection::parameter( const int idx, const QString& p ) const // the method to skip temporary objects from selection (called from LightApp) bool GEOMGUI_Selection::processOwner( const LightApp_DataOwner* theOwner ) { + if ( theOwner->entry().contains( GEOMGUI_AnnotationMgr::GetEntrySeparator() ) ) { + myAnnotationEntries.append( theOwner->entry() ); + } return !theOwner->entry().contains("_"); } @@ -858,6 +864,11 @@ bool GEOMGUI_Selection::hasVisibleDimensions( const int theIndex ) const return isAnyVisible; } +int GEOMGUI_Selection::annotationsCount() const +{ + return myAnnotationEntries.size(); +} + bool GEOMGUI_Selection::hasAnnotations( const int theIndex, bool& theHidden, bool& theVisible ) const { SalomeApp_Study* appStudy = dynamic_cast( study() ); diff --git a/src/GEOMGUI/GEOMGUI_Selection.h b/src/GEOMGUI/GEOMGUI_Selection.h index d5f6ba23b..76dda787c 100644 --- a/src/GEOMGUI/GEOMGUI_Selection.h +++ b/src/GEOMGUI/GEOMGUI_Selection.h @@ -85,6 +85,8 @@ private: bool hasHiddenDimensions( const int ) const; bool hasVisibleDimensions( const int ) const; + int annotationsCount() const; + bool hasAnnotations( const int, bool&, bool& ) const; bool hasHiddenAnnotations( const int ) const; bool hasVisibleAnnotations( const int ) const; @@ -102,6 +104,7 @@ private: private: GeomObjectVector myObjects; + QStringList myAnnotationEntries; }; #endif diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index 487291674..e59a6d9fc 100755 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -1623,9 +1623,9 @@ void GeometryGUI::initialize( CAM_Application* app ) mgr->insert( separator(), -1, -1 ); // ----------- mgr->insert( action( GEOMOp::OpEditAnnotation ), -1, -1 ); // edit annotation - mgr->setRule( action( GEOMOp::OpEditAnnotation ), QString("($component={'GEOM'}) and type='Shape' and selcount=1"), QtxPopupMgr::VisibleRule ); + mgr->setRule( action( GEOMOp::OpEditAnnotation ), clientOCC + " and annotationsCount=1", QtxPopupMgr::VisibleRule ); mgr->insert( action( GEOMOp::OpDeleteAnnotation ), -1, -1 ); // delete annotation - mgr->setRule( action( GEOMOp::OpDeleteAnnotation ), QString("($component={'GEOM'}) and type='Shape' and selcount=1"), QtxPopupMgr::VisibleRule ); + mgr->setRule( action( GEOMOp::OpDeleteAnnotation ), clientOCC + " and (annotationsCount>1)", QtxPopupMgr::VisibleRule ); mgr->insert( separator(), -1, -1 ); // ----------- QString canDisplay = "($component={'GEOM'}) and (selcount>0) and ({true} in $canBeDisplayed) ",