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