@COMMENCE@
-SUBDIRS = idl src doc
+SUBDIRS = src
+
+ifeq ($(GUI_DISABLE_CORBA),no)
+ SUBDIRS+= idl
+endif
+
+SUBDIRS+= doc adm_local
RESOURCES_FILES = \
back.xpm \
--- /dev/null
+# source path
+top_srcdir=@top_srcdir@
+top_builddir=..
+srcdir=@srcdir@
+VPATH=.:$(srcdir)/adm_local
+
+
+all: resources
+
+install:
+ cp -rf @top_srcdir@/adm_local @prefix@
+
+bin:
+
+resources :
+ cp -rf @top_srcdir@/adm_local $(top_builddir)
+
+inc:
+
+lib:
+
+depend:
+
+depend_idl:
+
+install-end:
+
+install-include:
+
+install-bin:
+
+uninstall:
+
+uninstall-idl:
+
+distclean:
+
+clean:
+
+tests:
+
+distclean-other:
+
--- /dev/null
+#
+# Check configure option --disable-glViewer=[yes|no|DIR] taking into account that
+# DISABLE_GLVIEWER may be already set during build_configure,
+# Set DISABLE_GLVIEWER to yes|no
+#
+# Author : Edawrd AGAPOV (OCC, 2005)
+#
+
+AC_DEFUN([CHECK_GLVIEWER],[
+
+AC_ARG_WITH(glViewer,
+ [ --disable-glViewer default=no ],
+ disable_glViewer="$withval",disable_glViewer="${DISABLE_GLVIEWER}")
+
+case $disable_glViewer in
+ yes)
+# AC_MSG_RESULT(************************************************)
+# AC_MSG_RESULT(******* DISABLE GLViewer configuration *****)
+# AC_MSG_RESULT(************************************************)
+ DISABLE_GLVIEWER="yes"
+ AC_SUBST(DISABLE_GLVIEWER)
+esac
+
+
+])dnl
--- /dev/null
+# Check availability of Salome binary distribution
+#
+# Author : Marc Tajchman (CEA, 2002)
+#------------------------------------------------------------
+
+AC_DEFUN([CHECK_SALOME_GUI],[
+
+AC_CHECKING(for SalomeGUI)
+
+SalomeGUI_ok=no
+
+AC_ARG_WITH(gui,
+ --with-salome_gui=DIR root directory path of SALOME GUI installation,
+ SALOME_GUI_DIR="$withval",SALOME_GUI_DIR="")
+
+if test "x$SALOME_GUI_DIR" = "x" ; then
+
+# no --with-gui-dir option used
+
+ if test "x$GUI_ROOT_DIR" != "x" ; then
+
+ # SALOME_ROOT_DIR environment variable defined
+ SALOME_GUI_DIR=$GUI_ROOT_DIR
+
+ else
+
+ # search Salome binaries in PATH variable
+ AC_PATH_PROG(TEMP, libLightApp.so)
+ if test "x$TEMP" != "x" ; then
+ SALOME_BIN_DIR=`dirname $TEMP`
+ SALOME_GUI_DIR=`dirname $SALOME_BIN_DIR`
+ fi
+
+ fi
+#
+fi
+
+if test -f ${SALOME_GUI_DIR}/lib/salome/libLightApp.so ; then
+ SalomeGUI_ok=yes
+ AC_MSG_RESULT(Using SALOME GUI distribution in ${SALOME_GUI_DIR})
+
+ if test "x$GUI_ROOT_DIR" == "x" ; then
+ GUI_ROOT_DIR=${SALOME_GUI_DIR}
+ fi
+ AC_SUBST(GUI_ROOT_DIR)
+else
+ AC_MSG_WARN("Cannot find compiled SALOME GUI distribution")
+fi
+
+AC_MSG_RESULT(for SALOME GUI: $SalomeGUI_ok)
+
+])dnl
+
--- /dev/null
+#
+# Check configure option --disable-occViewer=[yes|no|DIR] taking into account that
+# DISABLE_OCCVIEWER may be already set during build_configure,
+# Set DISABLE_OCCVIEWER to yes|no
+#
+# Author : Edawrd AGAPOV (OCC, 2005)
+#
+
+AC_DEFUN([CHECK_OCCVIEWER],[
+
+AC_ARG_WITH(occViewer,
+ [ --disable-occViewer default=no ],
+ disable_occViewer="$withval",disable_occViewer="${DISABLE_OCCVIEWER}")
+
+case $disable_occViewer in
+ yes)
+# AC_MSG_RESULT(************************************************)
+# AC_MSG_RESULT(***** DISABLE OCCViewer configuration ******)
+# AC_MSG_RESULT(************************************************)
+ DISABLE_OCCVIEWER="yes"
+ AC_SUBST(DISABLE_OCCVIEWER)
+esac
+
+
+])dnl
--- /dev/null
+#
+# Check configure option --disable-plot2dViewer=[yes|no|DIR] taking into account that
+# DISABLE_PLOT2DVIEWER may be already set during build_configure,
+# Set DISABLE_PLOT2DVIEWER to yes|no
+#
+# Author : Edawrd AGAPOV (OCC, 2005)
+#
+
+AC_DEFUN([CHECK_PLOT2DVIEWER],[
+
+AC_ARG_WITH(plot2dViewer,
+ [ --disable-plot2dViewer default=no ],
+ disable_plot2dViewer="$withval",disable_plot2dViewer="${DISABLE_PLOT2DVIEWER}")
+
+case $disable_plot2dViewer in
+ yes)
+# AC_MSG_RESULT(************************************************)
+# AC_MSG_RESULT(*** DISABLE Plot2dViewer configuration *****)
+# AC_MSG_RESULT(************************************************)
+ DISABLE_PLOT2DVIEWER="yes"
+ AC_SUBST(DISABLE_PLOT2DVIEWER)
+esac
+
+
+])dnl
--- /dev/null
+#
+# Check configure option --disable-pyConsole=[yes|no|DIR] taking into account that
+# DISABLE_PYCONSOLE may be already set during build_configure,
+# Set DISABLE_PYCONSOLE to yes|no
+#
+# Author : Edawrd AGAPOV (OCC, 2005)
+#
+
+AC_DEFUN([CHECK_PYCONSOLE],[
+
+AC_ARG_WITH(pyConsole,
+ [ --disable-pyConsole default=no ],
+ disable_pyConsole="$withval",disable_pyConsole="${DISABLE_PYCONSOLE}")
+
+case $disable_pyConsole in
+ yes)
+# AC_MSG_RESULT(************************************************)
+# AC_MSG_RESULT(***** DISABLE PyConsole configuration ******)
+# AC_MSG_RESULT(************************************************)
+ DISABLE_PYCONSOLE="yes"
+ AC_SUBST(DISABLE_PYCONSOLE)
+esac
+
+
+])dnl
--- /dev/null
+#
+# Check configure option --disable-salomeObject=[yes|no|DIR] taking into account that
+# DISABLE_SALOMEOBJECT may be already set during build_configure,
+# Set DISABLE_SALOMEOBJECT to yes|no
+#
+# Author : Edawrd AGAPOV (OCC, 2005)
+#
+
+AC_DEFUN([CHECK_SALOMEOBJECT],[
+
+AC_ARG_WITH(salomeObject,
+ [ --disable-salomeObject default=no ],
+ disable_salomeObject="$withval",disable_salomeObject="${DISABLE_SALOMEOBJECT}")
+
+case $disable_salomeObject in
+ yes)
+# AC_MSG_RESULT(************************************************)
+# AC_MSG_RESULT(*** DISABLE Salome object configuration ****)
+# AC_MSG_RESULT(************************************************)
+ DISABLE_SALOMEOBJECT="yes"
+ AC_SUBST(DISABLE_SALOMEOBJECT)
+esac
+
+
+])dnl
--- /dev/null
+#
+# Check configure option --disable-supervGraphViewer=[yes|no|DIR] taking into account that
+# DISABLE_SUPERVGRAPHVIEWER may be already set during build_configure,
+# Set DISABLE_SUPERVGRAPHVIEWER to yes|no
+#
+# Author : Edawrd AGAPOV (OCC, 2005)
+#
+
+AC_DEFUN([CHECK_SUPERVGRAPHVIEWER],[
+
+AC_ARG_WITH(supervGraphViewer,
+ [ --disable-supervGraphViewer default=no ],
+ disable_supervGraphViewer="$withval",disable_supervGraphViewer="${DISABLE_SUPERVGRAPHVIEWER}")
+
+case $disable_supervGraphViewer in
+ yes)
+# AC_MSG_RESULT(************************************************)
+# AC_MSG_RESULT(******* DISABLE SupervGraphViewer configuration ********)
+# AC_MSG_RESULT(************************************************)
+ DISABLE_SUPERVGRAPHVIEWER="yes"
+ AC_SUBST(DISABLE_SUPERVGRAPHVIEWER)
+esac
+
+
+])dnl
--- /dev/null
+#
+# Check configure option --disable-vtkViewer=[yes|no|DIR] taking into account that
+# DISABLE_VTKVIEWER may be already set during build_configure,
+# Set DISABLE_VTKVIEWER to yes|no
+#
+# Author : Edawrd AGAPOV (OCC, 2005)
+#
+
+AC_DEFUN([CHECK_VTKVIEWER],[
+
+AC_ARG_WITH(vtkViewer,
+ [ --disable-vtkViewer default=no ],
+ disable_vtkViewer="$withval",disable_vtkViewer="${DISABLE_VTKVIEWER}")
+
+case $disable_vtkViewer in
+ yes)
+# AC_MSG_RESULT(************************************************)
+# AC_MSG_RESULT(***** DISABLE VTK Viewer configuration *****)
+# AC_MSG_RESULT(************************************************)
+ DISABLE_VTKVIEWER="yes"
+ AC_SUBST(DISABLE_VTKVIEWER)
+esac
+
+
+])dnl
--- /dev/null
+# Check availability of full Salome binary distribution
+#
+# Author : Marc Tajchman (CEA, 2002)
+#------------------------------------------------------------
+
+AC_DEFUN([CHECK_CORBA_IN_GUI],[
+
+AC_CHECKING(for full SalomeGUI)
+
+SalomeGUI_ok=no
+CORBA_IN_GUI="no"
+
+AC_ARG_WITH(gui,
+ --with-salome_gui=DIR root directory path of full SALOME GUI installation,
+ SALOME_GUI_DIR="$withval",SALOME_GUI_DIR="")
+
+if test "x$SALOME_GUI_DIR" = "x" ; then
+
+# no --with-gui-dir option used
+
+ if test "x$GUI_ROOT_DIR" != "x" ; then
+
+ # SALOME_ROOT_DIR environment variable defined
+ SALOME_GUI_DIR=$GUI_ROOT_DIR
+
+ else
+
+ # search Salome binaries in PATH variable
+ AC_PATH_PROG(TEMP, libSalomeApp.so)
+ if test "x$TEMP" != "x" ; then
+ SALOME_BIN_DIR=`dirname $TEMP`
+ SALOME_GUI_DIR=`dirname $SALOME_BIN_DIR`
+ fi
+
+ fi
+#
+fi
+
+if test -f ${SALOME_GUI_DIR}/lib/salome/libSalomeApp.so ; then
+ SalomeGUI_ok=yes
+ CORBA_IN_GUI=yes
+ AC_MSG_RESULT(Using SALOME GUI distribution in ${SALOME_GUI_DIR})
+
+ if test "x$GUI_ROOT_DIR" == "x" ; then
+ GUI_ROOT_DIR=${SALOME_GUI_DIR}
+ fi
+else
+ AC_MSG_WARN("Cannot find compiled full SALOME GUI distribution")
+fi
+AC_SUBST(CORBA_IN_GUI)
+
+AC_MSG_RESULT(for full SALOME GUI: $SalomeGUI_ok)
+
+])dnl
+
--- /dev/null
+#
+# Check configure option --disable-corba=[yes|no|DIR] taking into account that
+# GUI_DISABLE_CORBA may be already set during build_configure,
+# Set GUI_DISABLE_CORBA to yes|no
+#
+# Author : Edawrd AGAPOV (OCC, 2005)
+#
+
+AC_DEFUN([CHECK_DISABLE_CORBA],[
+
+AC_ARG_WITH(corba,
+ [ --disable-corba default=no ],
+ disable_corba="$withval",disable_corba="${GUI_DISABLE_CORBA}")
+
+case $disable_corba in
+ yes)
+# AC_MSG_RESULT(************************************************)
+# AC_MSG_RESULT(******* DISABLE CORBA configuration ********)
+# AC_MSG_RESULT(************************************************)
+ GUI_DISABLE_CORBA="yes";;
+ *)
+ GUI_DISABLE_CORBA="no"
+esac
+
+AC_SUBST(GUI_DISABLE_CORBA)
+
+])dnl
--- /dev/null
+# Check availability of Qt's msg2qm tool binary distribution
+#
+# Author : Jerome Roy (CEA, 2003)
+#
+
+AC_DEFUN([CHECK_MSG2QM],[
+
+AC_CHECKING(for msg2qm)
+
+msg2qm_ok=no
+
+AC_ARG_WITH(msg2qm,
+ [ --with-msg2qm=DIR root directory path of MSG2QM installation],
+ MSG2QM_DIR="$withval",MSG2QM_DIR="")
+
+if test "x$MSG2QM_DIR" == "x" ; then
+
+# no --with-MSG2QM-dir option used
+
+ if test "x$MSG2QM_ROOT" != "x" ; then
+
+ # MSG2QM_ROOT environment variable defined
+ MSG2QM_DIR=$MSG2QM_ROOT
+
+ else
+
+ # search MSG2QM binaries in PATH variable
+ AC_PATH_PROG(TEMP, msg2qm)
+ if test "x$TEMP" != "x" ; then
+ MSG2QM_DIR=`dirname $TEMP`
+ fi
+
+ fi
+#
+fi
+
+# look for msg2qm in ${MSG2QM_DIR} directory
+if test -f ${MSG2QM_DIR}/msg2qm ; then
+ msg2qm_ok=yes
+ MSG2QM="${MSG2QM_DIR}/msg2qm"
+ AC_MSG_RESULT(Using MSG2QM executable in ${MSG2QM_DIR})
+else
+ # if not found, look for msg2qm in ${MSG2QM_DIR}/bin directory
+ if test -f ${MSG2QM_DIR}/bin/msg2qm ; then
+ msg2qm_ok=yes
+ MSG2QM="${MSG2QM_DIR}/bin/msg2qm"
+ AC_MSG_RESULT(Using MSG2QM executable in ${MSG2QM_DIR}/bin)
+ else
+ AC_MSG_WARN("Cannot find MSG2QM executable")
+ fi
+fi
+
+AC_SUBST(MSG2QM)
+AC_MSG_RESULT(for MSG2QM: $msg2qm_ok)
+
+])dnl
+
--- /dev/null
+dnl Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+dnl
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
+dnl
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl
+dnl See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+dnl
+dnl
+dnl
+AC_DEFUN([CHECK_OPENGL],[
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_CPP])dnl
+AC_ARG_WITH(opengl,
+ [ --with-opengl=DIR root directory path of OpenGL installation ],
+ [
+ opengl_dir="$withval"
+ local_opengl=yes
+ ], [
+ dirs="/usr/lib /usr/local/lib /opt/graphics/OpenGL/lib /usr/openwin/lib /usr/X11R6/lib"
+ ])dnl
+
+AC_CHECKING(for OpenGL)
+
+AC_SUBST(OGL_INCLUDES)
+AC_SUBST(OGL_LIBS)
+
+OGL_INCLUDES=""
+OGL_LIBS=""
+
+OpenGL_ok=no
+
+dnl openGL headers
+
+# by default
+
+if test "x$local_opengl" = "xyes" ; then
+ if test -f "${opengl_dir}/include/GL/gl.h" ; then
+ OpenGL_ok=yes
+ OGL_INCLUDES="-I${opengl_dir}/include"
+ if test "x${opengl_dir}" = "x/usr"
+ then
+ OGL_LIBS=""
+ else
+ OGL_LIBS="-L${opengl_dir}/lib"
+ fi
+ AC_MSG_RESULT(select OpenGL distribution in ${opengl_dir})
+ else
+ AC_MSG_RESULT(no gl.h header file in ${opengl_dir}/include/GL)
+ fi
+fi
+
+if test "x$OpenGL_ok" = "xno"
+then
+ AC_CHECK_HEADERS(GL/gl.h, [OpenGL_ok=yes])
+fi
+
+if test "x$OpenGL_ok" = "xno"
+then
+# under SunOS ?
+ AC_CHECK_HEADERS(/usr/openwin/share/include/GL/glxmd.h,
+ [OpenGL_ok=yes]
+ OGL_INCLUDES="-I/usr/openwin/share/include/")
+fi
+
+if test "x$OpenGL_ok" = "xno"
+then
+# under IRIX ?
+ AC_CHECK_HEADERS(/opt/graphics/OpenGL/include/GL/glxmd.h,
+ [OpenGL_ok=yes]
+ OGL_INCLUDES="-I/opt/graphics/OpenGL/include")
+fi
+if test "x$OpenGL_ok" = "xno"
+then
+# some linux OpenGL servers hide the includes in /usr/X11R6/include/GL
+ AC_CHECK_HEADERS(/usr/X11R6/include/GL/gl.h,
+ [OpenGL_ok=yes]
+ OGL_INCLUDES="-I/usr/X11R6/include")
+fi
+
+if test "x$OpenGL_ok" = "xyes"
+then
+ AC_CHECKING(for OpenGL library)
+ OpenGL_ok=no
+ for i in $dirs; do
+ if test -r "$i/libGL.so"; then
+dnl AC_MSG_RESULT(in $i)
+ if test "x$i" = "x/usr/lib"
+ then
+ OGL_LIBS=""
+ else
+ OGL_LIBS="-L$i"
+ fi
+ break
+ fi
+# under IRIX ?
+ if test -r "$i/libGL.sl"; then
+dnl AC_MSG_RESULT(in $i)
+ if test "x$i" = "x/usr/lib"
+ then
+ OGL_LIBS=""
+ else
+ OGL_LIBS="-L$i"
+ fi
+ break
+ fi
+ done
+ LDFLAGS_old="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $OGL_LIBS"
+ AC_CHECK_LIB(GL,glBegin,OpenGL_ok=yes,OpenGL_ok=no)
+ LDFLAGS="$LDFLAGS_old"
+fi
+
+if test "x$OpenGL_ok" = "xyes" ; then
+ OGL_LIBS="$OGL_LIBS -lGL"
+fi
+
+
+OpenGLU_ok=no
+LDFLAGS_old="$LDFLAGS"
+LDFLAGS="$LDFLAGS $OGL_LIBS"
+AC_CHECK_LIB(GLU,gluBeginSurface,OpenGLU_ok=yes,OpenGLU_ok=no)
+LDFLAGS="$LDFLAGS_old"
+
+if test "x$OpenGLU_ok" = "xyes" ; then
+ OGL_LIBS="$OGL_LIBS -lGLU"
+fi
+
+# Save cache
+AC_CACHE_SAVE
+
+])dnl
--- /dev/null
+dnl Copyright (C) 2003 CEA/DEN, EDF R&D
+
+AC_DEFUN([CHECK_PYQT],[
+AC_REQUIRE([CHECK_PYTHON])dnl
+AC_REQUIRE([CHECK_QT])dnl
+AC_REQUIRE([CHECK_SIP])dnl
+
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
+
+AC_ARG_WITH(pyqt,
+ [ --with-pyqt=DIR root directory path to PyQt installation ],
+ [PYQTDIR="$withval"
+ AC_MSG_RESULT("select $withval as path to PyQt")
+ ])
+
+AC_ARG_WITH(pyqt_sips,
+ [ --with-pyqt_sips=DIR a directory path to PyQt sips installation ],
+ [PYQT_SIPS="$withval"
+ AC_MSG_RESULT("select $withval as path to PyQt sips")
+ ])
+
+
+AC_ARG_WITH(pyuic,
+ [ --with-pyuic=EXEC pyuic executable ],
+ [PYUIC="$withval"
+ AC_MSG_RESULT("select $withval as pyqt executable")
+ ])
+
+AC_CHECKING(for pyqt)
+
+pyqt_ok=yes
+
+dnl look for pyuic
+pyqt_uic_ok=no
+if test "x$PYUIC" != x; then
+ dnl try withval value
+ AC_CHECK_FILE($PYUIC,pyqt_uic_ok=yes,pyqt_uic_ok=no)
+fi
+if test "x$pyqt_uic_ok" == "xno"; then
+ dnl try ${PYQTDIR}
+ if test "x${PYQTDIR}" != "x"; then
+ if test -d ${PYQTDIR} ; then
+ AC_CHECK_FILE(${PYQTDIR}/pyuic,pyqt_uic_ok=yes,pyqt_uic_ok=no)
+ if test "x$pyqt_uic_ok" == "xyes"; then
+ PYUIC="${PYQTDIR}/pyuic"
+ fi
+ fi
+ fi
+fi
+if test "x$pyqt_uic_ok" == "xno"; then
+ dnl try ${SIPDIR}
+ if test "x${SIPDIR}" != "x"; then
+ if test -d ${SIPDIR} ; then
+ AC_CHECK_FILE(${SIPDIR}/pyuic,pyqt_uic_ok=yes,pyqt_uic_ok=no)
+ if test "x$pyqt_uic_ok" == "xyes"; then
+ PYUIC="${SIPDIR}/pyuic"
+ fi
+ fi
+ fi
+fi
+if test "x$pyqt_uic_ok" == "xno"; then
+ dnl try ${PYTHONHOME}/bin
+ if test "x${PYTHONHOME}" != "x"; then
+ if test -d ${PYTHONHOME}/bin ; then
+ AC_CHECK_FILE(${PYTHONHOME}/bin/pyuic,pyqt_uic_ok=yes,pyqt_uic_ok=no)
+ if test "x$pyqt_uic_ok" == "xyes"; then
+ PYUIC="${PYTHONHOME}/bin/pyuic"
+ fi
+ fi
+ fi
+fi
+if test "x$pyqt_uic_ok" == "xno"; then
+ dnl try /usr/bin
+ AC_CHECK_FILE(/usr/bin/pyuic,pyqt_uic_ok=yes,pyqt_uic_ok=no)
+ if test "x$pyqt_uic_ok" == "xyes"; then
+ PYUIC="/usr/bin/pyuic"
+ fi
+fi
+if test "x$pyqt_uic_ok" == "xno"; then
+ pyqt_ok=no
+fi
+
+dnl look for PyQt libs
+pyqt_lib_ok=no
+if test "x${PYQTDIR}" != "x"; then
+ dnl try {PYQTDIR}
+ AC_CHECK_FILE(${PYQTDIR}/libqtcmodule.so,pyqt_lib_ok=yes,pyqt_lib_ok=no)
+ if test "x$pyqt_lib_ok" == "xyes"; then
+ if test "x${PYQTDIR}" = "x/usr/lib"
+ then
+ PYQT_LIBS="-lqtcmodule"
+ else
+ PYQT_LIBS="-L${PYQTDIR} -lqtcmodule"
+ fi
+ else
+ AC_CHECK_FILE(${PYQTDIR}/qt.so,pyqt_lib_ok=yes,pyqt_lib_ok=no)
+ if test "x$pyqt_lib_ok" == "xyes"; then
+ if test "x${PYQTDIR}" = "x/usr/lib"
+ then
+ PYQT_LIBS=""
+ else
+ PYQT_LIBS="-L${PYQTDIR}"
+ fi
+ fi
+ fi
+ if test "x$pyqt_lib_ok" == "xno"; then
+ dnl try {PYQTDIR}/lib
+ if test -d {PYQTDIR}/lib; then
+ AC_CHECK_FILE(${PYQTDIR}/lib/libqtcmodule.so,pyqt_lib_ok=yes,pyqt_lib_ok=no)
+ if test "x$pyqt_lib_ok" == "xyes"; then
+ PYQT_LIBS="-L${PYQTDIR}/lib -lqtcmodule"
+ else
+ AC_CHECK_FILE(${PYQTDIR}/lib/qt.so,pyqt_lib_ok=yes,pyqt_lib_ok=no)
+ if test "x$pyqt_lib_ok" == "xyes"; then
+ PYQT_LIBS="-L${PYQTDIR}/lib"
+ fi
+ fi
+ fi
+ fi
+ if test "x$pyqt_lib_ok" == "xno"; then
+ dnl try {PYQTDIR}/lib/python${PYTHON_VERSION}/site-packages
+ if test -d {PYQTDIR}/lib/python${PYTHON_VERSION}/site-packages; then
+ AC_CHECK_FILE(${PYQTDIR}/lib/python${PYTHON_VERSION}/site-packages/libqtcmodule.so,pyqt_lib_ok=yes,pyqt_lib_ok=no)
+ if test "x$pyqt_lib_ok" == "xyes"; then
+ PYQT_LIBS="-L${PYQTDIR}/lib/python${PYTHON_VERSION}/site-packages -lqtcmodule"
+ else
+ AC_CHECK_FILE(${PYQTDIR}/lib/python${PYTHON_VERSION}/site-packages/qt.so,pyqt_lib_ok=yes,pyqt_lib_ok=no)
+ if test "x$pyqt_lib_ok" == "xyes"; then
+ PYQT_LIBS="-L${PYQTDIR}/lib/python${PYTHON_VERSION}/site-packages"
+ fi
+ fi
+ fi
+ fi
+fi
+if test "x$pyqt_lib_ok" == "xno"; then
+ dnl try ${SIPDIR}
+ if test "x${SIPDIR}" != "x"; then
+ if test -d ${SIPDIR} ; then
+ AC_CHECK_FILE(${SIPDIR}/libqtcmodule.so,pyqt_lib_ok=yes,pyqt_lib_ok=no)
+ if test "x$pyqt_lib_ok" == "xyes"; then
+ if test "x${SIPDIR}" = "x/usr/lib"
+ then
+ PYQT_LIBS="-lqtcmodule"
+ else
+ PYQT_LIBS="-L${SIPDIR} -lqtcmodule"
+ fi
+ else
+ AC_CHECK_FILE(${SIPDIR}/qt.so,pyqt_lib_ok=yes,pyqt_lib_ok=no)
+ if test "x$pyqt_lib_ok" == "xyes"; then
+ if test "x${SIPDIR}" = "x/usr/lib"
+ then
+ PYQT_LIBS=""
+ else
+ PYQT_LIBS="-L${SIPDIR}"
+ fi
+ fi
+ fi
+ fi
+ fi
+fi
+if test "x$pyqt_lib_ok" == "xno"; then
+ dnl try ${PYTHONHOME}/lib/python${PYTHON_VERSION}/site-packages
+ if test "x${PYTHONHOME}" != "x"; then
+ if test -d ${PYTHONHOME}/lib/python${PYTHON_VERSION}/site-packages ; then
+ AC_CHECK_FILE(${PYTHONHOME}/lib/python${PYTHON_VERSION}/site-packages/libqtcmodule.so,pyqt_lib_ok=yes,pyqt_lib_ok=no)
+ if test "x$pyqt_lib_ok" == "xyes"; then
+ PYQT_LIBS="-L${PYTHONHOME}/lib/python${PYTHON_VERSION}/site-packages -lqtcmodule"
+ else
+ AC_CHECK_FILE(${PYTHONHOME}/lib/python${PYTHON_VERSION}/site-packages/qt.so,pyqt_lib_ok=yes,pyqt_lib_ok=no)
+ if test "x$pyqt_lib_ok" == "xyes"; then
+ PYQT_LIBS="-L${PYTHONHOME}/lib/python${PYTHON_VERSION}/site-packages"
+ fi
+ fi
+ fi
+ fi
+fi
+if test "x$pyqt_lib_ok" == "xno"; then
+ dnl try /usr/lib/python${PYTHON_VERSION}/site-packages
+ AC_CHECK_FILE(/usr/lib/python${PYTHON_VERSION}/site-packages/libqtcmodule.so,pyqt_lib_ok=yes,pyqt_lib_ok=no)
+ if test "x$pyqt_lib_ok" == "xyes"; then
+ PYQT_LIBS="-L/usr/lib/python${PYTHON_VERSION}/site-packages -lqtcmodule"
+ else
+ AC_CHECK_FILE(/usr/lib/python${PYTHON_VERSION}/site-packages/qt.so,pyqt_lib_ok=yes,pyqt_lib_ok=no)
+ if test "x$pyqt_lib_ok" == "xyes"; then
+ PYQT_LIBS="-L/usr/lib/python${PYTHON_VERSION}/site-packages"
+ fi
+ fi
+fi
+if test "x$pyqt_lib_ok" == "xno"; then
+ pyqt_ok=no
+fi
+
+dnl look for PyQt sips
+pyqt_sips_ok=no
+dnl try ${PYQT_SIPS} or ${PYQT_SIPS}/qt
+if test "x${PYQT_SIPS}" != "x"; then
+ AC_CHECK_FILE(${PYQT_SIPS}/qglobal.sip,pyqt_sips_ok=yes,pyqt_sips_ok=no)
+ if test "x$pyqt_sips_ok" == "xno"; then
+ AC_CHECK_FILE(${PYQT_SIPS}/qt/qglobal.sip,pyqt_sips_ok=yes,pyqt_sips_ok=no)
+ if test "x$pyqt_sips_ok" == "xyes"; then
+ PYQT_SIPS="${PYQT_SIPS}/qt"
+ fi
+ fi
+fi
+if test "x$pyqt_sips_ok" == "xno"; then
+ dnl try ${PYQTDIR}/sip
+ if test "x${PYQTDIR}" != "x"; then
+ if test -d ${PYQTDIR}/sip ; then
+ AC_CHECK_FILE(${PYQTDIR}/sip/qglobal.sip,pyqt_sips_ok=yes,pyqt_sips_ok=no)
+ if test "x$pyqt_sips_ok" == "xyes"; then
+ PYQT_SIPS="${PYQTDIR}/sip"
+ else
+ AC_CHECK_FILE(${PYQTDIR}/sip/qt/qglobal.sip,pyqt_sips_ok=yes,pyqt_sips_ok=no)
+ if test "x$pyqt_sips_ok" == "xyes"; then
+ PYQT_SIPS="${PYQTDIR}/sip/qt"
+ fi
+ fi
+ fi
+ fi
+fi
+if test "x$pyqt_sips_ok" == "xno"; then
+ dnl try ${SIPDIR}/sip
+ if test "x${SIPDIR}" != "x"; then
+ if test -d ${SIPDIR}/sip ; then
+ AC_CHECK_FILE(${SIPDIR}/sip/qglobal.sip,pyqt_sips_ok=yes,pyqt_sips_ok=no)
+ if test "x$pyqt_sips_ok" == "xyes"; then
+ PYQT_SIPS="${SIPDIR}/sip"
+ else
+ AC_CHECK_FILE(${SIPDIR}/sip/qt/qglobal.sip,pyqt_sips_ok=yes,pyqt_sips_ok=no)
+ if test "x$pyqt_sips_ok" == "xyes"; then
+ PYQT_SIPS="${SIPDIR}/sip/qt"
+ fi
+ fi
+ fi
+ fi
+fi
+if test "x$pyqt_sips_ok" == "xno"; then
+ dnl try /usr/share/sip
+ if test -d /usr/share/sip ; then
+ AC_CHECK_FILE(/usr/share/sip/qglobal.sip,pyqt_sips_ok=yes,pyqt_sips_ok=no)
+ if test "x$pyqt_sips_ok" == "xyes"; then
+ PYQT_SIPS="/usr/share/sip"
+ else
+ AC_CHECK_FILE(/usr/share/sip/qt/qglobal.sip,pyqt_sips_ok=yes,pyqt_sips_ok=no)
+ if test "x$pyqt_sips_ok" == "xyes"; then
+ PYQT_SIPS="/usr/share/sip/qt"
+ fi
+ fi
+ fi
+fi
+if test "x$pyqt_sips_ok" == "xno"; then
+ pyqt_ok=no
+else
+ PYQT_INCLUDES="-I$PYQT_SIPS"
+
+ dnl Additional sip flags required for correct wrappers compilation
+ AC_MSG_CHECKING(which qt classes should be excluded)
+
+ PYQT_SIPFLAGS=""
+
+ CXXFLAGS_old=$CXXFLAGS
+ CXXFLAGS="$CXXFLAGS $QT_INCLUDES"
+ LIBS_old=$LIBS
+ LIBS="$LIBS $QT_LIBS"
+
+ AC_TRY_COMPILE([#include <qcdestyle.h>],
+ [new QCDEStyle();],,PYQT_SIPFLAGS="$PYQT_SIPFLAGS -x Qt_STYLE_CDE")
+ AC_TRY_COMPILE([#include <qinterlacestyle.h>],
+ [new QInterlaceStyle();],,PYQT_SIPFLAGS="$PYQT_SIPFLAGS -x Qt_STYLE_INTERLACE")
+ AC_TRY_COMPILE([#include <qmotifstyle.h>],
+ [new QMotifStyle();],,PYQT_SIPFLAGS="$PYQT_SIPFLAGS -x Qt_STYLE_MOTIF")
+ AC_TRY_COMPILE([#include <qmotifplusstyle.h>],
+ [new QMotifPlusStyle();],,PYQT_SIPFLAGS="$PYQT_SIPFLAGS -x Qt_STYLE_MOTIFPLUS")
+ AC_TRY_COMPILE([#include <qplatinumstyle.h>],
+ [new QPlatinumStyle();],,PYQT_SIPFLAGS="$PYQT_SIPFLAGS -x Qt_STYLE_PLATINUM")
+ AC_TRY_COMPILE([#include <qsgistyle.h>],
+ [new QSGIStyle();],,PYQT_SIPFLAGS="$PYQT_SIPFLAGS -x Qt_STYLE_SGI")
+ AC_TRY_COMPILE([#include <qwindowsstyle.h>],
+ [new QWindowsStyle();],,PYQT_SIPFLAGS="$PYQT_SIPFLAGS -x Qt_STYLE_WINDOWS")
+ AC_TRY_COMPILE([#include <qwindowsxpstyle.h>],
+ [new QWindowsXPStyle();],,PYQT_SIPFLAGS="$PYQT_SIPFLAGS -x Qt_STYLE_WINDOWSXP")
+
+ LIBS="$LIBS -lqassistantclient"
+ AC_TRY_LINK([#include <qassistantclient.h>],
+ [new QAssistantClient("foo");],,PYQT_SIPFLAGS="$PYQT_SIPFLAGS -x Qt_ASSISTANTCLIENT")
+
+ AC_MSG_RESULT(done)
+
+ CXXFLAGS=$CXXFLAGS_old
+ LIBS=$LIBS_old
+fi
+
+AC_SUBST(PYQT_INCLUDES)
+AC_SUBST(PYQT_LIBS)
+AC_SUBST(PYQT_SIPS)
+AC_SUBST(PYUIC)
+AC_SUBST(PYQT_SIPFLAGS)
+
+AC_LANG_RESTORE
+
+AC_MSG_RESULT(for pyqt: $pyqt_ok)
+
+])dnl
+dnl
+
+
--- /dev/null
+dnl Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+dnl
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
+dnl
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl
+dnl See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+dnl
+dnl
+dnl
+
+AC_DEFUN([CHECK_QT],[
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_CXX])dnl
+AC_REQUIRE([AC_PROG_CPP])dnl
+AC_REQUIRE([AC_PROG_CXXCPP])dnl
+AC_REQUIRE([CHECK_OPENGL])dnl
+
+AC_CHECKING(for QT)
+qt_ok=yes
+
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
+
+if test "x$QTDIR" = "x"
+then
+ AC_MSG_RESULT(please define QTDIR variable)
+ qt_ok=no
+else
+ AC_MSG_RESULT(QTDIR is $QTDIR)
+ qt_inc_ok=no
+ QTINC=""
+ AC_CHECK_FILE(${QTDIR}/include/qt3/qglobal.h,QTINC="/qt3",QTINC="")
+ QT_VERS=`grep "QT_VERSION_STR" ${QTDIR}/include${QTINC}/qglobal.h | sed -e 's%^#define QT_VERSION_STR\([[:space:]]*\)%%g' -e 's%\"%%g'`
+ AC_MSG_RESULT(Qt version is $QT_VERS)
+ QT_VERS="Qt_"`echo $QT_VERS | sed -e 's%\"%%g' -e 's%\.%_%g'`
+fi
+
+if test "x$qt_ok" = "xyes"
+then
+ if test -f ${QTDIR}/bin/moc
+ then
+ MOC=${QTDIR}/bin/moc
+ else
+ AC_PATH_PROG(MOC, moc)
+ fi
+ if test "x$MOC" = "x"
+ then
+ qt_ok=no
+ AC_MSG_RESULT(moc qt-compiler not in PATH variable)
+ else
+ qt_ok=yes
+ AC_MSG_RESULT(moc found)
+ fi
+fi
+
+if test "x$qt_ok" = "xyes"
+then
+ if test -f ${QTDIR}/bin/uic
+ then
+ UIC=${QTDIR}/bin/uic
+ else
+ AC_PATH_PROG(UIC, uic)
+ fi
+ if test "x$UIC" = "x"
+ then
+ qt_ok=no
+ AC_MSG_RESULT(uic qt-interface compiler not in PATH variable)
+ else
+ qt_ok=yes
+ AC_MSG_RESULT(uic found)
+ fi
+fi
+
+AC_SUBST(QTDIR)
+QT_ROOT=$QTDIR
+
+if test "x$qt_ok" = "xyes"
+then
+ CPPFLAGS_old=$CPPFLAGS
+ CPPFLAGS="$CPPFLAGS -I$QTDIR/include${QTINC}"
+
+ AC_LANG_CPLUSPLUS
+ AC_CHECK_HEADER(qaction.h,qt_ok=yes ,qt_ok=no)
+
+ CPPFLAGS=$CPPFLAGS_old
+
+ AC_MSG_CHECKING(include of qt headers)
+
+ if test "x$qt_ok" = "xno"
+ then
+ AC_MSG_RESULT(qt headers not found, or too old qt version, in $QTDIR/include)
+ AC_MSG_RESULT(QTDIR environment variable may be wrong)
+ else
+ AC_MSG_RESULT(yes)
+ QT_INCLUDES="-I${QT_ROOT}/include${QTINC} -DQT_THREAD_SUPPORT -DQT_CLEAN_NAMESPACE"
+ QT_MT_INCLUDES="-I${QT_ROOT}/include${QTINC} -DQT_THREAD_SUPPORT -DQT_CLEAN_NAMESPACE"
+ fi
+fi
+
+if test "x$qt_ok" = "xyes"
+then
+ AC_MSG_CHECKING(linking qt library)
+ LIBS_old=$LIBS
+ if test "x$QTDIR" = "x/usr"
+ then
+ LIBS="$LIBS -lqt-mt $OGL_LIBS"
+ else
+ LIBS="$LIBS -L$QTDIR/lib -lqt-mt $OGL_LIBS"
+ fi
+
+ CXXFLAGS_old=$CXXFLAGS
+ CXXFLAGS="$CXXFLAGS $QT_INCLUDES"
+
+ AC_CACHE_VAL(salome_cv_lib_qt,[
+ AC_TRY_LINK(
+#include <qapplication.h>
+, int n;
+ char **s;
+ QApplication a(n, s);
+ a.exec();,
+ eval "salome_cv_lib_qt=yes",eval "salome_cv_lib_qt=no")
+ ])
+ qt_ok="$salome_cv_lib_qt"
+
+ if test "x$qt_ok" = "xno"
+ then
+ AC_MSG_RESULT(unable to link with qt library)
+ AC_MSG_RESULT(QTDIR environment variable may be wrong)
+ else
+ AC_MSG_RESULT(yes)
+ if test "x$QTDIR" = "x/usr"
+ then
+ QT_LIBS=" -lqt-mt"
+ QT_MT_LIBS=" -lqt-mt"
+ else
+ QT_LIBS="-L$QTDIR/lib -lqt-mt"
+ QT_MT_LIBS="-L$QTDIR/lib -lqt-mt"
+ fi
+ fi
+
+ LIBS=$LIBS_old
+ CXXFLAGS=$CXXFLAGS_old
+
+fi
+
+AC_SUBST(MOC)
+AC_SUBST(UIC)
+
+AC_SUBST(QT_ROOT)
+AC_SUBST(QT_INCLUDES)
+AC_SUBST(QT_LIBS)
+AC_SUBST(QT_MT_LIBS)
+AC_SUBST(QT_VERS)
+
+AC_LANG_RESTORE
+
+AC_MSG_RESULT(for qt: $qt_ok)
+
+# Save cache
+AC_CACHE_SAVE
+
+])dnl
+dnl
--- /dev/null
+dnl Copyright (C) 2003 CEA/DEN, EDF R&D
+
+AC_DEFUN([CHECK_QWT],[
+AC_REQUIRE([CHECK_QT])dnl
+
+AC_CHECKING(for qwt)
+
+qwt_ok=yes
+
+dnl were is qwt ?
+
+AC_ARG_WITH(qwt,
+ [ --with-qwt=DIR directory path to QWT installation ],
+ [QWTHOME="$withval"
+ AC_MSG_RESULT("select $withval as path to QWT")
+ ])
+
+AC_ARG_WITH(qwt_inc,
+ [ --with-qwt_inc=DIR directory path to QWT includes ],
+ [QWT_INCLUDES="$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
+ for d in /usr/local /usr ; do
+ AC_CHECK_FILE(${d}/lib/libqwt.so,exits_ok=yes,exits_ok=no)
+ if test "x$exits_ok" = "xyes"; then
+ QWTHOME=$d
+ AC_MSG_RESULT(libqwt.so detected in $d/lib)
+ fi
+ done
+ fi
+ if test "x$exits_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
+ 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"
+ fi
+ if test ! -f $QWT_INCLUDES/qwt.h ; then
+ QWT_INCLUDES=/usr/lib/qt3/include/qwt
+ fi
+ fi
+ fi
+else
+ if test -z $QWT_INCLUDES; then
+ QWT_INCLUDES="$QWTHOME/include"
+ fi
+fi
+
+if test "x$qwt_ok" = xno -o ! -d "$QWTHOME" ; then
+ AC_MSG_RESULT(no)
+ 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"
+
+ AC_CHECK_HEADER(qwt.h,qwt_ok=yes,qwt_ok=no)
+
+ CPPFLAGS=$CPPFLAGS_old
+
+ if test "x$qwt_ok" = xno ; then
+ AC_MSG_RESULT(no)
+ AC_MSG_WARN(qwt not found)
+ else
+ qwt_ok=yes
+ fi
+
+if test "x$qwt_ok" = "xyes"
+then
+ AC_MSG_CHECKING(linking qwt library)
+ LIBS_old=$LIBS
+ if test "x$QTDIR" = "x/usr"
+ then
+ LIBS="$LIBS -lqt-mt"
+ else
+ LIBS="$LIBS -L$QTDIR/lib -lqt-mt"
+ fi
+ 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"
+
+ AC_CACHE_VAL(salome_cv_lib_qwt,[
+ AC_TRY_LINK(
+#include <qapplication.h>
+#include <qwt_plot.h>
+, int n;
+ char **s;
+ QApplication a(n, s);
+ QwtPlot* p;
+ a.setMainWidget(p);
+ 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"
+ else
+ QWT_LIBS="-L$QWTHOME/lib -lqwt"
+ fi
+
+ AC_SUBST(QWT_INCLUDES)
+ AC_SUBST(QWT_LIBS)
+
+ AC_MSG_RESULT(yes)
+ fi
+
+ LIBS=$LIBS_old
+ CXXFLAGS=$CXXFLAGS_old
+
+fi
+
+
+ AC_LANG_RESTORE
+
+fi
+
+
+])dnl
+dnl
--- /dev/null
+dnl Copyright (C) 2003 CEA/DEN, EDF R&D
+
+AC_DEFUN([CHECK_SIP],[
+AC_REQUIRE([CHECK_PYTHON])dnl
+AC_REQUIRE([CHECK_QT])dnl
+
+sip_ok=yes
+
+AC_ARG_WITH(sip,
+ [ --with-sip=EXEC sip executable ],
+ [SIP="$withval"
+ AC_MSG_RESULT("select $withval as sip executable")
+ ], [
+ AC_PATH_PROG(SIP, sip)
+ ])
+
+if test "x$SIP" = "x" ; then
+ sip_ok=no
+ AC_MSG_RESULT(sip not in PATH variable)
+else
+ version=`$SIP -V`
+ AC_MSG_RESULT(sip version is $version)
+ case "$version" in
+ 3.2*)
+ SIP_VERS=v3_old ;;
+ 3.3*)
+ SIP_VERS=v3_old ;;
+ 3.4*)
+ SIP_VERS=v3_old ;;
+ 3.5*)
+ SIP_VERS=v3_old ;;
+ 3.6*)
+ SIP_VERS=v3_old ;;
+ 3.7*)
+ SIP_VERS=v3_old ;;
+ 3.8*)
+ SIP_VERS=v3_old ;;
+ 3.9*)
+ SIP_VERS=v3_old ;;
+ 3.10*)
+ SIP_VERS=v3_new ;;
+ 4.1*)
+ SIP_VERS=v4_old ;;
+ 4.2*)
+ SIP_VERS=v4_new ;;
+ *)
+ AC_MSG_RESULT(sip version $version not supported)
+ SIP_VERS=unsupported ;;
+ esac
+
+ sip_ok=no
+ dnl Search sip.h file
+ if test "x$SIPDIR" != "x" ; then
+ dnl look for sip.h in ${SIPDIR}
+ AC_CHECK_FILE(${SIPDIR}/sip.h,sip_ok=yes,sip_ok=no)
+ if test "x$sip_ok" == "xyes" ; then
+ SIP_INCLUDES="-I${SIPDIR}"
+ fi
+ if test "x$sip_ok" == "xno" ; then
+ dnl look for sip.h in ${SIPDIR}/include/python${PYTHON_VERSION}
+ if test -d ${SIPDIR}/include/python${PYTHON_VERSION} ; then
+ AC_CHECK_FILE(${SIPDIR}/include/python${PYTHON_VERSION}/sip.h,sip_ok=yes,sip_ok=no)
+ if test "x$sip_ok" == "xyes" ; then
+ SIP_INCLUDES="-I${SIPDIR}/include/python${PYTHON_VERSION}"
+ fi
+ fi
+ fi
+ fi
+ if test "x$sip_ok" == "xno" ; then
+ dnl look for sip.h in ${PYTHON_PREFIX}/include/python${PYTHON_VERSION}
+ if test -d ${PYTHON_PREFIX}/include/python${PYTHON_VERSION} ; then
+ AC_CHECK_FILE(${PYTHON_PREFIX}/include/python${PYTHON_VERSION}/sip.h,sip_ok=yes,sip_ok=no)
+ if test "x$sip_ok" == "xyes" ; then
+ SIP_INCLUDES="${PYTHON_INCLUDES}"
+ fi
+ fi
+ fi
+ if test "x$sip_ok" == "xno" ; then
+ dnl look for sip.h in /usr/include/python${PYTHON_VERSION}
+ if test -d /usr/include/python${PYTHON_VERSION} ; then
+ AC_CHECK_FILE(/usr/include/python${PYTHON_VERSION}/sip.h,sip_ok=yes,sip_ok=no)
+ if test "x$sip_ok" == "xyes" ; then
+ SIP_INCLUDES="/usr/include/python${PYTHON_VERSION}"
+ fi
+ fi
+ fi
+
+ dnl Search (lib)sip.so file
+ sip_lib_ok=no
+ if test "x$SIPDIR" != "x" ; then
+ dnl look for (lib)sip.so in ${SIPDIR}
+ AC_CHECK_FILE(${SIPDIR}/libsip.so,sip_lib_ok=yes,sip_lib_ok=no)
+ if test "x$sip_lib_ok" == "xyes" ; then
+ if test "x${SIPDIR}" = "x/usr/lib"
+ then
+ SIP_LIBS="-lsip"
+ else
+ SIP_LIBS="-L${SIPDIR} -lsip"
+ fi
+ else
+ AC_CHECK_FILE(${SIPDIR}/sip.so,sip_lib_ok=yes,sip_lib_ok=no)
+ if test "x$sip_lib_ok" == "xyes" ; then
+ if test "x${SIPDIR}" = "x/usr/lib"
+ then
+ SIP_LIBS=""
+ else
+ SIP_LIBS="-L${SIPDIR}"
+ fi
+ fi
+ fi
+
+ if test "x$sip_lib_ok" == "xno" ; then
+ dnl look for (lib)sip.so in ${SIPDIR}/lib/python${PYTHON_VERSION}/site-packages
+ if test -d ${SIPDIR}/lib/python${PYTHON_VERSION}/site-packages ; then
+ AC_CHECK_FILE(${SIPDIR}/lib/python${PYTHON_VERSION}/site-packages/libsip.so,sip_lib_ok=yes,sip_lib_ok=no)
+ if test "x$sip_lib_ok" == "xyes" ; then
+ SIP_LIBS="-L${SIPDIR}/lib/python${PYTHON_VERSION}/site-packages -lsip"
+ else
+ AC_CHECK_FILE(${SIPDIR}/lib/python${PYTHON_VERSION}/site-packages/sip.so,sip_lib_ok=yes,sip_lib_ok=no)
+ if test "x$sip_lib_ok" == "xyes" ; then
+ SIP_LIBS="-L${SIPDIR}/lib/python${PYTHON_VERSION}/site-packages"
+ fi
+ fi
+ fi
+ fi
+ fi
+ if test "x$sip_lib_ok" == "xno" ; then
+ dnl look for (lib)sip.so in ${PYTHON_PREFIX}/lib/python${PYTHON_VERSION}/site-packages
+ if test -d ${PYTHON_PREFIX}/lib/python${PYTHON_VERSION}/site-packages ; then
+ AC_CHECK_FILE(${PYTHON_PREFIX}/lib/python${PYTHON_VERSION}/site-packages/libsip.so,sip_lib_ok=yes,sip_lib_ok=no)
+ if test "x$sip_lib_ok" == "xyes" ; then
+ SIP_LIBS="-L${PYTHON_PREFIX}/lib/python${PYTHON_VERSION}/site-packages -lsip"
+ else
+ AC_CHECK_FILE(${PYTHON_PREFIX}/lib/python${PYTHON_VERSION}/site-packages/sip.so,sip_lib_ok=yes,sip_lib_ok=no)
+ if test "x$sip_lib_ok" == "xyes" ; then
+ SIP_LIBS="-L${PYTHON_PREFIX}/lib/python${PYTHON_VERSION}/site-packages"
+ fi
+ fi
+ fi
+ fi
+ if test "x$sip_lib_ok" == "xno" ; then
+ dnl look for (lib)sip.so in /usr/lib/python${PYTHON_VERSION}/site-packages
+ if test -d /usr/lib/python${PYTHON_VERSION}/site-packages ; then
+ AC_CHECK_FILE(/usr/lib/python${PYTHON_VERSION}/site-packages/libsip.so,sip_lib_ok=yes,sip_lib_ok=no)
+ if test "x$sip_lib_ok" == "xyes" ; then
+ SIP_LIBS="-L$/usr/lib/python${PYTHON_VERSION}/site-packages -lsip"
+ else
+ AC_CHECK_FILE(/usr/lib/python${PYTHON_VERSION}/site-packages/sip.so,sip_lib_ok=yes,sip_lib_ok=no)
+ if test "x$sip_lib_ok" == "xyes" ; then
+ SIP_LIBS="-L/usr/lib/python${PYTHON_VERSION}/site-packages"
+ fi
+ fi
+ fi
+ fi
+ if test "x$sip_lib_ok" == "xno" ; then
+ sip_ok=no
+ fi
+fi
+
+AC_SUBST(SIP)
+AC_SUBST(SIP_INCLUDES)
+AC_SUBST(SIP_LIBS)
+AC_SUBST(SIP_VERS)
+
+AC_MSG_RESULT(for sip: $sip_ok)
+
+])dnl
+dnl
--- /dev/null
+dnl Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+dnl
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
+dnl
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl
+dnl See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+dnl
+dnl
+dnl
+
+AC_DEFUN([CHECK_VTK],[
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_CXX])dnl
+AC_REQUIRE([AC_PROG_CPP])dnl
+AC_REQUIRE([AC_PROG_CXXCPP])dnl
+
+AC_CHECKING(for VTK)
+
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
+
+AC_SUBST(VTK_INCLUDES)
+AC_SUBST(VTK_LIBS)
+AC_SUBST(VTKPY_MODULES)
+
+VTK_INCLUDES=""
+VTK_LIBS=""
+VTKPY_MODULES=""
+
+vtk_ok=no
+
+AC_PATH_X
+
+if test "x$OpenGL_ok" != "xyes"
+then
+ AC_MSG_WARN(vtk needs OpenGL correct configuration, check configure output)
+fi
+
+if test "x$x_libraries" != "x"
+then
+ LXLIB="-L$x_libraries"
+else
+ LXLIB=""
+fi
+
+if test "x$x_libraries" = "x/usr/lib"
+then
+ LXLIB=""
+fi
+
+if test "x$x_libraries" = "x/usr/lib"
+then
+ LXLIB=""
+fi
+
+if test "x$x_libraries" = "x/usr/lib"
+then
+ LXLIB=""
+fi
+
+LOCAL_INCLUDES="$OGL_INCLUDES"
+LOCAL_LIBS="-lvtkCommon -lvtkGraphics -lvtkImaging -lvtkFiltering -lvtkIO -lvtkRendering -lvtkHybrid $OGL_LIBS $LXLIB -lX11 -lXt"
+TRY_LINK_LIBS="-lvtkCommon $OGL_LIBS $LXLIB -lX11 -lXt"
+
+if test -z $VTKHOME
+then
+ AC_MSG_WARN(undefined VTKHOME variable which specify where vtk was compiled)
+ if test -f /usr/include/vtk/vtkPlane.h ; then
+ AC_MSG_RESULT(trying /usr)
+ VTKHOME="/usr"
+ fi
+fi
+
+if test ! -z $VTKHOME
+then
+ LOCAL_INCLUDES="-I$VTKHOME/include/vtk $LOCAL_INCLUDES"
+ LOCAL_LIBS="-L$VTKHOME/lib/vtk $LOCAL_LIBS"
+ TRY_LINK_LIBS="-L$VTKHOME/lib/vtk $TRY_LINK_LIBS"
+fi
+
+dnl vtk headers
+CPPFLAGS_old="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS $LOCAL_INCLUDES"
+
+AC_CHECK_HEADER(vtkPlane.h,vtk_ok="yes",vtk_ok="no")
+
+ CPPFLAGS="$CPPFLAGS_old"
+
+ if test "x$vtk_ok" = "xyes"
+ then
+ VTK_INCLUDES="$LOCAL_INCLUDES"
+
+ dnl vtk libraries
+
+ AC_MSG_CHECKING(linking VTK library)
+
+ LIBS_old="$LIBS"
+# LIBS="$LIBS $TRY_LINK_LIBS"
+ LIBS="$LIBS $LOCAL_LIBS"
+ CPPFLAGS_old="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $VTK_INCLUDES"
+
+ dnl VTKPY_MODULES="$VTKHOME/python"
+
+ AC_CACHE_VAL(salome_cv_lib_vtk,[
+ AC_TRY_LINK(
+#include "vtkPlane.h"
+, vtkPlane *p = vtkPlane::New();,
+ eval "salome_cv_lib_vtk=yes",eval "salome_cv_lib_vtk=no")
+ ])
+ vtk_ok="$salome_cv_lib_vtk"
+ LIBS="$LIBS_old"
+ CPPFLAGS="$CPPFLAGS_old"
+
+fi
+
+if test "x$vtk_ok" = "xno"
+then
+ AC_MSG_RESULT("no")
+ AC_MSG_WARN(unable to link with vtk library)
+else
+ AC_MSG_RESULT("yes")
+ VTK_LIBS="$LOCAL_LIBS"
+ VTK_MT_LIBS="$LOCAL_LIBS"
+fi
+
+AC_MSG_RESULT("for vtk: $vtk_ok")
+
+AC_LANG_RESTORE
+
+# Save cache
+AC_CACHE_SAVE
+
+])dnl
+
+
# common directories to put headerfiles
inc_builddir=$(top_builddir)/include/salome
+GUI_DISABLE_CORBA=@GUI_DISABLE_CORBA@
+DISABLE_GLVIEWER=@DISABLE_GLVIEWER@
+DISABLE_PYCONSOLE=@DISABLE_PYCONSOLE@
+DISABLE_PLOT2DVIEWER=@DISABLE_PLOT2DVIEWER@
+DISABLE_SUPERVGRAPHVIEWER=@DISABLE_SUPERVGRAPHVIEWER@
+DISABLE_OCCVIEWER=@DISABLE_OCCVIEWER@
+DISABLE_VTKVIEWER=@DISABLE_VTKVIEWER@
+DISABLE_SALOMEOBJECT=@DISABLE_SALOMEOBJECT@
@SET_MAKE@
SHELL=/bin/sh
ACLOCAL_SRC = \
-ac_cxx_bool.m4 check_corba.m4 check_vtk.m4 \
-ac_cxx_depend_flag.m4 check_hdf5.m4 enable_pthreads.m4 \
-ac_cxx_mutable.m4 check_mico.m4 libtool.m4 \
-ac_cxx_namespaces.m4 check_omniorb.m4 pyembed.m4 \
-ac_cxx_partial_specialization.m4 check_opengl.m4 python.m4 \
-ac_cxx_typename.m4 check_pthreads.m4 check_cas.m4 \
-ac_cc_warnings.m4 check_qt.m4 check_swig.m4 \
-check_boost.m4 check_msg2qm.m4
-
-$(top_srcdir)/aclocal.m4: $(ACLOCAL_SRC:%=@KERNEL_ROOT_DIR@/salome_adm/unix/config_files/%)
+check_qt.m4 check_vtk.m4 check_qwt.m4 \
+check_sip.m4 check_msg2qm.m4 check_pyqt.m4 \
+check_opengl.m4
+
+$(top_srcdir)/aclocal.m4: $(ACLOCAL_SRC:%=$(top_srcdir)/adm_local/unix/config_files/%)
cd $(top_srcdir) ; aclocal --acdir=adm_local/unix/config_files -I @KERNEL_ROOT_DIR@/salome_adm/unix/config_files
--- /dev/null
+#=======================================================================
+# This section of this makefile comes from the file
+# 'adm/unix/make_conclude' which was generated with config.status
+# from file adm/unix/make_conclude.in
+#=======================================================================
+# -* Makefile *-
+#
+# Authors : Patrick GOLDBRONN (CEA) - Marc Tajchman (CEA)
+# Date : 6/07/2001
+# $Header$
+#
+
+ifneq ($(GUI_DISABLE_CORBA),yes)
+# ORB Specifics rules
+
+@CORBA@
+
+# transform idl reference in appropriate obj file
+LIB_CLIENT_SRC = $(LIB_CLIENT_IDL:%.idl=%$(IDL_CLN_CXX))
+LIB_SERVER_SRC = $(LIB_SERVER_IDL:%.idl=%$(IDL_SRV_CXX))
+LIB_SWIG_SRC = $(SWIG_DEF:%.i=%_wrap.cxx)
+else
+LIB_CLIENT_SRC =
+LIB_SERVER_SRC =
+LIB_SWIG_SRC =
+endif
+
+LIB_MOC_SRC = $(LIB_MOC:%.h=%_moc.cxx)
+LIB_SRC+=$(LIB_MOC_SRC)
+LIB_DEP= $(LIB_SRC) $(LIB_CLIENT_SRC) $(LIB_SERVER_SRC) $(LIB_SWIG_SRC)
+
+ifneq ($(GUI_DISABLE_CORBA),yes)
+LIB_CLIENT_OBJ = $(LIB_CLIENT_IDL:%.idl=%$(IDL_CLN_OBJ))
+LIB_SERVER_OBJ = $(LIB_SERVER_IDL:%.idl=%$(IDL_SRV_OBJ))
+LIB_SWIG_OBJ = $(LIB_SWIG_SRC:%.cxx=%.lo)
+else
+LIB_CLIENT_OBJ =
+LIB_SERVER_OBJ =
+LIB_SWIG_OBJ =
+endif
+
+# transform c file in appropriate libtool obj file (.c, .cc and .cxx)
+LIB_OBJ_C = $(patsubst %.c, %.lo, $(filter %.c, $(LIB_SRC)))
+LIB_OBJ_CC = $(patsubst %.cc, %.lo, $(filter %.cc, $(LIB_SRC)))
+LIB_OBJ_CXX = $(patsubst %.cxx, %.lo, $(filter %.cxx, $(LIB_SRC)))
+LIB_OBJ_F = $(patsubst %.f, %.lo, $(filter %.f, $(LIB_SRC)))
+
+# all libtool obj file in library
+LIB_OBJ = $(LIB_OBJ_CXX) $(LIB_OBJ_CC) $(LIB_OBJ_C) $(LIB_CLIENT_OBJ:%.o=%.lo) $(LIB_SERVER_OBJ:%.o=%.lo) $(LIB_SWIG_OBJ) $(LIB_OBJ_F)
+
+# LIB_BUILD = $(LIB:%.la=$(top_builddir)/lib/salome/%.la)
+LIB_BUILD = $(patsubst %.la, $(top_builddir)/lib/salome/%.la, $(filter %.la, $(LIB)))
+LIB_BUILD_A = $(patsubst %.a, $(top_builddir)/lib/salome/%.a, $(filter %.a, $(LIB)))
+LIB_BUILD_SO = $(patsubst %.so, $(top_builddir)/lib/salome/%.so, $(filter %.so, $(LIB)))
+
+ifneq ($(findstring cmodule.la,$(filter %.la, $(LIB))),)
+ifneq ($(GUI_DISABLE_CORBA),yes)
+LIB_SWIG = $(patsubst %cmodule.la,%.so, $(filter %.la, $(LIB)))
+else
+LIB_SWIG =
+endif
+else
+LIB_SWIG =
+endif
+
+lib: $(LIB_BUILD) $(LIB_BUILD_SO) $(LIB_CLIENT_PY)
+# we don't build static library !
+
+$(LIB_BUILD): $(top_builddir)/lib/salome/%.la: %.la
+ -$(RM) $@
+ -$(RM) $(patsubst %.la, %.so, $@)
+ -$(RM) $(patsubst %.la, %.a, $@)
+ ln -sf $(CURDIR)/$< $@ || true
+ ln -sf $(patsubst %.la, %.so, $(CURDIR)/.libs/$<) \
+ $(patsubst %.la, %.so, $@) || true
+ ln -sf $(patsubst %.la, %.so, $(CURDIR)/.libs/$<).0 \
+ $(patsubst %.la, %.so, $@).0 || true
+
+ if ! test -z $(LIB_SWIG) ; then \
+ ln -sf $(patsubst %.la,%.so, $(CURDIR)/.libs/$<) $(top_builddir)/lib/salome/_$(LIB_SWIG) || true;\
+ fi;
+
+$(LIB_BUILD_A): $(top_builddir)/lib/salome/%.a: %.a
+ -$(RM) $@
+ ln -sf $(CURDIR)/$< $@ || true
+
+$(LIB_BUILD_SO): $(top_builddir)/lib/salome/%.so: %.so
+ -$(RM) $@
+ ln -sf $(CURDIR)/$< $@ || true
+
+$(LIB): $(LIB_OBJ)
+ @$(LT) --mode=link $(CXX) -shared -rpath $(libdir) -o $@ $(CXXFLAGS) $(LIB_OBJ) $(LDFLAGS) $(LIBS)
+
+# transform idl reference in appropriate obj file
+ifneq ($(GUI_DISABLE_CORBA),yes)
+BIN_CLIENT_SRC = $(BIN_CLIENT_IDL:%.idl=%$(IDL_CLN_CXX))
+BIN_SERVER_SRC = $(BIN_SERVER_IDL:%.idl=%$(IDL_SRV_CXX))
+else
+BIN_CLIENT_SRC =
+BIN_SERVER_SRC =
+endif
+BIN_MOC_SRC = $(BIN_MOC:%.h=%_moc.cxx)
+BIN_SRC+=$(BIN_MOC_SRC)
+BIN_DEP=$(BIN:%=%.cxx) $(BIN_SRC) $(BIN_CLIENT_SRC) $(BIN_SERVER_SRC)
+
+ifneq ($(GUI_DISABLE_CORBA),yes)
+BIN_CLIENT_OBJ = $(BIN_CLIENT_IDL:%.idl=%$(IDL_CLN_OBJ))
+BIN_SERVER_OBJ = $(BIN_SERVER_IDL:%.idl=%$(IDL_SRV_OBJ))
+else
+BIN_CLIENT_OBJ =
+BIN_SERVER_OBJ =
+endif
+# transform c file in appropriate libtool obj file (.c)
+BIN_OBJ_C = $(patsubst %.c, %.o, $(filter %.c, $(BIN_SRC)))
+# transform c++ file in appropriate libtool obj file (.cc and .cxx)
+BIN_OBJ_CC = $(patsubst %.cc, %.o, $(filter %.cc, $(BIN_SRC)))
+BIN_OBJ_CXX = $(patsubst %.cxx, %.o, $(filter %.cxx, $(BIN_SRC)))
+# all obj file in bin target
+BIN_OBJ = $(BIN_OBJ_CC) $(BIN_OBJ_CXX) $(BIN_OBJ_C) $(BIN_CLIENT_OBJ) $(BIN_SERVER_OBJ)
+
+bin: $(BIN:%=$(top_builddir)/bin/salome/%) $(BIN) $(LIB) pyscripts sharedpyscripts
+
+BIN_LIB=$(LIB:lib%.la=-l%)
+
+$(BIN:%=$(top_builddir)/bin/salome/%) $(TEST_PROGS:%=$(top_builddir)/bin/salome/%): $(top_builddir)/bin/salome/%: %
+ -$(RM) $@
+ ln -sf $(CURDIR)/$< $@
+
+$(BIN) $(TEST_PROGS): %: %.lo $(BIN_OBJ)
+ $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ $^ $(BIN_LIB) $(LDFLAGSFORBIN) $(LIBSFORBIN)
+
+# copy python scripts in $(top_builddir)/bin/salome
+#
+
+UI_FILES = $(notdir $(wildcard $(srcdir)/*.ui))
+UI_PY_FILES_PY = $(patsubst %.ui, %.py, $(UI_FILES))
+UI_PY_FILES = $(filter-out $(EXPORT_PYSCRIPTS) ,$(UI_PY_FILES_PY))
+
+DEST_PYSCRIPTS = $(EXPORT_PYSCRIPTS:%=$(top_builddir)/bin/salome/%)
+DEST_UI_PY_FILES = $(UI_PY_FILES:%=$(top_builddir)/bin/salome/%)
+pyscripts: $(DEST_PYSCRIPTS) $(UI_PY_FILES) $(DEST_UI_PY_FILES)
+$(DEST_PYSCRIPTS): $(top_builddir)/bin/salome/%: %
+ cp -f $< $@
+
+# generate generic python scripts from *.ui files
+#
+$(UI_PY_FILES): %.py: %.ui
+ $(PYUIC) $< -o $@
+
+# copy ui-generated python scripts in $(top_builddir)/bin
+#
+$(DEST_UI_PY_FILES): $(top_builddir)/bin/salome/%: %
+ cp -f $< $@
+
+# copy pyqt files in $(PYTHON_SHARED_SITE)
+#
+PYTHON_SHARED_SITE=$(top_builddir)/lib/python$(PYTHON_VERSION)/site-packages/salome/shared_modules
+
+$(PYTHON_SHARED_SITE):
+ $(INSTALL) -d $@
+
+DEST_SHAREDPYSCRIPTS = $(EXPORT_SHAREDPYSCRIPTS:%=$(PYTHON_SHARED_SITE)/%)
+sharedpyscripts: $(PYTHON_SHARED_SITE) $(DEST_SHAREDPYSCRIPTS)
+$(DEST_SHAREDPYSCRIPTS): $(PYTHON_SHARED_SITE)/%: %
+ cp -f $< $@
+
+check: test
+
+tests: unittest
+
+test: $(LIB) $(TEST_PROGS:%=$(top_builddir)/bin/salome/%)
+
+unittest:
+ @if test "x$(UNIT_TEST_PROG)" != "x"; then \
+ $(top_builddir)/bin/salome/$(UNIT_TEST_PROG); \
+ fi;
+
+# copy header file in $(inc_builddir)
+#
+DEST_HEADERS = $(EXPORT_HEADERS:%=$(inc_builddir)/%)
+inc: $(DEST_HEADERS)
+$(DEST_HEADERS): $(inc_builddir)/%: %
+ cp -f $< $@
+
+# build resources file (icons and messages) : .qm file from .po file
+RESOURCES_FILES_ALL := $(notdir $(wildcard $(srcdir)/resources/*))
+RESOURCES_FILES_ALL := $(filter-out CVS, $(RESOURCES_FILES_ALL))
+RESOURCES_FILES_ALL := $(filter-out %.po, $(RESOURCES_FILES_ALL))
+RESOURCES_FILES ?= $(RESOURCES_FILES_ALL)
+
+resources: resources-po resources-cp
+
+resources-po: $(PO_FILES:%.po=$(top_builddir)/share/salome/resources/%.qm)
+
+resources-cp: $(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/%)
+
+$(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/%): $(top_builddir)/share/salome/resources/% : %
+ cp -fr $< $@;
+
+# Make installation directories if they don't exist.
+$(libdir) $(includedir) $(bindir) $(datadir) $(idldir) $(sharedpydir):
+ $(INSTALL) -d $@ && chmod 755 $@
+
+# Install the library, the public header files, and programs.
+install: $(LIB) $(BIN) $(TEST_PROGS) $(libdir) $(includedir) $(bindir) $(datadir) $(idldir) install-python install-sharedpyqt install-qm install-res
+ @for f in X $(LIB); do \
+ if test $$f != X; then \
+ ($(LT_INSTALL_LIB) $$f $(libdir)/. || exit 1); \
+ fi; \
+ done
+ @if ! test -z $(LIB_SWIG) ; then \
+ (cd $(libdir); ln -sf $(patsubst %.so, %cmodule.so, $(LIB_SWIG)) _$(LIB_SWIG) || true); \
+ fi;
+ @for f in X $(BIN); do \
+ if test $$f != X; then \
+ ($(LT_INSTALL_PROG) $$f $(bindir)/. || exit 1); \
+ fi; \
+ done
+# Install tests programmes in bindir
+ @for f in X $(TEST_PROGS); do \
+ if test $$f != X; then \
+ ($(LT_INSTALL_PROG) $$f $(bindir)/. || exit 1); \
+ fi; \
+ done
+# Install exported includes in includedir
+ @for f in X $(EXPORT_HEADERS:%=$(srcdir)/%); do \
+ if test $$f != X; then \
+ (cp -p -f $$f $(includedir) || exit 1); \
+ fi; \
+ done
+
+# Install python script in $(bindir)
+install-python: $(bindir) $(EXPORT_PYSCRIPTS:%=install-%) $(UI_PY_FILES:%=install-%)
+
+$(UI_PY_FILES:%=install-%): install-%: %
+ $(INSTALL_PROGRAM) $< $(bindir)/.
+
+$(EXPORT_PYSCRIPTS:%=install-%): install-%: %
+ $(INSTALL_PROGRAM) $< $(bindir)/.
+
+#install-python: $(bindir) $(EXPORT_PYSCRIPTS)
+# @for f in X $(EXPORT_PYSCRIPTS); do \
+# if test $$f != X; then \
+# ($(INSTALL_PROGRAM) $$f $(bindir)/. || exit 1); \
+# fi; \
+# done
+
+# Install pyqt script in $(install-sharedpyqt)
+install-sharedpyqt: $(sharedpydir) $(EXPORT_SHAREDPYSCRIPTS:%=install-%)
+
+$(EXPORT_SHAREDPYSCRIPTS:%=install-%): install-%: %
+ $(INSTALL_PROGRAM) $< $(sharedpydir)/.
+
+
+# generic rule to install .qm files :
+install-qm: resources
+ $(INSTALL) -d $(datadir)/resources
+ @for f in X $(PO_FILES:%.po=$(top_builddir)/share/salome/resources/%.qm); do \
+ if test $$f != X; then \
+ ($(INSTALL_DATA) $$f $(datadir)/resources/. || exit 1); \
+ fi; \
+ done
+
+# generic rule to install resources files (png, ini ...):
+install-res: resources
+ $(INSTALL) -d $(datadir)/resources
+ @for f in X $(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/%); do \
+ if test $$f != X; then \
+ ($(INSTALL_DATA) $$f $(datadir)/resources/. || exit 1); \
+ fi; \
+ done
+
+# Removes those things that `make install' (would have) installed.
+uninstall:
+ @if test "X$(LIB)" != X; then \
+ for f in $(LIB); do \
+ $(LT_UNINSTALL) $(libdir)/$$f; \
+ done; \
+ fi
+ @if test "X$(BIN)" != X; then \
+ for f in $(BIN); do \
+ $(LT_UNINSTALL) $(bindir)/$$f; \
+ done; \
+ fi
+ @for f in X $(TEST_PROGS); do \
+ if test $$f != X; then \
+ $(LT_UNINSTALL) $(bindir)/$$f; \
+ fi; \
+ done
+# Uninstall exported includes in includedir
+ @for f in X $(EXPORT_HEADERS); do \
+ if test $$f != X; then \
+ $(LT_UNINSTALL) $(includedir)/$$f; \
+ fi; \
+ done
+# Uninstall python script in $(bindir)
+ @for f in X $(EXPORT_PYSCRIPTS); do \
+ if test $$f != X; then \
+ $(LT_UNINSTALL) $(bindir)/$$f ; \
+ fi; \
+ done
+
+# Uninstall python script in $(bindir)
+ @for f in X $(UI_PY_FILES); do \
+ if test $$f != X; then \
+ $(LT_UNINSTALL) $(bindir)/$$f ; \
+ fi; \
+ done
+
+# Uninstall pyqt script in $(sharedpydir)
+ @for f in X $(EXPORT_SHAREDPYSCRIPTS); do \
+ if test $$f != X; then \
+ $(LT_UNINSTALL) $(sharedpydir)/$$f ; \
+ fi; \
+ done
+
+# Uninstall qm files
+ @for f in X $(PO_FILES:%.po=%.qm); do \
+ if test $$f != X; then \
+ $(LT_UNINSTALL) $(datadir)/resources/$$f ; \
+ fi; \
+ done
+
+# remove all dependencies files
+#
+cleandep:
+ -$(RM) .dep*
+
+# Removes temporary files without removing the final target files. That is,
+# remove things like object files but not libraries or executables.
+#
+mostlyclean: cleandep
+ -$(RM) $(LIB_OBJ) $(LIB_OBJ:.lo=.o)
+ -$(RM) $(BIN_OBJ) $(BIN:%=%.o)
+ -$(RM) $(TEST_OBJ) $(TEST_OBJ:.lo=.o)
+ -$(RM) $(PROG_OBJ) $(PROG_OBJ:.lo=.o) $(MOSTLYCLEAN)
+
+# Like `mostlyclean' except it also removes the final targets: things like
+# libraries and executables. This target doesn't remove any file that
+# is part of the SALOME distribution.
+#
+clean: mostlyclean
+ -$(RM) $(LIB) $(TEST_PROGS) $(BIN) $(CLEAN)
+ -$(RM) TAGS *~ *# core *.core
+ -$(RM) -r .libs
+ -$(RM) $(top_builddir)/lib/salome/$(LIB)
+ -$(RM) $(patsubst %,$(top_builddir)/bin/salome/%, $(BIN))
+ -$(RM) $(patsubst %.la, %.so, $(top_builddir)/lib/salome/$(LIB))
+ -$(RM) $(patsubst %.la, %.a, $(top_builddir)/lib/salome/$(LIB))
+# remove idl generated files (sources)
+ -$(RM) $(LIB_CLIENT_SRC) $(LIB_SERVER_SRC) $(BIN_CLIENT_SRC) $(BIN_SERVER_SRC)
+# remove idl generated files (headers)
+ -$(RM) $(LIB_CLIENT_IDL:%.idl=%$(IDL_CLN_H)) $(LIB_SERVER_IDL:%.idl=%$(IDL_SRV_H))
+ -$(RM) $(BIN_CLIENT_IDL:%.idl=%$(IDL_CLN_H)) $(BIN_SERVER_IDL:%.idl=%$(IDL_SRV_H))
+ -$(RM) $(LIB_MOC_SRC) $(BIN_MOC_SRC)
+ -$(RM) $(LIB_SWIG_SRC)
+
+# Like `clean' except it also removes files that were created by running
+# configure. If you've unpacked the source and built without creating
+# any other files, then `make distclean' will leave only the files that were
+# in the distribution.
+#
+distclean: clean
+ #remove qm file !
+ -$(RM) $(PO_FILES:%.po=%.qm) $(PO_FILES:%.po=$(top_builddir)/share/salome/resources/%.qm)
+ #remove include files
+ -$(RM) $(DEST_HEADERS)
+ -$(RM) $(DISTCLEAN) *.bak *.old *.new .dep*
+ @if test -f $(srcdir)/Makefile.in; then \
+ (@SETX@; $(RM) Makefile); \
+ fi
+
+
+#implicits rules
+.cc.o:
+ $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
+
+.cc.lo:
+ $(LT) --mode=compile $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
+
+.cxx.o:
+ $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
+
+.cxx.lo:
+ $(LT) --mode=compile $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
+
+.c.o:
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $<
+
+.c.lo:
+ $(LT_COMPILE) $(CFLAGS) $(CPPFLAGS) -c $<
+
+.f.o:
+ $(FC) $(FFLAGS) -c $< -o $@
+
+.f.lo:
+ $(LT) --mode=compile $(FC) $(FFLAGS) -c $<
+
+.ui.h:
+ $(UIC) -o $@ $<
+
+.ui.cxx:
+ $(UIC) -o $@ -i $*.h $<
+
+#pattern rules
+%_moc.cxx : %.h
+ $(MOC) $< -o $@
+
+%_wrap.cxx : %.i
+ $(SWIG) $(SWIG_FLAGS) -o $@ $<
+
+$(top_builddir)/share/salome/resources/%.qm: %.po
+ $(MSG2QM) $< $@ ; \
+
+#------------------------------------------------------------------------------
+# The following section of this makefile contains dependencies between the
+# source files and the header files. If GNU make and GCC are being used then
+# the dependencies are in the form of rules that cause the information to
+# be kept updated automatically. Otherwise the dependencies are listed
+# explicitly and come from the `.distdep' files in the various directories.
+# These files are part of the distribution and are generated automatically on
+# GNU/GCC systems.
+#------------------------------------------------------------------------------
+
+@DEPEND@
echo " ./adm_local/unix/make_omniorb \\" >> configure.in_tmp1
echo " ./salome_adm/unix/envScript \\" >> configure.in_tmp1
echo " ./adm_local/unix/make_commence \\" >> configure.in_tmp1
-echo " ./salome_adm/unix/make_conclude \\" >> configure.in_tmp1
+echo " ./adm_local/unix/make_conclude \\" >> configure.in_tmp1
echo " ./salome_adm/unix/make_module \\" >> configure.in_tmp1
\rm -f configure.in_tmp2 configure.in_tmp3
echo -n "Creating 'configure' script ... "
fi
-aclocal --acdir=adm_local/unix/config_files -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files
+aclocal -I adm_local/unix/config_files -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files
if autoconf
then
echo "done"
VERSION=0.0.1
AC_SUBST(VERSION)
+########################################################################
+# Check --disable-corba option
+
+GUI_DISABLE_CORBA="no"
+DISABLE_PYCONSOLE="no"
+DISABLE_GLVIEWER="no"
+DISABLE_PLOT2DVIEWER="no"
+DISABLE_SUPERVGRAPHVIEWER="no"
+DISABLE_OCCVIEWER="no"
+DISABLE_VTKVIEWER="no"
+DISABLE_SALOMEOBJECT="no"
+
+for option
+do
+ case $option in
+ -disable-corba=yes | --disable-corba=yes | -disable-corba | --disable-corba)
+ GUI_DISABLE_CORBA="yes";;
+ -disable-pyConsole=yes | --disable-pyConsole=yes | -disable-pyConsole | --disable-pyConsole)
+ DISABLE_PYCONSOLE="yes";;
+ -disable-glViewer=yes | --disable-glViewer=yes | -disable-glViewer | --disable-glViewer)
+ DISABLE_GLVIEWER="yes";;
+ -disable-plot2dViewer=yes | --disable-plot2dViewer=yes | -disable-plot2dViewer | --disable-plot2dViewer)
+ DISABLE_PLOT2DVIEWER="yes";;
+ -disable-supervGraphViewer=yes | --disable-supervGraphViewer=yes | \
+ -disable-supervGraphViewer | --disable-supervGraphViewer)
+ DISABLE_SUPERVGRAPHVIEWER="yes";;
+ -disable-occViewer=yes | --disable-occViewer=yes | -disable-occViewer | --disable-occViewer)
+ DISABLE_OCCVIEWER="yes";;
+ -disable-vtkViewer=yes | --disable-vtkViewer=yes | -disable-vtkViewer | --disable-vtkViewer)
+ DISABLE_VTKVIEWER="yes";;
+ -disable-salomeObject=yes | --disable-salomeObject=yes | -disable-salomeObject | --disable-salomeObject)
+ DISABLE_SALOMEOBJECT="yes";;
+ esac
+done
+
dnl
dnl Initialize source and build root directories
dnl
dnl CHECK_JAVA
+echo
+echo ---------------------------------------------
+echo Testing Disable Corba
+echo ---------------------------------------------
+echo
+
+CHECK_DISABLE_CORBA
+echo "GUI_DISABLE_CORBA = "$GUI_DISABLE_CORBA
+
+if test "x${GUI_DISABLE_CORBA}" != "xyes" ; then
+
echo
echo ---------------------------------------------
echo testing swig
echo
CHECK_SWIG
+fi
echo
echo ---------------------------------------------
ENABLE_PTHREADS
+if test "x${GUI_DISABLE_CORBA}" != "xyes" ; then
echo
echo ---------------------------------------------
echo testing omniORB
echo
DEFAULT_ORB=omniORB
+
+echo
+echo ---------------------------------------------
+echo testing Corba
+echo ---------------------------------------------
+echo
+
CHECK_CORBA
AC_SUBST_FILE(CORBA)
corba=make_$ORB
CORBA=adm_local/unix/$corba
+fi
echo
echo ---------------------------------------------
echo testing openGL
CHECK_QWT
+echo
+echo ---------------------------------------------
+echo Testing PyConsole
+echo ---------------------------------------------
+echo
+
+CHECK_PYCONSOLE
+echo "DISABLE_PYCONSOLE = "$DISABLE_PYCONSOLE
+
+echo
+echo ---------------------------------------------
+echo Testing GlViewer
+echo ---------------------------------------------
+echo
+
+CHECK_GLVIEWER
+echo "DISABLE_GLVIEWER = "$DISABLE_GLVIEWER
+
+echo
+echo ---------------------------------------------
+echo Testing Plot2dViewer
+echo ---------------------------------------------
+echo
+
+CHECK_PLOT2DVIEWER
+echo "DISABLE_PLOT2DVIEWER = "$DISABLE_PLOT2DVIEWER
+
+echo
+echo ---------------------------------------------
+echo Testing SupervGraphViewer
+echo ---------------------------------------------
+echo
+
+CHECK_SUPERVGRAPHVIEWER
+echo "DISABLE_SUPERVGRAPHVIEWER = "$DISABLE_SUPERVGRAPHVIEWER
+
+echo
+echo ---------------------------------------------
+echo Testing OCCViewer
+echo ---------------------------------------------
+echo
+
+CHECK_OCCVIEWER
+echo "DISABLE_OCCVIEWER = "$DISABLE_OCCVIEWER
+
+echo
+echo ---------------------------------------------
+echo Testing VTKViewer
+echo ---------------------------------------------
+echo
+
+CHECK_VTKVIEWER
+echo "DISABLE_VTKVIEWER = "$DISABLE_VTKVIEWER
+
+echo
+echo ---------------------------------------------
+echo Testing SalomeObject
+echo ---------------------------------------------
+echo
+
+CHECK_SALOMEOBJECT
+echo "DISABLE_SALOMEOBJECT = "$DISABLE_SALOMEOBJECT
+
+if test "x${GUI_DISABLE_CORBA}" != "xyes" ; then
+ if test "x${DISABLE_PYCONSOLE}" == "xyes" ; then
+ echo "failed : for full configuration of GUI module necessary enable PyConsole !"
+ exit
+ fi
+ if test "x${DISABLE_GLVIEWER}" == "xyes" ; then
+ echo "failed : for full configuration of GUI module necessary enable GlViewer !"
+ exit
+ fi
+ if test "x${DISABLE_PLOT2DVIEWER}" == "xyes" ; then
+ echo "failed : for full configuration of GUI module necessary enable Plot2dViewer !"
+ exit
+ fi
+ if test "x${DISABLE_SUPERVGRAPHVIEWER}" == "xyes" ; then
+ echo "failed : for full configuration of GUI module necessary enable SupervGraphViewer !"
+ exit
+ fi
+ if test "x${DISABLE_OCCVIEWER}" == "xyes" ; then
+ echo "failed : for full configuration of GUI module necessary enable OCCViewer !"
+ exit
+ fi
+ if test "x${DISABLE_VTKVIEWER}" == "xyes" ; then
+ echo "failed : for full configuration of GUI module necessary enable VTKViewer !"
+ exit
+ fi
+ if test "x${DISABLE_SALOMEOBJECT}" == "xyes" ; then
+ echo "failed : for full configuration of GUI module necessary enable SalomeObject !"
+ exit
+ fi
+fi
+
echo
echo ---------------------------------------------
echo Testing html generators
CHECK_HTML_GENERATORS
+if test "$GUI_DISABLE_CORBA" == "no"; then
+ echo
+ echo ---------------------------------------------
+ echo Testing Kernel
+ echo ---------------------------------------------
+ echo
+ CHECK_KERNEL
+fi
+
echo
echo ---------------------------------------------
-echo Testing Kernel
+echo Testing CPPUNIT only required for unit testing
echo ---------------------------------------------
echo
-CHECK_KERNEL
+CHECK_CPPUNIT
echo
echo ---------------------------------------------
echo ---------------------------------------------
echo
-echo Configure
+if test "$GUI_DISABLE_CORBA" == "yes"; then
+ echo "Configure (without Corba)"
+else
+ echo Configure
+fi
+
+
+if test "$GUI_DISABLE_CORBA" != "yes"; then
variables="cc_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok msg2qm_ok vtk_ok hdf5_ok omniORB_ok boost_ok occ_ok sip_ok pyqt_ok qwt_ok doxygen_ok graphviz_ok Kernel_ok"
+else
+variables="cc_ok lex_yacc_ok python_ok threads_ok OpenGL_ok qt_ok msg2qm_ok vtk_ok hdf5_ok boost_ok occ_ok sip_ok pyqt_ok qwt_ok doxygen_ok graphviz_ok Kernel_ok"
+fi
for var in $variables
do
eval echo \$$var
done
+echo "---Optional:"
+variables="cppunit_ok"
+
+for var in $variables
+do
+ eval toto=\$$var
+ if test x$toto != "x"; then
+ printf " %10s : " `echo \$var | sed -e "s,_ok,,"`
+ eval echo \$$var
+ fi
+done
+
+if test "$GUI_DISABLE_CORBA" != "yes"; then
echo
echo "Default ORB : $DEFAULT_ORB"
echo
-
+fi
dnl generals files which could be included in every makefile
AC_SUBST_FILE(COMMENCE) COMMENCE=adm_local/unix/make_commence
-AC_SUBST_FILE(CONCLUDE) CONCLUDE=salome_adm/unix/make_conclude
+AC_SUBST_FILE(CONCLUDE) CONCLUDE=adm_local/unix/make_conclude
AC_SUBST_FILE(MODULE) MODULE=salome_adm/unix/make_module
dnl les dependences
fi
# make other build directories
-for rep in salome_adm adm_local doc bin/salome include/salome lib/salome share/salome/resources idl
+if test "$GUI_DISABLE_CORBA" == "yes"; then
+dir_variables="salome_adm adm_local doc bin/salome include/salome lib/salome share/salome/resources idl"
+else
+dir_variables="salome_adm adm_local doc bin/salome include/salome lib/salome share/salome/resources"
+fi
+
+for rep in $dir_variables
do
# if test ! -d $rep ; then
# eval mkdir $rep
Get Active study ID
*/
long GetActiveStudyId();
+/*!
+ Restores a state of the study at theSavePoint
+*/
+ boolean restoreVisualState(in long theSavePoint);
} ;
-
} ;
*\retval Return -1 if something wrong.
*/
int CAM_Module::createMenu( const QString& subMenu, const int menu,
- const int id, const int group, const int index )
+ const int id, const int group, const int index,
+ const bool enableEmpty )
{
if ( !menuMgr() )
return -1;
- return menuMgr()->insert( subMenu, menu, group, index );
+ return menuMgr()->insert( subMenu, menu, group, id, index, enableEmpty );
}
/*! Create menu.
*\retval Return -1 if something wrong.
*/
int CAM_Module::createMenu( const QString& subMenu, const QString& menu,
- const int id, const int group, const int index )
+ const int id, const int group, const int index,
+ const bool enableEmpty )
{
if ( !menuMgr() )
return -1;
- return menuMgr()->insert( subMenu, menu, group, index );
+ return menuMgr()->insert( subMenu, menu, group, id, index, enableEmpty );
}
return ident;
}
+/*! Unregister an action.
+ * \param id - id for action.
+ * \retval true if succeded, false if action is used
+ */
+bool CAM_Module::unregisterAction( const int id )
+{
+ return unregisterAction( action( id ) );
+}
+
+/*! Unregister an action.
+ * \param a - action
+ * \retval true if succeded, false if action is used
+ */
+bool CAM_Module::unregisterAction( QAction* a )
+{
+ if ( !a )
+ return false;
+ if ( menuMgr() ) {
+ int id = menuMgr()->actionId( a );
+ if ( id != -1 && menuMgr()->containsMenu( id, -1 ) )
+ return false;
+ }
+ if ( toolMgr() ) {
+ int id = toolMgr()->actionId( a );
+ if ( id != -1 && toolMgr()->containsAction( id ) )
+ return false;
+ }
+ if ( menuMgr() )
+ menuMgr()->unRegisterAction( menuMgr()->actionId( a ) );
+ if ( toolMgr() )
+ toolMgr()->unRegisterAction( toolMgr()->actionId( a ) );
+ return true;
+}
+
/*! Return qt action manager separator.*/
QAction* CAM_Module::separator()
{
/** @name Set Menu Shown*/
//@{
- void setMenuShown( const bool );
+ virtual void setMenuShown( const bool );
void setMenuShown( QAction*, const bool );
void setMenuShown( const int, const bool );
//@}
/** @name Set Tool Shown*/
//@{
- void setToolShown( const bool );
+ virtual void setToolShown( const bool );
void setToolShown( QAction*, const bool );
void setToolShown( const int, const bool );
//@}
/** @name Create menu methods.*/
//@{
- int createMenu( const QString&, const int, const int = -1, const int = -1, const int = -1 );
- int createMenu( const QString&, const QString&, const int = -1, const int = -1, const int = -1 );
+ int createMenu( const QString&, const int, const int = -1, const int = -1, const int = -1, const bool = false );
+ int createMenu( const QString&, const QString&, const int = -1, const int = -1, const int = -1, const bool = false );
int createMenu( const int, const int, const int = -1, const int = -1 );
int createMenu( const int, const QString&, const int = -1, const int = -1 );
int createMenu( QAction*, const int, const int = -1, const int = -1, const int = -1 );
//@}
int registerAction( const int, QAction* );
+ bool unregisterAction( const int );
+ bool unregisterAction( QAction* );
QAction* createAction( const int, const QString&, const QIconSet&, const QString&,
const QString&, const int, QObject* = 0,
const bool = false, QObject* = 0, const char* = 0 );
LDOM_NodeList systemList = systems.getElementsByTagName( DDS_Dictionary::KeyWord( "UNIT_SYSTEM" ) );
for ( Standard_Integer i = 0; i < systemList.getLength(); i++ )
{
- LDOM_Element aSystem = (const LDOM_Element &)systemList.item( i );
+ //const LDOM_Element& aSystem = (const LDOM_Element &)systemList.item( i );
+ LDOM_Node aNode = systemList.item( i );
+ const LDOM_Element& anElem = (const LDOM_Element&) aNode;
+ LDOM_Element aSystem(anElem);
TCollection_AsciiString aName = aSystem.getAttribute( DDS_Dictionary::KeyWord( "UNIT_SYSTEM_NAME" ) );
TCollection_ExtendedString aLabel = aSystem.getAttribute( DDS_Dictionary::KeyWord( "UNIT_SYSTEM_LABEL" ) );
for ( Standard_Integer i = 0; i < aData.getLength(); i++ )
{
- LDOM_Element aQuantity = (const LDOM_Element&)aData.item( i );
+ //LDOM_Element aQuantity = (const LDOM_Element&)aData.item( i );
+ LDOM_Node aNode = aData.item( i );
+ const LDOM_Element& anElem = (const LDOM_Element&) aNode;
+ LDOM_Element aQuantity(anElem);
// 1. Attributes (id,label,units?,format?,required?)
TCollection_AsciiString anID = aQuantity.getAttribute( DDS_Dictionary::KeyWord( "DATUM_ID" ) );
if ( aListValueID.IsIntegerValue() )
{
// Read the text in the element "value"
- LDOM_Text aListItemTxt = (const LDOM_Text&)aListItemValue.getFirstChild();
+ //LDOM_Text aListItemTxt = (const LDOM_Text&)aListItemValue.getFirstChild();
+ LDOM_Node aNode = aListItemValue.getFirstChild();
+ const LDOM_Text& aText = (const LDOM_Text&) aNode;
+ LDOM_Text aListItemTxt(aText);
if ( !aListItemTxt.isNull() )
{
// adding ID and text value to sequence
if ( !aShDescr.isNull() )
{
// text is always a sub-node of element, containing it
- LDOM_Text aShDescrTxt = (const LDOM_Text&)aShDescr.getFirstChild();
+ //LDOM_Text aShDescrTxt = (const LDOM_Text&)aShDescr.getFirstChild();
+ LDOM_Node aNode = aShDescr.getFirstChild();
+ const LDOM_Text& aText = (const LDOM_Text&) aNode;
+ LDOM_Text aShDescrTxt(aText);
if ( !aShDescrTxt.isNull() )
aShortD = aShDescrTxt.getData();
}
if ( !aLDescr.isNull() )
{
// text is always a sub-node of element, containing it
- LDOM_Text aLDescrTxt = (const LDOM_Text&)aLDescr.getFirstChild();
+ //LDOM_Text aLDescrTxt = (const LDOM_Text&)aLDescr.getFirstChild();
+ LDOM_Node aNode = aLDescr.getFirstChild();
+ const LDOM_Text& aText = (const LDOM_Text&) aNode;
+ LDOM_Text aLDescrTxt(aText);
if ( !aLDescrTxt.isNull() )
aLongD = aLDescrTxt.getData();
}
break;
}
}
+
+/*! The method returns the visual parameters of this view as a formated string
+ */
+QString GLViewer_ViewFrame::getVisualParameters()
+{
+ QString retStr;
+ if ( myVP && myVP->inherits( "GLViewer_ViewPort2d" ) ) {
+ GLViewer_ViewPort2d* vp2d = (GLViewer_ViewPort2d*)myVP;
+ GLfloat xSc, ySc, xPan, yPan;
+ vp2d->getScale( xSc, ySc );
+ vp2d->getPan( xPan, yPan );
+ retStr.sprintf( "%.12e*%.12e*%.12e*%.12e", xSc, ySc, xPan, yPan );
+ }
+ return retStr;
+}
+
+/* The method restors visual parameters of this view from a formated string
+ */
+void GLViewer_ViewFrame::setVisualParameters( const QString& parameters )
+{
+ QStringList paramsLst = QStringList::split( '*', parameters, true );
+ if ( myVP && myVP->inherits( "GLViewer_ViewPort2d" ) && paramsLst.size() == 4) {
+ GLViewer_ViewPort2d* vp2d = (GLViewer_ViewPort2d*)myVP;
+
+ GLfloat xSc, ySc, xPan, yPan;
+ xSc = paramsLst[0].toDouble();
+ ySc = paramsLst[1].toDouble();
+ xPan = paramsLst[2].toDouble();
+ yPan = paramsLst[3].toDouble();
+
+ vp2d->getGLWidget()->setScale( xSc, ySc, 1. );
+ vp2d->getGLWidget()->setPan( xPan, yPan, 0. );
+ }
+}
QSize sizeHint() const;
virtual void onUpdate( int );
+
+ virtual QString getVisualParameters();
+ virtual void setVisualParameters( const QString& parameters );
signals:
void vfDrawExternal( QPainter* );
// Author: Natalia Donis
// Copyright (C) CEA 2005
-#include "PythonConsole_PyInterp.h" // WARNING! This include must be the first!
+#ifndef DISABLE_PYCONSOLE
+ #include "PythonConsole_PyInterp.h" // WARNING! This include must be the first!
+ #include <PythonConsole_PyConsole.h>
+#endif
#include "LightApp_Application.h"
#include "LightApp_WidgetContainer.h"
#include "LightApp_OBFilter.h"
-#include "LightApp_GLSelector.h"
#include "LightApp_OBSelector.h"
-#include "LightApp_OCCSelector.h"
-#include "LightApp_VTKSelector.h"
#include "LightApp_SelectionMgr.h"
#include <CAM_Module.h>
#include <LogWindow.h>
#include <OB_Browser.h>
#include <OB_ListView.h>
-#include <PythonConsole_PyConsole.h>
-#include <GLViewer_Viewer.h>
-#include <GLViewer_ViewManager.h>
+#ifndef DISABLE_GLVIEWER
+ #include <GLViewer_Viewer.h>
+ #include <GLViewer_ViewManager.h>
+ #include "LightApp_GLSelector.h"
+#endif
-#include <Plot2d_ViewManager.h>
-#include <Plot2d_ViewModel.h>
-#include <SPlot2d_ViewModel.h>
+#ifndef DISABLE_PLOT2DVIEWER
+ #include <Plot2d_ViewManager.h>
+ #include <Plot2d_ViewModel.h>
+#ifndef DISABLE_SALOMEOBJECT
+ #include <SPlot2d_ViewModel.h>
+#else
+ #include <Plot2d_ViewModel.h>
+#endif
+#endif
-#include <OCCViewer_ViewManager.h>
-#include <SOCC_ViewModel.h>
+#ifndef DISABLE_OCCVIEWER
+ #include <OCCViewer_ViewManager.h>
+#ifndef DISABLE_SALOMEOBJECT
+ #include <SOCC_ViewModel.h>
+#else
+ #include <OCCViewer_ViewModel.h>
+#endif
+ #include "LightApp_OCCSelector.h"
+#endif
-#include <SVTK_ViewModel.h>
-#include <SVTK_ViewManager.h>
-#include <VTKViewer_ViewModel.h>
+#ifndef DISABLE_VTKVIEWER
+#ifndef DISABLE_SALOMEOBJECT
+ #include <SVTK_ViewModel.h>
+ #include <SVTK_ViewManager.h>
+ #include "LightApp_VTKSelector.h"
+#else
+ #include <VTKViewer_ViewModel.h>
+ #include <VTKViewer_ViewManager.h>
+#endif
+ #include <VTKViewer_ViewModel.h>
+#endif
-#include <SUPERVGraph_ViewModel.h>
-#include <SUPERVGraph_ViewFrame.h>
-#include <SUPERVGraph_ViewManager.h>
+#ifndef DISABLE_SUPERVGRAPHVIEWER
+ #include <SUPERVGraph_ViewModel.h>
+ #include <SUPERVGraph_ViewFrame.h>
+ #include <SUPERVGraph_ViewManager.h>
+#endif
#include <QtxWorkstack.h>
#define FIRST_HELP_ID 1000000
-#include "SALOME_InteractiveObject.hxx"
-#include "SALOME_ListIO.hxx"
+#ifndef DISABLE_SALOMEOBJECT
+ #include "SALOME_InteractiveObject.hxx"
+ #include "SALOME_ListIO.hxx"
+#endif
static const char* imageEmptyIcon[] = {
"20 20 1 1",
"....................",
"...................."};
+int LightApp_Application::lastStudyId = 0;
+
+int LightApp_Application::studyId()
+{
+ return LightApp_Application::lastStudyId;
+}
+
/*!Create new instance of LightApp_Application.*/
extern "C" LIGHTAPP_EXPORT SUIT_Application* createApplication()
{
mySelMgr = new LightApp_SelectionMgr( this );
- myAccel = new SUIT_Accel( desktop() );
+ myAccel = SUIT_Accel::getAccel();
+
+#ifndef DISABLE_OCCVIEWER
myAccel->setActionKey( SUIT_Accel::PanLeft, CTRL+Key_Left, OCCViewer_Viewer::Type() );
myAccel->setActionKey( SUIT_Accel::PanRight, CTRL+Key_Right, OCCViewer_Viewer::Type() );
myAccel->setActionKey( SUIT_Accel::PanUp, CTRL+Key_Up, OCCViewer_Viewer::Type() );
myAccel->setActionKey( SUIT_Accel::RotateRight, ALT+Key_Right, OCCViewer_Viewer::Type() );
myAccel->setActionKey( SUIT_Accel::RotateUp, ALT+Key_Up, OCCViewer_Viewer::Type() );
myAccel->setActionKey( SUIT_Accel::RotateDown, ALT+Key_Down, OCCViewer_Viewer::Type() );
+#endif
+#ifndef DISABLE_VTKVIEWER
myAccel->setActionKey( SUIT_Accel::PanLeft, CTRL+Key_Left, VTKViewer_Viewer::Type() );
myAccel->setActionKey( SUIT_Accel::PanRight, CTRL+Key_Right, VTKViewer_Viewer::Type() );
myAccel->setActionKey( SUIT_Accel::PanUp, CTRL+Key_Up, VTKViewer_Viewer::Type() );
myAccel->setActionKey( SUIT_Accel::RotateRight, ALT+Key_Right, VTKViewer_Viewer::Type() );
myAccel->setActionKey( SUIT_Accel::RotateUp, ALT+Key_Up, VTKViewer_Viewer::Type() );
myAccel->setActionKey( SUIT_Accel::RotateDown, ALT+Key_Down, VTKViewer_Viewer::Type() );
+#endif
connect( mySelMgr, SIGNAL( selectionChanged() ), this, SLOT( onSelection() ) );
}
*/
LightApp_Application::~LightApp_Application()
{
- saveWindowsGeometry();
-
- if ( resourceMgr() )
- {
- if ( desktop() )
- desktop()->saveGeometry( resourceMgr(), "desktop" );
- resourceMgr()->save();
- }
delete mySelMgr;
}
return mySelMgr;
}
+/*!Creat action "New window" for certain type of viewer:*/
+void LightApp_Application::createActionForViewer( const int id,
+ const int parentId,
+ const QString& suffix,
+ const int accel )
+{
+ QAction* a = createAction( id, tr( QString( "NEW_WINDOW_%1" ).arg( suffix ) ), QIconSet(),
+ tr( QString( "NEW_WINDOW_%1" ).arg( suffix ) ),
+ tr( QString( "NEW_WINDOW_%1" ).arg( suffix ) ),
+ accel, desktop(), false, this, SLOT( onNewWindow() ) );
+ createMenu( a, parentId, -1 );
+}
+
/*!Create actions:*/
void LightApp_Application::createActions()
{
for ( it = modList.begin(); it != modList.end(); ++it )
{
- if ( (*it).isEmpty() )
+ if ( !isLibExists( *it ) )
continue;
QString iconName;
SUIT_Tools::simplifySeparators( modTBar );
// New window
- int windowMenu = createMenu( tr( "MEN_DESK_WINDOW" ), -1, 100 );
+ 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 );
- QMap<int, int> accelMap;
- accelMap[NewGLViewId] = ALT+Key_G;
- accelMap[NewPlot2dId] = ALT+Key_P;
- accelMap[NewOCCViewId] = ALT+Key_O;
- accelMap[NewVTKViewId] = ALT+Key_K;
- for ( id = NewGLViewId; id <= NewVTKViewId; id++ )
- {
- QAction* a = createAction( id, tr( QString( "NEW_WINDOW_%1" ).arg( id - NewGLViewId ) ), QIconSet(),
- tr( QString( "NEW_WINDOW_%1" ).arg( id - NewGLViewId ) ),
- tr( QString( "NEW_WINDOW_%1" ).arg( id - NewGLViewId ) ),
- accelMap.contains( id ) ? accelMap[id] : 0, desk, false, this, SLOT( onNewWindow() ) );
- createMenu( a, newWinMenu, -1 );
- }
+#ifndef DISABLE_GLVIEWER
+ createActionForViewer( NewGLViewId, newWinMenu, QString::number( 0 ), ALT+Key_G );
+#endif
+#ifndef DISABLE_PLOT2DVIEWER
+ createActionForViewer( NewPlot2dId, newWinMenu, QString::number( 1 ), ALT+Key_P );
+#endif
+#ifndef DISABLE_OCCVIEWER
+ createActionForViewer( NewOCCViewId, newWinMenu, QString::number( 2 ), ALT+Key_O );
+#endif
+#ifndef DISABLE_VTKVIEWER
+ createActionForViewer( NewVTKViewId, newWinMenu, QString::number( 3 ), ALT+Key_K );
+#endif
+
createAction( RenameId, tr( "TOT_RENAME" ), QIconSet(), tr( "MEN_DESK_RENAME" ), tr( "PRP_RENAME" ),
SHIFT+Key_R, desk, false, this, SLOT( onRenameWindow() ) );
int id = actionId( (QAction*)obj );
switch ( id )
{
+#ifndef DISABLE_GLVIEWER
case NewGLViewId:
type = GLViewer_Viewer::Type();
break;
+#endif
+#ifndef DISABLE_PLOT2DVIEWER
case NewPlot2dId:
type = Plot2d_Viewer::Type();
break;
+#endif
+#ifndef DISABLE_OCCVIEWER
case NewOCCViewId:
type = OCCViewer_Viewer::Type();
break;
+#endif
+#ifndef DISABLE_VTKVIEWER
case NewVTKViewId:
type = VTKViewer_Viewer::Type();
break;
+#endif
}
if ( !type.isEmpty() )
void LightApp_Application::updateCommandsStatus()
{
CAM_Application::updateCommandsStatus();
+ QAction* a = 0;
- for ( int id = NewGLViewId; id <= NewVTKViewId; id++ )
- {
- QAction* a = action( id );
- if ( a )
- a->setEnabled( activeStudy() );
- }
+#ifndef DISABLE_GLVIEWER
+ a = action( NewGLViewId );
+ if( a )
+ a->setEnabled( activeStudy() );
+#endif
+
+#ifndef DISABLE_PLOT2DVIEWER
+ a = action( NewPlot2dId );
+ if( a )
+ a->setEnabled( activeStudy() );
+#endif
+
+#ifndef DISABLE_OCCVIEWER
+ a = action( NewOCCViewId );
+ if( a )
+ a->setEnabled( activeStudy() );
+#endif
+
+#ifndef DISABLE_VTKVIEWER
+ a = action( NewVTKViewId );
+ if( a )
+ a->setEnabled( activeStudy() );
+#endif
}
// Helps to execute command
}
QFont f;
+#ifndef DISABLE_PYCONSOLE
if( wid->inherits( "PythonConsole" ) )
{
if( resourceMgr()->hasValue( "PyConsole", "font" ) )
}
}
else
+#endif
f = wid->font();
myWindows[flag]->insert( sId, wid );
return lw;
}
+#ifndef DISABLE_PYCONSOLE
/*!Get "PythonConsole"*/
PythonConsole* LightApp_Application::pythonConsole()
{
console = (PythonConsole*)wid;
return console;
}
+#endif
/*!Update obect browser*/
void LightApp_Application::updateObjectBrowser( const bool updateModels )
SUIT_ResourceMgr* resMgr = resourceMgr();
SUIT_ViewManager* viewMgr = 0;
+#ifndef DISABLE_GLVIEWER
if( vmType == GLViewer_Viewer::Type() )
{
viewMgr = new GLViewer_ViewManager( activeStudy(), desktop() );
new LightApp_GLSelector( (GLViewer_Viewer2d*)viewMgr->getViewModel(), mySelMgr );
}
- else if( vmType == Plot2d_Viewer::Type() )
+#endif
+#ifndef DISABLE_PLOT2DVIEWER
+ if( vmType == Plot2d_Viewer::Type() )
{
viewMgr = new Plot2d_ViewManager( activeStudy(), desktop() );
- SPlot2d_Viewer* vm = new SPlot2d_Viewer();
+ Plot2d_Viewer* vm;
+#ifndef DISABLE_SALOMEOBJECT
+ vm = new SPlot2d_Viewer();
+#else
+ vm = new Plot2d_Viewer();
+#endif
viewMgr->setViewModel( vm );// custom view model, which extends SALOME_View interface
Plot2d_ViewWindow* wnd = dynamic_cast<Plot2d_ViewWindow*>( viewMgr->getActiveView() );
if( wnd )
frame->setBackgroundColor( resMgr->colorValue( "Plot2d", "Background", frame->backgroundColor() ) );
}
}
- else if( vmType == SUPERVGraph_Viewer::Type() )
+#endif
+#ifndef DISABLE_SUPERVGRAPHVIEWER
+ if( vmType == SUPERVGraph_Viewer::Type() )
{
viewMgr = new SUPERVGraph_ViewManager( activeStudy(), desktop() );
SUPERVGraph_Viewer* vm = new SUPERVGraph_Viewer();
if( view )
view->setBackgroundColor( resMgr->colorValue( "SUPERVGraph", "Background", view->backgroundColor() ) );
}
- else if( vmType == OCCViewer_Viewer::Type() )
+#endif
+#ifndef DISABLE_OCCVIEWER
+ if( vmType == OCCViewer_Viewer::Type() )
{
viewMgr = new OCCViewer_ViewManager( activeStudy(), desktop() );
- SOCC_Viewer* vm = new SOCC_Viewer();
+ OCCViewer_Viewer* vm;
+#ifndef DISABLE_SALOMEOBJECT
+ vm = new SOCC_Viewer();
+#else
+ vm = new OCCViewer_Viewer();
+#endif
vm->setBackgroundColor( resMgr->colorValue( "OCCViewer", "background", vm->backgroundColor() ) );
vm->setTrihedronSize( resMgr->integerValue( "OCCViewer", "trihedron_size", vm->trihedronSize() ) );
int u( 1 ), v( 1 );
viewMgr->setViewModel( vm );// custom view model, which extends SALOME_View interface
new LightApp_OCCSelector( (OCCViewer_Viewer*)viewMgr->getViewModel(), mySelMgr );
}
- else if ( vmType == SVTK_Viewer::Type() )
+#endif
+#ifndef DISABLE_VTKVIEWER
+#ifndef DISABLE_SALOMEOBJECT
+ if ( vmType == SVTK_Viewer::Type() )
+#else
+ if ( vmType == VTKViewer_Viewer::Type() )
+#endif
{
+#ifndef DISABLE_SALOMEOBJECT
viewMgr = new SVTK_ViewManager( activeStudy(), desktop() );
SVTK_Viewer* vm = dynamic_cast<SVTK_Viewer*>( viewMgr->getViewModel() );
if( vm )
{
vm->setBackgroundColor( resMgr->colorValue( "VTKViewer", "background", vm->backgroundColor() ) );
- vm->setTrihedronSize( resMgr->integerValue( "VTKViewer", "trihedron_size", vm->trihedronSize() ) );
+ vm->setTrihedronSize( resMgr->integerValue( "VTKViewer", "trihedron_size", vm->trihedronSize() ),
+ resMgr->booleanValue( "VTKViewer", "relative_size", vm->trihedronRelative() ) );
new LightApp_VTKSelector( vm, mySelMgr );
}
+#else
+ viewMgr = new VTKViewer_ViewManager( activeStudy(), desktop() );
+ VTKViewer_Viewer* vm = dynamic_cast<VTKViewer_Viewer*>( viewMgr->getViewModel() );
+ if ( vm )
+ vm->setBackgroundColor( resMgr->colorValue( "VTKViewer", "background", vm->backgroundColor() ) );
+#endif
}
+#endif
if ( !viewMgr )
return 0;
*/
QString LightApp_Application::getFileFilter() const
{
- return "(*.bin)";
- // HDF persistence not yet completed - to be uncommented later
- //return "(*.hdf)";
+ //return "(*.bin)";
+ // HDF persistence
+ return "(*.hdf)";
}
/*! Gets file name*/
//=======================================================================
SUIT_Study* LightApp_Application::createNewStudy()
{
+ LightApp_Application::lastStudyId++;
+
LightApp_Study* aStudy = new LightApp_Study( this );
// Set up processing of major study-related events
{
OB_Browser* ob = new OB_Browser( desktop() );
ob->setAutoUpdate( true );
- ob->setAutoOpenLevel( 1 );
+ //ob->setAutoOpenLevel( 1 ); // commented by ASV as a fix to bug IPAL10107
ob->setCaption( tr( "OBJECT_BROWSER" ) );
OB_ListView* ob_list = dynamic_cast<OB_ListView*>( const_cast<QListView*>( ob->listView() ) );
ob->connectPopupRequest( this, SLOT( onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ) ) );
}
+#ifndef DISABLE_PYCONSOLE
else if ( flag == WT_PyConsole )
{
PythonConsole* pyCons = new PythonConsole( desktop() );
wid = pyCons;
// pyCons->connectPopupRequest( this, SLOT( onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ) ) );
}
+#endif
else if ( flag == WT_LogWindow )
{
LogWindow* logWin = new LogWindow( desktop() );
void LightApp_Application::defaultWindows( QMap<int, int>& aMap ) const
{
aMap.insert( WT_ObjectBrowser, Qt::DockLeft );
+#ifndef DISABLE_PYCONSOLE
aMap.insert( WT_PyConsole, Qt::DockBottom );
+#endif
// aMap.insert( WT_LogWindow, Qt::DockBottom );
}
if ( !resMgr )
return;
+#ifndef DISABLE_OCCVIEWER
if ( sec == QString( "OCCViewer" ) && param == QString( "trihedron_size" ) )
{
int sz = resMgr->integerValue( sec, param, -1 );
occVM->getAISContext()->UpdateCurrentViewer();
}
}
+#endif
+#ifndef DISABLE_VTKVIEWER
if ( sec == QString( "VTKViewer" ) && (param == QString( "trihedron_size" ) || param == QString( "relative_size" )) )
{
int sz = resMgr->integerValue( "VTKViewer", "trihedron_size", -1 );
+ bool isRelative = resMgr->booleanValue( "VTKViewer", "relative_size", true );
QPtrList<SUIT_ViewManager> lst;
+#ifndef DISABLE_SALOMEOBJECT
viewManagers( SVTK_Viewer::Type(), lst );
for ( QPtrListIterator<SUIT_ViewManager> it( lst ); it.current() && sz >= 0; ++it )
{
SVTK_Viewer* vtkVM = dynamic_cast<SVTK_Viewer*>( vm );
if( vtkVM )
{
- vtkVM->setTrihedronSize( sz );
+ vtkVM->setTrihedronSize( sz, isRelative );
vtkVM->Repaint();
}
}
+#endif
}
+#endif
+#ifndef DISABLE_OCCVIEWER
if ( sec == QString( "OCCViewer" ) && ( param == QString( "iso_number_u" ) || param == QString( "iso_number_v" ) ) )
{
QPtrList<SUIT_ViewManager> lst;
mgr->getOCCViewer()->setIsos( u, v );
}
}
+#endif
if( sec=="ObjectBrowser" )
{
updateWindows();
}
+#ifndef DISABLE_PYCONSOLE
if( sec=="PyConsole" )
{
if( param=="font" )
if( pythonConsole() )
pythonConsole()->setFont( resMgr->fontValue( "PyConsole", "font" ) );
}
+#endif
+}
+
+/*!Save preferences */
+void LightApp_Application::savePreferences()
+{
+ saveWindowsGeometry();
+
+ if ( resourceMgr() )
+ {
+ if ( desktop() )
+ desktop()->saveGeometry( resourceMgr(), "desktop" );
+ resourceMgr()->save();
+ }
}
/*!Update desktop title.*/
if ( !aVer.isEmpty() )
aTitle += QString( " " ) + aVer;
+ if ( activeStudy() ) {
+ QString sName = SUIT_Tools::file( activeStudy()->studyName().stripWhiteSpace(), false );
+ aTitle += QString( " - [%1]" ).arg( sName );
+ }
+
desktop()->setCaption( aTitle );
}
QMap<int, int> winMap;
currentWindows( winMap );
- for ( QMap<int, int>::ConstIterator it = winMap.begin(); it != winMap.end(); ++it )
- getWindow( it.key() );
+ if ( activeStudy() ) {
+ for ( QMap<int, int>::ConstIterator it = winMap.begin(); it != winMap.end(); ++it )
+ getWindow( it.key() );
- loadWindowsGeometry();
+ loadWindowsGeometry();
+ }
+ // setWindowShown should be done even if no study is active (open). in this case all open windows
+ // will be hidden, which is neccessary in this case.
for ( WindowMap::ConstIterator itr = myWindows.begin(); itr != myWindows.end(); ++itr )
setWindowShown( itr.key(), !itr.data()->isEmpty() && winMap.contains( itr.key() ) );
}
if( ok && !name.isEmpty() )
w->setCaption( name );
}
+
+bool LightApp_Application::isLibExists( const QString& moduleTitle ) const
+{
+ if( moduleTitle.isEmpty() )
+ return false;
+
+ QString lib = moduleLibrary( moduleTitle );
+ QStringList paths;
+#ifdef WIN32
+ paths = QStringList::split( ";", ::getenv( "PATH" ) );
+#else
+ paths = QStringList::split( ":", ::getenv( "LD_LIBRARY_PATH" ) );
+#endif
+
+ QStringList::const_iterator anIt = paths.begin(), aLast = paths.end();
+ for( ; anIt!=aLast; anIt++ )
+ {
+ QFileInfo inf( Qtx::addSlash( *anIt ) + lib );
+ if( inf.exists() )
+ return true;
+ }
+ return false;
+}
+
+/*! default name for an active study */
+void LightApp_Application::setDefaultStudyName( const QString& theName )
+{
+ QStringList anInfoList;
+ modules( anInfoList, false );
+
+ LightApp_Study* aStudy = (LightApp_Study*)activeStudy();
+ if( anInfoList.count() == 1 && // to avoid a conflict between different modules
+ !aStudy->isSaved() )
+ {
+ aStudy->setStudyName( theName );
+ updateDesktopTitle();
+ }
+}
class LogWindow;
class OB_Browser;
-class PythonConsole;
+#ifndef DISABLE_PYCONSOLE
+ class PythonConsole;
+#endif
class STD_Application;
class LightApp_WidgetContainer;
class LightApp_Preferences;
Q_OBJECT
public:
- typedef enum { WT_ObjectBrowser, WT_PyConsole, WT_LogWindow, WT_User } WindowTypes;
+ typedef enum { WT_ObjectBrowser,
+#ifndef DISABLE_PYCONSOLE
+ WT_PyConsole,
+#endif
+ WT_LogWindow,
+ WT_User }
+ WindowTypes;
+
+ enum { MenuWindowId = 6 };
+
+ enum { RenameId = CAM_Application::UserID,
+
+#ifndef DISABLE_GLVIEWER
+ NewGLViewId ,
+#endif
+
+#ifndef DISABLE_PLOT2DVIEWER
+ NewPlot2dId,
+#endif
- enum { NewGLViewId = CAM_Application::UserID, NewPlot2dId, NewOCCViewId, NewVTKViewId,
- PreferencesId, MRUId, RenameId, UserID };
+#ifndef DISABLE_OCCVIEWER
+ NewOCCViewId,
+#endif
+
+#ifndef DISABLE_VTKVIEWER
+ NewVTKViewId,
+#endif
+
+ PreferencesId, MRUId, UserID };
public:
LightApp_Application();
virtual ~LightApp_Application();
LogWindow* logWindow();
OB_Browser* objectBrowser();
+#ifndef DISABLE_PYCONSOLE
PythonConsole* pythonConsole();
+#endif
virtual void updateObjectBrowser( const bool = true );
SUIT_Accel* accel() const;
+ void setDefaultStudyName( const QString& theName );
+
+ static int studyId();
+
signals:
void studyOpened();
void studySaved();
protected:
virtual void createActions();
+ virtual void createActionForViewer( const int id,
+ const int parentId,
+ const QString& suffix,
+ const int accel );
virtual SUIT_Study* createNewStudy();
virtual QWidget* createWindow( const int );
virtual void defaultWindows( QMap<int, int>& ) const;
LightApp_Preferences* preferences( const bool ) const;
virtual void createPreferences( LightApp_Preferences* );
virtual void preferencesChanged( const QString&, const QString& );
+ virtual void savePreferences();
virtual void updateDesktopTitle();
protected slots:
void moduleIconNames( QMap<QString, QString>& ) const;
void activateWindows();
+ bool isLibExists( const QString& ) const;
protected:
typedef QMap<QString, QAction*> ActionMap;
SUIT_Accel* myAccel;
static LightApp_Preferences* _prefs_;
+
+ static int lastStudyId;
};
#ifdef WIN32
{
}
+#ifndef DISABLE_SALOMEOBJECT
/*!Constructor. Initialize by \a SALOME_InteractiveObject.*/
LightApp_DataOwner
::LightApp_DataOwner( const Handle(SALOME_InteractiveObject)& theIO ):
myIO(theIO)
{
}
+#endif
/*!Destructor. Do nothing.*/
LightApp_DataOwner
return other && entry() == other->entry();
}
+bool LightApp_DataOwner::operator<( const SUIT_DataOwner& obj ) const
+{
+ const LightApp_DataOwner* other = dynamic_cast<const LightApp_DataOwner*>( &obj );
+ return entry() < other->entry();
+}
+
/*!Gets entry.*/
QString
LightApp_DataOwner
return myEntry;
}
+#ifndef DISABLE_SALOMEOBJECT
/*!Gets SALOME_InteractiveObject.*/
const Handle(SALOME_InteractiveObject)&
LightApp_DataOwner
{
return myIO;
}
+#endif
#include "LightApp.h"
#include "SUIT_DataOwner.h"
-#include "SALOME_InteractiveObject.hxx"
+
+#ifndef DISABLE_SALOMEOBJECT
+ #include "SALOME_InteractiveObject.hxx"
+#endif
/*!
This class provide data owner objects.
class LIGHTAPP_EXPORT LightApp_DataOwner : public SUIT_DataOwner
{
public:
+#ifndef DISABLE_SALOMEOBJECT
LightApp_DataOwner( const Handle(SALOME_InteractiveObject)& theIO );
+#endif
LightApp_DataOwner( const QString& );
virtual ~LightApp_DataOwner();
virtual bool isEqual( const SUIT_DataOwner& ) const;
+ virtual bool operator<( const SUIT_DataOwner& ) const;
+
+#ifndef DISABLE_SALOMEOBJECT
const Handle(SALOME_InteractiveObject)& IO() const;
+#endif
QString entry() const;
private:
QString myEntry;
+#ifndef DISABLE_SALOMEOBJECT
Handle(SALOME_InteractiveObject) myIO;
+#endif
};
typedef SMART(LightApp_DataOwner) LightApp_DataOwnerPtr;
#include <CAM_Study.h>
-#include <SALOME_InteractiveObject.hxx>
-
#include <SUIT_Session.h>
#include <SUIT_Desktop.h>
#include <SUIT_ViewManager.h>
#include <SUIT_ViewWindow.h>
#include <qstring.h>
+#ifndef DISABLE_SALOMEOBJECT
+ #include "SALOME_InteractiveObject.hxx"
+#endif
LightApp_Displayer::LightApp_Displayer()
{
bool LightApp_Displayer::IsDisplayed( const QString& entry, SALOME_View* theViewFrame ) const
{
SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView();
+ bool res = false;
if( vf )
{
+#ifndef DISABLE_SALOMEOBJECT
Handle( SALOME_InteractiveObject ) temp = new SALOME_InteractiveObject();
temp->setEntry( entry.latin1() );
- return vf->isVisible( temp );
+ res = vf->isVisible( temp );
+#endif
}
- else
- return false;
+ return res;
}
void LightApp_Displayer::UpdateViewer() const
#include "LightApp_DataOwner.h"
-#include <SALOME_GLOwner.h>
-
#include <GLViewer_Context.h>
/*!Constructor. Initialize by GLViewer_Viewer2d and SUIT_SelectionMgr.*/
GLViewer_Object* obj = cont->SelectedObject();
if ( obj )
{
- SALOME_GLOwner* owner = dynamic_cast< SALOME_GLOwner* >( obj->owner() );
+ LightApp_GLOwner* owner = dynamic_cast< LightApp_GLOwner* >( obj->owner() );
if( owner )
aList.append( SUIT_DataOwnerPtr( new LightApp_DataOwner( owner->entry() ) ) );
}
GLViewer_Object* obj = *it;
if ( obj && obj->getVisible() )
{
- SALOME_GLOwner* owner = dynamic_cast< SALOME_GLOwner* >( obj->owner() );
+ LightApp_GLOwner* owner = dynamic_cast< LightApp_GLOwner* >( obj->owner() );
if ( owner )
aDisplayed.insert( owner->entry(), obj );
}
if ( Nb > 0 )
myViewer->updateAll();
}
+
+
+LightApp_GLOwner::LightApp_GLOwner( const char* entry )
+: GLViewer_Owner()
+{
+ setEntry( entry );
+}
+
+LightApp_GLOwner::~LightApp_GLOwner()
+{
+}
+
+const char* LightApp_GLOwner::entry() const
+{
+ return myEntry.c_str();
+}
+
+void LightApp_GLOwner::setEntry( const char* entry )
+{
+ myEntry = entry;
+}
#include <GLViewer_Viewer2d.h>
+#include <string>
+#include <GLViewer_Object.h>
+
class LIGHTAPP_EXPORT LightApp_GLSelector : public SUIT_Selector
{
Q_OBJECT
GLViewer_Viewer2d* myViewer;
};
+
+/*!
+ This class provide data owner objects for GLViewer.
+*/
+class LIGHTAPP_EXPORT LightApp_GLOwner : public GLViewer_Owner
+{
+public:
+ LightApp_GLOwner( const char* );
+ ~LightApp_GLOwner();
+
+ const char* entry() const;
+ void setEntry( const char* );
+
+private:
+ std::string myEntry;
+};
+
#endif
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, 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/
+//
+#include "LightApp_HDFDriver.h"
+
+#include "HDFexplorer.hxx"
+#include "HDFOI.hxx"
+
+// OCCT Includes
+#include <TCollection_AsciiString.hxx>
+
+/*! Constructor.*/
+LightApp_HDFDriver::LightApp_HDFDriver()
+{
+}
+
+/*! Destructor.*/
+LightApp_HDFDriver::~LightApp_HDFDriver()
+{
+}
+
+using namespace std;
+
+//================================================================
+// Function : SaveDatasInFile
+/*! Purpose : save in file 'theFileName' datas from this driver*/
+//================================================================
+bool LightApp_HDFDriver::SaveDatasInFile( const char* theFileName, bool isMultiFile )
+{
+ bool isASCII = false;
+ bool isError = false;
+
+ HDFfile *hdf_file = 0;
+ HDFgroup *hdf_group_datacomponent = 0;
+ HDFgroup *hdf_group_study_structure = 0;
+ HDFgroup *hdf_sco_group = 0;
+ HDFgroup *hdf_sco_group2 = 0;
+ HDFdataset *hdf_dataset = 0;
+ hdf_size aHDFSize[1];
+
+ try {
+ hdf_file = new HDFfile ((char*)theFileName);
+ hdf_file->CreateOnDisk();
+
+ //-----------------------------------------------------------------------
+ // 1 - Create a groupe for each SComponent and Update the PersistanceRef
+ //-----------------------------------------------------------------------
+ hdf_group_datacomponent = new HDFgroup ("DATACOMPONENT", hdf_file);
+ hdf_group_datacomponent->CreateOnDisk();
+
+ std::map<std::string, std::string> mapNameEntry;
+
+ int tag = 1;
+ std::map<std::string, ListOfFiles>::const_iterator it;
+ for (it = myMap.begin(); it != myMap.end(); ++it, ++tag) {
+ std::string aName (it->first);
+ char* aModuleName = const_cast<char*>(aName.c_str());
+ unsigned char* aBuffer;
+ long aBufferSize;
+ PutFilesToStream(aName, aBuffer, aBufferSize, isMultiFile);
+
+ //Handle(SALOMEDSImpl_SComponent) sco = itcomponent.Value();
+ //TCollection_AsciiString scoid = sco->GetID();
+ //hdf_sco_group = new HDFgroup(scoid.ToCString(), hdf_group_datacomponent);
+
+ TCollection_AsciiString entry ("0:1:");
+ entry += TCollection_AsciiString(tag);
+ mapNameEntry[aModuleName] = entry.ToCString();
+
+ //hdf_sco_group = new HDFgroup (aModuleName, hdf_group_datacomponent);
+ hdf_sco_group = new HDFgroup (entry.ToCString(), hdf_group_datacomponent);
+ hdf_sco_group->CreateOnDisk();
+
+ aHDFSize[0] = aBufferSize;
+
+ hdf_dataset = new HDFdataset ("FILE_STREAM", hdf_sco_group, HDF_STRING, aHDFSize, 1);
+ hdf_dataset->CreateOnDisk();
+ hdf_dataset->WriteOnDisk(aBuffer); //Save the stream in the HDF file
+ hdf_dataset->CloseOnDisk();
+ hdf_dataset = 0; //will be deleted by hdf_sco_group destructor
+
+ // store multifile state
+ aHDFSize[0] = 2;
+ hdf_dataset = new HDFdataset("MULTIFILE_STATE", hdf_sco_group, HDF_STRING, aHDFSize, 1);
+ hdf_dataset->CreateOnDisk();
+ hdf_dataset->WriteOnDisk((void*)(isMultiFile ? "M" : "S")); // save: multi or single
+ hdf_dataset->CloseOnDisk();
+ hdf_dataset = 0; //will be deleted by hdf_sco_group destructor
+
+ // store ASCII state
+ aHDFSize[0] = 2;
+ hdf_dataset = new HDFdataset("ASCII_STATE", hdf_sco_group, HDF_STRING, aHDFSize, 1);
+ hdf_dataset->CreateOnDisk();
+ hdf_dataset->WriteOnDisk((void*)(isASCII ? "A" : "B")); // save: ASCII or BINARY
+ hdf_dataset->CloseOnDisk();
+ hdf_dataset = 0; //will be deleted by hdf_sco_group destructor
+
+ hdf_sco_group->CloseOnDisk();
+ hdf_sco_group = 0; // will be deleted by hdf_group_datacomponent destructor
+
+ delete [] aBuffer;
+ }
+
+ hdf_group_datacomponent->CloseOnDisk();
+ hdf_group_datacomponent = 0; // will be deleted by hdf_file destructor
+
+ //-----------------------------------------------------------------------
+ // 3 - Write the Study Structure
+ //-----------------------------------------------------------------------
+ hdf_group_study_structure = new HDFgroup ("STUDY_STRUCTURE", hdf_file);
+ hdf_group_study_structure->CreateOnDisk();
+
+ for (it = myMap.begin(); it != myMap.end(); ++it) {
+ std::string aName (it->first);
+ char* aModuleName = const_cast<char*>(aName.c_str());
+
+ //hdf_sco_group2 = new HDFgroup(scid.ToCString(), hdf_group_study_structure);
+ char* entry = (char*)(mapNameEntry[aModuleName].c_str());
+ hdf_sco_group2 = new HDFgroup (entry, hdf_group_study_structure);
+ hdf_sco_group2->CreateOnDisk();
+
+ // ComponentDataType treatment
+ hdf_int32 name_len = (hdf_int32)strlen(aModuleName);
+ aHDFSize[0] = name_len + 1;
+ hdf_dataset = new HDFdataset ("COMPONENTDATATYPE", hdf_sco_group2, HDF_STRING, aHDFSize, 1);
+ hdf_dataset->CreateOnDisk();
+ hdf_dataset->WriteOnDisk(aModuleName);
+ hdf_dataset->CloseOnDisk();
+ hdf_dataset = 0; //will be deleted by hdf_sco_group2 destructor
+
+ hdf_sco_group2->CloseOnDisk();
+ hdf_sco_group2 = 0; // will be deleted by hdf_group_study_structure destructor
+ }
+
+ hdf_group_study_structure->CloseOnDisk();
+ hdf_group_study_structure = 0; // will be deleted by hdf_file destructor
+
+ hdf_file->CloseOnDisk();
+ delete hdf_file; // recursively deletes all hdf objects...
+
+ } catch (HDFexception) {
+ isError = true;
+ }
+ if (isASCII && !isError) { // save file in ASCII format
+ HDFascii::ConvertFromHDFToASCII(theFileName, true);
+ }
+
+ return !isError;
+}
+
+//=======================================================================
+// Function : ReadDatasFromFile
+/*! Purpose : filling current driver from file 'theFileName'*/
+//=======================================================================
+bool LightApp_HDFDriver::ReadDatasFromFile( const char* theFileName, bool isMultiFile )
+{
+ bool isASCII = false;
+ bool isError = false;
+ TCollection_AsciiString aHDFUrl;
+
+ HDFfile *hdf_file = 0;
+ HDFgroup *hdf_group_datacomponent = 0;
+ HDFgroup *hdf_group_study_structure = 0;
+ HDFgroup *hdf_sco_group = 0;
+ HDFgroup *hdf_sco_group2 = 0;
+
+ std::map<std::string, std::string> mapEntryName;
+
+ if (HDFascii::isASCII(theFileName)) {
+ isASCII = true;
+ char* aResultPath = HDFascii::ConvertFromASCIIToHDF(theFileName);
+ aHDFUrl = aResultPath;
+ aHDFUrl += "hdf_from_ascii.hdf";
+ delete(aResultPath);
+ } else {
+ aHDFUrl = (char*)theFileName;
+ }
+
+ hdf_file = new HDFfile((char*)aHDFUrl.ToCString());
+
+ char aMultifileState[2];
+ char ASCIIfileState[2];
+
+ try {
+ hdf_file->OpenOnDisk(HDF_RDONLY);
+
+ } catch (HDFexception) {
+ //char *eStr = new char[strlen(aUrl.ToCString()) + 17];
+ //sprintf(eStr,"Can't open file %s", aUrl.ToCString());
+ //_errorCode = TCollection_AsciiString(eStr);
+ //delete [] eStr;
+ return false;
+ }
+
+ try {
+ if (!hdf_file->ExistInternalObject("STUDY_STRUCTURE")) {
+ //_errorCode = "Study is empty";
+ isError = true;
+ } else {
+ hdf_group_study_structure = new HDFgroup ("STUDY_STRUCTURE", hdf_file);
+ hdf_group_study_structure->OpenOnDisk();
+
+ char name[HDF_NAME_MAX_LEN + 1];
+ Standard_Integer nbsons = hdf_group_study_structure->nInternalObjects();
+ for (Standard_Integer i = 0; i < nbsons; i++) {
+ hdf_group_study_structure->InternalObjectIndentify(i, name);
+ if (strncmp(name, "INTERNAL_COMPLEX", 16) == 0) continue;
+ hdf_object_type type = hdf_group_study_structure->InternalObjectType(name);
+ if (type == HDF_GROUP) {
+ hdf_sco_group2 = new HDFgroup (name, hdf_group_study_structure);
+ hdf_sco_group2->OpenOnDisk();
+
+ // Read component data
+ char* aCompDataType = NULL;
+ int aDataSize = 0;
+
+ if (hdf_sco_group2->ExistInternalObject("COMPONENTDATATYPE")) {
+ HDFdataset *hdf_dataset = new HDFdataset("COMPONENTDATATYPE", hdf_sco_group2);
+ hdf_dataset->OpenOnDisk();
+ aDataSize = hdf_dataset->GetSize();
+ aCompDataType = new char[aDataSize];
+ if (aCompDataType == NULL) {
+ isError = true;
+ } else {
+ hdf_dataset->ReadFromDisk(aCompDataType);
+
+ mapEntryName[name] = aCompDataType;
+
+ delete [] aCompDataType;
+ }
+
+ hdf_dataset->CloseOnDisk();
+ hdf_dataset = 0;
+ }
+
+ hdf_sco_group2->CloseOnDisk();
+ }
+ }
+
+ hdf_group_study_structure->CloseOnDisk();
+ }
+
+ if (!hdf_file->ExistInternalObject("DATACOMPONENT")) {
+ //_errorCode = "No components stored";
+ isError = true;
+ } else {
+ hdf_group_datacomponent = new HDFgroup ("DATACOMPONENT", hdf_file);
+ hdf_group_datacomponent->OpenOnDisk();
+
+ char name[HDF_NAME_MAX_LEN + 1];
+ Standard_Integer nbsons = hdf_group_datacomponent->nInternalObjects();
+ for (Standard_Integer i = 0; i < nbsons; i++) {
+ hdf_group_datacomponent->InternalObjectIndentify(i, name);
+ if (strncmp(name, "INTERNAL_COMPLEX", 16) == 0) continue;
+ hdf_object_type type = hdf_group_datacomponent->InternalObjectType(name);
+ if (type == HDF_GROUP) {
+ hdf_sco_group = new HDFgroup (name, hdf_group_datacomponent);
+ hdf_sco_group->OpenOnDisk();
+
+ // Read component data
+ unsigned char* aStreamFile = NULL;
+ int aStreamSize = 0;
+
+ if (hdf_sco_group->ExistInternalObject("FILE_STREAM")) {
+ HDFdataset *hdf_dataset = new HDFdataset("FILE_STREAM", hdf_sco_group);
+ hdf_dataset->OpenOnDisk();
+ aStreamSize = hdf_dataset->GetSize();
+ aStreamFile = new unsigned char[aStreamSize];
+ if (aStreamFile == NULL) {
+ isError = true;
+ } else {
+ hdf_dataset->ReadFromDisk(aStreamFile);
+ }
+
+ hdf_dataset->CloseOnDisk();
+ hdf_dataset = 0;
+ }
+
+ HDFdataset *multifile_hdf_dataset = new HDFdataset("MULTIFILE_STATE", hdf_sco_group);
+ multifile_hdf_dataset->OpenOnDisk();
+ multifile_hdf_dataset->ReadFromDisk(aMultifileState);
+ multifile_hdf_dataset->CloseOnDisk();
+ multifile_hdf_dataset = 0;
+
+ HDFdataset *ascii_hdf_dataset = new HDFdataset("ASCII_STATE", hdf_sco_group);
+ ascii_hdf_dataset->OpenOnDisk();
+ ascii_hdf_dataset->ReadFromDisk(ASCIIfileState);
+ ascii_hdf_dataset->CloseOnDisk();
+ ascii_hdf_dataset = 0;
+
+ isASCII = (ASCIIfileState[0] == 'A') ? true : false;
+
+ if (aStreamFile != NULL) {
+ // Put buffer to aListOfFiles and set to myMap
+ ListOfFiles aListOfFiles = PutStreamToFiles(aStreamFile, aStreamSize, isMultiFile);
+ char* aCompDataType = (char*)(mapEntryName[name].c_str());
+ SetListOfFiles(aCompDataType, aListOfFiles);
+
+ delete [] aStreamFile;
+ }
+
+ hdf_sco_group->CloseOnDisk();
+ }
+ }
+
+ hdf_group_datacomponent->CloseOnDisk();
+ }
+ } catch (HDFexception) {
+ isError = true;
+
+ //Handle(TColStd_HSequenceOfAsciiString) aFilesToRemove = new TColStd_HSequenceOfAsciiString;
+ //aFilesToRemove->Append(aHDFUrl);
+ //RemoveFiles(aFilesToRemove, true);
+ }
+
+ hdf_file->CloseOnDisk();
+ delete hdf_file; // all related hdf objects will be deleted
+
+ if (isASCII && !isError) {
+ //Handle(TColStd_HSequenceOfAsciiString) aFilesToRemove = new TColStd_HSequenceOfAsciiString;
+ //aFilesToRemove->Append(aHDFUrl);
+ //RemoveFiles(aFilesToRemove, true);
+ }
+
+ //std::map<std::string, std::string>::const_iterator it;
+ //for (it = mapEntryName.begin(); it != mapEntryName.end(); ++it) {
+ // cout << "Read Component: entry = " << it->first
+ // << ", Component data type = " << it->second << endl;
+ //}
+
+ return !isError;
+}
--- /dev/null
+#ifndef LIGHTAPP_HDFDRIVER_H
+#define LIGHTAPP_HDFDRIVER_H
+
+#include <LightApp.h>
+#include <LightApp_Driver.h>
+
+#ifdef WIN32
+#pragma warning( disable:4251 )
+#endif
+
+/*!Description : Driver can save to file and read from file list of files for light modules*/
+
+class LIGHTAPP_EXPORT LightApp_HDFDriver : public LightApp_Driver
+{
+public:
+ LightApp_HDFDriver();
+ virtual ~LightApp_HDFDriver();
+
+ virtual bool SaveDatasInFile (const char* theFileName, bool isMultiFile);
+ virtual bool ReadDatasFromFile (const char* theFileName, bool isMultiFile);
+};
+
+#endif
#include <SUIT_DataObject.h>
#include <SUIT_ResourceMgr.h>
-#include <SVTK_ViewWindow.h>
-#include <SVTK_ViewModel.h>
-#include <OCCViewer_ViewWindow.h>
-#include <OCCViewer_ViewPort3d.h>
-#include <SOCC_ViewModel.h>
-#include <GLViewer_ViewFrame.h>
-#include <GLViewer_ViewPort.h>
-#include <Plot2d_ViewWindow.h>
-#include <Plot2d_ViewFrame.h>
-#include <SPlot2d_ViewModel.h>
+#ifndef DISABLE_VTKVIEWER
+#ifndef DISABLE_SALOMEOBJECT
+ #include <SVTK_ViewWindow.h>
+ #include <SVTK_ViewModel.h>
+#else
+ #include <VTKViewer_ViewWindow.h>
+#endif
+ #include <VTKViewer_ViewModel.h>
+#endif
+#ifndef DISABLE_OCCVIEWER
+ #include <OCCViewer_ViewWindow.h>
+ #include <OCCViewer_ViewPort3d.h>
+#ifndef DISABLE_SALOMEOBJECT
+ #include <SOCC_ViewModel.h>
+#else
+ #include <OCCViewer_ViewModel.h>
+#endif
+#endif
+#ifndef DISABLE_GLVIEWER
+ #include <GLViewer_ViewFrame.h>
+ #include <GLViewer_ViewPort.h>
+#endif
+#ifndef DISABLE_PLOT2DVIEWER
+ #include <Plot2d_ViewWindow.h>
+ #include <Plot2d_ViewFrame.h>
+#ifndef DISABLE_SALOMEOBJECT
+ #include <SPlot2d_ViewModel.h>
+#else
+ #include <Plot2d_ViewModel.h>
+#endif
+#endif
#include <OB_Browser.h>
if ( res && application() && application()->resourceMgr() )
application()->resourceMgr()->raiseTranslators( name() );
+ connect( application(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ),
+ this, SLOT( onViewManagerAdded( SUIT_ViewManager* ) ) );
+ connect( application(), SIGNAL( viewManagerRemoved( SUIT_ViewManager* ) ),
+ this, SLOT( onViewManagerRemoved( SUIT_ViewManager* ) ) );
+
if ( mySwitchOp == 0 )
mySwitchOp = new LightApp_SwitchOp( this );
delete mySwitchOp;
mySwitchOp = 0;
+ disconnect( application(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ),
+ this, SLOT( onViewManagerAdded( SUIT_ViewManager* ) ) );
+ disconnect( application(), SIGNAL( viewManagerRemoved( SUIT_ViewManager* ) ),
+ this, SLOT( onViewManagerRemoved( SUIT_ViewManager* ) ) );
+
// abort all operations
MapOfOperation::const_iterator anIt;
for( anIt = myOperations.begin(); anIt != myOperations.end(); anIt++ ) {
if ( SUIT_ViewManager* viewMgr = getApp()->activeViewManager() )
if ( SUIT_ViewWindow* viewWnd = viewMgr->getActiveView() )
{
+#ifndef DISABLE_VTKVIEWER
+#ifndef DISABLE_SALOMEOBJECT
if ( viewWnd->inherits( "SVTK_ViewWindow" ) )
( (SVTK_ViewWindow*)viewWnd )->Repaint();
- else if ( viewWnd->inherits( "OCCViewer_ViewWindow" ) )
+#else
+ if ( viewWnd->inherits( "VTKViewer_ViewWindow" ) )
+ ( (VTKViewer_ViewWindow*)viewWnd )->Repaint();
+#endif
+#endif
+#ifndef DISABLE_OCCVIEWER
+ if ( viewWnd->inherits( "OCCViewer_ViewWindow" ) )
( (OCCViewer_ViewWindow*)viewWnd )->getViewPort()->onUpdate();
- else if ( viewWnd->inherits( "Plot2d_ViewWindow" ) )
+#endif
+#ifndef DISABLE_PLOT2DVIEWER
+ if ( viewWnd->inherits( "Plot2d_ViewWindow" ) )
( (Plot2d_ViewWindow*)viewWnd )->getViewFrame()->Repaint();
- else if ( viewWnd->inherits( "GLViewer_ViewFrame" ) )
+#endif
+#ifndef DISABLE_GLVIEWER
+ if ( viewWnd->inherits( "GLViewer_ViewFrame" ) )
( (GLViewer_ViewFrame*)viewWnd )->getViewPort()->onUpdate();
+#endif
}
}
}
myPopupMgr->setRule( disp, /*QString( "( not isVisible ) and " ) + */ uniform, true );
myPopupMgr->setRule( erase, /*QString( "( isVisible ) and " ) + */ uniform, true );
myPopupMgr->setRule( dispOnly, uniform, true );
- QString viewers = "{ '%1' '%2' '%3' }";
- viewers = viewers.arg( SOCC_Viewer::Type() ).arg( SVTK_Viewer::Type() ).arg( SPlot2d_Viewer::Type() );
- myPopupMgr->setRule( eraseAll, QString( "client in %1" ).arg( viewers ), true );
+
+ QStringList viewers;
+
+#ifndef DISABLE_OCCVIEWER
+#ifndef DISABLE_SALOMEOBJECT
+ viewers.append( SOCC_Viewer::Type() );
+#else
+ viewers.append( OCCViewer_Viewer::Type() );
+#endif
+#endif
+#ifndef DISABLE_VTKVIEWER
+#ifndef DISABLE_SALOMEOBJECT
+ viewers.append( SVTK_Viewer::Type() );
+#else
+ viewers.append( VTKViewer_Viewer::Type() );
+#endif
+#endif
+#ifndef DISABLE_PLOT2DVIEWER
+#ifndef DISABLE_SALOMEOBJECT
+ viewers.append( SPlot2d_Viewer::Type() );
+#else
+ viewers.append( Plot2d_Viewer::Type() );
+#endif
+#endif
+
+ if( !viewers.isEmpty() )
+ {
+ QString strViewers = "{ ", temp = "'%1' ";
+ QStringList::const_iterator anIt = viewers.begin(), aLast = viewers.end();
+ for( ; anIt!=aLast; anIt++ )
+ strViewers+=temp.arg( *anIt );
+ strViewers+="}";
+ myPopupMgr->setRule( eraseAll, QString( "client in %1" ).arg( strViewers ), true );
+ }
}
return myPopupMgr;
}
if( id!=-1 )
startOperation( id );
}
+
+void LightApp_Module::onViewManagerAdded( SUIT_ViewManager* )
+{
+}
+
+void LightApp_Module::onViewManagerRemoved( SUIT_ViewManager* )
+{
+}
class SUIT_Study;
class SUIT_DataObject;
class SUIT_Operation;
+class SUIT_ViewManager;
class CAM_Application;
class QtxPopupMgr;
virtual void onOperationStopped( SUIT_Operation* );
virtual void onOperationDestroyed();
virtual void onShowHide();
+ virtual void onViewManagerAdded( SUIT_ViewManager* );
+ virtual void onViewManagerRemoved( SUIT_ViewManager* );
protected:
virtual QtxPopupMgr* popupMgr();
//
// See http://www.salome-platform.org/
//
-// File : LightApp_NameDlg.cxx\r
-// Author : Vadim SANDLER\r
-// $Header$\r
-\r
-#include <LightApp_NameDlg.h>\r
-#include <SUIT_Application.h>\r
-#include <SUIT_Desktop.h>\r
-#include <SUIT_Tools.h>\r
-\r
-#include <qgroupbox.h>\r
-#include <qlabel.h>\r
-#include <qlineedit.h>\r
-#include <qpushbutton.h>\r
-#include <qlayout.h>\r
-\r
-#ifndef WIN32\r
-using namespace std;\r
-#endif\r
-\r
-/*!\r
- Constructor\r
-*/\r
-LightApp_NameDlg::LightApp_NameDlg( QWidget* parent )\r
-: QDialog( parent ? parent : NULL,//application()->desktop(), \r
-"LightApp_NameDlg",\r
-true,\r
-WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )\r
-{\r
- setCaption( tr("TLT_RENAME") );\r
- setSizeGripEnabled( TRUE );\r
-\r
- QVBoxLayout* topLayout = new QVBoxLayout( this );\r
- topLayout->setMargin( 11 ); topLayout->setSpacing( 6 );\r
-\r
- /***************************************************************/\r
- QGroupBox* GroupC1 = new QGroupBox( this, "GroupC1" );\r
- GroupC1->setColumnLayout(0, Qt::Vertical );\r
- GroupC1->layout()->setMargin( 0 ); GroupC1->layout()->setSpacing( 0 );\r
- QHBoxLayout* GroupC1Layout = new QHBoxLayout( GroupC1->layout() );\r
- GroupC1Layout->setAlignment( Qt::AlignTop );\r
- GroupC1Layout->setMargin( 11 ); GroupC1Layout->setSpacing( 6 );\r
- \r
- QLabel* TextLabel = new QLabel( GroupC1, "TextLabel1" );\r
- TextLabel->setText( tr( "NAME_LBL" ) );\r
- GroupC1Layout->addWidget( TextLabel );\r
- \r
- myLineEdit = new QLineEdit( GroupC1, "LineEdit1" );\r
- myLineEdit->setMinimumSize( 250, 0 );\r
- GroupC1Layout->addWidget( myLineEdit );\r
- \r
- /***************************************************************/\r
- QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );\r
- GroupButtons->setColumnLayout(0, Qt::Vertical );\r
- GroupButtons->layout()->setMargin( 0 ); GroupButtons->layout()->setSpacing( 0 ); \r
- QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons->layout() );\r
- GroupButtonsLayout->setAlignment( Qt::AlignTop );\r
- GroupButtonsLayout->setMargin( 11 ); GroupButtonsLayout->setSpacing( 6 );\r
- \r
- myButtonOk = new QPushButton( GroupButtons, "buttonOk" );\r
- myButtonOk->setText( tr( "BUT_OK" ) );\r
- myButtonOk->setAutoDefault( TRUE ); myButtonOk->setDefault( TRUE );\r
- GroupButtonsLayout->addWidget( myButtonOk );\r
-\r
- GroupButtonsLayout->addStretch();\r
- \r
- myButtonCancel = new QPushButton( GroupButtons, "buttonCancel" );\r
- myButtonCancel->setText( tr( "BUT_CANCEL" ) );\r
- myButtonCancel->setAutoDefault( TRUE );\r
- GroupButtonsLayout->addWidget( myButtonCancel );\r
- /***************************************************************/\r
- \r
- topLayout->addWidget( GroupC1 );\r
- topLayout->addWidget( GroupButtons );\r
- \r
- // signals and slots connections\r
- connect( myButtonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );\r
- connect( myButtonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );\r
- \r
- /* Move widget on the botton right corner of main widget */\r
- SUIT_Tools::centerWidget( this, parent );\r
-}\r
-\r
-/*!\r
- Destructor\r
-*/\r
-LightApp_NameDlg::~LightApp_NameDlg()\r
-{\r
-}\r
-\r
-/*!\r
- Sets name\r
-*/\r
-void LightApp_NameDlg::setName( const QString& name )\r
-{\r
- myLineEdit->setText( name );\r
- myLineEdit->end(false);\r
- myLineEdit->home(true);\r
-}\r
-\r
-/*!\r
- Returns name entered by user\r
-*/\r
-QString LightApp_NameDlg::name()\r
-{\r
- return myLineEdit->text();\r
-}\r
-\r
-void LightApp_NameDlg::accept()\r
-{\r
- if ( name().stripWhiteSpace().isEmpty() )\r
- return;\r
- QDialog::accept();\r
-}\r
-\r
-/*!\r
- Creates modal <Rename> dialog and returns name entered [ static ]\r
-*/\r
-QString LightApp_NameDlg::getName( QWidget* parent, const QString& oldName )\r
-{\r
- QString n;\r
- LightApp_NameDlg* dlg = new LightApp_NameDlg( parent );\r
- if ( !oldName.isNull() )\r
- dlg->setName( oldName );\r
- if ( dlg->exec() == QDialog::Accepted ) \r
- n = dlg->name();\r
- delete dlg;\r
- return n;\r
-}\r
+// File : LightApp_NameDlg.cxx
+// Author : Vadim SANDLER
+// $Header$
+
+#include <LightApp_NameDlg.h>
+#include <SUIT_Application.h>
+#include <SUIT_Desktop.h>
+#include <SUIT_Tools.h>
+
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qlayout.h>
+
+#ifndef WIN32
+using namespace std;
+#endif
+
+/*!
+ Constructor
+*/
+LightApp_NameDlg::LightApp_NameDlg( QWidget* parent )
+: QDialog( parent ? parent : NULL,//application()->desktop(),
+"LightApp_NameDlg",
+true,
+WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+{
+ setCaption( tr("TLT_RENAME") );
+ setSizeGripEnabled( TRUE );
+
+ QVBoxLayout* topLayout = new QVBoxLayout( this );
+ topLayout->setMargin( 11 ); topLayout->setSpacing( 6 );
+
+ /***************************************************************/
+ QGroupBox* GroupC1 = new QGroupBox( this, "GroupC1" );
+ GroupC1->setColumnLayout(0, Qt::Vertical );
+ GroupC1->layout()->setMargin( 0 ); GroupC1->layout()->setSpacing( 0 );
+ QHBoxLayout* GroupC1Layout = new QHBoxLayout( GroupC1->layout() );
+ GroupC1Layout->setAlignment( Qt::AlignTop );
+ GroupC1Layout->setMargin( 11 ); GroupC1Layout->setSpacing( 6 );
+
+ QLabel* TextLabel = new QLabel( GroupC1, "TextLabel1" );
+ TextLabel->setText( tr( "NAME_LBL" ) );
+ GroupC1Layout->addWidget( TextLabel );
+
+ myLineEdit = new QLineEdit( GroupC1, "LineEdit1" );
+ myLineEdit->setMinimumSize( 250, 0 );
+ GroupC1Layout->addWidget( myLineEdit );
+
+ /***************************************************************/
+ QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
+ GroupButtons->setColumnLayout(0, Qt::Vertical );
+ GroupButtons->layout()->setMargin( 0 ); GroupButtons->layout()->setSpacing( 0 );
+ QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons->layout() );
+ GroupButtonsLayout->setAlignment( Qt::AlignTop );
+ GroupButtonsLayout->setMargin( 11 ); GroupButtonsLayout->setSpacing( 6 );
+
+ myButtonOk = new QPushButton( GroupButtons, "buttonOk" );
+ myButtonOk->setText( tr( "BUT_OK" ) );
+ myButtonOk->setAutoDefault( TRUE ); myButtonOk->setDefault( TRUE );
+ GroupButtonsLayout->addWidget( myButtonOk );
+
+ GroupButtonsLayout->addStretch();
+
+ myButtonCancel = new QPushButton( GroupButtons, "buttonCancel" );
+ myButtonCancel->setText( tr( "BUT_CANCEL" ) );
+ myButtonCancel->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( myButtonCancel );
+ /***************************************************************/
+
+ topLayout->addWidget( GroupC1 );
+ topLayout->addWidget( GroupButtons );
+
+ // signals and slots connections
+ connect( myButtonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
+ connect( myButtonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
+
+ /* Move widget on the botton right corner of main widget */
+ SUIT_Tools::centerWidget( this, parent );
+}
+
+/*!
+ Destructor
+*/
+LightApp_NameDlg::~LightApp_NameDlg()
+{
+}
+
+/*!
+ Sets name
+*/
+void LightApp_NameDlg::setName( const QString& name )
+{
+ myLineEdit->setText( name );
+ myLineEdit->end(false);
+ myLineEdit->home(true);
+}
+
+/*!
+ Returns name entered by user
+*/
+QString LightApp_NameDlg::name()
+{
+ return myLineEdit->text();
+}
+
+void LightApp_NameDlg::accept()
+{
+ if ( name().stripWhiteSpace().isEmpty() )
+ return;
+ QDialog::accept();
+}
+
+/*!
+ Creates modal <Rename> dialog and returns name entered [ static ]
+*/
+QString LightApp_NameDlg::getName( QWidget* parent, const QString& oldName )
+{
+ QString n;
+ LightApp_NameDlg* dlg = new LightApp_NameDlg( parent );
+ if ( !oldName.isNull() )
+ dlg->setName( oldName );
+ if ( dlg->exec() == QDialog::Accepted )
+ n = dlg->name();
+ delete dlg;
+ return n;
+}
LightApp_DataObject* obj = dynamic_cast<LightApp_DataObject*>( it.current() );
if ( obj )
{
+#ifndef DISABLE_SALOMEOBJECT
Handle(SALOME_InteractiveObject) aSObj = new SALOME_InteractiveObject
( obj->entry(), obj->componentDataType(), obj->name() );
LightApp_DataOwner* owner = new LightApp_DataOwner( aSObj );
+#else
+ LightApp_DataOwner* owner = new LightApp_DataOwner( obj->entry() );
+#endif
that->mySelectedList.append( SUIT_DataOwnerPtr( owner ) );
}
}
#include "LightApp_DataOwner.h"
#include "LightApp_OCCSelector.h"
-#include <SALOME_InteractiveObject.hxx>
-
+#ifndef DISABLE_SALOMEOBJECT
+ #include <SALOME_InteractiveObject.hxx>
+#endif
#include <AIS_ListOfInteractive.hxx>
#include <AIS_ListIteratorOfListOfInteractive.hxx>
for ( AIS_ListIteratorOfListOfInteractive anIt( aSelList ); anIt.More(); anIt.Next() )
if ( !anIt.Value().IsNull() )
{
+#ifndef DISABLE_SALOMEOBJECT
Handle(SALOME_InteractiveObject) anObj = Handle(SALOME_InteractiveObject)::DownCast(anIt.Value()->GetOwner());
if( !anObj.IsNull() )
aList.append( SUIT_DataOwnerPtr( new LightApp_DataOwner( anObj ) ) );
+#else
+ aList.append( SUIT_DataOwnerPtr( new LightApp_DataOwner( entry( anIt.Value() ) ) ) );
+#endif
}
}
if ( anAIS.IsNull() || !anAIS->HasOwner() )
return QString::null;
- Handle(SALOME_InteractiveObject) anObj = Handle(SALOME_InteractiveObject)::DownCast(anAIS->GetOwner());
-
QString res;
+
+#ifndef DISABLE_SALOMEOBJECT
+ Handle(SALOME_InteractiveObject) anObj = Handle(SALOME_InteractiveObject)::DownCast(anAIS->GetOwner());
if ( !anObj.IsNull() )
res = QString( anObj->getEntry() );
+#endif
+
return res;
}
LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( mod_name, false );
// false in last parameter means that now we doesn't load module, if it isn't loaded
- return QtxValue( d ? d->canBeDisplayed( myEntries[ ind ] ) : true, 0 );
+ if ( d )
+ return d->canBeDisplayed( myEntries[ ind ] );
+ else if ( myEntries[ ind ].startsWith( QObject::tr( "SAVE_POINT_DEF_NAME" ) ) ) // object is a Save Point object
+ return false;
+
+ return true;
//now if displayer is null, it means, that according module isn't loaded, so that we allow to all display/erase
//operations under object
}
#include <SUIT_Session.h>
-#include <SALOME_ListIO.hxx>
-#include <SALOME_ListIteratorOfListIO.hxx>
+#ifndef DISABLE_SALOMEOBJECT
+ #include <SALOME_ListIO.hxx>
+ #include <SALOME_ListIteratorOfListIO.hxx>
-// Open CASCADE Include
-#include <TColStd_MapOfInteger.hxx>
-#include <TColStd_MapIteratorOfMapOfInteger.hxx>
-#include <TColStd_IndexedMapOfInteger.hxx>
+ // Open CASCADE Include
+ #include <TColStd_MapOfInteger.hxx>
+ #include <TColStd_MapIteratorOfMapOfInteger.hxx>
+ #include <TColStd_IndexedMapOfInteger.hxx>
+#endif
/*!
Constructor.
return myApp;
}
+#ifndef DISABLE_SALOMEOBJECT
/*!
Get all selected objects from selection manager
*/
setSelected( owners, append );
}
+#else
+/*!
+ Get all selected objects from selection manager
+*/
+void LightApp_SelectionMgr::selectedObjects( QStringList& theList, const QString& theType,
+ const bool convertReferences ) const
+{
+ theList.clear();
+
+ SUIT_DataOwnerPtrList aList;
+ selected( aList, theType );
+
+ QString entry;
+ for ( SUIT_DataOwnerPtrList::const_iterator itr = aList.begin(); itr != aList.end(); ++itr )
+ {
+ const LightApp_DataOwner* owner = dynamic_cast<const LightApp_DataOwner*>( (*itr).operator->() );
+ if( !owner )
+ continue;
+
+ LightApp_Study* study = dynamic_cast<LightApp_Study*>( application()->activeStudy() );
+ if ( !study )
+ return;
+
+ entry = owner->entry();
+ if( !theList.contains( entry ) )
+ theList.append( entry );
+ }
+}
+
+#endif
+
/*!
Emit current selection changed.
*/
emit currentSelectionChanged();
}
+#ifndef DISABLE_SALOMEOBJECT
+
/*!
get map of indexes for the given SALOME_InteractiveObject
*/
}
}
}
+
+#endif
#include "LightApp.h"
#include <SUIT_SelectionMgr.h>
-#include <SALOME_InteractiveObject.hxx>
-#include <qmap.h>
+#ifndef DISABLE_SALOMEOBJECT
+ #include <SALOME_InteractiveObject.hxx>
+ #include <qmap.h>
+
+ class SALOME_ListIO;
+ class TColStd_IndexedMapOfInteger;
+ class TColStd_MapOfInteger;
+#else
+#include <qstringlist.h>
+#endif
-class SALOME_ListIO;
class LightApp_Application;
-class TColStd_IndexedMapOfInteger;
-class TColStd_MapOfInteger;
class LIGHTAPP_EXPORT LightApp_SelectionMgr : public SUIT_SelectionMgr
{
LightApp_SelectionMgr( LightApp_Application*, const bool = true );
virtual ~LightApp_SelectionMgr();
+ LightApp_Application* application() const;
+
+#ifndef DISABLE_SALOMEOBJECT
typedef QMap< Handle(SALOME_InteractiveObject), TColStd_IndexedMapOfInteger > MapIOOfMapOfInteger;
typedef QMap< QString, TColStd_IndexedMapOfInteger > MapEntryOfMapOfInteger;
- LightApp_Application* application() const;
-
void selectedObjects( SALOME_ListIO&, const QString& = QString::null, const bool = true ) const;
void setSelectedObjects( const SALOME_ListIO&, const bool = false );
void selectObjects( MapIOOfMapOfInteger theMapIO, bool append );
void selectedSubOwners( MapEntryOfMapOfInteger& theMap );
+#else
+ void selectedObjects( QStringList&, const QString& = QString::null, const bool = true ) const;
+#endif
signals:
void currentSelectionChanged();
#include "LightApp_SelectionMgr.h"
#include "LightApp_Selection.h"
-#include <SALOME_ListIO.hxx>
-#include <SALOME_ListIteratorOfListIO.hxx>
+#ifndef DISABLE_SALOMEOBJECT
+ #include <SALOME_ListIO.hxx>
+ #include <SALOME_ListIteratorOfListIO.hxx>
+#endif
LightApp_ShowHideOp::LightApp_ShowHideOp( ActionType type )
: LightApp_Operation(),
}
}
+ QStringList entries;
+
+#ifndef DISABLE_SALOMEOBJECT
SALOME_ListIO selObjs;
mgr->selectedObjects( selObjs );
-
- QStringList entries;
SALOME_ListIteratorOfListIO anIt( selObjs );
for( ; anIt.More(); anIt.Next() )
- {
- if( anIt.Value().IsNull() )
- continue;
+ if( !anIt.Value().IsNull() )
+#else
+ QStringList selObjs;
+ mgr->selectedObjects( selObjs );
+ QStringList::const_iterator anIt = selObjs.begin(), aLast = selObjs.end();
+ for( ; ; anIt!=aLast )
+#endif
+ {
+ QString entry =
+#ifndef DISABLE_SALOMEOBJECT
+ anIt.Value()->getEntry();
+#else
+ *anIt;
+#endif
- if( study->isComponent( anIt.Value()->getEntry() ) )
- study->children( anIt.Value()->getEntry(), entries );
- else
- entries.append( anIt.Value()->getEntry() );
- }
+ if( study->isComponent( entry ) )
+ study->children( entry, entries );
+ else
+ entries.append( entry );
+ }
for( QStringList::const_iterator it = entries.begin(), last = entries.end(); it!=last; it++ )
{
#include "LightApp_DataModel.h"
#include "LightApp_DataObject.h"
#include "LightApp_RootObject.h"
-// HDF persistence not yet completed
-//#include "LightApp_HDFDriver.h"
+#include "LightApp_HDFDriver.h"
#include "SUIT_ResourceMgr.h"
#include "SUIT_DataObjectIterator.h"
LightApp_Study::LightApp_Study( SUIT_Application* app )
: CAM_Study( app )
{
- // HDF persistence not yet completed
- //myDriver = new LightApp_HDFDriver();
- myDriver = new LightApp_Driver();
+ // HDF persistence
+ myDriver = new LightApp_HDFDriver();
+ //myDriver = new LightApp_Driver();
}
-
+
/*!
Destructor.
*/
*/
void LightApp_Study::createDocument()
{
+ setStudyName( QString( "Study%1" ).arg( LightApp_Application::studyId() ) );
+
// create myRoot
setRoot( new LightApp_RootObject( this ) );
//
// See http://www.salome-platform.org/
//
-#ifndef LIGHTAPP_STUDY_H\r
-#define LIGHTAPP_STUDY_H\r
-\r
-#include <LightApp.h>\r
-#include <LightApp_Driver.h>\r
-\r
-#include <CAM_Study.h>\r
-#include <CAM_DataModel.h>\r
-#include <SUIT_Study.h>\r
-\r
-#include "string"\r
-#include "vector"\r
-\r
-class SUIT_Application;\r
-class CAM_DataModel;\r
-\r
-class LIGHTAPP_EXPORT LightApp_Study : public CAM_Study\r
-{\r
- Q_OBJECT\r
-\r
-public:\r
- LightApp_Study( SUIT_Application* );\r
- virtual ~LightApp_Study();\r
-\r
- virtual void createDocument();\r
- virtual bool openDocument( const QString& );\r
- virtual bool loadDocument( const QString& ); \r
-\r
- virtual bool saveDocument();\r
- virtual bool saveDocumentAs( const QString& );\r
-\r
- virtual void closeDocument(bool permanently = true);\r
-\r
- virtual bool isSaved() const;\r
- virtual bool isModified() const;\r
-\r
- virtual void addComponent ( const CAM_DataModel* dm);\r
-\r
- virtual std::string GetTmpDir ( const char* theURL, const bool isMultiFile );\r
-\r
- virtual QString componentDataType( const QString& ) const;\r
- virtual QString referencedToEntry( const QString& ) const;\r
- virtual bool isComponent( const QString& ) const;\r
- virtual void children( const QString&, QStringList& ) const;\r
- virtual void components( QStringList& ) const;\r
-\r
-protected:\r
- virtual void saveModuleData ( QString theModuleName, QStringList theListOfFiles );\r
- virtual void openModuleData ( QString theModuleName, QStringList& theListOfFiles );\r
- virtual bool saveStudyData ( const QString& theFileName );\r
- virtual bool openStudyData ( const QString& theFileName );\r
-\r
- virtual std::vector<std::string> GetListOfFiles ( const char* theModuleName ) const;\r
- virtual void SetListOfFiles ( const char* theModuleName,\r
- const std::vector<std::string> theListOfFiles );\r
-\r
- virtual void RemoveTemporaryFiles ( const char* theModuleName, const bool isMultiFile ) const;\r
-\r
-protected:\r
- virtual bool openDataModel ( const QString&, CAM_DataModel* );\r
-\r
-signals:\r
- void saved ( SUIT_Study* );\r
- void opened ( SUIT_Study* );\r
- void closed ( SUIT_Study* );\r
- void created( SUIT_Study* );\r
-\r
-\r
-private:\r
- LightApp_Driver* myDriver;\r
-};\r
-\r
-#endif \r
+#ifndef LIGHTAPP_STUDY_H
+#define LIGHTAPP_STUDY_H
+
+#include <LightApp.h>
+#include <LightApp_Driver.h>
+
+#include <CAM_Study.h>
+#include <CAM_DataModel.h>
+#include <SUIT_Study.h>
+
+#include "string"
+#include "vector"
+
+class SUIT_Application;
+class CAM_DataModel;
+
+class LIGHTAPP_EXPORT LightApp_Study : public CAM_Study
+{
+ Q_OBJECT
+
+public:
+ LightApp_Study( SUIT_Application* );
+ virtual ~LightApp_Study();
+
+ virtual void createDocument();
+ virtual bool openDocument( const QString& );
+ virtual bool loadDocument( const QString& );
+
+ virtual bool saveDocument();
+ virtual bool saveDocumentAs( const QString& );
+
+ virtual void closeDocument(bool permanently = true);
+
+ virtual bool isSaved() const;
+ virtual bool isModified() const;
+
+ virtual void addComponent ( const CAM_DataModel* dm);
+
+ virtual std::string GetTmpDir ( const char* theURL, const bool isMultiFile );
+
+ virtual QString componentDataType( const QString& ) const;
+ virtual QString referencedToEntry( const QString& ) const;
+ virtual bool isComponent( const QString& ) const;
+ virtual void children( const QString&, QStringList& ) const;
+ virtual void components( QStringList& ) const;
+
+protected:
+ virtual void saveModuleData ( QString theModuleName, QStringList theListOfFiles );
+ virtual void openModuleData ( QString theModuleName, QStringList& theListOfFiles );
+ virtual bool saveStudyData ( const QString& theFileName );
+ virtual bool openStudyData ( const QString& theFileName );
+
+ virtual std::vector<std::string> GetListOfFiles ( const char* theModuleName ) const;
+ virtual void SetListOfFiles ( const char* theModuleName,
+ const std::vector<std::string> theListOfFiles );
+
+ virtual void RemoveTemporaryFiles ( const char* theModuleName, const bool isMultiFile ) const;
+
+protected:
+ virtual bool openDataModel ( const QString&, CAM_DataModel* );
+
+signals:
+ void saved ( SUIT_Study* );
+ void opened ( SUIT_Study* );
+ void closed ( SUIT_Study* );
+ void created( SUIT_Study* );
+
+
+private:
+ LightApp_Driver* myDriver;
+
+ friend class LightApp_Application;
+};
+
+#endif
#include "LightApp_VTKSelector.h"
#include "LightApp_DataOwner.h"
-#include "SVTK_ViewModelBase.h"
-#include "SVTK_Selector.h"
-#include "SVTK_ViewWindow.h"
-#include "SVTK_Functor.h"
+#ifndef DISABLE_VTKVIEWER
+ #include "SVTK_ViewModelBase.h"
+ #include "SVTK_Selector.h"
+ #include "SVTK_ViewWindow.h"
+ #include "SVTK_Functor.h"
+ #include "VTKViewer_Algorithm.h"
+ #include <vtkRenderer.h>
+#endif
-#include "SALOME_Actor.h"
-#include "SALOME_ListIteratorOfListIO.hxx"
+#ifndef DISABLE_SALOMEOBJECT
+ #include "SALOME_Actor.h"
+ #include "SALOME_ListIteratorOfListIO.hxx"
+#endif
-#include "VTKViewer_Algorithm.h"
-#include <vtkRenderer.h>
+#ifndef DISABLE_VTKVIEWER
+#ifndef DISABLE_SALOMEOBJECT
/*!
Constructor.
*/
{
myIds = theIds; // workaround - there is no constructor copy for the container
}
+#endif
/*!
Destuctor.
return myActor.GetPointer();
}
+#endif
+
+
+#ifndef DISABLE_VTKVIEWER
/*!
Constructor.
*/
return myViewer->getType();
}
+#endif
/*!
On selection changed.
*/
selectionChanged();
}
+#ifndef DISABLE_VTKVIEWER
+
/*!
Gets list of selected data owners.(output \a aList).
*/
}
}
}
+
+#endif
#ifndef LIGHTAPP_VTKSELECTOR_H
#define LIGHTAPP_VTKSELECTOR_H
-#include <vtkSmartPointer.h>
-
-#include <TColStd_IndexedMapOfInteger.hxx>
-
#include "SUIT_Selector.h"
-
#include "LightApp.h"
#include "LightApp_DataOwner.h"
-#include "SVTK_Selection.h"
-#include "SALOME_InteractiveObject.hxx"
-
-class SALOME_Actor;
-class SVTK_ViewModelBase;
+#ifndef DISABLE_VTKVIEWER
+ #include <vtkSmartPointer.h>
+ #include <TColStd_IndexedMapOfInteger.hxx>
+ #include "SVTK_Selection.h"
+#ifndef DISABLE_SALOMEOBJECT
+ #include "SALOME_InteractiveObject.hxx"
+#endif
+ class SALOME_Actor;
+ class SVTK_ViewModelBase;
+#endif
/*!
Provide salome vtk data owner list.
class LIGHTAPP_EXPORT LightApp_SVTKDataOwner : public LightApp_DataOwner
{
public:
+#ifndef DISABLE_VTKVIEWER
+ #ifndef DISABLE_SALOMEOBJECT
LightApp_SVTKDataOwner( const Handle(SALOME_InteractiveObject)& theIO,
const TColStd_IndexedMapOfInteger& theIds,
Selection_Mode theMode = ActorSelection,
SALOME_Actor* theActor = NULL);
+ #endif
virtual ~LightApp_SVTKDataOwner();
/*!Gets dataowners ids list.*/
TColStd_IndexedMapOfInteger myIds;
Selection_Mode mySelectionMode;
vtkSmartPointer<SALOME_Actor> myActor;
+#else
+ LightApp_SVTKDataOwner( const QString& );
+#endif
};
Q_OBJECT;
public:
+#ifndef DISABLE_VTKVIEWER
LightApp_VTKSelector( SVTK_ViewModelBase*, SUIT_SelectionMgr* );
virtual ~LightApp_VTKSelector();
SVTK_ViewModelBase* viewer() const;
virtual QString type() const;
+#else
+ LightApp_VTKSelector( SUIT_SelectionMgr* );
+#endif
private slots:
void onSelectionChanged();
+#ifndef DISABLE_VTKVIEWER
protected:
virtual void getSelection( SUIT_DataOwnerPtrList& ) const;
virtual void setSelection( const SUIT_DataOwnerPtrList& );
private:
SVTK_ViewModelBase* myViewer;
+
+#endif
};
#endif
LightApp_Dialog.h \
LightApp_Displayer.h \
LightApp_Driver.h \
- LightApp_GLSelector.h \
+ LightApp_HDFDriver.h \
LightApp_Module.h \
LightApp_ModuleDlg.h \
LightApp_NameDlg.h \
LightApp_OBFilter.h \
LightApp_OBSelector.h \
- LightApp_OCCSelector.h \
LightApp_Operation.h \
LightApp_Selection.h \
LightApp_SelectionMgr.h \
LightApp_PreferencesDlg.h \
LightApp_RootObject.h \
LightApp_UpdateFlags.h \
- LightApp_VTKSelector.h \
LightApp_WidgetContainer.h
-# LightApp_HDFDriver.h \
+
+ifneq ($(DISABLE_VTKVIEWER),yes)
+ifneq ($(DISABLE_SALOMEOBJECT),yes)
+ EXPORT_HEADERS+= LightApp_VTKSelector.h
+endif
+endif
+ifneq ($(DISABLE_OCCVIEWER),yes)
+ EXPORT_HEADERS+= LightApp_OCCSelector.h
+endif
+ifneq ($(DISABLE_GLVIEWER),yes)
+ EXPORT_HEADERS+= LightApp_GLSelector.h
+endif
# .po files to transform in .qm
PO_FILES = LightApp_images.po \
LightApp_Dialog.cxx \
LightApp_Displayer.cxx \
LightApp_Driver.cxx \
- LightApp_GLSelector.cxx \
+ LightApp_HDFDriver.cxx \
LightApp_Module.cxx \
LightApp_ModuleDlg.cxx \
LightApp_NameDlg.cxx \
LightApp_OBFilter.cxx \
LightApp_OBSelector.cxx \
- LightApp_OCCSelector.cxx \
LightApp_Operation.cxx \
LightApp_Selection.cxx \
LightApp_SelectionMgr.cxx \
LightApp_SwitchOp.cxx \
LightApp_Preferences.cxx \
LightApp_PreferencesDlg.cxx \
- LightApp_VTKSelector.cxx \
LightApp_WidgetContainer.cxx
-# LightApp_HDFDriver.cxx \
+
+ifneq ($(DISABLE_VTKVIEWER),yes)
+ifneq ($(DISABLE_SALOMEOBJECT),yes)
+ LIB_SRC+= LightApp_VTKSelector.cxx
+endif
+endif
+ifneq ($(DISABLE_OCCVIEWER),yes)
+ LIB_SRC+= LightApp_OCCSelector.cxx
+endif
+ifneq ($(DISABLE_GLVIEWER),yes)
+ LIB_SRC+= LightApp_GLSelector.cxx
+endif
LIB_MOC = LightApp_AboutDlg.h \
LightApp_Application.h \
LightApp_DataModel.h \
LightApp_Dialog.h \
- LightApp_GLSelector.h \
LightApp_OBSelector.h \
- LightApp_OCCSelector.h \
LightApp_Operation.h \
LightApp_Module.h \
LightApp_ModuleDlg.h \
LightApp_SwitchOp.h \
LightApp_Preferences.h \
LightApp_PreferencesDlg.h \
- LightApp_VTKSelector.h \
LightApp_WidgetContainer.h
+ifneq ($(DISABLE_VTKVIEWER),yes)
+ifneq ($(DISABLE_SALOMEOBJECT),yes)
+ LIB_MOC+= LightApp_VTKSelector.h
+endif
+endif
+ifneq ($(DISABLE_OCCVIEWER),yes)
+ LIB_MOC+= LightApp_OCCSelector.h
+endif
+ifneq ($(DISABLE_GLVIEWER),yes)
+ LIB_MOC+= LightApp_GLSelector.h
+endif
+
RESOURCES_FILES = icon_about.png \
icon_applogo.png \
icon_default.png \
LightApp.ini \
LightApp.xml
-CPPFLAGS+=$(PYTHON_INCLUDES) $(QT_INCLUDES) $(QWT_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES)
- #$(HDF5_INCLUDES)
+CPPFLAGS+=$(PYTHON_INCLUDES) $(QT_INCLUDES) $(OCC_INCLUDES) \
+ $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
+
+ifneq ($(DISABLE_VTKVIEWER),yes)
+ CPPFLAGS+= $(VTK_INCLUDES)
+else
+ CPPFLAGS+= -DDISABLE_VTKVIEWER
+endif
+ifneq ($(DISABLE_PLOT2DVIEWER),yes)
+ CPPFLAGS+= $(QWT_INCLUDES)
+else
+ CPPFLAGS+= -DDISABLE_PLOT2DVIEWER
+endif
+ifeq ($(DISABLE_OCCVIEWER),yes)
+ CPPFLAGS+= -DDISABLE_OCCVIEWER
+endif
+ifneq ($(DISABLE_PYCONSOLE),yes)
+ CPPFLAGS+= $(PYTHON_INCLUDES)
+else
+ CPPFLAGS+= -DDISABLE_PYCONSOLE
+endif
+ifeq ($(DISABLE_GLVIEWER),yes)
+ CPPFLAGS+= -DDISABLE_GLVIEWER
+endif
+ifeq ($(DISABLE_SUPERVGRAPHVIEWER),yes)
+ CPPFLAGS+= -DDISABLE_SUPERVGRAPHVIEWER
+endif
+ifeq ($(DISABLE_SALOMEOBJECT),yes)
+ CPPFLAGS+= -DDISABLE_SALOMEOBJECT
+endif
+
+LDFLAGS+=$(QT_MT_LIBS)
+ifneq ($(DISABLE_PYCONSOLE),yes)
+ LDFLAGS+= $(PYTHON_LIBS)
+endif
+
+LIBS+= -lsuit -lstd -lCAM -lObjBrowser -lLogWindow $(CAS_KERNEL) -lSalomePrs \
+ $(HDF5_LIBS) -L$(KERNEL_ROOT_DIR)/lib/salome -lSalomeHDFPersist
-LDFLAGS+=$(PYTHON_LIBS) $(QT_MT_LIBS)
-LIBS+= -lsuit -lstd -lCAM -lObjBrowser -lLogWindow $(CAS_KERNEL) -lGLViewer -lOCCViewer -lVTKViewer -lSalomeObject -lSOCC -lSVTK -lSPlot2d -lSUPERVGraph -lPyInterp -lPythonConsole
- #$(HDF5_LIBS) -lSalomeHDFPersistCopy
+ifneq ($(DISABLE_SALOMEOBJECT),yes)
+ LIBS+= -lSalomeObject
+endif
+ifneq ($(DISABLE_VTKVIEWER),yes)
+ LIBS+= -lVTKViewer
+ifneq ($(DISABLE_SALOMEOBJECT),yes)
+ LIBS+= -lSVTK
+endif
+endif
+ifneq ($(DISABLE_OCCVIEWER),yes)
+ LIBS+= -lOCCViewer
+ifneq ($(DISABLE_SALOMEOBJECT),yes)
+ LIBS+= -lSOCC
+endif
+endif
+ifneq ($(DISABLE_GLVIEWER),yes)
+ LIBS+= -lGLViewer
+endif
+ifneq ($(DISABLE_PLOT2DVIEWER),yes)
+ LIBS+= -lPlot2d
+ifneq ($(DISABLE_SALOMEOBJECT),yes)
+ LIBS+= -lSPlot2d
+endif
+endif
+ifneq ($(DISABLE_PYCONSOLE),yes)
+ LIBS+= -lPyInterp -lPythonConsole
+endif
+ifneq ($(DISABLE_SUPERVGRAPHVIEWER),yes)
+ LIBS+= -lSUPERVGraph
+endif
@CONCLUDE@
<document>
<section name="desktop" >
- <parameter name="state" value="max"/>
- <parameter name="pos_x" value="100"/>
- <parameter name="pos_y" value="050"/>
- <parameter name="width" value="640"/>
- <parameter name="height" value="480"/>
+ <parameter name="state" value="normal"/>
+ <parameter name="pos_x" value="center"/>
+ <parameter name="pos_y" value="center"/>
+ <parameter name="width" value="800"/>
+ <parameter name="height" value="600"/>
</section>
<section name="launch">
<parameter name="gui" value="yes"/>
msgid "LightApp_ModuleDlg::ActivateComponent_DESCRIPTION"
msgstr "Create, open or load study."
+
+msgid "LightApp_NameDlg::TLT_RENAME"
+msgstr "Rename"
+
+msgid "LightApp_NameDlg::NAME_LBL"
+msgstr "Name: "
@COMMENCE@
-SUBDIRS = Qtx DDS QDS SUIT STD CAF CAM SUITApp VTKViewer OCCViewer GLViewer \
- LogWindow Event OBJECT Prs PyInterp PythonConsole ObjBrowser \
- RegistryDisplay Plot2d TOOLSGUI SOCC SVTK SPlot2d SUPERVGraph \
- LightApp Session SalomeApp SALOME_SWIG SALOME_PY SALOME_PYQT Style ResExporter
+SUBDIRS = Qtx DDS QDS SUIT STD CAF CAM SUITApp LogWindow ObjBrowser Prs
+
+ifneq ($(DISABLE_SALOMEOBJECT),yes)
+ SUBDIRS += OBJECT
+endif
+
+ifneq ($(DISABLE_GLVIEWER),yes)
+ SUBDIRS += GLViewer
+endif
+
+ifneq ($(DISABLE_VTKVIEWER),yes)
+ SUBDIRS += VTKViewer
+ifneq ($(DISABLE_SALOMEOBJECT),yes)
+ SUBDIRS += SVTK
+endif
+endif
+ifneq ($(DISABLE_OCCVIEWER),yes)
+ SUBDIRS += OCCViewer
+ifneq ($(DISABLE_SALOMEOBJECT),yes)
+ SUBDIRS += SOCC
+endif
+endif
+ifneq ($(DISABLE_PYCONSOLE),yes)
+ SUBDIRS += PyInterp PythonConsole
+endif
+ifneq ($(DISABLE_PLOT2DVIEWER),yes)
+ SUBDIRS += Plot2d
+ifneq ($(DISABLE_SALOMEOBJECT),yes)
+ SUBDIRS += SPlot2d
+endif
+endif
+ifneq ($(DISABLE_SUPERVGRAPHVIEWER),yes)
+ SUBDIRS += SUPERVGraph
+endif
+SUBDIRS += LightApp Style ResExporter
+
+ifneq ($(GUI_DISABLE_CORBA),yes)
+ SUBDIRS += RegistryDisplay TOOLSGUI \
+ Event Session SalomeApp SALOME_SWIG SALOME_PY SALOME_PYQT
+endif
+
+ifeq (@cppunit_ok@,yes)
+ifneq ($(GUI_DISABLE_CORBA),yes)
+ SUBDIRS+= \
+ SalomeApp/Test
+endif
+endif
@MODULE@
EXPORT_HEADERS = SALOME_InteractiveObject.hxx \
Handle_SALOME_InteractiveObject.hxx \
- SALOME_GLOwner.h \
SALOME_AISShape.hxx \
Handle_SALOME_AISShape.hxx \
SALOME_AISObject.hxx \
LIB = libSalomeObject.la
LIB_SRC = SALOME_InteractiveObject.cxx \
- SALOME_GLOwner.cxx \
SALOME_AISShape.cxx\
SALOME_AISObject.cxx\
SALOME_ListIO_0.cxx \
BIN =
BIN_SRC =
-CPPFLAGS+=$(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(QT_INCLUDES) $(OGL_INCLUDES)
-LDFLAGS+= $(PYTHON_LIBS) $(VTK_LIBS) $(QT_LIBS) $(OGL_LIBS) $(CAS_LDPATH) -lTKV3d -lVTKViewer -lsuit
+CPPFLAGS+=$(QT_INCLUDES) $(OCC_INCLUDES)
+LDFLAGS+= $(QT_LIBS) $(CAS_LDPATH) -lTKV3d
@CONCLUDE@
+++ /dev/null
-// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, 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/
-//
-
-#include <SALOME_GLOwner.h>
-
-SALOME_GLOwner::SALOME_GLOwner( const char* entry )
-: GLViewer_Owner()
-{
- setEntry( entry );
-}
-
-SALOME_GLOwner::~SALOME_GLOwner()
-{
-}
-
-const char* SALOME_GLOwner::entry() const
-{
- return myEntry.c_str();
-}
-
-void SALOME_GLOwner::setEntry( const char* entry )
-{
- myEntry = entry;
-}
+++ /dev/null
-// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, 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/
-//
-#ifndef SALOME_GLOWNER_H
-#define SALOME_GLOWNER_H
-
-#include <string>
-//#include <GLViewer.h>
-#include <GLViewer_Object.h>
-
-#ifdef WNT
-#define SALOME_OBJECT_EXPORT __declspec (dllexport)
-#else
-#define SALOME_OBJECT_EXPORT
-#endif
-
-class SALOME_OBJECT_EXPORT SALOME_GLOwner : public GLViewer_Owner
-{
-public:
- SALOME_GLOwner( const char* );
- ~SALOME_GLOwner();
-
- const char* entry() const;
- void setEntry( const char* );
-
-private:
- std::string myEntry;
-};
-
-#endif
#include <Xw_Window.hxx>
#include <Graphic3d_GraphicDevice.hxx>
#include <Xw_Driver.hxx>
-#include <Xdps_Driver.hxx>
+//#include <Xdps_Driver.hxx>
#include <Xw_TypeOfMapping.hxx>
#endif
Creates Xdps window driver [ static ]
On Win32 the same as OCCViewer_VService::WindowDriver()
*/
+/*
Handle(Aspect_WindowDriver) OCCViewer_VService::XdpsDriver( const Standard_CString aDisplay,
const Standard_Integer ahiwin,
const Standard_Integer alowin,
return new Xdps_Driver( W );
#endif
}
-
+*/
/*!
Creates Xw window driver [ static ]
On Win32 the same as OCCViewer_VService::WindowDriver()
const Standard_Integer hiwin,
const Standard_Integer lowin,
const Quantity_NameOfColor color = Quantity_NOC_GRAY69 );
- static Handle_Aspect_WindowDriver
+ /*static Handle_Aspect_WindowDriver
XdpsDriver( const Standard_CString display,
const Standard_Integer hiwin,
const Standard_Integer lowin,
const Quantity_NameOfColor color = Quantity_NOC_GRAY69 );
+ */
static Handle_Aspect_WindowDriver
ImageDriver( const Standard_CString display,
const Standard_Integer hiwin,
//****************************************************************
void OCCViewer_ViewWindow::onMemorizeView()
{
- double centerX, centerY, projX, projY, projZ, twist;
- double atX, atY, atZ, eyeX, eyeY, eyeZ;
-
- Handle(V3d_View) aView3d = myViewPort->getView();
-
- aView3d->Center( centerX, centerY );
- aView3d->Proj( projX, projY, projZ );
- aView3d->At( atX, atY, atZ );
- aView3d->Eye( eyeX, eyeY, eyeZ );
- twist = aView3d->Twist();
-
- viewAspect params;
- QString aName = QTime::currentTime().toString() + QString::fromLatin1( " h:m:s" );
-
- params.scale = aView3d->Scale();
- params.centerX = centerX;
- params.centerY = centerY;
- params.projX = projX;
- params.projY = projY;
- params.projZ = projZ;
- params.twist = twist;
- params.atX = atX;
- params.atY = atY;
- params.atZ = atZ;
- params.eyeX = eyeX;
- params.eyeY = eyeY;
- params.eyeZ = eyeZ;
- params.name = aName;
-
- myModel->appendViewAspect( params );
-
+ myModel->appendViewAspect( getViewParams() );
}
//****************************************************************
Standard_Boolean prev = aView3d->SetImmediateUpdate( Standard_False );
aView3d->SetScale( anItem.scale );
aView3d->SetCenter( anItem.centerX, anItem.centerY );
- aView3d->SetProj( anItem.projX, anItem.projY, anItem.projZ );
aView3d->SetTwist( anItem.twist );
aView3d->SetAt( anItem.atX, anItem.atY, anItem.atZ );
aView3d->SetImmediateUpdate( prev );
aView3d->SetEye( anItem.eyeX, anItem.eyeY, anItem.eyeZ );
+ aView3d->SetProj( anItem.projX, anItem.projY, anItem.projZ );
myRestoreFlag = 0;
}
v->Update();
v->Redraw();
}
+
+/*! The method returns the visual parameters of this view as a viewAspect object
+ */
+viewAspect OCCViewer_ViewWindow::getViewParams() const
+{
+ double centerX, centerY, projX, projY, projZ, twist;
+ double atX, atY, atZ, eyeX, eyeY, eyeZ;
+
+ Handle(V3d_View) aView3d = myViewPort->getView();
+
+ aView3d->Center( centerX, centerY );
+ aView3d->Proj( projX, projY, projZ );
+ aView3d->At( atX, atY, atZ );
+ aView3d->Eye( eyeX, eyeY, eyeZ );
+ twist = aView3d->Twist();
+
+ QString aName = QTime::currentTime().toString() + QString::fromLatin1( " h:m:s" );
+
+ viewAspect params;
+ params.scale = aView3d->Scale();
+ params.centerX = centerX;
+ params.centerY = centerY;
+ params.projX = projX;
+ params.projY = projY;
+ params.projZ = projZ;
+ params.twist = twist;
+ params.atX = atX;
+ params.atY = atY;
+ params.atZ = atZ;
+ params.eyeX = eyeX;
+ params.eyeY = eyeY;
+ params.eyeZ = eyeZ;
+ params.name = aName;
+
+ return params;
+}
+
+
+/*! The method returns the visual parameters of this view as a formated string
+ */
+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,
+ params.centerX, params.centerY, params.projX, params.projY, params.projZ, params.twist,
+ params.atX, params.atY, params.atZ, params.eyeX, params.eyeY, params.eyeZ );
+ return retStr;
+}
+
+/* The method restors visual parameters of this view from a formated string
+ */
+void OCCViewer_ViewWindow::setVisualParameters( const QString& parameters )
+{
+ QStringList paramsLst = QStringList::split( '*', parameters, true );
+ if ( paramsLst.size() == 13 ) {
+ viewAspect params;
+ params.scale = paramsLst[0].toDouble();
+ params.centerX = paramsLst[1].toDouble();
+ params.centerY = paramsLst[2].toDouble();
+ params.projX = paramsLst[3].toDouble();
+ params.projY = paramsLst[4].toDouble();
+ params.projZ = paramsLst[5].toDouble();
+ params.twist = paramsLst[6].toDouble();
+ params.atX = paramsLst[7].toDouble();
+ params.atY = paramsLst[8].toDouble();
+ params.atZ = paramsLst[9].toDouble();
+ params.eyeX = paramsLst[10].toDouble();
+ params.eyeY = paramsLst[11].toDouble();
+ params.eyeZ = paramsLst[12].toDouble();
+
+ performRestoring( params );
+ }
+}
void setCuttingPlane( bool on, const double x = 0 , const double y = 0 , const double z = 0,
const double dx = 0, const double dy = 0, const double dz = 1);
+
+ virtual QString getVisualParameters();
+ virtual void setVisualParameters( const QString& parameters );
public slots:
void onFrontView();
virtual OperationType getButtonState(QMouseEvent* theEvent);
+ viewAspect getViewParams() const;
+
OperationType myOperation;
OCCViewer_Viewer* myModel;
OCCViewer_ViewPort3d* myViewPort;
msgstr "Dump view"
msgid "DSC_CLIPPING"
-msgstr "Define clipping plane"
+msgstr "Set clipping plane"
msgid "MNU_CLIPPING"
msgstr "Clipping"
ItemPtr OB_BrowserSync::createItem( const ObjPtr& src,
const ItemPtr& parent, const ItemPtr& after,
- const bool asFirst ) const
+ const bool prepend ) const
{
- ItemPtr i = myBrowser ? dynamic_cast<ItemPtr>( myBrowser->createItem( src, parent, after, asFirst ) ) : 0;
+ ItemPtr i = myBrowser ? dynamic_cast<ItemPtr>( myBrowser->createItem( src, parent, after, prepend ) ) : 0;
if( i )
i->setOpen( src->isOpen() );
return i;
if ( !startObj || startObj->root() != getRootObject() )
return;
- if( startObj==myRoot )
+ if ( startObj == myRoot )
{
DataObjectList ch;
myRoot->children( ch );
{
OB_BrowserSync sync( this );
OB_ListItem* local_item = dynamic_cast<OB_ListItem*>( listViewItem( local_root ) );
-
- // QString srcName = ( local_root && !local_root->name().isNull() ) ? local_root->name() : "";
- // QString trgName = ( local_item && !local_item->text(0).isNull() ) ? local_item->text(0) : "";
- // printf( "--- OB_Browser::updateView() calls synchronize()_1: src = %s, trg = %s ---\n", srcName.latin1(), trgName.latin1() );
-
synchronize<ObjPtr,ItemPtr,OB_BrowserSync>( local_root, local_item, sync );
exist[local_root] = 0;
}
ItemMap::const_iterator anIt = exist.begin(), aLast = exist.end();
for( ; anIt!=aLast; anIt++ )
- if( anIt.data() )
+ {
+ if( anIt.data() ) // exist[local_root]==1 -> this local root was NOT in data model, should be removed
{
removeReferences( anIt.data() );
OB_ListItem* item = dynamic_cast<OB_ListItem*>( anIt.data() );
if( item && myItems.contains( item->dataObject() ) )
delete anIt.data();
}
+ }
}
else
{
OB_BrowserSync sync( this );
OB_ListItem* startItem = dynamic_cast<OB_ListItem*>( listViewItem( startObj ) );
-
- // QString srcName = ( startObj && !startObj->name().isNull() ) ? startObj->name() : "";
- // QString trgName = ( startItem && !startItem->text(0).isNull() ) ? startItem->text(0) : "";
- // printf( "--- OB_Browser::updateView() calls synchronize()_2: src = %s, trg = %s ---\n", srcName.latin1(), trgName.latin1() );
-
synchronize<ObjPtr,ItemPtr,OB_BrowserSync>( startObj, startItem, sync );
}
}
QListViewItem* OB_Browser::createItem( const SUIT_DataObject* o, QListViewItem* parent,
- QListViewItem* after, const bool asFirstChild )
+ QListViewItem* after, const bool prepend )
{
QListView* lv = listView();
if ( parent )
{
- if ( parent->childCount() && !after )
+ if ( after )
{
- after = parent->firstChild();
- while ( after->nextSibling() )
- after = after->nextSibling();
+ if ( type == -1 )
+ item = new OB_ListItem( obj, parent, after );
+ else
+ item = new OB_CheckListItem( obj, parent, after, (QCheckListItem::Type)type );
}
-
- if ( after && !asFirstChild )
+ else if ( prepend )
{
if ( type == -1 )
- item = new OB_ListItem( obj, parent, after );
+ item = new OB_ListItem( obj, parent );
else
- item = new OB_CheckListItem( obj, parent, after, (QCheckListItem::Type)type );
+ item = new OB_CheckListItem( obj, parent, (QCheckListItem::Type)type );
}
- else
+ else // append
{
+ after = parent->firstChild();
+ while ( after && after->nextSibling() )
+ after = after->nextSibling();
if ( type == -1 )
- item = new OB_ListItem( obj, parent );
+ item = new OB_ListItem( obj, parent, after );
else
- item = new OB_CheckListItem( obj, parent, (QCheckListItem::Type)type );
+ item = new OB_CheckListItem( obj, parent, after, (QCheckListItem::Type)type );
}
}
- else // ROOT item
+ else
{
- if ( type == -1 )
- item = new OB_ListItem( obj, lv );
- else
- item = new OB_CheckListItem( obj, lv, (QCheckListItem::Type)type );
+ if ( after )
+ {
+ if ( type == -1 )
+ item = new OB_ListItem( obj, lv, after );
+ else
+ item = new OB_CheckListItem( obj, lv, after, (QCheckListItem::Type)type );
+ }
+ else if ( prepend )
+ {
+ if ( type == -1 )
+ item = new OB_ListItem( obj, lv );
+ else
+ item = new OB_CheckListItem( obj, lv, (QCheckListItem::Type)type );
+ }
+ else // append
+ {
+ after = lv->firstChild();
+ while ( after && after->nextSibling() )
+ after = after->nextSibling();
+ if ( type == -1 )
+ item = new OB_ListItem( obj, lv, after );
+ else
+ item = new OB_CheckListItem( obj, lv, after, (QCheckListItem::Type)type );
+ }
}
myItems.insert( obj, item );
return res;
#endif
}
+
+QString Plot2d_ViewFrame::getVisualParameters()
+{
+ double xmin, xmax, ymin, ymax, y2min, y2max;
+ getFitRanges( xmin, xmax, ymin, ymax, y2min, y2max );
+ QString retStr;
+ retStr.sprintf( "%d*%d*%d*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e", myXMode,
+ myYMode, mySecondY, xmin, xmax, ymin, ymax, y2min, y2max );
+ return retStr;
+}
+
+void Plot2d_ViewFrame::setVisualParameters( const QString& parameters )
+{
+ QStringList paramsLst = QStringList::split( '*', parameters, true );
+ if ( paramsLst.size() == 9 ) {
+ double xmin, xmax, ymin, ymax, y2min, y2max;
+ myXMode = paramsLst[0].toInt();
+ myYMode = paramsLst[1].toInt();
+ mySecondY = (bool)paramsLst[2].toInt();
+ xmin = paramsLst[3].toDouble();
+ xmax = paramsLst[4].toDouble();
+ ymin = paramsLst[5].toDouble();
+ ymax = paramsLst[6].toDouble();
+ y2min = paramsLst[7].toDouble();
+ y2max = paramsLst[8].toDouble();
+
+ if (mySecondY)
+ setTitle( myY2TitleEnabled, myY2Title, Y2Title, false );
+ setHorScaleMode( myXMode, /*update=*/false );
+ setVerScaleMode( myYMode, /*update=*/false );
+
+ if (mySecondY) {
+ QwtDiMap yMap2 = myPlot->canvasMap( QwtPlot::yRight );
+ myYDistance2 = yMap2.d2() - yMap2.d1();
+ }
+
+ fitData( 0, xmin, xmax, ymin, ymax, y2min, y2max );
+ fitData( 0, xmin, xmax, ymin, ymax, y2min, y2max );
+ }
+}
virtual bool print( const QString& file, const QString& format ) const;
+ QString getVisualParameters();
+ void setVisualParameters( const QString& parameters );
+
protected:
int testOperation( const QMouseEvent& );
void readPreferences();
{
return SUIT_ViewWindow::filter() + ";;" + tr( "POSTSCRIPT_FILES" );
}
+
+/*! The method returns the visual parameters of this view as a formated string
+ */
+QString Plot2d_ViewWindow::getVisualParameters()
+{
+ return myViewFrame->getVisualParameters();
+}
+
+/* The method restors visual parameters of this view from a formated string
+ */
+void Plot2d_ViewWindow::setVisualParameters( const QString& parameters )
+{
+ myViewFrame->setVisualParameters( parameters );
+}
QToolBar* getToolBar() { return myToolBar; };
void contextMenuPopup( QPopupMenu* thePopup );
+ virtual QString getVisualParameters();
+ virtual void setVisualParameters( const QString& parameters );
+
protected:
virtual QImage dumpView();
virtual QString filter() const;
// Create cStringIO to capture stdout and stderr
PycString_IMPORT;
- _vout = PycStringIO->NewOutput(128);
- _verr = PycStringIO->NewOutput(128);
+ if (PycStringIO) { // CTH11627 : additional check
+ _vout = PycStringIO->NewOutput(128);
+ _verr = PycStringIO->NewOutput(128);
+ }
// All the initRun outputs are redirected to the standard output (console)
initRun();
-# File : Makefile.in\r# Author : Vladimir Klyachin (OCN)
+# File : Makefile.in
+# Author : Vladimir Klyachin (OCN)
# Module : suit
# $Header$
class QtxActionMenuMgr::MenuAction : public QtxAction
{
public:
- MenuAction( const QString&, const QString&, QObject* );
+ MenuAction( const QString&, const QString&, QObject*, const bool = false );
virtual ~MenuAction();
virtual bool addTo( QWidget* );
private:
int myId;
QPopupMenu* myPopup;
+ bool myEmptyEnabled;
};
-QtxActionMenuMgr::MenuAction::MenuAction( const QString& text, const QString& menuText, QObject* parent )
+QtxActionMenuMgr::MenuAction::MenuAction( const QString& text,
+ const QString& menuText,
+ QObject* parent,
+ const bool allowEmpty )
: QtxAction( text, menuText, 0, parent ),
-myId( -1 ),
-myPopup( 0 )
+ myId( -1 ),
+ myPopup( 0 ),
+ myEmptyEnabled( allowEmpty )
{
myPopup = new QPopupMenu();
}
if ( !w->inherits( "QPopupMenu" ) && !w->inherits( "QMenuBar" ) )
return false;
+ if ( !myPopup )
+ return false;
+
+ if ( !myEmptyEnabled && !myPopup->count() )
+ return false;
+
if ( w->inherits( "QPopupMenu" ) && QAction::addTo( w ) )
{
QPopupMenu* pm = (QPopupMenu*)w;
myRoot.id = -1;
myRoot.group = -1;
- if ( myMenu )
+ if ( myMenu ) {
connect( myMenu, SIGNAL( destroyed( QObject* ) ), this, SLOT( onDestroyed( QObject* ) ) );
+ if ( myMenu->inherits( "QMenuBar" ) )
+ connect( myMenu, SIGNAL( highlighted( int ) ), this, SLOT( onHighlighted( int ) ) );
+ }
}
QtxActionMenuMgr::QtxActionMenuMgr( QWidget* mw, QObject* p )
MenuNode* node = new MenuNode( pNode );
node->id = id;
+ node->idx = idx;
node->group = group;
- if ( idx < 0 || idx >= (int)pNode->children.count() )
- pNode->children.append( node );
- else
- pNode->children.insert( idx, node );
+ pNode->children.append( node );
updateMenu( pNode, false );
return insert( registerAction( a ), pId, group, idx );
}
-int QtxActionMenuMgr::insert( const QString& title, const int pId, const int group, const int idx )
+int QtxActionMenuMgr::insert( const QString& title, const int pId, const int group, const int id, const int idx, const bool allowEmpty )
{
MenuNode* pNode = pId == -1 ? &myRoot : find( pId );
if ( !pNode )
return -1;
- int id = -1;
- for ( NodeListIterator it( pNode->children ); it.current() && id == -1; ++it )
+ MenuNode* eNode = id == -1 ? 0 : find( id );
+
+ int fid = -1;
+ for ( NodeListIterator it( pNode->children ); it.current() && fid == -1; ++it )
{
if ( myMenus.contains( it.current()->id ) &&
clearTitle( myMenus[it.current()->id]->menuText() ) == clearTitle( title ) )
- id = it.current()->id;
+ fid = it.current()->id;
}
- if ( id != -1 )
- return id;
+ if ( fid != -1 )
+ return fid;
- MenuAction* ma = new MenuAction( clearTitle( title ), title, this );
+ MenuAction* ma = new MenuAction( clearTitle( title ), title, this, allowEmpty );
+ connect( ma->popup(), SIGNAL( highlighted( int ) ), this, SLOT( onHighlighted( int ) ) );
MenuNode* node = new MenuNode( pNode );
node->group = group;
- node->id = myMenus.insert( generateId(), ma ).key();
+ node->idx = idx;
+ node->id = myMenus.insert( (id == -1 || eNode ) ? generateId() : id, ma ).key();
- if ( idx < 0 || idx >= (int)pNode->children.count() )
- pNode->children.append( node );
- else
- pNode->children.insert( idx, node );
+ pNode->children.append( node );
updateMenu( pNode, false );
return node->id;
}
-int QtxActionMenuMgr::insert( const QString& title, const QString& menus, const int group, const int idx )
+int QtxActionMenuMgr::insert( const QString& title, const QString& menus, const int group, const int id, const int idx, const bool allowEmpty )
{
- return insert( title, QStringList::split( "|", menus ), group, idx );
+ return insert( title, QStringList::split( "|", menus ), group, id, idx, allowEmpty );
}
-int QtxActionMenuMgr::insert( const QString& title, const QStringList& menus, const int group, const int idx )
+int QtxActionMenuMgr::insert( const QString& title, const QStringList& menus, const int group, const int id, const int idx, const bool allowEmpty )
{
int pId = createMenu( menus, -1 );
- return insert( title, pId, group, idx );
+ return insert( title, pId, group, id, idx, allowEmpty );
}
-int QtxActionMenuMgr::append( const QString& title, const int pId, const int group )
+int QtxActionMenuMgr::append( const QString& title, const int pId, const int group, const int id, const bool allowEmpty )
{
- return insert( title, pId, group );
+ return insert( title, pId, group, id, allowEmpty );
}
int QtxActionMenuMgr::append( const int id, const int pId, const int group )
return insert( a, pId, group );
}
-int QtxActionMenuMgr::prepend( const QString& title, const int pId, const int group )
+int QtxActionMenuMgr::prepend( const QString& title, const int pId, const int group, const int id, const bool allowEmpty )
{
- return insert( title, pId, group, 0 );
+ return insert( title, pId, group, id, 0, allowEmpty );
}
int QtxActionMenuMgr::prepend( const int id, const int pId, const int group )
void QtxActionMenuMgr::remove( const int id, const int pId, const int group )
{
- MenuNode* pNode = find( pId );
+ MenuNode* pNode = pId == -1 ? &myRoot : find( pId );
if ( !pNode )
return;
myMenu = 0;
}
+void QtxActionMenuMgr::onHighlighted( int id )
+{
+ const QObject* snd = sender();
+ int pid = 0, realId;
+ if ( myMenu && snd == myMenu )
+ pid = -1;
+ else {
+ for ( MenuMap::Iterator itr = myMenus.begin(); itr != myMenus.end(); ++itr ) {
+ if ( itr.data()->popup() && itr.data()->popup() == snd )
+ pid = itr.key();
+ }
+ }
+ if ( pid ) {
+ realId = findId( id, pid );
+ if ( realId != -1 ) {
+ bool updatesEnabled = isUpdatesEnabled();
+ setUpdatesEnabled( false );
+ emit menuHighlighted( pid, realId );
+ setUpdatesEnabled( updatesEnabled );
+ updateMenu( find( realId ) );
+ }
+ }
+}
+
void QtxActionMenuMgr::setWidget( QWidget* mw )
{
if ( myMenu == mw )
connect( myMenu, SIGNAL( destroyed( QObject* ) ), this, SLOT( onDestroyed( QObject* ) ) );
}
-QtxActionMenuMgr::MenuNode* QtxActionMenuMgr::find( const int actId, const int pId ) const
+QtxActionMenuMgr::MenuNode* QtxActionMenuMgr::find( const int actId, const int pId, const bool rec ) const
{
- return find( actId, find( pId ) );
+ return find( actId, find( pId ), rec );
}
-QtxActionMenuMgr::MenuNode* QtxActionMenuMgr::find( const int id, MenuNode* startNode ) const
+QtxActionMenuMgr::MenuNode* QtxActionMenuMgr::find( const int id, MenuNode* startNode, const bool rec ) const
{
MenuNode* node = 0;
MenuNode* start = startNode ? startNode : (MenuNode*)&myRoot;
{
if ( it.current()->id == id )
node = it.current();
- else
- node = find( id, it.current() );
+ else if ( rec )
+ node = find( id, it.current(), rec );
}
return node;
}
return !lst.isEmpty();
}
+QtxActionMenuMgr::MenuNode* QtxActionMenuMgr::find( const QString& title, const int pId, const bool rec ) const
+{
+ return find( title, find( pId ), rec );
+}
+
+bool QtxActionMenuMgr::find( const QString& title, NodeList& lst, MenuNode* startNode ) const
+{
+ MenuNode* start = startNode ? startNode : (MenuNode*)&myRoot;
+ for ( NodeListIterator it( start->children ); it.current(); ++it )
+ {
+ QAction* a = itemAction( it.current()->id );
+ if ( !a )
+ a = menuAction( it.current()->id );
+ if ( a && clearTitle( a->menuText() ) == clearTitle( title ) )
+ lst.prepend( it.current() );
+
+ find( title, lst, it.current() );
+ }
+ return !lst.isEmpty();
+}
+
+QtxActionMenuMgr::MenuNode* QtxActionMenuMgr::find( const QString& title, MenuNode* startNode, const bool rec ) const
+{
+ MenuNode* node = 0;
+ MenuNode* start = startNode ? startNode : (MenuNode*)&myRoot;
+ for ( NodeListIterator it( start->children ); it.current() && !node; ++it )
+ {
+ QAction* a = itemAction( it.current()->id );
+ if ( !a )
+ a = menuAction( it.current()->id );
+ if ( a && clearTitle( a->menuText() ) == clearTitle( title ) )
+ node = it.current();
+ if ( !node && rec )
+ node = find( title, it.current(), rec );
+ }
+ return node;
+}
+
+int QtxActionMenuMgr::findId( const int id, const int pid ) const
+{
+ MenuNode* start = pid != -1 ? find( pid ) : (MenuNode*)&myRoot;
+ if ( start ) {
+ for ( NodeListIterator it( start->children ); it.current(); ++it ) {
+ if ( it.current()->id == id ) return id;
+ }
+ }
+ return -1;
+}
+
void QtxActionMenuMgr::removeMenu( const int id, MenuNode* startNode )
{
MenuNode* start = startNode ? startNode : &myRoot;
a->removeFrom( mw );
}
- if ( node != &myRoot )
- {
- if ( mw->inherits( "QMenuBar" ) )
- ((QMenuBar*)mw)->clear();
- else if ( mw->inherits( "QPopupMenu" ) )
- ((QPopupMenu*)mw)->clear();
- }
+ if ( mw->inherits( "QMenuBar" ) )
+ ((QMenuBar*)mw)->clear();
+ else if ( mw->inherits( "QPopupMenu" ) )
+ ((QPopupMenu*)mw)->clear();
QMap<int, NodeList> idMap;
for ( NodeListIterator it2( node->children ); it2.current(); ++it2 )
{
- MenuNode* par = it2.current()->parent;
- if ( isVisible( it2.current()->id, par ? par->id : -1 ) )
- {
- NodeList& lst = idMap[it2.current()->group];
+ NodeList& lst = idMap[it2.current()->group];
+ int idx = it2.current()->idx;
+ if ( idx < 0 || idx >= lst.count() )
lst.append( it2.current() );
- }
+ else
+ lst.insert( idx, it2.current() );
}
QIntList groups = idMap.keys();
const NodeList& lst = idMap[*gIt];
for ( NodeListIterator iter( lst ); iter.current(); ++iter )
{
+ MenuNode* par = iter.current()->parent;
+ if ( !isVisible( iter.current()->id, par ? par->id : -1 ) )
+ continue;
+
if ( rec )
updateMenu( iter.current(), rec, false );
QAction* a = itemAction( iter.current()->id );
- if ( a )
- a->addTo( mw );
- else
- {
- MenuAction* ma = menuAction( iter.current()->id );
- if ( ma && ma->popup() && ma->popup()->count() )
- ma->addTo( mw );
+ if ( !a )
+ a = menuAction( iter.current()->id );
+ if ( a ) {
+ QMenuData* md = dynamic_cast<QMenuData*>( mw );
+ int cnt = 0;
+ if ( md ) cnt = md->count();
+ a->addTo( mw );
+ if ( md && md->count() - cnt == 1 ) { //&& iter.current()->id > 0
+ int lid = md->idAt( cnt );
+ QMenuItem* mi = md->findItem( lid );
+ if ( mi && !mi->isSeparator() )
+ md->setId( cnt, iter.current()->id );
+ }
}
}
}
return r.read( fname, cr );
}
+bool QtxActionMenuMgr::containsMenu( const QString& title, const int pid ) const
+{
+ return (bool)find( title, pid, false );
+}
+
+bool QtxActionMenuMgr::containsMenu( const int id, const int pid ) const
+{
+ return (bool)find( id, pid, false );
+}
/*!
Class: QtxActionMenuMgr::MenuCreator
MenuNode( MenuNode* p ) : parent( p ), visible( true ) { children.setAutoDelete( true ); };
int id;
+ int idx;
int group;
MenuNode* parent;
bool visible;
virtual int insert( const int, const int, const int, const int = -1 );
int insert( QAction*, const int, const int, const int = -1 );
- int insert( const QString&, const QString&, const int, const int = -1 );
- int insert( const QString&, const QStringList&, const int, const int = -1 );
- virtual int insert( const QString&, const int, const int, const int = -1 );
+ int insert( const QString&, const QString&, const int, const int = -1, const int = -1, const bool = false );
+ int insert( const QString&, const QStringList&, const int, const int = -1, const int = -1, const bool = false );
+ virtual int insert( const QString&, const int, const int, const int = -1, const int = -1, const bool = false );
int append( const int, const int, const int );
int append( QAction*, const int, const int );
- int append( const QString&, const int, const int );
+ int append( const QString&, const int, const int, const int = -1, const bool = false );
int prepend( const int, const int, const int );
int prepend( QAction*, const int, const int );
- int prepend( const QString&, const int, const int );
+ int prepend( const QString&, const int, const int, const int = -1, const bool = false );
void remove( const int );
void remove( const int, const int, const int = -1 );
virtual bool load( const QString&, QtxActionMgr::Reader& );
+ bool containsMenu( const QString&, const int ) const;
+ bool containsMenu( const int, const int ) const;
+
+
private slots:
void onDestroyed( QObject* );
+ void onHighlighted( int );
+
+signals:
+ void menuHighlighted( int, int );
protected:
void setWidget( QWidget* );
- MenuNode* find( const int, const int ) const;
- MenuNode* find( const int, MenuNode* = 0 ) const;
+ MenuNode* find( const int, const int, const bool = true ) const;
+ MenuNode* find( const int, MenuNode* = 0, const bool = true ) const;
bool find( const int, NodeList&, MenuNode* = 0 ) const;
+ MenuNode* find( const QString&, const int, const bool = true ) const;
+ MenuNode* find( const QString&, MenuNode* = 0, const bool = true ) const;
+ bool find( const QString&, NodeList&, MenuNode* = 0 ) const;
+ int findId( const int, const int = -1 ) const;
void removeMenu( const int, MenuNode* );
return find( tname ) != -1;
}
+bool QtxActionToolMgr::containsAction( const int id, const int tid ) const
+{
+ for ( ToolBarMap::ConstIterator it = myToolBars.begin(); it != myToolBars.end(); ++it )
+ {
+ if ( tid == -1 || it.key() == tid ) {
+ const NodeList& list = it.data().nodes;
+ for ( NodeList::const_iterator nit = list.begin(); nit != list.end(); ++nit )
+ if ( (*nit).id == id )
+ return true;
+ }
+ }
+ return false;
+}
+
void QtxActionToolMgr::onToolBarDestroyed()
{
myToolBars.remove( find( (QToolBar*)sender() ) );
bool hasToolBar( const int ) const;
bool hasToolBar( const QString& ) const;
+ bool containsAction( const int, const int = -1 ) const;
+
virtual bool load( const QString&, QtxActionMgr::Reader& );
protected slots:
QSize calculateSize( const bool, const int,
const bool, const bool, const bool ) const;
- friend class Dock;
+#if QT_VER == 3
+ friend class QtxColorScale::Dock;
+#endif
private:
double myMin;
*/
void QtxDirListEditor::getPathList(QStringList& list)
{
+ // Finish the path editing
+ if (myEdit) {
+ validate(true);
+
+ myEdit->deleteLater();
+ myBtn->deleteLater();
+ myEdit = 0;
+ myBtn = 0;
+ myEdited = false;
+ myDirList->setFocus();
+ }
+
list.clear();
for (unsigned i = 0; i < myDirList->count()-1; i++)
list.append(myDirList->text(i));
/*!
Validates entered path, returns true if OK
*/
-bool QtxDirListEditor::validate()
+bool QtxDirListEditor::validate( const bool quietMode )
{
if ( myEdited )
{
- QString dirPath = QFileInfo( myEdit->text().stripWhiteSpace() ).absFilePath();
+ QString dirPath = QFileInfo( myEdit->text().stripWhiteSpace() ).filePath();
/*
#ifndef WNT
if ( dirPath.startsWith( "~") ) {
if (found) {
if (found != myLastSelected) {
// it is forbidden to add directory more then once
- QMessageBox::critical(this,
- tr("Error"),
- tr("Directory already specified."),
- tr("Ok"));
+ if ( !quietMode )
+ QMessageBox::critical(this,
+ tr("Error"),
+ tr("Directory already specified."),
+ tr("Ok"));
myEdit->setFocus();
return false;
}
}
else {
if (!dir.exists()) {
- if ( QMessageBox::information(this,
- tr("Warning"),
- tr("%1\n\nThe directory doesn't exist.\nAdd directory anyway?").arg(dir.absPath()),
- tr("Yes"), tr("No"), QString::null, 1, 1) == 1) {
+ if ( !quietMode && QMessageBox::information(this,
+ tr("Warning"),
+ tr("%1\n\nThe directory doesn't exist.\nAdd directory anyway?").arg(dir.absPath()),
+ tr("Yes"), tr("No"), QString::null, 1, 1) == 1) {
myEdit->setFocus();
return false;
}
* \brief Validates entered path
* \retval bool - returns status (true if OK)
*/
- bool validate();
+ bool validate( const bool quietMode = false );
/*!
* \brief Appends/changes path
#include <qdockarea.h>
#include <qdockwindow.h>
#include <qmainwindow.h>
+#include <qobjectlist.h>
#include <qapplication.h>
/*!
if ( !mw )
return;
- lst = mw->dockWindows();
+ QObjectList* objs = mw->queryList( "QDockWindow" );
+ if ( objs )
+ {
+ for ( QObjectListIt it( *objs ); it.current(); ++it )
+ {
+ QDockWindow* dockWin = ::qt_cast<QDockWindow*>( it.current() );
+ if ( dockWin && dockMainWindow( mw, dockWin ) )
+ lst.append( dockWin );
+ }
+ }
+ delete objs;
+}
+
+bool QtxDockAction::dockMainWindow( QMainWindow* mw, QObject* win ) const
+{
+ if ( !mw || !win )
+ return false;
+
+ while ( win )
+ {
+ if ( win->parent() && win->parent() == mw )
+ return true;
+
+ if ( ::qt_cast<QMainWindow*>( win->parent() ) )
+ return false;
+
+ win = win->parent();
+ }
+
+ return false;
}
/*!
if ( !myInfo.contains( dw ) )
return;
+ QMainWindow* mw = mainWindow();
+ if ( !mw )
+ return;
+
+ QObject* p = dw->parent();
+ if ( !( !p || p == mw || ( p->parent() && p->parent() == mw ) ) )
+ return;
+
QString winName = myInfo[dw].name;
if ( winName.isEmpty() || !myGeom.contains( winName ) )
return;
QMap<QString, QDockWindow*> nameMap;
for ( QPtrListIterator<QDockWindow> itr( lst ); itr.current(); ++itr )
{
+ QObject* p = itr.current()->parent();
+ if ( !( !p || p == mw || ( p->parent() && p->parent() == mw ) ) )
+ continue;
+
QString name;
if ( myInfo.contains( itr.current() ) )
name = myInfo[itr.current()].name;
void updateMenus();
+ bool dockMainWindow( QMainWindow*, QObject* ) const;
+
private:
enum { AutoAdd = QEvent::User, LoadArea };
#include <qfontdatabase.h>
#include <qfileinfo.h>
#include <qfiledialog.h>
+#include <qapplication.h>
#include "QtxIntSpinBox.h"
#include "QtxDblSpinBox.h"
if( deffam.canCast( QVariant::String ) )
curtext = deffam.toString();
}
+
+ if ( curtext.isEmpty() )
+ curtext = (QApplication::font()).family();
int idx = -1;
for ( int i = 0; i < (int)myFamilies->count() && idx < 0; i++ )
#include <qapplication.h>
#include <qinputdialog.h>
#include <qevent.h>
+#include <qregexp.h>
#define DARK_COLOR_LIGHT 250
+
/*!
Class: QtxWorkstack [Public]
Descr:
split->hide();
}
+void QtxWorkstack::splitterInfo( QSplitter* split, QString& info ) const
+{
+ if ( !split )
+ return;
+
+ const QObjectList* objs = split->children();
+ if ( objs )
+ {
+ // make up a sizes string: integer values are separated by ':' char
+ QValueList<int> sizes = split->sizes();
+ QString sizesStr;
+ for ( QValueList<int>::Iterator sIt = sizes.begin(); sIt != sizes.end(); ++sIt ) {
+ if ( *sIt > 1 ) // size 1 pixel usually means empty Workstack area, which will NOT be re-created,
+ sizesStr += QString( ":%1" ).arg( *sIt ); // so we don't need to store its size
+ }
+ if ( !sizesStr.isEmpty() ) // cut the first ':'
+ sizesStr = sizesStr.right( sizesStr.length()-1 );
+
+ // count all QSplitter-s and QtxWorkstackArea-s
+ // int nChilds( 0 );
+ // QObjectListIt it( *objs );
+ // for ( ; it.current(); ++it )
+ // {
+ // if ( it.current()->inherits( "QSplitter" ) ||
+ // it.current()->inherits( "QtxWorkstackArea" ) )
+ // nChilds++;
+ // }
+
+ info += QString( "(splitter orientation=%1 sizes=%3 " ).arg( split->orientation() ).arg( sizesStr );
+
+ for ( QObjectListIt it( *objs ); it.current(); ++it )
+ {
+ if ( it.current()->inherits( "QSplitter" ) )
+ splitterInfo( (QSplitter*)it.current(), info );
+ else if ( it.current()->inherits( "QtxWorkstackArea" ) ) {
+ QtxWorkstackArea* area = (QtxWorkstackArea*)it.current();
+ if ( area->isEmpty() )
+ continue;
+ info += QString( "(views active='%1'" ).arg( area->activeWidget()->name() );
+ QWidgetList views = area->widgetList();
+ for ( QWidgetListIt wIt( views ); wIt.current(); ++wIt )
+ info += QString( " '%1'" ).arg( wIt.current()->name() );
+ info += ')';
+ }
+ }
+ }
+ info += ')';
+}
+
+
+// cuts starting '(' symbol and ending '(' symbol
+void cutBrackets( QString& parameters )
+{
+ if ( !parameters.isEmpty() && parameters[0] == '(' && parameters[parameters.length()-1] == ')' )
+ parameters = parameters.mid( 1, parameters.length()-2 );
+}
+
+// for strings like "(splitter orientation=0 children=2 sizes=332:478" returns values of
+// parameters. For example, getValue( example, "children" ) returns "2"
+// getValue( example, "sizes" ) returns "332:478"
+QString getValue( const QString& str, const QString& valName )
+{
+ int i = str.find( valName );
+ if ( i != -1 ) {
+ int equal_i = str.find( '=', i );
+ if ( equal_i != -1 ) {
+ int space_i = str.find( ' ', ++equal_i );
+ if ( space_i != -1 )
+ return str.mid( equal_i, space_i-equal_i );
+ }
+ }
+ return QString( "" );
+}
+
+// checks format of splitter parameters string
+bool checkFormat( const QString& parameters )
+{
+ QString params( parameters );
+ // 1. begins and ends with brackets
+ bool ok = ( params[0] == '(' && params[params.length()-1] == ')' );
+ if ( !ok ) return ok;
+ ::cutBrackets( params );
+ // 2. has splitter word
+ ok = ( params.left( 8 ) == "splitter" );
+ if ( !ok ) return ok;
+ // 3. has children? = '(' is found
+ int i = params.find( '(' );
+ ok = i != -1;
+ if ( !ok ) return ok;
+ params = params.left( i ); // cut all children, they will be checked later
+ // 4. has orientation word and correct value
+ ::getValue( params, "orientation" ).toInt( &ok );
+ if ( !ok ) return ok;
+ // 5. has sizes word and values
+ ok = ! ::getValue( params, "sizes" ).isEmpty();
+ if ( !ok ) return ok;
+ // 6. check children -> number of '(' == number of ')' in original string
+ ok = ( parameters.contains( '(' ) == parameters.contains( ')' ) );
+ return ok;
+}
+
+// returns children of splitter in a list. Children are separated by '(' and ')' symbols
+QStringList getChildren( const QString& str )
+{
+ QStringList lst;
+ if ( !str.startsWith( "(" ) )
+ return lst;
+
+ int i = 1,
+ nOpen = 1, // count brackets: '(' increments nOpen, ')' decrements
+ start = 0;
+ while ( i < str.length() ) {
+ if ( str[i] == '(' ) {
+ nOpen++;
+ if ( nOpen == 1 )
+ start = i;
+ }
+ else if ( str[i] == ')' ) {
+ nOpen--;
+ if ( nOpen == 0 )
+ lst.append( str.mid( start, i-start+1 ) );
+ }
+ i++;
+ }
+
+ return lst;
+}
+
+// for a string like "views active='AnotherView' 'GLView' 'AnotherView'"
+// getViewName( example, 0 ) returns "GLView",
+// getViewName( example, 1 ) -> "AnotherView", etc.
+QString getViewName( const QString& str, int i )
+{
+ QRegExp exp( "\\s'\\w+'" );
+ int start = 0; // start index of view name in the string
+ int num = 0 ; // index of found match
+ while ( ( start = exp.search( str, start ) ) != -1 && num < i ) {
+ start += exp.matchedLength();
+ num ++;
+ }
+ if ( start != -1 ) // +2 and -3 avoid starting space and starting and ending ' symbols
+ return str.mid( start+2, exp.matchedLength()-3 );
+
+ return QString( "" );
+}
+
+// returns widget with given name
+QWidget* getView( const QWidget* parent, const QString& aName )
+{
+ QWidget* view = 0;
+ QObjectList *l = parent->topLevelWidget()->queryList( "QWidget", aName, false, true );
+ if ( !l->isEmpty() )
+ view = dynamic_cast<QWidget*>( l->first() );
+ delete l;
+ return view;
+}
+
+// installs a splitter described by given parameters string
+void QtxWorkstack::setSplitter( QSplitter* splitter, const QString& parameters, QMap< QSplitter*, QValueList<int> >& sMap )
+{
+ if ( !::checkFormat( parameters ) ) {
+ printf( "\nInvalid format of workstack parameters. Positions of viewers can not be restored.\n" );
+ return;
+ }
+
+ QString params( parameters );
+ ::cutBrackets( params );
+
+ // get splitter sizes and store it in the map for future setting
+ QValueList<int> sizes;
+ QStringList sizesLst = QStringList::split( ':', ::getValue( params, "sizes" ) );
+ for ( QStringList::Iterator it = sizesLst.begin(); it != sizesLst.end(); ++it )
+ sizes.append( (*it).toInt() );
+ sMap[ splitter ] = sizes;
+
+ // set orientation of splitter
+ int orient = ::getValue( params, "orientation" ).toInt();
+ splitter->setOrientation( (Qt::Orientation)orient );
+
+ // get children
+ QString options = params.left( params.find( '(' ) );
+ QString childrenStr = params.right( params.length()-options.length() );
+ QStringList children = ::getChildren( childrenStr );
+
+ // debug output..
+ // printf (" splitter orient=%d, sizes_count=%d, children=%d\n", orient, sizes.count(), children.count() );
+ // for ( QStringList::Iterator tit = children.begin(); tit != children.end(); ++tit )
+ // printf (" |-> child = [%s]\n", (*tit).latin1() );
+
+ for ( QStringList::Iterator it = children.begin(); it != children.end(); ++it ) {
+ if ( (*it).startsWith( "(splitter" ) ) {
+ QSplitter* newSplitter = new QSplitter( splitter );
+ setSplitter( newSplitter, *it, sMap );
+ }
+ else if ( (*it).startsWith( "(views" ) ) {
+ QtxWorkstackArea* newArea = createArea( splitter );
+ QString activeViewName = ::getValue( *it, "active" );
+ QWidget* activeView( 0 );
+ activeViewName = activeViewName.mid( 1, activeViewName.length()-2 ); // chop off ' symbols
+ int i = 0;
+ QString viewName = ::getViewName( *it, i );
+ while ( !viewName.isEmpty() ) {
+ if ( QWidget* view = ::getView( splitter, viewName ) ) {
+ newArea->insertWidget( view );
+ if ( activeViewName == view->name() )
+ activeView = view;
+ }
+ viewName = ::getViewName( *it, ++i );
+ }
+ if ( activeView )
+ newArea->setActiveWidget( activeView );
+ }
+ }
+}
+
+// Restore workstack's configuration stored in 'parameters' string
+QtxWorkstack& QtxWorkstack::operator<<( const QString& parameters )
+{
+ // clear the main splitter - remove all child splitters and empty areas from it
+ QPtrList<QSplitter> splitList;
+ QPtrList<QtxWorkstackArea> areaList;
+ splitters( mySplit, splitList, false );
+ areas( mySplit, areaList, false );
+ for ( QPtrListIterator<QSplitter> iter( splitList ); iter.current(); ++iter )
+ delete iter.current();
+ for ( QPtrListIterator<QtxWorkstackArea> it( areaList ); it.current(); ++it )
+ if ( it.current()->isEmpty() )
+ delete it.current();
+
+ // restore splitter recursively
+ QMap< QSplitter*, QValueList<int> > sMap;
+ setSplitter( mySplit, parameters, sMap );
+
+ // now mySplit may contains empty area (where all views were located before restoring)
+ // in order setSize to work correctly we have to exclude this area
+ areaList.clear();
+ areas( mySplit, areaList, false );
+ for ( QPtrListIterator<QtxWorkstackArea> delIt( areaList ); delIt.current(); ++delIt )
+ if ( delIt.current()->isEmpty() )
+ delete delIt.current();
+
+ qApp->processEvents();
+
+ // restore splitters' sizes (map of sizes is filled in setSplitters)
+ for ( QMap< QSplitter*, QValueList<int> >::Iterator it = sMap.begin(); it != sMap.end(); ++it )
+ it.key()->setSizes( it.data() );
+
+ return (*this);
+}
+
+// Example of string produced by operator>> :
+// "(splitter orientation=0 sizes=186:624 (views active='OCCViewer_0_0' 'OCCViewer_0_0')
+// (views active='VTKViewer_0_0' 'VTKViewer_0_0'))"
+QtxWorkstack& QtxWorkstack::operator>>( QString& outParameters )
+{
+ splitterInfo( mySplit, outParameters );
+ return (*this);
+}
+
+
/*!
Class: QtxWorkstackArea [Internal]
Descr:
void SetRelativePosition( QWidget* wid, const Qt::Orientation o, const double pos );
void SetRelativePositionInSplitter( QWidget* wid, const double pos );
+ // asv: Store/Restore visual parameters - geometry of inner windows
+ QtxWorkstack& operator<<( const QString& );
+ QtxWorkstack& operator>>( QString& );
+
signals:
void windowActivated( QWidget* );
void distributeSpace( QSplitter* ) const;
int setPosition( QWidget* wid, QSplitter* split, const Qt::Orientation o,
const int need_pos, const int splitter_pos );
-
+
+ void splitterInfo( QSplitter*, QString& ) const;
+ void setSplitter( QSplitter*, const QString&, QMap< QSplitter*,QValueList<int> >& );
+
private:
QWidget* myWin;
QtxWorkstackArea* myArea;
// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, 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
+// 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
+//
+// 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
+// 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/
#include "SalomeApp_Study.h"
#include "QtxWorkstack.h"
+#include "QtxActionMenuMgr.h"
+#include "QtxActionToolMgr.h"
#include <SALOME_LifeCycleCORBA.hxx>
#include <Container_init_python.hxx>
///////////////////////////////////////////////////////////////////////////////
// Default name of the module, replaced at the moment of module creation
-#define __DEFAULT_NAME__ "SALOME_PYQT_Module"
+const char* __DEFAULT_NAME__ = "SALOME_PYQT_Module";
///////////////////////////////////////////////////////////////////////////////
-// If __CALL_OLD_METHODS__ macro is not defined the invoking of obsolete Python
+// Default menu group number
+const int __DEFAULT_GROUP__ = 40;
+
+///////////////////////////////////////////////////////////////////////////////
+// If __CALL_OLD_METHODS__ macro is not defined the invoking of obsolete Python
// module's methods like setSetting(), definePopup(), etc. is blocked.
// This macro is defined by default (in Makefile)
#ifdef __CALL_OLD_METHODS__
const bool IsCallOldMethods = true;
-#else
+#else
const bool IsCallOldMethods = false;
#endif
public:
SALOME_PYQT_XmlHandler( SALOME_PYQT_Module* module, const QString& fileName );
void createActions();
- void createPopup ( QPopupMenu* menu,
- const QString& context,
- const QString& parent,
+ void createPopup ( QPopupMenu* menu,
+ const QString& context,
+ const QString& parent,
const QString& object );
protected:
void createToolBar ( QDomNode& parentNode );
- void createMenu ( QDomNode& parentNode,
+ void createMenu ( QDomNode& parentNode,
const int parentMenuId = -1 );
- void insertPopupItems( QDomNode& parentNode,
+ void insertPopupItems( QDomNode& parentNode,
QPopupMenu* menu );
private:
// While the SalomePyQtGUI library is not imported in Python it's initialization function
// should be called manually (and only once) in order to initialize global sip data
// and to get C API from sip : sipBuildResult for example
+#if defined(SIP_VERS_v4_old) || defined(SIP_VERS_v4_new)
+#define INIT_FUNCTION initSalomePyQtGUI
#if defined(SIP_STATIC_MODULE)
-extern "C" void initSalomePyQtGUI();
+extern "C" void INIT_FUNCTION();
+#else
+PyMODINIT_FUNC INIT_FUNCTION();
+#endif
#else
-PyMODINIT_FUNC initSalomePyQtGUI();
+#define INIT_FUNCTION initlibSalomePyQtGUIc
+extern "C" void INIT_FUNCTION();
#endif
/*!
if ( !alreadyInitialized ) {
// call only once (see above) !
PyEval_RestoreThread( KERNEL_PYTHON::_gtstate );
- initSalomePyQtGUI();
+ INIT_FUNCTION();
PyEval_ReleaseThread( KERNEL_PYTHON::_gtstate );
alreadyInitialized = !alreadyInitialized;
}
}
}
-/*!
+/*!
* Static variables definition
*/
SALOME_PYQT_Module::InterpMap SALOME_PYQT_Module::myInterpMap;
* Little trick : provide an access to being activated Python module from outside;
* needed by the SalomePyQt library :(
*/
-SALOME_PYQT_Module* SALOME_PYQT_Module::getInitModule()
-{
- return myInitModule;
+SALOME_PYQT_Module* SALOME_PYQT_Module::getInitModule()
+{
+ return myInitModule;
}
/*!
SALOME_PYQT_Module::SALOME_PYQT_Module() :
SalomeApp_Module( __DEFAULT_NAME__ ), myModule( 0 ), myXmlHandler ( 0 )
{
- myMenuActionList.setAutoDelete( false );
- myPopupActionList.setAutoDelete( false );
- myToolbarActionList.setAutoDelete( false );
}
/*!
*/
SALOME_PYQT_Module::~SALOME_PYQT_Module()
{
- myMenuActionList.clear();
- myPopupActionList.clear();
- myToolbarActionList.clear();
if ( myXmlHandler )
delete myXmlHandler;
}
*
* This method is used for creation of the menus, toolbars and other staff.
* There are two ways:
- * - for obsolete modules this method first tries to read <module>_<language>.xml
+ * - for obsolete modules this method first tries to read <module>_<language>.xml
* resource file which contains a menu, toolbars and popup menus description.
* - new modules can create menus by by calling the corresponding methods of SalomePyQt
* Python API in the Python module's initialize() method which is called from here.
QString aName = name( "" );
QString aFileName = aName + "_" + aLang + ".xml";
aFileName = aResMgr->path( "resources", aName, aFileName );
-
+
// parse XML file if it is found and create actions
if ( !myXmlHandler && !aFileName.isEmpty() ) {
myXmlHandler = new SALOME_PYQT_XmlHandler( this, aFileName );
{
public:
InitializeReq( CAM_Application* _app,
- SALOME_PYQT_Module* _obj )
+ SALOME_PYQT_Module* _obj )
: PyInterp_Request( 0, true ), // this request should be processed synchronously (sync == true)
myApp( _app ),
myObj( _obj ) {}
-
+
protected:
virtual void execute()
{
MESSAGE( "SALOME_PYQT_Module::activateModule" );
bool res = SalomeApp_Module::activateModule( theStudy );
-
+
if ( !res )
return res;
class ActivateReq : public PyInterp_Request
{
public:
- ActivateReq( SUIT_Study* _study,
- SALOME_PYQT_Module* _obj )
+ ActivateReq( SUIT_Study* _study,
+ SALOME_PYQT_Module* _obj )
: PyInterp_Request( 0, true ), // this request should be processed synchronously (sync == true)
myStudy ( _study ),
myObj ( _obj ) {}
-
+
protected:
virtual void execute()
{
setMenuShown( true );
setToolShown( true );
+ if ( menuMgr() )
+ connect( menuMgr(), SIGNAL( menuHighlighted( int, int ) ),
+ this, SLOT( onMenuHighlighted( int, int ) ) );
+
return true;
}
{
MESSAGE( "SALOME_PYQT_Module::deactivateModule" );
+ if ( menuMgr() )
+ disconnect( menuMgr(), SIGNAL( menuHighlighted( int, int ) ),
+ this, SLOT( onMenuHighlighted( int, int ) ) );
+
bool res = SalomeApp_Module::deactivateModule( theStudy );
// deactivate menus, toolbars, etc
class DeactivateReq : public PyInterp_LockRequest
{
public:
- DeactivateReq( PyInterp_base* _py_interp,
- SUIT_Study* _study,
- SALOME_PYQT_Module* _obj )
+ DeactivateReq( PyInterp_base* _py_interp,
+ SUIT_Study* _study,
+ SALOME_PYQT_Module* _obj )
: PyInterp_LockRequest( _py_interp, 0, true ), // this request should be processed synchronously (sync == true)
myStudy ( _study ),
myObj ( _obj ) {}
-
+
protected:
virtual void execute()
{
class GUIEvent : public PyInterp_LockRequest
{
public:
- GUIEvent( PyInterp_base* _py_interp,
+ GUIEvent( PyInterp_base* _py_interp,
SALOME_PYQT_Module* _obj,
- int _id )
+ int _id )
: PyInterp_LockRequest( _py_interp, 0, true ), // this request should be processed synchronously (sync == true)
myId ( _id ),
myObj ( _obj ) {}
-
+
protected:
virtual void execute()
{
/*!
* Processes GUI action (from context popup menu, only for XML-based actions!)
*/
-void SALOME_PYQT_Module::onGUIEvent( int id )
+void SALOME_PYQT_Module::onGUIEvent( int id )
{
// perform synchronous request to Python event dispatcher
class GUIEvent : public PyInterp_LockRequest
{
public:
- GUIEvent( PyInterp_base* _py_interp,
+ GUIEvent( PyInterp_base* _py_interp,
SALOME_PYQT_Module* _obj,
- int _id )
+ int _id )
: PyInterp_LockRequest( _py_interp, 0, true ), // this request should be processed synchronously (sync == true)
myId ( _id ),
myObj ( _obj ) {}
-
+
protected:
virtual void execute()
{
PyInterp_Dispatcher::Get()->Exec( new GUIEvent( myInterp, this, id ) );
}
-/*!
+/*!
+ * Menu highlight processing
+ */
+void SALOME_PYQT_Module::onMenuHighlighted( int menu, int submenu )
+{
+ if ( !action( menu ) && registered( menu, submenu ) ) {
+ // perform synchronous request to Python event dispatcher
+ class MenuHighlightEvent : public PyInterp_LockRequest
+ {
+ public:
+ MenuHighlightEvent( PyInterp_base* _py_interp,
+ SALOME_PYQT_Module* _obj,
+ int _menu,
+ int _submenu )
+ : PyInterp_LockRequest( _py_interp, 0, true ), // this request should be processed synchronously (sync == true)
+ myMenu ( _menu ),
+ mySubMenu( _submenu ),
+ myObj ( _obj ) {}
+
+ protected:
+ virtual void execute()
+ {
+ myObj->menuHighlight( myMenu, mySubMenu );
+ }
+
+ private:
+ int myMenu;
+ int mySubMenu;
+ SALOME_PYQT_Module* myObj;
+ };
+
+ // Posting the request
+ PyInterp_Dispatcher::Get()->Exec( new MenuHighlightEvent( myInterp, this, menu, submenu ) );
+ }
+}
+
+/*!
Context popup menu request.
Called when user activates popup menu in some window (view, object browser, etc).
*/
class PopupMenuEvent : public PyInterp_LockRequest
{
public:
- PopupMenuEvent( PyInterp_base* _py_interp,
+ PopupMenuEvent( PyInterp_base* _py_interp,
SALOME_PYQT_Module* _obj,
- const QString& _context,
- QPopupMenu* _popup )
+ const QString& _context,
+ QPopupMenu* _popup )
: PyInterp_LockRequest( _py_interp, 0, true ), // this request should be processed synchronously (sync == true)
- myContext( _context ),
+ myContext( _context ),
myPopup ( _popup ),
myObj ( _obj ) {}
-
+
protected:
virtual void execute()
{
/*!
* Defines the dockable window associated with the module.
- * To fill the list of windows the correspondind Python module's windows()
+ * To fill the list of windows the correspondind Python module's windows()
* method is called from SALOME_PYQT_Module::init() method.
* By default, ObjectBrowser, PythonConsole and LogWindow are provided.
*/
void SALOME_PYQT_Module::windows( QMap<int, int>& mappa ) const
{
- // First clear the output parameters
+ // First clear the output parameters
QMap<int, int>::ConstIterator it;
for ( it = myWindowsMap.begin(); it != myWindowsMap.end(); ++it ) {
mappa[ it.key() ] = it.data();
/*!
* Defines the compatible views which should be opened on module activation.
- * To fill the list of views the correspondind Python module's views()
+ * To fill the list of views the correspondind Python module's views()
* method is called from SALOME_PYQT_Module::init() method.
* By default, the list is empty.
*/
// initialize Python subinterpreter (on per study) and put it in <myInterp> variable
initInterp( aStudyId );
- if ( !myInterp )
- return; // Error
+ if ( !myInterp )
+ return; // Error
// import Python GUI module
importModule();
if ( !myModule )
- return; // Error
-
+ return; // Error
+
myInitModule = this;
if ( IsCallOldMethods ) { // __CALL_OLD_METHODS__
PyErr_Print();
}
}
-
+
// get the windows list from the Python module by calling windows() method
// ... first put default values
myWindowsMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::DockLeft );
}
/*!
- * Performs internal activation:
+ * Performs internal activation:
* - initializes/gets the Python interpreter (one per study)
* - imports the Python GUI module
* - calls Python module's setSettings() method (obsolete function, used for compatibility with old code)
// initialize Python subinterpreter (on per study) and put it in <myInterp> variable
initInterp( aStudyId );
- if ( !myInterp )
- return; // Error
+ if ( !myInterp )
+ return; // Error
// import Python GUI module
importModule();
if ( !myModule )
- return; // Error
-
+ return; // Error
+
// get python lock
PyLockWrapper aLock = myInterp->GetLockWrapper();
}
/*!
- * Performs internal deactivation:
+ * Performs internal deactivation:
* - calls Python module's deactivate() method
*/
void SALOME_PYQT_Module::deactivate( SUIT_Study* theStudy )
// initialize Python subinterpreter (on per study) and put it in <myInterp> variable
initInterp( aStudyId );
- if ( !myInterp )
- return; // Error
+ if ( !myInterp )
+ return; // Error
// import Python GUI module
importModule();
if ( !myModule )
- return; // Error
-
+ return; // Error
+
// get python lock
PyLockWrapper aLock = myInterp->GetLockWrapper();
return QString( "" );
}
-/*!
+/*!
* Called when study desktop is activated.
* Used for notifying about changing of the active study.
*/
class StudyChangedReq : public PyInterp_Request
{
public:
- StudyChangedReq( SUIT_Study* _study,
- SALOME_PYQT_Module* _obj )
+ StudyChangedReq( SUIT_Study* _study,
+ SALOME_PYQT_Module* _obj )
: PyInterp_Request( 0, true ), // this request should be processed synchronously (sync == true)
myStudy ( _study ),
myObj ( _obj ) {}
-
+
protected:
virtual void execute()
{
// import first
if ( !myInterp || !myModule )
return;
-
+
QString aContext( theContext ), aObject( "" ), aParent( "" );
-
+
if ( IsCallOldMethods && PyObject_HasAttrString(myModule , "definePopup") ) { //__CALL_OLD_METHODS__
// call definePopup() Python module's function
// this is obsolete function, used only for compatibility reasons
- PyObjWrapper res(PyObject_CallMethod( myModule,
- "definePopup",
+ PyObjWrapper res(PyObject_CallMethod( myModule,
+ "definePopup",
"sss",
- aContext.latin1(),
- aObject.latin1(),
+ aContext.latin1(),
+ aObject.latin1(),
aParent.latin1() ) );
if( !res ) {
PyErr_Print();
PyObjWrapper sipPopup( sipBuildResult( 0, "M", thePopupMenu, sipClass_QPopupMenu ) );
// then call Python module's createPopupMenu() method (for new modules)
- if ( PyObject_HasAttrString(myModule , "createPopupMenu") ) {
+ if ( PyObject_HasAttrString(myModule , "createPopupMenu") ) {
PyObjWrapper res1( PyObject_CallMethod( myModule,
"createPopupMenu",
"Os",
"customPopup",
"Osss",
sipPopup.get(),
- aContext.latin1(),
- aObject.latin1(),
+ aContext.latin1(),
+ aObject.latin1(),
aParent.latin1() ) );
if( !res2 ) {
PyErr_Print();
/*!
* Processes GUI event
* - calls Python module's OnGUIEvent() method
- */
+ */
void SALOME_PYQT_Module::guiEvent( const int theId )
{
// Python interpreter should be initialized and Python module should be
// import first
if ( !myInterp || !myModule )
return;
-
- if ( PyObject_HasAttrString(myModule , "OnGUIEvent") ) {
+
+ if ( PyObject_HasAttrString(myModule , "OnGUIEvent") ) {
PyObjWrapper res( PyObject_CallMethod( myModule, "OnGUIEvent", "i", theId ) );
if( !res ) {
PyErr_Print();
}
}
+/*!
+ * Menu highlight processing
+ * - calls Python module's menuActivated(int,int) method
+ */
+void SALOME_PYQT_Module::menuHighlight( const int menu, const int submenu )
+{
+ // Python interpreter should be initialized and Python module should be
+ // import first
+ if ( !myInterp || !myModule )
+ return;
+
+ if ( PyObject_HasAttrString(myModule , "menuHighlight") ) {
+ PyObjWrapper res( PyObject_CallMethod( myModule, "menuHighlight", "ii", menu, submenu ) );
+ if( !res ) {
+ PyErr_Print();
+ }
+ }
+}
+
/*!
* Initialises python subinterpreter (one per study)
*/
}
// not found - create a new one!
///////////////////////////////////////////////////////////////////
- // Attention: the creation of Python interpretor must be protected
+ // Attention: the creation of Python interpretor must be protected
// by a C++ Lock because of C threads
///////////////////////////////////////////////////////////////////
myInterp = new SALOME_PYQT_PyInterp();
myInterp->initialize();
myInterpMap[ theStudyId ] = myInterp;
-
+
// import 'salome' module and call 'salome_init' method;
// do it only once on interpreter creation
// ... first get python lock
// Error!
PyErr_Print();
return;
- }
+ }
if ( IsCallOldMethods ) { //__CALL_OLD_METHODS__
// ... then get workspace object
}
PyObjWrapper pyws( sipBuildResult( 0, "M", aWorkspace, sipClass_QWidget ) );
// ... and finally call Python module's setWorkspace() method (obsolete)
- if ( PyObject_HasAttrString(myModule , "setWorkSpace") ) {
+ if ( PyObject_HasAttrString(myModule , "setWorkSpace") ) {
PyObjWrapper res( PyObject_CallMethod( myModule, "setWorkSpace", "O", pyws.get() ) );
if( !res ) {
PyErr_Print();
}
/*!
- * Adds an action into private action list [internal usage]
+ * Returns default menu group
*/
-void SALOME_PYQT_Module::addAction( const PyQtGUIAction type, QAction* action )
+int SALOME_PYQT_Module::defaultMenuGroup()
{
- switch ( type ) {
- case PYQT_ACTION_MENU:
- myMenuActionList.append( action );
- break;
- case PYQT_ACTION_TOOLBAL:
- myToolbarActionList.append( action );
- break;
- case PYQT_ACTION_POPUP:
- myPopupActionList.append( action );
- break;
- }
+ return __DEFAULT_GROUP__;
}
-
/*!
- * The next methods just call the parent implementation.
+ * The next methods call the parent implementation.
* This is done to open protected methods from CAM_Module class.
-*/
+ * Also these methods are used to register created from outside menus
+ * in order to enable dynamic menus handling.
+ */
int SALOME_PYQT_Module::createTool( const QString& name )
{
return SalomeApp_Module::createTool( name );
{
return SalomeApp_Module::createTool( a, tBar, id, idx );
}
-int SALOME_PYQT_Module::createMenu( const QString& subMenu, const int menu, const int id, const int group, const int idx )
+int SALOME_PYQT_Module::createMenu( const QString& subMenu, const int menu, const int id, const int group, const int idx, const bool constantMenu )
{
- return SalomeApp_Module::createMenu( subMenu, menu, id, group, idx );
+ bool exists = hasMenu( subMenu, menu );
+ int regId = SalomeApp_Module::createMenu( subMenu, menu, id, group, idx, true );
+ if ( !exists )
+ registerMenu( regId, menu, constantMenu );
+ return regId;
}
-int SALOME_PYQT_Module::createMenu( const QString& subMenu, const QString& menu, const int id, const int group, const int idx )
+int SALOME_PYQT_Module::createMenu( const QString& subMenu, const QString& menu, const int id, const int group, const int idx, const bool constantMenu )
{
- return SalomeApp_Module::createMenu( subMenu, menu, id, group, idx );
+ QStringList menus = QStringList::split( "|", menu, false );
+ int pid = -1;
+ for (int i = 0; i < menus.count(); i++ ) {
+ pid = createMenu( menus[i], pid, -1, -1, -1, constantMenu );
+ if ( pid == -1 ) break;
+ }
+ if ( pid != -1 )
+ pid = createMenu( subMenu, pid, id, group, idx, constantMenu );
+ return pid;
}
-int SALOME_PYQT_Module::createMenu( const int id, const int menu, const int group, const int idx )
+int SALOME_PYQT_Module::createMenu( const int id, const int menu, const int group, const int idx, const bool constantMenu )
{
- return SalomeApp_Module::createMenu( id, menu, group, idx );
+ int regId = SalomeApp_Module::createMenu( id, menu, group, idx );
+ if ( regId != -1 )
+ registerMenu( regId, menu, constantMenu );
+ return regId;
}
-int SALOME_PYQT_Module::createMenu( const int id, const QString& menu, const int group, const int idx )
+int SALOME_PYQT_Module::createMenu( const int id, const QString& menu, const int group, const int idx, const bool constantMenu )
{
- return SalomeApp_Module::createMenu( id, menu, group, idx );
+ QStringList menus = QStringList::split( "|", menu, false );
+ int pid = -1;
+ for (int i = 0; i < menus.count(); i++ ) {
+ pid = createMenu( menus[i], pid, -1, -1, -1, constantMenu );
+ if ( pid == -1 ) break;
+ }
+ if ( pid != -1 )
+ pid = createMenu( id, pid, group, idx, constantMenu );
+ return pid;
}
-int SALOME_PYQT_Module::createMenu( QAction* a, const int menu, const int id, const int group, const int idx )
+int SALOME_PYQT_Module::createMenu( QAction* a, const int menu, const int id, const int group, const int idx, const bool constantMenu )
{
- return SalomeApp_Module::createMenu( a, menu, id, group, idx );
+ int regId = SalomeApp_Module::createMenu( a, menu, id, group, idx );
+ if ( regId != -1 )
+ registerMenu( regId, menu, constantMenu );
+ return regId;
}
-int SALOME_PYQT_Module::createMenu( QAction* a, const QString& menu, const int id, const int group, const int idx )
+int SALOME_PYQT_Module::createMenu( QAction* a, const QString& menu, const int id, const int group, const int idx, const bool constantMenu )
{
- return SalomeApp_Module::createMenu( a, menu, id, group, idx );
+ QStringList menus = QStringList::split( "|", menu, false );
+ int pid = -1;
+ for (int i = 0; i < menus.count(); i++ ) {
+ pid = createMenu( menus[i], pid, -1, -1, -1, constantMenu );
+ if ( pid == -1 ) break;
+ }
+ if ( pid != -1 )
+ pid = createMenu( a, pid, id, group, idx, constantMenu );
+ return pid;
}
QAction* SALOME_PYQT_Module::createSeparator()
{
}
QAction* SALOME_PYQT_Module::action( const int id ) const
{
- QAction* a = SalomeApp_Module::action( id );
- if ( !a ) // try own action map for menu items
- a = SalomeApp_Module::action( id + PYQT_ACTION_MENU );
- if ( !a ) // try own action map for toolbar items
- a = SalomeApp_Module::action( id + PYQT_ACTION_TOOLBAL );
- if ( !a ) // try own action map for popup items
- a = SalomeApp_Module::action( id + PYQT_ACTION_POPUP );
- return a;
+ return SalomeApp_Module::action( id );
}
int SALOME_PYQT_Module::actionId( const QAction* a ) const
{
- int id = SalomeApp_Module::actionId( a );
- if ( myMenuActionList.contains( a ) ) // check own action map for menu items
- id -= PYQT_ACTION_MENU;
- if ( myToolbarActionList.contains( a ) ) // check own action map for toolbar items
- id -= PYQT_ACTION_TOOLBAL;
- if ( myPopupActionList.contains( a ) ) // check own action map for popup items
- id -= PYQT_ACTION_POPUP;
- return id;
+ return SalomeApp_Module::actionId( a );
}
-QAction* SALOME_PYQT_Module::createAction( const int id, const QString& text, const QString& icon,
+QAction* SALOME_PYQT_Module::createAction( const int id, const QString& text, const QString& icon,
const QString& menu, const QString& tip, const int key,
const bool toggle )
{
if ( !pixmap.isNull() )
anIcon = QIconSet( pixmap );
}
- return SalomeApp_Module::createAction( id, text, anIcon, menu, tip, key, getApp()->desktop(), toggle, this, SLOT( onGUIEvent() ) );
+ QAction* a = action( id );
+ if ( a ) {
+ if ( a->text().isEmpty() && !text.isEmpty() ) a->setText( text );
+ if ( a->menuText().isEmpty() && !menu.isEmpty() ) a->setMenuText( menu );
+ if ( a->iconSet().isNull() && !anIcon.isNull() ) a->setIconSet( anIcon );
+ if ( a->statusTip().isEmpty() && !tip.isNull() ) a->setStatusTip( tip );
+ if ( a->accel().isEmpty() && key ) a->setAccel( key );
+ if ( a->isToggleAction() != toggle ) a->setToggleAction( toggle );
+ disconnect( a, SIGNAL( activated() ), this, SLOT( onGUIEvent() ) );
+ connect( a, SIGNAL( activated() ), this, SLOT( onGUIEvent() ) );
+ }
+ else {
+ a = SalomeApp_Module::createAction( id, text, anIcon, menu, tip, key, getApp()->desktop(), toggle, this, SLOT( onGUIEvent() ) );
+ }
+ return a;
+}
+
+/*!
+ * Returns TRUE if menu already exists
+ */
+bool SALOME_PYQT_Module::hasMenu( const QString& subMenu, const int menu )
+{
+ return menuMgr() && menuMgr()->containsMenu( subMenu, menu );
+}
+
+/*!
+ * Register the menu
+ */
+void SALOME_PYQT_Module::registerMenu( const int id, const int menu, const bool constantMenu )
+{
+ QAction* a = action( id );
+ QAction* s = separator();
+ if ( a && a == s )
+ return;
+ if ( !registered( id, menu ) )
+ myMenus[menu].append( MenuId( id, constantMenu ) );
+}
+
+/*!
+ * Unregister the menu
+ */
+void SALOME_PYQT_Module::unregisterMenu( const int id, const int menu )
+{
+ if ( myMenus.find( menu ) != myMenus.end() ) {
+ MenuIdList::iterator lit;
+ for ( lit = myMenus[menu].begin(); lit != myMenus[menu].end(); ++lit ) {
+ if ( (*lit).id == id ) {
+ myMenus[menu].remove( lit );
+ return;
+ }
+ }
+ }
+}
+
+/*!
+ * Returns TRUE if the menu is registered
+ */
+bool SALOME_PYQT_Module::registered( const int id, const int menu )
+{
+ MenuMap::iterator mit;
+ for ( mit = myMenus.begin(); mit != myMenus.end(); ++mit ) {
+ MenuIdList::iterator lit;
+ for ( lit = mit.data().begin(); lit != mit.data().end(); ++lit ) {
+ if ( (*lit).id == id && ( menu == 0 || mit.key() == menu ) )
+ return true;
+ }
+ }
+ return false;
+}
+
+/*!
+ * Returns TRUE if the menu is constant (not removed by clearMenu()).
+ * This concerns the menus which are created from XML files.
+ */
+bool SALOME_PYQT_Module::isConstantMenu( const int id, const int menu )
+{
+ if ( myMenus.find( menu ) != myMenus.end() ) {
+ MenuIdList& l = myMenus[ menu ];
+ MenuIdList::iterator lit;
+ for ( lit = l.begin(); lit != l.end(); ++lit ) {
+ if ( (*lit).id == id && (*lit).constantMenu )
+ return true;
+ }
+ }
+ return false;
+}
+
+/*!
+ * Displays/hides the module's menus.
+ */
+void SALOME_PYQT_Module::setMenuShown( const bool show )
+{
+ QtxActionMenuMgr* mMgr = menuMgr();
+ if ( !mMgr )
+ return;
+
+ bool upd = mMgr->isUpdatesEnabled();
+ mMgr->setUpdatesEnabled( false );
+
+ SalomeApp_Module::setMenuShown( show );
+
+ for ( MenuMap::iterator mit = myMenus.begin(); mit != myMenus.end(); ++mit ) {
+ MenuIdList::iterator lit;
+ for ( lit = mit.data().begin(); lit != mit.data().end(); ++lit )
+ if ( !action( (*lit).id ) )
+ mMgr->setShown( (*lit).id, show );
+ }
+
+ mMgr->setUpdatesEnabled( upd );
+ if ( upd )
+ mMgr->update();
+}
+
+/*!
+ * Displays/hides the module's toolbars.
+ */
+void SALOME_PYQT_Module::setToolShown( const bool show )
+{
+ SalomeApp_Module::setToolShown( show );
}
+/*!
+ * Clears the given menu.
+ * If <id> = 0 : clear all items in the <menu> menu
+ * If <menu> = 0 : clear all menus recursively starting from top-level.
+ * If <removeActions> = 0 : also unregister all removed actions (not delete!).
+ */
+bool SALOME_PYQT_Module::clearMenu( const int id, const int menu, const bool removeActions )
+{
+ QAction* a = action( id );
+ QAction* s = separator();
+ typedef QValueList<int> IntList;
+ if ( a && a != s ) {
+ // action
+ IntList menus;
+ if ( menu != 0 ) {
+ if ( registered( id, menu ) ) menus.append( menu );
+ }
+ else {
+ MenuMap::iterator mit;
+ for ( mit = myMenus.begin(); mit != myMenus.end(); ++mit )
+ if ( registered( id, mit.key() ) ) menus.append( mit.key() );
+ }
+ for ( int i = 0; i < menus.count(); i++ ) {
+ if ( !isConstantMenu( id, menus[i] ) ) {
+ menuMgr()->remove( menuMgr()->actionId( a ), menus[ i ] );
+ unregisterMenu( id, menus[i] );
+ }
+ }
+ if ( !registered( id ) && removeActions )
+ unregisterAction( id );
+ }
+ else {
+ // menu
+ if ( id == 0 ) {
+ if ( menu == 0 ) {
+ // clear all menus recursively starting from top-level (main menu)
+ IntList l = myMenus.keys();
+ IntList::iterator lit;
+ for ( lit = l.begin(); lit != l.end(); ++lit )
+ clearMenu( 0, *lit, removeActions );
+ }
+ else {
+ if ( myMenus.find( menu ) != myMenus.end() ) {
+ // remove all items in the parent menu
+ IntList l;
+ MenuIdList::iterator lit;
+ for ( lit = myMenus[menu].begin(); lit != myMenus[menu].end(); ++lit )
+ l.append( (*lit).id );
+ for ( int i = 0; i < l.count(); i++ )
+ clearMenu( l[i], menu, removeActions );
+ if ( myMenus[menu].empty() )
+ myMenus.remove( menu );
+ }
+ }
+ }
+ else {
+ MenuMap::iterator mit;
+ for ( mit = myMenus.begin(); mit != myMenus.end(); ++mit ) {
+ MenuIdList::iterator lit;
+ for ( lit = mit.data().begin(); lit != mit.data().end(); ++lit ) {
+ if ( (*lit).id == id && ( menu == 0 || mit.key() == menu ) ) {
+ clearMenu( 0, id, removeActions ); // first remove all sub-menus
+ if ( !isConstantMenu( id, mit.key() ) ) {
+ menuMgr()->remove( id, mit.key() );
+ mit.data().remove( lit );
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ return false;
+}
//=============================================================================
// SALOME_PYQT_XmlHandler class implementation
// gets an tag name for the dom element [ static ]
// returns an empty string if the element does not have tag name
static QString tagName( const QDomElement& element ) {
- return element.tagName().stripWhiteSpace();
+ return element.tagName().stripWhiteSpace();
}
// gets an attribute by it's name for the dom element [ static ]
// checks the given value for the integer value [ static ]
// returns -1 if item is empty or presents and invalid number
-static int checkInt( const QString& value )
+static int checkInt( const QString& value, const int def = -1 )
{
- return value.isEmpty() ? -1 : value.toInt();
+ return value.isEmpty() ? def : value.toInt();
}
/*!
* Constructor
*/
-SALOME_PYQT_XmlHandler::SALOME_PYQT_XmlHandler( SALOME_PYQT_Module* module, const QString& fileName )
+SALOME_PYQT_XmlHandler::SALOME_PYQT_XmlHandler( SALOME_PYQT_Module* module, const QString& fileName )
: myModule( module )
{
QFile aFile( fileName );
}
/*!
- Called by SALOME_PYQT_Module::initialize() in order to create actions
+ Called by SALOME_PYQT_Module::initialize() in order to create actions
(menus, toolbars, popup menus)
*/
void SALOME_PYQT_XmlHandler::createActions()
/*!
* Creates popup menu
*/
-void SALOME_PYQT_XmlHandler::createPopup( QPopupMenu* menu,
- const QString& context,
- const QString& parent,
+void SALOME_PYQT_XmlHandler::createPopup( QPopupMenu* menu,
+ const QString& context,
+ const QString& parent,
const QString& object )
{
// get document element
{
if ( !myModule )
return;
-
+
if ( parentNode.isNull() )
return;
- QDomElement parentElement = parentNode.toElement();
+ QDomElement parentElement = parentNode.toElement();
if ( !parentElement.isNull() ) {
QString plabel = attribute( parentElement, "label-id" );
int pid = checkInt( attribute( parentElement, "item-id" ) );
int ppos = checkInt( attribute( parentElement, "pos-id" ) );
+ int group = checkInt( attribute( parentElement, "group-id" ),
+ myModule->defaultMenuGroup() );
if ( !plabel.isEmpty() ) {
// create menu
int menuId = myModule->createMenu( plabel, // label
parentMenuId, // parent menu ID, should be -1 for main menu
pid, // ID
- 80, // group ID
- ppos ); // position
+ group, // group ID
+ ppos, // position
+ true ); // create constant menu (not removed by clearMenu())
QDomNode node = parentNode.firstChild();
while ( !node.isNull() ) {
if ( node.isElement() ) {
if ( aTagName == "popup-item" ) {
int id = checkInt( attribute( elem, "item-id" ) );
int pos = checkInt( attribute( elem, "pos-id" ) );
+ int group = checkInt( attribute( elem, "group-id" ),
+ myModule->defaultMenuGroup() );
QString label = attribute( elem, "label-id" );
QString icon = attribute( elem, "icon-id" );
QString tooltip = attribute( elem, "tooltip-id" );
// -1 action ID is not allowed : it means that <item-id> attribute is missed in the XML file!
// also check if the action with given ID is already created
- if ( id != -1 && !myModule->action( SALOME_PYQT_Module::PYQT_ACTION_MENU + id ) ) {
- // little trick to have several actions with same ID for menus and toolbars
- id = SALOME_PYQT_Module::PYQT_ACTION_MENU + id;
+ if ( id != -1 ) {
// create menu action
QAction* action = myModule->createAction( id, // ID
tooltip, // tooltip
tooltip, // status-bar text
QKeySequence( accel ), // keyboard accelerator
toggle ); // toogled action
- myModule->addAction( SALOME_PYQT_Module::PYQT_ACTION_MENU, action );
- myModule->createMenu( action, menuId, -1, 80, pos );
+ myModule->createMenu( action, // action
+ menuId, // parent menu ID
+ id, // ID (same as for createAction())
+ group, // group ID
+ pos, // position
+ true ); // create constant menu (not removed by clearMenu())
}
}
else if ( aTagName == "submenu" ) {
}
else if ( aTagName == "separator" ) {
// create menu separator
- int pos = checkInt( attribute( elem, "pos-id" ) );
+ int id = checkInt( attribute( elem, "item-id" ) ); // separator can have ID
+ int pos = checkInt( attribute( elem, "pos-id" ) );
+ int group = checkInt( attribute( elem, "group-id" ),
+ myModule->defaultMenuGroup() );
QAction* action = myModule->createSeparator();
- myModule->createMenu( action, menuId, -1, 80, pos );
+ myModule->createMenu( action, // separator action
+ menuId, // parent menu ID
+ id, // ID
+ group, // group ID
+ pos, // position
+ true ); // create constant menu (not removed by clearMenu())
}
}
node = node.nextSibling();
{
if ( !myModule )
return;
-
+
if ( parentNode.isNull() )
return;
- QDomElement parentElement = parentNode.toElement();
+ QDomElement parentElement = parentNode.toElement();
if ( !parentElement.isNull() ) {
QString aLabel = attribute( parentElement, "label-id" );
if ( !aLabel.isEmpty() ) {
// -1 action ID is not allowed : it means that <item-id> attribute is missed in the XML file!
// also check if the action with given ID is already created
- if ( id != -1 && !myModule->action( SALOME_PYQT_Module::PYQT_ACTION_TOOLBAL + id ) ) {
- // little trick to have several actions with same ID for menus and toolbars
- id = SALOME_PYQT_Module::PYQT_ACTION_TOOLBAL + id;
+ if ( id != -1 ) {
// create toolbar action
QAction* action = myModule->createAction( id, // ID
tooltip, // tooltip
tooltip, // status-bar text
QKeySequence( accel ), // keyboard accelerator
toggle ); // toogled action
- myModule->addAction( SALOME_PYQT_Module::PYQT_ACTION_TOOLBAL, action );
myModule->createTool( action, tbId, -1, pos );
}
}
node = node.nextSibling();
}
}
- }
+ }
}
void SALOME_PYQT_XmlHandler::insertPopupItems( QDomNode& parentNode, QPopupMenu* menu )
{
if ( !myModule )
return;
-
+
if ( parentNode.isNull() )
return;
if ( !pixmap.isNull() )
anIcon = QIconSet( pixmap );
}
-
+
// -1 action ID is not allowed : it means that <item-id> attribute is missed in the XML file!
// also check if the action with given ID is already created
if ( id != -1 ) {
SALOME_PYQT_PyInterp* myInterp;
/* Python GUI module loaded */
PyObjWrapper myModule;
- /* Pytho GUI being initialized (not zero only during the initialization)*/
- static SALOME_PYQT_Module* myInitModule;
-
- typedef QPtrList<QAction> ActionList;
-
- /* own actions list */
- ActionList myMenuActionList;
- ActionList myPopupActionList;
- ActionList myToolbarActionList;
+ /* Python GUI being initialized (not zero only during the initialization)*/
+ static SALOME_PYQT_Module* myInitModule;
+
+ /* own menus list */
+ struct MenuId
+ {
+ int id;
+ bool constantMenu;
+ MenuId() : id( -1 ), constantMenu( false ) {}
+ MenuId( const int _id, const bool _constantMenu )
+ : id( _id ), constantMenu( _constantMenu ) {}
+ };
+ typedef QValueList<MenuId> MenuIdList;
+ typedef QMap<int,MenuIdList> MenuMap;
+ MenuMap myMenus;
- enum PyQtGUIAction { PYQT_ACTION_MENU = 10000000,
- PYQT_ACTION_TOOLBAL = 20000000,
- PYQT_ACTION_POPUP = 30000000 };
-
/* XML resource file parser */
SALOME_PYQT_XmlHandler* myXmlHandler;
/* windows map*/
/* called when study desktop is activated */
virtual void studyActivated();
+ /* returns default menu group */
+ static int defaultMenuGroup();
+
/* working with toolbars : open protected methods */
int createTool( const QString& );
int createTool( const int, const int, const int = -1 );
int createTool( QAction*, const QString&, const int = -1, const int = -1 );
/* working with menus : open protected methods */
- int createMenu( const QString&, const int, const int = -1, const int = -1, const int = -1 );
- int createMenu( const QString&, const QString&, const int = -1, const int = -1, const int = -1 );
- int createMenu( const int, const int, const int = -1, const int = -1 );
- int createMenu( const int, const QString&, const int = -1, const int = -1 );
- int createMenu( QAction*, const int, const int = -1, const int = -1, const int = -1 );
- int createMenu( QAction*, const QString&, const int = -1, const int = -1, const int = -1 );
+ int createMenu( const QString&, const int, const int = -1, const int = -1, const int = -1, const bool = false );
+ int createMenu( const QString&, const QString&, const int = -1, const int = -1, const int = -1, const bool = false );
+ int createMenu( const int, const int, const int = -1, const int = -1, const bool = false );
+ int createMenu( const int, const QString&, const int = -1, const int = -1, const bool = false );
+ int createMenu( QAction*, const int, const int = -1, const int = -1, const int = -1, const bool = false );
+ int createMenu( QAction*, const QString&, const int = -1, const int = -1, const int = -1, const bool = false );
+
+ /* clear given menu */
+ bool clearMenu( const int = 0, const int = 0, const bool = true );
/* create separator : open protected method */
QAction* createSeparator();
QAction* createAction( const int, const QString&, const QString&, const QString&,
const QString&, const int, const bool = false );
+ /* Show/hide menus/toolbars */
+ void setMenuShown( const bool );
+ void setToolShown( const bool );
+
public slots:
/* activation */
virtual bool activateModule( SUIT_Study* );
void onGUIEvent();
void onGUIEvent( int );
+protected:
+ /* Menu processing */
+ bool hasMenu( const QString&, const int );
+ void registerMenu( const int, const int, const bool = false );
+ void unregisterMenu( const int, const int );
+ bool registered( const int, const int = 0 );
+ bool isConstantMenu( const int, const int );
+
+protected slots:
+ void onMenuHighlighted( int, int );
+
private:
/* internal initizalition */
void init ( CAM_Application* );
void contextMenu( const QString&, QPopupMenu* );
/* GUI event processing */
void guiEvent( const int );
-
- /* add action to the private action map */
- void addAction ( const PyQtGUIAction, QAction* );
+ /* Menu highlight processing */
+ void menuHighlight( const int, const int );
/* initialize a Python subinterpreter */
void initInterp ( int );
# Compilation/linkage flags
CPPFLAGS += $(QT_INCLUDES) $(SIP_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(BOOST_CPPFLAGS) -DHAVE_CONFIG_H -I${KERNEL_ROOT_DIR}/include/salome
LIBS += $(PYTHON_LIBS) $(SIP_LIBS) $(PYQT_LIBS) $(VTK_LIBS) $(OGL_LIBS)
-LDFLAGS += -lsuit -lCAM -lstd -lqtx -lSalomeApp -lSalomeSession -lEvent -lLogWindow -lVTKViewer -lToolsGUI -L${KERNEL_ROOT_DIR}/lib/salome -lSalomeDS -lSalomePyQtGUI
+LDFLAGS += -lsuit -lCAM -lstd -lqtx -lSalomeApp -lSalomeSession -lEvent -lLogWindow -lVTKViewer -lToolsGUI -lSalomePyQtGUI
# Custom build step: generate C++ wrapping according to $(SIP_FILES)
return ProcessEvent( new TDumpViewEvent( filename ) );
}
+/*!
+ SalomePyQt::defaultMenuGroup
+ Returns default menu group
+*/
+class TDefMenuGroupEvent: public SALOME_Event {
+public:
+ typedef int TResult;
+ TResult myResult;
+ TDefMenuGroupEvent() : myResult( -1 ) {}
+ virtual void Execute() {
+ myResult = SALOME_PYQT_Module::defaultMenuGroup();
+ }
+};
+int SalomePyQt::defaultMenuGroup()
+{
+ return ProcessEvent( new TDefMenuGroupEvent() );
+}
+
/*!
SalomePyQt::createTool
These methods allow operating with the toolbars:
class CrMenu
{
public:
- CrMenu( const QString& subMenu, const int menu, const int group, const int idx )
- : myCase( 0 ), mySubMenuName( subMenu ), myMenuId( menu ), myGroup( group ), myIndex( idx ) {}
- CrMenu( const QString& subMenu, const QString& menu, const int group, const int idx )
- : myCase( 1 ), mySubMenuName( subMenu ), myMenuName( menu ), myGroup( group ), myIndex( idx ) {}
+ CrMenu( const QString& subMenu, const int menu, const int id, const int group, const int idx )
+ : myCase( 0 ), mySubMenuName( subMenu ), myMenuId( menu ), myId( id ), myGroup( group ), myIndex( idx ) {}
+ CrMenu( const QString& subMenu, const QString& menu, const int id, const int group, const int idx )
+ : myCase( 1 ), mySubMenuName( subMenu ), myMenuName( menu ), myId( id ), myGroup( group ), myIndex( idx ) {}
CrMenu( const int id, const int menu, const int group, const int idx )
: myCase( 2 ), myId( id ), myMenuId( menu ), myGroup( group ), myIndex( idx ) {}
CrMenu( const int id, const QString& menu, const int group, const int idx )
if ( module ) {
switch ( myCase ) {
case 0:
- return module->createMenu( mySubMenuName, myMenuId, -1, myGroup, myIndex );
+ return module->createMenu( mySubMenuName, myMenuId, myId, myGroup, myIndex );
case 1:
- return module->createMenu( mySubMenuName, myMenuName, -1, myGroup, myIndex );
+ return module->createMenu( mySubMenuName, myMenuName, myId, myGroup, myIndex );
case 2:
return module->createMenu( myId, myMenuId, myGroup, myIndex );
case 3:
}
}
};
-int SalomePyQt::createMenu( const QString& subMenu, const int menu, const int group, const int idx )
+int SalomePyQt::createMenu( const QString& subMenu, const int menu, const int id, const int group, const int idx )
{
- return ProcessEvent( new TCreateMenuEvent( CrMenu( subMenu, menu, group, idx ) ) );
+ return ProcessEvent( new TCreateMenuEvent( CrMenu( subMenu, menu, id, group, idx ) ) );
}
-int SalomePyQt::createMenu( const QString& subMenu, const QString& menu, const int group, const int idx )
+int SalomePyQt::createMenu( const QString& subMenu, const QString& menu, const int id, const int group, const int idx )
{
- return ProcessEvent( new TCreateMenuEvent( CrMenu( subMenu, menu, group, idx ) ) );
+ return ProcessEvent( new TCreateMenuEvent( CrMenu( subMenu, menu, id, group, idx ) ) );
}
int SalomePyQt::createMenu( const int id, const int menu, const int group, const int idx )
{
return ProcessEvent( new TActionIdEvent( a ) );
}
+
+/*!
+ SalomePyQt::clearMenu
+ Clears given menu (recursively if necessary)
+*/
+class TClearMenuEvent: public SALOME_Event {
+public:
+ typedef bool TResult;
+ TResult myResult;
+ int myId;
+ int myMenu;
+ bool myRemoveActions;
+ TClearMenuEvent( const int id, const int menu, const bool removeActions )
+ : myResult( false ), myId( id ), myMenu( menu ), myRemoveActions( removeActions ) {}
+ virtual void Execute() {
+ if ( SalomeApp_Application* anApp = getApplication() ) {
+ SALOME_PYQT_Module* module = SALOME_PYQT_Module::getInitModule();
+ if ( !module )
+ module = dynamic_cast<SALOME_PYQT_Module*>( anApp->activeModule() );
+ if ( module )
+ myResult = module->clearMenu( myId, myMenu, myRemoveActions );
+ }
+ }
+};
+bool SalomePyQt::clearMenu( const int id, const int menu, const bool removeActions )
+{
+ return ProcessEvent( new TClearMenuEvent( id, menu, removeActions ) );
+}
+
static bool dumpView( const QString& );
+ static int defaultMenuGroup();
+
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 QString&, const int = -1, const int = -1 );
static int createMenu( const QString&, const int = -1,
- const int = -1, const int = -1 );
+ const int = -1, const int = -1, const int = -1 );
static int createMenu( const QString&, const QString& = QString::null,
- const int = -1, const int = -1 );
+ const int = -1, const int = -1, const int = -1 );
static int createMenu( const int, const int = -1,
const int = -1, const int = -1 );
static int createMenu( const int, const QString& = QString::null,
static QtxAction* action( const int );
static int actionId( const QtxAction* );
+ static bool clearMenu( const int = 0, const int = 0,
+ const bool = true );
+
static void addSetting ( const QString&, const QString&, const double );
static void addSetting ( const QString&, const QString&, const int );
static void addSetting ( const QString&, const QString&, const QString& );
static bool dumpView( const QString& );
+ static int defaultMenuGroup();
+
static int createTool( const QString& );
static int createTool( const int, const int, int = -1 );
static int createTool( const int, const QString&, int = -1 );
static int createTool( QtxAction*, const QString&, int = -1, int = -1 );
static int createMenu( const QString&, const int,
- int = -1, int = -1 );
+ int = -1, int = -1, int = -1 );
static int createMenu( const QString&, const QString&,
- int = -1, int = -1 );
+ int = -1, int = -1, int = -1 );
static int createMenu( const int, const int,
int = -1, int = -1 );
static int createMenu( const int, const QString&,
static QtxAction* action( const int );
static int actionId( const QtxAction* );
+ static bool clearMenu( int = 0, int = 0,
+ bool = true );
+
static void addSetting ( const QString&, const QString&, const double );
static void addSetting ( const QString&, const QString&, const int /Constrained/ );
static void addSetting ( const QString&, const QString&, const QString& );
static void addSetting ( const QString&, const QString&, const QColor& );
static int integerSetting( const QString&, const QString&, int = 0 );
static double doubleSetting ( const QString&, const QString&, int = 0 );
- static bool boolSetting ( const QString&, const QString&, bool = 0 );
+ static bool boolSetting ( const QString&, const QString&, bool = false );
static QString stringSetting ( const QString&, const QString&, const QString& = QString("") );
static QColor colorSetting ( const QString&, const QString&, const QColor& = QColor() );
static void removeSetting ( const QString&, const QString& );
static void updateObjBrowser( const int = 0, bool = true );
static QString getFileName ( QWidget*, const QString&, const QStringList&, const QString&, bool ) /ReleaseGIL/ ;
- static QStringList getOpenFileNames ( QWidget*, const QString&, const QStringList&, const QString& );
- static QString getExistingDirectory( QWidget*, const QString&, const QString& );
+ static QStringList getOpenFileNames ( QWidget*, const QString&, const QStringList&, const QString& ) /ReleaseGIL/ ;
+ static QString getExistingDirectory( QWidget*, const QString&, const QString& ) /ReleaseGIL/ ;
static void helpContext( const QString&, const QString& );
static bool dumpView( const QString& );
+ static int defaultMenuGroup();
+
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 QString&, const int = -1, const int = -1 );
static int createMenu( const QString&, const int,
- const int = -1, const int = -1 );
+ const int = -1, const int = -1, const int = -1 );
static int createMenu( const QString&, const QString&,
- const int = -1, const int = -1 );
+ const int = -1, const int = -1, const int = -1 );
static int createMenu( const int, const int,
const int = -1, const int = -1 );
static int createMenu( const int, const QString&,
const int = -1, const int = -1 );
static int createMenu( QtxAction*, const QString&, const int = -1,
const int = -1, const int = -1 );
-
static QtxAction* createSeparator();
static QtxAction* createAction( const int, const QString&,
static QtxAction* action( const int );
static int actionId( const QtxAction* );
+ static bool clearMenu( const int = 0, const int = 0,
+ const bool = true );
+
static void addSetting ( const QString&, const QString&, const double );
static void addSetting ( const QString&, const QString&, const int /Constrained/ );
static void addSetting ( const QString&, const QString&, const QString& );
static void addSetting ( const QString&, const QString&, const QColor& );
static int integerSetting( const QString&, const QString&, const int = 0 );
static double doubleSetting ( const QString&, const QString&, const int = 0 );
- static bool boolSetting ( const QString&, const QString&, const bool = 0 );
+ static bool boolSetting ( const QString&, const QString&, const bool = false );
static QString stringSetting ( const QString&, const QString&, const QString& = QString("") );
static QColor colorSetting ( const QString&, const QString&, const QColor& = QColor() );
static void removeSetting ( const QString&, const QString& );
import SALOME_Session_idl
+from import_hook import register_name
+register_name("SalomePyQt")
+
# this function is required
def init_shared_modules():
# SALOME_GenericObj.idl
#CPPFLAGS+=$(QT_INCLUDES) $(OCC_INCLUDES) $(OGL_INCLUDES) $(PYTHON_INCLUDES) $(QWT_INCLUDES) $(BOOST_CPPFLAGS) -I$(KERNEL_ROOT_DIR)/include/salome
-CPPFLAGS+=$(QT_INCLUDES) $(OCC_INCLUDES) $(QWT_INCLUDES) $(BOOST_CPPFLAGS) -I$(KERNEL_ROOT_DIR)/include/salome
-LDFLAGS+=$(QT_MT_LIBS) $(QWT_LIBS) -L$(KERNEL_ROOT_DIR)/lib/salome -lsuit -lPlot2d -lSalomePrs
+CPPFLAGS+=$(QT_INCLUDES) $(OCC_INCLUDES) $(QWT_INCLUDES) $(BOOST_CPPFLAGS)
+LDFLAGS+=$(QT_MT_LIBS) $(QWT_LIBS) -lsuit -lPlot2d -lSalomePrs
@CONCLUDE@
// Create menus
- int fileMenu = createMenu( tr( "MEN_DESK_FILE" ), -1, -1, 0 );
- int editMenu = createMenu( tr( "MEN_DESK_EDIT" ), -1, -1, 10 );
- int viewMenu = createMenu( tr( "MEN_DESK_VIEW" ), -1, -1, 10 );
- int helpMenu = createMenu( tr( "MEN_DESK_HELP" ), -1, -1, 1000 );
+ int fileMenu = createMenu( tr( "MEN_DESK_FILE" ), -1, MenuFileId, 0 );
+ int editMenu = createMenu( tr( "MEN_DESK_EDIT" ), -1, MenuEditId, 10 );
+ int viewMenu = createMenu( tr( "MEN_DESK_VIEW" ), -1, MenuViewId, 10 );
+ int helpMenu = createMenu( tr( "MEN_DESK_HELP" ), -1, MenuHelpId, 1000 );
// Create menu items
- createMenu( FileNewId, fileMenu, 0 );
- createMenu( FileOpenId, fileMenu, 0 );
- createMenu( FileLoadId, fileMenu, 0 ); //SRN: BugID IPAL9021, add a menu item "Load"
- createMenu( FileCloseId, fileMenu, 0 );
- createMenu( separator(), fileMenu, -1, 0 );
- createMenu( FileSaveId, fileMenu, 0 );
+ createMenu( FileNewId, fileMenu, 0 );
+ createMenu( FileOpenId, fileMenu, 0 );
+ createMenu( FileLoadId, fileMenu, 0 ); //SRN: BugID IPAL9021, add a menu item "Load"
+ createMenu( FileCloseId, fileMenu, 0 );
+ createMenu( separator(), fileMenu, -1, 0 );
+ createMenu( FileSaveId, fileMenu, 0 );
createMenu( FileSaveAsId, fileMenu, 0 );
- createMenu( separator(), fileMenu, -1, 0 );
+ createMenu( separator(), fileMenu, -1, 0 );
- createMenu( separator(), fileMenu );
- createMenu( FileExitId, fileMenu );
+ createMenu( separator(), fileMenu );
+ createMenu( FileExitId, fileMenu );
- createMenu( EditCopyId, editMenu );
+ createMenu( EditCopyId, editMenu );
createMenu( EditPasteId, editMenu );
createMenu( separator(), editMenu );
- createMenu( ViewWindowsId, viewMenu );
+ createMenu( ViewWindowsId, viewMenu );
createMenu( ViewStatusBarId, viewMenu );
- createMenu( separator(), viewMenu );
+ createMenu( separator(), viewMenu );
createMenu( HelpAboutId, helpMenu );
createMenu( separator(), helpMenu );
for ( int i = EditCopyId; i <= EditPasteId; i++ )
{
- mMgr->setShown( i, myEditEnabled );
- tMgr->setShown( i, myEditEnabled );
+ mMgr->setShown( mMgr->actionId(action(i)), myEditEnabled );
+ tMgr->setShown( tMgr->actionId(action(i)), myEditEnabled );
}
}
virtual void onViewManagerActivated( SUIT_ViewManager* );
protected:
- enum { FileNewId, FileOpenId, FileCloseId, FileSaveId, FileSaveAsId,
- FileExitId, EditCutId, EditCopyId, EditPasteId, ViewStatusBarId,
- NewWindowId, HelpAboutId, ViewWindowsId, FileLoadId, UserID };
+ enum { MenuFileId = 1,
+ MenuViewId = 2,
+ MenuEditId = 3,
+ MenuHelpId = 7
+ };
+
+ enum { FileNewId, FileOpenId, FileLoadId, FileCloseId,
+ FileSaveId, FileSaveAsId, FileExitId,
+ ViewStatusBarId, ViewWindowsId, NewWindowId,
+ EditCutId, EditCopyId, EditPasteId,
+ HelpAboutId,
+ UserID
+ };
protected:
virtual void createActions();
if ( !mMgr )
return;
- int winMenuId = mMgr->insert( tr( "MEN_DESK_WINDOW" ), -1, 100 );
+ int winMenuId = mMgr->insert( tr( "MEN_DESK_WINDOW" ), -1, 100, MenuWindowId );
mMgr->insert( myWorkspaceAction, winMenuId, -1 );
mMgr->insert( QtxActionMenuMgr::separator(), winMenuId, -1 );
}
Q_OBJECT
public:
+ enum { MenuWindowId = 6 };
enum { Cascade, Tile, HTile, VTile };
public:
if ( !mMgr )
return;
- int winMenuId = mMgr->insert( tr( "MEN_DESK_WINDOW" ), -1, 100 );
+ int winMenuId = mMgr->insert( tr( "MEN_DESK_WINDOW" ), -1, 100, MenuWindowId );
mMgr->insert( myWorkstackAction, winMenuId, -1 );
mMgr->insert( QtxActionMenuMgr::separator(), winMenuId, -1 );
}
Q_OBJECT
public:
+ enum { MenuWindowId = 6 };
enum { VSplit, HSplit };
public:
//////////////////////////////////////////////////////////////////////
#include "SUIT_Accel.h"
-#include "SUIT_Desktop.h"
-#include "SUIT_ViewManager.h"
#include "SUIT_ViewWindow.h"
+#include "SUIT_ViewManager.h"
#include "SUIT_ViewModel.h"
-#include <qaccel.h>
+#include <qobjectlist.h>
+#include <qapplication.h>
+#include <qnamespace.h>
+
/*!\class SUIT_Accel
* Class handles keyboard accelerator bindings.
*/
+SUIT_Accel* SUIT_Accel::myself = 0;
-/*! Constructor.*/
-SUIT_Accel::SUIT_Accel(SUIT_Desktop* theDesktop)
- : QObject( theDesktop, "SUIT_Accel" ),
- myDesktop( theDesktop )
+/*! Constructor [private].*/
+SUIT_Accel::SUIT_Accel()
+ : QObject( qApp, "SUIT_Accel" )
{
- myAccel = new QAccel( theDesktop, "SUIT_Accel_interal_qaccel" );
- connect( myAccel, SIGNAL( activated( int ) ), this, SLOT( onActivated( int ) ) );
+ qApp->installEventFilter( this );
}
-/*! Destructor.*/
-SUIT_Accel::~SUIT_Accel()
+/*! getAccel() : public interface for SUIT_Accel object. Only one instance is created and returned. */
+SUIT_Accel* SUIT_Accel::getAccel()
{
+ if ( !myself )
+ myself = new SUIT_Accel();
+ return myself;
}
-/*! setActionKey assign a ceratain action for a key accelerator */
+/*! setActionKey() : assign a ceratain action for a key accelerator */
void SUIT_Accel::setActionKey( const int action, const int key, const QString& type )
-{
- // 1. get or generate interal "id" of action
- int id = myAccel->findKey( key );
- if ( id == -1 )
- id = myAccel->insertItem( key );
-
+{
IdActionMap idActionMap;
if ( myMap.contains( type ) )
idActionMap = myMap[type];
- idActionMap[id] = action;
+ idActionMap[key] = action;
myMap[type] = idActionMap;
+
+ myOptMap[key] = true;
}
-/*! onActivated slot called when a registered key accelerator was activated */
-void SUIT_Accel::onActivated( int id )
+/*! unsetActionKey() : unregister a certain key accelerator */
+void SUIT_Accel::unsetActionKey( const int key, const QString& type )
{
- if ( myDesktop ) {
- if ( SUIT_ViewWindow* vw = myDesktop->activeWindow() ) {
+ if ( myMap.contains( type ) ) {
+ IdActionMap idActionMap = myMap[type];
+ if ( idActionMap.contains( key ) ) {
+ idActionMap.erase( key );
+ myMap[type] = idActionMap;
+ }
+ }
+}
+
+/*! getParentViewWindow() : returns given object or any of its parents-grandparents-.. if it is a SUIT_ViewWindow */
+SUIT_ViewWindow* getParentViewWindow( const QObject* obj )
+{
+ if ( obj ) {
+ if ( obj->inherits( "SUIT_ViewWindow" ) )
+ return (SUIT_ViewWindow*)obj;
+ else
+ return getParentViewWindow( obj->parent() );
+ }
+ return 0;
+}
+
+/*! getKey() : returns integer key code (with modifiers) made of key pressed 'inside' given event */
+int getKey( QKeyEvent *keyEvent )
+{
+ int key = keyEvent->key(),
+ state = keyEvent->state();
+ if ( state & Qt::ShiftButton )
+ key += Qt::SHIFT;
+ if ( state & Qt::ControlButton )
+ key += Qt::CTRL;
+ if ( state & Qt::AltButton )
+ key += Qt::ALT;
+ if ( state & Qt::MetaButton )
+ key += Qt::META;
+ return key;
+}
+
+/*! getAccelKey() : returns key pressed if 1) event was KeyPress 2) pressed key is a registered accelerator */
+int SUIT_Accel::getAccelKey( QEvent *event )
+{
+ if ( event && event->type() == QEvent::KeyPress ) {
+ int key = ::getKey( (QKeyEvent*)event );
+ if ( myOptMap.contains( key ) )
+ return key;
+ }
+ return 0;
+}
+
+/*! eventFilter() : filtering ALL events of QApplication. */
+bool SUIT_Accel::eventFilter( QObject *obj, QEvent *event )
+{
+ const int key = getAccelKey( event );
+ if ( key ) {
+ SUIT_ViewWindow* vw = ::getParentViewWindow( obj );
+ if ( vw ) {
QString type = vw->getViewManager()->getViewModel()->getType();
- if ( myMap.contains( type ) ) {
+ if ( myMap.contains( type ) ) {
IdActionMap idActionMap = myMap[type];
- if ( idActionMap.contains( id ) ) {
- vw->onAccelAction( idActionMap[id] );
+ if ( idActionMap.contains( key ) ) {
+ vw->onAccelAction( idActionMap[key] );
+ return true;
}
}
}
}
+ return false;
}
-
+
#include <qstring.h>
#include <qmap.h>
-class QAccel;
-class SUIT_Desktop;
-
class SUIT_EXPORT SUIT_Accel: public QObject
{
Q_OBJECT
};
public:
- SUIT_Accel( SUIT_Desktop* theDesktop );
- virtual ~SUIT_Accel();
+ static SUIT_Accel* getAccel();
void setActionKey( const int action, const int key, const QString& type );
+ void unsetActionKey( const int key, const QString& type );
-protected slots:
- void onActivated( int );
+protected:
+ bool eventFilter( QObject *, QEvent * );
private:
- QAccel* myAccel;
- SUIT_Desktop* myDesktop;
+ SUIT_Accel();
+
+ int getAccelKey( QEvent* ); // returns key pressed if 1) event was KeyPress
+ // 2) pressed key is a registered accelerator
- typedef QMap<int, int> IdActionMap; // internal_id - to - action map
+ typedef QMap<int, int> IdActionMap; // key - to - action_id map
typedef QMap<QString, IdActionMap> ViewerTypeIdActionMap; // viewer_type - to - IdActionMap
ViewerTypeIdActionMap myMap;
+
+ QMap<int, bool> myOptMap; // key - to - <not_used> map, used for optimazation. all registered keys (accelerators)
+ // are stored in this map.
+
+ static SUIT_Accel* myself;
};
#endif
if ( !desktop() || !desktop()->toolMgr() )
return -1;
- int regId = desktop()->toolMgr()->registerAction( a, id );
- return desktop()->toolMgr()->insert( regId, tBar, idx );
+ int regId = registerAction( id, a );
+ int intId = desktop()->toolMgr()->insert( a, tBar, idx );
+ return intId != -1 ? regId : -1;
}
int SUIT_Application::createTool( QAction* a, const QString& tBar, const int id, const int idx )
if ( !desktop() || !desktop()->toolMgr() )
return -1;
- return desktop()->toolMgr()->insert( a, tBar, idx );
+ int regId = registerAction( id, a );
+ int intId = desktop()->toolMgr()->insert( a, tBar, idx );
+ return intId != -1 ? regId : -1;
}
int SUIT_Application::createTool( const int id, const int tBar, const int idx )
if ( !desktop() || !desktop()->toolMgr() )
return -1;
- return desktop()->toolMgr()->insert( id, tBar, idx );
+ int intId = desktop()->toolMgr()->insert( action( id ), tBar, idx );
+ return intId != -1 ? id : -1;
}
int SUIT_Application::createTool( const int id, const QString& tBar, const int idx )
if ( !desktop() || !desktop()->toolMgr() )
return -1;
- return desktop()->toolMgr()->insert( id, tBar, idx );
+ int intId = desktop()->toolMgr()->insert( action( id ), tBar, idx );
+ return intId != -1 ? id : -1;
}
int SUIT_Application::createMenu( const QString& subMenu, const int menu,
if ( !desktop() || !desktop()->menuMgr() )
return -1;
- return desktop()->menuMgr()->insert( subMenu, menu, group, index );
+ return desktop()->menuMgr()->insert( subMenu, menu, group, id, index );
}
int SUIT_Application::createMenu( const QString& subMenu, const QString& menu,
if ( !desktop() || !desktop()->menuMgr() )
return -1;
- return desktop()->menuMgr()->insert( subMenu, menu, group, index );
+ return desktop()->menuMgr()->insert( subMenu, menu, group, id, index );
}
int SUIT_Application::createMenu( QAction* a, const int menu, const int id, const int group, const int index )
if ( !a || !desktop() || !desktop()->menuMgr() )
return -1;
- int regId = desktop()->menuMgr()->registerAction( a, id );
- return desktop()->menuMgr()->insert( regId, menu, group, index );
+ int regId = registerAction( id, a );
+ int intId = desktop()->menuMgr()->insert( a, menu, group, index );
+ return intId != -1 ? regId : -1;
}
int SUIT_Application::createMenu( QAction* a, const QString& menu, const int id, const int group, const int index )
if ( !a || !desktop() || !desktop()->menuMgr() )
return -1;
- int regId = desktop()->menuMgr()->registerAction( a, id );
- return desktop()->menuMgr()->insert( regId, menu, group, index );
+ int regId = registerAction( id, a );
+ int intId = desktop()->menuMgr()->insert( a, menu, group, index );
+ return intId != -1 ? regId : -1;
}
int SUIT_Application::createMenu( const int id, const int menu, const int group, const int index )
if ( !desktop() || !desktop()->menuMgr() )
return -1;
- return desktop()->menuMgr()->insert( id, menu, group, index );
+ int intId = desktop()->menuMgr()->insert( action( id ), menu, group, index );
+ return intId != -1 ? id : -1;
}
int SUIT_Application::createMenu( const int id, const QString& menu, const int group, const int index )
if ( !desktop() || !desktop()->menuMgr() )
return -1;
- return desktop()->menuMgr()->insert( id, menu, group, index );
+ int intId = desktop()->menuMgr()->insert( action( id ), menu, group, index );
+ return intId != -1 ? id : -1;
}
void SUIT_Application::setMenuShown( QAction* a, const bool on )
QAction* SUIT_Application::action( const int id ) const
{
- SUIT_Application* that = (SUIT_Application*)this;
- SUIT_Desktop* desk = that->desktop();
- if ( !desk )
- return 0;
-
QAction* a = 0;
- if ( desk->menuMgr() )
- a = desk->menuMgr()->action( id );
- if ( !a && desk->toolMgr() )
- a = desk->toolMgr()->action( id );
+ if ( myActionMap.contains( id ) )
+ a = myActionMap[id];
return a;
}
int SUIT_Application::actionId( const QAction* a ) const
{
- SUIT_Application* that = (SUIT_Application*)this;
- SUIT_Desktop* desk = that->desktop();
- if ( !desk )
- return 0;
-
int id = -1;
- if ( desk->menuMgr() )
- id = desk->menuMgr()->actionId( a );
- if ( id == -1 && desk->toolMgr() )
- id = desk->toolMgr()->actionId( a );
+ for ( QMap<int, QAction*>::ConstIterator it = myActionMap.begin();
+ it != myActionMap.end() && id == -1;
+ ++it ) {
+ if ( it.data() == a )
+ id = it.key();
+ }
return id;
}
return a;
}
-void SUIT_Application::registerAction( const int id, QAction* a )
+int SUIT_Application::registerAction( const int id, QAction* a )
{
+ int ident = actionId( a );
+ if ( ident != -1 )
+ return ident;
+
+ static int generatedId = -1;
+ ident = id == -1 ? --generatedId : id;
+
+ if ( action( ident ) )
+ qWarning( "Action registration id is already in use: %d", ident );
+
+ myActionMap.insert( ident, a );
+
if ( desktop() && desktop()->menuMgr() )
- desktop()->menuMgr()->registerAction( a, id );
+ desktop()->menuMgr()->registerAction( a );
if ( desktop() && desktop()->toolMgr() )
- desktop()->toolMgr()->registerAction( a, id );
+ desktop()->toolMgr()->registerAction( a );
+
+ return ident;
}
QAction* SUIT_Application::separator()
static QAction* separator();
QAction* action( const int ) const;
int actionId( const QAction* ) const;
- void registerAction( const int, QAction* );
+ int registerAction( const int, QAction* );
QAction* createAction( const int, const QString&, const QIconSet&, const QString&,
const QString&, const int, QObject* = 0,
const bool = false, QObject* = 0, const char* = 0 );
private:
SUIT_Study* myStudy;
SUIT_Desktop* myDesktop;
+ QMap<int, QAction*> myActionMap;
QLabel* myStatusLabel;
};
#include "SUIT_DataObjectKey.h"
-#include <iostream> // for cout in dump()
-
/*!
Constructor
*/
void SUIT_DataObject::dump( const int indent ) const
{
QString strIndent = QString().fill( ' ', indent ); // indentation string
- std::cout << strIndent << name() << std::endl; // dump to cout
+ printf( "%s%s\n", strIndent.latin1(), name().latin1() );
for ( DataObjectListIterator it( myChildren ); it.current(); ++it ) // iterate all children
it.current()->dump( indent + 2 ); // dump every child with indent + 2 spaces
}
{
if ( !qApp )
return;
-
+
+ while ( QApplication::overrideCursor() )
+ QApplication::restoreOverrideCursor();
+
SUIT_MessageBox::error1( qApp->mainWidget(), title, msg, "OK" );
}
#ifdef WIN32
lib = ::LoadLibrary( (char*)libFile.latin1() );
#else
- lib = dlopen( (char*)libFile.latin1(), RTLD_LAZY );
+ lib = dlopen( (char*)libFile.latin1(), RTLD_LAZY /*| RTLD_GLOBAL */ );
#endif
return lib;
}
{
return false;
}
+
+/*!
+ * \brief Stores the study state
+*/
+int SUIT_Study::storeState()
+{
+ return -1;
+}
+
+/*!
+ * \brief Restores the study state
+*/
+void SUIT_Study::restoreState(int savePoint)
+{
+}
bool suspend( SUIT_Operation* );
bool resume( SUIT_Operation* );
+ virtual int storeState();
+ virtual void restoreState(int savePoint);
+
signals:
void studyModified( SUIT_Study* );
template <class SrcItem, class TrgItem, class TreeData>
TrgItem synchronize( const SrcItem& r1, const TrgItem& r2, const TreeData& td )
{
- // printf( "--- synchronize : %d ---\n", ++gSync );
-
if( td.isEqual( r1, r2 ) )
{
+ // update items themselves
+ td.updateItem( r2 );
+
+ // iterate 'siblings' (direct children)
QValueList< DiffItem< SrcItem, TrgItem > > d;
diffSiblings( r1, r2, d, td );
void SUIT_ViewWindow::action( const int )
{
}
+
+QString SUIT_ViewWindow::getVisualParameters()
+{
+ return "empty";
+}
+
+void SUIT_ViewWindow::setVisualParameters( const QString& parameters )
+{
+}
void onAccelAction( int );
+ virtual QString getVisualParameters();
+ virtual void setVisualParameters( const QString& parameters );
+
public slots:
virtual void onDumpView();
LIB_CLIENT_IDL =
CPPFLAGS+=$(QT_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
-LDFLAGS+=$(QT_MT_LIBS) -L$(top_builddir)/lib
+LDFLAGS+=$(QT_MT_LIBS) -L$(top_builddir)/lib -lsuit
@CONCLUDE@
#include "SVTK_CubeAxesActor2D.h"
#include "QtxAction.h"
+#include "QtxIntSpinBox.h"
#include <qlayout.h>
#include <qframe.h>
aHBox = new QHBox(myLabelsGrp);
aHBox->setSpacing(5);
aLabel = new QLabel(tr("NUMBER"), aHBox);
- myLabelNumber = new QLineEdit(aHBox);
- myLabelNumber->setValidator(new QIntValidator(0, 25, this));
- myLabelNumber->installEventFilter(this);
+ myLabelNumber = new QtxIntSpinBox(0,25,1,aHBox,"SpinBoxLabelNumber");
aLabels.append(aLabel);
aHBox = new QHBox(myLabelsGrp);
aHBox->setSpacing(5);
aLabel = new QLabel(tr("OFFSET"), aHBox);
- myLabelOffset = new QLineEdit(aHBox);
+ myLabelOffset = new QtxIntSpinBox(0,100,1,aHBox,"SpinBoxLabellOffset");
aLabels.append(aLabel);
aHBox = new QHBox(myLabelsGrp);
aHBox = new QHBox(myTicksGrp);
aHBox->setSpacing(5);
aLabel = new QLabel(tr("LENGTH"), aHBox);
- myTickLength = new QLineEdit(aHBox);
+ myTickLength = new QtxIntSpinBox(0,100,1,aHBox,"SpinBoxTickLength");
+
aLabels.append(aLabel);
// Layout
onTicksChecked();
}
-bool SVTK_AxisWidget::eventFilter(QObject* o, QEvent* e)
-{
- if (e->type() == QEvent::FocusOut) {
- bool isOK = false;
- int k = myLabelNumber->text().toInt(&isOK);
- if (isOK && k > 25) myLabelNumber->setText("25");
- }
- return false;
-}
-
//=======================================================================
// name : SVTK_AxisWidget::onNameChecked
// Purpose :
}
myIsLabelsVisible->setChecked(useLabels);
- myLabelNumber->setText(QString("%1").arg(nbLabels));
- myLabelOffset->setText(QString("%1").arg(anOffset));
+ myLabelNumber->setValue(nbLabels);
+ myLabelOffset->setValue(anOffset);
myLabelsFont->SetData(aLabelsColor, aLabelsFontFamily, isLabelsBold, isLabelsItalic, isLabelsShadow);
// Tick marks
int aTickLength = theActor->GetTickLength();
myIsTicksVisible->setChecked(useTickMarks);
- myTickLength->setText(QString("%1").arg(aTickLength));
+ myTickLength->setValue(aTickLength);
return true;
}
theActor->SetLabelVisibility(myIsLabelsVisible->isChecked() ? 1 : 0);
- bool isOk = false;
- int nbLabels = myLabelNumber->text().toInt(&isOk);
- if (isOk)
- theActor->SetNumberOfLabels(nbLabels);
+ int nbLabels = myLabelNumber->value();
+ theActor->SetNumberOfLabels(nbLabels);
- int anOffset = myLabelOffset->text().toInt(&isOk);
- if (isOk)
- theActor->SetTickOffset(anOffset);
+ int anOffset = myLabelOffset->value();
+ theActor->SetTickOffset(anOffset);
QColor aLabelsColor(255, 255, 255);
int aLabelsFontFamily = VTK_ARIAL;
// Tick marks
theActor->SetTickVisibility(myIsTicksVisible->isChecked());
- int aTickLength = myTickLength->text().toInt(&isOk);
- if (isOk)
- theActor->SetTickLength(aTickLength);
+ int aTickLength = myTickLength->value();
+ theActor->SetTickLength(aTickLength);
return true;
}
try
{
+ QWidget *aCurrWid = this->focusWidget();
+ aCurrWid->clearFocus();
+ aCurrWid->setFocus();
+
isOk = isOk && myAxes[ 0 ]->Apply(myActor->GetXAxisActor2D());
isOk = isOk && myAxes[ 1 ]->Apply(myActor->GetYAxisActor2D());
isOk = isOk && myAxes[ 2 ]->Apply(myActor->GetZAxisActor2D());
class QGroupBox;
class QtxAction;
+class QtxIntSpinBox;
class vtkAxisActor2D;
class SVTK_CubeAxesActor2D;
bool ReadData( vtkAxisActor2D* );
bool Apply( vtkAxisActor2D* );
-protected:
- bool eventFilter(QObject*, QEvent*);
-
private slots:
void onNameChecked();
void onLabelsChecked();
// labels
QGroupBox* myLabelsGrp;
QCheckBox* myIsLabelsVisible;
- QLineEdit* myLabelNumber;
- QLineEdit* myLabelOffset;
+ QtxIntSpinBox* myLabelNumber;
+ QtxIntSpinBox* myLabelOffset;
SVTK_FontWidget* myLabelsFont;
// tick marks
QGroupBox* myTicksGrp;
QCheckBox* myIsTicksVisible;
- QLineEdit* myTickLength;
+ QtxIntSpinBox* myTickLength;
friend class SVTK_CubeAxesDlg;
};
//----------------------------------------------------------------------------
void
SVTK_MainWindow
-::SetTrihedronSize( const int theSize )
+::SetTrihedronSize( const int theSize, const bool theRelative )
{
- GetRenderer()->SetTrihedronSize(theSize);
+ GetRenderer()->SetTrihedronSize(theSize, theRelative);
Repaint();
}
//! Redirect the request to #SVTK_Renderer::SetTrihedronSize
void
- SetTrihedronSize(const int theSize);
+ SetTrihedronSize(const int theSize, const bool theRelative = true);
//! Redirect the request to #SVTK_Renderer::AdjustActors
void
QVTK_RenderWindowInteractor
::paintEvent( QPaintEvent* theEvent )
{
- GetDevice()->Render();
+ GetDevice()->CreateTimer(VTKI_TIMER_FIRST);
}
myTransform(VTKViewer_Transform::New()),
myCubeAxes(SVTK_CubeAxesActor2D::New()),
myTrihedron(SVTK_Trihedron::New()),
- myTrihedronSize(105)
+ myTrihedronSize(105),
+ myIsTrihedronRelative(true)
{
myDevice->Delete();
myTransform->Delete();
// if the new trihedron size have sufficient difference, then apply the value
double aSize = myTrihedron->GetSize();
- ComputeTrihedronSize(GetDevice(),aSize,aSize,myTrihedronSize);
- myTrihedron->SetSize(aSize);
+ if ( IsTrihedronRelative() )
+ {
+ ComputeTrihedronSize(GetDevice(),aSize,aSize,myTrihedronSize);
+ myTrihedron->SetSize(aSize);
+ }
+ else
+ myTrihedron->SetSize( myTrihedronSize );
// iterate through displayed objects and set size if necessary
vtkActorCollection* anActors = GetDevice()->GetActors();
void
SVTK_Renderer
-::SetTrihedronSize(int theSize)
+::SetTrihedronSize(int theSize, const bool theRelative)
{
- if(myTrihedronSize != theSize){
+ if(myTrihedronSize != theSize || myIsTrihedronRelative != theRelative){
myTrihedronSize = theSize;
+ myIsTrihedronRelative = theRelative;
AdjustActors();
}
}
return myTrihedronSize;
}
+bool
+SVTK_Renderer
+::IsTrihedronRelative() const
+{
+ return myIsTrihedronRelative;
+}
//----------------------------------------------------------------------------
VTKViewer_Trihedron*
//! Set size of the trihedron in percents from bounding box of the scene
void
- SetTrihedronSize(int theSize);
+ SetTrihedronSize(int theSize, const bool theRelative = true);
//! Get size of the trihedron in percents from bounding box of the scene
int
GetTrihedronSize() const;
+ //! Shows if the size of the trihedron is relative
+ bool
+ IsTrihedronRelative() const;
+
//----------------------------------------------------------------------------
//! Get trihedron control
VTKViewer_Trihedron*
//----------------------------------------------------------------------------
vtkSmartPointer<SVTK_CubeAxesActor2D> myCubeAxes;
vtkSmartPointer<VTKViewer_Trihedron> myTrihedron;
- int myTrihedronSize;
+ int myTrihedronSize;
+ bool myIsTrihedronRelative;
float myBndBox[6];
};
SVTK_Viewer::SVTK_Viewer()
{
myTrihedronSize = 105;
+ myTrihedronRelative = true;
}
//==========================================================
for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
if(SUIT_ViewWindow* aViewWindow = aViews.at(i)){
if(TViewWindow* aView = dynamic_cast<TViewWindow*>(aViewWindow)){
- aView->getMainWindow()->SetBackgroundColor(theColor);
+ aView->setBackgroundColor(theColor);
}
}
}
}
//==========================================================
-SUIT_ViewWindow*
+SUIT_ViewWindow*
SVTK_Viewer::
createView( SUIT_Desktop* theDesktop )
{
- SVTK_ViewWindow* aViewWindow = new SVTK_ViewWindow(theDesktop);
+ TViewWindow* aViewWindow = new TViewWindow(theDesktop);
aViewWindow->Initialize(this);
-
+
aViewWindow->setBackgroundColor( backgroundColor() );
- aViewWindow->SetTrihedronSize( trihedronSize() );
+ aViewWindow->SetTrihedronSize( trihedronSize(), trihedronRelative() );
return aViewWindow;
}
return myTrihedronSize;
}
-void SVTK_Viewer::setTrihedronSize( const int sz )
+bool SVTK_Viewer::trihedronRelative() const
{
- myTrihedronSize = sz;
-
- SUIT_ViewManager* vm = getViewManager();
- if ( !vm )
- return;
-
- QPtrVector<SUIT_ViewWindow> vec = vm->getViews();
- for ( int i = 0; i < vec.count(); i++ )
- {
- SUIT_ViewWindow* win = vec.at( i );
- if ( !win || !win->inherits( "SVTK_ViewWindow" ) )
- continue;
+ return myTrihedronRelative;
+}
- SVTK_ViewWindow* vw = (SVTK_ViewWindow*)win;
- vw->SetTrihedronSize( sz );
+void SVTK_Viewer::setTrihedronSize( const int theSize, const bool theRelative )
+{
+ myTrihedronSize = theSize;
+ myTrihedronRelative = theRelative;
+
+ if (SUIT_ViewManager* aViewManager = getViewManager()) {
+ QPtrVector<SUIT_ViewWindow> aViews = aViewManager->getViews();
+ for (int i = 0; i < aViews.count(); i++) {
+ if (TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at(i))) {
+ aView->SetTrihedronSize(theSize, theRelative);
+ }
+ }
}
}
thePopup->insertSeparator();
if(TViewWindow* aView = dynamic_cast<TViewWindow*>(myViewManager->getActiveView())){
- if ( !aView->getView()->GetMainWindow()->getToolBar()->isVisible() ){
+ if ( !aView->getMainWindow()->getToolBar()->isVisible() ){
thePopup->insertItem( VTKViewer_Viewer::tr( "MEN_SHOW_TOOLBAR" ), this, SLOT( onShowToolbar() ) );
}
}
QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
if(TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at(i))){
- aView->getView()->GetMainWindow()->getToolBar()->show();
+ aView->getMainWindow()->getToolBar()->show();
}
}
}
{
QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
for(int i = 0, iEnd = aViews.size(); i < iEnd; i++)
- if(SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(aViews.at(i)))
- if(SVTK_View* aView = aViewWindow->getView())
- if(!aView->isVisible( io ))
- return false;
+ if(SUIT_ViewWindow* aViewWindow = aViews.at(i))
+ if(TViewWindow* aViewWnd = dynamic_cast<TViewWindow*>(aViewWindow))
+ if(SVTK_View* aView = aViewWnd->getView())
+ if(!aView->isVisible( io ))
+ return false;
return true;
}
// if (theUpdateTrihedron) onAdjustTrihedron();
QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
for(int i = 0, iEnd = aViews.size(); i < iEnd; i++)
- if(SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(aViews.at(i)))
+ if(TViewWindow* aViewWindow = dynamic_cast<TViewWindow*>(aViews.at(i)))
if(SVTK_View* aView = aViewWindow->getView())
aView->Repaint();
}
//! Get size of trihedron of the viewer (see #SVTK_Renderer::SetTrihedronSize)
int trihedronSize() const;
+ //! Shows if the size of trihedron relative (see #SVTK_Renderer::SetTrihedronSize)
+ bool trihedronRelative() const;
+
//! Set size of trihedron of the viewer (see #SVTK_Renderer::SetTrihedronSize)
- void setTrihedronSize( const int );
+ void setTrihedronSize( const int, const bool = true );
public:
void enableSelection(bool isEnabled);
private:
QColor myBgColor;
int myTrihedronSize;
+ bool myTrihedronRelative;
bool mySelectionEnabled;
bool myMultiSelectionEnabled;
};
void
SVTK_ViewWindow
-::SetTrihedronSize(const int theSize)
+::SetTrihedronSize(const int theSize, const bool theRelative)
{
- myMainWindow->SetTrihedronSize(theSize);
+ myMainWindow->SetTrihedronSize(theSize, theRelative);
}
/*! If parameter theIsForcedUpdate is true, recalculate parameters for
myMainWindow->InvokeEvent( anEvent, 0 );
}
}
+
+/*! The method returns the visual parameters of this view as a formated string
+ */
+QString
+SVTK_ViewWindow
+::getVisualParameters()
+{
+ double pos[3], focalPnt[3], viewUp[3], parScale, scale[3];
+
+ vtkCamera* camera = getRenderer()->GetActiveCamera();
+ camera->GetPosition( pos );
+ camera->GetFocalPoint( focalPnt );
+ camera->GetViewUp( viewUp );
+ parScale = camera->GetParallelScale();
+ GetScale( scale );
+
+ QString retStr;
+ retStr.sprintf( "%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e",
+ pos[0], pos[1], pos[2], focalPnt[0], focalPnt[1], focalPnt[2], viewUp[0], viewUp[1],
+ viewUp[2], parScale, scale[0], scale[1], scale[2] );
+ return retStr;
+}
+
+/* The method restores visual parameters of this view or postpones it untill the view is shown
+ */
+void
+SVTK_ViewWindow
+::setVisualParameters( const QString& parameters )
+{
+ SVTK_RenderWindowInteractor* anInteractor = getMainWindow()->GetInteractor();
+ if ( anInteractor->isVisible() ) {
+ doSetVisualParameters( parameters );
+ }
+ else {
+ myVisualParams = parameters;
+ anInteractor->installEventFilter(this);
+ }
+}
+
+/* The method restores visual parameters of this view from a formated string
+ */
+void
+SVTK_ViewWindow
+::doSetVisualParameters( const QString& parameters )
+{
+ QStringList paramsLst = QStringList::split( '*', parameters, true );
+ if ( paramsLst.size() == 13 ) {
+ // 'reading' list of parameters
+ double pos[3], focalPnt[3], viewUp[3], parScale, scale[3];
+ pos[0] = paramsLst[0].toDouble();
+ pos[1] = paramsLst[1].toDouble();
+ pos[2] = paramsLst[2].toDouble();
+ focalPnt[0] = paramsLst[3].toDouble();
+ focalPnt[1] = paramsLst[4].toDouble();
+ focalPnt[2] = paramsLst[5].toDouble();
+ viewUp[0] = paramsLst[6].toDouble();
+ viewUp[1] = paramsLst[7].toDouble();
+ viewUp[2] = paramsLst[8].toDouble();
+ parScale = paramsLst[9].toDouble();
+ scale[0] = paramsLst[10].toDouble();
+ scale[1] = paramsLst[11].toDouble();
+ scale[2] = paramsLst[12].toDouble();
+
+ // applying parameters
+ vtkCamera* camera = getRenderer()->GetActiveCamera();
+ camera->SetPosition( pos );
+ camera->SetFocalPoint( focalPnt );
+ camera->SetViewUp( viewUp );
+ camera->SetParallelScale( parScale );
+ SetScale( scale );
+
+ // resize( size() );
+
+ // getRenderer()->ResetCameraClippingRange();
+ // Repaint();
+ // getMainWindow()->GetRenderer()->GetTransform()->SetMatrixScale( scale[0], scale[1], scale[2] );
+ }
+}
+
+
+//================================================================
+// Function : eventFilter
+/*! Purpose : delayed setVisualParameters
+*/
+//================================================================
+bool SVTK_ViewWindow::eventFilter( QObject* theWatched, QEvent* theEvent )
+{
+ if ( theEvent->type() == QEvent::Show && theWatched->inherits( "SVTK_RenderWindowInteractor" ) ) {
+ SVTK_RenderWindowInteractor* anInteractor = (SVTK_RenderWindowInteractor*)theWatched;
+ if ( anInteractor->isVisible() ) {
+ doSetVisualParameters( myVisualParams );
+ anInteractor->removeEventFilter( this ); // theWatched = RenderWindowInteractor
+ }
+ }
+ return SUIT_ViewWindow::eventFilter( theWatched, theEvent );
+}
//! Redirect the request to #SVTK_Renderer::SetTrihedronSize
virtual
void
- SetTrihedronSize( const int );
+ SetTrihedronSize( const int, const bool = true );
//! Redirect the request to #SVTK_Renderer::SetSelectionProp
virtual
void
SetSelectionTolerance(const double& theTolNodes = 0.025,
const double& theTolCell = 0.001);
+
+ //! Methods to save/restore visual parameters of a view (pan, zoom, etc.)
+ virtual
+ QString
+ getVisualParameters();
+
+ virtual
+ void
+ setVisualParameters( const QString& parameters );
+
+ virtual
+ bool
+ eventFilter( QObject*, QEvent* );
public slots:
virtual
Initialize(SVTK_View* theView,
SVTK_ViewModelBase* theModel);
+ void
+ doSetVisualParameters( const QString& );
+
QImage dumpView();
virtual void action( const int );
SVTK_View* myView;
SVTK_MainWindow* myMainWindow;
SVTK_ViewModelBase* myModel;
+
+ QString myVisualParams; // used for delayed setting of view parameters
};
#ifdef WIN32
SalomeApp_Filter.h \
SalomeApp_TypeFilter.h \
SalomeApp_StudyPropertiesDlg.h \
- SalomeApp_CheckFileDlg.h
+ SalomeApp_CheckFileDlg.h \
+ SalomeApp_VisualState.h
# .po files to transform in .qm
PO_FILES = SalomeApp_images.po \
SalomeApp_TypeFilter.cxx \
SalomeApp_StudyPropertiesDlg.cxx \
SalomeApp_ListView.cxx \
- SalomeApp_CheckFileDlg.cxx
+ SalomeApp_CheckFileDlg.cxx \
+ SalomeApp_VisualState.cxx
LIB_MOC = SalomeApp_Application.h \
SalomeApp_DataModel.h \
CPPFLAGS+=$(PYTHON_INCLUDES) $(QT_INCLUDES) $(QWT_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
LDFLAGS+=$(PYTHON_LIBS) $(QT_MT_LIBS)
-LIBS+= -lsuit -lstd -lCAM -lObjBrowser -lSalomePrs -L$(KERNEL_ROOT_DIR)/lib/salome -lOpUtil -lSALOMELocalTrace $(CAS_KERNEL) -lSPlot2d -lGLViewer -lOCCViewer -lVTKViewer -lSalomeObject -lSVTK -lSOCC -lPyInterp -lPythonConsole -lLogWindow -lLightApp -lSalomeContainer -lToolsGUI
+LIBS+= -lsuit -lstd -lCAM -lObjBrowser -lSalomePrs -L$(KERNEL_ROOT_DIR)/lib/salome -lOpUtil -lSALOMELocalTrace -lSalomeDSClient $(CAS_KERNEL) -lSPlot2d -lGLViewer -lOCCViewer -lVTKViewer -lSalomeObject -lSVTK -lSOCC -lPyInterp -lPythonConsole -lLogWindow -lLightApp -lSalomeContainer -lToolsGUI
@CONCLUDE@
#include "SalomeApp_DataModel.h"
#include "SalomeApp_DataObject.h"
#include "SalomeApp_EventFilter.h"
+#include "SalomeApp_VisualState.h"
#include "SalomeApp_StudyPropertiesDlg.h"
-#include "SalomeApp_CheckFileDlg.h"
-
#include "LightApp_Application.h"
#include "LightApp_Preferences.h"
#include "LightApp_WidgetContainer.h"
#include "LightApp_SelectionMgr.h"
+#include "LightApp_NameDlg.h"
#include "STD_LoadStudiesDlg.h"
#include <qcombobox.h>
#include <qlistbox.h>
#include <qregexp.h>
+#include <qcheckbox.h>
+#include <qpushbutton.h>
+#include <qlabel.h>
#include "SALOMEDS_StudyManager.hxx"
#include "SALOMEDS_SObject.hxx"
+#include "SALOMEDS_IParameters.hxx"
#include "SALOME_ListIteratorOfListIO.hxx"
#include "SALOME_ListIO.hxx"
#include "ToolsGUI_CatalogGeneratorDlg.h"
#include "ToolsGUI_RegWidget.h"
+#include <SALOMEDSClient_ClientFactory.hxx>
+
/*!Create new instance of SalomeApp_Application.*/
extern "C" SALOMEAPP_EXPORT SUIT_Application* createApplication()
{
SUIT_Desktop* desk = desktop();
+ //! Save GUI state
+ createAction( SaveGUIStateId, tr( "TOT_DESK_FILE_SAVE_GUI_STATE" ), QIconSet(),
+ tr( "MEN_DESK_FILE_SAVE_GUI_STATE" ), tr( "PRP_DESK_FILE_SAVE_GUI_STATE" ),
+ 0, desk, false, this, SLOT( onSaveGUIState() ) );
+
//! Dump study
createAction( DumpStudyId, tr( "TOT_DESK_FILE_DUMP_STUDY" ), QIconSet(),
tr( "MEN_DESK_FILE_DUMP_STUDY" ), tr( "PRP_DESK_FILE_DUMP_STUDY" ),
int fileMenu = createMenu( tr( "MEN_DESK_FILE" ), -1 );
+ createMenu( SaveGUIStateId, fileMenu, 10, -1 );
createMenu( DumpStudyId, fileMenu, 10, -1 );
createMenu( separator(), fileMenu, -1, 15, -1 );
createMenu( LoadScriptId, fileMenu, 10, -1 );
createMenu( PropertiesId, fileMenu, 10, -1 );
createMenu( separator(), fileMenu, -1, 15, -1 );
- int toolsMenu = createMenu( tr( "MEN_DESK_TOOLS" ), -1, -1, 50 );
+ int toolsMenu = createMenu( tr( "MEN_DESK_TOOLS" ), -1, MenuToolsId, 50 );
createMenu( CatalogGenId, toolsMenu, 10, -1 );
createMenu( RegDisplayId, toolsMenu, 10, -1 );
createMenu( separator(), toolsMenu, -1, 15, -1 );
if ( a )
a->setEnabled( activeStudy() );
+ // Properties menu
a = action( PropertiesId );
if( a )
a->setEnabled( activeStudy() );
+ // Save GUI state menu
+ a = action( SaveGUIStateId );
+ if( a )
+ a->setEnabled( activeStudy() );
+
// update state of Copy/Paste menu items
onSelectionChanged();
}
+/*
+ Class : DumpStudyFileDlg
+ Description : Private class used in Dump Study operation. Consists 2 check boxes:
+ "Publish in study" and "Save GUI parameters"
+*/
+class DumpStudyFileDlg : public SUIT_FileDlg
+{
+public:
+ DumpStudyFileDlg( QWidget* parent ) : SUIT_FileDlg( parent, false, true, true )
+ {
+ QHBox* hB = new QHBox( this );
+ myPublishChk = new QCheckBox( tr("PUBLISH_IN_STUDY"), hB );
+ mySaveGUIChk = new QCheckBox( tr("SAVE_GUI_STATE"), hB );
+ QPushButton* pb = new QPushButton(this);
+ addWidgets( new QLabel("", this), hB, pb );
+ pb->hide();
+ }
+ QCheckBox* myPublishChk;
+ QCheckBox* mySaveGUIChk;
+};
+
/*!Private SLOT. On dump study.*/
void SalomeApp_Application::onDumpStudy( )
{
QStringList aFilters;
aFilters.append( tr( "PYTHON_FILES_FILTER" ) );
- SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg( desktop(), false, tr("PUBLISH_IN_STUDY"), true, true);
+ DumpStudyFileDlg* fd = new DumpStudyFileDlg( desktop() );
fd->setCaption( tr( "TOT_DESK_FILE_DUMP_STUDY" ) );
fd->setFilters( aFilters );
- fd->SetChecked(true);
+ fd->myPublishChk->setChecked( true );
+ fd->mySaveGUIChk->setChecked( true );
fd->exec();
QString aFileName = fd->selectedFile();
- bool toPublish = fd->IsChecked();
+ bool toPublish = fd->myPublishChk->isChecked();
+ bool toSaveGUI = fd->mySaveGUIChk->isChecked();
delete fd;
- if(!aFileName.isEmpty()) {
+ if ( !aFileName.isEmpty() ) {
QFileInfo aFileInfo(aFileName);
- bool res = aStudy->DumpStudy( aFileInfo.dirPath( true ).latin1(), aFileInfo.baseName().latin1(), toPublish );
+ int savePoint;
+ if ( toSaveGUI ) { //SRN: Store a visual state of the study at the save point for DumpStudy method
+ SALOMEDS_IParameters::setDumpPython(appStudy->studyDS());
+ savePoint = SalomeApp_VisualState( this ).storeState(); //SRN: create a temporary save point
+ //prefix = SALOMEDS_IParameters::getStudyScript(appStudy->studyDS(), appStudy->getVisualComponentName(), savePoint);
+
+ }
+ bool res = aStudy->DumpStudy( aFileInfo.dirPath( true ).latin1(), aFileInfo.baseName().latin1(), toPublish);
+ if ( toSaveGUI )
+ appStudy->removeSavePoint(savePoint); //SRN: remove the created temporary save point.
if ( !res )
- SUIT_MessageBox::warn1 ( desktop(),
- QObject::tr("WRN_WARNING"),
- tr("WRN_DUMP_STUDY_FAILED"),
- QObject::tr("BUT_OK") );
+ SUIT_MessageBox::warn1 ( desktop(),
+ QObject::tr("WRN_WARNING"),
+ tr("WRN_DUMP_STUDY_FAILED"),
+ QObject::tr("BUT_OK") );
}
}
}
}
+/*!Private SLOT. On save GUI state.*/
+void SalomeApp_Application::onSaveGUIState()
+{
+ SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( activeStudy() );
+ if ( study ) {
+ SalomeApp_VisualState( this ).storeState();
+ updateSavePointDataObjects( study );
+ objectBrowser()->updateTree( study->root() );
+ }
+}
+
/*!Gets file filter.
*\retval QString "(*.hdf)"
*/
LightApp_Preferences::Bool, "ObjectBrowser", QString().sprintf( "visibility_column_%d", i ) );
}
pref->setItemProperty( defCols, "columns", 1 );
+
+ // adding preference to LightApp_Application handled preferences.. a bit of hacking with resources..
+ int genTab = pref->addPreference( LightApp_Application::tr( "PREF_TAB_GENERAL" ), salomeCat );
+ int studyGroup = pref->addPreference( LightApp_Application::tr( "PREF_GROUP_STUDY" ), genTab );
+ pref->addPreference( tr( "PREF_STORE_VISUAL_STATE" ), studyGroup, LightApp_Preferences::Bool, "Study", "store_visual_state" );
}
/*!Update desktop title.*/
/*!Create and return SALOMEDS_StudyManager.*/
SALOMEDSClient_StudyManager* SalomeApp_Application::studyMgr()
{
- static SALOMEDSClient_StudyManager* _sm = new SALOMEDS_StudyManager();
- return _sm;
+ static _PTR(StudyManager) _sm;
+ if(!_sm) _sm = ClientFactory::StudyManager();
+ return _sm.get();
}
/*!Create and return SALOME_NamingService.*/
LightApp_SelectionMgr* mgr = selectionMgr();
mgr->selectedObjects( aList, QString::null, false );
+ // add GUI state commands: restore, rename
+ if ( aList.Extent() == 1 && aList.First()->hasEntry() &&
+ QString( aList.First()->getEntry() ).startsWith( tr( "SAVE_POINT_DEF_NAME" ) ) ) {
+ thePopup->insertSeparator();
+ thePopup->insertItem( tr( "MEN_RESTORE_VS" ), this, SLOT( onRestoreGUIState() ) );
+ thePopup->insertItem( tr( "MEN_RENAME_VS" ), this, SLOT( onRenameGUIState() ) );
+ thePopup->insertItem( tr( "MEN_DELETE_VS" ), this, SLOT( onDeleteGUIState() ) );
+ }
+
// "Delete reference" item should appear only for invalid references
// isInvalidRefs will be true, if at least one of selected objects is invalid reference
if (aList.Extent() != 1)
return;
Handle(SALOME_InteractiveObject) aIObj = aList.First();
+ // check if item is a "GUI state" item (also a first level object)
+ QString entry( aIObj->getEntry() );
+ if ( entry.startsWith( tr( "SAVE_POINT_DEF_NAME" ) ) )
+ return;
QString aModuleName(aIObj->getComponentDataType());
QString aModuleTitle = moduleTitle(aModuleName);
CAM_Module* currentModule = activeModule();
/*!Update obect browser:
1.if 'updateModels' true, update existing data models;
2. update "non-existing" (not loaded yet) data models;
- 3. update object browser if it existing */
+ 3. update object browser if it exists */
void SalomeApp_Application::updateObjectBrowser( const bool updateModels )
{
// update "non-existing" (not loaded yet) data models
//SalomeApp_DataModel::BuildTree( aComponent, study->root(), study, /*skipExisitng=*/true );
}
}
+ // create data objects that correspond to GUI state save points
+ updateSavePointDataObjects( study );
}
// update existing data models (already loaded SComponents)
LightApp_Application::updateObjectBrowser( updateModels );
-/* if ( objectBrowser() )
- {
- objectBrowser()->updateGeometry();
- objectBrowser()->updateTree();
- }*/
+ // -- debug --
+ // if ( study && study->root() )
+ // study->root()->dump();
}
/*!Display Catalog Genenerator dialog */
}
}
}
+
+SUIT_ViewManager* SalomeApp_Application::newViewManager(const QString& type)
+{
+ return createViewManager(type);
+}
+
+
+/*!Global utility funciton, returns selected GUI Save point object's ID */
+int getSelectedSavePoint( const LightApp_SelectionMgr* selMgr )
+{
+ SALOME_ListIO aList;
+ selMgr->selectedObjects( aList );
+ Handle(SALOME_InteractiveObject) aIObj = aList.First();
+ QString entry( aIObj->getEntry() );
+ QString startStr = QObject::tr( "SAVE_POINT_DEF_NAME" );
+ if ( !entry.startsWith( startStr ) ) // it's a "GUI state" object
+ return -1;
+ bool ok; // conversion to integer is ok?
+ int savePoint = entry.right( entry.length() - startStr.length() ).toInt( &ok );
+ return ok ? savePoint : -1;
+}
+
+/*!Called on Restore GUI State popup command*/
+void SalomeApp_Application::onRestoreGUIState()
+{
+ int savePoint = ::getSelectedSavePoint( selectionMgr() );
+ if ( savePoint == -1 )
+ return;
+ SalomeApp_VisualState( this ).restoreState( savePoint );
+}
+
+/*!Called on Rename GUI State popup command*/
+void SalomeApp_Application::onRenameGUIState()
+{
+ int savePoint = ::getSelectedSavePoint( selectionMgr() );
+ if ( savePoint == -1 )
+ return;
+ SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( activeStudy() );
+ if ( !study )
+ return;
+
+ QString newName = LightApp_NameDlg::getName( desktop(), study->getNameOfSavePoint( savePoint ) );
+ if ( !newName.isNull() && !newName.isEmpty() ) {
+ study->setNameOfSavePoint( savePoint, newName );
+ updateSavePointDataObjects( study );
+ }
+}
+
+
+/*!Called on Delete GUI State popup command*/
+void SalomeApp_Application::onDeleteGUIState()
+{
+ int savePoint = ::getSelectedSavePoint( selectionMgr() );
+ if ( savePoint == -1 )
+ return;
+ SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( activeStudy() );
+ if ( !study )
+ return;
+
+ study->removeSavePoint( savePoint );
+ updateSavePointDataObjects( study );
+}
+
+/*!Called on Save study operation*/
+void SalomeApp_Application::onStudySaved( SUIT_Study* study )
+{
+ LightApp_Application::onStudySaved( study );
+
+ if ( objectBrowser() ) {
+ updateSavePointDataObjects( dynamic_cast<SalomeApp_Study*>( study ) );
+ objectBrowser()->updateTree( study->root() );
+ }
+}
+
+/*!Called on Open study operation*/
+void SalomeApp_Application::onStudyOpened( SUIT_Study* study )
+{
+ LightApp_Application::onStudyOpened( study );
+
+ if ( objectBrowser() ) {
+ updateSavePointDataObjects( dynamic_cast<SalomeApp_Study*>( study ) );
+ objectBrowser()->updateTree( study->root() );
+ }
+}
+
+/*! utility function. returns true if list view item that correspond to given SUIT_DataObject is open.
+ only first level items are traversed */
+bool isListViewItemOpen( QListView* lv, const SUIT_DataObject* dobj )
+{
+ if ( !lv || !dobj )
+ return false;
+
+ QListViewItem* item = lv->firstChild();
+ while ( item ) {
+ OB_ListItem* ob_item = dynamic_cast<OB_ListItem*>( item );
+ if ( ob_item && ob_item->dataObject() == dobj )
+ return ob_item->isOpen();
+ item = item->nextSibling();
+ }
+ return false;
+}
+
+/*! updateSavePointDataObjects: syncronize data objects that correspond to save points (gui states)*/
+void SalomeApp_Application::updateSavePointDataObjects( SalomeApp_Study* study )
+{
+ OB_Browser* ob = objectBrowser();
+
+ if ( !study || !ob )
+ return;
+
+ // find GUI states root object
+ SUIT_DataObject* guiRootObj = 0;
+ DataObjectList ch;
+ study->root()->children( ch );
+ DataObjectList::const_iterator it = ch.begin(), last = ch.end();
+ for ( ; it != last ; ++it ) {
+ if ( dynamic_cast<SalomeApp_SavePointRootObject*>( *it ) ) {
+ guiRootObj = *it;
+ break;
+ }
+ }
+ std::vector<int> savePoints = study->getSavePoints();
+ // case 1: no more save points but they existed in study's tree
+ if ( savePoints.empty() && guiRootObj ) {
+ delete guiRootObj;
+ return;
+ }
+ // case 2: no more save points but root does not exist either
+ if ( savePoints.empty() && !guiRootObj )
+ return;
+ // case 3: save points but no root for them - create it
+ if ( !savePoints.empty() && !guiRootObj )
+ guiRootObj = new SalomeApp_SavePointRootObject( study->root() );
+ // case 4: everything already exists.. here may be a problem: we want "GUI states" root object
+ // to be always the last one in the tree. Here we check - if it is not the last one - remove and
+ // re-create it.
+ bool isOpen( false );
+ if ( guiRootObj->nextBrother() ) {
+ isOpen = isListViewItemOpen( ob->listView(), guiRootObj );
+ delete guiRootObj;
+ guiRootObj = new SalomeApp_SavePointRootObject( study->root() );
+ }
+
+ // store data objects in a map id-to-DataObject
+ QMap<int,SalomeApp_SavePointObject*> mapDO;
+ ch.clear();
+ guiRootObj->children( ch );
+ for( it = ch.begin(), last = ch.end(); it != last ; ++it ) {
+ SalomeApp_SavePointObject* dobj = dynamic_cast<SalomeApp_SavePointObject*>( *it );
+ if ( dobj )
+ mapDO[dobj->getId()] = dobj;
+ }
+
+ // iterate new save points. if DataObject with such ID not found in map - create DataObject
+ // if in the map - remove it from map.
+ for ( int i = 0; i < savePoints.size(); i++ )
+ if ( !mapDO.contains( savePoints[i] ) )
+ new SalomeApp_SavePointObject( guiRootObj, savePoints[i], study );
+ else {
+ ob->updateTree( mapDO[ savePoints[i] ] );
+ mapDO.remove( savePoints[i] );
+ }
+ // delete DataObjects that are still in the map -- their IDs were not found in data model
+ for ( QMap<int,SalomeApp_SavePointObject*>::Iterator it = mapDO.begin(); it != mapDO.end(); ++it )
+ delete it.data();
+
+ if ( isOpen ) // set open if we recreated guiRootObj and it was previously open..
+ guiRootObj->setOpen( true );
+}
+
class LightApp_Preferences;
class SalomeApp_Module;
+class SalomeApp_Study;
class SALOME_LifeCycleCORBA;
Q_OBJECT
public:
+ enum { MenuToolsId = 5 };
enum { DumpStudyId = LightApp_Application::UserID, LoadScriptId, PropertiesId,
- CatalogGenId, RegDisplayId, UserID };
+ CatalogGenId, RegDisplayId, SaveGUIStateId, UserID };
public:
SalomeApp_Application();
static SALOME_LifeCycleCORBA* lcc();
static QString defaultEngineIOR();
+ SUIT_ViewManager* newViewManager(const QString&);
+ void updateSavePointDataObjects( SalomeApp_Study* );
+
public slots:
virtual bool onOpenDoc( const QString& );
virtual void onLoadDoc();
virtual void onCopy();
virtual void onPaste();
+protected slots:
+ void onStudySaved( SUIT_Study* );
+ void onStudyOpened( SUIT_Study* );
+
protected:
virtual void createActions();
virtual SUIT_Study* createNewStudy();
void onProperties();
void onDumpStudy();
void onLoadScript();
+ void onSaveGUIState();
+ void onDeleteGUIState();
void onCatalogGen();
void onRegDisplay();
void onOpenWith();
+ void onRestoreGUIState();
+ void onRenameGUIState();
};
#ifdef WIN32
suitPtr SalomeApp_DataModelSync::createItem( const kerPtr& so,
const suitPtr& parent,
const suitPtr& after,
- const bool asFirst ) const
+ const bool prepend ) const
{
if( !isCorrect( so ) )
return 0;
else
parent->appendChild( nitem );
}
- else if( asFirst )
+ else if( prepend )
parent->insertChild( nitem, 0 );
- else
+ else // append
parent->appendChild( nitem );
else if( myRoot )
myRoot->appendChild( nitem );
SalomeApp_DataModelSync sync( study->studyDS(), study->root() );
- // QString srcName = sobj ? sobj->GetName().c_str() : "";
- // QString trgName = ( suitObj && !suitObj->name().isNull() ) ? suitObj->name() : "";
- // printf( "--- SalomeApp_DataModel::syncronize() calls synchronize()_1: src = %s, trg = %s ---\n", srcName.latin1(), trgName.latin1() );
-
- SUIT_DataObject* o = ::synchronize<kerPtr,suitPtr,SalomeApp_DataModelSync>( sobj, suitObj, sync );
-// showTree( o );
- return o;
-}
-
-//================================================================
-// Function : synchronize
-/*! Purpose : synchronizes kernel tree and suit data tree starting from 'sobj' and 'obj' correspondly */
-//================================================================
-SUIT_DataObject* SalomeApp_DataModel::synchronize( const _PTR( SObject )& sobj, SUIT_DataObject* obj,
- SalomeApp_Study* study )
-{
- if( !study )
- return 0;
- SalomeApp_DataModelSync sync( study->studyDS(), study->root() );
-
- // QString srcName = sobj ? sobj->GetName().c_str() : "";
- // QString trgName = ( obj && !obj->name().isNull() ) ? obj->name() : "";
- // printf( "--- SalomeApp_DataModel::syncronize() calls synchronize()_2: src = s, trg = %s ---\n", srcName.latin1(), trgName.latin1() );
-
- return ::synchronize<kerPtr,suitPtr,SalomeApp_DataModelSync>( sobj, obj, sync );
+ return ::synchronize<kerPtr,suitPtr,SalomeApp_DataModelSync>( sobj, suitObj, sync );
}
//================================================================
public:
static SUIT_DataObject* synchronize( const _PTR( SComponent )&, SalomeApp_Study* );
- static SUIT_DataObject* synchronize( const _PTR( SObject )&, SUIT_DataObject*, SalomeApp_Study* );
- SalomeApp_DataModel ( CAM_Module* theModule );
- virtual ~SalomeApp_DataModel();
+ SalomeApp_DataModel ( CAM_Module* theModule );
+ virtual ~SalomeApp_DataModel();
virtual bool open( const QString&, CAM_Study*, QStringList );
virtual bool create( CAM_Study* );
#include "SalomeApp_Study.h"
#include "LightApp_RootObject.h"
+#include <CAM_DataObject.h>
+
#include <SUIT_Application.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_DataObjectKey.h>
return SalomeApp_DataObject::name();
}
+/*
+ Class: SalomeApp_SavePointObject
+ Level: Public
+*/
+
+/*!Constructor.Initialize by \a parent.*/
+SalomeApp_SavePointObject::SalomeApp_SavePointObject( SUIT_DataObject* _parent, const int id, SalomeApp_Study* study )
+ : LightApp_DataObject( _parent ), CAM_DataObject( _parent ), // IMPORTANT TO CALL ALL VIRTUAL CONSTRUCTORS!
+ myId( id ),
+ myStudy( study )
+{
+}
+
+/*!Destructor. Do nothing.*/
+SalomeApp_SavePointObject::~SalomeApp_SavePointObject()
+{
+}
+
+/*!Returns save points ID */
+int SalomeApp_SavePointObject::getId() const
+{
+ return myId;
+}
+
+/*!Returns "invalid" entry, which does not correspond to any object in data structure
+ but indicates that it is a save point object */
+QString SalomeApp_SavePointObject::entry() const
+{
+ return QObject::tr( "SAVE_POINT_DEF_NAME" ) + QString::number( myId );
+}
+
+/*!Returns displayed name of object */
+QString SalomeApp_SavePointObject::name() const
+{
+ return myStudy->getNameOfSavePoint( myId );
+}
+
+QPixmap SalomeApp_SavePointObject::icon() const
+{
+ return QPixmap();
+}
+
+QString SalomeApp_SavePointObject::toolTip() const
+{
+ return QObject::tr( "SAVE_POINT_OBJECT_TOOLTIP" ).arg( name() );
+}
+
SalomeApp_ModuleObject( CAM_DataModel*, const _PTR(SObject)&, SUIT_DataObject* = 0 );
virtual ~SalomeApp_ModuleObject();
- virtual QString name() const;
+ virtual QString name() const;
+};
+
+/*!
+ * SalomeApp_SavePointObject - class that represents persistent visual_state object
+ * these objects are stored in data model, but NOT in SObjects structure, so we
+ * must handle them separately using this special class for them
+ */
+
+class SALOMEAPP_EXPORT SalomeApp_SavePointObject : public virtual LightApp_DataObject
+{
+public:
+ SalomeApp_SavePointObject( SUIT_DataObject* parent, const int, SalomeApp_Study* study );
+ virtual ~SalomeApp_SavePointObject();
+
+ virtual QString entry() const;
+
+ virtual QString name() const;
+ virtual QPixmap icon() const;
+ virtual QString toolTip() const;
+
+ int getId() const;
+
+private:
+ int myId;
+ SalomeApp_Study* myStudy;
+};
+
+/*!
+ * SalomeApp_SavePointRootObject - class that represents parent object for visual_state objects
+ */
+
+class SALOMEAPP_EXPORT SalomeApp_SavePointRootObject : public SUIT_DataObject
+{
+public:
+ SalomeApp_SavePointRootObject( SUIT_DataObject* parent ) : SUIT_DataObject( parent ) {}
+
+ virtual QString name() const { return QObject::tr( "SAVE_POINT_ROOT_NAME" ); }
+ virtual QString toolTip() const{ return QObject::tr( "SAVE_POINT_ROOT_TOOLTIP" ); }
};
#endif
// See http://www.salome-platform.org/
//
#include "SalomeApp_ExceptionHandler.h"
+#include "CASCatch.hxx"
#include <OSD.hxx>
-#include <Standard_Failure.hxx>
-#include <Standard_ErrorHandler.hxx>
-
#include <stdexcept>
#include <exception>
#include <qstring.h>
-#include <CASCatch_CatchSignals.hxx>
-#include <CASCatch_ErrorHandler.hxx>
-#include <CASCatch_Failure.hxx>
-
-
/*!Constructor. Initialize by \a floatSignal.*/
SalomeApp_ExceptionHandler::SalomeApp_ExceptionHandler( const bool floatSignal )
: SUIT_ExceptionHandler()
/*!Try to call SUIT_ExceptionHandler::internalHandle(o, e), catch if failure.*/
bool SalomeApp_ExceptionHandler::handleSignals( QObject* o, QEvent* e )
{
-
- CASCatch_CatchSignals aCatchSignals;
- aCatchSignals.Activate();
-
-
CASCatch_TRY {
SUIT_ExceptionHandler::internalHandle( o, e );
}
- CASCatch_CATCH(CASCatch_Failure) {
- aCatchSignals.Deactivate();
- Handle(CASCatch_Failure) aFail = CASCatch_Failure::Caught();
- throw std::runtime_error( aFail->GetError() );
+ CASCatch_CATCH(Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ throw Standard_Failure( aFail->GetMessageString() );
}
- aCatchSignals.Deactivate();
return true;
}
-#ifdef try
-#undef try
-#endif
-
-#ifdef catch
-#undef catch
-#endif
-
/*!Try to call handleSignals( o, e ), catch and show error message.*/
bool SalomeApp_ExceptionHandler::handle( QObject* o, QEvent* e )
{
#include "LightApp_Selection.h"
#include "LightApp_Operation.h"
#include "LightApp_Preferences.h"
+//#include "LightApp_Displayer.h"
#include "CAM_DataModel.h"
#include <SALOME_ListIO.hxx>
#include <SALOME_ListIteratorOfListIO.hxx>
#include <SALOME_InteractiveObject.hxx>
+//#include <SALOME_Actor.h>
+
+//#include "SALOMEDS_IParameters.hxx"
#include <SUIT_Session.h>
+#include <SUIT_ViewModel.h>
+
+#include <SVTK_ViewWindow.h>
+//#include <SVTK_ViewModel.h>
+//#include <SVTK_MainWindow.h>
+//#include <SVTK_RenderWindowInteractor.h>
#include <qstring.h>
#include <qmap.h>
+//#include <vtkActorCollection.h>
+//#include <vtkRenderer.h>
+
/*!Constructor.*/
SalomeApp_Module::SalomeApp_Module( const QString& name )
: LightApp_Module( name )
dest.Append( obj );
}
}
+
+/*!
+ * \brief Virtual public
+ *
+ * This method is called just before the study document is saved, so the module has a possibility
+ * to store visual parameters in AttributeParameter attribue(s)
+ */
+void SalomeApp_Module::storeVisualParameters(int savePoint)
+{
+}
+
+/*!
+ * \brief Virtual public
+ *
+ * This method is called after the study document is opened, so the module has a possibility to restore
+ * visual parameters
+ */
+void SalomeApp_Module::restoreVisualParameters(int savePoint)
+{
+}
+
#include <LightApp_Module.h>
-#include <string>
-
class CAM_DataModel;
class SalomeApp_Application;
class LightApp_Operation;
SalomeApp_Application* getApp() const;
+ virtual void storeVisualParameters(int savePoint);
+ virtual void restoreVisualParameters(int savePoint);
+
protected:
virtual CAM_DataModel* createDataModel();
virtual LightApp_Selection* createSelection() const;
#include "SalomeApp_DataObject.h"
#include "SalomeApp_Application.h"
#include "SalomeApp_Engine_i.hxx"
+#include "SalomeApp_VisualState.h"
#include "LightApp_RootObject.h"
#include <SUIT_ResourceMgr.h>
#include <qptrlist.h>
+#include <qapplication.h>
+#include <qdict.h>
#include "utilities.h"
-#include "string.h"
-#include "vector.h"
+#include <iostream.h>
+#include <string>
+#include <vector>
+
+#include <SUIT_Session.h>
#include "SALOMEDS_Tool.hxx"
+#include "SALOMEDS_IParameters.hxx"
+
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOME_Exception)
+using namespace std;
+
/*!
Constructor.
*/
emit opened( this );
study->IsSaved(true);
+
+ bool restore = application()->resourceMgr()->booleanValue( "Study", "store_visual_state", true );
+ if ( restore ) {
+ std::vector<int> savePoints = getSavePoints();
+ if ( savePoints.size() > 0 )
+ SalomeApp_VisualState( (SalomeApp_Application*)application() ).restoreState( savePoints[savePoints.size()-1] );
+ }
+
return res;
}
bool res = CAM_Study::openDocument( theStudyName );
emit opened( this );
+ bool restore = application()->resourceMgr()->booleanValue( "Study", "store_visual_state", true );
+ if ( restore ) {
+ std::vector<int> savePoints = getSavePoints();
+ if ( savePoints.size() > 0 )
+ SalomeApp_VisualState( (SalomeApp_Application*)application() ).restoreState( savePoints[savePoints.size()-1] );
+ }
+
//SRN: BugID IPAL9021: End
return res;
//=======================================================================
bool SalomeApp_Study::saveDocumentAs( const QString& theFileName )
{
+ bool store = application()->resourceMgr()->booleanValue( "Study", "store_visual_state", true );
+ if ( store )
+ SalomeApp_VisualState( (SalomeApp_Application*)application() ).storeState();
+
ModelList list; dataModels( list );
SalomeApp_DataModel* aModel = (SalomeApp_DataModel*)list.first();
//=======================================================================
bool SalomeApp_Study::saveDocument()
{
+ bool store = application()->resourceMgr()->booleanValue( "Study", "store_visual_state", true );
+ if ( store )
+ SalomeApp_VisualState( (SalomeApp_Application*)application() ).storeState();
+
ModelList list; dataModels( list );
SalomeApp_DataModel* aModel = (SalomeApp_DataModel*)list.first();
for ( ; aModel; aModel = (SalomeApp_DataModel*)list.next() ) {
listOfFiles.clear();
aModel->save(listOfFiles);
- if ( !listOfFiles.isEmpty() )
+ if ( !listOfFiles.isEmpty() )
saveModuleData(aModel->module()->name(), listOfFiles);
}
comps.append( aComponent->ComponentDataType().c_str() );
}
}
+
+//================================================================
+// Function : getSavePoints
+/*! Purpose : returns a list of saved points' IDs
+*/
+//================================================================
+std::vector<int> SalomeApp_Study::getSavePoints()
+{
+ std::vector<int> v;
+
+ _PTR(SObject) so = studyDS()->FindComponent("Interface Applicative");
+ if(!so) return v;
+
+ _PTR(StudyBuilder) builder = studyDS()->NewBuilder();
+ _PTR(ChildIterator) anIter ( studyDS()->NewChildIterator( so ) );
+ for(; anIter->More(); anIter->Next())
+ {
+ _PTR(SObject) val( anIter->Value() );
+ _PTR(GenericAttribute) genAttr;
+ if(builder->FindAttribute(val, genAttr, "AttributeParameter")) v.push_back(val->Tag());
+ }
+
+ return v;
+}
+
+//================================================================
+// Function :removeSavePoint
+/*! Purpose : remove a given save point
+*/
+//================================================================
+void SalomeApp_Study::removeSavePoint(int savePoint)
+{
+ if(savePoint <= 0) return;
+ _PTR(AttributeParameter) AP = studyDS()->GetCommonParameters(getVisualComponentName(), savePoint);
+ _PTR(SObject) so = AP->GetSObject();
+ _PTR(StudyBuilder) builder = studyDS()->NewBuilder();
+ builder->RemoveObjectWithChildren(so);
+}
+
+//================================================================
+// Function : getNameOfSavePoint
+/*! Purpose : returns a name of save point
+*/
+//================================================================
+QString SalomeApp_Study::getNameOfSavePoint(int savePoint)
+{
+ _PTR(AttributeParameter) AP = studyDS()->GetCommonParameters(getVisualComponentName(), savePoint);
+ SALOMEDS_IParameters ip(AP);
+ return ip.getProperty("AP_SAVEPOINT_NAME");
+}
+
+//================================================================
+// Function : setNameOfSavePoint
+/*! Purpose : sets a name of save point
+*/
+//================================================================
+void SalomeApp_Study::setNameOfSavePoint(int savePoint, const QString& nameOfSavePoint)
+{
+ _PTR(AttributeParameter) AP = studyDS()->GetCommonParameters(getVisualComponentName(), savePoint);
+ SALOMEDS_IParameters ip(AP);
+ ip.setProperty("AP_SAVEPOINT_NAME", nameOfSavePoint.latin1());
+}
+
+//================================================================
+// Function : getVisualComponentName
+/*! Purpose : returns a name of the component where visual
+ * parameters are stored
+*/
+//================================================================
+std::string SalomeApp_Study::getVisualComponentName()
+{
+ return "Interface Applicative";
+}
+
+//================================================================
+// Function : updateModelRoot
+/*! Purpose : slot called on change of a root of a data model. redefined from CAM_Study*/
+//================================================================
+void SalomeApp_Study::updateModelRoot( const CAM_DataModel* dm )
+{
+ LightApp_Study::updateModelRoot( dm );
+
+ // calling updateSavePointDataObjects in order to set correct order of "Gui states" object
+ // it must always be the last one.
+ ((SalomeApp_Application*)application())->updateSavePointDataObjects( this );
+}
#include "SalomeApp.h"
#include <LightApp_Study.h>
+#include <string>
#ifdef WIN32
#pragma warning( disable:4251 )
virtual void children( const QString&, QStringList& ) const;
virtual void components( QStringList& ) const;
+ std::vector<int> getSavePoints();
+ void removeSavePoint(int savePoint);
+ QString getNameOfSavePoint(int savePoint);
+ void setNameOfSavePoint(int savePoint, const QString& nameOfSavePoint);
+ virtual std::string getVisualComponentName();
+
protected:
virtual void saveModuleData ( QString theModuleName, QStringList theListOfFiles );
virtual void openModuleData ( QString theModuleName, QStringList& theListOfFiles );
virtual bool openDataModel( const QString&, CAM_DataModel* );
void setStudyDS(const _PTR(Study)& s );
+protected slots:
+ virtual void updateModelRoot( const CAM_DataModel* );
+
private:
QString newStudyName() const;
#include "LightApp_DataOwner.h"
#include "SalomeApp_Study.h"
-#include <SALOMEDS_SObject.hxx>
-
/*!
Constructor.
*/
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, 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/
+//
+#include "SalomeApp_VisualState.h"
+
+#include "SalomeApp_Module.h"
+#include "SalomeApp_Study.h"
+#include "SalomeApp_Application.h"
+
+#include <SUIT_ResourceMgr.h>
+#include <QtxWorkstack.h>
+
+#include <STD_TabDesktop.h>
+
+#include <qptrlist.h>
+#include <qapplication.h>
+#include <qdict.h>
+
+#include <SALOMEDS_IParameters.hxx>
+
+#include <vector>
+#include <string>
+
+/*!
+ Constructor.
+*/
+SalomeApp_VisualState::SalomeApp_VisualState( SalomeApp_Application* app )
+ : myApp( app )
+{
+}
+
+/*!
+ Destructor.
+*/
+SalomeApp_VisualState::~SalomeApp_VisualState()
+{
+}
+
+//================================================================
+// Function : nameViewWindows
+/*! Purpose : set names of all view windows in given list. This is used
+// in order to apply the same naming algorithm when saving and restoring
+// view windows. Names of view windows must be the same before saving
+// workstack (splitters) information, and before its restoring!
+// Naming rule: ViewerType_IndexOfViewerOfThisType_IndexOfViewInThisViewer
+// VTKViewer_0_0
+// OCCViewer_0_0 OCCViewer_0_1 OCCViewer_0_2
+// VTKViewer_1_0
+*/
+//================================================================
+void nameViewWindows( const ViewManagerList& lst )
+{
+ QDict<int> viewersCounter; // map viewerType - to - index_of_this_viewer_type
+ viewersCounter.setAutoDelete( true );
+ for ( QPtrListIterator<SUIT_ViewManager> it(lst); it.current(); ++it) {
+ int view_count = it.current()->getViewsCount();
+ QString vType = it.current()->getType();
+ if ( !view_count )
+ continue; //No views is opened in the viewer
+
+ int* viewerID = viewersCounter[ vType ];
+ if ( !viewerID ) {
+ viewerID = new int( 0 );
+ viewersCounter.insert( vType, viewerID );
+ }
+ else
+ ++(*viewerID);
+
+ QPtrVector<SUIT_ViewWindow> views = it.current()->getViews();
+ for ( int i = 0; i < view_count; i++ ) {
+ QString vName = QString( "%1_%2_%3" ).arg( vType ).arg( *viewerID ).arg( i );
+ views[i]->setName( vName );
+ }
+ }
+}
+
+//================================================================
+// Function : storeState
+/*! Purpose : store the visual parameters of the viewers
+*/
+//================================================================
+int SalomeApp_VisualState::storeState()
+{
+ SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( myApp->activeStudy() );
+ if ( !study )
+ return -1;
+
+ int savePoint = 1;
+ std::vector<int> savePoints = study->getSavePoints();
+ //Calculate a new savePoint number = the last save point number + 1
+ if ( savePoints.size() > 0)
+ savePoint = savePoints[savePoints.size()-1] + 1;
+
+ _PTR(AttributeParameter) ap = study->studyDS()->GetCommonParameters( study->getVisualComponentName(), savePoint );
+ SALOMEDS_IParameters ip( ap );
+
+ ViewManagerList lst;
+ myApp->viewManagers( lst );
+
+ // setting unique names for view windows in order to save this view inside
+ // workstack's structure (see below). On restore the views with the same names will
+ // be placed to the same place inside the workstack's splitters.
+ nameViewWindows( lst );
+
+ // store active window's name
+ SUIT_ViewWindow* win = myApp->desktop()->activeWindow();
+ if ( win )
+ ip.setProperty("AP_ACTIVE_VIEW", win->name() );
+
+ int viewerID = 0;
+ SUIT_ViewManager* vm = 0;
+ for (QPtrListIterator<SUIT_ViewManager> it( lst ); it.current(); ++it ) {
+ vm = it.current();
+ int view_count = vm->getViewsCount();
+ if ( !view_count )
+ continue; //No views is opened in the viewer
+
+ std::string viewerEntry = QString( "%1_%2" ).arg( vm->getType() ).arg( ++viewerID ).latin1();
+ ip.append("AP_VIEWERS_LIST", viewerEntry);
+
+ QPtrVector<SUIT_ViewWindow> views = vm->getViews();
+ for(int i = 0; i<view_count; i++) {
+ ip.append( viewerEntry, views[i]->caption() );
+ ip.append( viewerEntry, views[i]->getVisualParameters().latin1() );
+ }
+ }
+
+ //Save information about split areas
+ if ( myApp->desktop()->inherits( "STD_TabDesktop" ) ) {
+ QtxWorkstack* workstack = ((STD_TabDesktop*)myApp->desktop())->workstack();
+ QString workstackInfo;
+ (*workstack) >> workstackInfo;
+ ip.setProperty( "AP_WORKSTACK_INFO", workstackInfo.latin1() );
+ }
+
+ //Save a name of the active module
+ if ( CAM_Module* activeModule = myApp->activeModule() )
+ ip.setProperty( "AP_ACTIVE_MODULE", activeModule->moduleName().latin1() );
+
+ //Store visual parameters of the modules
+ QPtrList<CAM_Module> mlist;
+ myApp->modules( mlist );
+ CAM_Module* module = 0;
+ for ( module = mlist.first(); module; module = mlist.next() ) {
+ if ( SalomeApp_Module* sModule = dynamic_cast<SalomeApp_Module*>( module ) ) {
+ ip.append( "AP_MODULES_LIST", sModule->moduleName().latin1() );
+ sModule->storeVisualParameters( savePoint );
+ }
+ }
+
+ // set default name of new savePoint
+ study->setNameOfSavePoint( savePoint, QObject::tr( "SAVE_POINT_DEF_NAME" ) + QString::number( savePoint ) );
+
+ return savePoint;
+}
+
+//================================================================
+// Function : restoreState
+/*! Purpose : restore the visual parameters of the viewers
+*/
+//================================================================
+void SalomeApp_VisualState::restoreState(int savePoint)
+{
+ SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( myApp->activeStudy() );
+ if ( !study )
+ return;
+
+ _PTR(AttributeParameter) ap = study->studyDS()->GetCommonParameters( study->getVisualComponentName(), savePoint );
+ SALOMEDS_IParameters ip(ap);
+
+ //Remove all already existent veiwers and their views
+ ViewManagerList lst;
+ myApp->viewManagers( lst );
+ for ( QPtrListIterator<SUIT_ViewManager> it(lst); it.current(); ++it )
+ myApp->removeViewManager( it.current() );
+
+ //Restore the viewers and view windows
+ int nbViewers = ip.nbValues( "AP_VIEWERS_LIST" );
+ SUIT_ViewWindow* viewWin = 0;
+
+ for ( int i = 0; i < nbViewers; i++ ) {
+ std::string viewerEntry = ip.getValue( "AP_VIEWERS_LIST", i );
+ std::vector<std::string> veiewerParams = ip.parseValue(viewerEntry,'_');
+ std::string type = veiewerParams[0];
+ std::string viewerID = veiewerParams[1];
+ SUIT_ViewManager* vm = myApp->newViewManager( type.c_str() );
+ if ( !vm )
+ continue; //Unknown viewer
+
+ int nbViews = (ip.nbValues(viewerEntry))/2;
+
+ //Create nbViews-1 view (-1 because 1 view is created by createViewManager)
+ for ( int i = 1; i< nbViews; i++ ) {
+ SUIT_ViewWindow* aView = vm->createViewWindow();
+ aView->show();
+ }
+
+ int viewCount = vm->getViewsCount();
+ if (viewCount != nbViews) {
+ printf( "\nRestore visual state: Unknow error, Can't create a view!\n" );
+ continue;
+ }
+
+ //Resize the views, set their captions and apply visual parameters.
+ QPtrVector<SUIT_ViewWindow> views = vm->getViews();
+ for (int i = 0, j = 0; i<viewCount; i++, j++) {
+ viewWin = views[i];
+ if ( !viewWin )
+ continue;
+
+ // wait untill the window is really shown. This step fixes MANY bugs..
+ while ( !viewWin->isVisible() )
+ qApp->processEvents();
+
+ viewWin->setCaption(ip.getValue(viewerEntry, j).c_str());
+ viewWin->setVisualParameters(ip.getValue(viewerEntry, j+1).c_str());
+ }
+ }
+
+ // restore modules' visual parameters
+ std::vector<std::string> v = ip.getValues("AP_MODULES_LIST");
+ for ( int i = 0; i < v.size(); i++ ) {
+ myApp->activateModule( v[i].c_str() );
+ if ( SalomeApp_Module* module = dynamic_cast<SalomeApp_Module*>( myApp->activeModule() ) )
+ module->restoreVisualParameters( savePoint );
+ }
+
+ // activate module that was active on save
+ QString activeModuleName( ip.getProperty("AP_ACTIVE_MODULE" ).c_str() );
+ if ( !activeModuleName.isEmpty() )
+ myApp->activateModule( activeModuleName );
+
+ // setting unique names for view windows in order to restore positions of view windows inside
+ // workstack's structure (see below). During save the same naming algorithm was used,
+ // so the same views will get the same names.
+ lst.clear();
+ myApp->viewManagers(lst);
+ nameViewWindows( lst );
+
+ // work-around to bug of setting visual parameters of views: all view windows now have
+ // correct visual parameters, bug after restoring the workstack the visual parameters
+ // are messted, and must be re-set again. So here we store them in a map and set them
+ // later back again. why we don't store these parameters in a map on views creation?
+ // because 1) names of view windows are not set at that time 2) some view windows
+ // are created by modules' restoreVisualParameters (like Gauss Viewers), which is NOT here..
+ QMap<QString, QString> viewersParameters;
+ QPtrListIterator<SUIT_ViewManager> it( lst );
+ for ( ; it.current(); ++it ) {
+ int view_count = it.current()->getViewsCount();
+ QPtrVector<SUIT_ViewWindow> views = it.current()->getViews();
+ for ( int i = 0; i < view_count; i++ )
+ viewersParameters[ views[i]->name() ] = views[i]->getVisualParameters();
+ }
+
+ // restore workstack parameters. should be done after module's restoreVisualParameters(), because
+ // some modules can create their own viewers (like VISU creates GaussViewers)
+ if ( myApp->desktop()->inherits( "STD_TabDesktop" ) ) {
+ QtxWorkstack* workstack = ((STD_TabDesktop*)myApp->desktop())->workstack();
+ (*workstack) << ip.getProperty( "AP_WORKSTACK_INFO" ).c_str();
+ }
+
+ // restore visual parameters of view windows. it must be done AFTER restoring workstack.
+ for ( it.toFirst(); it.current(); ++it ) {
+ int view_count = it.current()->getViewsCount();
+ QPtrVector<SUIT_ViewWindow> views = it.current()->getViews();
+ for ( int i = 0; i < view_count; i++ )
+ views[i]->setVisualParameters( viewersParameters[ views[i]->name() ] );
+ }
+
+ // set focus to previously saved active view window
+ std::string activeViewName = ip.getProperty("AP_ACTIVE_VIEW");
+ for ( it.toFirst(); it.current(); ++it ) {
+ int view_count = it.current()->getViewsCount();
+ QPtrVector<SUIT_ViewWindow> views = it.current()->getViews();
+ for ( int i = 0; i < view_count; i++ ) {
+ if ( activeViewName == views[i]->name() )
+ views[i]->setFocus();
+ }
+ }
+}
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, 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/
+//
+#ifndef SALOMEAPP_VISUALSTATE_H
+#define SALOMEAPP_VISUALSTATE_H
+
+#ifdef WIN32
+#pragma warning( disable:4251 )
+#endif
+
+#include "SalomeApp.h"
+
+class SalomeApp_Application;
+
+class SALOMEAPP_EXPORT SalomeApp_VisualState
+{
+public:
+ SalomeApp_VisualState( SalomeApp_Application* );
+ virtual ~SalomeApp_VisualState();
+
+ virtual int storeState();
+ virtual void restoreState( int savePoint );
+
+protected:
+ SalomeApp_Application* myApp;
+};
+
+#ifdef WIN32
+#pragma warning( default:4251 )
+#endif
+
+#endif
--- /dev/null
+# SALOMELocalTrace : log on local machine
+#
+# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+#
+#
+#
+# File : Makefile.in
+# Author : Sergey RUIN
+# Module : SALOME
+
+top_srcdir=@top_srcdir@
+top_builddir=../../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@:@top_srcdir@/idl
+
+
+@COMMENCE@
+
+# header files
+EXPORT_HEADERS= SalomeAppTest.hxx
+
+EXPORT_PYSCRIPTS = TestSalomeApp.py
+
+# Libraries targets
+
+LIB = libSalomeAppTest.la
+LIB_SRC = SalomeAppTest.cxx
+LIB_CLIENT_IDL =
+
+# Executables targets
+
+BIN = TestSalomeApp
+BIN_SRC =
+BIN_CLIENT_IDL =
+
+
+CXXFLAGS += $ @CPPUNIT_INCLUDES@ -I${KERNEL_ROOT_DIR}/include/salome
+CPPFLAGS += $ @CPPUNIT_INCLUDES@ -I${KERNEL_ROOT_DIR}/include/salome
+
+LIBS= @LIBS@ @CPPUNIT_LIBS@
+
+LDFLAGS+=
+
+LDFLAGSFORBIN+= $(LDFLAGS) -lSalomeAppTest
+
+UNIT_TEST_PROG = TestSalomeApp
+
+@CONCLUDE@
--- /dev/null
+// Copyright (C) 2006 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/
+//
+
+#include "SalomeAppTest.hxx"
+
+using namespace std;
+
+// ============================================================================
+/*!
+ * Set up the environment
+ */
+// ============================================================================
+
+void SalomeAppTest::setUp()
+{
+}
+
+// ============================================================================
+/*!
+ * - delete
+ */
+// ============================================================================
+
+void SalomeAppTest::tearDown()
+{
+}
+
+// ============================================================================
+/*!
+ * Check SalomeApp functionality
+ */
+// ============================================================================
+void SalomeAppTest::testSalomeApp()
+{
+}
+
+
+
+
--- /dev/null
+// Copyright (C) 2006 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/
+//
+
+#ifndef _SalomeAppTEST_HXX_
+#define _SalomeAppTEST_HXX_
+
+#include <cppunit/extensions/HelperMacros.h>
+
+class SalomeAppTest : public CppUnit::TestFixture
+{
+ CPPUNIT_TEST_SUITE( SalomeAppTest );
+ CPPUNIT_TEST( testSalomeApp );
+ CPPUNIT_TEST_SUITE_END();
+
+public:
+
+ void setUp();
+ void tearDown();
+ void testSalomeApp();
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/
+//
+
+// --- include all SalomeApp Test from basics until the present directory
+
+#include "SalomeAppTest.hxx"
+
+// --- Registers the fixture into the 'registry'
+
+CPPUNIT_TEST_SUITE_REGISTRATION( SalomeAppTest );
+
+// --- generic Main program from Basic/Test
+
+#include "BasicMainTest.hxx"
--- /dev/null
+
+import sys, os,signal,string,commands
+import runSalome
+import orbmodule
+import TestKiller
+
+# get SALOME environment :
+
+args, modules_list, modules_root_dir = runSalome.get_config()
+runSalome.set_env(args, modules_list, modules_root_dir)
+
+# launch CORBA naming server
+
+clt=orbmodule.client()
+
+# launch CORBA logger server
+
+myServer=runSalome.LoggerServer(args)
+myServer.run()
+clt.waitLogger("Logger")
+
+# execute Unit Test
+
+command = ['TestSalomeApp']
+ret = os.spawnvp(os.P_WAIT, command[0], command)
+
+# kill Test process
+
+TestKiller.killProcess(runSalome.process_id)
<document>
<section name="desktop" >
- <parameter name="state" value="max"/>
- <parameter name="pos_x" value="100"/>
- <parameter name="pos_y" value="050"/>
- <parameter name="width" value="640"/>
- <parameter name="height" value="480"/>
+ <parameter name="state" value="normal"/>
+ <parameter name="pos_x" value="center"/>
+ <parameter name="pos_y" value="center"/>
+ <parameter name="width" value="800"/>
+ <parameter name="height" value="600"/>
</section>
<section name="launch">
<parameter name="gui" value="yes"/>
<parameter name="font" value="Helvetic,12" />
</section>
<section name="Study">
- <parameter name="store_positions" value="false" />
+ <parameter name="store_positions" value="false" />
+ <parameter name="store_visual_state" value="false" />
</section>
<section name="GEOM">
<parameter name="name" value="Geometry"/>
<parameter value="false" name="auto_groups" />
</section>
<section name="VISU" >
+ <parameter value="false" name="use_build_progress" />
<parameter value="false" name="full_med_loading" />
<parameter value="false" name="represent_shading" />
<parameter value="0.05" name="scalar_bar_horizontal_height" />
msgid "SalomeApp_Application::PRP_DESK_FILE_DUMP_STUDY"
msgstr "Dumps study to the python script"
+msgid "SalomeApp_Application::TOT_DESK_FILE_SAVE_GUI_STATE"
+msgstr "Save GUI state"
+
+msgid "SalomeApp_Application::MEN_DESK_FILE_SAVE_GUI_STATE"
+msgstr "Save GUI state..."
+
+msgid "SalomeApp_Application::PRP_DESK_FILE_SAVE_GUI_STATE"
+msgstr "Saves current state of viewers, displayed objects, etc."
+
msgid "SalomeApp_Application::TOT_DESK_FILE_LOAD_SCRIPT"
msgstr "Load python script"
msgid "SalomeApp_Application::MEN_DELETE_INVALID_REFERENCE"
msgstr "Delete Invalid Reference"
+msgid "SalomeApp_Application::PREF_STORE_VISUAL_STATE"
+msgstr "Store/restore last GUI state"
+
+//=======================================================================================
+
+msgid "PUBLISH_IN_STUDY"
+msgstr "Publish in study"
+
+msgid "SAVE_GUI_STATE"
+msgstr "Save GUI state"
+
//=======================================================================================
msgid "SalomeApp_Application::MEN_WINDOWS_NEW"
msgid "SalomeApp_Application::WRN_DUMP_STUDY_FAILED"
msgstr "Dump study failed"
+msgid "SAVE_POINT_OBJECT_TOOLTIP"
+msgstr "Saved GUI state: %1"
+
+msgid "SAVE_POINT_DEF_NAME"
+msgstr "GUI state: "
+
+msgid "SAVE_POINT_ROOT_TOOLTIP"
+msgstr "Persistent GUI states"
+
+msgid "SAVE_POINT_ROOT_NAME"
+msgstr "GUI states"
+
+//=======================================================================================
+
+msgid "SalomeApp_Application::MEN_RESTORE_VS"
+msgstr "Restore"
+
+msgid "SalomeApp_Application::MEN_RENAME_VS"
+msgstr "Rename"
+
+msgid "SalomeApp_Application::MEN_DELETE_VS"
+msgstr "Delete"
LIB_SRC=Session_Session_i.cxx \
Session_ServerThread.cxx \
Session_ServerLauncher.cxx \
- Session_SignalsHandler.cxx \
SalomeApp_Engine_i.cxx \
InquireServersQThread.cxx
CPPFLAGS += $(QT_MT_INCLUDES) $(PYTHON_INCLUDES) $(HDF5_INCLUDES) $(BOOST_CPPFLAGS) -I$(KERNEL_ROOT_DIR)/include/salome -I$(OCC_INCLUDES)
CXXFLAGS += $(OCC_CXXFLAGS) $(BOOST_CPPFLAGS)
-LDFLAGS += $(QT_MT_LIBS) -L$(KERNEL_ROOT_DIR)/lib/salome -lSalomeNS -lsuit -lSalomeLifeCycleCORBA -lOpUtil -lSALOMELocalTrace -lwith_loggerTraceCollector -lEvent -lCASCatch -lSalomeCatalog -lSalomeDS $(CAS_KERNEL)
+LDFLAGS += $(QT_MT_LIBS) -L$(KERNEL_ROOT_DIR)/lib/salome -lSalomeNS -lsuit -lSalomeLifeCycleCORBA -lOpUtil -lSALOMELocalTrace -lwith_loggerTraceCollector -lEvent -lSalomeCatalog -lSalomeDSClient $(CAS_KERNEL)
LDFLAGSFORBIN= $(LDFLAGS) $(OMNIORB_LIBS) $(HDF5_LIBS) -lqtx -lSalomeContainer -lSalomeResourcesManager -lTOOLSDS -lSalomeHDFPersist -lSalomeDSImpl -lSalomeGenericObj -lRegistry -lSalomeNotification -lSALOMEBasics
#include "SUIT_ExceptionHandler.h"
-extern "C" int HandleSignals( QApplication *theQApplication );
-
/*! - read arguments, define list of server to launch with their arguments.
* - wait for naming service
* - create and run a thread for launch of all servers
#include "SALOME_Container_i.hxx"
#include "SALOME_ContainerManager.hxx"
-#include "SALOMEDS_StudyManager_i.hxx"
+#include <SALOMEDSClient.hxx>
+#include <SALOMEDSClient_ClientFactory.hxx>
#include "SALOME_ModuleCatalog_impl.hxx"
#include "RegistryService.hxx"
#include "Session_Session_i.hxx"
// counted objects, they will be deleted by the POA when they are no
// longer needed.
- SALOMEDS_StudyManager_i * myStudyManager_i
- = new SALOMEDS_StudyManager_i(_orb,_root_poa);
-
- // Activate the objects. This tells the POA that the objects are
- // ready to accept requests.
-
- PortableServer::ObjectId_var myStudyManager_iid
- = _root_poa->activate_object(myStudyManager_i);
- myStudyManager_i->register_name("/myStudyManager");
+ ClientFactory::createStudyManager(_orb,_root_poa);
}
catch(CORBA::SystemException&)
{
}
return aStudyId;
}
+
+bool SALOME_Session_i::restoreVisualState(CORBA::Long theSavePoint)
+{
+ class TEvent: public SALOME_Event {
+ int _savePoint;
+ public:
+ TEvent(int savePoint) { _savePoint = savePoint; }
+ virtual void Execute() {
+ SUIT_Study* study = SUIT_Session::session()->activeApplication()->activeStudy();
+ if ( study ) {
+ study->restoreState(_savePoint);
+ }
+ }
+ };
+
+ if(SUIT_Session::session() && SUIT_Session::session()->activeApplication() ) {
+ SUIT_Study* study = SUIT_Session::session()->activeApplication()->activeStudy();
+ if(!study) SUIT_Session::session()->activeApplication()->createEmptyStudy();
+ ProcessVoidEvent( new TEvent(theSavePoint) );
+ return true;
+ }
+
+ return false;
+}
void ping(){};
+ //! Restors a visual state of the study at theSavePoint
+ bool restoreVisualState(CORBA::Long theSavePoint);
+
protected:
//! Naming service interface
+++ /dev/null
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-
-
-#include <stdexcept>
-#include <qapplication.h>
-
-#include <CASCatch_CatchSignals.hxx>
-#include <CASCatch_ErrorHandler.hxx>
-#include <CASCatch_Failure.hxx>
-
-extern "C" int HandleSignals(QApplication *theQApplication)
-{
- int aRet = -1;
- CASCatch_CatchSignals aCatchSignals;
- aCatchSignals.Activate();
-
- CASCatch_TRY {
- aRet = theQApplication->exec();
- }
- CASCatch_CATCH(CASCatch_Failure) {
- aCatchSignals.Deactivate();
- Handle(CASCatch_Failure) aFail = CASCatch_Failure::Caught();
- throw std::runtime_error( aFail->GetError() );
- }
-
- aCatchSignals.Deactivate();
- return aRet;
-}
VTKViewer_Actor
::IsInfinitive()
{
- return myIsInfinite;
+ static float MIN_DISTANCE = 1.0 / VTK_LARGE_FLOAT;
+
+ if(myIsInfinite || GetLength() < MIN_DISTANCE)
+ return true;
+ else
+ return false;
}
#include "VTKViewer_AppendFilter.h"
-#include "VTKViewer_ConvexTool.h"
-
-#include <vtkSmartPointer.h>
-#include <vtkCellArray.h>
+#include <vtkCell.h>
#include <vtkCellData.h>
-#include <vtkGenericCell.h>
-#include <vtkHexahedron.h>
-#include <vtkMergePoints.h>
+#include <vtkDataSetAttributes.h>
+#include <vtkDataSetCollection.h>
#include <vtkObjectFactory.h>
#include <vtkPointData.h>
-#include <vtkPolyData.h>
-#include <vtkPyramid.h>
-#include <vtkStructuredGrid.h>
-#include <vtkTetra.h>
-#include <vtkUnsignedCharArray.h>
#include <vtkUnstructuredGrid.h>
-#include <vtkVoxel.h>
-#include <vtkWedge.h>
-#include <vtkDataSetCollection.h>
-
-#include <vector>
-#include <map>
-using namespace std;
-
-#ifdef _DEBUG_
-//static int MYDEBUG = 0;
-//static int MYDEBUGWITHFILES = 0;
-#else
-//static int MYDEBUG = 0;
-//static int MYDEBUGWITHFILES = 0;
-#endif
+#include <vtkPoints.h>
#if defined __GNUC__
#if __GNUC__ == 2
VTKViewer_AppendFilter
::VTKViewer_AppendFilter()
{
- myDoMappingFlag=false;
+ myDoMappingFlag = false;
}
VTKViewer_AppendFilter
VTKViewer_AppendFilter
::SetDoMappingFlag(const bool theFlag)
{
- myDoMappingFlag=theFlag;
+ if(myDoMappingFlag == theFlag)
+ return;
+
+ myDoMappingFlag = theFlag;
+
+ this->Modified();
}
bool
VTKViewer_AppendFilter
::SetPoints(vtkPoints* thePoints)
{
+ if(GetPoints() == thePoints)
+ return;
+
myPoints = thePoints;
+
+ this->Modified();
}
vtkPoints*
VTKViewer_AppendFilter
::Execute()
{
- if (myPoints.GetPointer()) {
+ if(myPoints.GetPointer())
MakeOutput();
- }
- else {
- vtkAppendFilter::Execute();
- }
- if (myDoMappingFlag){
+ else
+ Superclass::Execute();
+
+ if(myDoMappingFlag)
DoMapping();
- }
}
-void
-VTKViewer_AppendFilter
-::Reset()
-{
- myNodeIds.clear();
- myCellIds.clear();
- myNodeRanges.clear();
- myCellRanges.clear();
- myNodeMapObjIDVtkID.clear();
- myCellMapObjIDVtkID.clear();
-}
+
//==================================================================
// function: DoMapping
// purpose :
VTKViewer_AppendFilter
::DoMapping()
{
- int i, j, i1, i2, iNodeCnt, iCellCnt;
- IteratorOfDataMapOfIntegerInteger aMapIt;
- vtkIdType aNbPnts, aNbCells, aId;
- vtkDataSet *pDS;
- //
- Reset();
- //
- iNodeCnt=0;
- iCellCnt=0;
- for (i=0; i<NumberOfInputs; ++i) {
- pDS=(vtkDataSet *)Inputs[i];
- //
- // Nodes
- if (!myPoints.GetPointer()) {
- aNbPnts=pDS->GetNumberOfPoints();
- i1=myNodeIds.size();
- i2=i1+aNbPnts-1;
- myNodeRanges.push_back(i1);
- myNodeRanges.push_back(i2);
- //
- for(j=0; j<aNbPnts; ++j) {
- aId=(vtkIdType)j;
- myNodeIds.push_back(aId);
- //
- aMapIt=myNodeMapObjIDVtkID.find(aId);
- if (aMapIt==myNodeMapObjIDVtkID.end()) {
- // if not found
- myNodeMapObjIDVtkID[aId]=iNodeCnt;
- }
- ++iNodeCnt;
- }
- }
- //
- // Cells
- aNbCells=pDS->GetNumberOfCells();
- i1=myCellIds.size();
- i2=i1+aNbCells-1;
- myCellRanges.push_back(i1);
- myCellRanges.push_back(i2);
- for(j=0; j<aNbCells; ++j) {
- aId=(vtkIdType)j;
- myCellIds.push_back(aId);
- //
- aMapIt=myCellMapObjIDVtkID.find(aId);
- if (aMapIt==myCellMapObjIDVtkID.end()) {
- // if not found
- myCellMapObjIDVtkID[aId]=iCellCnt;
- }
- ++iCellCnt;
+ myNodeRanges.clear();
+ myCellRanges.clear();
+
+ vtkIdType aPntStartId = 0;
+ vtkIdType aCellStartId = 0;
+
+ for(vtkIdType aDataSetId = 0; aDataSetId < this->NumberOfInputs; ++aDataSetId){
+ vtkDataSet* aDataSet = (vtkDataSet *)(this->Inputs[aDataSetId]);
+ // Do mapping of the nodes
+ if(!myPoints.GetPointer()){
+ vtkIdType aNbPnts = aDataSet->GetNumberOfPoints();
+ myNodeRanges.push_back(aPntStartId + aNbPnts);
+ aPntStartId += aNbPnts;
}
+ // Do mapping of the cells
+ vtkIdType aNbCells = aDataSet->GetNumberOfCells();
+ myCellRanges.push_back(aCellStartId + aNbCells);
+ aCellStartId += aNbCells;
}
}
//---------------------------------------------------------------
+namespace
+{
+ inline
+ vtkIdType
+ GetOutputID(vtkIdType theInputID,
+ vtkIdType theInputDataSetID,
+ const VTKViewer_AppendFilter::TVectorIds& theRanges)
+ {
+ theInputID = theInputDataSetID = -1;
+
+ vtkIdType aNbInputs = theRanges.size();
+ if(theInputDataSetID < 0 || theInputDataSetID >= aNbInputs)
+ return -1;
+
+ vtkIdType aStartId = theRanges[theInputDataSetID];
+ return aStartId + theInputID;
+ }
+}
+
vtkIdType
VTKViewer_AppendFilter
-::GetPointOutputID(vtkIdType theInputID)
+::GetPointOutputID(vtkIdType theInputID,
+ vtkIdType theInputDataSetID)
{
- if (myPoints.GetPointer()) {
+ if(myPoints.GetPointer())
return theInputID;
- }
- //
- int aVtkID=-1;
- IteratorOfDataMapOfIntegerInteger aMapIt;
- //
- aMapIt=myNodeMapObjIDVtkID.find(theInputID);
- if (aMapIt!=myNodeMapObjIDVtkID.end()) {
- // found
- PairOfDataMapOfIntegerInteger& aPair=(*aMapIt);
- aVtkID=aPair.second;
- }
- return aVtkID;
+
+ return GetOutputID(theInputID,theInputDataSetID,myNodeRanges);
}
//---------------------------------------------------------------
vtkIdType
VTKViewer_AppendFilter
-::GetCellOutputID(vtkIdType theInputID)
+::GetCellOutputID(vtkIdType theInputID,
+ vtkIdType theInputDataSetID)
{
- int aVtkID=-1;
- IteratorOfDataMapOfIntegerInteger aMapIt;
- //
- aMapIt=myCellMapObjIDVtkID.find(theInputID);
- if (aMapIt!=myCellMapObjIDVtkID.end()) {
- // found
- PairOfDataMapOfIntegerInteger& aPair=(*aMapIt);
- aVtkID=aPair.second;
- }
- return aVtkID;
+ if(myPoints.GetPointer())
+ return theInputID;
+
+ return GetOutputID(theInputID,theInputDataSetID,myCellRanges);
}
//---------------------------------------------------------------
-vtkIdType
+namespace
+{
+ void
+ GetInputID(vtkIdType theOutputID,
+ vtkIdType& theInputID,
+ vtkIdType& theStartID,
+ vtkIdType& theInputDataSetID,
+ const VTKViewer_AppendFilter::TVectorIds& theRanges)
+ {
+ theInputID = theStartID = theInputDataSetID = -1;
+
+ if(theRanges.empty())
+ return;
+
+ const vtkIdType& aRangeEnd = theRanges.back();
+ if(theOutputID < 0 || theOutputID >= aRangeEnd)
+ return;
+
+ vtkIdType aStartId = 0;
+ vtkIdType aNbInputs = theRanges.size();
+ for(vtkIdType aDataSetId = 0; aDataSetId < aNbInputs; ++aDataSetId){
+ vtkIdType aRange = theRanges[aDataSetId];
+ if(aRange > theOutputID){
+ theInputID = theOutputID - aStartId;
+ theInputDataSetID = aDataSetId;
+ theStartID = aStartId;
+ break;
+ }
+ aStartId = aRange;
+ }
+ }
+}
+
+void
VTKViewer_AppendFilter
-::GetPointInputID(vtkIdType theOutputID,
+::GetPointInputID(vtkIdType theOutputID,
+ vtkIdType& theInputID,
+ vtkIdType& theStartID,
vtkIdType& theInputDataSetID)
{
- if (myPoints.GetPointer()) {
- theInputDataSetID=0;
- return theOutputID;
- }
- //
- int aNb, aNbRanges, aRetID, i, i1, i2, j;
- //
- aRetID=-1;
- theInputDataSetID=-1;
- //
- aNb=myNodeIds.size();
- if (theOutputID<0 || theOutputID>=aNb) {
- return aRetID;
- }
- //
- aRetID=(int)myNodeIds[theOutputID];
- //
- aNbRanges=myNodeRanges.size()/2;
- for (i=0; i<aNbRanges; ++i) {
- j=2*i;
- i1=myNodeRanges[j];
- i2=myNodeRanges[j+1];
- if (theOutputID>=i1 && theOutputID<=i2) {
- theInputDataSetID=i;
- }
+ if(myPoints.GetPointer()) {
+ theStartID = theInputDataSetID = 0;
+ theInputID = theOutputID;
+ return;
}
- //
- return aRetID;
+
+ ::GetInputID(theOutputID,
+ theInputID,
+ theStartID,
+ theInputDataSetID,
+ myNodeRanges);
}
//---------------------------------------------------------------
-vtkIdType
+void
VTKViewer_AppendFilter
-::GetCellInputID(vtkIdType theOutputID,
+::GetCellInputID(vtkIdType theOutputID,
+ vtkIdType& theInputID,
+ vtkIdType& theStartID,
vtkIdType& theInputDataSetID)
{
- int aNb, aNbRanges, aRetID, i, i1, i2, j;
- //
- aRetID=-1;
- theInputDataSetID=-1;
- //
- aNb=myCellIds.size();
- if (theOutputID<0 || theOutputID>=aNb) {
- return aRetID;
- }
- //
- aRetID=(int)myCellIds[theOutputID];
- //
- aNbRanges=myCellRanges.size()/2;
- for (i=0; i<aNbRanges; ++i) {
- j=2*i;
- i1=myCellRanges[j];
- i2=myCellRanges[j+1];
- if (theOutputID>=i1 && theOutputID<=i2) {
- theInputDataSetID=i;
- }
- }
- //
- return aRetID;
+ ::GetInputID(theOutputID,
+ theInputID,
+ theStartID,
+ theInputDataSetID,
+ myCellRanges);
}
GetPoints();
vtkIdType
- GetPointOutputID(vtkIdType theInputID);
+ GetPointOutputID(vtkIdType theInputID,
+ vtkIdType theInputDataSetID);
vtkIdType
- GetCellOutputID(vtkIdType theInputID);
+ GetCellOutputID(vtkIdType theInputID,
+ vtkIdType theInputDataSetID);
- vtkIdType
- GetPointInputID(vtkIdType theOutputID,
- vtkIdType& theInputDataSetID);
+ void
+ GetPointInputID(vtkIdType theOutputID,
+ vtkIdType& theInputID,
+ vtkIdType& theStartID,
+ vtkIdType& theInputDataSetID);
- vtkIdType
- GetCellInputID(vtkIdType theOutputID,
+ void
+ GetCellInputID(vtkIdType theOutputID,
+ vtkIdType& theInputID,
+ vtkIdType& theStartID,
vtkIdType& theInputDataSetID);
+ typedef std::vector<vtkIdType> TVectorIds;
+
protected:
/*! \fn VTKViewer_AppendFilter();
* \brief Constructor
void MakeOutput();
- //
+ bool myDoMappingFlag;
+ TVectorIds myNodeRanges;
+ TVectorIds myCellRanges;
vtkSmartPointer<vtkPoints> myPoints;
-
-private:
- typedef std::vector<vtkIdType> TVectorId;
- typedef std::vector<int> VectorInt;
- typedef std::map <int,int> DataMapOfIntegerInteger;
- typedef DataMapOfIntegerInteger::iterator IteratorOfDataMapOfIntegerInteger;
- typedef DataMapOfIntegerInteger::value_type PairOfDataMapOfIntegerInteger;
-private:
- bool myDoMappingFlag;
- TVectorId myNodeIds;
- TVectorId myCellIds;
- VectorInt myNodeRanges;
- VectorInt myCellRanges;
- DataMapOfIntegerInteger myNodeMapObjIDVtkID;
- DataMapOfIntegerInteger myCellMapObjIDVtkID;
};
#endif
/*!@see vtkRenderer::ResetCamera(float bounds[6]) method*/
void ResetCamera(vtkRenderer* theRenderer, int theUsingZeroFocalPoint)
{
- if(!theRenderer) return;
- float bounds[6];
- int aCount = ComputeVisiblePropBounds(theRenderer,bounds);
+ if(!theRenderer)
+ return;
+
+ vtkCamera* aCamera = theRenderer->GetActiveCamera();
+ if(!aCamera)
+ return;
+
+ float aBounds[6];
+ int aCount = ComputeVisiblePropBounds(theRenderer,aBounds);
+
if(theUsingZeroFocalPoint || aCount){
- float aLength = bounds[1]-bounds[0];
- aLength = max((bounds[3]-bounds[2]),aLength);
- aLength = max((bounds[5]-bounds[4]),aLength);
+ static float MIN_DISTANCE = 1.0 / VTK_LARGE_FLOAT;
+
+ float aLength = aBounds[1]-aBounds[0];
+ aLength = max((aBounds[3]-aBounds[2]),aLength);
+ aLength = max((aBounds[5]-aBounds[4]),aLength);
- double vn[3];
- if ( theRenderer->GetActiveCamera() != NULL )
- theRenderer->GetActiveCamera()->GetViewPlaneNormal(vn);
- else{
+ if(aLength < MIN_DISTANCE)
return;
- }
+
+ float aWidth =
+ sqrt((aBounds[1]-aBounds[0])*(aBounds[1]-aBounds[0]) +
+ (aBounds[3]-aBounds[2])*(aBounds[3]-aBounds[2]) +
+ (aBounds[5]-aBounds[4])*(aBounds[5]-aBounds[4]));
+
+ if(aWidth < MIN_DISTANCE)
+ return;
+
+ double aViewPlaneNormal[3];
+ aCamera->GetViewPlaneNormal(aViewPlaneNormal);
- float center[3] = {0.0, 0.0, 0.0};
+ float aCenter[3] = {0.0, 0.0, 0.0};
if(!theUsingZeroFocalPoint){
- center[0] = (bounds[0] + bounds[1])/2.0;
- center[1] = (bounds[2] + bounds[3])/2.0;
- center[2] = (bounds[4] + bounds[5])/2.0;
+ aCenter[0] = (aBounds[0] + aBounds[1])/2.0;
+ aCenter[1] = (aBounds[2] + aBounds[3])/2.0;
+ aCenter[2] = (aBounds[4] + aBounds[5])/2.0;
}
- theRenderer->GetActiveCamera()->SetFocalPoint(center[0],center[1],center[2]);
+ aCamera->SetFocalPoint(aCenter[0],aCenter[1],aCenter[2]);
- float width = sqrt((bounds[1]-bounds[0])*(bounds[1]-bounds[0]) +
- (bounds[3]-bounds[2])*(bounds[3]-bounds[2]) +
- (bounds[5]-bounds[4])*(bounds[5]-bounds[4]));
-
- double ang = theRenderer->GetActiveCamera()->GetViewAngle();
- float distance = 2.0*width/tan(ang*vtkMath::Pi()/360.0);
+ double aViewAngle = aCamera->GetViewAngle();
+ float aDistance = 2.0*aWidth/tan(aViewAngle*vtkMath::Pi()/360.0);
// check view-up vector against view plane normal
- double *vup = theRenderer->GetActiveCamera()->GetViewUp();
- if ( fabs(vtkMath::Dot(vup,vn)) > 0.999 ){
- theRenderer->GetActiveCamera()->SetViewUp(-vup[2], vup[0], vup[1]);
- }
+ double aViewUp[3];
+ aCamera->GetViewUp(aViewUp);
+ if(fabs(vtkMath::Dot(aViewUp,aViewPlaneNormal)) > 0.999)
+ aCamera->SetViewUp(-aViewUp[2], aViewUp[0], aViewUp[1]);
// update the camera
- theRenderer->GetActiveCamera()->SetPosition(center[0]+distance*vn[0],
- center[1]+distance*vn[1],
- center[2]+distance*vn[2]);
+ aCamera->SetPosition(aCenter[0]+aDistance*aViewPlaneNormal[0],
+ aCenter[1]+aDistance*aViewPlaneNormal[1],
+ aCenter[2]+aDistance*aViewPlaneNormal[2]);
+
// find size of the window
- int* winsize = theRenderer->GetSize();
- if(winsize[0] < winsize[1]) width *= float(winsize[1])/float(winsize[0]);
+ int* aWinSize = theRenderer->GetSize();
+ if(aWinSize[0] < aWinSize[1])
+ aWidth *= float(aWinSize[1])/float(aWinSize[0]);
- if(theUsingZeroFocalPoint) width *= sqrt(2.0);
+ if(theUsingZeroFocalPoint)
+ aWidth *= sqrt(2.0);
- theRenderer->GetActiveCamera()->SetParallelScale(width/2.0);
+ aCamera->SetParallelScale(aWidth/2.0);
}
- //workaround on VTK
- //theRenderer->ResetCameraClippingRange(bounds);
+
ResetCameraClippingRange(theRenderer);
}
QPixmap px = QPixmap::grabWindow( myRenderWindow->winId() );
return px.convertToImage();
}
+
+/*! The method returns the visual parameters of this view as a formated string
+ */
+QString VTKViewer_ViewWindow::getVisualParameters()
+{
+ double pos[3], focalPnt[3], viewUp[3], parScale, scale[3];
+
+ vtkCamera* camera = myRenderer->GetActiveCamera();
+ camera->GetPosition( pos );
+ camera->GetFocalPoint( focalPnt );
+ camera->GetViewUp( viewUp );
+ parScale = camera->GetParallelScale();
+ GetScale( scale );
+
+ QString retStr;
+ retStr.sprintf( "%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e",
+ pos[0], pos[1], pos[2], focalPnt[0], focalPnt[1], focalPnt[2], viewUp[0], viewUp[1],
+ viewUp[2], parScale, scale[0], scale[1], scale[2] );
+ return retStr;
+}
+
+/* The method restors visual parameters of this view from a formated string
+ */
+void VTKViewer_ViewWindow::setVisualParameters( const QString& parameters )
+{
+ QStringList paramsLst = QStringList::split( '*', parameters, true );
+ if ( paramsLst.size() == 13 ) {
+ double pos[3], focalPnt[3], viewUp[3], parScale, scale[3];
+ pos[0] = paramsLst[0].toDouble();
+ pos[1] = paramsLst[1].toDouble();
+ pos[2] = paramsLst[2].toDouble();
+ focalPnt[0] = paramsLst[3].toDouble();
+ focalPnt[1] = paramsLst[4].toDouble();
+ focalPnt[2] = paramsLst[5].toDouble();
+ viewUp[0] = paramsLst[6].toDouble();
+ viewUp[1] = paramsLst[7].toDouble();
+ viewUp[2] = paramsLst[8].toDouble();
+ parScale = paramsLst[9].toDouble();
+ scale[0] = paramsLst[10].toDouble();
+ scale[1] = paramsLst[11].toDouble();
+ scale[2] = paramsLst[12].toDouble();
+
+ vtkCamera* camera = myRenderer->GetActiveCamera();
+ camera->SetPosition( pos );
+ camera->SetFocalPoint( focalPnt );
+ camera->SetViewUp( viewUp );
+ camera->SetParallelScale( parScale );
+ myTransform->SetMatrixScale( scale[0], scale[1], scale[2] );
+ myRWInteractor->Render();
+ }
+}
void AddActor( VTKViewer_Actor*, bool update = false );
void RemoveActor( VTKViewer_Actor*, bool update = false);
+ virtual QString getVisualParameters();
+ virtual void setVisualParameters( const QString& parameters );
+
public slots:
void onFrontView();
void onBackView();
"Last-Translator: FULLNAME <EMAIL@ADDRESS>\n"
"Content-Type: text/plain; charset=iso-8859-1\n"
-
#: SVTK_NonIsometricDlg.cxx
msgid "SVTK_NonIsometricDlg::MEN_SCALING"