]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Remove functionality by popup menu and the keyboard button "Delete".
authornds <nds@opencascade.com>
Thu, 21 Nov 2013 07:19:46 +0000 (07:19 +0000)
committernds <nds@opencascade.com>
Thu, 21 Nov 2013 07:19:46 +0000 (07:19 +0000)
src/HYDROGUI/HYDROGUI_Module.cxx
src/HYDROGUI/HYDROGUI_Module.h
src/HYDROGUI/HYDROGUI_Operations.cxx
src/HYDROGUI/HYDROGUI_PolylineDlg.cxx
src/HYDROGUI/HYDROGUI_PolylineDlg.h
src/HYDROGUI/HYDROGUI_PolylineOp.cxx
src/HYDROGUI/HYDROGUI_PolylineOp.h

index 28fc93e7d9a08b2826a2f949a1c78283e94242a6..3b45b680811bfe71cc048aab341e2d488796b888 100644 (file)
@@ -38,6 +38,7 @@
 #include "HYDROGUI_VTKPrs.h"
 #include "HYDROGUI_VTKPrsDisplayer.h"
 #include "HYDROGUI_AbstractDisplayer.h"
+#include "HYDROGUI_PolylineOp.h"
 
 #include <HYDROData_Image.h>
 #include <HYDROData_Lambert93.h>
@@ -418,6 +419,14 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
     }
   }
 
+  if ( anIsOCCView )
+  {
+    SUIT_Operation* anOp = application()->activeStudy()->activeOperation();
+    HYDROGUI_PolylineOp* aPolylineOp = dynamic_cast<HYDROGUI_PolylineOp*>( anOp );
+    if ( aPolylineOp && aPolylineOp->deleteEnabled() )
+      theMenu->addAction( action( DeleteId ) );
+  }
+
   if( anIsObjectBrowser || anIsGraphicsView || anIsOCCView || anIsVTKView )
   {
     theMenu->addAction( action( ShowAllId ) );
index 0aaf8f0b7091d17811b72d8a19693f0641441afd..384e5e714de7933809ae3ad24234158b589c152f 100644 (file)
@@ -162,6 +162,8 @@ protected:
 
 protected slots:
   void                            onOperation();
+  void                            onDelete();
+
 
   bool                            onUndo( int theNumActions );
   bool                            onRedo( int theNumActions );
index d32802e9d418aed99851cd5e8f623b17f3cab2f1..87515c4d48ba324096c698cdea7c44b2a7d51b26 100644 (file)
@@ -127,7 +127,8 @@ void HYDROGUI_Module::createActions()
   createAction( SplitImageId, "SPLIT_IMAGE" );
   createAction( EditSplittedImageId, "EDIT_SPLITTED_IMAGE" );
 
-  createAction( DeleteId, "DELETE", "", Qt::Key_Delete );
+  createAction( DeleteId, "DELETE", "", Qt::Key_Delete, false,
+                SLOT( onDelete() ) );
 
   createAction( SetColorId, "COLOR" );
 
@@ -232,6 +233,16 @@ void HYDROGUI_Module::onOperation()
     startOperation( anId );
 }
 
+void HYDROGUI_Module::onDelete()
+{
+  SUIT_Operation* anOp = application()->activeStudy()->activeOperation();
+  HYDROGUI_PolylineOp* aPolylineOp = dynamic_cast<HYDROGUI_PolylineOp*>( anOp );
+  if ( aPolylineOp && aPolylineOp->deleteEnabled() )
+    aPolylineOp->deleteSelected();
+  else
+    startOperation( DeleteId );
+}
+
 bool HYDROGUI_Module::onUndo( int theNumActions )
 {
   QApplication::setOverrideCursor( Qt::WaitCursor );
index 88f11469527d03bfb9120402b60acd66e565c7d8..de14235fd5f3fefa5b1bdff0cbb6b0baf92e54d8 100755 (executable)
@@ -120,3 +120,19 @@ QList< QPair< int, int > > HYDROGUI_PolylineDlg::getSelectedPoints()
 {
   return myEditorWidget->getSelectedPoints();
 }
+
+/**
+ * Redirect the delete action to editor widget
+ */
+void HYDROGUI_PolylineDlg::deleteSelected()
+{
+  myEditorWidget->removeSelected();
+}
+
+/**
+ * Checks whether there are some to delete
+ */
+bool HYDROGUI_PolylineDlg::deleteEnabled()
+{
+  return myEditorWidget->removeEnabled();
+}
index 69c4b6cbd29954415218f934f1a7b88eb8952640..866527c12eaf09897f57d2968ad0e9f5f32110c2 100755 (executable)
@@ -51,6 +51,9 @@ public:
   QList<int> getSelectedSections();
   QList< QPair< int, int > > getSelectedPoints();
 
+  void  deleteSelected();
+  bool  deleteEnabled();
+
 protected slots:
   void processStartedSubOperation( QWidget* );
   void processFinishedSubOperation( QWidget* );
index cbefd532cc923ff07a3b2853736fb3f0008284d9..ae3d5b21c48ea6d74e0e75d7d3f8eb776137f30d 100755 (executable)
@@ -56,6 +56,24 @@ HYDROGUI_PolylineOp::~HYDROGUI_PolylineOp()
   erasePreview();
 }
 
+/**
+ * Redirect the delete action to input panel
+ */
+void HYDROGUI_PolylineOp::deleteSelected()
+{
+  HYDROGUI_PolylineDlg* aPanel = (HYDROGUI_PolylineDlg*)inputPanel();
+  aPanel->deleteSelected();
+}
+
+/**
+ * Checks whether there are some to delete
+ */
+bool HYDROGUI_PolylineOp::deleteEnabled()
+{
+  HYDROGUI_PolylineDlg* aPanel = (HYDROGUI_PolylineDlg*)inputPanel();
+  return aPanel->deleteEnabled();
+}
+
 void HYDROGUI_PolylineOp::startOperation()
 {
   if( myCurve )
index 78c97a5b9b7459d556ad701627693ba9cde56a7f..c7fbe6582b5fb85a72146f3a77ab8425692cae9d 100755 (executable)
@@ -39,6 +39,9 @@ public:
   HYDROGUI_PolylineOp( HYDROGUI_Module* theModule, bool isEdit );
   virtual ~HYDROGUI_PolylineOp();
 
+  void                       deleteSelected();
+  bool                       deleteEnabled();
+
 protected:
   virtual void               startOperation();
   virtual void               abortOperation();