Salome HOME
PR: mergefrom_PAL_OCC_21Oct04
[modules/kernel.git] / src / SALOMEGUI / QAD_Desktop.h
index 0658375483beb57323cd8343627b90b855ac74f1..83bc083c972ceb6c8f30bb1c09f3831fae75a4d8 100644 (file)
 #include "QAD_Application.h"
 #include "QAD_OperatorMenus.h"
 #include "QAD_Menus.h"
-#include "QAD_HelpWindow.h"
+//NRI#include "QAD_HelpWindow.h"
 #include "QAD_Action.h"
 
 #include "SALOME_NamingService.hxx"
 #include "SALOME_LifeCycleCORBA.hxx"
+#include "SALOME_Selection.h"
 
 // IDL Headers 
 #include <SALOMEconfig.h>
 #include <qfiledialog.h>
 #include <qtoolbutton.h>
 
-// Open CASCADE Includes
-#include <OSD_SharedLibrary.hxx>
-
 class QAD_XmlHandler;
+class SALOMEGUI;
+class SALOME_Event;
 
 class QAD_EXPORT QAD_Desktop : public QMainWindow
 {
@@ -71,7 +71,7 @@ class QAD_EXPORT QAD_Desktop : public QMainWindow
 protected:
   //NRI - unused - :  enum ComponentType {GEOM, MESH, SOLVER, DATA, VISU, OTHER} ;
 
-  enum {  FileNewId = 0, FileOpenId, FileLoadId, FileCloseId, FileSaveId, FileSaveAsId, FilePropsId, FileExitId,
+  enum {  FileNewId = -1000, FileOpenId, FileLoadId, FileCloseId, FileSaveId, FileSaveAsId, FilePropsId, FileExitId,
          ViewStatusBarId,
          SelectionPointId, SelectionEdgeId, SelectionCellId, SelectionActorId,
          PrefViewerOCCId, PrefViewerVTKId, PrefGraphSupervisorId, PrefViewerPlot2dId,
@@ -79,13 +79,15 @@ protected:
          DefaultViewerOCCId, DefaultViewerVTKId, DefaultGraphSupervisorId, DefaultPlot2dId,
          //VRV: T2.5 - add default viewer
          PrefViewerTrihedronId, PrefConsoleFontId, PrefObjectBrowserEntryId, 
-         PrefObjectBrowserIAPPId, PrefObjectBrowserValueId, PrefObjectBrowserCHRONO_SORTId, 
-         PrefDirsId, PrefMultiFileSave, PrefASCIISave, PrefSaveId,
+         PrefObjectBrowserIAPPId, PrefObjectBrowserValueId, PrefObjectBrowserCHRONO_SORTId,PrefObjectBrowserShowUseCaseId, 
+         PrefObjectBrowserNoAutoSizeColumnsId,  
+         PrefDirsId, PrefMultiFileSave, PrefASCIISave, PrefUndoLevelId, PrefExternalBrowserId, PrefSaveId,
          //NRI : SAL2214
          WindowNew3dId, ViewOCCId, ViewVTKId, ViewPlot2dId,
          //NRI : SAL2214
          WindowCascadeId, WindowTileId, 
-         HelpContentsId, HelpSearchId, HelpWhatsThisId, HelpAboutId };
+         HelpContentsId, HelpContentsModuleId,
+         HelpSearchId, HelpWhatsThisId, HelpAboutId };
   enum UpdateCommand { ActivateApp, DeactivateApp };
 
     /* Desktop can be created only by application */
@@ -113,16 +115,13 @@ public:
     void     definePopup(QString & theContext,
                         QString & theParent, 
                         QString & theObject );
-
-    void     createPopup(QPopupMenu* popupFather, QPopupMenu* popup,
-                        QString text, int popupID, bool separator = false);
     void     createPopup(QPopupMenu* popup, const QString & theContext,
                         const QString & theParent, const QString & theObject );
     void     customPopup(QPopupMenu* popup, const QString & theContext,
                         const QString & theParent, const QString & theObject);
 
     /* selection mode */
-    void SetSelectionMode(int mode, bool activeCompOnly = false);
+    void SetSelectionMode(Selection_Mode mode, bool activeCompOnly = false);
 
     /* desktop */
     void             showDesktop();
@@ -144,15 +143,18 @@ public:
     QWorkspaceP*      getMainFrame() const;
     QString          getNewStudyName();
     QAD_Study*        findStudy( SALOMEDS::Study_ptr theStudy );
-
+    static int        getUndoLevel();
     /* help actions */
     virtual void      helpAbout();    
-    virtual void      helpSearch();
+/*    virtual void      helpSearch();
     virtual void      helpContents();
     virtual void      helpContext(const QString& path, const QString& dir = QString::null);
-
+*/
     bool             loadComponent(QString);
+    bool              loadComponentData( const QString& );
+    QString           changeXmlInputSourceData(QString theData, QString theComponent);
     void             activateComponent(const QString& theName, bool isLoadData = true);
+    void              deactivateComponent();
     void              createStudy();
 
     void              setSettings();
@@ -161,8 +163,10 @@ public:
 
     QAD_Menus*           getActiveMenus()      {return myActiveMenus;}
     QAD_OperatorMenus*   getOperatorMenus()    {return myOperatorMenus;}
-    const OSD_SharedLibrary&  getHandle() const {return mySharedLibrary;}// never return sych objects "by value"
     const QString&       getActiveComponent() const;
+    SALOMEGUI*            getActiveGUI();
+    SALOMEGUI*            getComponentGUI( const QString& );  // accepts component`s user name
+    QString               getComponentDataType() const;
     SALOME_NamingService* getNameService()      {return myNameService;}
 
     Engines::Component_var getEngine(const char *containerName,
@@ -171,7 +175,7 @@ public:
     QString getComponentName(const char *componentUserName);
     QString getComponentUserName(const char *componentName);
     
-    QAD_HelpWindow*   getHelpWindow();
+    //NRI    QAD_HelpWindow*   getHelpWindow();
 
     void             onMouseMove(QMouseEvent*);
     bool             onMousePress(QMouseEvent*);
@@ -192,8 +196,6 @@ protected:
     virtual   void    updateCaption( UpdateCommand );
     virtual   void    updateMenu( UpdateCommand );
 
-    bool              loadComponentData( const QString& );
-
 protected slots:
     virtual void      onNewStudy();
     virtual void      onNewStudy(QAD_Application* app);
@@ -218,6 +220,11 @@ protected slots:
     virtual void      onWindowPopupAboutToShow();
     void             onWindowsPopupActivated( int id );
     void             onWindowsPopupStatusText( int id );
+    void              onHelpModulePopupStatusText(int id);
+    
+    void              onFilePopupStatusText( int id );
+    void              onEditPopupStatusText( int id );
+    void              onViewPopupStatusText( int id );
 
     void             onSelectionMode();
 
@@ -236,12 +243,16 @@ protected slots:
     void             onObjectBrowser();
     void              onMultiFileSave();
     void              onASCIISave();
+    void              onUndoLevel();
+    void             onExternalBrowser();      
 
     void             onActivateApp(QAD_Application* app);
     void             onDeactivateApp(QAD_Application* app);
 
     void             onHelpContents();
-    void             onHelpSearch();
+    void             onHelpContentsModule();
+    /*    void       onHelpContentsTUI(); */
+/*    void           onHelpSearch(); */
     void             onHelpAbout();
 
     void             onNewWindow3d();
@@ -257,7 +268,7 @@ protected slots:
     void             onComboActiveComponent( const QString & , bool isLoadData);
     void              onCascade(); 
 
-    void              onHelpWindowClosed();
+/* NRI   void              onHelpWindowClosed(); */
 
 protected:
     QMenuBar*        myMainMenu;           /* the main menu bar */
@@ -279,11 +290,13 @@ protected:
   //NRI : SAL2214
     QPopupMenu       myNewViewPopup;
   //NRI : SAL2214
+    QPopupMenu       myHelpContentsModulePopup;
+
     QPopupMenu       myToolsPopup;
     QPopupMenu       myPrefPopup;
     QPopupMenu       mySelectionModePopup;
     QPopupMenu       myWindowPopup;        /* not customized by an application */
-
+    
     ActionMap         myStdActions;        /* default actions */
     QToolBar*        myStdToolBar;         /* standard toolbar */
     QStatusBar*              myStatusBar;          /* the only status bar */
@@ -305,18 +318,23 @@ protected:
     QList<QAD_Menus>   myMenusList;
     QAD_Menus*        myActiveMenus;
 
-    QAD_HelpWindow*    myHelpWindow;
+    //NRI QAD_HelpWindow*    myHelpWindow;
 
     QList<QToolButton> myComponentButton;
 
     QMap<QString,QString> mapComponentName;
 
+private:
+    void processEvent( SALOME_Event* );
+
+private:
+    typedef QMap<QString, SALOMEGUI*> ComponentMap;
+
 private:
     static QAD_ResourceMgr*                resourceMgr;
     static QPalette*                       palette;
     void                                   createActions();
     void                                   updateActions();
-    OSD_SharedLibrary                      mySharedLibrary;
     QAD_XmlHandler*                        myXmlHandler;
     QString                                myActiveComp;
     SALOME_NamingService*                  myNameService;
@@ -324,7 +342,10 @@ private:
     SALOME_LifeCycleCORBA *                myEnginesLifeCycle;
     QComboBox *                                    myCombo;
     bool                                    myQueryClose;
+    bool                                    myAboutToClose;
     bool                                    _islibso;
+
+    ComponentMap                            myComponents;
 };
 
 /********************************************************************