From 88b0c459e092839cb9e5968f651718642f536855 Mon Sep 17 00:00:00 2001 From: dmv Date: Tue, 2 Dec 2008 09:20:45 +0000 Subject: [PATCH] IPAL20121 there are no tool tips for new controls of "View Operations" toolbar. --- src/SVTK/SVTK_ViewWindow.cxx | 39 ++++++++++++++++++++++--------- src/SVTK/SVTK_ViewWindow.h | 4 ++-- src/SVTK/resources/SVTK_msg_en.ts | 16 +++++++++---- 3 files changed, 42 insertions(+), 17 deletions(-) diff --git a/src/SVTK/SVTK_ViewWindow.cxx b/src/SVTK/SVTK_ViewWindow.cxx index 3093d1ba5..0d7348f42 100755 --- a/src/SVTK/SVTK_ViewWindow.cxx +++ b/src/SVTK/SVTK_ViewWindow.cxx @@ -674,8 +674,10 @@ void SVTK_ViewWindow::activateStartFocalPointSelection() void SVTK_ViewWindow::activateProjectionMode(int theMode) { - SVTK_ComboAction* a = ::qobject_cast( toolMgr()->action( ProjectionModeId ) ); - if ( a ) a->setCurrentIndex(theMode); + if (theMode) + toolMgr()->action( ProjectionModeId )->setChecked( true ); + else + toolMgr()->action( ParallelModeId )->setChecked( true ); } /*! @@ -1504,10 +1506,10 @@ void SVTK_ViewWindow::activateStartPointSelection() /*! Set the view projection mode: orthogonal or perspective */ -void SVTK_ViewWindow::onProjectionMode(int mode) +void SVTK_ViewWindow::onPerspectiveMode() { vtkCamera* aCamera = getRenderer()->GetActiveCamera(); - aCamera->SetParallelProjection(mode==0); + aCamera->SetParallelProjection(toolMgr()->action( ParallelModeId )->isChecked()); GetInteractor()->GetDevice()->CreateTimer(VTKI_TIMER_FIRST); } @@ -1675,13 +1677,26 @@ void SVTK_ViewWindow::createActions(SUIT_ResourceMgr* theResourceMgr) connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onUpdateRate(bool))); mgr->registerAction( anAction, UpdateRate ); - // Set projection mode - SVTK_ComboAction* aModeAction = new SVTK_ComboAction(tr("MNU_SVTK_PROJECTION_MODE"), this); - aModeAction->setStatusTip(tr("DSC_SVTK_PROJECTION_MODE")); - aModeAction->insertItem(theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_SVTK_VIEW_PARALLEL" ) ) ); - aModeAction->insertItem(theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_SVTK_VIEW_PERSPECTIVE" ) ) ); - connect(aModeAction, SIGNAL(triggered(int)), this, SLOT(onProjectionMode(int))); - mgr->registerAction( aModeAction, ProjectionModeId ); + // Set perspective mode group + anAction = new QtxAction(tr("MNU_SVTK_PARALLEL_MODE"), + theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_SVTK_VIEW_PARALLEL" ) ), + tr( "MNU_SVTK_PARALLEL_MODE" ), 0, this); + anAction->setStatusTip(tr("DSC_SVTK_PARALLEL_MODE")); + anAction->setCheckable(true); + connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onPerspectiveMode())); + mgr->registerAction( anAction, ParallelModeId ); + + anAction = new QtxAction(tr("MNU_SVTK_PERSPECTIVE_MODE"), + theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_SVTK_VIEW_PERSPECTIVE" ) ), + tr( "MNU_SVTK_PERSPECTIVE_MODE" ), 0, this); + anAction->setStatusTip(tr("DSC_SVTK_PERSPECTIVE_MODE")); + anAction->setCheckable(true); + connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onPerspectiveMode())); + mgr->registerAction( anAction, ProjectionModeId ); + + QActionGroup* aPerspectiveGroup = new QActionGroup( this ); + aPerspectiveGroup->addAction( mgr->action( ParallelModeId ) ); + aPerspectiveGroup->addAction( mgr->action( ProjectionModeId ) ); // View Parameters anAction = new QtxAction(tr("MNU_VIEWPARAMETERS_VIEW"), @@ -1779,6 +1794,8 @@ void SVTK_ViewWindow::createToolBar() mgr->append( GraduatedAxes, myToolBar ); mgr->append( ViewParametersId, myToolBar ); + mgr->append( toolMgr()->separator(), myToolBar ); + mgr->append( ParallelModeId, myToolBar ); mgr->append( ProjectionModeId, myToolBar ); mgr->append( StartRecordingId, myRecordingToolBar ); diff --git a/src/SVTK/SVTK_ViewWindow.h b/src/SVTK/SVTK_ViewWindow.h index 0b5f2014a..92a4dbc0f 100755 --- a/src/SVTK/SVTK_ViewWindow.h +++ b/src/SVTK/SVTK_ViewWindow.h @@ -271,7 +271,7 @@ public slots: void activatePanning(); void activateGlobalPanning(); - void onProjectionMode(int mode); + void onPerspectiveMode(); void activateProjectionMode(int); @@ -358,7 +358,7 @@ protected: ChangeRotationPointId, RotationId, FrontId, BackId, TopId, BottomId, LeftId, RightId, ResetId, ViewTrihedronId, NonIsometric, GraduatedAxes, UpdateRate, - ProjectionModeId, ViewParametersId, SwitchInteractionStyleId, + ParallelModeId, ProjectionModeId, ViewParametersId, SwitchInteractionStyleId, StartRecordingId, PlayRecordingId, PauseRecordingId, StopRecordingId }; diff --git a/src/SVTK/resources/SVTK_msg_en.ts b/src/SVTK/resources/SVTK_msg_en.ts index e8467cd57..bbaa60f87 100644 --- a/src/SVTK/resources/SVTK_msg_en.ts +++ b/src/SVTK/resources/SVTK_msg_en.ts @@ -162,12 +162,20 @@ Change the parameters of the view - MNU_SVTK_PROJECTION_MODE - Projection Mode + MNU_SVTK_PARALLEL_MODE + Orthogonal Mode + + + DSC_SVTK_PARALLEL_MODE + Set the orthogonal projection type + + + MNU_SVTK_PERSPECTIVE_MODE + Perspective Mode - DSC_SVTK_PROJECTION_MODE - Set orthogonal or perspective projection of the view + DSC_SVTK_PERSPECTIVE_MODE + Set the perspective projection type DSC_SVTK_STYLE_SWITCH -- 2.39.2