]> git.mxchange.org Git - flightgear.git/blobdiff - src/GUI/prop_picker.cxx
Patch from Andy Ross to allow virtual panel to tilt with mouse view:
[flightgear.git] / src / GUI / prop_picker.cxx
index 59674c36d6a0175ebcaf112845df159b6e42fd55..a7e5c6c07becb5ca0d6d5cfeb3d0d11cf1934117 100755 (executable)
@@ -501,6 +501,26 @@ void fgPropPicker::find_props ()
 
   files [ num_files ] = NULL ;
 
+  // leave the . and .. alone...
+  int ii = ( strcmp(files [0], "." ) == 0 ) ? 2 : 0;
+
+  // Sort the entries.  This is a simple N^2 extraction sort.  More
+  // elaborate algorithms aren't necessary for the few dozen
+  // properties we're going to sort.
+  for(i=ii; i<num_files; i++) {
+    int j, min = i;
+    char df, *tmp;
+    for(j=i+1; j<num_files; j++)
+      if(strcmp(names[j], names[min]) < 0)
+       min = j;
+    if(i != min) {
+      tmp =  names[min];  names[min] =  names[i];  names[i] = tmp;
+      tmp =  files[min];  files[min] =  files[i];  files[i] = tmp;
+      tmp = values[min]; values[min] = values[i]; values[i] = tmp;
+      df  =  dflag[min];  dflag[min] =  dflag[i];  dflag[i] = df;
+    }
+  }
+
   // printf("files pointer=%i/%i\n", files, num_files);
 
   proppath ->    setLabel          (startDir);
@@ -586,3 +606,5 @@ fgPropEdit::fgPropEdit ( char *name, char *value, char *proppath ) : puDialogBox
         
     FG_FINALIZE_PUI_DIALOG( this );
 }
+
+