Salome HOME
Preparation of 3.1.0a2 - come back old implementation ForTest_3_1_0a2
authorsmh <smh@opencascade.com>
Tue, 18 Oct 2005 14:23:41 +0000 (14:23 +0000)
committersmh <smh@opencascade.com>
Tue, 18 Oct 2005 14:23:41 +0000 (14:23 +0000)
17 files changed:
adm_local/unix/make_commence.in
bin/VERSION
configure.in.base
src/LIGHTGUI/LIGHTGUI.cxx
src/LIGHTGUI/LIGHTGUI.h
src/LIGHTGUI/LIGHTGUI_DataModel.cxx
src/LIGHTGUI/LIGHTGUI_DataModel.h
src/LIGHTGUI/LIGHTGUI_DataObject.cxx
src/LIGHTGUI/LIGHTGUI_DataObject.h
src/LIGHTGUI/LIGHTGUI_DataOwner.cxx [new file with mode: 0644]
src/LIGHTGUI/LIGHTGUI_DataOwner.h [new file with mode: 0644]
src/LIGHTGUI/LIGHTGUI_OBSelector.cxx [new file with mode: 0644]
src/LIGHTGUI/LIGHTGUI_OBSelector.h [new file with mode: 0644]
src/LIGHTGUI/LIGHTGUI_Selection.cxx
src/LIGHTGUI/LIGHTGUI_Selection.h
src/LIGHTGUI/LIGHT_msg_en.po
src/LIGHTGUI/Makefile.in

index df547fd39e6f68faecb1297dd86a4b745de00cba..4ece646866d03f4d8ff27d73d9349053a58acbbe 100644 (file)
@@ -140,7 +140,7 @@ OMNIORB_CXXFLAGS    = @OMNIORB_CXXFLAGS@
 OMNIORB_IDL         = @OMNIORB_IDL@
 OMNIORB_IDLCXXFLAGS = @OMNIORB_IDLCXXFLAGS@
 OMNIORB_IDLPYFLAGS  = @OMNIORB_IDLPYFLAGS@ -I$(top_srcdir)/idl -I$(top_builddir)/salome/idl \
-       -I$(KERNEL_ROOT_DIR)/idl/salome
+       -I$(KERNEL_ROOT_DIR)/idl/salome -I$(MED_ROOT_DIR)/idl/salome
 
 OMNIORB_IDL_CLN_H   = @OMNIORB_IDL_CLN_H@
 OMNIORB_IDL_CLN_CXX = @OMNIORB_IDL_CLN_CXX@
@@ -158,7 +158,7 @@ CORBA_LIBS        = @CORBA_LIBS@
 CORBA_CXXFLAGS    = @CORBA_CXXFLAGS@
 
 IDLCXXFLAGS = -bcxx @IDLCXXFLAGS@ -I$(top_srcdir)/idl -I$(top_builddir)/idl/salome \
-       -I$(KERNEL_ROOT_DIR)/idl/salome
+       -I$(KERNEL_ROOT_DIR)/idl/salome -I$(MED_ROOT_DIR)/idl/salome
 IDLPYFLAGS  = @IDLPYFLAGS@
 
 IDL = @IDL@
index baa54d96ed8ce0d55fae9e6d67c022c97a908c4b..308e26e16808e089b4240fdd3f0e128f5160909a 100755 (executable)
@@ -1 +1 @@
-THIS IS SAMPLE LIGHT (NO-CORBA-ENGINE) MODULE : VERSION: 0.1
+THIS IS SAMPLE LIGHT (NO-CORBA-ENGINE) MODULE : VERSION: 0.2
index f5e5582598d742fcb970cdb844286529b9ac3b77..20c44775468ac91c6882bcffc1f11a10b80119c1 100644 (file)
@@ -286,6 +286,14 @@ echo
 
 CHECK_HDF5
 
+echo
+echo ---------------------------------------------
+echo testing MED2
+echo ---------------------------------------------
+echo
+
+CHECK_MED2
+
 echo
 echo ---------------------------------------------
 echo Testing OpenCascade
@@ -325,7 +333,7 @@ echo ---------------------------------------------
 echo
 
 echo Configure
-variables="cc_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok omniORB_ok occ_ok doxygen_ok graphviz_ok Kernel_ok SalomeGUI_ok"
+variables="cc_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok med2_ok omniORB_ok occ_ok doxygen_ok graphviz_ok Kernel_ok SalomeGUI_ok"
 
 for var in $variables
 do
index f182850674a00d10bb87d1a038b332ef738307a7..39cdf5a47433c18c861a6523d3f182bc6713da61 100644 (file)
@@ -29,27 +29,22 @@ using namespace std;
 
 #include "LIGHTGUI_Selection.h"
 #include "LIGHTGUI_DataModel.h"
-#include "LightApp_DataOwner.h"
+#include "LIGHTGUI_OBSelector.h"
+#include "LIGHTGUI_DataOwner.h"
 
 #include <SUIT_MessageBox.h>
-#include <LightApp_Application.h>
-#include <LightApp_SelectionMgr.h>
-#include "LightApp_Selection.h"
+#include <SalomeApp_Application.h>
+#include <SalomeApp_SelectionMgr.h>
 
 #include <qinputdialog.h>
 #include <qstringlist.h>
 
-#include <LIGHTGUI_TextPrs.hxx>
-#include <OCCViewer_ViewManager.h>
-#include <SOCC_ViewModel.h>
-#include <SOCC_Prs.h>
-
 //=================================================================================
 // function : LIGHTGUI()
 // purpose  : Constructor : sets the default name for the module
 //=================================================================================
 LIGHTGUI::LIGHTGUI()
-     : LightApp_Module( "LIGHTGUI" )
+     : SalomeApp_Module( "LIGHTGUI" )
 {
 }
 
@@ -59,7 +54,7 @@ LIGHTGUI::LIGHTGUI()
 //=================================================================================
 void LIGHTGUI::initialize ( CAM_Application* app )
 {
-  LightApp_Module::initialize( app );
+  SalomeApp_Module::initialize( app );
 
   QWidget* parent = application()->desktop();
 
@@ -67,8 +62,6 @@ void LIGHTGUI::initialize ( CAM_Application* app )
                 tr( "STB_LOAD_FILE" ), 0, parent, false, this, SLOT( onLoadFile() ) );
   createAction( lgSaveFile, tr( "TOP_SAVE_FILE" ), QIconSet(), tr( "MEN_SAVE_FILE" ),
                 tr( "STB_SAVE_FILE" ), 0, parent, false, this, SLOT( onSaveFile() ) );
-  createAction( lgDisplayLine, tr( "TOP_DISPLAY_LINE" ), QIconSet(), tr( "MEN_DISPLAY_LINE" ),
-                tr( "STB_DISPLAY_LINE" ), 0, parent, false, this, SLOT( onDisplayLine() ) );
   createAction( lgEditLine, tr( "TOP_EDIT_LINE" ), QIconSet(), tr( "MEN_EDIT_LINE" ),
                 tr( "STB_EDIT_LINE" ), 0, parent, false, this, SLOT( onEditLine() ) );
   createAction( lgAddLine,  tr( "TOP_ADD_LINE" ),  QIconSet(), tr( "MEN_ADD_LINE" ),
@@ -84,7 +77,6 @@ void LIGHTGUI::initialize ( CAM_Application* app )
   createMenu( lgSaveFile,  aFileMnu, 10 );
 
   int aLightMnu = createMenu( tr( "MEN_LIGHT" ), -1, -1, 50 );
-  createMenu( lgDisplayLine,  aLightMnu, 10 );
   createMenu( lgEditLine,  aLightMnu, 10 );
   createMenu( lgAddLine,   aLightMnu, 10 );
   createMenu( separator(), aLightMnu, -1, 10 );
@@ -95,9 +87,6 @@ void LIGHTGUI::initialize ( CAM_Application* app )
   int parentId = -1;
   QString rule = "client='ObjectBrowser' and selcount=1 and type='TextLine'";
 
-  popupMgr()->insert ( action( lgDisplayLine ), parentId, 0 );
-  popupMgr()->setRule( action( lgDisplayLine ), rule, true  );
-
   popupMgr()->insert ( action( lgEditLine ), parentId, 0 );
   popupMgr()->setRule( action( lgEditLine ), rule, true  );
 
@@ -116,12 +105,10 @@ void LIGHTGUI::initialize ( CAM_Application* app )
 // function : contextMenuPopup()
 // purpose  : defines context popup menu
 //=================================================================================
-void LIGHTGUI::contextMenuPopup ( const QString& client, QPopupMenu* menu, QString& str)
+void LIGHTGUI::contextMenuPopup ( const QString& client, QPopupMenu* menu, QString& )
 {
-  LIGHTGUI_Selection* sel = new LIGHTGUI_Selection();
-  sel->init( client, getApp()->selectionMgr() );
-  popupMgr()->updatePopup( menu, sel );
-  delete sel;
+  LIGHTGUI_Selection sel ( client, getApp()->selectionMgr() );
+  popupMgr()->updatePopup( menu, &sel );
 }
 
 //=================================================================================
@@ -130,8 +117,18 @@ void LIGHTGUI::contextMenuPopup ( const QString& client, QPopupMenu* menu, QStri
 //=================================================================================
 void LIGHTGUI::windows ( QMap<int, int>& aMap ) const
 {
-  aMap.insert( LightApp_Application::WT_ObjectBrowser, Qt::DockLeft );
-  aMap.insert( LightApp_Application::WT_PyConsole, Qt::DockBottom );
+  aMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::DockLeft );
+  aMap.insert( SalomeApp_Application::WT_PyConsole, Qt::DockBottom );
+}
+
+//=================================================================================
+// function : engineIOR()
+// purpose  : Returns empty string. It means that this module
+//            should use default engine for its persistence.
+//=================================================================================
+QString LIGHTGUI::engineIOR() const
+{
+  return QString( "" );
 }
 
 //=================================================================================
@@ -152,19 +149,17 @@ int LIGHTGUI::selectedLine()
   int aPosition = 0; // bad value
   
   // Look for selected lines
-  LightApp_Application* app = getApp();
-  LightApp_SelectionMgr* mgr = app ? app->selectionMgr() : NULL;
+  SalomeApp_Application* app = getApp();
+  SalomeApp_SelectionMgr* mgr = app ? app->selectionMgr() : NULL;
   if ( mgr ) {
     SUIT_DataOwnerPtrList anOwnersList;
     mgr->selected( anOwnersList );
     
     // Get index of the single selected line
     if ( anOwnersList.size() == 1 ) {
-      const LightApp_DataOwner* owner =
-       dynamic_cast<const LightApp_DataOwner*>( anOwnersList[0].get() );
-      QString anEntry = owner->entry();
-      int anIndex = anEntry.find("_");
-      aPosition = (anEntry.mid(anIndex+1, anEntry.length() - anIndex)).toInt();//lineNb();
+      const LIGHTGUI_DataOwner* owner =
+       dynamic_cast<const LIGHTGUI_DataOwner*>( anOwnersList[0].get() );
+      aPosition = owner->lineNb();
     }
   }
   return aPosition;
@@ -176,11 +171,36 @@ int LIGHTGUI::selectedLine()
 //=================================================================================
 bool LIGHTGUI::activateModule ( SUIT_Study* study )
 {
-  bool isDone = LightApp_Module::activateModule( study );
+  bool isDone = SalomeApp_Module::activateModule( study );
   if ( !isDone ) return false;
 
   setMenuShown( true );
 
+  // enable own ObjectBrowser selector an disable another ones
+  bool isOwnSelector = false;
+  QPtrList<SUIT_Selector> lst;
+  getApp()->selectionMgr()->selectors( lst );
+  for ( QPtrListIterator<SUIT_Selector> it( lst ); it.current(); ++it ) {
+    if ( it.current()->type() == "ObjectBrowser" ) {
+      LIGHTGUI_OBSelector* anOwnSelector = dynamic_cast<LIGHTGUI_OBSelector*>( it.current() );
+      // restore own selector
+      if ( anOwnSelector ) {
+        // enable own
+        anOwnSelector->setEnabled( true );
+       isOwnSelector = true;
+      } 
+      else {
+        // disable other
+        it.current()->setEnabled( false );
+      }
+    }
+  }
+
+  // create own selector, if it was not found in selection manager
+  if ( !isOwnSelector ) {
+    new LIGHTGUI_OBSelector ( getApp()->objectBrowser(), getApp()->selectionMgr() );
+  }
+
   return isDone;
 }
 
@@ -193,7 +213,24 @@ bool LIGHTGUI::deactivateModule ( SUIT_Study* study )
   // hide menus
   setMenuShown( false );
 
-  return LightApp_Module::deactivateModule( study );
+  // disable own ObjectBrowser selector an enable another ones
+  QPtrList<SUIT_Selector> lst;
+  getApp()->selectionMgr()->selectors( lst );
+  for ( QPtrListIterator<SUIT_Selector> it( lst ); it.current(); ++it ) {
+    if ( it.current()->type() == "ObjectBrowser" ) {
+      LIGHTGUI_OBSelector* anOwnSelector = dynamic_cast<LIGHTGUI_OBSelector*>( it.current() );
+      if ( anOwnSelector ) {
+        // disable own selector
+        anOwnSelector->setEnabled( false );
+      } 
+      else {
+        // enable other
+        it.current()->setEnabled( true );
+      }
+    }
+  }
+
+  return SalomeApp_Module::deactivateModule( study );
 }
 
 //=================================================================================
@@ -250,35 +287,6 @@ void LIGHTGUI::onSaveFile()
       }
   }
 }
-//=================================================================================
-// function : onDisplayLine()
-// purpose  : "Display Line" action slot
-//=================================================================================
-void LIGHTGUI::onDisplayLine()
-{
-  OCCViewer_ViewManager* aMgr = (OCCViewer_ViewManager*)getApp()->getViewManager("OCCViewer", true);
-  SOCC_Viewer* aViewer = (SOCC_Viewer*)aMgr->getViewModel();  
-  if ( !aViewer )
-    return;
-
-  LIGHTGUI_DataModel* dm = dynamic_cast<LIGHTGUI_DataModel*>( dataModel() );
-  if ( !dm ) return;
-  int aPosition = selectedLine();
-  QString aLine =  dm->getLineText( aPosition );
-  double aX = 0, aY = 0, aZ = 0;
-  QString aStrId = QString("LIGHTGUI_%1").arg(aPosition);
-
-  Handle(LIGHTGUI_TextPrs) aPrs = new LIGHTGUI_TextPrs( aLine, gp_Pnt( aX, aY, aZ ) );
-  aPrs->SetOwner(new SALOME_InteractiveObject( aStrId, "" ) );
-  SOCC_Prs* prs = dynamic_cast<SOCC_Prs*>( aViewer->CreatePrs() ); // aStringID is an "entry"
-  if ( prs ) {
-    aViewer->EraseAll();
-    prs->AddObject( aPrs );
-    aViewer->Display( prs );
-    aViewer->Repaint();
-    getApp()->updateObjectBrowser();
-  } 
-}
 
 //=================================================================================
 // function : onEditLine()
index b27d4fb0415b3fa509b2529320f0f2be3b9f50cd..1fbbea1b2ca51d7d497b1fbd0f2f5885481331c6 100644 (file)
 #ifndef LIGHTGUI_H
 #define LIGHTGUI_H
 
-#include <LightApp_Module.h>
+#include <SalomeApp_Module.h>
 
-class LIGHTGUI: public LightApp_Module
+class LIGHTGUI: public SalomeApp_Module
 {
   Q_OBJECT
-  enum { lgLoadFile = 931, lgSaveFile, lgDisplayLine, lgEditLine, lgAddLine, lgDelLine, lgClear };
+  enum { lgLoadFile = 931, lgSaveFile, lgEditLine, lgAddLine, lgDelLine, lgClear };
 
 public:
   LIGHTGUI();
@@ -40,6 +40,8 @@ public:
   virtual void           contextMenuPopup ( const QString&, QPopupMenu*, QString& );
   virtual void           windows ( QMap<int, int>& ) const;
 
+  virtual QString        engineIOR() const;
+
 protected:
   virtual CAM_DataModel* createDataModel();
   int                    selectedLine();
@@ -51,14 +53,10 @@ public slots:
 private slots:
   void onLoadFile();
   void onSaveFile();
-  void onDisplayLine();
   void onEditLine();
   void onAddLine ();
   void onDelLine ();
   void onClear   ();
-
-private:
-  int anIndex;
 };
 
 #endif // LIGHTGUI_H
index 8090dcafeedfc1c5970045c04ce4ed5b6bacd521..675fcbe80b77d13f65237e49030c483a465c9389 100644 (file)
 #include "LIGHTGUI_DataModel.h"
 #include "LIGHTGUI_DataObject.h"
 
-#include <LightApp_Study.h>
+#include <SalomeApp_Study.h>
 #include <SUIT_Tools.h>
 #include <SUIT_DataObjectIterator.h>
-#include <CAM_Module.h>
-#include <CAM_Application.h>
 
 #include <qstring.h>
 #include <qfile.h>
 
-#include <vector.h>
-#include <string.h>
-
 //=================================================================================
 // function : LIGHTGUI_DataModel()
 // purpose  : constructor
 //=================================================================================
 LIGHTGUI_DataModel::LIGHTGUI_DataModel ( CAM_Module* theModule )
-     : LightApp_DataModel( theModule ),
+     : SalomeApp_DataModel( theModule ),
        myFileName( "" ),
        myStudyURL( "" )
 {
@@ -63,14 +58,14 @@ LIGHTGUI_DataModel::~LIGHTGUI_DataModel()
 //=================================================================================
 bool LIGHTGUI_DataModel::open ( const QString& theURL, CAM_Study* study )
 {
-  LightApp_Study* aDoc = dynamic_cast<LightApp_Study*>( study );
+  SalomeApp_Study* aDoc = dynamic_cast<SalomeApp_Study*>( study );
   if ( !aDoc )
     return false;
 
-  LightApp_DataModel::open( theURL, aDoc );
+  SalomeApp_DataModel::open( theURL, study );
 
-  // Get list of files, created for this module by LightApp_Engine_i::Load().
-  std::vector<std::string> aListOfFiles = aDoc->GetListOfFiles();
+  // Get list of files, created for this module by SalomeApp_Engine_i::Load().
+  std::vector<std::string> aListOfFiles = GetListOfFiles();
 
   // The first list item contains path to a temporary
   // directory, where the persistent files was placed
@@ -78,18 +73,18 @@ bool LIGHTGUI_DataModel::open ( const QString& theURL, CAM_Study* study )
     QString aTmpDir ( aListOfFiles[0] );
 
     // This module operates with a single persistent file
-  if ( aListOfFiles.size() == 2 ) {
-    myStudyURL = theURL;
-    QString aFileName ( aListOfFiles[1] );
-    QString aFullPath = SUIT_Tools::addSlash( aTmpDir ) + aFileName;
+    if ( aListOfFiles.size() == 2 ) {
+      myStudyURL = theURL;
+      QString aFileName ( aListOfFiles[1] );
+      QString aFullPath = SUIT_Tools::addSlash( aTmpDir ) + aFileName;
 
-    loadFile( aFullPath, aDoc );
-  }
+      loadFile( aFullPath, study );
+    }
 
     // Remove the files and temporary directory, created
-    // for this module by LightApp_Engine_i::Load()
+    // for this module by SalomeApp_Engine_i::Load()
     bool isMultiFile = false; // TODO: decide, how to access this parameter
-    aDoc->RemoveTemporaryFiles( isMultiFile );
+    RemoveTemporaryFiles( isMultiFile );
   }
 
   return true;
@@ -104,11 +99,7 @@ bool LIGHTGUI_DataModel::save()
   // 1. Save data to temporary files
   bool isMultiFile = false; // TODO: decide, how to access this parameter
 
-  LightApp_DataModel::save();
-
-  LightApp_Study* study = dynamic_cast<LightApp_Study*>( module()->application()->activeStudy() );
-
-  QString aTmpDir = study->GetTmpDir( myStudyURL.latin1(), isMultiFile );
+  QString aTmpDir ( SalomeApp_DataModel::GetTmpDir( myStudyURL.latin1(), isMultiFile ) );
   QString aFileName = SUIT_Tools::file( myStudyURL, false ) + "_LIGHTGUI.txt";
   QString aFullPath = aTmpDir + aFileName;
   dumpFile( aFullPath );
@@ -117,7 +108,7 @@ bool LIGHTGUI_DataModel::save()
   std::vector<std::string> aListOfFiles ( 2 );
   aListOfFiles[0] = aTmpDir.latin1();
   aListOfFiles[1] = aFileName.latin1();
-  study->SetListOfFiles( aListOfFiles );
+  SetListOfFiles( aListOfFiles );
 
   return true;
 }
@@ -138,7 +129,6 @@ bool LIGHTGUI_DataModel::saveAs ( const QString& theURL, CAM_Study* )
 //=================================================================================
 bool LIGHTGUI_DataModel::close()
 {
-  LightApp_DataModel::close();
   return true;
 }
 
@@ -174,10 +164,10 @@ bool LIGHTGUI_DataModel::isSaved() const
 // function : update()
 // purpose  : updates data model
 //=================================================================================
-void LIGHTGUI_DataModel::update ( LightApp_DataObject*, LightApp_Study* )
+void LIGHTGUI_DataModel::update ( SalomeApp_DataObject*, SalomeApp_Study* )
 {
   // Nothing to do here: we always keep the data tree in the up-to-date state
-  // The only goal of this method is to hide default behavior from LightApp_DataModel
+  // The only goal of this method is to hide default behavior from SalomApp_DataModel
   return;
 }
 
@@ -404,10 +394,9 @@ void LIGHTGUI_DataModel::buildTree ( SUIT_DataObject* studyRoot, const QStringLi
 {
   if ( !studyRoot )
     return;
-
+  
   LIGHTGUI_ModuleObject* modelRoot = new LIGHTGUI_ModuleObject( this, studyRoot );
-  LIGHTGUI_DataObject* aParaObject;
-  LIGHTGUI_DataObject* aLineObject;
+  CAM_DataObject* aParaObject, aLineObject;
 
   aParaObject = new LIGHTGUI_DataObject ( "", modelRoot );
 
@@ -416,7 +405,7 @@ void LIGHTGUI_DataModel::buildTree ( SUIT_DataObject* studyRoot, const QStringLi
   for ( ; it1 != it2; ++it1 ) {
     if ( (*it1).stripWhiteSpace().isEmpty() ) {
       aParaObject = new LIGHTGUI_DataObject ( *it1, modelRoot );
-    }
+    } 
     else {
       aLineObject = new LIGHTGUI_DataObject ( *it1, aParaObject );
     }
index 40d94ba03ce55a568789bfee919b1fc12da47c14..4cf4c57e83263104d02ed2ce632894ab5b6f6338 100644 (file)
 #pragma once
 #endif // _MSC_VER > 1000
 
-#include <LightApp_DataModel.h>
+#include <SalomeApp_DataModel.h>
 
 class CAM_Module;
-class LightApp_Study;
-class LightApp_DataObject;
+class SalomeApp_Study;
 class LIGHTGUI_DataObject;
 
-class LIGHTGUI_DataModel : public LightApp_DataModel
+class LIGHTGUI_DataModel : public SalomeApp_DataModel
 {
   Q_OBJECT
 
@@ -54,7 +53,7 @@ public:
   virtual bool         isModified () const;
   virtual bool         isSaved    () const;
 
-  virtual void         update ( LightApp_DataObject* = 0, LightApp_Study* = 0 );
+  virtual void         update ( SalomeApp_DataObject* = 0, SalomeApp_Study* = 0 );
 
   bool                 loadFile ( const QString&, CAM_Study* study = 0 );
   bool                 dumpFile ( const QString& = QString::null );
index 434ae5c9be75d0355b51b85a932117049925bd6f..457cbc95a6c07601cda28e50d81083e9203cccc5 100644 (file)
@@ -37,8 +37,7 @@
 // purpose  : default constructor
 //=================================================================================
 LIGHTGUI_DataObject::LIGHTGUI_DataObject ( SUIT_DataObject* parent )
-: LightApp_DataObject( parent ),
-  CAM_DataObject( parent )    
+     : CAM_DataObject( parent )
 {
 }
 
@@ -47,9 +46,8 @@ LIGHTGUI_DataObject::LIGHTGUI_DataObject ( SUIT_DataObject* parent )
 // purpose  : constructor
 //=================================================================================
 LIGHTGUI_DataObject::LIGHTGUI_DataObject ( const QString& line_text, SUIT_DataObject* parent )
-: LightApp_DataObject( parent ),
-  myLineTxt( line_text ),
-  CAM_DataObject( parent)
+     : CAM_DataObject( parent ),
+       myLineTxt( line_text )
 {
 }
 
@@ -61,15 +59,6 @@ LIGHTGUI_DataObject::~LIGHTGUI_DataObject()
 {
 }
 
-/*!Gets object ID.
- *\retval QString
- */
-QString LIGHTGUI_DataObject::entry() const
-{
-  QString aStr = QString("LIGHTGUI_%1").arg(lineNb());
-  return aStr;
-}
-
 //=================================================================================
 // function : name()
 // purpose  : gets an name of the object
@@ -153,9 +142,9 @@ int LIGHTGUI_DataObject::lineNb() const
 // purpose  : one more constructor
 //=================================================================================
 LIGHTGUI_ModuleObject::LIGHTGUI_ModuleObject ( CAM_DataModel* dm, SUIT_DataObject* parent )
-: LIGHTGUI_DataObject( parent ),
-  CAM_RootObject( dm, parent ),
-  CAM_DataObject( parent )
+     : LIGHTGUI_DataObject( parent ),
+       CAM_RootObject( dm, parent ),
+       CAM_DataObject( parent )
 {
 }
 
index 04f5493bbe91cfea84c878407ac2b4f4fc23b75f..0a942e416bfa0d250435916e07f4d2605e6f248a 100644 (file)
 #ifndef LIGHTGUI_DATAOBJECT_H
 #define LIGHTGUI_DATAOBJECT_H
 
-#include <LightApp_DataObject.h>
-#include <LightApp_RootObject.h>
+#include <CAM_DataObject.h>
+#include <CAM_RootObject.h>
 
 #include <qstring.h>
 
 /*!
  * LIGHTGUI_DataObject - LIGHT module's data object class
  */
-class LIGHTGUI_DataObject : public virtual LightApp_DataObject
+class LIGHTGUI_DataObject : public virtual CAM_DataObject
 {
 public:
   LIGHTGUI_DataObject ( SUIT_DataObject* = 0 );
   LIGHTGUI_DataObject ( const QString&, SUIT_DataObject* = 0 );
   virtual ~LIGHTGUI_DataObject();
     
-  virtual QString entry() const;
-
   QString    name()    const;
   QPixmap    icon()    const;
   QString    toolTip() const;
@@ -59,8 +57,8 @@ private:
  * LIGHTGUI_ModuleObject - LIGHT module's root data object class
  */
 
-class LIGHTGUI_ModuleObject :  public LIGHTGUI_DataObject,
-                               public CAM_RootObject
+class LIGHTGUI_ModuleObject : public LIGHTGUI_DataObject,
+                              public CAM_RootObject
 {
 public:
   LIGHTGUI_ModuleObject ( CAM_DataModel*, SUIT_DataObject* = 0 );
diff --git a/src/LIGHTGUI/LIGHTGUI_DataOwner.cxx b/src/LIGHTGUI/LIGHTGUI_DataOwner.cxx
new file mode 100644 (file)
index 0000000..a3df0e7
--- /dev/null
@@ -0,0 +1,64 @@
+//  LIGHT : sample (no-corba-engine) SALOME module
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//  Author : Julia DOROVSKIKH
+//  Date   : 01/01/2005
+//  $Header$
+
+#include "LIGHTGUI_DataOwner.h"
+
+//=================================================================================
+// function : LIGHTGUI_DataOwner()
+// purpose  : constructor
+//=================================================================================
+LIGHTGUI_DataOwner::LIGHTGUI_DataOwner ( const int theLineNb )
+     : myLineNb( theLineNb )
+{
+}
+
+//=================================================================================
+// function : ~LIGHTGUI_DataOwner()
+// purpose  : destructor
+//=================================================================================
+LIGHTGUI_DataOwner::~LIGHTGUI_DataOwner()
+{
+}
+
+//=================================================================================
+// function : isEqual()
+// purpose  : compares two owners
+//=================================================================================
+bool LIGHTGUI_DataOwner::isEqual ( const SUIT_DataOwner& obj ) const
+{
+  const LIGHTGUI_DataOwner* other =
+    dynamic_cast<const LIGHTGUI_DataOwner*>( &obj );
+
+  return other && lineNb() == other->lineNb();
+}
+
+//=================================================================================
+// function : lineNb()
+// purpose  : returns owner id
+//=================================================================================
+int LIGHTGUI_DataOwner::lineNb() const
+{
+  return myLineNb;
+}
diff --git a/src/LIGHTGUI/LIGHTGUI_DataOwner.h b/src/LIGHTGUI/LIGHTGUI_DataOwner.h
new file mode 100644 (file)
index 0000000..e8b3c3b
--- /dev/null
@@ -0,0 +1,44 @@
+//  LIGHT : sample (no-corba-engine) SALOME module
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//  Author : Julia DOROVSKIKH
+//  Date   : 01/01/2005
+//  $Header$
+
+#ifndef LIGHTGUI_DATAOWNER_H
+#define LIGHTGUI_DATAOWNER_H
+
+#include <SUIT_DataOwner.h>
+
+class LIGHTGUI_DataOwner : public SUIT_DataOwner
+{
+public:
+  LIGHTGUI_DataOwner ( const int );
+  virtual ~LIGHTGUI_DataOwner ();
+
+  virtual bool isEqual ( const SUIT_DataOwner& ) const;
+  int          lineNb () const;
+
+private:
+  int myLineNb;
+};
+
+#endif // LIGHTGUI_DATAOWNER_H
diff --git a/src/LIGHTGUI/LIGHTGUI_OBSelector.cxx b/src/LIGHTGUI/LIGHTGUI_OBSelector.cxx
new file mode 100644 (file)
index 0000000..e1e3e11
--- /dev/null
@@ -0,0 +1,125 @@
+//  LIGHT : sample (no-corba-engine) SALOME module
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//  Author : Julia DOROVSKIKH
+//  Date   : 01/01/2005
+//  $Header$
+
+#include "LIGHTGUI_OBSelector.h"
+#include "LIGHTGUI_DataOwner.h"
+#include "LIGHTGUI_DataObject.h"
+
+#include <OB_Browser.h>
+
+#include <SUIT_DataObjectIterator.h>
+
+//=================================================================================
+// function : LIGHTGUI_OBSelector()
+// purpose  : constructor
+//=================================================================================
+LIGHTGUI_OBSelector::LIGHTGUI_OBSelector ( OB_Browser* ob, SUIT_SelectionMgr* mgr )
+     : SUIT_Selector( mgr, ob ),
+       myBrowser( ob )
+{
+  if ( myBrowser ) {
+    connect( myBrowser, SIGNAL( selectionChanged() ), this, SLOT( onSelectionChanged() ) );
+  }    
+}
+
+//=================================================================================
+// function : ~LIGHTGUI_OBSelector()
+// purpose  : destructor
+//=================================================================================
+LIGHTGUI_OBSelector::~LIGHTGUI_OBSelector()
+{
+}
+
+//=================================================================================
+// function : browser()
+// purpose  : gets object browser
+//=================================================================================
+OB_Browser* LIGHTGUI_OBSelector::browser() const
+{
+  return myBrowser;
+}
+
+//=================================================================================
+// function : getSelection()
+// purpose  : gets selection
+//=================================================================================
+void LIGHTGUI_OBSelector::getSelection ( SUIT_DataOwnerPtrList& aList ) const
+{
+  if ( !myBrowser )
+    return;
+
+  DataObjectList objlist;
+  myBrowser->getSelected( objlist );
+  for ( DataObjectListIterator it ( objlist ); it.current(); ++it )
+  {
+    LIGHTGUI_DataObject* obj = dynamic_cast<LIGHTGUI_DataObject*>( it.current() );
+    if ( obj )
+      aList.append( SUIT_DataOwnerPtr( new LIGHTGUI_DataOwner( obj->lineNb() ) ) );
+  }
+}
+
+//=================================================================================
+// function : setSelection()
+// purpose  : sets selection
+//=================================================================================
+void LIGHTGUI_OBSelector::setSelection ( const SUIT_DataOwnerPtrList& aList )
+{
+  if ( !myBrowser )
+    return;
+
+  // Fill map of all data objects
+  QMap<int, LIGHTGUI_DataObject*> aMap;
+
+  SUIT_DataObjectIterator objit ( myBrowser->getRootObject(),
+                                  SUIT_DataObjectIterator::DepthLeft );
+  for ( ; objit.current(); ++objit )
+  {
+    LIGHTGUI_DataObject* obj = dynamic_cast<LIGHTGUI_DataObject*>( objit.current() );
+    if ( obj )
+      aMap.insert( obj->lineNb(), obj );
+  }
+
+  // Fill list with all selected data objects
+  DataObjectList objList;
+  SUIT_DataOwnerPtrList::const_iterator ownit = aList.begin();
+  for ( ; ownit != aList.end(); ++ownit )
+  {
+    const LIGHTGUI_DataOwner* owner =
+      dynamic_cast<const LIGHTGUI_DataOwner*>( (*ownit).get() );
+    if ( owner && aMap.contains( owner->lineNb() ) )
+      objList.append( aMap[owner->lineNb()] );
+  }
+
+  myBrowser->setSelected( objList );
+}
+
+//=================================================================================
+// function : onSelectionChanged()
+// purpose  : called when selection is changed in the Object Browser
+//=================================================================================
+void LIGHTGUI_OBSelector::onSelectionChanged()
+{
+  selectionChanged();
+}
diff --git a/src/LIGHTGUI/LIGHTGUI_OBSelector.h b/src/LIGHTGUI/LIGHTGUI_OBSelector.h
new file mode 100644 (file)
index 0000000..1a0687a
--- /dev/null
@@ -0,0 +1,56 @@
+//  LIGHT : sample (no-corba-engine) SALOME module
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//  Author : Julia DOROVSKIKH
+//  Date   : 01/01/2005
+//  $Header$
+
+#ifndef LIGHTGUI_OBSELECTOR_H
+#define LIGHTGUI_OBSELECTOR_H
+
+#include <SUIT_Selector.h>
+
+class OB_Browser;
+
+class LIGHTGUI_OBSelector : public SUIT_Selector
+{
+  Q_OBJECT
+
+public:
+  LIGHTGUI_OBSelector ( OB_Browser*, SUIT_SelectionMgr* );
+  virtual ~LIGHTGUI_OBSelector ();
+
+  OB_Browser*     browser () const;
+
+  virtual QString type () const { return "ObjectBrowser"; }
+
+private slots:
+  void            onSelectionChanged ();
+
+protected:
+  virtual void    getSelection ( SUIT_DataOwnerPtrList& ) const;
+  virtual void    setSelection ( const SUIT_DataOwnerPtrList& );
+
+private:
+  OB_Browser*     myBrowser;
+};
+
+#endif // LIGHTGUI_OBSELECTOR_H
index ccc8a749b899740b2af1b93539f25ed92a028efc..82db12c09a2f18ac6c1ebc8ac8cce7a1a651dbd3 100644 (file)
 //  $Header$
 
 #include "LIGHTGUI_Selection.h"
-#include "LightApp_DataOwner.h"
+#include "LIGHTGUI_DataOwner.h"
 
-#include <LightApp_SelectionMgr.h>
+#include <SalomeApp_SelectionMgr.h>
 
 //=================================================================================
 // function : LIGHTGUI_Selection()
 // purpose  : constructor
 //=================================================================================
-LIGHTGUI_Selection::LIGHTGUI_Selection ()
-: LightApp_Selection()
+LIGHTGUI_Selection::LIGHTGUI_Selection ( const QString&          client,
+                                        SalomeApp_SelectionMgr* mgr )
 {
-}
-
-//=================================================================================
-// function : ~LIGHTGUI_Selection()
-// purpose  : destructor
-//=================================================================================
-LIGHTGUI_Selection::~LIGHTGUI_Selection()
-{
-}
+  myPopupClient = client;
 
-//=================================================================================
-// function : init()
-// purpose  : initialization
-//=================================================================================
-void LIGHTGUI_Selection::init( const QString& client, LightApp_SelectionMgr* mgr)
-{
   if ( mgr ) {
     SUIT_DataOwnerPtrList sel;
     mgr->selected( sel);
@@ -58,17 +44,21 @@ void LIGHTGUI_Selection::init( const QString& client, LightApp_SelectionMgr* mgr
                                           aLast = sel.end();
     for ( ; anIt != aLast; anIt++ ) {
       SUIT_DataOwner* owner = (SUIT_DataOwner*)( (*anIt).get() );
-      LightApp_DataOwner* sowner = dynamic_cast<LightApp_DataOwner*>( owner );
-      QString anEntry = sowner->entry();
-      int anIndex = anEntry.find("_");
-      int aPosition = (anEntry.mid(anIndex+1, anEntry.length() - anIndex)).toInt();//lineNb();
-      if ( sowner && aPosition > 0 )
+      LIGHTGUI_DataOwner* sowner = dynamic_cast<LIGHTGUI_DataOwner*>( owner );
+      if ( sowner && sowner->lineNb() > 0 )
         myTypes.append( "TextLine" );
       else
         myTypes.append( "Unknown" );
     }
   }
-  LightApp_Selection::init(client, mgr);
+}
+
+//=================================================================================
+// function : ~LIGHTGUI_Selection()
+// purpose  : destructor
+//=================================================================================
+LIGHTGUI_Selection::~LIGHTGUI_Selection()
+{
 }
 
 //=================================================================================
index 2ce070b0f4441ededbfa298c9c9a91169532126d..f28cd78844fa4cef0e7d9ff21b101212ccd65e1a 100644 (file)
 #define LIGHTGUI_SELECTION_H
 
 #include <QtxPopupMgr.h>
-#include <LightApp_Selection.h>
 
-class LightApp_SelectionMgr;
+class SalomeApp_SelectionMgr;
 
-class LIGHTGUI_Selection : public LightApp_Selection
+class LIGHTGUI_Selection : public QtxPopupMgr::Selection
 {
 public:
-  LIGHTGUI_Selection ();
+  LIGHTGUI_Selection ( const QString&, SalomeApp_SelectionMgr* );
   virtual ~LIGHTGUI_Selection ();
 
-  virtual void     init( const QString&, LightApp_SelectionMgr* );
   virtual int      count () const;
   virtual QtxValue param ( const int, const QString& ) const;
 
 private:
+  QString          myPopupClient;
   QStringList      myTypes;
 };
 
index 3ea89c2c22b01202f285a84f4f2590fb76015b7f..f99176a2519a3268ac09bf8138498908af1ad6d0 100644 (file)
@@ -53,14 +53,6 @@ msgstr "Save text file"
 msgid "STB_SAVE_FILE"
 msgstr "Save text file"
 
-msgid "TOP_DISPLAY_LINE"
-msgstr "Display line"
-
-msgid "MEN_DISPLAY_LINE"
-msgstr "Display selected line"
-
-msgid "STB_DISPLAY_LINE"
-msgstr "Display selected line"
 
 msgid "TOP_EDIT_LINE"
 msgstr "Edit line"
index e3e127a2cc097da7a4aa62d44028517a05b79746..66d14b73583a99f3fcaacd1ff08d9518298673da 100644 (file)
@@ -46,21 +46,27 @@ LIB_SRC = \
        LIGHTGUI.cxx            \
        LIGHTGUI_Selection.cxx  \
        LIGHTGUI_DataObject.cxx \
+       LIGHTGUI_DataOwner.cxx  \
        LIGHTGUI_DataModel.cxx  \
-       LIGHTGUI_TextPrs.cxx
+       LIGHTGUI_OBSelector.cxx
 
-LIB_CLIENT_IDL = SALOME_Component.idl
+LIB_CLIENT_IDL = SALOME_Component.idl SALOME_Exception.idl
 # MOC pre-processing
 LIB_MOC =                       \
        LIGHTGUI.h              \
        LIGHTGUI_DataModel.h    \
+       LIGHTGUI_OBSelector.h
 
 # additionnal compilation flags
-CPPFLAGS +=$(PYTHON_INCLUDES) $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) -I${BOOSTDIR} \
+CPPFLAGS += \
+       $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${BOOSTDIR} \
+       -I${KERNEL_ROOT_DIR}/include/salome \
        -I${GUI_ROOT_DIR}/include/salome
 
 # additionnal linkage flags
-LDFLAGS +=$(PYTHON_LIBS) $(QT_MT_LIBS)\
-       -lLightApp -L${GUI_ROOT_DIR}/lib/salome
+LDFLAGS += \
+       -lSalomeApp \
+       -L${KERNEL_ROOT_DIR}/lib/salome \
+       -L${GUI_ROOT_DIR}/lib/salome
 
 @CONCLUDE@