From caa5a5329e5b10acf7465ba94b999e72aed65ce1 Mon Sep 17 00:00:00 2001 From: jfa Date: Mon, 8 Aug 2005 08:57:16 +0000 Subject: [PATCH] Correct popup-menu: Delete now available only in Object Browser --- src/VISUGUI/VisuGUI.cxx | 54 ++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index fcaf2a00..01bcb137 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -2571,6 +2571,9 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q { SalomeApp_Module::contextMenuPopup(theClient, theMenu, theTitle); + OB_Browser* ob = getApp()->objectBrowser(); + bool isOBClient = (ob && theClient == ob->popupClientType()); + SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this); SALOME_ListIO aListIO; aSelectionMgr->selectedObjects(aListIO); @@ -2584,8 +2587,6 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q SALOME_ListIteratorOfListIO It (aListIO); for (; It.More(); It.Next()) { Handle(SALOME_InteractiveObject)& anIO = It.Value(); - /*std::vector aPrsList = GetPrs3dList(this, anIO); - nbPrs += aPrsList.size();*/ if (!anIO.IsNull() && anIO->hasEntry()) { _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry()); @@ -2624,7 +2625,7 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q theMenu->insertSeparator(); // Check if some (nb > 0) removable objects selected - if (IsRemovableSelected(this)) { + if (isOBClient && IsRemovableSelected(this)) { action( VISU_DELETE_OBJS )->addTo(theMenu); } @@ -2642,35 +2643,34 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q if (aType == VISU::TANIMATION) { action( VISU_SHOW_ANIMATION )->addTo(theMenu); - } else if (IsSObjectTable(SO)) { - OB_Browser* ob = getApp()->objectBrowser(); - if (ob && theClient == ob->popupClientType()) { + } else if (isOBClient) { + if (IsSObjectTable(SO)) { action( VISU_SHOW_TABLE )->addTo(theMenu); action( VISU_CREATE_CURVES )->addTo(theMenu); action( VISU_EXPORT_TABLE )->addTo(theMenu); theMenu->insertSeparator(); - } - } else { - if (!CORBA::is_nil(anObject)) { - SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject); - if (!CORBA::is_nil(aMED.in())) { - action( VISU_IMPORT_MED_STRUCTURE )->addTo(theMenu); - } - - SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject); // "Import Structure" - if (!CORBA::is_nil(aField)) { - action( VISU_IMPORT_MED_TIMESTAMP )->addTo(theMenu); // "Import TimeStamp" - } } else { - _PTR(SObject) aSFather = SO->GetFather(); - if (aSFather) { - _PTR(GenericAttribute) anAttr; - aSFather->FindAttribute(anAttr, "AttributeName"); - if (anAttr) { - _PTR(AttributeName) aName (anAttr); - std::string aValue = aName->Value(); - if (strcmp(aValue.c_str(), "MEDFIELD") == 0) { - action( VISU_IMPORT_MED_FIELD )->addTo(theMenu); // "Import Field" + if (!CORBA::is_nil(anObject)) { + SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject); + if (!CORBA::is_nil(aMED.in())) { + action( VISU_IMPORT_MED_STRUCTURE )->addTo(theMenu); + } + + SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject); // "Import Structure" + if (!CORBA::is_nil(aField)) { + action( VISU_IMPORT_MED_TIMESTAMP )->addTo(theMenu); // "Import TimeStamp" + } + } else { + _PTR(SObject) aSFather = SO->GetFather(); + if (aSFather) { + _PTR(GenericAttribute) anAttr; + aSFather->FindAttribute(anAttr, "AttributeName"); + if (anAttr) { + _PTR(AttributeName) aName (anAttr); + std::string aValue = aName->Value(); + if (strcmp(aValue.c_str(), "MEDFIELD") == 0) { + action( VISU_IMPORT_MED_FIELD )->addTo(theMenu); // "Import Field" + } } } } -- 2.39.2