From: mzn Date: Tue, 20 Dec 2005 11:59:35 +0000 (+0000) Subject: Fix for bug PAL10982 ( T_3_1_0pre: can't change the trihedron size of a VTK view ). X-Git-Tag: T_Before_Join_BR_3_1_0deb~19 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=603049fa7d8608203d7ab387f1fe057e2b8cdb68;p=modules%2Fgui.git Fix for bug PAL10982 ( T_3_1_0pre: can't change the trihedron size of a VTK view ). --- diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index 475b2763b..3aa523b1c 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -1504,6 +1504,7 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref ) int vtkTS = pref->addPreference( tr( "PREF_TRIHEDRON_SIZE" ), vtkGroup, LightApp_Preferences::IntSpin, "VTKViewer", "trihedron_size" ); + pref->addPreference( tr( "PREF_RELATIVE_SIZE" ), vtkGroup, LightApp_Preferences::Bool, "VTKViewer", "relative_size" ); pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), vtkGroup, LightApp_Preferences::Color, "VTKViewer", "background" ); @@ -1612,9 +1613,9 @@ void LightApp_Application::preferencesChanged( const QString& sec, const QString } } - if ( sec == QString( "VTKViewer" ) && param == QString( "trihedron_size" ) ) + if ( sec == QString( "VTKViewer" ) && (param == QString( "trihedron_size" ) || param == QString( "relative_size" )) ) { - int sz = resMgr->integerValue( sec, param, -1 ); + int sz = resMgr->integerValue( "VTKViewer", "trihedron_size", -1 ); QPtrList lst; viewManagers( SVTK_Viewer::Type(), lst ); for ( QPtrListIterator it( lst ); it.current() && sz >= 0; ++it ) diff --git a/src/SVTK/SVTK_ViewWindow.cxx b/src/SVTK/SVTK_ViewWindow.cxx index cbe8d968c..6ee41df13 100755 --- a/src/SVTK/SVTK_ViewWindow.cxx +++ b/src/SVTK/SVTK_ViewWindow.cxx @@ -749,9 +749,6 @@ int SVTK_ViewWindow::GetTrihedronSize() const void SVTK_ViewWindow::SetTrihedronSize( const int sz ) { - if ( myTrihedronSize == sz ) - return; - myTrihedronSize = sz; AdjustTrihedrons( true ); } @@ -774,8 +771,12 @@ SVTK_ViewWindow myCubeAxes->GetBounds(bnd); int aVisibleNum = myTrihedron->GetVisibleActorCount( myRenderer ); + + SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); + bool isRelativeSize = aResMgr->booleanValue( "VTKViewer", "relative_size", true ); + //if (aVisibleNum || theIsForcedUpdate) { - if (aVisibleNum) { + if (aVisibleNum || !isRelativeSize) { // if the new trihedron size have sufficient difference, then apply the value double aNewSize = 100, anOldSize=myTrihedron->GetSize(); bool aTDisplayed = isTrihedronDisplayed(); @@ -783,13 +784,16 @@ SVTK_ViewWindow if(aTDisplayed) myTrihedron->VisibilityOff(); if(aCDisplayed) myCubeAxes->VisibilityOff(); - SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); - QString aSetting = aResMgr->stringValue("Viewer", "TrihedronSize", "105"); - static float aSizeInPercents = aSetting.toFloat(); - + int aDefaultSize = 100; + if (isRelativeSize) aDefaultSize = 105; + int aSizeFromPreferences = aResMgr->integerValue( "VTKViewer", "trihedron_size", aDefaultSize ); + //bool isComputeTrihedronSize = - ::ComputeTrihedronSize(myRenderer, aNewSize, anOldSize, aSizeInPercents); - + if (isRelativeSize) + ::ComputeTrihedronSize(myRenderer, aNewSize, anOldSize, (float)aSizeFromPreferences); + else + aNewSize = (double)aSizeFromPreferences; + myTrihedron->SetSize( aNewSize ); // iterate through displayed objects and set size if necessary diff --git a/src/SalomeApp/resources/SalomeApp.xml b/src/SalomeApp/resources/SalomeApp.xml index 5b525482a..b32780274 100644 --- a/src/SalomeApp/resources/SalomeApp.xml +++ b/src/SalomeApp/resources/SalomeApp.xml @@ -101,7 +101,8 @@
- + +