From: vsr Date: Thu, 10 Jun 2010 08:03:59 +0000 (+0000) Subject: Merge from V5_1_main 10/06/2010 X-Git-Tag: V6_1_0a1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=be20c3d07620f9793fe67c66bb12f5f95bf5fe83;p=modules%2Fgui.git Merge from V5_1_main 10/06/2010 --- diff --git a/adm_local/cmake_files/FindVTK.cmake b/adm_local/cmake_files/FindVTK.cmake index 480737678..71f7a605e 100644 --- a/adm_local/cmake_files/FindVTK.cmake +++ b/adm_local/cmake_files/FindVTK.cmake @@ -47,3 +47,11 @@ SET(VTK_LIBS ${VTK_LIBS} ${VTK_WIDGETS}) FIND_LIBRARY(vtkCommonPythonD vtkCommonPythonD ${VTK_LIBRARY_DIRS} NO_DEFAULT_PATH) FIND_LIBRARY(vtkGraphicsPythonD vtkGraphicsPythonD ${VTK_LIBRARY_DIRS} NO_DEFAULT_PATH) FIND_LIBRARY(vtkImagingPythonD vtkImagingPythonD ${VTK_LIBRARY_DIRS} NO_DEFAULT_PATH) + +IF(NOT WINDOWS) + IF(VTK_MAJOR_VERSION STREQUAL 5) + IF(VTK_MINOR_VERSION STREQUAL 0) + SET(VTK_INCLUDES ${VTK_INCLUDES} -Wno-deprecated) + ENDIF(VTK_MINOR_VERSION STREQUAL 0) + ENDIF(VTK_MAJOR_VERSION STREQUAL 5) +ENDIF(NOT WINDOWS) diff --git a/doc/salome/gui/images/pref32.png b/doc/salome/gui/images/pref32.png new file mode 100755 index 000000000..b2f2d50e2 Binary files /dev/null and b/doc/salome/gui/images/pref32.png differ diff --git a/doc/salome/gui/input/postpro_preferences.doc b/doc/salome/gui/input/postpro_preferences.doc index 54036ef32..6e2755a6b 100644 --- a/doc/salome/gui/input/postpro_preferences.doc +++ b/doc/salome/gui/input/postpro_preferences.doc @@ -122,6 +122,18 @@ structure of the study and can be visualized in a XY plot. +

Stream Lines Preferences

+ +\image html pref32.png + + +

Sweep and Animation Preferences

\image html ppref3.png diff --git a/doc/salome/gui/input/using_input_widgets.doc b/doc/salome/gui/input/using_input_widgets.doc index 2d0cb9bcb..fcb04f032 100755 --- a/doc/salome/gui/input/using_input_widgets.doc +++ b/doc/salome/gui/input/using_input_widgets.doc @@ -8,58 +8,57 @@ with SALOME GUI input widgets.

Spin boxes

This type of widgets is used for numeric (integer or floating-point) -data input. Spin boxes are used in standard \b SALOME modules in case -if an input value has clearly defined input range (and precision in -case of floating-point value). +data input. Spin boxes are used in standard \b SALOME modules if the +input value has a clearly defined input range (and precision in +case of a floating-point value). -Input precision has specific semantics in \b SALOME floating-point +Input precision has a specific semantics in \b SALOME floating-point spin boxes: -- Positive value means that a number in a fixed-point format -(corresponding to "f" format specifier for C printf function) is +- Positive precision value means that a number in the fixed-point format +(corresponding to the "f" format specifier for C printf function) is expected. Positive precision value is the maximum allowed number of digits after the decimal separator. -- Negative precision value means that a number either in a fixed-point -or scientific (exponetial) format is expected. This is similar to -behavior of "g" format specifier for C printf function. Absolute +- Negative precision value means that a number either in the fixed-point +or the scientific (exponetial) format is expected. This is similar to the +behavior of the "g" format specifier for C printf function. Negative precision value is the maximum allowed number of significant digits in mantissa (note that one digit is always before the decimal separator). To make the user aware of an input value constraints applied by some -\b SALOME operation, the following basic capabilties are provided by +\b SALOME operations, the following basic capabilties are provided by spin boxes: -- Text entered manually into a spin box by the user is checked to be a +- The text input manually in a spin box by the user is checked to be a number of valid type (integer or floating-point). -- The text is converted to a number and checked against the valid +- The text is converted to a number and checked to be within the valid range. - Additionally, for floating-point data the input text is checked against the precision rules described above. -In case if the input text in a spin box does not satisfy the -constraints, the user is informed about this by a message shown in a +If the input text in a spin box does not meet the +constraints, the user is shown a message in a tooltip near the spin box just as he types in it. The tooltip contains -information about valid data range. For floating-point input, the -tooltip also contains information about expected precision. +information about the valid data range. For a floating-point input, the +tooltip also contains information about the expected precision. -In standard \bSALOME modules precision value can be adjusted through -\ref setting_preferences_page "user preferences" of correspodning modules, and the tooltip contains a -reference to corresponding parameter in the preferences. +In standard \bSALOME modules the precision value can be adjusted through +\ref setting_preferences_page "user preferences" of the correspodning modules, and the tooltip contains a +reference to the corresponding parameter in the preferences. On-line documentation for each standard SALOME module contains the list of user preferences that can be used for tuning floating-point -precision for different type of input quantities. +precision for different types of input quantities.

Spin boxes and SALOME Notebook

-Apart from numeric input, spin boxes in some \b SALOME modules accept -names of \b Notebook variables (see \ref using_notebook "Using Notebook" +Apart from the numeric input, spin boxes in some \b SALOME modules accept +the names of \b Notebook variables (see \ref using_notebook "Using Notebook" page for more details about \b Notebook). -If some spin box accepts variable names, then it is -additionally checked whether the manual input text represents a variable name. Variable -names should satisfy common naming rules for \b Python variables. -In case if the input is neither a valid number nor a variable name, -the tooltip is shown informing the user that variable names are -also acceptable in this spin box. +If a spin box accepts variable names, then it is +additionally checked whether the manually input text represents a variable name. Variable +names should comply with the common naming rules for \b Python variables. +If the input is neither a valid number nor a variable name, +the tooltip informs the user that variable names are also acceptable in this spin box. */ diff --git a/src/OpenGLUtils/OpenGLUtils_FrameBuffer.cxx b/src/OpenGLUtils/OpenGLUtils_FrameBuffer.cxx index a5e81e813..e227f2642 100755 --- a/src/OpenGLUtils/OpenGLUtils_FrameBuffer.cxx +++ b/src/OpenGLUtils/OpenGLUtils_FrameBuffer.cxx @@ -132,7 +132,7 @@ bool OpenGLUtils_FrameBuffer::init( const GLsizei& xSize, const GLsizei& ySize ) if( !IsEXTInitialized || strstr( ext, "GL_EXT_framebuffer_object" ) == NULL ) { - INFOS( "Initializing OpenGL FrameBuffer extension failed" ); + MESSAGE( "Initializing OpenGL FrameBuffer extension failed" ); return false; } diff --git a/src/Qtx/QtxDoubleSpinBox.cxx b/src/Qtx/QtxDoubleSpinBox.cxx index f0560db9b..87120b243 100644 --- a/src/Qtx/QtxDoubleSpinBox.cxx +++ b/src/Qtx/QtxDoubleSpinBox.cxx @@ -28,6 +28,8 @@ #include +const double PSEUDO_ZERO = 1.e-20; + /*! \class QtxDoubleSpinBox \brief Enhanced version of the Qt's double spin box. @@ -263,6 +265,11 @@ void QtxDoubleSpinBox::stepBy( int steps ) myCleared = false; QDoubleSpinBox::stepBy( steps ); + double tmpval = value(); + if ( qAbs( tmpval ) < PSEUDO_ZERO ) tmpval = 0.; + if ( tmpval < minimum() ) tmpval = minimum(); + else if ( tmpval > maximum() ) tmpval = maximum(); + setValue( tmpval ); } /*! diff --git a/src/Qtx/QtxTreeView.cxx b/src/Qtx/QtxTreeView.cxx index ef551abc4..d86270d85 100644 --- a/src/Qtx/QtxTreeView.cxx +++ b/src/Qtx/QtxTreeView.cxx @@ -319,6 +319,22 @@ void QtxTreeView::selectionChanged( const QItemSelection& selected, emit( selectionChanged() ); } +/*! + \brief Called when rows are about to be removed. + \param parent model index + \param start first row to remove + \param end last row to remove +*/ +void QtxTreeView::rowsAboutToBeRemoved( const QModelIndex& parent, int start, int end ) +{ + QModelIndex curIndex = currentIndex(); + while ( curIndex.isValid() && curIndex.parent() != parent ) + curIndex = curIndex.parent(); + if ( curIndex.isValid() && curIndex.row() >= start && curIndex.row() <= end ) + setCurrentIndex( QModelIndex() ); + QTreeView::rowsAboutToBeRemoved( parent, start, end ); +} + /*! \brief Expand/collapse the specified item (recursively). \param index model index diff --git a/src/Qtx/QtxTreeView.h b/src/Qtx/QtxTreeView.h index af16b8284..d63c9bdad 100644 --- a/src/Qtx/QtxTreeView.h +++ b/src/Qtx/QtxTreeView.h @@ -57,6 +57,7 @@ public: protected slots: void onHeaderClicked( int ); + void rowsAboutToBeRemoved( const QModelIndex&, int, int ); void selectionChanged( const QItemSelection&, const QItemSelection& ); void onAppropriate( Qt::Orientation, int, int ); diff --git a/src/SUIT/SUIT_Study.h b/src/SUIT/SUIT_Study.h index d269c0be6..bd2ec1342 100755 --- a/src/SUIT/SUIT_Study.h +++ b/src/SUIT/SUIT_Study.h @@ -48,7 +48,7 @@ public: virtual int id() const; SUIT_DataObject* root() const; - QString studyName() const; + virtual QString studyName() const; SUIT_Application* application() const; virtual bool isSaved() const; diff --git a/src/SVTK/SVTK_Recorder.cxx b/src/SVTK/SVTK_Recorder.cxx index 84a3221eb..bba8a401f 100755 --- a/src/SVTK/SVTK_Recorder.cxx +++ b/src/SVTK/SVTK_Recorder.cxx @@ -322,7 +322,7 @@ int GetFrameIndex(double theStartTime, double theFPS) { - double aTimeNow = vtkTimerLog::GetCurrentTime(); + double aTimeNow = vtkTimerLog::GetUniversalTime(); double aDelta = aTimeNow - theStartTime; return int(aDelta*theFPS); } @@ -336,7 +336,7 @@ SVTK_Recorder if(myFrameIndex < 0){ myFrameIndex = 0; - myTimeStart = vtkTimerLog::GetCurrentTime(); + myTimeStart = vtkTimerLog::GetUniversalTime(); }else{ int aFrameIndex = GetFrameIndex(myTimeStart,myNbFPS); if(aFrameIndex <= myFrameIndex) diff --git a/src/SalomeApp/SalomeApp_Study.cxx b/src/SalomeApp/SalomeApp_Study.cxx index be3b09618..019b882b4 100644 --- a/src/SalomeApp/SalomeApp_Study.cxx +++ b/src/SalomeApp/SalomeApp_Study.cxx @@ -66,11 +66,30 @@ SalomeApp_Study::~SalomeApp_Study() int SalomeApp_Study::id() const { int id = -1; - if ( myStudyDS ) + if ( studyDS() ) id = studyDS()->StudyId(); return id; } +/*! + Get study name. +*/ +QString SalomeApp_Study::studyName() const +{ + // redefined from SUIT_Study to update study name properly since + // it can be changed outside of GUI + // TEMPORARILY SOLUTION: better to be implemented with help of SALOMEDS observers + if ( studyDS() ) { + QString newName = studyDS()->Name().c_str(); + if ( LightApp_Study::studyName() != newName ) { + SalomeApp_Study* that = const_cast( this ); + that->setStudyName( newName ); + ((SalomeApp_Application*)application())->updateDesktopTitle(); + } + } + return LightApp_Study::studyName(); +} + /*! Gets studyDS pointer. */ diff --git a/src/SalomeApp/SalomeApp_Study.h b/src/SalomeApp/SalomeApp_Study.h index fe281212d..597a3e069 100644 --- a/src/SalomeApp/SalomeApp_Study.h +++ b/src/SalomeApp/SalomeApp_Study.h @@ -42,6 +42,7 @@ public: virtual ~SalomeApp_Study(); virtual int id() const; + virtual QString studyName() const; virtual bool createDocument( const QString& ); virtual bool openDocument( const QString& ); diff --git a/src/SalomeApp/SalomeApp_VisualState.cxx b/src/SalomeApp/SalomeApp_VisualState.cxx index 689038fa6..0c06d2fd5 100644 --- a/src/SalomeApp/SalomeApp_VisualState.cxx +++ b/src/SalomeApp/SalomeApp_VisualState.cxx @@ -108,6 +108,10 @@ int SalomeApp_VisualState::storeState() if ( !study ) return -1; + // unlock study if it is locked + bool aLocked = study->studyDS()->GetProperties()->IsLocked(); + if (aLocked) study->studyDS()->GetProperties()->SetLocked(false); + int savePoint = 1; std::vector savePoints = study->getSavePoints(); //Calculate a new savePoint number = the last save point number + 1 @@ -182,6 +186,8 @@ int SalomeApp_VisualState::storeState() // set default name of new savePoint study->setNameOfSavePoint( savePoint, QObject::tr( "SAVE_POINT_DEF_NAME" ) + QString::number( savePoint ) ); + if (aLocked) study->studyDS()->GetProperties()->SetLocked(true); + return savePoint; } diff --git a/src/VTKViewer/VTKViewer_MarkerDlg.cxx b/src/VTKViewer/VTKViewer_MarkerDlg.cxx index baa4a1fda..5484bad62 100644 --- a/src/VTKViewer/VTKViewer_MarkerDlg.cxx +++ b/src/VTKViewer/VTKViewer_MarkerDlg.cxx @@ -20,8 +20,14 @@ #include "VTKViewer_MarkerDlg.h" #include "VTKViewer_MarkerWidget.h" +#include +#include +#include +#include + #include #include +#include /*! * Class : VTKViewer_MarkerDlg @@ -42,6 +48,8 @@ VTKViewer_MarkerDlg::VTKViewer_MarkerDlg( QWidget* theParent ) aTopLayout->setSpacing( 0 ); aTopLayout->setMargin( 0 ); aTopLayout->addWidget( myMarkerWidget ); + + connect( this, SIGNAL( dlgHelp() ), this, SLOT( onHelp() ) ); } /*! @@ -51,6 +59,48 @@ VTKViewer_MarkerDlg::~VTKViewer_MarkerDlg() { } +void VTKViewer_MarkerDlg::setHelpData( const QString& theModuleName, + const QString& theHelpFileName ) +{ + myModuleName = theModuleName; + myHelpFileName = theHelpFileName; +} + +void VTKViewer_MarkerDlg::keyPressEvent( QKeyEvent* e ) +{ + QtxDialog::keyPressEvent( e ); + if ( e->isAccepted() ) + return; + + if ( e->key() == Qt::Key_F1 ) { + e->accept(); + onHelp(); + } +} + +void VTKViewer_MarkerDlg::onHelp() +{ + if( myModuleName.isNull() || myHelpFileName.isNull() ) + return; + + SUIT_Application* app = SUIT_Session::session()->activeApplication(); + if (app) + app->onHelpContextModule(myModuleName, myHelpFileName); + else { + QString platform; +#ifdef WIN32 + platform = "winapplication"; +#else + platform = "application"; +#endif + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), + tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", + platform)). + arg(myHelpFileName)); + } +} + void VTKViewer_MarkerDlg::setCustomMarkerMap( VTK::MarkerMap theMarkerMap ) { myMarkerWidget->setCustomMarkerMap( theMarkerMap ); diff --git a/src/VTKViewer/VTKViewer_MarkerDlg.h b/src/VTKViewer/VTKViewer_MarkerDlg.h index 8cbe935e6..7e40c6131 100644 --- a/src/VTKViewer/VTKViewer_MarkerDlg.h +++ b/src/VTKViewer/VTKViewer_MarkerDlg.h @@ -39,6 +39,9 @@ public: VTKViewer_MarkerDlg( QWidget* = 0 ); virtual ~VTKViewer_MarkerDlg(); + void setHelpData( const QString& theModuleName, + const QString& theHelpFileName ); + void setCustomMarkerMap( VTK::MarkerMap ); VTK::MarkerMap getCustomMarkerMap(); @@ -48,8 +51,17 @@ public: VTK::MarkerScale getStandardMarkerScale() const; int getCustomMarkerID() const; +protected: + void keyPressEvent( QKeyEvent* ); + +private slots: + void onHelp(); + private: VTKViewer_MarkerWidget* myMarkerWidget; + + QString myModuleName; + QString myHelpFileName; }; #endif diff --git a/src/VTKViewer/VTKViewer_PolyDataMapper.cxx b/src/VTKViewer/VTKViewer_PolyDataMapper.cxx index 50ea7c8e3..2a0458d22 100644 --- a/src/VTKViewer/VTKViewer_PolyDataMapper.cxx +++ b/src/VTKViewer/VTKViewer_PolyDataMapper.cxx @@ -126,7 +126,7 @@ VTKViewer_PolyDataMapper::VTKViewer_PolyDataMapper() { Q_INIT_RESOURCE( VTKViewer ); - this->ExtensionsInitialized = 0; + this->ExtensionsInitialized = ES_None; this->PointSpriteTexture = 0; @@ -220,24 +220,18 @@ int VTKViewer_PolyDataMapper::GetMarkerTexture() } //----------------------------------------------------------------------------- -bool VTKViewer_PolyDataMapper::InitExtensions() +int VTKViewer_PolyDataMapper::InitExtensions() { - if( this->ExtensionsInitialized ) - return true; - - InitializeBufferExtensions(); - char* ext = (char*)glGetString( GL_EXTENSIONS ); if( !IsBufferExtensionsInitialized || strstr( ext, "GL_ARB_point_sprite" ) == NULL || strstr( ext, "GL_ARB_vertex_buffer_object" ) == NULL ) { - INFOS("Initializing ARB extensions failed"); - return false; + MESSAGE("Initializing ARB extensions failed"); + return ES_Error; } - this->ExtensionsInitialized = 1; - return true; + return ES_Ok; } //----------------------------------------------------------------------------- @@ -296,7 +290,8 @@ void VTKViewer_PolyDataMapper::RenderPiece( vtkRenderer* ren, vtkActor* act ) bool isUsePointSprites = this->MarkerEnabled && this->MarkerType != VTK::MT_NONE; if( isUsePointSprites ) { - this->InitExtensions(); + if( this->ExtensionsInitialized == ES_None ) + this->ExtensionsInitialized = this->InitExtensions(); this->InitPointSprites(); this->InitTextures(); } @@ -542,7 +537,7 @@ int VTKViewer_PolyDataMapper::Draw( vtkRenderer* ren, vtkActor* act ) delete aColorFunctor; } - if( this->ExtensionsInitialized ) { + if( this->ExtensionsInitialized == ES_Ok ) { GLuint aBufferObjectID = 0; vglGenBuffersARB( 1, &aBufferObjectID ); vglBindBufferARB( GL_ARRAY_BUFFER_ARB, aBufferObjectID ); diff --git a/src/VTKViewer/VTKViewer_PolyDataMapper.h b/src/VTKViewer/VTKViewer_PolyDataMapper.h index 38b4838fb..9b936f8f9 100644 --- a/src/VTKViewer/VTKViewer_PolyDataMapper.h +++ b/src/VTKViewer/VTKViewer_PolyDataMapper.h @@ -55,6 +55,9 @@ class vtkImageData; */ class VTKVIEWER_EXPORT VTKViewer_PolyDataMapper : public MAPPER_SUPERCLASS { +public: + enum ExtensionsState { ES_None = 0, ES_Error, ES_Ok }; + public: static VTKViewer_PolyDataMapper* New(); vtkTypeRevisionMacro( VTKViewer_PolyDataMapper, MAPPER_SUPERCLASS ); @@ -88,7 +91,7 @@ protected: ~VTKViewer_PolyDataMapper(); //! Initializing OpenGL extensions. - bool InitExtensions(); + int InitExtensions(); //! Activate Point Sprites. void InitPointSprites();