Salome HOME
Debug of CMake build procedure
[modules/gui.git] / src / LightApp / LightApp_Application.cxx
index 2b81c7a0b71f1ba8a724b09b2b445cc205b839dd..e6970b23f1ab05c57bb867e79a67664ae00294f8 100644 (file)
@@ -1,36 +1,48 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
 //
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 // File:      LightApp_Application.cxx
 // Created:   6/20/2005 18:39:45 PM
 // Author:    Natalia Donis
-//
+
+#ifdef WIN32
+// E.A. : On windows with python 2.6, there is a conflict
+// E.A. : between pymath.h and Standard_math.h which define
+// E.A. : some same symbols : acosh, asinh, ...
+  #include <Standard_math.hxx>
+  #ifndef DISABLE_PYCONSOLE
+    #include <pymath.h>
+  #endif
+#endif
+
 #ifndef DISABLE_PYCONSOLE
-  #include <PyConsole_Interp.h> // WARNING! This include must be the first!
+  #include "LightApp_PyInterp.h" // WARNING! This include must be the first!
   #include <PyConsole_Console.h>
 #endif
 
 #include "LightApp_Application.h"
 #include "LightApp_Module.h"
 #include "LightApp_DataModel.h"
+#include "LightApp_DataOwner.h"
 #include "LightApp_Study.h"
 #include "LightApp_Preferences.h"
 #include "LightApp_PreferencesDlg.h"
 #include "LightApp_AboutDlg.h"
 #include "LightApp_ModuleAction.h"
 // temporary commented
-//#include "LightApp_OBFilter.h"
 #include "LightApp_EventFilter.h"
 #include "LightApp_OBSelector.h"
 #include "LightApp_SelectionMgr.h"
 #include "LightApp_DataObject.h"
+#include "LightApp_WgViewModel.h"
+#include "LightApp_FullScreenHelper.h"
+
+
+#include <GUI_version.h>
+#include <Basics_OCCTVersion.hxx>
 
 #include <SALOME_Event.h>
 
@@ -59,6 +76,7 @@
 #include <SUIT_Study.h>
 #include <SUIT_FileDlg.h>
 #include <SUIT_ResourceMgr.h>
+#include <SUIT_ShortcutMgr.h>
 #include <SUIT_Tools.h>
 #include <SUIT_Accel.h>
 #include <SUIT_MessageBox.h>
@@ -73,6 +91,8 @@
 #include <QtxActionToolMgr.h>
 #include <QtxSearchTool.h>
 #include <QtxWorkstack.h>
+#include <QtxMap.h>
+#include <QtxWebBrowser.h>
 
 #include <LogWindow.h>
 
 #ifndef DISABLE_PLOT2DVIEWER
   #include <Plot2d_ViewManager.h>
   #include <Plot2d_ViewModel.h>
+  #include <Plot2d_ViewWindow.h>
+  #include <Plot2d_ViewFrame.h>
   #include "LightApp_Plot2dSelector.h"
 #ifndef DISABLE_SALOMEOBJECT
   #include <SPlot2d_ViewModel.h>
 #endif
 #endif
 
-#include <QxScene_ViewManager.h>
-#include <QxScene_ViewModel.h>
-#include <QxScene_ViewWindow.h>
-
 #ifndef DISABLE_OCCVIEWER
   #include <OCCViewer_ViewManager.h>
+  #include <OCCViewer_ViewFrame.h>
 #ifndef DISABLE_SALOMEOBJECT
   #include <SOCC_ViewModel.h>
 #else
   #include <VTKViewer_ViewModel.h>
 #endif
 
-//#ifndef DISABLE_SUPERVGRAPHVIEWER
-//  #include <SUPERVGraph_ViewModel.h>
-//  #include <SUPERVGraph_ViewFrame.h>
-//  #include <SUPERVGraph_ViewManager.h>
-//#endif
-
 #ifndef DISABLE_QXGRAPHVIEWER
-  #include <QxGraph_ViewModel.h>
-  #include <QxGraph_ViewWindow.h>
-  #include <QxGraph_ViewManager.h>
+  #include <QxScene_ViewManager.h>
+  #include <QxScene_ViewModel.h>
+  #include <QxScene_ViewWindow.h>
+#endif
+
+#ifndef DISABLE_GRAPHICSVIEW
+  #include "GraphicsView_Viewer.h"
+  #include "GraphicsView_ViewManager.h"
+  #include "LightApp_GVSelector.h"
 #endif
 
+#define VISIBILITY_COLUMN_WIDTH 25
+
 #include <QDir>
 #include <QImage>
 #include <QString>
 #include <QByteArray>
 #include <QMenu>
 #include <QProcess>
+#include <QTimer>
+#include <QHeaderView>
+#include <QTreeView>
+#include <QMimeData>
+#include <QShortcut>
 
 #include <utilities.h>
 
   #include <SALOME_ListIO.hxx>
 #endif
 
+#include <Standard_Version.hxx>
+
 #define ToolBarMarker    0
 #define DockWidgetMarker 1
 
 static const char* imageEmptyIcon[] = {
 "20 20 1 1",
-".     c None",
+".      c None",
 "....................",
 "....................",
 "....................",
@@ -188,6 +216,55 @@ static const char* imageEmptyIcon[] = {
 
 int LightApp_Application::lastStudyId = 0;
 
+
+// Markers used to parse array with dockable windows and toolbars state.
+// For more details please see the qdockarealayout.cpp && qtoolbararealayout.cpp
+// in the Qt source code.
+
+#define QDockWidgetMarker 0xfd // = DockWidgetStateMarker
+#define QToolBarMarker 0xfc    // = ToolBarStateMarkerEx
+
+// Format of the Byte array with the windows and toolbar state is:
+// VersionMarker|version|DockWidgetStateMarker|nbDockWidgetLines|...DocWidgetData...|ToolBarStateMarkerEx|nbToolBarLines|...ToolBarData...
+
+//Find toolbar marker position in the array in the following way:
+//since the 'toolbar marker' is not unique, find index of first occurrence of the
+//'toolbar marker' in the array and check that next string is name of the toolbar
+
+int getToolbarMarkerIndex(QByteArray input, const QStringList& aFlags) {
+  int aResult = -1,tmp = 0;
+  int inputLen = input.length();
+  QDataStream anInputData(&input, QIODevice::ReadOnly);
+  while(tmp < inputLen) {
+      tmp = input.indexOf(QToolBarMarker, tmp + 1);
+      if(tmp < 0 )
+       break;
+      anInputData.device()->seek(tmp);
+      uchar mark;
+      anInputData>>mark;
+      int lines;
+      anInputData >> lines;
+
+      if(lines == 0 && anInputData.atEnd()){
+       //Case then array doesn't contain information about toolbars,
+       aResult = tmp;
+       break;
+      }
+
+      int pos;
+      anInputData >> pos;
+      int cnt;
+      anInputData >> cnt;
+      QString str;
+      anInputData>>str;
+      if(aFlags.contains(str)) {
+       aResult = tmp;
+       break;
+      }
+    }        
+  return aResult;
+}
+
 /*!
   \return last global id of study
 */
@@ -205,6 +282,7 @@ extern "C" LIGHTAPP_EXPORT SUIT_Application* createApplication()
 /*! \var global preferences of LightApp */
 LightApp_Preferences* LightApp_Application::_prefs_ = 0;
 
+
 /*!
   \class LightApp_Application
   Application containing LightApp module
@@ -213,15 +291,38 @@ LightApp_Preferences* LightApp_Application::_prefs_ = 0;
 /*!Constructor.*/
 LightApp_Application::LightApp_Application()
 : CAM_Application( false ),
-  myPrefs( 0 )
+  myPrefs( 0 ),
+  myScreenHelper(new LightApp_FullScreenHelper())
 {
+  Q_INIT_RESOURCE( LightApp );
+
   STD_TabDesktop* desk = new STD_TabDesktop();
+  desk->setFullScreenAllowed(false);
+  desk->setMinimizeAllowed(false);
 
   setDesktop( desk );
 
+  // initialize auto save timer
+  myAutoSaveTimer = new QTimer( this );
+  myAutoSaveTimer->setSingleShot( true );
+  connect( myAutoSaveTimer, SIGNAL( timeout() ), this, SLOT( onSaveDoc() ) );
+
   SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
   QPixmap aLogo = aResMgr->loadPixmap( "LightApp", tr( "APP_DEFAULT_ICO" ), false );
 
+  QtxWebBrowser::setResourceManager( aResMgr );
+  QtxWebBrowser::setData("browser:icon",          aResMgr->loadPixmap( "LightApp", tr( "BROWSER_ICON" ) ) );
+  QtxWebBrowser::setData("browser:title",         tr( "BROWSER_TITLE" ) );
+  QtxWebBrowser::setData("toolbar:title",         tr( "BROWSER_TOOLBAR_TITLE" ) );
+  QtxWebBrowser::setData("menu:file:title",       tr( "BROWSER_FILEMENU" ) );
+  QtxWebBrowser::setData("action:close:title",    tr( "BROWSER_CLOSE" ) );
+  QtxWebBrowser::setData("action:close:icon",     aResMgr->loadPixmap( "LightApp", tr( "BROWSER_CLOSE_ICON" ) ) );
+  QtxWebBrowser::setData("action:back:title",     tr( "BROWSER_BACK" ) );
+  QtxWebBrowser::setData("action:forward:title",  tr( "BROWSER_FORWARD" ) );
+  QtxWebBrowser::setData("action:find:title",     tr( "BROWSER_FIND" ) );
+  QtxWebBrowser::setData("action:findnext:title", tr( "BROWSER_FINDNEXT" ) );
+  QtxWebBrowser::setData("action:findprev:title", tr( "BROWSER_FINDPREV" ) );
+
   desktop()->setWindowIcon( aLogo );
   desktop()->setDockableMenuBar( false );
   desktop()->setDockableStatusBar( false );
@@ -245,6 +346,7 @@ LightApp_Application::LightApp_Application()
   myAccel->setActionKey( SUIT_Accel::ZoomIn,      Qt::CTRL+Qt::Key_Plus,     OCCViewer_Viewer::Type() );
   myAccel->setActionKey( SUIT_Accel::ZoomOut,     Qt::CTRL+Qt::Key_Minus,    OCCViewer_Viewer::Type() );
   myAccel->setActionKey( SUIT_Accel::ZoomFit,     Qt::CTRL+Qt::Key_Asterisk, OCCViewer_Viewer::Type() );
+  myAccel->setActionKey( SUIT_Accel::ZoomFit,     Qt::Key_Space,             OCCViewer_Viewer::Type() );
   myAccel->setActionKey( SUIT_Accel::RotateLeft,  Qt::ALT+Qt::Key_Left,      OCCViewer_Viewer::Type() );
   myAccel->setActionKey( SUIT_Accel::RotateRight, Qt::ALT+Qt::Key_Right,     OCCViewer_Viewer::Type() );
   myAccel->setActionKey( SUIT_Accel::RotateUp,    Qt::ALT+Qt::Key_Up,        OCCViewer_Viewer::Type() );
@@ -258,6 +360,7 @@ LightApp_Application::LightApp_Application()
   myAccel->setActionKey( SUIT_Accel::ZoomIn,      Qt::CTRL+Qt::Key_Plus,     VTKViewer_Viewer::Type() );
   myAccel->setActionKey( SUIT_Accel::ZoomOut,     Qt::CTRL+Qt::Key_Minus,    VTKViewer_Viewer::Type() );
   myAccel->setActionKey( SUIT_Accel::ZoomFit,     Qt::CTRL+Qt::Key_Asterisk, VTKViewer_Viewer::Type() );
+  myAccel->setActionKey( SUIT_Accel::ZoomFit,     Qt::Key_Space,             VTKViewer_Viewer::Type() );
   myAccel->setActionKey( SUIT_Accel::RotateLeft,  Qt::ALT+Qt::Key_Left,      VTKViewer_Viewer::Type() );
   myAccel->setActionKey( SUIT_Accel::RotateRight, Qt::ALT+Qt::Key_Right,     VTKViewer_Viewer::Type() );
   myAccel->setActionKey( SUIT_Accel::RotateUp,    Qt::ALT+Qt::Key_Up,        VTKViewer_Viewer::Type() );
@@ -271,6 +374,7 @@ LightApp_Application::LightApp_Application()
   myAccel->setActionKey( SUIT_Accel::ZoomIn,      Qt::CTRL+Qt::Key_Plus,     Plot2d_Viewer::Type() );
   myAccel->setActionKey( SUIT_Accel::ZoomOut,     Qt::CTRL+Qt::Key_Minus,    Plot2d_Viewer::Type() );
   myAccel->setActionKey( SUIT_Accel::ZoomFit,     Qt::CTRL+Qt::Key_Asterisk, Plot2d_Viewer::Type() );
+  myAccel->setActionKey( SUIT_Accel::ZoomFit,     Qt::Key_Space,             Plot2d_Viewer::Type() );
 #endif
 
   connect( mySelMgr, SIGNAL( selectionChanged() ), this, SLOT( onSelection() ) );
@@ -289,15 +393,15 @@ LightApp_Application::LightApp_Application()
   QStringList anAddFamilies = aResMgr->stringValue( "PyConsole", "additional_families" ).split( ";", QString::SkipEmptyParts );
   QString aFamily;
   for ( QStringList::Iterator it = anAddFamilies.begin(); it != anAddFamilies.end(); ++it )
+  {
+    aFamily = *it;
+    if ( famdb.contains(aFamily) )
     {
-      aFamily = *it;
-      if ( famdb.contains(aFamily) )
-       {
-         f.setFamily( aFamily );
-         aResMgr->setValue( "PyConsole", "font", f );
-         break;
-       }
+      f.setFamily( aFamily );
+      aResMgr->setValue( "PyConsole", "font", f );
+      break;
     }
+  }
 }
 
 /*!Destructor.
@@ -309,6 +413,7 @@ LightApp_Application::LightApp_Application()
 LightApp_Application::~LightApp_Application()
 {
   delete mySelMgr;
+  delete myScreenHelper;
 }
 
 /*!Start application.*/
@@ -328,7 +433,10 @@ void LightApp_Application::start()
 /*!Gets application name.*/
 QString LightApp_Application::applicationName() const
 {
-  return tr( "APP_NAME" );
+  static QString _app_name;
+  if ( _app_name.isEmpty() )
+    _app_name = tr( "APP_NAME" );
+  return _app_name;
 }
 
 /*!Gets application version.*/
@@ -345,27 +453,7 @@ QString LightApp_Application::applicationVersion() const
     }
     else
     {
-      QString path( ::getenv( "GUI_ROOT_DIR" ) );
-      if ( !path.isEmpty() )
-        path += QDir::separator();
-      path += QString( "bin/salome/VERSION" );
-
-      QFile vf( path );
-      if ( vf.open( QIODevice::ReadOnly ) )
-      {
-        QString line( vf.readLine( 1024 ) );
-       vf.close();
-
-       if ( !line.isEmpty() )
-        {
-         while ( !line.isEmpty() && line.at( line.length() - 1 ) == QChar( '\n' ) )
-           line.remove( line.length() - 1, 1 );
-
-         int idx = line.lastIndexOf( ":" );
-         if ( idx != -1 )
-           _app_version = line.mid( idx + 1 ).trimmed();
-        }
-      }
+      _app_version = GUI_VERSION_STR;
     }
   }
   return _app_version;
@@ -427,94 +515,128 @@ void LightApp_Application::createActionForViewer( const int id,
                                                   const QString& suffix,
                                                   const int accel )
 {
-  QAction* a = createAction( id, tr( QString( "NEW_WINDOW_%1" ).arg( suffix ).toLatin1().constData() ), QIcon(),
-                            tr( QString( "NEW_WINDOW_%1" ).arg( suffix ).toLatin1().constData() ),
-                            tr( QString( "NEW_WINDOW_%1" ).arg( suffix ).toLatin1().constData() ),
-                            accel, desktop(), false, this, SLOT( onNewWindow() ) );
+  QString vtlt = tr( QString( "NEW_WINDOW_%1" ).arg( suffix ).toLatin1().constData() );
+  QString tip = tr( "CREATING_NEW_WINDOW" ).arg( vtlt.remove( "&" ) );
+  QAction* a = createAction( id,                      // menu action id
+                             tip,                     // status tip
+                             QIcon(),                 // icon
+                             vtlt,                    // menu text
+                             tip,                     // tooltip
+                             accel,                   // shortcut
+                             desktop(),               // parent
+                             false,                   // toggle flag
+                             this,                    // receiver
+                             SLOT( onNewWindow() ) ); // slot
   createMenu( a, parentId, -1 );
 }
 
 /*!Create actions:*/
+
 void LightApp_Application::createActions()
 {
-  STD_Application::createActions();
+  CAM_Application::createActions();
 
   SUIT_Desktop* desk = desktop();
   SUIT_ResourceMgr* resMgr = resourceMgr();
 
-  //! Preferences
+  // Preferences
   createAction( PreferencesId, tr( "TOT_DESK_PREFERENCES" ), QIcon(),
-               tr( "MEN_DESK_PREFERENCES" ), tr( "PRP_DESK_PREFERENCES" ),
-               Qt::CTRL+Qt::Key_R, desk, false, this, SLOT( onPreferences() ) );
+                tr( "MEN_DESK_PREFERENCES" ), tr( "PRP_DESK_PREFERENCES" ),
+                Qt::CTRL+Qt::Key_R, desk, false, this, SLOT( onPreferences() ) );
 
-  //! Help for modules
-  int helpMenu = createMenu( tr( "MEN_DESK_HELP" ), -1, -1, 1000 );
-  int helpModuleMenu = createMenu( tr( "MEN_DESK_MODULE_HELP" ), helpMenu, -1, 0 );
-  createMenu( separator(), helpMenu, -1, 1 );
+  // Help menu:
+
+  // - Help for modules
 
+  int helpMenu = createMenu( tr( "MEN_DESK_HELP" ), -1, -1, 1000 );
+  createMenu( separator(), helpMenu, -1, 10 );
   QStringList aModuleList;
   modules( aModuleList, false );
+  aModuleList.prepend( "GUI" );
+  aModuleList.prepend( "KERNEL" );
 
   int id = LightApp_Application::UserID + FIRST_HELP_ID;
-  // help for KERNEL and GUI
-  QString dir;//QByteArray dir;
-  QString aFileName = "index.html";
-  QString root;
-  QAction* a;
-  dir = getenv("GUI_ROOT_DIR");
-  if ( !dir.isEmpty() ) {
-    root = Qtx::addSlash( Qtx::addSlash(dir) + Qtx::addSlash("share") + Qtx::addSlash("doc") +
-                          Qtx::addSlash("salome") + Qtx::addSlash("gui") +  Qtx::addSlash("GUI") );
-    if ( QFileInfo( root + aFileName ).exists() ) {
-      a = createAction( id, tr( QString("GUI Help").toLatin1().constData() ),
-                       resMgr->loadPixmap( "STD", tr( "ICON_HELP" ), false ),
-                       tr( QString("GUI Help").toLatin1().constData() ),
-                       tr( QString("GUI Help").toLatin1().constData() ),
-                       0, desk, false, this, SLOT( onHelpContentsModule() ) );
-      a->setObjectName( QString("GUI") );
-      createMenu( a, helpModuleMenu, -1 );
-      id++;
+
+  QString aModule;
+  foreach( aModule, aModuleList ) {
+    if ( aModule.isEmpty() )                                         // module title (user name)
+      continue;
+    IMap <QString, QString> helpData;                                // list of help files for the module
+    QString helpSubMenu;                                             // help submenu name (empty if not needed)
+    QString modName = moduleName( aModule );                         // module name
+    if ( modName.isEmpty() ) modName = aModule;                      // for KERNEL and GUI
+    QString rootDir = QString( "%1_ROOT_DIR" ).arg( modName );       // module root dir variable
+    QString modDir  = getenv( rootDir.toLatin1().constData() );      // module root dir
+    QString docSection;
+    if (resMgr->hasValue( modName, "documentation" ) )
+      docSection = resMgr->stringValue(modName, "documentation");
+    else if ( resMgr->hasSection( modName + "_documentation" ) )
+      docSection = modName + "_documentation";
+    if ( !docSection.isEmpty() ) {
+      helpSubMenu = resMgr->stringValue( docSection, "sub_menu", "" ).arg( aModule );
+      QStringList listOfParam = resMgr->parameters( docSection );
+      foreach( QString paramName, listOfParam ) {
+        QString valueStr = resMgr->stringValue( docSection, paramName );
+        if ( !valueStr.isEmpty() ) {
+          QFileInfo fi( valueStr );
+          if ( fi.isRelative() && !modDir.isEmpty() )
+            valueStr = Qtx::addSlash( modDir ) + valueStr;
+          if ( QFile::exists( valueStr ) )
+            helpData.insert( paramName.arg( aModule ), valueStr );
+        }
+      }
     }
-  }
-  dir = getenv("KERNEL_ROOT_DIR");
-  if ( !dir.isEmpty() ) {
-    root = Qtx::addSlash( Qtx::addSlash(dir) + Qtx::addSlash("share") + Qtx::addSlash("doc") +
-                         Qtx::addSlash("salome") );
-    if ( QFileInfo( root + aFileName ).exists() ) {
-      a = createAction( id, tr( QString("KERNEL Help").toLatin1().constData() ),
-                       resMgr->loadPixmap( "STD", tr( "ICON_HELP" ), false ),
-                       tr( QString("KERNEL Help").toLatin1().constData() ),
-                       tr( QString("KERNEL Help").toLatin1().constData() ),
-                       0, desk, false, this, SLOT( onHelpContentsModule() ) );
-      a->setObjectName( QString("KERNEL") );
-      createMenu( a, helpModuleMenu, -1 );
+
+    if ( helpData.isEmpty() && !modDir.isEmpty() ) {
+      QStringList idxLst = QStringList() << modDir << "share" << "doc" << "salome" << "gui" << modName << "index.html";
+      QString indexFile = idxLst.join( QDir::separator() );          // index file
+      if ( QFile::exists( indexFile ) )
+        helpData.insert( tr( "%1 module Users's Guide" ).arg( aModule ), indexFile );
+    }
+
+    IMapConstIterator<QString, QString > fileIt;
+    for ( fileIt = helpData.begin(); fileIt != helpData.end(); fileIt++ ) {
+      QString helpFileName = fileIt.key();
+      // remove all '//' occurances 
+      while ( helpFileName.contains( "//" ) )
+        helpFileName.replace( "//", "" );
+      // obtain submenus hierarchy if given
+      QStringList smenus = helpFileName.split( "/" );
+      helpFileName = smenus.last();
+      smenus.removeLast();
+      QAction* a = createAction( id, helpFileName,
+                                 resMgr->loadPixmap( "STD", tr( "ICON_HELP" ), false ),
+                                 helpFileName, helpFileName,
+                                 0, desk, false, this, SLOT( onHelpContentsModule() ) );
+      a->setData( fileIt.value() );
+      if ( !helpSubMenu.isEmpty() ) {
+        smenus.prepend( helpSubMenu );
+      }
+      // create sub-menus hierarchy
+      int menuId = helpMenu;
+      foreach ( QString subMenu, smenus ) {
+        menuId = createMenu( subMenu, menuId, -1, 0 );
+      }
+      createMenu( a, menuId, -1, 0 );
       id++;
     }
   }
-  // help for other existing modules
-  QStringList::Iterator it;
-  for ( it = aModuleList.begin(); it != aModuleList.end(); ++it )
-  {
-    if ( (*it).isEmpty() )
-      continue;
 
-    QString modName = moduleName( *it );
-
-    dir = getenv( (modName + "_ROOT_DIR").toLatin1().constData() );
-    if ( !dir.isEmpty() ) {
-      root = Qtx::addSlash( Qtx::addSlash(dir) +  Qtx::addSlash("share") + Qtx::addSlash("doc") +
-                            Qtx::addSlash("salome") + Qtx::addSlash("gui") +  Qtx::addSlash(modName) );
-      if ( QFileInfo( root + aFileName ).exists() ) {
-
-       QAction* a = createAction( id, tr( (moduleTitle(modName) + QString(" Help")).toLatin1().constData() ),
-                                  resMgr->loadPixmap( "STD", tr( "ICON_HELP" ), false ),
-                                  tr( (moduleTitle(modName) + QString(" Help")).toLatin1().constData() ),
-                                  tr( (moduleTitle(modName) + QString(" Help")).toLatin1().constData() ),
-                                  0, desk, false, this, SLOT( onHelpContentsModule() ) );
-       a->setObjectName( modName );
-       createMenu( a, helpModuleMenu, -1 );
-       id++;
-      }
+  // - Additional help items
+
+  createMenu( separator(), helpMenu, -1, 5 );
+
+  QStringList addHelpItems = resMgr->parameters( "add_help" );
+  foreach ( QString addHelpItem, addHelpItems ) {
+    QString valueStr = resMgr->stringValue( "add_help", addHelpItem );
+    if ( !valueStr.isEmpty() && QFile::exists( valueStr ) ) {
+      QAction* a = createAction( id, addHelpItem,
+                                 resMgr->loadPixmap( "STD", tr( "ICON_HELP" ), false ),
+                                 addHelpItem, addHelpItem,
+                                 0, desk, false, this, SLOT( onHelpContentsModule() ) );
+      a->setData( valueStr );
+      createMenu( a, helpMenu, -1, 5 );
+      id++;
     }
   }
 
@@ -546,24 +668,29 @@ void LightApp_Application::createActions()
 
     const int iconSize = 20;
 
+    QStringList::Iterator it;
     for ( it = modList.begin(); it != modList.end(); ++it )
     {
       if ( !isLibExists( *it ) )
         continue;
 
+      QString modName = moduleName( *it );
+
+      if ( !isModuleAccessible( *it ) )
+        continue;
+
       QString iconName;
       if ( iconMap.contains( *it ) )
         iconName = iconMap[*it];
 
-      QString modName = moduleName( *it );
-
       QPixmap icon = resMgr->loadPixmap( modName, iconName, false );
       if ( icon.isNull() )
       {
-       icon = modIcon;
-       INFOS ( "****************************************************************" << std::endl
-            << "*    Icon for " << (*it).toLatin1().constData() << " not found. Using the default one." << std::endl
-            << "****************************************************************" << std::endl );
+        icon = modIcon;
+        INFOS ( "\n****************************************************************" << std::endl
+                <<  "*    Icon for " << (*it).toLatin1().constData()
+                << " not found. Using the default one." << std::endl
+                << "****************************************************************" << std::endl );
       }
 
       icon = Qtx::scaleIcon( icon, iconSize );
@@ -571,8 +698,8 @@ void LightApp_Application::createActions()
       moduleAction->insertModule( *it, icon );
     }
 
-
-    connect( moduleAction, SIGNAL( moduleActivated( const QString& ) ), this, SLOT( onModuleActivation( const QString& ) ) );
+    connect( moduleAction, SIGNAL( moduleActivated( const QString& ) ),
+             this, SLOT( onModuleActivation( const QString& ) ) );
     registerAction( ModulesListId, moduleAction );
   }
 
@@ -581,7 +708,7 @@ void LightApp_Application::createActions()
   int newWinMenu = createMenu( tr( "MEN_DESK_NEWWINDOW" ), windowMenu, -1, 0 );
 
   createAction( CloseId, tr( "TOT_CLOSE" ), QIcon(), tr( "MEN_DESK_CLOSE" ), tr( "PRP_CLOSE" ),
-                Qt::SHIFT+Qt::Key_C, desk, false, this, SLOT( onCloseWindow() ) );
+                Qt::CTRL+Qt::Key_F4, desk, false, this, SLOT( onCloseWindow() ) );
   createAction( CloseAllId, tr( "TOT_CLOSE_ALL" ), QIcon(), tr( "MEN_DESK_CLOSE_ALL" ), tr( "PRP_CLOSE_ALL" ),
                 0, desk, false, this, SLOT( onCloseAllWindow() ) );
   createAction( GroupAllId, tr( "TOT_GROUP_ALL" ), QIcon(), tr( "MEN_DESK_GROUP_ALL" ), tr( "PRP_GROUP_ALL" ),
@@ -605,13 +732,14 @@ void LightApp_Application::createActions()
   createActionForViewer( NewVTKViewId, newWinMenu, QString::number( 3 ), Qt::ALT+Qt::Key_K );
 #endif
 #ifndef DISABLE_QXGRAPHVIEWER
-  createActionForViewer( NewQxGraphViewId, newWinMenu, QString::number( 4 ), Qt::ALT+Qt::Key_C );
+  createActionForViewer( NewQxSceneViewId, newWinMenu, QString::number( 4 ), Qt::ALT+Qt::Key_S );
+#endif
+#ifndef DISABLE_GRAPHICSVIEW
+  createActionForViewer( NewGraphicsViewId, newWinMenu, QString::number( 5 ), Qt::ALT+Qt::Key_R );
 #endif
-
-  createActionForViewer( NewQxSceneViewId, newWinMenu, QString::number( 5 ), Qt::ALT+Qt::Key_S );
 
   createAction( RenameId, tr( "TOT_RENAME" ), QIcon(), tr( "MEN_DESK_RENAME" ), tr( "PRP_RENAME" ),
-               Qt::SHIFT+Qt::Key_R, desk, false, this, SLOT( onRenameWindow() ) );
+                Qt::ALT+Qt::SHIFT+Qt::Key_R, desk, false, this, SLOT( onRenameWindow() ) );
   createMenu( RenameId, windowMenu, -1 );
 
   int fileMenu = createMenu( tr( "MEN_DESK_FILE" ), -1 );
@@ -625,9 +753,14 @@ void LightApp_Application::createActions()
   createAction( StyleId, tr( "TOT_THEME" ), QIcon(), tr( "MEN_DESK_THEME" ), tr( "PRP_THEME" ),
                 0, desk, false, this, SLOT( onStylePreferences() ) );
 
+  createAction( FullScreenId, tr( "TOT_FULLSCREEN" ), QIcon(), tr( "MEN_DESK_FULLSCREEN" ), tr( "PRP_FULLSCREEN" ),
+                Qt::Key_F11, desk, false, this, SLOT( onFullScreen() ) );
+
+
   int viewMenu = createMenu( tr( "MEN_DESK_VIEW" ), -1 );
   createMenu( separator(), viewMenu, -1, 20, -1 );
   createMenu( StyleId, viewMenu, 20, -1 );
+  createMenu( FullScreenId, viewMenu, 20, -1 );
 
   int modTBar = createTool( tr( "INF_TOOLBAR_MODULES" ) );
   createTool( ModulesListId, modTBar );
@@ -661,9 +794,9 @@ void LightApp_Application::onModuleActivation( const QString& modName )
       putInfo( tr("INF_CANCELLED") );
 
       LightApp_ModuleAction* moduleAction =
-       qobject_cast<LightApp_ModuleAction*>( action( ModulesListId ) );
+        qobject_cast<LightApp_ModuleAction*>( action( ModulesListId ) );
       if ( moduleAction )
-       moduleAction->setActiveModule( QString() );
+        moduleAction->setActiveModule( QString() );
       cancelled = true;
     }
   }
@@ -714,13 +847,15 @@ void LightApp_Application::onNewWindow()
     break;
 #endif
 #ifndef DISABLE_QXGRAPHVIEWER
-  case NewQxGraphViewId:
-    type = QxGraph_Viewer::Type();
-    break;
-#endif
   case NewQxSceneViewId:
     type = QxScene_Viewer::Type();
     break;
+#endif
+#ifndef DISABLE_GRAPHICSVIEW
+  case NewGraphicsViewId:
+    type = GraphicsView_Viewer::Type();
+    break;
+#endif
   }
 
   if ( !type.isEmpty() )
@@ -732,7 +867,9 @@ void LightApp_Application::onNewWindow()
 */
 void LightApp_Application::onNewDoc()
 {
-  saveDockWindowsState();
+  //asl: fix for 0020515
+  if ( activeStudy() )
+    saveDockWindowsState();
 
   CAM_Application::onNewDoc();
 }
@@ -838,13 +975,16 @@ void LightApp_Application::updateCommandsStatus()
 #endif
 
 #ifndef DISABLE_QXGRAPHVIEWER
-  a = action( NewQxGraphViewId );
+  a = action( NewQxSceneViewId );
   if( a )
     a->setEnabled( activeStudy() );
 #endif
-  a = action( NewQxSceneViewId );
+
+#ifndef DISABLE_GRAPHICSVIEW
+  a = action( NewGraphicsViewId );
   if( a )
     a->setEnabled( activeStudy() );
+#endif
 }
 
 /*!
@@ -855,38 +995,34 @@ class RunBrowser: public QThread
 {
 public:
   RunBrowser( LightApp_Application* app,
-             const QString&        theApp,
-             const QString&        theParams,
-             const QString&        theHelpFile,
-             const QString&        theContext = QString() )
+              const QString&        theApp,
+              const QString&        theParams,
+              const QString&        theHelpFile,
+              const QString&        theContext = QString() )
     : myApp( theApp ),
       myParams( theParams ),
-#ifdef WIN32
-      myHelpFile( "file://" + theHelpFile ),
-#else
-      myHelpFile( "file:" + theHelpFile ),
-#endif
       myContext( theContext ),
       myStatus(0),
       myLApp( app )
   {
+    //For the external browser always specify 'file://' protocol,
+    //because some WEB browsers (for example Mozilla Firefox) can't open local file without protocol.
+    myHelpFile = QString("file://%1").arg( QFileInfo( theHelpFile ).canonicalFilePath() );
   }
 
   virtual void run()
   {
-    if ( !myApp.isEmpty()) {
-      QString aCommand = QString( "%1 %2 %3" ).arg( myApp, myParams, myHelpFile );
-      if ( !myContext.isEmpty() )
-       aCommand += "#" + myContext;
+    if ( !myApp.isEmpty() && !myHelpFile.isEmpty()) {
+      QString aCommand = QString( "%1 %2 \"%3%4\"" ).arg( myApp, myParams, myHelpFile, myContext.isEmpty() ? QString("") : QString( "#%1" ).arg( myContext ) );
 
       QProcess* proc = new QProcess();
 
       proc->start( aCommand );
       if ( !proc->waitForStarted() ) {
-       SALOME_CustomEvent* ce2000 = new SALOME_CustomEvent( 2000 );
-       QString* msg = new QString( QObject::tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ).arg( myApp, myHelpFile ) );
-       ce2000->setData( msg );
-       QApplication::postEvent( myLApp, ce2000 );
+        SALOME_CustomEvent* ce2000 = new SALOME_CustomEvent( 2000 );
+        QString* msg = new QString( QObject::tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ).arg( myApp, myHelpFile ) );
+        ce2000->setData( msg );
+        QApplication::postEvent( myLApp, ce2000 );
       }
     }
   }
@@ -905,44 +1041,47 @@ private:
 */
 void LightApp_Application::onHelpContentsModule()
 {
-  const QAction* obj = (QAction*) sender();
-
-  QString aComponentName = obj->objectName();
-  QString aFileName = "index.html";
+  const QAction* a = (QAction*) sender();
+  QString helpFile = a->data().toString();
+  if ( helpFile.isEmpty() ) return;
 
-  QString dir = getenv( (aComponentName + "_ROOT_DIR").toLatin1().constData() );
-  QString homeDir = !aComponentName.compare(QString("KERNEL")) ?
-    Qtx::addSlash( Qtx::addSlash(dir) + Qtx::addSlash("share") + Qtx::addSlash("doc") + Qtx::addSlash("salome") ) :
-    Qtx::addSlash( Qtx::addSlash(dir) + Qtx::addSlash("share") + Qtx::addSlash("doc") + Qtx::addSlash("salome") + Qtx::addSlash("gui") +  Qtx::addSlash(aComponentName) );
-
-  QString helpFile = QFileInfo( homeDir + aFileName ).absoluteFilePath();
   SUIT_ResourceMgr* resMgr = resourceMgr();
-       QString platform;
+  QString platform;
 #ifdef WIN32
-       platform = "winapplication";
+  platform = "winapplication";
 #else
-       platform = "application";
+  platform = "application";
 #endif
-       QString anApp = resMgr->stringValue("ExternalBrowser", platform);
+  QString anApp = resMgr->stringValue("ExternalBrowser", platform);
 #ifdef WIN32
-       QString quote("\"");
-       anApp.prepend( quote );
-       anApp.append( quote );
+  QString quote("\"");
+  anApp.prepend( quote );
+  anApp.append( quote );
 #endif
   QString aParams = resMgr->stringValue("ExternalBrowser", "parameters");
+  bool useExtBrowser = resMgr->booleanValue("ExternalBrowser", "use_external_browser", false );
 
-  if ( !anApp.isEmpty() )
-  {
-    RunBrowser* rs = new RunBrowser( this, anApp, aParams, helpFile );
-    rs->start();
-  }
-  else
-  {
-    if ( SUIT_MessageBox::question( desktop(), tr( "WRN_WARNING" ), tr( "DEFINE_EXTERNAL_BROWSER" ),
-                                   SUIT_MessageBox::Yes | SUIT_MessageBox::No,
-                                   SUIT_MessageBox::Yes ) == SUIT_MessageBox::Yes )
+  if( useExtBrowser ) {
+    if ( !anApp.isEmpty() ) {
+      RunBrowser* rs = new RunBrowser( this, anApp, aParams, helpFile );
+      rs->start();
+    }
+    else {
+      if ( SUIT_MessageBox::question( desktop(), tr( "WRN_WARNING" ), tr( "DEFINE_EXTERNAL_BROWSER" ),
+                                      SUIT_MessageBox::Yes | SUIT_MessageBox::No,
+                                      SUIT_MessageBox::Yes ) == SUIT_MessageBox::Yes )
 
-      showPreferences( tr( "PREF_APP" ) );
+        showPreferences( tr( "PREF_APP" ) );
+    }
+  }
+  else {
+#ifdef WIN32
+    // On Win32 platform QWebKit of the Qt 4.6.3 hang up in case 'file://' protocol 
+    // is defined. On Linux platform QWebKit doesn't work correctly without 'file://' protocol.
+    QtxWebBrowser::loadUrl(helpFile);
+#else
+    QtxWebBrowser::loadUrl(QString("file://%1").arg(helpFile));
+#endif
   }
 }
 
@@ -950,48 +1089,73 @@ void LightApp_Application::onHelpContentsModule()
   SLOT: Displays help contents for choosen dialog
 */
 void LightApp_Application::onHelpContextModule( const QString& theComponentName,
-                                               const QString& theFileName,
-                                               const QString& theContext )
+                                                const QString& theFileName,
+                                                const QString& theContext )
 {
+  QString fileName = theFileName;
+  QString context  = theContext;
+  if ( !QFile::exists( fileName ) && theContext.isEmpty() ) {
+    // context might be passed within theFileName argument
+    QStringList comps = fileName.split("#");
+    if ( comps.count() > 1 ) {
+      context = comps.last();
+      comps.removeLast();
+      fileName = comps.join("#");
+    }
+  }
+
   QString homeDir = "";
   if ( !theComponentName.isEmpty() ) {
     QString dir = getenv( ( theComponentName + "_ROOT_DIR" ).toLatin1().constData() );
     if ( !dir.isEmpty() )
       homeDir = Qtx::addSlash( Qtx::addSlash( dir )      +
-                              Qtx::addSlash( "share" )  +
-                              Qtx::addSlash( "doc" )    +
-                              Qtx::addSlash( "salome" ) +
-                              Qtx::addSlash( "gui" )    +
-                              Qtx::addSlash( theComponentName ) );
+                               Qtx::addSlash( "share" )  +
+                               Qtx::addSlash( "doc" )    +
+                               Qtx::addSlash( "salome" ) +
+                               Qtx::addSlash( "gui" )    +
+                               Qtx::addSlash( theComponentName ) );
   }
 
-  QString helpFile = QFileInfo( homeDir + theFileName ).absoluteFilePath();
+  QString helpFile = QFileInfo( homeDir + fileName ).absoluteFilePath();
   SUIT_ResourceMgr* resMgr = resourceMgr();
-       QString platform;
+        QString platform;
 #ifdef WIN32
-       platform = "winapplication";
+        platform = "winapplication";
 #else
-       platform = "application";
+        platform = "application";
 #endif
-       QString anApp = resMgr->stringValue("ExternalBrowser", platform);
+        QString anApp = resMgr->stringValue("ExternalBrowser", platform);
 #ifdef WIN32
-       QString quote("\"");
-       anApp.prepend( quote );
-       anApp.append( quote );
+        QString quote("\"");
+        anApp.prepend( quote );
+        anApp.append( quote );
 #endif
-  QString aParams = resMgr->stringValue("ExternalBrowser", "parameters");
 
-  if ( !anApp.isEmpty() )
-  {
-    RunBrowser* rs = new RunBrowser( this, anApp, aParams, helpFile, theContext );
-    rs->start();
+  bool useExtBrowser = resMgr->booleanValue("ExternalBrowser", "use_external_browser", false );
+
+  if(useExtBrowser) {
+    QString aParams = resMgr->stringValue("ExternalBrowser", "parameters");
+
+    if ( !anApp.isEmpty() ) {
+      RunBrowser* rs = new RunBrowser( this, anApp, aParams, helpFile, context );
+      rs->start();
+    }
+    else {
+      if ( SUIT_MessageBox::question( desktop(), tr( "WRN_WARNING" ), tr( "DEFINE_EXTERNAL_BROWSER" ),
+                                      SUIT_MessageBox::Yes | SUIT_MessageBox::No,
+                                      SUIT_MessageBox::Yes ) == SUIT_MessageBox::Yes )
+        showPreferences( tr( "PREF_APP" ) );
+    }
   }
-  else
-  {
-    if ( SUIT_MessageBox::question( desktop(), tr( "WRN_WARNING" ), tr( "DEFINE_EXTERNAL_BROWSER" ),
-                                   SUIT_MessageBox::Yes | SUIT_MessageBox::No,
-                                   SUIT_MessageBox::Yes ) == SUIT_MessageBox::Yes )
-      showPreferences( tr( "PREF_APP" ) );
+  else {
+#ifdef WIN32
+    // On Win32 platform QWebKit of the Qt 4.6.3 hang up in case 'file://' protocol 
+    // is defined. On Linux platform QWebKit doesn't work correctly without 'file://' protocol.
+    QtxWebBrowser::loadUrl(helpFile, context);
+#else
+    QtxWebBrowser::loadUrl(QString("file://%1").arg(helpFile), context);
+#endif
+    
   }
 }
 
@@ -1000,6 +1164,12 @@ void LightApp_Application::onHelpContextModule( const QString& theComponentName,
 */
 void LightApp_Application::onSelectionChanged()
 {
+  LightApp_Module* m = dynamic_cast<LightApp_Module*>( activeModule() );
+  bool canCopy  = m ? m->canCopy() : false;
+  bool canPaste = m ? m->canPaste() : false;
+
+  action( EditCopyId )->setEnabled(canCopy);
+  action( EditPasteId )->setEnabled(canPaste);
 }
 
 /*!
@@ -1055,8 +1225,8 @@ void LightApp_Application::addWindow( QWidget* wid, const int flag, const int st
       f = resourceMgr()->fontValue( "PyConsole", "font" );
     else
       {
-       f = ( ( PyConsole_Console* )wid )->font();
-       resourceMgr()->setValue( "PyConsole", "font", f );
+        f = ( ( PyConsole_Console* )wid )->font();
+        resourceMgr()->setValue( "PyConsole", "font", f );
       }
   }
   else
@@ -1109,6 +1279,11 @@ void LightApp_Application::insertDockWindow( const int id, QWidget* wid )
   dock->setFeatures( QDockWidget::AllDockWidgetFeatures );
   dock->setObjectName( QString( "window_%1" ).arg( id ) );
   dock->setWidget( wid );
+
+  QKeySequence accel = wid->property( "shortcut" ).value<QKeySequence>();
+  if ( !accel.isEmpty() )
+    dock->toggleViewAction()->setShortcut( accel );
+
   dock->show();
 }
 
@@ -1133,8 +1308,11 @@ void LightApp_Application::removeDockWindow( const int id )
 void LightApp_Application::placeDockWindow( const int id, Qt::DockWidgetArea place )
 {
   QDockWidget* dock = windowDock( dockWindow( id ) );
-  if ( dock && desktop() )
+  if ( dock && desktop() ) {
     desktop()->addDockWidget( place, dock );
+    QtxDockAction* a = qobject_cast<QtxDockAction*>( action( ViewWindowsId ) );
+    if ( a ) a->update();
+  }
 }
 
 /*!
@@ -1175,11 +1353,21 @@ LogWindow* LightApp_Application::logWindow()
 
 #ifndef DISABLE_PYCONSOLE
 /*!
+  This returns the python console integrated to the GUI. Depending
+  when you request the python console, this function could return
+  null. Then the optional parameter force (default to false) can be
+  set to force the creation of the python console if it is not done
+  already. 
+  \param force - if true, the pythonConsole is created if it does not exist yet
   \return Python Console
 */
-PyConsole_Console* LightApp_Application::pythonConsole()
+PyConsole_Console* LightApp_Application::pythonConsole(const bool force)
 {
-  return qobject_cast<PyConsole_Console*>( dockWindow( WT_PyConsole ) );
+  QWidget* wid = dockWindow( WT_PyConsole );
+  if ( !wid && force==true) {
+    wid = getWindow(WT_PyConsole);
+  }
+  return qobject_cast<PyConsole_Console*>( wid );
 }
 #endif
 
@@ -1202,7 +1390,7 @@ void LightApp_Application::updateObjectBrowser( const bool updateModels )
       study->dataModels( dm_list );
       QListIterator<CAM_DataModel*> it( dm_list );
       while ( it.hasNext() ) {
-       CAM_DataModel* camDM = it.next();
+        CAM_DataModel* camDM = it.next();
         if ( camDM && camDM->inherits( "LightApp_DataModel" ) )
           ((LightApp_DataModel*)camDM)->update();
       }
@@ -1289,6 +1477,7 @@ SUIT_ViewManager* LightApp_Application::createViewManager( const QString& vmType
     }
   }
 #endif
+#ifndef DISABLE_QXGRAPHVIEWER
   if( vmType == QxScene_Viewer::Type() )
   {
     viewMgr = new QxScene_ViewManager( activeStudy(), desktop() );
@@ -1296,17 +1485,13 @@ SUIT_ViewManager* LightApp_Application::createViewManager( const QString& vmType
     viewMgr->setViewModel( vm  );
     //QxScene_ViewWindow* wnd = dynamic_cast<QxScene_ViewWindow*>( viewMgr->getActiveView() );
   }
-  //#ifndef DISABLE_SUPERVGRAPHVIEWER
-  //  if( vmType == SUPERVGraph_Viewer::Type() )
-  //  {
-  //    viewMgr = new SUPERVGraph_ViewManager( activeStudy(), desktop(), new SUPERVGraph_Viewer() );
-  //  }
-  //#endif
-#ifndef DISABLE_QXGRAPHVIEWER
-  if( vmType == QxGraph_Viewer::Type() )
-    {
-      viewMgr = new QxGraph_ViewManager( activeStudy(), desktop(), new QxGraph_Viewer() );
-    }
+#endif
+#ifndef DISABLE_GRAPHICSVIEW
+  if( vmType == GraphicsView_Viewer::Type() )
+  {
+    viewMgr = new GraphicsView_ViewManager( activeStudy(), desktop() );
+    new LightApp_GVSelector( (GraphicsView_Viewer*)viewMgr->getViewModel(), mySelMgr );
+  }
 #endif
 #ifndef DISABLE_OCCVIEWER
   if( vmType == OCCViewer_Viewer::Type() )
@@ -1316,15 +1501,24 @@ SUIT_ViewManager* LightApp_Application::createViewManager( const QString& vmType
 #ifndef DISABLE_SALOMEOBJECT
     vm = new SOCC_Viewer();
 #else
-    vm = new OCCViewer_Viewer( true, resMgr->booleanValue( "OCCViewer", "static_trihedron", true ) );
-#endif
-    vm->setBackgroundColor( resMgr->colorValue( "OCCViewer", "background", vm->backgroundColor() ) );
-    vm->setTrihedronSize( resMgr->doubleValue( "OCCViewer", "trihedron_size", vm->trihedronSize() ) );
-    int u( 1 ), v( 1 );
-    vm->isos( u, v );
-    u = resMgr->integerValue( "OCCViewer", "iso_number_u", u );
-    v = resMgr->integerValue( "OCCViewer", "iso_number_v", v );
-    vm->setIsos( u, v );
+    vm = new OCCViewer_Viewer( true );
+#endif
+    vm->setBackground( OCCViewer_ViewFrame::TOP_LEFT,
+                       resMgr->backgroundValue( "OCCViewer", "xz_background", vm->background(OCCViewer_ViewFrame::TOP_LEFT) ) );
+    vm->setBackground( OCCViewer_ViewFrame::TOP_RIGHT,
+                       resMgr->backgroundValue( "OCCViewer", "yz_background", vm->background(OCCViewer_ViewFrame::TOP_RIGHT) ) );
+    vm->setBackground( OCCViewer_ViewFrame::BOTTOM_LEFT,
+                       resMgr->backgroundValue( "OCCViewer", "xy_background", vm->background(OCCViewer_ViewFrame::BOTTOM_LEFT) ) );
+    vm->setBackground( OCCViewer_ViewFrame::BOTTOM_RIGHT,
+                       resMgr->backgroundValue( "OCCViewer", "background", vm->background(OCCViewer_ViewFrame::MAIN_VIEW) ) );
+
+    vm->setTrihedronSize(  resMgr->doubleValue( "3DViewer", "trihedron_size", vm->trihedronSize() ),
+                           resMgr->booleanValue( "3DViewer", "relative_size", vm->trihedronRelative() ));
+    vm->setInteractionStyle( resMgr->integerValue( "3DViewer", "navigation_mode", vm->interactionStyle() ) );
+    vm->setZoomingStyle( resMgr->integerValue( "3DViewer", "zooming_mode", vm->zoomingStyle() ) );
+    vm->enablePreselection( resMgr->booleanValue( "OCCViewer", "enable_preselection", vm->isPreselectionEnabled() ) );
+    vm->enableSelection(    resMgr->booleanValue( "OCCViewer", "enable_selection",    vm->isSelectionEnabled() ) );
+
     viewMgr->setViewModel( vm );// custom view model, which extends SALOME_View interface
     new LightApp_OCCSelector( (OCCViewer_Viewer*)viewMgr->getViewModel(), mySelMgr );
   }
@@ -1342,22 +1536,26 @@ SUIT_ViewManager* LightApp_Application::createViewManager( const QString& vmType
     if( vm )
     {
       vm->setProjectionMode( resMgr->integerValue( "VTKViewer", "projection_mode", vm->projectionMode() ) );
-      vm->setBackgroundColor( resMgr->colorValue( "VTKViewer", "background", vm->backgroundColor() ) );
-      vm->setTrihedronSize( resMgr->doubleValue( "VTKViewer", "trihedron_size", vm->trihedronSize() ),
-                           resMgr->booleanValue( "VTKViewer", "relative_size", vm->trihedronRelative() ) );
-      vm->setInteractionStyle( resMgr->integerValue( "VTKViewer", "navigation_mode", vm->interactionStyle() ) );
+      vm->setBackground( resMgr->backgroundValue( "VTKViewer", "background", vm->background() ) );
+      vm->setTrihedronSize( resMgr->doubleValue( "3DViewer", "trihedron_size", vm->trihedronSize() ),
+                            resMgr->booleanValue( "3DViewer", "relative_size", vm->trihedronRelative() ) );
+      vm->setStaticTrihedronVisible( resMgr->booleanValue( "3DViewer", "show_static_trihedron", vm->isStaticTrihedronVisible() ) );
+      vm->setInteractionStyle( resMgr->integerValue( "3DViewer", "navigation_mode", vm->interactionStyle() ) );
+      vm->setZoomingStyle( resMgr->integerValue( "3DViewer", "zooming_mode", vm->zoomingStyle() ) );
+      vm->setPreSelectionMode(resMgr->integerValue( "VTKViewer", "preselection", vm->preSelectionMode() ) );
+      vm->enableSelection( resMgr->booleanValue( "VTKViewer", "enable_selection", vm->isSelectionEnabled() ) );
       vm->setIncrementalSpeed( resMgr->integerValue( "VTKViewer", "speed_value", vm->incrementalSpeed() ),
-                              resMgr->integerValue( "VTKViewer", "speed_mode", vm->incrementalSpeedMode() ) );
+                               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_func5_btn", vm->spacemouseBtn(3) ) );
+                                resMgr->integerValue( "VTKViewer", "spacemouse_func2_btn", vm->spacemouseBtn(2) ),
+                                resMgr->integerValue( "VTKViewer", "spacemouse_func5_btn", vm->spacemouseBtn(3) ) );
       new LightApp_VTKSelector( vm, mySelMgr );
     }
 #else
     viewMgr = new VTKViewer_ViewManager( activeStudy(), desktop() );
     VTKViewer_Viewer* vm = dynamic_cast<VTKViewer_Viewer*>( viewMgr->getViewModel() );
     if ( vm )
-      vm->setBackgroundColor( resMgr->colorValue( "VTKViewer", "background", vm->backgroundColor() ) );
+      vm->setBackground( resMgr->backgroundValue( "VTKViewer", "background", vm->background() ) );
 #endif
   }
 #endif
@@ -1368,12 +1566,36 @@ SUIT_ViewManager* LightApp_Application::createViewManager( const QString& vmType
   addViewManager( viewMgr );
   SUIT_ViewWindow* viewWin = viewMgr->createViewWindow();
 
-  if ( viewWin && desktop() )
+  if ( viewWin && desktop() ) {
     viewWin->resize( (int)( desktop()->width() * 0.6 ), (int)( desktop()->height() * 0.6 ) );
+    viewWin->setDropDownButtons( resMgr->booleanValue( "viewers", "drop_down_buttons", true ) );
+  }
 
   return viewMgr;
 }
 
+SUIT_ViewManager* LightApp_Application::createViewManager( const QString& vmType, QWidget* w )
+{
+  SUIT_ResourceMgr* resMgr = resourceMgr();
+
+  SUIT_ViewManager* vm = new SUIT_ViewManager( activeStudy(),
+                                               desktop(),
+                                               new LightApp_WgViewModel( vmType, w ) );
+  vm->setTitle( QString( "%1: %M - viewer %V" ).arg( vmType ) );
+
+  addViewManager( vm );
+  SUIT_ViewWindow* vw = vm->createViewWindow();
+  if ( vw && desktop() ) {
+    vw->resize( (int)( desktop()->width() * 0.6 ), (int)( desktop()->height() * 0.6 ) );
+    vw->setDropDownButtons( resMgr->booleanValue( "viewers", "drop_down_buttons", true ) );
+  }
+
+  if ( !vmType.isEmpty() && !myUserWmTypes.contains( vmType ) )
+    myUserWmTypes << vmType;
+
+  return vm;
+}
+
 /*!
   SLOT: Removes view manager from application
 */
@@ -1449,6 +1671,9 @@ void LightApp_Application::onStudySaved( SUIT_Study* s )
 /*!Protected SLOT. On study closed.*/
 void LightApp_Application::onStudyClosed( SUIT_Study* s )
 {
+  // stop auto-save timer
+  myAutoSaveTimer->stop();
+
   // Bug 10396: clear selection
   mySelMgr->clearSelected();
 
@@ -1475,6 +1700,16 @@ void LightApp_Application::studyOpened( SUIT_Study* s )
   updateViewManagers();
 }
 
+void LightApp_Application::studySaved( SUIT_Study* s )
+{
+  CAM_Application::studyOpened( s );
+  SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+  if ( aResMgr && activeStudy() ) {
+    int autoSaveInterval = aResMgr->integerValue( "Study", "auto_save_interval", 0 );
+    if ( autoSaveInterval > 0 ) myAutoSaveTimer->start( autoSaveInterval*60000 );
+  }
+}
+
 void LightApp_Application::studyCreated( SUIT_Study* s )
 {
   CAM_Application::studyCreated( s );
@@ -1529,6 +1764,18 @@ void LightApp_Application::onRefresh()
   updateObjectBrowser( true );
 }
 
+/*!Private SLOT. Support drag-and-drop operation.*/
+void LightApp_Application::onDropped( const QList<SUIT_DataObject*>& objects, SUIT_DataObject* parent, int row, Qt::DropAction action )
+{
+  LightApp_DataObject* parentObj = dynamic_cast<LightApp_DataObject*>( parent );
+  if ( !parentObj )
+    return;
+
+  LightApp_Module* aModule = dynamic_cast<LightApp_Module*>( parentObj->module() );
+  if ( aModule )
+    aModule->dropObjects( objects, parentObj, row, action );
+}
+
 /*!Private SLOT. On preferences.*/
 void LightApp_Application::onPreferences()
 {
@@ -1554,6 +1801,9 @@ void LightApp_Application::showPreferences( const QString& itemText )
     if ( desktop() )
       resourceMgr()->setValue( "desktop", "geometry", desktop()->storeGeometry() );
     resourceMgr()->save();
+
+    // Update shortcuts
+    shortcutMgr()->updateShortcuts();
   }
 
   delete prefDlg;
@@ -1578,6 +1828,9 @@ void LightApp_Application::onPreferenceChanged( QString& modName, QString& secti
 /*!Remove all windows from study.*/
 void LightApp_Application::beforeCloseDoc( SUIT_Study* s )
 {
+  if ( SUIT_DataBrowser* ob = objectBrowser() )
+    ob->setModel(0);
+
   CAM_Application::beforeCloseDoc( s );
 }
 
@@ -1627,27 +1880,45 @@ QWidget* LightApp_Application::createWindow( const int flag )
     ob->setWindowTitle( tr( "OBJECT_BROWSER" ) );
     connect( ob, SIGNAL( requestUpdate() ), this, SLOT( onRefresh() ) );
 
+    QString EntryCol = QObject::tr( "ENTRY_COLUMN" );
+    SUIT_AbstractModel* treeModel = dynamic_cast<SUIT_AbstractModel*>( ob->model() );
+    treeModel->setSearcher( this );
+    treeModel->registerColumn( 0, EntryCol, LightApp_DataObject::EntryId );
+    treeModel->setAppropriate( EntryCol, Qtx::Toggled );
+
+    // Mantis issue 0020136: Drag&Drop in OB
+    SUIT_ProxyModel* proxyModel = dynamic_cast<SUIT_ProxyModel*>(treeModel);
+    if ( proxyModel ) {
+      connect( proxyModel, SIGNAL( dropped( const QList<SUIT_DataObject*>&, SUIT_DataObject*, int, Qt::DropAction ) ),
+               this,       SLOT( onDropped( const QList<SUIT_DataObject*>&, SUIT_DataObject*, int, Qt::DropAction ) ) );
+    }
+
     // temporary commented
     /*
     OB_ListView* ob_list = dynamic_cast<OB_ListView*>( const_cast<QListView*>( ob->listView() ) );
     if( ob_list )
       ob_list->setColumnMaxWidth( 0, desktop()->width()/4 );
-
-    ob->setFilter( new LightApp_OBFilter( selectionMgr() ) );
     */
 
     // Create OBSelector
     new LightApp_OBSelector( ob, mySelMgr );
 
+    ob->treeView()->header()->setResizeMode(SUIT_DataObject::VisibilityId, QHeaderView::Fixed);
+    ob->treeView()->header()->moveSection(SUIT_DataObject::NameId,SUIT_DataObject::VisibilityId);
+    ob->treeView()->setColumnWidth(SUIT_DataObject::VisibilityId, VISIBILITY_COLUMN_WIDTH);
+    ob->setProperty( "shortcut", QKeySequence( "Alt+Shift+O" ) );
     wid = ob;
-
     ob->connectPopupRequest( this, SLOT( onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ) ) );
   }
 #ifndef DISABLE_PYCONSOLE
   else  if ( flag == WT_PyConsole )
   {
-    PyConsole_Console* pyCons = new PyConsole_Console( desktop() );
+    PyConsole_Console* pyCons = new PyConsole_EnhConsole( desktop(),new LightApp_PyInterp());
     pyCons->setWindowTitle( tr( "PYTHON_CONSOLE" ) );
+    pyCons->setFont(resourceMgr()->fontValue( "PyConsole", "font" ));
+    pyCons->setIsShowBanner(resourceMgr()->booleanValue( "PyConsole", "show_banner", true ));
+    pyCons->setProperty( "shortcut", QKeySequence( "Alt+Shift+P" ) );
+
     wid = pyCons;
     pyCons->connectPopupRequest( this, SLOT( onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ) ) );
   }
@@ -1656,6 +1927,7 @@ QWidget* LightApp_Application::createWindow( const int flag )
   {
     LogWindow* logWin = new LogWindow( desktop() );
     logWin->setWindowTitle( tr( "LOG_WINDOW" ) );
+    logWin->setProperty( "shortcut", QKeySequence( "Alt+Shift+L" ) );
     wid = logWin;
     logWin->connectPopupRequest( this, SLOT( onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ) ) );
   }
@@ -1701,7 +1973,10 @@ LightApp_Preferences* LightApp_Application::preferences( const bool crt ) const
 
   that->myPrefs = _prefs_;
 
-  if ( !toCreate )
+  connect( myPrefs, SIGNAL( preferenceChanged( QString&, QString&, QString& ) ),
+           this, SLOT( onPreferenceChanged( QString&, QString&, QString& ) ) );
+
+  if ( !crt )
     return myPrefs;
 
   SUIT_ResourceMgr* resMgr = resourceMgr();
@@ -1721,12 +1996,12 @@ LightApp_Preferences* LightApp_Application::preferences( const bool crt ) const
 
     for ( QStringList::const_iterator it = modNameList.begin(); it != modNameList.end(); ++it )
     {
-      if ( !app->isLibExists( *it ) )
-       continue;
+      if ( !app->isLibExists( *it ) || _prefs_->hasModule( *it ) )
+        continue;
 
       int modId = _prefs_->addPreference( *it );
       if ( iconMap.contains( *it ) )
-       _prefs_->setItemIcon( modId, Qtx::scaleIcon( resMgr->loadPixmap( moduleName( *it ), iconMap[*it], false ), 20 ) );
+        _prefs_->setItemIcon( modId, Qtx::scaleIcon( resMgr->loadPixmap( moduleName( *it ), iconMap[*it], false ), 20 ) );
     }
 
     ModuleList modList;
@@ -1738,21 +2013,18 @@ LightApp_Preferences* LightApp_Application::preferences( const bool crt ) const
 
       CAM_Module* anItem = itr.next();
       if ( anItem->inherits( "LightApp_Module" ) )
-       mod = (LightApp_Module*)anItem;
+        mod = (LightApp_Module*)anItem;
 
       if ( mod && !_prefs_->hasModule( mod->moduleName() ) )
       {
-       _prefs_->addPreference( mod->moduleName() );
-       mod->createPreferences();
-       that->emptyPreferences( mod->moduleName() );
+        _prefs_->addPreference( mod->moduleName() );
+        mod->createPreferences();
+        that->emptyPreferences( mod->moduleName() );
       }
     }
   }
   _prefs_->setItemProperty( "info", tr( "PREFERENCES_NOT_LOADED" ) );
 
-  connect( myPrefs, SIGNAL( preferenceChanged( QString&, QString&, QString& ) ),
-           this, SLOT( onPreferenceChanged( QString&, QString&, QString& ) ) );
-
   return myPrefs;
 }
 
@@ -1781,7 +2053,7 @@ void LightApp_Application::emptyPreferences( const QString& modName )
   if ( !item || !item->isEmpty() )
     return;
 
-  printf( "---------------------> Modify for empty module.\n" );
+  //  printf( "---------------------> Modify for empty module.\n" );
 
   QtxPagePrefFrameItem* frm = new QtxPagePrefFrameItem( item->title(), item->parentItem() );
   frm->setIcon( item->icon() );
@@ -1801,284 +2073,485 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref )
 
   QStringList     aValuesList;
   QList<QVariant> anIndicesList;
+  QIntList        idList;
+  QIntList        txtList;
 
+  // . Top-level "SALOME" preferences group <<start>>
   int salomeCat = pref->addPreference( tr( "PREF_CATEGORY_SALOME" ) );
   pref->setItemIcon( salomeCat, Qtx::scaleIcon( resourceMgr()->loadPixmap( "LightApp", tr( "APP_DEFAULT_ICO" ), false ), 20 ) );
 
+  // .. "General" preferences tab <<start>>
   int genTab = pref->addPreference( tr( "PREF_TAB_GENERAL" ), salomeCat );
-  int studyGroup = pref->addPreference( tr( "PREF_GROUP_STUDY" ), genTab );
 
+  // ... "Language" group <<start>>
+  int langGroup = pref->addPreference( tr( "PREF_GROUP_LANGUAGE" ), genTab );
+  pref->setItemProperty( "columns", 2, langGroup );
+  // .... -> application language
+  int curLang = pref->addPreference( tr( "PREF_CURRENT_LANGUAGE" ), langGroup,
+                                          LightApp_Preferences::Selector, "language", "language" );
+  QStringList aLangs = SUIT_Session::session()->resourceMgr()->stringValue( "language", "languages", "en" ).split( "," );
+  QList<QVariant> aIcons;
+  foreach ( QString aLang, aLangs ) {
+    aIcons << QPixmap( QString( ":/images/%1" ).arg( aLang ) );
+  }
+  pref->setItemProperty( "strings", aLangs, curLang );
+  pref->setItemProperty( "icons",   aIcons, curLang );
+  // ... "Language" group <<end>>
+
+  // ... "Look and feel" group <<start>>
+  int lookGroup = pref->addPreference( tr( "PREF_GROUP_LOOK_AND_FEEL" ), genTab );
+  pref->setItemProperty( "columns", 2, lookGroup );
+  // .... -> show splash-screen
+  pref->addPreference( tr( "PREF_SHOW_SPLASH" ), lookGroup, LightApp_Preferences::Bool, "launch", "splash" );
+  // .... -> opaque resize
+  pref->addPreference( tr( "PREF_OPAQUE_RESIZE" ), lookGroup, LightApp_Preferences::Bool, "desktop", "opaque_resize" );
+  // .... -> drop-down buttons 
+  pref->addPreference( tr( "PREF_DROP_DOWN_BUTTONS" ), lookGroup, LightApp_Preferences::Bool, "viewers", "drop_down_buttons" );
+  // ... "Look and feel" group <<end>>
+
+  // ... "Study properties" group <<start>>
+  int studyGroup = pref->addPreference( tr( "PREF_GROUP_STUDY" ), genTab );
   pref->setItemProperty( "columns", 2, studyGroup );
-
+  // .... -> multi-file save
   pref->addPreference( tr( "PREF_MULTI_FILE" ), studyGroup, LightApp_Preferences::Bool, "Study", "multi_file" );
+  // .... -> ascii save mode
   pref->addPreference( tr( "PREF_ASCII_FILE" ), studyGroup, LightApp_Preferences::Bool, "Study", "ascii_file" );
+  // .... -> store windows geometry
   pref->addPreference( tr( "PREF_STORE_POS" ),  studyGroup, LightApp_Preferences::Bool, "Study", "store_positions" );
-
-  int extgroup = pref->addPreference( tr( "PREF_GROUP_EXT_BROWSER" ), genTab );
-  QString platform;
+  pref->addPreference( "", studyGroup, LightApp_Preferences::Space );
+  pref->addPreference( tr( "PREF_STORE_TOOL_POS" ),  studyGroup, LightApp_Preferences::Bool, "Study", "store_tool_positions" );
+  // .... -> auto-save
+  int autoSaveInterval = pref->addPreference( tr( "PREF_AUTO_SAVE" ),  studyGroup,
+                                              LightApp_Preferences::IntSpin, "Study", "auto_save_interval" );
+  pref->setItemProperty( "min",        0, autoSaveInterval );
+  pref->setItemProperty( "max",     1440, autoSaveInterval );
+  pref->setItemProperty( "special", tr( "PREF_AUTO_SAVE_DISABLED" ), autoSaveInterval );
+  // ... "Study properties" group <<end>>
+
+  // ... "Help browser" group <<start>>
+  int extgroup = pref->addPreference( tr( "PREF_GROUP_EXT_BROWSER" ), genTab, LightApp_Preferences::Auto, "ExternalBrowser", "use_external_browser");
 #ifdef WIN32
-  platform = "winapplication";
+  QString platform = "winapplication";
 #else
-  platform = "application";
+  QString platform = "application";
 #endif
+  // .... -> browser application
   int apppref = pref->addPreference( tr( "PREF_APP" ), extgroup, LightApp_Preferences::File, "ExternalBrowser", platform );
   pref->setItemProperty( "mode", Qtx::PT_OpenFile, apppref );
-
+  // .... -> browser parameters
   pref->addPreference( tr( "PREF_PARAM" ), extgroup, LightApp_Preferences::String, "ExternalBrowser", "parameters" );
+  // ... "Help browser" group <<end>>
 
+  // ... "Python console properties" group <<start>>
   int pythonConsoleGroup = pref->addPreference( tr( "PREF_GROUP_PY_CONSOLE" ), genTab );
+  // .... -> font
   pref->addPreference( tr( "PREF_FONT" ), pythonConsoleGroup, LightApp_Preferences::Font, "PyConsole", "font" );
+  // .... -> show banner
+  pref->addPreference( tr( "PREF_SHOW_BANNER" ), pythonConsoleGroup, LightApp_Preferences::Bool, "PyConsole", "show_banner" );
+  // ... "Python console properties" group <<end>>
 
-  int viewTab = pref->addPreference( tr( "PREF_TAB_VIEWERS" ), salomeCat );
-
-  int occGroup = pref->addPreference( tr( "PREF_GROUP_OCCVIEWER" ), viewTab );
-
-  int vtkGroup = pref->addPreference( tr( "PREF_GROUP_VTKVIEWER" ), viewTab );
-
-  int plot2dGroup = pref->addPreference( tr( "PREF_GROUP_PLOT2DVIEWER" ), viewTab );
-
-  int supervGroup = pref->addPreference( tr( "PREF_GROUP_SUPERV" ), viewTab );
-
-  pref->setItemProperty( "columns", 2, occGroup );
-  pref->setItemProperty( "columns", 1, vtkGroup );
-  pref->setItemProperty( "columns", 2, plot2dGroup );
-
-  // OCC Viewer
-  int occTS = pref->addPreference( tr( "PREF_TRIHEDRON_SIZE" ), occGroup,
-                                  LightApp_Preferences::DblSpin, "OCCViewer", "trihedron_size" );
+  // ... "MRU" preferences group <<start>>
+  int mruGroup = pref->addPreference( tr( "PREF_GROUP_MRU" ), genTab, LightApp_Preferences::Auto, "MRU", "show_mru" );
+  pref->setItemProperty( "columns", 4, mruGroup );
+  // number of MRU items
+  int mruVisCount = pref->addPreference( tr( "PREF_MRU_VISIBLE_COUNT" ), mruGroup, LightApp_Preferences::IntSpin,
+                                         "MRU", "visible_count" );
+  pref->setItemProperty( "min", 0,   mruVisCount );
+  pref->setItemProperty( "max", 100, mruVisCount );
+  // MRU links type
+  int mruLinkType = pref->addPreference( tr( "PREF_MRU_LINK_TYPE" ), mruGroup, LightApp_Preferences::Selector,
+                                         "MRU", "link_type" );
+  aValuesList.clear();
+  anIndicesList.clear();
+  aValuesList   << tr("PREF_MRU_LINK_AUTO") << tr("PREF_MRU_LINK_SHORT") << tr("PREF_MRU_LINK_FULL");
+  anIndicesList << 0                        << 1                         << 2                       ;
+  pref->setItemProperty( "strings", aValuesList,   mruLinkType );
+  pref->setItemProperty( "indexes", anIndicesList, mruLinkType );
+  // ... "MRU" preferences group <<end>>
+  // .. "General" preferences tab <<end>>
+
+  // .. "3D viewer" group <<start>>
+  int Viewer3DGroup = pref->addPreference( tr( "PREF_GROUP_3DVIEWER" ), salomeCat );
+  // ... -> navigation mode
+  int vtkStyleMode = pref->addPreference( tr( "PREF_NAVIGATION" ), Viewer3DGroup,
+                                          LightApp_Preferences::Selector, "3DViewer", "navigation_mode" );
+  aValuesList.clear();
+  anIndicesList.clear();
+  aValuesList   << tr("PREF_STANDARD_STYLE") << tr("PREF_KEYFREE_STYLE");
+  anIndicesList << 0                         << 1;
+  pref->setItemProperty( "strings", aValuesList,   vtkStyleMode );
+  pref->setItemProperty( "indexes", anIndicesList, vtkStyleMode );
+  // ... -> zooming mode
+  #if OCC_VERSION_LARGE > 0x0603000A // available only with OCC-6.3-sp11 and higher version
+    int occZoomingStyleMode = pref->addPreference( tr( "PREF_ZOOMING" ), Viewer3DGroup,
+                                                   LightApp_Preferences::Selector, "3DViewer", "zooming_mode" );
+    aValuesList.clear();
+    anIndicesList.clear();
+    aValuesList   << tr("PREF_ZOOMING_AT_CENTER") << tr("PREF_ZOOMING_AT_CURSOR");
+    anIndicesList << 0                            << 1;
+    pref->setItemProperty( "strings", aValuesList,   occZoomingStyleMode );
+    pref->setItemProperty( "indexes", anIndicesList, occZoomingStyleMode );
+  #endif
+  // ... "Trihedron" group <<start>>
+  int occTriGroup = pref->addPreference( tr( "PREF_TRIHEDRON" ), Viewer3DGroup );
+  pref->setItemProperty( "columns", 2, occTriGroup );
+  // .... -> trihedron size
+  int occTS = pref->addPreference( tr( "PREF_TRIHEDRON_SIZE" ), occTriGroup,
+                                   LightApp_Preferences::DblSpin, "3DViewer", "trihedron_size" );
   pref->setItemProperty( "min", 1.0E-06, occTS );
   pref->setItemProperty( "max", 1000, occTS );
+  // .... -> relative size of trihedron
+  pref->addPreference( tr( "PREF_RELATIVE_SIZE" ), occTriGroup, LightApp_Preferences::Bool, "3DViewer", "relative_size" );
+  // .... -> show static trihedron
+  pref->addPreference( tr( "PREF_SHOW_STATIC_TRIHEDRON" ), occTriGroup, LightApp_Preferences::Bool, "3DViewer", "show_static_trihedron" );
+  // ... "Trihedron" group <<end>>
+  // .. "3D viewer" group <<end>>
+
+  QString formats;
+  int bgId;
+#ifndef DISABLE_OCCVIEWER
+  // .. "OCC viewer" group <<start>>
+  int occGroup = pref->addPreference( tr( "PREF_GROUP_OCCVIEWER" ), salomeCat );
 
+  // ... "Background" group <<start>>
+  int bgGroup = pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), occGroup );
+  //  pref->setItemProperty( "columns", 2, bgGroup );
+  aValuesList.clear();
+  anIndicesList.clear();
+  txtList.clear();
+  formats = OCCViewer_Viewer::backgroundData( aValuesList, idList, txtList );
+  foreach( int gid, idList ) anIndicesList << gid;
+  // .... -> 3D viewer background
+  bgId = pref->addPreference( tr( "PREF_3DVIEWER_BACKGROUND" ), bgGroup,
+                                  LightApp_Preferences::Background, "OCCViewer", "background" );
+  pref->setItemProperty( "gradient_names", aValuesList, bgId );
+  pref->setItemProperty( "gradient_ids", anIndicesList, bgId );
+  pref->setItemProperty( "texture_enabled", !txtList.isEmpty(), bgId );
+  pref->setItemProperty( "texture_center_enabled", (bool)txtList.contains( Qtx::CenterTexture ), bgId );
+  pref->setItemProperty( "texture_tile_enabled", (bool)txtList.contains( Qtx::TileTexture ), bgId );
+  pref->setItemProperty( "texture_stretch_enabled", (bool)txtList.contains( Qtx::StretchTexture ), bgId );
+  pref->setItemProperty( "custom_enabled", false, bgId );
+  pref->setItemProperty( "image_formats", formats, bgId );
+  // .... -> XZ viewer background
+  bgId = pref->addPreference( tr( "PREF_XZVIEWER_BACKGROUND" ), bgGroup,
+                              LightApp_Preferences::Background, "OCCViewer", "xz_background" );
+  pref->setItemProperty( "gradient_names", aValuesList, bgId );
+  pref->setItemProperty( "gradient_ids", anIndicesList, bgId );
+  pref->setItemProperty( "texture_enabled", !txtList.isEmpty(), bgId );
+  pref->setItemProperty( "texture_center_enabled", (bool)txtList.contains( Qtx::CenterTexture ), bgId );
+  pref->setItemProperty( "texture_tile_enabled", (bool)txtList.contains( Qtx::TileTexture ), bgId );
+  pref->setItemProperty( "texture_stretch_enabled", (bool)txtList.contains( Qtx::StretchTexture ), bgId );
+  pref->setItemProperty( "custom_enabled", false, bgId );
+  pref->setItemProperty( "image_formats", formats, bgId );
+  // .... -> YZ viewer background
+  bgId = pref->addPreference( tr( "PREF_YZVIEWER_BACKGROUND" ), bgGroup,
+                              LightApp_Preferences::Background, "OCCViewer", "yz_background" );
+  pref->setItemProperty( "gradient_names", aValuesList, bgId );
+  pref->setItemProperty( "gradient_ids", anIndicesList, bgId );
+  pref->setItemProperty( "texture_enabled", !txtList.isEmpty(), bgId );
+  pref->setItemProperty( "texture_center_enabled", (bool)txtList.contains( Qtx::CenterTexture ), bgId );
+  pref->setItemProperty( "texture_tile_enabled", (bool)txtList.contains( Qtx::TileTexture ), bgId );
+  pref->setItemProperty( "texture_stretch_enabled", (bool)txtList.contains( Qtx::StretchTexture ), bgId );
+  pref->setItemProperty( "custom_enabled", false, bgId );
+  pref->setItemProperty( "image_formats", formats, bgId );
+  // .... -> XY viewer background
+  bgId = pref->addPreference( tr( "PREF_XYVIEWER_BACKGROUND" ), bgGroup,
+                              LightApp_Preferences::Background, "OCCViewer", "xy_background" );
+  pref->setItemProperty( "gradient_names", aValuesList, bgId );
+  pref->setItemProperty( "gradient_ids", anIndicesList, bgId );
+  pref->setItemProperty( "texture_enabled", !txtList.isEmpty(), bgId );
+  pref->setItemProperty( "texture_center_enabled", (bool)txtList.contains( Qtx::CenterTexture ), bgId );
+  pref->setItemProperty( "texture_tile_enabled", (bool)txtList.contains( Qtx::TileTexture ), bgId );
+  pref->setItemProperty( "texture_stretch_enabled", (bool)txtList.contains( Qtx::StretchTexture ), bgId );
+  pref->setItemProperty( "custom_enabled", false, bgId );
+  pref->setItemProperty( "image_formats", formats, bgId );
+  // ... "Background" group <<end>>
+
+
+  // ... "Selection" group <<start>>
+  int occSelectionGroup = pref->addPreference( tr( "PREF_GROUP_SELECTION" ), occGroup );
+  pref->setItemProperty( "columns", 2, occSelectionGroup );
+  // .... -> enable preselection
+  pref->addPreference( tr( "PREF_ENABLE_PRESELECTION" ), occSelectionGroup, 
+                      LightApp_Preferences::Bool, "OCCViewer", "enable_preselection" );
+  // .... -> enable selection
+  pref->addPreference( tr( "PREF_ENABLE_SELECTION" ), occSelectionGroup, 
+                      LightApp_Preferences::Bool, "OCCViewer", "enable_selection" );
+  // ... "Selection" group <<end>>
+
+  // ... -> empty frame (for layout) <<start>>
+  int occGen = pref->addPreference( "", occGroup, LightApp_Preferences::Frame );
+  pref->setItemProperty( "margin",  0, occGen );
+  pref->setItemProperty( "columns", 2, occGen );
+  // ... -> empty frame (for layout) <<end>>
+  // .. "OCC viewer" group <<end>>
+#endif
 
-  int isoU = pref->addPreference( tr( "PREF_ISOS_U" ), occGroup,
-                                 LightApp_Preferences::IntSpin, "OCCViewer", "iso_number_u" );
-  pref->setItemProperty( "min", 0, isoU );
-  pref->setItemProperty( "max", 100000, isoU );
-
-  pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), occGroup,
-                      LightApp_Preferences::Color, "OCCViewer", "background" );
-
-  int isoV = pref->addPreference( tr( "PREF_ISOS_V" ), occGroup,
-                                 LightApp_Preferences::IntSpin, "OCCViewer", "iso_number_v" );
-  pref->setItemProperty( "min", 0, isoV );
-  pref->setItemProperty( "max", 100000, isoV );
+#ifndef DISABLE_VTKVIEWER
+  // .. "VTK viewer" group <<start>>
+  int vtkGroup = pref->addPreference( tr( "PREF_GROUP_VTKVIEWER" ), salomeCat ); //viewTab
 
-  // VTK Viewer
+  // ... -> empty frame (for layout) <<start>>
   int vtkGen = pref->addPreference( "", vtkGroup, LightApp_Preferences::Frame );
-  pref->setItemProperty( "columns", 2, vtkGen );
-
+  //pref->setItemProperty( "columns", 2, vtkGen );
+  // .... -> projection mode
   int vtkProjMode = pref->addPreference( tr( "PREF_PROJECTION_MODE" ), vtkGen,
-                                        LightApp_Preferences::Selector, "VTKViewer", "projection_mode" );
-  QStringList aProjModeList;
-  aProjModeList.append( tr("PREF_ORTHOGRAPHIC") );
-  aProjModeList.append( tr("PREF_PERSPECTIVE") );
-
-  QList<QVariant> aModeIndexesList;
-  aModeIndexesList.append(0);
-  aModeIndexesList.append(1);
-
-  pref->setItemProperty( "strings", aProjModeList, vtkProjMode );
-  pref->setItemProperty( "indexes", aModeIndexesList, vtkProjMode );
-
-  pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), vtkGen,
-                      LightApp_Preferences::Color, "VTKViewer", "background" );
-
-  int vtkTS = pref->addPreference( tr( "PREF_TRIHEDRON_SIZE" ), vtkGen,
-                                  LightApp_Preferences::DblSpin, "VTKViewer", "trihedron_size" );
-
-  pref->setItemProperty( "min", 1.0E-06, vtkTS );
-  pref->setItemProperty( "max", 150, vtkTS );
-
-  pref->addPreference( tr( "PREF_RELATIVE_SIZE" ), vtkGen, LightApp_Preferences::Bool, "VTKViewer", "relative_size" );
-
-  int vtkStyleMode = pref->addPreference( tr( "PREF_NAVIGATION" ), vtkGen,
-                                         LightApp_Preferences::Selector, "VTKViewer", "navigation_mode" );
-  QStringList aStyleModeList;
-  aStyleModeList.append( tr("PREF_STANDARD_STYLE") );
-  aStyleModeList.append( tr("PREF_KEYFREE_STYLE") );
-
-  pref->setItemProperty( "strings", aStyleModeList, vtkStyleMode );
-  pref->setItemProperty( "indexes", aModeIndexesList, vtkStyleMode );
-
-  pref->addPreference( "", vtkGroup, LightApp_Preferences::Space );
-
+                                         LightApp_Preferences::Selector, "VTKViewer", "projection_mode" );
+  aValuesList.clear();
+  anIndicesList.clear();
+  aValuesList   << tr("PREF_ORTHOGRAPHIC") << tr("PREF_PERSPECTIVE");
+  anIndicesList << 0                       << 1;
+  pref->setItemProperty( "strings", aValuesList,   vtkProjMode );
+  pref->setItemProperty( "indexes", anIndicesList, vtkProjMode );
+  // .... -> background
+  aValuesList.clear();
+  anIndicesList.clear();
+  txtList.clear();
+#ifndef DISABLE_SALOMEOBJECT
+  formats = SVTK_Viewer::backgroundData( aValuesList, idList, txtList );
+#endif
+  foreach( int gid, idList ) anIndicesList << gid;
+  bgId = pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), vtkGen,
+                              LightApp_Preferences::Background, "VTKViewer", "background" );
+  pref->setItemProperty( "gradient_names", aValuesList, bgId );
+  pref->setItemProperty( "gradient_ids", anIndicesList, bgId );
+  pref->setItemProperty( "texture_enabled", !txtList.isEmpty(), bgId );
+  pref->setItemProperty( "texture_center_enabled", (bool)txtList.contains( Qtx::CenterTexture ), bgId );
+  pref->setItemProperty( "texture_tile_enabled", (bool)txtList.contains( Qtx::TileTexture ), bgId );
+  pref->setItemProperty( "texture_stretch_enabled", (bool)txtList.contains( Qtx::StretchTexture ), bgId );
+  pref->setItemProperty( "custom_enabled", false, bgId );
+#ifndef DISABLE_SALOMEOBJECT
+  pref->setItemProperty( "image_formats", formats, bgId );
+#endif
+  // .... -> speed increment
   int vtkSpeed = pref->addPreference( tr( "PREF_INCREMENTAL_SPEED" ), vtkGen,
-                                     LightApp_Preferences::IntSpin, "VTKViewer", "speed_value" );
-
+                                      LightApp_Preferences::IntSpin, "VTKViewer", "speed_value" );
   pref->setItemProperty( "min", 1, vtkSpeed );
   pref->setItemProperty( "max", 1000, vtkSpeed );
-
+  // .... -> speed mode
   int vtkSpeedMode = pref->addPreference( tr( "PREF_INCREMENTAL_SPEED_MODE" ), vtkGen,
-                                         LightApp_Preferences::Selector, "VTKViewer", "speed_mode" );
-  QStringList aSpeedModeList;
-  aSpeedModeList.append( tr("PREF_ARITHMETIC") );
-  aSpeedModeList.append( tr("PREF_GEOMETRICAL") );
+                                          LightApp_Preferences::Selector, "VTKViewer", "speed_mode" );
+  aValuesList.clear();
+  anIndicesList.clear();
+  aValuesList   << tr("PREF_ARITHMETIC") << tr("PREF_GEOMETRICAL");
+  anIndicesList << 0                     << 1;
+  pref->setItemProperty( "strings", aValuesList,   vtkSpeedMode );
+  pref->setItemProperty( "indexes", anIndicesList, vtkSpeedMode );
+
+  // ... "Selection" group <<start>>
+  int vtkSelectionGroup = pref->addPreference( tr( "PREF_GROUP_SELECTION" ), vtkGroup );
+  pref->setItemProperty( "columns", 2, vtkSelectionGroup );
+  // .... -> preselection
+  int vtkPreselection = pref->addPreference( tr( "PREF_PRESELECTION" ),  vtkSelectionGroup, 
+                                             LightApp_Preferences::Selector, "VTKViewer", "preselection" );
+  aValuesList.clear();
+  anIndicesList.clear();
+  aValuesList   << tr("PREF_PRESELECTION_STANDARD") << tr("PREF_PRESELECTION_DYNAMIC") << tr("PREF_PRESELECTION_DISABLED");
+  anIndicesList << 0 << 1 << 2;
+  pref->setItemProperty( "strings", aValuesList,   vtkPreselection );
+  pref->setItemProperty( "indexes", anIndicesList, vtkPreselection );
+  // .... -> enable selection
+  pref->addPreference( tr( "PREF_ENABLE_SELECTION" ), vtkSelectionGroup, LightApp_Preferences::Bool, "VTKViewer", "enable_selection" );
+  // ... "Selection" group <<end>>
 
-  pref->setItemProperty( "strings", aSpeedModeList, vtkSpeedMode );
-  pref->setItemProperty( "indexes", aModeIndexesList, vtkSpeedMode );
+  // ... -> empty frame (for layout) <<end>>
 
+  // ... space mouse sub-group <<start>>
   int vtkSM = pref->addPreference( tr( "PREF_FRAME_SPACEMOUSE" ), vtkGroup, LightApp_Preferences::GroupBox );
-  pref->setItemProperty( "columns", 2, vtkSM );
+  //pref->setItemProperty( "columns", 2, vtkSM );
+  // .... -> decrease speed increment
   int spacemousePref1 = pref->addPreference( tr( "PREF_SPACEMOUSE_FUNC_1" ), vtkSM,
-                                            LightApp_Preferences::Selector, "VTKViewer",
-                                            "spacemouse_func1_btn" ); //decrease_speed_increment
+                                             LightApp_Preferences::Selector, "VTKViewer",
+                                             "spacemouse_func1_btn" );
+  // .... -> increase speed increment
   int spacemousePref2 = pref->addPreference( tr( "PREF_SPACEMOUSE_FUNC_2" ), vtkSM,
-                                            LightApp_Preferences::Selector, "VTKViewer",
-                                            "spacemouse_func2_btn" ); //increase_speed_increment
+                                             LightApp_Preferences::Selector, "VTKViewer",
+                                             "spacemouse_func2_btn" );
+  // .... -> dominant / combined switch  
   int spacemousePref3 = pref->addPreference( tr( "PREF_SPACEMOUSE_FUNC_3" ), vtkSM,
-                                            LightApp_Preferences::Selector, "VTKViewer",
-                                            "spacemouse_func5_btn" ); //dominant_combined_switch
-
-  QStringList values;
-  values.append( tr( "PREF_SPACEMOUSE_BTN_1" ) );
-  values.append( tr( "PREF_SPACEMOUSE_BTN_2" ) );
-  values.append( tr( "PREF_SPACEMOUSE_BTN_3" ) );
-  values.append( tr( "PREF_SPACEMOUSE_BTN_4" ) );
-  values.append( tr( "PREF_SPACEMOUSE_BTN_5" ) );
-  values.append( tr( "PREF_SPACEMOUSE_BTN_6" ) );
-  values.append( tr( "PREF_SPACEMOUSE_BTN_7" ) );
-  values.append( tr( "PREF_SPACEMOUSE_BTN_8" ) );
-  values.append( tr( "PREF_SPACEMOUSE_BTN_*" ) );
-  values.append( tr( "PREF_SPACEMOUSE_BTN_10" ) );
-  values.append( tr( "PREF_SPACEMOUSE_BTN_11" ) );
-  QList<QVariant> indices;
-  indices.append( 1 );
-  indices.append( 2 );
-  indices.append( 3 );
-  indices.append( 4 );
-  indices.append( 5 );
-  indices.append( 6 );
-  indices.append( 7 );
-  indices.append( 8 );
-  indices.append( 9 ); // == button_*
-  indices.append( 10 );
-  indices.append( 11 );
-  pref->setItemProperty( "strings", values, spacemousePref1 );
-  pref->setItemProperty( "indexes", indices, spacemousePref1 );
-  pref->setItemProperty( "strings", values, spacemousePref2 );
-  pref->setItemProperty( "indexes", indices, spacemousePref2 );
-  pref->setItemProperty( "strings", values, spacemousePref3 );
-  pref->setItemProperty( "indexes", indices, spacemousePref3 );
-
+                                             LightApp_Preferences::Selector, "VTKViewer",
+                                             "spacemouse_func5_btn" ); //
+  aValuesList.clear();
+  anIndicesList.clear();
+  aValuesList << tr( "PREF_SPACEMOUSE_BTN_1" )  << tr( "PREF_SPACEMOUSE_BTN_2" ) << tr( "PREF_SPACEMOUSE_BTN_3" );
+  aValuesList << tr( "PREF_SPACEMOUSE_BTN_4" )  << tr( "PREF_SPACEMOUSE_BTN_5" ) << tr( "PREF_SPACEMOUSE_BTN_6" );
+  aValuesList << tr( "PREF_SPACEMOUSE_BTN_7" )  << tr( "PREF_SPACEMOUSE_BTN_8" ) << tr( "PREF_SPACEMOUSE_BTN_*" );
+  aValuesList << tr( "PREF_SPACEMOUSE_BTN_10" ) << tr( "PREF_SPACEMOUSE_BTN_11" );
+  anIndicesList << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10 << 11;
+  pref->setItemProperty( "strings", aValuesList,   spacemousePref1 );
+  pref->setItemProperty( "indexes", anIndicesList, spacemousePref1 );
+  pref->setItemProperty( "strings", aValuesList,   spacemousePref2 );
+  pref->setItemProperty( "indexes", anIndicesList, spacemousePref2 );
+  pref->setItemProperty( "strings", aValuesList,   spacemousePref3 );
+  pref->setItemProperty( "indexes", anIndicesList, spacemousePref3 );
+  // ... space mouse sub-group <<end>>
+
+  // ... avi recording sub-group <<start>>
   int vtkRec = pref->addPreference( tr( "PREF_FRAME_RECORDING" ), vtkGroup, LightApp_Preferences::GroupBox );
   pref->setItemProperty( "columns", 2, vtkRec );
-
+  // .... -> recording mode
   int modePref = pref->addPreference( tr( "PREF_RECORDING_MODE" ), vtkRec,
-                                     LightApp_Preferences::Selector, "VTKViewer", "recorder_mode" );
-  values.clear();
-  values.append( tr( "PREF_SKIPPED_FRAMES" ) );
-  values.append( tr( "PREF_ALL_DISLPAYED_FRAMES" ) );
-  indices.clear();
-  indices.append( 0 );
-  indices.append( 1 );
-  pref->setItemProperty( "strings", values, modePref );
-  pref->setItemProperty( "indexes", indices, modePref );
-
+                                      LightApp_Preferences::Selector, "VTKViewer", "recorder_mode" );
+  aValuesList.clear();
+  anIndicesList.clear();
+  aValuesList   << tr( "PREF_SKIPPED_FRAMES" ) << tr( "PREF_ALL_DISLPAYED_FRAMES" );
+  anIndicesList << 0                           << 1;
+  pref->setItemProperty( "strings", aValuesList,   modePref );
+  pref->setItemProperty( "indexes", anIndicesList, modePref );
+  // .... -> fps
   int fpsPref = pref->addPreference( tr( "PREF_FPS" ), vtkRec,
-                                    LightApp_Preferences::DblSpin, "VTKViewer", "recorder_fps" );
+                                     LightApp_Preferences::DblSpin, "VTKViewer", "recorder_fps" );
   pref->setItemProperty( "min", 0.1, fpsPref );
   pref->setItemProperty( "max", 100, fpsPref );
-
+  // .... -> quality
   int qualityPref = pref->addPreference( tr( "PREF_QUALITY" ), vtkRec,
-                                        LightApp_Preferences::IntSpin, "VTKViewer", "recorder_quality" );
+                                         LightApp_Preferences::IntSpin, "VTKViewer", "recorder_quality" );
   pref->setItemProperty( "min", 1, qualityPref );
   pref->setItemProperty( "max", 100, qualityPref );
-
+  // .... -> progressive mode
   pref->addPreference( tr( "PREF_PROGRESSIVE" ), vtkRec,
-                      LightApp_Preferences::Bool, "VTKViewer", "recorder_progressive" );
+                       LightApp_Preferences::Bool, "VTKViewer", "recorder_progressive" );
+  // ... avi recording sub-group <<end>>
+
+  // ... group names sub-group <<start>>
+  int vtkGN = pref->addPreference( tr( "PREF_FRAME_GROUP_NAMES" ), vtkGroup,
+                                   LightApp_Preferences::GroupBox, "VTKViewer", "show_group_names" );
+  pref->setItemProperty( "columns", 2, vtkGN );
+  // .... -> text color
+  pref->addPreference( tr(  "PREF_GROUP_NAMES_TEXT_COLOR" ), vtkGN,
+                       LightApp_Preferences::Color, "VTKViewer", "group_names_text_color" );
+  // .... -> transparency
+  int transPref = pref->addPreference( tr( "PREF_GROUP_NAMES_TRANSPARENCY" ), vtkGN,
+                                       LightApp_Preferences::DblSpin, "VTKViewer", "group_names_transparency" );
+  pref->setItemProperty( "min", 0.0, transPref );
+  pref->setItemProperty( "max", 1.0, transPref );
+  pref->setItemProperty( "step", 0.1, transPref );
+  // ... -> group names sub-group <<end>>
+  // .. "VTK viewer" group <<end>>
+#endif
 
-  // Plot2d
-  pref->addPreference( tr( "PREF_SHOW_LEGEND" ), plot2dGroup,
-                      LightApp_Preferences::Bool, "Plot2d", "ShowLegend" );
+  // .. "Plot2d viewer" group <<start>>
+  int plot2dGroup = pref->addPreference( tr( "PREF_GROUP_PLOT2DVIEWER" ), salomeCat ); //viewTab
+  //pref->setItemProperty( "columns", 2, plot2dGroup );
 
+  // ... -> show legend
+  pref->addPreference( tr( "PREF_SHOW_LEGEND" ), plot2dGroup,
+                       LightApp_Preferences::Bool, "Plot2d", "ShowLegend" );
+  // ... -> legend position
   int legendPosition = pref->addPreference( tr( "PREF_LEGEND_POSITION" ), plot2dGroup,
-                                           LightApp_Preferences::Selector, "Plot2d", "LegendPos" );
+                                            LightApp_Preferences::Selector, "Plot2d", "LegendPos" );
   aValuesList.clear();
   anIndicesList.clear();
   aValuesList   << tr("PREF_LEFT") << tr("PREF_RIGHT") << tr("PREF_TOP") << tr("PREF_BOTTOM");
   anIndicesList << 0               << 1                << 2              << 3                ;
-
   pref->setItemProperty( "strings", aValuesList,   legendPosition );
   pref->setItemProperty( "indexes", anIndicesList, legendPosition );
-
+  // ... -> legend font
+  pref->addPreference( tr( "PREF_LEGEND_FONT" ), plot2dGroup, LightApp_Preferences::Font, "Plot2d", "LegendFont" );
+  // ... -> curve type
   int curveType = pref->addPreference( tr( "PREF_CURVE_TYPE" ), plot2dGroup,
-                                      LightApp_Preferences::Selector, "Plot2d", "CurveType" );
+                                       LightApp_Preferences::Selector, "Plot2d", "CurveType" );
   aValuesList.clear();
   anIndicesList.clear();
   aValuesList   << tr("PREF_POINTS") << tr("PREF_LINES") << tr("PREF_SPLINE");
   anIndicesList << 0                 << 1                << 2                ;
-
   pref->setItemProperty( "strings", aValuesList,   curveType );
   pref->setItemProperty( "indexes", anIndicesList, curveType );
-
+  // ... -> marker size
   int markerSize = pref->addPreference( tr( "PREF_MARKER_SIZE" ), plot2dGroup,
-                                       LightApp_Preferences::IntSpin, "Plot2d", "MarkerSize" );
-
+                                        LightApp_Preferences::IntSpin, "Plot2d", "MarkerSize" );
   pref->setItemProperty( "min", 0, markerSize );
   pref->setItemProperty( "max", 100, markerSize );
-
+  // ... -> horizontal scaling mode
+  int horScale = pref->addPreference( tr( "PREF_HOR_AXIS_SCALE" ), plot2dGroup,
+                                      LightApp_Preferences::Selector, "Plot2d", "HorScaleMode" );
   aValuesList.clear();
   anIndicesList.clear();
   aValuesList   << tr("PREF_LINEAR") << tr("PREF_LOGARITHMIC");
   anIndicesList << 0                 << 1                     ;
-
-  int horScale = pref->addPreference( tr( "PREF_HOR_AXIS_SCALE" ), plot2dGroup,
-                                     LightApp_Preferences::Selector, "Plot2d", "HorScaleMode" );
-
   pref->setItemProperty( "strings", aValuesList,   horScale );
   pref->setItemProperty( "indexes", anIndicesList, horScale );
-
+  // ... -> vertical scaling mode
   int verScale = pref->addPreference( tr( "PREF_VERT_AXIS_SCALE" ), plot2dGroup,
-                                     LightApp_Preferences::Selector, "Plot2d", "VerScaleMode" );
-
+                                      LightApp_Preferences::Selector, "Plot2d", "VerScaleMode" );
   pref->setItemProperty( "strings", aValuesList,   verScale );
   pref->setItemProperty( "indexes", anIndicesList, verScale );
-
-  pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), plot2dGroup,
-                      LightApp_Preferences::Color, "Plot2d", "Background" );
-
+  // ... -> background
+  pref->addPreference( tr( "PREF_VIEWER_BACKGROUND_COLOR" ), plot2dGroup,
+                       LightApp_Preferences::Color, "Plot2d", "Background" );
+  // ... -> font color
+  pref->addPreference( tr( "PREF_FONT_COLOR" ), plot2dGroup, LightApp_Preferences::Color, "Plot2d", "LegendFontColor" );
+  // ... -> selection font color
+  pref->addPreference( tr( "PREF_SELECTED_FONT_COLOR" ), plot2dGroup, LightApp_Preferences::Color, "Plot2d", "SelectedLegendFontColor" );
+  // ... -> selection color
+  pref->addPreference( tr( "PREF_VIEWER_SELECTION" ), plot2dGroup,
+                       LightApp_Preferences::Color, "Plot2d", "SelectionColor" );
+  // ... -> errors/deviation colot
+  pref->addPreference( tr( "PREF_DEVIATION_COLOR" ), plot2dGroup,
+                       LightApp_Preferences::Color, "Plot2d", "DeviationMarkerColor" );
+  // ... -> deviation markers line size
+  int deviationMarkerLw = pref->addPreference( tr( "PREF_DEVIATION_MARKER_LW" ), plot2dGroup,
+                                        LightApp_Preferences::IntSpin, "Plot2d", "DeviationMarkerLineWidth" );
+  pref->setItemProperty( "min", 1, deviationMarkerLw );
+  pref->setItemProperty( "max", 5, deviationMarkerLw );
+  // ... -> deviation markers tick mark size
+  int deviationMarkerTs = pref->addPreference( tr( "PREF_DEVIATION_MARKER_TS" ), plot2dGroup,
+                                        LightApp_Preferences::IntSpin, "Plot2d", "DeviationMarkerTickSize" );
+  pref->setItemProperty( "min", 1, deviationMarkerTs );
+  pref->setItemProperty( "max", 5, deviationMarkerTs );
+  // .. "Plot2d viewer" group <<end>>
+
+  // .. "Directories" preferences tab <<start>>
   int dirTab = pref->addPreference( tr( "PREF_TAB_DIRECTORIES" ), salomeCat );
+  // ... --> quick directories list
   int dirGroup = pref->addPreference( tr( "PREF_GROUP_DIRECTORIES" ), dirTab );
   pref->addPreference( tr( "" ), dirGroup,
-                      LightApp_Preferences::DirList, "FileDlg", "QuickDirList" );
-
-  pref->setItemProperty( "columns", 4, supervGroup );
-  pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), supervGroup,
-                      LightApp_Preferences::Color, "SUPERVGraph", "Background" );
-  pref->addPreference( tr( "PREF_SUPERV_TITLE_COLOR" ), supervGroup,
-                      LightApp_Preferences::Color, "SUPERVGraph", "Title" );
-//  pref->addPreference( tr( "PREF_SUPERV_CTRL_COLOR" ), supervGroup,
-//                    LightApp_Preferences::Color, "SUPERVGraph", "Ctrl" );
+                       LightApp_Preferences::DirList, "FileDlg", "QuickDirList" );
+  // .. "Directories" preferences tab <<end>>
 
+  // .. "Object browser" preferences tab <<start>>
   int obTab = pref->addPreference( tr( "PREF_TAB_OBJBROWSER" ), salomeCat );
+
+  // ... "Search tool" group <<start>>
   int stGroup = pref->addPreference( tr( "PREF_OBJ_BROWSER_SEARCH_TOOL" ), obTab );
+  // .... --> auto-hide
   pref->addPreference( tr( "PREF_AUTO_HIDE_SEARCH_TOOL" ), stGroup, LightApp_Preferences::Bool,
-                      "ObjectBrowser", "auto_hide_search_tool" );
+                       "ObjectBrowser", "auto_hide_search_tool" );
+  // ... "Search tool" group <<end>>
 
-  int objSetGroup = pref->addPreference( tr( "PREF_OBJ_BROWSER_SETTINGS" ), obTab );
+  // ... "Object browser settings" group <<start>>
+  int objSetGroup = pref->addPreference( tr( "PREF_GROUP_LOOK_AND_FEEL" ), obTab );
   pref->setItemProperty( "columns", 2, objSetGroup );
+  // .... -> auto size first column
   pref->addPreference( tr( "PREF_AUTO_SIZE_FIRST" ), objSetGroup, LightApp_Preferences::Bool,
-                      "ObjectBrowser", "auto_size_first" );
+                       "ObjectBrowser", "auto_size_first" );
+  // .... -> auto size other columns
   pref->addPreference( tr( "PREF_AUTO_SIZE" ), objSetGroup, LightApp_Preferences::Bool,
-                      "ObjectBrowser", "auto_size" );
+                       "ObjectBrowser", "auto_size" );
+  // .... -> resize columns on expand item
   pref->addPreference( tr( "PREF_RESIZE_ON_EXPAND_ITEM" ), objSetGroup, LightApp_Preferences::Bool,
-                      "ObjectBrowser", "resize_on_expand_item" );
-
-  // MRU preferences
-  int mruGroup = pref->addPreference( tr( "PREF_GROUP_MRU" ), genTab, LightApp_Preferences::Auto, "MRU", "show_mru" );
-  pref->setItemProperty( "columns", 4, mruGroup );
-  int mruVisCount = pref->addPreference( tr( "PREF_MRU_VISIBLE_COUNT" ), mruGroup, LightApp_Preferences::IntSpin,
-                                        "MRU", "visible_count" );
-  pref->setItemProperty( "min", 0,   mruVisCount );
-  pref->setItemProperty( "max", 100, mruVisCount );
-  int mruLinkType = pref->addPreference( tr( "PREF_MRU_LINK_TYPE" ), mruGroup, LightApp_Preferences::Selector,
-                                        "MRU", "link_type" );
+                       "ObjectBrowser", "resize_on_expand_item" );
+  // .... -> browse to published object
+  int browsePublished = pref->addPreference( tr( "PREF_BROWSE_TO_THE_PUBLISHED_OBJECT" ), objSetGroup, LightApp_Preferences::Selector,
+                                             "ObjectBrowser", "browse_published_object" );
   aValuesList.clear();
   anIndicesList.clear();
-  aValuesList   << tr("PREF_MRU_LINK_AUTO") << tr("PREF_MRU_LINK_SHORT") << tr("PREF_MRU_LINK_FULL");
-  anIndicesList << 0                        << 1                         << 2                       ;
-  pref->setItemProperty( "strings", aValuesList,   mruLinkType );
-  pref->setItemProperty( "indexes", anIndicesList, mruLinkType );
+  aValuesList << tr( "PREF_BROWSE_NEVER" ) << tr( "PREF_BROWSE_AFTER_APPLY_AND_CLOSE_ONLY" ) << tr( "PREF_BROWSE_ALWAYS" );
+  anIndicesList << BP_Never << BP_ApplyAndClose << BP_Always;
+  pref->setItemProperty( "strings", aValuesList,   browsePublished );
+  pref->setItemProperty( "indexes", anIndicesList, browsePublished );
+  // ... "Object browser settings" group <<end>>
+  // .. "Object browser" preferences tab <<end>>
+
+  // .. "Shortcuts" preferences tab <<start>>
+  int shortcutTab = pref->addPreference( tr( "PREF_TAB_SHORTCUTS" ), salomeCat );
+  // ... "Shortcuts settings" group <<start>>
+  int shortcutGroup = pref->addPreference( tr( "PREF_GROUP_SHORTCUTS" ), shortcutTab );
+  pref->addPreference( tr( "" ), shortcutGroup,
+                       LightApp_Preferences::ShortcutTree, "shortcuts" );
+  // ... "Shortcuts settings" group <<end>>
+  // .. "Shortcuts" preferences tab <<end>>
+  // . Top-level "SALOME" preferences group <<end>>
 
   pref->retrieve();
 }
@@ -2094,51 +2567,203 @@ void LightApp_Application::preferencesChanged( const QString& sec, const QString
   if ( !resMgr )
     return;
 
-#ifndef DISABLE_OCCVIEWER
-  if ( sec == QString( "OCCViewer" ) && param == QString( "trihedron_size" ) )
+  if ( sec == "viewers" && param == "drop_down_buttons" )
+  {
+    ViewManagerList vmlist = viewManagers();
+    foreach( SUIT_ViewManager* vm, vmlist )
+    {
+      QVector<SUIT_ViewWindow*> vwlist = vm->getViews();
+      foreach( SUIT_ViewWindow* vw, vwlist )
+        if ( vw ) vw->setDropDownButtons( resMgr->booleanValue( "viewers", "drop_down_buttons", true ) );
+    }
+  }
+
+  if ( sec == QString( "3DViewer" ) && (param == QString( "trihedron_size" ) || param == QString( "relative_size" )))
   {
-    double sz = resMgr->doubleValue( sec, param, -1 );
+    double sz = resMgr->doubleValue( sec, "trihedron_size", -1 );
+    bool relative = resMgr->booleanValue( sec, "relative_size", true );
     QList<SUIT_ViewManager*> lst;
+#ifndef DISABLE_OCCVIEWER
     viewManagers( OCCViewer_Viewer::Type(), lst );
-    QListIterator<SUIT_ViewManager*> it( lst );
-    while ( it.hasNext() && sz >= 0 )
+    QListIterator<SUIT_ViewManager*> itOCC( lst );
+    while ( itOCC.hasNext() && sz >= 0 )
     {
-      SUIT_ViewModel* vm = it.next()->getViewModel();
+      SUIT_ViewModel* vm = itOCC.next()->getViewModel();
       if ( !vm || !vm->inherits( "OCCViewer_Viewer" ) )
-       continue;
+        continue;
 
       OCCViewer_Viewer* occVM = (OCCViewer_Viewer*)vm;
-      occVM->setTrihedronSize( sz );
+      occVM->setTrihedronSize( sz, relative );
       occVM->getAISContext()->UpdateCurrentViewer();
     }
-  }
 #endif
-
 #ifndef DISABLE_VTKVIEWER
-  if ( sec == QString( "VTKViewer" ) && (param == QString( "trihedron_size" ) || param == QString( "relative_size" )) )
+#ifndef DISABLE_SALOMEOBJECT
+    viewManagers( SVTK_Viewer::Type(), lst );
+    QListIterator<SUIT_ViewManager*> itVTK( lst );
+    while ( itVTK.hasNext() && sz >= 0 )
+    {
+      SUIT_ViewModel* vm = itVTK.next()->getViewModel();
+      if ( !vm || !vm->inherits( "SVTK_Viewer" ) )
+        continue;
+
+      SVTK_Viewer* vtkVM = dynamic_cast<SVTK_Viewer*>( vm );
+      if( vtkVM )
+      {
+        vtkVM->setTrihedronSize( sz, relative );
+        vtkVM->Repaint();
+      }
+    }
+#endif
+#endif
+  }
+
+  if ( sec == QString( "3DViewer" ) && param == QString( "show_static_trihedron" ) )
   {
-    double sz = resMgr->doubleValue( "VTKViewer", "trihedron_size", -1 );
-    bool isRelative = resMgr->booleanValue( "VTKViewer", "relative_size", true );
+    bool isVisible = resMgr->booleanValue( "3DViewer", "show_static_trihedron", true );
     QList<SUIT_ViewManager*> lst;
+#ifndef DISABLE_OCCVIEWER
+    viewManagers( OCCViewer_Viewer::Type(), lst );
+    QListIterator<SUIT_ViewManager*> itOCC( lst );
+    while ( itOCC.hasNext() )
+    {
+      SUIT_ViewModel* vm = itOCC.next()->getViewModel();
+      if ( !vm || !vm->inherits( "OCCViewer_Viewer" ) )
+        continue;
+
+      OCCViewer_Viewer* occVM = dynamic_cast<OCCViewer_Viewer*>( vm );
+      if( occVM )
+      {
+        occVM->setStaticTrihedronDisplayed( isVisible );
+      }
+    }
+#endif
+#ifndef DISABLE_VTKVIEWER
 #ifndef DISABLE_SALOMEOBJECT
     viewManagers( SVTK_Viewer::Type(), lst );
-    QListIterator<SUIT_ViewManager*> it( lst );
-    while ( it.hasNext() && sz >= 0 )
+    QListIterator<SUIT_ViewManager*> itVTK( lst );
+    while ( itVTK.hasNext() )
     {
-      SUIT_ViewModel* vm = it.next()->getViewModel();
+      SUIT_ViewModel* vm = itVTK.next()->getViewModel();
       if ( !vm || !vm->inherits( "SVTK_Viewer" ) )
-       continue;
+        continue;
 
       SVTK_Viewer* vtkVM = dynamic_cast<SVTK_Viewer*>( vm );
       if( vtkVM )
       {
-       vtkVM->setTrihedronSize( sz, isRelative );
-       vtkVM->Repaint();
+        vtkVM->setStaticTrihedronVisible( isVisible );
+        vtkVM->Repaint();
       }
     }
+#endif
 #endif
   }
+
+  if ( sec == QString( "3DViewer" ) && param == QString( "navigation_mode" ) )
+  {
+    int mode = resMgr->integerValue( "3DViewer", "navigation_mode", 0 );
+    QList<SUIT_ViewManager*> lst;
+#ifndef DISABLE_OCCVIEWER
+    viewManagers( OCCViewer_Viewer::Type(), lst );
+    QListIterator<SUIT_ViewManager*> itOCC( lst );
+    while ( itOCC.hasNext() )
+    {
+      SUIT_ViewModel* vm = itOCC.next()->getViewModel();
+      if ( !vm || !vm->inherits( "OCCViewer_Viewer" ) )
+        continue;
+
+      OCCViewer_Viewer* occVM = (OCCViewer_Viewer*)vm;
+      occVM->setInteractionStyle( mode );
+    }
 #endif
+#ifndef DISABLE_VTKVIEWER
+#ifndef DISABLE_SALOMEOBJECT
+    viewManagers( SVTK_Viewer::Type(), lst );
+    QListIterator<SUIT_ViewManager*> itVTK( lst );
+    while ( itVTK.hasNext() )
+    {
+      SUIT_ViewModel* vm = itVTK.next()->getViewModel();
+      if ( !vm || !vm->inherits( "SVTK_Viewer" ) )
+        continue;
+
+      SVTK_Viewer* vtkVM = dynamic_cast<SVTK_Viewer*>( vm );
+      if( vtkVM ) vtkVM->setInteractionStyle( mode );
+    }
+#endif
+#endif
+  }
+
+#ifndef DISABLE_OCCVIEWER
+  if ( sec == QString( "OCCViewer" ) && param == QString( "enable_preselection" ) )
+  {
+    bool isToEnablePreselection = resMgr->booleanValue( "OCCViewer", "enable_preselection", true );
+    QList<SUIT_ViewManager*> lst;
+    viewManagers( OCCViewer_Viewer::Type(), lst );
+    QListIterator<SUIT_ViewManager*> it( lst );
+    while ( it.hasNext() )
+    {
+      SUIT_ViewModel* vm = it.next()->getViewModel();
+      if ( !vm || !vm->inherits( "OCCViewer_Viewer" ) )
+        continue;
+
+      OCCViewer_Viewer* occVM = (OCCViewer_Viewer*)vm;
+      occVM->enablePreselection( isToEnablePreselection );
+    }
+  }
+#endif
+
+#ifndef DISABLE_OCCVIEWER
+  if ( sec == QString( "OCCViewer" ) && param == QString( "enable_selection" ) )
+  {
+    bool isToEnableSelection = resMgr->booleanValue( "OCCViewer", "enable_selection", true );
+    QList<SUIT_ViewManager*> lst;
+    viewManagers( OCCViewer_Viewer::Type(), lst );
+    QListIterator<SUIT_ViewManager*> it( lst );
+    while ( it.hasNext() )
+    {
+      SUIT_ViewModel* vm = it.next()->getViewModel();
+      if ( !vm || !vm->inherits( "OCCViewer_Viewer" ) )
+        continue;
+
+      OCCViewer_Viewer* occVM = (OCCViewer_Viewer*)vm;
+      occVM->enableSelection( isToEnableSelection );
+    }
+  }
+#endif
+
+  if ( sec == QString( "3DViewer" ) && param == QString( "zooming_mode" ) )
+  {
+    int mode = resMgr->integerValue( "3DViewer", "zooming_mode", 0 );
+    QList<SUIT_ViewManager*> lst;
+#ifndef DISABLE_OCCVIEWER
+    viewManagers( OCCViewer_Viewer::Type(), lst );
+    QListIterator<SUIT_ViewManager*> itOCC( lst );
+    while ( itOCC.hasNext() )
+    {
+      SUIT_ViewModel* vm = itOCC.next()->getViewModel();
+      if ( !vm || !vm->inherits( "OCCViewer_Viewer" ) )
+        continue;
+
+      OCCViewer_Viewer* occVM = (OCCViewer_Viewer*)vm;
+      occVM->setZoomingStyle( mode );
+    }
+#endif
+#ifndef DISABLE_VTKVIEWER
+#ifndef DISABLE_SALOMEOBJECT
+    viewManagers( SVTK_Viewer::Type(), lst );
+    QListIterator<SUIT_ViewManager*> itVTK( lst );
+    while ( itVTK.hasNext() )
+    {
+      SUIT_ViewModel* vm = itVTK.next()->getViewModel();
+      if ( !vm || !vm->inherits( "SVTK_Viewer" ) )
+        continue;
+
+      SVTK_Viewer* vtkVM = dynamic_cast<SVTK_Viewer*>( vm );
+      if( vtkVM ) vtkVM->setZoomingStyle( mode );
+    }
+#endif
+#endif
+  }
 
 #ifndef DISABLE_VTKVIEWER
   if ( sec == QString( "VTKViewer" ) && (param == QString( "speed_value" ) || param == QString( "speed_mode" )) )
@@ -2153,7 +2778,7 @@ void LightApp_Application::preferencesChanged( const QString& sec, const QString
     {
       SUIT_ViewModel* vm = it.next()->getViewModel();
       if ( !vm || !vm->inherits( "SVTK_Viewer" ) )
-       continue;
+        continue;
 
       SVTK_Viewer* vtkVM = dynamic_cast<SVTK_Viewer*>( vm );
       if( vtkVM ) vtkVM->setIncrementalSpeed( speed, mode );
@@ -2174,7 +2799,7 @@ void LightApp_Application::preferencesChanged( const QString& sec, const QString
     {
       SUIT_ViewModel* vm = it.next()->getViewModel();
       if ( !vm || !vm->inherits( "SVTK_Viewer" ) )
-       continue;
+        continue;
 
       SVTK_Viewer* vtkVM = dynamic_cast<SVTK_Viewer*>( vm );
       if( vtkVM ) vtkVM->setProjectionMode( mode );
@@ -2184,9 +2809,9 @@ void LightApp_Application::preferencesChanged( const QString& sec, const QString
 #endif
 
 #ifndef DISABLE_VTKVIEWER
-  if ( sec == QString( "VTKViewer" ) && param == QString( "navigation_mode" ) )
+  if ( sec == QString( "VTKViewer" ) && param == QString( "preselection" ) )
   {
-    int mode = resMgr->integerValue( "VTKViewer", "navigation_mode", 0 );
+    int mode = resMgr->integerValue( "VTKViewer", "preselection", 0 );
     QList<SUIT_ViewManager*> lst;
 #ifndef DISABLE_SALOMEOBJECT
     viewManagers( SVTK_Viewer::Type(), lst );
@@ -2195,23 +2820,19 @@ void LightApp_Application::preferencesChanged( const QString& sec, const QString
     {
       SUIT_ViewModel* vm = it.next()->getViewModel();
       if ( !vm || !vm->inherits( "SVTK_Viewer" ) )
-       continue;
+        continue;
 
       SVTK_Viewer* vtkVM = dynamic_cast<SVTK_Viewer*>( vm );
-      if( vtkVM ) vtkVM->setInteractionStyle( mode );
+      if( vtkVM ) vtkVM->setPreSelectionMode( mode );
     }
 #endif
   }
 #endif
 
 #ifndef DISABLE_VTKVIEWER
-  if ( sec == QString( "VTKViewer" ) && (param == QString( "spacemouse_func1_btn" ) ||
-                                        param == QString( "spacemouse_func2_btn" ) ||
-                                        param == QString( "spacemouse_func5_btn" ) ) )
+  if ( sec == QString( "VTKViewer" ) && param == QString( "enable_selection" ) )
   {
-    int btn1 = resMgr->integerValue( "VTKViewer", "spacemouse_func1_btn", 1 );
-    int btn2 = resMgr->integerValue( "VTKViewer", "spacemouse_func2_btn", 2 );
-    int btn3 = resMgr->integerValue( "VTKViewer", "spacemouse_func5_btn", 9 );
+    bool isToEnableSelection = resMgr->booleanValue( "VTKViewer", "enable_selection", true );
     QList<SUIT_ViewManager*> lst;
 #ifndef DISABLE_SALOMEOBJECT
     viewManagers( SVTK_Viewer::Type(), lst );
@@ -2220,32 +2841,39 @@ void LightApp_Application::preferencesChanged( const QString& sec, const QString
     {
       SUIT_ViewModel* vm = it.next()->getViewModel();
       if ( !vm || !vm->inherits( "SVTK_Viewer" ) )
-       continue;
+        continue;
 
       SVTK_Viewer* vtkVM = dynamic_cast<SVTK_Viewer*>( vm );
-      if( vtkVM ) vtkVM->setSpacemouseButtons( btn1, btn2, btn3 );
+      if( vtkVM ) vtkVM->enableSelection( isToEnableSelection );
     }
 #endif
   }
 #endif
 
-#ifndef DISABLE_OCCVIEWER
-  if ( sec == QString( "OCCViewer" ) && ( param == QString( "iso_number_u" ) || param == QString( "iso_number_v" ) ) )
+#ifndef DISABLE_VTKVIEWER
+  if ( sec == QString( "VTKViewer" ) && (param == QString( "spacemouse_func1_btn" ) ||
+                                         param == QString( "spacemouse_func2_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_func5_btn", 9 );
     QList<SUIT_ViewManager*> lst;
-    viewManagers( OCCViewer_Viewer::Type(), lst );
-    int u = resMgr->integerValue( sec, "iso_number_u" );
-    int v = resMgr->integerValue( sec, "iso_number_v" );
+#ifndef DISABLE_SALOMEOBJECT
+    viewManagers( SVTK_Viewer::Type(), lst );
     QListIterator<SUIT_ViewManager*> it( lst );
     while ( it.hasNext() )
     {
-      OCCViewer_ViewManager* mgr = dynamic_cast<OCCViewer_ViewManager*>( it.next() );
-      if( mgr && mgr->getOCCViewer() )
-       mgr->getOCCViewer()->setIsos( u, v );
+      SUIT_ViewModel* vm = it.next()->getViewModel();
+      if ( !vm || !vm->inherits( "SVTK_Viewer" ) )
+        continue;
+
+      SVTK_Viewer* vtkVM = dynamic_cast<SVTK_Viewer*>( vm );
+      if( vtkVM ) vtkVM->setSpacemouseButtons( btn1, btn2, btn3 );
     }
+#endif
   }
 #endif
-
   if( sec=="ObjectBrowser" )
   {
     SUIT_DataBrowser* ob = objectBrowser();
@@ -2257,13 +2885,13 @@ void LightApp_Application::preferencesChanged( const QString& sec, const QString
       bool autoSizeFirst = resMgr->booleanValue( "ObjectBrowser", "auto_size_first", true );
       ob->setAutoSizeFirstColumn( autoSizeFirst );
       if ( autoSizeFirst )
-       ob->adjustFirstColumnWidth();
+        ob->adjustFirstColumnWidth();
     }
     else if ( param=="auto_size" ) {
       bool autoSize = resMgr->booleanValue( "ObjectBrowser", "auto_size", false );
       ob->setAutoSizeColumns(autoSize);
       if ( autoSize )
-       ob->adjustColumnsWidth();
+        ob->adjustColumnsWidth();
     }
     else if ( param=="resize_on_expand_item" ) {
       bool resizeOnExpandItem = resMgr->booleanValue( "ObjectBrowser", "resize_on_expand_item", false );
@@ -2276,16 +2904,22 @@ void LightApp_Application::preferencesChanged( const QString& sec, const QString
 
   if( sec=="Study" )
   {
-    if( param=="store_positions" )
-      updateWindows();
+    if( param=="auto_save_interval" ) {
+      myAutoSaveTimer->stop();
+      int autoSaveInterval = resMgr->integerValue( "Study", "auto_save_interval", 0 );
+      if ( activeStudy() && autoSaveInterval > 0 ) myAutoSaveTimer->start( autoSaveInterval*60000 );
+    }
   }
 
 #ifndef DISABLE_PYCONSOLE
-  if( sec=="PyConsole" )
+  if( sec=="PyConsole" && pythonConsole() )
   {
-    if( param=="font" )
-      if( pythonConsole() )
-       pythonConsole()->setFont( resMgr->fontValue( "PyConsole", "font" ) );
+    if ( param=="font" ) {
+      pythonConsole()->setFont( resMgr->fontValue( "PyConsole", "font" ) );
+    }
+    else if ( param=="show_banner" ) {
+      pythonConsole()->setIsShowBanner( resMgr->booleanValue( "PyConsole", "show_banner", true ) );
+    }
   }
 #endif
 
@@ -2294,19 +2928,53 @@ void LightApp_Application::preferencesChanged( const QString& sec, const QString
     QtxMRUAction* mru = ::qobject_cast<QtxMRUAction*>( action( MRUId ) );
     if ( mru ) {
       if ( param == "visible_count" )
-       mru->setVisibleCount( resMgr->integerValue( "MRU", "visible_count", 5 ) );    // 5 MRU items by default
+        mru->setVisibleCount( resMgr->integerValue( "MRU", "visible_count", 5 ) );    // 5 MRU items by default
       else if ( param == "max_count" )
-       mru->setHistoryCount( resMgr->integerValue( "MRU", "max_count", -1 ) );       // unlimited history by default
+        mru->setHistoryCount( resMgr->integerValue( "MRU", "max_count", -1 ) );       // unlimited history by default
       else if ( param == "insert_mode" )
-       mru->setInsertMode( resMgr->integerValue( "MRU", "insert_mode", 0 ) );        // QtxMRUAction::MoveFirst by default
+        mru->setInsertMode( resMgr->integerValue( "MRU", "insert_mode", 0 ) );        // QtxMRUAction::MoveFirst by default
       else if ( param == "link_type" )
-       mru->setLinkType( resMgr->integerValue( "MRU", "link_type", 0 ) );            // QtxMRUAction::LinkAuto by default
+        mru->setLinkType( resMgr->integerValue( "MRU", "link_type", 0 ) );            // QtxMRUAction::LinkAuto by default
       else if ( param == "show_clear" )
-       mru->setClearPossible( resMgr->booleanValue( "MRU", "show_clear", false ) );  // do not show "Clear" item by default
+        mru->setClearPossible( resMgr->booleanValue( "MRU", "show_clear", false ) );  // do not show "Clear" item by default
       else if ( param == "show_mru" )
-       mru->setVisible( resMgr->booleanValue( "MRU", "show_mru", false ) );          // do not show MRU menu item by default
+        mru->setVisible( resMgr->booleanValue( "MRU", "show_mru", false ) );          // do not show MRU menu item by default
     }
   }
+  if ( sec == "language" && param == "language" )
+  {
+    SUIT_MessageBox::information( desktop(), tr( "WRN_WARNING" ), tr( "LANG_CHANGED" ) );
+  }
+  if ( sec == "desktop" && param == "opaque_resize" ) {
+    bool opaqueResize = resMgr->booleanValue( "desktop", "opaque_resize", false );
+    QMainWindow::DockOptions dopts = desktop()->dockOptions();
+    if ( opaqueResize ) dopts |= QMainWindow::AnimatedDocks;
+    else                dopts &= ~QMainWindow::AnimatedDocks;
+    desktop()->setDockOptions( dopts );
+    desktop()->setOpaqueResize( opaqueResize );
+    if ( dynamic_cast<STD_TabDesktop*>( desktop() ) )
+      dynamic_cast<STD_TabDesktop*>( desktop() )->workstack()->setOpaqueResize( opaqueResize );
+  }
+
+  if ( sec == "ExternalBrowser" && param == "use_external_browser" ) {
+    if ( resMgr->booleanValue("ExternalBrowser", "use_external_browser", false ) )
+    {
+      QtxWebBrowser::shutdown();
+    }
+  }
+
+#ifndef DISABLE_PLOT2DVIEWER
+  if ( sec == "Plot2d" ) {
+    if( param == "SelectionColor" ) {
+      QColor c = resMgr->colorValue( sec, param );
+      Plot2d_Object::setSelectionColor(c);
+    }
+    else if (param == "SelectedLegendFontColor") {
+      QColor c = resMgr->colorValue( sec, param );      
+      Plot2d_Object::setHighlightedLegendTextColor(c);
+    }
+  }
+#endif
 }
 
 /*!
@@ -2337,17 +3005,8 @@ void LightApp_Application::loadPreferences()
     mru_load = false;
   }
 
-  myWinGeom.clear();
-  QStringList mods = aResMgr->parameters( "windows_geometry" );
-  for ( QStringList::const_iterator it = mods.begin(); it != mods.end(); ++it )
-  {
-    QByteArray arr;
-    if ( aResMgr->value( "windows_geometry", *it, arr ) )
-      myWinGeom.insert( *it, arr );
-  }
-
   myWinVis.clear();
-  mods = aResMgr->parameters( "windows_visibility" );
+  QStringList mods = aResMgr->parameters( "windows_visibility" );
   for ( QStringList::const_iterator itr = mods.begin(); itr != mods.end(); ++itr )
   {
     QByteArray arr;
@@ -2355,8 +3014,17 @@ void LightApp_Application::loadPreferences()
       myWinVis.insert( *itr, arr );
   }
 
-  if ( desktop() )
+  if ( desktop() ) {
     desktop()->retrieveGeometry( aResMgr->stringValue( "desktop", "geometry" ) );
+    bool opaqueResize = aResMgr->booleanValue( "desktop", "opaque_resize", false );
+    QMainWindow::DockOptions dopts = desktop()->dockOptions();
+    if ( opaqueResize ) dopts |= QMainWindow::AnimatedDocks;
+    else                dopts &= ~QMainWindow::AnimatedDocks;
+    desktop()->setDockOptions( dopts );
+    desktop()->setOpaqueResize( opaqueResize );
+    if ( dynamic_cast<STD_TabDesktop*>( desktop() ) )
+      dynamic_cast<STD_TabDesktop*>( desktop() )->workstack()->setOpaqueResize( opaqueResize );
+  }
 }
 
 /*!
@@ -2377,9 +3045,6 @@ void LightApp_Application::savePreferences()
   if ( mru )
     mru->saveLinks( aResMgr, "MRU" );
 
-  for ( WinGeom::const_iterator it = myWinGeom.begin(); it != myWinGeom.end(); ++it )
-    aResMgr->setValue( "windows_geometry", it.key(), it.value() );
-
   for ( WinVis::const_iterator itr = myWinVis.begin(); itr != myWinVis.end(); ++itr )
     aResMgr->setValue( "windows_visibility", itr.key(), itr.value() );
 
@@ -2469,8 +3134,17 @@ void LightApp_Application::afterCloseDoc()
 void LightApp_Application::updateModuleActions()
 {
   QString modName;
-  if ( activeModule() )
+  if ( activeModule() ) {
     modName = activeModule()->moduleName();
+    if ( !isModuleAccessible( modName ) ) {
+      QList<SUIT_Application*> apps = SUIT_Session::session()->applications();
+      foreach( SUIT_Application* app, apps ) {
+        LightApp_Application* lapp = dynamic_cast<LightApp_Application*>( app );
+        if ( lapp && lapp != this )
+          lapp->removeModuleAction( modName );
+      }
+    }
+  }
 
   LightApp_ModuleAction* moduleAction =
     qobject_cast<LightApp_ModuleAction*>( action( ModulesListId ) );
@@ -2478,6 +3152,14 @@ void LightApp_Application::updateModuleActions()
     moduleAction->setActiveModule( modName );
 }
 
+void LightApp_Application::removeModuleAction( const QString& modName )
+{
+  LightApp_ModuleAction* moduleAction =
+    qobject_cast<LightApp_ModuleAction*>( action( ModulesListId ) );
+  if ( moduleAction )
+    moduleAction->removeModule( modName );
+}
+
 /*!
   Gets current windows.
   \param winMap - output current windows map.
@@ -2523,7 +3205,7 @@ void LightApp_Application::updateWindows()
     for ( QMap<int, int>::ConstIterator it = winMap.begin(); it != winMap.end(); ++it )
     {
       if ( !dockWindow( it.key() ) )
-       getWindow( it.key() );
+        getWindow( it.key() );
     }
   }
 
@@ -2561,51 +3243,91 @@ void LightApp_Application::loadDockWindowsState()
 {
   if ( !desktop() )
     return;
-
-  bool store = resourceMgr()->booleanValue( "Study", "store_positions", true );
-  if( !store )
-    return;
+  SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+  bool storeWin = aResMgr->booleanValue( "Study", "store_positions", true );
+  bool storeTb = aResMgr->booleanValue( "Study", "store_tool_positions", true );
 
   QString modName;
   if ( activeModule() )
     modName = activeModule()->name();
 
-  if ( myWinGeom.contains( modName ) )
-    desktop()->restoreState( myWinGeom[modName] );
-
-  if ( !myWinVis.contains( modName ) )
+  QtxResourceMgr::WorkingMode prevMode = aResMgr->workingMode();
+  aResMgr->setWorkingMode(QtxResourceMgr::IgnoreUserValues);
+  QByteArray aDefaultState;
+  aResMgr->value("windows_geometry", modName , aDefaultState );
+  QByteArray aDefaultVisibility;
+  aResMgr->value("windows_visibility", modName , aDefaultVisibility );
+  bool hasDefaultVisibility = !aDefaultVisibility.isEmpty();
+  aResMgr->setWorkingMode(prevMode);
+  
+  if( !storeWin && !storeTb && aDefaultState.isEmpty() && !hasDefaultVisibility)
     return;
 
-  QMap<QString, bool> tbMap, dwMap;
-  dockWindowsState( myWinVis[modName], tbMap, dwMap );
+  if ( aResMgr->hasValue("windows_geometry" ,modName ) ) {
+    QByteArray arr;
+    aResMgr->value("windows_geometry", modName , arr );
+    QByteArray aTargetArray = processState(arr, storeWin, storeTb, true, aDefaultState);
+    desktop()->restoreState( aTargetArray );
+  }
 
-  QList<QToolBar*> tbList = qFindChildren<QToolBar*>( desktop() );
-  for ( QList<QToolBar*>::iterator tit = tbList.begin(); tit != tbList.end(); ++tit )
-  {
-    QToolBar* tb = *tit;
+  if ( !myWinVis.contains( modName ) && aDefaultVisibility.isEmpty())
+    return;
 
-    QObject* po = Qtx::findParent( tb, "QMainWindow" );
-    if ( po != desktop() )
-      continue;
+  QMap<QString, bool> *tbMap = 0;
+  QMap<QString, bool> *dwMap = 0;
+  
+  QMap<QString, bool> userTbMap, userDwMap;
+  dockWindowsState( myWinVis[modName], userTbMap, userDwMap );
 
-    if ( tbMap.contains( tb->objectName() ) )
-      tb->setVisible( tbMap[tb->objectName()] );
+  QMap<QString, bool> defaultTbMap, defaultDwMap;
+  if(hasDefaultVisibility) {
+    dockWindowsState( aDefaultVisibility, defaultTbMap, defaultDwMap);    
   }
 
-  QList<QDockWidget*> dwList = qFindChildren<QDockWidget*>( desktop() );
-  for ( QList<QDockWidget*>::iterator dit = dwList.begin(); dit != dwList.end(); ++dit )
-  {
-    QDockWidget* dw = *dit;
+  if(storeTb) {
+    tbMap =  &userTbMap;
+  } else {
+    if(hasDefaultVisibility){
+      tbMap =  &defaultTbMap;
+    }
+  }
 
-    QObject* po = Qtx::findParent( dw, "QMainWindow" );
-    if ( po != desktop() )
-      continue;
+  if(storeWin) {
+    dwMap =  &userDwMap;
+  } else {
+    if(hasDefaultVisibility){
+      dwMap =  &defaultDwMap;
+    }
+  }
+  
+  if(tbMap) {
+    QList<QToolBar*> tbList = findToolBars();
+    for ( QList<QToolBar*>::iterator tit = tbList.begin(); tit != tbList.end(); ++tit )
+      {        
+       QToolBar* tb = *tit;
+       if ( tbMap->contains( tb->objectName() ) ) {      
+         tb->setVisible( (*tbMap)[tb->objectName()] );
+       }
+      }
+  }
 
-    if ( dwMap.contains( dw->objectName() ) )
-      dw->setVisible( dwMap[dw->objectName()] );
+  if(dwMap) {
+    QList<QDockWidget*> dwList = qFindChildren<QDockWidget*>( desktop() );
+    for ( QList<QDockWidget*>::iterator dit = dwList.begin(); dit != dwList.end(); ++dit )
+      {
+       QDockWidget* dw = *dit;
+       
+       QObject* po = Qtx::findParent( dw, "QMainWindow" );
+       if ( po != desktop() )
+         continue;
+       
+       if ( dwMap->contains( dw->objectName() ) )
+         dw->setVisible( (*dwMap)[dw->objectName()] );
+      }
   }
 }
 
+
 /*!
   Saves windows geometry
 */
@@ -2614,15 +3336,18 @@ void LightApp_Application::saveDockWindowsState()
   if ( !desktop() )
     return;
 
-  bool store = resourceMgr()->booleanValue( "Study", "store_positions", true );
-  if( !store )
+  bool storeWin = resourceMgr()->booleanValue( "Study", "store_positions", true );
+  bool storeTb = resourceMgr()->booleanValue( "Study", "store_tool_positions", true );
+
+  if( !storeWin && !storeTb )
     return;
 
   QString modName;
   if ( activeModule() )
     modName = activeModule()->name();
 
-  myWinGeom.insert( modName, desktop()->saveState() );
+  QByteArray arr = desktop()->saveState();
+  resourceMgr()->setValue( "windows_geometry", modName, processState(arr, storeWin, storeTb, false) );
 
   QByteArray visArr;
   if ( myWinVis.contains( modName ) )
@@ -2748,15 +3473,44 @@ void LightApp_Application::moduleIconNames( QMap<QString, QString>& iconMap ) co
 */
 void LightApp_Application::contextMenuPopup( const QString& type, QMenu* thePopup, QString& title )
 {
-  CAM_Application::contextMenuPopup( type, thePopup, title );
+  //Add "Rename" item
+  LightApp_SelectionMgr* selMgr = LightApp_Application::selectionMgr();
+  bool cacheIsOn = selMgr->isSelectionCacheEnabled();
+  selMgr->setSelectionCacheEnabled( true );
 
   SUIT_DataBrowser* ob = objectBrowser();
+
+  CAM_Application::contextMenuPopup( type, thePopup, title );
+
   if ( ob && type == ob->popupClientType() ) {
     thePopup->addSeparator();
     QAction* a = thePopup->addAction( tr( "MEN_REFRESH" ), this, SLOT( onRefresh() ) );
-    if ( ob->updateKey() )
-      a->setShortcut( ob->updateKey() );
+    if ( ob->shortcutKey(SUIT_DataBrowser::UpdateShortcut) )
+      a->setShortcut( ob->shortcutKey(SUIT_DataBrowser::UpdateShortcut) );
+  }
+
+#ifndef DISABLE_SALOMEOBJECT
+  if ( selMgr && ob ) {
+    SALOME_ListIO selected;
+    selMgr->selectedObjects( selected );
+    if(selected.Extent() == 1){
+      Handle(SALOME_InteractiveObject) anIObject = selected.First();
+      SUIT_DataObject* obj = findObject(anIObject->getEntry());
+      if(obj && obj->renameAllowed()) {
+        QAction* a = new QAction(tr("MEN_RENAME_OBJ"), thePopup);
+        connect( a, SIGNAL( triggered(bool) ), ob, SLOT( onStartEditing() ) );
+        if ( ob->shortcutKey(SUIT_DataBrowser::RenameShortcut) )
+          a->setShortcut( ob->shortcutKey(SUIT_DataBrowser::RenameShortcut) );
+
+        QList<QAction*> acts = thePopup->actions();
+        QAction* firstAction = acts.count() > 0 ? acts.first() : 0;
+        thePopup->insertAction(firstAction,a);
+      }
+    }
   }
+#endif
+
+  selMgr->setSelectionCacheEnabled( cacheIsOn );
 }
 
 /*!
@@ -2768,6 +3522,23 @@ void LightApp_Application::createEmptyStudy()
 
   if ( objectBrowser() )
     objectBrowser()->updateTree();
+
+  SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+  if ( aResMgr && activeStudy() ) {
+    int autoSaveInterval = aResMgr->integerValue( "Study", "auto_save_interval", 0 );
+    if ( autoSaveInterval > 0 ) myAutoSaveTimer->start( autoSaveInterval*60000 );
+  }
+}
+
+/*!Set desktop:*/
+void LightApp_Application::setDesktop( SUIT_Desktop* desk )
+{
+  CAM_Application::setDesktop( desk );
+
+  if ( desk ) {
+    connect( desk, SIGNAL( message( const QString& ) ),
+             this, SLOT( onDesktopMessage( const QString& ) ), Qt::UniqueConnection );
+  }
 }
 
 /*!
@@ -2824,6 +3595,15 @@ void LightApp_Application::onStylePreferences()
   resourceMgr()->setValue( "Style", "use_salome_style", Style_Salome::isActive() );
 }
 
+void LightApp_Application::onFullScreen(){
+  if(myScreenHelper) {
+    if(desktop()->isFullScreen())
+      myScreenHelper->switchToNormalScreen();
+    else
+      myScreenHelper->switchToFullScreen();
+  }
+}
+
 /*!
   Connects just added view manager
 */
@@ -2831,7 +3611,7 @@ void LightApp_Application::addViewManager( SUIT_ViewManager* vm )
 {
   connect( vm, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ),
            this, SLOT( onCloseView( SUIT_ViewManager* ) ) );
-  STD_Application::addViewManager( vm );
+  CAM_Application::addViewManager( vm );
 }
 
 /*!
@@ -2841,8 +3621,24 @@ void LightApp_Application::removeViewManager( SUIT_ViewManager* vm )
 {
   disconnect( vm, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ),
            this, SLOT( onCloseView( SUIT_ViewManager* ) ) );
-  STD_Application::removeViewManager( vm );
-  delete vm;
+  LightApp_Study* aStudy = dynamic_cast<LightApp_Study*>(activeStudy());
+  if (aStudy )
+    aStudy->removeViewMgr(vm->getGlobalId());
+
+  CAM_Application::removeViewManager( vm );
+
+  LightApp_SelectionMgr* selMgr = selectionMgr();
+  QList<SUIT_Selector*> selectors;
+  selMgr->selectors( selectors );
+  foreach( SUIT_Selector* selector, selectors ) {
+    if ( selector->owner() == vm->getViewModel() ) {
+      delete selector;
+    }
+  }
+
+  // IPAL22894: Crash on closing OCC view
+  //delete vm;
+  vm->deleteLater();
 }
 
 /*!
@@ -2923,6 +3719,7 @@ bool LightApp_Application::isLibExists( const QString& moduleTitle ) const
 
   //abd: changed libSalomePyQtGUI to SalomePyQtGUI for WIN32
   bool isPythonModule = lib.contains("SalomePyQtGUI");
+  bool isPythonLightModule = lib.contains("SalomePyQtGUILight");
 
   QStringList paths;
 #ifdef WIN32
@@ -2939,55 +3736,56 @@ bool LightApp_Application::isLibExists( const QString& moduleTitle ) const
 
     if( inf.exists() )
       {
-       isLibFound = true;
-       break;
+        isLibFound = true;
+        break;
       }
   }
 
   if ( !isLibFound )
     {
-      INFOS( "****************************************************************" << std::endl
+      INFOS( "\n****************************************************************" << std::endl
           << "*    Warning: library " << lib.toLatin1().constData() << " cannot be found" << std::endl
           << "*    Module " << moduleTitle.toLatin1().constData() << " will not be available in GUI mode" << std::endl
           << "****************************************************************" << std::endl );
     }
-  else if ( !isPythonModule )
+  else if ( !isPythonModule && !isPythonLightModule)
     return true;
 
-  if ( isPythonModule )
+  if ( isPythonModule || isPythonLightModule)
     {
       QString pylib = moduleName( moduleTitle ) + QString(".py");
       QString pylibgui = moduleName( moduleTitle ) + QString("GUI.py");
 
       // Check the python library
-#ifdef WIN32
-      paths = QString(::getenv( "PATH" )).split( ";", QString::SkipEmptyParts );
-#else
+// #ifdef WIN32
+//       paths = QString(::getenv( "PATH" )).split( ";", QString::SkipEmptyParts );
+// #else
       paths = QString(::getenv( "PYTHONPATH" )).split( ":", QString::SkipEmptyParts );
-#endif
+// #endif
       bool isPyLib = false, isPyGuiLib = false;
       QStringList::const_iterator anIt = paths.begin(), aLast = paths.end();
       for( ; anIt!=aLast; anIt++ )
-       {
-         QFileInfo inf( Qtx::addSlash( *anIt ) + pylib );
-         QFileInfo infgui( Qtx::addSlash( *anIt ) + pylibgui );
+        {
+          QFileInfo inf( Qtx::addSlash( *anIt ) + pylib );
+          QFileInfo infgui( Qtx::addSlash( *anIt ) + pylibgui );
 
-         if( !isPyLib && inf.exists() )
-           isPyLib = true;
+          if(!isPythonLightModule)
+            if( !isPyLib && inf.exists() )
+              isPyLib = true;
 
-         if( !isPyGuiLib && infgui.exists() )
-           isPyGuiLib = true;
+          if( !isPyGuiLib && infgui.exists() )
+            isPyGuiLib = true;
 
-         if ( isPyLib && isPyGuiLib && isLibFound)
-           return true;
-       }
+          if ((isPyLib || isPythonLightModule ) && isPyGuiLib && isLibFound)
+            return true;
+        }
 
-      printf( "****************************************************************\n" );
+      printf( "\n****************************************************************\n" );
       printf( "*    Warning: python library for %s cannot be found:\n", moduleTitle.toLatin1().constData() );
       if (!isPyLib)
-       printf( "*    No module named %s\n", moduleName( moduleTitle ).toLatin1().constData() );
+        printf( "*    No module named %s\n", moduleName( moduleTitle ).toLatin1().constData() );
       if (!isPyGuiLib)
-       printf( "*    No module named %s\n", (moduleName( moduleTitle ) + QString("GUI")).toLatin1().constData() );
+        printf( "*    No module named %s\n", (moduleName( moduleTitle ) + QString("GUI")).toLatin1().constData() );
       printf( "****************************************************************\n" );
       return true;
   }
@@ -3021,9 +3819,9 @@ bool LightApp_Application::event( QEvent* e )
     SALOME_CustomEvent* ce = ( SALOME_CustomEvent* )e;
     QString* d = ( QString* )ce->data();
     if( SUIT_MessageBox::question(0, tr("WRN_WARNING"),
-                                 d ? *d : "",
-                                 SUIT_MessageBox::Yes | SUIT_MessageBox::No,
-                                 SUIT_MessageBox::Yes ) == SUIT_MessageBox::Yes )
+                                  d ? *d : "",
+                                  SUIT_MessageBox::Yes | SUIT_MessageBox::No,
+                                  SUIT_MessageBox::Yes ) == SUIT_MessageBox::Yes )
       showPreferences( tr( "PREF_APP" ) );
     if( d )
       delete d;
@@ -3037,9 +3835,9 @@ bool LightApp_Application::checkDataObject(LightApp_DataObject* theObj)
 {
   if (theObj)
     {
-      bool isSuitable =        !theObj->entry().isEmpty() &&
-                       !theObj->componentDataType().isEmpty() &&
-                       !theObj->name().isEmpty();
+      bool isSuitable = !theObj->entry().isEmpty() &&
+                        !theObj->componentDataType().isEmpty() &&
+                        !theObj->name().isEmpty();
       return isSuitable;
     }
 
@@ -3054,7 +3852,7 @@ int LightApp_Application::openChoice( const QString& aName )
   {
     // Do you want to reload it?
     if ( SUIT_MessageBox::question( desktop(), tr( "WRN_WARNING" ), tr( "QUE_DOC_ALREADYOPEN" ).arg( aName ),
-                                   SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::No ) == SUIT_MessageBox::Yes )
+                                    SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::No ) == SUIT_MessageBox::Yes )
       choice = OpenReload;
   }
 
@@ -3073,20 +3871,20 @@ bool LightApp_Application::openAction( const int choice, const QString& aName )
       QList<SUIT_Application*> appList = session->applications();
       for ( QList<SUIT_Application*>::iterator it = appList.begin(); it != appList.end() && !app; ++it )
       {
-       if ( (*it)->activeStudy() && (*it)->activeStudy()->studyName() == aName )
-         app = ::qobject_cast<STD_Application*>( *it );
+        if ( (*it)->activeStudy() && (*it)->activeStudy()->studyName() == aName )
+          app = ::qobject_cast<STD_Application*>( *it );
       }
 
       if ( app )
       {
-       app->onCloseDoc( false );
-       appList = session->applications();
-       STD_Application* other = 0;
-       for ( QList<SUIT_Application*>::iterator it = appList.begin(); it != appList.end() && !other; ++it )
-         other = ::qobject_cast<STD_Application*>( *it );
-
-       if ( other )
-         res = other->onOpenDoc( aName );
+        app->onCloseDoc( false );
+        appList = session->applications();
+        STD_Application* other = 0;
+        for ( QList<SUIT_Application*>::iterator it = appList.begin(); it != appList.end() && !other; ++it )
+          other = ::qobject_cast<STD_Application*>( *it );
+
+        if ( other )
+          res = other->onOpenDoc( aName );
       }
     }
     break;
@@ -3097,3 +3895,395 @@ bool LightApp_Application::openAction( const int choice, const QString& aName )
 
   return res;
 }
+
+QStringList LightApp_Application::viewManagersTypes() const
+{
+  QStringList aTypesList;
+  aTypesList += myUserWmTypes;
+#ifndef DISABLE_GLVIEWER
+  aTypesList<<GLViewer_Viewer::Type();
+#endif
+#ifndef DISABLE_PLOT2DVIEWER
+  aTypesList<<Plot2d_Viewer::Type();
+#endif
+#ifndef DISABLE_QXGRAPHVIEWER
+  aTypesList<<QxScene_Viewer::Type();
+#endif
+#ifndef DISABLE_OCCVIEWER
+  aTypesList<<OCCViewer_Viewer::Type();
+#endif
+#ifndef DISABLE_VTKVIEWER
+ #ifndef DISABLE_SALOMEOBJECT
+  aTypesList<<SVTK_Viewer::Type();
+ #else
+  aTypesList<<VTKViewer_Viewer::Type();
+ #endif
+#endif
+  return aTypesList;
+}
+/*!
+ * Removes all view managers of known types
+ * Other view managers are ignored
+ */
+void LightApp_Application::clearKnownViewManagers()
+{
+  QStringList aTypesList = viewManagersTypes();
+  QList<SUIT_ViewManager*> aMgrList;
+  viewManagers( aMgrList );
+  foreach (SUIT_ViewManager* aMgr, aMgrList) {
+    if (aTypesList.contains(aMgr->getType()))
+      removeViewManager(aMgr);
+  }
+}
+
+/*!
+  Copy of current selection
+ */
+void LightApp_Application::onCopy()
+{
+  LightApp_Module* m = dynamic_cast<LightApp_Module*>( activeModule() );
+  if( m )
+    m->copy();
+}
+
+/*!
+  Paste of current data in clipboard
+ */
+void LightApp_Application::onPaste()
+{
+  LightApp_Module* m = dynamic_cast<LightApp_Module*>( activeModule() );
+  if( m )
+    m->paste();
+}
+
+/*!
+  Browse (i.e. set focus on) the published objects
+  \param theIsApplyAndClose - flag indicating that the dialog for creating objects
+                              has been accepted by Ok (or Apply & Close) button
+  \param theIsOptimizedBrowsing - flag switching to optimized browsing mode
+                                  (to select the first published object only)
+  \return entry of the selected object
+ */
+QString LightApp_Application::browseObjects( const QStringList& theEntryList,
+                                             const bool theIsApplyAndClose,
+                                             const bool theIsOptimizedBrowsing )
+{
+  QString aResult;
+  if( SUIT_ResourceMgr* aResourceMgr = resourceMgr() )
+  {
+    int aBrowsePolicy = aResourceMgr->integerValue( "ObjectBrowser", "browse_published_object", (int)BP_Never );
+    switch( aBrowsePolicy )
+    {
+      case BP_Never:
+        return aResult;
+      case BP_ApplyAndClose:
+        if( !theIsApplyAndClose )
+          return aResult;
+      case BP_Always:
+      default:
+        break;
+    }
+  }
+
+  LightApp_Study* aStudy = dynamic_cast<LightApp_Study*>( activeStudy() );
+  if( !aStudy )
+    return aResult;
+
+  SUIT_DataBrowser* anOB = objectBrowser();
+  if( !anOB )
+    return aResult;
+
+  SUIT_AbstractModel* aModel = dynamic_cast<SUIT_AbstractModel*>( anOB->model() );
+  if( !aModel )
+    return aResult;
+
+  QStringListIterator anIter( theEntryList );
+  if( theIsOptimizedBrowsing )
+  {
+    // go to the last entry
+    anIter.toBack();
+    if( anIter.hasPrevious() )
+      anIter.previous();
+  }
+
+  // scroll to each entry in the list
+  // (in optimized mode - to the last entry only)
+  QString anEntry;
+  LightApp_DataObject* anObject = 0;
+  while( anIter.hasNext() )
+  {
+    anEntry = anIter.next();
+    if( !anEntry.isEmpty() )
+    {
+      anObject = aStudy->findObjectByEntry( anEntry );
+      if( anObject )
+      {
+        QModelIndex anIndex = aModel->index( anObject );
+        anOB->treeView()->scrollTo( anIndex );
+      }
+    }
+  }
+
+  // always select the last object
+  if( anObject && !anEntry.isEmpty() )
+  {
+    QList<SUIT_Selector*> aSelectorList;
+    selectionMgr()->selectors( "ObjectBrowser", aSelectorList );
+    if( !aSelectorList.isEmpty() )
+    {
+      if( LightApp_OBSelector* aSelector = dynamic_cast<LightApp_OBSelector*>( aSelectorList.first() ) )
+      {
+        bool anIsAutoBlock = aSelector->autoBlock();
+
+        // temporarily disable auto block, to emit LightApp_SelectionMgr::currentSelectionChanged() signal
+        aSelector->setAutoBlock( false );
+
+        SUIT_DataOwnerPtrList aList;
+#ifndef DISABLE_SALOMEOBJECT
+        Handle(SALOME_InteractiveObject) aSObj = new SALOME_InteractiveObject
+          ( anObject->entry().toLatin1().constData(),
+            anObject->componentDataType().toLatin1().constData(),
+            anObject->name().toLatin1().constData() );
+        LightApp_DataOwner* owner = new LightApp_DataOwner( aSObj  );
+#else
+        LightApp_DataOwner* owner = new LightApp_DataOwner( anEntry );
+#endif
+
+        aList.append( owner );
+        selectionMgr()->setSelected( aList );
+        aResult = anEntry;
+
+        // restore auto block flag
+        aSelector->setAutoBlock( anIsAutoBlock );
+      }
+    }
+  }
+
+  return aResult;
+}
+
+SUIT_DataObject* LightApp_Application::findObject( const QString& id ) const
+{
+  LightApp_Study* study = dynamic_cast<LightApp_Study*>( activeStudy() );
+  return study ? study->findObjectByEntry( id ) : 0;
+}
+
+/*!
+  Checks that an object can be renamed.
+  \param entry entry of the object
+  \brief Return \c true if object can be renamed
+*/
+bool LightApp_Application::renameAllowed( const QString& /*entry*/) const {
+  return false;
+}
+
+/*!
+  Rename object by entry.
+  \param entry entry of the object
+  \param name new name of the object
+  \brief Return \c true if rename operation finished successfully, \c false otherwise.
+*/
+bool LightApp_Application::renameObject( const QString& entry, const QString& ) {
+  return false;
+}
+
+/*! Process standard messages from desktop */
+void LightApp_Application::onDesktopMessage( const QString& message )
+{
+  const QString sectionSeparator = "/";
+
+  if ( message.toLower() == "updateobjectbrowser" ||
+       message.toLower() == "updateobjbrowser" ) {
+    // update object browser
+    updateObjectBrowser();
+  }
+  else {
+    QStringList data = message.split( sectionSeparator );
+    if ( data.count() > 1 ) {
+      QString msgType = data[0].trimmed();
+      LightApp_Module* sMod = 0;
+      CAM_Module* mod = module( msgType );
+      if ( !mod )
+        mod = module( moduleTitle( msgType ) );
+      if ( mod && mod->inherits( "LightApp_Module" ) )
+        sMod = (LightApp_Module*)mod;
+
+      if ( msgType.toLower() == "preferences" ) {
+        // requested preferences change: should be given as "preferences/<section>/<name>/<value>"
+        // for example "preferences/Study/multi_file_dump/true"
+        if ( data.count() > 3 ) {
+          QString section = data[1].trimmed();
+          QString param   = data[2].trimmed();
+          QString value   = QStringList( data.mid(3) ).join( sectionSeparator );
+          resourceMgr()->setValue( section, param, value );
+        }
+      }
+      else if ( sMod ) {
+        // received message for the module
+        QString msg = QStringList( data.mid(1) ).join( sectionSeparator );
+        sMod->message( msg );
+      }
+    }
+  }
+}
+
+/*!
+  Internal method. 
+  Returns all top level toolbars.
+  Note : Result list contains only main window toolbars, not including toolbars from viewers.
+*/
+QList<QToolBar*> LightApp_Application::findToolBars() {
+  QList<QToolBar*> aResult;
+  QList<QToolBar*> tbList = qFindChildren<QToolBar*>( desktop() );
+  for ( QList<QToolBar*>::iterator tit = tbList.begin(); tit != tbList.end(); ++tit ) {
+    QToolBar* tb = *tit;    
+    QObject* po = Qtx::findParent( tb, "QMainWindow" );
+    if ( po != desktop() )
+      continue;        
+    aResult.append(tb);
+  }
+  return aResult;
+}
+
+/*!
+  Internal method to parse toolbars and dockable windows state.
+ */
+QByteArray LightApp_Application::processState(QByteArray& input, 
+                                             const bool processWin, 
+                                             const bool processTb, 
+                                             const bool isRestoring, 
+                                             QByteArray defaultState) {
+
+  QByteArray aRes;
+  bool hasDefaultState  = !defaultState.isEmpty();
+  bool isDockWinWriten = false;
+  int nbDocWin = -1;
+  //Write date from users settings
+  if(isRestoring){
+    QDataStream tmpInputData(&input, QIODevice::ReadOnly);
+    int marker, version;
+    uchar dockmarker;
+    tmpInputData >> marker;
+    tmpInputData >> version;
+    tmpInputData >> dockmarker;
+    tmpInputData >> nbDocWin;
+  }  
+  if(processWin && processTb && !isRestoring) {
+    aRes = input;
+  } else if(!processWin && !processTb ) {
+    if(hasDefaultState)
+      aRes = defaultState;
+  } else {
+    QDataStream aData(&aRes, QIODevice::WriteOnly);
+    QList<QToolBar*> aToolBars = findToolBars();
+
+    QStringList aNames;
+    for ( QList<QToolBar*>::iterator tit = aToolBars.begin(); tit != aToolBars.end(); ++tit ) {        
+      QToolBar* tb = *tit;
+      aNames.append(tb->objectName());
+    }
+
+    int toolBarMarkerIndex = getToolbarMarkerIndex(input,aNames);
+    QDataStream anInputData(&input, QIODevice::ReadOnly);
+    if(toolBarMarkerIndex < 0)
+      return aRes;
+
+    int toolBarMarkerIndexDef;
+    if(hasDefaultState) {
+      toolBarMarkerIndexDef = getToolbarMarkerIndex(defaultState, aNames);
+      if(toolBarMarkerIndexDef < 0)
+       return aRes;      
+    }
+    QDataStream anInputDataDef(&defaultState, QIODevice::ReadOnly);
+
+    QDataStream* aTargetData = 0;
+    int          aTargetIndex = -1;
+
+    QByteArray currentArr = desktop()->saveState();
+    QDataStream anInputDataCur(&currentArr, QIODevice::ReadOnly);
+    bool useInputData = !isRestoring || (isRestoring && nbDocWin > 0);
+    if(processWin && useInputData) {
+      aTargetData = &anInputData;
+      aTargetIndex = toolBarMarkerIndex;
+    } else {
+      //Write date from default settings
+      if(hasDefaultState) {
+       aTargetData = &anInputDataDef;
+       aTargetIndex = toolBarMarkerIndexDef;
+      } else {
+       //If no default state, write current snapshot of the dockable windows
+       if(isRestoring) {
+         aTargetData = &anInputDataCur;
+         int toolBarMarkerIndexCur = getToolbarMarkerIndex(currentArr, aNames);
+         aTargetIndex = toolBarMarkerIndexCur;
+       }         
+      }
+    }
+
+    if(aTargetData && aTargetIndex >= 0 ) {
+      aTargetData->device()->seek(0);
+      while( aTargetData->device()->pos() < aTargetIndex ) {
+       uchar ch;
+       *aTargetData >> ch;
+       aData<<ch;
+      }
+      isDockWinWriten = true;
+    }
+    
+    aTargetData = 0;
+    aTargetIndex = -1;
+
+    if(processTb) {
+      aTargetData = &anInputData;
+      aTargetIndex = toolBarMarkerIndex;
+    } else {
+      if(hasDefaultState) {
+       aTargetData = &anInputDataDef;
+       aTargetIndex = toolBarMarkerIndexDef;   
+      }      
+    }
+
+    if(aTargetData && aTargetIndex >= 0) {
+      int index;
+      if(!isDockWinWriten ) {
+       //Write version marker
+       int marker, version;
+       aTargetData->device()->seek(0);
+       *aTargetData >> marker;
+       *aTargetData >> version;
+       aData << marker;
+       aData << version;
+       aData << (uchar) QDockWidgetMarker;
+       aData << (int) 0;
+       int shift = 4*sizeof(int) + sizeof(QSize);
+       index = aTargetIndex - shift;
+      } else {
+       index = aTargetIndex;
+      }
+      
+      aTargetData->device()->seek(index);
+      while(!aTargetData->atEnd()) {
+       uchar ch;
+       *aTargetData >> ch;
+       aData << ch;
+      }
+    } else { // Not treat toolbars
+      aData << (uchar) QToolBarMarker;
+      aData << (int) 0; //Nb toolbars = 0
+    }
+  }
+  return aRes;
+}
+
+/*!
+  \brief Emits operationFinished signal.
+  \param theModuleName the name of the module which perfomed the operation
+  \param theOperationName the operation name
+  \param theEntryList the list of the created objects entries
+*/
+void LightApp_Application::emitOperationFinished( const QString& theModuleName,
+                                                  const QString& theOperationName,
+                                                  const QStringList& theEntryList )
+{
+  emit operationFinished( theModuleName, theOperationName, theEntryList );
+}