]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Notebook component visibility in the Object Browser
authorvsr <vsr@opencascade.com>
Mon, 7 Dec 2009 14:08:51 +0000 (14:08 +0000)
committervsr <vsr@opencascade.com>
Mon, 7 Dec 2009 14:08:51 +0000 (14:08 +0000)
src/SalomeApp/SalomeApp_Application.cxx
src/SalomeApp/SalomeApp_Application.h
src/SalomeApp/SalomeApp_DataModel.cxx
src/SalomeApp/resources/SalomeApp.xml
src/SalomeApp/resources/SalomeApp_msg_en.ts

index 07ce76db3c586caaaeb0a4ec7072cefd69e3676d..71f9c3fd910e16cf1218899d4f7b11986124cf02 100644 (file)
@@ -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();
index e6a584330639a55bf932ba7af7f82f5c8133fedd..4b987fe992b2b3b68a10e0d8d690ffdf6aab93e1 100644 (file)
@@ -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& );
index 1548ff23b8ef3b91691c20ae49911314ff142620..5f82aa421d219162435bd3d5464a393a69f6a528 100644 (file)
@@ -29,6 +29,8 @@
 #include "SalomeApp_Module.h"
 #include "SalomeApp_Application.h"
 
+#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
 #include <CAM_DataObject.h>
 
 #include <SUIT_TreeSync.h>
@@ -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;
 }
index 956a3a13c7c4cdc2a7a3d5dc0070abc9bf4359ff..54fce23f0bad9e0a53219ded422561095722cdb3 100644 (file)
   </section>
   <section name="ObjectBrowser" >
     <!-- Object Browser preferences -->
-    <parameter name="auto_hide_search_tool" value="true" />
-    <parameter name="auto_size"             value="false" />
-    <parameter name="auto_size_first"       value="true"  />
-    <parameter name="resize_on_expand_item" value="false"  />
+    <parameter name="auto_hide_search_tool"  value="true" />
+    <parameter name="auto_size"              value="false" />
+    <parameter name="auto_size_first"        value="true"  />
+    <parameter name="resize_on_expand_item"  value="false"  />
     <parameter name="visibility_column_id_1" value="false"  />
     <parameter name="visibility_column_id_2" value="false" />
     <parameter name="visibility_column_id_3" value="false" />
     <parameter name="visibility_column_id_4" value="false" />
+    <parameter name="show_notebook"          value="false" />
   </section>
   <section name="PyConsole">
     <!-- Python console preferences -->
index 400c9e794d530c3bda801fbc88f8fb1e63713b77..1971b2a3b84d116bade237f3f499cd1bef412443 100644 (file)
@@ -331,6 +331,14 @@ Do you want to reload it ?</translation>
         <source>ACTIVATE_MODULE_OP_LOAD</source>
         <translation>&amp;Load...</translation>
     </message>
+    <message>
+        <source>PREF_NOTEBOOK</source>
+        <translation>Notebook</translation>
+    </message>
+    <message>
+        <source>SHOW_NOTEBOOK</source>
+        <translation>Show Notebook item</translation>
+    </message>
 </context>
 <context>
     <name>SalomeApp_StudyPropertiesDlg</name>