From dda6566adf314492b6f30a017050985022185c49 Mon Sep 17 00:00:00 2001 From: nkv Date: Mon, 9 Jun 2008 09:36:18 +0000 Subject: [PATCH] Move navigation preferences to Salome page --- src/LightApp/LightApp_Application.cxx | 8 ++++---- src/SVTK/SVTK_MainWindow.cxx | 21 +++++++++++++-------- src/SVTK/SVTK_ViewModel.cxx | 4 ++++ 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index 3bdc1cb19..1e0f9eb8b 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -1303,7 +1303,7 @@ SUIT_ViewManager* LightApp_Application::createViewManager( const QString& vmType resMgr->integerValue( "VTKViewer", "speed_mode", vm->incrementalSpeedMode() ) ); vm->setSpacemouseButtons( resMgr->integerValue( "VTKViewer", "spacemouse_func1_btn", vm->spacemouseBtn(1) ), resMgr->integerValue( "VTKViewer", "spacemouse_func2_btn", vm->spacemouseBtn(2) ), - resMgr->integerValue( "VTKViewer", "spacemouse_func3_btn", vm->spacemouseBtn(3) ) ); + resMgr->integerValue( "VTKViewer", "spacemouse_func5_btn", vm->spacemouseBtn(3) ) ); new LightApp_VTKSelector( vm, mySelMgr ); vm->connectToApplication(this); } @@ -1851,7 +1851,7 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref ) "spacemouse_func2_btn" ); //increase_speed_increment int spacemousePref3 = pref->addPreference( tr( "PREF_SPACEMOUSE_FUNC_3" ), vtkSM, LightApp_Preferences::Selector, "VTKViewer", - "spacemouse_func3_btn" ); //dominant_combined_switch + "spacemouse_func5_btn" ); //dominant_combined_switch QStringList values; values.append( tr( "PREF_SPACEMOUSE_BTN_1" ) ); @@ -2161,11 +2161,11 @@ void LightApp_Application::preferencesChanged( const QString& sec, const QString #ifndef DISABLE_VTKVIEWER if ( sec == QString( "VTKViewer" ) && (param == QString( "spacemouse_func1_btn" ) || param == QString( "spacemouse_func2_btn" ) || - param == QString( "spacemouse_func3_btn" ) ) ) + param == QString( "spacemouse_func5_btn" ) ) ) { int btn1 = resMgr->integerValue( "VTKViewer", "spacemouse_func1_btn", 1 ); int btn2 = resMgr->integerValue( "VTKViewer", "spacemouse_func2_btn", 2 ); - int btn3 = resMgr->integerValue( "VTKViewer", "spacemouse_func3_btn", 9 ); + int btn3 = resMgr->integerValue( "VTKViewer", "spacemouse_func5_btn", 9 ); QList lst; #ifndef DISABLE_SALOMEOBJECT viewManagers( SVTK_Viewer::Type(), lst ); diff --git a/src/SVTK/SVTK_MainWindow.cxx b/src/SVTK/SVTK_MainWindow.cxx index da9e4b5ae..b9ca147a7 100644 --- a/src/SVTK/SVTK_MainWindow.cxx +++ b/src/SVTK/SVTK_MainWindow.cxx @@ -781,21 +781,26 @@ void SVTK_MainWindow::activateWindowFit() void SVTK_MainWindow::onSwitchInteractionStyle(bool theOn) { if (theOn) { - // keep the same style extensions - SVTK_InteractorStyle* aStyle = (SVTK_InteractorStyle*)GetInteractorStyle(); - if ( aStyle ) { - myKeyFreeInteractorStyle->SetControllerIncrement(aStyle->ControllerIncrement()); - myKeyFreeInteractorStyle->SetControllerOnKeyDown(aStyle->ControllerOnKeyDown()); + // check if style is already set + if ( GetInteractorStyle() != myKeyFreeInteractorStyle.GetPointer() ) + { + // keep the same style extensions + SVTK_InteractorStyle* aStyle = (SVTK_InteractorStyle*)GetInteractorStyle(); + if ( aStyle ) { + myKeyFreeInteractorStyle->SetControllerIncrement(aStyle->ControllerIncrement()); + myKeyFreeInteractorStyle->SetControllerOnKeyDown(aStyle->ControllerOnKeyDown()); + } + + PushInteractorStyle(myKeyFreeInteractorStyle.GetPointer()); } - - PushInteractorStyle(myKeyFreeInteractorStyle.GetPointer()); } else { PopInteractorStyle(); } // update action state if method is called outside - action(SwitchInteractionStyleId)->setChecked( theOn ); + QtxAction* a = action( SwitchInteractionStyleId ); + if ( a->isChecked() != theOn ) a->setChecked( theOn ); } /*! diff --git a/src/SVTK/SVTK_ViewModel.cxx b/src/SVTK/SVTK_ViewModel.cxx index 7ccffe623..7a4a04940 100644 --- a/src/SVTK/SVTK_ViewModel.cxx +++ b/src/SVTK/SVTK_ViewModel.cxx @@ -130,6 +130,10 @@ SUIT_ViewWindow* SVTK_Viewer::createView( SUIT_Desktop* theDesktop ) aViewWindow->setBackgroundColor( backgroundColor() ); aViewWindow->SetTrihedronSize( trihedronSize(), trihedronRelative() ); + aViewWindow->SetProjectionMode( projectionMode() ); + aViewWindow->SetInteractionStyle( interactionStyle() ); + aViewWindow->SetIncrementalSpeed( incrementalSpeed(), incrementalSpeedMode() ); + aViewWindow->SetSpacemouseButtons( spacemouseBtn(1), spacemouseBtn(2), spacemouseBtn(3) ); connect(aViewWindow, SIGNAL( actorAdded(VTKViewer_Actor*) ), this, SLOT(onActorAdded(VTKViewer_Actor*))); -- 2.39.2