| 1 | <?xml version="1.0"?> |
| 2 | |
| 3 | <PropertyList> |
| 4 | <name>joystick-info</name> |
| 5 | <layout>vbox</layout> |
| 6 | <resizable>true</resizable> |
| 7 | <default-padding>3</default-padding> |
| 8 | |
| 9 | <group> |
| 10 | <layout>hbox</layout> |
| 11 | <default-padding>1</default-padding> |
| 12 | |
| 13 | <text> |
| 14 | <label>Joystick Information</label> |
| 15 | </text> |
| 16 | |
| 17 | <empty><stretch>true</stretch></empty> |
| 18 | |
| 19 | <button> |
| 20 | <legend>X</legend> |
| 21 | <key>Esc</key> |
| 22 | <pref-width>20</pref-width> |
| 23 | <pref-height>20</pref-height> |
| 24 | <binding> |
| 25 | <command>dialog-close</command> |
| 26 | </binding> |
| 27 | </button> |
| 28 | </group> |
| 29 | |
| 30 | <hrule/> |
| 31 | |
| 32 | <nasal> |
| 33 | <open> |
| 34 | var value = func(p, default = "") { |
| 35 | return p != nil and (var v = p.getValue()) != nil ? v : default; |
| 36 | } |
| 37 | |
| 38 | var items = func(it, name) { |
| 39 | var t = ""; |
| 40 | foreach (var x; it) { |
| 41 | t ~= " ["; |
| 42 | t ~= value(x.getNode("name"), name ~ " #" ~ x.getIndex()); |
| 43 | t ~= "] ... "; |
| 44 | t ~= value(x.getNode("desc"), "???"); |
| 45 | t ~= "\n"; |
| 46 | } |
| 47 | return t; |
| 48 | } |
| 49 | |
| 50 | var t = ""; |
| 51 | var joysticks = props.globals.getNode("/input/joysticks").getChildren("js"); |
| 52 | var numjs = size(joysticks); |
| 53 | forindex (var i; joysticks) { |
| 54 | var js = joysticks[i]; |
| 55 | var id = value(js.getNode("id"), "[unnamed]"); |
| 56 | var source = value(js.getNode("source"), "[user defined]"); |
| 57 | var names = js.getChildren("name"); |
| 58 | |
| 59 | t ~= "Joystick #" ~ js.getIndex() ~ ": \"" ~ id ~ "\"\n\n"; |
| 60 | t ~= " Driver: " ~ source ~ "\n"; |
| 61 | if (size(names)) { |
| 62 | t ~= " Used for: "; |
| 63 | var last = pop(names); |
| 64 | foreach (var n; names) |
| 65 | t ~= '"' ~ value(n) ~ '", '; |
| 66 | |
| 67 | t ~= '"' ~ value(last) ~ '"'; |
| 68 | } |
| 69 | t ~= "\n\n"; |
| 70 | t ~= items(js.getChildren("axis"), "Axis"); |
| 71 | t ~= "\n"; |
| 72 | t ~= items(js.getChildren("button"), "Button"); |
| 73 | |
| 74 | var help = value(js.getNode("help"), nil); |
| 75 | if (help != nil) |
| 76 | t ~= "\n\n" ~ help; |
| 77 | |
| 78 | if (numjs > 1 and i < numjs - 1) |
| 79 | t ~= "\n\n\n----------------------------------------\n\n\n"; |
| 80 | } |
| 81 | |
| 82 | var text = props.globals.getNode("/sim/gui/dialogs/joystick-info/text", 1); |
| 83 | text.setValue(t); |
| 84 | </open> |
| 85 | |
| 86 | <close> |
| 87 | text.setValue(""); |
| 88 | </close> |
| 89 | </nasal> |
| 90 | |
| 91 | <group> |
| 92 | <layout>table</layout> |
| 93 | <default-padding>2</default-padding> |
| 94 | |
| 95 | <empty> |
| 96 | <width>150</width> |
| 97 | <col>0</col> |
| 98 | <row>0</row> |
| 99 | </empty> |
| 100 | |
| 101 | <text> |
| 102 | <label>Aileron: </label> |
| 103 | <halign>right</halign> |
| 104 | <col>1</col> |
| 105 | <row>0</row> |
| 106 | </text> |
| 107 | |
| 108 | <text> |
| 109 | <label>-0.00000</label> |
| 110 | <halign>left</halign> |
| 111 | <format>%.5f</format> |
| 112 | <property>/controls/flight/aileron</property> |
| 113 | <live>1</live> |
| 114 | <col>2</col> |
| 115 | <row>0</row> |
| 116 | </text> |
| 117 | |
| 118 | <text> |
| 119 | <label>Elevator: </label> |
| 120 | <halign>right</halign> |
| 121 | <col>1</col> |
| 122 | <row>1</row> |
| 123 | </text> |
| 124 | |
| 125 | <text> |
| 126 | <label>-0.00000</label> |
| 127 | <halign>left</halign> |
| 128 | <format>%.5f</format> |
| 129 | <property>/controls/flight/elevator</property> |
| 130 | <live>1</live> |
| 131 | <col>2</col> |
| 132 | <row>1</row> |
| 133 | </text> |
| 134 | |
| 135 | <text> |
| 136 | <label>Rudder: </label> |
| 137 | <halign>right</halign> |
| 138 | <col>3</col> |
| 139 | <row>0</row> |
| 140 | </text> |
| 141 | |
| 142 | <text> |
| 143 | <label>-0.00000</label> |
| 144 | <halign>left</halign> |
| 145 | <format>%.5f</format> |
| 146 | <property>/controls/flight/rudder</property> |
| 147 | <live>1</live> |
| 148 | <col>4</col> |
| 149 | <row>0</row> |
| 150 | </text> |
| 151 | |
| 152 | <text> |
| 153 | <label>Throttle: </label> |
| 154 | <halign>right</halign> |
| 155 | <col>3</col> |
| 156 | <row>1</row> |
| 157 | </text> |
| 158 | |
| 159 | <text> |
| 160 | <label>-0.00000</label> |
| 161 | <halign>left</halign> |
| 162 | <format>%.5f</format> |
| 163 | <property>/controls/engines/engine/throttle</property> |
| 164 | <live>1</live> |
| 165 | <col>4</col> |
| 166 | <row>1</row> |
| 167 | </text> |
| 168 | |
| 169 | <empty> |
| 170 | <width>150</width> |
| 171 | <col>5</col> |
| 172 | <row>0</row> |
| 173 | </empty> |
| 174 | </group> |
| 175 | |
| 176 | <textbox> |
| 177 | <padding>5</padding> |
| 178 | <halign>fill</halign> |
| 179 | <valign>fill</valign> |
| 180 | <stretch>true</stretch> |
| 181 | <pref-width>640</pref-width> |
| 182 | <pref-height>480</pref-height> |
| 183 | <slider>20</slider> |
| 184 | <wrap>false</wrap> |
| 185 | <editable>false</editable> |
| 186 | <property>/sim/gui/dialogs/joystick-info/text</property> |
| 187 | </textbox> |
| 188 | </PropertyList> |