Salome HOME
Using files from package LightApp instead of SalomeApp
authornds <nds@opencascade.com>
Thu, 3 Nov 2005 08:33:50 +0000 (08:33 +0000)
committernds <nds@opencascade.com>
Thu, 3 Nov 2005 08:33:50 +0000 (08:33 +0000)
Remove dependency from KERNEL( from SalomeApp ).

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_Selection.cxx
src/LIGHTGUI/LIGHTGUI_Selection.h
src/LIGHTGUI/LIGHT_msg_en.po
src/LIGHTGUI/Makefile.in

index 39cdf5a47433c18c861a6523d3f182bc6713da61..05aa062c0db89f05f8ca3f7ffe0af4510787bdfa 100644 (file)
@@ -29,22 +29,27 @@ using namespace std;
 
 #include "LIGHTGUI_Selection.h"
 #include "LIGHTGUI_DataModel.h"
-#include "LIGHTGUI_OBSelector.h"
-#include "LIGHTGUI_DataOwner.h"
+#include "LightApp_DataOwner.h"
 
 #include <SUIT_MessageBox.h>
-#include <SalomeApp_Application.h>
-#include <SalomeApp_SelectionMgr.h>
+#include <LightApp_Application.h>
+#include <LightApp_SelectionMgr.h>
+#include "LightApp_Selection.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()
-     : SalomeApp_Module( "LIGHTGUI" )
+     : LightApp_Module( "LIGHTGUI" )
 {
 }
 
@@ -54,12 +59,14 @@ LIGHTGUI::LIGHTGUI()
 //=================================================================================
 void LIGHTGUI::initialize ( CAM_Application* app )
 {
-  SalomeApp_Module::initialize( app );
+  LightApp_Module::initialize( app );
 
   QWidget* parent = application()->desktop();
 
   createAction( lgLoadFile, tr( "TOP_LOAD_FILE" ), QIconSet(), tr( "MEN_LOAD_FILE" ),
                 tr( "STB_LOAD_FILE" ), 0, parent, false, this, SLOT( onLoadFile() ) );
+  createAction( lgDisplayLine, tr( "TOP_DISPLAY_LINE" ), QIconSet(), tr( "MEN_DISPLAY_LINE" ),
+                tr( "STB_DISPLAY_LINE" ), 0, parent, false, this, SLOT( onDisplayLine() ) );
   createAction( lgSaveFile, tr( "TOP_SAVE_FILE" ), QIconSet(), tr( "MEN_SAVE_FILE" ),
                 tr( "STB_SAVE_FILE" ), 0, parent, false, this, SLOT( onSaveFile() ) );
   createAction( lgEditLine, tr( "TOP_EDIT_LINE" ), QIconSet(), tr( "MEN_EDIT_LINE" ),
@@ -77,6 +84,7 @@ 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 );
@@ -87,6 +95,9 @@ 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  );
 
@@ -102,33 +113,34 @@ void LIGHTGUI::initialize ( CAM_Application* app )
 }
 
 //=================================================================================
-// function : contextMenuPopup()
-// purpose  : defines context popup menu
+// function : iconName()
+// purpose  : Module icon name
 //=================================================================================
-void LIGHTGUI::contextMenuPopup ( const QString& client, QPopupMenu* menu, QString& )
+QString LIGHTGUI::iconName() const
 {
-  LIGHTGUI_Selection sel ( client, getApp()->selectionMgr() );
-  popupMgr()->updatePopup( menu, &sel );
+  return QObject::tr( "ICON_LIGHT" );
 }
 
 //=================================================================================
-// function : windows()
-// purpose  : gets a list of compliant dockable GUI elements
+// function : contextMenuPopup()
+// purpose  : defines context popup menu
 //=================================================================================
-void LIGHTGUI::windows ( QMap<int, int>& aMap ) const
+void LIGHTGUI::contextMenuPopup ( const QString& client, QPopupMenu* menu, QString& str)
 {
-  aMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::DockLeft );
-  aMap.insert( SalomeApp_Application::WT_PyConsole, Qt::DockBottom );
+  LIGHTGUI_Selection* sel = new LIGHTGUI_Selection();
+  sel->init( client, getApp()->selectionMgr() );
+  popupMgr()->updatePopup( menu, sel );
+  delete sel;
 }
 
 //=================================================================================
-// function : engineIOR()
-// purpose  : Returns empty string. It means that this module
-//            should use default engine for its persistence.
+// function : windows()
+// purpose  : gets a list of compliant dockable GUI elements
 //=================================================================================
-QString LIGHTGUI::engineIOR() const
+void LIGHTGUI::windows ( QMap<int, int>& aMap ) const
 {
-  return QString( "" );
+  aMap.insert( LightApp_Application::WT_ObjectBrowser, Qt::DockLeft );
+  aMap.insert( LightApp_Application::WT_PyConsole, Qt::DockBottom );
 }
 
 //=================================================================================
@@ -149,17 +161,19 @@ int LIGHTGUI::selectedLine()
   int aPosition = 0; // bad value
   
   // Look for selected lines
-  SalomeApp_Application* app = getApp();
-  SalomeApp_SelectionMgr* mgr = app ? app->selectionMgr() : NULL;
+  LightApp_Application* app = getApp();
+  LightApp_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 LIGHTGUI_DataOwner* owner =
-       dynamic_cast<const LIGHTGUI_DataOwner*>( anOwnersList[0].get() );
-      aPosition = owner->lineNb();
+      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();
     }
   }
   return aPosition;
@@ -171,36 +185,11 @@ int LIGHTGUI::selectedLine()
 //=================================================================================
 bool LIGHTGUI::activateModule ( SUIT_Study* study )
 {
-  bool isDone = SalomeApp_Module::activateModule( study );
+  bool isDone = LightApp_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;
 }
 
@@ -213,24 +202,7 @@ bool LIGHTGUI::deactivateModule ( SUIT_Study* study )
   // hide menus
   setMenuShown( false );
 
-  // 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 );
+  return LightApp_Module::deactivateModule( study );
 }
 
 //=================================================================================
@@ -288,6 +260,35 @@ 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();
+  } 
+}
+
 //=================================================================================
 // function : onEditLine()
 // purpose  : "Edit Line" action slot
index 1fbbea1b2ca51d7d497b1fbd0f2f5885481331c6..dbb39d5d0f244fe809635f6fdd3921f8c9f9aea4 100644 (file)
 #ifndef LIGHTGUI_H
 #define LIGHTGUI_H
 
-#include <SalomeApp_Module.h>
+#include <LightApp_Module.h>
 
-class LIGHTGUI: public SalomeApp_Module
+class LIGHTGUI: public LightApp_Module
 {
   Q_OBJECT
-  enum { lgLoadFile = 931, lgSaveFile, lgEditLine, lgAddLine, lgDelLine, lgClear };
+  enum { lgLoadFile = 931, lgSaveFile, lgDisplayLine, lgEditLine, lgAddLine, lgDelLine, lgClear };
 
 public:
   LIGHTGUI();
 
   virtual void           initialize ( CAM_Application* );
+  virtual QString        iconName() const;
+
   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();
@@ -53,6 +53,7 @@ public slots:
 private slots:
   void onLoadFile();
   void onSaveFile();
+  void onDisplayLine();
   void onEditLine();
   void onAddLine ();
   void onDelLine ();
index 675fcbe80b77d13f65237e49030c483a465c9389..24615657e9ddba708281db6df145b625429a8f2f 100644 (file)
 #include "LIGHTGUI_DataModel.h"
 #include "LIGHTGUI_DataObject.h"
 
-#include <SalomeApp_Study.h>
+#include <LightApp_Study.h>
 #include <SUIT_Tools.h>
 #include <SUIT_DataObjectIterator.h>
+#include <CAM_Module.h>
+#include <CAM_Application.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 )
-     : SalomeApp_DataModel( theModule ),
+     : LightApp_DataModel( theModule ),
        myFileName( "" ),
        myStudyURL( "" )
 {
@@ -56,35 +64,25 @@ LIGHTGUI_DataModel::~LIGHTGUI_DataModel()
 // function : open()
 // purpose  : Open data model operation
 //=================================================================================
-bool LIGHTGUI_DataModel::open ( const QString& theURL, CAM_Study* study )
+bool LIGHTGUI_DataModel::open ( const QString& theURL, CAM_Study* study, QStringList listOfFiles )
 {
-  SalomeApp_Study* aDoc = dynamic_cast<SalomeApp_Study*>( study );
+  LightApp_Study* aDoc = dynamic_cast<LightApp_Study*>( study );
   if ( !aDoc )
     return false;
 
-  SalomeApp_DataModel::open( theURL, study );
-
-  // Get list of files, created for this module by SalomeApp_Engine_i::Load().
-  std::vector<std::string> aListOfFiles = GetListOfFiles();
+  LightApp_DataModel::open( theURL, aDoc, listOfFiles );
 
   // The first list item contains path to a temporary
   // directory, where the persistent files was placed
-  if ( aListOfFiles.size() > 0 ) {
-    QString aTmpDir ( aListOfFiles[0] );
+  if ( listOfFiles.count() > 0 ) {
+    QString aTmpDir ( listOfFiles[0] );
 
     // This module operates with a single persistent file
-    if ( aListOfFiles.size() == 2 ) {
+    if ( listOfFiles.size() == 2 ) {
       myStudyURL = theURL;
-      QString aFileName ( aListOfFiles[1] );
-      QString aFullPath = SUIT_Tools::addSlash( aTmpDir ) + aFileName;
-
-      loadFile( aFullPath, study );
+      QString aFullPath = SUIT_Tools::addSlash( aTmpDir ) + listOfFiles[1];
+      loadFile( aFullPath, aDoc );
     }
-
-    // Remove the files and temporary directory, created
-    // for this module by SalomeApp_Engine_i::Load()
-    bool isMultiFile = false; // TODO: decide, how to access this parameter
-    RemoveTemporaryFiles( isMultiFile );
   }
 
   return true;
@@ -94,21 +92,23 @@ bool LIGHTGUI_DataModel::open ( const QString& theURL, CAM_Study* study )
 // function : save()
 // purpose  : Save data model operation
 //=================================================================================
-bool LIGHTGUI_DataModel::save()
+bool LIGHTGUI_DataModel::save( QStringList& theListOfFiles )
 {
   // 1. Save data to temporary files
   bool isMultiFile = false; // TODO: decide, how to access this parameter
 
-  QString aTmpDir ( SalomeApp_DataModel::GetTmpDir( myStudyURL.latin1(), isMultiFile ) );
+  LightApp_DataModel::save(theListOfFiles);
+
+  LightApp_Study* study = dynamic_cast<LightApp_Study*>( module()->application()->activeStudy() );
+
+  QString aTmpDir = study->GetTmpDir( myStudyURL.latin1(), isMultiFile );
+
   QString aFileName = SUIT_Tools::file( myStudyURL, false ) + "_LIGHTGUI.txt";
   QString aFullPath = aTmpDir + aFileName;
   dumpFile( aFullPath );
 
-  // 2. Set list of temporary files to Engine
-  std::vector<std::string> aListOfFiles ( 2 );
-  aListOfFiles[0] = aTmpDir.latin1();
-  aListOfFiles[1] = aFileName.latin1();
-  SetListOfFiles( aListOfFiles );
+  theListOfFiles.append(aTmpDir);
+  theListOfFiles.append(aFileName);
 
   return true;
 }
@@ -117,10 +117,10 @@ bool LIGHTGUI_DataModel::save()
 // function : saveAs()
 // purpose  : SaveAs data model operation
 //=================================================================================
-bool LIGHTGUI_DataModel::saveAs ( const QString& theURL, CAM_Study* )
+bool LIGHTGUI_DataModel::saveAs ( const QString& theURL, CAM_Study* theStudy, QStringList& theListOfFiles)
 {
   myStudyURL = theURL;
-  return save();
+  return save(theListOfFiles);
 }
 
 //=================================================================================
@@ -129,6 +129,7 @@ bool LIGHTGUI_DataModel::saveAs ( const QString& theURL, CAM_Study* )
 //=================================================================================
 bool LIGHTGUI_DataModel::close()
 {
+  LightApp_DataModel::close();
   return true;
 }
 
@@ -138,7 +139,7 @@ bool LIGHTGUI_DataModel::close()
 //=================================================================================
 bool LIGHTGUI_DataModel::create( CAM_Study* study )
 {
-  buildTree( study->root(), QStringList() );
+  //  buildTree( study->root(), QStringList() );
   return true;
 }
 
@@ -164,10 +165,10 @@ bool LIGHTGUI_DataModel::isSaved() const
 // function : update()
 // purpose  : updates data model
 //=================================================================================
-void LIGHTGUI_DataModel::update ( SalomeApp_DataObject*, SalomeApp_Study* )
+void LIGHTGUI_DataModel::update ( LightApp_DataObject* theObj, LightApp_Study* theStudy )
 {
   // 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 SalomApp_DataModel
+  // The only goal of this method is to hide default behavior from LightApp_DataModel
   return;
 }
 
@@ -193,7 +194,7 @@ bool LIGHTGUI_DataModel::loadFile ( const QString& theFileName, CAM_Study* study
     file.close();
 
     if  ( !study )
-      study = getStudy();
+      study = (CAM_Study*)module()->application()->activeStudy();
     buildTree( study->root(), lines );
 
     return true;
@@ -383,7 +384,11 @@ bool LIGHTGUI_DataModel::deleteTextLine( const int thePosition )
 //=================================================================================
 void LIGHTGUI_DataModel::clearAll()
 {
-  buildTree( getStudy()->root(), QStringList() );
+  LIGHTGUI_DataObject* obj = findObject( 0 );
+  if ( obj ) {
+    CAM_Study* study = (CAM_Study*)module()->application()->activeStudy();
+    buildTree( study->root(), QStringList() );
+  }
 }
 
 //=================================================================================
@@ -394,9 +399,10 @@ void LIGHTGUI_DataModel::buildTree ( SUIT_DataObject* studyRoot, const QStringLi
 {
   if ( !studyRoot )
     return;
-  
+
   LIGHTGUI_ModuleObject* modelRoot = new LIGHTGUI_ModuleObject( this, studyRoot );
-  CAM_DataObject* aParaObject, aLineObject;
+  LIGHTGUI_DataObject* aParaObject;
+  LIGHTGUI_DataObject* aLineObject;
 
   aParaObject = new LIGHTGUI_DataObject ( "", modelRoot );
 
@@ -405,7 +411,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 4cf4c57e83263104d02ed2ce632894ab5b6f6338..410f1cddcae312964a3bb8dd9ec2102b990798a9 100644 (file)
 #pragma once
 #endif // _MSC_VER > 1000
 
-#include <SalomeApp_DataModel.h>
+#include <LightApp_DataModel.h>
 
 class CAM_Module;
-class SalomeApp_Study;
+class LightApp_Study;
+class LightApp_DataObject;
 class LIGHTGUI_DataObject;
 
-class LIGHTGUI_DataModel : public SalomeApp_DataModel
+class LIGHTGUI_DataModel : public LightApp_DataModel
 {
   Q_OBJECT
 
@@ -44,16 +45,16 @@ public:
   LIGHTGUI_DataModel ( CAM_Module* theModule );
   virtual ~LIGHTGUI_DataModel();
 
-  virtual bool         open   ( const QString&, CAM_Study* );
-  virtual bool         save   ();
-  virtual bool         saveAs ( const QString&, CAM_Study* );
+  virtual bool         open   ( const QString&, CAM_Study*, QStringList );
+  virtual bool         save   ( QStringList& );
+  virtual bool         saveAs ( const QString&, CAM_Study*, QStringList& );
   virtual bool         close  ();
   virtual bool         create ( CAM_Study* );
 
   virtual bool         isModified () const;
   virtual bool         isSaved    () const;
 
-  virtual void         update ( SalomeApp_DataObject* = 0, SalomeApp_Study* = 0 );
+  virtual void         update ( LightApp_DataObject* = 0, LightApp_Study* = 0 );
 
   bool                 loadFile ( const QString&, CAM_Study* study = 0 );
   bool                 dumpFile ( const QString& = QString::null );
index 457cbc95a6c07601cda28e50d81083e9203cccc5..5c5f565560973d0ad8a035d7fde6cc507d6f114a 100644 (file)
@@ -27,6 +27,9 @@
 #include <SUIT_Session.h>
 #include <SUIT_ResourceMgr.h>
 
+#include <CAM_DataModel.h>
+#include <CAM_Module.h>
+
 /*!
  *  Class:       LIGHTGUI_DataObject
  *  Description: LIGHT module's data object
@@ -37,7 +40,8 @@
 // purpose  : default constructor
 //=================================================================================
 LIGHTGUI_DataObject::LIGHTGUI_DataObject ( SUIT_DataObject* parent )
-     : CAM_DataObject( parent )
+: LightApp_DataObject( parent ),
+  CAM_DataObject( parent )    
 {
 }
 
@@ -46,8 +50,9 @@ LIGHTGUI_DataObject::LIGHTGUI_DataObject ( SUIT_DataObject* parent )
 // purpose  : constructor
 //=================================================================================
 LIGHTGUI_DataObject::LIGHTGUI_DataObject ( const QString& line_text, SUIT_DataObject* parent )
-     : CAM_DataObject( parent ),
-       myLineTxt( line_text )
+: LightApp_DataObject( parent ),
+  myLineTxt( line_text ),
+  CAM_DataObject( parent)
 {
 }
 
@@ -59,6 +64,16 @@ LIGHTGUI_DataObject::~LIGHTGUI_DataObject()
 {
 }
 
+//=================================================================================
+// function : entry()
+// purpose  : 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
@@ -142,9 +157,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 ),
+  LightApp_ModuleObject(dm, parent),
+  CAM_DataObject( parent )
 {
 }
 
@@ -154,7 +169,7 @@ LIGHTGUI_ModuleObject::LIGHTGUI_ModuleObject ( CAM_DataModel* dm, SUIT_DataObjec
 //=================================================================================
 QString LIGHTGUI_ModuleObject::name() const
 {
-  return QObject::tr( "LIGHT_LIGHT" );
+  return CAM_RootObject::name();
 }
 
 //=================================================================================
@@ -163,7 +178,12 @@ QString LIGHTGUI_ModuleObject::name() const
 //=================================================================================
 QPixmap LIGHTGUI_ModuleObject::icon() const
 {
-  static QPixmap px = SUIT_Session::session()->resourceMgr()->loadPixmap( "LIGHT", QObject::tr( "ICON_LIGHT" ), false );
+  QPixmap px;
+  if (dataModel()) {
+    QString anIconName = dataModel()->module()->iconName();
+    if (!anIconName.isEmpty())
+      px = SUIT_Session::session()->resourceMgr()->loadPixmap( "LIGHT", anIconName, false );
+  }
   return px;
 }
 
index 0a942e416bfa0d250435916e07f4d2605e6f248a..940989bb046a1c58564da175f11d399ae8273ce1 100644 (file)
 #ifndef LIGHTGUI_DATAOBJECT_H
 #define LIGHTGUI_DATAOBJECT_H
 
-#include <CAM_DataObject.h>
-#include <CAM_RootObject.h>
+#include <LightApp_DataObject.h>
+#include <LightApp_RootObject.h>
 
 #include <qstring.h>
 
 /*!
  * LIGHTGUI_DataObject - LIGHT module's data object class
  */
-class LIGHTGUI_DataObject : public virtual CAM_DataObject
+class LIGHTGUI_DataObject : public virtual LightApp_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;
@@ -57,15 +59,15 @@ 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 LightApp_ModuleObject
 {
 public:
   LIGHTGUI_ModuleObject ( CAM_DataModel*, SUIT_DataObject* = 0 );
 
-  QString name()    const;
-  QPixmap icon()    const;
-  QString toolTip() const;
+  virtual QString name()    const;
+  QPixmap         icon()    const;
+  QString         toolTip() const;
 };
 
 #endif // LIGHTGUI_DATAOBJECT_H
index 82db12c09a2f18ac6c1ebc8ac8cce7a1a651dbd3..ccc8a749b899740b2af1b93539f25ed92a028efc 100644 (file)
 //  $Header$
 
 #include "LIGHTGUI_Selection.h"
-#include "LIGHTGUI_DataOwner.h"
+#include "LightApp_DataOwner.h"
 
-#include <SalomeApp_SelectionMgr.h>
+#include <LightApp_SelectionMgr.h>
 
 //=================================================================================
 // function : LIGHTGUI_Selection()
 // purpose  : constructor
 //=================================================================================
-LIGHTGUI_Selection::LIGHTGUI_Selection ( const QString&          client,
-                                        SalomeApp_SelectionMgr* mgr )
+LIGHTGUI_Selection::LIGHTGUI_Selection ()
+: LightApp_Selection()
 {
-  myPopupClient = client;
+}
+
+//=================================================================================
+// function : ~LIGHTGUI_Selection()
+// purpose  : destructor
+//=================================================================================
+LIGHTGUI_Selection::~LIGHTGUI_Selection()
+{
+}
 
+//=================================================================================
+// function : init()
+// purpose  : initialization
+//=================================================================================
+void LIGHTGUI_Selection::init( const QString& client, LightApp_SelectionMgr* mgr)
+{
   if ( mgr ) {
     SUIT_DataOwnerPtrList sel;
     mgr->selected( sel);
@@ -44,21 +58,17 @@ LIGHTGUI_Selection::LIGHTGUI_Selection ( const QString&          client,
                                           aLast = sel.end();
     for ( ; anIt != aLast; anIt++ ) {
       SUIT_DataOwner* owner = (SUIT_DataOwner*)( (*anIt).get() );
-      LIGHTGUI_DataOwner* sowner = dynamic_cast<LIGHTGUI_DataOwner*>( owner );
-      if ( sowner && sowner->lineNb() > 0 )
+      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 )
         myTypes.append( "TextLine" );
       else
         myTypes.append( "Unknown" );
     }
   }
-}
-
-//=================================================================================
-// function : ~LIGHTGUI_Selection()
-// purpose  : destructor
-//=================================================================================
-LIGHTGUI_Selection::~LIGHTGUI_Selection()
-{
+  LightApp_Selection::init(client, mgr);
 }
 
 //=================================================================================
index f28cd78844fa4cef0e7d9ff21b101212ccd65e1a..2ce070b0f4441ededbfa298c9c9a91169532126d 100644 (file)
 #define LIGHTGUI_SELECTION_H
 
 #include <QtxPopupMgr.h>
+#include <LightApp_Selection.h>
 
-class SalomeApp_SelectionMgr;
+class LightApp_SelectionMgr;
 
-class LIGHTGUI_Selection : public QtxPopupMgr::Selection
+class LIGHTGUI_Selection : public LightApp_Selection
 {
 public:
-  LIGHTGUI_Selection ( const QString&, SalomeApp_SelectionMgr* );
+  LIGHTGUI_Selection ();
   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 f99176a2519a3268ac09bf8138498908af1ad6d0..3ea89c2c22b01202f285a84f4f2590fb76015b7f 100644 (file)
@@ -53,6 +53,14 @@ 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 66d14b73583a99f3fcaacd1ff08d9518298673da..bc84ee537f8f430b1883d2eecaaab9628e96c9ee 100644 (file)
@@ -46,27 +46,22 @@ LIB_SRC = \
        LIGHTGUI.cxx            \
        LIGHTGUI_Selection.cxx  \
        LIGHTGUI_DataObject.cxx \
-       LIGHTGUI_DataOwner.cxx  \
        LIGHTGUI_DataModel.cxx  \
-       LIGHTGUI_OBSelector.cxx
+       LIGHTGUI_TextPrs.cxx
 
-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 += \
        $(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 += \
-       -lSalomeApp \
-       -L${KERNEL_ROOT_DIR}/lib/salome \
+       -lLightApp \
        -L${GUI_ROOT_DIR}/lib/salome
 
 @CONCLUDE@