From: nds Date: Thu, 3 Nov 2005 07:27:13 +0000 (+0000) Subject: This file in LightApp package X-Git-Tag: V3_1_0a3~80 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=cdce4bc659c9b5fe82e643f0cc2da4063c7c9371;p=modules%2Fgui.git This file in LightApp package --- diff --git a/src/SalomeApp/SalomeApp_DataOwner.cxx b/src/SalomeApp/SalomeApp_DataOwner.cxx deleted file mode 100644 index 4035b214f..000000000 --- a/src/SalomeApp/SalomeApp_DataOwner.cxx +++ /dev/null @@ -1,56 +0,0 @@ -#include "SalomeApp_DataOwner.h" - -#include "SalomeApp_DataObject.h" - -#ifdef WNT -#include -#endif - -#include - -/*!Constructor. Initialize by \a theEntry.*/ -SalomeApp_DataOwner -::SalomeApp_DataOwner( const QString& theEntry ): - myEntry( theEntry ) -{ -} - -/*!Constructor. Initialize by \a SALOME_InteractiveObject.*/ -SalomeApp_DataOwner -::SalomeApp_DataOwner( const Handle(SALOME_InteractiveObject)& theIO ): - myEntry(!theIO.IsNull()? theIO->getEntry(): ""), - myIO(theIO) -{ -} - -/*!Destructor. Do nothing.*/ -SalomeApp_DataOwner -::~SalomeApp_DataOwner() -{ -} - -/*!Checks: Is current data owner equal \a obj.*/ -bool -SalomeApp_DataOwner -::isEqual( const SUIT_DataOwner& obj ) const -{ - const SalomeApp_DataOwner* other = dynamic_cast( &obj ); - - return other && entry() == other->entry(); -} - -/*!Gets entry.*/ -QString -SalomeApp_DataOwner -::entry() const -{ - return myEntry; -} - -/*!Gets SALOME_InteractiveObject.*/ -const Handle(SALOME_InteractiveObject)& -SalomeApp_DataOwner -::IO() const -{ - return myIO; -} diff --git a/src/SalomeApp/SalomeApp_DataOwner.h b/src/SalomeApp/SalomeApp_DataOwner.h deleted file mode 100644 index f2fa5172d..000000000 --- a/src/SalomeApp/SalomeApp_DataOwner.h +++ /dev/null @@ -1,30 +0,0 @@ - -#ifndef SALOMEAPP_DATAOWNER_H -#define SALOMEAPP_DATAOWNER_H - -#include -#include "SUIT_DataOwner.h" -#include "SALOME_InteractiveObject.hxx" - -/*! - This class provide data owner objects. -*/ -class SALOMEAPP_EXPORT SalomeApp_DataOwner : public SUIT_DataOwner -{ -public: - SalomeApp_DataOwner( const Handle(SALOME_InteractiveObject)& theIO ); - SalomeApp_DataOwner( const QString& ); - virtual ~SalomeApp_DataOwner(); - - virtual bool isEqual( const SUIT_DataOwner& ) const; - const Handle(SALOME_InteractiveObject)& IO() const; - QString entry() const; - -private: - QString myEntry; - Handle(SALOME_InteractiveObject) myIO; -}; - -typedef SMART(SalomeApp_DataOwner) SalomeApp_DataOwnerPtr; - -#endif diff --git a/src/SalomeApp/SalomeApp_DataSubOwner.cxx b/src/SalomeApp/SalomeApp_DataSubOwner.cxx deleted file mode 100644 index 6c201155f..000000000 --- a/src/SalomeApp/SalomeApp_DataSubOwner.cxx +++ /dev/null @@ -1,33 +0,0 @@ -#include "SalomeApp_DataSubOwner.h" - -#include "SalomeApp_DataObject.h" - -#ifdef WNT -#include -#endif - -/*!Constructor.Initialize by \a entry and \a index*/ -SalomeApp_DataSubOwner::SalomeApp_DataSubOwner( const QString& entry, const int index ) -: SalomeApp_DataOwner( entry ), -myIndex( index ) -{ -} - -/*!Destructor. Do nothing.*/ -SalomeApp_DataSubOwner::~SalomeApp_DataSubOwner() -{ -} - -/*!Checks: Is current data sub owner equal \a obj.*/ -bool SalomeApp_DataSubOwner::isEqual( const SUIT_DataOwner& obj ) const -{ - const SalomeApp_DataSubOwner* other = dynamic_cast( &obj ); - - return other && entry() == other->entry() && index() == other->index(); -} - -/*!Gets index.*/ -int SalomeApp_DataSubOwner::index() const -{ - return myIndex; -} diff --git a/src/SalomeApp/SalomeApp_DataSubOwner.h b/src/SalomeApp/SalomeApp_DataSubOwner.h deleted file mode 100644 index 253f0ad93..000000000 --- a/src/SalomeApp/SalomeApp_DataSubOwner.h +++ /dev/null @@ -1,24 +0,0 @@ - -#ifndef SALOMEAPP_DATASUBOWNER_H -#define SALOMEAPP_DATASUBOWNER_H - -#include -#include - -/*! - Class provide sub owner. - */ -class SALOMEAPP_EXPORT SalomeApp_DataSubOwner : public SalomeApp_DataOwner -{ -public: - SalomeApp_DataSubOwner( const QString&, const int ); - virtual ~SalomeApp_DataSubOwner(); - - virtual bool isEqual( const SUIT_DataOwner& ) const; - int index() const; - -private: - int myIndex; -}; - -#endif diff --git a/src/SalomeApp/SalomeApp_GLSelector.cxx b/src/SalomeApp/SalomeApp_GLSelector.cxx deleted file mode 100644 index 0e3b4a842..000000000 --- a/src/SalomeApp/SalomeApp_GLSelector.cxx +++ /dev/null @@ -1,98 +0,0 @@ -#include "SalomeApp_GLSelector.h" - -#include "SalomeApp_DataOwner.h" - -#include - -#include - -/*!Constructor. Initialize by GLViewer_Viewer2d and SUIT_SelectionMgr.*/ -SalomeApp_GLSelector::SalomeApp_GLSelector( GLViewer_Viewer2d* viewer, SUIT_SelectionMgr* mgr ) -: SUIT_Selector( mgr, viewer ), - myViewer( viewer ) -{ - if ( myViewer ) - connect( myViewer, SIGNAL( selectionChanged() ), this, SLOT( onSelectionChanged() ) ); -} - -/*!Destructor. Do nothing.*/ -SalomeApp_GLSelector::~SalomeApp_GLSelector() -{ -} - -/*!Gets viewer*/ -GLViewer_Viewer2d* SalomeApp_GLSelector::viewer() const -{ - return myViewer; -} - -/*!On selection changed event.*/ -void SalomeApp_GLSelector::onSelectionChanged() -{ - selectionChanged(); -} - -/*!Gets list of selected Data Owner objects.*/ -void SalomeApp_GLSelector::getSelection( SUIT_DataOwnerPtrList& aList ) const -{ - if ( !myViewer ) - return; - - GLViewer_Context* cont = myViewer->getGLContext(); - if ( !cont ) - return; - - for ( cont->InitSelected(); cont->MoreSelected(); cont->NextSelected() ) - { - GLViewer_Object* obj = cont->SelectedObject(); - if ( obj ) - { - SALOME_GLOwner* owner = dynamic_cast< SALOME_GLOwner* >( obj->owner() ); - if( owner ) - aList.append( SUIT_DataOwnerPtr( new SalomeApp_DataOwner( owner->entry() ) ) ); - } - } -} - -/*!Sets to selected list of Data Owner objects.*/ -void SalomeApp_GLSelector::setSelection( const SUIT_DataOwnerPtrList& aList ) -{ - if ( !myViewer ) - return; - - GLViewer_Context* cont = myViewer->getGLContext(); - if ( !cont ) - return; - - QMap aDisplayed; - const ObjList& displayed = cont->getObjects(); - for ( ObjList::const_iterator it = displayed.begin(); it != displayed.end(); ++it ) - { - GLViewer_Object* obj = *it; - if ( obj && obj->getVisible() ) - { - SALOME_GLOwner* owner = dynamic_cast< SALOME_GLOwner* >( obj->owner() ); - if ( owner ) - aDisplayed.insert( owner->entry(), obj ); - } - } - - int Nb = 0; - cont->clearSelected( false ); - for ( SUIT_DataOwnerPtrList::const_iterator itr = aList.begin(); itr != aList.end(); ++itr ) - { - const SalomeApp_DataOwner* owner = dynamic_cast( (*itr).operator->() ); - - if ( !owner ) - continue; - - if ( aDisplayed.contains( owner->entry() ) ) - { - cont->setSelected( aDisplayed[owner->entry()], false ); - Nb++; - } - } - - if ( Nb > 0 ) - myViewer->updateAll(); -} diff --git a/src/SalomeApp/SalomeApp_GLSelector.h b/src/SalomeApp/SalomeApp_GLSelector.h deleted file mode 100644 index cd61d3298..000000000 --- a/src/SalomeApp/SalomeApp_GLSelector.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef SALOMEAPP_GLSELECTOR_H -#define SALOMEAPP_GLSELECTOR_H - -#include "SalomeApp.h" - -#include - -#include - -class SALOMEAPP_EXPORT SalomeApp_GLSelector : public SUIT_Selector -{ - Q_OBJECT - -public: - SalomeApp_GLSelector( GLViewer_Viewer2d*, SUIT_SelectionMgr* ); - virtual ~SalomeApp_GLSelector(); - - GLViewer_Viewer2d* viewer() const; - - virtual QString type() const { return GLViewer_Viewer2d::Type(); } - -private slots: - void onSelectionChanged(); - -protected: - virtual void getSelection( SUIT_DataOwnerPtrList& ) const; - virtual void setSelection( const SUIT_DataOwnerPtrList& ); - -private: - GLViewer_Viewer2d* myViewer; -}; - -#endif diff --git a/src/SalomeApp/SalomeApp_ModuleDlg.cxx b/src/SalomeApp/SalomeApp_ModuleDlg.cxx deleted file mode 100644 index 0b1ebc7e7..000000000 --- a/src/SalomeApp/SalomeApp_ModuleDlg.cxx +++ /dev/null @@ -1,204 +0,0 @@ -// SALOME SALOMEGUI : implementation of desktop and GUI kernel -// -// Copyright (C) 2005 CEA/DEN, EDF R&D -// -// -// -// File : SalomeApp_ModuleDlg.cxx -// Author : Michael Zorin (mzn) -// Module : SALOME - -#include "SalomeApp_ModuleDlg.h" - -#include -#include -#include -#include -#include - -#ifndef WNT -using namespace std; -#endif - -/*!Default icon*/ -static const char* const default_icon[] = { -"48 48 17 1", -". c None", -"# c #161e4c", -"b c #1d3638", -"e c #2f585b", -"i c #345b5e", -"c c #386266", -"g c #3f7477", -"d c #4d8589", -"m c #519099", -"o c #6abbc1", -"a c #70c9d3", -"f c #79ddea", -"n c #7adff2", -"k c #7ce2f4", -"j c #993550", -"h c #d84b71", -"l c #ef537d", -"................................................", -"................................................", -"................................................", -"................................................", -"................................................", -"................########.########.########......", -"...............#aaaaaa###aaaaaa###aaaaaa##......", -"..............#aaaaaa#b#aaaaaa#b#aaaaaa#c#......", -".............########b########b########cc#......", -".............#dddddd#b#dddddd#b#dddddd#cc#......", -"...........########d########d########d#cc#......", -"..........#aaaaaa###aaaaaa###aaaaaa##d#cc#......", -".........#aaaaaa#b#aaaaaa#b#aaaaaa#c#d#cc#......", -"........########b########e########cc#d#c#.......", -"........#dddddd#b#dddddd#e#ffffff#cc#d####......", -"......########d########d########f#cc###g##......", -".....#aaaaaa###aaaaaa###hhhhhh##f#cc#gg#c#......", -"....#aaaaaa#b#aaaaaa#i#hhhhhh#j#f#cc###cc#......", -"...########b########i########jj#f#c#gg#cc#......", -"...#kkkkkk#b#kkkkkk#i#llllll#jj#f####g#cc#......", -"...#kkkkkk#b#kkkkkk#i#llllll#jj###m##g#cc#......", -"...#knnkkk#b#kkkkkk#i#llllll#jj#mm#c#g#cc#......", -"...#knnkkk#b#kkkkkk#i#llllll#jj###cc#g#c#.......", -"...#kkkkkk#b#kkkkkk#i#llllll#j#dd#cc#g####......", -"...#kkkkkk###kkkkkk###llllll####d#cc###g##......", -"...########g########g########o##d#cc#gg#c#......", -"....#gggggg#b#gggggg#b#oooooo#c#d#cc###cc#......", -"...########b########b########cc#d#c#gg#cc#......", -"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#d####g#cc#......", -"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc###g##g#cc#......", -"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#gg#c#g#cc#......", -"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc###cc#g#c#.......", -"...#kkkkkk#b#kkkkkk#b#kkkkkk#c#gg#cc#g##........", -"...#kkkkkk###kkkkkk###kkkkkk####g#cc###.........", -"...########g########g########g##g#cc#...........", -"....#gggggg#b#gggggg#b#gggggg#c#g#cc#...........", -"...########b########b########cc#g#c#............", -"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#g##.............", -"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc###..............", -"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#................", -"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#................", -"...#kkkkkk#b#kkkkkk#b#kkkkkk#c#.................", -"...#kkkkkk###kkkkkk###kkkkkk##..................", -"...########.########.########...................", -"................................................", -"................................................", -"................................................", -"................................................"}; - -//============================================================================================================================== -/*! - * SalomeApp_ModuleDlg::SalomeApp_ModuleDlg \n - * - * Constructor. - */ -//============================================================================================================================== -SalomeApp_ModuleDlg::SalomeApp_ModuleDlg ( QWidget * parent, const QString& component, const QPixmap icon ) - : QDialog ( parent, "ActivateModuleDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - QPixmap defaultIcon( ( const char** ) default_icon ); - setCaption( tr( "CAPTION" ) ); - setSizeGripEnabled( TRUE ); - - QGridLayout* ActivateModuleDlgLayout = new QGridLayout( this ); - ActivateModuleDlgLayout->setMargin( 11 ); ActivateModuleDlgLayout->setSpacing( 6 ); - - // Module's name and icon - myComponentFrame = new QFrame( this, "myComponentFrame" ); - myComponentFrame->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding ) ); - myComponentFrame->setMinimumHeight( 100 ); - myComponentFrame->setFrameStyle( QFrame::Box | QFrame::Sunken ); - - QGridLayout* myComponentFrameLayout = new QGridLayout( myComponentFrame ); - myComponentFrameLayout->setMargin( 11 ); myComponentFrameLayout->setSpacing( 6 ); - - // --> icon - myComponentIcon = new QLabel( myComponentFrame, "myComponentIcon" ); - myComponentIcon->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); - myComponentIcon->setPixmap( !icon.isNull() ? icon : defaultIcon ); - myComponentIcon->setScaledContents( false ); - myComponentIcon->setAlignment( AlignCenter ); - // --> name - myComponentLab = new QLabel( component, myComponentFrame, "myComponentLab" ); - QFont fnt = myComponentLab->font(); fnt.setBold( TRUE ); myComponentLab->setFont( fnt ); - myComponentLab->setAlignment( AlignCenter ); - - myComponentFrameLayout->addWidget( myComponentIcon, 0, 0 ); - myComponentFrameLayout->addWidget( myComponentLab, 0, 1 ); - - // Info - QVBoxLayout* infoLayout = new QVBoxLayout(); - infoLayout->setMargin( 0 ); infoLayout->setSpacing( 6 ); - - // --> top line - QFrame* myLine1 = new QFrame( this, "myLine1" ); - myLine1->setFrameStyle( QFrame::HLine | QFrame::Plain ); - // --> info label - myInfoLabel = new QLabel( tr ("ActivateComponent_DESCRIPTION"), this, "myInfoLabel" ); - myInfoLabel->setAlignment( AlignCenter ); - // --> bottom line - QFrame* myLine2 = new QFrame( this, "myLine2" ); - myLine2->setFrameStyle( QFrame::HLine | QFrame::Plain ); - - infoLayout->addStretch(); - infoLayout->addWidget( myLine1 ); - infoLayout->addWidget( myInfoLabel ); - infoLayout->addWidget( myLine2 ); - infoLayout->addStretch(); - - // Buttons - QHBoxLayout* btnLayout = new QHBoxLayout(); - btnLayout->setMargin( 0 ); btnLayout->setSpacing( 6 ); - - // --> New - myNewBtn = new QPushButton( tr( "NEW" ), this, "myNewBtn" ); - myNewBtn->setDefault( true ); myNewBtn->setAutoDefault( true ); - // --> Open - myOpenBtn = new QPushButton( tr( "OPEN" ), this, "myOpenBtn" ); - myOpenBtn->setAutoDefault( true ); - // --> Load - myLoadBtn = new QPushButton( tr( "LOAD" ), this, "myLoadBtn" ); - myLoadBtn->setAutoDefault( true ); - // --> Cancel - myCancelBtn = new QPushButton( tr( "CANCEL" ), this, "myCancelBtn" ); - myCancelBtn->setAutoDefault( true ); - - btnLayout->addWidget( myNewBtn ); - btnLayout->addWidget( myOpenBtn ); - btnLayout->addWidget( myLoadBtn ); - btnLayout->addStretch(); - btnLayout->addSpacing( 70 ); - btnLayout->addStretch(); - btnLayout->addWidget( myCancelBtn ); - - ActivateModuleDlgLayout->addWidget( myComponentFrame, 0, 0 ); - ActivateModuleDlgLayout->addLayout( infoLayout, 0, 1 ); - ActivateModuleDlgLayout->addMultiCellLayout( btnLayout, 1, 1, 0, 1 ); - - // signals and slots connections - connect( myNewBtn, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) ); - connect( myOpenBtn, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) ); - connect( myLoadBtn, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) ); - connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) ); -} - -//============================================================================================================================== -/*! - * SalomeApp_ModuleDlg::onButtonClicked - * - * Buttons slot - */ -//============================================================================================================================== -void SalomeApp_ModuleDlg::onButtonClicked() -{ - QPushButton* btn = ( QPushButton* )sender(); - if ( btn == myNewBtn ) - done( 1 ); - if ( btn == myOpenBtn ) - done( 2 ); - if ( btn == myLoadBtn ) - done( 3 ); -} diff --git a/src/SalomeApp/SalomeApp_ModuleDlg.h b/src/SalomeApp/SalomeApp_ModuleDlg.h deleted file mode 100644 index fb465bc3a..000000000 --- a/src/SalomeApp/SalomeApp_ModuleDlg.h +++ /dev/null @@ -1,44 +0,0 @@ -// SALOME SALOMEGUI : implementation of desktop and GUI kernel -// -// Copyright (C) 2005 CEA/DEN, EDF R&D -// -// -// -// File : SalomeApp_ModuleDlg.h -// Author : Michael ZORIN (mzn) -// Module : SALOME - -#ifndef SALOMEAPP_MODULEDLG_H -#define SALOMEAPP_MODULEDLG_H - -#include -#include - -class QFrame; -class QLabel; -class QPushButton; - -class SalomeApp_ModuleDlg : public QDialog -{ - Q_OBJECT - -public: - SalomeApp_ModuleDlg ( QWidget* parent, const QString& component, const QPixmap icon = QPixmap() ) ; - ~SalomeApp_ModuleDlg ( ) { }; - -private slots: - void onButtonClicked(); - -private: - QFrame* myComponentFrame; - QLabel* myComponentLab; - QLabel* myComponentIcon; - QLabel* myInfoLabel; - QPushButton* myNewBtn; - QPushButton* myOpenBtn; - QPushButton* myLoadBtn; - QPushButton* myCancelBtn; -}; - -#endif - diff --git a/src/SalomeApp/SalomeApp_NameDlg.cxx b/src/SalomeApp/SalomeApp_NameDlg.cxx deleted file mode 100644 index 632404f52..000000000 --- a/src/SalomeApp/SalomeApp_NameDlg.cxx +++ /dev/null @@ -1,135 +0,0 @@ -// SALOME SalomeApp : implementation of desktop and GUI kernel -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// -// -// File : SalomeApp_NameDlg.cxx -// Author : Vadim SANDLER -// Module : SALOME -// $Header$ - -#include "SalomeApp_NameDlg.h" -#include "SUIT_Application.h" -#include "SUIT_Desktop.h" -#include "SUIT_Tools.h" - -#include -#include -#include -#include -#include - -#ifndef WNT -using namespace std; -#endif - -/*! - Constructor -*/ -SalomeApp_NameDlg::SalomeApp_NameDlg( QWidget* parent ) - : QDialog( parent ? parent : NULL,//application()->desktop(), - "SalomeApp_NameDlg", - true, - WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - setCaption( tr("TLT_RENAME") ); - setSizeGripEnabled( TRUE ); - - QVBoxLayout* topLayout = new QVBoxLayout( this ); - topLayout->setMargin( 11 ); topLayout->setSpacing( 6 ); - - /***************************************************************/ - QGroupBox* GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setColumnLayout(0, Qt::Vertical ); - GroupC1->layout()->setMargin( 0 ); GroupC1->layout()->setSpacing( 0 ); - QHBoxLayout* GroupC1Layout = new QHBoxLayout( GroupC1->layout() ); - GroupC1Layout->setAlignment( Qt::AlignTop ); - GroupC1Layout->setMargin( 11 ); GroupC1Layout->setSpacing( 6 ); - - QLabel* TextLabel = new QLabel( GroupC1, "TextLabel1" ); - TextLabel->setText( tr( "NAME_LBL" ) ); - GroupC1Layout->addWidget( TextLabel ); - - myLineEdit = new QLineEdit( GroupC1, "LineEdit1" ); - myLineEdit->setMinimumSize( 250, 0 ); - GroupC1Layout->addWidget( myLineEdit ); - - /***************************************************************/ - QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" ); - GroupButtons->setColumnLayout(0, Qt::Vertical ); - GroupButtons->layout()->setMargin( 0 ); GroupButtons->layout()->setSpacing( 0 ); - QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons->layout() ); - GroupButtonsLayout->setAlignment( Qt::AlignTop ); - GroupButtonsLayout->setMargin( 11 ); GroupButtonsLayout->setSpacing( 6 ); - - myButtonOk = new QPushButton( GroupButtons, "buttonOk" ); - myButtonOk->setText( tr( "BUT_OK" ) ); - myButtonOk->setAutoDefault( TRUE ); myButtonOk->setDefault( TRUE ); - GroupButtonsLayout->addWidget( myButtonOk ); - - GroupButtonsLayout->addStretch(); - - myButtonCancel = new QPushButton( GroupButtons, "buttonCancel" ); - myButtonCancel->setText( tr( "BUT_CANCEL" ) ); - myButtonCancel->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( myButtonCancel ); - /***************************************************************/ - - topLayout->addWidget( GroupC1 ); - topLayout->addWidget( GroupButtons ); - - // signals and slots connections - connect( myButtonOk, SIGNAL( clicked() ), this, SLOT( accept() ) ); - connect( myButtonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); - - /* Move widget on the botton right corner of main widget */ - SUIT_Tools::centerWidget( this, parent ); -} - -/*! - Destructor -*/ -SalomeApp_NameDlg::~SalomeApp_NameDlg() -{ -} - -/*! - Sets name -*/ -void SalomeApp_NameDlg::setName( const QString& name ) -{ - myLineEdit->setText( name ); - myLineEdit->end(false); - myLineEdit->home(true); -} - -/*! - Returns name entered by user -*/ -QString SalomeApp_NameDlg::name() -{ - return myLineEdit->text(); -} - -void SalomeApp_NameDlg::accept() -{ - if ( name().stripWhiteSpace().isEmpty() ) - return; - QDialog::accept(); -} - -/*! - Creates modal dialog and returns name entered [ static ] -*/ -QString SalomeApp_NameDlg::getName( QWidget* parent, const QString& oldName ) -{ - QString n; - SalomeApp_NameDlg* dlg = new SalomeApp_NameDlg( parent ); - if ( !oldName.isNull() ) - dlg->setName( oldName ); - if ( dlg->exec() == QDialog::Accepted ) - n = dlg->name(); - delete dlg; - return n; -} diff --git a/src/SalomeApp/SalomeApp_NameDlg.h b/src/SalomeApp/SalomeApp_NameDlg.h deleted file mode 100644 index cf0a5775c..000000000 --- a/src/SalomeApp/SalomeApp_NameDlg.h +++ /dev/null @@ -1,46 +0,0 @@ -// SALOME SalomeApp : implementation of desktop and GUI kernel -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// -// -// File : SalomeApp_NameDlg.h -// Author : Vadim SANDLER -// Module : SALOME -// $Header$ - -#ifndef SALOMEAPP_NAMEDLG_H -#define SALOMEAPP_NAMEDLG_H - -#include - -class QLineEdit; -class QPushButton; - -//================================================================================= -// class : SalomeApp_NameDlg -/*! purpose : Common dialog box class*/ -//================================================================================= -class SalomeApp_NameDlg : public QDialog -{ - Q_OBJECT - -public: - SalomeApp_NameDlg( QWidget* parent = 0 ); - ~SalomeApp_NameDlg(); - - void setName( const QString& name ); - QString name(); - - static QString getName( QWidget* parent = 0, const QString& oldName = QString::null ); - -protected slots: - void accept(); - -private: - QPushButton* myButtonOk; - QPushButton* myButtonCancel; - QLineEdit* myLineEdit; -}; - -#endif // SalomeApp_NAMEDLG_H diff --git a/src/SalomeApp/SalomeApp_OBFilter.cxx b/src/SalomeApp/SalomeApp_OBFilter.cxx deleted file mode 100644 index 738793466..000000000 --- a/src/SalomeApp/SalomeApp_OBFilter.cxx +++ /dev/null @@ -1,29 +0,0 @@ -#include "SalomeApp_OBFilter.h" - -#include "SalomeApp_SelectionMgr.h" -#include "SalomeApp_DataObject.h" -#include "SalomeApp_DataOwner.h" - -/*! - Constructor. -*/ -SalomeApp_OBFilter::SalomeApp_OBFilter( SalomeApp_SelectionMgr* theSelMgr ) -{ - mySelMgr = theSelMgr; -} - -/*!Destructor.*/ -SalomeApp_OBFilter::~SalomeApp_OBFilter() -{ -} - -/*!Checks: data object is ok?*/ -bool SalomeApp_OBFilter::isOk( const SUIT_DataObject* theDataObj ) const -{ - const SalomeApp_DataObject* obj = dynamic_cast( theDataObj ); - if ( obj ) - return mySelMgr->isOk( new SalomeApp_DataOwner( obj->entry() ) ); - - return true; -} - diff --git a/src/SalomeApp/SalomeApp_OBFilter.h b/src/SalomeApp/SalomeApp_OBFilter.h deleted file mode 100644 index 15f3ebeb3..000000000 --- a/src/SalomeApp/SalomeApp_OBFilter.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef SALOMEAPP_OBFILTER_H -#define SALOMEAPP_OBFILTER_H - -#include "SalomeApp.h" -#include "OB_Filter.h" - -class SalomeApp_SelectionMgr; - -class SALOMEAPP_EXPORT SalomeApp_OBFilter: public OB_Filter -{ -public: - SalomeApp_OBFilter( SalomeApp_SelectionMgr* theSelMgr ); - ~SalomeApp_OBFilter(); - - virtual bool isOk( const SUIT_DataObject* ) const; - -private: - SalomeApp_SelectionMgr* mySelMgr; - -}; - -#endif diff --git a/src/SalomeApp/SalomeApp_OCCSelector.cxx b/src/SalomeApp/SalomeApp_OCCSelector.cxx deleted file mode 100644 index 56ceb353d..000000000 --- a/src/SalomeApp/SalomeApp_OCCSelector.cxx +++ /dev/null @@ -1,103 +0,0 @@ - -#include "SalomeApp_DataOwner.h" -#include "SalomeApp_OCCSelector.h" - -#include - -#include -#include - -/*! - Constructor -*/ -SalomeApp_OCCSelector::SalomeApp_OCCSelector( OCCViewer_Viewer* viewer, SUIT_SelectionMgr* mgr ) -: SUIT_Selector( mgr, viewer ), - myViewer( viewer ) -{ - if ( myViewer ) - connect( myViewer, SIGNAL( selectionChanged() ), this, SLOT( onSelectionChanged() ) ); -} - -/*! - Destructor. -*/ -SalomeApp_OCCSelector::~SalomeApp_OCCSelector() -{ -} - -/*! - Gets viewer. -*/ -OCCViewer_Viewer* SalomeApp_OCCSelector::viewer() const -{ - return myViewer; -} - -/*!On selection changed.*/ -void SalomeApp_OCCSelector::onSelectionChanged() -{ - selectionChanged(); -} - -/*!Gets selection list.*/ -void SalomeApp_OCCSelector::getSelection( SUIT_DataOwnerPtrList& aList ) const -{ - if ( !myViewer ) - return; - - AIS_ListOfInteractive aSelList; - myViewer->getSelectedObjects( aSelList ); - for ( AIS_ListIteratorOfListOfInteractive anIt( aSelList ); anIt.More(); anIt.Next() ) - if ( !anIt.Value().IsNull() ) - { - Handle(SALOME_InteractiveObject) anObj = Handle(SALOME_InteractiveObject)::DownCast(anIt.Value()->GetOwner()); - if( !anObj.IsNull() ) - aList.append( SUIT_DataOwnerPtr( new SalomeApp_DataOwner( anObj ) ) ); - } -} - -/*!Sets selection list.*/ -void SalomeApp_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& aList ) -{ - if ( !myViewer ) - return; - - QMap aDisplayed; - Handle(AIS_InteractiveContext) aContext = myViewer->getAISContext(); - if ( aContext.IsNull() ) - return; - - AIS_ListOfInteractive aDispList, aSelList; - aContext->DisplayedObjects( aDispList ); - - for ( AIS_ListIteratorOfListOfInteractive it( aDispList ); it.More(); it.Next() ) - { - QString entryStr = entry( it.Value() ); - if ( !entryStr.isEmpty() ) - aDisplayed.insert( entryStr, it.Value() ); - } - - for ( SUIT_DataOwnerPtrList::const_iterator itr = aList.begin(); itr != aList.end(); ++itr ) - { - const SalomeApp_DataOwner* owner = dynamic_cast( (*itr).operator->() ); - if ( owner && aDisplayed.contains( owner->entry() ) ) - aSelList.Append( aDisplayed[owner->entry()] ); - } - - myViewer->unHighlightAll( false ); - myViewer->setObjectsSelected( aSelList ); -} - -/*!Gets entry ob object.*/ -QString SalomeApp_OCCSelector::entry( const Handle(AIS_InteractiveObject)& anAIS ) const -{ - if ( anAIS.IsNull() || !anAIS->HasOwner() ) - return QString::null; - - Handle(SALOME_InteractiveObject) anObj = Handle(SALOME_InteractiveObject)::DownCast(anAIS->GetOwner()); - - QString res; - if ( !anObj.IsNull() ) - res = QString( anObj->getEntry() ); - return res; -} diff --git a/src/SalomeApp/SalomeApp_OCCSelector.h b/src/SalomeApp/SalomeApp_OCCSelector.h deleted file mode 100644 index 05ace6387..000000000 --- a/src/SalomeApp/SalomeApp_OCCSelector.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef SALOMEAPP_OCCSELECTOR_H -#define SALOMEAPP_OCCSELECTOR_H - -#include "SalomeApp.h" - -#include - -#include - -class Handle_AIS_InteractiveObject; - -class SALOMEAPP_EXPORT SalomeApp_OCCSelector : public SUIT_Selector -{ - Q_OBJECT - -public: - SalomeApp_OCCSelector( OCCViewer_Viewer*, SUIT_SelectionMgr* ); - virtual ~SalomeApp_OCCSelector(); - - OCCViewer_Viewer* viewer() const; - - virtual QString type() const { return OCCViewer_Viewer::Type(); } - -private slots: - virtual void onSelectionChanged(); - -protected: - virtual void getSelection( SUIT_DataOwnerPtrList& ) const; - virtual void setSelection( const SUIT_DataOwnerPtrList& ); - - QString entry( const Handle_AIS_InteractiveObject& ) const; - -private: - OCCViewer_Viewer* myViewer; -}; - -#endif diff --git a/src/SalomeApp/SalomeApp_Preferences.cxx b/src/SalomeApp/SalomeApp_Preferences.cxx deleted file mode 100755 index d48cf410b..000000000 --- a/src/SalomeApp/SalomeApp_Preferences.cxx +++ /dev/null @@ -1,87 +0,0 @@ -// File: SalomeApp_Preferences.cxx -// Author: Sergey TELKOV - -#include "SalomeApp_Preferences.h" - -#include - -#include - -/*! - Constructor.Initialize by resource manager and parent QWidget. -*/ -SalomeApp_Preferences::SalomeApp_Preferences( QtxResourceMgr* resMgr, QWidget* parent ) -: QtxListResourceEdit( resMgr, parent ) -{ -} - -/*! - Destructor. -*/ -SalomeApp_Preferences::~SalomeApp_Preferences() -{ -} - -/*! - Adds preference. -*/ -int SalomeApp_Preferences::addPreference( const QString& label, const int pId, const int type, - const QString& section, const QString& param ) -{ - return addItem( label, pId, type, section, param ); -} - -/*! - Adds preference. -*/ -int SalomeApp_Preferences::addPreference( const QString& mod, const QString& label, const int pId, - const int type, const QString& section, const QString& param ) -{ - int id = addItem( label, pId, type, section, param ); - if ( id != -1 && !mod.isEmpty() ) - myPrefMod.insert( id, mod ); - return id; -} - -/*! - Checks: is preferences has module with name \a mod. -*/ -bool SalomeApp_Preferences::hasModule( const QString& mod ) const -{ - bool res = false; - for ( PrefModuleMap::ConstIterator it = myPrefMod.begin(); it != myPrefMod.end() && !res; ++it ) - res = it.data() == mod; - return res; -} - -/*!Do nothing.*/ -void SalomeApp_Preferences::onHelp() -{ -} - -/*!Store preferences on apply.*/ -void SalomeApp_Preferences::onApply() -{ - store(); -} - -/*!Emit preference changed.*/ -void SalomeApp_Preferences::changedResources( const QMap& map ) -{ - for ( QMap::ConstIterator it = map.begin(); it != map.end(); ++it ) - { - QString sec, param; - it.key()->resource( sec, param ); - QString mod = module( it.key()->id() ); - emit preferenceChanged( mod, sec, param ); - } -} - -/*!Gets module name by \a id, if exist.*/ -QString SalomeApp_Preferences::module( const int id ) const -{ - QString mod; - if ( myPrefMod.contains( id ) ) - mod = myPrefMod[id]; - return mod; -} diff --git a/src/SalomeApp/SalomeApp_Preferences.h b/src/SalomeApp/SalomeApp_Preferences.h deleted file mode 100755 index 2319772c8..000000000 --- a/src/SalomeApp/SalomeApp_Preferences.h +++ /dev/null @@ -1,49 +0,0 @@ -// File: SalomeApp_Preferences.h -// Author: Sergey TELKOV - -#ifndef SALOMEAPP_PREFERENCES_H -#define SALOMEAPP_PREFERENCES_H - -#include - -#include -#include - -#include - -class QtxResourceMgr; - -class SALOMEAPP_EXPORT SalomeApp_Preferences : public QtxListResourceEdit -{ - Q_OBJECT - -public: - SalomeApp_Preferences( QtxResourceMgr*, QWidget* = 0 ); - virtual ~SalomeApp_Preferences(); - - int addPreference( const QString& label, const int pId = -1, const int = -1, - const QString& section = QString::null, const QString& param = QString::null ); - int addPreference( const QString& modName, const QString& label, const int pId = -1, const int = -1, - const QString& section = QString::null, const QString& param = QString::null ); - - bool hasModule( const QString& ) const; - -signals: - void preferenceChanged( QString&, QString&, QString& ); - -private slots: - void onHelp(); - void onApply(); - virtual void changedResources( const QMap& ); - -private: - QString module( const int ) const; - -private: - typedef QMap PrefModuleMap; - -private: - PrefModuleMap myPrefMod; -}; - -#endif diff --git a/src/SalomeApp/SalomeApp_RootObject.h b/src/SalomeApp/SalomeApp_RootObject.h deleted file mode 100644 index 5ad6c925c..000000000 --- a/src/SalomeApp/SalomeApp_RootObject.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef SALOMEAPP_ROOTOBJECT_H -#define SALOMEAPP_ROOTOBJECT_H - -#include "SalomeApp.h" -#include "SUIT_DataObject.h" - -class SalomeApp_Study; - -/*! - SalomeApp_RootObject - class to be instanciated by only one object - - root object of SalomeApp data object tree. This object is not shown - in object browser (invisible), so it has no re-definition of name(), icon(), - etc. methods. The goal of this class is to provide a unified access - to SalomeApp_Study object from SalomeApp_DataObject instances. -*/ -class SALOMEAPP_EXPORT SalomeApp_RootObject : public SUIT_DataObject -{ -public: - SalomeApp_RootObject( SalomeApp_Study* study ) - : myStudy( study ) {} - - virtual ~SalomeApp_RootObject() {} - - void setStudy( SalomeApp_Study* study ) { myStudy = study; } - SalomeApp_Study* study() const { return myStudy; } - -private: - SalomeApp_Study* myStudy; - -}; - -#endif diff --git a/src/SalomeApp/SalomeApp_SwitchOp.cxx b/src/SalomeApp/SalomeApp_SwitchOp.cxx deleted file mode 100755 index cb0d33397..000000000 --- a/src/SalomeApp/SalomeApp_SwitchOp.cxx +++ /dev/null @@ -1,164 +0,0 @@ -/** -* SALOME SalomeApp -* -* Copyright (C) 2005 CEA/DEN, EDF R&D -* -* -* -* File : SalomeApp_SwitchOp.h -* Author : Sergey LITONIN -* Module : SALOME -*/ - -#include "SalomeApp_SwitchOp.h" -#include "SalomeApp_Module.h" -#include "SalomeApp_Operation.h" -#include "SalomeApp_Dialog.h" -#include -#include -#include -#include -#include -#include -#include - -/*! - * \brief Constructor - * \param theParent - parent of object -* -* Creates instance of the object. Connects signals and slots. Install eveny filter -* on application -*/ -SalomeApp_SwitchOp::SalomeApp_SwitchOp( SalomeApp_Module* theModule ) -: QObject( 0 ), - myModule( theModule ) -{ - qApp->installEventFilter( this ); -} - -/*! - * \brief Destructor -*/ -SalomeApp_SwitchOp::~SalomeApp_SwitchOp() -{ - -} - -/*! - * \brief Get module -* -* Get module. Module is a parent of this class -*/ -SalomeApp_Module* SalomeApp_SwitchOp::module() const -{ - return myModule; -} - -/*! - * \brief Get study - * \return Active study of application (in current realisation) -* -* Get study -*/ -SUIT_Study* SalomeApp_SwitchOp::study() const -{ - return module()->application()->activeStudy(); -} - -/*! - * \brief Get operation by widget - * \param theWg - key widget to find operation - * \return Pointer to the operations if it is found or zero -* -* Find operation containing dialog with given widget -*/ -SalomeApp_Operation* SalomeApp_SwitchOp::operation( QWidget* theWg ) const -{ - // get dialog from widget - SalomeApp_Dialog* aDlg = 0; - QWidget* aParent = theWg; - while( aParent && !aParent->inherits( "SalomeApp_Dialog" ) ) - aParent = aParent->parentWidget(); - - if ( aParent && aParent->inherits( "SalomeApp_Dialog" ) ) - aDlg = (SalomeApp_Dialog*)aParent; - - // try to find operation corresponding to the dialog - if ( aDlg != 0 && study() != 0 ) - { - QPtrListIterator anIter( study()->operations() ); - while( SUIT_Operation* anOp = anIter.current() ) - { - if ( anOp->inherits( "SalomeApp_Operation" ) && - ((SalomeApp_Operation*)anOp)->dlg() == aDlg ) - return ((SalomeApp_Operation*)anOp); - ++anIter; - } - } - - return 0; -} - -/*! - * \brief Event filter - * \param theObj - object - * \param theEv - event -* -* Event filter. Catched signals off application. If event concerns to dialog then -* corresponding operation is found and activated. -*/ -bool SalomeApp_SwitchOp::eventFilter( QObject* theObj, QEvent* theEv ) -{ - if ( theObj->inherits( "QWidget" ) && ( theEv->type() == QEvent::Enter ) ) - { - QEvent::Type aType = theEv->type(); - SalomeApp_Operation* anOp = operation( (QWidget*)theObj ); - if ( anOp ) - { - switch ( aType ) - { - case QEvent::Enter: - { - if ( !anOp->isActive() && anOp->isAutoResumed() && - study() && !study()->blockingOperation( anOp ) ) - study()->resume( anOp ); - } - break; - - case QEvent::MouseButtonRelease: - case QEvent::MouseButtonPress: - case QEvent::MouseButtonDblClick: - case QEvent::MouseMove: - case QEvent::KeyPress: - case QEvent::KeyRelease: - { - if ( !anOp->isActive() ) - return true; - } - break; - - } - } - } - - return QObject::eventFilter( theObj, theEv ); -} - - - - - - - - - - - - - - - - - - - diff --git a/src/SalomeApp/SalomeApp_SwitchOp.h b/src/SalomeApp/SalomeApp_SwitchOp.h deleted file mode 100755 index 9b69905fe..000000000 --- a/src/SalomeApp/SalomeApp_SwitchOp.h +++ /dev/null @@ -1,71 +0,0 @@ -/** -* SALOME SalomeApp -* -* Copyright (C) 2005 CEA/DEN, EDF R&D -* -* -* -* File : SalomeApp_SwitchOp.h -* Author : Sergey LITONIN -* Module : SALOME -*/ - - - -#ifndef SalomeApp_SwitchOp_H -#define SalomeApp_SwitchOp_H - -#include - -class SalomeApp_Module; -class SalomeApp_Operation; -class QEvent; -class SUIT_Study; - -/*! - * \brief This class is intended for controling switching between operation - * - * Several operation may be launched simultaneously. This class is intended for - * controlling switching between such operations. This class works with operations having - * dialogs (activation of other operations is performed by SUIT_Study). When several - * operations is launched simultaneously corresponding dialogs are shown on the screen. - * Only one operation from the launched ones can be active (active operation). Other - * operations are suspended. As result only one dialog from shown ones can be active too. - * Other dialogs are disabled. This class installs event filter on application. When mouse - * cursor is moved above disabled dialog corresponding event is catched by this class. - * It finds corresponding operation and verify whether operation can be resumed (see - * SUIT_Study::isDenied( SUIT_Operation* ) method). If yes then current active - * operation is suspended and new operation activated. Module contains this class as a - * field. Then module is created instance of this class created too. - */ -class SalomeApp_SwitchOp : public QObject -{ - Q_OBJECT - -public: - - SalomeApp_SwitchOp( SalomeApp_Module* ); - virtual ~SalomeApp_SwitchOp(); - - // Redefined from base class - bool eventFilter( QObject*, QEvent* ); - -private: - - SalomeApp_Module* module() const; - SalomeApp_Operation* operation( QWidget* ) const; - SUIT_Study* study() const; - -private: - - SalomeApp_Module* myModule; - -}; - -#endif - - - - - - diff --git a/src/SalomeApp/SalomeApp_UpdateFlags.h b/src/SalomeApp/SalomeApp_UpdateFlags.h deleted file mode 100755 index 7943ac23e..000000000 --- a/src/SalomeApp/SalomeApp_UpdateFlags.h +++ /dev/null @@ -1,37 +0,0 @@ -// SALOME SalomeApp -// -// Copyright (C) 2005 CEA/DEN, EDF R&D -// -// -// -// File : SalomeApp_UpdateFlags.h -// Author : Sergey LITONIN -// Module : SALOME - - -#ifndef SalomeApp_UpdateFlags_H -#define SalomeApp_UpdateFlags_H - -/* - Enum : UpdateFlags - Description : Enumeration for update flags. First byte is reserved for SalomeApp_Module. - Modules derived from this model must use other 3 bytes to define their - own update flags -*/ - -typedef enum -{ - UF_Forced = 0x00000001, - UF_Model = 0x00000002, - UF_Viewer = 0x00000004, - UF_ObjBrowser = 0x00000008, - UF_Controls = 0x00000010, -} UpdateFlags; - -#endif - - - - - - diff --git a/src/SalomeApp/SalomeApp_VTKSelector.cxx b/src/SalomeApp/SalomeApp_VTKSelector.cxx deleted file mode 100644 index c3d53c11d..000000000 --- a/src/SalomeApp/SalomeApp_VTKSelector.cxx +++ /dev/null @@ -1,198 +0,0 @@ -#include "SalomeApp_VTKSelector.h" -#include "SalomeApp_DataOwner.h" - -#include "SVTK_ViewModel.h" -#include "SVTK_Selector.h" -#include "SVTK_ViewWindow.h" -#include "SVTK_Functor.h" - -#include "SALOME_Actor.h" -#include "SALOME_ListIteratorOfListIO.hxx" - -#include "VTKViewer_Algorithm.h" - -#include - -#include "utilities.h" - -#ifdef _DEBUG_ -static int MYDEBUG = 1; -#else -static int MYDEBUG = 0; -#endif - -/*! - Constructor. -*/ -SalomeApp_SVTKDataOwner -::SalomeApp_SVTKDataOwner( const Handle(SALOME_InteractiveObject)& theIO, - const TColStd_IndexedMapOfInteger& theIds, - Selection_Mode theMode, - SALOME_Actor* theActor): - SalomeApp_DataOwner( theIO ), - mySelectionMode(theMode), - myActor(theActor) -{ - myIds = theIds; // workaround - there is no constructor copy for the container -} - -/*! - Destuctor. -*/ -SalomeApp_SVTKDataOwner -::~SalomeApp_SVTKDataOwner() -{ -} - -/*! - Gets actor pointer. -*/ -SALOME_Actor* -SalomeApp_SVTKDataOwner -::GetActor() const -{ - return myActor.GetPointer(); -} - -/*! - Constructor. -*/ -SalomeApp_VTKSelector -::SalomeApp_VTKSelector( SVTK_Viewer* viewer, - SUIT_SelectionMgr* mgr ): - SUIT_Selector( mgr, viewer ), - myViewer( viewer ) -{ - if ( myViewer ) - connect( myViewer, SIGNAL( selectionChanged() ), this, SLOT( onSelectionChanged() ) ); -} - -/*! - Destructor. -*/ -SalomeApp_VTKSelector -::~SalomeApp_VTKSelector() -{ -} - -/*! - Gets viewer. -*/ -SVTK_Viewer* -SalomeApp_VTKSelector -::viewer() const -{ - return myViewer; -} - -/*! - Gets type of salome vtk viewer. -*/ -QString -SalomeApp_VTKSelector -::type() const -{ - return SVTK_Viewer::Type(); -} - -/*! - On selection changed. -*/ -void -SalomeApp_VTKSelector -::onSelectionChanged() -{ - selectionChanged(); -} - -/*! - Gets list of selected data owners.(output \a aList). -*/ -void -SalomeApp_VTKSelector -::getSelection( SUIT_DataOwnerPtrList& aList ) const -{ - if(myViewer){ - if(SUIT_ViewManager* aViewMgr = myViewer->getViewManager()){ - if(SVTK_ViewWindow* aView = dynamic_cast(aViewMgr->getActiveView())){ - if(SVTK_Selector* aSelector = aView->GetSelector()){ - Selection_Mode aMode = aSelector->SelectionMode(); - const SALOME_ListIO& aListIO = aSelector->StoredIObjects(); - SALOME_ListIteratorOfListIO anIter(aListIO); - for(; anIter.More(); anIter.Next()){ - Handle(SALOME_InteractiveObject) anIO = anIter.Value(); - if(anIO->hasEntry()){ - TColStd_IndexedMapOfInteger anIds; - aSelector->GetIndex(anIO,anIds); - SALOME_Actor* anActor = aSelector->GetActor(anIO); - if( !anActor ) - anActor = VTK::Find(aView->getRenderer()->GetActors(),VTK::TIsSameIObject(anIO)); - - aList.append(new SalomeApp_SVTKDataOwner(anIO,anIds,aMode,anActor)); - if(MYDEBUG) MESSAGE("VTKSelector::getSelection - "<getEntry()); - } - } - } - } - } - } -} - -/*! - Sets selection to selector from data owner list \a theList. -*/ -void -SalomeApp_VTKSelector -::setSelection( const SUIT_DataOwnerPtrList& theList ) -{ - if(myViewer){ - if(SUIT_ViewManager* aViewMgr = myViewer->getViewManager()){ - if(SVTK_ViewWindow* aView = dynamic_cast(aViewMgr->getActiveView())){ - if(SVTK_Selector* aSelector = aView->GetSelector()){ - SALOME_ListIO anAppendList; - const SALOME_ListIO& aStoredList = aSelector->StoredIObjects(); - SUIT_DataOwnerPtrList::const_iterator anIter = theList.begin(); - for(; anIter != theList.end(); ++anIter){ - const SUIT_DataOwner* aDataOwner = (*anIter).get(); - if(const SalomeApp_SVTKDataOwner* anOwner = dynamic_cast(aDataOwner)){ - aSelector->SetSelectionMode(anOwner->GetMode()); - Handle(SALOME_InteractiveObject) anIO = anOwner->IO(); - - if( anOwner->GetActor() ) - aSelector->AddIObject( anOwner->GetActor() ); - else - aSelector->AddIObject(anIO); - - anAppendList.Append(anIO); - aSelector->AddOrRemoveIndex(anIO,anOwner->GetIds(),false); - if(MYDEBUG) MESSAGE("VTKSelector::setSelection - SVTKDataOwner - "<getEntry()); - }else if(const SalomeApp_DataOwner* anOwner = dynamic_cast(aDataOwner)){ - Handle(SALOME_InteractiveObject) anIO = - new SALOME_InteractiveObject(anOwner->entry().latin1(),""); - aSelector->AddIObject(anIO); - anAppendList.Append(anIO); - if(MYDEBUG) MESSAGE("VTKSelector::setSelection - DataOwner - "<getEntry()); - } - } - // To remove IOs, which is not selected. - QMap< QString, Handle( SALOME_InteractiveObject )> toRemove; - SALOME_ListIteratorOfListIO anIt( aStoredList ); - for( ; anIt.More(); anIt.Next() ) - if( !anIt.Value().IsNull() ) - toRemove[ anIt.Value()->getEntry() ] = anIt.Value(); - - anIt = SALOME_ListIteratorOfListIO(anAppendList); - for( ; anIt.More(); anIt.Next() ) - toRemove.remove( anIt.Value()->getEntry() ); - - QMap< QString, Handle( SALOME_InteractiveObject )>::const_iterator RIt = toRemove.begin(), - REnd = toRemove.end(); - for( ; RIt!=REnd; RIt++ ) - aSelector->RemoveIObject( RIt.data() ); - - aView->onSelectionChanged(); - } - } - } - } -} diff --git a/src/SalomeApp/SalomeApp_VTKSelector.h b/src/SalomeApp/SalomeApp_VTKSelector.h deleted file mode 100644 index 1834c979f..000000000 --- a/src/SalomeApp/SalomeApp_VTKSelector.h +++ /dev/null @@ -1,78 +0,0 @@ -#ifndef SALOMEAPP_VTKSELECTOR_H -#define SALOMEAPP_VTKSELECTOR_H - -#include - -#include - -#include "SUIT_Selector.h" - -#include "SalomeApp.h" -#include "SalomeApp_DataOwner.h" - -#include "SVTK_Selection.h" -#include "SALOME_InteractiveObject.hxx" - -class SALOME_Actor; -class SVTK_Viewer; - -/*! - Provide salome vtk data owner list. -*/ -class SalomeApp_SVTKDataOwner : public SalomeApp_DataOwner -{ - public: - SalomeApp_SVTKDataOwner( const Handle(SALOME_InteractiveObject)& theIO, - const TColStd_IndexedMapOfInteger& theIds, - Selection_Mode theMode = ActorSelection, - SALOME_Actor* theActor = NULL); - virtual ~SalomeApp_SVTKDataOwner(); - - /*!Gets dataowners ids list.*/ - const TColStd_IndexedMapOfInteger& GetIds() const - { - return myIds; - } - - /*!Gets selection mode.*/ - Selection_Mode GetMode() const - { - return mySelectionMode; - } - - SALOME_Actor* GetActor() const; - - protected: - TColStd_IndexedMapOfInteger myIds; - Selection_Mode mySelectionMode; - vtkSmartPointer myActor; -}; - - -/*! - Provide salome vtk selection of data owners. -*/ -class SALOMEAPP_EXPORT SalomeApp_VTKSelector : public SUIT_Selector -{ - Q_OBJECT; - -public: - SalomeApp_VTKSelector( SVTK_Viewer*, SUIT_SelectionMgr* ); - virtual ~SalomeApp_VTKSelector(); - - SVTK_Viewer* viewer() const; - - virtual QString type() const; - -private slots: - void onSelectionChanged(); - -protected: - virtual void getSelection( SUIT_DataOwnerPtrList& ) const; - virtual void setSelection( const SUIT_DataOwnerPtrList& ); - -private: - SVTK_Viewer* myViewer; -}; - -#endif diff --git a/src/SalomeApp/SalomeApp_WidgetContainer.cxx b/src/SalomeApp/SalomeApp_WidgetContainer.cxx deleted file mode 100644 index 79b786867..000000000 --- a/src/SalomeApp/SalomeApp_WidgetContainer.cxx +++ /dev/null @@ -1,133 +0,0 @@ -#include "SalomeApp_WidgetContainer.h" - -#include -#include - -/*! - Constructor. -*/ -SalomeApp_WidgetContainer::SalomeApp_WidgetContainer( const int type, QWidget* parent ) -: QDockWindow( QDockWindow::InDock, parent ), -myType( type ) -{ - setWidget( myStack = new QWidgetStack( this ) ); - myStack->show(); -} - -/*! - Destructor. -*/ -SalomeApp_WidgetContainer::~SalomeApp_WidgetContainer() -{ -} - -/*! - Checks: is widget container is empty? -*/ -bool SalomeApp_WidgetContainer::isEmpty() const -{ - const QObjectList* lst = myStack->children(); - if ( !lst ) - return true; - - bool res = true; - for ( QObjectListIt it( *lst ); it.current() && res; ++it ) - { - if ( it.current()->isWidgetType() && myStack->id( (QWidget*)it.current() ) != -1 ) - res = false; - } - return res; -} - -/*! - Gets type of widget container. -*/ -int SalomeApp_WidgetContainer::type() const -{ - return myType; -} - -/*! - Checks: is container contains widget with id \a id. -*/ -bool SalomeApp_WidgetContainer::contains( const int id ) const -{ - return myStack->widget( id ) != 0; -} - -/*! - * Insert widget(\a wid with id \a id) to container.And return id of widget in stack. - *\warning remove widget with id = \a id , if it was in container. - */ -int SalomeApp_WidgetContainer::insert( const int id, QWidget* wid ) -{ - if ( id == -1 || !wid ) - return -1; - - if ( contains( id ) ) - remove( id ); - - int stackId = myStack->addWidget( wid, id ); - if ( !myStack->visibleWidget() ) - myStack->raiseWidget( wid ); - - setCaption( myStack->visibleWidget() ? myStack->visibleWidget()->caption() : QString::null ); - - return stackId; -} - -/*! - Remove widget from stack by widget \a id. -*/ -void SalomeApp_WidgetContainer::remove( const int id ) -{ - remove( myStack->widget( id ) ); - - setCaption( myStack->visibleWidget() ? myStack->visibleWidget()->caption() : QString::null ); -} - -/*! - Remove widget(\a wid) from stack. -*/ -void SalomeApp_WidgetContainer::remove( QWidget* wid ) -{ - myStack->removeWidget( wid ); - - setCaption( myStack->visibleWidget() ? myStack->visibleWidget()->caption() : QString::null ); -} - -/*! - Raise widget with id = \a id. -*/ -void SalomeApp_WidgetContainer::activate( const int id ) -{ - myStack->raiseWidget( id ); - - setCaption( myStack->visibleWidget() ? myStack->visibleWidget()->caption() : QString::null ); -} - -/*! - Raise widget (\a wid). -*/ -void SalomeApp_WidgetContainer::activate( QWidget* wid ) -{ - myStack->raiseWidget( wid ); - - setCaption( myStack->visibleWidget() ? myStack->visibleWidget()->caption() : QString::null ); -} - -/*! - Gets widget from container list(stack) by id = \a id. -*/ -QWidget* SalomeApp_WidgetContainer::widget( const int id ) const -{ - return myStack->widget( id ); -} - -/*! - Gets visible widget. -*/ -QWidget* SalomeApp_WidgetContainer::active() const -{ - return myStack->visibleWidget(); -} diff --git a/src/SalomeApp/SalomeApp_WidgetContainer.h b/src/SalomeApp/SalomeApp_WidgetContainer.h deleted file mode 100644 index 67e15f4bc..000000000 --- a/src/SalomeApp/SalomeApp_WidgetContainer.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef SALOMEAPP_WIDGETCONTAINER_H -#define SALOMEAPP_WIDGETCONTAINER_H - -#include "SalomeApp.h" - -#include - -class QWidget; -class QWidgetStack; - -/*! - Class which privade widget container. -*/ -class SALOMEAPP_EXPORT SalomeApp_WidgetContainer : public QDockWindow -{ - Q_OBJECT - -public: - SalomeApp_WidgetContainer( const int, QWidget* = 0 ); - virtual ~SalomeApp_WidgetContainer(); - - bool isEmpty() const; - - int type() const; - - int insert( const int, QWidget* ); - void remove( QWidget* ); - void remove( const int ); - bool contains( const int ) const; - - void activate( QWidget* ); - void activate( const int ); - - QWidget* active() const; - QWidget* widget( const int ) const; - -private: - int myType; - QWidgetStack* myStack; -}; - -#endif