From 7512553a9adb8f6a371d940c4a175479d0375f7c Mon Sep 17 00:00:00 2001 From: mfranz Date: Thu, 18 May 2006 12:51:32 +0000 Subject: [PATCH] don't reset list to top after having changed a value --- src/GUI/prop_picker.cxx | 10 +++++++--- src/GUI/prop_picker.hxx | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/GUI/prop_picker.cxx b/src/GUI/prop_picker.cxx index dd6e6b23a..0599246f8 100755 --- a/src/GUI/prop_picker.cxx +++ b/src/GUI/prop_picker.cxx @@ -88,7 +88,7 @@ void prop_pickerRefresh() prop_pickerInit(); } fgPropPicker *me = (fgPropPicker *)PP_widget -> getUserData(); - me -> find_props(); + me -> find_props( true ); } void prop_editOpen( const char * name, const char * value, char * proppath ) @@ -426,7 +426,7 @@ static int nodeNameCompare(const void *ppNode1, const void *ppNode2) // Replace the current list of properties with the children of node "startDir". -void fgPropPicker::find_props () +void fgPropPicker::find_props ( bool restore_pos ) { int pi; int i; @@ -499,12 +499,16 @@ void fgPropPicker::find_props () proppath -> setLabel (startDir); + int top = list_box->getTopItem(); list_box -> newList ( files ) ; + if (restore_pos) + list_box->setTopItem(top); // adjust the size of the slider... if (num_files > list_box->getNumVisible()) { slider->setSliderFraction((float)list_box->getNumVisible() / num_files); - slider->setValue(1.0f); + if (!restore_pos) + slider->setValue(1.0f); slider->reveal(); up_arrow->reveal(); down_arrow->reveal(); diff --git a/src/GUI/prop_picker.hxx b/src/GUI/prop_picker.hxx index 1741f105a..2bb87cb7f 100755 --- a/src/GUI/prop_picker.hxx +++ b/src/GUI/prop_picker.hxx @@ -65,7 +65,7 @@ protected: public: puText *proppath ; - void find_props () ; + void find_props ( bool restore_slider_pos = false ) ; fgPropPicker ( int x, int y, int w, int h, int arrows, const char *dir, const char *title = "Pick a file" ) ; -- 2.39.5