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