Here's a fun toy. I've been using the property picker a lot recently, while working on a panel for the Harrier. Sometimes it gets difficult to find the property you're looking for in a crowded tree. The attached patch sorts the list alphabetically.
Andy Index: prop_picker.cxx =================================================================== RCS file: /var/cvs/FlightGear-0.7/FlightGear/src/GUI/prop_picker.cxx,v retrieving revision 1.6 diff -u -w -r1.6 prop_picker.cxx --- prop_picker.cxx 8 Feb 2002 12:31:22 -0000 1.6 +++ prop_picker.cxx 21 Feb 2002 01:16:30 -0000 @@ -501,6 +501,23 @@ files [ num_files ] = NULL ; + // 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=0; 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); _______________________________________________ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel