Merge branch 'master' of gitorious.org:fg/fgdata
[fg:toms-fgdata.git] / mice.xml
1 <?xml version="1.0"?>
2 <!--
3 Mouse binding definitions.
4
5 This is a independent configuration file: it is not part of the main
6 FlightGear property tree.
7
8 Currently, Glut supports only one mouse, but the configuration format
9 is designed to support additional mice in the future if possible.  The
10 current mode for each mouse is held in the
11 /devices/status/mice/mouse[n]/mode property.
12 -->
13
14 <PropertyList>
15
16  <mouse n="0">
17
18   <mode-count type="int">4</mode-count>
19   <mode archive="y" type="int">0</mode>
20
21
22   <mode n="0">
23    <cursor>inherit</cursor>
24    <constrained type="bool">false</constrained>
25    <pass-through type="bool">true</pass-through>
26
27    <button n="0">
28     <binding>
29      <condition>
30        <property>/sim/menubar/autovisibility/enabled</property>
31      </condition>
32      <command>property-assign</command>
33      <property>/sim/menubar/visibility</property>
34      <value type="bool">false</value>
35     </binding>
36    </button>
37
38    <button n="2">
39     <binding>
40         <command>cycle-mouse-mode</command>
41         <reason>right-click</reason>
42     </binding>
43    </button>
44
45    <!-- extra buttons control FoV -->
46    <!-- these are often assigned to mouse-wheel motion in Linux -->
47    <button n="3">
48     <binding>
49      <condition>
50        <and>
51          <property>/devices/status/mice/mouse[0]/button[2]</property>
52          <not><property>/sim/mouse/right-button-mode-cycle-enabled</property></not>
53        </and>
54      </condition>
55       <command>nasal</command>
56       <script>view.decrease()</script>
57     </binding>
58    </button>
59
60    <button n="4">
61     <binding>
62      <condition>
63        <and>
64          <property>/devices/status/mice/mouse[0]/button[2]</property>
65          <not><property>/sim/mouse/right-button-mode-cycle-enabled</property></not>
66        </and>
67      </condition>
68       <command>nasal</command>
69       <script>view.increase()</script>
70     </binding>
71    </button>
72  
73   </mode>
74
75   <mode n="1">
76    <cursor>crosshair</cursor>
77    <constrained type="bool">true</constrained>
78    <pass-through type="bool">false</pass-through>
79
80    <button n="2">
81     <binding>
82         <command>cycle-mouse-mode</command>
83         <reason>right-click</reason>
84     </binding>
85    </button>
86
87    <!-- extra buttons control elevator trim -->
88    <!-- these are often assigned to mouse-wheel motion in Linux -->
89    <button n="3">
90     <binding>
91      <command>property-adjust</command>
92      <property>/controls/flight/elevator-trim</property>
93      <step type="double">0.01</step>
94     </binding>
95    </button>
96
97    <button n="4">
98     <binding>
99      <command>property-adjust</command>
100      <property>/controls/flight/elevator-trim</property>
101      <step type="double">-0.01</step>
102     </binding>
103    </button>
104
105    <!-- Mouse left/right motion. -->
106    <x-axis>
107
108     <!-- No buttons pressed: control ailerons -->
109     <binding>
110      <condition>
111       <and>
112        <not>
113         <property>/devices/status/mice/mouse[0]/button[0]</property>
114        </not>
115        <not>
116         <property>/devices/status/mice/mouse[0]/button[1]</property>
117        </not>
118       </and>
119      </condition>
120      <command>property-adjust</command>
121      <property>/controls/flight/aileron</property>
122      <factor type="double">4.0</factor>
123      <min type="double">-1.0</min>
124      <max type="double">1.0</max>
125      <wrap type="bool">false</wrap>
126     </binding>
127
128     <!-- Left button pressed: control rudder -->
129     <binding>
130      <condition>
131       <and>
132        <property>/devices/status/mice/mouse[0]/button[0]</property>
133        <not>
134         <property>/devices/status/mice/mouse[0]/button[1]</property>
135        </not>
136       </and>
137      </condition>
138      <command>property-adjust</command>
139      <property>/controls/flight/rudder</property>
140      <factor type="double">4.0</factor>
141      <min type="double">-1.0</min>
142      <max type="double">1.0</max>
143      <wrap type="bool">false</wrap>
144     </binding>
145
146    </x-axis>
147
148    <!-- Mouse up/down motion -->
149    <y-axis>
150
151     <!-- No buttons pressed: control elevator -->
152     <binding>
153      <condition>
154       <and>
155        <not>
156         <property>/devices/status/mice/mouse[0]/button[0]</property>
157        </not>
158        <not>
159         <property>/devices/status/mice/mouse[0]/button[1]</property>
160        </not>
161       </and>
162      </condition>
163      <command>property-adjust</command>
164      <property>/controls/flight/elevator</property>
165      <factor type="double">-4.0</factor>
166      <min type="double">-1.0</min>
167      <max type="double">1.0</max>
168      <wrap type="bool">false</wrap>
169     </binding>
170
171     <!-- Middle button pressed: control throttle -->
172     <binding>
173      <command>nasal</command>
174      <script>controls.throttleMouse()</script>
175     </binding>
176    </y-axis>
177
178   </mode>
179
180   <!-- Mode 2: view mode -->
181   <mode n="2">
182    <cursor>left-right</cursor>
183    <constrained type="bool">true</constrained>
184    <pass-through type="bool">false</pass-through>
185
186    <!-- left button centres view direction; middle + left also resets view point -->
187    <button n="0">
188     <binding>
189      <command>nasal</command>
190      <script>
191          view.resetViewDir();
192          view.resetFOV();
193      </script>
194     </binding>
195     <binding>
196      <condition>
197       <property>/devices/status/mice/mouse[0]/button[1]</property>
198      </condition>
199      <command>nasal</command>
200      <script>
201          view.resetViewPos();
202      </script>
203     </binding>
204    </button>
205
206    <!-- right button switches modes -->
207    <button n="2">
208     <binding>
209         <command>cycle-mouse-mode</command>
210         <reason>right-click</reason>
211     </binding>
212    </button>
213    
214  
215    <!-- extra buttons control FoV -->
216    <!-- these are often assigned to mouse-wheel motion in Linux -->
217    <button n="3">
218     <binding>
219       <command>nasal</command>
220       <script>view.decrease()</script>
221     </binding>
222    </button>
223
224    <button n="4">
225     <binding>
226       <command>nasal</command>
227       <script>view.increase()</script>
228     </binding>
229    </button>
230
231    <!-- Mouse left/right motion -->
232    <x-axis>
233
234     <!-- No buttons pressed: rotate the view left or right -->
235     <binding>
236      <condition>
237       <and>
238        <not>
239         <property>/devices/status/mice/mouse[0]/button[0]</property>
240        </not>
241        <not>
242         <property>/devices/status/mice/mouse[0]/button[1]</property>
243        </not>
244       </and>
245      </condition>
246      <command>property-adjust</command>
247      <property>/sim/current-view/heading-offset-deg</property>
248      <factor type="double">-360</factor>
249      <min type="double">0</min>
250      <max type="double">360</max>
251      <wrap type="bool">true</wrap>
252     </binding>
253
254
255     <!-- Middle button pressed: move the view position left or right -->
256     <binding>
257      <condition>
258       <and>
259        <not>
260         <property>/devices/status/mice/mouse[0]/button[0]</property>
261        </not>
262        <property>/devices/status/mice/mouse[0]/button[1]</property>
263       </and>
264      </condition>
265      <command>property-adjust</command>
266      <property>/sim/current-view/x-offset-m</property>
267      <factor type="double">1</factor>
268      <wrap type="bool">false</wrap>
269     </binding>
270
271    </x-axis>
272
273    <!-- Mouse up/down motion -->
274    <y-axis>
275
276     <!-- No buttons pressed: tilt the view up and down -->
277     <binding>
278      <condition>
279       <and>
280        <not>
281         <property>/devices/status/mice/mouse[0]/button[0]</property>
282        </not>
283        <not>
284         <property>/devices/status/mice/mouse[0]/button[1]</property>
285        </not>
286       </and>
287      </condition>
288      <command>property-adjust</command>
289      <property>/sim/current-view/pitch-offset-deg</property>
290      <factor type="double">-180</factor>
291      <min type="double">-90</min>
292      <max type="double">90</max>
293      <wrap type="bool">false</wrap>
294     </binding>
295
296     <!-- Middle button pressed move the view up and down -->
297     <binding>
298      <condition>
299       <and>
300        <not>
301         <property>/devices/status/mice/mouse[0]/button[0]</property>
302        </not>
303        <property>/devices/status/mice/mouse[0]/button[1]</property>
304       </and>
305      </condition>
306      <command>property-adjust</command>
307      <property>/sim/current-view/y-offset-m</property>
308      <factor type="double">-1</factor>
309      <wrap type="bool">false</wrap>
310     </binding>
311
312    </y-axis>
313
314 <!-- Middle button and Ctrl pressed: move the view forward and backward -->
315    <y-axis-ctrl>
316        <binding>
317         <condition>
318          <and>
319           <not>
320            <property>/devices/status/mice/mouse[0]/button[0]</property>
321           </not>
322           <property>/devices/status/mice/mouse[0]/button[1]</property>
323          </and>
324         </condition>
325         <command>property-adjust</command>
326         <property>/sim/current-view/z-offset-m</property>
327         <factor type="double">1</factor>
328         <wrap type="bool">false</wrap>
329        </binding>
330     </y-axis-ctrl>
331     
332   </mode>
333
334   <!-- Mode 3: spring-loaded-view mode -->
335   <mode n="3">
336    <cursor>left-right</cursor>
337    <constrained type="bool">true</constrained>
338    <pass-through type="bool">false</pass-through>
339
340    <!-- Mouse left/right motion -->
341    <x-axis>
342
343     <!-- rotate the view left or right -->
344     <binding>
345      <condition>
346       <not>
347        <property>/devices/status/mice/mouse[0]/button[1]</property>
348       </not>
349      </condition>
350      <command>property-adjust</command>
351      <property>/sim/current-view/heading-offset-deg</property>
352      <factor type="double">-360</factor>
353      <min type="double">0</min>
354      <max type="double">360</max>
355      <wrap type="bool">true</wrap>
356     </binding>
357
358     <!-- Middle button pressed: move the view position left or right -->
359     <binding>
360      <condition>
361       <property>/devices/status/mice/mouse[0]/button[1]</property>
362      </condition>
363      <command>property-adjust</command>
364      <property>/sim/current-view/x-offset-m</property>
365      <factor type="double">1</factor>
366      <wrap type="bool">false</wrap>
367     </binding>
368
369    </x-axis>
370
371    <!-- Mouse up/down motion -->
372    <y-axis>
373
374     <!-- tilt the view up and down -->
375     <binding>
376      <condition>
377       <not>
378        <property>/devices/status/mice/mouse[0]/button[1]</property>
379       </not>
380      </condition>
381      <command>property-adjust</command>
382      <property>/sim/current-view/pitch-offset-deg</property>
383      <factor type="double">-180</factor>
384      <min type="double">-90</min>
385      <max type="double">90</max>
386      <wrap type="bool">false</wrap>
387     </binding>
388
389     <!-- Middle button pressed move the view up and down -->
390     <binding>
391      <condition>
392       <property>/devices/status/mice/mouse[0]/button[1]</property>
393      </condition>
394      <command>property-adjust</command>
395      <property>/sim/current-view/y-offset-m</property>
396      <factor type="double">-1</factor>
397      <wrap type="bool">false</wrap>
398     </binding>
399
400    </y-axis>
401
402    <y-axis-ctrl>
403        <!-- Middle button and Ctrl pressed: move the view forward and backward -->
404        <binding>
405         <condition>
406          <property>/devices/status/mice/mouse[0]/button[1]</property>
407         </condition>
408         <command>property-adjust</command>
409         <property>/sim/current-view/z-offset-m</property>
410         <factor type="double">1</factor>
411         <wrap type="bool">false</wrap>
412        </binding>
413
414        <binding>
415          <condition>
416            <not><property>/devices/status/mice/mouse[0]/button[1]</property></not>
417          </condition>
418          <command>property-adjust</command>
419          <property>/sim/current-view/y-offset-m</property>
420          <factor type="double">-1</factor>
421          <wrap type="bool">false</wrap>
422        </binding>
423     </y-axis-ctrl>
424
425     <x-axis-ctrl>
426        <binding>
427          <command>property-adjust</command>
428          <property>/sim/current-view/x-offset-m</property>
429          <factor type="double">1</factor>
430          <wrap type="bool">false</wrap>
431        </binding>
432     </x-axis-ctrl>
433
434   </mode>
435     
436  </mouse> <!-- of mouse 0 -->
437
438 </PropertyList>
439