Create "Break link" pop-up menu item

This commit is contained in:
vsv 2019-12-20 13:04:00 +03:00
parent c56d066c64
commit 779967e2f5
3 changed files with 48 additions and 0 deletions

View File

@ -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<int> 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* ) ) );

View File

@ -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 @@//

View File

@ -4503,6 +4503,19 @@ It can&apos;t be deleted </translation>
<source>STB_SORT_CHILD_ITEMS</source>
<translation>Sort child items</translation>
</message>
<message>
<source>MEN_BREAK_SHAPER_LINK</source>
<translation>Break link</translation>
</message>
<message>
<source>STB_BREAK_SHAPER_LINK</source>
<translation>Break link with Shaper model</translation>
</message>
<message>
<source>MSG_BREAK_SHAPER_LINK</source>
<translation>A link with Shaper model for object %1 will be broken.
Continue?</translation>
</message>
<message>
<source>SMESH_ADVANCED</source>
<translation>Advanced</translation>