Checkbox for AI sound support.
[fg:toms-fgdata.git] / gui / dialogs / sound.xml
1 <?xml version="1.0"?>
2
3 <!-- Sound control dialog -->
4
5 <PropertyList>
6   <name>sound-dialog</name>
7   <modal>false</modal>
8   <width>400</width>
9   <layout>vbox</layout>
10
11   <group>
12     <layout>hbox</layout>
13           <empty><stretch>1</stretch></empty>
14
15     <text>
16       <label>Sound Configuration</label>
17     </text>
18
19           <empty><stretch>1</stretch></empty>
20
21     <button>
22       <pref-width>16</pref-width>
23       <pref-height>16</pref-height>
24       <legend></legend>
25       <keynum>27</keynum>
26       <border>2</border>
27       <binding>
28         <command>dialog-close</command>
29       </binding>
30     </button>
31   </group>
32
33   <hrule/>
34
35   <group>
36     <layout>hbox</layout>
37     <text>
38     <halign>right</halign>
39     <label>Sound Device:</label>
40     </text>
41
42     <combo>
43       <name>source-selection</name>
44       <halign>fill</halign>
45       <stretch>true</stretch>
46       <property>sim/gui/dialogs/sound-dialog/source-selection</property>
47       <binding>
48         <command>dialog-apply</command>
49         <object-name>source-selection</object-name>
50       </binding>
51       <binding>
52         <command>dialog-update</command>
53         <object-name>sound-dialog</object-name>
54       </binding>
55     </combo>
56   </group>
57
58   <hrule/>
59
60   <group>
61     <layout>table</layout>
62     <halign>center</halign>
63
64     <text>
65       <row>0</row>
66       <col>0</col>
67       <label>Channel</label>
68       <padding>10</padding>
69     </text>
70
71     <text>
72       <row>0</row>
73       <col>1</col>
74       <label>Enabled</label>
75       <padding>10</padding>
76     </text>
77
78     <text>
79       <row>0</row>
80       <col>2</col>
81       <label>Volume</label>
82       <padding>10</padding>
83     </text>
84
85     <text>
86       <row>0</row>
87       <col>3</col>
88       <label>External</label>
89       <padding>10</padding>
90     </text>
91
92     <text>
93       <row>1</row>
94       <col>0</col>
95       <label>Master</label>
96       <halign>left</halign>
97     </text>
98
99     <checkbox>
100       <row>1</row>
101       <col>1</col>
102       <property>/sim/sound/enabled</property>
103       <binding>
104         <command>dialog-apply</command>
105       </binding>
106     </checkbox>
107
108     <slider>
109       <row>1</row>
110       <col>2</col>
111       <property>/sim/sound/volume</property>
112       <binding>
113         <command>dialog-apply</command>
114       </binding>
115     </slider>
116
117     <text>
118       <row>2</row>
119       <col>0</col>
120       <label>Effects</label>
121       <halign>left</halign>
122           <enable>
123         <property>/sim/sound/enabled</property>
124       </enable>
125     </text>
126
127     <checkbox>
128       <row>2</row>
129       <col>1</col>
130       <property>/sim/sound/effects/enabled</property>
131       <binding>
132         <command>dialog-apply</command>
133       </binding>
134           <enable>
135         <property>/sim/sound/enabled</property>
136       </enable>
137     </checkbox>
138
139     <slider>
140       <row>2</row>
141       <col>2</col>
142       <property>/sim/sound/effects/volume</property>
143       <binding>
144         <command>dialog-apply</command>
145       </binding>
146           <enable>
147         <property>/sim/sound/enabled</property>
148       </enable>
149     </slider>
150
151     <text>
152       <row>3</row>
153       <col>0</col>
154       <label>Chatter</label>
155       <halign>left</halign>
156           <enable>
157         <property>/sim/sound/enabled</property>
158       </enable>
159     </text>
160
161     <checkbox>
162       <row>3</row>
163       <col>1</col>
164       <property>/sim/sound/chatter/enabled</property>
165       <binding>
166         <command>dialog-apply</command>
167       </binding>
168           <enable>
169         <property>/sim/sound/enabled</property>
170       </enable>
171     </checkbox>
172
173     <slider>
174       <row>3</row>
175       <col>2</col>
176       <property>/sim/sound/chatter/volume</property>
177       <binding>
178         <command>dialog-apply</command>
179       </binding>
180           <enable>
181         <property>/sim/sound/enabled</property>
182       </enable>
183     </slider>
184
185     <text>
186       <row>4</row>
187       <col>0</col>
188       <label>Avionics</label>
189       <halign>left</halign>
190           <enable>
191         <property>/sim/sound/enabled</property>
192       </enable>
193     </text>
194
195     <checkbox>
196       <row>4</row>
197       <col>1</col>
198       <property>/sim/sound/avionics/enabled</property>
199       <binding>
200         <command>dialog-apply</command>
201       </binding>
202           <enable>
203         <property>/sim/sound/enabled</property>
204       </enable>
205     </checkbox>
206
207     <slider>
208       <row>4</row>
209       <col>2</col>
210       <property>/sim/sound/avionics/volume</property>
211       <binding>
212         <command>dialog-apply</command>
213       </binding>
214           <enable>
215         <property>/sim/sound/enabled</property>
216       </enable>
217     </slider>
218
219     <checkbox>
220       <row>4</row>
221       <col>3</col>
222       <property>/sim/sound/avionics/external-view</property>
223       <binding>
224         <command>dialog-apply</command>
225       </binding>
226           <enable>
227         <property>/sim/sound/enabled</property>
228       </enable>
229     </checkbox>
230
231     <text>
232       <row>5</row>
233       <col>0</col>
234       <label>ATC</label>
235       <halign>left</halign>
236           <enable>
237         <property>/sim/sound/enabled</property>
238       </enable>
239     </text>
240
241     <checkbox>
242       <row>5</row>
243       <col>1</col>
244       <property>/sim/sound/atc/enabled</property>
245       <binding>
246         <command>dialog-apply</command>
247       </binding>
248           <enable>
249         <property>/sim/sound/enabled</property>
250       </enable>
251     </checkbox>
252
253     <slider>
254       <row>5</row>
255       <col>2</col>
256       <property>/sim/sound/atc/volume</property>
257       <binding>
258         <command>dialog-apply</command>
259       </binding>
260           <enable>
261         <property>/sim/sound/enabled</property>
262       </enable>
263     </slider>
264
265     <checkbox>
266       <row>5</row>
267       <col>3</col>
268       <property>/sim/sound/atc/external-view</property>
269       <binding>
270         <command>dialog-apply</command>
271       </binding>
272           <enable>
273         <property>/sim/sound/enabled</property>
274       </enable>
275     </checkbox>
276
277     <text>
278       <row>6</row>
279       <col>0</col>
280       <label>AI/MP</label>
281       <halign>left</halign>
282           <enable>
283         <property>/sim/sound/enabled</property>
284       </enable>
285     </text>
286
287     <checkbox>
288       <row>6</row>
289       <col>1</col>
290       <property>/sim/sound/aimodels/enabled</property>
291       <binding>
292         <command>dialog-apply</command>
293       </binding>
294           <enable>
295         <property>/sim/sound/enabled</property>
296       </enable>
297     </checkbox>
298   </group>
299
300   <hrule/>
301
302   <group>
303     <layout>hbox</layout>
304     <default-padding>10</default-padding>
305
306     <button>
307       <legend>Apply</legend>
308       <key>Enter</key>
309       <binding>
310         <command>nasal</command>
311         <script>apply()</script>
312       </binding>
313       <binding>
314         <command>dialog-apply</command>
315       </binding>
316     </button>
317
318     <button>
319       <legend>Close</legend>
320       <default>true</default>
321       <key>Esc</key>
322       <binding>
323         <command>dialog-close</command>
324       </binding>
325     </button>
326   </group>
327
328   <nasal>
329     <open><![CDATA[
330       var dlg_root = cmdarg();
331
332       var findElementByName = func(rootN, name) {
333         foreach( var child; rootN.getChildren() ) {
334           var n = child.getNode( "name" );
335           if( n != nil and n.getValue() == name )
336             return child;
337           var f = findElementByName(child,name);
338           if( f != nil ) return f;
339         }
340         return nil;
341       };
342
343       # Fill the sound device combo box
344       var combo = findElementByName( dlg_root, "source-selection" );
345       var wsn = props.globals.getNode( "sim/sound/devices" );
346       if( wsn != nil ) {
347         var devices = wsn.getChildren("device");
348         forindex (var i; devices )
349           combo.getChild("value", i, 1).setValue(devices[i].getValue());
350       }
351
352       var apply = func {
353         var new = getprop("sim/gui/dialogs/sound-dialog/source-selection");
354         var current = getprop("sim/sound/device-name");
355         if (cmp(current, new) != 0) {
356           setprop("sim/sound/devices/name", new);
357           setprop("sim/sound/device-name", new);
358         }
359       }
360
361       # initialization
362       var default_device = getprop("sim/sound/device-name");
363       setprop( "sim/gui/dialogs/sound-dialog/source-selection", default_device);
364
365     ]]></open>
366   </nasal>
367
368 </PropertyList>