AC_ARG_WITH(opengl,
[AC_HELP_STRING([--with-opengl=DIR],[root directory path of OpenGL installation])],
[opengl_dir="$withval"],
- [dirs="/usr/lib${LIB_LOCATION_SUFFIX} /usr/local/lib${LIB_LOCATION_SUFFIX} /opt/graphics/OpenGL/lib${LIB_LOCATION_SUFFIX} /usr/openwin/lib${LIB_LOCATION_SUFFIX} /usr/X11R6/lib${LIB_LOCATION_SUFFIX}"])dnl
+ [dirs="/usr/lib64 /usr/lib /usr/local/lib64 /usr/local/lib /opt/graphics/OpenGL/lib64 /opt/graphics/OpenGL/lib /usr/openwin/lib64 /usr/openwin/lib /usr/X11R6/lib64 /usr/X11R6/lib"])dnl
AC_CHECKING(for OpenGL)
AC_CHECKING(for OpenGL headers)
for idir in $dirs; do
if test -r "${idir}/libGL.so"; then
AC_MSG_RESULT(in ${idir})
- if test "x${idir}" = "x/usr/lib${LIB_LOCATION_SUFFIX}" ; then
+ if test "x${idir}" = "x/usr/lib64" -o "x${idir}" = "x/usr/lib" ; then
GL_LIB_PATH=""
else
GL_LIB_PATH="-L${idir}"
# under IRIX ?
if test -r "${idir}/libGL.sl"; then
AC_MSG_RESULT(in ${idir})
- if test "x${idir}" = "x/usr/lib${LIB_LOCATION_SUFFIX}" ; then
+ if test "x${idir}" = "x/usr/lib64" -o "x${idir}" = "x/usr/lib" ; then
GL_LIB_PATH=""
else
GL_LIB_PATH="-L${idir}"
for idir in $dirs; do
if test -r "${idir}/libGLU.so"; then
AC_MSG_RESULT(in ${idir})
- if test "x${idir}" = "x/usr/lib${LIB_LOCATION_SUFFIX}" ; then
+ if test "x${idir}" = "x/usr/lib64" -o "x${idir}" = "x/usr/lib" ; then
GLU_LIB_PATH=""
else
GLU_LIB_PATH="-L${idir}"
# under IRIX ?
if test -r "${idir}/libGLU.sl"; then
AC_MSG_RESULT(in ${idir})
- if test "x${idir}" = "x/usr/lib${LIB_LOCATION_SUFFIX}" ; then
+ if test "x${idir}" = "x/usr/lib64" -o "x${idir}" = "x/usr/lib" ; then
GLU_LIB_PATH=""
else
GLU_LIB_PATH="-L${idir}"
AC_CHECKING(for qwt)
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
+
qwt_ok=yes
-dnl were is qwt ?
+dnl where is qwt ?
AC_ARG_WITH(qwt,
[ --with-qwt=DIR directory path to QWT installation ],
AC_ARG_WITH(qwt_inc,
[ --with-qwt_inc=DIR directory path to QWT includes ],
- [QWT_INCLUDES="$withval"
+ [QWT_INCDIR="$withval"
AC_MSG_RESULT("select $withval as path to QWT includes")
])
if test -z $QWTHOME; then
AC_MSG_RESULT(QWTHOME not defined)
- exits_ok=no
- if test "x$exits_ok" = "xno"; then
+ exist_ok=no
+ if test "x$exist_ok" = "xno"; then
for d in /usr/local /usr ; do
- AC_CHECK_FILE(${d}/lib${LIB_LOCATION_SUFFIX}/libqwt.so,exits_ok=yes,exits_ok=no)
- if test "x$exits_ok" = "xyes"; then
+ AC_CHECK_FILE(${d}/lib${LIB_LOCATION_SUFFIX}/libqwt.so,exist_ok=yes,exist_ok=no)
+ if test "x$exist_ok" = "xyes"; then
QWTHOME=$d
AC_MSG_RESULT(libqwt.so detected in $d/lib)
fi
done
fi
- if test "x$exits_ok" = "xno"; then
+ if test "x$exist_ok" = "xno"; then
for d in `echo $LD_LIBRARY_PATH | sed -e "s/:/ /g"` ; do
if test -f $d/libqwt.so ; then
AC_MSG_RESULT(libqwt.so detected in $d)
QWTHOME=$d
QWTHOME=`echo ${QWTHOME} | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
- exits_ok=yes
+ exist_ok=yes
break
fi
done
fi
- if test "x$exits_ok" = "xyes"; then
- if test -z $QWT_INCLUDES; then
- QWT_INCLUDES=$QWTHOME"/include/qwt"
- if test ! -f $QWT_INCLUDES/qwt.h ; then
- QWT_INCLUDES=$QWTHOME"/include"
+ if test "x$exist_ok" = "xyes"; then
+ if test -z $QWT_INCDIR; then
+ QWT_INCDIR=$QWTHOME"/include/qwt"
+ if test ! -f $QWT_INCDIR/qwt.h ; then
+ QWT_INCDIR=$QWTHOME"/include"
fi
- if test ! -f $QWT_INCLUDES/qwt.h ; then
- QWT_INCLUDES=/usr/lib/qt4/include/qwt
+ if test ! -f $QWT_INCDIR/qwt.h ; then
+ QWT_INCDIR=/usr/lib/qt4/include/qwt
fi
fi
+ else
+ qwt_ok=no
fi
else
- if test -z $QWT_INCLUDES; then
- QWT_INCLUDES="$QWTHOME/include"
+ if test -z $QWT_INCDIR; then
+ QWT_INCDIR="$QWTHOME/include"
fi
fi
AC_MSG_WARN(qwt not found)
qwt_ok=no
else
- AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
- CPPFLAGS_old=$CPPFLAGS
- CPPFLAGS="$CPPFLAGS -I$QWT_INCLUDES"
- CPPFLAGS="$CPPFLAGS $QT_INCLUDES"
+ CPPFLAGS_old=$CPPFLAGS
+ CPPFLAGS="$CPPFLAGS $QT_INCLUDES -I$QWT_INCDIR"
- AC_CHECK_HEADER(qwt.h,qwt_ok=yes,qwt_ok=no)
+ AC_CHECK_HEADER(qwt.h,qwt_ok=yes,qwt_ok=no)
+ CPPFLAGS=$CPPFLAGS_old
- CPPFLAGS=$CPPFLAGS_old
+ AC_MSG_CHECKING(include of qwt headers)
- if test "x$qwt_ok" = xno ; then
- AC_MSG_RESULT(no)
- AC_MSG_WARN(qwt not found)
+ if test "x$qwt_ok" = xno ; then
+ AC_MSG_RESULT(no)
+ AC_MSG_WARN(qwt not found)
else
- qwt_ok=yes
+ AC_MSG_RESULT(yes)
+ QWT_INCLUDES=-I$QWT_INCDIR
fi
-#
-# test Qwt libraries
-#
-if test "x$qwt_ok" = "xyes"
-then
- AC_MSG_CHECKING(linking qwt library)
- LIBS_old=$LIBS
- if test "x$QTDIR" = "x/usr"
- then
- QT_LIB_DIR=""
- else
- QT_LIB_DIR="-L$QTDIR/lib${LIB_LOCATION_SUFFIX}"
- fi
- LIBS="$LIBS $QT_LIB_DIR -lQtCore -lQtGui"
+ #
+ # test Qwt libraries
+ #
+ if test "x$qwt_ok" = "xyes" ; then
+ AC_MSG_CHECKING(linking qwt library)
- if test "x$QWTHOME" = "x/usr"
- then
- LIBS="$LIBS -lqwt"
- else
- LIBS="$LIBS -L$QWTHOME/lib -lqwt"
- fi
+ LIBS_old=$LIBS
+ LIBS="$LIBS $QT_LIBS"
+ if test "x$QWTHOME" = "x/usr" ; then
+ LIBS="$LIBS -lqwt"
+ else
+ LIBS="$LIBS -L$QWTHOME/lib -lqwt"
+ fi
- CXXFLAGS_old=$CXXFLAGS
- CXXFLAGS="$CXXFLAGS $QT_INCLUDES -I$QWT_INCLUDES"
+ CXXFLAGS_old=$CXXFLAGS
+ CXXFLAGS="$CXXFLAGS $QT_INCLUDES $QWT_INCLUDES"
- AC_CACHE_VAL(salome_cv_lib_qwt,[
- AC_TRY_LINK(
+ AC_CACHE_VAL(salome_cv_lib_qwt,[
+ AC_TRY_LINK(
#include <QApplication>
#include <qwt_plot.h>
-, int n;
- char **s;
- QApplication a(n, s);
- QwtPlot p;
- p.resize( 600, 400 );
- p.show();
- a.exec();,
- eval "salome_cv_lib_qwt=yes",eval "salome_cv_lib_qwt=no")
- ])
- qwt_ok="$salome_cv_lib_qwt"
-
- if test "x$qwt_ok" = "xno"
- then
- AC_MSG_RESULT(unable to link with qwt library)
- AC_MSG_RESULT(QWTHOME environment variable may be wrong)
- else
- QWT_INCLUDES="-I$QWT_INCLUDES"
- if test "x$QWTHOME" = "x/usr"
- then
- QWT_LIBS=" -lqwt"
+, int n;
+ char **s;
+ QApplication a(n, s);
+ QwtPlot p;
+ p.resize( 600, 400 );
+ p.show();
+ a.exec();,
+ eval "salome_cv_lib_qwt=yes",eval "salome_cv_lib_qwt=no")
+ ])
+ qwt_ok="$salome_cv_lib_qwt"
+
+ if test "x$qwt_ok" = "xno" ; then
+ AC_MSG_RESULT(unable to link with qwt library)
+ AC_MSG_RESULT(QWTHOME environment variable may be wrong)
else
- QWT_LIBS="-L$QWTHOME/lib -lqwt"
+ AC_MSG_RESULT(yes)
+ if test "x$QWTHOME" = "x/usr" ; then
+ QWT_LIBS=" -lqwt"
+ else
+ QWT_LIBS="-L$QWTHOME/lib -lqwt"
+ fi
fi
- AC_SUBST(QWT_INCLUDES)
- AC_SUBST(QWT_LIBS)
-
- AC_MSG_RESULT(yes)
+ LIBS=$LIBS_old
+ CXXFLAGS=$CXXFLAGS_old
fi
-
- LIBS=$LIBS_old
- CXXFLAGS=$CXXFLAGS_old
-
fi
+AC_SUBST(QWT_INCLUDES)
+AC_SUBST(QWT_LIBS)
- AC_LANG_RESTORE
+AC_LANG_RESTORE
-fi
+AC_MSG_RESULT(for qwt: $qwt_ok)
+# Save cache
+AC_CACHE_SAVE
])dnl
dnl
functionality which can be accessed by locking on them with left mouse
button.
-\image html image95.gif "Viewer Toolbar"
+\image html occviewer_toolbar.png "Viewer Toolbar"
<hr>
\image html image77.gif
(clipping planes) of geometrical objects.</center>
\image html clipping.png
-
<ul>
<li><b>Base point</b> - allows to define the coordinates of the base
point for the clipping plane.</li>
<li><b>Preview</b> - allows to see the results of clipping in the
viewer.</li>
</ul>
+<hr>
+\image html occviewer_axialscale.png
+\n <center><b>Scaling</b> - represents objects deformed (stretched or
+stuffed) along the axes of coordinates.</center>
+
+<b>Note!</b> OCC Viewer features a special <b>Polyline Selection</b> mechanism, which allows selecting an arbitraty part of the graphic area using a polygon frame, instead of the usual selection with a rectangular frame.
+
+To produce a Polyline Selection, lock the right mouse button and draw the first side of the polygon, then change the direction by clicking the left mouse button add draw another side, etc. The whole selection frame is drawn with the locked right mouse button.
+
+\image html polyselection1.png
+
+As a result, only the nodes within the frame are selected.
+
+\image html polyselection2.png
-*/
\ No newline at end of file
+*/
\image html loadstudy2.png
+\par
+Alternatively, it is possible to select <b>File > Most Recently Used > </b> to select a study from the list.
+
+
\n\b Tip: After opening an existing study, you will see its structure
in the \ref using_object_browser_page "Object Browser". It will contain the objects created with the
help of different components during the previous study session. If you
return myApp;
}
+/*!
+ \brief If return false, selection will be cleared at module activation
+*/
+bool CAM_Module::isSelectionCompatible()
+{
+ return false;
+}
+
/*!
\brief Activate module.
void onInfoChanged( QString );
protected:
+ virtual bool isSelectionCompatible();
+
virtual CAM_DataModel* createDataModel();
void setName( const QString& );
#include <QtxDockWidget.h>
#include <QtxActionToolMgr.h>
#include <QtxSearchTool.h>
+#include <QtxWorkstack.h>
#include <LogWindow.h>
#include <QMenu>
#include <QProcess>
+#include <utilities.h>
+
#define FIRST_HELP_ID 1000000
#ifndef DISABLE_SALOMEOBJECT
const int accel )
{
QAction* a = createAction( id, tr( QString( "NEW_WINDOW_%1" ).arg( suffix ).toLatin1().constData() ), QIcon(),
- tr( QString( "NEW_WINDOW_%1" ).arg( suffix ).toLatin1().constData() ),
- tr( QString( "NEW_WINDOW_%1" ).arg( suffix ).toLatin1().constData() ),
- accel, desktop(), false, this, SLOT( onNewWindow() ) );
+ tr( QString( "NEW_WINDOW_%1" ).arg( suffix ).toLatin1().constData() ),
+ tr( QString( "NEW_WINDOW_%1" ).arg( suffix ).toLatin1().constData() ),
+ accel, desktop(), false, this, SLOT( onNewWindow() ) );
createMenu( a, parentId, -1 );
}
if ( icon.isNull() )
{
icon = modIcon;
- printf( "****************************************************************\n" );
- printf( "* Icon for %s not found. Using the default one.\n", (*it).toLatin1().constData() );
- printf( "****************************************************************\n" );
+ INFOS ( "****************************************************************" << std::endl
+ << "* Icon for " << (*it).toLatin1().constData() << " not found. Using the default one." << std::endl
+ << "****************************************************************" << std::endl );
}
icon = Qtx::scaleIcon( icon, iconSize );
// New window
int windowMenu = createMenu( tr( "MEN_DESK_WINDOW" ), -1, MenuWindowId, 100 );
int newWinMenu = createMenu( tr( "MEN_DESK_NEWWINDOW" ), windowMenu, -1, 0 );
- createMenu( separator(), windowMenu, -1, 1 );
+ createAction( CloseId, tr( "TOT_CLOSE" ), QIcon(), tr( "MEN_DESK_CLOSE" ), tr( "PRP_CLOSE" ),
+ Qt::SHIFT+Qt::Key_C, desk, false, this, SLOT( onCloseWindow() ) );
+ createAction( CloseAllId, tr( "TOT_CLOSE_ALL" ), QIcon(), tr( "MEN_DESK_CLOSE_ALL" ), tr( "PRP_CLOSE_ALL" ),
+ 0, desk, false, this, SLOT( onCloseAllWindow() ) );
+ createAction( GroupAllId, tr( "TOT_GROUP_ALL" ), QIcon(), tr( "MEN_DESK_GROUP_ALL" ), tr( "PRP_GROUP_ALL" ),
+ 0, desk, false, this, SLOT( onGroupAllWindow() ) );
+
+ createMenu( CloseId, windowMenu, 0, -1 );
+ createMenu( CloseAllId, windowMenu, 0, -1 );
+ createMenu( GroupAllId, windowMenu, 0, -1 );
+ createMenu( separator(), windowMenu, -1, 0 );
#ifndef DISABLE_GLVIEWER
createActionForViewer( NewGLViewId, newWinMenu, QString::number( 0 ), Qt::ALT+Qt::Key_G );
pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), vtkGroup,
LightApp_Preferences::Color, "VTKViewer", "background" );
pref->addPreference( tr( "PREF_RELATIVE_SIZE" ), vtkGroup, LightApp_Preferences::Bool, "VTKViewer", "relative_size" );
+ pref->addPreference( tr( "PREF_USE_ADVANCED_SELECTION_ALGORITHM" ), vtkGroup,
+ LightApp_Preferences::Bool, "VTKViewer", "use_advanced_selection_algorithm" );
pref->setItemProperty( "min", 1.0E-06, vtkTS );
pref->setItemProperty( "max", 150, vtkTS );
if ( mru_load )
{
QtxMRUAction* mru = ::qobject_cast<QtxMRUAction*>( action( MRUId ) );
- if ( mru )
+ if ( mru ) {
+ mru->setVisibleCount( aResMgr->integerValue( "MRU", "max_count", 5 ) );
mru->loadLinks( aResMgr, "MRU" );
+ }
mru_load = false;
}
w->setWindowTitle( name );
}
+/*!
+ Closes active window of desktop
+*/
+void LightApp_Application::onCloseWindow()
+{
+ if( !desktop() )
+ return;
+
+ QWidget* w = desktop()->activeWindow();
+ if( !w )
+ return;
+
+ w->close();
+}
+
+/*!
+ Closes all windows of desktop
+*/
+void LightApp_Application::onCloseAllWindow()
+{
+ STD_TabDesktop* desk = dynamic_cast<STD_TabDesktop*>( desktop() );
+ if( !desk )
+ return;
+
+ QList<SUIT_ViewWindow*> wndList = desk->windows();
+ SUIT_ViewWindow* wnd;
+ foreach( wnd, wndList )
+ {
+ if ( wnd )
+ wnd->close();
+ }
+}
+
+/*!
+ Groups all windows of desktop
+*/
+void LightApp_Application::onGroupAllWindow()
+{
+ STD_TabDesktop* desk = dynamic_cast<STD_TabDesktop*>( desktop() );
+ if( !desk )
+ return;
+
+ QtxWorkstack* wgStack = desk->workstack();
+ if ( wgStack )
+ wgStack->stack();
+}
+
/*!
\return if the library of module exists
\param moduleTitle - title of module
if ( !isLibFound )
{
- printf( "****************************************************************\n" );
- printf( "* Warning: library %s cannot be found\n", lib.toLatin1().constData() );
- printf( "* Module will not be available\n" );
- printf( "* Module %s will not be available in GUI mode\n", moduleTitle.toLatin1().constData() );
- printf( "****************************************************************\n" );
+ INFOS( "****************************************************************" << std::endl
+ << "* Warning: library " << lib.toLatin1().constData() << " cannot be found" << std::endl
+ << "* Module " << moduleTitle.toLatin1().constData() << " will not be available in GUI mode" << std::endl
+ << "****************************************************************" << std::endl );
}
else if ( !isPythonModule )
return true;
enum { MenuWindowId = 6 };
- enum { RenameId = CAM_Application::UserID, PreferencesId, MRUId, ModulesListId,
+ enum { RenameId = CAM_Application::UserID,
+ CloseId, CloseAllId, GroupAllId,
+ PreferencesId, MRUId, ModulesListId,
NewGLViewId, NewPlot2dId, NewOCCViewId, NewVTKViewId, NewQxGraphViewId, UserID };
protected:
void onPreferences();
void onPreferenceChanged( QString&, QString&, QString& );
void onRenameWindow();
+ void onCloseWindow();
+ void onCloseAllWindow();
+ void onGroupAllWindow();
protected:
void updateWindows();
#include "LightApp_SwitchOp.h"
#include "LightApp_UpdateFlags.h"
#include "LightApp_ShowHideOp.h"
+#include "LightApp_SelectionMgr.h"
#include <SUIT_DataBrowser.h>
#include <SUIT_Study.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_Desktop.h>
+#include <SALOME_ListIO.hxx>
+#include <SALOME_ListIteratorOfListIO.hxx>
+
#ifndef DISABLE_VTKVIEWER
#ifndef DISABLE_SALOMEOBJECT
#include <SVTK_ViewWindow.h>
{
}
+/*! \brief If return false, selection will be cleared at module activation
+ */
+bool LightApp_Module::isSelectionCompatible()
+{
+ // return true if selected objects belong to this module
+ bool isCompatible = true;
+ SALOME_ListIO selected;
+ if ( LightApp_SelectionMgr *Sel = getApp()->selectionMgr() )
+ Sel->selectedObjects( selected );
+
+ LightApp_Study* aStudy = dynamic_cast<LightApp_Study*>( getApp()->activeStudy() );
+ LightApp_DataObject* aRoot = dynamic_cast<LightApp_DataObject*>( dataModel()->root() );
+ if ( aStudy && aRoot ) {
+ // my data type
+ QString moduleDataType = aRoot->componentDataType();
+ // check data type of selection
+ SALOME_ListIteratorOfListIO It( selected );
+ for ( ; isCompatible && It.More(); It.Next()) {
+ Handle(SALOME_InteractiveObject)& io = It.Value();
+ isCompatible = ( aStudy->componentDataType( io->getEntry() ) == moduleDataType );
+ }
+ }
+ return isCompatible;
+}
+
/*!Activate module.*/
bool LightApp_Module::activateModule( SUIT_Study* study )
{
bool res = CAM_Module::activateModule( study );
+ if ( !isSelectionCompatible() )// PAL19290, PAL18352
+ getApp()->selectionMgr()->clearSelected();
+
if ( res && application() && application()->resourceMgr() )
application()->resourceMgr()->raiseTranslators( name() );
virtual void updateControls();
+ virtual bool isSelectionCompatible();
+
private:
typedef QMap<int,LightApp_Operation*> MapOfOperation;
QPushButton* newButton = new QPushButton( button, this );
+ if ( myButtons.empty() ) newButton->setDefault( true );
+
myButtons.insert( newButton, bid );
myButtonLayout->insertWidget( myButtonLayout->count()-3, newButton );
connect( newButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
<!-- "Open/Save File" dialog box preferences-->
<parameter name="QuickDirList" value=""/>
</section>
+ <section name="MRU" >
+ <!-- Max number of "Most recently used" studies-->
+ <parameter name="max_count" value="7"/>
+ </section>
<section name="Study">
<!-- General study settings -->
<parameter name="store_positions" value="true" />
<!-- OCC viewer preferences -->
<parameter name="background" value="0, 0, 0"/>
<parameter name="trihedron_size" value="100" />
+ <parameter name="relative_size" value="true" />
+ <parameter name="use_advanced_selection_algorithm" value="true" />
</section>
<section name="Plot2d" >
<!-- Plot2d viewer preferences -->
<source>PYTHON_CONSOLE</source>
<translation>Python Console</translation>
</message>
+ <message>
+ <source>PREF_USE_ADVANCED_SELECTION_ALGORITHM</source>
+ <translation>Use Advanced Selection Algorithm</translation>
+ </message>
+ <message>
+ <source>TOT_CLOSE</source>
+ <translation>Close</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_CLOSE</source>
+ <translation>&Close</translation>
+ </message>
+ <message>
+ <source>PRP_CLOSE</source>
+ <translation>Close active window</translation>
+ </message>
+ <message>
+ <source>TOT_CLOSE_ALL</source>
+ <translation>Close all</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_CLOSE_ALL</source>
+ <translation>Close all</translation>
+ </message>
+ <message>
+ <source>PRP_CLOSE_ALL</source>
+ <translation>Close all windows</translation>
+ </message>
+ <message>
+ <source>TOT_GROUP_ALL</source>
+ <translation>Group all</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_GROUP_ALL</source>
+ <translation>&Group all</translation>
+ </message>
+ <message>
+ <source>PRP_GROUP_ALL</source>
+ <translation>Group all windows</translation>
+ </message>
+ <message>
+ <source>ERR_DOC_NOT_EXISTS</source>
+ <translation>Can not open %1.
+File does not exist</translation>
+ </message>
</context>
<context>
<name>LightApp_Module</name>
OCCViewer_CreateRestoreViewDlg.h \
OCCViewer.h \
OCCViewer_ClippingDlg.h \
+ OCCViewer_AxialScaleDlg.h \
OCCViewer_SetRotationPointDlg.h
dist_libOCCViewer_la_SOURCES= \
OCCViewer_VService.cxx \
OCCViewer_CreateRestoreViewDlg.cxx \
OCCViewer_SetRotationPointDlg.cxx \
- OCCViewer_ClippingDlg.cxx
+ OCCViewer_ClippingDlg.cxx \
+ OCCViewer_AxialScaleDlg.cxx
MOC_FILES= \
OCCViewer_AISSelector_moc.cxx \
OCCViewer_ViewManager_moc.cxx \
OCCViewer_CreateRestoreViewDlg_moc.cxx \
OCCViewer_SetRotationPointDlg_moc.cxx \
- OCCViewer_ClippingDlg_moc.cxx
+ OCCViewer_ClippingDlg_moc.cxx \
+ OCCViewer_AxialScaleDlg_moc.cxx
nodist_libOCCViewer_la_SOURCES= $(MOC_FILES)
dist_salomeres_DATA = \
resources/occ_view_clone.png \
resources/occ_view_clipping.png \
resources/occ_view_clipping_pressed.png \
+ resources/occ_view_scaling.png \
resources/occ_view_fitall.png \
resources/occ_view_fitarea.png \
resources/occ_view_front.png \
--- /dev/null
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "OCCViewer_AxialScaleDlg.h"
+#include "OCCViewer_ViewWindow.h"
+#include "OCCViewer_ViewPort3d.h"
+
+#include <QtxDoubleSpinBox.h>
+
+#include <QGroupBox>
+#include <QLabel>
+#include <QPushButton>
+#include <QVBoxLayout>
+#include <QHBoxLayout>
+
+/*!
+ \class OCCViewer_AxialScaleDlg
+ \brief Dialog allowing to assign parameters of axes scaling
+*/
+
+/*!
+ \brief Constructor
+ \param view - view window
+ \param parent - parent widget
+*/
+OCCViewer_AxialScaleDlg::OCCViewer_AxialScaleDlg( OCCViewer_ViewWindow* view, QWidget* parent )
+ : QDialog( parent ),
+ myView( view )
+{
+ setWindowTitle( tr( "DLG_SCALING" ) );
+ setModal( false );
+ setSizeGripEnabled( true );
+
+ // Create layout for this dialog
+ QVBoxLayout* layoutDlg = new QVBoxLayout( this );
+ layoutDlg->setSpacing( 6 );
+ layoutDlg->setMargin( 11 );
+
+ // Create croup box with grid layout
+ QGroupBox* aGroupBox = new QGroupBox( this );
+ QHBoxLayout* aHBoxLayout = new QHBoxLayout( aGroupBox );
+ aHBoxLayout->setMargin( 11 );
+ aHBoxLayout->setSpacing( 6 );
+
+ // "X" scaling
+ QLabel* TextLabelX = new QLabel( tr( "LBL_X" ), aGroupBox );
+ m_sbXcoeff = new QtxDoubleSpinBox( 1e-7, RealLast(), 0.1, aGroupBox );
+ m_sbXcoeff->setMinimumWidth( 80 );
+ m_sbXcoeff->setValue( 1.0 );
+
+ // "Y" scaling
+ QLabel* TextLabelY = new QLabel( tr( "LBL_Y" ), aGroupBox );
+ m_sbYcoeff = new QtxDoubleSpinBox( 1e-7, RealLast(), 0.1, aGroupBox );
+ m_sbYcoeff->setMinimumWidth( 80 );
+ m_sbYcoeff->setValue( 1.0 );
+
+ // "Z" scaling
+ QLabel* TextLabelZ = new QLabel( tr( "LBL_Z" ), aGroupBox );
+ m_sbZcoeff = new QtxDoubleSpinBox( 1e-7, RealLast(), 0.1, aGroupBox );
+ m_sbZcoeff->setMinimumWidth( 80 );
+ m_sbZcoeff->setValue( 1.0 );
+
+ // Create <Reset> button
+ m_bReset = new QPushButton( tr( "&Reset" ), aGroupBox );
+
+ // Layout widgets in the group box
+ aHBoxLayout->addWidget( TextLabelX );
+ aHBoxLayout->addWidget( m_sbXcoeff );
+ aHBoxLayout->addWidget( TextLabelY );
+ aHBoxLayout->addWidget( m_sbYcoeff );
+ aHBoxLayout->addWidget( TextLabelZ );
+ aHBoxLayout->addWidget( m_sbZcoeff );
+ aHBoxLayout->addSpacing( 10 );
+ aHBoxLayout->addWidget( m_bReset );
+
+ // OK, CANCEL, Apply button
+ QGroupBox* aGroupBox2 = new QGroupBox( this );
+ QHBoxLayout* aHBoxLayout2 = new QHBoxLayout( aGroupBox2 );
+ aHBoxLayout2->setMargin( 11 );
+ aHBoxLayout2->setSpacing( 6 );
+ // Create <OK> button
+ QPushButton* m_bOk = new QPushButton( tr( "O&K" ), aGroupBox2 );
+ m_bOk->setDefault( true );
+ m_bOk->setAutoDefault( true );
+ // Create <Apply> button
+ QPushButton* m_bApply = new QPushButton( tr( "&Apply" ), aGroupBox2 );
+ m_bApply->setAutoDefault( true );
+ // Create <Cancel> button
+ QPushButton* m_bCancel = new QPushButton( tr( "&Cancel" ), aGroupBox2 );
+ m_bCancel->setAutoDefault( true );
+
+ // Layout buttons
+ aHBoxLayout2->addWidget( m_bOk );
+ aHBoxLayout2->addWidget( m_bApply );
+ aHBoxLayout2->addSpacing( 10 );
+ aHBoxLayout2->addStretch();
+ aHBoxLayout2->addWidget( m_bCancel );
+
+ // Layout top level widgets
+ layoutDlg->addWidget( aGroupBox );
+ layoutDlg->addWidget( aGroupBox2 );
+
+ // signals and slots connections
+ connect( m_bCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
+ connect( m_bOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
+ connect( m_bApply, SIGNAL( clicked() ), this, SLOT( apply() ) );
+ connect( m_bReset, SIGNAL( clicked() ), this, SLOT( reset() ) );
+
+ connect( view, SIGNAL( Hide( QHideEvent* ) ), this, SLOT( hide() ) );
+}
+
+/*!
+ \brief Destructor
+*/
+OCCViewer_AxialScaleDlg::~OCCViewer_AxialScaleDlg()
+{
+}
+
+/*!
+ \brief Update widgets values from the view
+*/
+void OCCViewer_AxialScaleDlg::Update()
+{
+ // Get values from the OCC view
+ double aScaleFactor[3];
+ myView->getViewPort()->getView()->AxialScale( aScaleFactor[0], aScaleFactor[1], aScaleFactor[2] );
+ m_sbXcoeff->setValue( aScaleFactor[0] );
+ m_sbYcoeff->setValue( aScaleFactor[1] );
+ m_sbZcoeff->setValue( aScaleFactor[2] );
+}
+
+/*!
+ \brief Called when <OK> button is pressed
+*/
+void OCCViewer_AxialScaleDlg::accept()
+{
+ if ( apply() )
+ QDialog::accept();
+}
+
+/*!
+ \brief Called when <Apply> button is pressed
+*/
+bool OCCViewer_AxialScaleDlg::apply()
+{
+ double aScaleFactor[3] = { m_sbXcoeff->value(), m_sbYcoeff->value(), m_sbZcoeff->value() };
+ myView->getViewPort()->getView()->SetAxialScale( aScaleFactor[0], aScaleFactor[1], aScaleFactor[2] );
+ return true;
+}
+
+/*!
+ \brief Called when <Reset> button is pressed
+*/
+void OCCViewer_AxialScaleDlg::reset()
+{
+ m_bReset->setFocus();
+ m_sbXcoeff->setValue( 1.0 );
+ m_sbYcoeff->setValue( 1.0 );
+ m_sbZcoeff->setValue( 1.0 );
+}
--- /dev/null
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef OCCVIEWER_AXIALSCALEDLG_H
+#define OCCVIEWER_AXIALSCALEDLG_H
+
+#include "OCCViewer.h"
+
+#include <QDialog>
+
+class OCCViewer_ViewWindow;
+class QtxDoubleSpinBox;
+class QPushButton;
+
+class OCCVIEWER_EXPORT OCCViewer_AxialScaleDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ OCCViewer_AxialScaleDlg( OCCViewer_ViewWindow*, QWidget* = 0 );
+ ~OCCViewer_AxialScaleDlg();
+
+ void Update();
+
+protected slots:
+ bool apply();
+ void reset();
+ void accept();
+
+private:
+ OCCViewer_ViewWindow* myView;
+ QtxDoubleSpinBox* m_sbXcoeff;
+ QtxDoubleSpinBox* m_sbYcoeff;
+ QtxDoubleSpinBox* m_sbZcoeff;
+ QPushButton* m_bReset;
+};
+
+#endif // OCCVIEWER_AXIALSCALEDLG_H
if ( !aView3d.IsNull() && !myClippingPlane.IsNull() )
aView3d->SetPlaneOn( myClippingPlane );
- if (!myView->isCuttingPlane())
- myAction->setChecked( false );
+ myAction->setChecked( false );
QDialog::closeEvent( e );
}
if ( !aView3d.IsNull() && !myClippingPlane.IsNull() )
aView3d->SetPlaneOn( myClippingPlane );
- if (!myView->isCuttingPlane())
- myAction->setChecked( false );
+ myAction->setChecked( false );
reject();
}
aView3d->SetAt( myCurrentItem.atX, myCurrentItem.atY, myCurrentItem.atZ );
aView3d->SetImmediateUpdate( prev );
aView3d->SetEye( myCurrentItem.eyeX, myCurrentItem.eyeY, myCurrentItem.eyeZ );
+ aView3d->SetAxialScale( myCurrentItem.scaleX, myCurrentItem.scaleY, myCurrentItem.scaleZ );
}
}
{
hide();
}
+
+/*!
+ Custom handling of close event: toggle action
+*/
+void
+OCCViewer_SetRotationPointDlg
+::closeEvent( QCloseEvent* e )
+{
+ myAction->setChecked( false );
+ QDialog::closeEvent( e );
+}
void onViewShow();
void onViewHide();
+
+protected:
+ void closeEvent( QCloseEvent* );
};
#endif // OCCVIEWER_SETROTATIONPOINTDLG_H
#include <QMenu>
#include <QMouseEvent>
#include <QToolBar>
+#include <QDesktopWidget>
#include <AIS_Axis.hxx>
#include <AIS_Drawer.hxx>
#include <AIS_ListIteratorOfListOfInteractive.hxx>
#include <Geom_Axis2Placement.hxx>
+#include <Prs3d_Drawer.hxx>
#include <Prs3d_DatumAspect.hxx>
#include <Prs3d_LineAspect.hxx>
+#include <Prs3d_LengthAspect.hxx>
+#include <Prs3d_AngleAspect.hxx>
+#include <Prs3d_TextAspect.hxx>
/*!
Constructor
// display isoline on planar faces (box for ex.)
myAISContext->IsoOnPlane( true );
+ double h = QApplication::desktop()->screenGeometry( QApplication::desktop()->primaryScreen() ).height() / 300. ;
+ Handle(Prs3d_Drawer) drawer = myAISContext->DefaultDrawer();
+ Handle(Prs3d_TextAspect) ta = drawer->TextAspect();
+ ta->SetHeight(100); // VSR: workaround for CAS.CADE bug (is it really needed ???)
+ ta->SetHeight(h);
+ drawer->SetTextAspect(ta);
+ drawer->AngleAspect()->SetTextAspect(ta);
+ drawer->LengthAspect()->SetTextAspect(ta);
+
clearViewAspects();
/* create trihedron */
double eyeX;
double eyeY;
double eyeZ;
+ double scaleX;
+ double scaleY;
+ double scaleZ;
QString name;
};
#include "OCCViewer_CreateRestoreViewDlg.h"
#include "OCCViewer_ClippingDlg.h"
#include "OCCViewer_SetRotationPointDlg.h"
+#include "OCCViewer_AxialScaleDlg.h"
#include <SUIT_Desktop.h>
#include <SUIT_Session.h>
myEnableDrawMode = false;
updateEnabledDrawMode();
myClippingDlg = 0;
+ myScalingDlg = 0;
mySetRotationPointDlg = 0;
myRectBand = 0;
connect(aAction, SIGNAL(activated()), this, SLOT(onTrihedronShow()));
toolMgr()->registerAction( aAction, TrihedronShowId );
}
+
+ // Scale
+ aAction = new QtxAction(tr("MNU_SCALING"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_SCALING" ) ),
+ tr( "MNU_SCALING" ), 0, this);
+ aAction->setStatusTip(tr("DSC_SCALING"));
+ connect(aAction, SIGNAL(activated()), this, SLOT(onAxialScale()));
+ toolMgr()->registerAction( aAction, AxialScaleId );
}
/*!
toolMgr()->append( toolMgr()->separator(), tid );
toolMgr()->append( ClippingId, tid );
+ toolMgr()->append( AxialScaleId, tid );
}
/*!
{
SUIT_ViewWindow* vw = myManager->createViewWindow();
//vw->show();
+ emit viewCloned( vw );
}
/*!
*/
void OCCViewer_ViewWindow::onClipping( bool on )
{
+ /*
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
- /*if ( on )
+ if ( on )
myActionsMap[ ClippingId ]->setIcon(aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_CLIPPING_PRESSED" )));
else
myActionsMap[ ClippingId ]->setIcon(aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_CLIPPING" )));
*/
if ( on )
+ {
+ if ( !myClippingDlg )
{
- if ( !myClippingDlg )
- {
- myClippingDlg = new OCCViewer_ClippingDlg( this, myDesktop );
- myClippingDlg->SetAction( myClippingAction );
- }
-
- if ( !myClippingDlg->isVisible() )
- myClippingDlg->show();
+ myClippingDlg = new OCCViewer_ClippingDlg( this, myDesktop );
+ myClippingDlg->SetAction( myClippingAction );
}
+
+ if ( !myClippingDlg->isVisible() )
+ myClippingDlg->show();
+ }
else
- {
- if ( myClippingDlg->isVisible() )
- myClippingDlg->hide();
- setCuttingPlane(false);
- }
+ {
+ if ( myClippingDlg->isVisible() )
+ myClippingDlg->hide();
+ setCuttingPlane(false);
+ }
+}
+
+/*!
+ Creates one more window with same content
+*/
+void OCCViewer_ViewWindow::onAxialScale()
+{
+ if ( !myScalingDlg )
+ myScalingDlg = new OCCViewer_AxialScaleDlg( this, myDesktop );
+
+ if ( !myScalingDlg->isVisible() )
+ myScalingDlg->show();
}
/*!
aView3d->SetImmediateUpdate( prev );
aView3d->SetEye( anItem.eyeX, anItem.eyeY, anItem.eyeZ );
aView3d->SetProj( anItem.projX, anItem.projY, anItem.projZ );
-
+ aView3d->SetAxialScale( anItem.scaleX, anItem.scaleY, anItem.scaleZ );
+
myRestoreFlag = 0;
}
{
double centerX, centerY, projX, projY, projZ, twist;
double atX, atY, atZ, eyeX, eyeY, eyeZ;
+ double aScaleX, aScaleY, aScaleZ;
Handle(V3d_View) aView3d = myViewPort->getView();
aView3d->Eye( eyeX, eyeY, eyeZ );
twist = aView3d->Twist();
+ aView3d->AxialScale(aScaleX,aScaleY,aScaleZ);
+
QString aName = QTime::currentTime().toString() + QString::fromLatin1( " h:m:s" );
viewAspect params;
params.eyeX = eyeX;
params.eyeY = eyeY;
params.eyeZ = eyeZ;
+ params.scaleX = aScaleX;
+ params.scaleY = aScaleY;
+ params.scaleZ = aScaleZ;
params.name = aName;
return params;
{
viewAspect params = getViewParams();
QString retStr;
- retStr.sprintf( "%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e", params.scale,
+ retStr.sprintf( "%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e", params.scale,
params.centerX, params.centerY, params.projX, params.projY, params.projZ, params.twist,
- params.atX, params.atY, params.atZ, params.eyeX, params.eyeY, params.eyeZ );
+ params.atX, params.atY, params.atZ, params.eyeX, params.eyeY, params.eyeZ,
+ params.scaleX, params.scaleY, params.scaleZ );
return retStr;
}
void OCCViewer_ViewWindow::setVisualParameters( const QString& parameters )
{
QStringList paramsLst = parameters.split( '*' );
- if ( paramsLst.size() == 13 ) {
+ if ( paramsLst.size() >= 13 ) {
viewAspect params;
params.scale = paramsLst[0].toDouble();
params.centerX = paramsLst[1].toDouble();
params.eyeX = paramsLst[10].toDouble();
params.eyeY = paramsLst[11].toDouble();
params.eyeZ = paramsLst[12].toDouble();
+ if ( paramsLst.size() == 16 ) {
+ params.scaleX = paramsLst[13].toDouble();
+ params.scaleY = paramsLst[14].toDouble();
+ params.scaleZ = paramsLst[15].toDouble();
+ }
+ else {
+ params.scaleX = 1.;
+ params.scaleY = 1.;
+ params.scaleZ = 1.;
+ }
performRestoring( params );
}
class OCCViewer_ViewPort3d;
class OCCViewer_ViewSketcher;
class OCCViewer_ClippingDlg;
+class OCCViewer_AxialScaleDlg;
class OCCViewer_SetRotationPointDlg;
class OCCViewer_Viewer;
class viewAspect;
enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId,
ChangeRotationPointId, RotationId,
FrontId, BackId, TopId, BottomId, LeftId, RightId, ResetId, CloneId, ClippingId, MemId, RestoreId,
- TrihedronShowId };
+ TrihedronShowId, AxialScaleId };
enum OperationType{ NOTHING, PANVIEW, ZOOMVIEW, ROTATE,
PANGLOBAL, WINDOWFIT, FITALLVIEW, RESETVIEW,
void onSetRotationPoint( bool on );
void onCloneView();
void onClipping( bool on );
+ void onAxialScale();
void onMemorizeView();
void onRestoreView();
void onTrihedronShow();
signals:
void vpTransformationStarted(OCCViewer_ViewWindow::OperationType type);
void vpTransformationFinished(OCCViewer_ViewWindow::OperationType type);
- void cloneView();
+ void viewCloned( SUIT_ViewWindow* );
void Show( QShowEvent * );
void Hide( QHideEvent * );
OCCViewer_ClippingDlg* myClippingDlg;
QtxAction* myClippingAction;
+ OCCViewer_AxialScaleDlg* myScalingDlg;
+
OCCViewer_SetRotationPointDlg* mySetRotationPointDlg;
QtxAction* mySetRotationPointAction;
<source>ICON_OCCVIEWER_VIEW_TRIHEDRON</source>
<translation>occ_view_triedre.png</translation>
</message>
+ <message>
+ <source>ICON_OCCVIEWER_SCALING</source>
+ <translation>occ_view_scaling.png</translation>
+ </message>
</context>
</TS>
<source>DSC_BACK_VIEW</source>
<translation>Back View</translation>
</message>
+ <message>
+ <source>DSC_SCALING</source>
+ <translation>Change scale of axes</translation>
+ </message>
+ <message>
+ <source>MNU_SCALING</source>
+ <translation>Scaling</translation>
+ </message>
</context>
<context>
<name>OCCViewer_CreateRestoreViewDlg</name>
<name>OCCViewer_SetRotationPointDlg</name>
<message>
<source>LBL_X</source>
- <translation>X :</translation>
+ <translation>X:</translation>
</message>
<message>
<source>LBL_Y</source>
- <translation>Y :</translation>
+ <translation>Y:</translation>
</message>
<message>
<source>LBL_Z</source>
- <translation>Z :</translation>
+ <translation>Z:</translation>
</message>
<message>
<source>USE_BBCENTER</source>
<translation>Change background...</translation>
</message>
</context>
+<context>
+ <name>OCCViewer_AxialScaleDlg</name>
+ <message>
+ <source>DLG_SCALING</source>
+ <translation>Axes scaling</translation>
+ </message>
+ <message>
+ <source>LBL_X</source>
+ <translation>X:</translation>
+ </message>
+ <message>
+ <source>LBL_Y</source>
+ <translation>Y:</translation>
+ </message>
+ <message>
+ <source>LBL_Z</source>
+ <translation>Z:</translation>
+ </message>
+</context>
</TS>
aPoint.y = theY;
aPoint.text = txt;
- QList<Plot2d_Point>::iterator aIt;
+ pointList::iterator aIt;
int aCurrent = 0;
for(aIt = myPoints.begin(); aIt != myPoints.end(); ++aIt) {
if (thePos == aCurrent) {
*/
double Plot2d_Curve::getMinX() const
{
- QList<Plot2d_Point>::const_iterator aIt;
+ pointList::const_iterator aIt;
double aMinX = 1e150;
//int aCurrent = 0;
for(aIt = myPoints.begin(); aIt != myPoints.end(); ++aIt) {
*/
double Plot2d_Curve::getMinY() const
{
- QList<Plot2d_Point>::const_iterator aIt;
+ pointList::const_iterator aIt;
double aMinY = 1e150;
//int aCurrent = 0;
for(aIt = myPoints.begin(); aIt != myPoints.end(); ++aIt) {
*/
void Plot2d_ViewFrame::DisplayAll()
{
- QList<Plot2d_Curve*> clist;
+ curveList clist;
getCurves( clist );
for ( int i = 0; i < (int)clist.count(); i++ ) {
updateCurve( clist.at( i ), false );
void Plot2d_ViewFrame::displayCurves( const curveList& curves, bool update )
{
//myPlot->setUpdatesEnabled( false ); // call this function deprecate update of legend
- QList<Plot2d_Curve*>::const_iterator it = curves.begin();
+ curveList::const_iterator it = curves.begin();
Plot2d_Curve* aCurve;
for (; it != curves.end(); ++it ) {
aCurve = *it;
*/
void Plot2d_ViewFrame::eraseCurves( const curveList& curves, bool update )
{
- QList<Plot2d_Curve*>::const_iterator it = curves.begin();
+ curveList::const_iterator it = curves.begin();
Plot2d_Curve* aCurve;
for (; it != curves.end(); ++it ) {
aCurve = *it;
return;
curveList aCurves = prs->getCurves();
- QList<Plot2d_Curve*>::iterator it = aCurves.begin();
+ curveList::iterator it = aCurves.begin();
Plot2d_Curve* aCurve;
for (; it != aCurves.end(); ++it ) {
aCurve = *it;
SLOT: called if action "Clone view" is activated, emits signal cloneView()
*/
void Plot2d_ViewManager::onCloneView()
+{
+ if( sender() && sender()->inherits( "Plot2d_ViewWindow" ) )
+ {
+ Plot2d_ViewWindow* srcWnd = ( Plot2d_ViewWindow* )sender();
+ cloneView( srcWnd );
+ }
+}
+
+/*!
+ \brief Creates clone of source window
+ \param srcWnd source window
+ \return Pointer on the new window
+ \sa onCloneView()
+*/
+Plot2d_ViewWindow* Plot2d_ViewManager::cloneView( Plot2d_ViewWindow* srcWnd )
{
SUIT_ViewWindow* vw = createViewWindow();
- Plot2d_ViewWindow *newWnd = 0, *clonedWnd = 0;
+ Plot2d_ViewWindow* newWnd = 0;
if( vw && vw->inherits( "Plot2d_ViewWindow" ) )
newWnd = ( Plot2d_ViewWindow* )vw;
- if( sender() && sender()->inherits( "Plot2d_ViewWindow" ) )
- clonedWnd = ( Plot2d_ViewWindow* )sender();
- if( newWnd && clonedWnd )
- emit cloneView( clonedWnd->getViewFrame(), newWnd->getViewFrame() );
+ if( newWnd && srcWnd )
+ emit cloneView( srcWnd->getViewFrame(), newWnd->getViewFrame() );
+
+ return newWnd;
}
#include "SUIT_ViewManager.h"
class SUIT_Desktop;
+class Plot2d_ViewWindow;
class Plot2d_Viewer;
class Plot2d_ViewFrame;
~Plot2d_ViewManager();
Plot2d_Viewer* getPlot2dModel() const;
+ Plot2d_ViewWindow* cloneView( Plot2d_ViewWindow* srcWnd );
protected:
bool insertView(SUIT_ViewWindow* theView);
/*!
SLOT: called when action "Clone view" is activated
*/
-void Plot2d_Viewer::onCloneView( Plot2d_ViewFrame*, Plot2d_ViewFrame* )
+void Plot2d_Viewer::onCloneView( Plot2d_ViewFrame* clonedVF, Plot2d_ViewFrame* newVF )
{
+ if( !clonedVF || !newVF )
+ return;
+
+ // 1) Copy all properties of view
+
+ newVF->copyPreferences( clonedVF );
+
+ // 2) Display all curves displayed in cloned view
+
+ curveList aCurves;
+ clonedVF->getCurves( aCurves );
+ curveList::const_iterator anIt = aCurves.begin(), aLast = aCurves.end();
+
+ for( ; anIt!=aLast; anIt++ )
+ if( clonedVF->isVisible( *anIt ) )
+ newVF->displayCurve( *anIt, false );
+ newVF->Repaint();
+
+ if ( newVF )
+ {
+ // find view window corresponding to the frame
+ QWidget* p = newVF->parentWidget();
+ while( p && !p->inherits( "SUIT_ViewWindow" ) )
+ p = p->parentWidget();
+
+ // emits signal
+ if ( p && p->inherits( "SUIT_ViewWindow" ) )
+ emit viewCloned( (SUIT_ViewWindow*)p );
+ }
}
/*!
void update();
void clearPrs();
void setAutoDel(bool theDel);
+
+signals:
+ void viewCloned( SUIT_ViewWindow* );
protected slots:
- void onChangeBgColor();
- void onDumpView();
- void onShowToolbar();
+ void onChangeBgColor();
+ void onDumpView();
+ void onShowToolbar();
virtual void onCloneView( Plot2d_ViewFrame*, Plot2d_ViewFrame* );
private:
}
/*!
- \brief Get all child widgets in all workareas.
- \return list of widgets in all workareas
+ \brief Get list of all widgets in all areas or in specified area which given
+ widget belongs to
+ \param wid widget specifying area if it is equal to null when widgets of all
+ areas are retuned
+ \return list of widgets
*/
-QWidgetList QtxWorkstack::windowList() const
+QWidgetList QtxWorkstack::windowList( QWidget* wid ) const
{
QList<QtxWorkstackArea*> lst;
- areas( mySplit, lst, true );
+ if ( !wid )
+ {
+ areas( mySplit, lst, true );
+ }
+ else
+ {
+ QtxWorkstackArea* area = wgArea( wid );
+ if ( area )
+ lst.append( area );
+ }
QWidgetList widList;
for ( QList<QtxWorkstackArea*>::iterator it = lst.begin(); it != lst.end(); ++it )
if ( !split )
return;
- const QObjectList& objs = split->children();
+ /*const QObjectList& objs = */split->children(); // VSR: is it needed ???
QString sizesStr;
QList<int> sizes = split->sizes();
\brief Emitted when the workstack's child widget \w is activated.
\param w widget being activated
*/
+
+/*!
+ \brief Gets area containing given widget
+ \param wid widget
+ \return pointer to QtxWorkstackArea* object
+*/
+QtxWorkstackArea* QtxWorkstack::wgArea( QWidget* wid ) const
+{
+ QtxWorkstackArea* resArea = 0;
+
+ QList<QtxWorkstackArea*> areaList;
+ areas( mySplit, areaList, true );
+
+ QtxWorkstackArea* area;
+ QList<QtxWorkstackArea*>::ConstIterator it;
+ for ( it = areaList.begin(); it != areaList.end() && !resArea; ++it )
+ {
+ if ( (*it)->contains( wid ) )
+ resArea = area;
+ }
+
+ return resArea;
+}
+
+/*!
+ \brief Moves the first widget to the same area which the second widget belongs to
+ \param wid widget to be moved
+ \param wid_to widget specified the destination area
+ \param before specifies whether the first widget has to be moved before or after
+ the second widget
+ \return TRUE if operation is completed successfully, FALSE otherwise
+*/
+bool QtxWorkstack::move( QWidget* wid, QWidget* wid_to, const bool before )
+{
+ if ( wid && wid_to )
+ {
+ QtxWorkstackArea* area_src = wgArea( wid );
+ QtxWorkstackArea* area_to = wgArea( wid_to );
+ if ( area_src && area_to )
+ {
+ // find index of the second widget
+ QWidgetList wgList = area_to->widgetList();
+ QWidgetList::ConstIterator it;
+ int idx = 0;
+ for ( it = wgList.begin(); it != wgList.begin(); ++it, idx++ )
+ {
+ if ( *it == wid_to )
+ break;
+ }
+
+ if ( idx < wgList.count() ) // paranoidal check
+ {
+ if ( !before )
+ idx++;
+ area_src->removeWidget( wid, true );
+ area_to->insertWidget( wid, idx );
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+/*!
+ \brief Group all windows in one area
+ \return TRUE if operation is completed successfully, FALSE otherwise
+*/
+void QtxWorkstack::stack()
+{
+ QWidgetList wgList = windowList();
+ if ( !wgList.count() )
+ return; // nothing to do
+
+ QtxWorkstackArea* area_to = 0;
+ QWidgetList::ConstIterator it;
+ for ( it = wgList.begin(); it != wgList.end(); ++it )
+ {
+ QtxWorkstackArea* area_src = 0;
+ if ( !area_to )
+ {
+ area_to = wgArea( *it );
+ area_src = area_to;
+ }
+ else
+ area_src = wgArea( *it );
+
+ if ( area_src != area_to )
+ {
+ area_src->removeWidget( *it, true );
+ area_to->insertWidget( *it, -1 );
+ }
+ }
+}
QtxWorkstack( QWidget* = 0 );
virtual ~QtxWorkstack();
- QWidgetList windowList() const;
+ QWidgetList windowList( QWidget* = 0 ) const;
QWidgetList splitWindowList() const;
QWidget* activeWindow() const;
int menuActions() const;
void split( const int );
+ bool move( QWidget* wid, QWidget* wid_to, const bool before );
+ void stack();
QWidget* addWindow( QWidget*, Qt::WindowFlags = 0 );
void insertWidget( QWidget*, QWidget*, QWidget* );
QtxWorkstackArea* areaAt( const QPoint& ) const;
+ QtxWorkstackArea* wgArea( QWidget* ) const;
QtxWorkstackArea* targetArea();
QtxWorkstackArea* activeArea() const;
-DHAVE_CONFIG_H @KERNEL_CXXFLAGS@ -DCALL_OLD_METHODS \
-I$(srcdir)/../../PyInterp -I$(srcdir)/../../SalomeApp \
-I$(srcdir)/../../SUIT -I$(srcdir)/../../Qtx -I$(srcdir)/../../LightApp \
+ -I$(srcdir)/../../Plot2d -I$(srcdir)/../../OCCViewer \
-I$(srcdir)/../../SalomeApp -I$(srcdir)/../../CAM -I$(srcdir)/../../STD \
-I$(top_builddir)/salome_adm/unix @CORBA_CXXFLAGS@ @CORBA_INCLUDES@
libSalomePyQtGUI_la_LIBADD= $(PYTHON_LIBS) $(SIP_LIBS) $(PYQT_LIBS) $(VTK_LIBS) \
- $(OGL_LIBS) ../../PyInterp/libPyInterp.la ../../SalomeApp/libSalomeApp.la
+ $(OGL_LIBS) ../../PyInterp/libPyInterp.la ../../SalomeApp/libSalomeApp.la \
+ ../../OCCViewer/libOCCViewer.la ../../Plot2d/libPlot2d.la
##################################
#include <PyInterp_Dispatcher.h>
#include <SUIT_ResourceMgr.h>
+#include <SUIT_Desktop.h>
+#include <SUIT_ViewModel.h>
+#include <SUIT_ViewWindow.h>
+#include <SUIT_ViewManager.h>
#include <STD_MDIDesktop.h>
#include <STD_TabDesktop.h>
#include <LightApp_Preferences.h>
#include <QDomElement>
#include <QMenuBar>
#include <QMenu>
+#include <QAction>
+#include <QActionGroup>
#include "sipAPISalomePyQtGUI.h"
myLastActivateStatus = PyObject_IsTrue( res1 );
}
}
+
+ // Connect the SUIT_Desktop signal windowActivated() to this->onActiveViewChanged()
+ SUIT_Desktop* aDesk = theStudy->application()->desktop();
+ if ( aDesk )
+ {
+ connect( aDesk, SIGNAL( windowActivated( SUIT_ViewWindow* ) ),
+ this, SLOT( onActiveViewChanged( SUIT_ViewWindow* ) ) );
+ // If a active window exists send activeViewChanged
+ // If a getActiveView() in SalomePyQt available we no longer need this
+ SUIT_ViewWindow* aView = aDesk->activeWindow();
+ if ( aView )
+ activeViewChanged( aView );
+
+ // get all view currently opened in the study and connect their signals to
+ // the corresponding slots of the class.
+ QList<SUIT_ViewWindow*> wndList = aDesk->windows();
+ SUIT_ViewWindow* wnd;
+ foreach ( wnd, wndList )
+ connectView( wnd );
+ }
}
/*!
PyErr_Print();
}
}
+
+ // Disconnect the SUIT_Desktop signal windowActivated()
+ SUIT_Desktop* aDesk = theStudy->application()->desktop();
+ if ( aDesk )
+ {
+ disconnect( aDesk, SIGNAL( windowActivated( SUIT_ViewWindow* ) ),
+ this, SLOT( onActiveViewChanged( SUIT_ViewWindow* ) ) );
+ }
}
/*!
return a;
}
+/*!
+ \brief Create new action group.
+
+ If the action with specified identifier already registered
+ it is not created, but its attributes are only modified.
+
+ \param id action ID
+ \param text tooltip text
+ \param icon icon
+ \param menu menu text
+ \param tip status tip
+ \param key keyboard shortcut
+ \param toggle \c true for checkable action
+ \return created action
+*/
+/*
+QActionGroup* SALOME_PYQT_Module::createActionGroup(const int id, const bool exclusive)
+{
+ QActionGroup* a = action( id );
+ if ( !a || !a->inherits( "QActionGroup" ) ) {
+ a = new QActionGroup( this );
+ SalomeApp_Module::registerAction( id, a );
+ }
+ a->setExclusive( exclusive );
+ return (QActionGroup*)a;
+}
+*/
/*!
\brief Load icon from resource file.
\param fileName icon file name
SalomeApp_Module::setPreferenceProperty( id, prop, var );
}
+
+/*!
+ \brief Signal handler windowActivated(SUIT_ViewWindow*) of SUIT_Desktop
+ \param pview view being activated
+*/
+void SALOME_PYQT_Module::onActiveViewChanged( SUIT_ViewWindow* pview )
+{
+ class ActiveViewChange : public PyInterp_LockRequest
+ {
+ public:
+ ActiveViewChange( PyInterp_Interp* _py_interp, SALOME_PYQT_Module* _obj, const SUIT_ViewWindow* _pview )
+ : PyInterp_LockRequest( _py_interp, 0, true ),
+ myObj(_obj),myView(_pview) {}
+
+ protected:
+ virtual void execute()
+ {
+ myObj->activeViewChanged( myView );
+ }
+
+ private:
+ SALOME_PYQT_Module* myObj;
+ const SUIT_ViewWindow * myView;
+ };
+
+ PyInterp_Dispatcher::Get()->Exec( new ActiveViewChange( myInterp, this, pview ) );
+}
+
+/*!
+ \brief Processes the view changing, calls Python module's activeViewChanged() method
+ \param pview view being activated
+*/
+void SALOME_PYQT_Module::activeViewChanged( const SUIT_ViewWindow* pview )
+{
+ if ( !myInterp || !myModule )
+ return;
+
+ // Do not use SUIT_ViewWindow::closing() signal here. View manager reacts on
+ // this signal and deletes view. So our slot does not works if it is connected
+ // on this signal. SUIT_ViewManager::deleteView(SUIT_ViewWindow*) is used here
+
+ connectView( pview );
+
+ if ( PyObject_HasAttrString( myModule, "activeViewChanged" ) )
+ {
+ if ( !pview )
+ return;
+
+ PyObjWrapper res( PyObject_CallMethod( myModule, "activeViewChanged", "i" , pview->getId() ) );
+ if( !res )
+ PyErr_Print();
+ }
+}
+
+/*!
+ \brief Signal handler cloneView() of OCCViewer_ViewWindow
+ \param pview view being cloned
+*/
+void SALOME_PYQT_Module::onViewCloned( SUIT_ViewWindow* pview )
+{
+ class ViewClone : public PyInterp_LockRequest
+ {
+ public:
+ ViewClone( PyInterp_Interp* _py_interp, SALOME_PYQT_Module* _obj, const SUIT_ViewWindow* _pview )
+ : PyInterp_LockRequest( _py_interp, 0, true ),
+ myObj(_obj), myView(_pview) {}
+
+ protected:
+ virtual void execute()
+ {
+ myObj->viewCloned( myView );
+ }
+
+ private:
+ SALOME_PYQT_Module* myObj;
+ const SUIT_ViewWindow* myView;
+ };
+
+ PyInterp_Dispatcher::Get()->Exec( new ViewClone( myInterp, this, pview ) );
+}
+
+/*!
+ \brief Processes the view cloning, calls Python module's activeViewCloned() method
+ \param pview view being cloned
+*/
+void SALOME_PYQT_Module::viewCloned( const SUIT_ViewWindow* pview )
+{
+ if ( !myInterp || !myModule || !pview )
+ return;
+
+ if ( PyObject_HasAttrString( myModule, "viewCloned" ) )
+ {
+ PyObjWrapper res( PyObject_CallMethod( myModule, "viewCloned", "i", pview->getId() ) );
+ if( !res )
+ PyErr_Print();
+ }
+}
+
+/*!
+ \brief Signal handler closing(SUIT_ViewWindow*) of a view
+ \param pview view being closed
+*/
+void SALOME_PYQT_Module::onViewClosed( SUIT_ViewWindow* pview )
+{
+ class ViewClose : public PyInterp_LockRequest
+ {
+ public:
+ ViewClose( PyInterp_Interp* _py_interp, SALOME_PYQT_Module* _obj, const SUIT_ViewWindow* _pview )
+ : PyInterp_LockRequest( _py_interp, 0, true ),
+ myObj(_obj),myView(_pview) {}
+
+ protected:
+ virtual void execute()
+ {
+ myObj->viewClosed( myView );
+ }
+
+ private:
+ SALOME_PYQT_Module* myObj;
+ const SUIT_ViewWindow * myView;
+ };
+
+ PyInterp_Dispatcher::Get()->Exec( new ViewClose( myInterp, this, pview ) );
+}
+
+/*!
+ \brief Processes the view closing, calls Python module's viewClosed() method
+ \param pview view being closed
+*/
+void SALOME_PYQT_Module::viewClosed( const SUIT_ViewWindow* pview )
+{
+ if ( !myInterp || !myModule )
+ return;
+
+ if ( PyObject_HasAttrString( myModule, "viewClosed" ) )
+ {
+ PyObjWrapper res( PyObject_CallMethod( myModule, "viewClosed", "i", pview->getId() ) );
+ if ( !res )
+ {
+ PyErr_Print();
+ }
+ }
+}
+
+/*!
+ \brief Connects or disconnects signals about activating and cloning view on the module slots
+ \param pview view which is connected/disconnected
+*/
+void SALOME_PYQT_Module::connectView( const SUIT_ViewWindow* pview )
+{
+ SUIT_ViewManager* viewMgr = pview->getViewManager();
+ SUIT_ViewModel* viewModel = viewMgr ? viewMgr->getViewModel() : 0;
+
+ if ( viewMgr )
+ {
+ disconnect( viewMgr, SIGNAL( deleteView( SUIT_ViewWindow* ) ),
+ this, SLOT( onViewClosed( SUIT_ViewWindow* ) ) );
+
+ connect( viewMgr, SIGNAL( deleteView( SUIT_ViewWindow* ) ),
+ this, SLOT( onViewClosed( SUIT_ViewWindow* ) ) );
+ }
+
+ // Connect cloneView() signal of an OCC View
+ if ( pview->inherits( "OCCViewer_ViewWindow" ) )
+ {
+ disconnect( pview, SIGNAL( viewCloned( SUIT_ViewWindow* ) ),
+ this, SLOT( onViewCloned( SUIT_ViewWindow* ) ) );
+ connect( pview, SIGNAL( viewCloned( SUIT_ViewWindow* ) ),
+ this, SLOT( onViewCloned( SUIT_ViewWindow* ) ) );
+ }
+ // Connect cloneView() signal of Plot2d View manager
+ else if ( viewModel && viewModel->inherits( "Plot2d_Viewer" ) )
+ {
+ disconnect( viewModel, SIGNAL( viewCloned( SUIT_ViewWindow* ) ),
+ this, SLOT( onViewCloned( SUIT_ViewWindow* ) ) );
+ connect( viewModel, SIGNAL( viewCloned( SUIT_ViewWindow* ) ),
+ this, SLOT( onViewCloned( SUIT_ViewWindow* ) ) );
+ }
+}
+
/*!
\brief Get tag name for the DOM element.
\param element DOM element
#include CORBA_CLIENT_HEADER(SALOME_Component)
class SALOME_PYQT_PyInterp;
+class SUIT_ViewWindow;
class QAction;
+class QActionGroup;
class QMenu;
class SALOME_PYQT_EXPORT SALOME_PYQT_Module: public SalomeApp_Module
QAction* createAction( const int, const QString&, const QString&,
const QString&, const QString&, const int,
const bool = false, QObject* = 0 );
+ // QActionGroup* createActionGroup( const int, const bool );
+
QIcon loadIcon( const QString& fileName );
const QString& );
void onGUIEvent();
+ void onActiveViewChanged( SUIT_ViewWindow* );
+ void onViewClosed( SUIT_ViewWindow* );
+ void onViewCloned( SUIT_ViewWindow* );
+
protected:
Engines::Component_var getEngine() const;
void initInterp ( int );
void importModule();
void setWorkSpace();
+
+ void activeViewChanged( const SUIT_ViewWindow* );
+ void viewClosed( const SUIT_ViewWindow* );
+ void viewCloned( const SUIT_ViewWindow* );
+ void connectView( const SUIT_ViewWindow* );
friend class XmlHandler;
};
# Libraries targets
MOC_FILES = SalomePyQt_moc.cxx
-COMMON_CPP_FLAGS=$(QT_INCLUDES) $(SIP_INCLUDES) $(PYTHON_INCLUDES) \
+COMMON_CPP_FLAGS=$(QT_INCLUDES) $(QWT_INCLUDES) $(SIP_INCLUDES) $(PYTHON_INCLUDES) \
$(CAS_CPPFLAGS) $(VTK_INCLUDES) $(OGL_INCLUDES) $(BOOST_CPPFLAGS) \
-DHAVE_CONFIG_H @KERNEL_CXXFLAGS@ -I$(top_builddir)/salomeadn/unix \
-I$(top_builddir)/idl \
-I$(srcdir)/../../Qtx -I$(srcdir)/../../SalomeApp -I$(srcdir)/../../Event \
-I$(srcdir)/../../SalomeSession -I$(srcdir)/../../LogWindow \
-I$(srcdir)/../../VTKViewer -I$(srcdir)/../../TOOLSGUI \
+ -I$(srcdir)/../../OCCViewer -I$(srcdir)/../../Plot2d \
-I$(srcdir)/../SALOME_PYQT_GUI -I$(srcdir)/../../PyInterp \
-I$(srcdir)/../../LightApp -I$(srcdir)/../../ObjBrowser \
-I$(srcdir)/../../OBJECT \
-I$(top_builddir)/salome_adm/unix @CORBA_CXXFLAGS@ @CORBA_INCLUDES@
-COMMON_LIBS=$(PYTHON_LIBS) $(SIP_LIBS) $(PYQT_LIBS) $(VTK_LIBS) \
+COMMON_LIBS=$(PYTHON_LIBS) $(SIP_LIBS) $(PYQT_LIBS) $(VTK_LIBS) $(QWT_LIBS) \
$(OGL_LIBS) ../../SUIT/libsuit.la ../../CAM/libCAM.la ../../STD/libstd.la \
../../Qtx/libqtx.la ../../SalomeApp/libSalomeApp.la ../../Event/libEvent.la \
../../Session/libSalomeSession.la ../../LogWindow/libLogWindow.la \
../../VTKViewer/libVTKViewer.la ../../TOOLSGUI/libToolsGUI.la \
- ../SALOME_PYQT_GUI/libSalomePyQtGUI.la
+ ../SALOME_PYQT_GUI/libSalomePyQtGUI.la ../../OCCViewer/libOCCViewer.la \
+ ../../Plot2d/libPlot2d.la
lib_LTLIBRARIES = libSalomePyQt.la
dist_libSalomePyQt_la_SOURCES= SalomePyQt.cxx
#include <QMenu>
#include <QImage>
#include <QStringList>
+#include <QAction>
#include <SALOME_Event.h>
-#include <QtxAction.h>
+//#include <QtxAction.h>
#include <QtxActionMenuMgr.h>
+#include <QtxWorkstack.h>
#include <SUIT_Session.h>
#include <SUIT_Desktop.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_Tools.h>
#include <SUIT_ViewManager.h>
#include <SUIT_ViewWindow.h>
+#include <STD_TabDesktop.h>
#include <SalomeApp_Application.h>
#include <SalomeApp_Study.h>
#include <LightApp_SelectionMgr.h>
#include <LogWindow.h>
+#include <OCCViewer_ViewWindow.h>
+#include <Plot2d_ViewManager.h>
+#include <Plot2d_ViewWindow.h>
/*!
\brief Get the currently active application.
: myCase( 1 ), myId( id ), myTbId( tBar ), myIndex( idx ) {}
CrTool( const int id, const QString& tBar, const int idx )
: myCase( 2 ), myId( id ), myTbName( tBar ), myIndex( idx ) {}
- CrTool( QtxAction* action, const int tbId, const int id, const int idx )
+ CrTool( QAction* action, const int tbId, const int id, const int idx )
: myCase( 3 ), myAction( action ), myTbId( tbId ), myId( id ), myIndex( idx ) {}
- CrTool( QtxAction* action, const QString& tBar, const int id, const int idx )
+ CrTool( QAction* action, const QString& tBar, const int id, const int idx )
: myCase( 4 ), myAction( action ), myTbName( tBar ), myId( id ), myIndex( idx ) {}
int execute( SALOME_PYQT_Module* module ) const
int myCase;
QString myTbName;
int myTbId;
- QtxAction* myAction;
+ QAction* myAction;
int myId;
int myIndex;
};
\param idx required index in the toolbar
\return action ID or -1 if action could not be added
*/
-int SalomePyQt::createTool( QtxAction* a, const int tBar, const int id, const int idx )
+int SalomePyQt::createTool( QAction* a, const int tBar, const int id, const int idx )
{
return ProcessEvent( new TCreateToolEvent( CrTool( a, tBar, id, idx ) ) );
}
\param idx required index in the toolbar
\return action ID or -1 if action could not be added
*/
-int SalomePyQt::createTool( QtxAction* a, const QString& tBar, const int id, const int idx )
+int SalomePyQt::createTool( QAction* a, const QString& tBar, const int id, const int idx )
{
return ProcessEvent( new TCreateToolEvent( CrTool( a, tBar, id, idx ) ) );
}
: myCase( 2 ), myId( id ), myMenuId( menu ), myGroup( group ), myIndex( idx ) {}
CrMenu( const int id, const QString& menu, const int group, const int idx )
: myCase( 3 ), myId( id ), myMenuName( menu ), myGroup( group ), myIndex( idx ) {}
- CrMenu( QtxAction* action, const int menu, const int id, const int group, const int idx )
+ CrMenu( QAction* action, const int menu, const int id, const int group, const int idx )
: myCase( 4 ), myAction( action ), myMenuId( menu ), myId( id ), myGroup( group ), myIndex( idx ) {}
- CrMenu( QtxAction* action, const QString& menu, const int id, const int group, const int idx )
+ CrMenu( QAction* action, const QString& menu, const int id, const int group, const int idx )
: myCase( 5 ), myAction( action ), myMenuName( menu ), myId( id ), myGroup( group ), myIndex( idx ) {}
int execute( SALOME_PYQT_Module* module ) const
int myMenuId;
QString mySubMenuName;
int myGroup;
- QtxAction* myAction;
+ QAction* myAction;
int myId;
int myIndex;
};
\param idx required index in the menu
\return action ID or -1 if action could not be added
*/
-int SalomePyQt::createMenu( QtxAction* a, const int menu, const int id, const int group, const int idx )
+int SalomePyQt::createMenu( QAction* a, const int menu, const int id, const int group, const int idx )
{
return ProcessEvent( new TCreateMenuEvent( CrMenu( a, menu, id, group, idx ) ) );
}
\param idx required index in the menu
\return action ID or -1 if action could not be added
*/
-int SalomePyQt::createMenu( QtxAction* a, const QString& menu, const int id, const int group, const int idx )
+int SalomePyQt::createMenu( QAction* a, const QString& menu, const int id, const int group, const int idx )
{
return ProcessEvent( new TCreateMenuEvent( CrMenu( a, menu, id, group, idx ) ) );
}
/*!
- \fn QtxAction* SalomePyQt::createSeparator();
+ \fn QAction* SalomePyQt::createSeparator();
\brief Create separator action which can be used in the menu or toolbar.
\return new separator action
*/
class TCreateSepEvent: public SALOME_Event
{
public:
- typedef QtxAction* TResult;
+ typedef QAction* TResult;
TResult myResult;
TCreateSepEvent()
: myResult( 0 ) {}
{
SALOME_PYQT_Module* module = getActiveModule();
if ( module )
- myResult = (QtxAction*)module->separator();
+ myResult = (QAction*)module->separator();
}
};
-QtxAction* SalomePyQt::createSeparator()
+QAction* SalomePyQt::createSeparator()
{
return ProcessEvent( new TCreateSepEvent() );
}
/*!
- \fn QtxAction* SalomePyQt::createAction( const int id,
+ \fn QAction* SalomePyQt::createAction( const int id,
const QString& menuText,
const QString& tipText,
const QString& statusText,
class TCreateActionEvent: public SALOME_Event
{
public:
- typedef QtxAction* TResult;
+ typedef QAction* TResult;
TResult myResult;
int myId;
QString myMenuText;
{
SALOME_PYQT_Module* module = getActiveModule();
if ( module )
- myResult = (QtxAction*)module->createAction( myId, myTipText, myIcon, myMenuText, myStatusText, myKey, myToggle );
+ myResult = (QAction*)module->createAction( myId, myTipText, myIcon, myMenuText, myStatusText, myKey, myToggle );
}
};
-QtxAction* SalomePyQt::createAction( const int id, const QString& menuText,
+QAction* SalomePyQt::createAction( const int id, const QString& menuText,
const QString& tipText, const QString& statusText,
const QString& icon, const int key, const bool toggle )
{
}
/*!
- \fn QtxAction* SalomePyQt::action( const int id )
+ \fn QActionGroup* SalomePyQt::createActionGroup( const int id, const bool exclusive )
+ \brief Create an action group which can be then used in the menu or toolbar
+ \param id : the unique id action group to be registered to
+ \param exclusive : if \c true the action group does exclusive toggling
+*/
+/*
+struct TcreateActionGroupEvent: public SALOME_Event {
+ typedef QActionGroup* TResult;
+ TResult myResult;
+ int myId;
+ bool myExclusive;
+ TcreateActionGroupEvent( const int id, const bool exclusive )
+ : myId( id ), myExclusive( exclusive ) {}
+ virtual void Execute()
+ {
+ SALOME_PYQT_Module* module = getActiveModule();
+ if ( module )
+ myResult = (QAction*)module->createActionGroup( myId, myExclusive );
+ }
+};
+QActionGroup* SalomePyQt::createActionGroup(const int id, const bool exclusive)
+{
+ return ProcessEvent( new TcreateActionGroupEvent( id, exclusive ) );
+}
+*/
+/*!
+ \fn QAction* SalomePyQt::action( const int id )
\brief Get action by specified identifier.
\return action or 0 if action is not registered
*/
class TActionEvent: public SALOME_Event
{
public:
- typedef QtxAction* TResult;
+ typedef QAction* TResult;
TResult myResult;
int myId;
TActionEvent( const int id )
{
SALOME_PYQT_Module* module = getActiveModule();
if ( module )
- myResult = (QtxAction*)module->action( myId );
+ myResult = (QAction*)module->action( myId );
}
};
-QtxAction* SalomePyQt::action( const int id )
+QAction* SalomePyQt::action( const int id )
{
return ProcessEvent( new TActionEvent( id ) );
}
/*!
- \fn int SalomePyQt::actionId( const QtxAction* a );
+ \fn int SalomePyQt::actionId( const QAction* a );
\brief Get an action identifier.
\return action ID or -1 if action is not registered
*/
public:
typedef int TResult;
TResult myResult;
- const QtxAction* myAction;
- TActionIdEvent( const QtxAction* action )
+ const QAction* myAction;
+ TActionIdEvent( const QAction* action )
: myResult( -1 ), myAction( action ) {}
virtual void Execute()
{
myResult = module->actionId( myAction );
}
};
-int SalomePyQt::actionId( const QtxAction* a )
+int SalomePyQt::actionId( const QAction* a )
{
return ProcessEvent( new TActionIdEvent( a ) );
}
/*!
\brief Add the property value to the list of values.
- This method allows creating properties which are QValueList<QVariant>
+ This method allows creating properties which are QList<QVariant>
- there is no way to pass such values directly to QVariant parameter with PyQt.
\param id preferences identifier
};
ProcessVoidEvent( new TEvent() );
}
+
+/*!
+ \brief Gets window with specified identifier
+ \internal
+ \param id window identifier
+ \return pointer on the window
+*/
+static SUIT_ViewWindow* getWnd( const int id )
+{
+ SUIT_ViewWindow* resWnd = 0;
+
+ SalomeApp_Application* app = getApplication();
+ if ( app )
+ {
+ STD_TabDesktop* tabDesk = dynamic_cast<STD_TabDesktop*>( app->desktop() );
+ if ( tabDesk )
+ {
+ QList<SUIT_ViewWindow*> wndlist = tabDesk->windows();
+ SUIT_ViewWindow* wnd;
+ foreach ( wnd, wndlist )
+ {
+ if ( id == wnd->getId() )
+ {
+ resWnd = wnd;
+ break;
+ }
+ }
+ }
+ }
+
+ return resWnd;
+}
+
+/*!
+ \fn QList<int> SalomePyQt::getViews()
+ \brief Get list of integer identifiers of all the currently opened views
+ \return list of integer identifiers of all the currently opened views
+*/
+
+class TGetViews: public SALOME_Event
+{
+public:
+ typedef QList<int> TResult;
+ TResult myResult;
+ TGetViews() {}
+ virtual void Execute()
+ {
+ myResult.clear();
+ SalomeApp_Application* app = getApplication();
+ if ( app )
+ {
+ STD_TabDesktop* tabDesk = dynamic_cast<STD_TabDesktop*>( app->desktop() );
+ if ( tabDesk )
+ {
+ QList<SUIT_ViewWindow*> wndlist = tabDesk->windows();
+ SUIT_ViewWindow* wnd;
+ foreach ( wnd, wndlist )
+ myResult.append( wnd->getId() );
+ }
+ }
+ }
+};
+QList<int> SalomePyQt::getViews()
+{
+ return ProcessEvent( new TGetViews() );
+}
+
+/*!
+ \fn int SalomePyQt::getActiveView()
+ \brief Get integer identifier of the currently active view
+ \return integer identifier of the currently active view
+*/
+
+class TGetActiveView: public SALOME_Event
+{
+public:
+ typedef int TResult;
+ TResult myResult;
+ TGetActiveView()
+ : myResult( -1 ) {}
+ virtual void Execute()
+ {
+ SalomeApp_Application* app = getApplication();
+ if ( app )
+ {
+ SUIT_ViewManager* viewMgr = app->activeViewManager();
+ if ( viewMgr )
+ {
+ SUIT_ViewWindow* wnd = viewMgr->getActiveView();
+ if ( wnd )
+ myResult = wnd->getId();
+ }
+ }
+ }
+};
+int SalomePyQt::getActiveView()
+{
+ return ProcessEvent( new TGetActiveView() );
+}
+
+/*!
+ \fn QString SalomePyQt::getViewType( const int id )
+ \brief Get type of the specified view, e.g. "OCCViewer"
+ \param id window identifier
+ \return view type
+*/
+
+class TGetViewType: public SALOME_Event
+{
+public:
+ typedef QString TResult;
+ TResult myResult;
+ int myWndId;
+ TGetViewType( const int id )
+ : myWndId( id ) {}
+ virtual void Execute()
+ {
+ SUIT_ViewWindow* wnd = getWnd( myWndId );
+ if ( wnd )
+ {
+ SUIT_ViewManager* viewMgr = wnd->getViewManager();
+ if ( viewMgr )
+ myResult = viewMgr->getType();
+ }
+ }
+};
+QString SalomePyQt::getViewType( const int id )
+{
+ return ProcessEvent( new TGetViewType( id ) );
+}
+
+/*!
+ \fn bool SalomePyQt::setViewTitle( const int id, const QString& title )
+ \brief Change view caption
+ \param id window identifier
+ \param title new window title
+ \return \c true if operation is completed successfully and \c false otherwise
+*/
+
+class TSetViewTitle: public SALOME_Event
+{
+public:
+ typedef bool TResult;
+ TResult myResult;
+ int myWndId;
+ QString myTitle;
+ TSetViewTitle( const int id, const QString& title )
+ : myResult( false ),
+ myWndId( id ),
+ myTitle( title ) {}
+ virtual void Execute()
+ {
+ SUIT_ViewWindow* wnd = getWnd( myWndId );
+ if ( wnd )
+ {
+ wnd->setWindowTitle( myTitle );
+ myResult = true;
+ }
+ }
+};
+bool SalomePyQt::setViewTitle( const int id, const QString& title )
+{
+ return ProcessEvent( new TSetViewTitle( id, title ) );
+}
+
+
+/*!
+ \fn QString SalomePyQt::getViewTitle( const int id )
+ \brief Get view caption
+ \param id window identifier
+ \return view caption
+*/
+
+class TGetViewTitle: public SALOME_Event
+{
+public:
+ typedef QString TResult;
+ TResult myResult;
+ int myWndId;
+ TGetViewTitle( const int id )
+ : myWndId( id ) {}
+ virtual void Execute()
+ {
+ SUIT_ViewWindow* wnd = getWnd( myWndId );
+ if ( wnd )
+ myResult = wnd->windowTitle();
+ }
+};
+QString SalomePyQt::getViewTitle( const int id )
+{
+ return ProcessEvent( new TGetViewTitle( id ) );
+}
+
+/*!
+ \fn QList<int> SalomePyQt::findViews( const QString& type )
+ \brief Get list of integer identifiers of all the
+ currently opened views of the specified type
+ \param type viewer type
+ \return list of integer identifiers
+*/
+
+class TFindViews: public SALOME_Event
+{
+public:
+ typedef QList<int> TResult;
+ TResult myResult;
+ QString myType;
+ TFindViews( const QString& type )
+ : myType( type ) {}
+ virtual void Execute()
+ {
+ myResult.clear();
+ SalomeApp_Application* app = getApplication();
+ if ( app )
+ {
+ ViewManagerList vmList;
+ app->viewManagers( myType, vmList );
+ SUIT_ViewManager* viewMgr;
+ foreach ( viewMgr, vmList )
+ {
+ QVector<SUIT_ViewWindow*> vec = viewMgr->getViews();
+ for ( int i = 0, n = vec.size(); i < n; i++ )
+ {
+ SUIT_ViewWindow* wnd = vec[ i ];
+ if ( wnd )
+ myResult.append( wnd->getId() );
+ }
+ }
+ }
+ }
+};
+QList<int> SalomePyQt::findViews( const QString& type )
+{
+ return ProcessEvent( new TFindViews( type ) );
+}
+
+/*!
+ \fn bool SalomePyQt::activateView( const int id )
+ \brief Activate view
+ \param id window identifier
+ \return \c true if operation is completed successfully and \c false otherwise
+*/
+
+class TActivateView: public SALOME_Event
+{
+public:
+ typedef bool TResult;
+ TResult myResult;
+ int myWndId;
+ TActivateView( const int id )
+ : myResult( false ),
+ myWndId( id ) {}
+ virtual void Execute()
+ {
+ SUIT_ViewWindow* wnd = getWnd( myWndId );
+ if ( wnd )
+ {
+ wnd->setFocus();
+ myResult = true;
+ }
+ }
+};
+bool SalomePyQt::activateView( const int id )
+{
+ return ProcessEvent( new TActivateView( id ) );
+}
+
+/*!
+ \fn int SalomePyQt::createView( const QString& type )
+ \brief Create new view and activate it
+ \param type viewer type
+ \return integer identifier of created view (or -1 if view could not be created)
+*/
+
+class TCreateView: public SALOME_Event
+{
+public:
+ typedef int TResult;
+ TResult myResult;
+ QString myType;
+ TCreateView( const QString& theType )
+ : myResult( -1 ),
+ myType( theType ) {}
+ virtual void Execute()
+ {
+ SalomeApp_Application* app = getApplication();
+ if ( app )
+ {
+ SUIT_ViewManager* viewMgr = app->createViewManager( myType );
+ if ( viewMgr )
+ {
+ SUIT_ViewWindow* wnd = viewMgr->getActiveView();
+ if ( wnd )
+ myResult = wnd->getId();
+ }
+ }
+ }
+};
+int SalomePyQt::createView( const QString& type )
+{
+ return ProcessEvent( new TCreateView( type ) );
+}
+
+/*!
+ \fn bool SalomePyQt::closeView( const int id )
+ \brief Close view
+ \param id window identifier
+ \return \c true if operation is completed successfully and \c false otherwise
+*/
+
+class TCloseView: public SALOME_Event
+{
+public:
+ typedef bool TResult;
+ TResult myResult;
+ int myWndId;
+ TCloseView( const int id )
+ : myResult( false ),
+ myWndId( id ) {}
+ virtual void Execute()
+ {
+ SUIT_ViewWindow* wnd = getWnd( myWndId );
+ if ( wnd )
+ {
+ SUIT_ViewManager* viewMgr = wnd->getViewManager();
+ if ( viewMgr )
+ {
+ wnd->close();
+ myResult = true;
+ }
+ }
+ }
+};
+bool SalomePyQt::closeView( const int id )
+{
+ return ProcessEvent( new TCloseView( id ) );
+}
+
+/*!
+ \fn int SalomePyQt::cloneView( const int id )
+ \brief Clone view (if this operation is supported for specified view type)
+ \param id window identifier
+ \return integer identifier of the cloned view or -1 or operation could not be performed
+*/
+
+class TCloneView: public SALOME_Event
+{
+public:
+ typedef int TResult;
+ TResult myResult;
+ int myWndId;
+ TCloneView( const int id )
+ : myResult( -1 ),
+ myWndId( id ) {}
+ virtual void Execute()
+ {
+ SUIT_ViewWindow* wnd = getWnd( myWndId );
+ if ( wnd )
+ {
+ SUIT_ViewManager* viewMgr = wnd->getViewManager();
+ if ( viewMgr )
+ {
+ if ( wnd->inherits( "OCCViewer_ViewWindow" ) )
+ {
+ OCCViewer_ViewWindow* occView = (OCCViewer_ViewWindow*)( wnd );
+ occView->onCloneView();
+
+ wnd = viewMgr->getActiveView();
+ if ( wnd )
+ myResult = wnd->getId();
+ }
+ else if ( wnd->inherits( "Plot2d_ViewWindow" ) )
+ {
+ Plot2d_ViewManager* viewMgr2d = dynamic_cast<Plot2d_ViewManager*>( viewMgr );
+ Plot2d_ViewWindow* srcWnd2d = dynamic_cast<Plot2d_ViewWindow*>( wnd );
+ if ( viewMgr2d && srcWnd2d )
+ {
+ Plot2d_ViewWindow* resWnd = viewMgr2d->cloneView( srcWnd2d );
+ myResult = resWnd->getId();
+ }
+ }
+ }
+ }
+ }
+};
+int SalomePyQt::cloneView( const int id )
+{
+ return ProcessEvent( new TCloneView( id ) );
+}
+
+/*!
+ \fn bool SalomePyQt::isViewVisible( const int id )
+ \brief Check whether view is visible ( i.e. it is on the top of the views stack)
+ \param id window identifier
+ \return \c true if view is visible and \c false otherwise
+*/
+
+class TIsViewVisible: public SALOME_Event
+{
+public:
+ typedef bool TResult;
+ TResult myResult;
+ int myWndId;
+ TIsViewVisible( const int id )
+ : myResult( false ),
+ myWndId( id ) {}
+ virtual void Execute()
+ {
+ SUIT_ViewWindow* wnd = getWnd( myWndId );
+ if ( wnd )
+ {
+ QWidget* p = wnd->parentWidget();
+ myResult = ( p && p->isVisibleTo( p->parentWidget() ) );
+ }
+ }
+};
+bool SalomePyQt::isViewVisible( const int id )
+{
+ return ProcessEvent( new TIsViewVisible( id ) );
+}
+
+/*!
+ \fn bool SalomePyQt::groupAllViews()
+ \brief Group all views to the single tab area
+ \return \c true if operation is completed successfully and \c false otherwise
+*/
+
+class TGroupAllViews: public SALOME_Event
+{
+public:
+ typedef bool TResult;
+ TResult myResult;
+ TGroupAllViews()
+ : myResult( false ) {}
+ virtual void Execute()
+ {
+ SalomeApp_Application* app = getApplication();
+ if ( app )
+ {
+ STD_TabDesktop* tabDesk = dynamic_cast<STD_TabDesktop*>( app->desktop() );
+ if ( tabDesk )
+ {
+ QtxWorkstack* wStack = tabDesk->workstack();
+ if ( wStack )
+ {
+ wStack->stack();
+ myResult = true;
+ }
+ }
+ }
+ }
+};
+bool SalomePyQt::groupAllViews()
+{
+ return ProcessEvent( new TGroupAllViews() );
+}
+
+/*!
+ \fn bool SalomePyQt::splitView( const int id, const Orientation ori, const Action action )
+ \brief Split tab area to which view with identifier belongs to
+ \param id window identifier
+ \param ori orientation of split operation
+ \param action action to be performed
+ \return \c true if operation is completed successfully \c false otherwise
+*/
+
+class TSplitView: public SALOME_Event
+{
+public:
+ typedef bool TResult;
+ TResult myResult;
+ int myWndId;
+ Orientation myOri;
+ Action myAction;
+ TSplitView( const int id,
+ const Orientation ori,
+ const Action action )
+ : myResult( false ),
+ myWndId( id ),
+ myOri( ori ),
+ myAction( action ) {}
+ virtual void Execute()
+ {
+ SUIT_ViewWindow* wnd = getWnd( myWndId );
+ if ( wnd )
+ {
+ // activate view
+ // wnd->setFocus(); ???
+
+ // split workstack
+ if ( getApplication() )
+ {
+ STD_TabDesktop* desk =
+ dynamic_cast<STD_TabDesktop*>( getApplication()->desktop() );
+ if ( desk )
+ {
+ QtxWorkstack* wStack = desk->workstack();
+ if ( wStack )
+ {
+ Qt::Orientation qtOri =
+ ( myOri == Horizontal ) ? Qt::Horizontal : Qt::Vertical;
+
+ QtxWorkstack::SplitType sType;
+ if ( myAction == MoveWidget )
+ sType = QtxWorkstack::SplitMove;
+ else if ( myAction == LeaveWidget )
+ sType = QtxWorkstack::SplitStay;
+ else
+ sType = QtxWorkstack::SplitAt;
+
+ wStack->Split( wnd, qtOri, sType );
+ myResult = true;
+ }
+ }
+ }
+ }
+ }
+};
+bool SalomePyQt::splitView( const int id, const Orientation ori, const Action action )
+{
+ return ProcessEvent( new TSplitView( id, ori, action ) );
+}
+
+/*!
+ \fn bool SalomePyQt::moveView( const int id, const int id_to, const bool before )
+ \brief Move view with the first identifier to the same area which
+ another view with the second identifier belongs to
+ \param id source window identifier
+ \param id_to destination window identifier
+ param before specifies whether the first viewt has to be moved before or after
+ the second view
+ \return \c true if operation is completed successfully and \c false otherwise
+*/
+
+class TMoveView: public SALOME_Event
+{
+public:
+ typedef bool TResult;
+ TResult myResult;
+ int myWndId;
+ int myWndToId;
+ bool myIsBefore;
+ TMoveView( const int id, const int id_to, const bool before )
+ : myResult( false ),
+ myWndId( id ),
+ myWndToId( id_to ),
+ myIsBefore( before ) {}
+ virtual void Execute()
+ {
+ SUIT_ViewWindow* wnd = getWnd( myWndId );
+ SUIT_ViewWindow* wnd_to = getWnd( myWndToId );
+ if ( wnd && wnd_to )
+ {
+ QtxWorkstack* wStack = dynamic_cast<STD_TabDesktop*>(
+ getApplication()->desktop() )->workstack();
+ if ( wStack )
+ myResult = wStack->move( wnd, wnd_to, myIsBefore );
+ }
+ }
+};
+bool SalomePyQt::moveView( const int id, const int id_to, const bool before )
+{
+ return ProcessEvent( new TMoveView( id, id_to, before ) );
+}
+
+/*!
+ \fn QList<int> SalomePyQt::neighbourViews( const int id )
+ \brief Get list of views identifiers that belongs to the same area as
+ specified view (excluding it)
+ \param id window identifier
+ \return list of views identifiers
+*/
+
+class TNeighbourViews: public SALOME_Event
+{
+public:
+ typedef QList<int> TResult;
+ TResult myResult;
+ int myWndId;
+ TNeighbourViews( const int id )
+ : myWndId( id ) {}
+ virtual void Execute()
+ {
+ myResult.clear();
+ SUIT_ViewWindow* wnd = getWnd( myWndId );
+ if ( wnd )
+ {
+ QtxWorkstack* wStack = dynamic_cast<STD_TabDesktop*>(
+ getApplication()->desktop() )->workstack();
+ if ( wStack )
+ {
+ QWidgetList wgList = wStack->windowList( wnd );
+ QWidget* wg;
+ foreach ( wg, wgList )
+ {
+ SUIT_ViewWindow* tmpWnd = dynamic_cast<SUIT_ViewWindow*>( wg );
+ if ( tmpWnd && tmpWnd != wnd )
+ myResult.append( tmpWnd->getId() );
+ }
+ }
+ }
+ }
+};
+QList<int> SalomePyQt::neighbourViews( const int id )
+{
+ return ProcessEvent( new TNeighbourViews( id ) );
+}
class QMenuBar;
class QMenu;
class QWidget;
-class QtxAction;
+class QAction;
+class QActionGroup;
class SALOME_Selection : public QObject
{
PT_File = LightApp_Preferences::File,
};
+//! Orientation
+enum Orientation {
+ Horizontal = 0, //!< Horizontal orientation
+ Vertical = 1 //!< Vertical orientation
+};
+
+//! Action of splitting corresponding to QtxWorkstack::SplitType enumeration
+enum Action {
+ MoveWidget = 0, //!< move specified widget to the new area, other views stay in the previous area
+ LeaveWidget = 1, //!< specified widget stays in the old area, all other views are moved to the new area
+ SplitAt = 2 //!< the view area is splitted in such a way, that specified view and all views which follow it, are moved to the new area
+};
+
class SalomePyQt
{
public:
static int createTool( const QString& );
static int createTool( const int, const int, const int = -1 );
static int createTool( const int, const QString&, const int = -1 );
- static int createTool( QtxAction*, const int, const int = -1, const int = -1 );
- static int createTool( QtxAction*, const QString&, const int = -1, const int = -1 );
+ static int createTool( QAction*, const int, const int = -1, const int = -1 );
+ static int createTool( QAction*, const QString&, const int = -1, const int = -1 );
static int createMenu( const QString&, const int = -1,
const int = -1, const int = -1, const int = -1 );
const int = -1, const int = -1 );
static int createMenu( const int, const QString& = QString(),
const int = -1, const int = -1 );
- static int createMenu( QtxAction*, const int, const int = -1,
+ static int createMenu( QAction*, const int, const int = -1,
const int = -1, const int = -1 );
- static int createMenu( QtxAction*, const QString&, const int = -1,
+ static int createMenu( QAction*, const QString&, const int = -1,
const int = -1, const int = -1 );
- static QtxAction* createSeparator();
+ static QAction* createSeparator();
- static QtxAction* createAction( const int, const QString&,
+ static QAction* createAction( const int, const QString&,
const QString& = QString(), const QString& = QString(),
const QString& = QString(), const int = 0, const bool = false );
+
+ // static QActionGroup* createActionGroup( const int, const bool = true );
- static QtxAction* action( const int );
- static int actionId( const QtxAction* );
+ static QAction* action( const int );
+ static int actionId( const QAction* );
static void addSetting ( const QString&, const QString&, const double );
static void addSetting ( const QString&, const QString&, const int );
static void message( const QString&, bool = true );
static void clearMessages();
+
+ static QList<int> getViews();
+ static int getActiveView();
+ static QString getViewType( const int );
+ static bool setViewTitle( const int, const QString& );
+ static QString getViewTitle( const int );
+ static QList<int> findViews( const QString& );
+ static bool activateView( const int );
+ static int createView( const QString& );
+ static bool closeView( const int );
+ static int cloneView( const int );
+ static bool isViewVisible( const int id );
+
+ static bool groupAllViews();
+ static bool splitView( const int, const Orientation, const Action );
+ static bool moveView( const int, const int, const bool );
+ static QList<int> neighbourViews( const int );
};
#endif // SALOME_PYQT_H
PT_File,
};
+enum Orientation {
+ Horizontal = 0,
+ Vertical = 1
+};
+
+enum Action {
+ MoveWidget = 0,
+ LeaveWidget = 1,
+ SplitAt = 2
+};
+
class QtxAction : QAction
{
%TypeHeaderCode
static int createTool( const QString& ) /ReleaseGIL/ ;
static int createTool( const int, const int, const int = -1 ) /ReleaseGIL/ ;
static int createTool( const int, const QString&, const int = -1 ) /ReleaseGIL/ ;
- static int createTool( QtxAction*, const int, const int = -1, const int = -1 ) /ReleaseGIL/ ;
- static int createTool( QtxAction*, const QString&, const int = -1, const int = -1 ) /ReleaseGIL/ ;
+ static int createTool( QAction*, const int, const int = -1, const int = -1 ) /ReleaseGIL/ ;
+ static int createTool( QAction*, const QString&, const int = -1, const int = -1 ) /ReleaseGIL/ ;
static int createMenu( const QString&, const int,
const int = -1, const int = -1, const int = -1 ) /ReleaseGIL/ ;
const int = -1, const int = -1 ) /ReleaseGIL/ ;
static int createMenu( const int, const QString&,
const int = -1, const int = -1 ) /ReleaseGIL/ ;
- static int createMenu( QtxAction*, const int, const int = -1,
+ static int createMenu( QAction*, const int, const int = -1,
const int = -1, const int = -1 ) /ReleaseGIL/ ;
- static int createMenu( QtxAction*, const QString&, const int = -1,
+ static int createMenu( QAction*, const QString&, const int = -1,
const int = -1, const int = -1 ) /ReleaseGIL/ ;
- static QtxAction* createSeparator() /ReleaseGIL/ ;
+ static QAction* createSeparator() /ReleaseGIL/ ;
- static QtxAction* createAction( const int, const QString&,
+ static QAction* createAction( const int, const QString&,
const QString& = QString(), const QString& = QString(),
const QString& = QString(), const int = 0, const bool = false ) /ReleaseGIL/ ;
- static QtxAction* action( const int ) /ReleaseGIL/ ;
- static int actionId( const QtxAction* ) /ReleaseGIL/ ;
+ //static QActionGroup* createActionGroup( const int, const bool = true ) /ReleaseGIL/ ;
+
+ static QAction* action( const int ) /ReleaseGIL/ ;
+ static int actionId( const QAction* ) /ReleaseGIL/ ;
static void addSetting ( const QString&, const QString&, const double ) /ReleaseGIL/ ;
static void addSetting ( const QString&, const QString&, const int /Constrained/ ) /ReleaseGIL/ ;
static void message( const QString&, bool = true ) /ReleaseGIL/ ;
static void clearMessages() /ReleaseGIL/ ;
+
+ static QList<int> getViews() /ReleaseGIL/ ;
+ static int getActiveView() /ReleaseGIL/ ;
+ static QString getViewType( const int ) /ReleaseGIL/ ;
+ static bool setViewTitle( const int, const QString& ) /ReleaseGIL/ ;
+ static QString getViewTitle( const int ) /ReleaseGIL/ ;
+ static QList<int> findViews( const QString& ) /ReleaseGIL/ ;
+ static bool activateView( const int ) /ReleaseGIL/ ;
+ static int createView( const QString& ) /ReleaseGIL/ ;
+ static bool closeView( const int ) /ReleaseGIL/ ;
+ static int cloneView( const int ) /ReleaseGIL/ ;
+ static bool isViewVisible( const int id ) /ReleaseGIL/ ;
+
+ static bool groupAllViews() /ReleaseGIL/ ;
+ static bool splitView( const int, Orientation, Action ) /ReleaseGIL/ ;
+ static bool moveView( const int, const int, const bool ) /ReleaseGIL/ ;
+ static QList<int> neighbourViews( const int ) /ReleaseGIL/ ;
};
*/
void SPlot2d_Viewer::onCloneView( Plot2d_ViewFrame* clonedVF, Plot2d_ViewFrame* newVF )
{
- if( !clonedVF || !newVF )
+ // this code is moved on the level of base class
+ /*if( !clonedVF || !newVF )
return;
// 1) Copy all properties of view
if( aCurve && clonedVF->isVisible( aCurve ) )
newVF->displayCurve( aCurve, false );
}
- newVF->Repaint();
+ newVF->Repaint();*/
+
+ Plot2d_Viewer::onCloneView( clonedVF, newVF );
}
/*!
#include <QLabel>
#include <QStatusBar>
#include <QApplication>
+#include <QSize>
#include <QtxAction.h>
#include <QtxActionMenuMgr.h>
#include <QtxActionToolMgr.h>
+/*!
+ \class StatusLabel
+ \brief Status bar customization label. Used to workaroubd desktop resizing bug.
+ \internal
+*/
+class StatusLabel : public QLabel
+{
+public:
+ StatusLabel( QWidget* parent ) : QLabel( parent ) {}
+ QSize minimumSizeHint () const { return QSize( 0, 0 ); }
+};
+
/*!
Default constructor
*/
if ( !myStatusLabel )
{
- myStatusLabel = new QLabel( desktop()->statusBar() );
+ myStatusLabel = new StatusLabel( desktop()->statusBar() );
desktop()->statusBar()->addWidget( myStatusLabel, 1 );
myStatusLabel->show();
}
return dirname;
}
+/*!
+ \brief Get last visited path
+ \return last visited path
+*/
+QString SUIT_FileDlg::getLastVisitedPath()
+{
+ return myLastVisitedPath;
+}
+
/*!
\brief Selects current file
const bool = true,
SUIT_FileValidator* = 0 );
+ static QString getLastVisitedPath();
+
protected:
virtual bool event( QEvent* );
QLineEdit* lineEdit() const;
if ( myAppList.isEmpty() )
{
- printf( "Calling QApplication::exit() with exit code = %d\n", myExitStatus );
+ //printf( "Calling QApplication::exit() with exit code = %d\n", myExitStatus );
QApplication::instance()->exit( myExitStatus );
}
}
{
return myToolMgr;
}
+
+/*!
+ \return window unique identifier
+*/
+int SUIT_ViewWindow::getId() const
+{
+ return int(long(this));
+}
virtual void setVisualParameters( const QString& parameters );
void setDestructiveClose( const bool );
+
+ int getId() const;
QtxActionToolMgr* toolMgr() const;
if(myIsPreselected){
const TColStd_IndexedMapOfInteger& aMapIndex = myPreHighlightActor->GetMapIndex();
int anExtent = aMapIndex.Extent();
- anIsChanged |= (anExtent == 0);
+ anIsChanged |= (anExtent == 0 || anExtent == 1);
anIsChanged |= (anExtent == 2 && (anObjId != aMapIndex(1) || anEdgeId != aMapIndex(2)));
if(anIsChanged){
TColStd_IndexedMapOfInteger aMapIndex;
#include <vtkTextProperty.h>
/*!
- * Class : AxisWg
- * Description : Tab of dialog
- */
+ \class SVTK_CubeAxesDlg::AxisWidget
+ \brief Axis tab widget of the "Graduated axis" dialog box
+ \internal
+*/
+
+class SVTK_CubeAxesDlg::AxisWidget : public QFrame
+{
+public:
+ AxisWidget( QWidget* );
+ ~AxisWidget();
+
+ void UseName( const bool );
+ void SetName( const QString& );
+ void SetNameFont( const QColor&, const int, const bool, const bool, const bool );
+ bool ReadData( vtkAxisActor2D* );
+ bool Apply( vtkAxisActor2D* );
+
+private:
+ // name
+ QGroupBox* myNameGrp;
+ QLineEdit* myAxisName;
+ SVTK_FontWidget* myNameFont;
+
+ // labels
+ QGroupBox* myLabelsGrp;
+ QtxIntSpinBox* myLabelNumber;
+ QtxIntSpinBox* myLabelOffset;
+ SVTK_FontWidget* myLabelsFont;
+
+ // tick marks
+ QGroupBox* myTicksGrp;
+ QtxIntSpinBox* myTickLength;
+
+ friend class SVTK_CubeAxesDlg;
+};
/*!
Constructor
*/
-SVTK_AxisWidget::SVTK_AxisWidget (QWidget* theParent)
+SVTK_CubeAxesDlg::AxisWidget::AxisWidget (QWidget* theParent)
: QFrame(theParent)
{
QList< QLabel* > aLabels;
// "Name" grp
- myNameGrp = new QGroupBox(tr("AXIS_NAME"), this);
+ myNameGrp = new QGroupBox(SVTK_CubeAxesDlg::tr("AXIS_NAME"), this);
+ myNameGrp->setCheckable( true );
+
QVBoxLayout* aVBox = new QVBoxLayout;
- myIsNameVisible = new QCheckBox(tr("IS_VISIBLE"), myNameGrp);
- aVBox->addWidget(myIsNameVisible);
-
QHBoxLayout* aHBox = new QHBoxLayout;
aHBox->setSpacing(5);
- QLabel* aLabel = new QLabel(tr("NAME"));
+ QLabel* aLabel = new QLabel(SVTK_CubeAxesDlg::tr("NAME"));
aHBox->addWidget(aLabel);
myAxisName = new QLineEdit;
aHBox->addWidget(myAxisName);
aHBox = new QHBoxLayout;
aHBox->setSpacing(5);
- aLabel = new QLabel(tr("FONT"));
+ aLabel = new QLabel(SVTK_CubeAxesDlg::tr("FONT"));
aHBox->addWidget(aLabel);
myNameFont = new SVTK_FontWidget(myNameGrp);
aHBox->addWidget(myNameFont);
// "Labels" grp
- myLabelsGrp = new QGroupBox(tr("LABELS"), this);
- aVBox = new QVBoxLayout;
+ myLabelsGrp = new QGroupBox(SVTK_CubeAxesDlg::tr("LABELS"), this);
+ myLabelsGrp->setCheckable( true );
- myIsLabelsVisible = new QCheckBox(tr("IS_VISIBLE"), myLabelsGrp);
- aVBox->addWidget(myIsLabelsVisible);
+ aVBox = new QVBoxLayout;
aHBox = new QHBoxLayout;
aHBox->setSpacing(5);
- aLabel = new QLabel(tr("NUMBER"));
+ aLabel = new QLabel(SVTK_CubeAxesDlg::tr("NUMBER"));
aHBox->addWidget(aLabel);
myLabelNumber = new QtxIntSpinBox(0,25,1,myLabelsGrp);
- myLabelNumber->setObjectName("SpinBoxLabelNumber");
aHBox->addWidget(myLabelNumber);
aLabels.append(aLabel);
aVBox->addLayout(aHBox);
aHBox = new QHBoxLayout;
aHBox->setSpacing(5);
- aLabel = new QLabel(tr("OFFSET"));
+ aLabel = new QLabel(SVTK_CubeAxesDlg::tr("OFFSET"));
aHBox->addWidget(aLabel);
myLabelOffset = new QtxIntSpinBox(0,100,1,myLabelsGrp);
- myLabelOffset->setObjectName("SpinBoxLabellOffset");
aHBox->addWidget(myLabelOffset);
aLabels.append(aLabel);
aVBox->addLayout(aHBox);
aHBox = new QHBoxLayout;
aHBox->setSpacing(5);
- aLabel = new QLabel(tr("FONT"));
+ aLabel = new QLabel(SVTK_CubeAxesDlg::tr("FONT"));
aHBox->addWidget(aLabel);
myLabelsFont = new SVTK_FontWidget(myLabelsGrp);
aHBox->addWidget(myLabelsFont);
// "Tick marks" grp
- myTicksGrp = new QGroupBox(tr("TICK_MARKS"), this);
- aVBox = new QVBoxLayout;
+ myTicksGrp = new QGroupBox(SVTK_CubeAxesDlg::tr("TICK_MARKS"), this);
+ myTicksGrp->setCheckable( true );
- myIsTicksVisible = new QCheckBox(tr("IS_VISIBLE"), myTicksGrp);
- aVBox->addWidget(myIsTicksVisible);
+ aVBox = new QVBoxLayout;
aHBox = new QHBoxLayout;
aHBox->setSpacing(5);
- aLabel = new QLabel(tr("LENGTH"));
+ aLabel = new QLabel(SVTK_CubeAxesDlg::tr("LENGTH"));
aHBox->addWidget(aLabel);
myTickLength = new QtxIntSpinBox(0,100,1,myTicksGrp);
- myTickLength->setObjectName("SpinBoxTickLength");
aHBox->addWidget(myTickLength);
aLabels.append(aLabel);
aVBox->addLayout(aHBox);
aLay->addWidget(myTicksGrp);
// init
- myIsNameVisible->setChecked(true);
- myIsLabelsVisible->setChecked(true);
- myIsTicksVisible->setChecked(true);
- updateControlState();
+ myNameGrp->setChecked( true );
+ myLabelsGrp->setChecked( true );
+ myTicksGrp->setChecked( true );
// Adjust label widths
QList< QLabel* >::iterator anIter;
aMaxWidth = qMax(aMaxWidth, (*anIter)->sizeHint().width());
for (anIter = aLabels.begin(); anIter != aLabels.end(); anIter++)
(*anIter)->setFixedWidth(aMaxWidth);
-
- // connect signals and slots
- connect(myIsNameVisible, SIGNAL(stateChanged(int)), SLOT(onNameChecked()));
- connect(myIsLabelsVisible, SIGNAL(stateChanged(int)), SLOT(onLabelsChecked()));
- connect(myIsTicksVisible, SIGNAL(stateChanged(int)), SLOT(onTicksChecked()));
}
/*!
Destructor
*/
-SVTK_AxisWidget::~SVTK_AxisWidget()
-{
-}
-
-void SVTK_AxisWidget::updateControlState()
-{
- onNameChecked();
- onLabelsChecked();
- onTicksChecked();
-}
-
-void SVTK_AxisWidget::setEnabled(QGroupBox* theGrp, const bool theState)
-{
- QObjectList aChildren(theGrp->children());
- QObject* anObj;
- for(int i = 0; i < aChildren.size(); i++)
- {
- anObj = aChildren.at(i);
- if (anObj !=0 && anObj->inherits("QHBoxLayout"))
- ((QHBoxLayout*)anObj)->setEnabled(theState);
- }
-}
-
-void SVTK_AxisWidget::onLabelsChecked()
-{
- setEnabled(myLabelsGrp, myIsLabelsVisible->isChecked());
-}
-
-void SVTK_AxisWidget::onTicksChecked()
-{
- setEnabled(myTicksGrp, myIsTicksVisible->isChecked());
-}
-
-void SVTK_AxisWidget::onNameChecked()
+SVTK_CubeAxesDlg::AxisWidget::~AxisWidget()
{
- setEnabled(myNameGrp, myIsNameVisible->isChecked());
}
-void SVTK_AxisWidget::UseName(const bool toUse)
+void SVTK_CubeAxesDlg::AxisWidget::UseName(const bool toUse)
{
- myIsNameVisible->setChecked(toUse);
+ myNameGrp->setChecked(toUse);
}
-void SVTK_AxisWidget::SetName(const QString& theName)
+void SVTK_CubeAxesDlg::AxisWidget::SetName(const QString& theName)
{
myAxisName->setText(theName);
}
-void SVTK_AxisWidget::SetNameFont(const QColor& theColor,
- const int theFont,
- const bool theIsBold,
- const bool theIsItalic,
- const bool theIsShadow)
+void SVTK_CubeAxesDlg::AxisWidget::SetNameFont(const QColor& theColor,
+ const int theFont,
+ const bool theIsBold,
+ const bool theIsItalic,
+ const bool theIsShadow)
{
myNameFont->SetData(theColor, theFont, theIsBold, theIsItalic, theIsShadow);
}
-bool SVTK_AxisWidget::ReadData(vtkAxisActor2D* theActor)
+bool SVTK_CubeAxesDlg::AxisWidget::ReadData(vtkAxisActor2D* theActor)
{
if (theActor == 0)
return false;
isTitleShadow = aTitleProp->GetShadow() ? true : false;
}
- myIsNameVisible->setChecked(useName);
+ myNameGrp->setChecked(useName);
myAxisName->setText(aTitle);
myNameFont->SetData(aTitleColor, aTitleFontFamily, isTitleBold, isTitleItalic, isTitleShadow);
isLabelsShadow = aLabelsProp->GetShadow() ? true : false;
}
- myIsLabelsVisible->setChecked(useLabels);
+ myLabelsGrp->setChecked(useLabels);
myLabelNumber->setValue(nbLabels);
myLabelOffset->setValue(anOffset);
myLabelsFont->SetData(aLabelsColor, aLabelsFontFamily, isLabelsBold, isLabelsItalic, isLabelsShadow);
bool useTickMarks = theActor->GetTickVisibility();
int aTickLength = theActor->GetTickLength();
- myIsTicksVisible->setChecked(useTickMarks);
+ myTicksGrp->setChecked(useTickMarks);
myTickLength->setValue(aTickLength);
return true;
}
-bool SVTK_AxisWidget::Apply(vtkAxisActor2D* theActor)
+bool SVTK_CubeAxesDlg::AxisWidget::Apply(vtkAxisActor2D* theActor)
{
if (theActor == 0)
return false;
// Name
- theActor->SetTitleVisibility(myIsNameVisible->isChecked() ? 1 : 0);
+ theActor->SetTitleVisibility(myNameGrp->isChecked() ? 1 : 0);
theActor->SetTitle(myAxisName->text().toLatin1());
QColor aTitleColor(255, 255, 255);
// Labels
- theActor->SetLabelVisibility(myIsLabelsVisible->isChecked() ? 1 : 0);
+ theActor->SetLabelVisibility(myLabelsGrp->isChecked() ? 1 : 0);
int nbLabels = myLabelNumber->value();
theActor->SetNumberOfLabels(nbLabels);
// Tick marks
- theActor->SetTickVisibility(myIsTicksVisible->isChecked());
+ theActor->SetTickVisibility(myTicksGrp->isChecked());
int aTickLength = myTickLength->value();
theActor->SetTickLength(aTickLength);
myTabWg = new QTabWidget(aFrame);
- myAxes[ 0 ] = new SVTK_AxisWidget(myTabWg);
- myAxes[ 1 ] = new SVTK_AxisWidget(myTabWg);
- myAxes[ 2 ] = new SVTK_AxisWidget(myTabWg);
+ myAxes[ 0 ] = new AxisWidget(myTabWg);
+ myAxes[ 1 ] = new AxisWidget(myTabWg);
+ myAxes[ 2 ] = new AxisWidget(myTabWg);
myTabWg->addTab(myAxes[ 0 ], tr("X_AXIS"));
myTabWg->addTab(myAxes[ 1 ], tr("Y_AXIS"));
#include "SVTK_DialogBase.h"
-#include <QFrame>
-
class QWidget;
class QPushButton;
class QTabWidget;
class QCheckBox;
-class QLineEdit;
-class QGroupBox;
class QtxAction;
-class QtxIntSpinBox;
-
-class vtkAxisActor2D;
class SVTK_CubeAxesActor2D;
-
-class SVTK_FontWidget;
-class SVTK_AxisWidget;
class SVTK_MainWindow;
/*!
{
Q_OBJECT
+ class AxisWidget;
+
public:
SVTK_CubeAxesDlg(QtxAction* theAction,
SVTK_MainWindow* theParent,
QPushButton* myOkBtn;
QPushButton* myApplyBtn;
QPushButton* myCloseBtn;
- SVTK_AxisWidget* myAxes[ 3 ];
-};
-
-/*!
- * Class : SVTK_AxisWidget
- * Description : Tab of dialog
- */
-class SVTK_AxisWidget : public QFrame
-{
- Q_OBJECT
-
-public:
- SVTK_AxisWidget( QWidget* );
- ~SVTK_AxisWidget();
-
- void UseName( const bool );
- void SetName( const QString& );
- void SetNameFont( const QColor&, const int, const bool, const bool, const bool );
- bool ReadData( vtkAxisActor2D* );
- bool Apply( vtkAxisActor2D* );
-
-private slots:
- void onNameChecked();
- void onLabelsChecked();
- void onTicksChecked();
-
-private:
- void updateControlState();
- void setEnabled( QGroupBox*, const bool );
-
-private:
- // name
- QGroupBox* myNameGrp;
- QCheckBox* myIsNameVisible;
- QLineEdit* myAxisName;
- SVTK_FontWidget* myNameFont;
-
- // labels
- QGroupBox* myLabelsGrp;
- QCheckBox* myIsLabelsVisible;
- QtxIntSpinBox* myLabelNumber;
- QtxIntSpinBox* myLabelOffset;
- SVTK_FontWidget* myLabelsFont;
-
- // tick marks
- QGroupBox* myTicksGrp;
- QCheckBox* myIsTicksVisible;
- QtxIntSpinBox* myTickLength;
-
- friend class SVTK_CubeAxesDlg;
+ AxisWidget* myAxes[ 3 ];
};
#endif
// and handle the transformation ourselves.
vtkMatrix4x4 *aMatrix = vtkMatrix4x4::New();
aMatrix->DeepCopy(theRenderer->GetActiveCamera()->
- GetCompositePerspectiveTransformMatrix(1,0,1));
+ GetCompositePerspectiveTransformMatrix( theRenderer->GetTiledAspectRatio(), 0, 1 ) );
for(vtkIdType aCellId = 0; aCellId < aNumCells; aCellId++){
vtkCell* aCell = theInput->GetCell(aCellId);
#include "SVTK_SelectorDef.h"
-#include "VTKViewer_Filter.h"
+#include <VTKViewer_Filter.h>
#include "SALOME_Actor.h"
+#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
+
#include <TColStd_MapIteratorOfMapOfInteger.hxx>
#include <TColStd_IndexedMapOfInteger.hxx>
SVTK_SelectorDef
::Pick(const SVTK_SelectionEvent* theEvent, vtkRenderer* theRenderer) const
{
- myCellPicker->Pick(theEvent->myX,
- theEvent->myY,
- 0.0,
- theRenderer);
-
- vtkActorCollection* aListActors = myCellPicker->GetActors();
- SALOME_Actor* anActor = GetLastSALOMEActor(aListActors);
+ bool anAdvancedSelectionAlgorithm = true;
+ SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
+ if ( aResourceMgr )
+ anAdvancedSelectionAlgorithm = aResourceMgr->booleanValue( "VTKViewer", "use_advanced_selection_algorithm", true );
+
+ SALOME_Actor* anActor = NULL;
+ vtkActorCollection* aListActors = NULL;
+ if ( anAdvancedSelectionAlgorithm ) {
+ myCellPicker->Pick(theEvent->myX,
+ theEvent->myY,
+ 0.0,
+ theRenderer);
- if (! anActor) {
+ aListActors = myCellPicker->GetActors();
+ anActor = GetLastSALOMEActor(aListActors);
+ }
+
+ if ( !anActor ) {
myPicker->Pick(theEvent->myX,
theEvent->myY,
0.0,
</message>
</context>
<context>
- <name>SVTK_AxisWidget</name>
+ <name>SVTK_CubeAxesDlg</name>
+ <message>
+ <source>X_AXIS</source>
+ <translation>X axis</translation>
+ </message>
+ <message>
+ <source>Y_AXIS</source>
+ <translation>Y axis</translation>
+ </message>
+ <message>
+ <source>Z_AXIS</source>
+ <translation>Z axis</translation>
+ </message>
+ <message>
+ <source>CAPTION</source>
+ <translation>Graduated axes</translation>
+ </message>
+ <message>
+ <source>IS_VISIBLE</source>
+ <translation>Is visible</translation>
+ </message>
<message>
<source>FONT</source>
<translation>Font</translation>
<source>OFFSET</source>
<translation>Offset</translation>
</message>
- <message>
- <source>IS_VISIBLE</source>
- <translation>Is visible</translation>
- </message>
<message>
<source>AXIS_NAME</source>
<translation>Axis name</translation>
</message>
</context>
-<context>
- <name>SVTK_CubeAxesDlg</name>
- <message>
- <source>X_AXIS</source>
- <translation>X axis</translation>
- </message>
- <message>
- <source>Y_AXIS</source>
- <translation>Y axis</translation>
- </message>
- <message>
- <source>Z_AXIS</source>
- <translation>Z axis</translation>
- </message>
- <message>
- <source>CAPTION</source>
- <translation>Graduated axes</translation>
- </message>
- <message>
- <source>IS_VISIBLE</source>
- <translation>Is visible</translation>
- </message>
-</context>
<context>
<name>SVTK_FontWidget</name>
<message>
<name>SVTK_NonIsometricDlg</name>
<message>
<source>LBL_X</source>
- <translation>X :</translation>
+ <translation>X:</translation>
</message>
<message>
<source>LBL_Y</source>
- <translation>Y :</translation>
+ <translation>Y:</translation>
</message>
<message>
<source>LBL_Z</source>
- <translation>Z :</translation>
+ <translation>Z:</translation>
</message>
<message>
<source>MEN_SCALING</source>
<name>SVTK_SetRotationPointDlg</name>
<message>
<source>LBL_X</source>
- <translation>X :</translation>
+ <translation>X:</translation>
</message>
<message>
<source>LBL_Y</source>
- <translation>Y :</translation>
+ <translation>Y:</translation>
</message>
<message>
<source>LBL_Z</source>
- <translation>Z :</translation>
+ <translation>Z:</translation>
</message>
<message>
<source>LBL_CENTER_OF_BOUNDING_BOX</source>
#include <SUIT_Desktop.h>
#include <SUIT_DataBrowser.h>
#include <SUIT_FileDlg.h>
+#include <SUIT_FileValidator.h>
#include <SUIT_MessageBox.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_TreeModel.h>
-#include <QtxMRUAction.h>
#include <QtxTreeView.h>
// temporary commented
QCheckBox* mySaveGUIChk;
};
+class DumpStudyFileValidator : public SUIT_FileValidator
+{
+ public:
+ DumpStudyFileValidator( QWidget* parent) : SUIT_FileValidator ( parent ) {};
+ virtual ~DumpStudyFileValidator() {};
+ virtual bool canSave( const QString& file );
+};
+
+bool DumpStudyFileValidator::canSave(const QString& file)
+{
+ QFileInfo fi( file );
+ QString name = fi.fileName();
+
+ if ( name.indexOf( QRegExp("[-!?#*&]") ) >= 0 ) {
+ SUIT_MessageBox::critical( parent(),
+ QObject::tr("WRN_WARNING"),
+ QObject::tr("WRN_FILE_NAME_BAD") );
+ return false;
+ }
+ return SUIT_FileValidator::canSave( file );
+}
+
/*!Private SLOT. On dump study.*/
void SalomeApp_Application::onDumpStudy( )
{
QStringList aFilters;
aFilters.append( tr( "PYTHON_FILES_FILTER" ) );
- DumpStudyFileDlg* fd = new DumpStudyFileDlg( desktop() );
- fd->setWindowTitle( tr( "TOT_DESK_FILE_DUMP_STUDY" ) );
- fd->setFilters( aFilters );
- fd->myPublishChk->setChecked( true );
- fd->mySaveGUIChk->setChecked( true );
- QString aFileName;
- while (1) {
- fd->exec();
- fd->raise();
- aFileName = fd->selectedFile();
- if ( aFileName.isEmpty() )
- break;
- if ( aFileName.indexOf( QRegExp("[-!?#*&]") ) == -1 )
- break;
- SUIT_MessageBox::warning( desktop(),
- tr( "WRN_WARNING" ),
- tr( "WRN_FILE_NAME_BAD" ) );
- }
- bool toPublish = fd->myPublishChk->isChecked();
- bool toSaveGUI = fd->mySaveGUIChk->isChecked();
- delete fd;
-
- if ( !aFileName.isEmpty() ) {
- QFileInfo aFileInfo(aFileName);
- if( aFileInfo.isDir() ) // IPAL19257
- return;
-
- int savePoint;
- _PTR(AttributeParameter) ap;
- _PTR(IParameters) ip = ClientFactory::getIParameters(ap);
- if(ip->isDumpPython(appStudy->studyDS())) ip->setDumpPython(appStudy->studyDS()); //Unset DumpPython flag.
- if ( toSaveGUI ) { //SRN: Store a visual state of the study at the save point for DumpStudy method
- ip->setDumpPython(appStudy->studyDS());
- savePoint = SalomeApp_VisualState( this ).storeState(); //SRN: create a temporary save point
+ DumpStudyFileDlg fd( desktop() );
+ fd.setValidator( new DumpStudyFileValidator( &fd ) );
+ fd.setWindowTitle( tr( "TOT_DESK_FILE_DUMP_STUDY" ) );
+ fd.setFilters( aFilters );
+ fd.myPublishChk->setChecked( true );
+ fd.mySaveGUIChk->setChecked( true );
+ if ( fd.exec() == QDialog::Accepted )
+ {
+ QString aFileName = fd.selectedFile();
+
+ bool toPublish = fd.myPublishChk->isChecked();
+ bool toSaveGUI = fd.mySaveGUIChk->isChecked();
+
+ if ( !aFileName.isEmpty() ) {
+ QFileInfo aFileInfo(aFileName);
+ if( aFileInfo.isDir() ) // IPAL19257
+ return;
+
+ int savePoint;
+ _PTR(AttributeParameter) ap;
+ _PTR(IParameters) ip = ClientFactory::getIParameters(ap);
+ if(ip->isDumpPython(appStudy->studyDS())) ip->setDumpPython(appStudy->studyDS()); //Unset DumpPython flag.
+ if ( toSaveGUI ) { //SRN: Store a visual state of the study at the save point for DumpStudy method
+ ip->setDumpPython(appStudy->studyDS());
+ savePoint = SalomeApp_VisualState( this ).storeState(); //SRN: create a temporary save point
+ }
+ bool res = aStudy->DumpStudy( aFileInfo.absolutePath().toStdString(),
+ aFileInfo.baseName().toStdString(), toPublish);
+ if ( toSaveGUI )
+ appStudy->removeSavePoint(savePoint); //SRN: remove the created temporary save point.
+ if ( !res )
+ SUIT_MessageBox::warning( desktop(),
+ QObject::tr("WRN_WARNING"),
+ tr("WRN_DUMP_STUDY_FAILED") );
}
- bool res = aStudy->DumpStudy( aFileInfo.absolutePath().toStdString(),
- aFileInfo.baseName().toStdString(), toPublish);
- if ( toSaveGUI )
- appStudy->removeSavePoint(savePoint); //SRN: remove the created temporary save point.
- if ( !res )
- SUIT_MessageBox::warning( desktop(),
- QObject::tr("WRN_WARNING"),
- tr("WRN_DUMP_STUDY_FAILED") );
}
}
QStringList filtersList;
filtersList.append(tr("PYTHON_FILES_FILTER"));
filtersList.append(tr("ALL_FILES_FILTER"));
+
+ QString anInitialPath = "";
+ if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
+ anInitialPath = QDir::currentPath();
- QString aFile = SUIT_FileDlg::getFileName( desktop(), "", filtersList, tr( "TOT_DESK_FILE_LOAD_SCRIPT" ), true, true );
+ QString aFile = SUIT_FileDlg::getFileName( desktop(), anInitialPath, filtersList, tr( "TOT_DESK_FILE_LOAD_SCRIPT" ), true, true );
if ( !aFile.isEmpty() )
{
if ( myObject && myObject->FindAttribute( anAttr, "AttributePixMap" ) ){
_PTR(AttributePixMap) aPixAttr ( anAttr );
if ( aPixAttr->HasPixMap() ) {
- QString pixmapName = QObject::tr( aPixAttr->GetPixMap().c_str() );
+ QString componentType = componentDataType();
+ QString pixmapID = aPixAttr->GetPixMap().c_str();
+ // select a plugin within a component
+ QStringList plugin_pixmap = pixmapID.split( "::", QString::KeepEmptyParts );
+ if ( plugin_pixmap.size() == 2 ) {
+ componentType = plugin_pixmap.front();
+ pixmapID = plugin_pixmap.back();
+ }
+ QString pixmapName = QObject::tr( pixmapID.toLatin1().constData() );
LightApp_RootObject* aRoot = dynamic_cast<LightApp_RootObject*>( root() );
if ( aRoot && aRoot->study() ) {
SUIT_ResourceMgr* mgr = aRoot->study()->application()->resourceMgr();
- return mgr->loadPixmap( componentDataType(), pixmapName, false );
+ return mgr->loadPixmap( componentType, pixmapName, false );
}
}
}
<parameter name="killall" value="no"/>
<parameter name="pinter" value="no"/>
<parameter name="noexcepthandler" value="no"/>
- <parameter name="modules" value="GEOM,SMESH,VISU,SUPERV,MED,COMPONENT,PYCALCULATOR"/>
+ <parameter name="modules" value="GEOM,SMESH,VISU,SUPERV,MED,YACS,COMPONENT,PYCALCULATOR"/>
<parameter name="pyModules" value=""/>
<parameter name="embedded" value="SalomeAppEngine,study,cppContainer,registry,moduleCatalog"/>
<parameter name="standalone" value="pyContainer,supervContainer"/>
<parameter name="GHS3DPlugin" value="${GHS3DPLUGIN_ROOT_DIR}/share/salome/resources/ghs3dplugin"/>
<parameter name="BLSURFPlugin" value="${BLSURFPLUGIN_ROOT_DIR}/share/salome/resources"/>
<parameter name="HexoticPLUGIN" value="${HexoticPLUGIN_ROOT_DIR}/share/salome/resources"/>
+ <parameter name="GHS3DPRLPlugin" value="${GHS3DPRLPLUGIN_ROOT_DIR}/share/salome/resources"/>
</section>
<section name="SMESH">
<!-- Default SMESH module plugins -->
- <parameter name="plugins" value="NETGENPlugin,GHS3DPlugin,BLSURFPlugin,HexoticPLUGIN"/>
+ <parameter name="plugins" value="NETGENPlugin,GHS3DPlugin,GHS3DPRLPlugin,HexoticPLUGIN,BLSURFPlugin"/>
</section>
<section name="desktop" >
<!-- Default GUI desktop state, position, size -->
<parameter name="background" value="0, 0, 0" />
<parameter name="trihedron_size" value="105" />
<parameter name="relative_size" value="true" />
+ <parameter name="use_advanced_selection_algorithm" value="true" />
</section>
<section name="Plot2d" >
<!-- Plot2d viewer preferences -->
<parameter name="Title" value="63, 213, 255" />
<parameter name="NodeBody" value="255, 249, 147" />
</section>
+ <section name="MRU" >
+ <!-- Max number of "Most recently used" studies-->
+ <parameter name="max_count" value="7"/>
+ </section>
<section name="QxGraph" >
<!-- QxGraph viewer preferences -->
<parameter name="Background" value="144, 208, 211" />
<!DOCTYPE TS><TS>
<context>
<name>@default</name>
+ <message>
+ <source>WRN_FILE_NAME_BAD</source>
+ <translation>Please enter correct file name. Special characters are not allowed.</translation>
+ </message>
<message>
<source>CLOSE_LOCKED_STUDY</source>
<translation>Close locked study?</translation>
<source>ACTIVATE_MODULE_OP_LOAD</source>
<translation>&Load...</translation>
</message>
- <message>
- <source>WRN_FILE_NAME_BAD</source>
- <translation>Please enter correct file name</translation>
- </message>
</context>
<context>
<name>SalomeApp_StudyPropertiesDlg</name>
#include <OpUtil.hxx>
#include <RegistryService.hxx>
#include <ConnectionManager_i.hxx>
+#include <SALOME_LifeCycleCORBA.hxx>
#include <QDir>
#include <QFile>
void killOmniNames()
{
- QString fileName( ::getenv ("OMNIORB_CONFIG") );
- QString portNumber;
- if ( !fileName.isEmpty() )
- {
- QFile aFile( fileName );
- if ( aFile.open(QIODevice::ReadOnly) ) {
- QRegExp re("InitRef = .*:([0-9]+)$");
- QTextStream stream ( &aFile );
- while ( !stream.atEnd() ) {
- QString textLine = stream.readLine();
- if ( re.indexIn( textLine ) > -1 )
- portNumber = re.cap(1);
- }
- aFile.close();
- }
- }
-
- if ( !portNumber.isEmpty() )
- {
- QString cmd ;
- cmd = QString( "ps -eo pid,command | grep -v grep | grep -E \"omniNames.*%1\" | awk '{cmd=sprintf(\"kill -9 %s\",$1); system(cmd)}'" ).arg( portNumber );
- system ( cmd.toLatin1().data() );
- }
-
- /////////////////// NPAL 18309 (Kill Notifd) ////////////////////////////
- if ( !portNumber.isEmpty() )
- {
- QString cmd = QString("import pickle, os; ");
- cmd += QString("from killSalomeWithPort import getPiDict; ");
- cmd += QString("filedict=getPiDict(%1); ").arg(portNumber);
- cmd += QString("f=open(filedict, 'r'); ");
- cmd += QString("pids=pickle.load(f); ");
- cmd += QString("m={}; ");
- cmd += QString("[ m.update(i) for i in pids ]; ");
- cmd += QString("pids=filter(lambda a: 'notifd' in m[a], m.keys()); ");
- cmd += QString("[ os.kill(pid, 9) for pid in pids ]; ");
- cmd += QString("os.remove(filedict); ");
- cmd = QString("python -c \"%1\" > /dev/null").arg(cmd);
- system( cmd.toLatin1().data() );
- }
-
+ SALOME_LifeCycleCORBA::killOmniNames();
}
// shutdown standalone servers
void shutdownServers( SALOME_NamingService* theNS )
{
- // get each Container from NamingService => shutdown it
- // (the order is inverse to the order of servers initialization)
-
- CORBA::Object_var objS = theNS->Resolve("/Kernel/Session");
- SALOME::Session_var session = SALOME::Session::_narrow(objS);
- if (!CORBA::is_nil(session)) {
- session->ping();
-
- string hostname = GetHostname();
- //string containerName = "/Containers/" + hostname;
-
- // 1) SuperVisionContainer
- //string containerNameSV = containerName + "/SuperVisionContainer";
- //CORBA::Object_var objSV = theNS->Resolve(containerNameSV.c_str());
- //Engines::Container_var SVcontainer = Engines::Container::_narrow(objSV) ;
- //if ( !CORBA::is_nil(SVcontainer) && ( session->getPID() != SVcontainer->getPID() ) )
- // SVcontainer->Shutdown();
-
- // 2) FactoryServerPy
- //string containerNameFSP = containerName + "/FactoryServerPy";
- //CORBA::Object_var objFSP = theNS->Resolve(containerNameFSP.c_str());
- //Engines::Container_var FSPcontainer = Engines::Container::_narrow(objFSP) ;
- //if ( !CORBA::is_nil(FSPcontainer) && ( session->getPID() != FSPcontainer->getPID() ) )
- // FSPcontainer->Shutdown();
-
- // 3) FactoryServer
- //string containerNameFS = containerName + "/FactoryServer";
- //CORBA::Object_var objFS = theNS->Resolve(containerNameFS.c_str());
- //Engines::Container_var FScontainer = Engines::Container::_narrow(objFS) ;
- //if ( !CORBA::is_nil(FScontainer) && ( session->getPID() != FScontainer->getPID() ) )
- // FScontainer->Shutdown();
-
- // 4) ContainerManager
- //CORBA::Object_var objCM=theNS->Resolve("/ContainerManager");
- //Engines::ContainerManager_var contMan=Engines::ContainerManager::_narrow(objCM);
- //if ( !CORBA::is_nil(contMan) && ( session->getPID() != contMan->getPID() ) )
- // contMan->ShutdownWithExit();
-
- // 4) SalomeLauncher
- CORBA::Object_var objSL = theNS->Resolve("/SalomeLauncher");
- Engines::SalomeLauncher_var launcher = Engines::SalomeLauncher::_narrow(objSL);
- if (!CORBA::is_nil(launcher) && (session->getPID() != launcher->getPID()))
- launcher->Shutdown();
-
- // 5) ConnectionManager
- CORBA::Object_var objCnM=theNS->Resolve("/ConnectionManager");
- Engines::ConnectionManager_var connMan=Engines::ConnectionManager::_narrow(objCnM);
- if ( !CORBA::is_nil(connMan) && ( session->getPID() != connMan->getPID() ) )
- connMan->ShutdownWithExit();
-
- // 6) SALOMEDS
- CORBA::Object_var objSDS = theNS->Resolve("/myStudyManager");
- SALOMEDS::StudyManager_var studyManager = SALOMEDS::StudyManager::_narrow(objSDS) ;
- if ( !CORBA::is_nil(studyManager) && ( session->getPID() != studyManager->getPID() ) )
- studyManager->Shutdown();
-
- // 7) ModuleCatalog
- CORBA::Object_var objMC=theNS->Resolve("/Kernel/ModulCatalog");
- SALOME_ModuleCatalog::ModuleCatalog_var catalog = SALOME_ModuleCatalog::ModuleCatalog::_narrow(objMC);
- if ( !CORBA::is_nil(catalog) && ( session->getPID() != catalog->getPID() ) )
- catalog->shutdown();
-
- // 8) Registry
- CORBA::Object_var objR = theNS->Resolve("/Registry");
- Registry::Components_var registry = Registry::Components::_narrow(objR);
- if ( !CORBA::is_nil(registry) && ( session->getPID() != registry->getPID() ) )
- registry->Shutdown();
-
- // 9) Kill OmniNames
- //killOmniNames();
- }
+ SALOME_LifeCycleCORBA lcc(theNS);
+ lcc.shutdownServers();
}
// ---------------------------- MAIN -----------------------
Py_Finalize();
try {
- orb->destroy();
+ orb->shutdown(0);
}
catch (...) {
//////////////////////////////////////////////////////////////
delete [] cellVis;
}
- return 0;
+ return 1;
}