Salome HOME
Merge from V5_1_main branch 24/11/2010
[modules/multipr.git] / src / MULTIPRGUI / MULTIPR_GUI.h
index 91fd6ccfa2c71a28e01cd092f0ca27f6bbde1a4c..5aec810f9f58c3bf6e404f2425b0dcccf097262e 100644 (file)
@@ -1,6 +1,24 @@
-// Project MULTIPR, IOLS WP1.2.1 - EDF/CS
-// Partitioning/decimation module for the SALOME v3.2 platform
+//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D
+//
+//  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.com
+//
 
+// Partitioning/decimation module for the SALOME v3.2 platform
+//
 /**
  * \file    MULTIPR_GUI.h
  *
@@ -21,7 +39,8 @@
 
 #include <SalomeApp_Module.h>
 #include <LightApp_DataObject.h>
-#include <LightApp_DataModel.h>
+//#include <LightApp_DataModel.h>
+#include <SalomeApp_DataModel.h>
 
 #include <SALOMEconfig.h>
 #include CORBA_CLIENT_HEADER(MULTIPR)
@@ -36,6 +55,8 @@
 class SalomeApp_Application;
 class CAM_Module;
 
+class SUIT_Desktop;
+
 class QVBoxLayout;
 class QHBoxLayout;
 class QGridLayout;
@@ -47,6 +68,9 @@ class QLineEdit;
 class QSpinBox;
 class QPushButton;
 
+class QTimer;
+//class MULTIPR_GUI_ProgressCallbackDlg;
+class QProgressDialog;
 
 //*****************************************************************************
 // Class MULTIPR_GUI
@@ -55,67 +79,77 @@ class QPushButton;
 
 class MULTIPR_GUI: public SalomeApp_Module
 {
-       Q_OBJECT
+    Q_OBJECT
 
 public:
 
-       MULTIPR_GUI();
-       
-       virtual ~MULTIPR_GUI();
-       
-       void initialize(CAM_Application*);
-       
-       QString engineIOR() const;
-       
-       void windows(QMap<int, int>&) const;
-       
-       MULTIPR_ORB::MULTIPR_Obj_ptr getMULTIPRObj();
-       
-       SalomeApp_Application* getAppli() const;
-       
-       void selected(QStringList&, const bool);
-       
-       const QStringList& getSelectedParts() const { return mSelectedParts; }
+    MULTIPR_GUI();
+    
+    virtual ~MULTIPR_GUI();
+    
+    void initialize(CAM_Application*);
+    
+    QString engineIOR() const;
+    
+    void windows(QMap<int, int>&) const;
+    
+    MULTIPR_ORB::MULTIPR_Obj_ptr getMULTIPRObj();
+    void setMULTIPRObj (MULTIPR_ORB::MULTIPR_Obj_ptr theObj);
+    
+    SalomeApp_Application* getAppli() const;
+    
+    void selected(QStringList&, const bool);
+    
+    const QStringList& getSelectedParts() const { return mSelectedParts; }
+
+    static SUIT_Desktop* desktop();
 
 public slots:
 
-       bool deactivateModule(SUIT_Study*);
-       bool activateModule(SUIT_Study*);
+    bool deactivateModule(SUIT_Study*);
+    bool activateModule(SUIT_Study*);
 
 protected slots:
 
-       void OnImportFromMEDFile();
-       void OnPartition1();
-       void OnPartition2();
-       void OnDecimate();
-       void OnRemove();
-       void OnSave();
-       
+    void OnImportFromMEDFile();
+    void OnPartition1();
+    void OnPartition2();
+    void OnDecimate();
+    void OnRemove();
+    void OnSave();
+
+    void timerDone(); // update saving progress dialog
+
 protected:
 
-       virtual CAM_DataModel* createDataModel();
-       
-       void retrieveSelectedParts();
-       bool isPartExist(const char* partName);
-       bool removeLowerResolution();
-       
+    virtual CAM_DataModel* createDataModel();
+
+    void retrieveSelectedParts();
+    bool isPartExist(const char* partName);
+    bool removeLowerResolution();
+    
 protected:
 
-       enum 
-       
-               ACTION_IMPORT_MED = 190,
-               ACTION_SAVE,
-               ACTION_REMOVE,
-               ACTION_SPLIT,
-               ACTION_DECIMATE
-       };
-       
+    enum 
+    { 
+        ACTION_IMPORT_MED = 190,
+        ACTION_SAVE,
+        ACTION_REMOVE,
+        ACTION_SPLIT,
+        ACTION_DECIMATE
+    };
+    
 private:
 
-       QString                      mMEDFileName;
-       QStringList                  mSelectedParts;
-       MULTIPR_ORB::MULTIPR_Obj_ptr mMULTIPRObj;
-  
+    QString                      mMEDFileName;
+    QStringList                  mSelectedParts;
+    //MULTIPR_ORB::MULTIPR_Obj_ptr mMULTIPRObj;
+    MULTIPR_ORB::MULTIPR_Obj_var mMULTIPRObj;
+
+    QProgressDialog*             mProgress;
+    //MULTIPR_GUI_ProgressCallbackDlg* mProgress;
+    QTimer*                      mTimer;
+
 }; // class MULTIPR_GUI
 
 
@@ -128,17 +162,17 @@ class MULTIPR_GUI_DataObject : public LightApp_DataObject
 {
 public:
 
-       MULTIPR_GUI_DataObject(SUIT_DataObject* parent, const char* name);
-       virtual ~MULTIPR_GUI_DataObject();
-       
-       virtual QString entry()   const;
-       virtual QString name()    const;
-       virtual QPixmap icon()    const;
-       virtual QString toolTip() const;
+    MULTIPR_GUI_DataObject(SUIT_DataObject* parent, const char* name);
+    virtual ~MULTIPR_GUI_DataObject();
+    
+    virtual QString entry()   const;
+    virtual QString name()    const;
+    virtual QPixmap icon()    const;
+    virtual QString toolTip() const;
 
 protected:
 
-       QString mName;
+    QString mName;
 };
 
 
@@ -146,19 +180,25 @@ protected:
 // Class MULTIPR_GUI_DataObject_Module
 //*****************************************************************************
 
-class MULTIPR_GUI_DataObject_Module : public MULTIPR_GUI_DataObject, public LightApp_ModuleObject
+
+class MULTIPR_GUI_DataObject_Module : public MULTIPR_GUI_DataObject
 {
 public:
 
-       MULTIPR_GUI_DataObject_Module(CAM_DataModel* dm, SUIT_DataObject* parent, const char* name);
-       virtual ~MULTIPR_GUI_DataObject_Module();
-       
-       virtual QString entry()   const;
-       virtual QString name()    const;
-       virtual QPixmap icon()    const;
-       virtual QString toolTip() const;
-};
+    MULTIPR_GUI_DataObject_Module(CAM_DataModel* dm, SUIT_DataObject* parent, const char* name);
+    virtual ~MULTIPR_GUI_DataObject_Module();
+    
+    virtual QString entry()   const;
+    virtual QString name()    const;
+    virtual QPixmap icon()    const;
+    virtual QString toolTip() const;
+
+private:
 
+    CAM_DataModel* mDm;
+    SUIT_DataObject* mParent;
+
+};
 
 //*****************************************************************************
 // Class MULTIPR_GUI_DataObject_Mesh
@@ -168,12 +208,12 @@ class MULTIPR_GUI_DataObject_Mesh : public MULTIPR_GUI_DataObject
 {
 public:
 
-       MULTIPR_GUI_DataObject_Mesh(SUIT_DataObject* parent, const char* name);
-       virtual ~MULTIPR_GUI_DataObject_Mesh();
-       
-       virtual QString entry()   const;
-       virtual QPixmap icon()    const;
-       virtual QString toolTip() const;
+    MULTIPR_GUI_DataObject_Mesh(SUIT_DataObject* parent, const char* name);
+    virtual ~MULTIPR_GUI_DataObject_Mesh();
+    
+    virtual QString entry()   const;
+    virtual QPixmap icon()    const;
+    virtual QString toolTip() const;
 };
 
 
@@ -185,20 +225,20 @@ class MULTIPR_GUI_DataObject_Part : public MULTIPR_GUI_DataObject
 {
 public:
 
-       MULTIPR_GUI_DataObject_Part(SUIT_DataObject* parent, const char* name, const char* info);
-       virtual ~MULTIPR_GUI_DataObject_Part();
-       
-       virtual QString entry()   const;
-       virtual QPixmap icon()    const;
-       virtual QString toolTip() const;
+    MULTIPR_GUI_DataObject_Part(SUIT_DataObject* parent, const char* name, const char* info);
+    virtual ~MULTIPR_GUI_DataObject_Part();
+    
+    virtual QString entry()   const;
+    virtual QPixmap icon()    const;
+    virtual QString toolTip() const;
 
 protected:
 
-       QString mMeshName;
-       int     mId;
-       QString mPath;
-       QString mMEDFileName;
-       QString mTooltip;
+    QString mMeshName;
+    int     mId;
+    QString mPath;
+    QString mMEDFileName;
+    QString mTooltip;
 };
 
 
@@ -210,12 +250,12 @@ class MULTIPR_GUI_DataObject_Resolution : public MULTIPR_GUI_DataObject_Part
 {
 public:
 
-       MULTIPR_GUI_DataObject_Resolution(SUIT_DataObject* parent, const char* name, const char* info);
-       virtual ~MULTIPR_GUI_DataObject_Resolution();
-       
-       virtual QString entry()   const;
-       virtual QPixmap icon()    const;
-       virtual QString toolTip() const;
+    MULTIPR_GUI_DataObject_Resolution(SUIT_DataObject* parent, const char* name, const char* info);
+    virtual ~MULTIPR_GUI_DataObject_Resolution();
+    
+    virtual QString entry()   const;
+    virtual QPixmap icon()    const;
+    virtual QString toolTip() const;
 };
 
 
@@ -223,20 +263,25 @@ public:
 // Class MULTIPR_GUI_DataModel
 //*****************************************************************************
 
-class MULTIPR_GUI_DataModel : public LightApp_DataModel
+//class MULTIPR_GUI_DataModel : public LightApp_DataModel
+class MULTIPR_GUI_DataModel : public SalomeApp_DataModel
 {
+
 public:
 
-       MULTIPR_GUI_DataModel(CAM_Module*);
-       virtual ~MULTIPR_GUI_DataModel();
+    MULTIPR_GUI_DataModel(CAM_Module*);
+    virtual ~MULTIPR_GUI_DataModel();
+
+    virtual void update (LightApp_DataObject* = 0, LightApp_Study* = 0);
 
 protected:
 
-       virtual void build();
-       
+    virtual void build();
+    void buildAll (LightApp_Study* = 0);
+
 private:
 
-       MULTIPR_GUI* mMULTIPR_GUI;
+    MULTIPR_GUI* mMULTIPR_GUI;
 };
 
 
@@ -244,4 +289,3 @@ private:
 
 
 // EOF
-