New Nasal code, with lots of input binding handlers in controls.nas.
[fg:toms-fgdata.git] / mice.xml
1 <?xml version="1.0"?>
2 <!--
3 Mouse binding definitions.
4
5 NOTE: CURRENTLY, THIS FILE IS USED ONLY IF YOU CONFIGURE FLIGHTGEAR
6 'with-new-mouse' AT BUILD TIME.
7
8 This file is included by preferences.xml, and uses the context of its
9 inclusion point; that means that you need to prepend "/input/mice"
10 to all property names.
11
12 Currently, Glut supports only one mouse, but the configuration format
13 is designed to support additional mice in the future if possible.
14
15 The current mode for each mouse is held in the
16 /devices/status/mice/mouse[n]/mode property.
17 -->
18
19
20 <PropertyList>
21
22  <mouse n="0">
23
24   <mode-count type="int">3</mode-count>
25   <mode archive="y" type="int">0</mode>
26
27
28   <mode n="0">
29    <cursor>inherit</cursor>
30    <constrained type="bool">false</constrained>
31    <pass-through type="bool">true</pass-through>
32
33    <button n="2">
34     <binding>
35      <command>property-assign</command>
36      <property>/devices/status/mice/mouse[0]/mode</property>
37      <value type="int">1</value>
38     </binding>
39    </button>
40
41    <!-- extra buttons control elevator trim -->
42    <!-- these are often assigned to mouse-wheel motion in Linux -->
43    <button n="3">
44     <binding>
45      <command>property-adjust</command>
46      <property>/controls/flight/elevator-trim</property>
47      <step type="double">0.002</step>
48     </binding>
49    </button>
50
51    <button n="4">
52     <binding>
53      <command>property-adjust</command>
54      <property>/controls/flight/elevator-trim</property>
55      <step type="double">-0.002</step>
56     </binding>
57    </button>
58
59   </mode>
60
61   <mode n="1">
62    <cursor>crosshair</cursor>
63    <constrained type="bool">true</constrained>
64    <pass-through type="bool">false</pass-through>
65
66    <button n="2">
67     <binding>
68      <command>property-assign</command>
69      <property>/devices/status/mice/mouse[0]/mode</property>
70      <value type="int">2</value>
71     </binding>
72    </button>
73
74    <!-- extra buttons control elevator trim -->
75    <!-- these are often assigned to mouse-wheel motion in Linux -->
76    <button n="3">
77     <binding>
78      <command>property-adjust</command>
79      <property>/controls/flight/elevator-trim</property>
80      <step type="double">0.01</step>
81     </binding>
82    </button>
83
84    <button n="4">
85     <binding>
86      <command>property-adjust</command>
87      <property>/controls/flight/elevator-trim</property>
88      <step type="double">-0.01</step>
89     </binding>
90    </button>
91
92    <!-- Mouse left/right motion. -->
93    <x-axis>
94
95     <!-- No buttons pressed: control ailerons -->
96     <binding>
97      <condition>
98       <and>
99        <not>
100         <property>/devices/status/mice/mouse[0]/button[0]</property>
101        </not>
102        <not>
103         <property>/devices/status/mice/mouse[0]/button[1]</property>
104        </not>
105       </and>
106      </condition>
107      <command>property-adjust</command>
108      <property>/controls/flight/aileron</property>
109      <factor type="double">4.0</factor>
110      <min type="double">-1.0</min>
111      <max type="double">1.0</max>
112      <wrap type="bool">false</wrap>
113     </binding>
114
115     <!-- Left button pressed: control rudder -->
116     <binding>
117      <condition>
118       <and>
119        <property>/devices/status/mice/mouse[0]/button[0]</property>
120        <not>
121         <property>/devices/status/mice/mouse[0]/button[1]</property>
122        </not>
123       </and>
124      </condition>
125      <command>property-adjust</command>
126      <property>/controls/flight/rudder</property>
127      <factor type="double">4.0</factor>
128      <min type="double">-1.0</min>
129      <max type="double">1.0</max>
130      <wrap type="bool">false</wrap>
131     </binding>
132
133    </x-axis>
134
135    <!-- Mouse up/down motion -->
136    <y-axis>
137
138     <!-- No buttons pressed: control elevator -->
139     <binding>
140      <condition>
141       <and>
142        <not>
143         <property>/devices/status/mice/mouse[0]/button[0]</property>
144        </not>
145        <not>
146         <property>/devices/status/mice/mouse[0]/button[1]</property>
147        </not>
148       </and>
149      </condition>
150      <command>property-adjust</command>
151      <property>/controls/flight/elevator</property>
152      <factor type="double">-4.0</factor>
153      <min type="double">-1.0</min>
154      <max type="double">1.0</max>
155      <wrap type="bool">false</wrap>
156     </binding>
157
158     <!-- Middle button pressed: control throttle -->
159     <binding>
160      <command>nasal</command>
161      <script>controls.throttleMouse()</script>
162     </binding>
163    </y-axis>
164
165   </mode>
166
167   <!-- Mode 2: view mode -->
168   <mode n="2">
169    <cursor>left-right</cursor>
170    <constrained type="bool">true</constrained>
171    <pass-through type="bool">false</pass-through>
172
173    <!-- left button centres the offsets -->
174    <button n="0">
175     <binding>
176      <command>property-assign</command>
177      <property>/sim/current-view/heading-offset-deg</property>
178      <value alias="/sim/view/config/front-direction-deg"/>
179     </binding>
180     <binding>
181      <command>property-assign</command>
182      <property>/sim/current-view/goal-pitch-offset-deg</property>
183      <property>/sim/current-view/config/pitch-offset-deg</property>
184     </binding>
185    </button>
186
187    <!-- right button switches modes -->
188    <button n="2">
189     <binding>
190      <command>property-assign</command>
191      <property>/devices/status/mice/mouse[0]/mode</property>
192      <value type="int">0</value>
193     </binding>
194    </button>
195
196    <!-- extra buttons control elevator trim -->
197    <!-- these are often assigned to mouse-wheel motion in Linux -->
198    <button n="3">
199     <binding>
200      <command>property-adjust</command>
201      <property>/controls/flight/elevator-trim</property>
202      <step type="double">0.01</step>
203     </binding>
204    </button>
205
206    <button n="4">
207     <binding>
208      <command>property-adjust</command>
209      <property>/controls/flight/elevator-trim</property>
210      <step type="double">-0.01</step>
211     </binding>
212    </button>
213
214    <!-- Mouse left/right motion -->
215    <x-axis>
216
217     <!-- No buttons pressed: move the view position 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    </x-axis>
238
239    <!-- Mouse up/down motion -->
240    <y-axis>
241
242     <!-- No buttons pressed: tilt the view up and down -->
243     <binding>
244      <condition>
245       <and>
246        <not>
247         <property>/devices/status/mice/mouse[0]/button[0]</property>
248        </not>
249        <not>
250         <property>/devices/status/mice/mouse[0]/button[1]</property>
251        </not>
252       </and>
253      </condition>
254      <command>property-adjust</command>
255      <property>/sim/current-view/pitch-offset-deg</property>
256      <factor type="double">-180</factor>
257      <min type="double">-90</min>
258      <max type="double">90</max>
259      <wrap type="bool">false</wrap>
260     </binding>
261    </y-axis>
262
263   </mode>
264
265  </mouse>
266
267 </PropertyList>
268