Hi all, I've created a system, which I think is new in FG as I've never seen it elsewhere. It allows to manage many many buttons, knobs, actions, execute nasal scripts, etc. with only a few serie of keys.
you can find it here: http://seb.marque.free.fr/fichiers/flightgear/apm20.tgz nasal code is in Nasal/key-handler.nas xml is in key-handler.xml, called in lionceau-base.xml Indeed the principle is simple, the user launch the key-handler system pressing a regular shortcut (in the example this is 'm'), then the key-handler manage all keyboard entries, and follows a "scenario" written in XML, depending of next pressed keys. Example of "scenario": m... launch key-handler c... select COMM1 c... select COMM2 c... select COMM1 up... increment by 1MHz COMM1 stand-by freq c... select COMM2 d... select decimal part of COMM2 stand-by freq down... decrement by 0.05MHz COMM2 stand-by freq r... select VOR radials knob pageup... increment by 5° radials ring of VOR down... decrement by 1° radials ring of VOR g... select GPS device p... select power knob of GPS up... execute nasal code to increase GPS power m... select GPS mode knob down... turn GPS mode knob counterclock up... turn GPS mode knob clockwise n... select NAV1 s... swap selected <-> stand-by NAV1 freqs space-bar... quit key-handler the key-handler automagically quits 5 seconds after the last pressed key (defined with a <timeout> tag in XML scenario), or by pressing a key (multiple possibilities, in the example escape or spacebar keys are able to quit the key-handler, defined with <stop-key> tag(s) in XML scenario). The scenario is written with XML, each level of the scenario inherits the parent's values. If a pressed key is not known in the actual level of scenario, the key-handler falls back recursively to the previous level until it find the correct pressed key entrie, stopping the search at the root level of the scenario if not found (it is planned to change this behaviour as it was first implemented, but it is not very convenient for user or coder). the only hard-coded things are the "step-by-step" keys (up/down for small steps, pageup/pagedown for bigger steps). Actually, the example is not very consistant as it hasn't many knobs and buttons to manage, but the system could be very effective in an aircraft cockpit with many switches and knobs, as they can be splitted in "parts", each part splitted in devices or sub-parts, etc... it could be possible to create aliases for redondant actions (not tested yet...), and the name of the device can vary if there are multiple instances (as COMM and NAV), each char '#' is equal to "property index" + 1, and each '$' is equal to "property index". The key-handler shows a popup, telling to the user which is the selected device (all the path of the scenario) or what kind of action he/she is doing (planning to popup all possible entries for each level). Hope this system could help aircraft designers to create complex cockpits without being afraid of the keyboard size or its usability. At least the key-handler helps me a lot for easily change NAV and COMM freqs, and VOR radials, and manage the ZKV500 GPS without losing the control of my favourite aircraft, trying to catch the buttons or knobs with my mouse pointer. you'll find more descriptions at the end of key-handler.xml file and in the code of key-handler.nas. Sorry if I could not find more "technical" terms for this system, as I'm not an English native speaker for those who haven't found that themselves :D. So I'm not sure that "key-handler" is correct (copied from prop_key_handler.nas ;)), neither about "scenario" ad others... by the way, it works fine. enjoy! seb ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel