Salome HOME
PAL10611: Remove popup-menu items Erase, Display, etc., provided by parent LightApp_M...
authorjfa <jfa@opencascade.com>
Tue, 22 Nov 2005 15:03:24 +0000 (15:03 +0000)
committerjfa <jfa@opencascade.com>
Tue, 22 Nov 2005 15:03:24 +0000 (15:03 +0000)
src/VISUGUI/VisuGUI.cxx

index 488443d8032605120c344d1103a2f12a240ff4d1..84811faa99d100f91b4ab820cc2254fbfd2af54d 100644 (file)
@@ -2664,6 +2664,36 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q
     action( VISU_DELETE_OBJS )->addTo(theMenu);
   }
 
+  // Check if some curves selected (for bug PAL10611)
+  bool isCurves = false;
+  SALOME_ListIteratorOfListIO It1 (aListIO);
+  for (; It1.More() && !isCurves; It1.Next()) {
+    Handle(SALOME_InteractiveObject)& anIO = It1.Value();
+
+    if (!anIO.IsNull() && anIO->hasEntry()) {
+      _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
+      _PTR(GenericAttribute) anAttr;
+      if (aSObject->FindAttribute(anAttr, "AttributeComment")) {
+        _PTR(AttributeComment) aComment (anAttr);
+        string aComm = aComment->Value();
+        QString strIn (aComm.c_str());
+        VISU::Storable::TRestoringMap pMap;
+        VISU::Storable::StrToMap(strIn, pMap);
+        bool isExist;
+        VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(pMap,"myType",&isExist).toInt();
+        if (isExist && aType == VISU::TCURVE) {
+          isCurves = true;
+        }
+      }
+    }
+  }
+  if (isCurves) {
+    action( myDisplay     )->removeFrom(theMenu);
+    action( myErase       )->removeFrom(theMenu);
+    action( myDisplayOnly )->removeFrom(theMenu);
+    action( myEraseAll    )->removeFrom(theMenu);
+  }
+
   // Check single selection
   if (aListIO.Extent() != 1) return;