I wrote:
> > Erik Hofman wrote:
> > The removeChild() code was used because "we" wanted the dialog to appear
> > with the same dimension and location after loading the configuration
> > file again. But we don't do that anymore, the settings remain in the
> > property tree so the removeChild calls should have been removed back then.
>
> This is wrong.  How does one have a dialog with fixed layout for some
> parts and dynamic layout for others?  The whole point was to restore
> the property tree to the state that it had before the layout was
> performed.
>
> Can you provide more specifics about your change?  I strongly suspect
> you've broken the intended behavior with this change.

Indeed this patch (below) doesn't work the way you want it to.  It is
not impossible to have a dialog element with a user defined width or
height.  The layout management code will clobber that value -- you
should be able to see this by deleting and recreating the dialog
repeatedly.  Different components will grow or shrink each iteration.

(There was actually a bug reported, and worked around, long ago like
this.  We now know that it was because removeChild() was failing to
actually remove the children.)

I *strongly* recommend reverting this change and fixing removeChild()
instead.

Andy


Update of /var/cvs/FlightGear-0.9/FlightGear/src/GUI
In directory baron:/tmp/cvs-serv1266

Modified Files:
        dialog.cxx
Log Message:
Make the dialogs work again.

Index: dialog.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/FlightGear/src/GUI/dialog.cxx,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -r1.30 -r1.31
*** dialog.cxx  6 May 2005 11:46:52 -0000       1.30
--- dialog.cxx  16 May 2005 08:37:18 -0000      1.31
***************
*** 360,367 ****
      int screenh = globals->get_props()->getIntValue("/sim/startup/ysize");

!     bool userx = props->hasValue("x");
!     bool usery = props->hasValue("y");
!     bool userw = props->hasValue("width");
!     bool userh = props->hasValue("height");

      LayoutWidget wid(props);
--- 360,367 ----
      int screenh = globals->get_props()->getIntValue("/sim/startup/ysize");

!     // bool userx = props->hasValue("x");
!     // bool usery = props->hasValue("y");
!     // bool userw = props->hasValue("width");
!     // bool userh = props->hasValue("height");

      LayoutWidget wid(props);
***************
*** 378,386 ****

      // Remove automatically generated properties, so the layout looks
      // the same next time around.
!     if(!userx) props->removeChild("x");
!     if(!usery) props->removeChild("y");
!     if(!userw) props->removeChild("width");
!     if(!userh) props->removeChild("height");

      if (_object != 0) {
--- 378,388 ----

      // Remove automatically generated properties, so the layout looks
+     // EMH - this isn't needed anymore since the layout remains in
+     //       the poprty tree now.
      // the same next time around.
!     // if(!userx) props->removeChild("x");
!     // if(!usery) props->removeChild("y");
!     // if(!userw) props->removeChild("width");
!     // if(!userh) props->removeChild("height");

      if (_object != 0) {

_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d

Reply via email to