From: vsr Date: Mon, 7 Dec 2009 14:08:51 +0000 (+0000) Subject: Notebook component visibility in the Object Browser X-Git-Tag: PHASE_17_Part1_V3~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f62ee351a248baffe2c2c30a541ead52baaca360;p=modules%2Fgui.git Notebook component visibility in the Object Browser --- diff --git a/src/SalomeApp/SalomeApp_Application.cxx b/src/SalomeApp/SalomeApp_Application.cxx index 07ce76db3..71f9c3fd9 100644 --- a/src/SalomeApp/SalomeApp_Application.cxx +++ b/src/SalomeApp/SalomeApp_Application.cxx @@ -876,6 +876,9 @@ void SalomeApp_Application::createPreferences( LightApp_Preferences* pref ) pref->addPreference( tr( QString().sprintf( "OBJ_BROWSER_COLUMN_%d", i-1 ).toLatin1() ), defCols, LightApp_Preferences::Bool, "ObjectBrowser", QString().sprintf( "visibility_column_id_%d", i ) ); } + int nbGrp = pref->addPreference( tr( "PREF_NOTEBOOK" ), obTab ); + pref->addPreference( tr( "SHOW_NOTEBOOK" ), nbGrp, LightApp_Preferences::Bool, "ObjectBrowser", "show_notebook" ); + pref->setItemProperty( "orientation", Qt::Vertical, defCols ); // adding preference to LightApp_Application handled preferences.. a bit of hacking with resources.. @@ -884,6 +887,16 @@ void SalomeApp_Application::createPreferences( LightApp_Preferences* pref ) pref->addPreference( tr( "PREF_STORE_VISUAL_STATE" ), studyGroup, LightApp_Preferences::Bool, "Study", "store_visual_state" ); } +/*! Called when application preferenes are changed */ +void SalomeApp_Application::preferencesChanged( const QString& section, const QString& param ) +{ + if ( section == "ObjectBrowser" ) { + if ( param == "show_notebook" ) { + updateObjectBrowser( false ); + } + } +} + /*!Update desktop title.*/ void SalomeApp_Application::updateDesktopTitle() { QString aTitle = applicationName(); diff --git a/src/SalomeApp/SalomeApp_Application.h b/src/SalomeApp/SalomeApp_Application.h index e6a584330..4b987fe99 100644 --- a/src/SalomeApp/SalomeApp_Application.h +++ b/src/SalomeApp/SalomeApp_Application.h @@ -130,6 +130,7 @@ protected: virtual void onSelectionChanged(); virtual void createPreferences( LightApp_Preferences* ); + virtual void preferencesChanged( const QString&, const QString& ); virtual bool closeAction( const int, bool& ); virtual int closeChoice( const QString& ); diff --git a/src/SalomeApp/SalomeApp_DataModel.cxx b/src/SalomeApp/SalomeApp_DataModel.cxx index 1548ff23b..5f82aa421 100644 --- a/src/SalomeApp/SalomeApp_DataModel.cxx +++ b/src/SalomeApp/SalomeApp_DataModel.cxx @@ -29,6 +29,8 @@ #include "SalomeApp_Module.h" #include "SalomeApp_Application.h" +#include +#include #include #include @@ -65,6 +67,7 @@ private: private: _PTR( Study ) myStudy; SUIT_DataObject* myRoot; + bool myShowNoteBook; }; /*! @@ -74,6 +77,7 @@ SalomeApp_DataModelSync::SalomeApp_DataModelSync( _PTR( Study ) aStudy, SUIT_Dat : myStudy( aStudy ), myRoot( aRoot ) { + myShowNoteBook = SUIT_Session::session()->resourceMgr()->booleanValue( "ObjectBrowser", "show_notebook", false ); } /*! @@ -90,6 +94,8 @@ bool SalomeApp_DataModelSync::isCorrect( const kerPtr& so ) const _PTR(AttributeDrawable) aAttrDraw = anAttr; isDraw = aAttrDraw->IsDrawable(); } + _PTR(SComponent) aSComp( so ); + if ( aSComp && aSComp->ComponentDataType() == "NOTEBOOK" && !myShowNoteBook ) return false; bool res = so && ( so->GetName().size() || so->ReferencedObject( refObj ) ) && isDraw; return res; } diff --git a/src/SalomeApp/resources/SalomeApp.xml b/src/SalomeApp/resources/SalomeApp.xml index 956a3a13c..54fce23f0 100644 --- a/src/SalomeApp/resources/SalomeApp.xml +++ b/src/SalomeApp/resources/SalomeApp.xml @@ -105,14 +105,15 @@
- - - - + + + + +
diff --git a/src/SalomeApp/resources/SalomeApp_msg_en.ts b/src/SalomeApp/resources/SalomeApp_msg_en.ts index 400c9e794..1971b2a3b 100644 --- a/src/SalomeApp/resources/SalomeApp_msg_en.ts +++ b/src/SalomeApp/resources/SalomeApp_msg_en.ts @@ -331,6 +331,14 @@ Do you want to reload it ? ACTIVATE_MODULE_OP_LOAD &Load... + + PREF_NOTEBOOK + Notebook + + + SHOW_NOTEBOOK + Show Notebook item + SalomeApp_StudyPropertiesDlg