]> git.mxchange.org Git - flightgear.git/commitdiff
don't reset list to top after having changed a value
authormfranz <mfranz>
Thu, 18 May 2006 12:51:32 +0000 (12:51 +0000)
committermfranz <mfranz>
Thu, 18 May 2006 12:51:32 +0000 (12:51 +0000)
src/GUI/prop_picker.cxx
src/GUI/prop_picker.hxx

index dd6e6b23ad2420713aaa4397e1e8fa0357a7506f..0599246f8329bd376c2336f94b51286a4ac4832f 100755 (executable)
@@ -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();
index 1741f105a26d5c05b5d4484ffc9f5d2144578616..2bb87cb7fee554b8c2f6112b8311e69052be653b 100755 (executable)
@@ -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" ) ;