From 931d822245bc349d80eca7ff89b89dcc918c49ea Mon Sep 17 00:00:00 2001 From: asl Date: Wed, 20 Sep 2017 14:40:08 +0300 Subject: [PATCH] refs #1335: delete profile point via keyboard "Delete" --- src/HYDROGUI/HYDROGUI_DeleteOp.cxx | 16 ++++++++++++++++ src/HYDROGUI/HYDROGUI_ProfileOp.cxx | 10 ++++++++++ src/HYDROGUI/HYDROGUI_ProfileOp.h | 2 ++ 3 files changed, 28 insertions(+) diff --git a/src/HYDROGUI/HYDROGUI_DeleteOp.cxx b/src/HYDROGUI/HYDROGUI_DeleteOp.cxx index 8425cb1d..7164ea8a 100644 --- a/src/HYDROGUI/HYDROGUI_DeleteOp.cxx +++ b/src/HYDROGUI/HYDROGUI_DeleteOp.cxx @@ -23,6 +23,7 @@ #include "HYDROGUI_Tool.h" #include "HYDROGUI_Tool2.h" #include "HYDROGUI_UpdateFlags.h" +#include "HYDROGUI_ProfileOp.h" #include #include @@ -31,6 +32,7 @@ #include #include +#include #include @@ -46,6 +48,20 @@ HYDROGUI_DeleteOp::~HYDROGUI_DeleteOp() void HYDROGUI_DeleteOp::startOperation() { + QList operations = study()->operations(); + int n = operations.size(); + if( n>=2 ) + { + SUIT_Operation* anOtherOp = operations[n-2]; + HYDROGUI_ProfileOp* aProfileOp = dynamic_cast( anOtherOp ); + if( aProfileOp ) + { + aProfileOp->deleteSelected(); + abort(); + return; + } + } + HYDROGUI_Operation::startOperation(); HYDROData_SequenceOfObjects aSeq = HYDROGUI_Tool::GetSelectedObjects( module() ); diff --git a/src/HYDROGUI/HYDROGUI_ProfileOp.cxx b/src/HYDROGUI/HYDROGUI_ProfileOp.cxx index 11a60f85..ab8f669b 100644 --- a/src/HYDROGUI/HYDROGUI_ProfileOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ProfileOp.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -279,3 +280,12 @@ void HYDROGUI_ProfileOp::erasePreview() } } } + +bool HYDROGUI_ProfileOp::isValid( SUIT_Operation* theOtherOp ) const +{ + HYDROGUI_DeleteOp* aDelOp = dynamic_cast( theOtherOp ); + if( aDelOp ) + return true; + else + return false; +} diff --git a/src/HYDROGUI/HYDROGUI_ProfileOp.h b/src/HYDROGUI/HYDROGUI_ProfileOp.h index b9590309..2d773d8e 100644 --- a/src/HYDROGUI/HYDROGUI_ProfileOp.h +++ b/src/HYDROGUI/HYDROGUI_ProfileOp.h @@ -36,6 +36,8 @@ public: void deleteSelected(); bool deleteEnabled(); + virtual bool isValid( SUIT_Operation* theOtherOp ) const; + protected: virtual void startOperation(); virtual void abortOperation(); -- 2.39.2