]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
This commit was generated by cvs2git to create branch 'BR-D5-38-2003'.
authoradmin <salome-admin@opencascade.com>
Fri, 12 Aug 2005 11:27:52 +0000 (11:27 +0000)
committeradmin <salome-admin@opencascade.com>
Fri, 12 Aug 2005 11:27:52 +0000 (11:27 +0000)
Cherrypick from master 2005-08-12 11:27:51 UTC apo <apo@opencascade.com> 'To introduce default launch mode of SALOMEDS server':
    src/OBJECT/SALOME_AISShape.hxx
    src/RegistryDisplay/HelpWindow.cxx
    src/RegistryDisplay/IntervalWindow.hxx
    src/RegistryDisplay/RegWidgetFactory.cxx
    src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_SipDefs.h.in
    src/SUPERVGraph/SUPERVGraph.cxx
    src/SVTK/SVTK_CubeAxesActor2D.cxx
    src/SVTK/SVTK_CubeAxesActor2D.h
    src/SVTK/SVTK_Prs.h
    src/SalomeApp/SalomeApp_ImportOperation.cxx
    src/SalomeApp/resources/SalomeApp.xml
    src/Session/InquireServersQThread.cxx
    src/Session/InquireServersQThread.h
    src/Session/SalomeApp_Engine_i.cxx
    src/Session/SalomeApp_Engine_i.hxx
    src/Session/Session_ServerLauncher.hxx
    src/TOOLSGUI/ToolsGUI.cxx
    src/TOOLSGUI/ToolsGUI.h
    src/TOOLSGUI/ToolsGUI_CatalogGeneratorDlg.h
    src/TOOLSGUI/ToolsGUI_HelpWindow.cxx
    src/TOOLSGUI/ToolsGUI_HelpWindow.h
    src/TOOLSGUI/ToolsGUI_IntervalWindow.cxx
    src/TOOLSGUI/ToolsGUI_IntervalWindow.h
    src/TOOLSGUI/ToolsGUI_RegWidget.cxx
    src/TOOLSGUI/ToolsGUI_RegWidget.h
    src/VTKViewer/VTKViewer_Utilities.h

26 files changed:
src/OBJECT/SALOME_AISShape.hxx [new file with mode: 0755]
src/RegistryDisplay/HelpWindow.cxx [new file with mode: 0755]
src/RegistryDisplay/IntervalWindow.hxx [new file with mode: 0755]
src/RegistryDisplay/RegWidgetFactory.cxx [new file with mode: 0755]
src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_SipDefs.h.in [new file with mode: 0644]
src/SUPERVGraph/SUPERVGraph.cxx [new file with mode: 0755]
src/SVTK/SVTK_CubeAxesActor2D.cxx [new file with mode: 0644]
src/SVTK/SVTK_CubeAxesActor2D.h [new file with mode: 0644]
src/SVTK/SVTK_Prs.h [new file with mode: 0644]
src/SalomeApp/SalomeApp_ImportOperation.cxx [new file with mode: 0644]
src/SalomeApp/resources/SalomeApp.xml [new file with mode: 0644]
src/Session/InquireServersQThread.cxx [new file with mode: 0755]
src/Session/InquireServersQThread.h [new file with mode: 0755]
src/Session/SalomeApp_Engine_i.cxx [new file with mode: 0644]
src/Session/SalomeApp_Engine_i.hxx [new file with mode: 0755]
src/Session/Session_ServerLauncher.hxx [new file with mode: 0755]
src/TOOLSGUI/ToolsGUI.cxx [new file with mode: 0755]
src/TOOLSGUI/ToolsGUI.h [new file with mode: 0755]
src/TOOLSGUI/ToolsGUI_CatalogGeneratorDlg.h [new file with mode: 0755]
src/TOOLSGUI/ToolsGUI_HelpWindow.cxx [new file with mode: 0755]
src/TOOLSGUI/ToolsGUI_HelpWindow.h [new file with mode: 0755]
src/TOOLSGUI/ToolsGUI_IntervalWindow.cxx [new file with mode: 0755]
src/TOOLSGUI/ToolsGUI_IntervalWindow.h [new file with mode: 0755]
src/TOOLSGUI/ToolsGUI_RegWidget.cxx [new file with mode: 0755]
src/TOOLSGUI/ToolsGUI_RegWidget.h [new file with mode: 0755]
src/VTKViewer/VTKViewer_Utilities.h [new file with mode: 0755]

diff --git a/src/OBJECT/SALOME_AISShape.hxx b/src/OBJECT/SALOME_AISShape.hxx
new file mode 100755 (executable)
index 0000000..f12700b
--- /dev/null
@@ -0,0 +1,122 @@
+//  SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
+//
+//  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 
+//
+//
+//
+//  File   : SALOME_AISShape.hxx
+//  Module : SALOME
+
+#ifndef _SALOME_AISShape_HeaderFile
+#define _SALOME_AISShape_HeaderFile
+
+#ifndef _Standard_HeaderFile
+#include <Standard.hxx>
+#endif
+#ifndef _Handle_SALOME_AISShape_HeaderFile
+#include <Handle_SALOME_AISShape.hxx>
+#endif
+
+#ifndef _Standard_CString_HeaderFile
+#include <Standard_CString.hxx>
+#endif
+#ifndef _Handle_SALOME_InteractiveObject_HeaderFile
+#include <Handle_SALOME_InteractiveObject.hxx>
+#endif
+#ifndef _AIS_Shape_HeaderFile
+#include <AIS_Shape.hxx>
+#endif
+#ifndef _Standard_Boolean_HeaderFile
+#include <Standard_Boolean.hxx>
+#endif
+class SALOME_InteractiveObject;
+class TopoDS_Shape;
+class TColStd_IndexedMapOfInteger;
+
+
+class SALOME_AISShape : public AIS_Shape {
+
+public:
+
+    inline void* operator new(size_t,void* anAddress) 
+      {
+        return anAddress;
+      }
+    inline void* operator new(size_t size) 
+      { 
+        return Standard::Allocate(size); 
+      }
+    inline void  operator delete(void *anAddress) 
+      { 
+        if (anAddress) Standard::Free((Standard_Address&)anAddress); 
+      }
+//    inline void  operator delete(void *anAddress, size_t size) 
+//      { 
+//        if (anAddress) Standard::Free((Standard_Address&)anAddress,size); 
+//      }
+ // Methods PUBLIC
+ // 
+Standard_EXPORT SALOME_AISShape(const TopoDS_Shape& shape);
+Standard_EXPORT virtual  Handle_SALOME_InteractiveObject getIO() = 0;
+Standard_EXPORT virtual  Standard_Boolean hasIO() = 0;
+Standard_EXPORT virtual  Standard_CString getName() = 0;
+Standard_EXPORT virtual  void setName(const Standard_CString aName) = 0;
+Standard_EXPORT virtual  void highlightSubShapes(const TColStd_IndexedMapOfInteger& aIndexMap, const Standard_Boolean aHighlight ) = 0;
+Standard_EXPORT ~SALOME_AISShape();
+
+
+
+
+ // Type management
+ //
+ Standard_EXPORT friend Handle_Standard_Type& SALOME_AISShape_Type_();
+ Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
+ Standard_EXPORT Standard_Boolean             IsKind(const Handle(Standard_Type)&) const;
+
+protected:
+
+ // Methods PROTECTED
+ // 
+
+
+ // Fields PROTECTED
+ //
+
+private: 
+
+ // Methods PRIVATE
+ // 
+
+
+ // Fields PRIVATE
+ //
+
+
+};
+
+
+
+
+
+// other inline functions and methods (like "C++: function call" methods)
+//
+
+
+#endif
diff --git a/src/RegistryDisplay/HelpWindow.cxx b/src/RegistryDisplay/HelpWindow.cxx
new file mode 100755 (executable)
index 0000000..a75b6d4
--- /dev/null
@@ -0,0 +1,102 @@
+//  SALOME RegistryDisplay : GUI for Registry server implementation
+//
+//  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 
+//
+//
+//
+//  File   : HelpWindow.cxx
+//  Author : Pascale NOYRET, EDF
+//  Module : SALOME
+//  $Header$
+
+# include "HelpWindow.hxx"
+# include "utilities.h"
+
+# include <qtextview.h>
+# include <qpushbutton.h>
+# include <qtextstream.h> 
+# include <qfile.h> 
+
+using namespace std;
+
+HelpWindow::HelpWindow(QWidget* parent, const char* name ) 
+     : QMainWindow( parent, name, WType_TopLevel | WDestructiveClose )
+{
+  BEGIN_OF("Constructeur HelpWindow");
+  
+  setCaption( tr( "Help" ) );
+
+  myTextView = new QTextView( this, "myTextView" );
+  QPalette pal = myTextView->palette();
+  QColorGroup cg = pal.active();
+  cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) );
+  cg.setColor( QColorGroup::HighlightedText, Qt::white );
+  cg.setColor( QColorGroup::Base, QColor( 255,255,220 )  ); 
+  cg.setColor( QColorGroup::Text, Qt::black );
+  pal.setActive  ( cg );
+  cg = pal.inactive();
+  cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) );
+  cg.setColor( QColorGroup::HighlightedText, Qt::white );
+  cg.setColor( QColorGroup::Base, QColor( 255,255,220 )  ); 
+  cg.setColor( QColorGroup::Text, Qt::black );
+  pal.setInactive( cg );
+  cg = pal.disabled();
+  cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) );
+  cg.setColor( QColorGroup::HighlightedText, Qt::white );
+  cg.setColor( QColorGroup::Base, QColor( 255,255,220 )  ); 
+  cg.setColor( QColorGroup::Text, Qt::black );
+  pal.setDisabled( cg );
+  myTextView->setPalette( pal );
+  
+  setCentralWidget( myTextView );
+  setMinimumSize( 450, 250 );
+
+  QFile f ( "tmp.txt" );
+  if ( f.open( IO_ReadOnly ) )   
+    {
+      QTextStream t( &f ); 
+      while ( !t.eof() ) 
+       {
+         myTextView->append(t.readLine());
+       }
+    }
+  f.close();
+
+  END_OF("Constructeur HelpWindow");
+}
+
+/*!
+  Destructor
+*/
+HelpWindow::~HelpWindow()
+{
+  BEGIN_OF("Destructeur HelpWindow");
+  END_OF("Destructeur HelpWindow");
+};
+
+/*!
+  Sets text
+*/
+void HelpWindow::setText( const QString& text )
+{
+  myTextView->setText( text );
+}
+
+
diff --git a/src/RegistryDisplay/IntervalWindow.hxx b/src/RegistryDisplay/IntervalWindow.hxx
new file mode 100755 (executable)
index 0000000..42a03c2
--- /dev/null
@@ -0,0 +1,41 @@
+//  SALOME RegistryDisplay : GUI for Registry server implementation
+//
+//  Copyright (C) 2003  CEA/DEN, EDF R&D
+//
+//
+//
+//  File   : IntervalWindow.hxx
+//  Author : Oksana TCHEBANOVA
+//  Module : SALOME
+
+#ifndef IntervalWindow_HeaderFile
+#define IntervalWindow_HeaderFile
+
+# include <qwidget.h>
+# include <qdialog.h>
+# include <qpushbutton.h>
+# include <qspinbox.h>
+
+#ifndef WNT
+using namespace std;
+#endif
+
+class IntervalWindow : public QDialog
+{
+public:
+  IntervalWindow( QWidget* parent = 0 );
+  ~IntervalWindow();
+  
+  QPushButton* Ok();
+  QPushButton* Cancel();
+
+  int getValue();
+  void setValue( int );
+
+private:
+  QSpinBox* mySpinBox;
+  QPushButton* myButtonOk;
+  QPushButton* myButtonCancel;
+};
+
+#endif
diff --git a/src/RegistryDisplay/RegWidgetFactory.cxx b/src/RegistryDisplay/RegWidgetFactory.cxx
new file mode 100755 (executable)
index 0000000..e52b4bd
--- /dev/null
@@ -0,0 +1,48 @@
+//  SALOME RegistryDisplay : GUI for Registry server implementation
+//
+//  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 
+//
+//
+//
+//  File   : RegWidgetFactory.cxx
+//  Author : Pascale NOYRET, EDF
+//  Module : SALOME
+//  $Header$
+
+# include "RegWidget.h"
+# include "utilities.h"
+
+using namespace std;
+
+extern "C"
+{
+
+void OnGUIEvent( CORBA::ORB_var &orb, QWidget *parent, const char *name )
+{
+  // N.B. parent can be 0
+ RegWidget* ptrRegWidget = RegWidget::GetRegWidget( orb, parent, name );
+ //ASSERT ( !ptrRegWidget );
+ ptrRegWidget->show();
+ ptrRegWidget->raise();
+ ptrRegWidget->setActiveWindow();
+ return;
+}
+
+}
diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_SipDefs.h.in b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_SipDefs.h.in
new file mode 100644 (file)
index 0000000..2a427ce
--- /dev/null
@@ -0,0 +1 @@
+#define SIP_VERS_@SIP_VERS@
diff --git a/src/SUPERVGraph/SUPERVGraph.cxx b/src/SUPERVGraph/SUPERVGraph.cxx
new file mode 100755 (executable)
index 0000000..2b8f3d8
--- /dev/null
@@ -0,0 +1,45 @@
+//  SALOME SUPERVGraph : build Supervisor viewer into desktop
+//
+//  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 
+//
+//
+//
+//  File   : SUPERVGraph.cxx
+//  Author : Nicolas REJNERI
+//  Module : SALOME
+//  $Header$
+
+#include "SUPERVGraph.h"
+#include "SUPERVGraph_ViewFrame.h"
+
+using namespace std;
+
+SUIT_ViewWindow* SUPERVGraph::createView(SUIT_Desktop* parent)
+{
+  return new SUPERVGraph_ViewFrame( parent/*, "vtkView"*/ ); 
+}
+
+extern "C"
+{
+  SUIT_ViewWindow* createView(SUIT_Desktop* parent)
+  {
+    return SUPERVGraph::createView(parent);
+  }
+}
diff --git a/src/SVTK/SVTK_CubeAxesActor2D.cxx b/src/SVTK/SVTK_CubeAxesActor2D.cxx
new file mode 100644 (file)
index 0000000..3fdcf72
--- /dev/null
@@ -0,0 +1,668 @@
+//  SALOME OBJECT : kernel of SALOME component
+//
+//  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 
+//
+//
+//
+//  File   : SVTK_CubeAxesActor2D.cxx
+//  Author : Eugeny Nikolaev
+//  Module : SALOME
+//  $Header$
+
+#include "SVTK_CubeAxesActor2D.h"
+#include "VTKViewer_Transform.h"
+
+#include <vtkPolyDataMapper.h>
+#include <vtkRectilinearGridGeometryFilter.h>
+#include <vtkActor.h>
+#include <vtkCubeAxesActor2D.h>
+#include <vtkAxisActor2D.h>
+#include <vtkCamera.h>
+#include <vtkDataSet.h>
+#include <vtkMath.h>
+#include <vtkObjectFactory.h>
+#include <vtkTextProperty.h>
+#include <vtkViewport.h>
+#include <vtkFloatArray.h>
+#include <vtkRectilinearGrid.h>
+#include <vtkProperty.h>
+#include <vtkProperty2D.h>
+
+vtkCxxRevisionMacro(SVTK_CubeAxesActor2D, "$Revision$");
+vtkStandardNewMacro(SVTK_CubeAxesActor2D);
+
+//----------------------------------------------------------------------------
+// Instantiate this object.
+SVTK_CubeAxesActor2D::SVTK_CubeAxesActor2D()
+{
+  this->wireActorXY = vtkActor::New();
+  this->wireActorYZ = vtkActor::New();
+  this->wireActorXZ = vtkActor::New();
+
+  this->planeXY = vtkRectilinearGridGeometryFilter::New();
+  this->planeYZ = vtkRectilinearGridGeometryFilter::New();
+  this->planeXZ = vtkRectilinearGridGeometryFilter::New();
+
+  this->rgridMapperXY = vtkPolyDataMapper::New();
+  this->rgridMapperYZ = vtkPolyDataMapper::New();
+  this->rgridMapperXZ = vtkPolyDataMapper::New();
+
+  this->rgridMapperXY->SetInput(this->planeXY->GetOutput());
+  this->rgridMapperYZ->SetInput(this->planeYZ->GetOutput());
+  this->rgridMapperXZ->SetInput(this->planeXZ->GetOutput());
+
+  this->wireActorXY->SetMapper(rgridMapperXY);
+  this->wireActorYZ->SetMapper(rgridMapperYZ);
+  this->wireActorXZ->SetMapper(rgridMapperXZ);
+
+  this->wireActorXY->GetProperty()->SetRepresentationToWireframe();
+  this->wireActorYZ->GetProperty()->SetRepresentationToWireframe();
+  this->wireActorXZ->GetProperty()->SetRepresentationToWireframe();
+
+  // setting ambient to 1 (if no - incorrect reaction on light)
+  this->wireActorXY->GetProperty()->SetAmbient(1);
+  this->wireActorYZ->GetProperty()->SetAmbient(1);
+  this->wireActorXZ->GetProperty()->SetAmbient(1);
+
+  this->XAxis->SetTitle(this->XLabel);
+  this->YAxis->SetTitle(this->YLabel);
+  this->ZAxis->SetTitle(this->ZLabel);
+  
+  this->XAxis->SetNumberOfLabels(this->NumberOfLabels);
+  this->YAxis->SetNumberOfLabels(this->NumberOfLabels);
+  this->ZAxis->SetNumberOfLabels(this->NumberOfLabels);
+  this->XAxis->SetLabelFormat(this->LabelFormat);
+  this->YAxis->SetLabelFormat(this->LabelFormat);
+  this->ZAxis->SetLabelFormat(this->LabelFormat);
+  
+  this->XAxis->SetFontFactor(this->FontFactor);
+  this->YAxis->SetFontFactor(this->FontFactor);
+  this->ZAxis->SetFontFactor(this->FontFactor);
+  
+  this->XAxis->SetProperty(this->GetProperty());
+  this->YAxis->SetProperty(this->GetProperty());
+  this->ZAxis->SetProperty(this->GetProperty());
+
+  vtkTextProperty* aTLProp = vtkTextProperty::New();
+  aTLProp->SetBold(0);
+  aTLProp->SetItalic(0);
+  aTLProp->SetShadow(0);
+  aTLProp->SetFontFamilyToArial();
+  aTLProp->SetColor(1,0,0);
+  if (this->XAxis->GetLabelTextProperty())
+    this->XAxis->GetLabelTextProperty()->ShallowCopy(aTLProp);
+  aTLProp->SetColor(0,1,0);
+  if (this->YAxis->GetLabelTextProperty())
+    this->YAxis->GetLabelTextProperty()->ShallowCopy(aTLProp);
+  aTLProp->SetColor(0,0,1);
+  if (this->ZAxis->GetLabelTextProperty())
+    this->ZAxis->GetLabelTextProperty()->ShallowCopy(aTLProp);;
+
+  aTLProp->SetColor(1,0,0);
+  if (this->XAxis->GetLabelTextProperty())
+    this->XAxis->GetTitleTextProperty()->ShallowCopy(aTLProp);
+  aTLProp->SetColor(0,1,0);
+  if (this->YAxis->GetLabelTextProperty())
+    this->YAxis->GetTitleTextProperty()->ShallowCopy(aTLProp);
+  aTLProp->SetColor(0,0,1);
+  if (this->ZAxis->GetLabelTextProperty())
+    this->ZAxis->GetTitleTextProperty()->ShallowCopy(aTLProp);
+  
+  aTLProp->Delete();
+  
+}
+
+//----------------------------------------------------------------------------
+SVTK_CubeAxesActor2D::~SVTK_CubeAxesActor2D()
+{
+  this->wireActorXY->Delete();
+  this->wireActorYZ->Delete();
+  this->wireActorXZ->Delete();
+
+  this->planeXY->Delete();
+  this->planeYZ->Delete();
+  this->planeXZ->Delete();
+
+  this->rgridMapperXY->Delete();
+  this->rgridMapperYZ->Delete();
+  this->rgridMapperXZ->Delete();
+}
+
+//----------------------------------------------------------------------------
+// Static variable describes connections in cube.
+static int Conn[8][3] = {{1,2,4}, {0,3,5}, {3,0,6}, {2,1,7},
+                         {5,6,0}, {4,7,1}, {7,4,2}, {6,5,3}};
+
+//----------------------------------------------------------------------------
+// Project the bounding box and compute edges on the border of the bounding
+// cube. Determine which parts of the edges are visible via intersection 
+// with the boundary of the viewport (minus borders).
+int SVTK_CubeAxesActor2D::RenderOverlay(vtkViewport *viewport)
+{
+  int renderedSomething=0;
+
+  // Initialization
+  if ( ! this->RenderSomething )
+    {
+    return 0;
+    }
+  
+  //Render the axes
+  if ( this->XAxisVisibility )
+    {
+    renderedSomething += this->XAxis->RenderOverlay(viewport);
+    }
+  if ( this->YAxisVisibility )
+    {
+    renderedSomething += this->YAxis->RenderOverlay(viewport);
+    }
+  if ( this->ZAxisVisibility )
+    {
+    renderedSomething += this->ZAxis->RenderOverlay(viewport);
+    }
+  
+  bool RX=false,RY=false;
+  if (this->XAxisVisibility){
+    this->wireActorXY->RenderOverlay(viewport);
+    this->wireActorXZ->RenderOverlay(viewport);
+    RX = true;
+  }
+  if (this->YAxisVisibility){
+    if(!RX) this->wireActorXY->RenderOverlay(viewport);
+    this->wireActorYZ->RenderOverlay(viewport);
+    RY = true;
+  }
+  if (this->ZAxisVisibility){
+    if(!RX) this->wireActorXZ->RenderOverlay(viewport);
+    if(!RY) this->wireActorYZ->RenderOverlay(viewport);
+  }
+
+  return renderedSomething;
+}
+
+static void ChangeValues(float* aArray1,float* aArray2,float *aRange1,float* aRange2,bool theY){
+  float tmp=-1000;
+  if (!theY){
+    for (int i=0; i<4; i++){
+      tmp = aArray1[i]; aArray1[i] = aArray2[i]; aArray2[i] = tmp;
+    }
+#ifndef WNT
+    for(int i=0;i<2; i++){
+#else
+    for(i=0;i<2; i++){
+#endif
+      tmp = aRange1[i]; aRange1[i] = aRange2[i]; aRange2[i] = tmp;
+    }
+  }
+  else{
+    tmp = aArray1[2]; aArray1[2] = aArray2[0]; aArray2[0] = tmp;
+    tmp = aArray1[3]; aArray1[3] = aArray2[1]; aArray2[1] = tmp;
+    tmp = aArray1[0]; aArray1[0] = aArray2[2]; aArray2[2] = tmp;
+    tmp = aArray1[1]; aArray1[1] = aArray2[3]; aArray2[3] = tmp;
+
+    tmp = aRange1[0]; aRange1[0] = aRange2[1]; aRange2[1] = tmp;
+    tmp = aRange1[1]; aRange1[1] = aRange2[0]; aRange2[0] = tmp;
+  }
+}
+
+static void ChangeArrays(float* xCoords,float* yCoords,float* zCoords,
+                        float* xRange,float* yRange,float* zRange,
+                        const int xAxes,const int yAxes, const int zAxes)
+{
+  if ( xAxes == 0 && yAxes == 2 && zAxes == 1)
+    ChangeValues(yCoords,zCoords,yRange,zRange,true);
+  else if (xAxes == 1 && yAxes == 0 && zAxes == 2)
+    ChangeValues(xCoords,yCoords,xRange,yRange,true);
+  else if (xAxes == 1 && yAxes == 2 && zAxes == 0){
+    ChangeValues(xCoords,zCoords,xRange,zRange,false);
+    // xAxes == 0 && yAxes == 2 && zAxes == 1
+    ChangeValues(yCoords,zCoords,yRange,zRange,true);
+  } else if (xAxes == 2 && yAxes == 0 && zAxes == 1){
+    ChangeValues(xCoords,yCoords,xRange,yRange,true);
+    // xAxes == 0 && yAxes == 2 && zAxes == 1
+    ChangeValues(zCoords,yCoords,zRange,yRange,true);
+  } else if (xAxes == 2 && yAxes == 1 && zAxes == 0)
+    ChangeValues(zCoords,xCoords,zRange,xRange,false);
+}
+
+//----------------------------------------------------------------------------
+// Project the bounding box and compute edges on the border of the bounding
+// cube. Determine which parts of the edges are visible via intersection 
+// with the boundary of the viewport (minus borders).
+int SVTK_CubeAxesActor2D::RenderOpaqueGeometry(vtkViewport *viewport)
+{
+  float bounds[6], slope = 0.0, minSlope, num, den;
+  float pts[8][3], d2, d2Min, min;
+  int i, idx = 0;
+  int xIdx, yIdx = 0, zIdx = 0, zIdx2, renderedSomething=0;
+  int xAxes = 0, yAxes, zAxes;
+
+  // Initialization
+  if ( !this->Camera )
+    {
+    vtkErrorMacro(<<"No camera!");
+    this->RenderSomething = 0;
+    return 0;
+    }
+  
+  this->RenderSomething = 1;
+
+  // determine the bounds to use
+  this->GetBounds(bounds);
+
+  // Build the axes (almost always needed so we don't check mtime)
+  // Transform all points into display coordinates
+  this->TransformBounds(viewport, bounds, pts);
+
+  // Find the portion of the bounding box that fits within the viewport,
+  if ( this->ClipBounds(viewport, pts, bounds) == 0 )
+    {
+    this->RenderSomething = 0;
+    return 0;
+    }
+
+  // Take into account the inertia. Process only so often.
+  if ( this->RenderCount++ == 0 || !(this->RenderCount % this->Inertia) )
+    {
+    // Okay, we have a bounding box, maybe clipped and scaled, that is visible.
+    // We setup the axes depending on the fly mode.
+    if ( this->FlyMode == VTK_FLY_CLOSEST_TRIAD )
+      {
+      // Loop over points and find the closest point to the camera
+      min = VTK_LARGE_FLOAT;
+      for (i=0; i < 8; i++)
+        {
+        if ( pts[i][2] < min )
+          {
+          idx = i;
+          min = pts[i][2];
+          }
+        }
+
+      // Setup the three axes to be drawn
+      xAxes = 0;
+      xIdx = Conn[idx][0];
+      yAxes = 1;
+      yIdx = Conn[idx][1];
+      zAxes = 2;
+      zIdx = idx;
+      zIdx2 = Conn[idx][2];
+      }
+    else
+      {
+      float e1[2], e2[2], e3[2];
+
+      // Find distance to origin
+      d2Min = VTK_LARGE_FLOAT;
+      for (i=0; i < 8; i++)
+        {
+        d2 = pts[i][0]*pts[i][0] + pts[i][1]*pts[i][1];
+        if ( d2 < d2Min )
+          {
+          d2Min = d2;
+          idx = i;
+          }
+        }
+
+      // find minimum slope point connected to closest point and on 
+      // right side (in projected coordinates). This is the first edge.
+      minSlope = VTK_LARGE_FLOAT;
+      for (xIdx=0, i=0; i<3; i++)
+        {
+        num = (pts[Conn[idx][i]][1] - pts[idx][1]);
+        den = (pts[Conn[idx][i]][0] - pts[idx][0]);
+        if ( den != 0.0 )
+          {
+          slope = num / den;
+          }
+        if ( slope < minSlope && den > 0 )
+          {
+          xIdx = Conn[idx][i];
+          yIdx = Conn[idx][(i+1)%3];
+          zIdx = Conn[idx][(i+2)%3];
+          xAxes = i;
+          minSlope = slope;
+          }
+        }
+
+      // find edge (connected to closest point) on opposite side
+      for ( i=0; i<2; i++)
+        {
+        e1[i] = (pts[xIdx][i] - pts[idx][i]);
+        e2[i] = (pts[yIdx][i] - pts[idx][i]);
+        e3[i] = (pts[zIdx][i] - pts[idx][i]);
+        }
+      vtkMath::Normalize2D(e1);
+      vtkMath::Normalize2D(e2);
+      vtkMath::Normalize2D(e3);
+
+      if ( vtkMath::Dot2D(e1,e2) < vtkMath::Dot2D(e1,e3) )
+        {
+        yAxes = (xAxes + 1) % 3;
+        }
+      else
+        {
+        yIdx = zIdx;
+        yAxes = (xAxes + 2) % 3;
+        }
+
+      // Find the final point by determining which global x-y-z axes have not 
+      // been represented, and then determine the point closest to the viewer.
+      zAxes = (xAxes != 0 && yAxes != 0 ? 0 :
+              (xAxes != 1 && yAxes != 1 ? 1 : 2));
+      if ( pts[Conn[xIdx][zAxes]][2] < pts[Conn[yIdx][zAxes]][2] )
+        {
+        zIdx = xIdx;
+        zIdx2 = Conn[xIdx][zAxes];
+        }
+      else
+        {
+        zIdx = yIdx;
+        zIdx2 = Conn[yIdx][zAxes];
+        }
+      }//else boundary edges fly mode
+    this->InertiaAxes[0] = idx;
+    this->InertiaAxes[1] = xIdx;
+    this->InertiaAxes[2] = yIdx;
+    this->InertiaAxes[3] = zIdx;
+    this->InertiaAxes[4] = zIdx2;
+    this->InertiaAxes[5] = xAxes;
+    this->InertiaAxes[6] = yAxes;
+    this->InertiaAxes[7] = zAxes;
+    } //inertia
+  else
+    {
+    idx = this->InertiaAxes[0];
+    xIdx = this->InertiaAxes[1];
+    yIdx = this->InertiaAxes[2];
+    zIdx = this->InertiaAxes[3];
+    zIdx2 = this->InertiaAxes[4];
+    xAxes = this->InertiaAxes[5];
+    yAxes = this->InertiaAxes[6];
+    zAxes = this->InertiaAxes[7];
+    }
+
+  // Setup the axes for plotting
+  float xCoords[4], yCoords[4], zCoords[4], xRange[2], yRange[2], zRange[2];
+  this->AdjustAxes(pts, bounds, idx, xIdx, yIdx, zIdx, zIdx2, 
+                   xAxes, yAxes, zAxes, 
+                   xCoords, yCoords, zCoords, xRange, yRange, zRange);
+
+  // Upate axes
+  this->Labels[0] = this->XLabel;
+  this->Labels[1] = this->YLabel;
+  this->Labels[2] = this->ZLabel;
+
+  // correct XAxis, YAxis, ZAxis, which must be 
+  // parallel OX, OY, OZ system coordinates
+  // if xAxes=0 yAxes=1 zAxes=2 - good situation
+  if (!(xAxes == 0 && yAxes == 1 && zAxes == 2))
+    ChangeArrays(xCoords,yCoords,zCoords,
+                xRange,yRange,zRange,
+                xAxes,yAxes,zAxes);
+
+  double aTScale[3];
+  if(m_Transform.GetPointer() != NULL)
+    m_Transform->GetMatrixScale(aTScale);
+
+  this->XAxis->GetPositionCoordinate()->SetValue(xCoords[0], xCoords[1]);
+  this->XAxis->GetPosition2Coordinate()->SetValue(xCoords[2], xCoords[3]);
+  if(m_Transform.GetPointer() != NULL) this->XAxis->SetRange(xRange[0]/aTScale[0], xRange[1]/aTScale[0]);
+  else this->XAxis->SetRange(xRange[0], xRange[1]);
+
+  this->YAxis->GetPositionCoordinate()->SetValue(yCoords[2], yCoords[3]);
+  this->YAxis->GetPosition2Coordinate()->SetValue(yCoords[0], yCoords[1]);
+  if(m_Transform.GetPointer() != NULL) this->YAxis->SetRange(yRange[1]/aTScale[1], yRange[0]/aTScale[1]);
+  else this->YAxis->SetRange(yRange[1], yRange[0]);
+
+  this->ZAxis->GetPositionCoordinate()->SetValue(zCoords[0], zCoords[1]);
+  this->ZAxis->GetPosition2Coordinate()->SetValue(zCoords[2], zCoords[3]);
+  if(m_Transform.GetPointer() != NULL) this->ZAxis->SetRange(zRange[0]/aTScale[2], zRange[1]/aTScale[2]);
+  else this->ZAxis->SetRange(zRange[0], zRange[1]);
+
+  int numOfLabelsX = this->XAxis->GetNumberOfLabels();
+  int numOfLabelsY = this->YAxis->GetNumberOfLabels();
+  int numOfLabelsZ = this->ZAxis->GetNumberOfLabels();
+
+  // XCoords coordinates for X grid
+  vtkFloatArray *XCoords = vtkFloatArray::New();
+#ifndef WNT
+  for(int i=0;i<numOfLabelsX;i++){
+#else
+  for(i=0;i<numOfLabelsX;i++){
+#endif
+    float val = bounds[0]+i*(bounds[1]-bounds[0])/(numOfLabelsX-1);
+    XCoords->InsertNextValue(val);
+  }
+  // YCoords coordinates for Y grid
+  vtkFloatArray *YCoords = vtkFloatArray::New();
+#ifndef WNT
+  for(int i=0;i<numOfLabelsX;i++){
+#else
+  for(i=0;i<numOfLabelsX;i++){
+#endif
+    float val = bounds[2]+i*(bounds[3]-bounds[2])/(numOfLabelsY-1);
+    YCoords->InsertNextValue(val);
+  }
+  // ZCoords coordinates for Z grid
+  vtkFloatArray *ZCoords = vtkFloatArray::New();
+#ifndef WNT
+  for(int i=0;i<numOfLabelsZ;i++){
+#else
+  for(i=0;i<numOfLabelsZ;i++){
+#endif
+    float val = bounds[4]+i*(bounds[5]-bounds[4])/(numOfLabelsZ-1);
+    ZCoords->InsertNextValue(val);
+  }
+
+  vtkRectilinearGrid *rgrid = vtkRectilinearGrid::New();
+  rgrid->SetDimensions(numOfLabelsX,numOfLabelsY,numOfLabelsZ);
+  rgrid->SetXCoordinates(XCoords);
+  rgrid->SetYCoordinates(YCoords);
+  rgrid->SetZCoordinates(ZCoords);
+
+  this->planeXY->SetInput(rgrid);
+  this->planeYZ->SetInput(rgrid);
+  this->planeXZ->SetInput(rgrid);
+
+  rgrid->Delete();
+
+  float aCPosition[3];
+  float aCDirection[3];
+  this->Camera->GetPosition(aCPosition);
+  this->Camera->GetDirectionOfProjection(aCDirection);
+
+  // culculate placement of XY
+  bool replaceXY=false;
+  bool replaceYZ=false;
+  bool replaceXZ=false;
+  float p[6][3]; // centers of planes
+  float vecs[6][3]; // 6 vectors from camera position to centers
+
+  float aMiddleX = (XCoords->GetValue(0) + XCoords->GetValue(numOfLabelsX-1))/2;
+  float aMiddleY = (YCoords->GetValue(0) + YCoords->GetValue(numOfLabelsY-1))/2;
+  float aMiddleZ = (ZCoords->GetValue(0) + ZCoords->GetValue(numOfLabelsZ-1))/2;
+
+  // plane XY
+  p[0][0] = aMiddleX; // plane X=0.5 Y=0.5 Z=0
+  p[0][1] = aMiddleY;
+  p[0][2] = ZCoords->GetValue(0);
+
+  p[1][0] = aMiddleX; // plane X=0.5 Y=0.5 Z=1
+  p[1][1] = aMiddleY;
+  p[1][2] = ZCoords->GetValue(numOfLabelsZ-1);
+
+  // plane YZ
+  p[2][0] = XCoords->GetValue(0); // plane X=0 Y=0.5 Z=0.5
+  p[2][1] = aMiddleY;
+  p[2][2] = aMiddleZ;
+
+  p[3][0] = XCoords->GetValue(numOfLabelsX-1);
+  p[3][1] = aMiddleY;
+  p[3][2] = aMiddleZ;
+
+  // plane XZ
+  p[4][0] = aMiddleX; // plane X=0.5 Y=0 Z=0.5
+  p[4][1] = YCoords->GetValue(0);
+  p[4][2] = aMiddleZ;
+
+  p[5][0] = aMiddleX; // plane X=0.5 Y=1 Z=0.5
+  p[5][1] = YCoords->GetValue(numOfLabelsY-1);
+  p[5][2] = aMiddleZ;
+
+#ifndef WNT
+  for(int i=0;i<3;i++) 
+#else
+  for(i=0;i<3;i++) 
+#endif
+    for(int j=0;j<6;j++) vecs[j][i] = p[j][i] - aCPosition[i];
+
+  if ( vtkMath::Dot(vecs[0],aCDirection) < vtkMath::Dot(vecs[1],aCDirection))
+    replaceXY = true;
+  if ( vtkMath::Dot(vecs[2],aCDirection) < vtkMath::Dot(vecs[3],aCDirection))
+    replaceYZ = true;
+  if ( vtkMath::Dot(vecs[4],aCDirection) < vtkMath::Dot(vecs[5],aCDirection))
+    replaceXZ = true;
+
+  if(replaceXY) this->planeXY->SetExtent(0,numOfLabelsX, 0,numOfLabelsY, numOfLabelsZ,numOfLabelsZ);
+  else this->planeXY->SetExtent(0,numOfLabelsX, 0,numOfLabelsY, 0,0);
+
+  if(replaceYZ) this->planeYZ->SetExtent(numOfLabelsX,numOfLabelsX, 0,numOfLabelsY, 0,numOfLabelsZ);
+  else this->planeYZ->SetExtent(0,0, 0,numOfLabelsY, 0,numOfLabelsZ);
+
+  if(replaceXZ) this->planeXZ->SetExtent(0,numOfLabelsX, numOfLabelsY,numOfLabelsY, 0,numOfLabelsZ);
+  else this->planeXZ->SetExtent(0,numOfLabelsX, 0,0, 0,numOfLabelsZ);
+
+  XCoords->Delete();
+  YCoords->Delete();
+  ZCoords->Delete();
+
+  float color[3];
+
+  this->GetProperty()->GetColor(color);
+  this->wireActorXY->GetProperty()->SetColor(color);
+  this->wireActorYZ->GetProperty()->SetColor(color);
+  this->wireActorXZ->GetProperty()->SetColor(color);
+
+  /*
+  // Rebuid text props
+  // Perform shallow copy here since each individual axis can be
+  // accessed through the class API (i.e. each individual axis text prop
+  // can be changed). Therefore, we can not just assign pointers otherwise
+  // each individual axis text prop would point to the same text prop.
+
+  if (this->AxisLabelTextProperty &&
+      this->AxisLabelTextProperty->GetMTime() > this->BuildTime)
+    {
+    if (this->XAxis->GetLabelTextProperty())
+      {
+      this->XAxis->GetLabelTextProperty()->ShallowCopy(
+        this->AxisLabelTextProperty);
+      }
+    if (this->YAxis->GetLabelTextProperty())
+      {
+      this->YAxis->GetLabelTextProperty()->ShallowCopy(
+        this->AxisLabelTextProperty);
+      }
+    if (this->ZAxis->GetLabelTextProperty())
+      {
+      this->ZAxis->GetLabelTextProperty()->ShallowCopy(
+        this->AxisLabelTextProperty);
+      }
+    }
+
+  if (this->AxisTitleTextProperty &&
+      this->AxisTitleTextProperty->GetMTime() > this->BuildTime)
+    {
+    if (this->XAxis->GetLabelTextProperty())
+      {
+      this->XAxis->GetTitleTextProperty()->ShallowCopy(
+        this->AxisTitleTextProperty);
+      }
+    if (this->YAxis->GetLabelTextProperty())
+      {
+      this->YAxis->GetTitleTextProperty()->ShallowCopy(
+        this->AxisTitleTextProperty);
+      }
+    if (this->ZAxis->GetLabelTextProperty())
+      {
+      this->ZAxis->GetTitleTextProperty()->ShallowCopy(
+        this->AxisTitleTextProperty);
+      }
+    }
+  */  
+  this->BuildTime.Modified();
+
+  //Render the axes
+  if ( this->XAxisVisibility )
+  {
+    renderedSomething += this->XAxis->RenderOpaqueGeometry(viewport);
+  }
+  if ( this->YAxisVisibility )
+  {
+    renderedSomething += this->YAxis->RenderOpaqueGeometry(viewport);
+  }
+  if ( this->ZAxisVisibility )
+  {
+    renderedSomething += this->ZAxis->RenderOpaqueGeometry(viewport);
+  }
+
+  bool RX=false,RY=false;
+  if (this->XAxisVisibility){
+    this->wireActorXY->RenderOpaqueGeometry(viewport);
+    this->wireActorXZ->RenderOpaqueGeometry(viewport);
+    RX = true;
+  }
+  if (this->YAxisVisibility){
+    if(!RX) this->wireActorXY->RenderOpaqueGeometry(viewport);
+    this->wireActorYZ->RenderOpaqueGeometry(viewport);
+    RY = true;
+  }
+  if (this->ZAxisVisibility){
+    if(!RX) this->wireActorXZ->RenderOpaqueGeometry(viewport);
+    if(!RY) this->wireActorYZ->RenderOpaqueGeometry(viewport);
+  }
+
+  return renderedSomething;
+}
+
+//----------------------------------------------------------------------------
+// Release any graphics resources that are being consumed by this actor.
+// The parameter window could be used to determine which graphic
+// resources to release.
+void SVTK_CubeAxesActor2D::ReleaseGraphicsResources(vtkWindow *win)
+{
+  this->XAxis->ReleaseGraphicsResources(win);
+  this->YAxis->ReleaseGraphicsResources(win);
+  this->ZAxis->ReleaseGraphicsResources(win);
+
+  this->wireActorXY->ReleaseGraphicsResources(win);
+  this->wireActorYZ->ReleaseGraphicsResources(win);
+  this->wireActorXZ->ReleaseGraphicsResources(win);
+}
+
+void SVTK_CubeAxesActor2D::SetTransform(VTKViewer_Transform* theTransform){
+  this->m_Transform = theTransform;
+}
+
+VTKViewer_Transform* SVTK_CubeAxesActor2D::GetTransform(){
+  return (this->m_Transform.GetPointer());
+}
diff --git a/src/SVTK/SVTK_CubeAxesActor2D.h b/src/SVTK/SVTK_CubeAxesActor2D.h
new file mode 100644 (file)
index 0000000..1de1c1c
--- /dev/null
@@ -0,0 +1,108 @@
+//  SALOME OBJECT : kernel of SALOME component
+//
+//  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 
+//
+//
+//
+//  File   : SVTK_CubeAxesActor2D.h
+//  Author : Eugeny Nikolaev
+//  Module : SALOME
+//  $Header$
+
+#ifndef __SVTK_CubeAxesActor2D_h
+#define __SVTK_CubeAxesActor2D_h
+
+#include <vtkCubeAxesActor2D.h>
+#include <vtkSmartPointer.h>
+
+class vtkActor;
+class vtkAxisActor2D;
+class vtkCamera;
+class vtkDataSet;
+class vtkTextProperty;
+class vtkPolyDataMapper;
+class vtkRectilinearGridGeometryFilter;
+class VTKViewer_Transform;
+
+#include <SVTK.h>
+
+#ifndef WNT
+class VTK_HYBRID_EXPORT SVTK_CubeAxesActor2D : public vtkCubeAxesActor2D
+#else
+class SVTK_EXPORT SVTK_CubeAxesActor2D : public vtkCubeAxesActor2D
+#endif
+{
+public:
+  vtkTypeRevisionMacro(SVTK_CubeAxesActor2D,vtkCubeAxesActor2D);
+
+  // Description:
+  // Instantiate object with bold, italic, and shadow enabled; font family
+  // set to Arial; and label format "6.3g". The number of labels per axis
+  // is set to 3.
+  static SVTK_CubeAxesActor2D *New();
+  
+  // Description:
+  // Draw the axes as per the vtkProp superclass' API.
+  int RenderOverlay(vtkViewport*);
+  int RenderOpaqueGeometry(vtkViewport*);
+
+  // Description:
+  // Release any graphics resources that are being consumed by this actor.
+  // The parameter window could be used to determine which graphic
+  // resources to release.
+  void ReleaseGraphicsResources(vtkWindow *);
+
+  // Description:
+  
+  vtkActor* GetWireActorXY(){return this->wireActorXY;}
+  vtkActor* GetWireActorYZ(){return this->wireActorYZ;}
+  vtkActor* GetWireActorXZ(){return this->wireActorXZ;}
+
+  void SetTransform(VTKViewer_Transform* theTransform);
+  VTKViewer_Transform* GetTransform();
+  
+protected:
+  SVTK_CubeAxesActor2D();
+  ~SVTK_CubeAxesActor2D();
+
+  vtkActor* wireActorXY;
+  vtkActor* wireActorYZ;
+  vtkActor* wireActorXZ;
+
+private:
+  // hide the superclass' ShallowCopy() from the user and the compiler.
+  void ShallowCopy(vtkProp *prop) { this->vtkProp::ShallowCopy( prop ); };
+
+  vtkRectilinearGridGeometryFilter *planeXY; // rectilinear grid XY
+  vtkPolyDataMapper *rgridMapperXY;
+  
+  vtkRectilinearGridGeometryFilter *planeYZ; // rectilinear grid YZ
+  vtkPolyDataMapper *rgridMapperYZ;
+
+  vtkRectilinearGridGeometryFilter *planeXZ; // rectilinear grid XZ
+  vtkPolyDataMapper *rgridMapperXZ;
+  
+  vtkSmartPointer<VTKViewer_Transform> m_Transform;
+private:
+  SVTK_CubeAxesActor2D(const SVTK_CubeAxesActor2D&);  // Not implemented.
+  void operator=(const SVTK_CubeAxesActor2D&);  // Not implemented.
+};
+
+#endif
diff --git a/src/SVTK/SVTK_Prs.h b/src/SVTK/SVTK_Prs.h
new file mode 100644 (file)
index 0000000..3446e9a
--- /dev/null
@@ -0,0 +1,59 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  Copyright (C) 2004  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.salome-platform.org or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : SVTK_Prs.h
+//  Author : Sergey ANIKIN
+//  Module : SALOME
+//  $Header$
+
+#ifndef SVTK_Prs_H
+#define SVTK_Prs_H
+
+#include <SVTK.h>
+#include "SALOME_Prs.h"
+
+#include <vtkActorCollection.h>
+
+class SVTK_EXPORT SVTK_Prs : public SALOME_VTKPrs
+{
+public:
+  SVTK_Prs();
+  // Default constructor
+  SVTK_Prs( const vtkActor* obj );
+  // Standard constructor
+  ~SVTK_Prs();
+  // Destructor
+
+  vtkActorCollection* GetObjects() const;
+  // Get actors list
+  void AddObject( const vtkActor* obj );
+  // Add actor
+  
+  bool IsNull() const;
+  // Reimplemented from SALOME_Prs
+
+private:
+  vtkActorCollection* myObjects;    // list of actors
+};
+
+#endif
diff --git a/src/SalomeApp/SalomeApp_ImportOperation.cxx b/src/SalomeApp/SalomeApp_ImportOperation.cxx
new file mode 100644 (file)
index 0000000..5543f90
--- /dev/null
@@ -0,0 +1,40 @@
+//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+//  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 
+//
+//
+//
+//  File   : SALOMEGUI_ImportOperation.cxx
+//  Author : Nicolas REJNERI
+//  Module : SALOME
+//  $Header$
+
+#include "SalomeApp_ImportOperation.h"
+#include <SUIT_Application.h>
+
+#ifndef WNT
+using namespace std;
+#endif
+
+/*!Constructor. Do nothing.*/
+SalomeApp_ImportOperation::SalomeApp_ImportOperation( SUIT_Application* app ) :
+SUIT_Operation( app )
+{
+}
diff --git a/src/SalomeApp/resources/SalomeApp.xml b/src/SalomeApp/resources/SalomeApp.xml
new file mode 100644 (file)
index 0000000..5487e6c
--- /dev/null
@@ -0,0 +1,149 @@
+<document>
+  <section name="desktop" >
+    <parameter name="state"  value="max"/>
+    <parameter name="pos_x"  value="100"/>
+    <parameter name="pos_y"  value="050"/>
+    <parameter name="width"  value="640"/>
+    <parameter name="height" value="480"/>
+  </section>
+  <section name="launch">
+    <parameter name="gui"        value="yes"/>
+    <parameter name="splash"     value="yes"/>
+    <parameter name="file"       value="no"/>
+    <parameter name="key"        value="no"/>
+    <parameter name="interp"     value="no"/>
+    <parameter name="logger"     value="no"/>
+    <parameter name="xterm"      value="no"/>
+    <parameter name="portkill"   value="no"/>
+    <parameter name="killall"    value="no"/>
+    <parameter name="modules"    value="GEOM,SMESH,VISU,SUPERV,MED,COMPONENT"/>
+    <parameter name="pyModules"  value=""/>
+    <parameter name="embedded"   value="SalomeAppEngine,study"/>
+    <parameter name="standalone" value="pyContainer,cppContainer,registry,moduleCatalog"/>
+  </section>
+  <section name="language">
+    <parameter name="language"    value="en"/>
+    <parameter name="translators" value="%P_msg_%L.qm|%P_icons.qm|%P_images.qm"/>
+  </section>
+  <section name="resources">
+    <parameter name="SUIT"         value="${SUITRoot}/resources"/>
+    <parameter name="STD"          value="${SUITRoot}/resources"/>
+    <parameter name="Plot2d"       value="${SUITRoot}/resources"/>
+    <parameter name="SPlot2d"      value="${SUITRoot}/resources"/>
+    <parameter name="GLViewer"     value="${SUITRoot}/resources"/>
+    <parameter name="OCCViewer"    value="${SUITRoot}/resources"/>
+    <parameter name="VTKViewer"    value="${SUITRoot}/resources"/>
+    <parameter name="SalomeApp"    value="${SUITRoot}/resources"/>
+    <parameter name="OB"           value="${SUITRoot}/resources"/>
+    <parameter name="CAM"          value="${SUITRoot}/resources"/>
+    <parameter name="GEOM"         value="${GEOM_ROOT_DIR}/share/salome/resources"/>
+    <parameter name="SMESH"        value="${SMESH_ROOT_DIR}/share/salome/resources"/>
+    <parameter name="VISU"         value="${VISU_ROOT_DIR}/share/salome/resources"/>
+    <parameter name="SUPERV"       value="${SUPERV_ROOT_DIR}/share/salome/resources"/>
+    <parameter name="MED"          value="${MED_ROOT_DIR}/share/salome/resources"/>
+    <parameter name="StdMeshers"   value="${SMESH_ROOT_DIR}/share/salome/resources"/>
+    <parameter name="COMPONENT"    value="${COMPONENT_ROOT_DIR}/share/salome/resources"/>
+    <parameter name="NETGENPlugin" value="${NETGENPLUGIN_ROOT_DIR}/share/salome/resources"/>
+    <parameter name="GHS3DPlugin"  value="${GHS3DPLUGIN_ROOT_DIR}/share/salome/resources"/>
+    <parameter name="ToolsGUI"     value="${SUITRoot}/resources"/>
+  </section>
+  <section name="GEOM">
+    <parameter name="name"       value="Geometry"/>
+    <parameter name="icon"       value="ModuleGeom.png"/>
+  </section>
+  <section name="SMESH">
+    <parameter name="name"       value="Mesh"/>
+    <parameter name="icon"       value="ModuleMesh.png"/>
+  </section>
+  <section name="VISU">
+    <parameter name="name"       value="Post-Pro"/>
+    <parameter name="icon"       value="ModuleVisu.png"/>
+  </section>
+  <section name="SUPERV">
+    <parameter name="name"       value="Supervisor"/>
+    <parameter name="icon"       value="ModuleSupervision.png"/>
+  </section>
+  <section name="MED">
+    <parameter name="name"       value="Med"/>
+    <parameter name="icon"       value="ModuleMed.png"/>
+  </section>
+
+<!-- values below this line are just an example, they are not used  -->
+  <section name="application">
+    <parameter name="QuickDirList" value=""/>
+    <!-- Here go other common user preferences -->
+  </section>
+  <section name="ObjectBrowser" >
+    <parameter value="false" name="auto_size" />
+  </section>
+  <section name="Geometry" >
+    <parameter value="10" name="SettingsGeomStep" />
+    <parameter value="0"  name="display_mode" />
+    <parameter value="255, 255, 0" name="shading_color" />
+  </section>
+  <section name="SMESH">
+    <parameter name="plugins" value="NETGENPlugin,GHS3DPlugin"/>
+    <parameter value="255, 0,   0" name="node_color" />
+    <parameter value="0, 170, 255" name="fill_color" />
+    <parameter value="0, 170, 255" name="outline_color" />
+    <parameter value="0, 0,   255" name="backface_color" />
+    <parameter value="3" name="node_size" />
+    <parameter value="1" name="element_width" />
+    <parameter value="75" name="shrink_coeff" />
+    <parameter value="0, 255,   255" name="highlight_color" />
+    <parameter value="255, 255,   0" name="selection_element_color" />
+    <parameter value="255, 255, 255" name="selection_object_color" />
+    <parameter value="0.001" name="selection_precision_element" />
+    <parameter value="0.025" name="selection_precision_node" />
+    <parameter value="5" name="selection_width" />
+    <parameter value="5" name="highlight_width" />
+    <parameter value="0" name="controls_precision" />
+    <parameter value="0.12" name="scalar_bar_horizontal_height" />
+    <parameter value="0.6" name="scalar_bar_horizontal_width" />
+    <parameter value="0.2" name="scalar_bar_horizontal_x" />
+    <parameter value="0.01" name="scalar_bar_horizontal_y" />
+    <parameter value="255, 255, 255" name="scalar_bar_label_color" />
+    <parameter value="Arial,12" name="scalar_bar_label_font" />
+    <parameter value="64" name="scalar_bar_num_colors" />
+    <parameter value="5" name="scalar_bar_num_labels" />
+    <parameter value="0" name="scalar_bar_orientation" />
+    <parameter value="255, 255, 255" name="scalar_bar_title_color" />
+    <parameter value="Arial,12" name="scalar_bar_title_font" />
+    <parameter value="0.8" name="scalar_bar_vertical_height" />
+    <parameter value="0.1" name="scalar_bar_vertical_width" />
+    <parameter value="0.01" name="scalar_bar_vertical_x" />
+    <parameter value="0.1" name="scalar_bar_vertical_y" />
+    <parameter value="true" name="DisplayMode" />
+  </section>
+  <section name="VISU" >
+  <parameter value="false" name="full_med_loading" />
+  <parameter value="0.12" name="scalar_bar_horizontal_height" />
+  <parameter value="0.6" name="scalar_bar_horizontal_width" />
+  <parameter value="0.2" name="scalar_bar_horizontal_x" />
+  <parameter value="0.01" name="scalar_bar_horizontal_y" />
+  <parameter value="255, 255, 255" name="scalar_bar_label_color" />
+  <parameter value="Arial,Bold,Italic,Underline,12" name="scalar_bar_label_font" />
+  <parameter value="false" name="scalar_bar_logarithmic" />
+  <parameter value="0" name="scalar_bar_mode" />
+  <parameter value="64" name="scalar_bar_num_colors" />
+  <parameter value="5" name="scalar_bar_num_labels" />
+  <parameter value="0" name="scalar_bar_orientation" />
+  <parameter value="255, 255, 255" name="scalar_bar_title_color" />
+  <parameter value="Arial,Bold,Italic,Underline,12" name="scalar_bar_title_font" />
+  <parameter value="0.8" name="scalar_bar_vertical_height" />
+  <parameter value="0.1" name="scalar_bar_vertical_width" />
+  <parameter value="0.01" name="scalar_bar_vertical_x" />
+  <parameter value="0.1" name="scalar_bar_vertical_y" />
+  <parameter value="0" name="scalar_range_max" />
+  <parameter value="0" name="scalar_range_min" />
+  <parameter value="0" name="scalar_range_type" />
+  <parameter value="1" name="sweeping_number_cycles" />
+  <parameter value="20" name="sweeping_number_steps" />
+  <parameter value="0.2" name="sweeping_time_step" />
+  </section>
+  <!-- Here go optional sections for other modules -->
+  <section name="resources">
+    <parameter name="salome" value="${KERNEL_ROOT_DIR}/share/salome/res"/>
+    <!-- Here go resource directories for other modules -->
+  </section>
+</document>
diff --git a/src/Session/InquireServersQThread.cxx b/src/Session/InquireServersQThread.cxx
new file mode 100755 (executable)
index 0000000..3a4b9dd
--- /dev/null
@@ -0,0 +1,580 @@
+//  Copyright (C) 2003  CEA/DEN, EDF R&D
+//
+//
+//
+//  File   : InquireServersQThread.cxx
+//  Author : Vasily RUSYAEV
+//  Module : SALOME
+//  $Header$
+
+#include "InquireServersQThread.h"
+
+#include <qapplication.h>
+#include <qpushbutton.h>
+#include <qabstractlayout.h> 
+#include <qlayout.h>
+#include <qevent.h> 
+#include <qfont.h> 
+#include <qmessagebox.h> 
+#include <qdir.h>
+#include <qfileinfo.h>
+#include <qstringlist.h>
+#include <qlabel.h> 
+#include <qprogressbar.h> 
+
+//VRV: porting on Qt 3.0.5
+#if QT_VERSION >= 0x030005
+#include <qdesktopwidget.h> 
+#endif
+//VRV: porting on Qt 3.0.5
+
+#include <qsize.h> 
+
+#include <SALOMEconfig.h>
+
+#include "Utils_ORB_INIT.hxx"
+#include "Utils_SINGLETON.hxx"
+#include "SALOME_NamingService.hxx"
+#include "utilities.h"
+#include "OpUtil.hxx"
+
+using namespace std;
+
+#include CORBA_CLIENT_HEADER(SALOME_Session)
+#include CORBA_CLIENT_HEADER(SALOME_Registry)
+#include CORBA_CLIENT_HEADER(SALOMEDS)
+#include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog)
+#include CORBA_CLIENT_HEADER(SALOME_Component)
+
+#define MARGIN_SIZE  5
+#define SPACING_SIZE 3
+
+InquireServersGUI::InquireServersGUI()
+     : QVBox(0, "SFA splash", Qt::WDestructiveClose | Qt::WStyle_Customize | Qt::WStyle_NoBorder | WType_TopLevel | WStyle_StaysOnTop | WX11BypassWM  )
+{
+  //  myGUI = false;
+  myThread = new InquireServersQThread( this );
+
+  // 1. Polish the appearance
+  setMargin( MARGIN_SIZE );
+  setSpacing( SPACING_SIZE );
+  setFrameStyle( QFrame::Plain | QFrame::Box );
+  setLineWidth( 2 );
+  setMinimumSize( 200, 150 );
+
+  // 2. Set palette
+  QPalette pal = palette();
+  QColorGroup cg = pal.active();
+  cg.setColor( QColorGroup::Foreground, Qt::darkBlue ); 
+  cg.setColor( QColorGroup::Background, Qt::white );
+  pal.setActive( cg ); pal.setInactive( cg ); pal.setDisabled( cg );
+  setPalette( pal );
+
+  // 2. Splash image
+  mySplashFrame = new QFrame( this );
+  mySplashFrame->setFrameStyle( QFrame::Box | QFrame::Raised );
+  QHBoxLayout* frmLayout = new QHBoxLayout( mySplashFrame );
+  frmLayout->setMargin( MARGIN_SIZE );
+  mySplash = new QLabel( mySplashFrame, "splash" );
+  frmLayout->addWidget( mySplash );
+
+  // setting pixmap
+  //QPixmap pix = SUIT_ResourceMgr( "SalomeApp" ).loadPixmap( "SalomeApp", tr( "ABOUT" ) );
+  //splash->setPixmap( pix  );
+  
+  // 3. Progress bar
+  myPrgBar = new QProgressBar( this, "QProgressBar" );
+  myPrgBar->setFixedWidth( 180 );
+  //Sets the total number of steps . 
+  myPrgBar->setPercentageVisible( false );
+  myPrgBar->setIndicatorFollowsStyle( false );
+  myPrgBar->setFixedHeight( 8 );
+  myPrgBar->setFrameStyle( QFrame::Box | QFrame::Plain );
+  myPrgBar->setMargin( 0 );
+  pal = myPrgBar->palette(); cg = pal.active();
+  cg.setColor( QColorGroup::Highlight, Qt::red );
+  pal.setActive( cg ); pal.setInactive( cg ); pal.setDisabled( cg ); myPrgBar->setPalette( pal );
+  myPrgBar->setTotalSteps ( myThread->getInquiredServers() );
+  myPrgBar->setProgress( 0 );
+
+  // 4. Info label
+  QWidget* aWgt1 = new QWidget( this );
+  QHBoxLayout* aHBoxLayout1 = new QHBoxLayout( aWgt1 );
+  myLabel = new QLabel( tr( "Loading:" ), aWgt1 );
+  myLabel->setFixedWidth( 180 );
+  myLabel->setAlignment( AlignLeft );
+  QFont theFont = myLabel->font();
+  theFont.setBold(true);
+  myLabel->setFont( theFont );
+  aHBoxLayout1->addItem( new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
+  aHBoxLayout1->addWidget( myLabel );
+  aHBoxLayout1->addItem( new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
+
+  // 5. <Cancel> button
+  QWidget* aWgt = new QWidget( this );
+  QHBoxLayout* aHBoxLayout = new QHBoxLayout( aWgt );
+  QPushButton* myCancelBtn = new QPushButton( tr( "Cancel" ), aWgt );
+  connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
+  aHBoxLayout->addItem( new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum )  );
+  aHBoxLayout->addWidget( myCancelBtn );
+  aHBoxLayout->addItem( new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum )  );
+
+  //Center widget
+#if QT_VERSION >= 0x030005
+  QDesktopWidget *d = QApplication::desktop();
+#else
+  QWidget *d = QApplication::desktop();
+#endif
+//VRV: porting on Qt 3.0.5
+
+  int w = d->width();         // returns desktop width
+  int h = d->height();        // returns desktop height
+  QSize mySize = sizeHint (); // returns widget size
+  int Xc = ( w - mySize.width() )  / 2;
+  int Yc = ( h - mySize.height() ) / 2;
+  move( Xc, Yc );
+
+  myThread->start();
+}
+
+void InquireServersGUI::setPixmap( QPixmap pix )
+{
+  if ( !pix.isNull() ) 
+  {
+    mySplash->setPixmap( pix );
+    int w = mySplash->sizeHint().width() + MARGIN_SIZE*2;
+    myPrgBar->setFixedWidth( w );
+    myLabel->setFixedWidth( w );
+  }
+}
+
+InquireServersGUI::~InquireServersGUI()
+{
+  delete myThread;
+}
+
+void InquireServersGUI::getArgs( int& _argc, char *** _argv)
+{
+  _argc = qApp->argc();
+  *_argv = qApp->argv();
+}
+
+//=================================================================================
+// function : ClickOnCancel()
+// purpose  : cancel loading of SALOME
+//=================================================================================
+void InquireServersGUI::ClickOnCancel()
+{
+  myThread->stop(); //it's necessary to stop asking servers
+  hide();
+  qApp->exit( 1 );
+}
+
+void InquireServersGUI::customEvent( QCustomEvent* pe )
+{
+  switch( pe->type() )
+    {
+        case InquireEvent::ProgressEvent:
+        {
+            int* value = ( int* )(( InquireEvent*)pe)->data();
+            myPrgBar->setProgress( *value );
+            break;
+        }
+        case InquireEvent::ProgressEventLabel:
+        {
+            QString* myString = ( QString* )(( InquireEvent*)pe)->data();
+            myLabel->setText( *myString );
+            break;
+        }
+        case InquireEvent::ProgressEventError:
+        {
+            QString* myErrDesc = ( QString* )(( InquireEvent*)pe)->data();
+           QString  appName = "SALOME Professional";
+           QString  error = "An internal error occurred.\n"+ *myErrDesc + "\n";
+           QMessageBox myMsgBox(appName,error,QMessageBox::Critical,QMessageBox::Ok,QMessageBox::NoButton,
+                                       QMessageBox::NoButton,0,"MY",TRUE,WStyle_DialogBorder|WStyle_StaysOnTop);
+           myMsgBox.exec();
+           ClickOnCancel();
+            break;
+        }
+      default:
+       {
+         ;
+       }
+    }
+}
+
+int InquireServersGUI::getExitStatus()
+{
+  return myThread->getExitStatus();
+}
+
+InquireServersQThread::InquireServersQThread( InquireServersGUI* r )
+     : receiver(r),  myExitStatus(0)
+{
+  char* cenv;
+
+  IsChecking = true;
+  myServersCount = 5;
+  //how many times we should repeat attempts to get response from all needed for launching SALOME servers
+  myRepeat = 30; // default value, user can change it by setting CSF_RepeatServerRequest env.variable
+  cenv = getenv( "CSF_RepeatServerRequest" );
+  if ( cenv ) {
+    int val = atoi( cenv );
+    if ( val > 0 )
+      myRepeat = val;
+  }
+  //define delay time between two attempts
+  myDelay = 1000000; // 1 second
+  QString str = "Loading: ";
+  myMessages[0] = "Checking naming service...";
+  myMessages[1] = str + "SALOME_Registry_Server" + "...";
+  myMessages[2] = str + "SALOMEDS_Server" + "...";
+  myMessages[3] = str + "SALOME_ModuleCatalog_Server" + "...";
+  myMessages[4] = str + "SALOME_Session_Server" + "...";
+  myMessages[5] = "";
+  myMessages[6] = "";
+  myMessages[7] = "";
+
+  r->getArgs( _argc, &_argv);
+
+  // NRI : Temporary solution for SuperVisionContainer
+  for ( int i=1; i<=(_argc-1); i++) {
+    if (strcmp(_argv[i],"CPP")==0) {
+      myMessages[5] = str + "SALOME_Container FactoryServer" + "...";
+      myServersCount++;
+    }
+    if (strcmp(_argv[i],"PY")==0) {
+      myMessages[6] = str + "SALOME_ContainerPy.py FactoryServerPy" + "...";
+      myServersCount++;
+    }
+    if (strcmp(_argv[i],"SUPERV")==0) {
+      myMessages[7] = str + "SALOME_Container SuperVisionContainer" + "...";
+      myServersCount++;
+    }
+//    if (strcmp(_argv[i],"GUI")==0) {
+//      r->withGUI(true);
+//    }
+  }
+}
+
+void InquireServersQThread::run()
+{
+  while ( IsChecking && receiver )
+  {
+    for (int i=1; i<=8; i++)
+    {
+      if ( myMessages[i-1].isEmpty() ) 
+      {
+       if ( i==8 ) 
+       {
+         IsChecking = false;
+         myExitStatus = 0;  //myExitStatus should be 0 because all servers exist and work
+         sleep( 1 ); // sleep( 1 second ) in order to see 100%.  in other case it closes on 85%..
+         break;
+       } 
+       else
+         continue;
+      }
+      QString *message = new QString(myMessages[i-1]);
+      QThread::postEvent( receiver, new InquireEvent( ( QEvent::Type )InquireEvent::ProgressEventLabel, message ) );
+      QThread::usleep(200000);
+      QString *errMsg;
+      bool result = AskServer(i,&errMsg);
+      if (result)
+      {
+       QThread::postEvent( receiver, new InquireEvent( ( QEvent::Type )InquireEvent::ProgressEvent, new int( i ) ) );
+       if ( i==8 )
+       {
+         IsChecking = false;
+         myExitStatus = 0; //myExitStatus should be 0 because all servers exist and work
+         sleep( 1 );  // sleep( 1 second ) in order to see 100%.  in other case it closes on 85%..
+         break;
+       }
+      }
+      else
+      {
+       QThread::postEvent( receiver, new InquireEvent( ( QEvent::Type )InquireEvent::ProgressEventError, errMsg ) );
+       stop();
+       break;
+      }
+    }
+  }
+
+  receiver->hide();
+  qApp->exit( myExitStatus );
+}
+
+void InquireServersQThread::stop()
+{
+  IsChecking = false;
+  myExitStatus = 1;
+}
+
+InquireServersQThread::~InquireServersQThread()
+{
+}
+
+bool InquireServersQThread::AskServer(int iteration, QString ** errMessage)
+{
+  if ( iteration > myServersCount )
+    return true; // we did not launch server with number iteration, so checking for it is not neccessary
+
+  ASSERT(iteration<=myServersCount);
+
+  //will be set true if we get response from server
+  bool IsPassed = false;
+  QString errDescription;
+#ifdef WNT
+  int i;
+#endif
+  switch (iteration)
+    {
+    case 1:
+      //First checking - existence of Naming Service
+#ifndef WNT
+      for (int i = myRepeat; i ; i--)
+#else
+         for (i = myRepeat; i ; i--)
+#endif
+       {
+         try
+           {
+             CORBA::ORB_var orb = CORBA::ORB_init(_argc,_argv) ;
+             CORBA::Object_var obj = orb->resolve_initial_references("NameService");
+             CosNaming::NamingContext_var _root_context = CosNaming::NamingContext::_narrow(obj);
+             if (CORBA::is_nil(_root_context))
+               continue;
+             else
+               IsPassed = true;
+             break;
+           }
+         catch(CORBA::COMM_FAILURE&)
+           {
+             MESSAGE("CORBA::COMM_FAILURE: unable to contact the naming service");
+           }
+         catch(...)
+           {
+             MESSAGE("Unknown Exception: unable to contact the naming service");
+           }
+         QThread::usleep(myDelay);
+       }
+      if (!IsPassed)
+       *errMessage = new QString("unable to contact the naming service");
+      break;
+    case 2:
+      //checking - existence of SALOME_Registry_Server
+    case 3:
+      //checking - existence of SALOMEDS_Server
+    case 4:
+      //checking - existence of SALOME_ModuleCatalog_Server
+    case 5:
+      //checking - existence of SALOME_Session_Server
+    case 6:
+      //checking - existence of SALOME_Container FactoryServer
+    case 7:
+      //checking - existence of SALOME_ContainerPy.py FactoryServerPy
+    case 8:
+      //checking - existence of SALOME_Container SuperVisionContainer
+
+
+      IsPassed = pingServer(iteration, errDescription);
+      if (!IsPassed)
+       *errMessage = new QString(errDescription);
+      break;
+    }
+return IsPassed;
+}
+
+bool InquireServersQThread::pingServer(int iteration, QString& errMessage)
+{
+  ASSERT(iteration<=myServersCount);
+  bool result = false;
+  QString errorDescr;
+  for (int i = myRepeat; i ; i--)
+    {
+      try
+       {
+         CORBA::ORB_var orb = CORBA::ORB_init(_argc,_argv) ;
+         SALOME_NamingService &NS = *SINGLETON_<SALOME_NamingService>::Instance() ;
+         ASSERT(SINGLETON_<SALOME_NamingService>::IsAlreadyExisting()) ;
+         NS.init_orb( orb ) ;
+         switch (iteration)
+           {
+           case 2:
+             {
+               CORBA::Object_var obj = NS.Resolve("/Registry");
+               Registry::Components_var registry = Registry::Components::_narrow(obj) ;
+               if (!CORBA::is_nil(registry))
+                 {
+                   MESSAGE("/Registry is found");
+                   registry->ping();
+                   result = true;
+                   MESSAGE("Registry was activated");
+                   return result;
+                 }
+             }
+             break;
+           case 3:
+             {
+               CORBA::Object_var obj = NS.Resolve("/myStudyManager");
+               SALOMEDS::StudyManager_var studyManager = SALOMEDS::StudyManager::_narrow(obj) ;
+               if (!CORBA::is_nil(studyManager))
+
+
+
+
+
+                 {
+                   MESSAGE("/myStudyManager is found");
+                   studyManager->ping();
+                   result = true;
+                   MESSAGE("StudyManager was activated");
+                   return result;
+                 }
+             }
+             break;
+           case 4:
+             {
+               CORBA::Object_var obj = NS.Resolve("/Kernel/ModulCatalog");
+               SALOME_ModuleCatalog::ModuleCatalog_var catalog = SALOME_ModuleCatalog::ModuleCatalog::_narrow(obj) ;
+               if (!CORBA::is_nil(catalog))
+                 {
+                   MESSAGE("/Kernel/ModulCatalog is found");
+                   catalog->ping();
+                   result = true;
+                   MESSAGE("ModuleCatalog was activated");
+                   return result;
+                 }
+             }
+             break;
+           case 5:
+             {
+               CORBA::Object_var obj = NS.Resolve("/Kernel/Session");
+               SALOME::Session_var session = SALOME::Session::_narrow(obj) ;
+               if (!CORBA::is_nil(session))
+                 {
+                   MESSAGE("/Kernel/Session is found");
+                   session->ping();
+                   result = true;
+                   MESSAGE("SALOME_Session was activated");
+                   return result;
+                 }
+             }
+             break;
+           case 6:
+             {
+               string hostname = GetHostname();
+               string containerName = "/Containers/";
+               containerName += hostname;
+               containerName += "/FactoryServer";
+
+               CORBA::Object_var obj = NS.Resolve(containerName.c_str());
+               Engines::Container_var FScontainer = Engines::Container::_narrow(obj) ;
+               if (!CORBA::is_nil(FScontainer))
+                 {
+                   FScontainer->ping();
+                   result = true;
+                   MESSAGE("FactoryServer container was activated");
+                   return result;
+                 }
+             }
+             break;
+           case 7:
+             {
+               string hostname = GetHostname();
+               string containerName = "/Containers/";
+               containerName += hostname;
+               containerName += "/FactoryServerPy";
+               
+               CORBA::Object_var obj = NS.Resolve(containerName.c_str());
+               Engines::Container_var FSPcontainer = Engines::Container::_narrow(obj) ;
+               if (!CORBA::is_nil(FSPcontainer))
+                 {
+                   FSPcontainer->ping();
+                   result = true;
+                   MESSAGE("FactoryServerPy container was activated");
+                   return result;
+                 }
+             }
+             break;
+           case 8:
+             {
+               string hostname = GetHostname();
+               string containerName = "/Containers/";
+               containerName += hostname;
+               containerName += "/SuperVisionContainer";
+               
+               CORBA::Object_var obj = NS.Resolve(containerName.c_str());
+               Engines::Container_var SVcontainer = Engines::Container::_narrow(obj) ;
+               if (!CORBA::is_nil(SVcontainer))
+                 {
+                   SVcontainer->ping();
+
+                   result = true;
+                   MESSAGE("SuperVisionContainer container was activated");
+                   return result;
+                 }
+             }
+             break;
+           }
+        }
+      catch (ServiceUnreachable&)
+       {
+         MESSAGE("Caught exception: Naming Service Unreachable");
+         errorDescr = "Caught exception: Naming Service Unreachable";
+       }
+      catch (CORBA::COMM_FAILURE&)
+       {
+         MESSAGE("Caught CORBA::SystemException CommFailure.");
+         errorDescr = "Caught CORBA::SystemException CommFailure";
+       }
+      catch (CORBA::SystemException&)
+       {
+         MESSAGE("Caught CORBA::SystemException.");
+         errorDescr = "Caught CORBA::SystemException";
+       }
+      catch (CORBA::Exception&)
+       {
+         MESSAGE("Caught CORBA::Exception.");
+         errorDescr = "Caught CORBA::Exception";
+       }
+      catch (...)
+       {
+         MESSAGE("Caught unknown exception.");
+         errorDescr = "Caught unknown exception";
+       }
+      QThread::usleep(myDelay);
+    }
+  if (!result)
+    {
+      QString serverName;
+      switch (iteration)
+       {
+       case 2:
+         serverName = "SALOME_Registry_Server is not loaded. ";
+         break;
+       case 3:
+         serverName = "SALOMEDS_Server is not loaded. ";
+         break;
+       case 4:
+         serverName = "SALOME_ModuleCatalog_Server is not loaded. ";
+         break;
+       case 5:
+         serverName = "SALOME_Session_Server is not loaded. ";
+         break;
+       case 6:
+         serverName = "SALOME_Container FactoryServer is not loaded. ";
+         break;
+       case 7:
+         serverName = "SALOME_ContainerPy.py FactoryServerPy is not loaded. ";
+         break;
+       case 8:
+         serverName = "SALOME_Container SuperVisionContainer is not loaded. ";
+         break;
+       }
+      errMessage = serverName + errorDescr;
+    }
+  return result;
+}
+
diff --git a/src/Session/InquireServersQThread.h b/src/Session/InquireServersQThread.h
new file mode 100755 (executable)
index 0000000..b97bfd0
--- /dev/null
@@ -0,0 +1,121 @@
+//  Copyright (C) 2003  CEA/DEN, EDF R&D
+//
+//
+//
+//  File   : InquireServersQThread.h
+//  Author : Vasily RUSYAEV
+//  Module : SALOME
+//  $Header$
+
+#include <qthread.h> 
+#include <qvbox.h> 
+#include <qguardedptr.h> 
+
+#ifdef WNT
+#include <SALOME_WNT.hxx>
+#else
+#define SALOME_WNT_EXPORT
+#endif
+
+/**********************************************************
+**  Class:   InquireEvent
+**  Descr:   Contains QCustomEvents for posting to InquireServersQThread
+**  Level:   Private
+***********************************************************/
+class SALOME_WNT_EXPORT InquireEvent : public QCustomEvent
+{
+public:
+
+  enum myCustomEvents{ ProgressEvent = QEvent::User + 10, ProgressEventLabel, ProgressEventError };
+  
+  InquireEvent( QEvent::Type type , void* data = 0 )
+        : QCustomEvent( type, data ) {}
+  ~InquireEvent() 
+      {
+        type() == (QEvent::Type)ProgressEvent ?
+         delete ( int* )data() : delete ( QString* )data();
+      }
+};
+
+class InquireServersGUI;
+
+class SALOME_WNT_EXPORT InquireServersQThread : public QThread
+{
+public:
+  InquireServersQThread( InquireServersGUI* r );
+  virtual ~InquireServersQThread();
+
+  //the main loop of this thread
+  virtual void run() ;
+  //stop to ask servers
+  void stop(); 
+  //return exit status: 0 - OK, >0 - BAD (some servers doesn't exists or user click cancel button) 
+  int getExitStatus() { return myExitStatus;}
+  //return count of inquired servers
+  int getInquiredServers() { return myServersCount; }
+
+private:
+
+//functions:
+
+  bool AskServer(int iteration, QString ** message);
+  bool pingServer(int iteration, QString& errMessage);
+
+//variables:
+
+  QGuardedPtr<InquireServersGUI> receiver;
+  int _argc ;
+  char ** _argv;
+  //this variable is true if we are checking servers
+  bool IsChecking;
+  //count of inquired servers
+  int myServersCount;
+  //how many times we should repeat attempt to get response from all needed for launching SALOME servers
+  int myRepeat;
+  //define delay time between two attempts in microseconds
+  int myDelay;
+  //this strings' array contains messages for each server (e.g. "Loading: SALOMEDS_Server") 
+  QString myMessages[8];
+  //exit status: 0 - OK, >0 - BAD (some servers doesn't exists or user click cancel button) 
+  int myExitStatus;
+
+} ;
+
+class QLabel;
+class QFrame;
+class QProgressBar;
+class SALOME_WNT_EXPORT InquireServersGUI : public QVBox
+{
+    Q_OBJECT
+
+public:
+  InquireServersGUI() ;
+  ~InquireServersGUI();
+
+  //returns arguments of QApplication
+  //they are needed for CORBA servers initialization
+  void getArgs(  int& _argc, char *** _argv);
+  //return exit status: 0 - OK, >0 - BAD (some servers doesn't exists or user click cancel button) 
+  int getExitStatus();
+  //launch IAPP
+  //  bool withGUI() { return myGUI; }
+  //  void withGUI(bool gui) { myGUI = gui; }
+
+  void setPixmap( QPixmap );
+
+protected:
+  virtual void customEvent( QCustomEvent* ); 
+
+private:
+  InquireServersQThread* myThread;
+  QProgressBar* myPrgBar;
+  //this string contains description of currently asked server
+  QLabel* myLabel;
+  QLabel* mySplash;
+  QFrame* mySplashFrame;
+  //  bool myGUI;
+
+private slots:
+
+    void ClickOnCancel();
+} ;
diff --git a/src/Session/SalomeApp_Engine_i.cxx b/src/Session/SalomeApp_Engine_i.cxx
new file mode 100644 (file)
index 0000000..27cc1cd
--- /dev/null
@@ -0,0 +1,169 @@
+//  SalomeApp_Engine_i : implementation of SalomeApp_Engine.idl
+//
+//  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
+//
+//
+//
+//  File   : SalomeApp_Engine_i.cxx
+//  Author : Alexander SLADKOV
+//  Module : SALOME
+//  $Header$
+
+#include "SalomeApp_Engine_i.hxx"
+
+#include "SALOMEDS_Tool.hxx"
+
+#include "utilities.h"
+
+#include <iostream>
+
+using namespace std;
+
+SalomeApp_Engine_i* SalomeApp_Engine_i::myInstance = NULL;
+
+SalomeApp_Engine_i::SalomeApp_Engine_i()
+{
+  myInstance = this;
+}
+
+SalomeApp_Engine_i::~SalomeApp_Engine_i()
+{
+}
+
+SALOMEDS::TMPFile* SalomeApp_Engine_i::Save (SALOMEDS::SComponent_ptr theComponent,
+                                             const char* theURL,
+                                             bool isMultiFile)
+{
+  SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile;
+
+  cout << "SalomeApp_Engine_i::Save() isMultiFile = " << isMultiFile << endl;
+  if (CORBA::is_nil(theComponent) || CORBA::is_nil(theComponent->GetStudy()))
+    return aStreamFile._retn();
+
+  const int studyId = theComponent->GetStudy()->StudyId();
+  cout << "SalomeApp_Engine_i::Save() - studyId = " << studyId << endl;
+
+  // Get a temporary directory to store a file
+  //std::string aTmpDir = isMultiFile ? theURL : SALOMEDS_Tool::GetTmpDir();
+
+  if (myMap.count(studyId)) {
+    cout << "SalomeApp_Engine_i::Save() - myMap.count(studyId)" << endl;
+    MapOfListOfFiles mapOfListOfFiles = myMap[studyId];
+    std::string componentName (theComponent->ComponentDataType());
+    cout << "SalomeApp_Engine_i::Save() - componentName = " << componentName << endl;
+    ListOfFiles listOfFiles = mapOfListOfFiles[componentName];
+
+    // listOfFiles must contain temporary directory name in its first item
+    // and names of files (relatively the temporary directory) in the others
+    const int n = listOfFiles.size() - 1;
+
+    if (n > 0) { // there are some files, containing persistent data of the component
+      std::string aTmpDir = listOfFiles[0];
+      cout << "SalomeApp_Engine_i::Save() - aTmpDir = " << aTmpDir << endl;
+
+      // Create a list to store names of created files
+      SALOMEDS::ListOfFileNames_var aSeq = new SALOMEDS::ListOfFileNames;
+      aSeq->length(n);
+      for (int i = 0; i < n; i++)
+        aSeq[i] = CORBA::string_dup(listOfFiles[i + 1].c_str());
+
+      // Convert a file to the byte stream
+      aStreamFile = SALOMEDS_Tool::PutFilesToStream(aTmpDir.c_str(), aSeq.in(), isMultiFile);
+
+      // Remove the files and tmp directory, created by the component storage procedure
+      if (!isMultiFile) SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.c_str(), aSeq.in(), true);
+    }
+  }
+
+  return aStreamFile._retn();
+}
+
+CORBA::Boolean SalomeApp_Engine_i::Load (SALOMEDS::SComponent_ptr theComponent,
+                                         const SALOMEDS::TMPFile& theFile,
+                                         const char* theURL,
+                                         bool isMultiFile)
+{
+  cout << "SalomeApp_Engine_i::Load() isMultiFile = " << isMultiFile << endl;
+  if (CORBA::is_nil(theComponent) || CORBA::is_nil(theComponent->GetStudy()))
+    return false;
+
+  const int studyId = theComponent->GetStudy()->StudyId();
+
+  // Create a temporary directory for the component's data files
+  std::string aTmpDir = isMultiFile ? theURL : SALOMEDS_Tool::GetTmpDir();
+
+  // Convert the byte stream theStream to a files and place them in the tmp directory.
+  // The files and temporary directory must be deleted by the component loading procedure.
+  SALOMEDS::ListOfFileNames_var aSeq =
+    SALOMEDS_Tool::PutStreamToFiles(theFile, aTmpDir.c_str(), isMultiFile);
+
+  // Store list of file names to be used by the component loading procedure
+  const int n = aSeq->length() + 1;
+  ListOfFiles listOfFiles (n);
+  listOfFiles[0] = aTmpDir;
+  for (int i = 1; i < n; i++)
+    listOfFiles[i] = std::string(aSeq[i - 1]);
+
+  //MapOfListOfFiles mapOfListOfFiles;
+  //if (myMap.count(studyId))
+  //  mapOfListOfFiles = myMap[studyId];
+  //std::string componentName (theComponent->ComponentDataType());
+  //mapOfListOfFiles[componentName] = listOfFiles;
+  //myMap[studyId] = mapOfListOfFiles;
+
+  SetListOfFiles(listOfFiles, studyId, theComponent->ComponentDataType());
+
+  return true;
+}
+
+SalomeApp_Engine_i::ListOfFiles SalomeApp_Engine_i::GetListOfFiles (const int theStudyId,
+                                                                    const char* theComponentName)
+{
+  ListOfFiles aListOfFiles;
+
+  if (myMap.count(theStudyId))
+  {
+    MapOfListOfFiles mapOfListOfFiles = myMap[theStudyId];
+    std::string componentName (theComponentName);
+    if (mapOfListOfFiles.count(componentName))
+      aListOfFiles = mapOfListOfFiles[componentName];
+  }
+
+  return aListOfFiles;
+}
+
+void SalomeApp_Engine_i::SetListOfFiles (const ListOfFiles theListOfFiles,
+                                         const int   theStudyId,
+                                         const char* theComponentName)
+{
+  //if (!myMap.count(theStudyId)) {
+  //  MapOfListOfFiles mapOfListOfFiles;
+  //  myMap[theStudyId] = mapOfListOfFiles;
+  //}
+
+  MapOfListOfFiles& mapOfListOfFiles = myMap[theStudyId];
+  std::string componentName (theComponentName);
+  mapOfListOfFiles[componentName] = theListOfFiles;
+}
+
+SalomeApp_Engine_i* SalomeApp_Engine_i::GetInstance()
+{
+  return myInstance;
+}
diff --git a/src/Session/SalomeApp_Engine_i.hxx b/src/Session/SalomeApp_Engine_i.hxx
new file mode 100755 (executable)
index 0000000..b3c79a1
--- /dev/null
@@ -0,0 +1,99 @@
+//  SalomeApp_Engine_i : implementation of SalomeApp_Engine.idl
+//
+//  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 
+//
+//
+//
+//  File   : SalomeApp_Engine_i.hxx
+//  Author : Alexander SLADKOV
+//  Module : SALOME
+//  $Header$
+
+#ifndef _SALOMEAPP_ENGINE_I_HXX_
+#define _SALOMEAPP_ENGINE_I_HXX_
+
+#include "SALOME_Component_i.hxx"
+
+#include <vector> 
+#include <map> 
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SalomeApp_Engine)
+
+#ifdef WNT
+#include <SALOME_WNT.hxx>
+#else
+#define SALOME_WNT_EXPORT
+#endif
+
+class SALOME_WNT_EXPORT SalomeApp_Engine_i: public POA_SalomeApp::Engine,
+                          public Engines_Component_i
+{
+public:
+  SalomeApp_Engine_i();
+  ~SalomeApp_Engine_i();
+
+  SALOMEDS::TMPFile*      Save( SALOMEDS::SComponent_ptr theComponent, 
+                               const char* theURL, 
+                               bool isMultiFile );
+
+  CORBA::Boolean          Load( SALOMEDS::SComponent_ptr theComponent, 
+                               const SALOMEDS::TMPFile& theFile, 
+                               const char* theURL, 
+                               bool isMultiFile );
+
+public:
+  typedef std::vector<std::string> ListOfFiles;
+
+  ListOfFiles             GetListOfFiles (const int         theStudyId, 
+                                          const char*       theComponentName);
+
+  void                    SetListOfFiles (const ListOfFiles theListOfFiles,
+                                          const int         theStudyId, 
+                                          const char*       theComponentName);
+
+  static SalomeApp_Engine_i* GetInstance();
+
+public:
+  // methods from SALOMEDS::Driver without implementation.  Must be redefined because 
+  // there is no default implementation of SALOMEDS::Driver interface
+  SALOMEDS::TMPFile* SaveASCII( SALOMEDS::SComponent_ptr, const char*, bool )                                                                        {return 0;}
+  CORBA::Boolean LoadASCII( SALOMEDS::SComponent_ptr, const SALOMEDS::TMPFile&, const char*, bool )                                                  {return 0;}
+  void Close( SALOMEDS::SComponent_ptr )                                                                                                             {}
+  char* ComponentDataType()                                                                                                                          {return 0;}
+  char* IORToLocalPersistentID( SALOMEDS::SObject_ptr, const char*, CORBA::Boolean,  CORBA::Boolean )                                                {return 0;}
+  char* LocalPersistentIDToIOR( SALOMEDS::SObject_ptr, const char*, CORBA::Boolean,  CORBA::Boolean )                                                {return 0;}
+  bool CanPublishInStudy( CORBA::Object_ptr )                                                                                                        {return 0;}
+  SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr, CORBA::Object_ptr, const char* ) throw (SALOME::SALOME_Exception) {return 0;}
+  CORBA::Boolean CanCopy( SALOMEDS::SObject_ptr )                                                                                                    {return 0;}
+  SALOMEDS::TMPFile* CopyFrom( SALOMEDS::SObject_ptr, CORBA::Long& )                                                                                 {return 0;}
+  CORBA::Boolean CanPaste( const char*, CORBA::Long )                                                                                                {return 0;}
+  SALOMEDS::SObject_ptr PasteInto( const SALOMEDS::TMPFile&, CORBA::Long, SALOMEDS::SObject_ptr )                                                    {return 0;}
+
+private:
+  typedef std::map<std::string, ListOfFiles> MapOfListOfFiles;
+  typedef std::map<int, MapOfListOfFiles>    MapOfMapOfListOfFiles;
+  MapOfMapOfListOfFiles                      myMap;
+
+  static SalomeApp_Engine_i* myInstance;
+};
+
+#endif
+
diff --git a/src/Session/Session_ServerLauncher.hxx b/src/Session/Session_ServerLauncher.hxx
new file mode 100755 (executable)
index 0000000..8791b66
--- /dev/null
@@ -0,0 +1,96 @@
+//  SALOME Session : implementation of Session_ServerLauncher.hxx
+//
+//  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 
+//
+//
+//
+//  File   : Session_ServerLauncher.hxx
+//  Author : Paul RASCLE, EDF
+//  Module : SALOME
+//  $Header$
+
+#ifndef _SESSION_SERVERLAUNCHER_HXX_
+#define _SESSION_SERVERLAUNCHER_HXX_
+
+#include "Session_ServerThread.hxx"
+
+#include <CORBA.h> 
+#include <list>
+#include <vector>
+#include <string>
+#include <qthread.h>
+#include <qwaitcondition.h>
+
+
+#ifdef WNT
+#include <SALOME_WNT.hxx>
+#else
+#define SALOME_WNT_EXPORT
+#endif
+
+using namespace std;
+
+class ServArg
+  {
+  public:
+    int _servType;
+    int _firstArg;
+    int _lastArg;
+    inline ServArg(int servType=0, int firstArg=0, int lastArg=0);
+};
+
+inline ServArg::ServArg(int servType, int firstArg, int lastArg):
+  _servType(servType),_firstArg(firstArg),_lastArg(lastArg)
+{}
+
+class SALOME_WNT_EXPORT Session_ServerLauncher: public QThread
+{
+public:
+  Session_ServerLauncher();
+  Session_ServerLauncher(int argc,
+                        char ** argv, 
+                        CORBA::ORB_ptr orb, 
+                        PortableServer::POA_ptr poa,
+                        QMutex *GUIMutex,
+                        QWaitCondition *ServerLaunch,
+                        QWaitCondition *SessionStarted);
+  virtual ~Session_ServerLauncher();
+  void run();
+  void KillAll();
+
+protected:
+  void CheckArgs();
+  void ActivateAll();
+
+private:
+  int _argc;
+  char ** _argv;
+  CORBA::ORB_var _orb;
+  PortableServer::POA_var _root_poa;
+  QMutex* _GUIMutex;
+  QWaitCondition *_ServerLaunch;
+  QWaitCondition *_SessionStarted;
+  list<ServArg> _argServToLaunch;
+  vector<string> _argCopy;
+  list<Session_ServerThread*> _serverThreads;
+};
+
+#endif
+
diff --git a/src/TOOLSGUI/ToolsGUI.cxx b/src/TOOLSGUI/ToolsGUI.cxx
new file mode 100755 (executable)
index 0000000..ac2ca02
--- /dev/null
@@ -0,0 +1,84 @@
+//  SALOME TOOLSGUI : implementation of desktop "Tools" optioins
+//
+//  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 
+//
+//
+//
+//  File   : ToolsGUI.cxx
+//  Author : Nicolas REJNERI
+//  Module : SALOME
+//  $Header$
+
+#include "ToolsGUI.h"
+
+//=======================================================================
+// name    : GetVisibility
+// Purpose : Verify whether object is visible or not
+//=======================================================================
+bool ToolsGUI::GetVisibility( _PTR(Study)   theStudy,
+                              _PTR(SObject) theObj,
+                              void*         theId )
+{
+  _PTR(GenericAttribute) anAttr;
+  if ( theObj && theObj->FindAttribute( anAttr, "AttributeGraphic" ) )
+  {
+    _PTR(AttributeGraphic) aGraphic (anAttr);
+    return aGraphic->GetVisibility( (unsigned long)theId );
+  }
+
+  return false;
+}
+
+//=======================================================================
+// name    : SetVisibility
+// Purpose : Set flag visibility of object
+//=======================================================================
+bool ToolsGUI::SetVisibility( _PTR(Study) theStudy,
+                              const char* theEntry,
+                              const bool  theValue,
+                              void*       theId )
+{
+  _PTR(SObject) anObj ( theStudy->FindObjectID( theEntry ) );
+
+  if ( anObj )
+  {
+    _PTR(GenericAttribute) aGAttr;
+    if ( anObj->FindAttribute( aGAttr, "AttributeGraphic" ) )
+    {
+      _PTR(AttributeGraphic) anAttr ( aGAttr );
+      anAttr->SetVisibility( (unsigned long)theId, theValue );
+    }
+    else if ( theValue )
+    {
+      _PTR(StudyBuilder) aBuilder (theStudy->NewBuilder());
+      _PTR(AttributeGraphic) anAttr (aBuilder->FindOrCreateAttribute(anObj, "AttributeGraphic"));
+      anAttr->SetVisibility( (unsigned long)theId, theValue );
+    }
+    return true;
+  }
+
+  return false;
+}
+
+
+
+
+
+
diff --git a/src/TOOLSGUI/ToolsGUI.h b/src/TOOLSGUI/ToolsGUI.h
new file mode 100755 (executable)
index 0000000..cb54ffd
--- /dev/null
@@ -0,0 +1,52 @@
+//  SALOME TOOLSGUI : implementation of desktop "Tools" optioins
+//
+//  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 
+//
+//
+//
+//  File   : ToolsGUI.h
+//  Author : Nicolas REJNERI
+//  Module : SALOME
+//  $Header$
+
+#ifndef ToolsGUI_HeaderFile
+#define ToolsGUI_HeaderFile
+
+#include "utilities.h"
+
+#ifndef _Standard_HeaderFile
+#include <Standard.hxx>
+#endif
+
+#include "SALOMEDSClient.hxx"
+
+class Standard_EXPORT ToolsGUI  
+{
+public :
+  static bool               GetVisibility( _PTR(Study)   theStudy,
+                                           _PTR(SObject) theObj,
+                                           void*         theId );
+  static bool               SetVisibility( _PTR(Study) theStudy,
+                                           const char* theEntry,
+                                           const bool  theValue,
+                                           void*       theId );
+};
+
+#endif
diff --git a/src/TOOLSGUI/ToolsGUI_CatalogGeneratorDlg.h b/src/TOOLSGUI/ToolsGUI_CatalogGeneratorDlg.h
new file mode 100755 (executable)
index 0000000..5da0d5c
--- /dev/null
@@ -0,0 +1,85 @@
+//  SALOME TOOLSGUI : implementation of desktop "Tools" optioins
+//
+//  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 
+//
+//
+//
+//  File   : ToolsGUI_CatalogGeneratorDlg.h
+//  Author : Nicolas REJNERI
+//  Module : SALOME
+//  $Header$
+
+#ifndef DIALOGBOX_TOOLSGUI_CATALOGGENERATORDLG_H
+#define DIALOGBOX_TOOLSGUI_CATALOGGENERATORDLG_H
+
+#include <qdialog.h>
+
+#include <Standard_Macro.hxx>
+
+class QLineEdit;
+class QPushButton;
+
+//=================================================================================
+// class    : ToolsGUI_CatalogGeneratorDlg
+// purpose  :
+//=================================================================================
+class Standard_EXPORT ToolsGUI_CatalogGeneratorDlg : public QDialog
+{ 
+    Q_OBJECT
+
+public:
+    ToolsGUI_CatalogGeneratorDlg( QWidget* parent = 0, const char* name = 0 );
+    ~ToolsGUI_CatalogGeneratorDlg();
+
+    QString getIdlPath();
+    QString getIdlFile();
+    QString getXmlFile();
+    QString getPngFile();
+    QString getAuthor();
+    QString getVersion();
+    QString getCompName();
+    QString getCompUserName();
+    QString getCompType();
+    QString getCompMultiStd();
+
+protected slots:
+    void    onBrowseBtnClicked();
+    void    updateButtonState();
+    void    onApply();
+
+private:
+    QLineEdit*     myIdlEdit;
+    QLineEdit*     myXmlEdit;
+    QLineEdit*     myPngEdit;
+    QLineEdit*     myVersionEdit;
+    QLineEdit*     myAuthorEdit;
+    QLineEdit*     myCompName;
+    QLineEdit*     myCompUserName;
+    QLineEdit*     myCompType;
+    QLineEdit*     myCompMultiStd;
+    QPushButton*   myBrowseIdlBtn;
+    QPushButton*   myBrowseXmlBtn;
+    QPushButton*   myBrowsePngBtn;
+
+    QPushButton*   myApplyBtn;
+    QPushButton*   myCloseBtn;
+};
+
+#endif // DIALOGBOX_TOOLSGUI_CATALOGGENERATORDLG_H
diff --git a/src/TOOLSGUI/ToolsGUI_HelpWindow.cxx b/src/TOOLSGUI/ToolsGUI_HelpWindow.cxx
new file mode 100755 (executable)
index 0000000..bd1ed42
--- /dev/null
@@ -0,0 +1,102 @@
+//  SALOME RegistryDisplay : GUI for Registry server implementation
+//
+//  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 
+//
+//
+//
+//  File   : ToolsGUI_HelpWindow.cxx
+//  Author : Pascale NOYRET, EDF
+//  Module : SALOME
+//  $Header$
+
+# include "ToolsGUI_HelpWindow.h"
+# include "utilities.h"
+
+# include <qtextview.h>
+# include <qpushbutton.h>
+# include <qtextstream.h> 
+# include <qfile.h> 
+
+using namespace std;
+
+ToolsGUI_HelpWindow::ToolsGUI_HelpWindow(QWidget* parent, const char* name ) 
+     : QMainWindow( parent, name, WType_TopLevel | WDestructiveClose )
+{
+  BEGIN_OF("Constructeur ToolsGUI_HelpWindow");
+  
+  setCaption( tr( "Help" ) );
+
+  myTextView = new QTextView( this, "myTextView" );
+  QPalette pal = myTextView->palette();
+  QColorGroup cg = pal.active();
+  cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) );
+  cg.setColor( QColorGroup::HighlightedText, Qt::white );
+  cg.setColor( QColorGroup::Base, QColor( 255,255,220 )  ); 
+  cg.setColor( QColorGroup::Text, Qt::black );
+  pal.setActive  ( cg );
+  cg = pal.inactive();
+  cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) );
+  cg.setColor( QColorGroup::HighlightedText, Qt::white );
+  cg.setColor( QColorGroup::Base, QColor( 255,255,220 )  ); 
+  cg.setColor( QColorGroup::Text, Qt::black );
+  pal.setInactive( cg );
+  cg = pal.disabled();
+  cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) );
+  cg.setColor( QColorGroup::HighlightedText, Qt::white );
+  cg.setColor( QColorGroup::Base, QColor( 255,255,220 )  ); 
+  cg.setColor( QColorGroup::Text, Qt::black );
+  pal.setDisabled( cg );
+  myTextView->setPalette( pal );
+  
+  setCentralWidget( myTextView );
+  setMinimumSize( 450, 250 );
+
+  QFile f ( "tmp.txt" );
+  if ( f.open( IO_ReadOnly ) )   
+    {
+      QTextStream t( &f ); 
+      while ( !t.eof() ) 
+       {
+         myTextView->append(t.readLine());
+       }
+    }
+  f.close();
+
+  END_OF("Constructeur ToolsGUI_HelpWindow");
+}
+
+/*!
+  Destructor
+*/
+ToolsGUI_HelpWindow::~ToolsGUI_HelpWindow()
+{
+  BEGIN_OF("Destructeur ToolsGUI_HelpWindow");
+  END_OF("Destructeur ToolsGUI_HelpWindow");
+};
+
+/*!
+  Sets text
+*/
+void ToolsGUI_HelpWindow::setText( const QString& text )
+{
+  myTextView->setText( text );
+}
+
+
diff --git a/src/TOOLSGUI/ToolsGUI_HelpWindow.h b/src/TOOLSGUI/ToolsGUI_HelpWindow.h
new file mode 100755 (executable)
index 0000000..22c06ca
--- /dev/null
@@ -0,0 +1,51 @@
+//  SALOME RegistryDisplay : GUI for Registry server implementation
+//
+//  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 
+//
+//
+//
+//  File   : HelpWindow.hxx
+//  Author : Pascale NOYRET, EDF
+//  Module : SALOME
+//  $Header$
+
+# ifndef __HELPWINDOW_H__
+# define __HELPWINDOW_H__
+
+# include <qapplication.h>
+# include <qmainwindow.h>
+
+class QTextView;
+
+class ToolsGUI_HelpWindow : public QMainWindow
+{
+public:
+  ToolsGUI_HelpWindow( QWidget* parent = 0, const char* name = 0);
+  ~ToolsGUI_HelpWindow();
+
+  void setText( const QString& text );
+  QTextView* textView() const { return myTextView; }
+
+private:
+  QTextView* myTextView;
+};
+# endif         /* __HELPWINDOW_H__ */
+
+
diff --git a/src/TOOLSGUI/ToolsGUI_IntervalWindow.cxx b/src/TOOLSGUI/ToolsGUI_IntervalWindow.cxx
new file mode 100755 (executable)
index 0000000..04d96c0
--- /dev/null
@@ -0,0 +1,107 @@
+//  SALOME RegistryDisplay : GUI for Registry server implementation
+//
+//  Copyright (C) 2003  CEA/DEN, EDF R&D
+//
+//
+//
+//  File   : ToolsGUI_IntervalWindow.cxx
+//  Author : Oksana TCHEBANOVA
+//  Module : SALOME
+
+#include "ToolsGUI_IntervalWindow.h"
+
+#include <qbuttongroup.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qlayout.h>
+# include "utilities.h"
+
+#define MARGIN_SIZE      11
+#define SPACING_SIZE      6
+#define MIN_SPIN_WIDTH  100 
+
+ToolsGUI_IntervalWindow::ToolsGUI_IntervalWindow ( QWidget* parent )
+     : QDialog( parent, "ToolsGUI_IntervalWindow" , true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
+{
+  BEGIN_OF("ToolsGUI_IntervalWindow constructor")
+  setCaption( tr( "Refresh Interval"  ) );
+  setSizeGripEnabled( true );
+
+  QGridLayout* topLayout = new QGridLayout( this );
+  topLayout->setSpacing( SPACING_SIZE );
+  topLayout->setMargin( MARGIN_SIZE );
+
+  QGroupBox* intervalGrp = new QGroupBox( this, "intervalGrp" );
+  intervalGrp->setColumnLayout( 0, Qt::Horizontal );//Vertical
+  intervalGrp->layout()->setSpacing( 0 );
+  intervalGrp->layout()->setMargin( 0 );
+  QGridLayout* intervalGrpLayout = new QGridLayout( intervalGrp->layout() );
+  intervalGrpLayout->setAlignment( Qt::AlignTop );
+  intervalGrpLayout->setSpacing( SPACING_SIZE );
+  intervalGrpLayout->setMargin( MARGIN_SIZE  );  
+
+  QHBoxLayout* aBtnLayout = new QHBoxLayout;
+  aBtnLayout->setSpacing( SPACING_SIZE );
+  aBtnLayout->setMargin( 0 );
+
+  myButtonOk = new QPushButton( this, "buttonOk" );
+  myButtonOk->setText( tr( "BUT_OK"  ) );
+  myButtonOk->setAutoDefault( TRUE );
+  myButtonOk->setDefault( TRUE );
+  
+  myButtonCancel = new QPushButton( this, "buttonCancel" );
+  myButtonCancel->setText( tr( "BUT_CANCEL"  ) );
+  myButtonCancel->setAutoDefault( TRUE );
+
+  QLabel* TextLabel = new QLabel( intervalGrp, "TextLabel" );
+  TextLabel->setText( tr( "Please, enter a number of seconds:"  ) );
+
+  mySpinBox = new QSpinBox( 1, 999999999, 1, intervalGrp, "SpinBox" );
+  mySpinBox->setValue( 100 );
+  mySpinBox->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
+  mySpinBox->setMinimumWidth(MIN_SPIN_WIDTH);
+
+  intervalGrpLayout->addWidget(TextLabel, 0, 0);
+  intervalGrpLayout->addWidget(mySpinBox, 0, 1);
+
+  aBtnLayout->addWidget( myButtonOk );
+  aBtnLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
+  aBtnLayout->addWidget( myButtonCancel );
+
+  topLayout->addWidget( intervalGrp, 0, 0 );
+  topLayout->addLayout( aBtnLayout, 1, 0 ); 
+
+  END_OF("ToolsGUI_IntervalWindow constructor")
+}
+ToolsGUI_IntervalWindow::~ToolsGUI_IntervalWindow() {}
+/* 
+   Sets start interval size
+*/
+void ToolsGUI_IntervalWindow::setValue(const int size)
+{
+  mySpinBox->setValue(size);
+}
+
+/*
+   Gets interval size
+*/
+int ToolsGUI_IntervalWindow::getValue()
+{
+  return mySpinBox->value();
+}
+
+/*
+   gets a pointer to myButtonOk
+*/
+QPushButton* ToolsGUI_IntervalWindow::Ok()
+{
+  return myButtonOk;
+}
+
+/*
+   gets a pointer to myButtonCancel
+*/
+QPushButton* ToolsGUI_IntervalWindow::Cancel()
+{
+  return myButtonCancel;
+}
diff --git a/src/TOOLSGUI/ToolsGUI_IntervalWindow.h b/src/TOOLSGUI/ToolsGUI_IntervalWindow.h
new file mode 100755 (executable)
index 0000000..40c1f1a
--- /dev/null
@@ -0,0 +1,41 @@
+//  SALOME RegistryDisplay : GUI for Registry server implementation
+//
+//  Copyright (C) 2003  CEA/DEN, EDF R&D
+//
+//
+//
+//  File   : IntervalWindow.hxx
+//  Author : Oksana TCHEBANOVA
+//  Module : SALOME
+
+#ifndef IntervalWindow_HeaderFile
+#define IntervalWindow_HeaderFile
+
+# include <qwidget.h>
+# include <qdialog.h>
+# include <qpushbutton.h>
+# include <qspinbox.h>
+
+#ifndef WNT
+using namespace std;
+#endif
+
+class ToolsGUI_IntervalWindow : public QDialog
+{
+public:
+  ToolsGUI_IntervalWindow( QWidget* parent = 0 );
+  ~ToolsGUI_IntervalWindow();
+  
+  QPushButton* Ok();
+  QPushButton* Cancel();
+
+  int getValue();
+  void setValue( int );
+
+private:
+  QSpinBox* mySpinBox;
+  QPushButton* myButtonOk;
+  QPushButton* myButtonCancel;
+};
+
+#endif
diff --git a/src/TOOLSGUI/ToolsGUI_RegWidget.cxx b/src/TOOLSGUI/ToolsGUI_RegWidget.cxx
new file mode 100755 (executable)
index 0000000..b36f8fd
--- /dev/null
@@ -0,0 +1,810 @@
+//  SALOME RegistryDisplay : GUI for Registry server implementation
+//
+//  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 
+//
+//
+//
+//  File   : ToolsGUI_RegWidget.cxx
+//  Author : Pascale NOYRET, EDF
+//  Module : SALOME
+//  $Header$
+
+# include <qpushbutton.h>
+# include <qlistview.h>
+# include <qtabwidget.h> 
+# include <qstatusbar.h>
+# include <qtextview.h>
+# include <qtimer.h>
+# include <qinputdialog.h>
+# include <qtoolbar.h>
+# include <qdir.h>
+# include <qtooltip.h>
+
+# include "SALOME_NamingService.hxx"
+# include "ServiceUnreachable.hxx"
+# include "Utils_SINGLETON.hxx"
+# include "Utils_CommException.hxx"
+
+# include "utilities.h"
+# include "OpUtil.hxx"
+
+# include "ToolsGUI_RegWidget.h"
+# include "ToolsGUI_HelpWindow.h"
+# include "ToolsGUI_IntervalWindow.h"
+
+# include "Qtx.h"
+
+using namespace std;
+
+typedef int PIXELS;
+ToolsGUI_RegWidget* ToolsGUI_RegWidget::myRegWidgetPtr = 0;
+
+QString addSlash( const QString& );
+QString findFile( QString filename );
+
+#define BOLD( text ) ( QString( "<b>" ) + QString( text ) + QString( "</b>" ) )
+
+static const char* const time_data[] = { 
+"16 16 6 1",
+". c None",
+"b c None",
+"# c #000000",
+"a c #4c4c4c",
+"d c #878787",
+"c c #ffffff",
+".....#####ab....",
+"...##cc#dc##ab..",
+"..#ccc###dcc#ab.",
+".#ccccc#dcccc#a.",
+".#ccccc#dcccc#ab",
+"#cccccc#dccccc#a",
+"#cccccc#dccc#c#a",
+"#c##ccc########a",
+"#ccddcccdddd#d#a",
+"#cccccccccccdc#a",
+".#ccccccccccc#aa",
+".#ccccc#ccccc#a.",
+"..#cccc#dccc#aa.",
+"...##cccdc##aa..",
+".....#####aaa...",
+"......aaaaa....."};
+
+static const char* const close_data[] = { 
+"16 16 6 1",
+"d c None",
+". c None",
+"# c #000000",
+"a c #4c4c4c",
+"c c #5b5b5b",
+"b c #ffffff",
+".....#####a.....",
+"...##bbbbb##a...",
+"..#bbbbbbbbb#a..",
+".#b#cbbbbbb#d#a.",
+".#bc#cbbbb#cb#a.",
+"#bbbc#cbb#cbbb#a",
+"#bbbbc#c#cbbbb#a",
+"#bbbbbc#cbbbbb#a",
+"#bbbbc#c#cbbbb#a",
+"#bbb#ccbb##bbb#a",
+".#b#c#bbbbc#b#aa",
+".#bc#bbbbbb#c#a.",
+"..#bbbbbbbbb#aa.",
+"...##bbbbb##aa..",
+".....#####aaa...",
+"......aaaaa....."};
+
+static const char* const refresh_data[] = { 
+"16 16 5 1",
+". c None",
+"# c #000000",
+"a c #4c4c4c",
+"c c #878787",
+"b c #ffffff",
+".....#####a.....",
+"...##bb#bb##a...",
+"..#bbbbc#bbb#a..",
+".#bbbb####cbb#a.",
+".#bbb#cc#cbbb#a.",
+"#bbb#cb#cbbbbb#a",
+"#bb#cbbbbbb#bb#a",
+"#bb#cbbbbbb#cb#a",
+"#bb#cbbbbbb#cb#a",
+"#bbbbbb#bb#cbb#a",
+".#bbbb#cb#cbb#aa",
+".#bbb####cbbb#a.",
+"..#bbb#cbbbb#aa.",
+"...##bb#cb##aa..",
+".....#####aaa...",
+"......aaaaa....."};
+
+/*!
+  Creates components list
+*/
+
+Registry::Components_var MakeRegistry( CORBA::ORB_var &orb )
+{
+
+  const char *registryName="Registry" ;
+  
+  SALOME_NamingService &naming = *SINGLETON_<SALOME_NamingService>::Instance() ;
+  naming.init_orb( orb ) ;
+  
+  // Recuperation de la reference de l'objet
+  CORBA::Object_var object = 0 ;
+  try
+    {
+      SCRUTE(registryName) ;
+      object = naming.Resolve( registryName ) ;
+      if(CORBA::is_nil(object)) throw CommException( "unable to find the RegistryService" ) ;
+    }
+  catch( const ServiceUnreachable &ex )
+    {
+      MESSAGE( ex.what() )
+      exit( EXIT_FAILURE ) ;
+    }
+  catch( const CORBA::Exception &exx )
+    {
+      exit( EXIT_FAILURE ) ;
+    }
+  
+  // Specialisation de l'objet generique
+  
+  return Registry::Components::_narrow( object ) ;
+}
+
+/*!
+  Only one global registry window should exist at the moment
+  This method creates registry window if necessary and returns it
+  [ static ] 
+*/
+ToolsGUI_RegWidget* ToolsGUI_RegWidget::GetRegWidget( CORBA::ORB_var &orb , QWidget *parent, const char *name )
+{
+  if ( !myRegWidgetPtr ) 
+    myRegWidgetPtr = new ToolsGUI_RegWidget( orb, parent, name );
+  return myRegWidgetPtr;
+}
+
+/*!
+  Constructor  
+*/
+ToolsGUI_RegWidget::ToolsGUI_RegWidget(CORBA::ORB_var &orb, QWidget *parent, const char *name ) 
+     : QMainWindow( parent, name, WType_TopLevel | WDestructiveClose ),
+       _VarComponents( MakeRegistry(orb) ),
+       _clients(0), _history(0), _parent( parent ),
+       _tabWidget(0), _refresh(0), _interval(0),
+       myInfoWindow(0), myHelpWindow(0), myIntervalWindow(0)
+{
+   QString aFile = findFile("default.png");
+ /* char* dir = getenv( "CSF_ResourcesDefaults" );
+  QString path( "" );
+  if ( dir ) {
+    QDir qDir( dir );
+    path = qDir.filePath( "default.png" );
+  }*/
+  QPixmap pm ( aFile );
+  if ( !pm.isNull() )
+    setIcon( pm );
+
+  // pixmap for buttons
+  QPixmap image_refresh ( ( const char** ) refresh_data );
+  QPixmap image_interval( ( const char** ) time_data );
+  QPixmap image_close   ( ( const char** ) close_data );
+
+  // Buttons definition
+  QToolBar* topbar = new QToolBar( tr("Toolbar"), this );
+  setDockEnabled( topbar, DockTornOff, false );
+  setDockMenuEnabled( false );
+
+  _refresh = new QPushButton( tr( "Refresh" ), topbar );
+  _refresh->setIconSet( image_refresh );
+  _refresh->setFocusPolicy( NoFocus );
+  connect( _refresh, SIGNAL( clicked() ), this, SLOT( slotListeSelect() ) );
+  QToolTip::add( _refresh, "", toolTipGroup(), tr("Immediately updates list of components") );
+  
+  /* PAL5540 - this button is needless
+  QPushButton* help = new QPushButton( tr( "Help" ), topbar );
+  connect( help, SIGNAL( clicked() ), this, SLOT( slotHelp() ) );
+  QToolTip::add( help, "", toolTipGroup(), tr("Opens Help window") );
+  */
+  
+  _interval = new QPushButton( tr( "Interval" ), topbar );
+  _interval->setIconSet( image_interval );
+  _interval->setFocusPolicy( NoFocus );
+  connect( _interval, SIGNAL( clicked() ), this, SLOT( slotSelectRefresh() ) );
+  QToolTip::add( _interval, "", toolTipGroup(), tr("Changes refresh interval") );
+  
+  topbar->addSeparator();
+  _close = new QPushButton( tr("Close"), topbar );
+  _close->setIconSet( image_close );
+  _close->setFocusPolicy( NoFocus );
+  connect( _close, SIGNAL( clicked() ), this, SLOT( close() ) );
+  QToolTip::add( _close, "", toolTipGroup(), tr("Closes Registry window") );
+  
+  // Display area and associated slots definition
+  _tabWidget = new QTabWidget( this );
+  _clients   = new QListView( _tabWidget );
+  SetListe();
+  _history   = new QListView( _tabWidget );
+  SetListeHistory();
+  
+  _tabWidget->addTab( _clients, tr( "Running" ) );
+  _tabWidget->addTab( _history, tr( "History" ) );
+  connect( _tabWidget, SIGNAL( currentChanged( QWidget* )), this, SLOT( slotListeSelect() ) );
+  connect( _clients,   SIGNAL( clicked( QListViewItem* ) ),        this, SLOT( slotClientChanged( QListViewItem* ) ) );
+  connect( _history,   SIGNAL( clicked( QListViewItem* ) ),        this, SLOT( slotHistoryChanged( QListViewItem* ) ) );
+  setCentralWidget( _tabWidget );
+  
+  // Timer definition (used to automaticaly refresh the display area)
+  _counter = new QTimer( this );
+  connect( _counter, SIGNAL( timeout() ), this, SLOT( slotListeSelect() ) );
+  myRefreshInterval = 10;
+  _counter->start( myRefreshInterval * 1000 );
+  
+  PIXELS xpos    = 160 ;
+  PIXELS ypos    = 100 ;
+  PIXELS largeur = 800 ;
+  PIXELS hauteur = 350 ;
+  setGeometry( xpos, ypos, largeur, hauteur ) ;
+  setCaption( name ) ;
+  statusBar()->message("    ");
+}
+
+/*!
+  Destructor
+*/
+ToolsGUI_RegWidget::~ToolsGUI_RegWidget()
+{
+  MESSAGE("Debut du Destructeur");
+  _counter->stop();
+  myRegWidgetPtr = 0;
+};
+
+/*!
+  Event filter
+*/
+bool ToolsGUI_RegWidget::eventFilter( QObject* object, QEvent* event )
+{
+  if ( object ) {
+    if ( object == myHelpWindow && event->type() == QEvent::Close ) {
+      myHelpWindow = 0;
+    }
+    else if ( object == myInfoWindow && event->type() == QEvent::Close ) {
+      myInfoWindow = 0;
+    }
+    else if ( object == myIntervalWindow && event->type() == QEvent::Close ) {
+      myIntervalWindow = 0;
+    }
+    else if ( object == _clients && event->type() == QEvent::KeyPress ) {
+      QKeyEvent* ke = (QKeyEvent*)event;
+      if ( ke->key() == Key_Enter || ke->key() == Key_Return ) {
+       slotClientChanged( _clients->currentItem() );
+      }
+    }
+    else if ( object == _history && event->type() == QEvent::KeyPress ) {
+      QKeyEvent* ke = (QKeyEvent*)event;
+      if ( ke->key() == Key_Enter || ke->key() == Key_Return ) {
+       slotHistoryChanged( _history->currentItem() );
+      }
+    }
+  }
+  return QMainWindow::eventFilter( object, event );
+}
+
+/*!
+  Searches item in the list and returns it's index or -1 if not found
+*/
+int ToolsGUI_RegWidget::numitem(const QString &name, const QString &pid, const QString &machine,const Registry::AllInfos *listclient)
+{
+  BEGIN_OF("numitem");
+  for (CORBA::ULong i=0; i<listclient->length(); i++)
+    {       
+      const Registry::Infos & c_info=(*listclient)[i];
+      ASSERT( c_info.name!=NULL);
+      QString b;
+      b.setNum(int(c_info.pid));
+      if ( (name.compare(QString(c_info.name)) == 0) && 
+         (machine.compare(QString(c_info.machine)) == 0) && 
+         (pid.compare(b) == 0) )
+       {
+         END_OF("numitem");
+         return i;
+       }
+    }
+  END_OF("numitem");
+  return -1;
+}
+
+/*!
+  Returns text, containing information about client [ static ]
+*/
+QString ToolsGUI_RegWidget::setlongText( const Registry::Infos &c_info)
+{
+  BEGIN_OF("setlongText");
+  ASSERT( c_info.name != NULL );
+  QString a = QString( "<hr><h2>" ) + tr( "Code" ) + QString( " : " );
+  a.append( QString( c_info.name ) );
+  a.append( "</h1><hr><br>" );
+  a.append( tr( "Process Id" ) + QString( " : " ) );
+  a.append( BOLD( QString::number( int( c_info.pid ) ) ) );
+  a.append( QString( " " ) + tr( "on machine" ) + QString( " " ) );
+  a.append( BOLD( c_info.machine ) ); 
+  a.append( QString( " " ) + tr( "ip address" ) + QString( " : " ) );
+  a.append( BOLD( c_info.adip ) );
+  a.append( "<br>" );
+  
+  a.append( tr( "launched by user" ) + QString( " " ) );
+  a.append( BOLD( c_info.pwname ) );
+  a.append( QString( " ( " ) + tr( "pid" ) + QString( " : " ) );
+  a.append( BOLD( QString::number( int( c_info.uid ) ) ) );
+  a.append( QString( " )<br> " ) + tr( "in directory" ) + QString( " " ));
+  a.append( BOLD( c_info.cdir ) );
+  
+  a.append( QString( "<br>" ) + tr( "begins" ) + QString( " " ) );
+  char * t1 = (char * )duplicate(ctime(&c_info.tc_start));
+  t1 [strlen(t1) -1 ] = ' ';
+  a.append( BOLD( t1 ) ); 
+  delete [] t1;
+  a.append( "<br>" );
+  
+  if (c_info.tc_hello != 0 )
+    {
+      char * t2 = (char * )duplicate(ctime(&c_info.tc_hello));
+      t2 [strlen(t2) -1 ] = ' ';
+      a.append( tr( "last signal" ) + QString(" : ") ); 
+      a.append( BOLD( t2 ) ); 
+      a.append( "<br>" );
+      delete [] t2;
+    }
+  if ((c_info.tc_end - c_info.difftime) != 0)
+    {
+      char * t3 = (char * )duplicate(ctime(&c_info.tc_end));
+      t3 [strlen(t3) -1 ] = ' ';
+      a.append( tr( "ends" ) + QString( " " ) ); 
+      a.append( BOLD( t3 ) ); 
+      a.append( "<br>" );
+      delete [] t3;
+    }
+  else
+    {
+      a.append( tr( "still running" ) + QString( "<br>" ) );
+    }
+  
+  SCRUTE(c_info.difftime);
+  if (c_info.difftime!= 0)
+    {
+      a.append( QString( "(" ) + tr( "Time on" ) + QString( " " ) ); 
+      a.append( BOLD( c_info.machine ) ); 
+      a.append( QString( " " ) + tr( "differs from server's time. The difference is" ) + QString( " " )); 
+      a.append( BOLD( QString::number( int( c_info.difftime ) ) ) );
+      a.append( QString( " " ) + tr( "seconds" ) + QString( ")<br>" ) );
+    }
+  END_OF("setlongText");  
+  return a;
+  
+}
+
+/*!
+  Close event
+*/
+void ToolsGUI_RegWidget::closeEvent( QCloseEvent *e)
+{
+  BEGIN_OF("closeEvent");
+  if ( myInfoWindow )
+    myInfoWindow->close();
+  if ( myHelpWindow )
+    myHelpWindow->close();
+  if (myIntervalWindow)
+    myIntervalWindow->close();
+  e->accept();
+  END_OF("closeEvent");
+};
+
+/*!
+  Setups Clients list
+*/
+void ToolsGUI_RegWidget::SetListe()
+{
+  BEGIN_OF("SetListe");
+  _clients->installEventFilter( this );
+  _clients->setAllColumnsShowFocus( true );
+  _clients->addColumn( tr( "Component" ), -1);
+  _clients->addColumn( tr( "PID" ), -1 );
+  _clients->addColumn( tr( "User Name" ), -1 );
+  _clients->addColumn( tr( "Machine" ), -1 );
+  _clients->addColumn( tr( "begins" ), -1 );
+  _clients->addColumn( tr( "hello" ) , -1 );
+  _clients->setColumnAlignment( 1, Qt::AlignRight );
+  END_OF("SetListe");
+}
+
+/*!
+  Setups History list
+*/
+void ToolsGUI_RegWidget::SetListeHistory()
+{
+   BEGIN_OF("SetListeHistory")
+  _history->installEventFilter( this );
+  _history->setAllColumnsShowFocus( true );
+  _history->addColumn( tr( "Component" ), -1);
+  _history->addColumn( tr( "PID" ), -1 );
+  _history->addColumn( tr( "User Name" ), -1 );
+  _history->addColumn( tr( "Machine" ), -1 );
+  _history->addColumn( tr( "begins" ), -1 );
+  _history->addColumn( tr( "ends" ), -1 );
+  _history->setColumnAlignment( 1, Qt::AlignRight );
+   END_OF("SetListeHistory")
+}
+
+/*!
+  Updates History list
+*/
+void ToolsGUI_RegWidget::InfoHistory()
+{
+
+  BEGIN_OF("InfoHistory")
+    _history->clear();
+  try
+    {
+      _serverhistory = _VarComponents->history();
+      for (CORBA::ULong i=0; i<_serverhistory->length(); i++)
+       {       
+         const Registry::Infos & c_info=(*_serverhistory)[i];
+         ASSERT( c_info.name!=NULL);
+         QString a;
+         a.setNum(int(c_info.pid));
+         char * t1 = (char * )duplicate(ctime(&c_info.tc_start));
+         t1 [strlen(t1) -1 ] = ' ';
+         char * t2 = (char * )duplicate(ctime(&c_info.tc_end));
+         t2 [strlen(t2) -1 ] = ' ';
+         QListViewItem * item = new QListViewItem(_history, QString(c_info.name),\
+                                                  a, QString(c_info.pwname), QString(c_info.machine), \
+                                                  QString(t1), QString(t2));
+         item=0 ;
+         delete [] t1;
+         delete [] t2;
+         
+       }
+    }
+  catch( ... )
+    {
+      _interval->setDisabled( TRUE ) ;
+      _refresh->setDisabled( TRUE ) ;
+      _counter->stop();
+      MESSAGE("Sorry, No more Registry Server") ;
+      statusBar()->message( tr( "Sorry, No more Registry Server" ) ) ;
+    }
+  END_OF("InfoHistory")
+}
+
+/*!
+  Updates clients list
+*/
+void ToolsGUI_RegWidget::InfoReg()
+{
+  BEGIN_OF("InfoReg")
+  _clients->clear();
+  try
+    {
+      _serverclients = _VarComponents->getall();
+      for (CORBA::ULong i=0; i<_serverclients->length(); i++)
+       {       
+         const Registry::Infos & c_info=(*_serverclients)[i];
+         ASSERT( c_info.name!=NULL);
+         QString a;
+         a.setNum(int(c_info.pid));
+         char * t1 = (char * )duplicate(ctime(&c_info.tc_start));
+         t1 [strlen(t1) -1 ] = ' ';
+         char * t2 = (char * )duplicate(ctime(&c_info.tc_hello));
+         t2 [strlen(t2) -1 ] = ' ';
+         QListViewItem * item = new QListViewItem(_clients, QString(c_info.name),\
+                                                  a, QString(c_info.pwname), QString(c_info.machine), \
+                                                  QString(t1), QString(t2));
+         item=0 ;
+         delete [] t1;
+         delete [] t2;
+         
+       }
+    }
+  catch( ... )
+    {
+      _interval->setDisabled( TRUE ) ;
+      _refresh->setDisabled( TRUE ) ;
+      _counter->stop();
+      MESSAGE("Sorry, No more Registry Server") ;
+      statusBar()->message( tr( "Sorry, No more Registry Server" ) ) ;
+    }
+  END_OF("InfoReg")
+}
+
+/*!
+  Called when <Refresh> button is clicked
+*/
+void ToolsGUI_RegWidget::slotListeSelect()
+{
+  try
+    {
+      ASSERT(_tabWidget->currentPage() != NULL);
+      if (_tabWidget->currentPage () == _clients) InfoReg();
+      else if (_tabWidget->currentPage () == _history) InfoHistory();
+    }
+  catch( ... )
+    {
+      MESSAGE("Sorry, No more Registry Server") ;
+      statusBar()->message( tr( "Sorry, No more Registry Server" ) ) ;
+    }
+}
+
+/*!
+  Called when <Interval> button is clicked (changing refresh interval)
+*/
+void ToolsGUI_RegWidget::slotSelectRefresh()
+{
+  BEGIN_OF("slotSelectRefresh");
+  myIntervalWindow = new ToolsGUI_IntervalWindow(this);
+  myIntervalWindow->installEventFilter( this );
+  myIntervalWindow->setValue(myRefreshInterval);
+  myIntervalWindow->show();
+  connect( myIntervalWindow->Cancel(), SIGNAL( clicked() ), myIntervalWindow, SLOT( close() ) );
+  connect( myIntervalWindow->Ok(), SIGNAL( clicked() ), this, SLOT( slotIntervalOk() ) );
+  END_OF("slotSelectRefresh");
+}
+
+void ToolsGUI_RegWidget::slotIntervalOk()
+{
+  BEGIN_OF("slotIntervalOk");
+  myRefreshInterval = myIntervalWindow->getValue();
+  _counter->changeInterval( myRefreshInterval * 1000 );
+  SCRUTE(myRefreshInterval);
+  myIntervalWindow->close();
+  END_OF("slotIntervalOk");
+}
+/*!
+  Called when <Help> button is clicked
+*/
+void ToolsGUI_RegWidget::slotHelp()
+{
+  BEGIN_OF("slotHelp()");
+
+  if ( !myHelpWindow ) {
+    myHelpWindow  = new ToolsGUI_HelpWindow( this );
+    myHelpWindow->installEventFilter( this );
+  }
+  myHelpWindow->show();
+  myHelpWindow->raise();
+  myHelpWindow->setActiveWindow();
+  
+  END_OF("slotHelp()") ;
+}
+
+/*!
+  Called when user clicks on item in <Running> list
+*/
+void ToolsGUI_RegWidget::slotClientChanged( QListViewItem* item )
+{
+  BEGIN_OF("slotClientChanged()") ;
+
+  if ( item <= 0)
+    return;
+
+  blockSignals( true ); // for sure that item will not be deleted when refreshing
+
+  int numeroItem = numitem(item->text(0), item->text(1), item->text(3), _serverclients);
+  SCRUTE(numeroItem) ;
+  SCRUTE(item->text(1)) ;
+  
+  ASSERT(numeroItem>=0) ;
+  ASSERT((size_t)numeroItem<_serverclients->length()) ;
+  const Registry::Infos & c_info=(*_serverclients)[numeroItem];
+  ASSERT( c_info.name!=NULL);
+  
+  if ( !myInfoWindow ) {
+    myInfoWindow  = new ToolsGUI_InfoWindow( this );
+    myInfoWindow->installEventFilter( this );
+  }
+  QString a = tr( "More about" ) + QString( " " ) + QString( c_info.name );
+  myInfoWindow->setCaption(a);
+  myInfoWindow->setText( ToolsGUI_RegWidget::setlongText( c_info) );
+  myInfoWindow->show();
+  myInfoWindow->raise();
+  myInfoWindow->setActiveWindow();
+
+  blockSignals( false ); // enabling signals again
+
+  END_OF("slotClientChanged()") ;
+  return ;
+}
+
+/*!
+  Called when user clicks on item in <History> list
+*/
+void ToolsGUI_RegWidget::slotHistoryChanged( QListViewItem* item )
+{
+
+  BEGIN_OF("slotHistoryChanged()") ;
+  
+  if ( item <= 0)
+    return;
+
+  blockSignals( true ); // for sure that item will not be deleted when refreshing
+
+  int numeroItem = numitem(item->text(0), item->text(1), item->text(3), _serverhistory);
+  
+  SCRUTE(numeroItem) ;
+  SCRUTE(item->text(1)) ;
+  ASSERT(numeroItem>=0) ;
+  ASSERT((size_t)numeroItem<_serverhistory->length()) ;
+  const Registry::Infos & c_info=(*_serverhistory)[numeroItem];
+  ASSERT( c_info.name!=NULL);
+  
+  if ( !myInfoWindow ) {
+    myInfoWindow  = new ToolsGUI_InfoWindow( this );
+    myInfoWindow->installEventFilter( this );
+  }
+  QString a = tr( "More about" ) + QString( " " ) + QString( c_info.name );
+  myInfoWindow->setCaption(a);
+  myInfoWindow->setText( ToolsGUI_RegWidget::setlongText( c_info ) );
+  myInfoWindow->show();
+  myInfoWindow->raise();
+  myInfoWindow->setActiveWindow();
+
+  blockSignals( false ); // enabling signals again
+
+  END_OF("slotHistoryChanged()") ;
+  return ;
+}
+
+/*!
+  Constructor
+*/
+ToolsGUI_InfoWindow::ToolsGUI_InfoWindow( QWidget* parent, const char* name )
+     : QMainWindow( parent, name, WType_TopLevel | WDestructiveClose )
+{
+  BEGIN_OF("InfoWindow");
+  myTextView = new QTextView( this, "myTextView" );
+  setCentralWidget( myTextView );
+  setMinimumSize( 450, 250 );
+  END_OF("InfoWindow");
+}
+
+/*!
+  Sets text
+*/
+void ToolsGUI_InfoWindow::setText( const QString& text )
+{
+  myTextView->setText( text );
+}
+
+/*!
+  Key press event
+*/
+void ToolsGUI_InfoWindow::keyPressEvent( QKeyEvent * e )
+{
+  QMainWindow::keyPressEvent( e );
+  if ( e->key() == Key_Escape )
+    close();
+}
+
+static const char* SEPARATOR    = ":";
+
+QString findFile( QString filename )
+{
+  QString dir;
+  char* cenv;
+  
+  // Try ${HOME}/.salome/resources directory
+  cenv = getenv( "HOME" );
+  if ( cenv ) {
+    dir.sprintf( "%s", cenv );
+    if ( !dir.isEmpty() ) {
+      dir = addSlash(dir) ;
+      dir = dir + ".salome" ;
+      dir = addSlash(dir) ;
+      dir = dir + "resources" ;
+      dir = addSlash(dir) ;
+      QFileInfo fileInfo( dir + filename );
+      if ( fileInfo.isFile() && fileInfo.exists() )
+       return fileInfo.filePath();
+    }
+  }
+  // Try ${SALOME_SITE_DIR}/share/salome/resources directory
+  cenv = getenv( "SALOME_SITE_DIR" );
+  if ( cenv ) {
+    dir.sprintf( "%s", cenv );
+    if ( !dir.isEmpty() ) {
+      dir = addSlash(dir) ;
+      dir = dir + "share" ;
+      dir = addSlash(dir) ;
+      cenv = getenv("SALOME_SITE_NAME");
+      if (cenv)  dir = dir + cenv;
+      else       dir = dir + "salome" ;
+      dir = addSlash(dir) ;
+      dir = dir + "resources" ;
+      dir = addSlash(dir) ;
+      QFileInfo fileInfo( dir + filename );
+      if ( fileInfo.isFile() && fileInfo.exists() )
+       return fileInfo.filePath();
+    }
+  }
+  // Try ${KERNEL_ROOT_DIR}/share/salome/resources directory
+  cenv = getenv( "KERNEL_ROOT_DIR" );
+  if ( cenv ) {
+    dir.sprintf( "%s", cenv );
+    if ( !dir.isEmpty() ) {
+      dir = addSlash(dir) ;
+      dir = dir + "share" ;
+      dir = addSlash(dir) ;
+      dir = dir + "salome" ;
+      dir = addSlash(dir) ;
+      dir = dir + "resources" ;
+      dir = addSlash(dir) ;
+      QFileInfo fileInfo( dir + filename );
+      if ( fileInfo.isFile() && fileInfo.exists() )
+       return fileInfo.filePath();
+    }
+  }
+
+  //SRN Added support for SALOMEGUI
+  cenv = getenv( "SALOMEGUI_ROOT_DIR" );
+  if ( cenv ) {
+    dir.sprintf( "%s", cenv );
+    if ( !dir.isEmpty() ) {
+      dir = addSlash(dir) ;
+      dir = dir + "share" ;
+      dir = addSlash(dir) ;
+      dir = dir + "salome" ;
+      dir = addSlash(dir) ;
+      dir = dir + "resources" ;
+      dir = addSlash(dir) ;
+      QFileInfo fileInfo( dir + filename );
+      if ( fileInfo.isFile() && fileInfo.exists() )
+       return fileInfo.filePath();
+    }
+  }
+
+  // Try CSF_SaloameResources env.var directory ( or directory list )
+  cenv = getenv( "CSF_SalomeResources" );
+  if ( cenv ) {
+    dir.sprintf( "%s", cenv );
+    if ( !dir.isEmpty() ) {
+      QStringList dirList = QStringList::split( SEPARATOR, dir, false ); // skip empty entries
+      for ( int i = 0; i < dirList.count(); i++ ) {
+       QFileInfo fileInfo( addSlash( dirList[ i ] ) + filename );
+       if ( fileInfo.isFile() && fileInfo.exists() )
+         return fileInfo.filePath();
+      }
+    }
+  }
+  return filename;
+}
+QString addSlash( const QString& path )
+{
+  return Qtx::addSlash( path );
+//  if (!path.isNull()) {
+//#ifdef WNT
+//    QChar slash ('\\');
+//#else
+//    QChar slash ('/');
+//#endif
+//    if ( path.at(path.length()-1) != slash )
+//      return path + slash;
+//  }
+//  return path;
+}
diff --git a/src/TOOLSGUI/ToolsGUI_RegWidget.h b/src/TOOLSGUI/ToolsGUI_RegWidget.h
new file mode 100755 (executable)
index 0000000..b2ff850
--- /dev/null
@@ -0,0 +1,126 @@
+//  SALOME RegistryDisplay : GUI for Registry server implementation
+//
+//  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 
+//
+//
+//
+//  File   : RegWidget.h
+//  Author : Pascale NOYRET, EDF
+//  Module : SALOME
+//  $Header$
+
+# ifndef __REGWIDGET_H__
+# define __REGWIDGET_H__
+# include <qapplication.h>
+# include <qmainwindow.h>
+
+#include <SALOMEconfig.h>
+#include CORBA_CLIENT_HEADER(SALOME_Registry)
+
+class QTabWidget;
+class QListView;
+class QListViewItem;
+class QWidget;
+class QTimer;
+class QCloseEvent;
+class QTextView;
+#if QT_VERSION > 300
+class QPushButton;
+#endif
+
+#include <Standard_Macro.hxx>
+
+class ToolsGUI_HelpWindow;
+class ToolsGUI_IntervalWindow;
+
+class Standard_EXPORT  ToolsGUI_InfoWindow : public QMainWindow {
+public:
+  ToolsGUI_InfoWindow( QWidget* parent = 0, const char* name = 0);
+
+  void setText( const QString& text );
+  QTextView* textView() const { return myTextView; }
+
+protected:
+  void keyPressEvent( QKeyEvent * e );
+
+private:
+  QTextView* myTextView;
+};
+
+class Standard_EXPORT  ToolsGUI_RegWidget : public QMainWindow
+{
+  
+  Q_OBJECT
+
+public:
+  ToolsGUI_RegWidget( CORBA::ORB_var &orb , QWidget *parent = 0, const char *name = 0 );
+  ~ToolsGUI_RegWidget();
+  void       SetListe();
+  void       SetListeHistory();
+  void       InfoReg();
+  void       InfoHistory();
+
+  bool       eventFilter( QObject* object, QEvent* event );
+
+  static ToolsGUI_RegWidget* GetRegWidget( CORBA::ORB_var &orb , QWidget *parent = 0, const char *name = 0 );
+
+public slots:
+  void       slotHelp();
+  void       slotListeSelect();
+  void       slotClientChanged( QListViewItem* );
+  void       slotHistoryChanged( QListViewItem* );
+  void       slotSelectRefresh();
+  void       slotIntervalOk();
+protected:  
+  static QString setlongText( const Registry::Infos &c_info );
+  int            numitem( const QString& name, const QString& pid, const QString& machine, const Registry::AllInfos* c_info );
+  void           closeEvent( QCloseEvent *e);
+   
+protected :
+  QListView*               _clients;
+  QListView*               _history;
+  QWidget*                 _parent;
+  QTabWidget*              _tabWidget;
+  QPushButton*             _refresh;
+  QPushButton*             _interval;
+  QPushButton*             _close;
+  QTimer*                  _counter;
+  Registry::AllInfos*      _serverhistory;
+  Registry::AllInfos*      _serverclients;
+  ToolsGUI_InfoWindow*     myInfoWindow;
+  ToolsGUI_HelpWindow*     myHelpWindow;
+  ToolsGUI_IntervalWindow* myIntervalWindow;
+  int                      myRefreshInterval;
+
+private:
+  const      Registry::Components_var _VarComponents;
+  static     ToolsGUI_RegWidget* myRegWidgetPtr;
+};
+
+# endif         /* # ifndef __REGWIDGET_H__ */
+
+
+
+
+
+
+
+
+
diff --git a/src/VTKViewer/VTKViewer_Utilities.h b/src/VTKViewer/VTKViewer_Utilities.h
new file mode 100755 (executable)
index 0000000..d733fc5
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef VTKVIEWER_UTILITIES_H
+#define VTKVIEWER_UTILITIES_H
+
+#include <VTKViewer.h>
+
+class vtkRenderer;
+
+VTKVIEWER_EXPORT extern void  ResetCamera(vtkRenderer* theRenderer, int theUsingZeroFocalPoint = false);
+VTKVIEWER_EXPORT extern int   ComputeVisiblePropBounds(vtkRenderer* theRenderer, float theBounds[6]);
+VTKVIEWER_EXPORT extern void  ResetCameraClippingRange(vtkRenderer* theRenderer);
+VTKVIEWER_EXPORT extern bool  ComputeTrihedronSize(vtkRenderer* theRenderer, double& theNewSize, 
+                                 const double theSize, const float theSizeInPercents);
+
+#ifndef max
+#define max(a,b)            (((a) > (b)) ? (a) : (b))
+#endif
+
+#ifndef min
+#define min(a,b)            (((a) < (b)) ? (a) : (b))
+#endif
+
+#endif