From 7473b9dca013c62acf37056591e9d2629546883b Mon Sep 17 00:00:00 2001 From: asv Date: Wed, 1 Mar 2006 15:16:33 +0000 Subject: [PATCH] implemented preferences for visual parameters --- src/SalomeApp/SalomeApp_Application.cxx | 5 +++++ src/SalomeApp/SalomeApp_VisualState.cxx | 9 +++++++++ src/SalomeApp/resources/SalomeApp.xml | 3 ++- src/SalomeApp/resources/SalomeApp_msg_en.po | 3 +++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/SalomeApp/SalomeApp_Application.cxx b/src/SalomeApp/SalomeApp_Application.cxx index 3baab9935..3e605fe86 100644 --- a/src/SalomeApp/SalomeApp_Application.cxx +++ b/src/SalomeApp/SalomeApp_Application.cxx @@ -624,6 +624,11 @@ void SalomeApp_Application::createPreferences( LightApp_Preferences* pref ) LightApp_Preferences::Bool, "ObjectBrowser", QString().sprintf( "visibility_column_%d", i ) ); } pref->setItemProperty( defCols, "columns", 1 ); + + // adding preference to LightApp_Application handled preferences.. a bit of hacking with resources.. + int genTab = pref->addPreference( LightApp_Application::tr( "PREF_TAB_GENERAL" ), salomeCat ); + int studyGroup = pref->addPreference( LightApp_Application::tr( "PREF_GROUP_STUDY" ), genTab ); + pref->addPreference( tr( "PREF_STORE_VISUAL_STATE" ), studyGroup, LightApp_Preferences::Bool, "Study", "store_visual_state" ); } /*!Update desktop title.*/ diff --git a/src/SalomeApp/SalomeApp_VisualState.cxx b/src/SalomeApp/SalomeApp_VisualState.cxx index 937a3e98e..cdb521e2d 100644 --- a/src/SalomeApp/SalomeApp_VisualState.cxx +++ b/src/SalomeApp/SalomeApp_VisualState.cxx @@ -22,6 +22,7 @@ #include "SalomeApp_Study.h" #include "SalomeApp_Application.h" +#include #include #include @@ -95,6 +96,10 @@ void nameViewWindows( const ViewManagerList& lst ) //================================================================ int SalomeApp_VisualState::storeState() { + bool store = myApp->resourceMgr()->booleanValue( "Study", "store_visual_state", true ); + if ( !store ) + return -1; + SalomeApp_Study* study = dynamic_cast( myApp->activeStudy() ); if ( !study ) return -1; @@ -172,6 +177,10 @@ int SalomeApp_VisualState::storeState() //================================================================ void SalomeApp_VisualState::restoreState(int savePoint) { + bool store = myApp->resourceMgr()->booleanValue( "Study", "store_visual_state", true ); + if ( !store ) + return; + SalomeApp_Study* study = dynamic_cast( myApp->activeStudy() ); if ( !study ) return; diff --git a/src/SalomeApp/resources/SalomeApp.xml b/src/SalomeApp/resources/SalomeApp.xml index 8644a5a14..0e0e304d6 100644 --- a/src/SalomeApp/resources/SalomeApp.xml +++ b/src/SalomeApp/resources/SalomeApp.xml @@ -59,7 +59,8 @@
- + +
diff --git a/src/SalomeApp/resources/SalomeApp_msg_en.po b/src/SalomeApp/resources/SalomeApp_msg_en.po index 9be7820a0..ae0693c42 100644 --- a/src/SalomeApp/resources/SalomeApp_msg_en.po +++ b/src/SalomeApp/resources/SalomeApp_msg_en.po @@ -102,6 +102,9 @@ msgstr "Activate Module" msgid "SalomeApp_Application::MEN_DELETE_INVALID_REFERENCE" msgstr "Delete Invalid Reference" +msgid "SalomeApp_Application::PREF_STORE_VISUAL_STATE" +msgstr "Store visual parameters" + //======================================================================================= msgid "PUBLISH_IN_STUDY" -- 2.39.2