From 804b0396a4c4506ba41b590a0d7879695c20e8eb Mon Sep 17 00:00:00 2001 From: Thomas Geymayer Date: Thu, 20 Sep 2012 00:01:48 +0200 Subject: [PATCH] Documentation browser dialog (for files in /Docs - Thanks to Hooray) --- Translations/de/menu.xml | 2 + Translations/en/menu.xml | 1 + gui/dialogs/doc-browser.xml | 140 ++++++++++++++++++++++++++++++++++++ gui/menubar.xml | 8 +++ 4 files changed, 151 insertions(+) create mode 100644 gui/dialogs/doc-browser.xml diff --git a/Translations/de/menu.xml b/Translations/de/menu.xml index 0203f0df2..d9a35dec5 100644 --- a/Translations/de/menu.xml +++ b/Translations/de/menu.xml @@ -123,7 +123,9 @@ Hilfe Hilfe (im Browser) + Erweiterte Dokumentation Flugzeug Hilfe + Flugzeug Checklisten Tastenbelegung (Flugzeugsteuerung) Tastenbelegung (allgemein) Joystick Informationen diff --git a/Translations/en/menu.xml b/Translations/en/menu.xml index 51c6e8e8d..70c2c6af8 100644 --- a/Translations/en/menu.xml +++ b/Translations/en/menu.xml @@ -108,6 +108,7 @@ Help Help (opens in browser) + Documentation Browser Aircraft Help Aircraft Checklists Common Aircraft Keys diff --git a/gui/dialogs/doc-browser.xml b/gui/dialogs/doc-browser.xml new file mode 100644 index 000000000..ffe3052e6 --- /dev/null +++ b/gui/dialogs/doc-browser.xml @@ -0,0 +1,140 @@ + + + -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 + + FIXED_8x13 + + /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); + + diff --git a/gui/menubar.xml b/gui/menubar.xml index aadd572fb..8432d39cb 100644 --- a/gui/menubar.xml +++ b/gui/menubar.xml @@ -703,6 +703,14 @@ + + doc-browser + + dialog-show + doc-browser + + + ? aircraft-keys