Salome HOME
updated copyright message
[modules/gui.git] / src / SalomeApp / SalomeApp_Module.cxx
index 21e27eb0d1811e15a282f22e6e0a4b07f15ccfcc..a5b7b6ba2eed892ffadcd4f3acd879a2038dc980 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2023  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -38,7 +38,6 @@
 //#include "OB_Browser.h"
 
 #include <SALOME_ListIO.hxx>
-#include <SALOME_ListIteratorOfListIO.hxx>
 #include <SALOME_InteractiveObject.hxx>
           
 #include <LightApp_DataObject.h>
@@ -53,8 +52,7 @@
 
 /*!Constructor.*/
 SalomeApp_Module::SalomeApp_Module( const QString& name )
-  : LightApp_Module( name ),
-    myIsFirstActivate( true )
+  : LightApp_Module( name )
 {
 }
 
@@ -119,7 +117,7 @@ void SalomeApp_Module::extractContainers( const SALOME_ListIO& source, SALOME_Li
                     val = valSO->GetName().c_str();
 
             Handle( SALOME_InteractiveObject ) new_obj =
-              new SALOME_InteractiveObject( id.toLatin1(), comp.toLatin1(), val.toLatin1() );
+              new SALOME_InteractiveObject( id.toUtf8(), comp.toLatin1(), val.toLatin1() );
             dest.Append( new_obj );
           }
           anIter->Next();
@@ -137,123 +135,16 @@ void SalomeApp_Module::extractContainers( const SALOME_ListIO& source, SALOME_Li
  * This method is called just before the study document is saved, so the module has a possibility
  * to store visual parameters in AttributeParameter attribut
  */
-void SalomeApp_Module::storeVisualParameters(int savePoint)
+void SalomeApp_Module::storeVisualParameters(int /*savePoint*/)
 {
 }
 
-
-/*!Activate module.*/
-bool SalomeApp_Module::activateModule( SUIT_Study* theStudy )
-{
-  bool state = LightApp_Module::activateModule( theStudy );
-
-  if (!myIsFirstActivate)
-    return state;
-  
-  updateModuleVisibilityState();
-
-  myIsFirstActivate = false;
-  
-  return state;
-}
-
 /*!
  * \brief Virtual public
  *
  * This method is called after the study document is opened, so the module has a possibility to restore
  * visual parameters
  */
-void SalomeApp_Module::restoreVisualParameters(int savePoint)
-{
-}
-
-/*! Redefined to reset internal flags valid for study instance */
-void SalomeApp_Module::studyClosed( SUIT_Study* theStudy )
-{
-  LightApp_Module::studyClosed( theStudy );
-  
-  myIsFirstActivate = true;
-  
-  LightApp_Application* app = dynamic_cast<LightApp_Application*>(application());
-  if (!app)
-    return;
-  
-  SUIT_DataBrowser* ob = app->objectBrowser();
-  if (ob && ob->model())
-    disconnect( ob->model(), SIGNAL( clicked( SUIT_DataObject*, int ) ),
-                this, SLOT( onObjectClicked( SUIT_DataObject*, int ) ) );
-}
-
-
-/*!
- * \brief Virtual public slot
- *
- * This method is called after the object inserted into data view to update their visibility state
- * This is default implementation
- */
-void SalomeApp_Module::onObjectClicked( SUIT_DataObject* theObject, int theColumn )
+void SalomeApp_Module::restoreVisualParameters(int /*savePoint*/)
 {
-  if (!isActiveModule())
-    return;
-  // change visibility of object
-  if (!theObject || theColumn != SUIT_DataObject::VisibilityId )
-    return;
-
-  SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
-  if( !study )
-    return;
-
-  LightApp_DataObject* lo = dynamic_cast<LightApp_DataObject*>(theObject);
-  if(!lo)
-    return;
-  
-  // detect action index (from LightApp level)
-  int id = -1;
-  
-  if ( study->visibilityState(lo->entry()) == Qtx::ShownState )
-    id = myErase;
-  else if ( study->visibilityState(lo->entry()) == Qtx::HiddenState )
-    id = myDisplay;
-  
-  if ( id != -1 )
-    startOperation( id );
-}
-
-
-/*!
-  Called then study closed
-*/
-void SalomeApp_Application::onStudyClosed( SUIT_Study* theStudy){
-  LightApp_Application::onStudyClosed(theStudy);
-
-  disconnect( this, SIGNAL( viewManagerRemoved( SUIT_ViewManager* ) ),
-             this, SLOT( onViewManagerRemoved( SUIT_ViewManager* ) ) );
-}
-
-
-void SalomeApp_Module::updateModuleVisibilityState() {
-
-  // update visibility state of objects
-  SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>(SUIT_Session::session()->activeApplication());
-  if (!app)
-    return;
-  
-  SUIT_DataBrowser* ob = app->objectBrowser();
-  if (!ob || !ob->model())
-    return;
-
-  // connect to click on item
-  connect( ob->model(), SIGNAL( clicked( SUIT_DataObject*, int ) ),
-           this, SLOT( onObjectClicked( SUIT_DataObject*, int ) ), Qt::UniqueConnection );
-
-  SUIT_DataObject* rootObj = ob->root();
-  if( !rootObj )
-    return;
-  
-  DataObjectList listObj = rootObj->children( true );
-  
-  SUIT_ViewModel* vmod = 0;
-  if ( SUIT_ViewManager* vman = app->activeViewManager() )
-    vmod = vman->getViewModel();
-  app->updateVisibilityState( listObj, vmod );
 }