From: jfa Date: Tue, 22 Nov 2005 15:03:24 +0000 (+0000) Subject: PAL10611: Remove popup-menu items Erase, Display, etc., provided by parent LightApp_M... X-Git-Tag: BR_3_1_0_deb~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3a10df098061570151be0f69799903483989f317;p=modules%2Fvisu.git PAL10611: Remove popup-menu items Erase, Display, etc., provided by parent LightApp_Module,\n if at least one curve is selected. It fixes the special case,\n when a curve is published not under VISU component. --- diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index 488443d8..84811faa 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -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;