SalomeApp_StudyPropertiesDlg.h \
SalomeApp_CheckFileDlg.h \
SalomeApp_Operation.h \
- SalomeApp_Dialog.h
+ SalomeApp_Dialog.h \
+ SalomeApp_UpdateFlags.h
# .po files to transform in .qm
PO_FILES = SalomeApp_images.po \
# Libraries targets
LIB = libSalomeApp.la
-LIB_SRC= SalomeApp_AboutDlg.cxx \
+LIB_SRC= SalomeApp_Module.cxx \
+ SalomeApp_AboutDlg.cxx \
SalomeApp_Application.cxx \
SalomeApp_DataModel.cxx \
SalomeApp_DataObject.cxx \
SalomeApp_VTKSelector.cxx \
SalomeApp_OBSelector.cxx \
SalomeApp_GLSelector.cxx \
- SalomeApp_Module.cxx \
SalomeApp_Study.cxx \
SalomeApp_WidgetContainer.cxx \
SalomeApp_ExceptionHandler.cxx \
#include "SalomeApp_DataModel.h"
#include "SalomeApp_Application.h"
#include "SalomeApp_Preferences.h"
+#include "SalomeApp_UpdateFlags.h"
#include <OB_Browser.h>
#include <QtxPopupMgr.h>
+#include <SVTK_ViewWindow.h>
+#include <OCCViewer_ViewWindow.h>
+#include <OCCViewer_ViewPort3d.h>
+#include <GLViewer_ViewFrame.h>
+#include <GLViewer_ViewPort.h>
+#include <Plot2d_ViewWindow.h>
+
SalomeApp_Module::SalomeApp_Module( const QString& name )
: CAM_Module( name ),
myPopupMgr( 0 )
if ( pref )
pref->setProperty( id, prop, var );
}
+
+void SalomeApp_Module::update( const int flags )
+{
+ if ( flags & UF_Model )
+ {
+ if( CAM_DataModel* aDataModel = dataModel() )
+ if( SalomeApp_DataModel* aModel = dynamic_cast<SalomeApp_DataModel*>( aDataModel ) )
+ aModel->update( 0, dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() ) );
+ }
+ else if ( flags & UF_ObjBrowser )
+ getApp()->objectBrowser()->updateTree( 0 );
+ else if ( flags & UF_Controls )
+ updateControls();
+ else if ( flags & UF_Viewer )
+ {
+ if ( SUIT_ViewManager* viewMgr = getApp()->activeViewManager() )
+ if ( SUIT_ViewWindow* viewWnd = viewMgr->getActiveView() )
+ {
+ if ( viewWnd->inherits( "SVTK_ViewWindow" ) )
+ ( (SVTK_ViewWindow*)viewWnd )->Repaint();
+ else if ( viewWnd->inherits( "OCCViewer_ViewWindow" ) )
+ ( (OCCViewer_ViewWindow*)viewWnd )->getViewPort()->onUpdate();
+ else if ( viewWnd->inherits( "Plot2d_ViewWindow" ) )
+ ( (Plot2d_ViewWindow*)viewWnd )->getViewFrame()->Repaint();
+ else if ( viewWnd->inherits( "GLViewer_ViewFrame" ) )
+ ( (GLViewer_ViewFrame*)viewWnd )->getViewPort()->onUpdate();
+ }
+ }
+
+}
+
+void SalomeApp_Module::updateControls()
+{
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& );
virtual void createPreferences();
-
+
// Convenient shortcuts
SalomeApp_Application* getApp() const;
-
- void updateObjBrowser( bool = true, SUIT_DataObject* = 0 );
+ virtual void update( const int );
+ // Update viewer or/and object browser etc. in accordance with update flags
+ // ( see SalomeApp_UpdateFlags enumeration ). Derived modules can redefine this method
+ // for their own purposes
+
+ void updateObjBrowser( bool = true, SUIT_DataObject* = 0 );
+ // Update object bropwser ( for updating model or whole object browser use update() method
+ // can be used )
+
virtual void selectionChanged();
virtual void preferencesChanged( const QString&, const QString& );
virtual CAM_DataModel* createDataModel();
virtual SalomeApp_Selection* createSelection() const;
+ virtual void updateControls();
int addPreference( const QString& label );
int addPreference( const QString& label, const int pId, const int = -1,
- const QString& section = QString::null,
- const QString& param = QString::null );
+ const QString& section = QString::null,
+ const QString& param = QString::null );
QVariant preferenceProperty( const int, const QString& ) const;
void setPreferenceProperty( const int, const QString&, const QVariant& );
return SUIT_Operation::eventFilter( obj, e );
}
-
-
+//=======================================================================
+// name : eventFilter
+// Purpose : Block mouse and key events if operator is not active one
+//=======================================================================
+void SalomeApp_Operation::update( const int flags )
+{
+ if ( myModule != 0 )
+ myModule->update( flags );
+}
SalomeApp_SelectionMgr* selectionMgr() const;
// Get selection manager
+ void update( const int );
+ // Call update() method of module ( see SalomeApp_Module for description )
+
private slots:
virtual void onSelectionDone();
--- /dev/null
+// SALOME SalomeApp
+//
+// Copyright (C) 2005 CEA/DEN, EDF R&D
+//
+//
+//
+// File : SalomeApp_UpdateFlags.h
+// Author : Sergey LITONIN
+// Module : SALOME
+
+
+#ifndef SalomeApp_UpdateFlags_H
+#define SalomeApp_UpdateFlags_H
+
+/*
+ Enum : UpdateFlags
+ Description : Enumeration for update flags. First byte is reserved for SalomeApp_Module.
+ Modules derived from this model must use other 3 bytes to define their
+ own update flags
+*/
+
+typedef enum
+{
+ UF_Forced = 0x00000001,
+ UF_Model = 0x00000002,
+ UF_Viewer = 0x00000004,
+ UF_ObjBrowser = 0x00000008,
+ UF_Controls = 0x00000010,
+} UpdateFlags;
+
+#endif
+
+
+
+
+
+