Hi all,

I'm still trying to get failures implemented specifically for one 
aircraft (before finding a better way for global solution). I've got a 
"problem" with the dialogs instrument-failures.xml and 
system-failures.xml, using the check boxes.

Indeed, it seems like the dialog-apply command changes every single 
property linked to a checkbox causing the listeners set on these 
properties to be triggered even if the property hadn't be changed by the 
user. The result is that all instruments or systems which have a 
listener are triggered, and obviously fail all instruments and systems 
in my case.

This is not new, it was the case with the precedent gui dialog, and I 
used a Nasal workaround but not really useful as it disallows to come 
back to a previous state. So maybe it is time to check this out directly 
in FG sources, and find a "solution" for dialog-apply command.

I had a look in $FGSRC/src/GUI/dialog.cxx.
We could do something like the following in copy_from_pui (line 430)
...
     switch (node->getType()) {
     case SGPropertyNode::BOOL:
     case SGPropertyNode::INT:
     case SGPropertyNode::LONG:
+++     if (object->getIntegerValue() != node->getIntegerValue())
             node->setIntValue(object->getIntegerValue());
         break;
     case SGPropertyNode::FLOAT:
     case SGPropertyNode::DOUBLE:
+++     if (object->getFloatValue() != node->getFloatValue())
             node->setFloatValue(object->getFloatValue());
         break;
...

copy_from_pui is called from FGDialog::applyValues, itself called from 
do_dialog_apply (in Main/fg_commands.cxx).

I don't know if this sounds like an acceptable trick, and if it could 
cause side effects. But maybe it could solve the problem of multiple 
properties modified, triggering listeners which not have to. What do you 
think about this?

btw, using MTBF works fine (as Nasal code changes only the wanted 
property) and is a nice tool ;)

hope I've been understandable :)
best regards
seb

Stuart Buchanan wrote :
 >
 > I believe the current patch is ready for review and inclusion in CVS. 
Feedback is obviously very welcome :)
 >
 > My thanks to John and erobo for their work on this.
 >
 > -Stuart
 >

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to