* Melchior FRANZ -- Wednesday 22 December 2004 15:10:
> getString is only made virtual in puList() and AirportList(), but it's
> not virtual in puObject. copy_from_pui(), however, uses the getStringValue()
> method on a puObject, assuming that it will get AirportList()'s. Of course,
> this doesn't work and puValue()'s is used instead. One would have to make
> getStringValue virtual in puObject() or puValue() to make this work.

From the numerous responses I gather that this is an often used and appreciated
feature. If someone more familiar with C++ than I am wants to try an acceptable
fix that avoids the necessity to change plib's pu.h: I attached my version.

On the fgfs side:

- make get{Integer,String}Value return the value of sub-object _list_box (which
  contains the index/icao code of the selected list item), instead of the 
object's
  itself (which is always zero)

On the plib side:

- make puValue::getStringValue() in pu.h:538 and puValue::getIntegerValue()
  in pu.h:535 virtual. Weirdly, the former would be enough ... at least until
  the next gcc is released.

To make the gui-airport list useful, one would have to add another button
"Scan Scenery" that would search all paths in fg_scenery() for airports and
store this list in $FG_HOME. Further runs would then only show actually
available airports. Unfortunately, the whole $FG_HOME idea was put down.
Sigh.

m.
Index: puList.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/FlightGear/src/GUI/puList.cxx,v
retrieving revision 1.1
diff -u -p -r1.1 puList.cxx
--- puList.cxx	27 Nov 2003 23:41:00 -0000	1.1
+++ puList.cxx	23 Dec 2004 15:02:57 -0000
@@ -77,7 +77,13 @@ puList::newList (char ** contents)
 char *
 puList::getStringValue ()
 {
-    return _contents[_list_box->getIntegerValue()];
+    return _contents[getIntegerValue()];
+}
+
+int
+puList::getIntegerValue ()
+{
+    return _list_box->getIntegerValue();
 }
 
 void
Index: puList.hxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/FlightGear/src/GUI/puList.hxx,v
retrieving revision 1.4
diff -u -p -r1.4 puList.hxx
--- puList.hxx	30 Apr 2004 08:44:35 -0000	1.4
+++ puList.hxx	23 Dec 2004 15:02:57 -0000
@@ -25,6 +25,7 @@ class puList : public puGroup
     virtual void newList (char ** contents);
     // TODO: other string value funcs
     virtual char * getStringValue ();
+    virtual int getIntegerValue ();
 
  protected:
     virtual void init (int w, int h);
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d

Reply via email to