-20 -20 doc-browser doc-browser vbox true hbox 1 1 hbox 170 500 filename fill /sim/gui/dialogs/doc-browser/filename clear dialog-apply filename dialog-update editfield editfield fill fill true 600 250 6 20 falsee false sim/gui/selected-style/fonts/fixed /sim/gui/dialogs/doc-browser/edit var self = cmdarg(); var dlg = props.globals.getNode("/sim/gui/dialogs/doc-browser", 1); var edit = dlg.getNode("edit", 1); if( !contains(globals, "__doc_browser") ) globals["__doc_browser"] = {}; var path = getprop("/sim/fg-root") ~ "/Docs/"; # hard coded list of file names, because not all files are plain text - not even the README* files # TODO: it would probably make sense to sort these files (README, introduction, properties etc) var doc_files = [ "README", "README.introduction", "README.fgjs", "README.xmlsyntax", "README.multiscreen", "README.properties", "README.IO", "README.logging", "README.protocol", "README.scenery", "README.materials", "README.yasim", "README.JSBsim", "README.submodels", "README.3DClouds", "README.flightrecorder", "README.jsclient", "README.multiplayer", "README.tutorials", "README.conditions", "README.commands", "README.digitalfilters", "README.airspeed-indicator", "README.hud", # "README.xmlhud", deprecated? "README.gui", "README.layout", "README.osgtext", "README.wildfire", "README.electrical", "README.effects", "README.xmlparticles", "README.sound", "README.xmlsound", "README.xmlpanel", "README.minipanel" ]; var filename_list = self.getNode("group[1]/list"); var n=0; # add the filenames to the list box foreach(var file; doc_files) { filename_list.getChild("value",n,1).setValue( file ); n+=1; } var filename_property = "/sim/gui/dialogs/doc-browser/filename"; var update = func { var file = getprop(filename_property); var doc_file = path ~ file; setprop("/sim/gui/dialogs/doc-browser/edit", io.readfile(doc_file)); } var listener = setlistener(filename_property, update); setprop("/sim/gui/dialogs/doc-browser/filename", "README.introduction"); removelistener(listener);