Dragonmaster Lou wrote in Tue Aug 30, 2011 3:25 pm:Okay, in other words, just to summarize things, someone who figures out the Nasal
Nasal's syntax is VERY close to JavaScript, obviously the library functions are different and more specific to FlightGear.
http://www.plausible.org/nasal/sample.nashttp://www.plausible.org/nasal/lib.htmlDragonmaster Lou wrote in Tue Aug 30, 2011 3:25 pm:and XML syntax well enough can write their own GUIs for configuring controls using FlightGear-native facilities and don't have to write C/C++ code to do so?
Yes, that's exactly the case: The absolute majority of GUI dialogs in FlightGear are all made up of XML files following a FlightGear-specific format that is called "PropertyList", this is because all XML files using this structure can directly be processed by the FlightGear property tree.
Usually, Nasal files contain bindings (e.g. actions for buttons) to trigger some code - such as fgcommands (see $FG_ROOT/README.commands):
http://gitorious.org/fg/fgdata/blobs/ma ... E.commandsFiguring out Nasal and/or XML should not that much of an issue, because you can view plenty of files from the base package that contain numerous examples. Especially, if you are programmer by profession.
Hmm, might be a nice pet project for me to work on if I can find the time and perhaps I can submit it to FG's codebase if that's the case. While I do know C and C++ and am a programmer at my day job, hacking Nasal sounds much easier than diving head first into FG's core source code and adding this functionality.
In fact, using the XML-configurable GUI system is now generally considered the preferred route, simply because the majority of GUI dialogs are kept in $FG_ROOT/GUI/dialogs
You can invoke Nasal scripts from these dialog files, and you can trigger fgcommands.
Nasal has a relatively rich library of functions that are supported by default, in addition you can FlightGear specific extension functions and FlightGear-specific helper modules from $FG_ROOT/Nasal - such as code from gui.nas or io.nas
To get started easily you could look around for a GUI dialog that is using the widgets that you need, you can then locate the file in $FG_ROOT/gui/dialogs and open it in a plain text editor. You could also use a validating XML editor instead if you want to make sure that your XML is valid.
You could save a copy of the file under a different file name, such as "config-gui.xml" and add a new entry to $FG_ROOT/gui/menubar.xml to add a new menubar entry for showing your dialog.
You could then -step by step- modify your dialog so that it can be used for configuring the controls and saving everything to a new XML file.
If you already know C++, it should be easy for you to understand the Nasal part - and XML is just a markup language.
Not all features of the underlying GUI library are currently exposed, but it is relatively easy to add support for new widgets.
The C++ source that turns the PropertyList GUI dialog files into PUI/PLIB dialogs is located in $FG_SRC/GUI/dialog.cxx:
http://gitorious.org/fg/flightgear/blob ... dialog.cxxThe PLIB PUI library is documented here:
http://plib.sourceforge.net/pui/index.htmlSo if you should find the need to add new widgets or features to the GUI bindings, it would not be too difficult to do - as you'll surely see.