Cherrypick from master 2005-11-28 09:20:47 UTC asl <asl@opencascade.com> 'It is recommended to use standard Qt QInputDialog instead QtxNameDlg':
adm_local/unix/make_commence.in
bin/runLightSalome.csh
src/CAF/Makefile.in
src/CAF/resources/CAF_msg_en.po
src/GLViewer/GLViewer_Context.cxx
src/GLViewer/GLViewer_Drawer.h
src/GLViewer/GLViewer_Geom.h
src/GLViewer/GLViewer_Viewer2d.cxx
src/LightApp/LightApp.h
src/LightApp/LightApp_Application.h
src/LightApp/LightApp_Module.h
src/LightApp/resources/icon_about.png
src/LightApp/resources/icon_applogo.png
src/LightApp/resources/icon_default.png
src/LightApp/resources/icon_module.png
src/LightApp/resources/icon_module_big.png
src/LightApp/resources/icon_select.png
src/ObjBrowser/OB_Browser.cxx
src/ObjBrowser/OB_Browser.h
src/Qtx/Makefile.in
src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip
src/SALOME_SWIG/SALOMEGUI_Swig.cxx
src/STD/resources/STD_images.po
src/SUPERVGraph/Makefile.in
src/SUPERVGraph/SUPERVGraph.h
src/SUPERVGraph/SUPERVGraph_ViewFrame.cxx
src/SUPERVGraph/SUPERVGraph_ViewFrame.h
src/SUPERVGraph/resources/SUPERVGraph_images.po
src/SUPERVGraph/resources/SUPERVGraph_msg_en.po
src/SUPERVGraph/resources/view_pan.png
src/SUPERVGraph/resources/view_reset.png
src/Session/Makefile.in
src/TOOLSGUI/Makefile.in
--- /dev/null
+# common directories to put headerfiles
+inc_builddir=$(top_builddir)/include/salome
+
+@SET_MAKE@
+SHELL=/bin/sh
+
+# header missing
+
+HAVE_SSTREAM=@HAVE_SSTREAM@
+
+
+LIBS=@LIBS@
+LIBSFORBIN=@LIBS@
+LDFLAGS=@LDFLAGS@ -L$(top_builddir)/lib/salome -Xlinker -rpath-link -Xlinker -L$(top_builddir)/lib/salome
+LDFLAGSFORBIN=@LDFLAGS@ -L$(top_builddir)/lib/salome
+# add libstdc++ to link c++ library with libtool !
+LDFLAGS+= -lstdc++
+LDFLAGSFORBIN+= -lstdc++
+
+CP=@CP@
+
+# CPP
+
+CPP=@CPP@
+CXXCPP=@CXXCPP@
+CPPFLAGS=@CPPFLAGS@ -I$(inc_builddir) -I$(srcdir) -I.
+
+# C
+
+CC = @CC@
+CFLAGS = @CFLAGS@
+C_DEPEND_FLAG = @C_DEPEND_FLAG@
+
+# C++
+
+CXX = @CXX@
+CXXFLAGS = @CXXFLAGS@
+CXX_DEPEND_FLAG = @CXX_DEPEND_FLAG@
+
+# BOOST Library
+
+BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
+
+# JAVA
+
+JAVA_INCLUDES = @JAVA_INCLUDES@
+JAVA_LIBS = @JAVA_LIBS@
+JAVA_LDPATH = @JAVA_LDPATH@
+
+# PYTHON
+
+PYTHON = @PYTHON@
+PYTHONHOME = @PYTHONHOME@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIBS = @PYTHON_LIBS@
+PYTHON_VERSION = @PYTHON_VERSION@
+PYTHON_SITE = $(prefix)/lib/python$(PYTHON_VERSION)/site-packages
+PYTHON_SITE_INSTALL = $(prefix)/lib/python$(PYTHON_VERSION)/site-packages/salome
+# QT
+
+QT_ROOT = @QT_ROOT@
+QT_INCLUDES = @QT_INCLUDES@
+QT_MT_INCLUDES = @QT_INCLUDES@ -DQT_THREAD_SUPPORT
+QT_LIBS = @QT_LIBS@
+QT_MT_LIBS = @QT_MT_LIBS@
+QT_VERS = @QT_VERS@
+
+MOC = @MOC@
+UIC = @UIC@
+
+# msg2qm
+MSG2QM = @MSG2QM@
+
+#QWT
+
+QWT_INCLUDES=@QWT_INCLUDES@
+QWT_LIBS=@QWT_LIBS@
+
+# SIP
+SIP = @SIP@
+SIP_INCLUDES = @SIP_INCLUDES@
+SIP_LIBS = @SIP_LIBS@
+SIP_VERS = @SIP_VERS@
+
+# PYQT
+PYQT_SIPS = @PYQT_SIPS@
+PYQT_LIBS = @PYQT_LIBS@
+PYQT_INCLUDES = @PYQT_INCLUDES@
+PYUIC = @PYUIC@
+PYQT_SIPFLAGS = @PYQT_SIPFLAGS@
+
+# openGL
+OGL_INCLUDES=@OGL_INCLUDES@
+OGL_LIBS=@OGL_LIBS@
+
+# VTK
+VTK_INCLUDES=@VTK_INCLUDES@
+VTK_LIBS=@VTK_LIBS@
+
+# HDF5
+
+HDF5_INCLUDES=@HDF5_INCLUDES@
+HDF5_LIBS=@HDF5_LIBS@
+HDF5_MT_LIBS=@HDF5_MT_LIBS@
+
+# OpenCasCade
+
+OCC_INCLUDES=@CAS_CPPFLAGS@
+OCC_CXXFLAGS=@CAS_CXXFLAGS@
+
+#OCC_KERNEL_LIBS=@CAS_KERNEL@
+#OCC_OCAF_LIBS=@CAS_OCAF@
+#OCC_VIEWER_LIBS=@CAS_VIEWER@
+#OCC_MODELER_LIBS=@CAS_MODELER@
+#OCC_DATAEXCHANGE_LIBS=@CAS_DATAEXCHANGE@
+#OCC_LIBS=@CAS_LDFLAGS@
+CAS_KERNEL=@CAS_KERNEL@
+CAS_MATH=@CAS_MATH@
+CAS_OCAF=@CAS_OCAF@
+CAS_OCAFVIS=@CAS_OCAFVIS@
+CAS_TKTopAlgo=@CAS_TKTopAlgo@
+CAS_VIEWER=@CAS_VIEWER@
+CAS_MODELER=@CAS_MODELER@
+CAS_DATAEXCHANGE=@CAS_DATAEXCHANGE@
+CAS_LDPATH=@CAS_LDPATH@
+# MPICH
+
+MPICH_INCLUDES=@MPICH_INCLUDES@
+MPICH_LIBS=@MPICH_LIBS@
+
+# Swig C++ Python
+
+SWIG = @SWIG@
+SWIG_FLAGS = @SWIG_FLAGS@ -I$(inc_builddir) -I$(srcdir) -I.
+
+# OMNIORB
+
+OMNIORB_ROOT = @OMNIORB_ROOT@
+OMNIORB_INCLUDES = @OMNIORB_INCLUDES@
+OMNIORB_LIBS = @OMNIORB_LIBS@
+OMNIORB_CXXFLAGS = @OMNIORB_CXXFLAGS@
+
+OMNIORB_IDL = @OMNIORB_IDL@
+OMNIORB_IDLCXXFLAGS = @OMNIORB_IDLCXXFLAGS@
+OMNIORB_IDLPYFLAGS = @OMNIORB_IDLPYFLAGS@ -I$(top_srcdir)/idl -I$(KERNEL_ROOT_DIR)/idl/salome
+
+OMNIORB_IDL_CLN_H = @OMNIORB_IDL_CLN_H@
+OMNIORB_IDL_CLN_CXX = @OMNIORB_IDL_CLN_CXX@
+OMNIORB_IDL_CLN_OBJ = @OMNIORB_IDL_CLN_OBJ@
+
+OMNIORB_IDL_SRV_H = @OMNIORB_IDL_SRV_H@
+OMNIORB_IDL_SRV_CXX = @OMNIORB_IDL_SRV_CXX@
+OMNIORB_IDL_SRV_OBJ = @OMNIORB_IDL_SRV_OBJ@
+
+# Default ORB
+
+CORBA_ROOT = @CORBA_ROOT@
+CORBA_INCLUDES = @CORBA_INCLUDES@
+CORBA_LIBS = @CORBA_LIBS@
+CORBA_CXXFLAGS = @CORBA_CXXFLAGS@
+
+IDLCXXFLAGS = -bcxx @IDLCXXFLAGS@ -I$(top_srcdir)/idl -I$(KERNEL_ROOT_DIR)/idl/salome
+IDLPYFLAGS = @IDLPYFLAGS@
+
+IDL = @IDL@
+
+IDL_CLN_H = @IDL_CLN_H@
+IDL_CLN_CXX = @IDL_CLN_CXX@
+IDL_CLN_OBJ = @IDL_CLN_OBJ@
+
+IDL_SRV_H = @IDL_SRV_H@
+IDL_SRV_CXX = @IDL_SRV_CXX@
+IDL_SRV_OBJ = @IDL_SRV_OBJ@
+
+CPPFLAGS+= $(CORBA_INCLUDES)
+CXXFLAGS+= $(CORBA_CXXFLAGS)
+
+# add corba libs when link salome application !
+#LDFLAGS+= $(CORBA_LIBS)
+#LIBS+=$(CORBA_LIBS)
+
+DOXYGEN = @DOXYGEN@
+
+## Shared libraries
+LT_STATIC_EXEC=@LT_STATIC_EXEC@
+DYNAMIC_DIRS=@DYNAMIC_DIRS@
+LT_LIB=libtool
+LT=$(top_builddir)/libtool
+LT_COMPILE=$(LT) --mode=compile $(CC)
+LT_LINK_LIB=$(LT_LIB) --mode=link $(CC) -rpath $(libdir)
+LT_LINK_EXE=$(LT) --mode=link $(CC) $(LT_STATIC_EXEC) -dlopen self -rpath $(bindir) $(DYNAMIC_DIRS)
+LT_RUN=$(LT) --mode=execute
+LT_INSTALL_PROG=$(LT) --mode=install $(INSTALL_PROGRAM)
+LT_INSTALL_LIB=$(LT) --mode=install $(INSTALL_DATA)
+LT_UNINSTALL=$(LT) --mode=uninstall $(RM)
+
+INSTALL=@INSTALL@
+INSTALL_PROGRAM=@INSTALL_PROGRAM@
+INSTALL_DATA=@INSTALL_DATA@
+
+# create a symbolic link (or a copie ?)
+LN_S=@LN_S@
+
+## Installation points
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+bindir=@bindir@/salome
+libdir=@libdir@/salome
+# warning : if user give this path in configure we could have salome/salome :-(
+includedir=@includedir@/salome
+datadir=@datadir@/salome
+idldir=${prefix}/idl/salome
+sharedpydir=@libdir@/python$(PYTHON_VERSION)/site-packages/salome/shared_modules
+incmakedir=${prefix}/salome_adm/unix
+
+docdir=${prefix}/doc/salome
+
+#
+# begin of package rules
+#
+
+.PHONY: all lib bin inc resources data docs tests install uninstall dep depend depend_idl cleandep mostlyclean clean distclean
+
+.SUFFIXES: .cxx .cc .c .f .o .lo .idl .py .i .ui .po .qm
+
+all:
+ $(MAKE) inc
+ $(MAKE) depend_idl
+ $(MAKE) depend
+ $(MAKE) lib
+ $(MAKE) bin
+ $(MAKE) resources
+
+#
+# add target to build administrative files
+#
+
+Makefile: $(top_builddir)/config.status $(srcdir)/Makefile.in
+ cd $(top_builddir) ; ./config.status
+
+$(top_builddir)/config.status: $(top_srcdir)/configure
+ cd $(top_builddir) ; ./config.status --recheck
+
+# VPATH contain $(srcdir), so make configure is good in top_srcdir and we must add target configure otherwise :-)
+ifneq ($(top_srcdir),$(srcdir))
+configure: $(top_srcdir)/configure
+endif
+
+$(top_srcdir)/configure: $(top_srcdir)/configure.in $(top_srcdir)/aclocal.m4
+ cd $(top_srcdir) ; autoconf
+
+$(top_srcdir)/configure.in: $(top_srcdir)/configure.in.base
+ cd $(top_srcdir) && ./build_configure
+
+
+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/%)
+ cd $(top_srcdir) ; aclocal --acdir=adm_local/unix/config_files -I @KERNEL_ROOT_DIR@/salome_adm/unix/config_files
--- /dev/null
+#!/bin/csh -f
+
+if ( ! $?SUITRoot ) setenv SUITRoot ${GUI_ROOT_DIR}/share/salome
+
+# this variable necessary for loading .ini or .xml file
+if ( ! $?LightAppConfig ) setenv LightAppConfig ${GUI_ROOT_DIR}/share/salome/resources
+if ( ! $?LightAppResources ) setenv LightAppResources ${GUI_ROOT_DIR}/share/salome/resources
+
+SUITApp LightApp -style salome $* &
--- /dev/null
+# File : Makefile.in
+# Author : Vladimir Klyachin (OCN)
+# Module : caf
+# $Header$
+
+top_srcdir=@top_srcdir@
+top_builddir=../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@:@srcdir@/resources
+
+
+@COMMENCE@
+
+# header files
+EXPORT_HEADERS= CAF.h \
+ CAF_Application.h \
+ CAF_Operation.h \
+ CAF_Study.h \
+ CAF_Tools.h
+
+# .po files to transform in .qm
+PO_FILES = CAF_images.po \
+ CAF_msg_en.po
+
+# Libraries targets
+LIB = libcaf.la
+
+LIB_SRC= CAF_Application.cxx \
+ CAF_Operation.cxx \
+ CAF_Study.cxx \
+ CAF_Tools.cxx
+
+LIB_MOC = \
+ CAF_Application.h \
+ CAF_Operation.h \
+ CAF_Study.h
+
+RESOURCES_FILES = \
+redo.png \
+undo.png
+
+
+CPPFLAGS+=$(QT_INCLUDES) $(OCC_INCLUDES) -I${QTDIR}/src/kernel -I$(QTDIR)/mkspecs/linux-g++
+
+LDFLAGS+=$(QT_MT_LIBS) $(CAS_OCAF) $(CAS_OCAFVIS)
+LIBS+= -lstd -lsuit
+
+@CONCLUDE@
+
+
+
+
+
--- /dev/null
+# This is a Qt message file in .po format. Each msgid starts with
+# a scope. This scope should *NOT* be translated - eg. "Foo::Bar"
+# would be translated to "Pub", not "Foo::Pub".
+msgid ""
+msgstr ""
+"Project-Id-Version: example-Qt-message-extraction\n"
+"POT-Creation-Date: 1999-02-23 15:38+0200\n"
+"PO-Revision-Date: 1999-02-23 15:38+0200\n"
+"Last-Translator: \n"
+"Content-Type: text/plain; charset=iso-8859-1\n"
+
+msgid "CAF_Application::ABOUT_INFO"
+msgstr "SUIT Caf application"
+
+msgid "CAF_Application::MEN_APP_EDIT"
+msgstr "&Edit"
+
+msgid "CAF_Application::MEN_DESK_EDIT"
+msgstr "&Edit"
+
+msgid "CAF_Application::MEN_APP_EDIT_REDO"
+msgstr "&Redo"
+
+msgid "CAF_Application::MEN_APP_EDIT_UNDO"
+msgstr "&Undo"
+
+msgid "CAF_Application::PRP_APP_EDIT_REDO"
+msgstr "Redoes the last operation"
+
+msgid "CAF_Application::PRP_APP_EDIT_UNDO"
+msgstr "Undoes the last operation"
+
+msgid "CAF_Application::TOT_APP_EDIT_REDO"
+msgstr "Redo"
+
+msgid "CAF_Application::TOT_APP_EDIT_UNDO"
+msgstr "Undo"
+
+msgid "CAF_Application::INF_APP_UNDOACTIONS"
+msgstr " Undoes %1 action(s) "
+
+msgid "CAF_Application::INF_APP_REDOACTIONS"
+msgstr " Redoes %1 action(s) "
+
+msgid "CAF_Application::INF_ALL_DOCUMENTS_FILTER"
+msgstr "All Readable Documents"
+
+msgid "CAF_Application::INF_ALL_FILTER"
+msgstr "All Files (*.*)"
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE
+//
+// 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
+//
+// Author : OPEN CASCADE
+//
+
+// File: GLViewer_Context.cxx
+// Created: November, 2004
+
+//================================================================
+// Class : GLViewer_AspectLine
+// Description : Class for manage of presentations in GLViewer
+//================================================================
+
+#include "GLViewer_Context.h"
+
+#include "GLViewer_Group.h"
+#include "GLViewer_Object.h"
+#include "GLViewer_Viewer2d.h"
+#include "GLViewer_ViewPort2d.h"
+
+#include <TColStd_SequenceOfInteger.hxx>
+
+#define TOLERANCE 12
+
+//=======================================================================
+// Function: GLViewer_Context
+// Purpose :
+//=======================================================================
+GLViewer_Context::GLViewer_Context( GLViewer_Viewer2d* v ) :
+ myGLViewer2d( v ),
+ myHighlightColor( Quantity_NOC_CYAN1 ),
+ mySelectionColor( Quantity_NOC_RED ),
+ myTolerance( TOLERANCE )
+{
+ myUpdateAll = true;
+
+ myLastPicked = 0;
+ myLastPickedChanged = false;
+
+ myHFlag = GL_TRUE;
+ mySFlag = GL_TRUE;
+
+ mySelCurIndex = 0;
+}
+
+//=======================================================================
+// Function: ~GLViewer_Context
+// Purpose :
+//=======================================================================
+GLViewer_Context::~GLViewer_Context()
+{
+ myActiveObjects.clear();
+ myInactiveObjects.clear();
+ mySelectedObjects.clear();
+}
+
+//=======================================================================
+// Function: MoveTo
+// Purpose :
+//=======================================================================
+int GLViewer_Context::MoveTo( int xi, int yi, bool byCircle )
+{
+ GLfloat x = (GLfloat)xi;
+ GLfloat y = (GLfloat)yi;
+ myGLViewer2d->transPoint( x, y );
+
+ myXhigh = x;
+ myYhigh = y;
+
+ GLboolean isHigh = GL_FALSE;
+ GLboolean onObject = GL_FALSE;
+
+ GLViewer_Object* aPrevLastPicked = myLastPicked;
+ GLViewer_Object* lastPicked = 0;
+
+ ObjList anUpdatedObjects;
+
+ if( myActiveObjects.isEmpty() )
+ return -1;
+
+ ObjList::iterator it = myActiveObjects.end();
+ ObjList::iterator itEnd = myActiveObjects.begin();
+ for( it--; ; --it )
+ {
+ GLViewer_Object* object = *it;
+
+ GLViewer_Rect* rect = object->getUpdateRect();
+ if( rect->contains( GLViewer_Pnt( x, y ) ) )
+ {
+ onObject = GL_TRUE;
+ object->highlight( x, y, myTolerance, GL_FALSE );
+ isHigh = object->isHighlighted();
+ }
+
+ if( isHigh )
+ {
+ lastPicked = object;
+ break;
+ }
+
+ if( it == itEnd )
+ break;
+ }
+
+ if( !myHFlag )
+ {
+ myLastPicked = lastPicked;
+ return -1;
+ }
+
+ if ( !onObject )
+ {
+ //cout << 0 << endl;
+ it = myActiveObjects.begin();
+ itEnd = myActiveObjects.end();
+
+ for( ; it != itEnd; ++it )
+ (*it)->unhighlight();
+
+ anUpdatedObjects.append( (*it) );
+
+ myLastPicked = 0;
+ myLastPickedChanged = aPrevLastPicked != myLastPicked;
+
+ if( myLastPickedChanged )
+ myGLViewer2d->updateAll();
+
+ return 0;
+ }
+
+ if( !myLastPicked && isHigh )
+ {
+ //cout << 1 << endl;
+ myLastPicked = lastPicked;
+ anUpdatedObjects.append( myLastPicked );
+ }
+ else if( myLastPicked && !isHigh )
+ {
+ //cout << 2 << endl;
+ myLastPicked->unhighlight();
+ anUpdatedObjects.append( myLastPicked );
+ myLastPicked = 0;
+ }
+ else if( myLastPicked && isHigh )
+ {
+ //cout << 3 << endl;
+ myLastPicked->highlight( x, y, myTolerance, byCircle );
+ anUpdatedObjects.append( myLastPicked );
+ if( myLastPicked != lastPicked )
+ {
+ myLastPicked->unhighlight();
+ myLastPicked = lastPicked;
+ anUpdatedObjects.append( myLastPicked );
+ }
+ }
+
+ myLastPickedChanged = ( aPrevLastPicked != myLastPicked );
+
+ if( myLastPickedChanged || myUpdateAll )
+ myGLViewer2d->updateAll();
+ else
+ myGLViewer2d->activateDrawers( anUpdatedObjects, TRUE, TRUE );
+
+ return 0;
+}
+
+//=======================================================================
+// Function: Select
+// Purpose :
+//=======================================================================
+int GLViewer_Context::Select( bool Append, bool byCircle )
+{
+ ObjList::Iterator it, itEnd, oit, oitEnd;
+ SelectionStatus status = SS_Invalid;
+
+ bool updateAll = false;
+
+ ObjList aList;
+
+ if ( !mySFlag )
+ return status;//invalid
+
+ if( myHFlag && myLastPicked )
+ {
+ if( mySelectedObjects.count() == 1 && mySelectedObjects.first() == myLastPicked )
+ status = SS_LocalChanged;
+
+ if ( !Append )
+ {
+ for( it = mySelectedObjects.begin(), itEnd = mySelectedObjects.end() ; it != itEnd; ++it )
+ if( myLastPicked != *it )
+ {
+ updateAll = (*it)->unselect() || updateAll;
+ aList.append( *it );
+ }
+
+ if( updateAll || myUpdateAll )
+ myGLViewer2d->updateAll();
+ else
+ myGLViewer2d->activateDrawers( aList, TRUE, TRUE );
+
+ if( mySelectedObjects.count() != 0 && status == SS_Invalid )
+ status = SS_GlobalChanged;
+ mySelectedObjects.clear();
+ }
+ else if( myLastPicked->isSelected() && status != SS_LocalChanged )
+ {
+ mySelectedObjects.remove( myLastPicked );
+ myLastPicked->unselect();
+ myGLViewer2d->updateAll();
+
+ if( mySelectedObjects.count() != 0 && status == SS_Invalid )
+ status = SS_GlobalChanged;
+
+ return status;
+ }
+
+ if ( myLastPicked->select( myXhigh, myYhigh, myTolerance, GLViewer_Rect(), false, byCircle, Append )
+ && mySelectedObjects.findIndex( myLastPicked ) == -1 )
+ {
+ mySelectedObjects.append( myLastPicked );
+ myGLViewer2d->activateDrawer( myLastPicked, TRUE, TRUE );
+
+ if( status == SS_Invalid )
+ status = SS_GlobalChanged;
+ }
+ else if( status == SS_LocalChanged )
+ status = SS_GlobalChanged;
+
+ return status;
+ }
+
+ if( myHFlag && !myLastPicked )
+ {
+ if ( !Append )
+ {
+ for( it = mySelectedObjects.begin(), itEnd = mySelectedObjects.end() ; it != itEnd; ++it )
+ if ( myLastPicked != *it )
+ {
+ updateAll = (*it)->unselect() || updateAll;
+ aList.append( *it );
+ }
+
+ if( updateAll || myUpdateAll )
+ myGLViewer2d->updateAll();
+ else
+ myGLViewer2d->activateDrawers( aList, TRUE, TRUE );
+
+ if( mySelectedObjects.count() != 0 )
+ status = SS_GlobalChanged;
+
+ mySelectedObjects.clear();
+ }
+ return status;
+ }
+
+ if( !myHFlag )
+ {
+ bool isSel = false;
+ GLfloat aXScale;
+ GLfloat aYScale;
+ GLViewer_ViewPort2d* vp = ( GLViewer_ViewPort2d* )myGLViewer2d->getActiveView()->getViewPort();
+ vp->getScale( aXScale, aYScale );
+
+ if ( !Append )
+ {
+ for( it = mySelectedObjects.begin(), itEnd = mySelectedObjects.end() ; it != itEnd; ++it )
+ if( myLastPicked != *it )
+ {
+ updateAll = (*it)->unselect() || updateAll;
+ aList.append( *it );
+ }
+
+ if( updateAll || myUpdateAll )
+ myGLViewer2d->updateAll();
+ else
+ myGLViewer2d->activateDrawers( aList, TRUE, TRUE );
+
+ if( mySelectedObjects.count() != 0 )
+ status = SS_GlobalChanged;
+
+ mySelectedObjects.clear();
+ }
+
+ for( oit = myActiveObjects.begin(), oitEnd = myActiveObjects.end(); oit != oitEnd; ++oit )
+ {
+ (*oit)->setScale( aXScale, aYScale );
+ GLViewer_Rect* rect = (*oit)->getUpdateRect();
+
+ if( rect->contains( GLViewer_Pnt( myXhigh, myXhigh ) ) )
+ {
+ (*oit)->select( myXhigh, myYhigh, myTolerance, GLViewer_Rect(), false, byCircle, Append );
+ isSel = (*oit)->isSelected();
+ }
+ if( isSel )
+ {
+ myLastPicked = *oit;
+ mySelectedObjects.append( myLastPicked );
+ myGLViewer2d->activateDrawer( myLastPicked, TRUE, TRUE );
+ status = SS_GlobalChanged;
+ return status;
+ }
+ }
+ }
+
+ return SS_NoChanged;
+}
+
+//=======================================================================
+// Function: SelectByRect
+// Purpose :
+//=======================================================================
+int GLViewer_Context::SelectByRect( const QRect& theRect, bool Append )
+{
+ GLfloat aXScale;
+ GLfloat aYScale;
+ GLViewer_ViewPort2d* vp = ( GLViewer_ViewPort2d* )myGLViewer2d->getActiveView()->getViewPort();
+ vp->getScale( aXScale, aYScale );
+
+ SelectionStatus status = SS_NoChanged;
+
+ ObjList aList;
+ ObjList::Iterator it, itEnd;
+
+ if ( !mySFlag || myActiveObjects.empty() )
+ return SS_Invalid;
+
+ bool updateAll = false;
+ if( !Append )
+ {
+ if( mySelectedObjects.count() != 0 )
+ status = SS_GlobalChanged;
+
+ for( it = mySelectedObjects.begin(), itEnd = mySelectedObjects.end(); it != itEnd; ++it )
+ {
+ updateAll = (*it)->unselect() || updateAll;
+ aList.append( *it );
+ }
+ mySelectedObjects.clear();
+ }
+
+ for( it = myActiveObjects.begin(), itEnd = myActiveObjects.end(); it != itEnd; ++it )
+ {
+ bool isSel = false;
+ (*it)->setScale( aXScale, aYScale );
+ QRect rect = myGLViewer2d->getQRect( *( (*it)->getRect() ) );
+
+ if( rect.intersects( theRect ) )
+ {
+ GLViewer_Rect aRect = myGLViewer2d->getGLVRect( theRect );
+ (*it)->select( myXhigh, myYhigh, myTolerance, aRect, false, false, Append );
+ isSel = (*it)->isSelected();
+ }
+
+ if( isSel && mySelectedObjects.findIndex( *it ) == -1 )
+ {
+ aList.append( *it );
+ mySelectedObjects.append( *it );
+ status = SS_GlobalChanged;
+ }
+ }
+
+ if( updateAll || myUpdateAll )
+ myGLViewer2d->updateAll();
+ else
+ myGLViewer2d->activateDrawers( aList, TRUE, TRUE );
+
+ return status;
+}
+
+//=======================================================================
+// Function: SetHighlightColor
+// Purpose :
+//=======================================================================
+void GLViewer_Context::SetHighlightColor( Quantity_NameOfColor aCol )
+{
+ myHighlightColor = aCol;
+
+ Quantity_Color colorH( aCol );
+ int redH = 255 * (int)colorH.Red();
+ int greenH = 255 * (int)colorH.Green();
+ int blueH = 255 * (int)colorH.Blue();
+ QColor colH = QColor( redH, greenH, blueH );
+
+ Quantity_Color colorS( mySelectionColor );
+ int redS = 255 * (int)colorS.Red();
+ int greenS = 255 * (int)colorS.Green();
+ int blueS = 255 * (int)colorS.Blue();
+ QColor colS = QColor( redS, greenS, blueS );
+
+ myGLViewer2d->updateColors( colH, colS);
+}
+
+//=======================================================================
+// Function: SetSelectionColor
+// Purpose :
+//=======================================================================
+void GLViewer_Context::SetSelectionColor( Quantity_NameOfColor aCol )
+{
+ mySelectionColor = aCol;
+
+ Quantity_Color colorH( myHighlightColor );
+ int redH = 255 * (int)colorH.Red();
+ int greenH = 255 * (int)colorH.Green();
+ int blueH = 255 * (int)colorH.Blue();
+ QColor colH = QColor( redH, greenH, blueH );
+
+ Quantity_Color colorS( aCol );
+ int redS = 255 * (int)colorS.Red();
+ int greenS = 255 * (int)colorS.Green();
+ int blueS = 255 * (int)colorS.Blue();
+ QColor colS = QColor( redS, greenS, blueS );
+
+ myGLViewer2d->updateColors( colH, colS);
+}
+
+//=======================================================================
+// Function: NbSelected
+// Purpose :
+//=======================================================================
+int GLViewer_Context::NbSelected()
+{
+ return mySelectedObjects.count();
+}
+
+//=======================================================================
+// Function: InitSelected
+// Purpose :
+//=======================================================================
+void GLViewer_Context::InitSelected()
+{
+ mySelCurIndex = 0;
+}
+
+//=======================================================================
+// Function: MoreSelected
+// Purpose :
+//=======================================================================
+bool GLViewer_Context::MoreSelected()
+{
+ return ( mySelCurIndex < NbSelected() );
+}
+
+//=======================================================================
+// Function: NextSelected
+// Purpose :
+//=======================================================================
+bool GLViewer_Context::NextSelected()
+{
+ if ( mySelCurIndex >= 0 && mySelCurIndex < NbSelected() )
+ {
+ mySelCurIndex++;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+//=======================================================================
+// Function: SelectedObject
+// Purpose :
+//=======================================================================
+GLViewer_Object* GLViewer_Context::SelectedObject()
+{
+ return mySelectedObjects[ mySelCurIndex ];
+}
+
+//=======================================================================
+// Function: isSelected
+// Purpose :
+//=======================================================================
+bool GLViewer_Context::isSelected( GLViewer_Object* theObj )
+{
+ return mySelectedObjects.contains( theObj );
+}
+
+//=======================================================================
+// Function: insertObject
+// Purpose :
+//=======================================================================
+int GLViewer_Context::insertObject( GLViewer_Object* object, bool display, bool isActive )
+{
+// cout << "GLViewer_Context::insertObject" << endl;
+
+ if( !object )
+ return -1;
+
+ if( isActive )
+ {
+ myActiveObjects.append( object );
+ if( display )
+ {
+ //QRect* rect = object->getRect()->toQRect();
+ //myGLViewer2d->updateBorders( *rect );
+ myGLViewer2d->activateDrawer( object, FALSE );
+ }
+ }
+ else
+ myInactiveObjects.append( object );
+
+ return myActiveObjects.count() + myInactiveObjects.count();
+}
+
+//=======================================================================
+// Function: replaceObject
+// Purpose :
+//=======================================================================
+bool GLViewer_Context::replaceObject( GLViewer_Object* oldObject, GLViewer_Object* newObject )
+{
+ if( !oldObject || !newObject )
+ return false;
+
+ if( myActiveObjects.contains( oldObject ) )
+ {
+ myActiveObjects.remove( oldObject );
+ myActiveObjects.append( newObject );
+ return true;
+ }
+
+ if( myInactiveObjects.contains( oldObject ) )
+ {
+ myInactiveObjects.remove( oldObject );
+ myInactiveObjects.append( newObject );
+ return true;
+ }
+
+ return false;
+}
+
+//=======================================================================
+// Function: updateScales
+// Purpose :
+//=======================================================================
+void GLViewer_Context::updateScales( GLfloat scX, GLfloat scY )
+{
+ if( scX <= 0 || scY <= 0 )
+ return;
+
+ ObjList::iterator it, itEnd;
+
+ for( it = myActiveObjects.begin(), itEnd = myActiveObjects.end(); it != itEnd; ++it )
+ (*it)->setScale( scX, scY );
+
+ for( it = myInactiveObjects.begin(), itEnd = myInactiveObjects.end(); it != itEnd; ++it )
+ (*it)->setScale( scX, scY );
+}
+
+//=======================================================================
+// Function: clearHighlighted
+// Purpose :
+//=======================================================================
+void GLViewer_Context::clearHighlighted( bool updateViewer )
+{
+ if( myHFlag && myLastPicked )
+ {
+ myLastPicked->unhighlight();
+ myLastPicked = 0;
+
+ if( updateViewer )
+ myGLViewer2d->updateAll();
+ }
+}
+
+//=======================================================================
+// Function: clearSelected
+// Purpose :
+//=======================================================================
+void GLViewer_Context::clearSelected( bool updateViewer )
+{
+ if( !mySFlag )
+ return;
+
+ ObjList::Iterator it, itEnd;
+ ObjList aList;
+
+ for( it = mySelectedObjects.begin(), itEnd = mySelectedObjects.end(); it != itEnd; ++it )
+ {
+ (*it)->unselect();
+ aList.append( *it );
+ }
+
+ if( updateViewer )
+ myGLViewer2d->activateDrawers( aList, TRUE );
+ mySelectedObjects.clear();
+}
+
+//=======================================================================
+// Function: setSelected
+// Purpose :
+//=======================================================================
+void GLViewer_Context::setSelected( GLViewer_Object* object, bool updateViewer )
+{
+ if( !object )
+ return;
+
+ if( myActiveObjects.contains( object ) && !mySelectedObjects.contains( object ) )
+ {
+ object->setSelected( TRUE );
+ mySelectedObjects.append( object );
+ }
+
+ if( updateViewer )
+ myGLViewer2d->activateDrawer( object, TRUE, TRUE );
+}
+
+//=======================================================================
+// Function: remSelected
+// Purpose :
+//=======================================================================
+void GLViewer_Context::remSelected( GLViewer_Object* object, bool updateViewer )
+{
+ if( !object || !mySelectedObjects.contains( object ) )
+ return;
+
+ mySelectedObjects.remove( object );
+ object->unselect();
+
+ if( updateViewer )
+ myGLViewer2d->activateDrawer( object, TRUE, TRUE );
+}
+
+//=======================================================================
+// Function: eraseObject
+// Purpose :
+//=======================================================================
+void GLViewer_Context::eraseObject( GLViewer_Object* theObject, bool theUpdateViewer )
+{
+ if( !theObject || !myActiveObjects.contains( theObject ) )
+ return;
+
+ theObject->unhighlight();
+ theObject->unselect();
+ theObject->setVisible( false );
+
+ if( theUpdateViewer )
+ myGLViewer2d->updateAll();
+}
+
+//=======================================================================
+// Function: deleteObject
+// Purpose :
+//=======================================================================
+void GLViewer_Context::deleteObject( GLViewer_Object* theObject, bool updateViewer )
+{
+ if( !theObject ||
+ ( !myActiveObjects.contains( theObject ) && !myInactiveObjects.contains( theObject ) ) )
+ return;
+
+ if( myActiveObjects.contains( theObject ) )
+ myActiveObjects.remove( theObject );
+ else if( myInactiveObjects.contains( theObject ) )
+ myInactiveObjects.remove( theObject );
+ else
+ return;
+
+ if( mySelectedObjects.contains( theObject ) )
+ mySelectedObjects.remove( theObject );
+
+ GLViewer_Group* aGroup = theObject->getGroup();
+ if( aGroup )
+ aGroup->removeObject( theObject );
+
+ if( myLastPicked == theObject )
+ myLastPicked = 0;
+
+ if ( updateViewer )
+ myGLViewer2d->updateAll();
+}
+
+//=======================================================================
+// Function: setActive
+// Purpose :
+//=======================================================================
+bool GLViewer_Context::setActive( GLViewer_Object* theObject )
+{
+ if( !theObject || !myInactiveObjects.contains( theObject ) )
+ return false;
+
+ myInactiveObjects.remove( theObject );
+ myActiveObjects.append( theObject );
+ return true;
+}
+
+//=======================================================================
+// Function: setInactive
+// Purpose :
+//=======================================================================
+bool GLViewer_Context::setInactive( GLViewer_Object* theObject )
+{
+ if( !theObject || !myActiveObjects.contains( theObject ) )
+ return false;
+
+ myActiveObjects.remove( theObject );
+ myInactiveObjects.append( theObject );
+ return true;
+}
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE
+//
+// 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
+//
+// Author : OPEN CASCADE
+//
+
+// File: GLViewer_Drawer.h
+// Created: November, 2004
+
+#ifndef GLVIEWER_DRAWER_H
+#define GLVIEWER_DRAWER_H
+
+#ifdef WNT
+#include "windows.h"
+#endif
+
+#include <qcolor.h>
+#include <qobject.h>
+#include <qfile.h>
+#include <qfont.h>
+#include <qgl.h>
+
+#include <GL/gl.h>
+
+#include "GLViewer.h"
+#include "GLViewer_Defs.h"
+
+class GLViewer_Object;
+class GLViewer_Rect;
+class GLViewer_CoordSystem;
+
+#ifdef WNT
+#pragma warning( disable:4251 )
+#endif
+/*!
+ * Struct GLViewer_TexIdStored
+ * Structure for store information about texture
+ */
+struct GLVIEWER_API GLViewer_TexIdStored
+{
+ //! Texture ID
+ GLuint myTexFontId;
+ //! Texture width
+ int myTexFontWidth;
+ //! texture height
+ int myTexFontHeight;
+};
+
+/*!
+ * Struct GLViewer_TexFindId
+ * Structure for srorage information about texture font
+ */
+struct GLVIEWER_API GLViewer_TexFindId
+{
+ //! Font description
+ QString myFontString;
+ //! View POrt ID
+ int myViewPortId;
+ //! Overloaded operator for using struct as MAP key
+ bool operator < (const GLViewer_TexFindId theStruct) const
+ {
+ if ( myViewPortId != theStruct.myViewPortId ) return myViewPortId < theStruct.myViewPortId;
+ else return myFontString < theStruct.myFontString;
+ }
+};
+
+/***************************************************************************
+** Class: GLViewer_TexFont
+** Descr: Font for GLViewer_Drawer
+** Module: GLViewer
+** Created: UI team, 03.10.01
+****************************************************************************/
+
+/*!
+ * Class GLViewer_TexFont
+ * Drawing bitmap and texture fonts in GLViewer
+ */
+class GLVIEWER_API GLViewer_TexFont
+{
+public:
+ //! A default constructor
+ GLViewer_TexFont();
+ //! A constructor
+ /*
+ * \param theFont - a base font
+ * \param theSeparator - separator between letters
+ * \param theIsResizeable - specifies whether text drawn by this object can be scaled along with the scene
+ * \param theMinMagFilter - min/mag filter, affects text sharpness
+ */
+ GLViewer_TexFont( QFont* theFont,
+ int theSeparator = 2,
+ bool theIsResizeable = false,
+ GLuint theMinMagFilter = GL_LINEAR/*_ATTENUATION*/ );
+ //! A destructor
+ ~GLViewer_TexFont();
+
+ //! Generating font texture
+ void generateTexture();
+ //! Drawing string theStr in point with coords theX and theY
+ void drawString( QString theStr, GLdouble theX = 0.0, GLdouble theY = 0.0 );
+
+ //! Returns separator between letters
+ int getSeparator(){ return mySeparator; }
+ //! Installing separator between letters
+ void setSeparator( int theSeparator ){ mySeparator = theSeparator; }
+
+ //! Returns width of string in pixels
+ int getStringWidth( QString theString );
+ //! Returns height of string in pixels
+ int getStringHeight();
+
+ //! Clears all generated fonts
+ static void clearTextBases();
+
+ //! Map for strorage generated texture fonts
+ static QMap<GLViewer_TexFindId,GLViewer_TexIdStored> TexFontBase;
+ //! Map for strorage generated bitmaps fonts
+ static QMap<GLViewer_TexFindId,GLuint> BitmapFontCache;
+
+protected:
+ //! Array of letter width
+ int* myWidths;
+ //! Array of letter positions in texture
+ int* myPositions;
+ //! Pointer to base font
+ QFont myQFont;
+ //! Font texture ID
+ GLuint myTexFont;
+ //! Font texture width
+ int myTexFontWidth;
+ //! Font texture height
+ int myTexFontHeight;
+ //! Separator between letters
+ int mySeparator;
+ //! Flag controlling scalability of this texmapped font
+ bool myIsResizeable;
+ //! Min/mag filter
+ GLuint myMinMagFilter;
+};
+
+/***************************************************************************
+** Class: GLViewer_Drawer
+** Descr: Drawer for GLObject
+** Module: GLViewer
+** Created: UI team, 03.10.01
+****************************************************************************/
+/*!
+ * Class GLViewer_Drawer
+ * Drawer for GLViewer_Objects.
+ * Drawer creates only one times per one type of object
+ */
+class GLVIEWER_API GLViewer_Drawer
+{
+public:
+ //! Text position relatively object
+ enum
+ {
+ GLText_Center = 0,
+ GLText_Left,
+ GLText_Right,
+ GLText_Top,
+ GLText_Bottom
+ };
+
+ // Objects status ( needs for change colors )
+ //enum ObjectStatus
+ //{
+ // OS_Normal = 0,
+ // OS_Highlighted,
+ // OS_Selected
+ //};
+
+ //
+ //enum ClosedStatus
+ //{
+ // CS_CLOSED = 0,
+ // CS_OPEN = 1
+ //};
+
+ //! A constructor
+ GLViewer_Drawer();
+ //! A destructor
+ virtual ~GLViewer_Drawer();
+
+ //! Main method which drawing object in GLViewer
+ /*
+ *\param xScale - current scale along X-direction
+ *\param yScale - current scale along Y-direction
+ *\param onlyUpdate - = true if only update highlight-select information
+ */
+ virtual void create( float xScale, float yScale, bool onlyUpdate ) = 0;
+
+ //! Adds object to drawer display list
+ virtual void addObject( GLViewer_Object* theObject ){ myObjects.append( theObject ); }
+ //! Clears drawer display list
+ virtual void clear(){ myObjects.clear(); }
+
+ //! Returns object type (needs for dynamic search of right drawer )
+ QString getObjectType() const { return myObjectType; }
+
+ //! Returns object priority
+ int getPriority() const { return myPriority; }
+
+ //! The function enables and disables antialiasing in Open GL (for points, lines and polygons).
+ void setAntialiasing(const bool on);
+
+ //! Clears all generated textures
+ static void destroyAllTextures();
+
+ //! A function translate object in to HPGL file on disk
+ /*!
+ *\param hFile the name of PostScript file chosen by user
+ *\param aViewerCS the GLViewer_CoordSystem of window
+ *\param aHPGLCS the GLViewer_CoordSystem of PostScript page
+ */
+ virtual bool translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aHPGLCS );
+
+ //! A function translate object in to PostScript file on disk
+ /*!
+ *\param hFile the name of PostScript file chosen by user
+ *\param aViewerCS the GLViewer_CoordSystem of window
+ *\param aPSCS the GLViewer_CoordSystem of PostScript page
+ */
+ virtual bool translateToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS );
+
+#ifdef WIN32
+ //! A function translate object in to EMF file on disk
+ /*!
+ *\warning WIN32 only
+ *
+ *\param dc the name of HDC associated with file chosen by user
+ *\param aViewerCS the GLViewer_CoordSystem of window
+ *\param aEMFCS the GLViewer_CoordSystem of EMF page
+ */
+ virtual bool translateToEMF( HDC hDC, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aEMFCS );
+#endif
+
+ //! Loads texture from file
+ /*!
+ *\param fileName - the name of texture file
+ *\param x_size - the horizontal size of picture ( less or equal texture horizontal size )
+ *\param y_size - the vertical size of picture ( less or equal texture vertical size )
+ *\param t_size - the size of texture ( texture vertical size equals texture horizontal size )
+ */
+ static GLuint loadTexture( const QString& fileName,
+ GLint* x_size = 0,
+ GLint* y_size = 0,
+ GLint* t_size = 0);
+
+ //! Draw square texture
+ /*!
+ *\param texture - the texture ID
+ *\param size - the size of square texture
+ *\param x - x coord
+ *\param y - y coord
+ */
+ void drawTexture( GLuint texture,
+ GLint size,
+ GLfloat x,
+ GLfloat y );
+
+ //! Draw texture
+ /*!
+ *\param texture - the texture ID
+ *\param x_size - the horizontal size of texture
+ *\param y_size - the vertical size of texture
+ *\param x - x coord
+ *\param y - y coord
+ */
+ void drawTexture( GLuint texture,
+ GLint x_size,
+ GLint y_size,
+ GLfloat x,
+ GLfloat y );
+
+ //! Draw texture part
+ /*!
+ *\param texture - the texture ID
+ *\param x_ratio - the horizontal ratio of texture part
+ *\param y_ratio - the vertical ratio of texture part
+ *\param x_size - the horizontal size of texture
+ *\param y_size - the vertical size of texture
+ *\param x - x coord
+ *\param y - y coord
+ *\param scale - common scale factor ( if = 0, use drawer scales )
+ */
+ void drawTexturePart( GLuint texture,
+ GLfloat x_ratio,
+ GLfloat y_ratio,
+ GLfloat x_size,
+ GLfloat y_size,
+ GLfloat x,
+ GLfloat y,
+ GLfloat scale = 0 );
+
+
+
+ //! Draw text string
+ /*!
+ *\param text - the text string
+ *\param xPos - x coord
+ *\param yPos - y coord
+ *\param color - text color
+ *\param aFont - base font of text
+ *\param theSeparator - letter separator
+ *\param DisplayTextFormat - text format
+ */
+ void drawText( const QString& text,
+ GLfloat xPos,
+ GLfloat yPos,
+ const QColor& color,
+ QFont* aFont,
+ int theSeparator,
+ DisplayTextFormat = DTF_BITMAP );
+
+ //! Draw text string
+ /*!
+ *\param text - the text string
+ *\param x - x coord
+ *\param y - y coord
+ *\param hPosition - horizontal alignment
+ *\param vPosition - vertical alignment
+ *\param color - text color
+ *\param smallFont - font format
+ */
+ void drawGLText( QString text,
+ float x,
+ float y,
+ int hPosition = GLText_Center,
+ int vPosition = GLText_Center,
+ QColor color = Qt::black,
+ bool smallFont = false );
+
+ //! Sets a default font to be used by drawGLText method
+ /*!
+ *\param font - the default font
+ */
+ inline void setFont( const QFont& font ) { myFont = font; }
+
+ //! Returns a default font used by drawGLText method
+ inline QFont font() const { return myFont; }
+
+ //! Sets a default text displaying format to be used by drawGLText method
+ /*!
+ *\param format - the default text displaying format
+ */
+ inline void setTextFormat( DisplayTextFormat format ) { myTextFormat = format; }
+
+ //! Returns a default text displaying format used by drawGLText method
+ inline DisplayTextFormat textFormat() const { return myTextFormat; }
+
+ //! Draw rectangle with predefined color
+ static void drawRectangle( GLViewer_Rect* theRect, QColor = Qt::black );
+
+protected:
+ //! Draw object text
+ virtual void drawText( GLViewer_Object* theObject );
+
+ //! X Scale factor
+ float myXScale;
+ //! Y scale factor
+ float myYScale;
+
+ //! List of objects
+ QValueList<GLViewer_Object*> myObjects;
+ //! List generated textures
+ GLuint myTextList;
+
+ //! Type of supporting object
+ QString myObjectType;
+ //! Dislay priority
+ int myPriority;
+
+ //! Default font for drawGLText() method
+ QFont myFont;
+ //! Default text displaying format for drawGLText() method
+ DisplayTextFormat myTextFormat;
+};
+
+#ifdef WNT
+#pragma warning ( default:4251 )
+#endif
+
+#endif // GLVIEWER_DRAWER_H
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE
+//
+// 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
+//
+// Author : OPEN CASCADE
+//
+
+// File: GLViewer_Geom.h
+// Created: November, 2004
+
+#ifndef GLVIEWER_GEOM_H
+#define GLVIEWER_GEOM_H
+
+#include "GLViewer.h"
+
+#include <qrect.h>
+#include <qvaluelist.h>
+#include <qgl.h>
+#include <math.h>
+
+
+#ifdef WNT
+#pragma warning( disable:4251 )
+#endif
+
+/*! Struct GLViewer_Pnt
+* Substitution of QPoint for OpenGL
+*/
+
+struct GLVIEWER_API GLViewer_Pnt
+{
+public:
+ GLViewer_Pnt() : myX( 0. ), myY( 0. ) {};
+ GLViewer_Pnt( GLfloat theX, GLfloat theY ) : myX( theX ), myY( theY ) {}
+
+ GLfloat x() const { return myX; }
+ GLfloat y() const { return myY; }
+ void setX( GLfloat theX ) { myX = theX; }
+ void setY( GLfloat theY ) { myY = theY; }
+ void setXY( GLfloat theX, GLfloat theY ) { myX = theX; myY = theY; }
+ void move( GLfloat theDX, GLfloat theDY ) { myX += theDX; myY += theDY; }
+
+private:
+ GLfloat myX;
+ GLfloat myY;
+};
+
+typedef QValueList<GLViewer_Pnt> GLViewer_PntList;
+
+/*! Class GLViewer_Rect
+* Substitution of QRect for OpenGL
+*/
+
+class GLVIEWER_API GLViewer_Rect
+{
+public:
+ GLViewer_Rect(): myLeft(0.0), myRight(0.0), myTop(0.0), myBottom(0.0){}
+ GLViewer_Rect( float theLeft, float theRight, float theTop, float theBottom )
+ : myLeft(theLeft), myRight(theRight), myTop(theTop), myBottom(theBottom) {}
+ GLViewer_Rect( QRect theRect ) {
+ myLeft = ( float )theRect.left(); myRight = ( float )theRect.right();
+ myTop = ( float )theRect.top(); myBottom = ( float )theRect.bottom(); }
+
+ float left() const { return myLeft; }
+ float right() const { return myRight; }
+ float top() const { return myTop; }
+ float bottom() const { return myBottom; }
+
+ float width() const { return fabs( myRight - myLeft ); }
+ float height() const { return fabs( myTop - myBottom ); }
+
+ void setLeft( float theLeft ) { myLeft = theLeft; }
+ void setRight( float theRight ) { myRight = theRight; }
+ void setTop( float theTop ) { myTop = theTop; }
+ void setBottom( float theBottom ) { myBottom = theBottom; }
+
+ void setCoords( float theLeft, float theRight, float theBottom, float theTop )
+ { myLeft = theLeft; myRight = theRight; myBottom = theBottom; myTop = theTop; }
+
+ //! \warning This method translate only rect format
+ QRect toQRect() { return QRect( ( int )myLeft, ( int )myBottom,
+ ( int )( myRight - myLeft ),
+ ( int )( myTop - myBottom ) ); }
+
+ //! On/off empty status
+ void setIsEmpty( bool on ) { myIsEmpty = on; }
+ //! Checks empty status
+ bool isEmpty() const { return myIsEmpty; }
+
+ //! Checks null status
+ bool isNull() const { return myLeft == 0.0 && myRight == 0.0 && myBottom == 0.0 && myTop == 0.0; }
+ //! Checks valid status
+ bool isValid() const { return ( myLeft < myRight && myBottom < myTop ); }
+
+ //! Checks staus of contains point
+ bool contains( GLViewer_Pnt pnt ) { return ( pnt.x() > left() &&
+ pnt.x() < right() &&
+ pnt.y() > bottom() &&
+ pnt.y() < top() ); }
+
+ void move( const float x, const float y )
+ {
+ myLeft += x;
+ myRight += x;
+ myTop += y;
+ myBottom += y;
+ }
+
+protected:
+ float myLeft;
+ float myRight;
+ float myTop;
+ float myBottom;
+
+ bool myIsEmpty;
+};
+
+/*! Class GLViewer_Segment
+* Segment for 2d detection
+*/
+
+class GLVIEWER_API GLViewer_Segment
+{
+public:
+ GLViewer_Segment( const GLViewer_Pnt& thePnt1,
+ const GLViewer_Pnt& thePnt2 );
+
+ //! Ordinary segment construction
+ /*!Construction of a ray with given equation Ax + By + C = 0 */
+
+ GLViewer_Segment( const GLViewer_Pnt& thePnt,
+ const GLfloat theA,
+ const GLfloat theB,
+ const GLfloat theC );
+ ~GLViewer_Segment();
+
+ bool HasIntersection( const GLViewer_Segment& theOther ) const;
+ // Detects intersection with another segment or ray
+
+private:
+ GLViewer_Pnt myPnt1;
+ GLViewer_Pnt myPnt2;
+ GLfloat myA;
+ GLfloat myB;
+ GLfloat myC;
+};
+
+/*! Class GLViewer_Poly
+* Polygon for 2d detection
+*/
+
+class GLVIEWER_API GLViewer_Poly
+{
+public:
+ GLViewer_Poly( const GLViewer_PntList* thePoints );
+ virtual ~GLViewer_Poly();
+
+ //! Adds point to polygon
+ void AddPoint( GLViewer_Pnt& pnt ) { myPoints->append( pnt ); }
+
+ //! Returns number of point
+ int Count() const { return myPoints->count(); }
+
+ //! Returns true if a point lies inside this polygon
+ virtual bool IsIn( const GLViewer_Pnt& thePnt ) const;
+
+ //! Returns true if a other polygon covers this polygon
+ virtual bool IsCovers( const GLViewer_Poly& thePoly ) const;
+
+ //! Likes the above function
+ virtual bool IsCovers( const GLViewer_Rect& theRect ) const;
+
+ // Returns true if intersection of this polygon with a segment or a ray not empty
+ virtual bool HasIntersection( const GLViewer_Segment& theSegment ) const;
+
+private:
+ GLViewer_PntList* myPoints;
+};
+
+#ifdef WNT
+#pragma warning ( default:4251 )
+#endif
+
+#endif
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE
+//
+// 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
+//
+// Author : OPEN CASCADE
+//
+
+// File: GLViewer_Viewer2d.cxx
+// Created: November, 2004
+
+/***************************************************************************
+** Class: GLViewer_Viewer2d
+** Descr: OpenGL Viewer 2D
+** Module: GLViewer
+** Created: UI team, 04.09.02
+****************************************************************************/
+
+//#include <GLViewerAfx.h>
+#include "GLViewer_Viewer2d.h"
+#include "GLViewer_Object.h"
+#include "GLViewer_BaseObjects.h"
+#include "GLViewer_CoordSystem.h"
+#include "GLViewer_Context.h"
+#include "GLViewer_Drawer.h"
+#include "GLViewer_Selector2d.h"
+//#include "GLViewer_Sketcher.h"
+#include "GLViewer_ViewPort2d.h"
+
+#include "SUIT_Desktop.h"
+#include "SUIT_ViewWindow.h"
+
+#include "OSD_Timer.hxx"
+#include <TColStd_MapOfInteger.hxx>
+
+#include <qpopupmenu.h>
+#include <qpointarray.h>
+#include <qcolordialog.h>
+
+GLViewer_Viewer2d::GLViewer_Viewer2d( const QString& title) :
+GLViewer_Viewer( title )
+{
+ myGLContext = new GLViewer_Context( this );
+
+ //myGLSketcher = new GLViewer_Sketcher( this );
+
+ createSelector();
+
+ mySelMode = GLViewer_Viewer::Multiple;
+
+ myDrawers.clear();
+}
+
+GLViewer_Viewer2d::~GLViewer_Viewer2d()
+{
+ //myGLSketcher = 0;
+ //delete myGLSketcher;
+ GLViewer_TexFont::clearTextBases();
+}
+
+SUIT_ViewWindow* GLViewer_Viewer2d::createView( SUIT_Desktop* theDesktop )
+{
+ return new GLViewer_ViewFrame( theDesktop, this );
+}
+
+void GLViewer_Viewer2d::addPopupItems( QPopupMenu* thePopup )
+{
+ // CTH8434. "Change background color" menu item is available if there are no selected objects
+ if ( getSelector() == 0 || getSelector()->numSelected() == 0 )
+ {
+ if( thePopup->count() > 0 )
+ thePopup->insertSeparator();
+ thePopup->insertItem( tr( "CHANGE_BGCOLOR" ), this, SLOT( onChangeBgColor() ) );
+ }
+}
+
+void GLViewer_Viewer2d::onChangeBgColor()
+{
+ if( !getActiveView() )
+ return;
+ GLViewer_ViewPort2d* vp = ( ( GLViewer_ViewPort2d* )getActiveView()->getViewPort() );
+
+ QColor selColor = QColorDialog::getColor( vp->backgroundColor(), vp );
+ if ( selColor.isValid() ) {
+ vp->setBackgroundColor( selColor );
+ }
+}
+
+void GLViewer_Viewer2d::updateColors( QColor colorH, QColor colorS )
+{
+// cout << "GLViewer_Viewer2d::updateColors" << endl;
+
+/*
+ for ( DrawerMap::Iterator it = myDrawers.begin(); it != myDrawers.end(); ++it )
+ {
+ it.key()->setHColor( colorH );
+ it.key()->setSColor( colorS );
+ }
+*/
+ /*
+ ObjList anObjects = myGLContext->getObjects();
+ ObjList::Iterator beginIt = anObjects.begin();
+ ObjList::Iterator endIt = anObjects.end();
+ for ( ObjList::Iterator it = beginIt; it != endIt; ++it )
+ {
+ //GLViewer_Drawer* aDrawer = (*it)->getDrawer();
+ //aDrawer->setHColor( colorH );
+ //aDrawer->setSColor( colorS );
+ }
+ */
+
+
+ activateAllDrawers( TRUE );
+}
+
+void GLViewer_Viewer2d::updateBorders( GLViewer_Rect* theRect )
+{
+ QPtrVector<SUIT_ViewWindow> views = getViewManager()->getViews();
+ for ( int i = 0, n = views.count(); i < n; i++ )
+ {
+ GLViewer_Rect* border = ( ( GLViewer_ViewPort2d* )((GLViewer_ViewFrame*)views[i])->getViewPort() )->getBorder();
+
+ border->setLeft( QMIN( border->left(), theRect->left() ) );
+ border->setRight( QMAX( border->right(), theRect->right() ) );
+ border->setBottom( QMIN( border->bottom(), theRect->bottom() ) );
+ border->setTop( QMAX( border->top(), theRect->top() ) );
+ }
+}
+
+void GLViewer_Viewer2d::updateBorders()
+{
+ QPtrVector<SUIT_ViewWindow> views = getViewManager()->getViews();
+
+ ObjList anObjects = myGLContext->getObjects();
+ ObjList::Iterator beginIt = anObjects.begin();
+ ObjList::Iterator endIt = anObjects.end();
+ for ( int i = 0, n = views.count(); i < n; i++ )
+ {
+ GLViewer_Rect* border = ( ( GLViewer_ViewPort2d* )((GLViewer_ViewFrame*)views[i])->getViewPort() )->getBorder();
+ if ( !border )
+ continue;
+ border->setIsEmpty( true );
+ // initialise border by default values to avoid old values
+ border->setCoords( 0, 0, 0, 0 );
+ for ( ObjList::Iterator it = beginIt; it != endIt; ++it )
+ {
+ GLViewer_Object* anObject = *it;
+ GLViewer_Rect* aRect = anObject->getRect();
+ if( !anObject->isSelectable() || !anObject->getVisible() )
+ continue;
+
+ if( border->isEmpty() )
+ {
+ border->setIsEmpty( false );
+ border->setCoords( aRect->left(), aRect->right(), aRect->bottom(), aRect->top() );
+ }
+ else
+ {
+ border->setLeft( QMIN( border->left(), aRect->left() ) );
+ border->setRight( QMAX( border->right(), aRect->right() ) );
+ border->setBottom( QMIN( border->bottom(), aRect->bottom() ) );
+ border->setTop( QMAX( border->top(), aRect->top() ) );
+ }
+ }
+ }
+}
+
+void GLViewer_Viewer2d::updateAll()
+{
+ if ( !getActiveView() )
+ return;
+
+ QPtrVector<SUIT_ViewWindow> views = getViewManager()->getViews();
+ for ( int i = 0, n = views.count(); i < n; i++ )
+ ( ( GLViewer_ViewPort2d* )( ( GLViewer_ViewFrame* )views[i] )->getViewPort() )->getGLWidget()->updateGL();
+}
+
+void GLViewer_Viewer2d::updateDrawers( GLboolean update, GLfloat scX, GLfloat scY )
+{
+// cout << "GLViewer_Viewer2d::updateDrawers" << endl;
+
+ //myGLContext->updateScales( scX, scY );
+ //myGLSketcher->drawContour();
+ activateAllDrawers( update );
+}
+
+void GLViewer_Viewer2d::activateDrawers( QValueList<GLViewer_Object*>& theObjects, bool onlyUpdate, GLboolean swap )
+{
+ //cout << "GLViewer_Viewer2d::activateDrawers " << (int)onlyUpdate << " " << (int)swap << endl;
+ QValueList<GLViewer_Drawer*>::Iterator anIt = myDrawers.begin();
+ QValueList<GLViewer_Drawer*>::Iterator endDIt = myDrawers.end();
+ for( ; anIt != endDIt; anIt++ )
+ (*anIt)->clear();
+
+ QValueList<GLViewer_Drawer*> anActiveDrawers;
+ QValueList<GLViewer_Object*>::Iterator endOIt = theObjects.end();
+
+ for( QValueList<GLViewer_Object*>::Iterator oit = theObjects.begin(); oit != endOIt; ++oit )
+ {
+ GLViewer_Drawer* aDrawer = (*oit)->getDrawer();
+ if( !aDrawer )
+ {
+ anIt = myDrawers.begin();
+ endDIt = myDrawers.end();
+
+ for( ; anIt != endDIt; anIt++ )
+ if( (*anIt)->getObjectType() == (*oit)->getObjectType() )
+ {
+ (*oit)->setDrawer( *anIt );
+ aDrawer = *anIt;
+ break;
+ }
+
+ if( !aDrawer )
+ {
+ myDrawers.append( (*oit)->createDrawer() );
+ aDrawer = (*oit)->getDrawer();
+ }
+ }
+ if ( !aDrawer )
+ continue;
+ aDrawer->addObject( (*oit) );
+
+ int aPriority = aDrawer->getPriority();
+
+ if( anActiveDrawers.findIndex( aDrawer ) != -1 )
+ continue;
+
+ QValueList<GLViewer_Drawer*>::Iterator aDIt = anActiveDrawers.begin();
+ QValueList<GLViewer_Drawer*>::Iterator aDEndIt = anActiveDrawers.end();
+ for( ; aDIt != aDEndIt; ++aDIt )
+ if( (*aDIt)->getPriority() > aPriority )
+ break;
+
+ anActiveDrawers.insert( aDIt, aDrawer );
+ }
+
+ QValueList<GLViewer_Drawer*>::Iterator aDIt = anActiveDrawers.begin();
+ QValueList<GLViewer_Drawer*>::Iterator aDEndIt = anActiveDrawers.end();
+
+ QPtrVector<SUIT_ViewWindow> views = getViewManager()->getViews();
+ for ( int i = 0, n = views.count(); i < n; i++ )
+ {
+ float xScale, yScale;
+ GLViewer_ViewPort2d* vp = ( GLViewer_ViewPort2d* )((GLViewer_ViewFrame*)views[i])->getViewPort();
+ vp->getScale( xScale, yScale );
+ vp->getGLWidget()->makeCurrent();
+
+ for( ; aDIt != aDEndIt; aDIt++ )
+ {
+ GLViewer_Drawer* aDrawer = *aDIt;
+ if( aDrawer )
+ aDrawer->create( xScale, yScale, onlyUpdate );
+ }
+/*
+ // draw border
+ GLViewer_Rect* border = ( ( GLViewer_ViewPort2d* )((GLViewer_ViewFrame*)views[i])->getViewPort() )->getBorder();
+ (*aDIt)->drawRectangle( border, Qt::blue );
+
+ QString coords = QString::number( border->left() ) + " " + QString::number( border->right() ) + " " +
+ QString::number( border->bottom() ) + " " + QString::number( border->top() );
+ (*aDIt)->drawText( "Border : " + coords, border->left(), border->top() + 10 / yScale,
+ Qt::blue, &QFont( "Courier", 8, QFont::Normal ), 2 );
+*/
+ if ( swap )
+ vp->getGLWidget()->swapBuffers();
+ }
+
+ ( ( GLViewer_ViewPort2d* )getActiveView()->getViewPort() )->getGLWidget()->makeCurrent();
+}
+
+void GLViewer_Viewer2d::activateDrawer( GLViewer_Object* theObject, bool onlyUpdate, GLboolean swap )
+{
+ ObjList aList;
+ aList.append( theObject );
+ activateDrawers( aList, onlyUpdate, swap );
+}
+
+void GLViewer_Viewer2d::activateAllDrawers( bool onlyUpdate, GLboolean swap )
+{
+ if ( !getActiveView() )
+ return;
+
+ ObjList anActiveObjs;
+ const ObjList& objs = myGLContext->getObjects();
+ for( ObjList::const_iterator it = objs.begin(); it != objs.end(); ++it )
+ {
+ GLViewer_Object* obj = (GLViewer_Object*)(*it);
+ if( obj->getVisible() )
+ anActiveObjs.append( obj );
+ }
+
+ activateDrawers( anActiveObjs, onlyUpdate, swap );
+}
+
+void GLViewer_Viewer2d::onCreateGLMarkers( int theMarkersNum, int theMarkersRad )
+{
+ if ( !getActiveView() )
+ return;
+
+ GLViewer_MarkerSet* aMarkerSet = new GLViewer_MarkerSet( theMarkersNum, theMarkersRad );
+ getGLContext()->insertObject( aMarkerSet );
+
+ GLViewer_ViewPort2d* vp = ( GLViewer_ViewPort2d* )getActiveView()->getViewPort();
+ int vpWidth = vp->getWidth();
+ int vpHeight = vp->getHeight();
+
+ float* aXCoord = new float[ theMarkersNum ];
+ float* anYCoord = new float[ theMarkersNum ];
+
+ srand( 1 );
+ for ( long i = 0; i < theMarkersNum; i++ )
+ {
+ aXCoord[i] = cos( PI * (rand() / (GLfloat)RAND_MAX) ) * ((GLfloat)vpWidth / 2.);
+ anYCoord[i] = cos( PI * (rand() / (GLfloat)RAND_MAX) ) * ((GLfloat)vpHeight / 2.);
+ }
+
+ aMarkerSet->setXCoord( aXCoord, theMarkersNum );
+ aMarkerSet->setYCoord( anYCoord, theMarkersNum );
+ aMarkerSet->compute();
+
+ updateBorders( aMarkerSet->getRect() );
+
+ activateAllDrawers( false );
+ activateTransform( GLViewer_Viewer::FitAll );
+
+ delete[] aXCoord;
+ delete[] anYCoord;
+}
+
+void GLViewer_Viewer2d::onCreateGLPolyline( int theAnglesNum, int theRadius, int thePolylineNumber )
+{
+ if ( !getActiveView() )
+ return;
+
+ GLViewer_ViewPort2d* vp = ( GLViewer_ViewPort2d* )getActiveView()->getViewPort();
+ int vpWidth = vp->getWidth();
+ int vpHeight = vp->getHeight();
+
+ float* aXCoord = new float[ theAnglesNum ];
+ float* anYCoord = new float[ theAnglesNum ];
+
+ //srand( ( unsigned )time( NULL ) );
+ srand( 1 );
+ for( int j = 0; j < thePolylineNumber; j++)
+ {
+ GLViewer_Polyline* aPolyline = new GLViewer_Polyline( theAnglesNum, theRadius );
+ getGLContext()->insertObject( aPolyline );
+
+ float aXOffset = cos( PI * (rand() / (GLfloat)RAND_MAX) ) * ((GLfloat)vpWidth / 2.);
+ float anYOffset = cos( PI * (rand() / (GLfloat)RAND_MAX) ) * ((GLfloat)vpHeight / 2.);
+ for( int i = 0; i < theAnglesNum; i++ )
+ {
+ aXCoord[i] = cos( 2. * PI * i / theAnglesNum ) * theRadius + aXOffset;
+ anYCoord[i] = sin( 2. * PI * i / theAnglesNum ) * theRadius + anYOffset;
+ }
+
+ aPolyline->setHighSelAll( true );
+ aPolyline->setClosed( true );
+ aPolyline->setXCoord( aXCoord, theAnglesNum );
+ aPolyline->setYCoord( anYCoord, theAnglesNum );
+ aPolyline->compute();
+
+ updateBorders( aPolyline->getRect() );
+ }
+
+ activateAllDrawers( false );
+ activateTransform( GLViewer_Viewer::FitAll );
+
+ delete[] aXCoord;
+ delete[] anYCoord;
+}
+
+void GLViewer_Viewer2d::onCreateGLText( QString theStr, int theTextNumber )
+{
+ if ( !getActiveView() )
+ return;
+
+ if( theTextNumber <= 0 )
+ return;
+
+ GLViewer_ViewPort2d* vp = ( GLViewer_ViewPort2d* )getActiveView()->getViewPort();
+ int vpWidth = vp->getWidth();
+ int vpHeight = vp->getHeight();
+
+ //srand( ( unsigned )time( NULL ) );
+ srand( 1 );
+ for( int j = 0; j < theTextNumber; j++)
+ {
+ float aXPos = cos( PI * (rand() / (GLfloat)RAND_MAX) ) * ((GLfloat)vpWidth / 2.);
+ float anYPos = cos( PI * (rand() / (GLfloat)RAND_MAX) ) * ((GLfloat)vpHeight / 2.);
+ QColor aColor( 255, 0, 255 );
+
+ GLViewer_TextObject* aText = new GLViewer_TextObject( theStr, aXPos, anYPos, aColor );
+ aText->compute();
+ getGLContext()->insertObject( aText );
+
+ updateBorders( aText->getRect() );
+ }
+
+ activateAllDrawers( false );
+}
+
+void GLViewer_Viewer2d::transPoint( GLfloat& x, GLfloat& y )
+{
+ if ( !getActiveView() )
+ return;
+
+ GLfloat xScale, yScale;
+ GLfloat xPan, yPan;
+
+ GLViewer_ViewPort2d* curvp = ( GLViewer_ViewPort2d* )getActiveView()->getViewPort();
+
+ curvp->getScale( xScale, yScale );
+ curvp->getPan( xPan, yPan );
+
+ GLfloat a = curvp->getGLWidget()->getRotationAngle() * PI / 180.;
+
+ x = ( x - ( GLfloat )curvp->getWidth() / 2 ) / xScale;
+ y = ( -y + ( GLfloat )curvp->getHeight() / 2 ) / yScale;
+
+ GLfloat x1 = x;
+ GLfloat y1 = y;
+
+ x = x1 * cos(a) + y1 * sin(a);
+ y = -x1 * sin(a) + y1 * cos(a);
+
+ x -= xPan;
+ y -= yPan;
+}
+
+QRect* GLViewer_Viewer2d::getWinObjectRect( GLViewer_Object* theObject )
+{
+ if ( !getActiveView() )
+ return 0;
+
+ GLfloat xScale, yScale;
+ GLfloat xPan, yPan;
+
+ GLViewer_ViewPort2d* curvp = ( GLViewer_ViewPort2d* )getActiveView()->getViewPort();
+ GLfloat aWidth = curvp->getWidth();
+ GLfloat aHeight = curvp->getHeight();
+
+
+ curvp->getScale( xScale, yScale );
+ curvp->getPan( xPan, yPan );
+
+ QRect aObjRect = theObject->getRect()->toQRect();
+ float aLeft = aObjRect.left() + xPan, aRight = aObjRect.right() + xPan;
+ float aTop = aObjRect.top() + yPan, aBot = aObjRect.bottom() + yPan;
+
+ GLfloat anAngle = curvp->getGLWidget()->getRotationAngle() * PI / 180.;
+
+ QPointArray aPointArray(4);
+ aPointArray[0] = QPoint( (int)(aLeft*cos(anAngle) - aTop*sin(anAngle)),
+ (int)(aLeft*sin(anAngle) + aTop*cos(anAngle)) );
+ aPointArray[1] = QPoint( (int)(aRight*cos(anAngle) - aTop*sin(anAngle)),
+ (int)(aRight*sin(anAngle) + aTop*cos(anAngle)) );
+ aPointArray[2] = QPoint( (int)(aRight*cos(anAngle) - aBot*sin(anAngle)),
+ (int)(aRight*sin(anAngle) + aBot*cos(anAngle)) );
+ aPointArray[3] = QPoint( (int)(aLeft*cos(anAngle) - aBot*sin(anAngle)),
+ (int)(aLeft*sin(anAngle) + aBot*cos(anAngle)) );
+
+ int aMinLeft = aPointArray[0].x(), aMaxRight = aPointArray[0].x(),
+ aMinTop = aPointArray[0].y(), aMaxBottom = aPointArray[0].y();
+ for( int i = 1; i < 4; i++ )
+ {
+ int x = aPointArray[i].x();
+ int y = aPointArray[i].y();
+ aMinLeft = QMIN( aMinLeft,x );
+ aMaxRight = QMAX( aMaxRight, x );
+ aMinTop = QMIN( aMinTop, y );
+ aMaxBottom = QMAX( aMaxBottom, y );
+ }
+
+ aLeft = (aMinLeft/* + xPan*/)*xScale + aWidth / 2;
+ aRight = (aMaxRight/* + xPan*/)*xScale + aWidth / 2;
+
+ aTop = -( (aMaxBottom/* + yPan*/)*yScale - aHeight / 2 );
+ aBot = -( (aMinTop/* + yPan*/)*yScale - aHeight / 2 );
+
+ QRect* newRect = new QRect( (int)aLeft, (int)aTop, (int)(aRight-aLeft), (int)(aBot-aTop) );
+
+ return newRect;
+}
+
+GLViewer_Rect GLViewer_Viewer2d::getGLVRect( const QRect& theRect ) const
+{
+ if ( !getActiveView() )
+ return GLViewer_Rect();
+
+ GLViewer_ViewPort2d* vp = ( GLViewer_ViewPort2d* )getActiveView()->getViewPort();
+
+ if( !vp )
+ return GLViewer_Rect();
+
+ return vp->win2GLV( theRect );
+}
+
+QRect GLViewer_Viewer2d::getQRect( const GLViewer_Rect& theRect ) const
+{
+ if ( !getActiveView() )
+ return QRect();
+
+ GLViewer_ViewPort2d* vp = ( GLViewer_ViewPort2d* )getActiveView()->getViewPort();
+
+ if( !vp )
+ return QRect();
+
+ return vp->GLV2win( theRect );
+}
+
+GLViewer_Selector* GLViewer_Viewer2d::createSelector()
+{
+ return new GLViewer_Selector2d( this, getGLContext() );
+}
+
+GLViewer_ViewTransformer* GLViewer_Viewer2d::createTransformer( int type )
+{
+ return new GLViewer_View2dTransformer( this, type );
+}
+/*
+GLViewer_Sketcher* GLViewer_Viewer2d::createGLSketcher( int type )
+{
+ return new GLViewer_Sketcher( this, type );
+}
+
+void GLViewer_Viewer2d::activateGLSketching( int type )
+{
+ GLViewer_ViewPort2d* vp = 0;
+ if ( !getActiveView() || !( vp = ( GLViewer_ViewPort2d* )getActiveView()->getViewPort() ) )
+ return;
+
+ // Finish current sketching
+ if ( type == None )
+ {
+ if ( myGLSketcher->getType() != None )
+ {
+ myGLSketcher->setType( None );
+ finishSketching();
+ }
+ }
+ // Activate new sketching
+ else
+ {
+ activateGLSketching( None ); // concurrency not supported
+ myGLSketcher->setType( type );
+ startSketching();
+ }
+}
+
+void GLViewer_Viewer2d::startSketching()
+{
+ GLViewer_ViewPort2d* avp = (GLViewer_ViewPort2d*)getActiveView()->getViewPort();
+ avp->setCursor( *avp->getSketchCursor() );
+ //avp->enablePopup( false );
+ myGLSketcher->startSketching();
+}
+
+void GLViewer_Viewer2d::finishSketching()
+{
+ GLViewer_ViewPort2d* avp = (GLViewer_ViewPort2d*)getActiveView()->getViewPort();
+ avp->setCursor( *avp->getDefaultCursor() );
+ //avp->enablePopup( true );
+ myGLSketcher->finishSketching();
+}
+
+bool GLViewer_Viewer2d::isSketchingActive()
+{
+ return myGLSketcher->getType() != None;
+}
+
+int GLViewer_Viewer2d::getSketchingType()
+{
+ return myGLSketcher->getType();
+}
+
+void GLViewer_Viewer2d::onSketchDelObject()
+{
+ GLViewer_ViewPort2d* avp = (GLViewer_ViewPort2d*)getActiveView()->getViewPort();
+ avp->setCursor( *avp->getDefaultCursor() );
+ myGLSketcher->finishSketching( true );
+}
+
+void GLViewer_Viewer2d::onSketchUndoLast()
+{
+
+}
+
+void GLViewer_Viewer2d::onSketchFinish()
+{
+ finishSketching();
+}
+*/
+void GLViewer_Viewer2d::onMouseEvent( SUIT_ViewWindow*, QMouseEvent* e )
+{
+ if ( !getActiveView() )
+ return;
+
+ //if ( testRotation( e ) )
+ // return;
+
+ switch( e->type() )
+ {
+ case QEvent::MouseButtonPress :
+ case QEvent::MouseMove :
+ case QEvent::MouseButtonRelease :
+ //if( myGLSketcher->getType() != None )
+ // myGLSketcher->sketch( e );
+ default: break;
+ }
+
+ GLViewer_Viewer::onMouseEvent( 0, e );
+}
+
+bool GLViewer_Viewer2d::testRotation( QMouseEvent* e )
+{
+ if ( ( e->button() == GLViewer_View2dTransformer::rotateButton() ) &&
+ ( e->type() == QEvent::MouseButtonPress ) &&
+ ( e->state() & GLViewer_ViewTransformer::accelKey() ) )
+ {
+ activateTransform( GLViewer_Viewer::Rotate );
+ return true;
+ }
+ return false;
+}
+
+
+void GLViewer_Viewer2d::insertHeader( VectorFileType aType, QFile& hFile )
+{
+ if( aType == POST_SCRIPT )
+ {
+ QString header = "%!PS-Adobe-3.0\n";
+ header += "%%Creator: OpenCascade 2004\n";
+ header += "%%Title: Our document\n";
+ header += "%%PageOrder: Ascend\n";
+ header += "%%Orientation: Portrait\n";
+ header += "%%LanguageLevel: 2\n";
+
+ header += "%%Pages: 1\n";
+ header += "%%Page: 1\n\n";
+
+ hFile.writeBlock( header.ascii(), header.length() );
+ }
+ else if( aType == HPGL )
+ {
+ QString header = "[Esc].(;\n";
+ header += "[Esc].I81;;17:\n";
+ header += "[Esc].N;19:\n";
+ header += "IN;\n";
+ header += "SC;\n";
+ header += "PU;\n";
+ header += "SP1;\n";
+ header += "LT;\n";
+ header += "VS36;\n";
+
+ hFile.writeBlock( header.ascii(), header.length() );
+ }
+}
+
+void GLViewer_Viewer2d::insertEnding( VectorFileType aType, QFile& hFile )
+{
+ if( aType == POST_SCRIPT )
+ {
+ QString ending = "showpage\n\n%%EOF";
+ hFile.writeBlock( ending.ascii(), ending.length() );
+ }
+ else if( aType == HPGL )
+ {
+ QString ending = "PU;PA0,0;SP;EC;PG1;EC1;OE\n";
+ hFile.writeBlock( ending.ascii(), ending.length() );
+ }
+}
+
+inline void mm2custom( GLViewer_Viewer2d::VectorFileType aType, double& value )
+{
+ if( aType==GLViewer_Viewer2d::POST_SCRIPT )
+ value*=2.8346; //mm to pt
+
+ else if( aType==GLViewer_Viewer2d::HPGL )
+ value*=40; //mm to plu (there are 40 plues in mm)
+#ifdef WIN32
+ else if( aType==GLViewer_Viewer2d::ENH_METAFILE )
+ value*=100; //this unit is 1/100 mm
+#endif
+}
+
+bool GLViewer_Viewer2d::translateTo( VectorFileType aType, QString FileName, PaperType aPType,
+ double mmLeft, double mmRight, double mmTop, double mmBottom )
+{
+ if ( !getActiveView() )
+ return false;
+
+ QFile hFile( FileName.ascii() );
+
+#ifdef WIN32
+ HDC hMetaFileDC;
+#endif
+
+ GLViewer_ViewPort2d* aCurVP = (GLViewer_ViewPort2d*) getActiveView()->getViewPort();
+
+ GLfloat xPan, yPan;
+ aCurVP->getPan( xPan, yPan );
+ GLfloat aRotation = aCurVP->getGLWidget()->getRotationAngle() * 3.14159265 / 180.0;
+
+ GLViewer_CoordSystem aViewerCS( GLViewer_CoordSystem::Cartesian, xPan, yPan, 1.0, 1.0, aRotation );
+
+ double AW = Sizes[2*int(aPType)],
+ AH = Sizes[2*int(aPType)+1]; //size of Axx paper in mm
+
+ mm2custom( aType, mmLeft ); //we translate mm to custom units
+ mm2custom( aType, mmRight );
+ mm2custom( aType, mmTop );
+ mm2custom( aType, mmBottom );
+ mm2custom( aType, AW );
+ mm2custom( aType, AH );
+
+ float xScale, yScale;
+ aCurVP->getScale( xScale, yScale );
+
+ double VPWidth = aCurVP->getWidth()/xScale, //the width in reference units
+ VPHeight = aCurVP->getHeight()/yScale;
+
+ double k1 = ( AW-mmLeft-mmRight ) / VPWidth,
+ k2 = ( AH-mmTop-mmBottom ) / VPHeight;
+
+ if( k1>k2 )
+ k1 = k2; //We select the minimum
+
+ double hdelta = ( AW-mmLeft-mmRight - VPWidth * k1 )/2.0, //addition in horizontal
+ vdelta = ( AH-mmTop-mmBottom - VPHeight * k1 )/2.0; //addition in vertical
+
+ mmLeft += hdelta; //The real free space on the left and right borders
+ mmRight += hdelta;
+ mmTop += vdelta;
+ mmBottom += vdelta;
+
+ GLViewer_CoordSystem aPaperCS( GLViewer_CoordSystem::Cartesian,
+ -(mmLeft/k1+VPWidth/2.0), -(mmBottom/k1+VPHeight/2.0), 1/k1, 1/k1 );
+
+ if( aType==POST_SCRIPT || aType==HPGL )
+ {
+ hFile.open( IO_ReadWrite | IO_Truncate );
+ hFile.at( 0 );
+ insertHeader( aType, hFile );
+ }
+#ifdef WIN32
+ else if( aType==ENH_METAFILE )
+ {
+ RECT r;
+ r.left = 0; r.right = AW;
+ r.top = 0; r.bottom = AH;
+ HDC screen_dc = GetDC( 0 ); //The screen device context
+ HDC bitDC = CreateCompatibleDC ( screen_dc ); //The context compatible with screen
+
+ hMetaFileDC = CreateEnhMetaFile( bitDC, FileName.ascii(), &r, "" );
+ SetMapMode( hMetaFileDC, MM_HIMETRIC );
+ SetWindowOrgEx( hMetaFileDC, 0, r.bottom, NULL );
+ HRGN ClipRgn = CreateRectRgn( 0, 0, AW, AH );
+ SelectClipRgn( hMetaFileDC, ClipRgn );
+
+ LOGBRUSH aBrushData;
+ aBrushData.lbColor = RGB( 255, 255, 255 );
+ aBrushData.lbStyle = BS_SOLID;
+
+ FillRect( hMetaFileDC, &r, CreateBrushIndirect( &aBrushData ) );
+
+ ReleaseDC( 0, screen_dc );
+ DeleteDC( bitDC );
+
+ aCurVP->getGLWidget()->translateBackgroundToEMF( hMetaFileDC, &aViewerCS, &aPaperCS );
+ }
+#endif
+
+ if( aType==POST_SCRIPT )
+ {
+ QString temp = "%1 %2 %3 %4 rectclip\n\n",
+ aBuffer = temp.arg( mmLeft ).arg( mmBottom ).
+ arg( AW-mmLeft-mmRight ).arg( AH-mmBottom-mmTop );
+ //It is set clipping path
+
+ hFile.writeBlock( aBuffer.ascii(), aBuffer.length() );
+
+ aCurVP->getGLWidget()->translateBackgroundToPS( hFile, &aViewerCS, &aPaperCS );
+ }
+
+ bool result = true;
+ for( int i=0, n=myDrawers.count(); i<n; i++ )
+ if( aType==POST_SCRIPT )
+ result &= myDrawers[ i ]->translateToPS( hFile, &aViewerCS, &aPaperCS );
+ else if( aType==HPGL )
+ result &= myDrawers[ i ]->translateToHPGL( hFile, &aViewerCS, &aPaperCS );
+#ifdef WIN32
+ else if( aType==ENH_METAFILE )
+ result &= myDrawers[ i ]->translateToEMF( hMetaFileDC, &aViewerCS, &aPaperCS );
+#endif
+
+ if( aType==POST_SCRIPT || aType==HPGL )
+ {
+ insertEnding( aType, hFile);
+ hFile.close();
+ }
+#ifdef WIN32
+ else if( aType==ENH_METAFILE )
+ DeleteEnhMetaFile( CloseEnhMetaFile( hMetaFileDC ) );
+#endif
+
+ return true;
+}
+
+
+void GLViewer_Viewer2d::repaintView( GLViewer_ViewFrame* theView, bool makeCurrent )
+{
+ GLViewer_ViewFrame* aCurView;
+ if( !theView )
+ aCurView = (GLViewer_ViewFrame*)getActiveView();
+ else
+ aCurView = theView;
+
+ if ( !aCurView )
+ return;
+
+ ObjList anActiveObjs;
+ const ObjList& objs = myGLContext->getObjects();
+ for( ObjList::const_iterator it = objs.begin(); it != objs.end(); ++it )
+ {
+ GLViewer_Object* obj = (GLViewer_Object*)(*it);
+ if( obj->getVisible() )
+ anActiveObjs.append( obj );
+ }
+
+ float xScale;
+ float yScale;
+
+ QValueList<GLViewer_Drawer*>::Iterator anIt = myDrawers.begin();
+ QValueList<GLViewer_Drawer*>::Iterator endDIt = myDrawers.end();
+ for( ; anIt != endDIt; anIt++ )
+ (*anIt)->clear();
+
+ QValueList<GLViewer_Drawer*> anActiveDrawers;
+ QValueList<GLViewer_Object*>::Iterator endOIt = anActiveObjs.end();
+
+ for( QValueList<GLViewer_Object*>::Iterator oit = anActiveObjs.begin(); oit != endOIt; ++oit )
+ {
+ GLViewer_Drawer* aDrawer = (*oit)->getDrawer();
+ if( !aDrawer )
+ {
+ anIt = myDrawers.begin();
+
+ for( ; anIt != endDIt; anIt++ )
+ if( (*anIt)->getObjectType() == (*oit)->getObjectType() )
+ {
+ (*oit)->setDrawer( *anIt );
+ aDrawer = *anIt;
+ break;
+ }
+
+ if( !aDrawer ) //are not exists
+ {
+ myDrawers.append( (*oit)->createDrawer() );
+ aDrawer = (*oit)->getDrawer();
+ }
+ }
+ aDrawer->addObject( (*oit) );
+ if( anActiveDrawers.findIndex( aDrawer ) == -1 )
+ anActiveDrawers.append( aDrawer );
+ }
+
+ QValueList<GLViewer_Drawer*>::Iterator aDIt = anActiveDrawers.begin();
+ QValueList<GLViewer_Drawer*>::Iterator aDEndIt = anActiveDrawers.end();
+
+ GLViewer_ViewPort2d* vp = ( GLViewer_ViewPort2d* )aCurView->getViewPort();
+ vp->getScale( xScale, yScale );
+
+ if( makeCurrent )
+ vp->getGLWidget()->makeCurrent();
+
+ for( ; aDIt != aDEndIt; aDIt++ )
+ (*aDIt)->create( xScale, yScale, false );
+
+// if ( swap )
+ vp->getGLWidget()->swapBuffers();
+
+// ( ( GLViewer_ViewPort2d* )getActiveView()->getViewPort() )->getGLWidget()->makeCurrent();
+}
+
+void GLViewer_Viewer2d::startOperations( QMouseEvent* e )
+{
+ GLViewer_ViewPort2d* vp = ( GLViewer_ViewPort2d* )((GLViewer_ViewFrame*)getActiveView())->getViewPort();
+
+ float x = e->pos().x();
+ float y = e->pos().y();
+ transPoint( x, y );
+ GLViewer_Pnt point( x, y );
+
+ if( e->button() == Qt::LeftButton && !myGLContext->getCurrentObject() && vp->startPulling( point ) )
+ return;
+
+ if( e->button() == Qt::LeftButton && !(vp->currentBlock() & BS_Selection) && !myGLContext->getCurrentObject() )
+ vp->startSelectByRect( e->x(), e->y() );
+}
+
+bool GLViewer_Viewer2d::updateOperations( QMouseEvent* e )
+{
+ GLViewer_ViewPort2d* vp = ( GLViewer_ViewPort2d* )((GLViewer_ViewFrame*)getActiveView())->getViewPort();
+
+ if( vp->isPulling() )
+ {
+ float x = e->pos().x();
+ float y = e->pos().y();
+ transPoint( x, y );
+
+ vp->drawPulling( GLViewer_Pnt( x, y ) );
+ updateAll();
+ return true;
+ }
+
+ if( !myGLContext->getCurrentObject() )
+ {
+ vp->drawSelectByRect( e->x(), e->y() );
+ return true;
+ }
+ return false;
+}
+
+void GLViewer_Viewer2d::finishOperations( QMouseEvent* e )
+{
+ GLViewer_ViewPort2d* vp = ( GLViewer_ViewPort2d* )((GLViewer_ViewFrame*)getActiveView())->getViewPort();
+
+ if( vp->isPulling() )
+ {
+ vp->finishPulling();
+ updateAll();
+ return;
+ }
+
+ if( !myGLContext->getCurrentObject() )
+ {
+ QRect aSelRect = vp->selectionRect();
+ vp->finishSelectByRect();
+ if ( getSelector() && !aSelRect.isNull() )
+ {
+ bool append = bool ( e->state() & GLViewer_Selector::appendKey() );
+ getSelector()->select( aSelRect, append );
+ }
+ }
+}
+
+void GLViewer_Viewer2d::startOperations( QWheelEvent* e )
+{
+ bool zoomIn = e->delta() > 0;
+ bool update = false;
+ for( myGLContext->InitSelected(); myGLContext->MoreSelected(); myGLContext->NextSelected() )
+ {
+ GLViewer_Object* anObject = myGLContext->SelectedObject();
+ update = anObject->updateZoom( zoomIn ) || update;
+ }
+
+ if( update )
+ updateAll();
+}
+
+
+/****************************************************************
+** Class: GLViewer_View2dTransformer
+**
+*****************************************************************/
+
+int GLViewer_View2dTransformer::rotateBtn = RightButton;
+
+GLViewer_View2dTransformer::GLViewer_View2dTransformer( GLViewer_Viewer* viewer, int typ )
+: GLViewer_ViewTransformer( viewer, typ )
+{
+ if ( type() == GLViewer_Viewer::Rotate )
+ initTransform( true );
+}
+
+GLViewer_View2dTransformer::~GLViewer_View2dTransformer()
+{
+ if ( type() == GLViewer_Viewer::Rotate )
+ initTransform( false );
+}
+
+/*!
+ Redefined to provide specific 3D transfomations. [ virtual public ]
+*/
+void GLViewer_View2dTransformer::exec()
+{
+ if ( !myViewer->getActiveView() )
+ return;
+
+ /* additional transforms */
+ GLViewer_ViewPort* vp = myViewer->getActiveView()->getViewPort();
+ GLViewer_ViewPort2d* avp = (GLViewer_ViewPort2d*)vp;
+ switch ( myType )
+ {
+ case GLViewer_Viewer::Rotate:
+ myMajorBtn = rotateButton();
+ avp->setCursor( *avp->getRotCursor() );
+ break;
+ default:
+ GLViewer_ViewTransformer::exec();
+ }
+}
+
+/*!
+ Handles rotation. [ protected virtual ]
+*/
+void GLViewer_View2dTransformer::onTransform( TransformState state )
+{
+ if ( !myViewer->getActiveView() )
+ return;
+
+ GLViewer_ViewPort* vp = myViewer->getActiveView()->getViewPort();
+ GLViewer_ViewPort2d* avp = (GLViewer_ViewPort2d*)vp;
+ if ( type() == GLViewer_Viewer::Rotate )
+ {
+ switch ( state )
+ {
+ case Debut:
+ if ( myButtonState & myMajorBtn )
+ avp->startRotation( myStart.x(), myStart.y() );
+ break;
+ case EnTrain:
+ if ( myButtonState & myMajorBtn )
+ avp->rotate( myCurr.x(), myCurr.y() );
+ break;
+ case Fin:
+ avp->endRotation();
+ break;
+ default: break;
+ }
+ }
+ GLViewer_ViewTransformer::onTransform( state );
+}
--- /dev/null
+// File: LightApp.h
+// Created: June, 2005
+// Author: OCC team
+// Copyright (C) CEA 2005
+
+
+// The following ifdef block is the standard way of creating macros which make exporting
+// from a DLL simpler. All files within this DLL are compiled with the LightApp_EXPORTS
+// symbol defined on the command line. this symbol should not be defined on any project
+// that uses this DLL. This way any other project whose source files include this file see
+// LightApp_API functions as being imported from a DLL, wheras this DLL sees symbols
+// defined with this macro as being exported.
+#ifdef WNT
+
+#ifdef LIGHTAPP_EXPORTS
+#define LIGHTAPP_EXPORT __declspec(dllexport)
+#else
+#define LIGHTAPP_EXPORT __declspec(dllimport)
+#endif
+
+#pragma warning ( disable:4251 )
+#pragma warning ( disable:4786 )
+#pragma warning ( disable:4503 )
+
+#else
+#define LIGHTAPP_EXPORT
+#endif //WNT
+
+#define APP_VERSION "0.1"
--- /dev/null
+// File: LightApp_Application.h
+// Created: 6/20/2005 18:39:25 PM
+// Author: OCC team
+// Copyright (C) CEA 2005
+
+#ifndef LIGHTAPP_APPLICATION_H
+#define LIGHTAPP_APPLICATION_H
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "LightApp.h"
+#include <CAM_Application.h>
+
+class LogWindow;
+class OB_Browser;
+class PythonConsole;
+class STD_Application;
+class LightApp_WidgetContainer;
+class LightApp_Preferences;
+class LightApp_SelectionMgr;
+class SUIT_Study;
+class SUIT_Accel;
+class CAM_Module;
+
+class QString;
+class QWidget;
+class QStringList;
+class QPixmap;
+
+#ifdef WIN32
+#pragma warning( disable:4251 )
+#endif
+
+/*!
+ Description : Application containing only LightApp module
+*/
+
+class LIGHTAPP_EXPORT LightApp_Application : public CAM_Application
+{
+ Q_OBJECT
+
+public:
+ typedef enum { WT_ObjectBrowser, WT_PyConsole, WT_LogWindow, WT_User } WindowTypes;
+
+ enum { NewGLViewId = CAM_Application::UserID, NewPlot2dId, NewOCCViewId, NewVTKViewId,
+ PreferencesId, MRUId, RenameId, UserID };
+public:
+ LightApp_Application();
+ virtual ~LightApp_Application();
+
+ virtual QString applicationName() const;
+ virtual QString applicationVersion() const;
+
+ virtual CAM_Module* loadModule( const QString& );
+ virtual bool activateModule( const QString& );
+
+ virtual bool useStudy( const QString& );
+
+ LightApp_SelectionMgr* selectionMgr() const;
+
+ LogWindow* logWindow();
+ OB_Browser* objectBrowser();
+ PythonConsole* pythonConsole();
+
+ virtual void updateObjectBrowser( const bool = true );
+
+ LightApp_Preferences* preferences() const;
+
+ virtual QString getFileFilter() const;
+
+ virtual QString getFileName( bool open, const QString& initial, const QString& filters,
+ const QString& caption, QWidget* parent );
+ virtual QString getDirectory( const QString& initial, const QString& caption, QWidget* parent );
+ virtual QStringList getOpenFileNames( const QString& initial, const QString& filters,
+ const QString& caption, QWidget* parent );
+
+ void updateActions();
+
+ SUIT_ViewManager* getViewManager( const QString&, const bool );
+ virtual void removeViewManager( SUIT_ViewManager* );
+ QWidget* getWindow( const int, const int = -1 );
+ QWidget* window( const int, const int = -1 ) const;
+ void addWindow( QWidget*, const int, const int = -1 );
+ void removeWindow( const int, const int = -1 );
+
+ bool isWindowVisible( const int ) const;
+ void setWindowShown( const int, const bool );
+
+ virtual void start();
+
+ virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& );
+
+ virtual void createEmptyStudy();
+
+ SUIT_Accel* accel() const;
+
+signals:
+ void studyOpened();
+ void studySaved();
+ void studyClosed();
+
+public slots:
+ virtual void onHelpContentsModule();
+ virtual void onNewDoc();
+ virtual void onOpenDoc();
+ virtual void onHelpAbout();
+ virtual bool onOpenDoc( const QString& );
+ virtual bool onLoadDoc( const QString& );
+
+protected:
+ virtual void createActions();
+ virtual SUIT_Study* createNewStudy();
+ virtual QWidget* createWindow( const int );
+ virtual void defaultWindows( QMap<int, int>& ) const;
+ void defaultViewManagers( QStringList& ) const;
+
+ virtual void setActiveStudy( SUIT_Study* );
+ virtual void updateCommandsStatus();
+ virtual void onSelectionChanged();
+
+ virtual void beforeCloseDoc( SUIT_Study* );
+ virtual void afterCloseDoc();
+ virtual void moduleAdded( CAM_Module* );
+ virtual bool activateModule( CAM_Module* = 0 );
+
+ LightApp_Preferences* preferences( const bool ) const;
+ virtual void createPreferences( LightApp_Preferences* );
+ virtual void preferencesChanged( const QString&, const QString& );
+ virtual void updateDesktopTitle();
+
+protected slots:
+ virtual void onDesktopActivated();
+
+ void onNewWindow();
+ void onModuleActivation( QAction* );
+ void onCloseView( SUIT_ViewManager* );
+
+ void onStudyCreated( SUIT_Study* );
+ void onStudyOpened( SUIT_Study* );
+ void onStudySaved( SUIT_Study* );
+ void onStudyClosed( SUIT_Study* );
+
+ void onWCDestroyed( QObject* );
+
+private slots:
+ void onSelection();
+ void onRefresh();
+ void onPreferences();
+ void onMRUActivated( QString );
+ void onPreferenceChanged( QString&, QString&, QString& );
+ void onRenameWindow();
+
+protected:
+ void updateWindows();
+ void updateViewManagers();
+ void updateModuleActions();
+
+ void loadWindowsGeometry();
+ void saveWindowsGeometry();
+
+ void updatePreference( const QString&, const QString&, const QString& );
+
+ QString defaultModule() const;
+ void currentWindows( QMap<int, int>& ) const;
+ void currentViewManagers( QStringList& ) const;
+ virtual SUIT_ViewManager* createViewManager( const QString& vmType );
+ void moduleIconNames( QMap<QString, QString>& ) const;
+
+ void activateWindows();
+
+protected:
+ typedef QMap<QString, QAction*> ActionMap;
+ typedef QMap<int, LightApp_WidgetContainer*> WindowMap;
+
+protected:
+ LightApp_Preferences* myPrefs;
+ LightApp_SelectionMgr* mySelMgr;
+ ActionMap myActions;
+ WindowMap myWindows;
+
+ SUIT_Accel* myAccel;
+
+ static LightApp_Preferences* _prefs_;
+};
+
+#ifdef WIN32
+#pragma warning( default:4251 )
+#endif
+
+#endif
--- /dev/null
+// File: LightApp_Module.h
+// Created: 6/20/2005 16:25:06 AM
+// Author: OCC team
+// Copyright (C) CEA 2005
+
+#ifndef LIGHTAPP_MODULE_H
+#define LIGHTAPP_MODULE_H
+
+#include "LightApp.h"
+#include <CAM_Module.h>
+
+class LightApp_Application;
+class LightApp_Preferences;
+class LightApp_Selection;
+class LightApp_Operation;
+class LightApp_SwitchOp;
+class LightApp_ShowHideOp;
+class LightApp_Displayer;
+
+class SUIT_Study;
+class SUIT_DataObject;
+class SUIT_Operation;
+class CAM_Application;
+
+class QtxPopupMgr;
+
+class QString;
+class QVariant;
+
+/*
+ Class : LightApp_Module
+ Description : Base class for all light modules
+*/
+
+class LIGHTAPP_EXPORT LightApp_Module : public CAM_Module
+{
+ Q_OBJECT
+
+public:
+ LightApp_Module( const QString& );
+ virtual ~LightApp_Module();
+
+ virtual void initialize( CAM_Application* );
+ virtual void windows( QMap<int, int>& ) const;
+ virtual void viewManagers( QStringList& ) const;
+
+ virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& );
+
+ virtual void createPreferences();
+
+ LightApp_Application* getApp() const;
+
+ virtual void update( const int );
+ // Update viewer or/and object browser etc. in accordance with update flags
+ // ( see SalomeApp_UpdateFlags enumeration ). Derived modules can redefine this method
+ // for their own purposes
+
+ virtual void updateObjBrowser( bool = true, SUIT_DataObject* = 0 );
+ // Update object bropwser ( for updating model or whole object browser use update() method
+ // can be used )
+
+ virtual void selectionChanged();
+ virtual void preferencesChanged( const QString&, const QString& );
+
+ virtual void studyActivated() {};
+
+ virtual LightApp_Displayer* displayer();
+
+public slots:
+ virtual bool activateModule( SUIT_Study* );
+ virtual bool deactivateModule( SUIT_Study* );
+
+ void MenuItem();
+
+protected slots:
+ virtual void onModelSaved();
+ virtual void onModelOpened();
+ virtual void onModelClosed();
+
+ virtual void onOperationStopped( SUIT_Operation* );
+ virtual void onOperationDestroyed();
+ virtual void onShowHide();
+
+protected:
+ virtual QtxPopupMgr* popupMgr();
+ LightApp_Preferences* preferences() const;
+
+ virtual CAM_DataModel* createDataModel();
+ virtual LightApp_Selection* createSelection() const;
+
+ int addPreference( const QString& label );
+ int addPreference( const QString& label, const int pId, const int = -1,
+ const QString& section = QString::null,
+ const QString& param = QString::null );
+ QVariant preferenceProperty( const int, const QString& ) const;
+ void setPreferenceProperty( const int, const QString&, const QVariant& );
+
+ /*! Module stores operations in map. This method starts operation by id.
+ * If operation isn't in map, then it will be created by createOperation method
+ * and will be inserted to map
+ */
+ void startOperation( const int );
+ /*! Create operation by its id. You must not call this method, it will be called automatically
+ * by startOperation. Please redefine this method in current module
+ */
+ virtual LightApp_Operation* createOperation( const int ) const;
+
+ virtual void updateControls();
+
+private:
+ typedef QMap<int,LightApp_Operation*> MapOfOperation;
+
+private:
+ QtxPopupMgr* myPopupMgr;
+ MapOfOperation myOperations;
+ LightApp_SwitchOp* mySwitchOp;
+
+protected:
+ int myDisplay, myErase, myDisplayOnly, myEraseAll;
+};
+
+#endif
--- /dev/null
+#include "OB_Browser.h"
+
+#include "OB_Filter.h"
+#include "OB_ListItem.h"
+#include "OB_ListView.h"
+
+#include <qcursor.h>
+#include <qlayout.h>
+#include <qtooltip.h>
+#include <qpainter.h>
+#include <qwmatrix.h>
+#include <qlistview.h>
+#include <qpopupmenu.h>
+
+/*!
+ Class: OB_Browser::ToolTip
+ Descr: Tool tip for OB_Browser.
+*/
+
+class OB_Browser::ToolTip : public QToolTip
+{
+public:
+ ToolTip( OB_Browser* b, QWidget* p = 0 );
+ virtual ~ToolTip();
+
+ void maybeTip( const QPoint& );
+
+private:
+ OB_Browser* myBrowser;
+};
+
+OB_Browser::ToolTip::ToolTip( OB_Browser* b, QWidget* p )
+: QToolTip( p ),
+myBrowser( b )
+{
+}
+
+OB_Browser::ToolTip::~ToolTip()
+{
+}
+
+void OB_Browser::ToolTip::maybeTip( const QPoint& pos )
+{
+ if ( !parentWidget() || !myBrowser || !myBrowser->isShowToolTips() )
+ return;
+
+ QListView* lv = myBrowser->listView();
+
+ QListViewItem* item = lv->itemAt( pos );
+ SUIT_DataObject* obj = myBrowser->dataObject( item );
+ if ( !obj )
+ return;
+
+ QString aText = obj->toolTip();
+
+ if ( aText.isEmpty() )
+ return;
+
+ QRect aRect = lv->itemRect( item );
+
+ tip( aRect, aText );
+}
+
+/*!
+ Class: OB_Browser
+ Descr: Hierarchical tree object browser.
+*/
+
+OB_Browser::OB_Browser( QWidget* parent, SUIT_DataObject* root )
+: QFrame( parent ),
+
+myRoot( 0 ),
+myTooltip( 0 ),
+myAutoOpenLevel( 0 ),
+myAutoUpdate( false ),
+myAutoDelObjs( false ),
+myRootDecorated( true )
+{
+ myView = new OB_ListView( QtxListView::HeaderAuto, this );
+ myView->setAppropriate( myView->addColumn( "Data" ), false );
+ myView->setSorting( -1 );
+ myView->setRootIsDecorated( true );
+ myView->setSelectionMode( QListView::Extended );
+ myView->installEventFilter( this );
+ myView->viewport()->installEventFilter( this );
+
+ QVBoxLayout* main = new QVBoxLayout( this );
+ main->addWidget( myView );
+
+ myShowToolTips = true;
+ myTooltip = new ToolTip( this, myView->viewport() );
+
+ connect( myView, SIGNAL( dropped( QPtrList<QListViewItem>, QListViewItem*, int ) ),
+ this, SLOT( onDropped( QPtrList<QListViewItem>, QListViewItem*, int ) ) );
+ connect( myView, SIGNAL( selectionChanged() ), this, SIGNAL( selectionChanged() ) );
+ connect( myView, SIGNAL( doubleClicked( QListViewItem* ) ),
+ this, SLOT( onDoubleClicked( QListViewItem* ) ) );
+
+ setRootObject( root );
+}
+
+OB_Browser::~OB_Browser()
+{
+ myItems.clear();
+ delete myTooltip;
+}
+
+bool OB_Browser::rootIsDecorated() const
+{
+ return myRootDecorated;
+}
+
+void OB_Browser::setRootIsDecorated( const bool decor )
+{
+ if ( decor == rootIsDecorated() )
+ return;
+
+ myRootDecorated = decor;
+ updateTree();
+}
+
+int OB_Browser::autoOpenLevel() const
+{
+ return myAutoOpenLevel;
+}
+
+void OB_Browser::setAutoOpenLevel( const int level )
+{
+ if ( myAutoOpenLevel == level )
+ return;
+
+ myAutoOpenLevel = level;
+
+ autoOpenBranches();
+}
+
+bool OB_Browser::isShowToolTips()
+{
+ return myShowToolTips;
+}
+
+void OB_Browser::setShowToolTips( const bool theDisplay )
+{
+ myShowToolTips = theDisplay;
+}
+
+bool OB_Browser::isAutoUpdate() const
+{
+ return myAutoUpdate;
+}
+
+void OB_Browser::setAutoUpdate( const bool on )
+{
+ myAutoUpdate = on;
+}
+
+bool OB_Browser::isAutoDeleteObjects() const
+{
+ return myAutoDelObjs;
+}
+
+void OB_Browser::setAutoDeleteObjects( const bool on )
+{
+ myAutoDelObjs = on;
+}
+
+SUIT_DataObject* OB_Browser::getRootObject() const
+{
+ return myRoot;
+}
+
+void OB_Browser::setRootObject( SUIT_DataObject* theRoot )
+{
+ DataObjectKey curKey;
+ DataObjectMap selObjs, openObjs;
+ DataObjectKeyMap selKeys, openKeys;
+
+ int selNum = numberOfSelected();
+
+ SUIT_DataObject* curObj = 0;
+ if ( theRoot )
+ curObj = storeState( selObjs, openObjs, selKeys, openKeys, curKey );
+
+ removeConnections( myRoot );
+ if ( myRoot != theRoot && isAutoDeleteObjects() )
+ delete myRoot;
+
+ myRoot = theRoot;
+
+ createConnections( myRoot );
+
+ if ( myRoot )
+ updateView( myRoot );
+ else if ( listView() )
+ {
+ myItems.clear();
+ listView()->clear();
+ }
+
+ restoreState( selObjs, openObjs, curObj, selKeys, openKeys, curKey );
+
+ autoOpenBranches();
+
+ if ( selNum != numberOfSelected() )
+ emit selectionChanged();
+}
+
+int OB_Browser::numberOfSelected() const
+{
+ int count = 0;
+ if ( listView() )
+ {
+ for ( QListViewItemIterator it( listView() ); it.current(); ++it )
+ if ( it.current()->isSelected() )
+ count++;
+ }
+ return count;
+}
+
+DataObjectList OB_Browser::getSelected() const
+{
+ DataObjectList lst;
+ getSelected( lst );
+ return lst;
+}
+
+void OB_Browser::getSelected( DataObjectList& theObjList ) const
+{
+ theObjList.clear();
+
+ if ( !listView() )
+ return;
+
+ for ( QListViewItemIterator it( listView() ); it.current(); ++it )
+ {
+ if ( it.current()->isSelected() )
+ {
+ SUIT_DataObject* obj = dataObject( it.current() );
+ if ( obj )
+ theObjList.append( obj );
+ }
+ }
+}
+
+void OB_Browser::setSelected( const SUIT_DataObject* theObject, const bool append )
+{
+ DataObjectList lst;
+ lst.append( theObject );
+ setSelected( lst, append );
+}
+
+void OB_Browser::setSelected( const DataObjectList& theObjLst, const bool append )
+{
+ QListView* lv = listView();
+
+ if ( !lv )
+ return;
+
+ bool changed = false;
+ bool block = lv->signalsBlocked();
+ lv->blockSignals( true );
+
+ QMap<QListViewItem*, int> map;
+ for ( DataObjectListIterator itr( theObjLst ); itr.current(); ++itr )
+ map.insert( listViewItem( itr.current() ), 0 );
+
+ for ( QListViewItemIterator it( lv ); it.current(); ++it )
+ {
+ QListViewItem* item = it.current();
+ if ( map.contains( item ) && !lv->isSelected( item ) )
+ {
+ changed = true;
+ lv->setSelected( item, true );
+ }
+ if ( !append && !map.contains( item ) && lv->isSelected( item ) )
+ {
+ changed = true;
+ lv->setSelected( item, false );
+ }
+ }
+
+ lv->blockSignals( block );
+
+ if ( changed )
+ {
+ int count = 0;
+ QListViewItem* sel = 0;
+ QListViewItem* cur = lv->currentItem();
+ for ( QListViewItemIterator iter( lv ); iter.current() && !sel; ++iter, count++ )
+ {
+ if ( iter.current()->isSelected() && cur == iter.current() )
+ sel = iter.current();
+ }
+
+ for ( QListViewItemIterator itr( lv ); itr.current() && !sel; ++itr )
+ {
+ if ( itr.current()->isSelected() )
+ sel = itr.current();
+ }
+
+ if ( sel )
+ lv->setCurrentItem( sel );
+
+ if ( sel && count == 1 )
+ lv->ensureItemVisible( sel );
+
+ emit selectionChanged();
+ }
+}
+
+bool OB_Browser::isOpen( SUIT_DataObject* theObject ) const
+{
+ bool res = false;
+ if ( listView() )
+ res = listView()->isOpen( listViewItem( theObject ) );
+ return res;
+}
+
+void OB_Browser::setOpen( SUIT_DataObject* theObject, const bool theOpen )
+{
+ if ( listView() )
+ listView()->setOpen( listViewItem( theObject ), theOpen );
+}
+
+SUIT_DataObject* OB_Browser::dataObjectAt( const QPoint& pos ) const
+{
+ SUIT_DataObject* obj = 0;
+
+ QListView* lv = listView();
+ if ( lv )
+ obj = dataObject( lv->itemAt( pos ) );
+
+ return obj;
+}
+
+OB_Filter* OB_Browser::filter() const
+{
+ return myView->filter();
+}
+
+void OB_Browser::setFilter( OB_Filter* f )
+{
+ myView->setFilter( f );
+}
+
+int OB_Browser::addColumn( const QString& label, const int id, const int width )
+{
+ return addColumn( QIconSet(), label, id, width );
+}
+
+int OB_Browser::addColumn( const QIconSet& icon, const QString& label, const int id, const int width )
+{
+ QListView* lv = listView();
+ if ( !lv )
+ return -1;
+
+ int theId = id;
+ if ( theId < 0 )
+ {
+ while ( myColumnIds.contains( theId ) )
+ theId++;
+ }
+
+ if ( myColumnIds.contains( theId ) )
+ return -1; // can not reuse id
+
+ int sec = -1;
+ if ( icon.isNull() )
+ sec = lv->addColumn( label, width );
+ else
+ sec = lv->addColumn( icon, label, width );
+
+ if ( sec == -1 )
+ return -1;
+
+ myColumnIds.insert( theId, sec );
+ updateText();
+
+ return theId;
+}
+
+void OB_Browser::removeColumn( const int id )
+{
+ QListView* lv = listView();
+ if ( !lv || !myColumnIds.contains( id ) )
+ return;
+
+ int sec = myColumnIds[id];
+ lv->removeColumn( sec );
+
+ // update map of column indeces
+ myColumnIds.remove( id );
+ for ( QMap<int, int>::iterator it = myColumnIds.begin(); it != myColumnIds.end(); ++it )
+ {
+ if ( it.key() > id )
+ it.data()--;
+ }
+ updateText();
+}
+
+void OB_Browser::setNameTitle( const QString& label )
+{
+ setNameTitle( QIconSet(), label );
+}
+
+void OB_Browser::setNameTitle( const QIconSet& icon, const QString& label )
+{
+ QListView* lv = listView();
+ if ( !lv )
+ return;
+
+ if ( icon.isNull() )
+ lv->setColumnText( 0, label );
+ else
+ lv->setColumnText( 0, icon, label );
+}
+
+void OB_Browser::setColumnTitle( const int id, const QString& label )
+{
+ setColumnTitle( id, QIconSet(), label );
+}
+
+void OB_Browser::setColumnTitle( const int id, const QIconSet& icon, const QString& label )
+{
+ QListView* lv = listView();
+ if ( !lv || !myColumnIds.contains( id ) )
+ return;
+
+ if ( icon.isNull() )
+ lv->setColumnText( myColumnIds[id], label );
+ else
+ lv->setColumnText( myColumnIds[id], icon, label );
+}
+
+QString OB_Browser::nameTitle() const
+{
+ return myView->columnText( 0 );
+}
+
+QString OB_Browser::columnTitle( const int id ) const
+{
+ QString txt;
+ if ( myColumnIds.contains( id ) )
+ txt = myView->columnText( myColumnIds[id] );
+ return txt;
+}
+
+bool OB_Browser::isColumnVisible( const int id ) const
+{
+ return myColumnIds.contains( id ) && myView->isShown( myColumnIds[id] );
+}
+
+void OB_Browser::setColumnShown( const int id, const bool on )
+{
+ if ( !myColumnIds.contains( id ) )
+ return;
+
+ myView->setShown( myColumnIds[id], on );
+}
+
+void OB_Browser::setWidthMode( QListView::WidthMode mode )
+{
+ for ( int i = 0, n = myView->columns(); i < n; i++ )
+ myView->setColumnWidthMode( i, mode );
+}
+
+QValueList<int> OB_Browser::columns() const
+{
+ QValueList<int> lst;
+ for ( QMap<int, int>::ConstIterator it = myColumnIds.begin(); it != myColumnIds.end(); ++it )
+ lst.append( it.key() );
+ return lst;
+}
+
+bool OB_Browser::appropriateColumn( const int id ) const
+{
+ bool res = false;
+ if ( myColumnIds.contains( id ) )
+ res = myView->appropriate( myColumnIds[id] );
+ return res;
+}
+
+void OB_Browser::setAppropriateColumn( const int id, const bool on )
+{
+ if ( !myColumnIds.contains( id ) )
+ return;
+
+ myView->setAppropriate( myColumnIds[id], on );
+}
+
+void OB_Browser::updateTree( SUIT_DataObject* obj )
+{
+ if ( !obj && !(obj = getRootObject()) )
+ return;
+
+ DataObjectKey curKey;
+ DataObjectMap selObjs, openObjs;
+ DataObjectKeyMap selKeys, openKeys;
+
+ int selNum = numberOfSelected();
+
+ SUIT_DataObject* curObj = storeState( selObjs, openObjs, selKeys, openKeys, curKey );
+
+ updateView( obj );
+
+ restoreState( selObjs, openObjs, curObj, selKeys, openKeys, curKey );
+
+ autoOpenBranches();
+
+ if ( selNum != numberOfSelected() )
+ emit selectionChanged();
+}
+
+void OB_Browser::replaceTree( SUIT_DataObject* src, SUIT_DataObject* trg )
+{
+ if ( !src || !trg || src == trg || src->root() != getRootObject() )
+ return;
+
+ DataObjectKey curKey;
+ DataObjectMap selObjs, openObjs;
+ DataObjectKeyMap selKeys, openKeys;
+
+ int selNum = numberOfSelected();
+
+ SUIT_DataObject* curObj = storeState( selObjs, openObjs, selKeys, openKeys, curKey );
+
+ SUIT_DataObject* parent = src->parent();
+ int pos = parent ? parent->childPos( src ) : -1;
+
+ src->setParent( 0 );
+
+ removeConnections( src );
+ if ( isAutoDeleteObjects() )
+ delete src;
+
+ if ( parent && pos != -1 )
+ parent->insertChild( trg, pos );
+
+ trg->setParent( parent );
+
+ updateView( trg );
+ createConnections( trg );
+
+ restoreState( selObjs, openObjs, curObj, selKeys, openKeys, curKey );
+
+ autoOpenBranches();
+
+ if ( selNum != numberOfSelected() )
+ emit selectionChanged();
+}
+
+void OB_Browser::updateView( const SUIT_DataObject* theStartObj )
+{
+ QListView* lv = listView();
+ if ( !lv )
+ return;
+
+ if ( !theStartObj || theStartObj->root() != getRootObject() )
+ return;
+
+ QListViewItem* after = 0;
+ QListViewItem* parent = 0;
+ QListViewItem* startItem = listViewItem( theStartObj );
+
+ if ( theStartObj->parent() )
+ parent = listViewItem( theStartObj->parent() );
+
+ QListViewItem* prv = 0;
+ QListViewItem* cur = parent ? parent->firstChild() : lv->firstChild();
+ while ( !after && cur )
+ {
+ if ( cur == startItem )
+ after = prv;
+
+ prv = cur;
+ cur = cur->nextSibling();
+ }
+
+ QPtrList<QListViewItem> delList;
+ if ( !startItem && theStartObj == getRootObject() )
+ {
+ for ( QListViewItem* item = lv->firstChild(); item; item = item->nextSibling() )
+ delList.append( item );
+ }
+ else
+ delList.append( startItem );
+
+ for ( QPtrListIterator<QListViewItem> it( delList ); it.current(); ++it )
+ {
+ removeReferences( it.current() );
+ delete it.current();
+ }
+
+ // for myRoot object, if myShowRoot==false, then creating multiple top-level QListViewItem-s
+ // (which will correspond to myRoot's children = Modules).
+ if ( rootIsDecorated() && theStartObj == myRoot )
+ {
+ DataObjectList lst;
+ theStartObj->children( lst );
+ DataObjectListIterator it ( lst );
+ // iterating backward to preserve the order of elements in the tree
+ for ( it.toLast(); it.current(); --it )
+ createTree( it.current(), 0, 0 );
+ }
+ else
+ createTree( theStartObj, parent, after ? after : parent );
+}
+
+QListViewItem* OB_Browser::createTree( const SUIT_DataObject* obj,
+ QListViewItem* parent, QListViewItem* after )
+{
+ if ( !obj )
+ return 0;
+
+ QListViewItem* item = createItem( obj, parent, after );
+
+ DataObjectList lst;
+ obj->children( lst );
+ for ( DataObjectListIterator it ( lst ); it.current(); ++it )
+ createTree( it.current(), item );
+
+ if ( item )
+ item->setOpen( obj->isOpen() );
+
+ return item;
+}
+
+QListViewItem* OB_Browser::createItem( const SUIT_DataObject* o,
+ QListViewItem* parent, QListViewItem* after )
+{
+ QListView* lv = listView();
+
+ if ( !lv || !o )
+ return 0;
+
+ QListViewItem* item = 0;
+ SUIT_DataObject* obj = (SUIT_DataObject*)o;
+
+ int type = -1;
+
+ switch ( obj->checkType() )
+ {
+ case SUIT_DataObject::CheckBox:
+ type = QCheckListItem::CheckBox;
+ break;
+ case SUIT_DataObject::RadioButton:
+ type = QCheckListItem::RadioButton;
+ break;
+ }
+
+ if ( parent )
+ {
+ if ( parent->childCount() && !after )
+ {
+ after = parent->firstChild();
+ while ( after->nextSibling() )
+ after = after->nextSibling();
+ }
+
+ if ( after )
+ {
+ if ( type == -1 )
+ item = new OB_ListItem( obj, parent, after );
+ else
+ item = new OB_CheckListItem( obj, parent, after, (QCheckListItem::Type)type );
+ }
+ else
+ {
+ if ( type == -1 )
+ item = new OB_ListItem( obj, parent );
+ else
+ item = new OB_CheckListItem( obj, parent, (QCheckListItem::Type)type );
+ }
+ }
+ else // ROOT item
+ {
+ if ( type == -1 )
+ item = new OB_ListItem( obj, lv );
+ else
+ item = new OB_CheckListItem( obj, lv, (QCheckListItem::Type)type );
+ }
+
+ myItems.insert( obj, item );
+ obj->connect( this, SLOT( onDestroyed( SUIT_DataObject* ) ) );
+
+ updateText( item );
+
+ return item;
+}
+
+void OB_Browser::adjustWidth()
+{
+ if ( !listView() )
+ return;
+
+ listView()->setColumnWidth( 0, 0 );
+ if ( listView()->firstChild() )
+ adjustWidth( listView()->firstChild() );
+}
+
+void OB_Browser::adjustWidth( QListViewItem* item )
+{
+ while ( item )
+ {
+ item->widthChanged( 0 );
+ if ( item->isOpen() )
+ adjustWidth( item->firstChild() );
+ item = item->nextSibling();
+ }
+}
+
+SUIT_DataObject* OB_Browser::dataObject( const QListViewItem* item ) const
+{
+ SUIT_DataObject* obj = 0;
+
+ if ( item && item->rtti() == OB_ListItem::RTTI() )
+ obj = ((OB_ListItem*)item)->dataObject();
+ else if ( item && item->rtti() == OB_CheckListItem::RTTI() )
+ obj = ((OB_CheckListItem*)item)->dataObject();
+
+ return obj;
+}
+
+QListViewItem* OB_Browser::listViewItem( const SUIT_DataObject* obj ) const
+{
+ QListViewItem* item = 0;
+
+ if ( myItems.contains( (SUIT_DataObject*)obj ) )
+ item = myItems[(SUIT_DataObject*)obj];
+
+ return item;
+}
+
+QListView* OB_Browser::listView() const
+{
+ return myView;
+}
+
+void OB_Browser::removeReferences( QListViewItem* item )
+{
+ if ( !item )
+ return;
+
+ SUIT_DataObject* obj = dataObject( item );
+ obj->disconnect( this, SLOT( onDestroyed( SUIT_DataObject* ) ) );
+ myItems.remove( obj );
+
+ QListViewItem* i = item->firstChild();
+ while ( i )
+ {
+ removeReferences( i );
+ i = i->nextSibling();
+ }
+}
+
+void OB_Browser::createConnections( SUIT_DataObject* obj )
+{
+ if ( !obj )
+ return;
+
+ DataObjectList childList;
+ obj->children( childList, true );
+
+ childList.prepend( obj );
+
+ for ( DataObjectListIterator it( childList ); it.current(); ++it )
+ it.current()->connect( this, SLOT( onDestroyed( SUIT_DataObject* ) ) );
+}
+
+void OB_Browser::removeConnections( SUIT_DataObject* obj )
+{
+ if ( !obj )
+ return;
+
+ DataObjectList childList;
+ obj->children( childList, true );
+
+ childList.prepend( obj );
+
+ for ( DataObjectListIterator it( childList ); it.current(); ++it )
+ it.current()->disconnect( this, SLOT( onDestroyed( SUIT_DataObject* ) ) );
+}
+
+SUIT_DataObject* OB_Browser::storeState( DataObjectMap& selObjs, DataObjectMap& openObjs,
+ DataObjectKeyMap& selKeys, DataObjectKeyMap& openKeys,
+ DataObjectKey& curKey ) const
+{
+ QListView* lv = listView();
+ if ( !lv )
+ return 0;
+
+ SUIT_DataObject* curObj = dataObject( lv->currentItem() );
+
+ curKey = objectKey( curObj );
+
+ for ( QListViewItemIterator it( lv ); it.current(); ++it )
+ {
+ SUIT_DataObject* obj = dataObject( it.current() );
+ if ( !obj )
+ continue;
+
+ selObjs.insert( obj, lv->isSelected( it.current() ) );
+ openObjs.insert( obj, lv->isOpen( it.current() ) );
+ if ( lv->isSelected( it.current() ) )
+ selKeys.insert( objectKey( obj ), 0 );
+ if ( lv->isOpen( it.current() ) )
+ openKeys.insert( objectKey( obj ), 0 );
+ }
+
+ return curObj;
+}
+
+void OB_Browser::restoreState( const DataObjectMap& selObjs, const DataObjectMap& openObjs,
+ const SUIT_DataObject* curObj, const DataObjectKeyMap& selKeys,
+ const DataObjectKeyMap& openKeys, const DataObjectKey& curKey )
+{
+ QListView* lv = listView();
+ if ( !lv )
+ return;
+
+ bool block = lv->signalsBlocked();
+ lv->blockSignals( true );
+
+ QListViewItem* curItem = 0;
+ for ( QListViewItemIterator it( lv ); it.current(); ++it )
+ {
+ QListViewItem* item = it.current();
+ SUIT_DataObject* obj = dataObject( item );
+
+ if ( !obj )
+ continue;
+
+ DataObjectKey key = objectKey( obj );
+
+ if ( selObjs.contains( obj ) )
+ {
+ if ( selObjs[obj] && !lv->isSelected( item ) )
+ lv->setSelected( item, true );
+ }
+ else if ( !key.isNull() && selKeys.contains( key ) && !lv->isSelected( item ) )
+ lv->setSelected( item, true );
+
+ if ( openObjs.contains( obj ) )
+ {
+ if ( openObjs[obj] )
+ lv->setOpen( item, true );
+ }
+ else if ( !key.isNull() && openKeys.contains( key ) )
+ lv->setOpen( item, true );
+
+ if ( !curItem && ( curObj == obj || ( !curKey.isNull() && curKey == key )) )
+ curItem = item;
+ }
+
+ if ( curItem )
+ lv->setCurrentItem( curItem );
+
+ lv->blockSignals( block );
+}
+
+OB_Browser::DataObjectKey OB_Browser::objectKey( QListViewItem* i ) const
+{
+ return objectKey( dataObject( i ) );
+}
+
+OB_Browser::DataObjectKey OB_Browser::objectKey( SUIT_DataObject* obj ) const
+{
+ if ( !obj )
+ return 0;
+
+ return DataObjectKey( obj->key() );
+}
+
+void OB_Browser::keyPressEvent( QKeyEvent* e )
+{
+ if ( e->key() == Qt::Key_F5 )
+ updateTree();
+
+ QFrame::keyPressEvent( e );
+}
+
+void OB_Browser::onExpand()
+{
+ DataObjectList selected;
+ getSelected( selected );
+ for ( DataObjectListIterator itr( selected ); itr.current(); ++itr )
+ expand( listViewItem( itr.current() ) );
+}
+
+void OB_Browser::onColumnVisible( int id )
+{
+ setColumnShown( id, !isColumnVisible( id ) );
+}
+
+void OB_Browser::onDestroyed( SUIT_DataObject* obj )
+{
+ removeObject( obj );
+}
+
+void OB_Browser::onDropped( QPtrList<QListViewItem> items, QListViewItem* item, int action )
+{
+ SUIT_DataObject* obj = dataObject( item );
+ if ( !obj )
+ return;
+
+ DataObjectList lst;
+ for ( QPtrListIterator<QListViewItem> it( items ); it.current(); ++it )
+ {
+ SUIT_DataObject* o = dataObject( it.current() );
+ if ( o )
+ lst.append( o );
+ }
+
+ if ( !lst.isEmpty() )
+ emit dropped( lst, obj, action );
+}
+
+void OB_Browser::updateText()
+{
+ if ( myColumnIds.isEmpty() )
+ return;
+
+ QListView* lv = listView();
+ if ( !lv )
+ return;
+
+ for ( QListViewItemIterator it( lv ); it.current(); ++it )
+ {
+ SUIT_DataObject* obj = dataObject( it.current() );
+ if ( !obj )
+ continue;
+
+ for( QMap<int, int>::iterator itr = myColumnIds.begin(); itr != myColumnIds.end(); ++itr )
+ it.current()->setText( itr.data(), obj->text( itr.key() ) );
+ }
+}
+
+void OB_Browser::updateText( QListViewItem* item )
+{
+ SUIT_DataObject* obj = dataObject( item );
+ if ( !obj )
+ return;
+
+ for( QMap<int, int>::iterator it = myColumnIds.begin(); it != myColumnIds.end(); ++it )
+ item->setText( it.data(), obj->text( it.key() ) );
+}
+
+bool OB_Browser::eventFilter( QObject* o, QEvent* e )
+{
+ if ( o == myView && e->type() == QEvent::ContextMenu )
+ {
+ QContextMenuEvent* ce = (QContextMenuEvent*)e;
+ if ( ce->reason() != QContextMenuEvent::Mouse )
+ contextMenuRequest( ce );
+ return true;
+ }
+ if ( o == myView->viewport() && e->type() == QEvent::MouseButtonRelease )
+ {
+ QMouseEvent* me = (QMouseEvent*)e;
+ if ( me->button() == RightButton )
+ {
+ QContextMenuEvent ce( QContextMenuEvent::Mouse, me->pos(), me->globalPos(), me->state() );
+ contextMenuRequest( &ce );
+ return true;
+ }
+ }
+
+ return QFrame::eventFilter( o, e );
+}
+
+void OB_Browser::contextMenuPopup( QPopupMenu* menu )
+{
+/* QValueList<int> cols;
+ for ( QMap<int, int>::ConstIterator it = myColumnIds.begin(); it != myColumnIds.end(); ++it )
+ {
+ if ( appropriateColumn( it.key() ) )
+ cols.append( it.key() );
+ }
+
+ uint num = menu->count();
+ menu->setCheckable( true );
+ for ( QValueList<int>::const_iterator iter = cols.begin(); iter != cols.end(); ++iter )
+ {
+ QString name = columnTitle( *iter );
+ if ( name.isEmpty() )
+ continue;
+
+ int id = menu->insertItem( name, this, SLOT( onColumnVisible( int ) ) );
+ menu->setItemChecked( id, isColumnVisible( *iter ) );
+ menu->setItemParameter( id, *iter );
+ }
+ if ( menu->count() != num )
+ menu->insertSeparator();*/
+
+ DataObjectList selected;
+ getSelected( selected );
+
+ bool closed = false;
+ for ( DataObjectListIterator itr( selected ); itr.current() && !closed; ++itr )
+ closed = hasClosed( listViewItem( itr.current() ) );
+
+ if ( closed )
+ {
+ menu->insertItem( tr( "MEN_EXPAND_ALL" ), this, SLOT( onExpand() ) );
+ menu->insertSeparator();
+ }
+}
+
+void OB_Browser::expand( QListViewItem* item )
+{
+ if ( !item )
+ return;
+
+ item->setOpen( true );
+ for ( QListViewItem* child = item->firstChild(); child; child = child->nextSibling() )
+ expand( child );
+}
+
+bool OB_Browser::hasClosed( QListViewItem* item ) const
+{
+ if ( !item )
+ return false;
+
+ if ( item->childCount() && !item->isOpen() )
+ return true;
+
+ bool has = false;
+ for ( QListViewItem* child = item->firstChild(); child && !has; child = child->nextSibling() )
+ has = hasClosed( child );
+
+ return has;
+}
+
+void OB_Browser::removeObject( SUIT_DataObject* obj, const bool autoUpd )
+{
+ if ( !obj )
+ return;
+
+ // Removing list view items from <myItems> recursively for all children.
+ // Otherwise, "delete item" line will destroy all item's children,
+ // and <myItems> will contain invalid pointers (see ~QListViewItem() description in Qt docs)
+ DataObjectList childList;
+ obj->children( childList );
+ for ( DataObjectListIterator it( childList ); it.current(); ++it )
+ removeObject( it.current(), false );
+
+ QListViewItem* item = listViewItem( obj );
+
+ obj->disconnect( this, SLOT( onDestroyed( SUIT_DataObject* ) ) );
+ myItems.remove( obj );
+
+ if ( obj == myRoot )
+ {
+ // remove all child list view items
+ setRootObject( 0 );
+ return;
+ }
+
+ if ( !autoUpd )
+ return;
+
+ if ( isAutoUpdate() )
+ {
+ SUIT_DataObject* pObj = item && item->parent() ? dataObject( item->parent() ) : 0;
+ updateTree( pObj );
+ }
+ else
+ delete item;
+}
+
+void OB_Browser::autoOpenBranches()
+{
+ int level = autoOpenLevel();
+ QListView* lv = listView();
+ if ( !lv || level < 1 )
+ return;
+
+ QListViewItem* item = lv->firstChild();
+ while ( item )
+ {
+ openBranch( item, level );
+ item = item->nextSibling();
+ }
+}
+
+void OB_Browser::openBranch( QListViewItem* item, const int level )
+{
+ if ( level < 1 )
+ return;
+
+ while ( item )
+ {
+ item->setOpen( true );
+ openBranch( item->firstChild(), level - 1 );
+ item = item->nextSibling();
+ }
+}
+
+void OB_Browser::onDoubleClicked( QListViewItem* item )
+{
+ if ( item )
+ emit doubleClicked( dataObject( item ) );
+}
--- /dev/null
+#ifndef OB_BROWSER_H
+#define OB_BROWSER_H
+
+#include "OB.h"
+
+#include <qframe.h>
+
+#include <qmap.h>
+#include <qlistview.h>
+
+#include <SUIT_DataObject.h>
+#include <SUIT_DataObjectKey.h>
+#include <SUIT_PopupClient.h>
+
+#ifdef WNT
+#pragma warning( disable:4251 )
+#endif
+
+class QToolTip;
+class OB_Filter;
+class OB_ListView;
+
+class OB_EXPORT OB_Browser : public QFrame, public SUIT_PopupClient
+{
+ Q_OBJECT
+
+ class ToolTip;
+
+public:
+ OB_Browser( QWidget* = 0, SUIT_DataObject* theRoot = 0 );
+ virtual ~OB_Browser();
+
+ virtual QString popupClientType() const { return QString( "ObjectBrowser" ); }
+
+ SUIT_DataObject* getRootObject() const;
+ virtual void setRootObject( SUIT_DataObject* theRoot = 0 );
+
+ int numberOfSelected() const;
+
+ DataObjectList getSelected() const;
+ void getSelected( DataObjectList& ) const;
+
+ virtual void setSelected( const SUIT_DataObject* theObject, const bool = false );
+ virtual void setSelected( const DataObjectList& theObjLst, const bool = false );
+
+ bool isOpen( SUIT_DataObject* theObject ) const;
+ virtual void setOpen( SUIT_DataObject* theObject, const bool theOpen = true );
+
+ bool isAutoUpdate() const;
+ virtual void setAutoUpdate( const bool );
+
+ bool isAutoDeleteObjects() const;
+ virtual void setAutoDeleteObjects( const bool );
+
+ virtual void updateTree( SUIT_DataObject* = 0 );
+ virtual void replaceTree( SUIT_DataObject*, SUIT_DataObject* );
+
+ bool isShowToolTips();
+ void setShowToolTips( const bool theDisplay );
+
+ void adjustWidth();
+
+ SUIT_DataObject* dataObjectAt( const QPoint& ) const;
+
+ OB_Filter* filter() const;
+ void setFilter( OB_Filter* );
+
+ bool rootIsDecorated() const;
+ void setRootIsDecorated( const bool );
+
+ int autoOpenLevel() const;
+ void setAutoOpenLevel( const int );
+
+ virtual int addColumn( const QString&, const int id = -1, const int width = -1 );
+ virtual int addColumn( const QIconSet&, const QString&, const int id = -1, const int width = -1 );
+ virtual void removeColumn( const int id );
+
+ void setNameTitle( const QString& );
+ virtual void setNameTitle( const QIconSet&, const QString& );
+ void setColumnTitle( const int id, const QString& );
+ virtual void setColumnTitle( const int id, const QIconSet&, const QString& );
+
+ QString nameTitle() const;
+ QString columnTitle( const int ) const;
+
+ bool isColumnVisible( const int ) const;
+ virtual void setColumnShown( const int, const bool );
+
+ virtual void setWidthMode( QListView::WidthMode );
+
+ QValueList<int> columns() const;
+
+ bool appropriateColumn( const int ) const;
+ virtual void setAppropriateColumn( const int, const bool );
+
+ virtual bool eventFilter(QObject* watched, QEvent* e);
+
+ QListView* listView() const;
+
+ virtual void contextMenuPopup( QPopupMenu* );
+
+signals:
+ void selectionChanged();
+ void doubleClicked( SUIT_DataObject* );
+ void dropped( DataObjectList, SUIT_DataObject*, int );
+
+private slots:
+ void onExpand();
+ void onColumnVisible( int );
+ void onDestroyed( SUIT_DataObject* );
+ void onDoubleClicked ( QListViewItem* );
+ void onDropped( QPtrList<QListViewItem>, QListViewItem*, int );
+
+protected:
+ void adjustWidth( QListViewItem* );
+ virtual void updateView( const SUIT_DataObject* theStartObj = 0 );
+ virtual void updateText();
+
+ virtual void keyPressEvent( QKeyEvent* );
+
+ SUIT_DataObject* dataObject( const QListViewItem* ) const;
+ QListViewItem* listViewItem( const SUIT_DataObject* ) const;
+
+private:
+ typedef QMap<SUIT_DataObject*, QListViewItem*> ItemMap;
+ typedef SUIT_DataObjectKeyHandle DataObjectKey;
+ typedef QMap<SUIT_DataObject*, int> DataObjectMap;
+ typedef QMap<DataObjectKey, int> DataObjectKeyMap;
+
+private:
+ void expand( QListViewItem* );
+ bool hasClosed( QListViewItem* ) const;
+
+ void autoOpenBranches();
+ void openBranch( QListViewItem*, const int );
+
+ void removeReferences( QListViewItem* );
+ void removeConnections( SUIT_DataObject* );
+ void createConnections( SUIT_DataObject* );
+ void removeObject( SUIT_DataObject*, const bool = true );
+
+ void updateText( QListViewItem* );
+
+ DataObjectKey objectKey( QListViewItem* ) const;
+ DataObjectKey objectKey( SUIT_DataObject* ) const;
+
+ QListViewItem* createTree( const SUIT_DataObject*, QListViewItem*, QListViewItem* = 0 );
+ QListViewItem* createItem( const SUIT_DataObject*, QListViewItem*, QListViewItem* = 0 );
+
+ SUIT_DataObject* storeState( DataObjectMap&, DataObjectMap&,
+ DataObjectKeyMap&, DataObjectKeyMap&, DataObjectKey& ) const;
+ void restoreState( const DataObjectMap&, const DataObjectMap&, const SUIT_DataObject*,
+ const DataObjectKeyMap&, const DataObjectKeyMap&, const DataObjectKey& );
+
+private:
+ OB_ListView* myView;
+ SUIT_DataObject* myRoot;
+ ItemMap myItems;
+ QToolTip* myTooltip;
+ QMap<int, int> myColumnIds;
+ bool myAutoUpdate;
+ bool myAutoDelObjs;
+ bool myShowToolTips;
+ bool myRootDecorated;
+ int myAutoOpenLevel;
+
+ friend class OB_Browser::ToolTip;
+};
+
+#endif
--- /dev/null
+# File : Makefile.in\r# Author : Vladimir Klyachin (OCN)
+# Module : suit
+# $Header$
+
+top_srcdir=@top_srcdir@
+top_builddir=../..
+srcdir=@srcdir@
+
+VPATH=.:@srcdir@:@srcdir@/resources
+
+@COMMENCE@
+
+# header files
+
+EXPORT_HEADERS= Qtx.h \
+ QtxAction.h \
+ QtxColorScale.h \
+ QtxComboBox.h \
+ QtxDblSpinBox.h \
+ QtxDialog.h \
+ QtxDockAction.h \
+ QtxDockWindow.h \
+ QtxGroupBox.h \
+ QtxIntSpinBox.h \
+ QtxListAction.h \
+ QtxListBox.h \
+ QtxListOfOperations.h \
+ QtxLogoMgr.h \
+ QtxMenuButton.h \
+ QtxMRUAction.h \
+ QtxOperations.h \
+ QtxPathDialog.h \
+ QtxPopupMgr.h \
+ QtxResourceMgr.h \
+ QtxStdOperations.h \
+ QtxTable.h \
+ QtxToolBar.h \
+ QtxToolTip.h \
+ QtxParser.h \
+ QtxPopupMenu.h \
+ QtxActionMgr.h \
+ QtxActionMenuMgr.h \
+ QtxActionToolMgr.h \
+ QtxMainWindow.h \
+ QtxWorkspaceAction.h \
+ QtxWorkstackAction.h \
+ QtxListResourceEdit.h \
+ QtxWorkstack.h \
+ QtxResourceEdit.h \
+ QtxListView.h \
+ QtxDirListEditor.h
+
+# .po files to transform in .qm
+
+PO_FILES = \
+
+# Libraries targets
+
+LIB = libqtx.la
+
+LIB_SRC= \
+ Qtx.cxx \
+ QtxAction.cxx \
+ QtxColorScale.cxx \
+ QtxComboBox.cxx \
+ QtxDblSpinBox.cxx \
+ QtxDialog.cxx \
+ QtxDockAction.cxx \
+ QtxDockWindow.cxx \
+ QtxGroupBox.cxx \
+ QtxIntSpinBox.cxx \
+ QtxListAction.cxx \
+ QtxListBox.cxx \
+ QtxListOfOperations.cxx \
+ QtxLogoMgr.cxx \
+ QtxMenuButton.cxx \
+ QtxMRUAction.cxx \
+ QtxPathDialog.cxx \
+ QtxPopupMgr.cxx \
+ QtxResourceMgr.cxx \
+ QtxStdOperations.cxx \
+ QtxTable.cxx \
+ QtxToolBar.cxx \
+ QtxToolTip.cxx \
+ QtxOperations.cxx \
+ QtxParser.cxx \
+ QtxPopupMenu.cxx \
+ QtxActionMgr.cxx \
+ QtxActionMenuMgr.cxx \
+ QtxActionToolMgr.cxx \
+ QtxMainWindow.cxx \
+ QtxWorkspaceAction.cxx \
+ QtxWorkstackAction.cxx \
+ QtxListResourceEdit.cxx \
+ QtxResourceEdit.cxx \
+ QtxWorkstack.cxx \
+ QtxListView.cxx \
+ QtxDirListEditor.cxx
+
+LIB_MOC = \
+ QtxAction.h \
+ QtxColorScale.h \
+ QtxComboBox.h \
+ QtxDblSpinBox.h \
+ QtxDialog.h \
+ QtxDockAction.h \
+ QtxDockWindow.h \
+ QtxGroupBox.h \
+ QtxIntSpinBox.h \
+ QtxListAction.h \
+ QtxListBox.h \
+ QtxLogoMgr.h \
+ QtxMenuButton.h \
+ QtxMRUAction.h \
+ QtxPathDialog.h \
+ QtxPopupMgr.h \
+ QtxPopupMenu.h \
+ QtxTable.h \
+ QtxToolBar.h \
+ QtxToolTip.h \
+ QtxActionMgr.h \
+ QtxActionMenuMgr.h \
+ QtxActionToolMgr.h \
+ QtxMainWindow.h \
+ QtxWorkspaceAction.h \
+ QtxWorkstackAction.h \
+ QtxWorkstack.h \
+ QtxListView.h \
+ QtxListResourceEdit.h \
+ QtxDirListEditor.h
+
+RESOURCES_FILES = \
+
+CPPFLAGS+=$(QT_INCLUDES)
+
+LDFLAGS+=$(QT_MT_LIBS)
+
+@CONCLUDE@
+
+
--- /dev/null
+//=============================================================================
+// File : SalomePyQt.sip
+// Created : 25/04/05
+// Author : Vadim SANDLER
+// Project : SALOME
+// Copyright : 2003-2005 CEA/DEN, EDF R&D
+// $Header : $
+//=============================================================================
+
+%Module SalomePyQt
+
+%Import qtmod.sip
+
+class SALOME_Selection : QObject
+{
+%HeaderCode
+#include <SalomePyQt.h>
+%End
+
+public:
+ void Clear();
+ void ClearIObjects();
+ void ClearFilters();
+
+private:
+ SALOME_Selection( QObject* /TransferThis/ );
+
+signals:
+ void currentSelectionChanged();
+};
+
+enum MenuName {
+ File = 1,
+ View = 2,
+ Edit = 3,
+ Preferences = 4,
+ Tools = 5,
+ Window = 6,
+ Help = 7
+};
+
+enum {
+ WT_ObjectBrowser,
+ WT_PyConsole,
+ WT_LogWindow,
+ WT_User
+};
+
+class QtxAction : QAction
+{
+%TypeHeaderCode
+#include <QtxAction.h>
+%End
+
+private:
+ QtxAction(const QtxAction &);
+};
+
+class SalomePyQt
+{
+%HeaderCode
+#include <SalomePyQt.h>
+%End
+
+public:
+ static QWidget* getDesktop();
+ static QWidget* getMainFrame();
+ static QMenuBar* getMainMenuBar();
+ static QPopupMenu* getPopupMenu( const MenuName );
+ static SALOME_Selection* getSelection() /Factory/;
+ static int getStudyId();
+ static void putInfo( const QString&, int = 0 );
+ static const QString getActiveComponent();
+ static void updateObjBrowser( int = 0, bool = true );
+
+ static QString getFileName ( QWidget*, const QString&, const QStringList&, const QString&, bool );
+ static QStringList getOpenFileNames ( QWidget*, const QString&, const QStringList&, const QString& );
+ static QString getExistingDirectory( QWidget*, const QString&, const QString& );
+
+ static void helpContext( const QString&, const QString& );
+
+ static bool dumpView( const QString& );
+
+ 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 int, int = -1, int = -1 );
+ static int createTool( QtxAction*, const QString&, int = -1, int = -1 );
+
+ static int createMenu( const QString&, const int,
+ int = -1, int = -1 );
+ static int createMenu( const QString&, const QString&,
+ int = -1, int = -1 );
+ static int createMenu( const int, const int,
+ int = -1, int = -1 );
+ static int createMenu( const int, const QString&,
+ int = -1, int = -1 );
+ static int createMenu( QtxAction*, const int, int = -1,
+ int = -1, int = -1 );
+ static int createMenu( QtxAction*, const QString&, int = -1,
+ int = -1, int = -1 );
+
+ static QtxAction* createSeparator();
+
+ static QtxAction* createAction( const int, const QString&,
+ const QString& = QString::null, const QString& = QString::null,
+ const QString& = QString::null, int = 0, bool = false );
+
+ static QtxAction* action( const int );
+ static int actionId( const QtxAction* );
+
+ 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 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& );
+
+// obsolete
+ static void addStringSetting( const QString&, const QString&, bool = true );
+ static void addIntSetting ( const QString&, const int, bool = true );
+ static void addDoubleSetting( const QString&, const double, bool = true );
+ static void removeSettings ( const QString& );
+ static QString getSetting ( const QString& );
+};
--- /dev/null
+// SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+// 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 : SALOMEGUI_Swig.cxx
+// Author : Vadim SANDLER
+// Module : SALOME
+// $Header$
+
+#include "SALOMEGUI_Swig.hxx"
+
+#include "SUIT_Session.h"
+#include "SUIT_Desktop.h"
+#include "SUIT_DataObjectIterator.h"
+#include "OB_Browser.h"
+#include "SalomeApp_Application.h"
+#include "SalomeApp_Study.h"
+#include "SalomeApp_Module.h"
+#include "SalomeApp_DataObject.h"
+#include "LightApp_SelectionMgr.h"
+#include "SALOME_Prs.h"
+#include "SOCC_ViewModel.h"
+#include "SVTK_ViewModel.h"
+
+#include "SALOME_Event.hxx"
+#include "SALOME_ListIO.hxx"
+#include "SALOME_InteractiveObject.hxx"
+#include "SALOME_ListIteratorOfListIO.hxx"
+
+//#include "utilities.h"
+
+#include <SALOMEconfig.h>
+#include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog)
+
+using namespace std;
+
+//////////////////////////////////////////////////////////////////////////////
+// asv : 3.12.04 : added checking for NULL GUI objects in almost all methods.
+// In the scope of fixing bug PAL6869.
+//////////////////////////////////////////////////////////////////////////////
+// (PR : modify comments)
+// Instance of this class is created every time "import salome" line is typed
+// - in IAPP embedded Python interpretor (SALOME_Session_Server executable),
+// - in inline Python nodes in Supervisor (in SALOME_Container executable),
+// - in stand-alone Python console outside any executable.
+// SALOME GUI(desktop and other objects) is only available in SALOME_Session_Server
+//////////////////////////////////////////////////////////////////////////////
+// VSR : 19.04.05 : Reimplemented for new SALOME GUI (SUIT-based)
+// All methods are implemeted using Event mechanism.
+// Display/Erase methods use SALOME_Prs/SALOME_View mechanism. It is currently
+// implemented only for OCC and VTK viewers.
+//////////////////////////////////////////////////////////////////////////////
+
+/*!
+ getApplication()
+ Returns active application object [ static ]
+*/
+static SalomeApp_Application* getApplication() {
+ if ( SUIT_Session::session() )
+ return dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
+ return NULL;
+}
+
+/*!
+ getActiveStudy()
+ Gets active study or 0 if there is no study opened [ static ]
+*/
+static SalomeApp_Study* getActiveStudy()
+{
+ if ( getApplication() )
+ return dynamic_cast<SalomeApp_Study*>( getApplication()->activeStudy() );
+ return 0;
+}
+
+/*!
+ SALOMEGUI_Swig::SALOMEGUI_Swig
+ Constructor
+*/
+SALOMEGUI_Swig::SALOMEGUI_Swig()
+{
+}
+
+/*!
+ SALOMEGUI_Swig::~SALOMEGUI_Swig
+ Destructor
+*/
+SALOMEGUI_Swig::~SALOMEGUI_Swig()
+{
+}
+
+/*!
+ SALOMEGUI_Swig::hasDesktop
+ Returns TRUE if GUI is available.
+*/
+class THasDesktopEvent: public SALOME_Event {
+public:
+ typedef bool TResult;
+ TResult myResult;
+ THasDesktopEvent() : myResult( false ) {}
+ virtual void Execute() {
+ myResult = (bool)( getApplication() && getApplication()->desktop() );
+ }
+};
+bool SALOMEGUI_Swig::hasDesktop()
+{
+ return ProcessEvent( new THasDesktopEvent() );
+}
+
+/*!
+ SALOMEGUI_Swig::updateObjBrowser
+ Updates active study's Object Browser.
+ VSR: updateSelection parameter is currently not used. Will be implemented or removed lately.
+*/
+void SALOMEGUI_Swig::updateObjBrowser( bool /*updateSelection*/ )
+{
+ class TEvent: public SALOME_Event {
+ public:
+ TEvent() {}
+ virtual void Execute() {
+ if ( SalomeApp_Application* anApp = getApplication() ) {
+ anApp->updateObjectBrowser();
+ anApp->updateActions(); //SRN: added in order to update the toolbar
+ }
+ }
+ };
+ ProcessVoidEvent( new TEvent() );
+}
+
+/*!
+ SALOMEGUI_Swig::getActiveStudyId
+ Returns active study's ID or 0 if there is no active study.
+*/
+class TGetActiveStudyIdEvent: public SALOME_Event {
+public:
+ typedef int TResult;
+ TResult myResult;
+ TGetActiveStudyIdEvent() : myResult( 0 ) {}
+ virtual void Execute() {
+ if ( SalomeApp_Study* aStudy = getActiveStudy() ) {
+ myResult = aStudy->studyDS()->StudyId();
+ }
+ }
+};
+int SALOMEGUI_Swig::getActiveStudyId()
+{
+ return ProcessEvent( new TGetActiveStudyIdEvent() );
+}
+
+/*!
+ SALOMEGUI_Swig::getActiveStudyName
+ Returns active study's name or NULL if there is no active study.
+*/
+class TGetActiveStudyNameEvent: public SALOME_Event {
+public:
+ typedef string TResult;
+ TResult myResult;
+ TGetActiveStudyNameEvent() {}
+ virtual void Execute() {
+ if ( SalomeApp_Study* aStudy = getActiveStudy() ) {
+ myResult = aStudy->studyDS()->Name();
+ }
+ }
+};
+const char* SALOMEGUI_Swig::getActiveStudyName()
+{
+ string result = ProcessEvent( new TGetActiveStudyNameEvent() );
+ return result.empty() ? NULL : result.c_str();
+}
+
+/*!
+ SALOMEGUI_Swig::getComponentName
+ Returns the name of the component by its user name.
+*/
+const char* SALOMEGUI_Swig::getComponentName( const char* componentUserName )
+{
+ if ( SalomeApp_Application* anApp = getApplication() ) {
+ CORBA::Object_var anObject = anApp->namingService()->Resolve("/Kernel/ModulCatalog");
+ if ( !CORBA::is_nil( anObject ) ) {
+ SALOME_ModuleCatalog::ModuleCatalog_var aCatalogue =
+ SALOME_ModuleCatalog::ModuleCatalog::_narrow( anObject );
+ SALOME_ModuleCatalog::ListOfIAPP_Affich_var aModules = aCatalogue->GetComponentIconeList();
+ for ( unsigned int ind = 0; ind < aModules->length(); ind++ ) {
+ CORBA::String_var aModuleName = aModules[ ind ].modulename;
+ CORBA::String_var aModuleUserName = aModules[ ind ].moduleusername;
+ if ( strcmp(componentUserName, aModuleUserName.in()) == 0 )
+ return aModuleName._retn();
+ }
+ }
+ }
+ return 0;
+}
+
+/*!
+ SALOMEGUI_Swig::getComponentUserName
+ Returns the user name of the component by its name.
+*/
+const char* SALOMEGUI_Swig::getComponentUserName( const char* componentName )
+{
+ if ( SalomeApp_Application* anApp = getApplication() ) {
+ CORBA::Object_var anObject = anApp->namingService()->Resolve("/Kernel/ModulCatalog");
+ if ( !CORBA::is_nil( anObject ) ) {
+ SALOME_ModuleCatalog::ModuleCatalog_var aCatalogue =
+ SALOME_ModuleCatalog::ModuleCatalog::_narrow( anObject );
+ SALOME_ModuleCatalog::ListOfIAPP_Affich_var aModules = aCatalogue->GetComponentIconeList();
+ for ( unsigned int ind = 0; ind < aModules->length(); ind++ ) {
+ CORBA::String_var aModuleName = aModules[ ind ].modulename;
+ CORBA::String_var aModuleUserName = aModules[ ind ].moduleusername;
+ if ( strcmp(componentName, aModuleName.in()) == 0 )
+ return aModuleUserName._retn();
+ }
+ }
+ }
+ return 0;
+}
+
+/*!
+ SALOMEGUI_Swig::SelectedCount
+ Returns the number of selected objects.
+*/
+class TSelectedCountEvent: public SALOME_Event {
+public:
+ typedef int TResult;
+ TResult myResult;
+ TSelectedCountEvent() : myResult( 0 ) {}
+ virtual void Execute() {
+ if ( SalomeApp_Application* anApp = getApplication() ) {
+ SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( anApp->activeStudy() ); // for sure!
+ LightApp_SelectionMgr* aSelMgr = anApp->selectionMgr();
+ if ( aStudy && aSelMgr ) {
+ SALOME_ListIO anIOList;
+ aSelMgr->selectedObjects( anIOList );
+ myResult = anIOList.Extent();
+ }
+ }
+ }
+};
+int SALOMEGUI_Swig::SelectedCount()
+{
+ return ProcessEvent( new TSelectedCountEvent() );
+}
+
+/*!
+ SALOMEGUI_Swig::getSelected
+ Returns the selected object entry by the given index.
+*/
+class TGetSelectedEvent: public SALOME_Event {
+public:
+ typedef QString TResult;
+ TResult myResult;
+ int myIndex;
+ TGetSelectedEvent( int theIndex ) : myIndex( theIndex ) {}
+ virtual void Execute() {
+ if ( SalomeApp_Application* anApp = getApplication() ) {
+ SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( anApp->activeStudy() ); // for sure!
+ LightApp_SelectionMgr* aSelMgr = anApp->selectionMgr();
+ if ( aStudy && aSelMgr ) {
+ SALOME_ListIO anIOList;
+ aSelMgr->selectedObjects( anIOList );
+ if ( myIndex < anIOList.Extent() ) {
+ int index = 0;
+ SALOME_ListIteratorOfListIO anIter( anIOList );
+ for( ; anIter.More(); anIter.Next(), index++ ) {
+ Handle(SALOME_InteractiveObject) anIO = anIter.Value();
+ if ( myIndex == index ) {
+ myResult = anIO->getEntry();
+ return;
+ }
+ }
+ }
+ }
+ }
+ }
+};
+const char* SALOMEGUI_Swig::getSelected( int index )
+{
+ QString result = ProcessEvent( new TGetSelectedEvent( index ) );
+ return result.isEmpty() ? NULL : strdup(result.latin1());
+}
+
+/*!
+ Adds an object with the given entry to the selection.
+*/
+void SALOMEGUI_Swig::AddIObject( const char* theEntry )
+{
+ class TEvent: public SALOME_Event {
+ public:
+ QString myEntry;
+ TEvent( const char* theEntry ) : myEntry( theEntry ) {}
+ virtual void Execute() {
+ if ( SalomeApp_Application* anApp = getApplication() ) {
+ SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( anApp->activeStudy() ); // for sure!
+ LightApp_SelectionMgr* aSelMgr = anApp->selectionMgr();
+ if ( aStudy && aSelMgr ) {
+ SALOME_ListIO anIOList;
+ anIOList.Append( new SALOME_InteractiveObject( myEntry, "", "" ) );
+ aSelMgr->setSelectedObjects( anIOList, true );
+ }
+ }
+ }
+ };
+ ProcessVoidEvent( new TEvent( theEntry ) );
+}
+
+/*!
+ Removes the object with the given entry from the selection.
+*/
+void SALOMEGUI_Swig::RemoveIObject( const char* theEntry )
+{
+ class TEvent: public SALOME_Event {
+ public:
+ QString myEntry;
+ TEvent( const char* theEntry ) : myEntry( theEntry ) {}
+ virtual void Execute() {
+ if ( SalomeApp_Application* anApp = getApplication() ) {
+ SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( anApp->activeStudy() ); // for sure!
+ LightApp_SelectionMgr* aSelMgr = anApp->selectionMgr();
+ if ( aStudy && aSelMgr ) {
+ SALOME_ListIO anIOList;
+ // VSR: temporary solution, until LightApp_SelectionMgr::unsetSelectedObjects() method appears
+ // Lately this should be replaced by the following:
+ // anIOList.Append( new SALOME_InteractiveObject( myEntry, "", "" ) );
+ // aSelMgr->unsetSelectedObjects( anIOList );
+ ///////////////////////////////////////////////
+ aSelMgr->selectedObjects( anIOList );
+ SALOME_ListIteratorOfListIO anIter( anIOList );
+ for( ; anIter.More(); anIter.Next() ) {
+ if ( anIter.Value()->isSame( new SALOME_InteractiveObject( myEntry, "", "" ) ) ) {
+ anIOList.Remove( anIter );
+ aSelMgr->setSelectedObjects( anIOList, true );
+ return;
+ }
+ }
+ }
+ }
+ }
+ };
+ ProcessVoidEvent( new TEvent( theEntry ) );
+}
+
+/*!
+ Clears selection.
+*/
+void SALOMEGUI_Swig::ClearIObjects()
+{
+ class TEvent: public SALOME_Event {
+ public:
+ TEvent() {}
+ virtual void Execute() {
+ if ( SalomeApp_Application* anApp = getApplication() ) {
+ SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( anApp->activeStudy() ); // for sure!
+ LightApp_SelectionMgr* aSelMgr = anApp->selectionMgr();
+ if ( aStudy && aSelMgr )
+ aSelMgr->clearSelected();
+ }
+ }
+ };
+ ProcessVoidEvent( new TEvent() );
+}
+
+/*!
+ Displays an object in the current view window
+ (the presentable object should be previously created and displayed in this viewer).
+ VSR: For the current moment implemented for OCC and VTK viewers only.
+*/
+void SALOMEGUI_Swig::Display( const char* theEntry )
+{
+ class TEvent: public SALOME_Event {
+ QString myEntry;
+ public:
+ TEvent( const char* theEntry ) : myEntry( theEntry ) {}
+ virtual void Execute() {
+ if ( SalomeApp_Application* anApp = getApplication() ) {
+ SUIT_ViewWindow* window = anApp->desktop()->activeWindow();
+ if ( window ) {
+ SALOME_View* view = dynamic_cast<SALOME_View*>( window->getViewManager()->getViewModel() );
+ if ( view )
+ view->Display( view->CreatePrs( myEntry ) );
+ }
+ }
+ }
+ };
+ ProcessVoidEvent( new TEvent( theEntry ) );
+}
+
+/*!
+ Displays an object in the current view window and erases all other
+ (the presentable object should be previously created and displayed in this viewer).
+ VSR: For the current moment implemented for OCC and VTK viewers only.
+*/
+void SALOMEGUI_Swig::DisplayOnly( const char* theEntry )
+{
+ class TEvent: public SALOME_Event {
+ QString myEntry;
+ public:
+ TEvent( const char* theEntry ) : myEntry( theEntry ) {}
+ virtual void Execute() {
+ if ( SalomeApp_Application* anApp = getApplication() ) {
+ SUIT_ViewWindow* window = anApp->desktop()->activeWindow();
+ if ( window ) {
+ SALOME_View* view = dynamic_cast<SALOME_View*>( window->getViewManager()->getViewModel() );
+ if ( view ) {
+ view->EraseAll( false );
+ view->Display( view->CreatePrs( myEntry ) );
+ }
+ }
+ }
+ }
+ };
+ ProcessVoidEvent( new TEvent( theEntry ) );
+}
+
+/*!
+ Erases an object in the current view window
+ (the presentable object should be previously created and displayed in this viewer).
+ VSR: For the current moment implemented for OCC and VTK viewers only.
+*/
+void SALOMEGUI_Swig::Erase( const char* theEntry )
+{
+ class TEvent: public SALOME_Event {
+ QString myEntry;
+ public:
+ TEvent( const char* theEntry ) : myEntry( theEntry ) {}
+ virtual void Execute() {
+ if ( SalomeApp_Application* anApp = getApplication() ) {
+ SUIT_ViewWindow* window = anApp->desktop()->activeWindow();
+ if ( window ) {
+ SALOME_View* view = dynamic_cast<SALOME_View*>( window->getViewManager()->getViewModel() );
+ if ( view )
+ view->Erase( view->CreatePrs( myEntry ) );
+ }
+ }
+ }
+ };
+ ProcessVoidEvent( new TEvent( theEntry ) );
+}
+
+/*!
+ Displays all active module's child objects in the current view window
+ (the presentable objects should be previously created and displayed in this viewer).
+ VSR: For the current moment implemented for OCC and VTK viewers only.
+*/
+void SALOMEGUI_Swig::DisplayAll()
+{
+ class TEvent: public SALOME_Event {
+ public:
+ TEvent() {}
+ virtual void Execute() {
+ if ( SalomeApp_Application* anApp = getApplication() ) {
+ SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( anApp->activeStudy() ); // for sure!
+ SUIT_ViewWindow* window = anApp->desktop()->activeWindow();
+ SalomeApp_Module* activeModule = dynamic_cast<SalomeApp_Module*>( anApp->activeModule() );
+ if ( study && window && activeModule ) {
+ SALOME_View* view = dynamic_cast<SALOME_View*>( window->getViewManager()->getViewModel() );
+ if ( view ) {
+ for ( SUIT_DataObjectIterator it( activeModule->dataModel()->root(), SUIT_DataObjectIterator::DepthLeft ); it.current(); ++it ) {
+ SalomeApp_DataObject* obj = dynamic_cast<SalomeApp_DataObject*>( it.current() );
+ if ( obj && !obj->entry().isEmpty() )
+ view->Display( view->CreatePrs( obj->entry() ) );
+ }
+ }
+ }
+ }
+ }
+ };
+ ProcessVoidEvent( new TEvent() );
+}
+
+/*!
+ Erases all objects from the current view window
+ VSR: For the current moment implemented for OCC and VTK viewers only.
+*/
+void SALOMEGUI_Swig::EraseAll()
+{
+ class TEvent: public SALOME_Event {
+ public:
+ TEvent() {}
+ virtual void Execute() {
+ if ( SalomeApp_Application* anApp = getApplication() ) {
+ SUIT_ViewWindow* window = anApp->desktop()->activeWindow();
+ if ( window ) {
+ SALOME_View* view = dynamic_cast<SALOME_View*>( window->getViewManager()->getViewModel() );
+ if ( view )
+ view->EraseAll( false );
+ }
+ }
+ }
+ };
+ ProcessVoidEvent( new TEvent() );
+}
+
+/*!
+ Returns TRUE if the object with given entry is in the current viewer.
+ VSR: For the current moment implemented for OCC and VTK viewers only.
+*/
+class TIsInViewerEvent: public SALOME_Event {
+ QString myEntry;
+public:
+ typedef bool TResult;
+ TResult myResult;
+ TIsInViewerEvent( const char* theEntry ) : myEntry( theEntry ), myResult( false ) {}
+ virtual void Execute() {
+ if ( SalomeApp_Application* anApp = getApplication() ) {
+ SUIT_ViewWindow* window = anApp->desktop()->activeWindow();
+ if ( window ) {
+ SALOME_View* view = dynamic_cast<SALOME_View*>( window->getViewManager()->getViewModel() );
+ if ( view ) {
+ SALOME_Prs* aPrs = view->CreatePrs( myEntry );
+ myResult = aPrs->IsNull();
+ }
+ }
+ }
+ }
+};
+bool SALOMEGUI_Swig::IsInCurrentView( const char* theEntry )
+{
+ return ProcessEvent( new TIsInViewerEvent( theEntry ) );
+}
--- /dev/null
+# This is a Qt message file in .po format. Each msgid starts with
+# a scope. This scope should *NOT* be translated - eg. "Foo::Bar"
+# would be translated to "Pub", not "Foo::Pub".
+msgid ""
+msgstr ""
+"Project-Id-Version: example-Qt-message-extraction\n"
+"POT-Creation-Date: 1999-02-23 15:38+0200\n"
+"PO-Revision-Date: 1999-02-23 15:38+0200\n"
+"Last-Translator: \n"
+"Content-Type: text/plain; charset=iso-8859-1\n"
+
+msgid "ICON_DESK_DEFAULTICON"
+msgstr "default.png"
+
+msgid "ICON_APP_DEFAULTICON"
+msgstr "default.png"
+
+msgid "ICON_FILE_NEW"
+msgstr "new.png"
+
+msgid "ICON_FILE_OPEN"
+msgstr "open.png"
+
+msgid "ICON_FILE_SAVE"
+msgstr "save.png"
+
+msgid "ICON_FILE_CLOSE"
+msgstr "close.png"
+
+msgid "ICON_EDIT_CUT"
+msgstr "cut.png"
+
+msgid "ICON_EDIT_COPY"
+msgstr "copy.png"
+
+msgid "ICON_EDIT_PASTE"
+msgstr "paste.png"
+
+msgid "ICON_HELP"
+msgstr "help.png"
+
+msgid "ICON_PRINT"
+msgstr "print.png"
+
+msgid "ICON_RESET"
+msgstr "reset.png"
+
+msgid "ICON_DESK_WINDOW_CASCADE"
+msgstr "cascade.png"
+
+msgid "ICON_DESK_WINDOW_TILE"
+msgstr "tile.png"
+
+msgid "ICON_DESK_WINDOW_VTILE"
+msgstr "vtile.png"
+
+msgid "ICON_DESK_WINDOW_HTILE"
+msgstr "htile.png"
+
+msgid "ICON_DESK_WINDOW_VSPLIT"
+msgstr "vtile.png"
+
+msgid "ICON_DESK_WINDOW_HSPLIT"
+msgstr "htile.png"
+
+msgid "ICON_APP_EDIT_UNDO"
+msgstr "undo.png"
+
+msgid "ICON_APP_EDIT_REDO"
+msgstr "redo.png"
+
+msgid "SUIT_ViewPort::ICON_CURSOR_ROTATE"
+msgstr "cursor_rotate.png"
+
+msgid "SUIT_ViewPort::ICON_CURSOR_ZOOM"
+msgstr "cursor_zoom.png"
--- /dev/null
+# source path
+top_srcdir=@top_srcdir@
+top_builddir=../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@:@top_srcdir@/idl:@srcdir@/resources
+
+
+@COMMENCE@
+
+EXPORT_HEADERS = SUPERVGraph_ViewFrame.h \
+ SUPERVGraph_ViewManager.h \
+ SUPERVGraph_ViewModel.h \
+ SUPERVGraph.h
+
+# .po files to transmit in .qm
+PO_FILES = SUPERVGraph_images.po \
+ SUPERVGraph_msg_en.po
+
+# Libraries targets
+
+LIB = libSUPERVGraph.la
+LIB_SRC = SUPERVGraph.cxx \
+ SUPERVGraph_ViewFrame.cxx \
+ SUPERVGraph_ViewManager.cxx \
+ SUPERVGraph_ViewModel.cxx
+
+LIB_MOC = SUPERVGraph_moc.cxx \
+ SUPERVGraph_ViewFrame_moc.cxx \
+ SUPERVGraph_ViewManager_moc.cxx \
+ SUPERVGraph_ViewModel_moc.cxx
+
+RESOURCES_FILES = view_pan.png \
+ view_reset.png
+
+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
+
+
+@CONCLUDE@
--- /dev/null
+// SALOME SUPERVGraph : build Supervisor viewer into desktop
+//
+// 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 : SUPERVGraph.h
+// Author : Nicolas REJNERI
+// Module : SALOME
+// $Header$
+
+#ifndef SUPERVGraph_HeaderFile
+#define SUPERVGraph_HeaderFile
+
+#include "SUIT_Desktop.h"
+#include "SUIT_ViewWindow.h"
+
+#ifdef WNT
+#ifdef SUPERVGRAPH_EXPORTS
+#define SUPERVGRAPH_EXPORT __declspec(dllexport)
+#else
+#define SUPERVGRAPH_EXPORT __declspec(dllimport)
+#endif
+#else
+#define SUPERVGRAPH_EXPORT
+#endif
+
+#if defined WNT
+#pragma warning ( disable: 4251 )
+#endif
+
+class SUPERVGRAPH_EXPORT SUPERVGraph : public QObject
+{
+ Q_OBJECT
+
+public :
+
+ /*Standard_EXPORT*/ static SUIT_ViewWindow* createView ( SUIT_Desktop* parent);
+
+};
+
+#endif
--- /dev/null
+// SALOME SUPERVGraph : build Supervisor viewer into desktop
+//
+// 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 : SUPERVGraph_ViewFrame.cxx
+// Author : Nicolas REJNERI
+// Module : SALOME
+// $Header$
+
+#include "SUPERVGraph_ViewFrame.h"
+
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_Session.h>
+
+//QT Include
+#include <qlayout.h>
+#include <qcolordialog.h>
+
+using namespace std;
+
+
+SUPERVGraph_View::SUPERVGraph_View( QWidget* theParent ): QWidget( theParent )
+{
+ init(theParent);
+}
+
+SUPERVGraph_View::SUPERVGraph_View( SUPERVGraph_View* theParent ): QWidget( theParent )
+{
+ init(theParent);
+}
+
+void SUPERVGraph_View::contextMenuPopup( QPopupMenu* )
+{
+ // to be implemented
+}
+
+void SUPERVGraph_View::init( QWidget* theParent )
+{
+ if ( theParent->inherits( "QMainWindow" ) ) {
+ ( ( QMainWindow* )theParent )->setCentralWidget( this );
+ }
+ else {
+ QBoxLayout* layout = new QVBoxLayout( theParent );
+ layout->addWidget( this );
+ }
+
+}
+
+/*!
+ Constructor
+*/
+SUPERVGraph_ViewFrame::SUPERVGraph_ViewFrame( SUIT_Desktop* theDesktop )
+ : SUIT_ViewWindow( theDesktop )
+{
+ myView = 0;
+
+ //myView = new SUPERVGraph_View(this);
+ // Set BackgroundColor
+ /*
+ int R = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorRed").toInt();
+ int G = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorGreen").toInt();
+ int B = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorBlue").toInt();
+ setBackgroundColor(QColor(R,G,B));*/
+
+ myToolBar = new QToolBar(this);
+ myToolBar->setCloseMode(QDockWindow::Undocked);
+ myToolBar->setLabel(tr("LBL_TOOLBAR_LABEL"));
+ createActions();
+ createToolBar();
+}
+
+void SUPERVGraph_ViewFrame::createActions()
+{
+ if (!myActionsMap.isEmpty()) return;
+ SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+ QAction* aAction;
+
+ // Panning
+ aAction = new QAction(tr("MNU_PAN_VIEW"), aResMgr->loadPixmap( "SUPERVGraph", tr( "ICON_SUPERVGraph_PAN" ) ),
+ tr( "MNU_PAN_VIEW" ), 0, this);
+ aAction->setStatusTip(tr("DSC_PAN_VIEW"));
+ connect(aAction, SIGNAL(activated()), this, SLOT(onViewPan()));
+ myActionsMap[ PanId ] = aAction;
+
+ // Reset
+ aAction = new QAction(tr("MNU_RESET_VIEW"), aResMgr->loadPixmap( "SUPERVGraph", tr( "ICON_SUPERVGraph_RESET" ) ),
+ tr( "MNU_RESET_VIEW" ), 0, this);
+ aAction->setStatusTip(tr("DSC_RESET_VIEW"));
+ connect(aAction, SIGNAL(activated()), this, SLOT(onViewReset()));
+ myActionsMap[ ResetId ] = aAction;
+}
+
+//================================================================
+// Function : createToolBar
+// Purpose :
+//================================================================
+void SUPERVGraph_ViewFrame::createToolBar()
+{
+ myActionsMap[PanId]->addTo(myToolBar);
+ myActionsMap[ResetId]->addTo(myToolBar);
+}
+
+SUPERVGraph_ViewFrame::~SUPERVGraph_ViewFrame() {}
+
+/*!
+ Returns widget containing 3D-Viewer
+*/
+SUPERVGraph_View* SUPERVGraph_ViewFrame::getViewWidget()
+{
+ return myView;
+}
+
+
+void SUPERVGraph_ViewFrame::setViewWidget( SUPERVGraph_View* theView )
+{
+ myView = theView;
+}
+
+
+/*!
+ Display/hide Trihedron
+*/
+void SUPERVGraph_ViewFrame::onViewTrihedron()
+{
+// MESSAGE ( "SUPERVGraph_ViewFrame::onViewTrihedron" )
+}
+
+/*!
+ Provides top projection of the active view
+*/
+void SUPERVGraph_ViewFrame::onViewTop()
+{
+// MESSAGE ( "SUPERVGraph_ViewFrame::onViewTop" )
+}
+
+/*!
+ Provides bottom projection of the active view
+*/
+void SUPERVGraph_ViewFrame::onViewBottom()
+{
+// MESSAGE ( "SUPERVGraph_ViewFrame::onViewBottom" )
+}
+
+/*!
+ Provides left projection of the active view
+*/
+void SUPERVGraph_ViewFrame::onViewLeft()
+{
+// MESSAGE ( "SUPERVGraph_ViewFrame::onViewLeft" )
+}
+
+/*!
+ Provides right projection of the active view
+*/
+void SUPERVGraph_ViewFrame::onViewRight()
+{
+// MESSAGE ( "SUPERVGraph_ViewFrame::onViewRight" )
+}
+
+/*!
+ Provides back projection of the active view
+*/
+void SUPERVGraph_ViewFrame::onViewBack()
+{
+// MESSAGE ( "SUPERVGraph_ViewFrame::onViewBack" )
+}
+
+/*!
+ Provides front projection of the active view
+*/
+void SUPERVGraph_ViewFrame::onViewFront()
+{
+// MESSAGE ( "SUPERVGraph_ViewFrame::onViewFront" )
+}
+
+/*!
+ Reset the active view
+*/
+void SUPERVGraph_ViewFrame::onViewReset()
+{
+// MESSAGE ( "SUPERVGraph_ViewFrame::onViewReset" )
+ if (myView)
+ myView->ResetView();
+}
+
+/*!
+ Rotates the active view
+*/
+void SUPERVGraph_ViewFrame::onViewRotate()
+{
+// MESSAGE ( "SUPERVGraph_ViewFrame::onViewRotate" )
+}
+
+/*!
+ Sets a new center of the active view
+*/
+void SUPERVGraph_ViewFrame::onViewGlobalPan()
+{
+// MESSAGE ( "SUPERVGraph_ViewFrame::onViewGlobalPan" )
+}
+
+/*!
+ Zooms the active view
+*/
+void SUPERVGraph_ViewFrame::onViewZoom()
+{
+// MESSAGE ( "SUPERVGraph_ViewFrame::onViewZoom" )
+}
+
+/*!
+ Moves the active view
+*/
+void SUPERVGraph_ViewFrame::onViewPan()
+{
+// MESSAGE ( "SUPERVGraph_ViewFrame::onViewPan" )
+ if (myView != NULL)
+ myView->ActivatePanning();
+}
+
+/*!
+ Fits all obejcts within a rectangular area of the active view
+*/
+void SUPERVGraph_ViewFrame::onViewFitArea()
+{
+// MESSAGE ( "SUPERVGraph_ViewFrame::onViewFitArea" )
+}
+
+/*!
+ Fits all objects in the active view
+*/
+void SUPERVGraph_ViewFrame::onViewFitAll()
+{
+// MESSAGE ( "SUPERVGraph_ViewFrame::onViewFitAll" )
+}
+
+/*!
+ Set background of the viewport
+*/
+void SUPERVGraph_ViewFrame::setBackgroundColor( const QColor& color )
+{
+ if (myView)
+ myView->setPaletteBackgroundColor(color);
+}
+
+/*!
+ Returns background of the viewport
+*/
+QColor SUPERVGraph_ViewFrame::backgroundColor() const
+{
+ if (myView)
+ return myView->paletteBackgroundColor();
+ return QMainWindow::backgroundColor();
+}
+
+void SUPERVGraph_ViewFrame::onAdjustTrihedron()
+{
+// MESSAGE ( "SUPERVGraph_ViewFrame::onAdjustTrihedron" )
+}
+
+void SUPERVGraph_ViewFrame::rename( const Handle(SALOME_InteractiveObject)& IObject,
+ QString newName )
+{
+// MESSAGE ( "SUPERVGraph_ViewFrame::rename" )
+}
+
+void SUPERVGraph_ViewFrame::unHighlightAll()
+{
+// MESSAGE ( "SUPERVGraph_ViewFrame::unHighlightAll" )
+}
+
+void SUPERVGraph_ViewFrame::highlight( const Handle(SALOME_InteractiveObject)& IObject,
+ bool highlight, bool immediatly )
+{
+// MESSAGE ( "SUPERVGraph_ViewFrame::highlight" )
+}
+
+bool SUPERVGraph_ViewFrame::isInViewer( const Handle(SALOME_InteractiveObject)& IObject )
+{
+// MESSAGE ( "SUPERVGraph_ViewFrame::isInViewer" )
+ return false;
+}
+
+bool SUPERVGraph_ViewFrame::isVisible( const Handle(SALOME_InteractiveObject)& IObject )
+{
+// MESSAGE ( "SUPERVGraph_ViewFrame::isVisible" )
+ return false;
+}
+
+void SUPERVGraph_ViewFrame::resizeEvent( QResizeEvent* theEvent )
+{
+ QMainWindow::resizeEvent( theEvent );
+ if ( myView ) myView->resizeView( theEvent );
+}
--- /dev/null
+// SALOME SUPERVGraph : build Supervisor viewer into desktop
+//
+// 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 : SUPERVGraph_ViewFrame.h
+// Author : Nicolas REJNERI
+// Module : SALOME
+// $Header$
+
+#ifndef SUPERVGraph_ViewFrame_H
+#define SUPERVGraph_ViewFrame_H
+
+#include "SUPERVGraph.h"
+
+#include "SALOME_InteractiveObject.hxx"
+#include "SUIT_PopupClient.h"
+#include "SUIT_ViewWindow.h"
+
+#include <qaction.h>
+
+class SUPERVGRAPH_EXPORT SUPERVGraph_View: public QWidget, public SUIT_PopupClient {
+ Q_OBJECT;
+ public:
+ static QString Type() { return "SUPERVGraphViewer"; }
+
+ SUPERVGraph_View(QWidget* theParent);
+ SUPERVGraph_View(SUPERVGraph_View* theParent);
+
+ virtual void ActivatePanning() = 0;
+ virtual void ResetView() = 0;
+
+ /* redefine functions from SUIT_PopupClient */
+ virtual QString popupClientType() const { return Type(); }
+ virtual void contextMenuPopup( QPopupMenu* );
+
+ virtual void resizeView( QResizeEvent* theEvent ) {};
+
+ protected:
+ void init(QWidget* theParent);
+
+};
+
+class SUPERVGRAPH_EXPORT SUPERVGraph_ViewFrame : public SUIT_ViewWindow {
+ Q_OBJECT
+
+ public:
+ SUPERVGraph_ViewFrame(SUIT_Desktop* theDesktop );
+ ~SUPERVGraph_ViewFrame();
+
+ SUPERVGraph_View* getViewWidget();
+ void setViewWidget(SUPERVGraph_View* theView);
+
+ void setBackgroundColor( const QColor& );
+ QColor backgroundColor() const;
+
+ void onAdjustTrihedron( );
+
+ /* interactive object management */
+ void highlight( const Handle(SALOME_InteractiveObject)& IObject,
+ bool highlight, bool immediatly = true );
+ void unHighlightAll();
+ void rename( const Handle(SALOME_InteractiveObject)& IObject,
+ QString newName );
+ bool isInViewer( const Handle(SALOME_InteractiveObject)& IObject );
+ bool isVisible( const Handle(SALOME_InteractiveObject)& IObject );
+
+ /* selection */
+ Handle(SALOME_InteractiveObject) FindIObject(const char* Entry) { Handle(SALOME_InteractiveObject) o; return o; };
+
+ /* display */
+ void Display(const Handle(SALOME_InteractiveObject)& IObject, bool immediatly = true){};
+ void DisplayOnly(const Handle(SALOME_InteractiveObject)& IObject){};
+ void Erase(const Handle(SALOME_InteractiveObject)& IObject, bool immediatly = true){};
+ void DisplayAll(){};
+ void EraseAll(){};
+ void Repaint() {};
+
+ QToolBar* getToolBar() { return myToolBar; }
+
+ public slots:
+ void onViewPan();
+ void onViewZoom();
+ void onViewFitAll();
+ void onViewFitArea();
+ void onViewGlobalPan();
+ void onViewRotate();
+ void onViewReset();
+ void onViewFront();
+ void onViewBack();
+ void onViewRight();
+ void onViewLeft();
+ void onViewBottom();
+ void onViewTop();
+ void onViewTrihedron();
+
+ protected:
+ void resizeEvent( QResizeEvent* theEvent );
+
+ private:
+ void createActions();
+ void createToolBar();
+
+ //! Actions ID
+ enum { PanId, ResetId };
+ typedef QMap<int, QAction*> ActionsMap;
+
+ ActionsMap myActionsMap;
+ QToolBar* myToolBar;
+
+ SUPERVGraph_View* myView;
+};
+#endif
--- /dev/null
+// File: SUPERVGraph_images.po
+// Created: 11/22/2005 10:52:37 PM
+// Author: Margarita Karpunina
+// Copyright (C) CEA 2005
+
+msgid "ICON_SUPERVGraph_PAN"
+msgstr "view_pan.png"
+
+msgid "ICON_SUPERVGraph_RESET"
+msgstr "view_reset.png"
+
--- /dev/null
+// File: SUPERVGraph_msg_en.po
+// Created: 11/22/2005 10:55:36 PM
+// Author: Margarita Karpunina
+// Copyright (C) CEA 2005
+
+msgid "LBL_TOOLBAR_LABEL"
+msgstr "View Operations"
+
+msgid "DSC_RESET_VIEW"
+msgstr "Reset View Point"
+
+msgid "MNU_RESET_VIEW"
+msgstr "Reset"
+
+msgid "DSC_PAN_VIEW"
+msgstr "Panning the view"
+
+msgid "MNU_PAN_VIEW"
+msgstr "Panning"
--- /dev/null
+# SALOME Session : implementation of Session.idl
+#
+# 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 : Paul RASCLE, EDF
+# Module : SALOME
+# $Header$
+
+# source path
+top_srcdir=@top_srcdir@
+top_builddir=../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@:@top_srcdir@/idl
+
+
+@COMMENCE@
+
+EXPORT_HEADERS= Session_Session_i.hxx \
+ Session_ServerLauncher.hxx \
+ Session_ServerThread.hxx \
+ SalomeApp_Engine_i.hxx
+
+# Libraries targets
+LIB = libSalomeSession.la
+
+LIB_SRC=Session_Session_i.cxx \
+ Session_ServerThread.cxx \
+ Session_ServerLauncher.cxx \
+ Session_SignalsHandler.cxx \
+ SalomeApp_Engine_i.cxx \
+ InquireServersQThread.cxx
+
+LIB_MOC = InquireServersQThread.h
+
+# Executables targets
+BIN = SALOME_Session_Server
+BIN_SRC =
+LIB_SERVER_IDL = SALOME_Session.idl SalomeApp_Engine.idl
+BIN_SERVER_IDL =
+BIN_CLIENT_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Component.idl SALOME_Registry.idl SALOME_ModuleCatalog.idl SALOME_Exception.idl SALOME_GenericObj.idl
+
+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)
+
+LDFLAGSFORBIN= $(LDFLAGS) $(OMNIORB_LIBS) $(HDF5_LIBS) -lqtx -lSalomeContainer -lSalomeResourcesManager -lTOOLSDS -lSalomeHDFPersist -lSalomeDSImpl -lSalomeGenericObj -lRegistry -lSalomeNotification -lSALOMEBasics
+
+@CONCLUDE@
+
--- /dev/null
+# SALOME TOOLSGUI : implementation of desktop "Tools" optioins
+#
+# 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 : Marc Tajchman (CEA)
+# Module : SALOME
+# $Header$
+
+top_srcdir=@top_srcdir@
+top_builddir=../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@:@top_srcdir@/idl:@srcdir@/resources
+
+
+@COMMENCE@
+
+# header files
+EXPORT_HEADERS = ToolsGUI.h \
+ ToolsGUI_RegWidget.h \
+ ToolsGUI_CatalogGeneratorDlg.h
+
+# .po files to transform in .qm
+PO_FILES = ToolsGUI_icons.po \
+ ToolsGUI_msg_en.po
+
+# Libraries targets
+LIB = libToolsGUI.la
+
+LIB_SRC = ToolsGUI_CatalogGeneratorDlg.cxx \
+ ToolsGUI_HelpWindow.cxx \
+ ToolsGUI_RegWidget.cxx \
+ ToolsGUI_IntervalWindow.cxx \
+ ToolsGUI.cxx
+
+LIB_MOC = ToolsGUI_CatalogGeneratorDlg.h \
+ ToolsGUI_RegWidget.h
+
+LIB_CLIENT_IDL = SALOME_Registry.idl SALOME_Exception.idl
+
+CPPFLAGS += $(QT_INCLUDES) $(OCC_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
+CXXFLAGS += $(OCC_CXXFLAGS) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
+
+LDFLAGS += $(QT_MT_LIBS) -lsuit $(CAS_KERNEL) -L$(KERNEL_ROOT_DIR)/lib/salome -lSalomeNS -lOpUtil
+
+@CONCLUDE@
+