From dbac576eefa66ce71440744deb33c20eda6d05f8 Mon Sep 17 00:00:00 2001 From: vsr Date: Thu, 10 Jul 2008 08:32:48 +0000 Subject: [PATCH] Merge from V4_1_0_maintainance branch (from tag mergeto_BR_QT4_Dev_08Jul08) --- adm_local/unix/config_files/check_opengl.m4 | 10 +- adm_local/unix/config_files/check_qwt.m4 | 159 ++-- .../gui/GUI/images/occviewer_axialscale.png | Bin 0 -> 329 bytes .../gui/GUI/images/occviewer_toolbar.png | Bin 0 -> 4762 bytes doc/salome/gui/GUI/images/polyselection1.png | Bin 0 -> 4262 bytes doc/salome/gui/GUI/images/polyselection2.png | Bin 0 -> 2114 bytes doc/salome/gui/GUI/input/occ_3d_viewer.doc | 19 +- doc/salome/gui/GUI/input/opening_studies.doc | 4 + src/CAM/CAM_Module.cxx | 8 + src/CAM/CAM_Module.h | 2 + src/LightApp/LightApp_Application.cxx | 89 ++- src/LightApp/LightApp_Application.h | 7 +- src/LightApp/LightApp_Module.cxx | 32 + src/LightApp/LightApp_Module.h | 2 + src/LightApp/LightApp_ModuleDlg.cxx | 2 + src/LightApp/resources/LightApp.xml | 6 + src/LightApp/resources/LightApp_msg_en.ts | 45 ++ src/OCCViewer/Makefile.am | 8 +- src/OCCViewer/OCCViewer_AxialScaleDlg.cxx | 176 +++++ src/OCCViewer/OCCViewer_AxialScaleDlg.h | 54 ++ src/OCCViewer/OCCViewer_ClippingDlg.cxx | 6 +- .../OCCViewer_CreateRestoreViewDlg.cxx | 1 + .../OCCViewer_SetRotationPointDlg.cxx | 11 + src/OCCViewer/OCCViewer_SetRotationPointDlg.h | 3 + src/OCCViewer/OCCViewer_ViewModel.cxx | 14 + src/OCCViewer/OCCViewer_ViewModel.h | 3 + src/OCCViewer/OCCViewer_ViewWindow.cxx | 78 +- src/OCCViewer/OCCViewer_ViewWindow.h | 8 +- src/OCCViewer/resources/OCCViewer_images.ts | 4 + src/OCCViewer/resources/OCCViewer_msg_en.ts | 33 +- src/OCCViewer/resources/occ_view_scaling.png | Bin 0 -> 453 bytes src/Plot2d/Plot2d_Curve.cxx | 6 +- src/Plot2d/Plot2d_ViewFrame.cxx | 8 +- src/Plot2d/Plot2d_ViewManager.cxx | 25 +- src/Plot2d/Plot2d_ViewManager.h | 2 + src/Plot2d/Plot2d_ViewModel.cxx | 31 +- src/Plot2d/Plot2d_ViewModel.h | 9 +- src/Qtx/QtxWorkstack.cxx | 115 ++- src/Qtx/QtxWorkstack.h | 5 +- src/SALOME_PYQT/SALOME_PYQT_GUI/Makefile.am | 4 +- .../SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx | 241 ++++++ .../SALOME_PYQT_GUI/SALOME_PYQT_Module.h | 13 + src/SALOME_PYQT/SalomePyQt/Makefile.am | 8 +- src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx | 695 +++++++++++++++++- src/SALOME_PYQT/SalomePyQt/SalomePyQt.h | 51 +- src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip | 46 +- src/SPlot2d/SPlot2d_ViewModel.cxx | 7 +- src/SUIT/SUIT_Application.cxx | 15 +- src/SUIT/SUIT_FileDlg.cxx | 9 + src/SUIT/SUIT_FileDlg.h | 2 + src/SUIT/SUIT_Session.cxx | 2 +- src/SUIT/SUIT_ViewWindow.cxx | 8 + src/SUIT/SUIT_ViewWindow.h | 2 + src/SVTK/SALOME_Actor.cxx | 2 +- src/SVTK/SVTK_CubeAxesDlg.cxx | 162 ++-- src/SVTK/SVTK_CubeAxesDlg.h | 63 +- src/SVTK/SVTK_RectPicker.cxx | 2 +- src/SVTK/SVTK_Selector.cxx | 30 +- src/SVTK/resources/SVTK_msg_en.ts | 61 +- src/SalomeApp/SalomeApp_Application.cxx | 106 +-- src/SalomeApp/SalomeApp_DataObject.cxx | 12 +- src/SalomeApp/resources/SalomeApp.xml | 10 +- src/SalomeApp/resources/SalomeApp_msg_en.ts | 8 +- src/Session/SALOME_Session_Server.cxx | 118 +-- src/VTKViewer/VTKViewer_GeometryFilter.cxx | 2 +- 65 files changed, 2096 insertions(+), 568 deletions(-) create mode 100644 doc/salome/gui/GUI/images/occviewer_axialscale.png create mode 100644 doc/salome/gui/GUI/images/occviewer_toolbar.png create mode 100755 doc/salome/gui/GUI/images/polyselection1.png create mode 100755 doc/salome/gui/GUI/images/polyselection2.png create mode 100644 src/OCCViewer/OCCViewer_AxialScaleDlg.cxx create mode 100644 src/OCCViewer/OCCViewer_AxialScaleDlg.h create mode 100644 src/OCCViewer/resources/occ_view_scaling.png diff --git a/adm_local/unix/config_files/check_opengl.m4 b/adm_local/unix/config_files/check_opengl.m4 index a1eb48ee2..baa90a374 100644 --- a/adm_local/unix/config_files/check_opengl.m4 +++ b/adm_local/unix/config_files/check_opengl.m4 @@ -30,7 +30,7 @@ AC_LANG_CPLUSPLUS AC_ARG_WITH(opengl, [AC_HELP_STRING([--with-opengl=DIR],[root directory path of OpenGL installation])], [opengl_dir="$withval"], - [dirs="/usr/lib${LIB_LOCATION_SUFFIX} /usr/local/lib${LIB_LOCATION_SUFFIX} /opt/graphics/OpenGL/lib${LIB_LOCATION_SUFFIX} /usr/openwin/lib${LIB_LOCATION_SUFFIX} /usr/X11R6/lib${LIB_LOCATION_SUFFIX}"])dnl + [dirs="/usr/lib64 /usr/lib /usr/local/lib64 /usr/local/lib /opt/graphics/OpenGL/lib64 /opt/graphics/OpenGL/lib /usr/openwin/lib64 /usr/openwin/lib /usr/X11R6/lib64 /usr/X11R6/lib"])dnl AC_CHECKING(for OpenGL) AC_CHECKING(for OpenGL headers) @@ -107,7 +107,7 @@ if test "x${OpenGL_headers_ok}" = "xyes" ; then for idir in $dirs; do if test -r "${idir}/libGL.so"; then AC_MSG_RESULT(in ${idir}) - if test "x${idir}" = "x/usr/lib${LIB_LOCATION_SUFFIX}" ; then + if test "x${idir}" = "x/usr/lib64" -o "x${idir}" = "x/usr/lib" ; then GL_LIB_PATH="" else GL_LIB_PATH="-L${idir}" @@ -117,7 +117,7 @@ if test "x${OpenGL_headers_ok}" = "xyes" ; then # under IRIX ? if test -r "${idir}/libGL.sl"; then AC_MSG_RESULT(in ${idir}) - if test "x${idir}" = "x/usr/lib${LIB_LOCATION_SUFFIX}" ; then + if test "x${idir}" = "x/usr/lib64" -o "x${idir}" = "x/usr/lib" ; then GL_LIB_PATH="" else GL_LIB_PATH="-L${idir}" @@ -144,7 +144,7 @@ if test "x${OpenGL_libs_ok}" = "xyes" ; then for idir in $dirs; do if test -r "${idir}/libGLU.so"; then AC_MSG_RESULT(in ${idir}) - if test "x${idir}" = "x/usr/lib${LIB_LOCATION_SUFFIX}" ; then + if test "x${idir}" = "x/usr/lib64" -o "x${idir}" = "x/usr/lib" ; then GLU_LIB_PATH="" else GLU_LIB_PATH="-L${idir}" @@ -154,7 +154,7 @@ if test "x${OpenGL_libs_ok}" = "xyes" ; then # under IRIX ? if test -r "${idir}/libGLU.sl"; then AC_MSG_RESULT(in ${idir}) - if test "x${idir}" = "x/usr/lib${LIB_LOCATION_SUFFIX}" ; then + if test "x${idir}" = "x/usr/lib64" -o "x${idir}" = "x/usr/lib" ; then GLU_LIB_PATH="" else GLU_LIB_PATH="-L${idir}" diff --git a/adm_local/unix/config_files/check_qwt.m4 b/adm_local/unix/config_files/check_qwt.m4 index 8ce6420b7..b46528b12 100644 --- a/adm_local/unix/config_files/check_qwt.m4 +++ b/adm_local/unix/config_files/check_qwt.m4 @@ -6,9 +6,12 @@ AC_REQUIRE([AC_LINKER_OPTIONS])dnl AC_CHECKING(for qwt) +AC_LANG_SAVE +AC_LANG_CPLUSPLUS + qwt_ok=yes -dnl were is qwt ? +dnl where is qwt ? AC_ARG_WITH(qwt, [ --with-qwt=DIR directory path to QWT installation ], @@ -18,47 +21,49 @@ AC_ARG_WITH(qwt, AC_ARG_WITH(qwt_inc, [ --with-qwt_inc=DIR directory path to QWT includes ], - [QWT_INCLUDES="$withval" + [QWT_INCDIR="$withval" AC_MSG_RESULT("select $withval as path to QWT includes") ]) if test -z $QWTHOME; then AC_MSG_RESULT(QWTHOME not defined) - exits_ok=no - if test "x$exits_ok" = "xno"; then + exist_ok=no + if test "x$exist_ok" = "xno"; then for d in /usr/local /usr ; do - AC_CHECK_FILE(${d}/lib${LIB_LOCATION_SUFFIX}/libqwt.so,exits_ok=yes,exits_ok=no) - if test "x$exits_ok" = "xyes"; then + AC_CHECK_FILE(${d}/lib${LIB_LOCATION_SUFFIX}/libqwt.so,exist_ok=yes,exist_ok=no) + if test "x$exist_ok" = "xyes"; then QWTHOME=$d AC_MSG_RESULT(libqwt.so detected in $d/lib) fi done fi - if test "x$exits_ok" = "xno"; then + if test "x$exist_ok" = "xno"; then for d in `echo $LD_LIBRARY_PATH | sed -e "s/:/ /g"` ; do if test -f $d/libqwt.so ; then AC_MSG_RESULT(libqwt.so detected in $d) QWTHOME=$d QWTHOME=`echo ${QWTHOME} | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"` - exits_ok=yes + exist_ok=yes break fi done fi - if test "x$exits_ok" = "xyes"; then - if test -z $QWT_INCLUDES; then - QWT_INCLUDES=$QWTHOME"/include/qwt" - if test ! -f $QWT_INCLUDES/qwt.h ; then - QWT_INCLUDES=$QWTHOME"/include" + if test "x$exist_ok" = "xyes"; then + if test -z $QWT_INCDIR; then + QWT_INCDIR=$QWTHOME"/include/qwt" + if test ! -f $QWT_INCDIR/qwt.h ; then + QWT_INCDIR=$QWTHOME"/include" fi - if test ! -f $QWT_INCLUDES/qwt.h ; then - QWT_INCLUDES=/usr/lib/qt4/include/qwt + if test ! -f $QWT_INCDIR/qwt.h ; then + QWT_INCDIR=/usr/lib/qt4/include/qwt fi fi + else + qwt_ok=no fi else - if test -z $QWT_INCLUDES; then - QWT_INCLUDES="$QWTHOME/include" + if test -z $QWT_INCDIR; then + QWT_INCDIR="$QWTHOME/include" fi fi @@ -67,92 +72,80 @@ if test "x$qwt_ok" = xno -o ! -d "$QWTHOME" ; then AC_MSG_WARN(qwt not found) qwt_ok=no else - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - CPPFLAGS_old=$CPPFLAGS - CPPFLAGS="$CPPFLAGS -I$QWT_INCLUDES" - CPPFLAGS="$CPPFLAGS $QT_INCLUDES" + CPPFLAGS_old=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $QT_INCLUDES -I$QWT_INCDIR" - AC_CHECK_HEADER(qwt.h,qwt_ok=yes,qwt_ok=no) + AC_CHECK_HEADER(qwt.h,qwt_ok=yes,qwt_ok=no) + CPPFLAGS=$CPPFLAGS_old - CPPFLAGS=$CPPFLAGS_old + AC_MSG_CHECKING(include of qwt headers) - if test "x$qwt_ok" = xno ; then - AC_MSG_RESULT(no) - AC_MSG_WARN(qwt not found) + if test "x$qwt_ok" = xno ; then + AC_MSG_RESULT(no) + AC_MSG_WARN(qwt not found) else - qwt_ok=yes + AC_MSG_RESULT(yes) + QWT_INCLUDES=-I$QWT_INCDIR fi -# -# test Qwt libraries -# -if test "x$qwt_ok" = "xyes" -then - AC_MSG_CHECKING(linking qwt library) - LIBS_old=$LIBS - if test "x$QTDIR" = "x/usr" - then - QT_LIB_DIR="" - else - QT_LIB_DIR="-L$QTDIR/lib${LIB_LOCATION_SUFFIX}" - fi - LIBS="$LIBS $QT_LIB_DIR -lQtCore -lQtGui" + # + # test Qwt libraries + # + if test "x$qwt_ok" = "xyes" ; then + AC_MSG_CHECKING(linking qwt library) - if test "x$QWTHOME" = "x/usr" - then - LIBS="$LIBS -lqwt" - else - LIBS="$LIBS -L$QWTHOME/lib -lqwt" - fi + LIBS_old=$LIBS + LIBS="$LIBS $QT_LIBS" + if test "x$QWTHOME" = "x/usr" ; then + LIBS="$LIBS -lqwt" + else + LIBS="$LIBS -L$QWTHOME/lib -lqwt" + fi - CXXFLAGS_old=$CXXFLAGS - CXXFLAGS="$CXXFLAGS $QT_INCLUDES -I$QWT_INCLUDES" + CXXFLAGS_old=$CXXFLAGS + CXXFLAGS="$CXXFLAGS $QT_INCLUDES $QWT_INCLUDES" - AC_CACHE_VAL(salome_cv_lib_qwt,[ - AC_TRY_LINK( + AC_CACHE_VAL(salome_cv_lib_qwt,[ + AC_TRY_LINK( #include #include -, int n; - char **s; - QApplication a(n, s); - QwtPlot p; - p.resize( 600, 400 ); - p.show(); - a.exec();, - eval "salome_cv_lib_qwt=yes",eval "salome_cv_lib_qwt=no") - ]) - qwt_ok="$salome_cv_lib_qwt" - - if test "x$qwt_ok" = "xno" - then - AC_MSG_RESULT(unable to link with qwt library) - AC_MSG_RESULT(QWTHOME environment variable may be wrong) - else - QWT_INCLUDES="-I$QWT_INCLUDES" - if test "x$QWTHOME" = "x/usr" - then - QWT_LIBS=" -lqwt" +, int n; + char **s; + QApplication a(n, s); + QwtPlot p; + p.resize( 600, 400 ); + p.show(); + a.exec();, + eval "salome_cv_lib_qwt=yes",eval "salome_cv_lib_qwt=no") + ]) + qwt_ok="$salome_cv_lib_qwt" + + if test "x$qwt_ok" = "xno" ; then + AC_MSG_RESULT(unable to link with qwt library) + AC_MSG_RESULT(QWTHOME environment variable may be wrong) else - QWT_LIBS="-L$QWTHOME/lib -lqwt" + AC_MSG_RESULT(yes) + if test "x$QWTHOME" = "x/usr" ; then + QWT_LIBS=" -lqwt" + else + QWT_LIBS="-L$QWTHOME/lib -lqwt" + fi fi - AC_SUBST(QWT_INCLUDES) - AC_SUBST(QWT_LIBS) - - AC_MSG_RESULT(yes) + LIBS=$LIBS_old + CXXFLAGS=$CXXFLAGS_old fi - - LIBS=$LIBS_old - CXXFLAGS=$CXXFLAGS_old - fi +AC_SUBST(QWT_INCLUDES) +AC_SUBST(QWT_LIBS) - AC_LANG_RESTORE +AC_LANG_RESTORE -fi +AC_MSG_RESULT(for qwt: $qwt_ok) +# Save cache +AC_CACHE_SAVE ])dnl dnl diff --git a/doc/salome/gui/GUI/images/occviewer_axialscale.png b/doc/salome/gui/GUI/images/occviewer_axialscale.png new file mode 100644 index 0000000000000000000000000000000000000000..82277c3fe00f72aebaf80f313d8a2b6298f2c6a4 GIT binary patch literal 329 zcmeAS@N?(olHy`uVBq!ia0vp^GC(ZJ!3-ot<@SjJDYF2d5LX~A5cOW*+=LFur2cq}if#Co5|NsA2CA_Nv>f|i&h%9Dc z;1&j9Muu5)B!GhKC7!;n>^E4L_@srs)c!sP3N7<=aSYKofAri%zGeds)_{ zE2}-QPVt&<>i2nKOHH@D-n-bG_bShPNy~zLhcb3?ZVBG}zQmYiSH`T)fBLCUUP&z6 zu<)no4U>JBnLpmMkzIRIYy44$rjF6*2UngD~?h}8f9 literal 0 HcmV?d00001 diff --git a/doc/salome/gui/GUI/images/occviewer_toolbar.png b/doc/salome/gui/GUI/images/occviewer_toolbar.png new file mode 100644 index 0000000000000000000000000000000000000000..611504328c724f1d0b27d7ff9875a879db1d7ee1 GIT binary patch literal 4762 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 literal 0 HcmV?d00001 diff --git a/doc/salome/gui/GUI/images/polyselection1.png b/doc/salome/gui/GUI/images/polyselection1.png new file mode 100755 index 0000000000000000000000000000000000000000..1920e972d43026b334f8a876b5c764a926e4c453 GIT binary patch literal 4262 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 F{s#~f8cqNJ literal 0 HcmV?d00001 diff --git a/doc/salome/gui/GUI/input/occ_3d_viewer.doc b/doc/salome/gui/GUI/input/occ_3d_viewer.doc index 6638facb1..87b874d2b 100644 --- a/doc/salome/gui/GUI/input/occ_3d_viewer.doc +++ b/doc/salome/gui/GUI/input/occ_3d_viewer.doc @@ -14,7 +14,7 @@ Toolbar. Buttons marked with small downward triangles have extended functionality which can be accessed by locking on them with left mouse button. -\image html image95.gif "Viewer Toolbar" +\image html occviewer_toolbar.png "Viewer Toolbar"
\image html image77.gif @@ -105,7 +105,6 @@ objects in the scene. (clipping planes) of geometrical objects. \image html clipping.png -
  • Base point - allows to define the coordinates of the base point for the clipping plane.
  • @@ -121,5 +120,19 @@ and which will remain after clipping.
  • Preview - allows to see the results of clipping in the viewer.
+
+\image html occviewer_axialscale.png +\n
Scaling - represents objects deformed (stretched or +stuffed) along the axes of coordinates.
+ +Note! OCC Viewer features a special Polyline Selection mechanism, which allows selecting an arbitraty part of the graphic area using a polygon frame, instead of the usual selection with a rectangular frame. + +To produce a Polyline Selection, lock the right mouse button and draw the first side of the polygon, then change the direction by clicking the left mouse button add draw another side, etc. The whole selection frame is drawn with the locked right mouse button. + +\image html polyselection1.png + +As a result, only the nodes within the frame are selected. + +\image html polyselection2.png -*/ \ No newline at end of file +*/ diff --git a/doc/salome/gui/GUI/input/opening_studies.doc b/doc/salome/gui/GUI/input/opening_studies.doc index 0c44f27a7..857ef07dc 100644 --- a/doc/salome/gui/GUI/input/opening_studies.doc +++ b/doc/salome/gui/GUI/input/opening_studies.doc @@ -21,6 +21,10 @@ created and unloaded and click \b Ok button: \image html loadstudy2.png +\par +Alternatively, it is possible to select File > Most Recently Used > to select a study from the list. + + \n\b Tip: After opening an existing study, you will see its structure in the \ref using_object_browser_page "Object Browser". It will contain the objects created with the help of different components during the previous study session. If you diff --git a/src/CAM/CAM_Module.cxx b/src/CAM/CAM_Module.cxx index 6d76b6097..13f20b8ec 100755 --- a/src/CAM/CAM_Module.cxx +++ b/src/CAM/CAM_Module.cxx @@ -178,6 +178,14 @@ CAM_Application* CAM_Module::application() const return myApp; } +/*! + \brief If return false, selection will be cleared at module activation +*/ +bool CAM_Module::isSelectionCompatible() +{ + return false; +} + /*! \brief Activate module. diff --git a/src/CAM/CAM_Module.h b/src/CAM/CAM_Module.h index df358c9e6..38f00862d 100755 --- a/src/CAM/CAM_Module.h +++ b/src/CAM/CAM_Module.h @@ -91,6 +91,8 @@ private slots: void onInfoChanged( QString ); protected: + virtual bool isSelectionCompatible(); + virtual CAM_DataModel* createDataModel(); void setName( const QString& ); diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index a730a0515..9cc19a01a 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -70,6 +70,7 @@ #include #include #include +#include #include @@ -142,6 +143,8 @@ #include #include +#include + #define FIRST_HELP_ID 1000000 #ifndef DISABLE_SALOMEOBJECT @@ -418,9 +421,9 @@ void LightApp_Application::createActionForViewer( const int id, const int accel ) { QAction* a = createAction( id, tr( QString( "NEW_WINDOW_%1" ).arg( suffix ).toLatin1().constData() ), QIcon(), - tr( QString( "NEW_WINDOW_%1" ).arg( suffix ).toLatin1().constData() ), - tr( QString( "NEW_WINDOW_%1" ).arg( suffix ).toLatin1().constData() ), - accel, desktop(), false, this, SLOT( onNewWindow() ) ); + tr( QString( "NEW_WINDOW_%1" ).arg( suffix ).toLatin1().constData() ), + tr( QString( "NEW_WINDOW_%1" ).arg( suffix ).toLatin1().constData() ), + accel, desktop(), false, this, SLOT( onNewWindow() ) ); createMenu( a, parentId, -1 ); } @@ -551,9 +554,9 @@ void LightApp_Application::createActions() if ( icon.isNull() ) { icon = modIcon; - printf( "****************************************************************\n" ); - printf( "* Icon for %s not found. Using the default one.\n", (*it).toLatin1().constData() ); - printf( "****************************************************************\n" ); + INFOS ( "****************************************************************" << std::endl + << "* Icon for " << (*it).toLatin1().constData() << " not found. Using the default one." << std::endl + << "****************************************************************" << std::endl ); } icon = Qtx::scaleIcon( icon, iconSize ); @@ -568,8 +571,18 @@ void LightApp_Application::createActions() // New window int windowMenu = createMenu( tr( "MEN_DESK_WINDOW" ), -1, MenuWindowId, 100 ); int newWinMenu = createMenu( tr( "MEN_DESK_NEWWINDOW" ), windowMenu, -1, 0 ); - createMenu( separator(), windowMenu, -1, 1 ); + createAction( CloseId, tr( "TOT_CLOSE" ), QIcon(), tr( "MEN_DESK_CLOSE" ), tr( "PRP_CLOSE" ), + Qt::SHIFT+Qt::Key_C, desk, false, this, SLOT( onCloseWindow() ) ); + createAction( CloseAllId, tr( "TOT_CLOSE_ALL" ), QIcon(), tr( "MEN_DESK_CLOSE_ALL" ), tr( "PRP_CLOSE_ALL" ), + 0, desk, false, this, SLOT( onCloseAllWindow() ) ); + createAction( GroupAllId, tr( "TOT_GROUP_ALL" ), QIcon(), tr( "MEN_DESK_GROUP_ALL" ), tr( "PRP_GROUP_ALL" ), + 0, desk, false, this, SLOT( onGroupAllWindow() ) ); + + createMenu( CloseId, windowMenu, 0, -1 ); + createMenu( CloseAllId, windowMenu, 0, -1 ); + createMenu( GroupAllId, windowMenu, 0, -1 ); + createMenu( separator(), windowMenu, -1, 0 ); #ifndef DISABLE_GLVIEWER createActionForViewer( NewGLViewId, newWinMenu, QString::number( 0 ), Qt::ALT+Qt::Key_G ); @@ -1782,6 +1795,8 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref ) pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), vtkGroup, LightApp_Preferences::Color, "VTKViewer", "background" ); pref->addPreference( tr( "PREF_RELATIVE_SIZE" ), vtkGroup, LightApp_Preferences::Bool, "VTKViewer", "relative_size" ); + pref->addPreference( tr( "PREF_USE_ADVANCED_SELECTION_ALGORITHM" ), vtkGroup, + LightApp_Preferences::Bool, "VTKViewer", "use_advanced_selection_algorithm" ); pref->setItemProperty( "min", 1.0E-06, vtkTS ); pref->setItemProperty( "max", 150, vtkTS ); @@ -2106,8 +2121,10 @@ void LightApp_Application::loadPreferences() if ( mru_load ) { QtxMRUAction* mru = ::qobject_cast( action( MRUId ) ); - if ( mru ) + if ( mru ) { + mru->setVisibleCount( aResMgr->integerValue( "MRU", "max_count", 5 ) ); mru->loadLinks( aResMgr, "MRU" ); + } mru_load = false; } @@ -2629,6 +2646,53 @@ void LightApp_Application::onRenameWindow() w->setWindowTitle( name ); } +/*! + Closes active window of desktop +*/ +void LightApp_Application::onCloseWindow() +{ + if( !desktop() ) + return; + + QWidget* w = desktop()->activeWindow(); + if( !w ) + return; + + w->close(); +} + +/*! + Closes all windows of desktop +*/ +void LightApp_Application::onCloseAllWindow() +{ + STD_TabDesktop* desk = dynamic_cast( desktop() ); + if( !desk ) + return; + + QList wndList = desk->windows(); + SUIT_ViewWindow* wnd; + foreach( wnd, wndList ) + { + if ( wnd ) + wnd->close(); + } +} + +/*! + Groups all windows of desktop +*/ +void LightApp_Application::onGroupAllWindow() +{ + STD_TabDesktop* desk = dynamic_cast( desktop() ); + if( !desk ) + return; + + QtxWorkstack* wgStack = desk->workstack(); + if ( wgStack ) + wgStack->stack(); +} + /*! \return if the library of module exists \param moduleTitle - title of module @@ -2665,11 +2729,10 @@ bool LightApp_Application::isLibExists( const QString& moduleTitle ) const if ( !isLibFound ) { - printf( "****************************************************************\n" ); - printf( "* Warning: library %s cannot be found\n", lib.toLatin1().constData() ); - printf( "* Module will not be available\n" ); - printf( "* Module %s will not be available in GUI mode\n", moduleTitle.toLatin1().constData() ); - printf( "****************************************************************\n" ); + INFOS( "****************************************************************" << std::endl + << "* Warning: library " << lib.toLatin1().constData() << " cannot be found" << std::endl + << "* Module " << moduleTitle.toLatin1().constData() << " will not be available in GUI mode" << std::endl + << "****************************************************************" << std::endl ); } else if ( !isPythonModule ) return true; diff --git a/src/LightApp/LightApp_Application.h b/src/LightApp/LightApp_Application.h index a18817802..834b7ceee 100644 --- a/src/LightApp/LightApp_Application.h +++ b/src/LightApp/LightApp_Application.h @@ -74,7 +74,9 @@ public: enum { MenuWindowId = 6 }; - enum { RenameId = CAM_Application::UserID, PreferencesId, MRUId, ModulesListId, + enum { RenameId = CAM_Application::UserID, + CloseId, CloseAllId, GroupAllId, + PreferencesId, MRUId, ModulesListId, NewGLViewId, NewPlot2dId, NewOCCViewId, NewVTKViewId, NewQxGraphViewId, UserID }; protected: @@ -207,6 +209,9 @@ private slots: void onPreferences(); void onPreferenceChanged( QString&, QString&, QString& ); void onRenameWindow(); + void onCloseWindow(); + void onCloseAllWindow(); + void onGroupAllWindow(); protected: void updateWindows(); diff --git a/src/LightApp/LightApp_Module.cxx b/src/LightApp/LightApp_Module.cxx index 883cfccf3..f2e42984d 100644 --- a/src/LightApp/LightApp_Module.cxx +++ b/src/LightApp/LightApp_Module.cxx @@ -35,6 +35,7 @@ #include "LightApp_SwitchOp.h" #include "LightApp_UpdateFlags.h" #include "LightApp_ShowHideOp.h" +#include "LightApp_SelectionMgr.h" #include #include @@ -44,6 +45,9 @@ #include #include +#include +#include + #ifndef DISABLE_VTKVIEWER #ifndef DISABLE_SALOMEOBJECT #include @@ -163,11 +167,39 @@ void LightApp_Module::selectionChanged() { } +/*! \brief If return false, selection will be cleared at module activation + */ +bool LightApp_Module::isSelectionCompatible() +{ + // return true if selected objects belong to this module + bool isCompatible = true; + SALOME_ListIO selected; + if ( LightApp_SelectionMgr *Sel = getApp()->selectionMgr() ) + Sel->selectedObjects( selected ); + + LightApp_Study* aStudy = dynamic_cast( getApp()->activeStudy() ); + LightApp_DataObject* aRoot = dynamic_cast( dataModel()->root() ); + if ( aStudy && aRoot ) { + // my data type + QString moduleDataType = aRoot->componentDataType(); + // check data type of selection + SALOME_ListIteratorOfListIO It( selected ); + for ( ; isCompatible && It.More(); It.Next()) { + Handle(SALOME_InteractiveObject)& io = It.Value(); + isCompatible = ( aStudy->componentDataType( io->getEntry() ) == moduleDataType ); + } + } + return isCompatible; +} + /*!Activate module.*/ bool LightApp_Module::activateModule( SUIT_Study* study ) { bool res = CAM_Module::activateModule( study ); + if ( !isSelectionCompatible() )// PAL19290, PAL18352 + getApp()->selectionMgr()->clearSelected(); + if ( res && application() && application()->resourceMgr() ) application()->resourceMgr()->raiseTranslators( name() ); diff --git a/src/LightApp/LightApp_Module.h b/src/LightApp/LightApp_Module.h index b05611454..08c8eb7d3 100644 --- a/src/LightApp/LightApp_Module.h +++ b/src/LightApp/LightApp_Module.h @@ -132,6 +132,8 @@ protected: virtual void updateControls(); + virtual bool isSelectionCompatible(); + private: typedef QMap MapOfOperation; diff --git a/src/LightApp/LightApp_ModuleDlg.cxx b/src/LightApp/LightApp_ModuleDlg.cxx index e164ebf27..e7d7f3dcb 100644 --- a/src/LightApp/LightApp_ModuleDlg.cxx +++ b/src/LightApp/LightApp_ModuleDlg.cxx @@ -222,6 +222,8 @@ int LightApp_ModuleDlg::addButton( const QString& button, const int id ) QPushButton* newButton = new QPushButton( button, this ); + if ( myButtons.empty() ) newButton->setDefault( true ); + myButtons.insert( newButton, bid ); myButtonLayout->insertWidget( myButtonLayout->count()-3, newButton ); connect( newButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); diff --git a/src/LightApp/resources/LightApp.xml b/src/LightApp/resources/LightApp.xml index 9fe7a3b57..8151472ac 100644 --- a/src/LightApp/resources/LightApp.xml +++ b/src/LightApp/resources/LightApp.xml @@ -68,6 +68,10 @@ +
+ + +
@@ -83,6 +87,8 @@ + +
diff --git a/src/LightApp/resources/LightApp_msg_en.ts b/src/LightApp/resources/LightApp_msg_en.ts index fdfd739d9..a4badcab7 100644 --- a/src/LightApp/resources/LightApp_msg_en.ts +++ b/src/LightApp/resources/LightApp_msg_en.ts @@ -353,6 +353,51 @@ CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITASPYTHON_CONSOLE Python Console + + PREF_USE_ADVANCED_SELECTION_ALGORITHM + Use Advanced Selection Algorithm + + + TOT_CLOSE + Close + + + MEN_DESK_CLOSE + &Close + + + PRP_CLOSE + Close active window + + + TOT_CLOSE_ALL + Close all + + + MEN_DESK_CLOSE_ALL + Close all + + + PRP_CLOSE_ALL + Close all windows + + + TOT_GROUP_ALL + Group all + + + MEN_DESK_GROUP_ALL + &Group all + + + PRP_GROUP_ALL + Group all windows + + + ERR_DOC_NOT_EXISTS + Can not open %1. +File does not exist + LightApp_Module diff --git a/src/OCCViewer/Makefile.am b/src/OCCViewer/Makefile.am index e774d1e69..3e6a522ed 100755 --- a/src/OCCViewer/Makefile.am +++ b/src/OCCViewer/Makefile.am @@ -37,6 +37,7 @@ salomeinclude_HEADERS= \ OCCViewer_CreateRestoreViewDlg.h \ OCCViewer.h \ OCCViewer_ClippingDlg.h \ + OCCViewer_AxialScaleDlg.h \ OCCViewer_SetRotationPointDlg.h dist_libOCCViewer_la_SOURCES= \ @@ -50,7 +51,8 @@ dist_libOCCViewer_la_SOURCES= \ OCCViewer_VService.cxx \ OCCViewer_CreateRestoreViewDlg.cxx \ OCCViewer_SetRotationPointDlg.cxx \ - OCCViewer_ClippingDlg.cxx + OCCViewer_ClippingDlg.cxx \ + OCCViewer_AxialScaleDlg.cxx MOC_FILES= \ OCCViewer_AISSelector_moc.cxx \ @@ -62,7 +64,8 @@ MOC_FILES= \ OCCViewer_ViewManager_moc.cxx \ OCCViewer_CreateRestoreViewDlg_moc.cxx \ OCCViewer_SetRotationPointDlg_moc.cxx \ - OCCViewer_ClippingDlg_moc.cxx + OCCViewer_ClippingDlg_moc.cxx \ + OCCViewer_AxialScaleDlg_moc.cxx nodist_libOCCViewer_la_SOURCES= $(MOC_FILES) dist_salomeres_DATA = \ @@ -72,6 +75,7 @@ dist_salomeres_DATA = \ resources/occ_view_clone.png \ resources/occ_view_clipping.png \ resources/occ_view_clipping_pressed.png \ + resources/occ_view_scaling.png \ resources/occ_view_fitall.png \ resources/occ_view_fitarea.png \ resources/occ_view_front.png \ diff --git a/src/OCCViewer/OCCViewer_AxialScaleDlg.cxx b/src/OCCViewer/OCCViewer_AxialScaleDlg.cxx new file mode 100644 index 000000000..432186e9a --- /dev/null +++ b/src/OCCViewer/OCCViewer_AxialScaleDlg.cxx @@ -0,0 +1,176 @@ +// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D +// +// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "OCCViewer_AxialScaleDlg.h" +#include "OCCViewer_ViewWindow.h" +#include "OCCViewer_ViewPort3d.h" + +#include + +#include +#include +#include +#include +#include + +/*! + \class OCCViewer_AxialScaleDlg + \brief Dialog allowing to assign parameters of axes scaling +*/ + +/*! + \brief Constructor + \param view - view window + \param parent - parent widget +*/ +OCCViewer_AxialScaleDlg::OCCViewer_AxialScaleDlg( OCCViewer_ViewWindow* view, QWidget* parent ) + : QDialog( parent ), + myView( view ) +{ + setWindowTitle( tr( "DLG_SCALING" ) ); + setModal( false ); + setSizeGripEnabled( true ); + + // Create layout for this dialog + QVBoxLayout* layoutDlg = new QVBoxLayout( this ); + layoutDlg->setSpacing( 6 ); + layoutDlg->setMargin( 11 ); + + // Create croup box with grid layout + QGroupBox* aGroupBox = new QGroupBox( this ); + QHBoxLayout* aHBoxLayout = new QHBoxLayout( aGroupBox ); + aHBoxLayout->setMargin( 11 ); + aHBoxLayout->setSpacing( 6 ); + + // "X" scaling + QLabel* TextLabelX = new QLabel( tr( "LBL_X" ), aGroupBox ); + m_sbXcoeff = new QtxDoubleSpinBox( 1e-7, RealLast(), 0.1, aGroupBox ); + m_sbXcoeff->setMinimumWidth( 80 ); + m_sbXcoeff->setValue( 1.0 ); + + // "Y" scaling + QLabel* TextLabelY = new QLabel( tr( "LBL_Y" ), aGroupBox ); + m_sbYcoeff = new QtxDoubleSpinBox( 1e-7, RealLast(), 0.1, aGroupBox ); + m_sbYcoeff->setMinimumWidth( 80 ); + m_sbYcoeff->setValue( 1.0 ); + + // "Z" scaling + QLabel* TextLabelZ = new QLabel( tr( "LBL_Z" ), aGroupBox ); + m_sbZcoeff = new QtxDoubleSpinBox( 1e-7, RealLast(), 0.1, aGroupBox ); + m_sbZcoeff->setMinimumWidth( 80 ); + m_sbZcoeff->setValue( 1.0 ); + + // Create button + m_bReset = new QPushButton( tr( "&Reset" ), aGroupBox ); + + // Layout widgets in the group box + aHBoxLayout->addWidget( TextLabelX ); + aHBoxLayout->addWidget( m_sbXcoeff ); + aHBoxLayout->addWidget( TextLabelY ); + aHBoxLayout->addWidget( m_sbYcoeff ); + aHBoxLayout->addWidget( TextLabelZ ); + aHBoxLayout->addWidget( m_sbZcoeff ); + aHBoxLayout->addSpacing( 10 ); + aHBoxLayout->addWidget( m_bReset ); + + // OK, CANCEL, Apply button + QGroupBox* aGroupBox2 = new QGroupBox( this ); + QHBoxLayout* aHBoxLayout2 = new QHBoxLayout( aGroupBox2 ); + aHBoxLayout2->setMargin( 11 ); + aHBoxLayout2->setSpacing( 6 ); + // Create button + QPushButton* m_bOk = new QPushButton( tr( "O&K" ), aGroupBox2 ); + m_bOk->setDefault( true ); + m_bOk->setAutoDefault( true ); + // Create button + QPushButton* m_bApply = new QPushButton( tr( "&Apply" ), aGroupBox2 ); + m_bApply->setAutoDefault( true ); + // Create button + QPushButton* m_bCancel = new QPushButton( tr( "&Cancel" ), aGroupBox2 ); + m_bCancel->setAutoDefault( true ); + + // Layout buttons + aHBoxLayout2->addWidget( m_bOk ); + aHBoxLayout2->addWidget( m_bApply ); + aHBoxLayout2->addSpacing( 10 ); + aHBoxLayout2->addStretch(); + aHBoxLayout2->addWidget( m_bCancel ); + + // Layout top level widgets + layoutDlg->addWidget( aGroupBox ); + layoutDlg->addWidget( aGroupBox2 ); + + // signals and slots connections + connect( m_bCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); + connect( m_bOk, SIGNAL( clicked() ), this, SLOT( accept() ) ); + connect( m_bApply, SIGNAL( clicked() ), this, SLOT( apply() ) ); + connect( m_bReset, SIGNAL( clicked() ), this, SLOT( reset() ) ); + + connect( view, SIGNAL( Hide( QHideEvent* ) ), this, SLOT( hide() ) ); +} + +/*! + \brief Destructor +*/ +OCCViewer_AxialScaleDlg::~OCCViewer_AxialScaleDlg() +{ +} + +/*! + \brief Update widgets values from the view +*/ +void OCCViewer_AxialScaleDlg::Update() +{ + // Get values from the OCC view + double aScaleFactor[3]; + myView->getViewPort()->getView()->AxialScale( aScaleFactor[0], aScaleFactor[1], aScaleFactor[2] ); + m_sbXcoeff->setValue( aScaleFactor[0] ); + m_sbYcoeff->setValue( aScaleFactor[1] ); + m_sbZcoeff->setValue( aScaleFactor[2] ); +} + +/*! + \brief Called when button is pressed +*/ +void OCCViewer_AxialScaleDlg::accept() +{ + if ( apply() ) + QDialog::accept(); +} + +/*! + \brief Called when button is pressed +*/ +bool OCCViewer_AxialScaleDlg::apply() +{ + double aScaleFactor[3] = { m_sbXcoeff->value(), m_sbYcoeff->value(), m_sbZcoeff->value() }; + myView->getViewPort()->getView()->SetAxialScale( aScaleFactor[0], aScaleFactor[1], aScaleFactor[2] ); + return true; +} + +/*! + \brief Called when button is pressed +*/ +void OCCViewer_AxialScaleDlg::reset() +{ + m_bReset->setFocus(); + m_sbXcoeff->setValue( 1.0 ); + m_sbYcoeff->setValue( 1.0 ); + m_sbZcoeff->setValue( 1.0 ); +} diff --git a/src/OCCViewer/OCCViewer_AxialScaleDlg.h b/src/OCCViewer/OCCViewer_AxialScaleDlg.h new file mode 100644 index 000000000..d6e5b1fb1 --- /dev/null +++ b/src/OCCViewer/OCCViewer_AxialScaleDlg.h @@ -0,0 +1,54 @@ +// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D +// +// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef OCCVIEWER_AXIALSCALEDLG_H +#define OCCVIEWER_AXIALSCALEDLG_H + +#include "OCCViewer.h" + +#include + +class OCCViewer_ViewWindow; +class QtxDoubleSpinBox; +class QPushButton; + +class OCCVIEWER_EXPORT OCCViewer_AxialScaleDlg : public QDialog +{ + Q_OBJECT + +public: + OCCViewer_AxialScaleDlg( OCCViewer_ViewWindow*, QWidget* = 0 ); + ~OCCViewer_AxialScaleDlg(); + + void Update(); + +protected slots: + bool apply(); + void reset(); + void accept(); + +private: + OCCViewer_ViewWindow* myView; + QtxDoubleSpinBox* m_sbXcoeff; + QtxDoubleSpinBox* m_sbYcoeff; + QtxDoubleSpinBox* m_sbZcoeff; + QPushButton* m_bReset; +}; + +#endif // OCCVIEWER_AXIALSCALEDLG_H diff --git a/src/OCCViewer/OCCViewer_ClippingDlg.cxx b/src/OCCViewer/OCCViewer_ClippingDlg.cxx index cc8cb60ef..40fd9988e 100644 --- a/src/OCCViewer/OCCViewer_ClippingDlg.cxx +++ b/src/OCCViewer/OCCViewer_ClippingDlg.cxx @@ -267,8 +267,7 @@ void OCCViewer_ClippingDlg::closeEvent( QCloseEvent* e ) if ( !aView3d.IsNull() && !myClippingPlane.IsNull() ) aView3d->SetPlaneOn( myClippingPlane ); - if (!myView->isCuttingPlane()) - myAction->setChecked( false ); + myAction->setChecked( false ); QDialog::closeEvent( e ); } @@ -308,8 +307,7 @@ void OCCViewer_ClippingDlg::ClickOnClose() if ( !aView3d.IsNull() && !myClippingPlane.IsNull() ) aView3d->SetPlaneOn( myClippingPlane ); - if (!myView->isCuttingPlane()) - myAction->setChecked( false ); + myAction->setChecked( false ); reject(); } diff --git a/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.cxx b/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.cxx index e17fe3979..cc816a932 100755 --- a/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.cxx +++ b/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.cxx @@ -160,6 +160,7 @@ void OCCViewer_CreateRestoreViewDlg::changeImage( QListWidgetItem* curItem ) aView3d->SetAt( myCurrentItem.atX, myCurrentItem.atY, myCurrentItem.atZ ); aView3d->SetImmediateUpdate( prev ); aView3d->SetEye( myCurrentItem.eyeX, myCurrentItem.eyeY, myCurrentItem.eyeZ ); + aView3d->SetAxialScale( myCurrentItem.scaleX, myCurrentItem.scaleY, myCurrentItem.scaleZ ); } } diff --git a/src/OCCViewer/OCCViewer_SetRotationPointDlg.cxx b/src/OCCViewer/OCCViewer_SetRotationPointDlg.cxx index db26945f3..af86ec168 100644 --- a/src/OCCViewer/OCCViewer_SetRotationPointDlg.cxx +++ b/src/OCCViewer/OCCViewer_SetRotationPointDlg.cxx @@ -288,3 +288,14 @@ OCCViewer_SetRotationPointDlg { hide(); } + +/*! + Custom handling of close event: toggle action +*/ +void +OCCViewer_SetRotationPointDlg +::closeEvent( QCloseEvent* e ) +{ + myAction->setChecked( false ); + QDialog::closeEvent( e ); +} diff --git a/src/OCCViewer/OCCViewer_SetRotationPointDlg.h b/src/OCCViewer/OCCViewer_SetRotationPointDlg.h index 2e3a465f8..8980e718c 100644 --- a/src/OCCViewer/OCCViewer_SetRotationPointDlg.h +++ b/src/OCCViewer/OCCViewer_SetRotationPointDlg.h @@ -76,6 +76,9 @@ protected slots: void onViewShow(); void onViewHide(); + +protected: + void closeEvent( QCloseEvent* ); }; #endif // OCCVIEWER_SETROTATIONPOINTDLG_H diff --git a/src/OCCViewer/OCCViewer_ViewModel.cxx b/src/OCCViewer/OCCViewer_ViewModel.cxx index cc6e0ba0e..0beafa3c2 100755 --- a/src/OCCViewer/OCCViewer_ViewModel.cxx +++ b/src/OCCViewer/OCCViewer_ViewModel.cxx @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -43,8 +44,12 @@ #include #include +#include #include #include +#include +#include +#include /*! Constructor @@ -72,6 +77,15 @@ myBgColor( Qt::black ) // display isoline on planar faces (box for ex.) myAISContext->IsoOnPlane( true ); + double h = QApplication::desktop()->screenGeometry( QApplication::desktop()->primaryScreen() ).height() / 300. ; + Handle(Prs3d_Drawer) drawer = myAISContext->DefaultDrawer(); + Handle(Prs3d_TextAspect) ta = drawer->TextAspect(); + ta->SetHeight(100); // VSR: workaround for CAS.CADE bug (is it really needed ???) + ta->SetHeight(h); + drawer->SetTextAspect(ta); + drawer->AngleAspect()->SetTextAspect(ta); + drawer->LengthAspect()->SetTextAspect(ta); + clearViewAspects(); /* create trihedron */ diff --git a/src/OCCViewer/OCCViewer_ViewModel.h b/src/OCCViewer/OCCViewer_ViewModel.h index 7fdb1e9d4..323979697 100755 --- a/src/OCCViewer/OCCViewer_ViewModel.h +++ b/src/OCCViewer/OCCViewer_ViewModel.h @@ -54,6 +54,9 @@ public: double eyeX; double eyeY; double eyeZ; + double scaleX; + double scaleY; + double scaleZ; QString name; }; diff --git a/src/OCCViewer/OCCViewer_ViewWindow.cxx b/src/OCCViewer/OCCViewer_ViewWindow.cxx index c1e090efe..40dbe87b5 100755 --- a/src/OCCViewer/OCCViewer_ViewWindow.cxx +++ b/src/OCCViewer/OCCViewer_ViewWindow.cxx @@ -28,6 +28,7 @@ #include "OCCViewer_CreateRestoreViewDlg.h" #include "OCCViewer_ClippingDlg.h" #include "OCCViewer_SetRotationPointDlg.h" +#include "OCCViewer_AxialScaleDlg.h" #include #include @@ -195,6 +196,7 @@ OCCViewer_ViewWindow::OCCViewer_ViewWindow( SUIT_Desktop* theDesktop, myEnableDrawMode = false; updateEnabledDrawMode(); myClippingDlg = 0; + myScalingDlg = 0; mySetRotationPointDlg = 0; myRectBand = 0; @@ -1054,6 +1056,13 @@ void OCCViewer_ViewWindow::createActions() connect(aAction, SIGNAL(activated()), this, SLOT(onTrihedronShow())); toolMgr()->registerAction( aAction, TrihedronShowId ); } + + // Scale + aAction = new QtxAction(tr("MNU_SCALING"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_SCALING" ) ), + tr( "MNU_SCALING" ), 0, this); + aAction->setStatusTip(tr("DSC_SCALING")); + connect(aAction, SIGNAL(activated()), this, SLOT(onAxialScale())); + toolMgr()->registerAction( aAction, AxialScaleId ); } /*! @@ -1102,6 +1111,7 @@ void OCCViewer_ViewWindow::createToolBar() toolMgr()->append( toolMgr()->separator(), tid ); toolMgr()->append( ClippingId, tid ); + toolMgr()->append( AxialScaleId, tid ); } /*! @@ -1241,6 +1251,7 @@ void OCCViewer_ViewWindow::onCloneView() { SUIT_ViewWindow* vw = myManager->createViewWindow(); //vw->show(); + emit viewCloned( vw ); } /*! @@ -1252,29 +1263,42 @@ void OCCViewer_ViewWindow::onCloneView() */ void OCCViewer_ViewWindow::onClipping( bool on ) { + /* SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); - /*if ( on ) + if ( on ) myActionsMap[ ClippingId ]->setIcon(aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_CLIPPING_PRESSED" ))); else myActionsMap[ ClippingId ]->setIcon(aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_CLIPPING" ))); */ if ( on ) + { + if ( !myClippingDlg ) { - if ( !myClippingDlg ) - { - myClippingDlg = new OCCViewer_ClippingDlg( this, myDesktop ); - myClippingDlg->SetAction( myClippingAction ); - } - - if ( !myClippingDlg->isVisible() ) - myClippingDlg->show(); + myClippingDlg = new OCCViewer_ClippingDlg( this, myDesktop ); + myClippingDlg->SetAction( myClippingAction ); } + + if ( !myClippingDlg->isVisible() ) + myClippingDlg->show(); + } else - { - if ( myClippingDlg->isVisible() ) - myClippingDlg->hide(); - setCuttingPlane(false); - } + { + if ( myClippingDlg->isVisible() ) + myClippingDlg->hide(); + setCuttingPlane(false); + } +} + +/*! + Creates one more window with same content +*/ +void OCCViewer_ViewWindow::onAxialScale() +{ + if ( !myScalingDlg ) + myScalingDlg = new OCCViewer_AxialScaleDlg( this, myDesktop ); + + if ( !myScalingDlg->isVisible() ) + myScalingDlg->show(); } /*! @@ -1314,7 +1338,8 @@ void OCCViewer_ViewWindow::performRestoring( const viewAspect& anItem ) aView3d->SetImmediateUpdate( prev ); aView3d->SetEye( anItem.eyeX, anItem.eyeY, anItem.eyeZ ); aView3d->SetProj( anItem.projX, anItem.projY, anItem.projZ ); - + aView3d->SetAxialScale( anItem.scaleX, anItem.scaleY, anItem.scaleZ ); + myRestoreFlag = 0; } @@ -1406,6 +1431,7 @@ viewAspect OCCViewer_ViewWindow::getViewParams() const { double centerX, centerY, projX, projY, projZ, twist; double atX, atY, atZ, eyeX, eyeY, eyeZ; + double aScaleX, aScaleY, aScaleZ; Handle(V3d_View) aView3d = myViewPort->getView(); @@ -1415,6 +1441,8 @@ viewAspect OCCViewer_ViewWindow::getViewParams() const aView3d->Eye( eyeX, eyeY, eyeZ ); twist = aView3d->Twist(); + aView3d->AxialScale(aScaleX,aScaleY,aScaleZ); + QString aName = QTime::currentTime().toString() + QString::fromLatin1( " h:m:s" ); viewAspect params; @@ -1431,6 +1459,9 @@ viewAspect OCCViewer_ViewWindow::getViewParams() const params.eyeX = eyeX; params.eyeY = eyeY; params.eyeZ = eyeZ; + params.scaleX = aScaleX; + params.scaleY = aScaleY; + params.scaleZ = aScaleZ; params.name = aName; return params; @@ -1445,9 +1476,10 @@ QString OCCViewer_ViewWindow::getVisualParameters() { viewAspect params = getViewParams(); QString retStr; - retStr.sprintf( "%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e", params.scale, + retStr.sprintf( "%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e", params.scale, params.centerX, params.centerY, params.projX, params.projY, params.projZ, params.twist, - params.atX, params.atY, params.atZ, params.eyeX, params.eyeY, params.eyeZ ); + params.atX, params.atY, params.atZ, params.eyeX, params.eyeY, params.eyeZ, + params.scaleX, params.scaleY, params.scaleZ ); return retStr; } @@ -1458,7 +1490,7 @@ QString OCCViewer_ViewWindow::getVisualParameters() void OCCViewer_ViewWindow::setVisualParameters( const QString& parameters ) { QStringList paramsLst = parameters.split( '*' ); - if ( paramsLst.size() == 13 ) { + if ( paramsLst.size() >= 13 ) { viewAspect params; params.scale = paramsLst[0].toDouble(); params.centerX = paramsLst[1].toDouble(); @@ -1473,6 +1505,16 @@ void OCCViewer_ViewWindow::setVisualParameters( const QString& parameters ) params.eyeX = paramsLst[10].toDouble(); params.eyeY = paramsLst[11].toDouble(); params.eyeZ = paramsLst[12].toDouble(); + if ( paramsLst.size() == 16 ) { + params.scaleX = paramsLst[13].toDouble(); + params.scaleY = paramsLst[14].toDouble(); + params.scaleZ = paramsLst[15].toDouble(); + } + else { + params.scaleX = 1.; + params.scaleY = 1.; + params.scaleZ = 1.; + } performRestoring( params ); } diff --git a/src/OCCViewer/OCCViewer_ViewWindow.h b/src/OCCViewer/OCCViewer_ViewWindow.h index 9d1d1d825..c13873886 100755 --- a/src/OCCViewer/OCCViewer_ViewWindow.h +++ b/src/OCCViewer/OCCViewer_ViewWindow.h @@ -28,6 +28,7 @@ class SUIT_Desktop; class OCCViewer_ViewPort3d; class OCCViewer_ViewSketcher; class OCCViewer_ClippingDlg; +class OCCViewer_AxialScaleDlg; class OCCViewer_SetRotationPointDlg; class OCCViewer_Viewer; class viewAspect; @@ -45,7 +46,7 @@ public: enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId, ChangeRotationPointId, RotationId, FrontId, BackId, TopId, BottomId, LeftId, RightId, ResetId, CloneId, ClippingId, MemId, RestoreId, - TrihedronShowId }; + TrihedronShowId, AxialScaleId }; enum OperationType{ NOTHING, PANVIEW, ZOOMVIEW, ROTATE, PANGLOBAL, WINDOWFIT, FITALLVIEW, RESETVIEW, @@ -99,6 +100,7 @@ public slots: void onSetRotationPoint( bool on ); void onCloneView(); void onClipping( bool on ); + void onAxialScale(); void onMemorizeView(); void onRestoreView(); void onTrihedronShow(); @@ -115,7 +117,7 @@ public slots: signals: void vpTransformationStarted(OCCViewer_ViewWindow::OperationType type); void vpTransformationFinished(OCCViewer_ViewWindow::OperationType type); - void cloneView(); + void viewCloned( SUIT_ViewWindow* ); void Show( QShowEvent * ); void Hide( QHideEvent * ); @@ -188,6 +190,8 @@ private: OCCViewer_ClippingDlg* myClippingDlg; QtxAction* myClippingAction; + OCCViewer_AxialScaleDlg* myScalingDlg; + OCCViewer_SetRotationPointDlg* mySetRotationPointDlg; QtxAction* mySetRotationPointAction; diff --git a/src/OCCViewer/resources/OCCViewer_images.ts b/src/OCCViewer/resources/OCCViewer_images.ts index 6c8d4dc01..9da198c96 100644 --- a/src/OCCViewer/resources/OCCViewer_images.ts +++ b/src/OCCViewer/resources/OCCViewer_images.ts @@ -85,5 +85,9 @@ ICON_OCCVIEWER_VIEW_TRIHEDRON occ_view_triedre.png + + ICON_OCCVIEWER_SCALING + occ_view_scaling.png + diff --git a/src/OCCViewer/resources/OCCViewer_msg_en.ts b/src/OCCViewer/resources/OCCViewer_msg_en.ts index 1e60f86a1..2cc935170 100644 --- a/src/OCCViewer/resources/OCCViewer_msg_en.ts +++ b/src/OCCViewer/resources/OCCViewer_msg_en.ts @@ -201,6 +201,14 @@ DSC_BACK_VIEW Back View + + DSC_SCALING + Change scale of axes + + + MNU_SCALING + Scaling + OCCViewer_CreateRestoreViewDlg @@ -213,15 +221,15 @@ OCCViewer_SetRotationPointDlg LBL_X - X : + X: LBL_Y - Y : + Y: LBL_Z - Z : + Z: USE_BBCENTER @@ -262,4 +270,23 @@ Change background... + + OCCViewer_AxialScaleDlg + + DLG_SCALING + Axes scaling + + + LBL_X + X: + + + LBL_Y + Y: + + + LBL_Z + Z: + + diff --git a/src/OCCViewer/resources/occ_view_scaling.png b/src/OCCViewer/resources/occ_view_scaling.png new file mode 100644 index 0000000000000000000000000000000000000000..5d3443634a69abf41d825b5fdbd331808066cbda GIT binary patch literal 453 zcmV;$0XqJPP)Po92!IiWcWARVf8UuMehUVxU!Hz^ z5f56#t2#PWfNiO<0o+x?B5WVo4EKQ*e-_w!F6>dmN?0+Lro6P-)DMJ@bM4ThIOU@b^V*pBXJDE)Ec)66%zq5v} zehjZCTW5+kpMTqjo2`@kf9-F^Z6D^)c+e{Oxt+Z|TmSVjD%qku5kW*U0RPyptkEvj v&T52V$YQbZe1K-N$!s?J7YrZ_L%aS33LLx=::iterator aIt; + pointList::iterator aIt; int aCurrent = 0; for(aIt = myPoints.begin(); aIt != myPoints.end(); ++aIt) { if (thePos == aCurrent) { @@ -367,7 +367,7 @@ QwtPlot::Axis Plot2d_Curve::getYAxis() const */ double Plot2d_Curve::getMinX() const { - QList::const_iterator aIt; + pointList::const_iterator aIt; double aMinX = 1e150; //int aCurrent = 0; for(aIt = myPoints.begin(); aIt != myPoints.end(); ++aIt) { @@ -382,7 +382,7 @@ double Plot2d_Curve::getMinX() const */ double Plot2d_Curve::getMinY() const { - QList::const_iterator aIt; + pointList::const_iterator aIt; double aMinY = 1e150; //int aCurrent = 0; for(aIt = myPoints.begin(); aIt != myPoints.end(); ++aIt) { diff --git a/src/Plot2d/Plot2d_ViewFrame.cxx b/src/Plot2d/Plot2d_ViewFrame.cxx index 5afc21af0..c963ca5d1 100755 --- a/src/Plot2d/Plot2d_ViewFrame.cxx +++ b/src/Plot2d/Plot2d_ViewFrame.cxx @@ -229,7 +229,7 @@ QWidget* Plot2d_ViewFrame::getViewWidget() */ void Plot2d_ViewFrame::DisplayAll() { - QList clist; + curveList clist; getCurves( clist ); for ( int i = 0; i < (int)clist.count(); i++ ) { updateCurve( clist.at( i ), false ); @@ -589,7 +589,7 @@ void Plot2d_ViewFrame::displayCurve( Plot2d_Curve* curve, bool update ) void Plot2d_ViewFrame::displayCurves( const curveList& curves, bool update ) { //myPlot->setUpdatesEnabled( false ); // call this function deprecate update of legend - QList::const_iterator it = curves.begin(); + curveList::const_iterator it = curves.begin(); Plot2d_Curve* aCurve; for (; it != curves.end(); ++it ) { aCurve = *it; @@ -625,7 +625,7 @@ void Plot2d_ViewFrame::eraseCurve( Plot2d_Curve* curve, bool update ) */ void Plot2d_ViewFrame::eraseCurves( const curveList& curves, bool update ) { - QList::const_iterator it = curves.begin(); + curveList::const_iterator it = curves.begin(); Plot2d_Curve* aCurve; for (; it != curves.end(); ++it ) { aCurve = *it; @@ -702,7 +702,7 @@ void Plot2d_ViewFrame::updateLegend( const Plot2d_Prs* prs ) return; curveList aCurves = prs->getCurves(); - QList::iterator it = aCurves.begin(); + curveList::iterator it = aCurves.begin(); Plot2d_Curve* aCurve; for (; it != aCurves.end(); ++it ) { aCurve = *it; diff --git a/src/Plot2d/Plot2d_ViewManager.cxx b/src/Plot2d/Plot2d_ViewManager.cxx index 7681bd3f2..a94f5642c 100755 --- a/src/Plot2d/Plot2d_ViewManager.cxx +++ b/src/Plot2d/Plot2d_ViewManager.cxx @@ -71,15 +71,30 @@ void Plot2d_ViewManager::createView() SLOT: called if action "Clone view" is activated, emits signal cloneView() */ void Plot2d_ViewManager::onCloneView() +{ + if( sender() && sender()->inherits( "Plot2d_ViewWindow" ) ) + { + Plot2d_ViewWindow* srcWnd = ( Plot2d_ViewWindow* )sender(); + cloneView( srcWnd ); + } +} + +/*! + \brief Creates clone of source window + \param srcWnd source window + \return Pointer on the new window + \sa onCloneView() +*/ +Plot2d_ViewWindow* Plot2d_ViewManager::cloneView( Plot2d_ViewWindow* srcWnd ) { SUIT_ViewWindow* vw = createViewWindow(); - Plot2d_ViewWindow *newWnd = 0, *clonedWnd = 0; + Plot2d_ViewWindow* newWnd = 0; if( vw && vw->inherits( "Plot2d_ViewWindow" ) ) newWnd = ( Plot2d_ViewWindow* )vw; - if( sender() && sender()->inherits( "Plot2d_ViewWindow" ) ) - clonedWnd = ( Plot2d_ViewWindow* )sender(); - if( newWnd && clonedWnd ) - emit cloneView( clonedWnd->getViewFrame(), newWnd->getViewFrame() ); + if( newWnd && srcWnd ) + emit cloneView( srcWnd->getViewFrame(), newWnd->getViewFrame() ); + + return newWnd; } diff --git a/src/Plot2d/Plot2d_ViewManager.h b/src/Plot2d/Plot2d_ViewManager.h index a26b01cb6..2a6ffba94 100755 --- a/src/Plot2d/Plot2d_ViewManager.h +++ b/src/Plot2d/Plot2d_ViewManager.h @@ -23,6 +23,7 @@ #include "SUIT_ViewManager.h" class SUIT_Desktop; +class Plot2d_ViewWindow; class Plot2d_Viewer; class Plot2d_ViewFrame; @@ -35,6 +36,7 @@ public: ~Plot2d_ViewManager(); Plot2d_Viewer* getPlot2dModel() const; + Plot2d_ViewWindow* cloneView( Plot2d_ViewWindow* srcWnd ); protected: bool insertView(SUIT_ViewWindow* theView); diff --git a/src/Plot2d/Plot2d_ViewModel.cxx b/src/Plot2d/Plot2d_ViewModel.cxx index ecef0231d..5725fb412 100755 --- a/src/Plot2d/Plot2d_ViewModel.cxx +++ b/src/Plot2d/Plot2d_ViewModel.cxx @@ -175,8 +175,37 @@ void Plot2d_Viewer::onDumpView() /*! SLOT: called when action "Clone view" is activated */ -void Plot2d_Viewer::onCloneView( Plot2d_ViewFrame*, Plot2d_ViewFrame* ) +void Plot2d_Viewer::onCloneView( Plot2d_ViewFrame* clonedVF, Plot2d_ViewFrame* newVF ) { + if( !clonedVF || !newVF ) + return; + + // 1) Copy all properties of view + + newVF->copyPreferences( clonedVF ); + + // 2) Display all curves displayed in cloned view + + curveList aCurves; + clonedVF->getCurves( aCurves ); + curveList::const_iterator anIt = aCurves.begin(), aLast = aCurves.end(); + + for( ; anIt!=aLast; anIt++ ) + if( clonedVF->isVisible( *anIt ) ) + newVF->displayCurve( *anIt, false ); + newVF->Repaint(); + + if ( newVF ) + { + // find view window corresponding to the frame + QWidget* p = newVF->parentWidget(); + while( p && !p->inherits( "SUIT_ViewWindow" ) ) + p = p->parentWidget(); + + // emits signal + if ( p && p->inherits( "SUIT_ViewWindow" ) ) + emit viewCloned( (SUIT_ViewWindow*)p ); + } } /*! diff --git a/src/Plot2d/Plot2d_ViewModel.h b/src/Plot2d/Plot2d_ViewModel.h index db0c471d2..b2c0b0416 100755 --- a/src/Plot2d/Plot2d_ViewModel.h +++ b/src/Plot2d/Plot2d_ViewModel.h @@ -48,11 +48,14 @@ public: void update(); void clearPrs(); void setAutoDel(bool theDel); + +signals: + void viewCloned( SUIT_ViewWindow* ); protected slots: - void onChangeBgColor(); - void onDumpView(); - void onShowToolbar(); + void onChangeBgColor(); + void onDumpView(); + void onShowToolbar(); virtual void onCloneView( Plot2d_ViewFrame*, Plot2d_ViewFrame* ); private: diff --git a/src/Qtx/QtxWorkstack.cxx b/src/Qtx/QtxWorkstack.cxx index 27e8cdd0a..6349b92ac 100644 --- a/src/Qtx/QtxWorkstack.cxx +++ b/src/Qtx/QtxWorkstack.cxx @@ -1511,13 +1511,25 @@ QtxWorkstack::~QtxWorkstack() } /*! - \brief Get all child widgets in all workareas. - \return list of widgets in all workareas + \brief Get list of all widgets in all areas or in specified area which given + widget belongs to + \param wid widget specifying area if it is equal to null when widgets of all + areas are retuned + \return list of widgets */ -QWidgetList QtxWorkstack::windowList() const +QWidgetList QtxWorkstack::windowList( QWidget* wid ) const { QList lst; - areas( mySplit, lst, true ); + if ( !wid ) + { + areas( mySplit, lst, true ); + } + else + { + QtxWorkstackArea* area = wgArea( wid ); + if ( area ) + lst.append( area ); + } QWidgetList widList; for ( QList::iterator it = lst.begin(); it != lst.end(); ++it ) @@ -2783,7 +2795,7 @@ void QtxWorkstack::splitterInfo( QSplitter* split, QString& info ) const if ( !split ) return; - const QObjectList& objs = split->children(); + /*const QObjectList& objs = */split->children(); // VSR: is it needed ??? QString sizesStr; QList sizes = split->sizes(); @@ -3114,3 +3126,96 @@ QtxWorkstack& QtxWorkstack::operator>>( QString& outParameters ) \brief Emitted when the workstack's child widget \w is activated. \param w widget being activated */ + +/*! + \brief Gets area containing given widget + \param wid widget + \return pointer to QtxWorkstackArea* object +*/ +QtxWorkstackArea* QtxWorkstack::wgArea( QWidget* wid ) const +{ + QtxWorkstackArea* resArea = 0; + + QList areaList; + areas( mySplit, areaList, true ); + + QtxWorkstackArea* area; + QList::ConstIterator it; + for ( it = areaList.begin(); it != areaList.end() && !resArea; ++it ) + { + if ( (*it)->contains( wid ) ) + resArea = area; + } + + return resArea; +} + +/*! + \brief Moves the first widget to the same area which the second widget belongs to + \param wid widget to be moved + \param wid_to widget specified the destination area + \param before specifies whether the first widget has to be moved before or after + the second widget + \return TRUE if operation is completed successfully, FALSE otherwise +*/ +bool QtxWorkstack::move( QWidget* wid, QWidget* wid_to, const bool before ) +{ + if ( wid && wid_to ) + { + QtxWorkstackArea* area_src = wgArea( wid ); + QtxWorkstackArea* area_to = wgArea( wid_to ); + if ( area_src && area_to ) + { + // find index of the second widget + QWidgetList wgList = area_to->widgetList(); + QWidgetList::ConstIterator it; + int idx = 0; + for ( it = wgList.begin(); it != wgList.begin(); ++it, idx++ ) + { + if ( *it == wid_to ) + break; + } + + if ( idx < wgList.count() ) // paranoidal check + { + if ( !before ) + idx++; + area_src->removeWidget( wid, true ); + area_to->insertWidget( wid, idx ); + return true; + } + } + } + return false; +} + +/*! + \brief Group all windows in one area + \return TRUE if operation is completed successfully, FALSE otherwise +*/ +void QtxWorkstack::stack() +{ + QWidgetList wgList = windowList(); + if ( !wgList.count() ) + return; // nothing to do + + QtxWorkstackArea* area_to = 0; + QWidgetList::ConstIterator it; + for ( it = wgList.begin(); it != wgList.end(); ++it ) + { + QtxWorkstackArea* area_src = 0; + if ( !area_to ) + { + area_to = wgArea( *it ); + area_src = area_to; + } + else + area_src = wgArea( *it ); + + if ( area_src != area_to ) + { + area_src->removeWidget( *it, true ); + area_to->insertWidget( *it, -1 ); + } + } +} diff --git a/src/Qtx/QtxWorkstack.h b/src/Qtx/QtxWorkstack.h index 22425c869..21d1b5f30 100644 --- a/src/Qtx/QtxWorkstack.h +++ b/src/Qtx/QtxWorkstack.h @@ -71,7 +71,7 @@ public: QtxWorkstack( QWidget* = 0 ); virtual ~QtxWorkstack(); - QWidgetList windowList() const; + QWidgetList windowList( QWidget* = 0 ) const; QWidgetList splitWindowList() const; QWidget* activeWindow() const; @@ -86,6 +86,8 @@ public: int menuActions() const; void split( const int ); + bool move( QWidget* wid, QWidget* wid_to, const bool before ); + void stack(); QWidget* addWindow( QWidget*, Qt::WindowFlags = 0 ); @@ -125,6 +127,7 @@ private: void insertWidget( QWidget*, QWidget*, QWidget* ); QtxWorkstackArea* areaAt( const QPoint& ) const; + QtxWorkstackArea* wgArea( QWidget* ) const; QtxWorkstackArea* targetArea(); QtxWorkstackArea* activeArea() const; diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUI/Makefile.am b/src/SALOME_PYQT/SALOME_PYQT_GUI/Makefile.am index 700e4ceaf..9dbaea88d 100644 --- a/src/SALOME_PYQT/SALOME_PYQT_GUI/Makefile.am +++ b/src/SALOME_PYQT/SALOME_PYQT_GUI/Makefile.am @@ -52,10 +52,12 @@ libSalomePyQtGUI_la_CPPFLAGS= $(QT_INCLUDES) $(SIP_INCLUDES) $(PYTHON_INCLUDES) -DHAVE_CONFIG_H @KERNEL_CXXFLAGS@ -DCALL_OLD_METHODS \ -I$(srcdir)/../../PyInterp -I$(srcdir)/../../SalomeApp \ -I$(srcdir)/../../SUIT -I$(srcdir)/../../Qtx -I$(srcdir)/../../LightApp \ + -I$(srcdir)/../../Plot2d -I$(srcdir)/../../OCCViewer \ -I$(srcdir)/../../SalomeApp -I$(srcdir)/../../CAM -I$(srcdir)/../../STD \ -I$(top_builddir)/salome_adm/unix @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ libSalomePyQtGUI_la_LIBADD= $(PYTHON_LIBS) $(SIP_LIBS) $(PYQT_LIBS) $(VTK_LIBS) \ - $(OGL_LIBS) ../../PyInterp/libPyInterp.la ../../SalomeApp/libSalomeApp.la + $(OGL_LIBS) ../../PyInterp/libPyInterp.la ../../SalomeApp/libSalomeApp.la \ + ../../OCCViewer/libOCCViewer.la ../../Plot2d/libPlot2d.la ################################## diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx index 9c7515e7b..b9867a0fe 100644 --- a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx +++ b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx @@ -25,6 +25,10 @@ #include #include +#include +#include +#include +#include #include #include #include @@ -45,6 +49,8 @@ #include #include #include +#include +#include #include "sipAPISalomePyQtGUI.h" @@ -934,6 +940,26 @@ void SALOME_PYQT_Module::activate( SUIT_Study* theStudy ) myLastActivateStatus = PyObject_IsTrue( res1 ); } } + + // Connect the SUIT_Desktop signal windowActivated() to this->onActiveViewChanged() + SUIT_Desktop* aDesk = theStudy->application()->desktop(); + if ( aDesk ) + { + connect( aDesk, SIGNAL( windowActivated( SUIT_ViewWindow* ) ), + this, SLOT( onActiveViewChanged( SUIT_ViewWindow* ) ) ); + // If a active window exists send activeViewChanged + // If a getActiveView() in SalomePyQt available we no longer need this + SUIT_ViewWindow* aView = aDesk->activeWindow(); + if ( aView ) + activeViewChanged( aView ); + + // get all view currently opened in the study and connect their signals to + // the corresponding slots of the class. + QList wndList = aDesk->windows(); + SUIT_ViewWindow* wnd; + foreach ( wnd, wndList ) + connectView( wnd ); + } } /*! @@ -1008,6 +1034,14 @@ void SALOME_PYQT_Module::deactivate( SUIT_Study* theStudy ) PyErr_Print(); } } + + // Disconnect the SUIT_Desktop signal windowActivated() + SUIT_Desktop* aDesk = theStudy->application()->desktop(); + if ( aDesk ) + { + disconnect( aDesk, SIGNAL( windowActivated( SUIT_ViewWindow* ) ), + this, SLOT( onActiveViewChanged( SUIT_ViewWindow* ) ) ); + } } /*! @@ -1620,6 +1654,33 @@ QAction* SALOME_PYQT_Module::createAction( const int id, const QString& text, co return a; } +/*! + \brief Create new action group. + + If the action with specified identifier already registered + it is not created, but its attributes are only modified. + + \param id action ID + \param text tooltip text + \param icon icon + \param menu menu text + \param tip status tip + \param key keyboard shortcut + \param toggle \c true for checkable action + \return created action +*/ +/* +QActionGroup* SALOME_PYQT_Module::createActionGroup(const int id, const bool exclusive) +{ + QActionGroup* a = action( id ); + if ( !a || !a->inherits( "QActionGroup" ) ) { + a = new QActionGroup( this ); + SalomeApp_Module::registerAction( id, a ); + } + a->setExclusive( exclusive ); + return (QActionGroup*)a; +} +*/ /*! \brief Load icon from resource file. \param fileName icon file name @@ -1704,6 +1765,186 @@ void SALOME_PYQT_Module::setPreferenceProperty( const int id, SalomeApp_Module::setPreferenceProperty( id, prop, var ); } + +/*! + \brief Signal handler windowActivated(SUIT_ViewWindow*) of SUIT_Desktop + \param pview view being activated +*/ +void SALOME_PYQT_Module::onActiveViewChanged( SUIT_ViewWindow* pview ) +{ + class ActiveViewChange : public PyInterp_LockRequest + { + public: + ActiveViewChange( PyInterp_Interp* _py_interp, SALOME_PYQT_Module* _obj, const SUIT_ViewWindow* _pview ) + : PyInterp_LockRequest( _py_interp, 0, true ), + myObj(_obj),myView(_pview) {} + + protected: + virtual void execute() + { + myObj->activeViewChanged( myView ); + } + + private: + SALOME_PYQT_Module* myObj; + const SUIT_ViewWindow * myView; + }; + + PyInterp_Dispatcher::Get()->Exec( new ActiveViewChange( myInterp, this, pview ) ); +} + +/*! + \brief Processes the view changing, calls Python module's activeViewChanged() method + \param pview view being activated +*/ +void SALOME_PYQT_Module::activeViewChanged( const SUIT_ViewWindow* pview ) +{ + if ( !myInterp || !myModule ) + return; + + // Do not use SUIT_ViewWindow::closing() signal here. View manager reacts on + // this signal and deletes view. So our slot does not works if it is connected + // on this signal. SUIT_ViewManager::deleteView(SUIT_ViewWindow*) is used here + + connectView( pview ); + + if ( PyObject_HasAttrString( myModule, "activeViewChanged" ) ) + { + if ( !pview ) + return; + + PyObjWrapper res( PyObject_CallMethod( myModule, "activeViewChanged", "i" , pview->getId() ) ); + if( !res ) + PyErr_Print(); + } +} + +/*! + \brief Signal handler cloneView() of OCCViewer_ViewWindow + \param pview view being cloned +*/ +void SALOME_PYQT_Module::onViewCloned( SUIT_ViewWindow* pview ) +{ + class ViewClone : public PyInterp_LockRequest + { + public: + ViewClone( PyInterp_Interp* _py_interp, SALOME_PYQT_Module* _obj, const SUIT_ViewWindow* _pview ) + : PyInterp_LockRequest( _py_interp, 0, true ), + myObj(_obj), myView(_pview) {} + + protected: + virtual void execute() + { + myObj->viewCloned( myView ); + } + + private: + SALOME_PYQT_Module* myObj; + const SUIT_ViewWindow* myView; + }; + + PyInterp_Dispatcher::Get()->Exec( new ViewClone( myInterp, this, pview ) ); +} + +/*! + \brief Processes the view cloning, calls Python module's activeViewCloned() method + \param pview view being cloned +*/ +void SALOME_PYQT_Module::viewCloned( const SUIT_ViewWindow* pview ) +{ + if ( !myInterp || !myModule || !pview ) + return; + + if ( PyObject_HasAttrString( myModule, "viewCloned" ) ) + { + PyObjWrapper res( PyObject_CallMethod( myModule, "viewCloned", "i", pview->getId() ) ); + if( !res ) + PyErr_Print(); + } +} + +/*! + \brief Signal handler closing(SUIT_ViewWindow*) of a view + \param pview view being closed +*/ +void SALOME_PYQT_Module::onViewClosed( SUIT_ViewWindow* pview ) +{ + class ViewClose : public PyInterp_LockRequest + { + public: + ViewClose( PyInterp_Interp* _py_interp, SALOME_PYQT_Module* _obj, const SUIT_ViewWindow* _pview ) + : PyInterp_LockRequest( _py_interp, 0, true ), + myObj(_obj),myView(_pview) {} + + protected: + virtual void execute() + { + myObj->viewClosed( myView ); + } + + private: + SALOME_PYQT_Module* myObj; + const SUIT_ViewWindow * myView; + }; + + PyInterp_Dispatcher::Get()->Exec( new ViewClose( myInterp, this, pview ) ); +} + +/*! + \brief Processes the view closing, calls Python module's viewClosed() method + \param pview view being closed +*/ +void SALOME_PYQT_Module::viewClosed( const SUIT_ViewWindow* pview ) +{ + if ( !myInterp || !myModule ) + return; + + if ( PyObject_HasAttrString( myModule, "viewClosed" ) ) + { + PyObjWrapper res( PyObject_CallMethod( myModule, "viewClosed", "i", pview->getId() ) ); + if ( !res ) + { + PyErr_Print(); + } + } +} + +/*! + \brief Connects or disconnects signals about activating and cloning view on the module slots + \param pview view which is connected/disconnected +*/ +void SALOME_PYQT_Module::connectView( const SUIT_ViewWindow* pview ) +{ + SUIT_ViewManager* viewMgr = pview->getViewManager(); + SUIT_ViewModel* viewModel = viewMgr ? viewMgr->getViewModel() : 0; + + if ( viewMgr ) + { + disconnect( viewMgr, SIGNAL( deleteView( SUIT_ViewWindow* ) ), + this, SLOT( onViewClosed( SUIT_ViewWindow* ) ) ); + + connect( viewMgr, SIGNAL( deleteView( SUIT_ViewWindow* ) ), + this, SLOT( onViewClosed( SUIT_ViewWindow* ) ) ); + } + + // Connect cloneView() signal of an OCC View + if ( pview->inherits( "OCCViewer_ViewWindow" ) ) + { + disconnect( pview, SIGNAL( viewCloned( SUIT_ViewWindow* ) ), + this, SLOT( onViewCloned( SUIT_ViewWindow* ) ) ); + connect( pview, SIGNAL( viewCloned( SUIT_ViewWindow* ) ), + this, SLOT( onViewCloned( SUIT_ViewWindow* ) ) ); + } + // Connect cloneView() signal of Plot2d View manager + else if ( viewModel && viewModel->inherits( "Plot2d_Viewer" ) ) + { + disconnect( viewModel, SIGNAL( viewCloned( SUIT_ViewWindow* ) ), + this, SLOT( onViewCloned( SUIT_ViewWindow* ) ) ); + connect( viewModel, SIGNAL( viewCloned( SUIT_ViewWindow* ) ), + this, SLOT( onViewCloned( SUIT_ViewWindow* ) ) ); + } +} + /*! \brief Get tag name for the DOM element. \param element DOM element diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.h b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.h index 20fd58317..510fcabb9 100644 --- a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.h +++ b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.h @@ -37,7 +37,9 @@ #include CORBA_CLIENT_HEADER(SALOME_Component) class SALOME_PYQT_PyInterp; +class SUIT_ViewWindow; class QAction; +class QActionGroup; class QMenu; class SALOME_PYQT_EXPORT SALOME_PYQT_Module: public SalomeApp_Module @@ -107,6 +109,8 @@ public: QAction* createAction( const int, const QString&, const QString&, const QString&, const QString&, const int, const bool = false, QObject* = 0 ); + // QActionGroup* createActionGroup( const int, const bool ); + QIcon loadIcon( const QString& fileName ); @@ -127,6 +131,10 @@ public slots: const QString& ); void onGUIEvent(); + void onActiveViewChanged( SUIT_ViewWindow* ); + void onViewClosed( SUIT_ViewWindow* ); + void onViewCloned( SUIT_ViewWindow* ); + protected: Engines::Component_var getEngine() const; @@ -145,6 +153,11 @@ private: void initInterp ( int ); void importModule(); void setWorkSpace(); + + void activeViewChanged( const SUIT_ViewWindow* ); + void viewClosed( const SUIT_ViewWindow* ); + void viewCloned( const SUIT_ViewWindow* ); + void connectView( const SUIT_ViewWindow* ); friend class XmlHandler; }; diff --git a/src/SALOME_PYQT/SalomePyQt/Makefile.am b/src/SALOME_PYQT/SalomePyQt/Makefile.am index c5870a03b..ee24c1d7d 100644 --- a/src/SALOME_PYQT/SalomePyQt/Makefile.am +++ b/src/SALOME_PYQT/SalomePyQt/Makefile.am @@ -36,7 +36,7 @@ EXTRA_DIST += SalomePyQt.sip # Libraries targets MOC_FILES = SalomePyQt_moc.cxx -COMMON_CPP_FLAGS=$(QT_INCLUDES) $(SIP_INCLUDES) $(PYTHON_INCLUDES) \ +COMMON_CPP_FLAGS=$(QT_INCLUDES) $(QWT_INCLUDES) $(SIP_INCLUDES) $(PYTHON_INCLUDES) \ $(CAS_CPPFLAGS) $(VTK_INCLUDES) $(OGL_INCLUDES) $(BOOST_CPPFLAGS) \ -DHAVE_CONFIG_H @KERNEL_CXXFLAGS@ -I$(top_builddir)/salomeadn/unix \ -I$(top_builddir)/idl \ @@ -44,17 +44,19 @@ COMMON_CPP_FLAGS=$(QT_INCLUDES) $(SIP_INCLUDES) $(PYTHON_INCLUDES) \ -I$(srcdir)/../../Qtx -I$(srcdir)/../../SalomeApp -I$(srcdir)/../../Event \ -I$(srcdir)/../../SalomeSession -I$(srcdir)/../../LogWindow \ -I$(srcdir)/../../VTKViewer -I$(srcdir)/../../TOOLSGUI \ + -I$(srcdir)/../../OCCViewer -I$(srcdir)/../../Plot2d \ -I$(srcdir)/../SALOME_PYQT_GUI -I$(srcdir)/../../PyInterp \ -I$(srcdir)/../../LightApp -I$(srcdir)/../../ObjBrowser \ -I$(srcdir)/../../OBJECT \ -I$(top_builddir)/salome_adm/unix @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ -COMMON_LIBS=$(PYTHON_LIBS) $(SIP_LIBS) $(PYQT_LIBS) $(VTK_LIBS) \ +COMMON_LIBS=$(PYTHON_LIBS) $(SIP_LIBS) $(PYQT_LIBS) $(VTK_LIBS) $(QWT_LIBS) \ $(OGL_LIBS) ../../SUIT/libsuit.la ../../CAM/libCAM.la ../../STD/libstd.la \ ../../Qtx/libqtx.la ../../SalomeApp/libSalomeApp.la ../../Event/libEvent.la \ ../../Session/libSalomeSession.la ../../LogWindow/libLogWindow.la \ ../../VTKViewer/libVTKViewer.la ../../TOOLSGUI/libToolsGUI.la \ - ../SALOME_PYQT_GUI/libSalomePyQtGUI.la + ../SALOME_PYQT_GUI/libSalomePyQtGUI.la ../../OCCViewer/libOCCViewer.la \ + ../../Plot2d/libPlot2d.la lib_LTLIBRARIES = libSalomePyQt.la dist_libSalomePyQt_la_SOURCES= SalomePyQt.cxx diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx index f10acdec6..0d2c16032 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx @@ -28,21 +28,27 @@ #include #include #include +#include #include -#include +//#include #include +#include #include #include #include #include #include #include +#include #include #include #include #include +#include +#include +#include /*! \brief Get the currently active application. @@ -1344,9 +1350,9 @@ public: : myCase( 1 ), myId( id ), myTbId( tBar ), myIndex( idx ) {} CrTool( const int id, const QString& tBar, const int idx ) : myCase( 2 ), myId( id ), myTbName( tBar ), myIndex( idx ) {} - CrTool( QtxAction* action, const int tbId, const int id, const int idx ) + CrTool( QAction* action, const int tbId, const int id, const int idx ) : myCase( 3 ), myAction( action ), myTbId( tbId ), myId( id ), myIndex( idx ) {} - CrTool( QtxAction* action, const QString& tBar, const int id, const int idx ) + CrTool( QAction* action, const QString& tBar, const int id, const int idx ) : myCase( 4 ), myAction( action ), myTbName( tBar ), myId( id ), myIndex( idx ) {} int execute( SALOME_PYQT_Module* module ) const @@ -1371,7 +1377,7 @@ private: int myCase; QString myTbName; int myTbId; - QtxAction* myAction; + QAction* myAction; int myId; int myIndex; }; @@ -1434,7 +1440,7 @@ int SalomePyQt::createTool( const int id, const QString& tBar, const int idx ) \param idx required index in the toolbar \return action ID or -1 if action could not be added */ -int SalomePyQt::createTool( QtxAction* a, const int tBar, const int id, const int idx ) +int SalomePyQt::createTool( QAction* a, const int tBar, const int id, const int idx ) { return ProcessEvent( new TCreateToolEvent( CrTool( a, tBar, id, idx ) ) ); } @@ -1447,7 +1453,7 @@ int SalomePyQt::createTool( QtxAction* a, const int tBar, const int id, const in \param idx required index in the toolbar \return action ID or -1 if action could not be added */ -int SalomePyQt::createTool( QtxAction* a, const QString& tBar, const int id, const int idx ) +int SalomePyQt::createTool( QAction* a, const QString& tBar, const int id, const int idx ) { return ProcessEvent( new TCreateToolEvent( CrTool( a, tBar, id, idx ) ) ); } @@ -1463,9 +1469,9 @@ public: : myCase( 2 ), myId( id ), myMenuId( menu ), myGroup( group ), myIndex( idx ) {} CrMenu( const int id, const QString& menu, const int group, const int idx ) : myCase( 3 ), myId( id ), myMenuName( menu ), myGroup( group ), myIndex( idx ) {} - CrMenu( QtxAction* action, const int menu, const int id, const int group, const int idx ) + CrMenu( QAction* action, const int menu, const int id, const int group, const int idx ) : myCase( 4 ), myAction( action ), myMenuId( menu ), myId( id ), myGroup( group ), myIndex( idx ) {} - CrMenu( QtxAction* action, const QString& menu, const int id, const int group, const int idx ) + CrMenu( QAction* action, const QString& menu, const int id, const int group, const int idx ) : myCase( 5 ), myAction( action ), myMenuName( menu ), myId( id ), myGroup( group ), myIndex( idx ) {} int execute( SALOME_PYQT_Module* module ) const @@ -1494,7 +1500,7 @@ private: int myMenuId; QString mySubMenuName; int myGroup; - QtxAction* myAction; + QAction* myAction; int myId; int myIndex; }; @@ -1577,7 +1583,7 @@ int SalomePyQt::createMenu( const int id, const QString& menu, const int group, \param idx required index in the menu \return action ID or -1 if action could not be added */ -int SalomePyQt::createMenu( QtxAction* a, const int menu, const int id, const int group, const int idx ) +int SalomePyQt::createMenu( QAction* a, const int menu, const int id, const int group, const int idx ) { return ProcessEvent( new TCreateMenuEvent( CrMenu( a, menu, id, group, idx ) ) ); } @@ -1590,13 +1596,13 @@ int SalomePyQt::createMenu( QtxAction* a, const int menu, const int id, const in \param idx required index in the menu \return action ID or -1 if action could not be added */ -int SalomePyQt::createMenu( QtxAction* a, const QString& menu, const int id, const int group, const int idx ) +int SalomePyQt::createMenu( QAction* a, const QString& menu, const int id, const int group, const int idx ) { return ProcessEvent( new TCreateMenuEvent( CrMenu( a, menu, id, group, idx ) ) ); } /*! - \fn QtxAction* SalomePyQt::createSeparator(); + \fn QAction* SalomePyQt::createSeparator(); \brief Create separator action which can be used in the menu or toolbar. \return new separator action */ @@ -1604,7 +1610,7 @@ int SalomePyQt::createMenu( QtxAction* a, const QString& menu, const int id, con class TCreateSepEvent: public SALOME_Event { public: - typedef QtxAction* TResult; + typedef QAction* TResult; TResult myResult; TCreateSepEvent() : myResult( 0 ) {} @@ -1612,16 +1618,16 @@ public: { SALOME_PYQT_Module* module = getActiveModule(); if ( module ) - myResult = (QtxAction*)module->separator(); + myResult = (QAction*)module->separator(); } }; -QtxAction* SalomePyQt::createSeparator() +QAction* SalomePyQt::createSeparator() { return ProcessEvent( new TCreateSepEvent() ); } /*! - \fn QtxAction* SalomePyQt::createAction( const int id, + \fn QAction* SalomePyQt::createAction( const int id, const QString& menuText, const QString& tipText, const QString& statusText, @@ -1641,7 +1647,7 @@ QtxAction* SalomePyQt::createSeparator() class TCreateActionEvent: public SALOME_Event { public: - typedef QtxAction* TResult; + typedef QAction* TResult; TResult myResult; int myId; QString myMenuText; @@ -1658,10 +1664,10 @@ public: { SALOME_PYQT_Module* module = getActiveModule(); if ( module ) - myResult = (QtxAction*)module->createAction( myId, myTipText, myIcon, myMenuText, myStatusText, myKey, myToggle ); + myResult = (QAction*)module->createAction( myId, myTipText, myIcon, myMenuText, myStatusText, myKey, myToggle ); } }; -QtxAction* SalomePyQt::createAction( const int id, const QString& menuText, +QAction* SalomePyQt::createAction( const int id, const QString& menuText, const QString& tipText, const QString& statusText, const QString& icon, const int key, const bool toggle ) { @@ -1669,7 +1675,33 @@ QtxAction* SalomePyQt::createAction( const int id, const QString& menu } /*! - \fn QtxAction* SalomePyQt::action( const int id ) + \fn QActionGroup* SalomePyQt::createActionGroup( const int id, const bool exclusive ) + \brief Create an action group which can be then used in the menu or toolbar + \param id : the unique id action group to be registered to + \param exclusive : if \c true the action group does exclusive toggling +*/ +/* +struct TcreateActionGroupEvent: public SALOME_Event { + typedef QActionGroup* TResult; + TResult myResult; + int myId; + bool myExclusive; + TcreateActionGroupEvent( const int id, const bool exclusive ) + : myId( id ), myExclusive( exclusive ) {} + virtual void Execute() + { + SALOME_PYQT_Module* module = getActiveModule(); + if ( module ) + myResult = (QAction*)module->createActionGroup( myId, myExclusive ); + } +}; +QActionGroup* SalomePyQt::createActionGroup(const int id, const bool exclusive) +{ + return ProcessEvent( new TcreateActionGroupEvent( id, exclusive ) ); +} +*/ +/*! + \fn QAction* SalomePyQt::action( const int id ) \brief Get action by specified identifier. \return action or 0 if action is not registered */ @@ -1677,7 +1709,7 @@ QtxAction* SalomePyQt::createAction( const int id, const QString& menu class TActionEvent: public SALOME_Event { public: - typedef QtxAction* TResult; + typedef QAction* TResult; TResult myResult; int myId; TActionEvent( const int id ) @@ -1686,16 +1718,16 @@ public: { SALOME_PYQT_Module* module = getActiveModule(); if ( module ) - myResult = (QtxAction*)module->action( myId ); + myResult = (QAction*)module->action( myId ); } }; -QtxAction* SalomePyQt::action( const int id ) +QAction* SalomePyQt::action( const int id ) { return ProcessEvent( new TActionEvent( id ) ); } /*! - \fn int SalomePyQt::actionId( const QtxAction* a ); + \fn int SalomePyQt::actionId( const QAction* a ); \brief Get an action identifier. \return action ID or -1 if action is not registered */ @@ -1705,8 +1737,8 @@ class TActionIdEvent: public SALOME_Event public: typedef int TResult; TResult myResult; - const QtxAction* myAction; - TActionIdEvent( const QtxAction* action ) + const QAction* myAction; + TActionIdEvent( const QAction* action ) : myResult( -1 ), myAction( action ) {} virtual void Execute() { @@ -1715,7 +1747,7 @@ public: myResult = module->actionId( myAction ); } }; -int SalomePyQt::actionId( const QtxAction* a ) +int SalomePyQt::actionId( const QAction* a ) { return ProcessEvent( new TActionIdEvent( a ) ); } @@ -1876,7 +1908,7 @@ void SalomePyQt::setPreferenceProperty( const int id, /*! \brief Add the property value to the list of values. - This method allows creating properties which are QValueList + This method allows creating properties which are QList - there is no way to pass such values directly to QVariant parameter with PyQt. \param id preferences identifier @@ -1979,3 +2011,610 @@ void SalomePyQt::clearMessages() }; ProcessVoidEvent( new TEvent() ); } + +/*! + \brief Gets window with specified identifier + \internal + \param id window identifier + \return pointer on the window +*/ +static SUIT_ViewWindow* getWnd( const int id ) +{ + SUIT_ViewWindow* resWnd = 0; + + SalomeApp_Application* app = getApplication(); + if ( app ) + { + STD_TabDesktop* tabDesk = dynamic_cast( app->desktop() ); + if ( tabDesk ) + { + QList wndlist = tabDesk->windows(); + SUIT_ViewWindow* wnd; + foreach ( wnd, wndlist ) + { + if ( id == wnd->getId() ) + { + resWnd = wnd; + break; + } + } + } + } + + return resWnd; +} + +/*! + \fn QList SalomePyQt::getViews() + \brief Get list of integer identifiers of all the currently opened views + \return list of integer identifiers of all the currently opened views +*/ + +class TGetViews: public SALOME_Event +{ +public: + typedef QList TResult; + TResult myResult; + TGetViews() {} + virtual void Execute() + { + myResult.clear(); + SalomeApp_Application* app = getApplication(); + if ( app ) + { + STD_TabDesktop* tabDesk = dynamic_cast( app->desktop() ); + if ( tabDesk ) + { + QList wndlist = tabDesk->windows(); + SUIT_ViewWindow* wnd; + foreach ( wnd, wndlist ) + myResult.append( wnd->getId() ); + } + } + } +}; +QList SalomePyQt::getViews() +{ + return ProcessEvent( new TGetViews() ); +} + +/*! + \fn int SalomePyQt::getActiveView() + \brief Get integer identifier of the currently active view + \return integer identifier of the currently active view +*/ + +class TGetActiveView: public SALOME_Event +{ +public: + typedef int TResult; + TResult myResult; + TGetActiveView() + : myResult( -1 ) {} + virtual void Execute() + { + SalomeApp_Application* app = getApplication(); + if ( app ) + { + SUIT_ViewManager* viewMgr = app->activeViewManager(); + if ( viewMgr ) + { + SUIT_ViewWindow* wnd = viewMgr->getActiveView(); + if ( wnd ) + myResult = wnd->getId(); + } + } + } +}; +int SalomePyQt::getActiveView() +{ + return ProcessEvent( new TGetActiveView() ); +} + +/*! + \fn QString SalomePyQt::getViewType( const int id ) + \brief Get type of the specified view, e.g. "OCCViewer" + \param id window identifier + \return view type +*/ + +class TGetViewType: public SALOME_Event +{ +public: + typedef QString TResult; + TResult myResult; + int myWndId; + TGetViewType( const int id ) + : myWndId( id ) {} + virtual void Execute() + { + SUIT_ViewWindow* wnd = getWnd( myWndId ); + if ( wnd ) + { + SUIT_ViewManager* viewMgr = wnd->getViewManager(); + if ( viewMgr ) + myResult = viewMgr->getType(); + } + } +}; +QString SalomePyQt::getViewType( const int id ) +{ + return ProcessEvent( new TGetViewType( id ) ); +} + +/*! + \fn bool SalomePyQt::setViewTitle( const int id, const QString& title ) + \brief Change view caption + \param id window identifier + \param title new window title + \return \c true if operation is completed successfully and \c false otherwise +*/ + +class TSetViewTitle: public SALOME_Event +{ +public: + typedef bool TResult; + TResult myResult; + int myWndId; + QString myTitle; + TSetViewTitle( const int id, const QString& title ) + : myResult( false ), + myWndId( id ), + myTitle( title ) {} + virtual void Execute() + { + SUIT_ViewWindow* wnd = getWnd( myWndId ); + if ( wnd ) + { + wnd->setWindowTitle( myTitle ); + myResult = true; + } + } +}; +bool SalomePyQt::setViewTitle( const int id, const QString& title ) +{ + return ProcessEvent( new TSetViewTitle( id, title ) ); +} + + +/*! + \fn QString SalomePyQt::getViewTitle( const int id ) + \brief Get view caption + \param id window identifier + \return view caption +*/ + +class TGetViewTitle: public SALOME_Event +{ +public: + typedef QString TResult; + TResult myResult; + int myWndId; + TGetViewTitle( const int id ) + : myWndId( id ) {} + virtual void Execute() + { + SUIT_ViewWindow* wnd = getWnd( myWndId ); + if ( wnd ) + myResult = wnd->windowTitle(); + } +}; +QString SalomePyQt::getViewTitle( const int id ) +{ + return ProcessEvent( new TGetViewTitle( id ) ); +} + +/*! + \fn QList SalomePyQt::findViews( const QString& type ) + \brief Get list of integer identifiers of all the + currently opened views of the specified type + \param type viewer type + \return list of integer identifiers +*/ + +class TFindViews: public SALOME_Event +{ +public: + typedef QList TResult; + TResult myResult; + QString myType; + TFindViews( const QString& type ) + : myType( type ) {} + virtual void Execute() + { + myResult.clear(); + SalomeApp_Application* app = getApplication(); + if ( app ) + { + ViewManagerList vmList; + app->viewManagers( myType, vmList ); + SUIT_ViewManager* viewMgr; + foreach ( viewMgr, vmList ) + { + QVector vec = viewMgr->getViews(); + for ( int i = 0, n = vec.size(); i < n; i++ ) + { + SUIT_ViewWindow* wnd = vec[ i ]; + if ( wnd ) + myResult.append( wnd->getId() ); + } + } + } + } +}; +QList SalomePyQt::findViews( const QString& type ) +{ + return ProcessEvent( new TFindViews( type ) ); +} + +/*! + \fn bool SalomePyQt::activateView( const int id ) + \brief Activate view + \param id window identifier + \return \c true if operation is completed successfully and \c false otherwise +*/ + +class TActivateView: public SALOME_Event +{ +public: + typedef bool TResult; + TResult myResult; + int myWndId; + TActivateView( const int id ) + : myResult( false ), + myWndId( id ) {} + virtual void Execute() + { + SUIT_ViewWindow* wnd = getWnd( myWndId ); + if ( wnd ) + { + wnd->setFocus(); + myResult = true; + } + } +}; +bool SalomePyQt::activateView( const int id ) +{ + return ProcessEvent( new TActivateView( id ) ); +} + +/*! + \fn int SalomePyQt::createView( const QString& type ) + \brief Create new view and activate it + \param type viewer type + \return integer identifier of created view (or -1 if view could not be created) +*/ + +class TCreateView: public SALOME_Event +{ +public: + typedef int TResult; + TResult myResult; + QString myType; + TCreateView( const QString& theType ) + : myResult( -1 ), + myType( theType ) {} + virtual void Execute() + { + SalomeApp_Application* app = getApplication(); + if ( app ) + { + SUIT_ViewManager* viewMgr = app->createViewManager( myType ); + if ( viewMgr ) + { + SUIT_ViewWindow* wnd = viewMgr->getActiveView(); + if ( wnd ) + myResult = wnd->getId(); + } + } + } +}; +int SalomePyQt::createView( const QString& type ) +{ + return ProcessEvent( new TCreateView( type ) ); +} + +/*! + \fn bool SalomePyQt::closeView( const int id ) + \brief Close view + \param id window identifier + \return \c true if operation is completed successfully and \c false otherwise +*/ + +class TCloseView: public SALOME_Event +{ +public: + typedef bool TResult; + TResult myResult; + int myWndId; + TCloseView( const int id ) + : myResult( false ), + myWndId( id ) {} + virtual void Execute() + { + SUIT_ViewWindow* wnd = getWnd( myWndId ); + if ( wnd ) + { + SUIT_ViewManager* viewMgr = wnd->getViewManager(); + if ( viewMgr ) + { + wnd->close(); + myResult = true; + } + } + } +}; +bool SalomePyQt::closeView( const int id ) +{ + return ProcessEvent( new TCloseView( id ) ); +} + +/*! + \fn int SalomePyQt::cloneView( const int id ) + \brief Clone view (if this operation is supported for specified view type) + \param id window identifier + \return integer identifier of the cloned view or -1 or operation could not be performed +*/ + +class TCloneView: public SALOME_Event +{ +public: + typedef int TResult; + TResult myResult; + int myWndId; + TCloneView( const int id ) + : myResult( -1 ), + myWndId( id ) {} + virtual void Execute() + { + SUIT_ViewWindow* wnd = getWnd( myWndId ); + if ( wnd ) + { + SUIT_ViewManager* viewMgr = wnd->getViewManager(); + if ( viewMgr ) + { + if ( wnd->inherits( "OCCViewer_ViewWindow" ) ) + { + OCCViewer_ViewWindow* occView = (OCCViewer_ViewWindow*)( wnd ); + occView->onCloneView(); + + wnd = viewMgr->getActiveView(); + if ( wnd ) + myResult = wnd->getId(); + } + else if ( wnd->inherits( "Plot2d_ViewWindow" ) ) + { + Plot2d_ViewManager* viewMgr2d = dynamic_cast( viewMgr ); + Plot2d_ViewWindow* srcWnd2d = dynamic_cast( wnd ); + if ( viewMgr2d && srcWnd2d ) + { + Plot2d_ViewWindow* resWnd = viewMgr2d->cloneView( srcWnd2d ); + myResult = resWnd->getId(); + } + } + } + } + } +}; +int SalomePyQt::cloneView( const int id ) +{ + return ProcessEvent( new TCloneView( id ) ); +} + +/*! + \fn bool SalomePyQt::isViewVisible( const int id ) + \brief Check whether view is visible ( i.e. it is on the top of the views stack) + \param id window identifier + \return \c true if view is visible and \c false otherwise +*/ + +class TIsViewVisible: public SALOME_Event +{ +public: + typedef bool TResult; + TResult myResult; + int myWndId; + TIsViewVisible( const int id ) + : myResult( false ), + myWndId( id ) {} + virtual void Execute() + { + SUIT_ViewWindow* wnd = getWnd( myWndId ); + if ( wnd ) + { + QWidget* p = wnd->parentWidget(); + myResult = ( p && p->isVisibleTo( p->parentWidget() ) ); + } + } +}; +bool SalomePyQt::isViewVisible( const int id ) +{ + return ProcessEvent( new TIsViewVisible( id ) ); +} + +/*! + \fn bool SalomePyQt::groupAllViews() + \brief Group all views to the single tab area + \return \c true if operation is completed successfully and \c false otherwise +*/ + +class TGroupAllViews: public SALOME_Event +{ +public: + typedef bool TResult; + TResult myResult; + TGroupAllViews() + : myResult( false ) {} + virtual void Execute() + { + SalomeApp_Application* app = getApplication(); + if ( app ) + { + STD_TabDesktop* tabDesk = dynamic_cast( app->desktop() ); + if ( tabDesk ) + { + QtxWorkstack* wStack = tabDesk->workstack(); + if ( wStack ) + { + wStack->stack(); + myResult = true; + } + } + } + } +}; +bool SalomePyQt::groupAllViews() +{ + return ProcessEvent( new TGroupAllViews() ); +} + +/*! + \fn bool SalomePyQt::splitView( const int id, const Orientation ori, const Action action ) + \brief Split tab area to which view with identifier belongs to + \param id window identifier + \param ori orientation of split operation + \param action action to be performed + \return \c true if operation is completed successfully \c false otherwise +*/ + +class TSplitView: public SALOME_Event +{ +public: + typedef bool TResult; + TResult myResult; + int myWndId; + Orientation myOri; + Action myAction; + TSplitView( const int id, + const Orientation ori, + const Action action ) + : myResult( false ), + myWndId( id ), + myOri( ori ), + myAction( action ) {} + virtual void Execute() + { + SUIT_ViewWindow* wnd = getWnd( myWndId ); + if ( wnd ) + { + // activate view + // wnd->setFocus(); ??? + + // split workstack + if ( getApplication() ) + { + STD_TabDesktop* desk = + dynamic_cast( getApplication()->desktop() ); + if ( desk ) + { + QtxWorkstack* wStack = desk->workstack(); + if ( wStack ) + { + Qt::Orientation qtOri = + ( myOri == Horizontal ) ? Qt::Horizontal : Qt::Vertical; + + QtxWorkstack::SplitType sType; + if ( myAction == MoveWidget ) + sType = QtxWorkstack::SplitMove; + else if ( myAction == LeaveWidget ) + sType = QtxWorkstack::SplitStay; + else + sType = QtxWorkstack::SplitAt; + + wStack->Split( wnd, qtOri, sType ); + myResult = true; + } + } + } + } + } +}; +bool SalomePyQt::splitView( const int id, const Orientation ori, const Action action ) +{ + return ProcessEvent( new TSplitView( id, ori, action ) ); +} + +/*! + \fn bool SalomePyQt::moveView( const int id, const int id_to, const bool before ) + \brief Move view with the first identifier to the same area which + another view with the second identifier belongs to + \param id source window identifier + \param id_to destination window identifier + param before specifies whether the first viewt has to be moved before or after + the second view + \return \c true if operation is completed successfully and \c false otherwise +*/ + +class TMoveView: public SALOME_Event +{ +public: + typedef bool TResult; + TResult myResult; + int myWndId; + int myWndToId; + bool myIsBefore; + TMoveView( const int id, const int id_to, const bool before ) + : myResult( false ), + myWndId( id ), + myWndToId( id_to ), + myIsBefore( before ) {} + virtual void Execute() + { + SUIT_ViewWindow* wnd = getWnd( myWndId ); + SUIT_ViewWindow* wnd_to = getWnd( myWndToId ); + if ( wnd && wnd_to ) + { + QtxWorkstack* wStack = dynamic_cast( + getApplication()->desktop() )->workstack(); + if ( wStack ) + myResult = wStack->move( wnd, wnd_to, myIsBefore ); + } + } +}; +bool SalomePyQt::moveView( const int id, const int id_to, const bool before ) +{ + return ProcessEvent( new TMoveView( id, id_to, before ) ); +} + +/*! + \fn QList SalomePyQt::neighbourViews( const int id ) + \brief Get list of views identifiers that belongs to the same area as + specified view (excluding it) + \param id window identifier + \return list of views identifiers +*/ + +class TNeighbourViews: public SALOME_Event +{ +public: + typedef QList TResult; + TResult myResult; + int myWndId; + TNeighbourViews( const int id ) + : myWndId( id ) {} + virtual void Execute() + { + myResult.clear(); + SUIT_ViewWindow* wnd = getWnd( myWndId ); + if ( wnd ) + { + QtxWorkstack* wStack = dynamic_cast( + getApplication()->desktop() )->workstack(); + if ( wStack ) + { + QWidgetList wgList = wStack->windowList( wnd ); + QWidget* wg; + foreach ( wg, wgList ) + { + SUIT_ViewWindow* tmpWnd = dynamic_cast( wg ); + if ( tmpWnd && tmpWnd != wnd ) + myResult.append( tmpWnd->getId() ); + } + } + } + } +}; +QList SalomePyQt::neighbourViews( const int id ) +{ + return ProcessEvent( new TNeighbourViews( id ) ); +} diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h index 043363eb4..829c20f17 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h @@ -35,7 +35,8 @@ class SalomeApp_Application; class QMenuBar; class QMenu; class QWidget; -class QtxAction; +class QAction; +class QActionGroup; class SALOME_Selection : public QObject { @@ -93,6 +94,19 @@ enum { PT_File = LightApp_Preferences::File, }; +//! Orientation +enum Orientation { + Horizontal = 0, //!< Horizontal orientation + Vertical = 1 //!< Vertical orientation +}; + +//! Action of splitting corresponding to QtxWorkstack::SplitType enumeration +enum Action { + MoveWidget = 0, //!< move specified widget to the new area, other views stay in the previous area + LeaveWidget = 1, //!< specified widget stays in the old area, all other views are moved to the new area + SplitAt = 2 //!< the view area is splitted in such a way, that specified view and all views which follow it, are moved to the new area +}; + class SalomePyQt { public: @@ -120,8 +134,8 @@ public: static int createTool( const QString& ); static int createTool( const int, const int, const int = -1 ); static int createTool( const int, const QString&, const int = -1 ); - static int createTool( QtxAction*, const int, const int = -1, const int = -1 ); - static int createTool( QtxAction*, const QString&, const int = -1, const int = -1 ); + static int createTool( QAction*, const int, const int = -1, const int = -1 ); + static int createTool( QAction*, const QString&, const int = -1, const int = -1 ); static int createMenu( const QString&, const int = -1, const int = -1, const int = -1, const int = -1 ); @@ -131,19 +145,21 @@ public: const int = -1, const int = -1 ); static int createMenu( const int, const QString& = QString(), const int = -1, const int = -1 ); - static int createMenu( QtxAction*, const int, const int = -1, + static int createMenu( QAction*, const int, const int = -1, const int = -1, const int = -1 ); - static int createMenu( QtxAction*, const QString&, const int = -1, + static int createMenu( QAction*, const QString&, const int = -1, const int = -1, const int = -1 ); - static QtxAction* createSeparator(); + static QAction* createSeparator(); - static QtxAction* createAction( const int, const QString&, + static QAction* createAction( const int, const QString&, const QString& = QString(), const QString& = QString(), const QString& = QString(), const int = 0, const bool = false ); + + // static QActionGroup* createActionGroup( const int, const bool = true ); - static QtxAction* action( const int ); - static int actionId( const QtxAction* ); + static QAction* action( const int ); + static int actionId( const QAction* ); static void addSetting ( const QString&, const QString&, const double ); static void addSetting ( const QString&, const QString&, const int ); @@ -182,6 +198,23 @@ public: static void message( const QString&, bool = true ); static void clearMessages(); + + static QList getViews(); + static int getActiveView(); + static QString getViewType( const int ); + static bool setViewTitle( const int, const QString& ); + static QString getViewTitle( const int ); + static QList findViews( const QString& ); + static bool activateView( const int ); + static int createView( const QString& ); + static bool closeView( const int ); + static int cloneView( const int ); + static bool isViewVisible( const int id ); + + static bool groupAllViews(); + static bool splitView( const int, const Orientation, const Action ); + static bool moveView( const int, const int, const bool ); + static QList neighbourViews( const int ); }; #endif // SALOME_PYQT_H diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip index c647eba5a..1a2a12a7f 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip @@ -80,6 +80,17 @@ enum PrefType { PT_File, }; +enum Orientation { + Horizontal = 0, + Vertical = 1 +}; + +enum Action { + MoveWidget = 0, + LeaveWidget = 1, + SplitAt = 2 +}; + class QtxAction : QAction { %TypeHeaderCode @@ -121,8 +132,8 @@ public: static int createTool( const QString& ) /ReleaseGIL/ ; static int createTool( const int, const int, const int = -1 ) /ReleaseGIL/ ; static int createTool( const int, const QString&, const int = -1 ) /ReleaseGIL/ ; - static int createTool( QtxAction*, const int, const int = -1, const int = -1 ) /ReleaseGIL/ ; - static int createTool( QtxAction*, const QString&, const int = -1, const int = -1 ) /ReleaseGIL/ ; + static int createTool( QAction*, const int, const int = -1, const int = -1 ) /ReleaseGIL/ ; + static int createTool( QAction*, const QString&, const int = -1, const int = -1 ) /ReleaseGIL/ ; static int createMenu( const QString&, const int, const int = -1, const int = -1, const int = -1 ) /ReleaseGIL/ ; @@ -132,18 +143,20 @@ public: const int = -1, const int = -1 ) /ReleaseGIL/ ; static int createMenu( const int, const QString&, const int = -1, const int = -1 ) /ReleaseGIL/ ; - static int createMenu( QtxAction*, const int, const int = -1, + static int createMenu( QAction*, const int, const int = -1, const int = -1, const int = -1 ) /ReleaseGIL/ ; - static int createMenu( QtxAction*, const QString&, const int = -1, + static int createMenu( QAction*, const QString&, const int = -1, const int = -1, const int = -1 ) /ReleaseGIL/ ; - static QtxAction* createSeparator() /ReleaseGIL/ ; + static QAction* createSeparator() /ReleaseGIL/ ; - static QtxAction* createAction( const int, const QString&, + static QAction* createAction( const int, const QString&, const QString& = QString(), const QString& = QString(), const QString& = QString(), const int = 0, const bool = false ) /ReleaseGIL/ ; - static QtxAction* action( const int ) /ReleaseGIL/ ; - static int actionId( const QtxAction* ) /ReleaseGIL/ ; + //static QActionGroup* createActionGroup( const int, const bool = true ) /ReleaseGIL/ ; + + static QAction* action( const int ) /ReleaseGIL/ ; + static int actionId( const QAction* ) /ReleaseGIL/ ; static void addSetting ( const QString&, const QString&, const double ) /ReleaseGIL/ ; static void addSetting ( const QString&, const QString&, const int /Constrained/ ) /ReleaseGIL/ ; @@ -183,4 +196,21 @@ public: static void message( const QString&, bool = true ) /ReleaseGIL/ ; static void clearMessages() /ReleaseGIL/ ; + + static QList getViews() /ReleaseGIL/ ; + static int getActiveView() /ReleaseGIL/ ; + static QString getViewType( const int ) /ReleaseGIL/ ; + static bool setViewTitle( const int, const QString& ) /ReleaseGIL/ ; + static QString getViewTitle( const int ) /ReleaseGIL/ ; + static QList findViews( const QString& ) /ReleaseGIL/ ; + static bool activateView( const int ) /ReleaseGIL/ ; + static int createView( const QString& ) /ReleaseGIL/ ; + static bool closeView( const int ) /ReleaseGIL/ ; + static int cloneView( const int ) /ReleaseGIL/ ; + static bool isViewVisible( const int id ) /ReleaseGIL/ ; + + static bool groupAllViews() /ReleaseGIL/ ; + static bool splitView( const int, Orientation, Action ) /ReleaseGIL/ ; + static bool moveView( const int, const int, const bool ) /ReleaseGIL/ ; + static QList neighbourViews( const int ) /ReleaseGIL/ ; }; diff --git a/src/SPlot2d/SPlot2d_ViewModel.cxx b/src/SPlot2d/SPlot2d_ViewModel.cxx index aa892cef2..4676bc9b9 100644 --- a/src/SPlot2d/SPlot2d_ViewModel.cxx +++ b/src/SPlot2d/SPlot2d_ViewModel.cxx @@ -370,7 +370,8 @@ SPlot2d_Curve* SPlot2d_Viewer::getCurveByIO( const Handle(SALOME_InteractiveObje */ void SPlot2d_Viewer::onCloneView( Plot2d_ViewFrame* clonedVF, Plot2d_ViewFrame* newVF ) { - if( !clonedVF || !newVF ) + // this code is moved on the level of base class + /*if( !clonedVF || !newVF ) return; // 1) Copy all properties of view @@ -387,7 +388,9 @@ void SPlot2d_Viewer::onCloneView( Plot2d_ViewFrame* clonedVF, Plot2d_ViewFrame* if( aCurve && clonedVF->isVisible( aCurve ) ) newVF->displayCurve( aCurve, false ); } - newVF->Repaint(); + newVF->Repaint();*/ + + Plot2d_Viewer::onCloneView( clonedVF, newVF ); } /*! diff --git a/src/SUIT/SUIT_Application.cxx b/src/SUIT/SUIT_Application.cxx index 19a68e935..ac75fdc4c 100755 --- a/src/SUIT/SUIT_Application.cxx +++ b/src/SUIT/SUIT_Application.cxx @@ -27,11 +27,24 @@ #include #include #include +#include #include #include #include +/*! + \class StatusLabel + \brief Status bar customization label. Used to workaroubd desktop resizing bug. + \internal +*/ +class StatusLabel : public QLabel +{ +public: + StatusLabel( QWidget* parent ) : QLabel( parent ) {} + QSize minimumSizeHint () const { return QSize( 0, 0 ); } +}; + /*! Default constructor */ @@ -171,7 +184,7 @@ void SUIT_Application::putInfo( const QString& msg, const int msec ) if ( !myStatusLabel ) { - myStatusLabel = new QLabel( desktop()->statusBar() ); + myStatusLabel = new StatusLabel( desktop()->statusBar() ); desktop()->statusBar()->addWidget( myStatusLabel, 1 ); myStatusLabel->show(); } diff --git a/src/SUIT/SUIT_FileDlg.cxx b/src/SUIT/SUIT_FileDlg.cxx index 1a026be1b..7572fba75 100755 --- a/src/SUIT/SUIT_FileDlg.cxx +++ b/src/SUIT/SUIT_FileDlg.cxx @@ -954,6 +954,15 @@ QString SUIT_FileDlg::getExistingDirectory( QWidget* parent, const QString& init return dirname; } +/*! + \brief Get last visited path + \return last visited path +*/ +QString SUIT_FileDlg::getLastVisitedPath() +{ + return myLastVisitedPath; +} + /*! \brief Selects current file diff --git a/src/SUIT/SUIT_FileDlg.h b/src/SUIT/SUIT_FileDlg.h index 832a28e13..76309c67a 100755 --- a/src/SUIT/SUIT_FileDlg.h +++ b/src/SUIT/SUIT_FileDlg.h @@ -92,6 +92,8 @@ public: const bool = true, SUIT_FileValidator* = 0 ); + static QString getLastVisitedPath(); + protected: virtual bool event( QEvent* ); QLineEdit* lineEdit() const; diff --git a/src/SUIT/SUIT_Session.cxx b/src/SUIT/SUIT_Session.cxx index 6ca03d964..a11ea26a6 100755 --- a/src/SUIT/SUIT_Session.cxx +++ b/src/SUIT/SUIT_Session.cxx @@ -230,7 +230,7 @@ void SUIT_Session::onApplicationClosed( SUIT_Application* theApp ) if ( myAppList.isEmpty() ) { - printf( "Calling QApplication::exit() with exit code = %d\n", myExitStatus ); + //printf( "Calling QApplication::exit() with exit code = %d\n", myExitStatus ); QApplication::instance()->exit( myExitStatus ); } } diff --git a/src/SUIT/SUIT_ViewWindow.cxx b/src/SUIT/SUIT_ViewWindow.cxx index a9e8ae95d..379505f8b 100755 --- a/src/SUIT/SUIT_ViewWindow.cxx +++ b/src/SUIT/SUIT_ViewWindow.cxx @@ -231,3 +231,11 @@ QtxActionToolMgr* SUIT_ViewWindow::toolMgr() const { return myToolMgr; } + +/*! + \return window unique identifier +*/ +int SUIT_ViewWindow::getId() const +{ + return int(long(this)); +} diff --git a/src/SUIT/SUIT_ViewWindow.h b/src/SUIT/SUIT_ViewWindow.h index 6ae1c5b19..f61138ef1 100755 --- a/src/SUIT/SUIT_ViewWindow.h +++ b/src/SUIT/SUIT_ViewWindow.h @@ -52,6 +52,8 @@ public: virtual void setVisualParameters( const QString& parameters ); void setDestructiveClose( const bool ); + + int getId() const; QtxActionToolMgr* toolMgr() const; diff --git a/src/SVTK/SALOME_Actor.cxx b/src/SVTK/SALOME_Actor.cxx index 7f17c2708..678d9de95 100644 --- a/src/SVTK/SALOME_Actor.cxx +++ b/src/SVTK/SALOME_Actor.cxx @@ -509,7 +509,7 @@ SALOME_Actor if(myIsPreselected){ const TColStd_IndexedMapOfInteger& aMapIndex = myPreHighlightActor->GetMapIndex(); int anExtent = aMapIndex.Extent(); - anIsChanged |= (anExtent == 0); + anIsChanged |= (anExtent == 0 || anExtent == 1); anIsChanged |= (anExtent == 2 && (anObjId != aMapIndex(1) || anEdgeId != aMapIndex(2))); if(anIsChanged){ TColStd_IndexedMapOfInteger aMapIndex; diff --git a/src/SVTK/SVTK_CubeAxesDlg.cxx b/src/SVTK/SVTK_CubeAxesDlg.cxx index 1258e98ed..050028a08 100644 --- a/src/SVTK/SVTK_CubeAxesDlg.cxx +++ b/src/SVTK/SVTK_CubeAxesDlg.cxx @@ -48,29 +48,60 @@ #include /*! - * Class : AxisWg - * Description : Tab of dialog - */ + \class SVTK_CubeAxesDlg::AxisWidget + \brief Axis tab widget of the "Graduated axis" dialog box + \internal +*/ + +class SVTK_CubeAxesDlg::AxisWidget : public QFrame +{ +public: + AxisWidget( QWidget* ); + ~AxisWidget(); + + void UseName( const bool ); + void SetName( const QString& ); + void SetNameFont( const QColor&, const int, const bool, const bool, const bool ); + bool ReadData( vtkAxisActor2D* ); + bool Apply( vtkAxisActor2D* ); + +private: + // name + QGroupBox* myNameGrp; + QLineEdit* myAxisName; + SVTK_FontWidget* myNameFont; + + // labels + QGroupBox* myLabelsGrp; + QtxIntSpinBox* myLabelNumber; + QtxIntSpinBox* myLabelOffset; + SVTK_FontWidget* myLabelsFont; + + // tick marks + QGroupBox* myTicksGrp; + QtxIntSpinBox* myTickLength; + + friend class SVTK_CubeAxesDlg; +}; /*! Constructor */ -SVTK_AxisWidget::SVTK_AxisWidget (QWidget* theParent) +SVTK_CubeAxesDlg::AxisWidget::AxisWidget (QWidget* theParent) : QFrame(theParent) { QList< QLabel* > aLabels; // "Name" grp - myNameGrp = new QGroupBox(tr("AXIS_NAME"), this); + myNameGrp = new QGroupBox(SVTK_CubeAxesDlg::tr("AXIS_NAME"), this); + myNameGrp->setCheckable( true ); + QVBoxLayout* aVBox = new QVBoxLayout; - myIsNameVisible = new QCheckBox(tr("IS_VISIBLE"), myNameGrp); - aVBox->addWidget(myIsNameVisible); - QHBoxLayout* aHBox = new QHBoxLayout; aHBox->setSpacing(5); - QLabel* aLabel = new QLabel(tr("NAME")); + QLabel* aLabel = new QLabel(SVTK_CubeAxesDlg::tr("NAME")); aHBox->addWidget(aLabel); myAxisName = new QLineEdit; aHBox->addWidget(myAxisName); @@ -79,7 +110,7 @@ SVTK_AxisWidget::SVTK_AxisWidget (QWidget* theParent) aHBox = new QHBoxLayout; aHBox->setSpacing(5); - aLabel = new QLabel(tr("FONT")); + aLabel = new QLabel(SVTK_CubeAxesDlg::tr("FONT")); aHBox->addWidget(aLabel); myNameFont = new SVTK_FontWidget(myNameGrp); aHBox->addWidget(myNameFont); @@ -90,35 +121,32 @@ SVTK_AxisWidget::SVTK_AxisWidget (QWidget* theParent) // "Labels" grp - myLabelsGrp = new QGroupBox(tr("LABELS"), this); - aVBox = new QVBoxLayout; + myLabelsGrp = new QGroupBox(SVTK_CubeAxesDlg::tr("LABELS"), this); + myLabelsGrp->setCheckable( true ); - myIsLabelsVisible = new QCheckBox(tr("IS_VISIBLE"), myLabelsGrp); - aVBox->addWidget(myIsLabelsVisible); + aVBox = new QVBoxLayout; aHBox = new QHBoxLayout; aHBox->setSpacing(5); - aLabel = new QLabel(tr("NUMBER")); + aLabel = new QLabel(SVTK_CubeAxesDlg::tr("NUMBER")); aHBox->addWidget(aLabel); myLabelNumber = new QtxIntSpinBox(0,25,1,myLabelsGrp); - myLabelNumber->setObjectName("SpinBoxLabelNumber"); aHBox->addWidget(myLabelNumber); aLabels.append(aLabel); aVBox->addLayout(aHBox); aHBox = new QHBoxLayout; aHBox->setSpacing(5); - aLabel = new QLabel(tr("OFFSET")); + aLabel = new QLabel(SVTK_CubeAxesDlg::tr("OFFSET")); aHBox->addWidget(aLabel); myLabelOffset = new QtxIntSpinBox(0,100,1,myLabelsGrp); - myLabelOffset->setObjectName("SpinBoxLabellOffset"); aHBox->addWidget(myLabelOffset); aLabels.append(aLabel); aVBox->addLayout(aHBox); aHBox = new QHBoxLayout; aHBox->setSpacing(5); - aLabel = new QLabel(tr("FONT")); + aLabel = new QLabel(SVTK_CubeAxesDlg::tr("FONT")); aHBox->addWidget(aLabel); myLabelsFont = new SVTK_FontWidget(myLabelsGrp); aHBox->addWidget(myLabelsFont); @@ -129,18 +157,16 @@ SVTK_AxisWidget::SVTK_AxisWidget (QWidget* theParent) // "Tick marks" grp - myTicksGrp = new QGroupBox(tr("TICK_MARKS"), this); - aVBox = new QVBoxLayout; + myTicksGrp = new QGroupBox(SVTK_CubeAxesDlg::tr("TICK_MARKS"), this); + myTicksGrp->setCheckable( true ); - myIsTicksVisible = new QCheckBox(tr("IS_VISIBLE"), myTicksGrp); - aVBox->addWidget(myIsTicksVisible); + aVBox = new QVBoxLayout; aHBox = new QHBoxLayout; aHBox->setSpacing(5); - aLabel = new QLabel(tr("LENGTH")); + aLabel = new QLabel(SVTK_CubeAxesDlg::tr("LENGTH")); aHBox->addWidget(aLabel); myTickLength = new QtxIntSpinBox(0,100,1,myTicksGrp); - myTickLength->setObjectName("SpinBoxTickLength"); aHBox->addWidget(myTickLength); aLabels.append(aLabel); aVBox->addLayout(aHBox); @@ -157,10 +183,9 @@ SVTK_AxisWidget::SVTK_AxisWidget (QWidget* theParent) aLay->addWidget(myTicksGrp); // init - myIsNameVisible->setChecked(true); - myIsLabelsVisible->setChecked(true); - myIsTicksVisible->setChecked(true); - updateControlState(); + myNameGrp->setChecked( true ); + myLabelsGrp->setChecked( true ); + myTicksGrp->setChecked( true ); // Adjust label widths QList< QLabel* >::iterator anIter; @@ -169,74 +194,35 @@ SVTK_AxisWidget::SVTK_AxisWidget (QWidget* theParent) aMaxWidth = qMax(aMaxWidth, (*anIter)->sizeHint().width()); for (anIter = aLabels.begin(); anIter != aLabels.end(); anIter++) (*anIter)->setFixedWidth(aMaxWidth); - - // connect signals and slots - connect(myIsNameVisible, SIGNAL(stateChanged(int)), SLOT(onNameChecked())); - connect(myIsLabelsVisible, SIGNAL(stateChanged(int)), SLOT(onLabelsChecked())); - connect(myIsTicksVisible, SIGNAL(stateChanged(int)), SLOT(onTicksChecked())); } /*! Destructor */ -SVTK_AxisWidget::~SVTK_AxisWidget() -{ -} - -void SVTK_AxisWidget::updateControlState() -{ - onNameChecked(); - onLabelsChecked(); - onTicksChecked(); -} - -void SVTK_AxisWidget::setEnabled(QGroupBox* theGrp, const bool theState) -{ - QObjectList aChildren(theGrp->children()); - QObject* anObj; - for(int i = 0; i < aChildren.size(); i++) - { - anObj = aChildren.at(i); - if (anObj !=0 && anObj->inherits("QHBoxLayout")) - ((QHBoxLayout*)anObj)->setEnabled(theState); - } -} - -void SVTK_AxisWidget::onLabelsChecked() -{ - setEnabled(myLabelsGrp, myIsLabelsVisible->isChecked()); -} - -void SVTK_AxisWidget::onTicksChecked() -{ - setEnabled(myTicksGrp, myIsTicksVisible->isChecked()); -} - -void SVTK_AxisWidget::onNameChecked() +SVTK_CubeAxesDlg::AxisWidget::~AxisWidget() { - setEnabled(myNameGrp, myIsNameVisible->isChecked()); } -void SVTK_AxisWidget::UseName(const bool toUse) +void SVTK_CubeAxesDlg::AxisWidget::UseName(const bool toUse) { - myIsNameVisible->setChecked(toUse); + myNameGrp->setChecked(toUse); } -void SVTK_AxisWidget::SetName(const QString& theName) +void SVTK_CubeAxesDlg::AxisWidget::SetName(const QString& theName) { myAxisName->setText(theName); } -void SVTK_AxisWidget::SetNameFont(const QColor& theColor, - const int theFont, - const bool theIsBold, - const bool theIsItalic, - const bool theIsShadow) +void SVTK_CubeAxesDlg::AxisWidget::SetNameFont(const QColor& theColor, + const int theFont, + const bool theIsBold, + const bool theIsItalic, + const bool theIsShadow) { myNameFont->SetData(theColor, theFont, theIsBold, theIsItalic, theIsShadow); } -bool SVTK_AxisWidget::ReadData(vtkAxisActor2D* theActor) +bool SVTK_CubeAxesDlg::AxisWidget::ReadData(vtkAxisActor2D* theActor) { if (theActor == 0) return false; @@ -264,7 +250,7 @@ bool SVTK_AxisWidget::ReadData(vtkAxisActor2D* theActor) isTitleShadow = aTitleProp->GetShadow() ? true : false; } - myIsNameVisible->setChecked(useName); + myNameGrp->setChecked(useName); myAxisName->setText(aTitle); myNameFont->SetData(aTitleColor, aTitleFontFamily, isTitleBold, isTitleItalic, isTitleShadow); @@ -292,7 +278,7 @@ bool SVTK_AxisWidget::ReadData(vtkAxisActor2D* theActor) isLabelsShadow = aLabelsProp->GetShadow() ? true : false; } - myIsLabelsVisible->setChecked(useLabels); + myLabelsGrp->setChecked(useLabels); myLabelNumber->setValue(nbLabels); myLabelOffset->setValue(anOffset); myLabelsFont->SetData(aLabelsColor, aLabelsFontFamily, isLabelsBold, isLabelsItalic, isLabelsShadow); @@ -301,20 +287,20 @@ bool SVTK_AxisWidget::ReadData(vtkAxisActor2D* theActor) bool useTickMarks = theActor->GetTickVisibility(); int aTickLength = theActor->GetTickLength(); - myIsTicksVisible->setChecked(useTickMarks); + myTicksGrp->setChecked(useTickMarks); myTickLength->setValue(aTickLength); return true; } -bool SVTK_AxisWidget::Apply(vtkAxisActor2D* theActor) +bool SVTK_CubeAxesDlg::AxisWidget::Apply(vtkAxisActor2D* theActor) { if (theActor == 0) return false; // Name - theActor->SetTitleVisibility(myIsNameVisible->isChecked() ? 1 : 0); + theActor->SetTitleVisibility(myNameGrp->isChecked() ? 1 : 0); theActor->SetTitle(myAxisName->text().toLatin1()); QColor aTitleColor(255, 255, 255); @@ -341,7 +327,7 @@ bool SVTK_AxisWidget::Apply(vtkAxisActor2D* theActor) // Labels - theActor->SetLabelVisibility(myIsLabelsVisible->isChecked() ? 1 : 0); + theActor->SetLabelVisibility(myLabelsGrp->isChecked() ? 1 : 0); int nbLabels = myLabelNumber->value(); theActor->SetNumberOfLabels(nbLabels); @@ -374,7 +360,7 @@ bool SVTK_AxisWidget::Apply(vtkAxisActor2D* theActor) // Tick marks - theActor->SetTickVisibility(myIsTicksVisible->isChecked()); + theActor->SetTickVisibility(myTicksGrp->isChecked()); int aTickLength = myTickLength->value(); theActor->SetTickLength(aTickLength); @@ -418,9 +404,9 @@ QWidget* SVTK_CubeAxesDlg::createMainFrame(QWidget* theParent) myTabWg = new QTabWidget(aFrame); - myAxes[ 0 ] = new SVTK_AxisWidget(myTabWg); - myAxes[ 1 ] = new SVTK_AxisWidget(myTabWg); - myAxes[ 2 ] = new SVTK_AxisWidget(myTabWg); + myAxes[ 0 ] = new AxisWidget(myTabWg); + myAxes[ 1 ] = new AxisWidget(myTabWg); + myAxes[ 2 ] = new AxisWidget(myTabWg); myTabWg->addTab(myAxes[ 0 ], tr("X_AXIS")); myTabWg->addTab(myAxes[ 1 ], tr("Y_AXIS")); diff --git a/src/SVTK/SVTK_CubeAxesDlg.h b/src/SVTK/SVTK_CubeAxesDlg.h index 1428dad9d..d4f90568a 100644 --- a/src/SVTK/SVTK_CubeAxesDlg.h +++ b/src/SVTK/SVTK_CubeAxesDlg.h @@ -29,23 +29,13 @@ #include "SVTK_DialogBase.h" -#include - class QWidget; class QPushButton; class QTabWidget; class QCheckBox; -class QLineEdit; -class QGroupBox; class QtxAction; -class QtxIntSpinBox; - -class vtkAxisActor2D; class SVTK_CubeAxesActor2D; - -class SVTK_FontWidget; -class SVTK_AxisWidget; class SVTK_MainWindow; /*! @@ -56,6 +46,8 @@ class SVTK_CubeAxesDlg : public SVTK_DialogBase { Q_OBJECT + class AxisWidget; + public: SVTK_CubeAxesDlg(QtxAction* theAction, SVTK_MainWindow* theParent, @@ -84,56 +76,7 @@ private: QPushButton* myOkBtn; QPushButton* myApplyBtn; QPushButton* myCloseBtn; - SVTK_AxisWidget* myAxes[ 3 ]; -}; - -/*! - * Class : SVTK_AxisWidget - * Description : Tab of dialog - */ -class SVTK_AxisWidget : public QFrame -{ - Q_OBJECT - -public: - SVTK_AxisWidget( QWidget* ); - ~SVTK_AxisWidget(); - - void UseName( const bool ); - void SetName( const QString& ); - void SetNameFont( const QColor&, const int, const bool, const bool, const bool ); - bool ReadData( vtkAxisActor2D* ); - bool Apply( vtkAxisActor2D* ); - -private slots: - void onNameChecked(); - void onLabelsChecked(); - void onTicksChecked(); - -private: - void updateControlState(); - void setEnabled( QGroupBox*, const bool ); - -private: - // name - QGroupBox* myNameGrp; - QCheckBox* myIsNameVisible; - QLineEdit* myAxisName; - SVTK_FontWidget* myNameFont; - - // labels - QGroupBox* myLabelsGrp; - QCheckBox* myIsLabelsVisible; - QtxIntSpinBox* myLabelNumber; - QtxIntSpinBox* myLabelOffset; - SVTK_FontWidget* myLabelsFont; - - // tick marks - QGroupBox* myTicksGrp; - QCheckBox* myIsTicksVisible; - QtxIntSpinBox* myTickLength; - - friend class SVTK_CubeAxesDlg; + AxisWidget* myAxes[ 3 ]; }; #endif diff --git a/src/SVTK/SVTK_RectPicker.cxx b/src/SVTK/SVTK_RectPicker.cxx index fb5ced7f2..8d6cfe07b 100644 --- a/src/SVTK/SVTK_RectPicker.cxx +++ b/src/SVTK/SVTK_RectPicker.cxx @@ -261,7 +261,7 @@ namespace // and handle the transformation ourselves. vtkMatrix4x4 *aMatrix = vtkMatrix4x4::New(); aMatrix->DeepCopy(theRenderer->GetActiveCamera()-> - GetCompositePerspectiveTransformMatrix(1,0,1)); + GetCompositePerspectiveTransformMatrix( theRenderer->GetTiledAspectRatio(), 0, 1 ) ); for(vtkIdType aCellId = 0; aCellId < aNumCells; aCellId++){ vtkCell* aCell = theInput->GetCell(aCellId); diff --git a/src/SVTK/SVTK_Selector.cxx b/src/SVTK/SVTK_Selector.cxx index 0f54789d6..906574ca7 100644 --- a/src/SVTK/SVTK_Selector.cxx +++ b/src/SVTK/SVTK_Selector.cxx @@ -29,10 +29,13 @@ #include "SVTK_SelectorDef.h" -#include "VTKViewer_Filter.h" +#include #include "SALOME_Actor.h" +#include +#include + #include #include @@ -547,15 +550,24 @@ SALOME_Actor* SVTK_SelectorDef ::Pick(const SVTK_SelectionEvent* theEvent, vtkRenderer* theRenderer) const { - myCellPicker->Pick(theEvent->myX, - theEvent->myY, - 0.0, - theRenderer); - - vtkActorCollection* aListActors = myCellPicker->GetActors(); - SALOME_Actor* anActor = GetLastSALOMEActor(aListActors); + bool anAdvancedSelectionAlgorithm = true; + SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr(); + if ( aResourceMgr ) + anAdvancedSelectionAlgorithm = aResourceMgr->booleanValue( "VTKViewer", "use_advanced_selection_algorithm", true ); + + SALOME_Actor* anActor = NULL; + vtkActorCollection* aListActors = NULL; + if ( anAdvancedSelectionAlgorithm ) { + myCellPicker->Pick(theEvent->myX, + theEvent->myY, + 0.0, + theRenderer); - if (! anActor) { + aListActors = myCellPicker->GetActors(); + anActor = GetLastSALOMEActor(aListActors); + } + + if ( !anActor ) { myPicker->Pick(theEvent->myX, theEvent->myY, 0.0, diff --git a/src/SVTK/resources/SVTK_msg_en.ts b/src/SVTK/resources/SVTK_msg_en.ts index dad1d0226..56b0e3d74 100644 --- a/src/SVTK/resources/SVTK_msg_en.ts +++ b/src/SVTK/resources/SVTK_msg_en.ts @@ -155,7 +155,27 @@ - SVTK_AxisWidget + SVTK_CubeAxesDlg + + X_AXIS + X axis + + + Y_AXIS + Y axis + + + Z_AXIS + Z axis + + + CAPTION + Graduated axes + + + IS_VISIBLE + Is visible + FONT Font @@ -184,38 +204,11 @@ OFFSET Offset - - IS_VISIBLE - Is visible - AXIS_NAME Axis name - - SVTK_CubeAxesDlg - - X_AXIS - X axis - - - Y_AXIS - Y axis - - - Z_AXIS - Z axis - - - CAPTION - Graduated axes - - - IS_VISIBLE - Is visible - - SVTK_FontWidget @@ -274,15 +267,15 @@ SVTK_NonIsometricDlg LBL_X - X : + X: LBL_Y - Y : + Y: LBL_Z - Z : + Z: MEN_SCALING @@ -297,15 +290,15 @@ SVTK_SetRotationPointDlg LBL_X - X : + X: LBL_Y - Y : + Y: LBL_Z - Z : + Z: LBL_CENTER_OF_BOUNDING_BOX diff --git a/src/SalomeApp/SalomeApp_Application.cxx b/src/SalomeApp/SalomeApp_Application.cxx index 02b419ac2..71bcbed49 100644 --- a/src/SalomeApp/SalomeApp_Application.cxx +++ b/src/SalomeApp/SalomeApp_Application.cxx @@ -45,11 +45,11 @@ #include #include #include +#include #include #include #include -#include #include // temporary commented @@ -631,6 +631,28 @@ public: QCheckBox* mySaveGUIChk; }; +class DumpStudyFileValidator : public SUIT_FileValidator +{ + public: + DumpStudyFileValidator( QWidget* parent) : SUIT_FileValidator ( parent ) {}; + virtual ~DumpStudyFileValidator() {}; + virtual bool canSave( const QString& file ); +}; + +bool DumpStudyFileValidator::canSave(const QString& file) +{ + QFileInfo fi( file ); + QString name = fi.fileName(); + + if ( name.indexOf( QRegExp("[-!?#*&]") ) >= 0 ) { + SUIT_MessageBox::critical( parent(), + QObject::tr("WRN_WARNING"), + QObject::tr("WRN_FILE_NAME_BAD") ); + return false; + } + return SUIT_FileValidator::canSave( file ); +} + /*!Private SLOT. On dump study.*/ void SalomeApp_Application::onDumpStudy( ) { @@ -641,49 +663,41 @@ void SalomeApp_Application::onDumpStudy( ) QStringList aFilters; aFilters.append( tr( "PYTHON_FILES_FILTER" ) ); - DumpStudyFileDlg* fd = new DumpStudyFileDlg( desktop() ); - fd->setWindowTitle( tr( "TOT_DESK_FILE_DUMP_STUDY" ) ); - fd->setFilters( aFilters ); - fd->myPublishChk->setChecked( true ); - fd->mySaveGUIChk->setChecked( true ); - QString aFileName; - while (1) { - fd->exec(); - fd->raise(); - aFileName = fd->selectedFile(); - if ( aFileName.isEmpty() ) - break; - if ( aFileName.indexOf( QRegExp("[-!?#*&]") ) == -1 ) - break; - SUIT_MessageBox::warning( desktop(), - tr( "WRN_WARNING" ), - tr( "WRN_FILE_NAME_BAD" ) ); - } - bool toPublish = fd->myPublishChk->isChecked(); - bool toSaveGUI = fd->mySaveGUIChk->isChecked(); - delete fd; - - if ( !aFileName.isEmpty() ) { - QFileInfo aFileInfo(aFileName); - if( aFileInfo.isDir() ) // IPAL19257 - return; - - int savePoint; - _PTR(AttributeParameter) ap; - _PTR(IParameters) ip = ClientFactory::getIParameters(ap); - if(ip->isDumpPython(appStudy->studyDS())) ip->setDumpPython(appStudy->studyDS()); //Unset DumpPython flag. - if ( toSaveGUI ) { //SRN: Store a visual state of the study at the save point for DumpStudy method - ip->setDumpPython(appStudy->studyDS()); - savePoint = SalomeApp_VisualState( this ).storeState(); //SRN: create a temporary save point + DumpStudyFileDlg fd( desktop() ); + fd.setValidator( new DumpStudyFileValidator( &fd ) ); + fd.setWindowTitle( tr( "TOT_DESK_FILE_DUMP_STUDY" ) ); + fd.setFilters( aFilters ); + fd.myPublishChk->setChecked( true ); + fd.mySaveGUIChk->setChecked( true ); + if ( fd.exec() == QDialog::Accepted ) + { + QString aFileName = fd.selectedFile(); + + bool toPublish = fd.myPublishChk->isChecked(); + bool toSaveGUI = fd.mySaveGUIChk->isChecked(); + + if ( !aFileName.isEmpty() ) { + QFileInfo aFileInfo(aFileName); + if( aFileInfo.isDir() ) // IPAL19257 + return; + + int savePoint; + _PTR(AttributeParameter) ap; + _PTR(IParameters) ip = ClientFactory::getIParameters(ap); + if(ip->isDumpPython(appStudy->studyDS())) ip->setDumpPython(appStudy->studyDS()); //Unset DumpPython flag. + if ( toSaveGUI ) { //SRN: Store a visual state of the study at the save point for DumpStudy method + ip->setDumpPython(appStudy->studyDS()); + savePoint = SalomeApp_VisualState( this ).storeState(); //SRN: create a temporary save point + } + bool res = aStudy->DumpStudy( aFileInfo.absolutePath().toStdString(), + aFileInfo.baseName().toStdString(), toPublish); + if ( toSaveGUI ) + appStudy->removeSavePoint(savePoint); //SRN: remove the created temporary save point. + if ( !res ) + SUIT_MessageBox::warning( desktop(), + QObject::tr("WRN_WARNING"), + tr("WRN_DUMP_STUDY_FAILED") ); } - bool res = aStudy->DumpStudy( aFileInfo.absolutePath().toStdString(), - aFileInfo.baseName().toStdString(), toPublish); - if ( toSaveGUI ) - appStudy->removeSavePoint(savePoint); //SRN: remove the created temporary save point. - if ( !res ) - SUIT_MessageBox::warning( desktop(), - QObject::tr("WRN_WARNING"), - tr("WRN_DUMP_STUDY_FAILED") ); } } @@ -704,8 +718,12 @@ void SalomeApp_Application::onLoadScript( ) QStringList filtersList; filtersList.append(tr("PYTHON_FILES_FILTER")); filtersList.append(tr("ALL_FILES_FILTER")); + + QString anInitialPath = ""; + if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() ) + anInitialPath = QDir::currentPath(); - QString aFile = SUIT_FileDlg::getFileName( desktop(), "", filtersList, tr( "TOT_DESK_FILE_LOAD_SCRIPT" ), true, true ); + QString aFile = SUIT_FileDlg::getFileName( desktop(), anInitialPath, filtersList, tr( "TOT_DESK_FILE_LOAD_SCRIPT" ), true, true ); if ( !aFile.isEmpty() ) { diff --git a/src/SalomeApp/SalomeApp_DataObject.cxx b/src/SalomeApp/SalomeApp_DataObject.cxx index 2b4fe2e21..4ba451631 100644 --- a/src/SalomeApp/SalomeApp_DataObject.cxx +++ b/src/SalomeApp/SalomeApp_DataObject.cxx @@ -203,11 +203,19 @@ QPixmap SalomeApp_DataObject::icon( const int index ) const if ( myObject && myObject->FindAttribute( anAttr, "AttributePixMap" ) ){ _PTR(AttributePixMap) aPixAttr ( anAttr ); if ( aPixAttr->HasPixMap() ) { - QString pixmapName = QObject::tr( aPixAttr->GetPixMap().c_str() ); + QString componentType = componentDataType(); + QString pixmapID = aPixAttr->GetPixMap().c_str(); + // select a plugin within a component + QStringList plugin_pixmap = pixmapID.split( "::", QString::KeepEmptyParts ); + if ( plugin_pixmap.size() == 2 ) { + componentType = plugin_pixmap.front(); + pixmapID = plugin_pixmap.back(); + } + QString pixmapName = QObject::tr( pixmapID.toLatin1().constData() ); LightApp_RootObject* aRoot = dynamic_cast( root() ); if ( aRoot && aRoot->study() ) { SUIT_ResourceMgr* mgr = aRoot->study()->application()->resourceMgr(); - return mgr->loadPixmap( componentDataType(), pixmapName, false ); + return mgr->loadPixmap( componentType, pixmapName, false ); } } } diff --git a/src/SalomeApp/resources/SalomeApp.xml b/src/SalomeApp/resources/SalomeApp.xml index 61bd18003..9fc268d83 100644 --- a/src/SalomeApp/resources/SalomeApp.xml +++ b/src/SalomeApp/resources/SalomeApp.xml @@ -12,7 +12,7 @@ - + @@ -65,10 +65,11 @@ +
- +
@@ -106,6 +107,7 @@ +
@@ -123,6 +125,10 @@
+
+ + +
diff --git a/src/SalomeApp/resources/SalomeApp_msg_en.ts b/src/SalomeApp/resources/SalomeApp_msg_en.ts index 146e43ade..822063b55 100644 --- a/src/SalomeApp/resources/SalomeApp_msg_en.ts +++ b/src/SalomeApp/resources/SalomeApp_msg_en.ts @@ -1,6 +1,10 @@ @default + + WRN_FILE_NAME_BAD + Please enter correct file name. Special characters are not allowed. + CLOSE_LOCKED_STUDY Close locked study? @@ -269,10 +273,6 @@ Do you want to reload it ? ACTIVATE_MODULE_OP_LOAD &Load... - - WRN_FILE_NAME_BAD - Please enter correct file name - SalomeApp_StudyPropertiesDlg diff --git a/src/Session/SALOME_Session_Server.cxx b/src/Session/SALOME_Session_Server.cxx index 8f28b4ab3..8032dcce4 100755 --- a/src/Session/SALOME_Session_Server.cxx +++ b/src/Session/SALOME_Session_Server.cxx @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -305,123 +306,14 @@ bool isFound( const char* str, int argc, char** argv ) void killOmniNames() { - QString fileName( ::getenv ("OMNIORB_CONFIG") ); - QString portNumber; - if ( !fileName.isEmpty() ) - { - QFile aFile( fileName ); - if ( aFile.open(QIODevice::ReadOnly) ) { - QRegExp re("InitRef = .*:([0-9]+)$"); - QTextStream stream ( &aFile ); - while ( !stream.atEnd() ) { - QString textLine = stream.readLine(); - if ( re.indexIn( textLine ) > -1 ) - portNumber = re.cap(1); - } - aFile.close(); - } - } - - if ( !portNumber.isEmpty() ) - { - QString cmd ; - cmd = QString( "ps -eo pid,command | grep -v grep | grep -E \"omniNames.*%1\" | awk '{cmd=sprintf(\"kill -9 %s\",$1); system(cmd)}'" ).arg( portNumber ); - system ( cmd.toLatin1().data() ); - } - - /////////////////// NPAL 18309 (Kill Notifd) //////////////////////////// - if ( !portNumber.isEmpty() ) - { - QString cmd = QString("import pickle, os; "); - cmd += QString("from killSalomeWithPort import getPiDict; "); - cmd += QString("filedict=getPiDict(%1); ").arg(portNumber); - cmd += QString("f=open(filedict, 'r'); "); - cmd += QString("pids=pickle.load(f); "); - cmd += QString("m={}; "); - cmd += QString("[ m.update(i) for i in pids ]; "); - cmd += QString("pids=filter(lambda a: 'notifd' in m[a], m.keys()); "); - cmd += QString("[ os.kill(pid, 9) for pid in pids ]; "); - cmd += QString("os.remove(filedict); "); - cmd = QString("python -c \"%1\" > /dev/null").arg(cmd); - system( cmd.toLatin1().data() ); - } - + SALOME_LifeCycleCORBA::killOmniNames(); } // shutdown standalone servers void shutdownServers( SALOME_NamingService* theNS ) { - // get each Container from NamingService => shutdown it - // (the order is inverse to the order of servers initialization) - - CORBA::Object_var objS = theNS->Resolve("/Kernel/Session"); - SALOME::Session_var session = SALOME::Session::_narrow(objS); - if (!CORBA::is_nil(session)) { - session->ping(); - - string hostname = GetHostname(); - //string containerName = "/Containers/" + hostname; - - // 1) SuperVisionContainer - //string containerNameSV = containerName + "/SuperVisionContainer"; - //CORBA::Object_var objSV = theNS->Resolve(containerNameSV.c_str()); - //Engines::Container_var SVcontainer = Engines::Container::_narrow(objSV) ; - //if ( !CORBA::is_nil(SVcontainer) && ( session->getPID() != SVcontainer->getPID() ) ) - // SVcontainer->Shutdown(); - - // 2) FactoryServerPy - //string containerNameFSP = containerName + "/FactoryServerPy"; - //CORBA::Object_var objFSP = theNS->Resolve(containerNameFSP.c_str()); - //Engines::Container_var FSPcontainer = Engines::Container::_narrow(objFSP) ; - //if ( !CORBA::is_nil(FSPcontainer) && ( session->getPID() != FSPcontainer->getPID() ) ) - // FSPcontainer->Shutdown(); - - // 3) FactoryServer - //string containerNameFS = containerName + "/FactoryServer"; - //CORBA::Object_var objFS = theNS->Resolve(containerNameFS.c_str()); - //Engines::Container_var FScontainer = Engines::Container::_narrow(objFS) ; - //if ( !CORBA::is_nil(FScontainer) && ( session->getPID() != FScontainer->getPID() ) ) - // FScontainer->Shutdown(); - - // 4) ContainerManager - //CORBA::Object_var objCM=theNS->Resolve("/ContainerManager"); - //Engines::ContainerManager_var contMan=Engines::ContainerManager::_narrow(objCM); - //if ( !CORBA::is_nil(contMan) && ( session->getPID() != contMan->getPID() ) ) - // contMan->ShutdownWithExit(); - - // 4) SalomeLauncher - CORBA::Object_var objSL = theNS->Resolve("/SalomeLauncher"); - Engines::SalomeLauncher_var launcher = Engines::SalomeLauncher::_narrow(objSL); - if (!CORBA::is_nil(launcher) && (session->getPID() != launcher->getPID())) - launcher->Shutdown(); - - // 5) ConnectionManager - CORBA::Object_var objCnM=theNS->Resolve("/ConnectionManager"); - Engines::ConnectionManager_var connMan=Engines::ConnectionManager::_narrow(objCnM); - if ( !CORBA::is_nil(connMan) && ( session->getPID() != connMan->getPID() ) ) - connMan->ShutdownWithExit(); - - // 6) SALOMEDS - CORBA::Object_var objSDS = theNS->Resolve("/myStudyManager"); - SALOMEDS::StudyManager_var studyManager = SALOMEDS::StudyManager::_narrow(objSDS) ; - if ( !CORBA::is_nil(studyManager) && ( session->getPID() != studyManager->getPID() ) ) - studyManager->Shutdown(); - - // 7) ModuleCatalog - CORBA::Object_var objMC=theNS->Resolve("/Kernel/ModulCatalog"); - SALOME_ModuleCatalog::ModuleCatalog_var catalog = SALOME_ModuleCatalog::ModuleCatalog::_narrow(objMC); - if ( !CORBA::is_nil(catalog) && ( session->getPID() != catalog->getPID() ) ) - catalog->shutdown(); - - // 8) Registry - CORBA::Object_var objR = theNS->Resolve("/Registry"); - Registry::Components_var registry = Registry::Components::_narrow(objR); - if ( !CORBA::is_nil(registry) && ( session->getPID() != registry->getPID() ) ) - registry->Shutdown(); - - // 9) Kill OmniNames - //killOmniNames(); - } + SALOME_LifeCycleCORBA lcc(theNS); + lcc.shutdownServers(); } // ---------------------------- MAIN ----------------------- @@ -678,7 +570,7 @@ int main( int argc, char **argv ) Py_Finalize(); try { - orb->destroy(); + orb->shutdown(0); } catch (...) { ////////////////////////////////////////////////////////////// diff --git a/src/VTKViewer/VTKViewer_GeometryFilter.cxx b/src/VTKViewer/VTKViewer_GeometryFilter.cxx index 5d2590de6..1c07aceaf 100755 --- a/src/VTKViewer/VTKViewer_GeometryFilter.cxx +++ b/src/VTKViewer/VTKViewer_GeometryFilter.cxx @@ -772,7 +772,7 @@ VTKViewer_GeometryFilter delete [] cellVis; } - return 0; + return 1; } -- 2.39.2