--- On Mon, 2/6/08, Stuart Buchanan wrote: > I will continue looking at this, though if anyone else > would like to jump in with suggestions, that would be very > welcome.
... and here's the patch, based on Fred's original patch. Assuming it passes muster, could someone review and commit please? -Stuart Index: AirportList.cxx =================================================================== RCS file: /var/cvs/FlightGear-0.9/source/src/GUI/AirportList.cxx,v retrieving revision 1.18 diff -u -p -r1.18 AirportList.cxx --- AirportList.cxx 11 Mar 2008 15:58:57 -0000 1.18 +++ AirportList.cxx 2 Jun 2008 21:05:01 -0000 @@ -1,4 +1,4 @@ - +#include <locale> #include <Main/globals.hxx> #include <Airports/simple.hxx> @@ -22,6 +22,7 @@ AirportList::~AirportList () void AirportList::create_list () { + const std::ctype<char> &ct = std::use_facet<std::ctype<char> >(std::locale() ); int num_apt = _airports->size(); char **content = new char *[num_apt + 1]; @@ -30,8 +31,13 @@ AirportList::create_list () const FGAirport *apt = _airports->getAirport(i); STD::string entry(apt->getName() + " (" + apt->getId() + ')'); - if (!_filter.empty() && entry.find(_filter) == STD::string::npos) + if (!_filter.empty()) { + // Perform filter check case-insensitively + std::string cientry(apt->getName() + " (" + apt->getId() + ')'); + ct.toupper( (char *) cientry.data(), (char *) cientry.data() + cientry.size() ); + if (cientry.find(_filter) == std::string::npos) continue; + } content[n] = new char[entry.size() + 1]; strcpy(content[n], entry.c_str()); @@ -60,7 +66,12 @@ AirportList::destroy_list () void AirportList::setValue (const char *s) { - STD::string filter(s); + std::string filter(s); + const std::ctype<char> &ct = std::use_facet<std::ctype<char> >(std::locale() ); + + // convert filter to upper-case for case-insensitive matching + ct.toupper( (char *) filter.data(), (char *) filter.data() + _filter.size() ); + if (filter != _filter) { _filter = filter; create_list(); Index: AirportList.hxx =================================================================== RCS file: /var/cvs/FlightGear-0.9/source/src/GUI/AirportList.hxx,v retrieving revision 1.7 diff -u -p -r1.7 AirportList.hxx --- AirportList.hxx 11 Mar 2008 15:58:57 -0000 1.7 +++ AirportList.hxx 2 Jun 2008 21:05:01 -0000 @@ -9,10 +9,6 @@ #include <plib/puAux.h> #include "dialog.hxx" - - -SG_USING_STD(string); - class FGAirportList; class AirportList : public puaList, public GUI_ID @@ -28,7 +24,7 @@ class AirportList : public puaList, publ private: FGAirportList * _airports; char ** _content; - STD::string _filter; + std::string _filter; }; #endif // __AIRPORTLIST_HXX __________________________________________________________ Sent from Yahoo! Mail. A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel