]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
refs #1335: delete profile point via keyboard "Delete"
authorasl <asl@opencascade.com>
Wed, 20 Sep 2017 11:40:08 +0000 (14:40 +0300)
committerasl <asl@opencascade.com>
Wed, 20 Sep 2017 11:40:08 +0000 (14:40 +0300)
src/HYDROGUI/HYDROGUI_DeleteOp.cxx
src/HYDROGUI/HYDROGUI_ProfileOp.cxx
src/HYDROGUI/HYDROGUI_ProfileOp.h

index 8425cb1d8e1181f7b6c4e1d0a97a51e5545414c5..7164ea8ad45a925b9ca6d48bdd2921d1edce5870 100644 (file)
@@ -23,6 +23,7 @@
 #include "HYDROGUI_Tool.h"
 #include "HYDROGUI_Tool2.h"
 #include "HYDROGUI_UpdateFlags.h"
+#include "HYDROGUI_ProfileOp.h"
 
 #include <HYDROData_Object.h>
 #include <HYDROData_Document.h>
@@ -31,6 +32,7 @@
 
 #include <SUIT_Desktop.h>
 #include <SUIT_MessageBox.h>
+#include <SUIT_Study.h>
 
 #include <QSet>
 
@@ -46,6 +48,20 @@ HYDROGUI_DeleteOp::~HYDROGUI_DeleteOp()
 
 void HYDROGUI_DeleteOp::startOperation()
 {
+  QList<SUIT_Operation*> operations = study()->operations();
+  int n = operations.size();
+  if( n>=2 )
+  {
+    SUIT_Operation* anOtherOp = operations[n-2];
+    HYDROGUI_ProfileOp* aProfileOp = dynamic_cast<HYDROGUI_ProfileOp*>( anOtherOp );
+    if( aProfileOp )
+    {
+      aProfileOp->deleteSelected();
+      abort();
+      return;
+    }
+  }
+
   HYDROGUI_Operation::startOperation();
 
   HYDROData_SequenceOfObjects aSeq = HYDROGUI_Tool::GetSelectedObjects( module() );
index 11a60f85217ae0411dd43c1cf4168220d1c7ce27..ab8f669b1de4579113c5cdbc1b4e589003b7d793 100644 (file)
@@ -25,6 +25,7 @@
 #include <HYDROData_Document.h>
 #include <HYDROData_Profile.h>
 #include <HYDROGUI_CurveCreatorProfile.h>
+#include <HYDROGUI_DeleteOp.h>
 #include <CurveCreator_Displayer.hxx>
 
 #include <LightApp_Application.h>
@@ -279,3 +280,12 @@ void HYDROGUI_ProfileOp::erasePreview()
     }
   }
 }
+
+bool HYDROGUI_ProfileOp::isValid( SUIT_Operation* theOtherOp ) const
+{
+  HYDROGUI_DeleteOp* aDelOp = dynamic_cast<HYDROGUI_DeleteOp*>( theOtherOp );
+  if( aDelOp )
+    return true;
+  else
+    return false;
+}
index b959030996d4b0fda1fc3cd72a110510146d7104..2d773d8e090d02658a6c396137f0dceaabecc6ca 100644 (file)
@@ -36,6 +36,8 @@ public:
   void                       deleteSelected();
   bool                       deleteEnabled();
 
+  virtual bool isValid( SUIT_Operation* theOtherOp ) const;
+
 protected:
   virtual void               startOperation();
   virtual void               abortOperation();