]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
Create "Break link" pop-up menu item
authorvsv <vsv@opencascade.com>
Fri, 20 Dec 2019 10:04:00 +0000 (13:04 +0300)
committervsv <vsv@opencascade.com>
Fri, 20 Dec 2019 10:04:00 +0000 (13:04 +0300)
src/SMESHGUI/SMESHGUI.cxx
src/SMESHGUI/SMESHGUI_Operations.h
src/SMESHGUI/SMESH_msg_en.ts

index 82d159350f3e8b4aa4a6a9c70d2ddf44dc0e0672..4a612b59d2c8d3bdb4aea6248a6e34834a9cbacb 100644 (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* ) ) );
 
index f66ba0f57fb29a215f506defa8c5978d722cda66..c7b7425d299316d155dfa89b54353befd153a52a 100644 (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 @@//
index 725431f1cdb6935d2ff0386f513377c03ed72c0b..6355806975cb351839e35a882fb5c3bc6565bb3e 100644 (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>