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