From b848f250470b1bd7d9549c7a14fe9713775c65a9 Mon Sep 17 00:00:00 2001 From: sln Date: Tue, 16 Jan 2007 10:50:13 +0000 Subject: [PATCH] Methods are added: // Gets type of last selector where selection has been changed QString lastSelectionSource() const; // Verifies whether synchronization between selectors is enabled bool isSynchronizationEnabled() const; // Enable or disable synchronization between selectors void setSynchronizationEnabled( const bool ); --- src/SUIT/SUIT_SelectionMgr.cxx | 48 +++++++++++++++++++++++++++------- src/SUIT/SUIT_SelectionMgr.h | 6 +++++ 2 files changed, 45 insertions(+), 9 deletions(-) diff --git a/src/SUIT/SUIT_SelectionMgr.cxx b/src/SUIT/SUIT_SelectionMgr.cxx index 895486f21..e84195622 100755 --- a/src/SUIT/SUIT_SelectionMgr.cxx +++ b/src/SUIT/SUIT_SelectionMgr.cxx @@ -22,11 +22,12 @@ * Provide selection manager. Manipulate by selection filters, modes, data owners. */ -/*!constructor. initialize myIterations and myIsSelChangeEnabled.*/ +/*!constructor. initialize myIterations, myIsSelChangeEnabled and myIsSynchronizationEnabled.*/ SUIT_SelectionMgr::SUIT_SelectionMgr( const bool Feedback, QObject* p ) : QObject( p ), myIterations( Feedback ? 1 : 0 ), -myIsSelChangeEnabled( true ) +myIsSelChangeEnabled( true ), +myIsSynchronizationEnabled( true ) { } @@ -138,23 +139,31 @@ void SUIT_SelectionMgr::selectionChanged( SUIT_Selector* sel ) SUIT_DataOwnerPtrList newOwners; filterOwners( owners, newOwners ); - for ( int i = 0; i < myIterations; i++ ) + if ( myIsSynchronizationEnabled ) { - for ( SUIT_Selector* aSel = mySelectors.first(); aSel; aSel = mySelectors.next() ) + for ( int i = 0; i < myIterations; i++ ) { - // Temporary action(to avoid selection of the objects which don't pass the filters): - //if ( aSel != sel ) - aSel->setSelected( newOwners ); + for ( SUIT_Selector* aSel = mySelectors.first(); aSel; aSel = mySelectors.next() ) + { + // Temporary action(to avoid selection of the objects which don't pass the filters): + //if ( aSel != sel ) + aSel->setSelected( newOwners ); + } } } + else + sel->setSelected( newOwners ); + myIsSelChangeEnabled = true; + myLastSelectionSource = sel->type(); + emit selectionChanged(); } /*! - Returns true if selection manger is in synchronising mode - (during synchonisation of the selectors selection). +Returns true if selection manger is in synchronising mode +(during synchonisation of the selectors selection). */ bool SUIT_SelectionMgr::isSynchronizing() const { @@ -327,3 +336,24 @@ void SUIT_SelectionMgr::filterOwners( const SUIT_DataOwnerPtrList& in, SUIT_Data out.append( *it ); } } + +/*! Gets type of last selector where selection has been changed. +*/ +QString SUIT_SelectionMgr::lastSelectionSource() const +{ + return myLastSelectionSource; +} + +/*! Verifies whether synchronization between selectors is enabled. +*/ +bool SUIT_SelectionMgr::isSynchronizationEnabled() const +{ + return myIsSynchronizationEnabled; +} + +/*! Enable or disable synchronization between selectors. +*/ +void SUIT_SelectionMgr::setSynchronizationEnabled( const bool on ) +{ + myIsSynchronizationEnabled = on; +} diff --git a/src/SUIT/SUIT_SelectionMgr.h b/src/SUIT/SUIT_SelectionMgr.h index 79576568f..897683ca9 100755 --- a/src/SUIT/SUIT_SelectionMgr.h +++ b/src/SUIT/SUIT_SelectionMgr.h @@ -77,6 +77,10 @@ public: bool isSynchronizing() const; + QString lastSelectionSource() const; + bool isSynchronizationEnabled() const; + void setSynchronizationEnabled( const bool ); + signals: void selectionChanged(); @@ -103,6 +107,8 @@ private: QValueList mySelModes; int myIterations; bool myIsSelChangeEnabled; + bool myIsSynchronizationEnabled; + QString myLastSelectionSource; friend class SUIT_Selector; }; -- 2.39.2