Salome HOME
bos #19960: [CEA 19958] Show/Hide SHAPERSTUDY objects occ/19960_v2
authorvsr <vsr@opencascade.com>
Thu, 10 Sep 2020 07:10:35 +0000 (10:10 +0300)
committervsr <vsr@opencascade.com>
Fri, 5 Feb 2021 08:06:52 +0000 (11:06 +0300)
src/CAM/CAM_Application.cxx
src/CAM/CAM_Application.h
src/LightApp/LightApp_Application.cxx
src/LightApp/LightApp_Application.h
src/LightApp/LightApp_Displayer.cxx
src/LightApp/LightApp_Module.cxx
src/LightApp/LightApp_Selection.cxx
src/LightApp/LightApp_ShowHideOp.cxx
src/SALOME_SWIG/SALOMEGUI_Swig.cxx
src/SalomeApp/SalomeApp_Application.cxx
src/SalomeApp/SalomeApp_Study.cxx

index ac598983034b7c2ae40b0c84d9d2eeb6753a5a79..4c39298f5c098f3b3d3e7f46f9a91b58cc8d557f 100644 (file)
@@ -208,7 +208,8 @@ void CAM_Application::modules( QStringList& lst, const bool loaded ) const
   {
     for ( ModuleInfoList::const_iterator it = myInfoList.begin(); 
           it != myInfoList.end(); ++it )
-      lst.append( (*it).title );
+      if ( (*it).status != stNoGui )
+        lst.append( (*it).title );
   }
 }
 
@@ -689,6 +690,30 @@ QString CAM_Application::moduleLibrary( const QString& name, const bool full )
   return res;
 }
 
+/*!
+  \brief Get displayer proxy for given module, by its title (user name).
+  \param name module name or title
+  \return name of module which provides displayer for requested module
+ */
+QString CAM_Application::moduleDisplayer( const QString& name )
+{
+  QString res;
+
+  if ( !name.isEmpty() )
+  {
+    for ( ModuleInfoList::const_iterator it = myInfoList.begin(); it != myInfoList.end() && res.isEmpty(); ++it )
+    {
+      if ( (*it).title == name || (*it).name == name ) {
+        res = (*it).displayer;
+        if ( res.isEmpty() )
+          res = (*it).title;
+      }
+    }
+  }
+
+  return res;
+}
+
 /*!
   \brief Read modules information list
 
@@ -772,47 +797,53 @@ void CAM_Application::readModuleList()
       continue; // omit KERNEL and GUI modules
 
     bool hasGui = resMgr->booleanValue( *it, "gui", true );
-    if ( !hasGui )
-      continue; // omit if module is explicitly declared as not having GUI
 
-    QString modTitle = resMgr->stringValue( *it, "name", QString() );
-    if ( modTitle.isEmpty() )
+    QString modTitle, modIcon, modLibrary, modDescription;
+
+    if ( hasGui )
     {
-      printf( "****************************************************************\n" );
-      printf( "     Warning: module %s is improperly configured!\n", qPrintable(*it) );
-      printf( "     Module %s will not be available in GUI mode!\n", qPrintable(*it) );
-      printf( "****************************************************************\n" );
-      continue;
-    }
+      // if module has GUI, check that it is present
+      modTitle = resMgr->stringValue( *it, "name", QString() );
+      if ( modTitle.isEmpty() )
+      {
+        printf( "****************************************************************\n" );
+        printf( "     Warning: module %s is improperly configured!\n", qPrintable(*it) );
+        printf( "     Module %s will not be available in GUI mode!\n", qPrintable(*it) );
+        printf( "****************************************************************\n" );
+        continue;
+      }
 
-    QString modIcon = resMgr->stringValue( *it, "icon", QString() );
+      modIcon = resMgr->stringValue( *it, "icon", QString() );
 
-    QString modDescription = resMgr->stringValue( *it, "description", QString() );
+      modDescription = resMgr->stringValue( *it, "description", QString() );
 
-    QString modLibrary = resMgr->stringValue( *it, "library", QString() ).trimmed();
-    if ( !modLibrary.isEmpty() )
-    {
-      modLibrary = SUIT_Tools::file( modLibrary.trimmed() );
+      modLibrary = resMgr->stringValue( *it, "library", QString() ).trimmed();
+      if ( !modLibrary.isEmpty() )
+      {
+        modLibrary = SUIT_Tools::file( modLibrary.trimmed() );
 #if defined(WIN32)
-      QString libExt = QString( "dll" );
+        QString libExt = QString( "dll" );
 #elif defined(__APPLE__)
-      QString libExt = QString( "dylib" );
+        QString libExt = QString( "dylib" );
 #else
-      QString libExt = QString( "so" );
+        QString libExt = QString( "so" );
 #endif
-      if ( SUIT_Tools::extension( modLibrary ).toLower() == libExt )
-        modLibrary.truncate( modLibrary.length() - libExt.length() - 1 );
+        if ( SUIT_Tools::extension( modLibrary ).toLower() == libExt )
+          modLibrary.truncate( modLibrary.length() - libExt.length() - 1 );
 #ifndef WIN32
-      QString prefix = QString( "lib" );
-      if ( modLibrary.startsWith( prefix ) )
-        modLibrary.remove( 0, prefix.length() );
+        QString prefix = QString( "lib" );
+        if ( modLibrary.startsWith( prefix ) )
+          modLibrary.remove( 0, prefix.length() );
 #endif
+      }
+      else
+        modLibrary = modName;
     }
-    else
-      modLibrary = modName;
 
     QString version = resMgr->stringValue( *it, "version", QString() );
 
+    QString modDisplayer = resMgr->stringValue( *it, "displayer", QString() );
+
     ModuleInfo inf;
     inf.name = modName;
     inf.title = modTitle;
@@ -820,6 +851,7 @@ void CAM_Application::readModuleList()
     if ( hasGui ) inf.library = modLibrary;
     inf.icon = modIcon;
     inf.description = modDescription;
+    inf.displayer = modDisplayer;
     inf.version = version;
     myInfoList.append( inf );
   }
index a11669897c504317043ac1d23e914df7cb1bef8d..93f7c266b704cc484c4d3fd228900790fc03b17f 100644 (file)
@@ -76,6 +76,7 @@ public:
   static QString      moduleIcon( const QString& );
   static QString      moduleDescription( const QString& );
   static QString      moduleLibrary( const QString&, const bool = true );
+  static QString      moduleDisplayer( const QString& );
 
   virtual void        createEmptyStudy();
 
@@ -101,7 +102,7 @@ private:
 private:
   enum { stUnknown = 0, stNoGui, stInaccessible, stReady };
   typedef struct { 
-    QString name, title, icon, library, version, description;
+    QString name, title, icon, library, version, description, displayer;
     int status;
   } ModuleInfo;
   typedef QList<ModuleInfo> ModuleInfoList;
index b0d8f7f8fe388a4e77d2e15a8e151fc8183dcbdc..249ce2fd1a3f12f2a58ff382335163dbd5bc750c 100644 (file)
@@ -465,7 +465,7 @@ void LightApp_Application::closeApplication()
 #ifndef DISABLE_QTXWEBBROWSER
   QProcess::startDetached( "HelpBrowser",
                            QStringList() << QString( "--remove=%1" ).arg( QApplication::instance()->applicationPid() ) );
-#endif  
+#endif
   CAM_Application::closeApplication();
 }
 
@@ -543,7 +543,7 @@ bool LightApp_Application::activateModule( const QString& modName )
   updateViewManagers();
 
   if ( activeStudy() && activeStudy()->root() && objectBrowser() ) {
-    if ( objectBrowser()->root() != activeStudy()->root() ) 
+    if ( objectBrowser()->root() != activeStudy()->root() )
       objectBrowser()->setRoot( activeStudy()->root() );
     updateObjectBrowser( true );
   }
@@ -598,7 +598,7 @@ void LightApp_Application::createActions()
   // Help menu
 
   int helpMenu = createMenu( tr( "MEN_DESK_HELP" ), -1, -1, 1000 );
-  
+
   int id = LightApp_Application::UserID + FIRST_HELP_ID;
 
   // a) Link to web site
@@ -719,7 +719,7 @@ void LightApp_Application::createActions()
     IMapConstIterator<QString, QString > fileIt;
     for ( fileIt = helpData.begin(); fileIt != helpData.end(); fileIt++ ) {
       QString helpItemPath = fileIt.key();
-      // remove all '//' occurances 
+      // remove all '//' occurances
       while ( helpItemPath.contains( "//" ) )
         helpItemPath.replace( "//", "" );
       // obtain submenus hierarchy if given
@@ -733,7 +733,7 @@ void LightApp_Application::createActions()
        if ( total.count() == 1 && smenus.count() > 0 )
          helpItemPath = smenus.takeLast();
       }
-      QPixmap helpIcon = fileIt.value().startsWith( "http", Qt::CaseInsensitive ) ? 
+      QPixmap helpIcon = fileIt.value().startsWith( "http", Qt::CaseInsensitive ) ?
         resMgr->loadPixmap( "STD", tr( "ICON_WWW" ), false ) : resMgr->loadPixmap( "STD", tr( "ICON_HELP" ), false );
       QAction* a = createAction( id, helpItemPath, helpIcon, helpItemPath, helpItemPath,
                                  0, desk, false, this, SLOT( onHelpContentsModule() ) );
@@ -759,9 +759,9 @@ void LightApp_Application::createActions()
     QString valueStr = resMgr->stringValue( "add_help", paramName );
     if ( !valueStr.isEmpty() ) {
       QStringList valueItems = valueStr.split( ";;", QString::SkipEmptyParts );
-      foreach( QString item, valueItems ) { 
+      foreach( QString item, valueItems ) {
         if ( item.startsWith( "http", Qt::CaseInsensitive ) || QFile::exists( item ) ) {
-          QPixmap helpIcon = item.startsWith( "http", Qt::CaseInsensitive ) ? 
+          QPixmap helpIcon = item.startsWith( "http", Qt::CaseInsensitive ) ?
             resMgr->loadPixmap( "STD", tr( "ICON_WWW" ), false ) : resMgr->loadPixmap( "STD", tr( "ICON_HELP" ), false );
           QAction* a = createAction( id++, paramName, helpIcon, paramName, paramName,
                                      0, desk, false, this, SLOT( onHelpContentsModule() ) );
@@ -1020,7 +1020,7 @@ void LightApp_Application::onNewDoc()
 
   //asl: fix for 0020515
   saveDockWindowsState();
-  
+
   CAM_Application::onNewDoc();
 }
 
@@ -1078,7 +1078,7 @@ bool LightApp_Application::onOpenDoc( const QString& aName )
 
   // We should take mru action first because this application instance can be deleted later.
   QtxMRUAction* mru = ::qobject_cast<QtxMRUAction*>( action( MRUId ) );
-  
+
   bool res = CAM_Application::onOpenDoc( aName );
 
   if ( mru )
@@ -1255,7 +1255,7 @@ void LightApp_Application::showHelp( const QString& path )
 
 #if DISABLE_QTXWEBBROWSER
   bool useExternalBrowser = true;
-#else  
+#else
   bool useExternalBrowser = resMgr->booleanValue("ExternalBrowser", "use_external_browser", false );
 #endif
 
@@ -1267,7 +1267,7 @@ void LightApp_Application::showHelp( const QString& path )
     QString browser = resMgr->stringValue( "ExternalBrowser", "application" );
 #endif
     QString parameters = resMgr->stringValue("ExternalBrowser", "parameters");
-  
+
     if ( !browser.isEmpty() )
     {
       RunBrowser::execute( this, browser, parameters, path );
@@ -1488,7 +1488,7 @@ LogWindow* LightApp_Application::logWindow()
   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. 
+  already.
   \param force - if true, the pythonConsole is created if it does not exist yet
   \return Python Console
 */
@@ -2388,7 +2388,7 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref )
   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 
+  // .... -> 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" );
@@ -5258,7 +5258,7 @@ void LightApp_Application::emitOperationFinished( const QString& theModuleName,
   Update visibility state of given objects
 */
 void LightApp_Application::updateVisibilityState( DataObjectList& theList,
-                                                  SUIT_ViewModel*  theViewModel )
+                                                  SUIT_ViewModel* theViewModel )
 {
   if ( !theViewModel || theList.isEmpty() ) return;
 
@@ -5273,18 +5273,66 @@ void LightApp_Application::updateVisibilityState( DataObjectList& theList,
     if ( !obj || aStudy->isComponent( obj->entry() ) )
       continue;
 
-    LightApp_Module* anObjModule = dynamic_cast<LightApp_Module*>(obj->module());
-    if ( anObjModule ) {
-      LightApp_Displayer* aDisplayer = anObjModule->displayer();
-      if ( aDisplayer ) {
-        Qtx::VisibilityState anObjState = Qtx::UnpresentableState;
-        if ( aDisplayer->canBeDisplayed( obj->entry(), theViewModel->getType() ) ) {
-          if ( aView && aDisplayer->IsDisplayed( obj->entry(), aView ) )
-            anObjState = Qtx::ShownState;
-          else
-            anObjState = Qtx::HiddenState;
+    QString mname = aStudy->componentDataType(obj->entry());
+    LightApp_Displayer* aDisplayer = LightApp_Displayer::FindDisplayer(mname, false);
+    if ( aDisplayer ) {
+      Qtx::VisibilityState anObjState = Qtx::UnpresentableState;
+      if ( aDisplayer->canBeDisplayed( obj->entry(), theViewModel->getType() ) ) {
+        if ( aView && aDisplayer->IsDisplayed( obj->entry(), aView ) )
+          anObjState = Qtx::ShownState;
+        else
+          anObjState = Qtx::HiddenState;
+      }
+      aStudy->setVisibilityState( obj->entry(), anObjState );
+    }
+  }
+}
+
+/*!
+  Update presentations of all displayed objects of theComponent in specified viewers
+*/
+void LightApp_Application::updatePresentations( const QString& theComponent,
+                                                const QStringList& theViewManagerTypes )
+{
+  LightApp_Displayer* aDisplayer = LightApp_Displayer::FindDisplayer(theComponent, false);
+  if ( aDisplayer ) {
+    LightApp_Study* aStudy = dynamic_cast<LightApp_Study*>(activeStudy());
+    DataObjectList aComps;
+    bool isFound = false;
+    aStudy->root()->children( aComps );
+    DataObjectList::const_iterator aCompsIt = aComps.begin();
+    for ( ; aCompsIt != aComps.end() && !isFound; aCompsIt++ ) {
+      LightApp_DataObject* aComp = dynamic_cast<LightApp_DataObject*>( *aCompsIt );
+      if ( aComp && aComp->componentDataType() ==  theComponent) {
+        isFound = true;
+        DataObjectList anObjs;
+        aComp->children(anObjs, true);
+
+        QList<SUIT_ViewManager*> aViewMgrs;
+        QStringList::const_iterator itVMTypes = theViewManagerTypes.begin();
+        for ( ; itVMTypes != theViewManagerTypes.end(); ++itVMTypes )
+          viewManagers( *itVMTypes, aViewMgrs );
+
+        DataObjectList::const_iterator itObjs = anObjs.begin();
+        for ( ; itObjs != anObjs.end(); itObjs++ ) {
+          LightApp_DataObject* anObj = dynamic_cast<LightApp_DataObject*>( *itObjs );
+          QString anEntry = anObj->entry();
+
+          QListIterator<SUIT_ViewManager*> itViewMgrs( aViewMgrs );
+          while ( itViewMgrs.hasNext()) {
+            SUIT_ViewModel* aVM = itViewMgrs.next()->getViewModel();
+            if ( aVM ) {
+              SALOME_View* aView = dynamic_cast<SALOME_View*>(aVM);
+              if ( aView ) {
+                bool isDisp = aDisplayer->IsDisplayed( anEntry, aView );
+                aDisplayer->Erase( anEntry, true, false, aView );
+                if ( isDisp ) {
+                  aDisplayer->Display( anEntry, false, aView );
+                }
+              }
+            }
+          }
         }
-        aStudy->setVisibilityState( obj->entry(), anObjState );
       }
     }
   }
index da8ffc266784632ec2c2b127d5b9f031a4c14576..141f5f5c101da24886bacd3017e3d11bc9515409 100644 (file)
@@ -182,7 +182,10 @@ public:
   void                                emitOperationFinished( const QString&, const QString&, const QStringList& );
 
   void                                updateVisibilityState( DataObjectList& theList,
-                                                             SUIT_ViewModel* theViewModel );  
+                                                             SUIT_ViewModel* theViewModel );
+
+  void                                updatePresentations( const QString& theComponent,
+                                                           const QStringList& theViewManagerTypes );
 
   virtual bool                        checkExistingDoc( bool = true );
 
@@ -320,8 +323,8 @@ protected:
 private:
   void                                emptyPreferences( const QString& );
   QList<QToolBar*>                    findToolBars( const QStringList& names = QStringList() );
-  
-  QByteArray                          processState(QByteArray& input, 
+
+  QByteArray                          processState(QByteArray& input,
                                                   const bool processWin,
                                                   const bool processTb,
                                                   const bool isRestoring,
index c369ecabdd85b3db98bbf6a24d40a34ae8aaf48a..fbc9200fda9be139c9f19b5e4ea6b054a1deecfb 100644 (file)
@@ -298,33 +298,36 @@ bool LightApp_Displayer::canBeDisplayed( const QString& entry ) const
 
 /*!
   \return displayer, corresponding to module
-  \param mod_name - name of module
+  \param mod_name - name or title of module.
+  \note It is better to use name (component data type)
+        in any case when you are not sure the title is not empty.
   \param load - is module has to be forced loaded
 */
 LightApp_Displayer* LightApp_Displayer::FindDisplayer( const QString& mod_name, const bool load )
 {
+  QString mname = LightApp_Application::moduleDisplayer( mod_name );
   SUIT_Session* session = SUIT_Session::session();
   SUIT_Application* sapp = session ? session->activeApplication() : 0;
   LightApp_Application* app = dynamic_cast<LightApp_Application*>( sapp );
   if( !app )
     return 0;
 
-  LightApp_Module* m = dynamic_cast<LightApp_Module*>( app ? app->module( mod_name ) : 0 );
+  LightApp_Module* m = dynamic_cast<LightApp_Module*>( app ? app->module( mname ) : 0 );
   bool wasLoaded = false;
   if( !m && load )
   {
-    m = dynamic_cast<LightApp_Module*>( app->loadModule( mod_name, false ) );
-       if( m ) {
+    m = dynamic_cast<LightApp_Module*>( app->loadModule( mname, false ) );
+    if( m ) {
       app->addModule( m );
-         wasLoaded = true;
-       }
+      wasLoaded = true;
+    }
   }
 
   if( m )
   {
     m->connectToStudy( dynamic_cast<CAM_Study*>( app->activeStudy() ) );
-       if( wasLoaded ) 
-               m->updateModuleVisibilityState();
+    if( wasLoaded ) 
+      m->updateModuleVisibilityState();
   }
   return m ? m->displayer() : 0;
 }
index ee0b2e5054fdc602326bba8b919841bf43d62d7f..ceb22eacd40b7de29ea894688cfeeb74c3779c57 100644 (file)
@@ -463,9 +463,9 @@ QtxPopupMgr* LightApp_Module::popupMgr()
     myPopupMgr->insert( eraseAll, -1, 0 );
     myPopupMgr->insert( separator(), -1, 0 );
 
-    QString oneAndNotActive = "( count( $component ) = 1 ) and ( not( activeModule in $component ) )";
+    QString oneAndNotActive = "( count( $component ) = 1 ) and ( not( activeModule in $component ) ) and ( not($displayer={'%3'}) )";
     QString uniform = "true in $canBeDisplayed and %1 and ( activeModule = '%2' )";
-    uniform = uniform.arg( oneAndNotActive ).arg( name() );
+    uniform = uniform.arg( oneAndNotActive ).arg( name() ).arg( LightApp_Application::moduleDisplayer( name() ) );
     myPopupMgr->setRule( disp, /*QString( "( not isVisible ) and " ) + */ uniform, QtxPopupMgr::VisibleRule );
     myPopupMgr->setRule( erase, /*QString( "( isVisible ) and " ) + */ uniform, QtxPopupMgr::VisibleRule );
     myPopupMgr->setRule( dispOnly, uniform, QtxPopupMgr::VisibleRule );
index b5b6ec74316dbbc300264bc62626ec77a682fabe..ec2f910ba992cf891c13b98d669fd9831e258f7c 100644 (file)
@@ -215,8 +215,8 @@ QVariant LightApp_Selection::parameter( const int idx, const QString& p ) const
     QString e = entry( idx );
     if ( !e.isEmpty() ) {
       if ( p == "isVisible" ) {
-       QString mod_name = app->moduleTitle( myStudy->componentDataType( e ) );
-       LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( mod_name, false );
+       QString mname = myStudy->componentDataType( e );
+       LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( mname, false );
        // false in last parameter means that now we doesn't load module, if it isn't loaded
 
        bool vis = false;
@@ -226,15 +226,17 @@ QVariant LightApp_Selection::parameter( const int idx, const QString& p ) const
          vis = LightApp_Displayer().IsDisplayed( e );
        v = vis;
       }
-      else if ( p == "component" || p == "displayer" )
-       v = myStudy->componentDataType( e );
+      else if ( p == "component" )
+        v = myStudy->componentDataType( e );
+      else if ( p == "displayer" )
+        v = LightApp_Application::moduleDisplayer( myStudy->componentDataType( e ) );
       else if ( p == "isComponent" )
        v = myStudy->isComponent( e );
       else if ( p == "isReference" )
        v = isReference( idx );
       else if ( p == "canBeDisplayed" ) {
-       QString mod_name = app->moduleTitle( myStudy->componentDataType( e ) );
-       LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( mod_name, false );
+       QString mname = myStudy->componentDataType( e ) ;
+       LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( mname, false );
        // false in last parameter means that now we doesn't load module, if it isn't loaded
 
        if ( d )
index 3c313941d6345d94be237d2c6d450d43a949d461..a940de8fca5a58e48d25826c9a26ccf00b783c67 100644 (file)
@@ -88,7 +88,7 @@ void LightApp_ShowHideOp::startOperation()
     QStringList::const_iterator anIt = comps.begin(), aLast = comps.end();
     for( ; anIt!=aLast; anIt++ )
     {
-      LightApp_Displayer* disp = LightApp_Displayer::FindDisplayer( app->moduleTitle( *anIt ), false );
+      LightApp_Displayer* disp = LightApp_Displayer::FindDisplayer( *anIt, false );
       if( disp )
         disp->EraseAll( false, false, 0 );
     }
@@ -105,11 +105,11 @@ void LightApp_ShowHideOp::startOperation()
   QString mod_name;
   if( sel->count()>0 )
   {
-    QString aStr =  sel->parameter( 0, "displayer" ).toString();
-    mod_name = app->moduleTitle( aStr );
+    QString aStr = sel->parameter( 0, "displayer" ).toString();
+    mod_name = aStr;
   }
   else if( app->activeModule() )
-    mod_name = app->moduleTitle( app->activeModule()->name() );
+    mod_name = app->activeModule()->name();
 
   LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( mod_name, true );
   if( !d )
index 60f31e8f187d83234cfc88f5d773eae7a5c2e383..2109b4399fe2bd38b916e244025d26ca932f0eb0 100644 (file)
@@ -418,7 +418,7 @@ void SALOMEGUI_Swig::Display( const char* theEntry )
       LightApp_Application* anApp  = getApplication();
       LightApp_Study*       aStudy = getActiveStudy();
       if ( anApp && aStudy ) {
-       QString mname = anApp->moduleTitle( aStudy->componentDataType( myEntry ) );
+       QString mname = aStudy->componentDataType( myEntry );
        LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( mname, true );
        if ( d ) {
          QStringList entries;
@@ -459,11 +459,11 @@ void SALOMEGUI_Swig::DisplayOnly( const char* theEntry )
        QStringList comps;
        aStudy->components( comps );
        foreach( QString comp, comps ) {
-         LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( anApp->moduleTitle( comp ), false );
+         LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( comp, false );
          if ( d ) d->EraseAll( false, false, 0 );
        }
 
-       QString mname = anApp->moduleTitle( aStudy->componentDataType( myEntry ) );
+       QString mname = aStudy->componentDataType( myEntry );
        LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( mname, true );
        if ( d ) {
          QStringList entries;
@@ -500,7 +500,7 @@ void SALOMEGUI_Swig::Erase( const char* theEntry )
       LightApp_Application* anApp  = getApplication();
       LightApp_Study*       aStudy = getActiveStudy();
       if ( anApp && aStudy ) {
-       QString mname = anApp->moduleTitle( aStudy->componentDataType( myEntry ) );
+       QString mname = aStudy->componentDataType( myEntry );
        LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( mname, true );
        if ( d ) {
          QStringList entries;
@@ -538,7 +538,7 @@ void SALOMEGUI_Swig::DisplayAll()
        QStringList comps;
        aStudy->components( comps );
        foreach( QString comp, comps ) {
-         LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( anApp->moduleTitle( comp ), true );
+         LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( comp, true );
          if ( d ) {
            QStringList entries;
            aStudy->children( aStudy->centry( comp ), entries );
@@ -569,7 +569,7 @@ void SALOMEGUI_Swig::EraseAll()
        QStringList comps;
        aStudy->components( comps );
        foreach( QString comp, comps ) {
-         LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( anApp->moduleTitle( comp ), false );
+         LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( comp, false );
          if ( d ) d->EraseAll( false, false, 0 );
        }
       }
index bfb209efa370c4ea8660a88c7c3e3346e2f661ac..ec5f66cc0494b1117cb6cebda192c7eb13e14321 100644 (file)
@@ -813,6 +813,8 @@ void SalomeApp_Application::onOpenWith()
   Handle(SALOME_InteractiveObject) aIObj = aList.First();
   QString aModuleName(aIObj->getComponentDataType());
   QString aModuleTitle = moduleTitle(aModuleName);
+  if (aModuleTitle.isEmpty()) // no gui
+    aModuleTitle = moduleDisplayer(aModuleName);
   activateModule(aModuleTitle);
   QApplication::restoreOverrideCursor();
 }
@@ -1488,9 +1490,14 @@ void SalomeApp_Application::contextMenuPopup( const QString& type, QMenu* thePop
     if ( !entry.startsWith( tr( "SAVE_POINT_DEF_NAME" ) ) ) {
       QString aModuleName( aIObj->getComponentDataType() );
       QString aModuleTitle = moduleTitle( aModuleName );
+      if (aModuleTitle.isEmpty()) {
+        // use displayer module, if given
+        aModuleTitle = moduleDisplayer( aModuleName );
+      }
       CAM_Module* currentModule = activeModule();
-      if ( ( !currentModule || currentModule->moduleName() != aModuleTitle ) && !aModuleTitle.isEmpty() )
+      if ( ( !currentModule || currentModule->moduleName() != aModuleTitle ) && !aModuleTitle.isEmpty() ) {
         thePopup->addAction( tr( "MEN_OPENWITH" ).arg( aModuleTitle ), this, SLOT( onOpenWith() ) );
+      }
     }
   }
 
index c680652323e8e61e629fc0da38948e23930b00cc..633154329a0d3e0979e871c0fdacbe256578d2e8 100644 (file)
@@ -190,17 +190,16 @@ public:
           /* Define visibility state */
           bool isComponent = dynamic_cast<SalomeApp_ModuleObject*>( suit_obj ) != 0;
           if ( suit_obj && !isComponent && myStudy->visibilityState( theID.c_str() ) == Qtx::UnpresentableState ) {
-            QString moduleTitle = ((CAM_Application*)myStudy->application())->moduleTitle(suit_obj->componentDataType());
-            if (!moduleTitle.isEmpty()) {
-              LightApp_Displayer* aDisplayer = LightApp_Displayer::FindDisplayer(moduleTitle,false);
-              if (aDisplayer) {
-                if(aDisplayer->canBeDisplayed(theID.c_str())) {
-                  myStudy->setVisibilityState( theID.c_str(), Qtx::HiddenState ); //hide the just added object
-                  //MESSAGE("Object with entry : "<< theID <<" CAN be displayed !!!");
-                }
-                //else
-                  //MESSAGE("Object with entry : "<< theID <<" CAN'T be displayed !!!");
+            LightApp_Displayer* aDisplayer = LightApp_Displayer::FindDisplayer
+              (suit_obj->componentDataType(),false);
+            if (aDisplayer) {
+              if (aDisplayer->canBeDisplayed(theID.c_str())) {
+                //hide the just added object
+                myStudy->setVisibilityState( theID.c_str(), Qtx::HiddenState );
+                //MESSAGE("Object with entry : "<< theID <<" CAN be displayed !!!");
               }
+              //else
+              //  MESSAGE("Object with entry : "<< theID <<" CAN'T be displayed !!!");
             }
           }
         } // END: work with tree nodes structure
@@ -323,17 +322,15 @@ public:
         /* Define visibility state */
         bool isComponent = dynamic_cast<SalomeApp_ModuleObject*>( suit_obj ) != 0;
         if ( suit_obj && !isComponent ) {
-          QString moduleTitle = ((CAM_Application*)myStudy->application())->moduleTitle(suit_obj->componentDataType());
-          if (!moduleTitle.isEmpty()) {
-            LightApp_Displayer* aDisplayer = LightApp_Displayer::FindDisplayer(moduleTitle,false);
-            if (aDisplayer) {
-              if(aDisplayer->canBeDisplayed(theID.c_str())) {
-                myStudy->setVisibilityState( theID.c_str(), Qtx::HiddenState );
-                //MESSAGE("Object with entry : "<< theID <<" CAN be displayed !!!");
-              }
-              //else
-                //MESSAGE("Object with entry : "<< theID <<" CAN'T be displayed !!!");
+          LightApp_Displayer* aDisplayer = LightApp_Displayer::FindDisplayer
+            (suit_obj->componentDataType(),false);
+          if (aDisplayer) {
+            if (aDisplayer->canBeDisplayed(theID.c_str())) {
+              myStudy->setVisibilityState( theID.c_str(), Qtx::HiddenState );
+              //MESSAGE("Object with entry : "<< theID <<" CAN be displayed !!!");
             }
+            //else
+            //  MESSAGE("Object with entry : "<< theID <<" CAN'T be displayed !!!");
           }
         }
         break;