]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Unicode support
authorrnv <rnv@opencascade.com>
Fri, 13 Jul 2018 06:45:54 +0000 (09:45 +0300)
committerrnv <rnv@opencascade.com>
Fri, 13 Jul 2018 06:45:54 +0000 (09:45 +0300)
1  2 
src/LightApp/LightApp_Application.cxx
src/LightApp/LightApp_VTKSelector.cxx
src/OCCViewer/OCCViewer_ViewPort3d.cxx
src/OCCViewer/OCCViewer_ViewWindow.cxx
src/Qtx/Qtx.cxx
src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx
src/SVTK/SVTK_ViewWindow.cxx
src/SalomeApp/SalomeApp_Application.cxx
src/VTKViewer/VTKViewer_PolyDataMapper.cxx

index ad5debdbcb2e8d8e2ae44ea20e38782ff1d015e8,c451c3734a8038a115ae768e6d1d90b9e5be1fa1..ae03b893e602ddc15f590ac7437098e8a7163255
  #include <QTreeView>
  #include <QMimeData>
  #include <QShortcut>
 +#include <QRegExp>
  
  #include <utilities.h>
  
@@@ -546,7 -545,6 +546,7 @@@ bool LightApp_Application::activateModu
  
    if ( activeModule() ) activeModule()->updateModuleVisibilityState();
  
 +  updateActions();
    return true;
  }
  
@@@ -591,65 -589,19 +591,65 @@@ void LightApp_Application::createAction
                  tr( "MEN_DESK_PREFERENCES" ), tr( "PRP_DESK_PREFERENCES" ),
                  Qt::CTRL+Qt::Key_P, desk, false, this, SLOT( onPreferences() ) );
  
 -  // Help menu:
 -
 -  // - Help for modules
 +  // Help menu
  
    int helpMenu = createMenu( tr( "MEN_DESK_HELP" ), -1, -1, 1000 );
 -  createMenu( separator(), helpMenu, -1, 10 );
 +  
 +  int id = LightApp_Application::UserID + FIRST_HELP_ID;
 +
 +  // a) Link to web site
 +  QString url = resMgr->stringValue("GUI", "site_url");
 +  if ( !url.isEmpty() ) {
 +    QString title = tr ( "SALOME_SITE" );
 +    QAction* as = createAction( id, title,
 +                              resMgr->loadPixmap( "LightApp", tr( "ICON_WWW" ), false ),
 +                              title, title,
 +                              0, desk, false, this, SLOT( onHelpOnline() ) );
 +    as->setData( url );
 +    createMenu( as, helpMenu, -1, 0 );
 +    id++;
 +  }
 +
 +  // b) Link to Forum
 +  url = resMgr->stringValue("GUI", "forum_url");
 +  if ( !url.isEmpty() ) {
 +    QString title = tr ( "SALOME_FORUM" );
 +    QAction* af = createAction( helpMenu, title,
 +                              resMgr->loadPixmap( "LightApp", tr( "ICON_WWW" ), false ),
 +                              title, title,
 +                              0, desk, false, this, SLOT( onHelpOnline() ) );
 +    af->setData( url );
 +    createMenu( af, helpMenu, -1, 0 );
 +    id++;
 +  }
 +
 +  // c) Link to YouTube channel
 +  url = resMgr->stringValue("GUI", "channel_url");
 +  if ( !url.isEmpty() ) {
 +    createMenu( separator(), helpMenu, -1, 0 );
 +    QString title = tr ( "SALOME_VIDEO_TUTORIALS" );
 +    QAction* av = createAction( helpMenu, title,
 +                              resMgr->loadPixmap( "LightApp", tr( "ICON_LIFE_RIGN" ), false ),
 +                              title, title,
 +                              0, desk, false, this, SLOT( onHelpOnline() ) );
 +    av->setData( url );
 +    createMenu( av, helpMenu, -1, 0 );
 +    id++;
 +  }
 +
 +  // d) Help for modules
 +
 +  // - First create top-level menus to preserve correct order
 +  QString userGuide = "User's Guide";
 +  QString devGuide = "Developer's Guide";
 +  createMenu( userGuide, helpMenu, -1, 5 );
 +  createMenu( devGuide, helpMenu, -1, 5 );
 +
    QStringList aModuleList;
    modules( aModuleList, false );
    aModuleList.prepend( "GUI" );
    aModuleList.prepend( "KERNEL" );
  
 -  int id = LightApp_Application::UserID + FIRST_HELP_ID;
 -
    QString aModule;
    foreach( aModule, aModuleList ) {
      if ( aModule.isEmpty() )                                         // module title (user name)
      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.toUtf8().constData() );      // module root dir
 +    QString rootDir = QString( "%1_ROOT_DIR" ).arg( modName );       // module root dir env variable
-     QString modDir  = getenv( rootDir.toLatin1().constData() );      // module root dir path
++    QString modDir  = getenv( rootDir.toUtf8().constData() );      // module root dir path
      QString docSection;
      if (resMgr->hasValue( modName, "documentation" ) )
        docSection = resMgr->stringValue(modName, "documentation");
          helpFileName.replace( "//", "" );
        // obtain submenus hierarchy if given
        QStringList smenus = helpFileName.split( "/" );
 -      helpFileName = smenus.last();
 -      smenus.removeLast();
 +      helpFileName = smenus.takeLast();
 +      // workaround for User's Guide and Developer's Guide to avoid having single item in module's submenu.
 +      if ( helpFileName == userGuide || helpFileName == devGuide ) {
 +      QString menuPath = smenus.join( "/" );
 +      QStringList allKeys = helpData.keys();
 +      QStringList total = allKeys.filter( QRegExp( QString( "^%1" ).arg( menuPath ) ) );
 +      if ( total.count() == 1 && smenus.count() > 0 )
 +        helpFileName = smenus.takeLast();
 +      }
        QAction* a = createAction( id, helpFileName,
                                   resMgr->loadPixmap( "STD", tr( "ICON_HELP" ), false ),
                                   helpFileName, helpFileName,
        }
        // create sub-menus hierarchy
        int menuId = helpMenu;
 -      foreach ( QString subMenu, smenus ) {
 -        menuId = createMenu( subMenu, menuId, -1, 0 );
 -      }
 -      createMenu( a, menuId, -1, 0 );
 +      foreach ( QString subMenu, smenus )
 +        menuId = createMenu( subMenu, menuId, -1, 5 );
 +      createMenu( a, menuId, -1, ( menuId != helpMenu && (helpFileName == userGuide || helpFileName == devGuide) ) ? 0 : 5 );
        id++;
      }
    }
  
    // - Additional help items
  
 -  createMenu( separator(), helpMenu, -1, 5 );
 +  createMenu( separator(), helpMenu, -1, 10 );
  
    QStringList addHelpItems = resMgr->parameters( "add_help" );
    foreach ( QString addHelpItem, addHelpItems ) {
                                   addHelpItem, addHelpItem,
                                   0, desk, false, this, SLOT( onHelpContentsModule() ) );
        a->setData( valueStr );
 -      createMenu( a, helpMenu, -1, 5 );
 +      createMenu( a, helpMenu, -1, 10 );
        id++;
      }
    }
@@@ -1137,23 -1083,16 +1137,23 @@@ public
                const QString&        theApp,
                const QString&        theParams,
                const QString&        theHelpFile,
 -              const QString&        theContext = QString() )
 +              const QString&        theContext = QString(),
 +            //For the external browser always specify 'file://' protocol,
 +            //because some WEB browsers (for example Mozilla Firefox) can't open local file without protocol.
 +            const QString&        theProtocol = QString("file://"),
 +            const bool            isFile = true)
      : myApp( theApp ),
        myParams( theParams ),
        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() );
 +    QString path_begin = theProtocol+"%1";
 +    QString path_end = theHelpFile;
 +    if( isFile ) {
 +      path_end = QFileInfo( theHelpFile ).canonicalFilePath();
 +    }
 +    myHelpFile = path_begin.arg( path_end );
    }
  
    virtual void run()
@@@ -1308,57 -1247,6 +1308,57 @@@ void LightApp_Application::onHelpContex
    }
  }
  
 +/*!
 +  SLOT: Displays help contents for choosen module
 +*/
 +void LightApp_Application::onHelpOnline()
 +{
 +  const QAction* a = (QAction*) sender();
 +  QString url = a->data().toString();
 +  if ( url.isEmpty() ) return;
 +
 +  SUIT_ResourceMgr* resMgr = resourceMgr();
 +  QString platform;
 +#ifdef WIN32
 +  platform = "winapplication";
 +#else
 +  platform = "application";
 +#endif
 +  QString anApp = resMgr->stringValue("ExternalBrowser", platform);
 +#ifdef WIN32
 +  QString quote("\"");
 +  anApp.prepend( quote );
 +  anApp.append( quote );
 +#endif
 +  QString aParams = resMgr->stringValue("ExternalBrowser", "parameters");
 +#if DISABLE_QTXWEBBROWSER
 +  bool useExtBrowser = true;
 +#else  
 +  bool useExtBrowser = resMgr->booleanValue("ExternalBrowser", "use_external_browser", false );
 +#endif
 +  
 +  if( useExtBrowser ) {
 +    if ( !anApp.isEmpty() ) {
 +      RunBrowser* rs = new RunBrowser( this, anApp, aParams, url, "", "http://", false );
 +      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 {
 +    QStringList parameters;
 +    parameters << QString( "--language=%1" ).arg( resMgr->stringValue( "language", "language" ) );
 +    parameters << QString( "--add=%1" ).arg( QApplication::instance()->applicationPid() );
 +    parameters << "http://" + url;
 +    QProcess::startDetached( "HelpBrowser", parameters );
 +  }
 +}
 +
  /*!
    Sets enable or disable some actions on selection changed.
  */
@@@ -2383,12 -2271,6 +2383,12 @@@ void LightApp_Application::createPrefer
    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" );
 +  // .... -> Notification timeout
 +  int delay = pref->addPreference( tr( "PREF_NOTIFY_TIMEOUT" ), lookGroup, LightApp_Preferences::IntSpin, "notification", "timeout" );
 +  pref->setItemProperty( "special", tr("PREF_NOTIFY_TIMEOUT_NONE"), delay );
 +  pref->setItemProperty( "min", 0, delay );
 +  pref->setItemProperty( "max", 100, delay );
 +  pref->setItemProperty( "suffix", " sec", delay );
    // ... "Look and feel" group <<end>>
  
    // ... "Study properties" group <<start>>
@@@ -4898,9 -4780,9 +4898,9 @@@ QString LightApp_Application::browseObj
          SUIT_DataOwnerPtrList aList;
  #ifndef DISABLE_SALOMEOBJECT
          Handle(SALOME_InteractiveObject) aSObj = new SALOME_InteractiveObject
-           ( anObject->entry().toLatin1().constData(),
+           ( anObject->entry().toUtf8().constData(),
              anObject->componentDataType().toLatin1().constData(),
-             anObject->name().toLatin1().constData() );
+             anObject->name().toUtf8().constData() );
          LightApp_DataOwner* owner = new LightApp_DataOwner( aSObj  );
  #else
          LightApp_DataOwner* owner = new LightApp_DataOwner( anEntry );
index 5d2a918eda2a8f31224045edbf8c4fa23ad60d10,70db9624fa29aab715200b7910c4fbb30dfb4e8d..697344247f0383dfb8a8a2047377e6acd11e4dca
@@@ -189,8 -189,8 +189,8 @@@ LightApp_VTKSelecto
  {
    if( myViewer ) {
      if( SVTK_Viewer* aSViewer = dynamic_cast<SVTK_Viewer*>(myViewer) ) {
 -      if( !aSViewer->isSelectionEnabled() ) 
 -      return;
 +      if( !aSViewer->isSelectionEnabled() )
 +        return;
      }
      if(SUIT_ViewManager* aViewManager = myViewer->getViewManager()){
        if(SVTK_ViewManager* aViewMgr = dynamic_cast<SVTK_ViewManager*>(aViewManager)){
  /*!
    Sets selection to selector from data owner list \a theList.
  */
 -void 
 +void
  LightApp_VTKSelector
  ::setSelection( const SUIT_DataOwnerPtrList& theList )
  {
    SVTK_Viewer* aViewer = dynamic_cast<SVTK_Viewer*>(myViewer);
 -  if(myViewer && aViewer && aViewer->isSelectionEnabled()){
 +  if ( myViewer && aViewer && ( theList.isEmpty() || aViewer->isSelectionEnabled() )) {
      if(SUIT_ViewManager* aViewMgr = myViewer->getViewManager()){
        if(SVTK_ViewWindow* aView = dynamic_cast<SVTK_ViewWindow*>(aViewMgr->getActiveView())){
          if(SVTK_Selector* aSelector = aView->GetSelector()){
            SALOME_ListIO anAppendList;
            const SALOME_ListIO& aStoredList = aSelector->StoredIObjects();
            SUIT_DataOwnerPtrList::const_iterator anIter = theList.begin();
 -          for(; anIter != theList.end(); ++anIter){
 +          for(; anIter != theList.end(); ++anIter) {
              const SUIT_DataOwner* aDataOwner = (*anIter).get();
 -            if(const LightApp_SVTKDataOwner* anOwner = dynamic_cast<const LightApp_SVTKDataOwner*>(aDataOwner)){
 +            if(const LightApp_SVTKDataOwner* anOwner = dynamic_cast<const LightApp_SVTKDataOwner*>(aDataOwner))
 +            {
                MESSAGE("aSelector->SetSelectionMode("<<anOwner->GetMode()<<");");
                aSelector->SetSelectionMode(anOwner->GetMode());
                Handle(SALOME_InteractiveObject) anIO = anOwner->IO();
  
                anAppendList.Append(anIO);
                aSelector->AddOrRemoveIndex(anIO,anOwner->GetIds(),false);
 -            }else if(const LightApp_DataOwner* anOwner = dynamic_cast<const LightApp_DataOwner*>(aDataOwner)){
 -              Handle(SALOME_InteractiveObject) anIO = 
 +            }
 +            else if(const LightApp_DataOwner* anOwner = dynamic_cast<const LightApp_DataOwner*>(aDataOwner))
 +            {
 +              Handle(SALOME_InteractiveObject) anIO =
-                 new SALOME_InteractiveObject(anOwner->entry().toLatin1(),"");
+                 new SALOME_InteractiveObject(anOwner->entry().toUtf8(),"");
                aSelector->AddIObject(anIO);
                anAppendList.Append(anIO);
              }
              toRemove.remove( anIt.Value()->getEntry() );
  
            QMap< QString, Handle( SALOME_InteractiveObject )>::const_iterator RIt = toRemove.begin(),
 -                                                                             REnd = toRemove.end();
 +            REnd = toRemove.end();
            for( ; RIt!=REnd; RIt++ )
              aSelector->RemoveIObject( RIt.value() );
 -          
 +
            aView->onSelectionChanged();
          }
        }
index 46153c3212c9139cceaa45c496d09597076c38d4,73f89e2137839f024228ee8851d135612ebcb3ff..941ada3d797260f6859618e10221cc8051cb2a55
@@@ -358,13 -358,13 +358,13 @@@ void OCCViewer_ViewPort3d::updateBackgr
        // set texture image: file name and fill mode
        switch ( textureMode ) {
        case Qtx::CenterTexture:
-       activeView()->SetBackgroundImage( fi.absoluteFilePath().toLatin1().constData(), Aspect_FM_CENTERED );
+       activeView()->SetBackgroundImage( fi.absoluteFilePath().toUtf8().constData(), Aspect_FM_CENTERED );
        break;
        case Qtx::TileTexture:
-       activeView()->SetBackgroundImage( fi.absoluteFilePath().toLatin1().constData(), Aspect_FM_TILED );
+       activeView()->SetBackgroundImage( fi.absoluteFilePath().toUtf8().constData(), Aspect_FM_TILED );
        break;
        case Qtx::StretchTexture:
-       activeView()->SetBackgroundImage( fi.absoluteFilePath().toLatin1().constData(), Aspect_FM_STRETCH );
+       activeView()->SetBackgroundImage( fi.absoluteFilePath().toUtf8().constData(), Aspect_FM_STRETCH );
        break;
        default:
        break;
@@@ -572,7 -572,6 +572,7 @@@ void OCCViewer_ViewPort3d::resizeEvent
      QApplication::syncX();
  #endif
    QTimer::singleShot( 0, this, SLOT( repaintViewAfterMove() ) );
 +  emit vpResizeEvent( e );
  }
  
  /*!
index c090f4ac49f686f004abcdfc5c8d3e89f504e2e0,3f3217a96fe2cf9ee29010857aedb957a7d0f215..7c9cb3e878871201ba6bbf5280d41ae3ca15696e
@@@ -82,7 -82,6 +82,7 @@@
  #include <Graphic3d_ExportFormat.hxx>
  #include <Graphic3d_StereoMode.hxx>
  #include <Graphic3d_RenderingParams.hxx>
 +#include <Graphic3d_BndBox3d.hxx>
  
  #include <V3d_Plane.hxx>
  #include <V3d_Light.hxx>
@@@ -237,8 -236,8 +237,8 @@@ const char* imageCrossCursor[] = 
    "................................",
    "................................"};
  
 -
 -/*!
 + 
 +  /*!
    \brief Constructor
    \param theDesktop main window of application
    \param theModel OCC 3D viewer
@@@ -269,8 -268,6 +269,8 @@@ OCCViewer_ViewWindow::OCCViewer_ViewWin
    mySelectionEnabled = true;
  
    myCursorIsHand = false;
 +  myPanningByBtn = false;
 +  myAutomaticZoom = true;
  
    clearViewAspects();
  }
@@@ -617,22 -614,6 +617,22 @@@ void OCCViewer_ViewWindow::activateZoom
  }
  
  
 +void OCCViewer_ViewWindow::onPanning()
 +{
 +  OCCViewer_ViewManager* aMgr = dynamic_cast<OCCViewer_ViewManager*>( getViewManager() );
 +  bool isChained = aMgr->isChainedOperations();
 +  bool isReset = ( myPanningByBtn && isChained );
 +  if( isReset )
 +  {
 +    resetState();
 +  }
 +  else
 +  {
 +    myPanningByBtn = true;
 +    activatePanning();
 +  }
 +}
 +
  /*!
    \brief Start panning operation.
  
@@@ -707,16 -688,13 +707,16 @@@ bool OCCViewer_ViewWindow::computeGravi
      if ( aStructure->IsEmpty() || !aStructure->IsVisible() || aStructure->CStructure()->IsForHighlight )
        continue;
  
 -    Bnd_Box aBox = aStructure->MinMaxValues();
 -    aXmin = aBox.IsVoid() ? RealFirst() : aBox.CornerMin().X();
 -    aYmin = aBox.IsVoid() ? RealFirst() : aBox.CornerMin().Y();
 -    aZmin = aBox.IsVoid() ? RealFirst() : aBox.CornerMin().Z();
 -    aXmax = aBox.IsVoid() ? RealLast()  : aBox.CornerMax().X();
 -    aYmax = aBox.IsVoid() ? RealLast()  : aBox.CornerMax().Y();
 -    aZmax = aBox.IsVoid() ? RealLast()  : aBox.CornerMax().Z();
 +    Bnd_Box aBox1 = aStructure->MinMaxValues();
 +    const Graphic3d_BndBox3d& aBox = aStructure->CStructure()->BoundingBox();
 +    if (!aBox.IsValid())
 +      continue;
 +    aXmin = /*aBox.IsVoid() ? RealFirst() :*/ aBox.CornerMin().x();
 +    aYmin = /*aBox.IsVoid() ? RealFirst() : */aBox.CornerMin().y();
 +    aZmin = /*aBox.IsVoid() ? RealFirst() : */aBox.CornerMin().z();
 +    aXmax = /*aBox.IsVoid() ? RealLast()  : */aBox.CornerMax().x();
 +    aYmax = /*aBox.IsVoid() ? RealLast()  : */aBox.CornerMax().y();
 +    aZmax = /*aBox.IsVoid() ? RealLast()  : */aBox.CornerMax().z();
  
      // Infinite structures are skipped
      Standard_Real aLIM = ShortRealLast() - 1.0;
      theX /= aPointsNb;
      theY /= aPointsNb;
      theZ /= aPointsNb;
 +    return true;
    }
 -  return true;
 +  else
 +    return false;
  }
  
  /*!
@@@ -1061,14 -1037,8 +1061,14 @@@ void OCCViewer_ViewWindow::vpMouseRelea
  
    case PANVIEW:
    case ZOOMVIEW:
 -    resetState();
 -    break;
 +    {
 +      OCCViewer_ViewManager* aMgr = dynamic_cast<OCCViewer_ViewManager*>( getViewManager() );
 +      bool isChained = aMgr->isChainedOperations();
 +      bool isReset = !( myOperation==PANVIEW && myPanningByBtn && isChained ) || theEvent->button() == Qt::RightButton;
 +      if( isReset )
 +        resetState();
 +      break;
 +    }
  
    case PANGLOBAL:
      if ( theEvent->button() == Qt::LeftButton ) {
@@@ -1133,8 -1103,6 +1133,8 @@@ void OCCViewer_ViewWindow::resetState(
  
    setTransformInProcess( false );
    setTransformRequested( NOTHING );
 +
 +  myPanningByBtn = false;
  }
  
  
@@@ -1236,7 -1204,7 +1236,7 @@@ void OCCViewer_ViewWindow::createAction
    aAction = new QtxAction(tr("MNU_PAN_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_PAN" ) ),
                             tr( "MNU_PAN_VIEW" ), 0, this);
    aAction->setStatusTip(tr("DSC_PAN_VIEW"));
 -  connect(aAction, SIGNAL(triggered()), this, SLOT(activatePanning()));
 +  connect(aAction, SIGNAL(triggered()), this, SLOT(onPanning()));
    toolMgr()->registerAction( aAction, PanId );
  
    // Global Panning
@@@ -1595,14 -1563,8 +1595,14 @@@ void OCCViewer_ViewWindow::onFrontView(
  {
    emit vpTransformationStarted ( FRONTVIEW );
    Handle(V3d_View) aView3d = myViewPort->getView();
 -  if ( !aView3d.IsNull() ) aView3d->SetProj (V3d_Xpos);
 -  onViewFitAll();
 +  if (myAutomaticZoom)
 +  {
 +    if ( !aView3d.IsNull() ) 
 +      aView3d->SetProj (V3d_Xpos);
 +    onViewFitAll();
 +  }
 +  else
 +    projAndPanToGravity(V3d_Xpos);
    emit vpTransformationFinished ( FRONTVIEW );
  }
  
@@@ -1613,14 -1575,8 +1613,14 @@@ void OCCViewer_ViewWindow::onBackView(
  {
    emit vpTransformationStarted ( BACKVIEW );
    Handle(V3d_View) aView3d = myViewPort->getView();
 -  if ( !aView3d.IsNull() ) aView3d->SetProj (V3d_Xneg);
 -  onViewFitAll();
 +  if (myAutomaticZoom)
 +  {
 +    if ( !aView3d.IsNull() ) 
 +      aView3d->SetProj (V3d_Xneg);
 +    onViewFitAll();
 +  }
 +  else
 +    projAndPanToGravity(V3d_Xneg);
    emit vpTransformationFinished ( BACKVIEW );
  }
  
@@@ -1631,14 -1587,8 +1631,14 @@@ void OCCViewer_ViewWindow::onTopView(
  {
    emit vpTransformationStarted ( TOPVIEW );
    Handle(V3d_View) aView3d = myViewPort->getView();
 -  if ( !aView3d.IsNull() ) aView3d->SetProj (V3d_Zpos);
 -  onViewFitAll();
 +  if (myAutomaticZoom)
 +  {
 +    if ( !aView3d.IsNull() ) 
 +      aView3d->SetProj (V3d_Zpos);
 +    onViewFitAll();
 +  }
 +  else
 +    projAndPanToGravity(V3d_Zpos);
    emit vpTransformationFinished ( TOPVIEW );
  }
  
@@@ -1649,14 -1599,8 +1649,14 @@@ void OCCViewer_ViewWindow::onBottomView
  {
    emit vpTransformationStarted ( BOTTOMVIEW );
    Handle(V3d_View) aView3d = myViewPort->getView();
 -  if ( !aView3d.IsNull() ) aView3d->SetProj (V3d_Zneg);
 -  onViewFitAll();
 +  if (myAutomaticZoom)
 +  {
 +    if ( !aView3d.IsNull() ) 
 +      aView3d->SetProj (V3d_Zneg);
 +    onViewFitAll();
 +  }
 +  else
 +    projAndPanToGravity(V3d_Zneg);
    emit vpTransformationFinished ( BOTTOMVIEW );
  }
  
@@@ -1667,14 -1611,8 +1667,14 @@@ void OCCViewer_ViewWindow::onLeftView(
  {
    emit vpTransformationStarted ( LEFTVIEW );
    Handle(V3d_View) aView3d = myViewPort->getView();
 -  if ( !aView3d.IsNull() ) aView3d->SetProj (V3d_Yneg);
 -  onViewFitAll();
 +  if (myAutomaticZoom)
 +  {
 +    if ( !aView3d.IsNull() ) 
 +      aView3d->SetProj (V3d_Yneg);
 +    onViewFitAll();
 +  }
 +  else
 +    projAndPanToGravity(V3d_Yneg);
    emit vpTransformationFinished ( LEFTVIEW );
  }
  
@@@ -1685,14 -1623,8 +1685,14 @@@ void OCCViewer_ViewWindow::onRightView(
  {
    emit vpTransformationStarted ( RIGHTVIEW );
    Handle(V3d_View) aView3d = myViewPort->getView();
 -  if ( !aView3d.IsNull() ) aView3d->SetProj (V3d_Ypos);
 -  onViewFitAll();
 +  if (myAutomaticZoom)
 +  {
 +    if ( !aView3d.IsNull() ) 
 +      aView3d->SetProj (V3d_Ypos);
 +    onViewFitAll();
 +  }
 +  else
 +    projAndPanToGravity(V3d_Ypos);
    emit vpTransformationFinished ( RIGHTVIEW );
  }
  
@@@ -2324,7 -2256,7 +2324,7 @@@ bool OCCViewer_ViewWindow::dumpViewToFo
      OpenGl_Caps* aCaps = &aDriver->ChangeOptions();
      int prev = aCaps->ffpEnable;
      aCaps->ffpEnable = 1;
-     res = a3dView->Export(strdup(qPrintable(fileName)), Graphic3d_EF_PostScript);
+     res = a3dView->Export(strdup(qUtf8Printable(fileName)), Graphic3d_EF_PostScript);
      aCaps->ffpEnable = prev;
    }
    else if (format == "EPS") {
      OpenGl_Caps* aCaps = &aDriver->ChangeOptions();
      int prev = aCaps->ffpEnable;
      aCaps->ffpEnable = 1;
-     res = a3dView->Export(strdup(qPrintable(fileName)), Graphic3d_EF_EnhPostScript);
+     res = a3dView->Export(strdup(qUtf8Printable(fileName)), Graphic3d_EF_EnhPostScript);
      aCaps->ffpEnable = prev;
    }
    else {
@@@ -3382,6 -3314,7 +3382,6 @@@ bool OCCViewer_ViewWindow::isQuadBuffer
    return enable;
  }
  
 -
  bool OCCViewer_ViewWindow::isOpenGlStereoSupport() const
  {
    GLboolean support[1];
@@@ -3660,84 -3593,3 +3660,84 @@@ void OCCViewer_ViewWindow::onLightSourc
        aDlg->show();
    }
  }
 +
 +bool OCCViewer_ViewWindow::isActionVisible( ActionId theId ) const
 +{
 +  QAction* a = toolMgr()->action( theId );
 +  return a && a->isVisible();
 +}
 +
 +void OCCViewer_ViewWindow::setActionVisible( ActionId theId, bool isVisible )
 +{
 +  QAction* a = toolMgr()->action( theId );
 +  if( a )
 +    a->setVisible( isVisible );
 +}
 +
 +void OCCViewer_ViewWindow::projAndPanToGravity(V3d_TypeOfOrientation CamOri)
 +{
 +  const bool USE_XY = true;
 +
 +  Handle(V3d_View) aView3d = myViewPort->getView();
 +  if (aView3d.IsNull())
 +    return;
 +
 +  bool IsGr = false;
 +  double X = 0, Y = 0, Z = 0;
 +  if( USE_XY )
 +  {
 +    const double EPS = 1E-6;
 +    int xp = myViewPort->width()/2, yp = myViewPort->height()/2, xp1, yp1;
 +    aView3d->Convert( xp, yp, X, Y, Z );
 +
 +    gp_Dir d = aView3d->Camera()->Direction();
 +    if( fabs( d.Z() ) > EPS )
 +    {
 +      double t = -Z/d.Z();
 +      X += t*d.X();
 +      Y += t*d.Y();
 +      Z += t*d.Z();
 +    }
 +  }
 +
 +  // It is really necessary to compute gravity center even if it is not used in part of code below.
 +  // Without this calculation the SetProj() method and other methods are not correct.
 +  double X2, Y2, Z2;
 +  IsGr = computeGravityCenter(X2, Y2, Z2);
 +  if ( !IsGr )
 +    IsGr = OCCViewer_Utilities::computeSceneBBCenter(aView3d, X2, Y2, Z2);
 +
 +  aView3d->SetProj(CamOri);
 +  if (IsGr)
 +  {
 +    //aView3d->Update();
 +    Handle(Graphic3d_Camera) Cam = aView3d->Camera();
 +    gp_XYZ gp(X, Y, Z);
 +    gp_Vec dir (Cam->Direction());
 +    gp_Pnt eye = Cam->Eye();
 +    gp_Vec V1(eye, gp);
 +    Standard_Real D = dir.Dot(V1);
 +    gp_Pnt ppdir = eye.Translated(D*dir);
 +    gp_Vec V2(ppdir, gp);
 +    gp_XYZ trEye = eye.XYZ() + V2.XYZ();
 +
 +    double xat, yat, zat;
 +    aView3d->At(xat, yat, zat);
 +    gp_Pnt At(xat, yat, zat);
 +    gp_XYZ trAt = At.XYZ() + V2.XYZ();
 +    aView3d->SetEye(trEye.X(), trEye.Y(), trEye.Z());
 +    aView3d->SetAt(trAt.X(), trAt.Y(), trAt.Z());
 +  }
 +}
 +
 +
 +bool OCCViewer_ViewWindow::isAutomaticZoom() const
 +{
 +  return myAutomaticZoom;
 +}
 +
 +void OCCViewer_ViewWindow::setAutomaticZoom(const bool isOn)
 +{
 +  myAutomaticZoom = isOn;
 +}
 +
diff --combined src/Qtx/Qtx.cxx
index 61d36d7c4cd36f0fe1b4dd102f6e4bafd6db364e,8d98abdb5f8977230b0d71880ec88eb592d24033..672fa3f8e7000547f6a29c9503c977a0d50b4ff8
@@@ -276,53 -276,34 +276,53 @@@ void Qtx::simplifySeparators( QWidget* 
    if ( !wid )
      return;
  
 -  QList<QAction*> items = wid->actions();
 -  if ( items.isEmpty() )
 -    return;
 -
 -  bool action = false;
 -  for ( int i = 0; i < items.count(); i++ )
 +  if ( wid->inherits( "QMenu") || wid->inherits( "QMenuBar") )
    {
 -    QAction* a = items[i];
 -    if ( a->isSeparator() ) {
 -      a->setVisible(action);
 -      action = false;
 -    }
 -    else if ( a->isVisible() ) {
 -      action = true;
 -      if ( recursive && a->menu() )
 -      simplifySeparators( a->menu(), recursive );
 +    if ( qobject_cast<QMenu*>( wid ) )
 +      qobject_cast<QMenu*>( wid )->setSeparatorsCollapsible( true );
 +    if ( recursive )
 +    {
 +      foreach ( QAction* action, wid->actions() )
 +      {
 +      if ( action->menu() )
 +        simplifySeparators( action->menu(), recursive );
 +      }
      }
    }
 -
 -  action = false;
 -  for ( int i = items.count() - 1; i > 0; i-- ) {
 -    QAction* a = items[i];
 -    if ( a->isSeparator() ) {
 -      a->setVisible(action);
 -      action = false;
 +  else
 +  {
 +    QList<QAction*> actions = wid->actions();
 +    if ( actions.isEmpty() )
 +      return;
 +
 +    bool is_action = false;
 +    for ( int i = 0; i < actions.count(); i++ )
 +    {
 +      QAction* action = actions[i];
 +      if ( action->isSeparator() )
 +      {
 +      action->setVisible( is_action );
 +      is_action = false;
 +      }
 +      else if ( action->isVisible() )
 +      {
 +      is_action = true;
 +      }
 +    }
 +    is_action = false;
 +    for ( int i = actions.count() - 1; i > 0; i-- )
 +    {
 +      QAction* action = actions[i];
 +      if ( action->isSeparator() )
 +      {
 +      action->setVisible( is_action );
 +      is_action = false;
 +      }
 +      else if ( action->isVisible() )
 +      {
 +      is_action = true;
 +      }
      }
 -    else if ( a->isVisible() )
 -      action = true;
    }
  }
  
@@@ -562,14 -543,14 +562,14 @@@ QString Qtx::addSlash( const QString& p
  */
  bool Qtx::dos2unix( const QString& absName )
  {
-   FILE* src = ::fopen( absName.toLatin1(), "rb" );
+   FILE* src = ::fopen( absName.toUtf8(), "rb" );
    if ( !src )
      return false;
  
    /* we'll use temporary file */
    char temp[512] = { '\0' };
    QString dir = Qtx::dir( absName );
-   FILE* tgt = ::fopen( strcpy( temp, ::tempnam( dir.toLatin1(), "__x" ) ), "wb" );
+   FILE* tgt = ::fopen( strcpy( temp, ::tempnam( dir.toUtf8(), "__x" ) ), "wb" );
    if ( !tgt )
      return false;
  
@@@ -746,8 -727,8 +746,8 @@@ QString Qtx::makeEnvVarSubst( const QSt
          break;
  
        QString newStr;
-       if ( ::getenv( envName.toLatin1() ) || mode == Always )
-         newStr = QString( ::getenv( envName.toLatin1() ) );
+       if ( ::getenv( envName.toUtf8() ) || mode == Always )
+         newStr = QString( ::getenv( envName.toUtf8() ) );
  
        if ( newStr.isNull() )
        {
index eb1d87e5210b4cbb6ff49ec5f437324631ea7ce6,6b2eb96a08170e97da444888e37d96bcf814f7b9..7466927b9ed60e1d329c2d4e4ddfb7d596ecc802
@@@ -42,9 -42,6 +42,9 @@@
  #include "OCCViewer_ViewWindow.h"
  #include "OCCViewer_ViewFrame.h"
  #endif // DISABLE_OCCVIEWER
 +#ifndef DISABLE_VTKVIEWER
 +#include "SVTK_ViewWindow.h"
 +#endif // DISABLE_VTKVIEWER
  #ifndef DISABLE_PLOT2DVIEWER
  #include "Plot2d_ViewManager.h"
  #include "Plot2d_ViewWindow.h"
@@@ -180,7 -177,7 +180,7 @@@ namespac
      if ( app && !fileName.isEmpty() ) {
        QPixmap pixmap = app->resourceMgr()->loadPixmap( module, 
                                                         QApplication::translate( module.toLatin1().data(), 
-                                                                                 fileName.toLatin1().data() ) );
+                                                                                 fileName.toUtf8().data() ) );
        if ( !pixmap.isNull() )
          icon = QIcon( pixmap );
      }
@@@ -726,93 -723,6 +726,93 @@@ void SalomePyQt::putInfo( const QString
    ProcessVoidEvent( new TPutInfoEvent( msg, sec ) );
  }
  
 +/*!
 +  \fn int SalomePyQt::showNotification( const QString& msg, const QString& title, const int sec );
 +  \brief Show notification in the application's desktop window.
 +
 +  Optional third delay parameter (\a sec) can be used to specify
 +  time of the notification diplaying in seconds. If this parameter is less
 +  or equal to zero, the permanent notification will be put.
 +
 +  Notification can be forcibly hidden via hideNotification() method.
 +
 +  \param msg message text 
 +  \param title title text 
 +  \param sec notification displaying time in seconds
 +  \return unique ID of the notification (can be used to hide notification)
 +  \sa hideNotification()
 +*/
 +
 +class TShowNotifyEvent: public SALOME_Event
 +{
 +  QString myMsg;
 +  QString myTitle;
 +  int     mySecs;
 +
 +public:
 +  typedef int TResult;
 +  TResult myResult;
 +
 +public:
 +  TShowNotifyEvent( const QString& msg, const QString& title, const int sec = -1 ) : myMsg( msg ), myTitle( title), mySecs( sec ), myResult( -1 ) {}
 +  virtual void Execute()
 +  {
 +    if ( LightApp_Application* anApp = getApplication() ) {
 +      myResult = anApp->showNotification( myMsg, myTitle, mySecs * 1000 );
 +    }
 +  }
 +};
 +
 +int SalomePyQt::showNotification( const QString& msg, const QString& title, const int sec )
 +{
 +  return ProcessEvent( new TShowNotifyEvent( msg, title, sec ) );
 +}
 +
 +/*!
 +  \fn void SalomePyQt::hideNotification( const QString& msg );
 +  \brief Remove notification with given message text from the application's desktop.
 +
 +  \param msg message text
 +  \sa showNotification()
 +*/
 +
 +/*!
 +  \fn void SalomePyQt::hideNotification( const int id );
 +  \brief Remove notification with given \a id from the application's desktop.
 +
 +  \param id notification id
 +  \sa showNotification()
 +*/
 +
 +class THideNotifyEvent: public SALOME_Event
 +{
 +  int     myId;
 +  QString myMsg;
 +
 +public:
 +  THideNotifyEvent( const QString& msg ) : myId( -1 ), myMsg( msg ) {}
 +  THideNotifyEvent( const int id ) : myId( id ) {}
 +  virtual void Execute()
 +  {
 +    if ( LightApp_Application* anApp = getApplication() ) {
 +      if ( myId >= 0 )
 +       anApp->hideNotification( myId );
 +      else
 +       anApp->hideNotification( myMsg );
 +    }
 +  }
 +};
 +
 +void SalomePyQt::hideNotification( const QString& msg )
 +{
 +  ProcessVoidEvent( new THideNotifyEvent( msg ) );
 +}
 +
 +void SalomePyQt::hideNotification( const int id )
 +{
 +  ProcessVoidEvent( new THideNotifyEvent( id ) );
 +}
 +
  /*!
    \fn const QString SalomePyQt::getActiveComponent();
    \brief Get the currently active module name (for the current study).
@@@ -3056,85 -2966,6 +3056,85 @@@ bool SalomePyQt::setViewSize( const in
    return ProcessEvent( new TSetViewSize( w, h, id ) );
  }
  
 +/*!
 +  \fn bool SalomePyQt::setViewRotationPoint( const double x, const double y, const double z, const int id );
 +  \brief Set view rotation point
 +  \param x coordinate X view rotation point
 +  \param y coordinate Y view rotation point
 +  \param z coordinate Z view rotation point
 +  \param id window identifier
 +  \return \c true if operation is completed successfully and \c false otherwise 
 +*/
 +
 +class TSetViewRotationPoint: public SALOME_Event
 +{
 +public:
 +  typedef bool TResult;
 +  TResult myResult;
 +  double myX;
 +  double myY;
 +  double myZ;
 +  int myWndId;
 +  TSetViewRotationPoint( const double x, const double y, const double z, const int id )
 +    : myResult( false ),
 +      myX( x ),
 +      myY( y ),
 +      myZ( z ),
 +      myWndId( id ) {}
 +  virtual void Execute() 
 +  {
 +    SUIT_ViewWindow* wnd = 0;
 +    if ( !myWndId ) {
 +      if ( LightApp_Application* anApp = getApplication() ) {
 +        SUIT_ViewManager* vm = anApp->activeViewManager();
 +        if ( vm )
 +          wnd = vm->getActiveView();
 +      }
 +    }
 +    else {
 +      wnd = dynamic_cast<SUIT_ViewWindow*>( getWnd( myWndId ) );
 +    }
 +    if ( wnd ) {
 +      SUIT_ViewManager* viewMgr = wnd->getViewManager();
 +      if ( viewMgr ) {
 +        QString type = viewMgr->getType();
 +        if ( type == "OCCViewer") {
 +#ifndef DISABLE_OCCVIEWER
 +          // specific processing for OCC viewer:
 +          // OCC view can embed up to 4 sub-views, split according to the specified layout;
 +          // - if there is only one sub-view active; its rotation point will be changed;
 +          // - if there are several sub-views, rotaion points of each of them will be changed.
 +          OCCViewer_ViewWindow* occView = qobject_cast<OCCViewer_ViewWindow*>( wnd );
 +          if ( occView ) {
 +            for ( int i = OCCViewer_ViewFrame::BOTTOM_RIGHT; i <= OCCViewer_ViewFrame::TOP_RIGHT; i++ ) {
 +              if ( occView && occView->getView( i ) ) {
 +                occView->getView( i )->activateSetRotationSelected( myX, myY, myZ );
 +                myResult = true;
 +              }
 +            }
 +          }
 +#endif // DISABLE_OCCVIEWER
 +        }
 +        else if ( type == "VTKViewer") {
 +#ifndef DISABLE_VTKVIEWER
 +          SVTK_ViewWindow* vtkView = qobject_cast<SVTK_ViewWindow*>( wnd );
 +          if ( vtkView )
 +          {
 +            double aCenter[3] = { myX, myY, myZ };
 +            vtkView->activateSetRotationSelected( (void*)aCenter );
 +            myResult = true;
 +          }
 +#endif // DISABLE_VTKVIEWER
 +        }
 +      }
 +    }
 +  }
 +};
 +bool SalomePyQt::setViewRotationPoint( const double x, const double y, const double z, const int id )
 +{
 +  return ProcessEvent( new TSetViewRotationPoint( x, y, z, id ) );
 +}
 +
  /*!
    \fn QString SalomePyQt::getViewTitle( const int id );
    \brief Get view caption  
index c2daba5045dcc4cf43307be95d073df0957c7a20,3a63b154fb6b911ba5061346828a6bb8f95dab44..4936481184bf686fba076786a0cc933421ffcecb
@@@ -153,7 -153,7 +153,7 @@@ void SVTK_ViewWindow::Initialize(SVTK_V
  {
    myModel = theModel;
    myInteractor = new SVTK_RenderWindowInteractor(this,"SVTK_RenderWindowInteractor");
 -  
 +
    SVTK_Selector* aSelector = SVTK_Selector::New();
    int aPreselectionMode =  SUIT_Session::session()->resourceMgr()->
      integerValue( "VTKViewer", "preselection", Standard_Preselection );
    bool isSelectionEnabled = SUIT_Session::session()->resourceMgr()->
      booleanValue( "VTKViewer", "enable_selection", true );
    aSelector->SetSelectionEnabled( isSelectionEnabled );
 -    
 +
    SVTK_GenericRenderWindowInteractor* aDevice = SVTK_GenericRenderWindowInteractor::New();
    aDevice->SetRenderWidget(myInteractor);
    aDevice->SetSelector(aSelector);
 -  
 +
    SVTK_Renderer* aRenderer = SVTK_Renderer::New();
    aRenderer->Initialize(aDevice,aSelector);
 -  
 +
    myInteractor->Initialize(aDevice,aRenderer,aSelector);
 -  
 +
    aDevice->Delete();
    aRenderer->Delete();
    aSelector->Delete();
 -  
 +
    myToolBar = toolMgr()->createToolBar( tr("LBL_TOOLBAR_LABEL"),                       // title (language-dependant)
 -                                      QString( "VTKViewerViewOperations" ),          // name (language-independant)
 -                                      false );                                       // disable floatable toolbar
 +                                        QString( "VTKViewerViewOperations" ),          // name (language-independant)
 +                                        false );                                       // disable floatable toolbar
  
    myRecordingToolBar = toolMgr()->createToolBar( tr("LBL_TOOLBAR_RECORD_LABEL"),       // title (language-dependant)
 -                                               QString( "VTKRecordingOperations" ),  // name (language-independant)
 -                                               false );                              // disable floatable toolbar
 -  
 +                                                 QString( "VTKRecordingOperations" ),  // name (language-independant)
 +                                                 false );                              // disable floatable toolbar
 +
    createActions( SUIT_Session::session()->resourceMgr() );
    createToolBar();
 -  
 +
    SetEventDispatcher(myInteractor->GetDevice());
    myInteractor->setBackgroundRole( QPalette::NoRole );//NoBackground
    myInteractor->setFocusPolicy(Qt::StrongFocus);
      booleanValue( "VTKViewer", "enable_quad_buffer_support", false );
    myInteractor->getRenderWindow()->SetStereoCapableWindow((int)isSupportQuadBuffer);
    setFocusProxy(myInteractor);
 -  
 +
    myUpdateRateDlg = new SVTK_UpdateRateDlg( getAction( UpdateRate ), this, "SVTK_UpdateRateDlg" );
    myNonIsometricDlg = new SVTK_NonIsometricDlg( getAction( NonIsometric ), this, "SVTK_NonIsometricDlg" );
    myCubeAxesDlg = new SVTK_CubeAxesDlg( getAction( GraduatedAxes ), this, "SVTK_CubeAxesDlg" );
    myEventCallbackCommand->SetCallback(SVTK_ViewWindow::ProcessEvents);
    myEventCallbackCommand->Delete();
  
 -  GetInteractor()->GetInteractorStyle()->AddObserver(SVTK::OperationFinished, 
 -                                                   myEventCallbackCommand.GetPointer(), 0.0);
 -  myKeyFreeInteractorStyle->AddObserver(SVTK::OperationFinished, 
 -                                      myEventCallbackCommand.GetPointer(), 0.0);
 +  GetInteractor()->GetInteractorStyle()->AddObserver(SVTK::OperationFinished,
 +                                                     myEventCallbackCommand.GetPointer(), 0.0);
 +  myKeyFreeInteractorStyle->AddObserver(SVTK::OperationFinished,
 +                                        myEventCallbackCommand.GetPointer(), 0.0);
 +
  
  
 -  
    myInteractor->getRenderWindow()->Render();
    setBackground( Qtx::BackgroundData( Qt::black ) ); // set default background
    onResetView();
@@@ -610,17 -610,17 +610,17 @@@ void SVTK_ViewWindow::setBackground( co
      switch ( bgData.mode() ) {
      case Qtx::ColorBackground:
        {
 -      QColor c = bgData.color();
 -      if ( c.isValid() ) {
 -        // show solid-colored background
 -        getRenderer()->SetTexturedBackground( false );  // cancel texture mode
 -        getRenderer()->SetGradientBackground( false );  // cancel gradient mode
 -        getRenderer()->SetBackground( c.red()/255.0,
 -                                      c.green()/255.0,
 -                                      c.blue()/255.0 ); // set background color
 -        ok = true;
 -      }
 -      break;
 +        QColor c = bgData.color();
 +        if ( c.isValid() ) {
 +          // show solid-colored background
 +          getRenderer()->SetTexturedBackground( false );  // cancel texture mode
 +          getRenderer()->SetGradientBackground( false );  // cancel gradient mode
 +          getRenderer()->SetBackground( c.red()/255.0,
 +                                        c.green()/255.0,
 +                                        c.blue()/255.0 ); // set background color
 +          ok = true;
 +        }
 +        break;
        }
      case Qtx::SimpleGradientBackground:
        {
        }
      case Qtx::CustomGradientBackground:
        {
 -      // NOT IMPLEMENTED YET
 -      getRenderer()->SetTexturedBackground( false );  // cancel texture mode
 -      getRenderer()->SetGradientBackground( false );  // cancel gradient mode
 -      // .........
 -      break;
 +        // NOT IMPLEMENTED YET
 +        getRenderer()->SetTexturedBackground( false );  // cancel texture mode
 +        getRenderer()->SetGradientBackground( false );  // cancel gradient mode
 +        // .........
 +        break;
        }
      default:
        break;
        int textureMode = bgData.texture( fileName );
        QFileInfo fi( fileName );
        if ( !fileName.isEmpty() && fi.exists() ) {
 -      // read texture from file
 -      QString extension = fi.suffix().toLower();
 -      vtkImageReader2* aReader = 0;
 -      if ( extension == "jpg" || extension == "jpeg" )
 -        aReader = vtkJPEGReader::New();
 -      else if ( extension == "bmp" )
 -        aReader = vtkBMPReader::New();
 -      else if ( extension == "tif" || extension == "tiff" )
 -        aReader = vtkTIFFReader::New();
 -      else if ( extension == "png" )
 -        aReader = vtkPNGReader::New();
 -      else if ( extension == "mhd" || extension == "mha" )
 -        aReader = vtkMetaImageReader::New();           
 -      if ( aReader ) {
 -        // create texture
 -        aReader->SetFileName( fi.absoluteFilePath().toUtf8().constData() );
 -        aReader->Update();      
 -        VTKViewer_Texture* aTexture = VTKViewer_Texture::New();           
 -        vtkImageMapToColors* aMap = 0;
 -        vtkAlgorithmOutput* anOutput;
 -        /*
 -        // special processing for BMP reader
 -        vtkBMPReader* aBMPReader = (vtkBMPReader*)aReader;
 -        if ( aBMPReader ) {
 -        // Special processing for BMP file
 -        aBMPReader->SetAllow8BitBMP(1);
 -          
 -        aMap = vtkImageMapToColors::New();
 -        aMap->SetInputConnection( aBMPReader->GetOutputPort() );
 -        aMap->SetLookupTable( (vtkScalarsToColors*)aBMPReader->GetLookupTable() );
 -        aMap->SetOutputFormatToRGB();
 -          
 -        anOutput = aMap->GetOutputPort();
 -        }
 -        else {
 -        }
 -        */
 -        anOutput = aReader->GetOutputPort( 0 );
 -        aTexture->SetInputConnection( anOutput );
 -        // set texture mode
 -        // VSR: Currently, VTK only supports Stretch mode, so below code will give
 -        // the same results for all modes
 -        switch ( textureMode ) {
 -        case Qtx::TileTexture:
 -          aTexture->SetPosition((int)VTKViewer_Texture::Tiled);
 -          break;
 -        case Qtx::StretchTexture:
 -          aTexture->SetPosition((int)VTKViewer_Texture::Stretched);
 -          break;
 -        case Qtx::CenterTexture:
 -          aTexture->SetPosition((int)VTKViewer_Texture::Centered);
 -        default:
 -          break;
 -        }
 -        // show textured background
 -        getRenderer()->SetTexturedBackground( true );
 -        getRenderer()->SetBackgroundTexture( aTexture );
 -        
 -        // clean-up resources
 -        if ( aMap )
 -          aMap->Delete();
 -        aReader->Delete();
 -        aTexture->Delete();
 -        ok = true;
 -      }
 +        // read texture from file
 +        QString extension = fi.suffix().toLower();
 +        vtkImageReader2* aReader = 0;
 +        if ( extension == "jpg" || extension == "jpeg" )
 +          aReader = vtkJPEGReader::New();
 +        else if ( extension == "bmp" )
 +          aReader = vtkBMPReader::New();
 +        else if ( extension == "tif" || extension == "tiff" )
 +          aReader = vtkTIFFReader::New();
 +        else if ( extension == "png" )
 +          aReader = vtkPNGReader::New();
 +        else if ( extension == "mhd" || extension == "mha" )
 +          aReader = vtkMetaImageReader::New();
 +        if ( aReader ) {
 +          // create texture
-           aReader->SetFileName( fi.absoluteFilePath().toLatin1().constData() );
++          aReader->SetFileName( fi.absoluteFilePath().toUtf8().constData() );
 +          aReader->Update();
 +          VTKViewer_Texture* aTexture = VTKViewer_Texture::New();
 +          vtkImageMapToColors* aMap = 0;
 +          vtkAlgorithmOutput* anOutput;
 +          /*
 +          // special processing for BMP reader
 +          vtkBMPReader* aBMPReader = (vtkBMPReader*)aReader;
 +          if ( aBMPReader ) {
 +          // Special processing for BMP file
 +          aBMPReader->SetAllow8BitBMP(1);
 +
 +          aMap = vtkImageMapToColors::New();
 +          aMap->SetInputConnection( aBMPReader->GetOutputPort() );
 +          aMap->SetLookupTable( (vtkScalarsToColors*)aBMPReader->GetLookupTable() );
 +          aMap->SetOutputFormatToRGB();
 +
 +          anOutput = aMap->GetOutputPort();
 +          }
 +          else {
 +          }
 +          */
 +          anOutput = aReader->GetOutputPort( 0 );
 +          aTexture->SetInputConnection( anOutput );
 +          // set texture mode
 +          // VSR: Currently, VTK only supports Stretch mode, so below code will give
 +          // the same results for all modes
 +          switch ( textureMode ) {
 +          case Qtx::TileTexture:
 +            aTexture->SetPosition((int)VTKViewer_Texture::Tiled);
 +            break;
 +          case Qtx::StretchTexture:
 +            aTexture->SetPosition((int)VTKViewer_Texture::Stretched);
 +            break;
 +          case Qtx::CenterTexture:
 +            aTexture->SetPosition((int)VTKViewer_Texture::Centered);
 +          default:
 +            break;
 +          }
 +          // show textured background
 +          getRenderer()->SetTexturedBackground( true );
 +          getRenderer()->SetBackgroundTexture( aTexture );
 +
 +          // clean-up resources
 +          if ( aMap )
 +            aMap->Delete();
 +          aReader->Delete();
 +          aTexture->Delete();
 +          ok = true;
 +        }
        }
      }
    }
@@@ -885,20 -885,20 +885,20 @@@ void SVTK_ViewWindow::SetProjectionMode
    SVTK_Viewer* aViewer = dynamic_cast<SVTK_Viewer*>(myModel);
    QtxAction* aSwitchZoomingStyle = dynamic_cast<QtxAction*>( toolMgr()->action( SwitchZoomingStyleId ) );
    if ( theMode == Parallel && !aParallelAction->isChecked() ) {
 -      aParallelAction->setChecked( true );
 -        aSwitchZoomingStyle->setEnabled(true);
 -        aStereoAction->setChecked( false );
 +    aParallelAction->setChecked( true );
 +    aSwitchZoomingStyle->setEnabled(true);
 +    aStereoAction->setChecked( false );
    }
    if ( theMode == Projection && !aProjectionAction->isChecked() ) {
 -      aProjectionAction->setChecked( true );
 -        aSwitchZoomingStyle->setEnabled(false);
 +    aProjectionAction->setChecked( true );
 +    aSwitchZoomingStyle->setEnabled(false);
    }
    if ( theMode == Stereo ) {
      aStereoAction->setChecked( true );
      if ( aParallelAction->isEnabled() ) {
 -        aParallelAction->setEnabled( false );
 -        aParallelAction->setChecked( false );
 -        aStereoAction->setChecked( false );
 +      aParallelAction->setEnabled( false );
 +      aParallelAction->setChecked( false );
 +      aStereoAction->setChecked( false );
      }
      else {
        aParallelAction->setEnabled( true );
@@@ -1095,6 -1095,7 +1095,6 @@@ void SVTK_ViewWindow::SetSelectionEnabl
    for (int i = 0; i < actors->GetNumberOfItems(); ++i )
      if (VTKViewer_Actor *actor = dynamic_cast<VTKViewer_Actor*>(actors->GetItemAsObject(i)))
      {
 -      cout << "actor " << actor << endl;
        actor->EnableSelection( theEnable );
      }
  }
@@@ -1420,7 -1421,7 +1420,7 @@@ bool SVTK_ViewWindow::dumpViewToFormat
      QString aFilePrefix(fileName);
      QString anExtension(SUIT_Tools::extension(fileName));
      aFilePrefix.truncate(aFilePrefix.length() - 1 - anExtension.length());
-     anExporter->SetFilePrefix(aFilePrefix.toLatin1().data());
+     anExporter->SetFilePrefix(aFilePrefix.toUtf8().data());
      anExporter->Write();
      anExporter->Delete();
    }
@@@ -1647,7 -1648,7 +1647,7 @@@ void setGradAxisVisualParams(QXmlStream
    //printf("#### Color: %f, %f, %f\n", color[0], color[1], color[2]);
  
    actor->SetTitleVisibility( isVisible );
-   actor->SetTitle( title.toLatin1() );
+   actor->SetTitle( title.toUtf8() );
    vtkTextProperty* txtProp = actor->GetTitleTextProperty();
    if ( txtProp ) {
      txtProp->SetColor( color );
@@@ -1732,7 -1733,7 +1732,7 @@@ void setGradAxisVisualParams( vtkAxisAc
      int shadow = paramsLst[10].toInt();
  
      actor->SetTitleVisibility( isVisible );
-     actor->SetTitle( title.toLatin1() );
+     actor->SetTitle( title.toUtf8() );
      vtkTextProperty* txtProp = actor->GetTitleTextProperty();
      if ( txtProp ) {
        txtProp->SetColor( color );
@@@ -1870,7 -1871,7 +1870,7 @@@ void SVTK_ViewWindow::setVisualParamete
  */
  void SVTK_ViewWindow::doSetVisualParameters( const QString& parameters, bool baseParamsOnly )
  {
 -  
 +
    double pos[3], focalPnt[3], viewUp[3], parScale, scale[3];
  
    QXmlStreamReader aReader(parameters);
      if (aReader.isStartElement()) {
        QXmlStreamAttributes aAttr = aReader.attributes();
        //printf("### Name = %s\n", qPrintable(aReader.name().toString()));
 -      if (aReader.name() == "Position") {       
 +      if (aReader.name() == "Position") {
          pos[0] = aAttr.value("X").toString().toDouble();
          pos[1] = aAttr.value("Y").toString().toDouble();
          pos[2] = aAttr.value("Z").toString().toDouble();
          scale[1] = aAttr.value("Y").toString().toDouble();
          scale[2] = aAttr.value("Z").toString().toDouble();
          //printf("#### ViewScale %f; %f; %f\n", scale[0], scale[1], scale[2]);
 -      } 
 +      }
        else if (aReader.name() == "DisplayCubeAxis") {
 -      if ( !baseParamsOnly ) {
 -        if (aAttr.value("Show") == "0")
 -          gradAxesActor->VisibilityOff();
 -        else
 -          gradAxesActor->VisibilityOn();
 -      }
 +        if ( !baseParamsOnly ) {
 +          if (aAttr.value("Show") == "0")
 +            gradAxesActor->VisibilityOff();
 +          else
 +            gradAxesActor->VisibilityOn();
 +        }
        }
        else if (aReader.name() == "GraduatedAxis") {
 -      if ( !baseParamsOnly ) {
 -        if(aAttr.value("Axis") == "X") 
 -          setGradAxisVisualParams(aReader, gradAxesActor->GetXAxisActor2D());
 -        else if(aAttr.value("Axis") == "Y")
 -          setGradAxisVisualParams(aReader, gradAxesActor->GetYAxisActor2D());
 -        else if(aAttr.value("Axis") == "Z")
 -          setGradAxisVisualParams(aReader, gradAxesActor->GetZAxisActor2D());
 -      }
 -      } 
 +        if ( !baseParamsOnly ) {
 +          if(aAttr.value("Axis") == "X")
 +            setGradAxisVisualParams(aReader, gradAxesActor->GetXAxisActor2D());
 +          else if(aAttr.value("Axis") == "Y")
 +            setGradAxisVisualParams(aReader, gradAxesActor->GetYAxisActor2D());
 +          else if(aAttr.value("Axis") == "Z")
 +            setGradAxisVisualParams(aReader, gradAxesActor->GetZAxisActor2D());
 +        }
 +      }
        else if (aReader.name() == "Trihedron") {
 -      if ( !baseParamsOnly ) {
 -        if (aAttr.value("isShown") == "0")
 -          GetTrihedron()->VisibilityOff();
 -        else
 -          GetTrihedron()->VisibilityOn();
 -        SetTrihedronSize(aAttr.value("Size").toString().toDouble());
 -      }
 +        if ( !baseParamsOnly ) {
 +          if (aAttr.value("isShown") == "0")
 +            GetTrihedron()->VisibilityOff();
 +          else
 +            GetTrihedron()->VisibilityOn();
 +          SetTrihedronSize(aAttr.value("Size").toString().toDouble());
 +        }
        }
        else if (aReader.name() == "Background") {
 -      if ( !baseParamsOnly ) {
 -        setBackground( Qtx::stringToBackground( aAttr.value("Value").toString() ) );
 -      }
 +        if ( !baseParamsOnly ) {
 +          setBackground( Qtx::stringToBackground( aAttr.value("Value").toString() ) );
 +        }
        }
      }
    }
        scale[0] = paramsLst[10].toDouble();
        scale[1] = paramsLst[11].toDouble();
        scale[2] = paramsLst[12].toDouble();
 -      
 +
        // applying parameters
        vtkCamera* camera = getRenderer()->GetActiveCamera();
        camera->SetPosition( pos );
        camera->SetParallelScale( parScale );
        GetRenderer()->SetScale( scale );
        //SetScale( scale );
 -      
 +
        // apply graduated axes parameters
        if ( !baseParamsOnly ) {
 -      SVTK_CubeAxesActor2D* gradAxesActor = GetCubeAxes();
 -      if ( gradAxesActor && paramsLst.size() == nAllParams ) {
 -        int i = nNormalParams+1, j = i + nGradAxisParams - 1;
 -        ::setGradAxisVisualParams( gradAxesActor->GetXAxisActor2D(), parameters.section( '*', i, j ) ); 
 -        i = j + 1; j += nGradAxisParams;
 -        ::setGradAxisVisualParams( gradAxesActor->GetYAxisActor2D(), parameters.section( '*', i, j ) ); 
 -        i = j + 1; j += nGradAxisParams;
 -        ::setGradAxisVisualParams( gradAxesActor->GetZAxisActor2D(), parameters.section( '*', i, j ) ); 
 -        
 -        if ( paramsLst[13].toUShort() )
 -          gradAxesActor->VisibilityOn();
 -        else
 -          gradAxesActor->VisibilityOff();
 -      }
 -      else if ( paramsLst.size() == nAllParams ) {
 -        if ( paramsLst[90].toUShort() )
 -          GetTrihedron()->VisibilityOn();
 -        else
 -          GetTrihedron()->VisibilityOff();
 -        
 -        SetTrihedronSize(paramsLst[91].toDouble());
 -      }
 +        SVTK_CubeAxesActor2D* gradAxesActor = GetCubeAxes();
 +        if ( gradAxesActor && paramsLst.size() == nAllParams ) {
 +          int i = nNormalParams+1, j = i + nGradAxisParams - 1;
 +          ::setGradAxisVisualParams( gradAxesActor->GetXAxisActor2D(), parameters.section( '*', i, j ) );
 +          i = j + 1; j += nGradAxisParams;
 +          ::setGradAxisVisualParams( gradAxesActor->GetYAxisActor2D(), parameters.section( '*', i, j ) );
 +          i = j + 1; j += nGradAxisParams;
 +          ::setGradAxisVisualParams( gradAxesActor->GetZAxisActor2D(), parameters.section( '*', i, j ) );
 +
 +          if ( paramsLst[13].toUShort() )
 +            gradAxesActor->VisibilityOn();
 +          else
 +            gradAxesActor->VisibilityOff();
 +        }
 +        else if ( paramsLst.size() == nAllParams ) {
 +          if ( paramsLst[90].toUShort() )
 +            GetTrihedron()->VisibilityOn();
 +          else
 +            GetTrihedron()->VisibilityOff();
 +
 +          SetTrihedronSize(paramsLst[91].toDouble());
 +        }
        }
      }
    }
@@@ -2226,7 -2227,7 +2226,7 @@@ void SVTK_ViewWindow::createActions(SUI
    this->addAction(anAction);
    mgr->registerAction( anAction, FrontId );
  
 -  anAction = new QtxAction(tr("MNU_BACK_VIEW"), 
 +  anAction = new QtxAction(tr("MNU_BACK_VIEW"),
                             theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_BACK" ) ),
                             tr( "MNU_BACK_VIEW" ), 0, this, false, "Viewers:Back view");
    anAction->setStatusTip(tr("DSC_BACK_VIEW"));
    this->addAction(anAction);
    mgr->registerAction( anAction, BackId );
  
 -  anAction = new QtxAction(tr("MNU_TOP_VIEW"), 
 +  anAction = new QtxAction(tr("MNU_TOP_VIEW"),
                             theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_TOP" ) ),
                             tr( "MNU_TOP_VIEW" ), 0, this, false, "Viewers:Top view");
    anAction->setStatusTip(tr("DSC_TOP_VIEW"));
    this->addAction(anAction);
    mgr->registerAction( anAction, TopId );
  
 -  anAction = new QtxAction(tr("MNU_BOTTOM_VIEW"), 
 +  anAction = new QtxAction(tr("MNU_BOTTOM_VIEW"),
                             theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_BOTTOM" ) ),
                             tr( "MNU_BOTTOM_VIEW" ), 0, this, false, "Viewers:Bottom view");
    anAction->setStatusTip(tr("DSC_BOTTOM_VIEW"));
    this->addAction(anAction);
    mgr->registerAction( anAction, BottomId );
  
 -  anAction = new QtxAction(tr("MNU_LEFT_VIEW"), 
 +  anAction = new QtxAction(tr("MNU_LEFT_VIEW"),
                             theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_LEFT" ) ),
                             tr( "MNU_LEFT_VIEW" ), 0, this, false, "Viewers:Left view");
    anAction->setStatusTip(tr("DSC_LEFT_VIEW"));
    this->addAction(anAction);
    mgr->registerAction( anAction, LeftId );
  
 -  anAction = new QtxAction(tr("MNU_RIGHT_VIEW"), 
 +  anAction = new QtxAction(tr("MNU_RIGHT_VIEW"),
                             theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_RIGHT" ) ),
                             tr( "MNU_RIGHT_VIEW" ), 0, this, false, "Viewers:Right view");
    anAction->setStatusTip(tr("DSC_RIGHT_VIEW"));
  
    // rotate anticlockwise
    anAction = new QtxAction(tr("MNU_ANTICLOCKWISE_VIEW"),
 -                         theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_ANTICLOCKWISE" ) ),
 +                           theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_ANTICLOCKWISE" ) ),
                             tr( "MNU_ANTICLOCKWISE_VIEW" ), 0, this, false, "Viewers:Rotate anticlockwise");
    anAction->setStatusTip(tr("DSC_ANTICLOCKWISE_VIEW"));
    connect(anAction, SIGNAL(triggered()), this, SLOT(onAntiClockWiseView()));
  
    // rotate clockwise
    anAction = new QtxAction(tr("MNU_CLOCKWISE_VIEW"),
 -                         theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_CLOCKWISE" ) ),
 +                           theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_CLOCKWISE" ) ),
                             tr( "MNU_CLOCKWISE_VIEW" ), 0, this, false, "Viewers:Rotate clockwise");
    anAction->setStatusTip(tr("DSC_CLOCKWISE_VIEW"));
    connect(anAction, SIGNAL(triggered()), this, SLOT(onClockWiseView()));
@@@ -2714,9 -2715,9 +2714,9 @@@ void SVTK_ViewWindow::emitTransformed(
    Processes events
  */
  void SVTK_ViewWindow::ProcessEvents(vtkObject* vtkNotUsed(theObject),
 -                                  unsigned long theEvent,
 -                                  void* theClientData,
 -                                  void* theCallData)
 +                                    unsigned long theEvent,
 +                                    void* theClientData,
 +                                    void* theCallData)
  {
    SVTK_ViewWindow* self = reinterpret_cast<SVTK_ViewWindow*>(theClientData);
    if(self)
index 5bb774c5ed42d102eabab7bbd2685121109ca9a0,5779f7b706617fc564186dabe6a896af75c40b20..ec97e8c9d10112e2f392d1c0c8165a6c339f17b5
@@@ -272,7 -272,7 +272,8 @@@ void SalomeApp_Application::start(
  
                script.remove( QRegExp("^python.*[\\s]+") );
                QString cmd = script+" "+args;
 -              QString command = QString( "exec(open(\"%1\",encoding='utf-8').read())" ).arg(cmd.trimmed());
++
 +              QString command = QString( "exec(open(\"%1\", \"rb\").read())" ).arg(cmd.trimmed());
                pyConsole->exec(command);
              }
            } // end for loop on pyfiles QStringList
@@@ -497,7 -497,7 +498,7 @@@ void SalomeApp_Application::onNewWithSc
    {
      onNewDoc();
  
 -    QString command = QString("exec(open(\"%1\",encoding='utf-8').read())").arg(aFile);
 +    QString command = QString("exec(open(\"%1\", \"rb\").read())").arg(aFile);
  
  #ifndef DISABLE_PYCONSOLE
      PyConsole_Console* pyConsole = pythonConsole();
@@@ -585,8 -585,6 +586,8 @@@ void SalomeApp_Application::onModuleAct
  /*!SLOT. Copy objects to study maneger from selection maneger..*/
  void SalomeApp_Application::onCopy()
  {
 +  LightApp_Application::onCopy();
 +
    SALOME_ListIO list;
    LightApp_SelectionMgr* mgr = selectionMgr();
    mgr->selectedObjects(list);
    if(it.More())
      {
        _PTR(SObject) so = stdDS->FindObjectID(it.Value()->getEntry());
 -      try {
 -        stdDS->Copy(so);
 -        onSelectionChanged();
 -      }
 -      catch(...) {
 +      if( so )
 +      {
 +        try {
 +          stdDS->Copy(so);
 +          onSelectionChanged();
 +        }
 +        catch(...) {
 +        }
        }
      }
  }
  /*!SLOT. Paste objects to study maneger from selection manager.*/
  void SalomeApp_Application::onPaste()
  {
 +  LightApp_Application::onPaste();
 +
    SALOME_ListIO list;
    LightApp_SelectionMgr* mgr = selectionMgr();
    mgr->selectedObjects(list);
    if(it.More())
      {
        _PTR(SObject) so = stdDS->FindObjectID(it.Value()->getEntry());
 -      try {
 -        stdDS->Paste(so);
 -        updateObjectBrowser( true );
 -        updateActions(); //SRN: BugID IPAL9377, case 3
 -      }
 -      catch(...) {
 +      if( so )
 +      {
 +        try {
 +          stdDS->Paste(so);
 +          updateObjectBrowser( true );
 +          updateActions(); //SRN: BugID IPAL9377, case 3
 +        }
 +        catch(...) {
 +        }
        }
      }
  }
@@@ -934,7 -924,7 +935,8 @@@ void SalomeApp_Application::onLoadScrip
  
    if ( !aFile.isEmpty() )
    {
 -    QString command = QString("exec(open(\"%1\",encoding='utf-8').read())").arg(aFile);
++
 +    QString command = QString("exec(open(\"%1\", \"rb\").read())").arg(aFile);
  
  #ifndef DISABLE_PYCONSOLE
      PyConsole_Console* pyConsole = pythonConsole();
@@@ -1201,7 -1191,7 +1203,7 @@@ int SalomeApp_Application::openChoice( 
    } else { // file is not exist on disk
      SUIT_MessageBox::warning( desktop(),
                                QObject::tr("WRN_WARNING"),
-                               QObject::tr("WRN_FILE_NOT_EXIST").arg(aName.toLatin1().data()));
+                               QObject::tr("WRN_FILE_NOT_EXIST").arg(aName.toUtf8().data()));
      return false;
    }
  
@@@ -1968,7 -1958,7 +1970,8 @@@ bool SalomeApp_Application::onRestoreSt
    SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
  
    // load study from the temporary directory
 -  QString command = QString( "exec(open(\"%1\",encoding='utf-8').read())" ).arg( theDumpScript );
++
 +  QString command = QString( "exec(open(\"%1\" ,\"rb\").read())" ).arg( theDumpScript );
  
  #ifndef DISABLE_PYCONSOLE
    PyConsole_Console* pyConsole = app->pythonConsole();
index 34c96cf4c046ece33e1d26ce3b197f8551ea5e2c,aa4861f806508e25910d97ae53273c0c814f9ccb..d6386fd7f09bed08cf5111cd45cf3e7fe0168518
@@@ -98,21 -98,6 +98,21 @@@ typedef GLfloat TBall
  #define BallTextureId 0 
  
  
 +
 +void MessageCallback( GLenum source,
 +                      GLenum type,
 +                      GLuint id,
 +                      GLenum severity,
 +                      GLsizei length,
 +                      const GLchar* message,
 +                      const void* userParam )
 +{
 +  fprintf( stderr, "GL CALLBACK: %s type = 0x%x, severity = 0x%x, message = %s\n",
 +           ( type == GL_DEBUG_TYPE_ERROR ? "** GL ERROR **" : "" ),
 +            type, severity, message );
 +}
 +
 +
  //-----------------------------------------------------------------------------
  VTKViewer_PolyDataMapper::VTKViewer_PolyDataMapper()
  {
  #endif
  
    this->OpenGLHelper.Init();
 +
 +  // For debug purposes only
 +  // glEnable              ( GL_DEBUG_OUTPUT );
 +  // glDebugMessageCallback( (GLDEBUGPROC) MessageCallback, 0 );
 +
  }
  
  //-----------------------------------------------------------------------------
@@@ -162,8 -142,6 +162,8 @@@ int VTKViewer_PolyDataMapper::InitShade
      return false;
  
    // Get uniform locations.
 +  GLint current_program;
 +  glGetIntegerv( GL_CURRENT_PROGRAM, &current_program );
    this->OpenGLHelper.vglUseProgramObjectARB( this->PointProgram );
  
    this->myLocations.ModelViewProjection = this->OpenGLHelper.vglGetUniformLocationARB( this->PointProgram, "uModelViewProjectionMatrix" );
    this->myLocations.GeneralPointSize    = this->OpenGLHelper.vglGetUniformLocationARB( this->PointProgram, "uGeneralPointSize" );
    this->myLocations.PointSprite         = this->OpenGLHelper.vglGetUniformLocationARB( this->PointProgram, "uPointSprite" );
  
 -  this->OpenGLHelper.vglUseProgramObjectARB( 0 );
 +  this->OpenGLHelper.vglUseProgramObjectARB( current_program );
  
    this->OpenGLHelper.vglGenVertexArraysARB(1, &this->VertexArrayObject);
  #else
@@@ -287,7 -265,7 +287,7 @@@ void VTKViewer_PolyDataMapper::SetBallE
        
        QString anAlphaTexture = getenv( "GUI_ROOT_DIR" );
        anAlphaTexture.append( "/share/salome/resources/gui/sprite_alpha.vti" );
-       vtkSmartPointer<vtkImageData> aTextureValue = VTK::MakeTexture( aMainTexture.toLatin1().constData(), anAlphaTexture.toLatin1().constData() );
+       vtkSmartPointer<vtkImageData> aTextureValue = VTK::MakeTexture( aMainTexture.toUtf8().constData(), anAlphaTexture.toUtf8().constData() );
        this->SpecialTextures[BallTextureId] = aTextureValue;
      }
      this->ImageData = this->SpecialTextures[BallTextureId];
@@@ -523,8 -501,7 +523,8 @@@ void VTKViewer_PolyDataMapper::RenderPi
      // make sure our window is current
      ren->GetRenderWindow()->MakeCurrent();
  
 -
 +    GLint current_program;
 +    glGetIntegerv( GL_CURRENT_PROGRAM, &current_program );
      this->OpenGLHelper.vglUseProgramObjectARB( this->PointProgram );
  
  #ifndef VTK_OPENGL2
      //    this->RenderEdges(ren,act);
      //this->RenderPieceFinish(ren, act);
  #endif    
 -    this->OpenGLHelper.vglUseProgramObjectARB( 0 );
 +    this->OpenGLHelper.vglUseProgramObjectARB( current_program );
      this->CleanupPointSprites();
      glBindTexture( GL_TEXTURE_2D, 0 );
    }  
@@@ -907,8 -884,6 +907,8 @@@ void VTKViewer_PolyDataMapper::Internal
  
        if( this->ExtensionsInitialized == ES_Ok ) {
  #ifdef VTK_OPENGL2
 +      GLint current_program;
 +      glGetIntegerv( GL_CURRENT_PROGRAM, &current_program );
          this->OpenGLHelper.vglUseProgramObjectARB( this->PointProgram );
  
          vtkOpenGLCamera *cam = (vtkOpenGLCamera *)(ren->GetActiveCamera());
         this->OpenGLHelper.vglDeleteBuffersARB( 1, &aBufferObjectID );
         this->OpenGLHelper.vglBindVertexArrayARB( 0 );
  
 -       this->OpenGLHelper.vglUseProgramObjectARB( 0 );
 +       this->OpenGLHelper.vglUseProgramObjectARB( current_program );
  #else
         GLuint aBufferObjectID, aDiamsID = 0;
         GLint attribute_diams = -1;