Debian Codegraph @

Input/Joysticks/Saitek/Pro-Flight-Quadrant.xml

raw symbols SCIP
1 <?xml version="1.0"?>
2 <!-- Saitek Pro Flight Quadrant
3
4 Copyright (C) 2008 Ronald Jensen (wino(at)jentronics.com)
5 Copyright (C) 2009 - 2010 Anders Gidenstam (anders(at)gidenstam.org)
6 This file is released under the GPL license version 2.
7 -->
8 <PropertyList>
9 <name>Saitek Saitek Pro Flight Quadrant</name>
10 <name>Saitek Pro Flight Quadrant</name>
11 <name>Saitek Pro Flight Throttle Quadrant</name>
12
13 <nasal>
14 <script>
15 <![CDATA[
16 var self = cmdarg().getParent();
17 var data = self.getNode("data");
18 var engine_select_mode = 0;
19 # TM0: All selected; TM1: #1-#3; TM2: #3-#6
20 var engine_axis_mode = 0;
21 # Valid only in TM1 and TM2.
22 # EA0: throttle
23 # EA1: mixure
24 # EA2: propeller
25 var pressed = [0,0,0,0,0,0];
26 var engine = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
27
28 # Do per-aircraft modifications
29 if (contains({"Aircraft/Short_Empire/Models/Short_Empire-model.xml" : 0,
30 "Aircraft/Lockheed1049/Models/Lockheed1049_twa.xml" : 0},
31 getprop("/sim/model/path"))) {
32 # Map port outer to axis 0, starboard outer to axis 2 and
33 # the inner engines to axis 1.
34 engine = [0, [1, 2], 3];
35 }
36 if (contains({"Aircraft/DO-X/Models/dox.xml" : 0},
37 getprop("/sim/model/path"))) {
38 engine = [[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11]];
39 }
40 if (contains({"Aircraft/Nordstern/Models/Nordstern.xml" : 0},
41 getprop("/sim/model/path"))) {
42 engine = [0, 1, [2, 3]];
43 }
44
45 var kbdctrl = props.globals.getNode("/devices/status/keyboard/ctrl", 1);
46 var kbdalt = props.globals.getNode("/devices/status/keyboard/alt", 1);
47
48 var axis_handler = func(axis) {
49 if (engine_select_mode == 0) {
50 if (axis == 0) {
51 controls.throttleAxis();
52 } elsif (axis == 1) {
53 controls.propellerAxis();
54 } elsif (axis == 2) {
55 controls.mixtureAxis();
56 }
57 } else {
58 controls.perEngineSelectedAxisHandler(engine_axis_mode)
59 (engine[axis + 3*(engine_select_mode - 1)]);
60 }
61 }
62
63 var trace = func(str) {
64 # Uncomment the line below to trace button presses.
65 #print("Pro-Flight-Quadrant.xml: " ~ str);
66 }
67 ]]>
68 </script>
69 </nasal>
70
71 <!-- Levers left to right. -->
72 <axis>
73 <name>Left lever</name>
74 <number>
75 <unix>0</unix>
76 <mac>0</mac>
77 <windows>0</windows>
78 </number>
79 <desc>TM0: throttle, TM1: throttle/propeller 1, TM2: throttle/propeller 4</desc>
80 <binding>
81 <command>nasal</command>
82 <script>axis_handler(0)</script>
83 </binding>
84 </axis>
85 <axis>
86 <name>Middle lever</name>
87 <number>
88 <unix>1</unix>
89 <mac>1</mac>
90 <windows>1</windows>
91 </number>
92 <desc>TM0: propeller, TM1: throttle/propeller 2, TM2: throttle/propeller 5</desc>
93 <binding>
94 <command>nasal</command>
95 <script>axis_handler(1)</script>
96 </binding>
97 </axis>
98 <axis>
99 <name>Right lever</name>
100 <number>
101 <unix>2</unix>
102 <mac>2</mac>
103 <windows>2</windows>
104 </number>
105 <desc>TM0: mixture, TM1: throttle/propeller 3, TM2: throttle/propeller 6</desc>
106 <binding>
107 <command>nasal</command>
108 <script>axis_handler(2)</script>
109 </binding>
110 </axis>
111
112 <!-- 2-way rocker switches. Left to right. -->
113 <button>
114 <name>Left button up</name>
115 <number>
116 <unix>0</unix>
117 <mac>0</mac>
118 <windows>0</windows>
119 </number>
120 <desc>Flaps up</desc>
121 <repeatable>false</repeatable>
122 <binding>
123 <command>nasal</command>
124 <script>controls.flapsDown(-1)</script>
125 </binding>
126 <mod-up>
127 <binding>
128 <command>nasal</command>
129 <script>controls.flapsDown(0)</script>
130 </binding>
131 </mod-up>
132 <mod-shift>
133 <binding>
134 <command>nasal</command>
135 <script>
136 trace("Button 0 + shift pressed!");
137 gui.popupTip("Saitek Quadrant: Throttle Mode 1");
138 engine_select_mode = 1;
139 </script>
140 </binding>
141 </mod-shift>
142 </button>
143 <button n="1">
144 <name>Left button down</name>
145 <number>
146 <unix>1</unix>
147 <mac>1</mac>
148 <windows>1</windows>
149 </number>
150 <desc>Flaps down</desc>
151 <repeatable>false</repeatable>
152 <binding>
153 <command>nasal</command>
154 <script>controls.flapsDown(1)</script>
155 </binding>
156 <mod-shift>
157 <binding>
158 <command>nasal</command>
159 <script>
160 trace("Button 1 + shift pressed!");
161 gui.popupTip("Saitek Quadrant: Throttle Mode 0");
162 engine_select_mode = 0;
163 </script>
164 </binding>
165 </mod-shift>
166 <mod-up>
167 <binding>
168 <command>nasal</command>
169 <script>controls.flapsDown(0)</script>
170 </binding>
171 </mod-up>
172 </button>
173
174 <button>
175 <name>Middle button up</name>
176 <number>
177 <unix>2</unix>
178 <mac>2</mac>
179 <windows>2</windows>
180 </number>
181 <desc>Elevator trim up</desc>
182 <repeatable>true</repeatable>
183 <binding>
184 <command>nasal</command>
185 <script>controls.elevatorTrim(-0.75)</script>
186 </binding>
187 <mod-shift>
188 <binding>
189 <command>nasal</command>
190 <script>
191 trace("Button 2 + shift pressed!");
192 if (engine_select_mode) gui.popupTip("Saitek Quadrant: Throttle control");
193 engine_axis_mode = 0;
194 </script>
195 </binding>
196 </mod-shift>
197 </button>
198 <button>
199 <name>Middle button down</name>
200 <number>
201 <unix>3</unix>
202 <mac>3</mac>
203 <windows>3</windows>
204 </number>
205 <desc>Elevator trim down</desc>
206 <repeatable>true</repeatable>
207 <binding>
208 <command>nasal</command>
209 <script>controls.elevatorTrim(0.75)</script>
210 </binding>
211 <mod-shift>
212 <binding>
213 <command>nasal</command>
214 <script>
215 trace("Button 3 + shift pressed!");
216 if (engine_select_mode)
217 gui.popupTip("Saitek Quadrant: Propeller control");
218 engine_axis_mode = 2;
219 </script>
220 </binding>
221 </mod-shift>
222 </button>
223
224 <button>
225 <name>Right button up</name>
226 <number>
227 <unix>4</unix>
228 <mac>4</mac>
229 <windows>4</windows>
230 </number>
231 <desc>Gear up</desc>
232 <repeatable>false</repeatable>
233 <binding>
234 <command>nasal</command>
235 <script>controls.gearDown(-1)</script>
236 </binding>
237 </button>
238 <button>
239 <name>Right button down</name>
240 <number>
241 <unix>5</unix>
242 <mac>5</mac>
243 <windows>5</windows>
244 </number>
245 <desc>Gear down</desc>
246 <repeatable>false</repeatable>
247 <binding>
248 <command>nasal</command>
249 <script>controls.gearDown(1)</script>
250 </binding>
251 </button>
252
253 <!-- Axis reverse area switches. -->
254 <button>
255 <name>Left lever reverse</name>
256 <number>
257 <unix>6</unix>
258 <mac>6</mac>
259 <windows>6</windows>
260 </number>
261 <desc></desc>
262 <repeatable>false</repeatable>
263 <binding>
264 <command>nasal</command>
265 <script></script>
266 </binding>
267 </button>
268 <button>
269 <name>Middle lever reverse</name>
270 <number>
271 <unix>7</unix>
272 <mac>7</mac>
273 <windows>7</windows>
274 </number>
275 <desc></desc>
276 <repeatable>false</repeatable>
277 <binding>
278 <command>nasal</command>
279 <script></script>
280 </binding>
281 </button>
282 <button>
283 <name>Right lever reverse</name>
284 <number>
285 <unix>8</unix>
286 <mac>8</mac>
287 <windows>8</windows>
288 </number>
289 <desc></desc>
290 <repeatable>false</repeatable>
291 <binding>
292 <command>nasal</command>
293 <script></script>
294 </binding>
295 </button>
296
297 </PropertyList>