155
edits
(→CDU) |
No edit summary |
||
Line 1: | Line 1: | ||
{{WIP|[[User:Hcc23|Hcc23]] is working on this. Find him in the FG IRC channel to discuss this page.}} | |||
This page is a rather technical description of the Nasal code for the framework used to implement a Boeing style [[CDU]]. | This page is a rather technical description of the Nasal code for the framework used to implement a Boeing style [[CDU]]. | ||
'''Note:''' Although this is meant as a documentation for the code, it obviously will (always) be (slightly) outdated. However, after reading through this page, the actual source code at https://gitorious.org/fg/fgdata/trees/master/Aircraft/Instruments-3d/cdu should not present any major surprises. [[User:Hcc23|Hcc23]] 10:07, 7 May 2011 (EDT) | '''Note:''' Although this is meant as a documentation for the code, it obviously will (always) be (slightly) outdated. However, after reading through this page, the actual source code at https://gitorious.org/fg/fgdata/trees/master/Aircraft/Instruments-3d/cdu should not present any major surprises. [[User:Hcc23|Hcc23]] 10:07, 7 May 2011 (EDT) | ||
Line 7: | Line 7: | ||
= Basic Classes = | = Basic Classes = | ||
These are the core classes in the CDU framework. The documentation should show a brief comment on what each variable or function is intended to do, particularly the ones that are important for the '''creation''' of an actual, content-filled CDU page. | |||
Although Nasal as such has no support for this, the internal stuff in a class is sectioned in three categories, borrowing language from <tt>C++</tt> | |||
* '''Static:''' Stuff in this section is mainly identified by being made directly as part of the <tt>hash</tt> (as opposed to being ''tagged on'' by the the <tt>new</tt> constructor. Elements in here also follow a ''camelCase'' type of notation, whereas ''members'' use an ''underscore_naming_convetion''. Please note that although meant to be comparable to statics, in hindsight a lot of them would be better placed in the member section Public... | |||
* '''Public:''' Elements in here are created from inside the <tt>new</tt> constructor and follow an ''underscore_naming_convetion''. In a perfect world these would only be accessing functions, as exposing variables is always prone for trouble when the time for a redesign comes... Elements in here should be the only ones used in the creation of a page - in a perfect world. | |||
* '''Private:''' Elements in here are created from inside the <tt>new</tt> constructor and follow an ''underscore_naming_convetion''. Although readable by everybody, access to these elements should be limited to functions in the static and public parts of the classes code. Particularly no page creation (user) code should need to access this information. | |||
'''Note:''' I know that I violate these rules. Yes. But I have rewritten the framework to often to (at this point) care much about it - particularly as it seems to be working. Please, feel free to correct the Nasal code I have written (which might involve the pain of revisiting the page creation sections... Sorry for that.) [[User:Hcc23|Hcc23]] 14:45, 9 May 2011 (EDT) | |||
== Line == | == Line == | ||
Line 126: | Line 138: | ||
<code> | <code> | ||
var CDU = { | var CDU = { | ||
# " | # "Static" | ||
func M_ERROR(message_string), | func M_ERROR(message_string), | ||
func M_WARNING(message_string), | func M_WARNING(message_string), | ||
Line 151: | Line 163: | ||
<code> | <code> | ||
var ScratchPad = { | var ScratchPad = { | ||
# " | # "Static" | ||
vector messages, | vector messages, | ||
scalar deleteString, # "DELETE"~"" | scalar deleteString, # "DELETE"~"" | ||
Line 157: | Line 169: | ||
func new(), | func new(), | ||
# " | # "Public" | ||
scalar me.input_string, | scalar me.input_string, | ||
func me.erase, | func me.erase, | ||
# " | # "Private" | ||
scalar me.pm_trigger, | scalar me.pm_trigger, | ||
func me.plusminus(), | func me.plusminus(), | ||
Line 175: | Line 187: | ||
<code> | <code> | ||
var ListenerCollection = { | var ListenerCollection = { | ||
# " | # "Static" | ||
func registerInPropTree(path), | func registerInPropTree(path), | ||
func add(prop, field_id, subpage_id, side, lsk_index), | func add(prop, field_id, subpage_id, side, lsk_index), | ||
Line 181: | Line 193: | ||
func new(ptp=nil), | func new(ptp=nil), | ||
# " | # "Private" | ||
scalar me.ptp, | scalar me.ptp, | ||
vector me.listener_list, | vector me.listener_list, |
edits