From: nds Date: Thu, 3 Nov 2005 07:42:33 +0000 (+0000) Subject: This file in LightApp package X-Git-Tag: V3_1_0a3~79 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e78c1f564e923a56b6617fd692d3eb290499643e;p=modules%2Fgui.git This file in LightApp package --- diff --git a/src/SalomeApp/SalomeApp_AboutDlg.cxx b/src/SalomeApp/SalomeApp_AboutDlg.cxx deleted file mode 100644 index 0caea52a7..000000000 --- a/src/SalomeApp/SalomeApp_AboutDlg.cxx +++ /dev/null @@ -1,130 +0,0 @@ -// File: SalomeApp_AboutDlg.cxx -// Created: 03.06.2005 13:52:45 -// Author: Sergey TELKOV -// Copyright (C) CEA 2005 - -#include "SalomeApp_AboutDlg.h" - -#include -#include - -#include -#include -#include -#include - -/*!Constructor.*/ -SalomeApp_AboutDlg::SalomeApp_AboutDlg( const QString& defName, const QString& defVer, QWidget* parent ) -: QtxDialog( parent, "salome_about_dialog", true, false, None ) -{ - SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - - QPixmap ico = resMgr->loadPixmap( "SalomeApp", tr( "APP_DEFAULT_ICO" ), false ); - if ( !ico.isNull() ) - setIcon( ico ); - - QPalette pal = palette(); - QColorGroup cg = pal.active(); - cg.setColor( QColorGroup::Foreground, Qt::darkBlue ); - cg.setColor( QColorGroup::Background, Qt::white ); - pal.setActive( cg ); pal.setInactive( cg ); pal.setDisabled( cg ); - setPalette(pal); - - QVBoxLayout* main = new QVBoxLayout( mainFrame() ); - QGroupBox* base = new QGroupBox( 1, Qt::Horizontal, "", mainFrame() ); - base->setFrameStyle( QFrame::NoFrame ); - base->setInsideMargin( 0 ); - main->addWidget( base ); - - QLabel* screen = new QLabel( base ); - screen->setScaledContents( true ); - screen->setAlignment( Qt::AlignCenter ); - screen->setFrameStyle( QFrame::Box | QFrame::Plain ); - - QLabel* title = new QLabel( base ); - title->setAlignment( Qt::AlignCenter ); - changeFont( title, true, false, false, 5 ); - - QLabel* version = new QLabel( base ); - version->setAlignment( Qt::AlignCenter ); - changeFont( version, false, true, false, 2 ); - - QLabel* copyright = new QLabel( base ); - copyright->setAlignment( Qt::AlignCenter ); - changeFont( copyright, false, false, false, 1 ); - - QLabel* license = new QLabel( base ); - license->setAlignment( Qt::AlignCenter ); - changeFont( license, false, false, false, 1 ); - - screen->setPixmap( resMgr->loadPixmap( "SalomeApp", tr( "ABOUT" ), false ) ); - checkLabel( screen ); - - QString titleText = tr( "ABOUT_TITLE" ); - if ( titleText == "ABOUT_TITLE" ) - titleText = defName; - title->setText( titleText ); - checkLabel( title ); - - QString verText = tr( "ABOUT_VERSION" ); - if ( verText.contains( "%1" ) ) - verText = verText.arg( defVer ); - version->setText( verText ); - checkLabel( version ); - - copyright->setText( tr( "ABOUT_COPYRIGHT" ) ); - checkLabel( copyright ); - - license->setText( tr( "ABOUT_LICENSE" ) ); - checkLabel( license ); - - QString capText = tr( "ABOUT_CAPTION" ); - if ( capText.contains( "%1" ) ) - capText = capText.arg( defName ); - setCaption( capText ); - - setSizeGripEnabled( false ); -} - -/*!Destructor.*/ -SalomeApp_AboutDlg::~SalomeApp_AboutDlg() -{ - //! Do nothing. -} - -/*!On mouse press event.*/ -void SalomeApp_AboutDlg::mousePressEvent( QMouseEvent* ) -{ - accept(); -} - -/*!Change font of widget \a wid. - *\param wid - QWidget - *\param bold - boolean value - *\param italic - boolean value - *\param underline - boolean value - *\param inc - integer increment for font point size. - */ -void SalomeApp_AboutDlg::changeFont( QWidget* wid, const bool bold, const bool italic, - const bool underline, const int inc ) const -{ - if ( !wid ) - return; - - QFont widFont = wid->font(); - widFont.setBold( bold ); - widFont.setItalic( italic ); - widFont.setUnderline( underline ); - widFont.setPointSize( widFont.pointSize() + inc ); -} - -/*!Check lable \a lab.*/ -void SalomeApp_AboutDlg::checkLabel( QLabel* lab ) const -{ - if ( !lab ) - return; - - bool vis = !lab->text().stripWhiteSpace().isEmpty() || - ( lab->pixmap() && !lab->pixmap()->isNull() ); - vis ? lab->show() : lab->hide(); -} diff --git a/src/SalomeApp/SalomeApp_AboutDlg.h b/src/SalomeApp/SalomeApp_AboutDlg.h deleted file mode 100644 index 5b4c353e8..000000000 --- a/src/SalomeApp/SalomeApp_AboutDlg.h +++ /dev/null @@ -1,36 +0,0 @@ -// File: SalomeApp_AboutDlg.h -// Created: 03.06.2005 13:49:25 -// Author: Sergey TELKOV -// Copyright (C) CEA 2005 - -#ifndef SALOMEAPP_ABOUTDLG_H -#define SALOMEAPP_ABOUTDLG_H - -#include "SalomeApp.h" - -#include - -/*! - Descr: Salome help about dialog -*/ - -class QLabel; - -class SALOMEAPP_EXPORT SalomeApp_AboutDlg : public QtxDialog -{ - Q_OBJECT - -public: - SalomeApp_AboutDlg( const QString&, const QString&, QWidget* = 0 ); - virtual ~SalomeApp_AboutDlg(); - -protected: - virtual void mousePressEvent( QMouseEvent* ); - -private: - void checkLabel( QLabel* ) const; - void changeFont( QWidget*, const bool = false, const bool = false, - const bool = false, const int = 0 ) const; -}; - -#endif diff --git a/src/SalomeApp/SalomeApp_Dialog.cxx b/src/SalomeApp/SalomeApp_Dialog.cxx deleted file mode 100644 index b69f2b698..000000000 --- a/src/SalomeApp/SalomeApp_Dialog.cxx +++ /dev/null @@ -1,860 +0,0 @@ -// File: SalomeApp_Dialog.cxx -// Author: Alexander SOLOVYOV - -#include -#include - -#include -#include -#include - -/* - Class : SalomeApp_Dialog - Description : Base class for all SALOME dialogs -*/ - -//======================================================================= -// name : SalomeApp_Dialog -// Purpose : Constructor -//======================================================================= -SalomeApp_Dialog::SalomeApp_Dialog( QWidget* parent, const char* name, bool modal, - bool allowResize, const int f, WFlags wf ) -: QtxDialog( parent, name, modal, allowResize, f, wf ), - myIsExclusive( true ), - myIsBusy( false ) -{ - setObjectPixmap( "SalomeApp", tr( "ICON_SELECT" ) ); -} - -//======================================================================= -// name : ~SalomeApp_Dialog -// Purpose : Destructor -//======================================================================= -SalomeApp_Dialog::~SalomeApp_Dialog() -{ -} - -//======================================================================= -// name : show -// Purpose : -//======================================================================= -void SalomeApp_Dialog::show() -{ - QtxDialog::show(); -} - -//======================================================================= -// name : isExclusive -// Purpose : -//======================================================================= -bool SalomeApp_Dialog::isExclusive() const -{ - return myIsExclusive; -} - -//======================================================================= -// name : updateButtons -// Purpose : -//======================================================================= -void SalomeApp_Dialog::updateButtons( const int _id ) -{ - if( !myIsExclusive ) - return; - - int id = _id; - - ObjectMap::const_iterator anIt = myObjects.begin(), - aLast = myObjects.end(); - for( ; anIt!=aLast; anIt++ ) - { - QToolButton* but = (QToolButton*)anIt.data().myBtn; - if( but && but->isOn() ) - { - if( id==-1 ) - id = anIt.key(); - - if( anIt.key()!=id ) - but->setOn( false ); - } - } -} - -//======================================================================= -// name : setExclusive -// Purpose : -//======================================================================= -void SalomeApp_Dialog::setExclusive( const bool ex ) -{ - myIsExclusive = ex; - updateButtons(); -} - -//======================================================================= -// name : showObject -// Purpose : -//======================================================================= -void SalomeApp_Dialog::showObject( const int id ) -{ - setObjectShown( id, true ); -} - -//======================================================================= -// name : hideObject -// Purpose : -//======================================================================= -void SalomeApp_Dialog::hideObject( const int id ) -{ - setObjectShown( id, false ); -} - -//======================================================================= -// name : setObjectShown -// Purpose : -//======================================================================= -void SalomeApp_Dialog::setObjectShown( const int id, const bool shown ) -{ - if( myObjects.contains( id ) && isObjectShown( id )!=shown ) - { - Object& obj = myObjects[ id ]; - obj.myEdit->setShown( shown ); - obj.myBtn->setShown( shown ); - obj.myLabel->setShown( shown ); - if( !shown ) - ( ( QToolButton* )obj.myBtn )->setOn( false ); - } -} - -//======================================================================= -// name : isObjectShown -// Purpose : -//======================================================================= -bool SalomeApp_Dialog::isObjectShown( const int id ) const -{ - return myObjects.contains( id ) && myObjects[ id ].myEdit->isShown(); -} - -//======================================================================= -// name : setObjectEnabled -// Purpose : -//======================================================================= -void SalomeApp_Dialog::setObjectEnabled( const int id, const bool en ) -{ - if( myObjects.contains( id ) && isObjectEnabled( id )!=en ) - { - Object& obj = myObjects[ id ]; - obj.myEdit->setEnabled( en ); - obj.myBtn->setEnabled( en ); -// obj.myLabel->setEnabled( en ); - if( !en ) - ( ( QToolButton* )obj.myBtn )->setOn( false ); - } -} - -//======================================================================= -// name : isObjectEnabled -// Purpose : -//======================================================================= -bool SalomeApp_Dialog::isObjectEnabled( const int id ) const -{ - return myObjects.contains( id ) && myObjects[ id ].myEdit->isEnabled(); -} - -//======================================================================= -// name : selectObject -// Purpose : -//======================================================================= -void SalomeApp_Dialog::selectObject( const QString& name, const int type, const QString& id, const bool update ) -{ - QStringList names; names.append( name ); - TypesList types; types.append( type ); - QStringList ids; ids.append( id ); - selectObject( names, types, ids, update ); -} - -//======================================================================= -// name : selectObject -// Purpose : -//======================================================================= -void SalomeApp_Dialog::selectObject( const QStringList& _names, - const TypesList& _types, - const QStringList& _ids, - const bool update ) -{ - ObjectMap::iterator anIt = myObjects.begin(), - aLast = myObjects.end(); - for( ; anIt!=aLast; anIt++ ) - if( anIt.data().myBtn->isOn() ) - selectObject( anIt.key(), _names, _types, _ids, update ); -} - -//======================================================================= -// name : hasSelection -// Purpose : -//======================================================================= -bool SalomeApp_Dialog::hasSelection( const int id ) const -{ - return myObjects.contains( id ) && !myObjects[ id ].myIds.isEmpty(); -} - -//======================================================================= -// name : clearSelection -// Purpose : -//======================================================================= -void SalomeApp_Dialog::clearSelection( const int id ) -{ - if( id==-1 ) - { - ObjectMap::const_iterator anIt = myObjects.begin(), - aLast = myObjects.end(); - for( ; anIt!=aLast; anIt++ ) - clearSelection( anIt.key() ); - } - - else if( myObjects.contains( id ) ) - { - myObjects[ id ].myIds.clear(); - myObjects[ id ].myTypes.clear(); - myObjects[ id ].myNames.clear(); - - myObjects[ id ].myEdit->setText( QString::null ); - emit selectionChanged( id ); - } -} - -//======================================================================= -// name : objectWg -// Purpose : -//======================================================================= -QWidget* SalomeApp_Dialog::objectWg( const int theId, const int theWgId ) const -{ - QWidget* aResWg = 0; - if( myObjects.contains( theId ) ) - { - if ( theWgId == Label ) - aResWg = myObjects[ theId ].myLabel; - else if ( theWgId == Btn ) - aResWg = myObjects[ theId ].myBtn; - else if ( theWgId == Control ) - aResWg = myObjects[ theId ].myEdit; - } - return aResWg; -} - -//======================================================================= -// name : objectText -// Purpose : -//======================================================================= -QString SalomeApp_Dialog::objectText( const int theId ) const -{ - return myObjects.contains( theId ) ? myObjects[ theId ].myEdit->text() : ""; -} - -//======================================================================= -// name : setObjectText -// Purpose : -//======================================================================= -void SalomeApp_Dialog::setObjectText( const int theId, const QString& theText ) -{ - if ( myObjects.contains( theId ) ) - myObjects[ theId ].myEdit->setText( theText ); -} - -//======================================================================= -// name : selectedObject -// Purpose : -//======================================================================= -void SalomeApp_Dialog::selectedObject( const int id, QStringList& list ) const -{ - if( myObjects.contains( id ) ) - list = myObjects[ id ].myIds; -} - -//======================================================================= -// name : selectedObject -// Purpose : -//======================================================================= -QString SalomeApp_Dialog::selectedObject( const int id ) const -{ - if ( myObjects.contains( id ) && myObjects[ id ].myIds.count() > 0 ) - return myObjects[ id ].myIds.first(); - else - return ""; -} - -//======================================================================= -// name : objectSelection -// Purpose : -//======================================================================= -void SalomeApp_Dialog::objectSelection( SelectedObjects& objs ) const -{ - //objs.clear(); - ObjectMap::const_iterator anIt = myObjects.begin(), - aLast = myObjects.end(); - for( ; anIt!=aLast; anIt++ ) - { - QStringList ids; - selectedObject( anIt.key(), ids ); - if( !ids.isEmpty() ) - objs.insert( anIt.key(), ids ); - } -} - -//======================================================================= -// name : createObject -// Purpose : -//======================================================================= -int SalomeApp_Dialog::createObject( const QString& label, QWidget* parent, const int id ) -{ - int nid = id; - if( nid<0 ) - for( nid=0; myObjects.contains( nid ); nid++ ); - - if( !myObjects.contains( nid ) ) - { - QLabel* lab = new QLabel( label, parent ); - myObjects[ nid ].myLabel = lab; - - QToolButton* but = new QToolButton( parent ); - but->setIconSet( QIconSet( myPixmap ) ); - but->setToggleButton( true ); - but->setMaximumWidth( but->height() ); - but->setMinimumWidth( but->height() ); - connect( but, SIGNAL( toggled( bool ) ), this, SLOT( onToggled( bool ) ) ); - myObjects[ nid ].myBtn = but; - - QLineEdit* ne = new QLineEdit( parent ); - ne->setReadOnly( true ); - ne->setMinimumWidth( 150 ); - connect( ne, SIGNAL( textChanged( const QString& ) ), this, SLOT( onTextChanged( const QString& ) ) ); - myObjects[ nid ].myEdit = ne; - - myObjects[ nid ].myNI = OneNameOrCount; - } - return nid; -} - -//======================================================================= -// name : renameObject -// Purpose : -//======================================================================= -void SalomeApp_Dialog::renameObject( const int id, const QString& label ) -{ - if( myObjects.contains( id ) ) - myObjects[ id ].myLabel->setText( label ); -} - -//======================================================================= -// name : setObjectType -// Purpose : -//======================================================================= -void SalomeApp_Dialog::setObjectType( const int id, const int type1, ... ) -{ - TypesList types; - - const int* tt = &type1; - while( *tt>=0 ) - { - types.append( *tt ); - tt++; - } - - setObjectType( id, types ); -} - -//======================================================================= -// name : setObjectType -// Purpose : -//======================================================================= -void SalomeApp_Dialog::setObjectType( const int id, const TypesList& list ) -{ - if( !myObjects.contains( id ) ) - return; - - TypesList& internal = myObjects[ id ].myPossibleTypes; - - QMap types; - TypesList::const_iterator anIt = list.begin(), - aLast = list.end(); - for( ; anIt!=aLast; anIt++ ) - types.insert( *anIt, 0 ); - - - internal.clear(); - QMap::const_iterator aMIt = types.begin(), - aMLast = types.end(); - for( ; aMIt!=aMLast; aMIt++ ) - internal.append( aMIt.key() ); - - updateObject( id ); -} - -//======================================================================= -// name : addObjectType -// Purpose : -//======================================================================= -void SalomeApp_Dialog::addObjectType( const int id, const int type1, const int, ... ) -{ - TypesList types; objectTypes( id, types ); - - const int* tt = &type1; - while( *tt>=0 ) - { - types.append( *tt ); - tt++; - } - - setObjectType( id, types ); -} - -//======================================================================= -// name : addObjectType -// Purpose : -//======================================================================= -void SalomeApp_Dialog::addObjectType( const int id, const TypesList& list ) -{ - TypesList types = list; objectTypes( id, types ); - setObjectType( id, types ); -} - -//======================================================================= -// name : addObjectType -// Purpose : -//======================================================================= -void SalomeApp_Dialog::addObjectType( const int id, const int type ) -{ - TypesList types; objectTypes( id, types ); - types.append( type ); - setObjectType( id, types ); -} - -//======================================================================= -// name : removeObjectType -// Purpose : -//======================================================================= -void SalomeApp_Dialog::removeObjectType( const int id ) -{ - TypesList types; - setObjectType( id, types ); -} - -//======================================================================= -// name : removeObjectType -// Purpose : -//======================================================================= -void SalomeApp_Dialog::removeObjectType( const int id, const TypesList& list ) -{ - if( !myObjects.contains( id ) ) - return; - - TypesList& internal = myObjects[ id ].myPossibleTypes; - - QMap types; - TypesList::const_iterator anIt = internal.begin(), - aLast = internal.end(); - for( ; anIt!=aLast; anIt++ ) - types.insert( *anIt, 0 ); - anIt = list.begin(); aLast = list.end(); - for( ; anIt!=aLast; anIt++ ) - types.remove( *anIt ); - - - internal.clear(); - QMap::const_iterator aMIt = types.begin(), - aMLast = types.end(); - for( ; aMIt!=aMLast; aMIt++ ) - internal.append( aMIt.key() ); - - updateObject( id ); -} - -//======================================================================= -// name : removeObjectType -// Purpose : -//======================================================================= -void SalomeApp_Dialog::removeObjectType( const int id, const int type ) -{ - TypesList list; list.append( type ); - removeObjectType( id, list ); -} - -//======================================================================= -// name : hasObjectType -// Purpose : -//======================================================================= -bool SalomeApp_Dialog::hasObjectType( const int id, const int type ) const -{ - if( myObjects.contains( id ) ) - return myObjects[ id ].myPossibleTypes.contains( type ); - else - return false; -} - -//======================================================================= -// name : objectTypes -// Purpose : -//======================================================================= -void SalomeApp_Dialog::objectTypes( const int id, TypesList& list ) const -{ - if( myObjects.contains( id ) ) - { - TypesList::const_iterator anIt = myObjects[ id ].myPossibleTypes.begin(), - aLast = myObjects[ id ].myPossibleTypes.end(); - for( ; anIt!=aLast; anIt++ ) - list.append( *anIt ); - } -} - -//======================================================================= -// name : onToggled -// Purpose : -//======================================================================= -void SalomeApp_Dialog::onToggled( bool on ) -{ - QButton* but = ( QButton* )sender(); - int id = -1; - - if( !but ) - return; - - ObjectMap::const_iterator anIt = myObjects.begin(), - aLast = myObjects.end(); - for( ; anIt!=aLast && id==-1; anIt++ ) - if( anIt.data().myBtn==but ) - id = anIt.key(); - - if( id!=-1 ) - if( on ) - { - updateButtons( id ); - emit objectActivated( id ); - } - else - emit objectDeactivated( id ); -} - -//======================================================================= -// name : updateObject -// Purpose : -//======================================================================= -void SalomeApp_Dialog::updateObject( const int id, bool emit_signal ) -{ - if( hasSelection( id ) ) - { - Object& obj = myObjects[ id ]; - filterTypes( id, obj.myNames, obj.myTypes, obj.myIds ); - obj.myEdit->setText( selectionDescription( obj.myNames, obj.myTypes, obj.myNI ) ); - if( emit_signal ) - emit selectionChanged( id ); - } -} - -//======================================================================= -// name : filterTypes -// Purpose : -//======================================================================= -void SalomeApp_Dialog::filterTypes( const int id, QStringList& names, TypesList& types, QStringList& ids ) const -{ - if( !myObjects.contains( id ) ) - return; - - const Object& obj = myObjects[ id ]; - if( obj.myPossibleTypes.isEmpty() ) - return; - - QStringList new_names, new_ids; - TypesList new_types; - - TypesList::const_iterator anIt1 = types.begin(), - aLast = types.end(); - QStringList::const_iterator anIt2 = names.begin(), - anIt3 = ids.begin(); - for( ; anIt1!=aLast; anIt1++, anIt2++, anIt3++ ) - if( obj.myPossibleTypes.contains( *anIt1 ) ) - { - if( new_types.count()==1 && !multipleSelection( id ) ) - break; - - new_names.append( *anIt2 ); - new_types.append( *anIt1 ); - new_ids.append( *anIt3 ); - } - names = new_names; - types = new_types; - ids = new_ids; -} - -//======================================================================= -// name : resMgr -// Purpose : -//======================================================================= -SUIT_ResourceMgr* SalomeApp_Dialog::resMgr() const -{ - return SUIT_Session::session()->resourceMgr(); -} - -//======================================================================= -// name : setObjectPixmap -// Purpose : -//======================================================================= -void SalomeApp_Dialog::setObjectPixmap( const QPixmap& p ) -{ - myPixmap = p; - ObjectMap::const_iterator anIt = myObjects.begin(), - aLast = myObjects.end(); - for( ; anIt!=aLast; anIt++ ) - ( ( QToolButton* )anIt.data().myBtn )->setIconSet( p ); -} - -//======================================================================= -// name : setObjectPixmap -// Purpose : -//======================================================================= -void SalomeApp_Dialog::setObjectPixmap( const QString& section, const QString& file ) -{ - SUIT_ResourceMgr* mgr = resMgr(); - if( mgr ) - setObjectPixmap( mgr->loadPixmap( section, file ) ); -} - -//======================================================================= -// name : multipleSelection -// Purpose : -//======================================================================= -bool SalomeApp_Dialog::multipleSelection( const int id ) const -{ - return nameIndication( id )!=OneName; -} - -//======================================================================= -// name : nameIndication -// Purpose : -//======================================================================= -SalomeApp_Dialog::NameIndication SalomeApp_Dialog::nameIndication( const int id ) const -{ - if( myObjects.contains( id ) ) - return myObjects[ id ].myNI; - else - return OneNameOrCount; -} - -//======================================================================= -// name : setNameIndication -// Purpose : -//======================================================================= -void SalomeApp_Dialog::setNameIndication( const int id, const NameIndication ni ) -{ - if( id==-1 ) - { - ObjectMap::iterator anIt = myObjects.begin(), - aNext, - aLast = myObjects.end(); - for( ; anIt!=aLast; anIt++ ) - { - anIt.data().myNI = ni; - setReadOnly( anIt.key(), isReadOnly( anIt.key() ) ); - aNext = anIt; aNext++; - updateObject( anIt.key(), aNext==aLast ); - } - } - else if( myObjects.contains( id ) ) - { - myObjects[ id ].myNI = ni; - setReadOnly( id, isReadOnly( id ) ); - updateObject( id, true ); - } -} - -//======================================================================= -// name : selectionDescription -// Purpose : -//======================================================================= -QString SalomeApp_Dialog::selectionDescription( const QStringList& names, const TypesList& types, const NameIndication ni ) const -{ - if( names.count()!=types.count() ) - return "SalomeApp_Dialog::selectionDescription(): Error!!!"; - - if( names.isEmpty() ) - return QString::null; - - switch( ni ) - { - case OneName: - return names.first(); - break; - - case OneNameOrCount: - if( names.count()==1 ) - return names.first(); - else - return countOfTypes( types ); - break; - - case ListOfNames: - return names.join( " " ); - break; - - case Count: - return countOfTypes( types ); - break; - }; - return QString::null; -} - -//======================================================================= -// name : countOfTypes -// Purpose : -//======================================================================= -QString SalomeApp_Dialog::countOfTypes( const TypesList& types ) const -{ - QMap typesCount; - QStringList typeCount; - - TypesList::const_iterator anIt = types.begin(), - aLast = types.end(); - for( ; anIt!=aLast; anIt++ ) - if( typesCount.contains( *anIt ) ) - typesCount[ *anIt ]++; - else - typesCount[ *anIt ] = 1; - - QMap::const_iterator aMIt = typesCount.begin(), - aMLast = typesCount.end(); - for( ; aMIt!=aMLast; aMIt++ ) - typeCount.append( QString( "%1 %2" ).arg( aMIt.data() ).arg( typeName( aMIt.key() ) ) ); - - return typeCount.join( ", " ); -} - -//======================================================================= -// name : typeName -// Purpose : -//======================================================================= -QString& SalomeApp_Dialog::typeName( const int type ) -{ - return myTypeNames[ type ]; -} - -//======================================================================= -// name : typeName -// Purpose : -//======================================================================= -const QString& SalomeApp_Dialog::typeName( const int type ) const -{ - return myTypeNames[ type ]; -} - - -//======================================================================= -// name : activateObject -// Purpose : -//======================================================================= -void SalomeApp_Dialog::activateObject( const int theId ) -{ - if ( myObjects.contains( theId ) && !myObjects[ theId ].myBtn->isOn() ) - myObjects[ theId ].myBtn->toggle(); -} - -//======================================================================= -// name : deactivateAll -// Purpose : -//======================================================================= -void SalomeApp_Dialog::deactivateAll() -{ - ObjectMap::iterator anIt = myObjects.begin(), - aLast = myObjects.end(); - for( ; anIt!=aLast; anIt++ ) - { - QToolButton* btn = ( QToolButton* )anIt.data().myBtn; - btn->setOn( false ); - } -} - -//======================================================================= -// name : selectObject -// Purpose : -//======================================================================= -void SalomeApp_Dialog::selectObject( const int id, const QString& name, const int type, const QString& selid, const bool update ) -{ - QStringList names; names.append( name ); - TypesList types; types.append( type ); - QStringList ids; ids.append( selid ); - selectObject( id, names, types, ids, update ); -} - -//======================================================================= -// name : selectObject -// Purpose : -//======================================================================= -void SalomeApp_Dialog::selectObject( const int id, const QStringList& _names, const TypesList& _types, - const QStringList& _ids, const bool update ) -{ - if( !myObjects.contains( id ) ) - return; - - QStringList names = _names, ids = _ids; - TypesList types = _types; - - filterTypes( id, names, types, ids ); - - Object& obj = myObjects[ id ]; - if( update ) - obj.myEdit->setText( selectionDescription( names, types, obj.myNI ) ); - obj.myTypes = types; - obj.myIds = ids; - obj.myNames = names; - - emit selectionChanged( id ); -} - -//======================================================================= -// name : setReadOnly -// Purpose : -//======================================================================= -void SalomeApp_Dialog::setReadOnly( const int id, const bool ro ) -{ - if( myObjects.contains( id ) ) - myObjects[ id ].myEdit->setReadOnly( nameIndication( id )==ListOfNames || nameIndication( id )==OneName ? ro : true ); -} - -//======================================================================= -// name : isReadOnly -// Purpose : -//======================================================================= -bool SalomeApp_Dialog::isReadOnly( const int id ) const -{ - if( myObjects.contains( id ) ) - return myObjects[ id ].myEdit->isReadOnly(); - else - return true; -} - -//======================================================================= -// name : onTextChanged -// Purpose : -//======================================================================= -void SalomeApp_Dialog::onTextChanged( const QString& text ) -{ - if( myIsBusy ) - return; - - myIsBusy = true; - - if( sender() && sender()->inherits( "QLineEdit" ) ) - { - QLineEdit* edit = ( QLineEdit* )sender(); - int id = -1; - ObjectMap::const_iterator anIt = myObjects.begin(), - aLast = myObjects.end(); - for( ; anIt!=aLast; anIt++ ) - if( anIt.data().myEdit == edit ) - id = anIt.key(); - - if( id>=0 && !isReadOnly( id ) ) - { - QStringList list = QStringList::split( " ", text ); - emit objectChanged( id, list ); - } - } - - myIsBusy = false; -} diff --git a/src/SalomeApp/SalomeApp_Dialog.h b/src/SalomeApp/SalomeApp_Dialog.h deleted file mode 100644 index 8ffba8309..000000000 --- a/src/SalomeApp/SalomeApp_Dialog.h +++ /dev/null @@ -1,266 +0,0 @@ -// File: SalomeApp_Dialog.h -// Author: Alexander SOLOVYOV - -#ifndef SALOMEAPP_DIALOG_H -#define SALOMEAPP_DIALOG_H - -#include - -#include -#include -#include - -class QLineEdit; -class QButton; -class QLabel; - -class SUIT_ResourceMgr; - -/* - Class : SalomeApp_Dialog - Description : Base class for all SALOME dialogs -*/ -class SalomeApp_Dialog : public QtxDialog -{ - Q_OBJECT - -public: - typedef QValueList TypesList; - typedef QMap SelectedObjects; - - enum ObjectWg - { - Label = 0x00000001, - Btn = 0x00000002, - Control = 0x00000004 - }; - - typedef enum - { - OneName, // " is shown - ListOfNames, //! list of all names is shown - Count //! In every case " " is shown - - } NameIndication; - //! The enumeration describing how names of selected objects will be shown in line edit - //! For more details see above - -public: - SalomeApp_Dialog( QWidget* = 0, const char* = 0, bool = false, - bool = false, const int = Standard, WFlags = 0 ); - virtual ~SalomeApp_Dialog(); - - virtual void show(); - - //! Check if buttons is exclusive (as radiobuttons) - bool isExclusive() const; - - //! Set exclusive state - void setExclusive( const bool ); - - //! Check if operation according to dialog will be resumed automatically when mouse enter the dialog - bool isAutoResumed() const; - - //! Set auto resumed state - void setAutoResumed( const bool ); - - //! Show widgets corresponding to id - void showObject( const int ); - - //! Hide widgets corresponding to id - void hideObject( const int ); - - //! Change the shown state of widgets corresponding to id - void setObjectShown( const int, const bool ); - - //! Check the shown state - bool isObjectShown( const int ) const; - - //! Change the enabled state of widgets corresponding to id - void setObjectEnabled( const int, const bool ); - - //! Check the enabled state - bool isObjectEnabled( const int ) const; - - //! Get widget of object (see ObjectWg enumeration) - QWidget* objectWg( const int theId, const int theWgId ) const; - - //! Pass to all active widgets name, type and id of selected object - void selectObject( const QString&, const int, const QString&, const bool = true ); - - /*! - Pass to all active widgets list of names, types and ids of selected objects - Every active widget filters list and accept only objects with possible types - */ - void selectObject( const QStringList&, const TypesList&, const QStringList&, const bool = true ); - - //! Get text of object's control - QString objectText( const int ) const; - - //! Set text of object's control - void setObjectText( const int, const QString& ); - - //! Select in certain widget avoiding check if there is active widget - void selectObject( const int, const QString&, const int, const QString&, const bool = true ); - void selectObject( const int, const QStringList&, const TypesList&, const QStringList&, const bool = true ); - - //! Check if certain widget has selection - bool hasSelection( const int ) const; - - //! Clear selection in widgets. If parameter is -1, then selection in all widgets will be cleared - void clearSelection( const int = -1 ); - - //! Get ids list of object selected in certain widget - void selectedObject( const int, QStringList& ) const; - - //! Get ids list of object selected in certain widget - QString selectedObject( const int ) const; - - //! Get map "widget id -> ids list" - void objectSelection( SelectedObjects& ) const; - - //! Activate object selection button - void activateObject( const int ); - - //! Set all object selection buttons to inactive state - void deactivateAll(); - -signals: - //! selection in certain widget is changed - void selectionChanged ( int ); - - //! selection in certain widget is on - void objectActivated ( int ); - - //! selection in certain widget is off - void objectDeactivated( int ); - - /* - text representation of selection is changed - it is emitted only if "read only" state of line edit is false - */ - void objectChanged( int, const QStringList& ); - -protected: - //! Finds and returns resource manager - SUIT_ResourceMgr* resMgr() const; - - /*! Create label, button and line edit for object selection - * If passed id is negative, then id will be calculated automatically (first free id) - * Returns the same id (if id>=0) or calculated - */ - int createObject ( const QString&, QWidget*, const int = -1 ); - - //! Set pixmap as icon for all selection buttons - void setObjectPixmap ( const QPixmap& ); - - //! Load pixmap with section, name using resource manager and set as icon for all selection buttons - void setObjectPixmap ( const QString&, const QString& ); - - //! Change label - void renameObject ( const int, const QString& ); - - //! Set possible types for certain id. The list of arguments must be finished by negative integer - void setObjectType ( const int, const int, ... ); - - //! Set list as possible types for object selection - void setObjectType ( const int, const TypesList& ); - - /*! - Add types to list of possible types - The list of arguments must be finished by negative integer - */ - void addObjectType ( const int, const int, const int, ... ); - - //! Add types to list of possible types - void addObjectType ( const int, const TypesList& ); - - //! Add type to list of possible types - void addObjectType ( const int, const int ); - - //! Clear list of possible types (it means, that all types are welcome) - void removeObjectType( const int ); - - //! Remove types in list from list of possible types - void removeObjectType( const int, const TypesList& ); - - //! Remove a type from list of possible types - void removeObjectType( const int, const int ); - - //! Check if list of possible types contains this one - bool hasObjectType ( const int, const int ) const; - - //! Return list of possible types - void objectTypes ( const int, TypesList& ) const; - - //!Change and get type name for indicating in selection widget - QString& typeName( const int ); - const QString& typeName( const int ) const; - - //! Create string contains selection list by list of names, list of types and current name indication state - virtual QString selectionDescription( const QStringList&, const TypesList&, const NameIndication ) const; - - //! Create string by pattern " " for current list of types - virtual QString countOfTypes( const TypesList& ) const; - - //! Get and set name indication for certain widget - NameIndication nameIndication( const int ) const; - void setNameIndication( const int, const NameIndication ); - - //! Check using name indication if multiple selection in possible - bool multipleSelection( const int ) const; - - //! Set the "read only" state of object selection line edit - //! The "read only" will be false only if name indication is ListOfNames - void setReadOnly( const int, const bool ); - - //! Check the "read only" state of object selection line edit - bool isReadOnly( const int ) const; - -private slots: - //! emits if the object selection button changes state - void onToggled( bool ); - - //! text in some line edit is changed - void onTextChanged( const QString& ); - -private: - /*! - If buttons are exclusive, set to "off" all buttons except one with id - If id=-1, then all buttons, except first with "on" state, will be set to "off" - */ - void updateButtons( const int = -1 ); - - /*! - Filter types and update selection string in line edit - If bool is true, then signal is emitted - */ - void updateObject( const int, bool = true ); - - //! Remove from list not possible types and remove from names and ids lists the corresponding items - void filterTypes( const int, QStringList&, TypesList&, QStringList& ) const; - -private: - typedef struct - { - QLineEdit* myEdit; - QButton* myBtn; - QLabel* myLabel; - QStringList myNames, myIds; - TypesList myTypes, myPossibleTypes; - NameIndication myNI; - - } Object; - - typedef QMap ObjectMap; - -private: - ObjectMap myObjects; - QMap myTypeNames; - bool myIsExclusive, myIsBusy; - QPixmap myPixmap; -}; - -#endif diff --git a/src/SalomeApp/SalomeApp_OBSelector.cxx b/src/SalomeApp/SalomeApp_OBSelector.cxx deleted file mode 100644 index 655f80998..000000000 --- a/src/SalomeApp/SalomeApp_OBSelector.cxx +++ /dev/null @@ -1,101 +0,0 @@ -#include "SalomeApp_OBSelector.h" - -#include "SalomeApp_DataOwner.h" -#include "SalomeApp_DataObject.h" - -#include - -#include - -/*! - Constructor -*/ -SalomeApp_OBSelector::SalomeApp_OBSelector( OB_Browser* ob, SUIT_SelectionMgr* mgr ) -: SUIT_Selector( mgr, ob ), - myBrowser( ob ) -{ - if ( myBrowser ) { - connect( myBrowser, SIGNAL( selectionChanged() ), this, SLOT( onSelectionChanged() ) ); - } -} - -/*! - Destructor -*/ -SalomeApp_OBSelector::~SalomeApp_OBSelector() -{ -} - -/*! - Gets browser. -*/ -OB_Browser* SalomeApp_OBSelector::browser() const -{ - return myBrowser; -} - -/*! - Gets selection. -*/ -void SalomeApp_OBSelector::getSelection( SUIT_DataOwnerPtrList& thelist ) const -{ - if ( !myBrowser ) - return; - - DataObjectList objlist; - myBrowser->getSelected( objlist ); - for ( DataObjectListIterator it( objlist ); it.current(); ++it ) - { - SalomeApp_DataObject* obj = dynamic_cast( it.current() ); - if ( obj ) - { - Handle( SALOME_InteractiveObject ) aSObj = new SALOME_InteractiveObject - ( obj->entry(), obj->componentDataType(), obj->name() ); - SalomeApp_DataOwner* owner = new SalomeApp_DataOwner( aSObj ); - thelist.append( SUIT_DataOwnerPtr( owner ) ); - } - } -} - -/*!Sets selection.*/ -void SalomeApp_OBSelector::setSelection( const SUIT_DataOwnerPtrList& thelist ) -{ - if ( !myBrowser ) - return; - - QMap themap; - fillEntries( themap ); - - DataObjectList objList; - for ( SUIT_DataOwnerPtrList::const_iterator it = thelist.begin(); it != thelist.end(); ++it ) - { - const SalomeApp_DataOwner* owner = dynamic_cast( (*it).operator->() ); - if ( owner && themap.contains( owner->entry() ) ) - objList.append( themap[owner->entry()] ); - } - - myBrowser->setSelected( objList ); -} - -/*!On selection changed.*/ -void SalomeApp_OBSelector::onSelectionChanged() -{ - selectionChanged(); -} - -/*!Fill entries.*/ -void SalomeApp_OBSelector::fillEntries( QMap& entires ) -{ - entires.clear(); - - if ( !myBrowser ) - return; - - for ( SUIT_DataObjectIterator it( myBrowser->getRootObject(), - SUIT_DataObjectIterator::DepthLeft ); it.current(); ++it ) - { - SalomeApp_DataObject* obj = dynamic_cast( it.current() ); - if ( obj ) - entires.insert( obj->entry(), obj ); - } -} diff --git a/src/SalomeApp/SalomeApp_OBSelector.h b/src/SalomeApp/SalomeApp_OBSelector.h deleted file mode 100644 index 312d4fef5..000000000 --- a/src/SalomeApp/SalomeApp_OBSelector.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef SALOMEAPP_OBSELECTOR_H -#define SALOMEAPP_OBSELECTOR_H - -#include "SalomeApp.h" - -#include - -class OB_Browser; -class SalomeApp_DataObject; - -class SALOMEAPP_EXPORT SalomeApp_OBSelector : public SUIT_Selector -{ - Q_OBJECT - -public: - SalomeApp_OBSelector( OB_Browser*, SUIT_SelectionMgr* ); - virtual ~SalomeApp_OBSelector(); - - OB_Browser* browser() const; - - /*!Return "ObjectBrowser"*/ - virtual QString type() const { return "ObjectBrowser"; } - -private slots: - void onSelectionChanged(); - -protected: - virtual void getSelection( SUIT_DataOwnerPtrList& ) const; - virtual void setSelection( const SUIT_DataOwnerPtrList& ); - -private: - void fillEntries( QMap& ); - -private: - OB_Browser* myBrowser; -}; - -#endif diff --git a/src/SalomeApp/SalomeApp_PreferencesDlg.cxx b/src/SalomeApp/SalomeApp_PreferencesDlg.cxx deleted file mode 100755 index 5f06df4a6..000000000 --- a/src/SalomeApp/SalomeApp_PreferencesDlg.cxx +++ /dev/null @@ -1,84 +0,0 @@ -// File: SalomeApp_PreferencesDlg.cxx -// Author: Sergey TELKOV - -#include "SalomeApp_PreferencesDlg.h" - -#include "SalomeApp_Preferences.h" - -#include -#include - -/*! - Constructor. -*/ -SalomeApp_PreferencesDlg::SalomeApp_PreferencesDlg( SalomeApp_Preferences* prefs, QWidget* parent ) -: QtxDialog( parent, 0, true, false, OK | Close | Apply ), -myPrefs( prefs ) -{ - setCaption( tr( "CAPTION" ) ); - - QVBoxLayout* main = new QVBoxLayout( mainFrame(), 5 ); - - QVBox* base = new QVBox( mainFrame() ); - main->addWidget( base ); - - myPrefs->reparent( base, QPoint( 0, 0 ), true ); - - setFocusProxy( myPrefs ); - - setButtonPosition( Right, Close ); - - setDialogFlags( AlignOnce ); - - connect( this, SIGNAL( dlgHelp() ), this, SLOT( onHelp() ) ); - connect( this, SIGNAL( dlgApply() ), this, SLOT( onApply() ) ); -} - -/*! - Destructor. -*/ -SalomeApp_PreferencesDlg::~SalomeApp_PreferencesDlg() -{ - if ( !myPrefs ) - return; - - myPrefs->reparent( 0, QPoint( 0, 0 ), false ); - myPrefs = 0; -} - -/*!Show dialog.*/ -void SalomeApp_PreferencesDlg::show() -{ - myPrefs->retrieve(); - myPrefs->toBackup(); - - QtxDialog::show(); -} - -/*!Store preferences on accept.*/ -void SalomeApp_PreferencesDlg::accept() -{ - QtxDialog::accept(); - - myPrefs->store(); -} - -/*!Reject. Restore preferences from backup.*/ -void SalomeApp_PreferencesDlg::reject() -{ - QtxDialog::reject(); - - myPrefs->fromBackup(); -} - -/*!Do nothing.*/ -void SalomeApp_PreferencesDlg::onHelp() -{ -} - -/*!Store preferences on apply.*/ -void SalomeApp_PreferencesDlg::onApply() -{ - myPrefs->store(); - myPrefs->toBackup(); -} diff --git a/src/SalomeApp/SalomeApp_PreferencesDlg.h b/src/SalomeApp/SalomeApp_PreferencesDlg.h deleted file mode 100755 index 16c798f23..000000000 --- a/src/SalomeApp/SalomeApp_PreferencesDlg.h +++ /dev/null @@ -1,34 +0,0 @@ -// File: SalomeApp_PreferencesDlg.h -// Author: Sergey TELKOV - -#ifndef SALOMEAPP_PREFERENCESDLG_H -#define SALOMEAPP_PREFERENCESDLG_H - -#include - -#include - -class SalomeApp_Preferences; - -/*!Preferences dialog.*/ -class SALOMEAPP_EXPORT SalomeApp_PreferencesDlg : public QtxDialog -{ - Q_OBJECT - -public: - SalomeApp_PreferencesDlg( SalomeApp_Preferences*, QWidget* = 0 ); - virtual ~SalomeApp_PreferencesDlg(); - - virtual void show(); - virtual void accept(); - virtual void reject(); - -private slots: - void onHelp(); - void onApply(); - -private: - SalomeApp_Preferences* myPrefs; -}; - -#endif diff --git a/src/SalomeApp/SalomeApp_Selection.cxx b/src/SalomeApp/SalomeApp_Selection.cxx deleted file mode 100644 index 3182881af..000000000 --- a/src/SalomeApp/SalomeApp_Selection.cxx +++ /dev/null @@ -1,190 +0,0 @@ - -#include "SalomeApp_Selection.h" -#include "SalomeApp_SelectionMgr.h" -#include "SalomeApp_DataOwner.h" -#include "SalomeApp_Study.h" -#include "SalomeApp_Application.h" -#include "SalomeApp_Displayer.h" - -#include "SUIT_Session.h" -#include "SUIT_ViewWindow.h" - -/*! - Constructor -*/ -SalomeApp_Selection::SalomeApp_Selection() -: myStudy( 0 ) -{ -} - -/*! - Destructor. -*/ -SalomeApp_Selection::~SalomeApp_Selection() -{ -} - -/*! - Initializetion. -*/ -void SalomeApp_Selection::init( const QString& client, SalomeApp_SelectionMgr* mgr) -{ - myPopupClient = client; - - if( mgr ) - { - if ( mgr->application() ) - myStudy = dynamic_cast( mgr->application()->activeStudy() ); - - if( !myStudy ) - return; - - _PTR(Study) studyds = myStudy->studyDS(); - _PTR(SObject) refobj; - - SUIT_DataOwnerPtrList sel; - mgr->selected( sel, client ); - SUIT_DataOwnerPtrList::const_iterator anIt = sel.begin(), aLast = sel.end(); - for( ; anIt!=aLast; anIt++ ) - { - SUIT_DataOwner* owner = ( SUIT_DataOwner* )( (*anIt ).get() ); - SalomeApp_DataOwner* sowner = dynamic_cast( owner ); - if( sowner ) - { - _PTR(SObject) obj = studyds->FindObjectID( sowner->entry() ); - if( obj->ReferencedObject( refobj ) ) - { - myEntries.append( refobj->GetID() ); - myIsReferences.append( true ); - } - else - { - myEntries.append( sowner->entry() ); - myIsReferences.append( false ); - } - processOwner( sowner ); - } - } - } -} - -/*! - Gets count of entries. -*/ -int SalomeApp_Selection::count() const -{ - return myEntries.count(); -} - -/*! - Gets QtxValue(); -*/ -QtxValue SalomeApp_Selection::param( const int ind, const QString& p ) const -{ - if( !( ind>=0 && indstudyDS()->FindObjectID( myEntries[ ind ].latin1() ) ); - _PTR(SComponent) comp = obj->GetFatherComponent(); - QString mod_name = comp->ComponentDataType().c_str(); - //cout << "component : " << ind << " >> " << mod_name.latin1() << endl; - if( !mod_name.isEmpty() ) - return mod_name; - } - else if( p=="isReference" ) - return QtxValue( isReference( ind ), false ); - - return QtxValue(); -} - -/*! - Gets global parameters. client, isActiveView, activeView etc. -*/ -QtxValue SalomeApp_Selection::globalParam( const QString& p ) const -{ - if ( p == "client" ) return QtxValue( myPopupClient ); - else if ( p == "activeModule" ) - { - SalomeApp_Application* app = dynamic_cast( myStudy->application() ); - QString mod_name = app ? QString( app->activeModule()->name() ) : QString::null; - //cout << "activeModule : " << mod_name.latin1() << endl; - if( !mod_name.isEmpty() ) - return mod_name; - else - return QtxValue(); - } - else if ( p == "isActiveView" ) return QtxValue( (bool)activeVW() ); - else if ( p == "activeView" ) return QtxValue( activeViewType() ); -#ifndef WNT - else return QtxPopupMgr::Selection::globalParam( p ); -#else - else return Selection::globalParam( p ); -#endif -} - -/*! - Do nothing. -*/ -void SalomeApp_Selection::processOwner( const SalomeApp_DataOwner* ) -{ -} - -/*! - Gets entry with index \a index. -*/ -QString SalomeApp_Selection::entry( const int index ) const -{ - if ( index >= 0 && index < count() ) - return myEntries[ index ]; - return QString(); -} - -/*! - Returns true if i-th selected object was reference to object with entry( i ) -*/ -bool SalomeApp_Selection::isReference( const int index ) const -{ - if( index >= 0 && index < count() ) - return myIsReferences[ index ]; - else - return false; -} - -/*! - Gets type of active view manager. -*/ -QString SalomeApp_Selection::activeViewType() const -{ - SUIT_ViewWindow* win = activeVW(); - if ( win ) { - SUIT_ViewManager* vm = win->getViewManager(); - if ( vm ) - return vm->getType(); - } - return QString::null; -} - -/*! - Gets active view window. -*/ -SUIT_ViewWindow* SalomeApp_Selection::activeVW() const -{ - SUIT_Session* session = SUIT_Session::session(); - if ( session ) { - SUIT_Application* app = session->activeApplication(); - if ( app ) { - SUIT_Desktop* desk = app->desktop(); - if ( desk ) - return desk->activeWindow(); - } - } - return 0; -} diff --git a/src/SalomeApp/SalomeApp_Selection.h b/src/SalomeApp/SalomeApp_Selection.h deleted file mode 100644 index 97f05ee52..000000000 --- a/src/SalomeApp/SalomeApp_Selection.h +++ /dev/null @@ -1,71 +0,0 @@ -// SalomeApp_Selection -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SalomeApp_Selection.h -// Author : Alexander SOLOVYOV -// Module : GUI -// $Header$ - -#ifndef SalomeApp_SELECTION_HeaderFile -#define SalomeApp_SELECTION_HeaderFile - -#include - -#include - -class SalomeApp_SelectionMgr; -class SalomeApp_DataOwner; -class SalomeApp_Study; -class SALOMEDSClient_Study; -class SUIT_ViewWindow; - - -class SALOMEAPP_EXPORT SalomeApp_Selection : public QtxPopupMgr::Selection -{ -public: - SalomeApp_Selection(); - virtual ~SalomeApp_Selection(); - - virtual void init( const QString&, SalomeApp_SelectionMgr* ); - virtual void processOwner( const SalomeApp_DataOwner* ); - - virtual int count() const; - virtual QtxValue param( const int, const QString& ) const; - virtual QtxValue globalParam( const QString& ) const; - -protected: - QString entry( const int ) const; - bool isReference( const int ) const; - /*!Gets study.*/ - SalomeApp_Study* study() const { return myStudy; } - QString activeViewType() const; - SUIT_ViewWindow* activeVW() const; - -private: - QString myPopupClient; - QStringList myEntries; // entries of selected objects - QValueList myIsReferences; // whether i-th selected object was a reference - SalomeApp_Study* myStudy; -}; - -#endif diff --git a/src/SalomeApp/SalomeApp_SelectionMgr.cxx b/src/SalomeApp/SalomeApp_SelectionMgr.cxx deleted file mode 100644 index 059b2ccfd..000000000 --- a/src/SalomeApp/SalomeApp_SelectionMgr.cxx +++ /dev/null @@ -1,274 +0,0 @@ -#include "SalomeApp_SelectionMgr.h" - -#include "SalomeApp_Study.h" -#include "SalomeApp_DataOwner.h" -#include "SalomeApp_DataSubOwner.h" -#include "SalomeApp_Application.h" - -#include - -#include -#include - -// Open CASCADE Include -#include -#include -#include - -#include "SALOMEDSClient.hxx" - -/*! - Constructor. -*/ -SalomeApp_SelectionMgr::SalomeApp_SelectionMgr( SalomeApp_Application* app, const bool fb ) -: SUIT_SelectionMgr( fb ), -myApp( app ) -{ -} - -/*! - Destructor. -*/ -SalomeApp_SelectionMgr::~SalomeApp_SelectionMgr() -{ -} - -/*! - Gets application. -*/ -SalomeApp_Application* SalomeApp_SelectionMgr::application() const -{ - return myApp; -} - -/*! - Get all selected objects from selection manager -*/ -void SalomeApp_SelectionMgr::selectedObjects( SALOME_ListIO& theList, const QString& theType, - const bool convertReferences ) const -{ - theList.Clear(); - - SUIT_DataOwnerPtrList aList; - selected( aList, theType ); - - QMap entryMap; - SalomeApp_Study* st = dynamic_cast( application()->activeStudy() ); - if( !st ) - return; - - _PTR(Study) dstudy = st->studyDS(); - QString entry; - _PTR(SObject) refobj; - - for ( SUIT_DataOwnerPtrList::const_iterator itr = aList.begin(); itr != aList.end(); ++itr ) - { - const SalomeApp_DataOwner* owner = dynamic_cast( (*itr).operator->() ); - if( !owner ) - continue; - - _PTR(SObject) obj = dstudy->FindObjectID( owner->entry() ); - if( obj && convertReferences && obj->ReferencedObject( refobj ) ) - { - entry = refobj->GetID(); - if( !entryMap.contains( entry ) ) - theList.Append( new SALOME_InteractiveObject( refobj->GetID().c_str(), - refobj->GetFatherComponent()->ComponentDataType().c_str(), - refobj->Name().c_str() ) ); - } - else - { - entry = owner->entry(); - if( !entryMap.contains( entry ) ) - theList.Append( owner->IO() ); - } - - entryMap.insert( entry , 1); - } -} - -/*! - Append selected objects. -*/ -void SalomeApp_SelectionMgr::setSelectedObjects( const SALOME_ListIO& lst, const bool append ) -{ - SUIT_DataOwnerPtrList owners; - for ( SALOME_ListIteratorOfListIO it( lst ); it.More(); it.Next() ) - { - if ( it.Value()->hasEntry() ) - owners.append( new SalomeApp_DataOwner( it.Value() ) ); - } - - setSelected( owners, append ); -} - -/*! - Emit current selection changed. -*/ -void SalomeApp_SelectionMgr::selectionChanged( SUIT_Selector* theSel ) -{ - SUIT_SelectionMgr::selectionChanged( theSel ); - - emit currentSelectionChanged(); -} - -/*! - get map of indexes for the given SALOME_InteractiveObject -*/ -void SalomeApp_SelectionMgr::GetIndexes( const Handle(SALOME_InteractiveObject)& IObject, - TColStd_IndexedMapOfInteger& theIndex) -{ - theIndex.Clear(); - - SUIT_DataOwnerPtrList aList; - selected( aList ); - - for ( SUIT_DataOwnerPtrList::const_iterator itr = aList.begin(); itr != aList.end(); ++itr ) - { - const SalomeApp_DataSubOwner* subOwner = dynamic_cast( (*itr).operator->() ); - if ( subOwner ) - if ( subOwner->entry() == QString(IObject->getEntry()) ) - theIndex.Add( subOwner->index() ); - } - -} - -/*! - get map of indexes for the given entry of SALOME_InteractiveObject -*/ -void SalomeApp_SelectionMgr::GetIndexes( const QString& theEntry, TColStd_IndexedMapOfInteger& theIndex ) -{ - theIndex.Clear(); - - SUIT_DataOwnerPtrList aList; - selected( aList ); - - for ( SUIT_DataOwnerPtrList::const_iterator itr = aList.begin(); itr != aList.end(); ++itr ) - { - const SalomeApp_DataSubOwner* subOwner = dynamic_cast( (*itr).operator->() ); - if ( subOwner ) - if ( subOwner->entry() == theEntry ) - theIndex.Add( subOwner->index() ); - } - -} - -/*! - Add or remove interactive objects from selection manager. -*/ -bool SalomeApp_SelectionMgr::AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& IObject, - const TColStd_MapOfInteger& theIndexes, - bool modeShift) -{ - SUIT_DataOwnerPtrList remainsOwners; - - SUIT_DataOwnerPtrList aList; - selected( aList ); - - if ( !modeShift ) { - for ( SUIT_DataOwnerPtrList::const_iterator itr = aList.begin(); itr != aList.end(); ++itr ) - { - const SalomeApp_DataOwner* owner = dynamic_cast( (*itr).operator->() ); - if ( owner ) - { - if ( owner->entry() != QString(IObject->getEntry()) ) - { - const SalomeApp_DataSubOwner* subOwner = dynamic_cast( owner ); - if ( subOwner ) - remainsOwners.append( new SalomeApp_DataSubOwner( subOwner->entry(), subOwner->index() ) ); - else - remainsOwners.append( new SalomeApp_DataOwner( owner->entry() ) ); - } - } - } - } - else - remainsOwners = aList; - - TColStd_MapIteratorOfMapOfInteger It; - It.Initialize(theIndexes); - for(;It.More();It.Next()) - remainsOwners.append( new SalomeApp_DataSubOwner( QString(IObject->getEntry()), It.Key() ) ); - - bool append = false; - setSelected( remainsOwners, append ); - - emit currentSelectionChanged(); - - TColStd_IndexedMapOfInteger anIndexes; - GetIndexes( IObject, anIndexes ); - return !anIndexes.IsEmpty(); - -} - -/*! - select 'subobjects' with given indexes -*/ -void SalomeApp_SelectionMgr::selectObjects( const Handle(SALOME_InteractiveObject)& IObject, - TColStd_IndexedMapOfInteger theIndex, bool append ) -{ - SUIT_DataOwnerPtrList aList; - - if ( theIndex.IsEmpty() ) - aList.append( new SalomeApp_DataOwner( QString(IObject->getEntry()) ) ); - else - { - int i; - for ( i = 1; i <= theIndex.Extent(); i++ ) - aList.append( new SalomeApp_DataSubOwner( QString(IObject->getEntry()), theIndex( i ) ) ); - } - - setSelected( aList, append ); - -} - -/*! - select 'subobjects' with given indexes -*/ -void SalomeApp_SelectionMgr::selectObjects( MapIOOfMapOfInteger theMapIO, bool append ) -{ - SUIT_DataOwnerPtrList aList; - - MapIOOfMapOfInteger::Iterator it; - for ( it = theMapIO.begin(); it != theMapIO.end(); ++it ) - { - if ( it.data().IsEmpty() ) - aList.append( new SalomeApp_DataOwner( QString(it.key()->getEntry()) ) ); - else - { - int i; - for ( i = 1; i <= it.data().Extent(); i++ ) - aList.append( new SalomeApp_DataSubOwner( QString(it.key()->getEntry()), it.data()( i ) ) ); - } - } - - setSelected( aList, append ); - -} - -/*! - get map of selected subowners : object's entry <-> map of indexes -*/ -void SalomeApp_SelectionMgr::selectedSubOwners( MapEntryOfMapOfInteger& theMap ) -{ - theMap.clear(); - - TColStd_IndexedMapOfInteger anIndexes; - - SUIT_DataOwnerPtrList aList; - selected( aList ); - - for ( SUIT_DataOwnerPtrList::const_iterator itr = aList.begin(); itr != aList.end(); ++itr ) - { - const SalomeApp_DataSubOwner* subOwner = dynamic_cast( (*itr).operator->() ); - if ( subOwner ) - { - if ( !theMap.contains( subOwner->entry() ) ) - { - anIndexes.Clear(); - GetIndexes( subOwner->entry(), anIndexes ); - theMap.insert( subOwner->entry(), anIndexes ); - } - } - } -} diff --git a/src/SalomeApp/SalomeApp_SelectionMgr.h b/src/SalomeApp/SalomeApp_SelectionMgr.h deleted file mode 100644 index 54643c2e4..000000000 --- a/src/SalomeApp/SalomeApp_SelectionMgr.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef SALOMEAPP_SELECTIONMGR_H -#define SALOMEAPP_SELECTIONMGR_H - -#include "SalomeApp.h" - -#include -#include - -#include - -class SALOME_ListIO; -class SalomeApp_Application; -class TColStd_IndexedMapOfInteger; -class TColStd_MapOfInteger; - -class SALOMEAPP_EXPORT SalomeApp_SelectionMgr : public SUIT_SelectionMgr -{ - Q_OBJECT - -public: - SalomeApp_SelectionMgr( SalomeApp_Application*, const bool = true ); - virtual ~SalomeApp_SelectionMgr(); - - typedef QMap< Handle(SALOME_InteractiveObject), TColStd_IndexedMapOfInteger > MapIOOfMapOfInteger; - typedef QMap< QString, TColStd_IndexedMapOfInteger > MapEntryOfMapOfInteger; - - SalomeApp_Application* application() const; - - void selectedObjects( SALOME_ListIO&, const QString& = QString::null, const bool = true ) const; - void setSelectedObjects( const SALOME_ListIO&, const bool = false ); - - void GetIndexes( const Handle(SALOME_InteractiveObject)& IObject, - TColStd_IndexedMapOfInteger& theIndex ); - void GetIndexes( const QString& theEntry, - TColStd_IndexedMapOfInteger& theIndex ); - - bool AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& IObject, - const TColStd_MapOfInteger& theIndices, - bool modeShift ); - - void selectObjects( const Handle(SALOME_InteractiveObject)& IObject, - TColStd_IndexedMapOfInteger theIndex, bool append ); - void selectObjects( MapIOOfMapOfInteger theMapIO, bool append ); - - void selectedSubOwners( MapEntryOfMapOfInteger& theMap ); - -signals: - void currentSelectionChanged(); - -private: - virtual void selectionChanged( SUIT_Selector* ); - -private: - SalomeApp_Application* myApp; -}; - -#endif diff --git a/src/SalomeApp/SalomeApp_ShowHideOp.cxx b/src/SalomeApp/SalomeApp_ShowHideOp.cxx deleted file mode 100644 index 3eb77dfe7..000000000 --- a/src/SalomeApp/SalomeApp_ShowHideOp.cxx +++ /dev/null @@ -1,76 +0,0 @@ - -#include "SalomeApp_ShowHideOp.h" -#include "SalomeApp_Application.h" -#include "SalomeApp_SelectionMgr.h" -#include "SalomeApp_Selection.h" -#include "SalomeApp_Module.h" -#include "SalomeApp_Displayer.h" -#include "CAM_Study.h" -#include -#include - -SalomeApp_ShowHideOp::SalomeApp_ShowHideOp( ActionType type ) -: SalomeApp_Operation(), - myActionType( type ) -{ -} - -SalomeApp_ShowHideOp::~SalomeApp_ShowHideOp() -{ -} - -void SalomeApp_ShowHideOp::startOperation() -{ - SalomeApp_Application* app = dynamic_cast( application() ); - if( !app ) - { - abort(); - return; - } - - SalomeApp_SelectionMgr* mgr = app->selectionMgr(); - SalomeApp_Selection sel; sel.init( "", mgr ); - if( sel.count()==0 ) - { - abort(); - return; - } - - QString mod_name = app->moduleTitle( sel.param( 0, "component" ).toString() ); - SalomeApp_Module* m = dynamic_cast( app ? app->module( mod_name ) : 0 ); - if( !m ) - { - m = dynamic_cast( app->loadModule( mod_name ) ); - app->addModule( m ); - m->connectToStudy( dynamic_cast( app->activeStudy() ) ); - m->setMenuShown( false ); - m->setToolShown( false ); - } - - SalomeApp_Displayer* d = m ? m->displayer(): 0; - if( !d ) - { - abort(); - return; - } - - if( myActionType==DISPLAY_ONLY ) - d->EraseAll( false, false, 0 ); - - SALOME_ListIO selObjs; - mgr->selectedObjects( selObjs ); - SALOME_ListIteratorOfListIO anIt( selObjs ); - for( ; anIt.More(); anIt.Next() ) - { - if( anIt.Value().IsNull() ) - continue; - - if( myActionType==DISPLAY || myActionType==DISPLAY_ONLY ) - d->Display( anIt.Value()->getEntry(), false, 0 ); - else if( myActionType==ERASE ) - d->Erase( anIt.Value()->getEntry(), false, false, 0 ); - } - d->UpdateViewer(); - commit(); -} - diff --git a/src/SalomeApp/SalomeApp_ShowHideOp.h b/src/SalomeApp/SalomeApp_ShowHideOp.h deleted file mode 100644 index a3280a96d..000000000 --- a/src/SalomeApp/SalomeApp_ShowHideOp.h +++ /dev/null @@ -1,26 +0,0 @@ - -#ifndef SALOMEAPP_SHOW_HIDE_OPERATION_HEADER -#define SALOMEAPP_SHOW_HIDE_OPERATION_HEADER - -#include "SalomeApp_Operation.h" - -class SalomeApp_ShowHideOp : public SalomeApp_Operation -{ - Q_OBJECT - -public: - typedef enum { DISPLAY, ERASE, DISPLAY_ONLY } ActionType; - -public: - SalomeApp_ShowHideOp( ActionType ); - ~SalomeApp_ShowHideOp(); - -protected: - virtual void startOperation(); - -private: - ActionType myActionType; -}; - -#endif - diff --git a/src/SalomeApp/resources/icon_about.png b/src/SalomeApp/resources/icon_about.png deleted file mode 100755 index 287b4f766..000000000 Binary files a/src/SalomeApp/resources/icon_about.png and /dev/null differ diff --git a/src/SalomeApp/resources/icon_applogo.png b/src/SalomeApp/resources/icon_applogo.png deleted file mode 100755 index bb1265280..000000000 Binary files a/src/SalomeApp/resources/icon_applogo.png and /dev/null differ diff --git a/src/SalomeApp/resources/icon_default.png b/src/SalomeApp/resources/icon_default.png deleted file mode 100644 index 0140a6667..000000000 Binary files a/src/SalomeApp/resources/icon_default.png and /dev/null differ diff --git a/src/SalomeApp/resources/icon_module.png b/src/SalomeApp/resources/icon_module.png deleted file mode 100644 index 9fdd5fb01..000000000 Binary files a/src/SalomeApp/resources/icon_module.png and /dev/null differ diff --git a/src/SalomeApp/resources/icon_module_big.png b/src/SalomeApp/resources/icon_module_big.png deleted file mode 100755 index 99e10b1ff..000000000 Binary files a/src/SalomeApp/resources/icon_module_big.png and /dev/null differ diff --git a/src/SalomeApp/resources/icon_select.png b/src/SalomeApp/resources/icon_select.png deleted file mode 100644 index 99ebde65e..000000000 Binary files a/src/SalomeApp/resources/icon_select.png and /dev/null differ