-// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2023 CEA, EDF, OPEN CASCADE
//
// Copyright (C) 2003-2007 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.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
#include "SalomeApp.h"
#include <LightApp_Application.h>
-#include <SUIT_DataObject.h>
-
-#include <CORBA.h>
+#include <omniORB4/CORBA.h>
//#include <SALOMEconfig.h>
//#include CORBA_CLIENT_HEADER(SALOMEDS)
#include "SALOMEDSClient.hxx"
+#include <QPointer>
+
+#include <memory>
+
class LightApp_Preferences;
class SalomeApp_Study;
-class SalomeApp_NoteBookDlg;
+#ifndef DISABLE_PYCONSOLE
+class SalomeApp_NoteBook;
+#endif
class SUIT_Desktop;
-
-class SUIT_ViewModel;
class SALOME_LifeCycleCORBA;
\brief Application containing SalomeApp module or LightApp module
*/
-class SALOMEAPP_EXPORT SalomeApp_Application : public LightApp_Application
+class SALOMEAPPIMPL_EXPORT SalomeApp_Application : public LightApp_Application
{
Q_OBJECT
public:
enum { MenuToolsId = 5 };
enum { DumpStudyId = LightApp_Application::UserID, LoadScriptId, PropertiesId,
- CatalogGenId, RegDisplayId, SaveGUIStateId, FileLoadId, NoteBookId, UserID };
+ CatalogGenId, RegDisplayId, SaveGUIStateId, ConnectId, DisconnectId,
+ UserID };
+
+ typedef enum { WT_NoteBook = LightApp_Application::WT_User,
+ WT_User
+ } WindowTypes;
protected:
enum { OpenRefresh = LightApp_Application::OpenReload + 1 };
- enum { CloseUnload = LightApp_Application::CloseDiscard + 1 };
+ enum { CloseDisconnectSave = LightApp_Application::CloseDiscard + 1, CloseDisconnect };
enum { LoadStudyId = LightApp_Application::OpenStudyId + 1, NewAndScriptId };
public:
- SalomeApp_Application();
+ SalomeApp_Application(SALOME_NamingService_Abstract *ns = nullptr);
virtual ~SalomeApp_Application();
virtual void updateObjectBrowser( const bool = true );
- virtual QString getFileFilter() const;
-
virtual void start();
virtual void contextMenuPopup( const QString&, QMenu*, QString& );
virtual bool checkDataObject(LightApp_DataObject* theObj);
- virtual void setDesktop( SUIT_Desktop* );
+ virtual bool checkExistingDoc();
static CORBA::ORB_var orb();
- static SALOMEDSClient_StudyManager* studyMgr();
- static SALOME_NamingService* namingService();
+ static _PTR(Study) getStudy();
+ static SALOME_NamingService_Abstract* namingService();
static SALOME_LifeCycleCORBA* lcc();
SUIT_ViewManager* newViewManager(const QString&);
virtual bool useStudy( const QString& );
virtual void updateDesktopTitle();
-
- virtual void setNoteBook(SalomeApp_NoteBookDlg* theNoteBook);
- virtual SalomeApp_NoteBookDlg* getNoteBook() const;
- //! update visibility state of objects
- void updateVisibilityState( DataObjectList& theList,
- SUIT_ViewModel* theViewModel );
+#ifndef DISABLE_PYCONSOLE
+ virtual void setNoteBook(SalomeApp_NoteBook* theNoteBook);
+ virtual SalomeApp_NoteBook* getNoteBook() const;
+#endif
virtual bool renameAllowed( const QString& ) const;
virtual bool renameObject( const QString&, const QString& );
-
+
public slots:
+ virtual void onNewDoc();
virtual void onLoadDoc();
virtual void onNewWithScript();
virtual bool onLoadDoc( const QString& );
+ virtual void onUnloadDoc( bool ask = true);
virtual void onCloseDoc( bool ask = true);
+ virtual void onOpenDoc();
+ virtual bool onOpenDoc( const QString& );
+ virtual bool onReopenDoc();
virtual void onExit();
virtual void onCopy();
virtual void onPaste();
void onSaveGUIState();// called from VISU
+#ifndef DISABLE_PYCONSOLE
+ void onUpdateStudy(); // called from NoteBook
+#endif
+ bool onRestoreStudy( const QString& theDumpScript,
+ const QString& theStudyName,
+ bool theIsStudySaved );
+
+ virtual void onDockWindowVisibilityChanged( bool );
protected slots:
void onStudyCreated( SUIT_Study* );
- void onStudySaved( SUIT_Study* );
void onStudyOpened( SUIT_Study* );
- void onStudyClosed( SUIT_Study* );
-
- void onViewManagerRemoved( SUIT_ViewManager* );
+ void onDesktopMessage( const QString& );
+
+ virtual void onModuleActivation( const QString& );
protected:
virtual void createActions();
void objectBrowserColumnsVisibility();
+#ifndef DISABLE_PYCONSOLE
+ bool updateStudy();
+ virtual PyConsole_Interp* createPyInterp();
+#endif
+
+ virtual bool canOpenDoc( const QString& );
+ virtual void afterCloseDoc();
+
+ virtual void addCatalogue( const QString&, const QString& );
+
private slots:
void onDeleteInvalidReferences();
void onDblClick( SUIT_DataObject* );
void onProperties();
void onDumpStudy();
- void onNoteBook();
void onLoadScript();
void onDeleteGUIState();
void onOpenWith();
void onExtAction();
- void onWindowActivated( SUIT_ViewWindow* theViewWindow );
-
private:
void createExtraActions();
+ void ensureShaperIsActivated();
+
+ QString getScriptFileName();
+ void execScript(bool isNewDoc);
private:
- SalomeApp_NoteBookDlg* myNoteBook;
- QMap<QString, QAction*> myExtActions; // Map <AttributeUserID, QAction>
+#ifndef DISABLE_PYCONSOLE
+ QPointer<SalomeApp_NoteBook> myNoteBook; // Notebook instance
+#endif
+ QMap<QString, QAction*> myExtActions; // Map <AttributeUserID, QAction>
+ bool myIsCloseFromExit; // "Close from Exit" flag
+
+ bool myToIgnoreMessages;// to ignore messages from SALOMEDS
+
+signals:
+ void dumpedStudyClosed( const QString& theDumpScript,
+ const QString& theStudyName,
+ bool theIsStudySaved );
+ void notebookVarUpdated( QString theVarName );
+ void objectDoubleClicked( SUIT_DataObject* );
+protected:
+ static std::unique_ptr<SALOME_NamingService_Abstract> _ns;
};
#ifdef WIN32