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