From 0ca7e1648d54237e42da4eb61737a5f31ad913cc Mon Sep 17 00:00:00 2001 From: apo Date: Thu, 30 Nov 2006 13:45:27 +0000 Subject: [PATCH] To check ColoredPrs3dHolder on _non_existent before its handling --- src/VISUGUI/VisuGUI_Slider.cxx | 24 ++++++++++++++++++++---- src/VISUGUI/VisuGUI_Slider.h | 1 + 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/VISUGUI/VisuGUI_Slider.cxx b/src/VISUGUI/VisuGUI_Slider.cxx index 32e1f3e8..068783ea 100644 --- a/src/VISUGUI/VisuGUI_Slider.cxx +++ b/src/VISUGUI/VisuGUI_Slider.cxx @@ -229,12 +229,26 @@ VisuGUI_Slider::~VisuGUI_Slider() { } +bool VisuGUI_Slider::checkHolderList() +{ + THolderList aHolderList; + THolderList::const_iterator anIter = myHolderList.begin(); + THolderList::const_iterator anIterEnd = myHolderList.end(); + for(; anIter != anIterEnd; anIter++){ + VISU::ColoredPrs3dHolder_var aHolder = *anIter; + if(!aHolder->_non_existent()) + aHolderList.push_back(aHolder); + } + myHolderList.swap(aHolderList); + return myHolderList.empty(); +} + void VisuGUI_Slider::enableControls( bool on ) { widget()->setEnabled( on ); if( on ) { - if( myHolderList.empty() ) + if( checkHolderList() ) return; myTimeStampStrings->clear(); @@ -288,7 +302,7 @@ void VisuGUI_Slider::enableControls( bool on ) void VisuGUI_Slider::updateMemoryState() { - if( myHolderList.empty() ) + if( checkHolderList() ) return; VISU::ColoredPrs3dHolder_var aHolder = myHolderList.front(); @@ -337,7 +351,7 @@ void VisuGUI_Slider::onSelectionChanged() } } - enableControls( !myHolderList.empty() ); + enableControls( !checkHolderList() ); updateMemoryState(); } @@ -396,8 +410,10 @@ void VisuGUI_Slider::onLast() void VisuGUI_Slider::onValueChanged( int value ) { - if( myHolderList.empty() ) + if( checkHolderList() ){ + enableControls( false ); return; + } VISU::ColoredPrs3dHolder_var aHolder = myHolderList.front(); diff --git a/src/VISUGUI/VisuGUI_Slider.h b/src/VISUGUI/VisuGUI_Slider.h index a15037c1..652236ea 100644 --- a/src/VISUGUI/VisuGUI_Slider.h +++ b/src/VISUGUI/VisuGUI_Slider.h @@ -85,6 +85,7 @@ public slots: protected: virtual void enableControls( bool ); virtual void updateMemoryState(); + virtual bool checkHolderList(); private: VisuGUI_Module* myModule; -- 2.39.2