]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Part of code inserting data model of new loaded module now is described as method...
authorasl <asl@opencascade.com>
Thu, 6 Oct 2005 09:18:36 +0000 (09:18 +0000)
committerasl <asl@opencascade.com>
Thu, 6 Oct 2005 09:18:36 +0000 (09:18 +0000)
src/CAM/CAM_Application.cxx
src/CAM/CAM_Module.cxx
src/CAM/CAM_Module.h

index 4f276dfa8ea1cbc5545d22de1ea07d47b28ae19a..171a2cb1ba6b6cd45c33b4f11c5c755d2a44a1f4 100755 (executable)
@@ -290,20 +290,7 @@ bool CAM_Application::activateModule( CAM_Module* mod )
 
   if ( myModule ){
     // Connect the module to the active study
-    CAM_Study* camStudy = dynamic_cast<CAM_Study*>( activeStudy() );
-    if ( camStudy ){
-      CAM_DataModel* prev = 0;
-      for ( ModuleListIterator it( myModules ); it.current(); ++it ) {
-       CAM_DataModel* dm = it.current()->dataModel();
-       if ( it.current() == myModule && !camStudy->containsDataModel( dm ) ){
-         if ( prev )
-           camStudy->insertDataModel( it.current()->dataModel(), prev );
-         else
-           camStudy->insertDataModel( it.current()->dataModel(), 0 );
-       }
-       prev = dm;
-      }
-    }
+    myModule->connectToStudy( dynamic_cast<CAM_Study*>( activeStudy() ) );
     if ( !myModule->activateModule( activeStudy() ) )
     {
       myModule->setMenuShown( false );
index 46ac007ee1cd62d123514df846cc8fc9562998c8..733afa4dc84998a6fefaaa41ba9168fb716fa639 100755 (executable)
@@ -550,3 +550,25 @@ QAction* CAM_Module::separator()
 {
   return QtxActionMgr::separator();
 }
+
+/*! Connect data model of module with active study */
+void CAM_Module::connectToStudy( CAM_Study* camStudy )
+{
+  CAM_Application* app = camStudy ? dynamic_cast<CAM_Application*>( camStudy->application() ) : 0;
+  if( !app )
+    return;
+
+  CAM_DataModel* prev = 0;
+  for( CAM_Application::ModuleListIterator it = app->modules(); it.current(); ++it )
+  {
+    CAM_DataModel* dm = it.current()->dataModel();
+    if( it.current() == this && !camStudy->containsDataModel( dm ) )
+    {
+      if( prev )
+       camStudy->insertDataModel( it.current()->dataModel(), prev );
+      else
+       camStudy->insertDataModel( it.current()->dataModel(), 0 );
+    }
+    prev = dm;
+  }
+}
index b0fcfc7cd8fd78af8299d05d1b0824ab7d70481e..328d2500a82dc88fcdb9f0ddbc4ec08036aaac13 100755 (executable)
@@ -9,6 +9,7 @@
 
 class QAction;
 class SUIT_Study;
+class CAM_Study;
 class CAM_DataModel;
 class CAM_Application;
 class QtxActionMenuMgr;
@@ -59,6 +60,8 @@ public slots:
   virtual bool           activateModule( SUIT_Study* );
   virtual bool           deactivateModule( SUIT_Study* );
 
+  virtual void           connectToStudy( CAM_Study* );
+
   virtual void           studyClosed( SUIT_Study* );
   virtual void           studyChanged( SUIT_Study*, SUIT_Study* );