From 94e3ceeb7868d36eecc152bd273090af06a05991 Mon Sep 17 00:00:00 2001 From: asv Date: Thu, 4 May 2006 08:10:23 +0000 Subject: [PATCH] Interface of action() virtual function has changed: now it returns bool. 'true' return value means that the event (key accelerator action) is handled and should NOT be passed further, 'false' -- event is NOT handled. --- src/SOCC/SOCC_ViewWindow.cxx | 5 +++-- src/SOCC/SOCC_ViewWindow.h | 2 +- src/SVTK/SVTK_ViewWindow.cxx | 5 ++++- src/SVTK/SVTK_ViewWindow.h | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/SOCC/SOCC_ViewWindow.cxx b/src/SOCC/SOCC_ViewWindow.cxx index 56616e8ce..444b6ef74 100644 --- a/src/SOCC/SOCC_ViewWindow.cxx +++ b/src/SOCC/SOCC_ViewWindow.cxx @@ -44,7 +44,7 @@ SOCC_ViewWindow Performs action \param theAction - type of action */ -void +bool SOCC_ViewWindow ::action( const int theAction ) { @@ -98,5 +98,6 @@ SOCC_ViewWindow myViewPort->rotate( cx, cy + inc ); myViewPort->endRotation(); break; - } + } + return true; } diff --git a/src/SOCC/SOCC_ViewWindow.h b/src/SOCC/SOCC_ViewWindow.h index 7b4f22551..413ee469d 100644 --- a/src/SOCC/SOCC_ViewWindow.h +++ b/src/SOCC/SOCC_ViewWindow.h @@ -35,7 +35,7 @@ public: virtual ~SOCC_ViewWindow(); protected: - virtual void action( const int ); + virtual bool action( const int ); }; diff --git a/src/SVTK/SVTK_ViewWindow.cxx b/src/SVTK/SVTK_ViewWindow.cxx index 19c045751..346345fe3 100755 --- a/src/SVTK/SVTK_ViewWindow.cxx +++ b/src/SVTK/SVTK_ViewWindow.cxx @@ -735,16 +735,19 @@ int convertAction( const int accelAction ) Performs action \param accelAction - action */ -void +bool SVTK_ViewWindow ::action( const int accelAction ) { + if ( !myMainWindow->hasFocus() ) + return false; if ( accelAction == SUIT_Accel::ZoomFit ) onFitAll(); else { int anEvent = convertAction( accelAction ); myMainWindow->InvokeEvent( anEvent, 0 ); } + return true; } // old visual parameters had 13 values. New format added additional diff --git a/src/SVTK/SVTK_ViewWindow.h b/src/SVTK/SVTK_ViewWindow.h index 51e50ac45..1f53bf7d2 100755 --- a/src/SVTK/SVTK_ViewWindow.h +++ b/src/SVTK/SVTK_ViewWindow.h @@ -343,7 +343,7 @@ protected: doSetVisualParameters( const QString& ); QImage dumpView(); - virtual void action( const int ); + virtual bool action( const int ); SVTK_View* myView; SVTK_MainWindow* myMainWindow; -- 2.39.2