Remove fragile alias references in bindings and replace with property
[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 the offsets -->
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/current-view/config/pitch-offset-deg</property>
178     </binding>
179    </button>
180
181    <!-- right button switches modes -->
182    <button n="2">
183     <binding>
184      <command>property-assign</command>
185      <property>/devices/status/mice/mouse[0]/mode</property>
186      <value type="int">0</value>
187     </binding>
188    </button>
189
190    <!-- extra buttons control elevator trim -->
191    <!-- these are often assigned to mouse-wheel motion in Linux -->
192    <button n="3">
193     <binding>
194      <command>property-adjust</command>
195      <property>/controls/flight/elevator-trim</property>
196      <step type="double">0.01</step>
197     </binding>
198    </button>
199
200    <button n="4">
201     <binding>
202      <command>property-adjust</command>
203      <property>/controls/flight/elevator-trim</property>
204      <step type="double">-0.01</step>
205     </binding>
206    </button>
207
208    <!-- Mouse left/right motion -->
209    <x-axis>
210
211     <!-- No buttons pressed: move the view position left or right -->
212     <binding>
213      <condition>
214       <and>
215        <not>
216         <property>/devices/status/mice/mouse[0]/button[0]</property>
217        </not>
218        <not>
219         <property>/devices/status/mice/mouse[0]/button[1]</property>
220        </not>
221       </and>
222      </condition>
223      <command>property-adjust</command>
224      <property>/sim/current-view/heading-offset-deg</property>
225      <factor type="double">-360</factor>
226      <min type="double">0</min>
227      <max type="double">360</max>
228      <wrap type="bool">true</wrap>
229     </binding>
230
231    </x-axis>
232
233    <!-- Mouse up/down motion -->
234    <y-axis>
235
236     <!-- No buttons pressed: tilt the view up and down -->
237     <binding>
238      <condition>
239       <and>
240        <not>
241         <property>/devices/status/mice/mouse[0]/button[0]</property>
242        </not>
243        <not>
244         <property>/devices/status/mice/mouse[0]/button[1]</property>
245        </not>
246       </and>
247      </condition>
248      <command>property-adjust</command>
249      <property>/sim/current-view/pitch-offset-deg</property>
250      <factor type="double">-180</factor>
251      <min type="double">-90</min>
252      <max type="double">90</max>
253      <wrap type="bool">false</wrap>
254     </binding>
255    </y-axis>
256
257   </mode>
258
259  </mouse>
260
261 </PropertyList>
262