#!/bin/csh -f
+#
+# 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
+#
+# File : runLightSalome.csh
+# Author : Vadim SANDLER, Open CASCADE S.A.S, vadim.sandler@opencascade.com
+#
+
+###
+# set default value for the LightAppConfig variable, which
+# is necessary for loading of .ini or .xml resources file
+###
-# this variable necessary for loading .ini or .xml file
if ( ! $?LightAppConfig ) setenv LightAppConfig ${GUI_ROOT_DIR}/share/salome/resources/gui
if ( ! $?LightAppResources ) setenv LightAppResources ${GUI_ROOT_DIR}/share/salome/resources/gui
+###
+# process --modules=... command line option (get list of modules)
+###
+
+set modules=""
+
+foreach arg ( X $* )
+ if ( "$arg" != "X" ) then
+ switch ( $arg )
+ case --modules=*:
+ set modules=`echo $arg | awk -F= '{ print $2 }' | sed -e "s%,% %g"`
+ breaksw
+ default:
+ breaksw
+ endsw
+ endif
+end
+
+set modules="KERNEL GUI $modules"
+
+###
+# exclude modules duplication
+###
+
+set mods=""
+
+foreach mod ( $modules )
+ echo $mods | grep -E "\<$mod\>" >/dev/null
+ if ( "$?" == "1" ) then
+ set mods="$mods $mod"
+ endif
+end
+
+###
+# set additional environment
+###
+
+foreach mod ( $mods )
+ if ( "$arg" != "X" ) then
+ set root_dir=`printenv ${mod}_ROOT_DIR`
+ if ( "$root_dir" != "" ) then
+ set mod_lower=`echo $mod | tr "A-Z" "a-z"`
+ setenv PATH ${root_dir}/bin/salome:${PATH}
+ setenv LD_LIBRARY_PATH ${root_dir}/lib/salome:${LD_LIBRARY_PATH}
+ if ( "$mod" != "KERNEL" && "$mod" != "GUI" ) then
+ setenv LightAppConfig ${LightAppConfig}:${root_dir}/share/salome/resources/${mod_lower}
+ endif
+ endif
+ endif
+end
+
+###
+# start application
+###
+
SUITApp LightApp -style salome $* &
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+# File : runLightSalome.sh
+# Author : Vadim SANDLER, Open CASCADE S.A.S, vadim.sandler@opencascade.com
+#
+
+###
+# set default value for the LightAppConfig variable, which
+# is necessary for loading of .ini or .xml resources file
+###
-# this variable necessary for loading .ini or .xml file
if [ -z "$LightAppConfig" ] ; then
export LightAppConfig=${GUI_ROOT_DIR}/share/salome/resources/gui
fi
export LightAppResources=${GUI_ROOT_DIR}/share/salome/resources/gui
fi
-modules="KERNEL GUI"
+###
+# process --modules=... command line option (get list of modules)
+###
+
+modules=""
for arg in X $* ; do
if [ "$arg" != "X" ] ; then
case $arg in
- --modules=* ) modules="$modules "`echo $arg | awk -F= '{ print $2 }' | sed -e "s%,% %g"` ;;
+ --modules=* ) modules=`echo $arg | awk -F= '{ print $2 }' | sed -e "s%,% %g"` ;;
*) ;;
esac
fi
done
+modules="KERNEL GUI $modules"
+
+###
+# exclude modules duplication
+###
+
+mods=""
+
for mod in $modules ; do
+ echo $mods | grep -E "\<$mod\>" >/dev/null 2>&1
+ if [ "$?" == "1" ] ; then
+ mods="$mods $mod"
+ fi
+done
+
+###
+# set additional environment
+###
+
+for mod in $mods ; do
if [ "$arg" != "X" ] ; then
root_dir=`printenv ${mod}_ROOT_DIR`
- export PATH=${root_dir}/bin/salome:${PATH}
- export LD_LIBRARY_PATH=${root_dir}/lib/salome:${LD_LIBRARY_PATH}
+ if [ "$root_dir" != "" ] ; then
+ mod_lower=`echo $mod | tr "A-Z" "a-z"`
+ export PATH=${root_dir}/bin/salome:${PATH}
+ export LD_LIBRARY_PATH=${root_dir}/lib/salome:${LD_LIBRARY_PATH}
+ if [ "$mod" != "KERNEL" ] && [ "$mod" != "GUI" ] ; then
+ export LightAppConfig=${LightAppConfig}:${root_dir}/share/salome/resources/${mod_lower}
+ fi
+ fi
fi
done
+###
+# start application
+###
+
SUITApp LightApp -style salome $* &
QStringList modList;
- QStringList args = QApplication::arguments();
+ QString args = QApplication::arguments().join( " " );
+
+ QRegExp rx1("--modules=([\\w,]*)");
+ rx1.setMinimal( false );
+ QRegExp rx2("--modules\\s+\\(\\s*(.*)\\s*\\)");
+ rx2.setMinimal( true );
+ int pos = 0;
+ while ( 1 ) {
+ QString modules;
+ int pos1 = rx1.indexIn( args, pos );
+ int pos2 = rx2.indexIn( args, pos );
+ if ( pos1 != -1 && pos2 != -1 ) {
+ modules = pos1 < pos2 ? rx1.cap( 1 ) : rx2.cap(1);
+ pos = pos1 < pos2 ? pos1 + rx1.matchedLength() : pos2 + rx2.matchedLength();
+ }
+ else if ( pos1 != -1 ) {
+ modules = rx1.cap( 1 );
+ pos = pos1 + rx1.matchedLength();
+ }
+ else if ( pos2 != -1 ) {
+ modules = rx2.cap( 1 );
+ pos = pos2 + rx2.matchedLength();
+ }
+ else {
+ break;
+ }
- QRegExp rx("--modules\\s+\\(\\s*(.*)\\s*\\)");
- rx.setMinimal( true );
- if ( rx.indexIn( args.join(" ") ) >= 0 && rx.numCaptures() > 0 ) {
- QString modules = rx.cap(1);
- QStringList mods = modules.split( ":", QString::SkipEmptyParts );
+ modList.clear();
+ QStringList mods = modules.split( QRegExp( "[:|,\\s]" ), QString::SkipEmptyParts );
for ( int i = 0; i < mods.count(); i++ ) {
if ( !mods[i].trimmed().isEmpty() )
modList.append( mods[i].trimmed() );
}
}
+
if ( modList.isEmpty() ) {
QString mods = resMgr->stringValue( "launch", "modules", QString() );
modList = mods.split( ",", QString::SkipEmptyParts );
for ( QStringList::const_iterator it = modList.begin(); it != modList.end(); ++it )
{
QString modName = (*it).trimmed();
+
if ( modName.isEmpty() )
- continue;
+ continue; // empty module name
+
+ if ( !moduleTitle( modName ).isEmpty() )
+ continue; // already added
QString modTitle = resMgr->stringValue( *it, "name", QString() );
if ( modTitle.isEmpty() )
- {
- printf( "****************************************************************\n" );
- printf( "* Warning: %s not found in resources.\n", (*it).toLatin1().data() );
- printf( "* Module will not be available\n" );
- printf( "****************************************************************\n" );
- continue;
- }
+ {
+ printf( "****************************************************************\n" );
+ printf( "* Warning: %s not found in resources.\n", (*it).toLatin1().data() );
+ printf( "* Module will not be available\n" );
+ printf( "****************************************************************\n" );
+ continue;
+ }
QString modIcon = resMgr->stringValue( *it, "icon", QString() );
if ( flag == WT_ObjectBrowser )
{
LightApp_Browser* ob = new LightApp_Browser( new LightApp_DataObject(), desktop() );
- ob->treeView()->setSortMenuEnabled( true );
+ ob->setSortMenuEnabled( true );
ob->setAutoUpdate( true );
//ob->setAutoOpenLevel( 1 ); // commented by ASV as a fix to bug IPAL10107
ob->setWindowTitle( tr( "OBJECT_BROWSER" ) );
#include <QtxComboBox.h>
#include <QtxActionSet.h>
-#include <QHBoxLayout>
+#include <QVBoxLayout>
/*!
\class LightApp_ModuleAction::ActionSet
return 0;
QWidget* dumb = new QWidget( parent );
- QHBoxLayout* l = new QHBoxLayout( dumb );l->setSpacing(0);l->setMargin(0);
+ QVBoxLayout* l = new QVBoxLayout( dumb );
+ l->setSpacing( 0 ); l->setMargin( 0 );
QtxComboBox* cb = new QtxComboBox( dumb );
- cb->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred );
+ cb->setSizeAdjustPolicy( QComboBox::AdjustToContents );
cb->setFocusPolicy( Qt::NoFocus );
l->addWidget( cb );
GLViewer = $(GUI_ROOT_DIR)/share/salome/resources/gui
OCCViewer = $(GUI_ROOT_DIR)/share/salome/resources/gui
VTKViewer = $(GUI_ROOT_DIR)/share/salome/resources/gui
-LIGHT = $(LIGHT_ROOT_DIR)/share/salome/resources/light
-
-[LIGHT]
-name = Light
-icon = LIGHT
<parameter name="LightApp" value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
<parameter name="SVTK" value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
<parameter name="ToolsGUI" value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
- <parameter name="LIGHT" value="${LIGHT_ROOT_DIR}/share/salome/resources/light"/>
</section>
<section name="desktop" >
<!-- Default GUI desktop state, position, size -->
<parameter name="width" value="800"/>
<parameter name="height" value="600"/>
</section>
- <section name="LIGHT">
- <!-- LIGHT module settings -->
- <parameter name="name" value="Light"/>
- <parameter name="icon" value="LIGHT.png"/>
- </section>
<section name="PyConsole">
<!-- Python console preferences -->
<parameter name="font" value="Helvetic,12" />
//setUpdater( 0 );
}
-/*!
- \brief Get tree view widget.
- \return tree view widget of the object browser
-*/
-QtxTreeView* OB_Browser::treeView() const
-{
- return myView;
-}
-
/*!
\brief Get popup menu client type.
\return popup client type
myView->setRootIsDecorated( decor );
}
+/*
+ \brief Check if "Sorting" popup menu command for the header is enabled.
+ \return \c true if "Sorting" menu command is enabled
+ \sa setSortMenuEnabled()
+*/
+bool OB_Browser::sortMenuEnabled() const
+{
+ return myView->sortMenuEnabled();
+}
+
+/*
+ \brief Enable/disable "Sorting" popup menu command for the header.
+ \param enableSortMenu if \c true, enable "Sorting" menu command
+ \sa sortMenuEnabled()
+*/
+void OB_Browser::setSortMenuEnabled( const bool enabled )
+{
+ if ( enabled != sortMenuEnabled() )
+ myView->setSortMenuEnabled( enabled );
+}
+
/*!
\brief Get number of levels which should be automatically expanded
when updating the data tree.
}
*/
+/*!
+ \brief Get tree view widget.
+ \return tree view widget of the object browser
+*/
+QtxTreeView* OB_Browser::treeView() const
+{
+ return myView;
+}
+
/*!
\brief Process context menu request event.
\param e context menu event
OB_Browser( QWidget* = 0, QAbstractItemModel* = 0 );
virtual ~OB_Browser();
- QtxTreeView* treeView() const;
-
virtual QString popupClientType() const;
QAbstractItemModel* model() const;
bool rootIsDecorated() const;
void setRootIsDecorated( const bool );
+ bool sortMenuEnabled() const;
+ void setSortMenuEnabled( const bool );
+
int autoOpenLevel() const;
void setAutoOpenLevel( const int );
void openLevels( const int = -1 );
protected:
//void adjustWidth( QListViewItem* );
//virtual void updateText();
+ QtxTreeView* treeView() const;
virtual void contextMenuEvent( QContextMenuEvent* );
\param parent parent object
*/
QtxListAction::QtxListAction( QObject* parent )
-: QWidgetAction( parent ),
+: QtxAction( parent ),
myFrame( 0 )
{
initialize();
*/
QtxListAction::QtxListAction( const QIcon& icon, const QString& menuText,
int accel, QObject* parent )
-: QWidgetAction( parent ),
+: QtxAction( menuText, icon, menuText, accel, parent ),
myFrame( 0 )
{
- setIcon( icon );
- setText( menuText );
- setShortcut( accel );
-
initialize();
}
\param parent parent object
*/
QtxListAction::QtxListAction( const QString& menuText, int accel, QObject* parent )
-: QWidgetAction( parent ),
+: QtxAction( menuText, menuText, accel, parent ),
myFrame( 0 )
{
- setText( menuText );
- setShortcut( accel );
-
initialize();
}
*/
QtxListAction::QtxListAction( const QString& text, const QString& menuText,
int accel, QObject* parent )
-: QWidgetAction( parent ),
+: QtxAction( text, menuText, accel, parent ),
myFrame( 0 )
{
- setText( menuText );
- setShortcut( accel );
- setToolTip( text );
-
initialize();
}
*/
QtxListAction::QtxListAction( const QString& text, const QIcon& icon,
const QString& menuText, int accel, QObject* parent )
-: QWidgetAction( parent ),
+: QtxAction( text, icon, menuText, accel, parent ),
myFrame( 0 )
{
- setIcon( icon );
- setText( menuText );
- setShortcut( accel );
- setToolTip( text );
-
initialize();
}
#define QTXLISTACTION_H
#include "Qtx.h"
-
+#include "QtxAction.h"
#include <QStringList>
-#include <QWidgetAction>
#ifdef WIN32
#pragma warning( disable:4251 )
#endif
-class QTX_EXPORT QtxListAction : public QWidgetAction
+class QTX_EXPORT QtxListAction : public QtxAction
{
Q_OBJECT
\brief Expand the branch specifed by the \index and all its
children recursively.
\param index model index to be expanded
+ \sa collapseAll()
*/
void QtxTreeView::expandAll( const QModelIndex& index )
{
\brief Collapse the branch specifed by the \index and all its
children recursively.
\param index model index to be collapsed
+ \sa expandAll()
*/
void QtxTreeView::collapseAll( const QModelIndex& index )
{
/*
\brief Enable/disable "Sorting" popup menu command for the header.
\param enableSortMenu if \c true, enable "Sorting" menu command
+ \sa sortMenuEnabled()
*/
void QtxTreeView::setSortMenuEnabled( const bool enableSortMenu )
{
/*
\brief Check if "Sorting" popup menu command for the header is enabled.
\return \c true if "Sorting" menu command is enabled
+ \sa setSortMenuEnabled()
*/
bool QtxTreeView::sortMenuEnabled() const
{