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