From 43d6157a180d90a91a00e9086bbbe4c1ea5c7ab0 Mon Sep 17 00:00:00 2001 From: rnv Date: Fri, 23 May 2014 13:00:40 +0400 Subject: [PATCH] Implementation of the "22589: EDF 8048 - ergonomics of SMESH" issue. --- src/OCCViewer/OCCViewer_ViewWindow.cxx | 8 +++++--- src/OCCViewer/OCCViewer_ViewWindow.h | 2 +- src/SALOME_PY/SalomePy.cxx | 2 +- src/SVTK/SVTK_Renderer.cxx | 12 ++++++++++++ src/SVTK/SVTK_Renderer.h | 5 +++++ src/SVTK/SVTK_ViewWindow.cxx | 9 ++++++--- src/SVTK/SVTK_ViewWindow.h | 2 +- 7 files changed, 31 insertions(+), 9 deletions(-) diff --git a/src/OCCViewer/OCCViewer_ViewWindow.cxx b/src/OCCViewer/OCCViewer_ViewWindow.cxx index 96e15b488..ed1d3c1db 100755 --- a/src/OCCViewer/OCCViewer_ViewWindow.cxx +++ b/src/OCCViewer/OCCViewer_ViewWindow.cxx @@ -1283,8 +1283,10 @@ void OCCViewer_ViewWindow::createActions() if (myModel->trihedronActivated()) { aAction = new QtxAction(tr("MNU_SHOW_TRIHEDRE"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_TRIHEDRON" ) ), tr( "MNU_SHOW_TRIHEDRE" ), 0, this); + aAction->setCheckable( true ); + aAction->setChecked( true ); aAction->setStatusTip(tr("DSC_SHOW_TRIHEDRE")); - connect(aAction, SIGNAL(triggered()), this, SLOT(onTrihedronShow())); + connect(aAction, SIGNAL(toggled(bool)), this, SLOT(onTrihedronShow(bool))); toolMgr()->registerAction( aAction, TrihedronShowId ); } @@ -1790,9 +1792,9 @@ void OCCViewer_ViewWindow::setRestoreFlag() /*! \brief Called when action "show/hide trihedron" is activated. */ -void OCCViewer_ViewWindow::onTrihedronShow() +void OCCViewer_ViewWindow::onTrihedronShow(bool show) { - myModel->toggleTrihedron(); + myModel->setTrihedronShown(show); } /*! diff --git a/src/OCCViewer/OCCViewer_ViewWindow.h b/src/OCCViewer/OCCViewer_ViewWindow.h index 135d81c0d..421e43f04 100755 --- a/src/OCCViewer/OCCViewer_ViewWindow.h +++ b/src/OCCViewer/OCCViewer_ViewWindow.h @@ -260,7 +260,7 @@ public slots: virtual void onAmbientToogle(); virtual void onMemorizeView(); virtual void onRestoreView(); - virtual void onTrihedronShow(); + virtual void onTrihedronShow(bool); virtual void setRestoreFlag(); virtual void onSwitchInteractionStyle( bool on ); virtual void onSwitchZoomingStyle( bool on ); diff --git a/src/SALOME_PY/SalomePy.cxx b/src/SALOME_PY/SalomePy.cxx index 85286c91b..167941da8 100755 --- a/src/SALOME_PY/SalomePy.cxx +++ b/src/SALOME_PY/SalomePy.cxx @@ -372,7 +372,7 @@ extern "C" SALOMEPY_EXPORT PyObject* libSalomePy_showTrihedron( PyObject* self, { if( SVTK_ViewWindow* aVTKViewWindow = GetVTKViewWindow( __Find ) ) { if ( aVTKViewWindow->isTrihedronDisplayed() != myShow ) - aVTKViewWindow->onViewTrihedron(); + aVTKViewWindow->onViewTrihedron(myShow); } } }; diff --git a/src/SVTK/SVTK_Renderer.cxx b/src/SVTK/SVTK_Renderer.cxx index 8bbed3803..d5ccedbef 100644 --- a/src/SVTK/SVTK_Renderer.cxx +++ b/src/SVTK/SVTK_Renderer.cxx @@ -558,6 +558,18 @@ SVTK_Renderer myTrihedron->VisibilityOn(); } +/*! + Set trihedron visibility +*/ +void +SVTK_Renderer +::SetTrihedronVisibility( const bool show ) { + if(show) + myTrihedron->VisibilityOn(); + else + myTrihedron->VisibilityOff(); +} + /*! Adjust size of the trihedron to the bounding box of the scene */ diff --git a/src/SVTK/SVTK_Renderer.h b/src/SVTK/SVTK_Renderer.h index 91421aa4a..19e7f51e8 100644 --- a/src/SVTK/SVTK_Renderer.h +++ b/src/SVTK/SVTK_Renderer.h @@ -153,6 +153,11 @@ class SVTK_EXPORT SVTK_Renderer : public vtkObject void OnViewTrihedron(); + //! Set Toggle trihedron visibility + + void + SetTrihedronVisibility( const bool ); + //! Adjust size of the trihedron to the bounding box of the scene void OnAdjustTrihedron(); diff --git a/src/SVTK/SVTK_ViewWindow.cxx b/src/SVTK/SVTK_ViewWindow.cxx index 63ed448bc..d56dde955 100755 --- a/src/SVTK/SVTK_ViewWindow.cxx +++ b/src/SVTK/SVTK_ViewWindow.cxx @@ -799,9 +799,9 @@ bool SVTK_ViewWindow::isCubeAxesDisplayed() /*! Redirect the request to #SVTK_Renderer::OnViewTrihedron */ -void SVTK_ViewWindow::onViewTrihedron() +void SVTK_ViewWindow::onViewTrihedron(bool show) { - GetRenderer()->OnViewTrihedron(); + GetRenderer()->SetTrihedronVisibility(show); Repaint(); } @@ -2050,8 +2050,11 @@ void SVTK_ViewWindow::createActions(SUIT_ResourceMgr* theResourceMgr) anAction = new QtxAction(tr("MNU_SHOW_TRIHEDRON"), theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_TRIHEDRON" ) ), tr( "MNU_SHOW_TRIHEDRON" ), 0, this); + anAction->setCheckable( true ); + anAction->setChecked( true ); + anAction->setStatusTip(tr("DSC_SHOW_TRIHEDRON")); - connect(anAction, SIGNAL(activated()), this, SLOT(onViewTrihedron())); + connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onViewTrihedron(bool))); mgr->registerAction( anAction, ViewTrihedronId ); // onNonIsometric: Manage non-isometric params diff --git a/src/SVTK/SVTK_ViewWindow.h b/src/SVTK/SVTK_ViewWindow.h index 3ee736b38..ef6eb8a55 100755 --- a/src/SVTK/SVTK_ViewWindow.h +++ b/src/SVTK/SVTK_ViewWindow.h @@ -365,7 +365,7 @@ public slots: virtual void onFitAll(); //! Redirect the request to #SVTK_Renderer::OnViewTrihedron - virtual void onViewTrihedron(); + virtual void onViewTrihedron(bool); //! Redirect the request to #SVTK_Renderer::OnViewCubeAxes virtual void onViewCubeAxes(); -- 2.30.2