From 779967e2f5d9692aa1992e34f327379cf285c143 Mon Sep 17 00:00:00 2001 From: vsv Date: Fri, 20 Dec 2019 13:04:00 +0300 Subject: [PATCH] Create "Break link" pop-up menu item --- src/SMESHGUI/SMESHGUI.cxx | 33 ++++++++++++++++++++++++++++++ src/SMESHGUI/SMESHGUI_Operations.h | 2 ++ src/SMESHGUI/SMESH_msg_en.ts | 13 ++++++++++++ 3 files changed, 48 insertions(+) diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index 82d159350..4a612b59d 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -1382,6 +1382,31 @@ namespace } } + // Break link with Shaper model + void breakShaperLink() + { + LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr(); + SALOME_ListIO selected; + if (aSel) { + aSel->selectedObjects(selected); + if (selected.Extent()) { + Handle(SALOME_InteractiveObject) anIObject = selected.First(); + _PTR(Study) aStudy = SMESH::getStudy(); + _PTR(SObject) aSObj = aStudy->FindObjectID(anIObject->getEntry()); + if (aSObj) { + std::string aName = aSObj->GetName(); + QMessageBox::StandardButton aRes = SUIT_MessageBox::warning(SMESHGUI::desktop(), + QObject::tr("SMESH_WRN_WARNING"), + QObject::tr("MSG_BREAK_SHAPER_LINK").arg(aName.c_str()), + SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::No); + if (aRes == SUIT_MessageBox::Yes) { + // Remove link here + } + } + } + } + } + void SetDisplayMode(int theCommandID, VTK::MarkerMap& theMarkerMap) { SALOME_ListIO selected; @@ -3751,6 +3776,9 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) case SMESHOp::OpSortChild: ::sortChildren(); break; + case SMESHOp::OpBreakLink: + ::breakShaperLink(); + break; } @@ -4084,6 +4112,8 @@ void SMESHGUI::initialize( CAM_Application* app ) createSMESHAction( SMESHOp::OpSortChild, "SORT_CHILD_ITEMS" ); + createSMESHAction( SMESHOp::OpBreakLink, "BREAK_SHAPER_LINK" ); + QList aCtrlActions; aCtrlActions << SMESHOp::OpFreeNode << SMESHOp::OpEqualNode << SMESHOp::OpNodeConnectivityNb // node controls @@ -4857,6 +4887,9 @@ void SMESHGUI::initialize( CAM_Application* app ) popupMgr()->setRule( action( SMESHOp::OpSortChild ), "$component={'SMESH'} and client='ObjectBrowser' and isContainer and nbChildren>1", QtxPopupMgr::VisibleRule ); popupMgr()->insert( separator(), -1, -1 ); + popupMgr()->insert( action( SMESHOp::OpBreakLink), -1, -1 ); + popupMgr()->setRule( action( SMESHOp::OpBreakLink), "$component={'SHAPERSTUDY'} and client='ObjectBrowser'", QtxPopupMgr::VisibleRule ); + connect( application(), SIGNAL( viewManagerActivated( SUIT_ViewManager* ) ), this, SLOT( onViewManagerActivated( SUIT_ViewManager* ) ) ); diff --git a/src/SMESHGUI/SMESHGUI_Operations.h b/src/SMESHGUI/SMESHGUI_Operations.h index f66ba0f57..c7b7425d2 100644 --- a/src/SMESHGUI/SMESHGUI_Operations.h +++ b/src/SMESHGUI/SMESHGUI_Operations.h @@ -230,6 +230,8 @@ namespace SMESHOp { OpClipping = 6100, // POPUP MENU - CLIPPING // SortChild ----------------------//-------------------------------- OpSortChild = 6110, // POPUP MENU - SORT CHILDREN + // Break link with Shaper object --//-------------------------------- + OpBreakLink = 6120, // POPUP MENU - Break link with Shaper // Advanced -----------------------//-------------------------------- OpAdvancedNoOp = 10000, // NO OPERATION (advanced operations base) //@@ insert new functions before this line @@ do not remove this line @@// diff --git a/src/SMESHGUI/SMESH_msg_en.ts b/src/SMESHGUI/SMESH_msg_en.ts index 725431f1c..635580697 100644 --- a/src/SMESHGUI/SMESH_msg_en.ts +++ b/src/SMESHGUI/SMESH_msg_en.ts @@ -4503,6 +4503,19 @@ It can't be deleted STB_SORT_CHILD_ITEMS Sort child items + + MEN_BREAK_SHAPER_LINK + Break link + + + STB_BREAK_SHAPER_LINK + Break link with Shaper model + + + MSG_BREAK_SHAPER_LINK + A link with Shaper model for object %1 will be broken. +Continue? + SMESH_ADVANCED Advanced -- 2.39.2