X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI.h;h=92a51bf56bb073f03f6c8a6dec22384d713d0f44;hp=4905f783f9e499d429166805147839652a76f3b9;hb=ad3cb4c93852dbc834d7075c087bbc749197454b;hpb=e4737e85f0da6d3f90fd08f6be1c2825195fe16f diff --git a/src/SMESHGUI/SMESHGUI.h b/src/SMESHGUI/SMESHGUI.h index 4905f783f..92a51bf56 100644 --- a/src/SMESHGUI/SMESHGUI.h +++ b/src/SMESHGUI/SMESHGUI.h @@ -1,101 +1,235 @@ -// SMESH SMESHGUI : GUI for SMESH component +// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE // -// 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 +// 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, 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 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// File : SMESHGUI.h -// Author : Nicolas REJNERI -// Module : SMESH -// $Header$ +// 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 +// + +// SMESH SMESHGUI : GUI for SMESH component +// File : SMESHGUI.h +// Author : Nicolas REJNERI, Open CASCADE S.A.S. +// +#ifndef SMESHGUI_H +#define SMESHGUI_H + +// SMESH includes +#include "SMESH_SMESHGUI.hxx" -#ifndef SMESHGUI_HeaderFile -#define SMESHGUI_HeaderFile +// SALOME GUI includes +#include +#include +#include -// SALOME Includes -#include "SALOMEGUI.h" -#include "SALOME_InteractiveObject.hxx" +// IDL includes +#include +#include CORBA_SERVER_HEADER(SMESH_Gen) -class QAD_Desktop; -class QAD_Study; +// VTK includes +#include +#include + +class vtkActor; +class vtkCallbackCommand; +class vtkObject; class QDialog; +class SUIT_Desktop; +class SUIT_Study; +class SUIT_ViewWindow; +class SUIT_ResourceMgr; +class SUIT_ViewManager; + +class LightApp_Operation; +class SalomeApp_Study; +class LightApp_Selection; +class LightApp_SelectionMgr; + +class SMESH_Actor; +class SMESHGUI_FilterLibraryDlg; + +typedef std::map SMESHGUI_StudyId2MarkerMap; + +namespace SMESH +{ + class OrientedPlane; + struct ClippingPlaneInfo + { + OrientedPlane* Plane; + std::list ActorList; + }; +} + +typedef std::list SMESHGUI_ClippingPlaneInfoList; +typedef std::map SMESHGUI_ClippingPlaneInfoMap; //================================================================================= // class : SMESHGUI // purpose : //================================================================================= -class SMESHGUI : public SALOMEGUI +class SMESHGUI_EXPORT SMESHGUI : public SalomeApp_Module { - Q_OBJECT; - -private : - QAD_Desktop* myDesktop; - QAD_Study* myActiveStudy; - QDialog* myActiveDialogBox; - - int myState; - bool myAutomaticUpdate; + Q_OBJECT public : - SMESHGUI( const QString& name = "", QObject* parent = 0 ); - static SMESHGUI* GetSMESHGUI() ; + SMESHGUI(); ~SMESHGUI(); - QAD_Desktop* GetDesktop() ; - QAD_Study* GetActiveStudy() ; - bool ActiveStudyLocked(); - - QDialog* GetActiveDialogBox() ; - void SetActiveDialogBox(QDialog* aDlg) ; - - void ResetState() ; - void SetState(int aState) ; - bool DefineDlgPosition(QWidget* aDlg, int& x, int& y) ; - - virtual bool OnGUIEvent (int theCommandID, QAD_Desktop* parent); - virtual bool OnMousePress (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame); - virtual bool OnMouseMove (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame); - virtual bool OnKeyPress (QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame); - virtual bool ActiveStudyChanged( QAD_Desktop* parent ); - virtual bool SetSettings ( QAD_Desktop* parent ); - virtual void DefinePopup ( QString & theContext, QString & theParent, QString & theObject ); - virtual bool CustomPopup ( QAD_Desktop* parent, QPopupMenu* popup, const QString & theContext, - const QString & theParent, const QString & theObject ); - virtual void BuildPresentation ( const Handle(SALOME_InteractiveObject)& theIO, - QAD_ViewFrame* = 0 ); - virtual void SupportedViewType (int* buffer, int bufferSize); - virtual void Deactivate (); - - /* Non modal dialog boxes magement */ - void EmitSignalDeactivateDialog() ; - void EmitSignalStudyFrameChanged() ; - void EmitSignalCloseAllDialogs() ; + static SMESH::SMESH_Gen_var GetSMESHGen(); + static SMESHGUI* GetSMESHGUI(); + static LightApp_SelectionMgr* selectionMgr(); + static SUIT_ResourceMgr* resourceMgr(); + static SUIT_Desktop* desktop(); + static SalomeApp_Study* activeStudy(); + + bool isActiveStudyLocked(); + + static bool automaticUpdate(unsigned int requestedSize = 0, bool* limitExceeded = 0); + static bool automaticUpdate( SMESH::SMESH_IDSource_ptr, int*, bool*, int*, long* ); + + static void Modified( bool = true ); + + virtual LightApp_Displayer* displayer(); + virtual QString engineIOR() const; + virtual void initialize( CAM_Application* ); + virtual void windows( QMap& ) const; + virtual void viewManagers( QStringList& ) const; + + QDialog* GetActiveDialogBox(); + void SetActiveDialogBox( QDialog* ); + + void ResetState(); + void SetState( int ); + int GetState() const { return myState; } + bool DefineDlgPosition( QWidget*, int&, int& ); + void switchToOperation( int ); + + virtual bool OnGUIEvent( int ); + virtual bool OnMousePress( QMouseEvent*, SUIT_ViewWindow* ); + virtual bool OnMouseMove( QMouseEvent*, SUIT_ViewWindow* ); + virtual bool OnKeyPress( QKeyEvent*, SUIT_ViewWindow* ); + + virtual LightApp_Selection* createSelection() const; + + virtual void BuildPresentation ( const Handle(SALOME_InteractiveObject)&, + SUIT_ViewWindow* = 0 ); + + /* Non modal dialog boxes management */ + void EmitSignalDeactivateDialog(); + void EmitSignalStudyFrameChanged(); + void EmitSignalCloseAllDialogs(); + void EmitSignalVisibilityChanged(); + void EmitSignalCloseView(); + void EmitSignalActivatedViewManager(); + + virtual void contextMenuPopup( const QString&, QMenu*, QString& ); + virtual void createPreferences(); + virtual void preferencesChanged( const QString&, const QString& ); + + virtual void message( const QString& ); + + virtual void update( const int ); + + static SALOMEDS::Color getUniqueColor( const QList& ); + static SALOMEDS::Color getPredefinedUniqueColor(); + + virtual void storeVisualParameters (int savePoint); + virtual void restoreVisualParameters(int savePoint); + + virtual void addActorAsObserver( SMESH_Actor* theActor ); + + virtual bool renameAllowed( const QString& ) const; + virtual bool renameObject( const QString&, const QString& ); + + + SMESHGUI_ClippingPlaneInfoMap& getClippingPlaneInfoMap() { return myClippingPlaneInfoMap; } + +public slots: + virtual bool deactivateModule( SUIT_Study* ); + virtual bool activateModule( SUIT_Study* ); + virtual void studyClosed( SUIT_Study* ); + void onViewClosed( SUIT_ViewWindow* ); + +private slots: + void OnGUIEvent(); + void onViewManagerActivated( SUIT_ViewManager* ); + void onViewManagerRemoved( SUIT_ViewManager* ); + void onOperationCommited( SUIT_Operation* ); + void onOperationAborted( SUIT_Operation* ); + void onHypothesisEdit( int result ); + void onUpdateControlActions(); signals: - void SignalDeactivateActiveDialog() ; - void SignalStudyFrameChanged() ; - void SignalCloseAllDialogs() ; + void SignalDeactivateActiveDialog(); + void SignalStudyFrameChanged(); + void SignalCloseAllDialogs(); + void SignalVisibilityChanged(); + void SignalCloseView(); + void SignalActivatedViewManager(); + +protected: + void createSMESHAction( const int, + const QString&, + const QString& = QString(), + const int = 0, + const bool = false, + const QString& = QString() ); + void createPopupItem( const int, + const QString&, + const QString&, + const QString& = QString(), + const int = -1 ); + + virtual LightApp_Operation* createOperation( const int ) const; + + virtual bool isSelectionCompatible(); + + virtual bool reusableOperation( const int id ); + + static void ProcessEvents( vtkObject* theObject, + unsigned long theEvent, + void* theClientData, + void* theCallData ); + +private: + void OnEditDelete(); + int addVtkFontPref( const QString&, + const int, + const QString&, + const bool = false); + + void connectView( const SUIT_ViewWindow* ); + -}; +private : + static SMESH::SMESH_Gen_var myComponentSMESH; + QDialog* myActiveDialogBox; + int myState; + QMap myRules; + LightApp_Displayer* myDisplayer; + + SMESHGUI_FilterLibraryDlg* myFilterLibraryDlg; + SMESHGUI_StudyId2MarkerMap myMarkerMap; + SMESHGUI_ClippingPlaneInfoMap myClippingPlaneInfoMap; + + vtkSmartPointer myEventCallbackCommand; + double myPriority; +}; -#endif +#endif // SMESHGUI_H