1
0
Fork 0
fgdata/gui/dialogs/sound.xml

287 lines
6 KiB
XML
Raw Normal View History

<?xml version="1.0"?>
<!-- Sound control dialog -->
<PropertyList>
<name>sound-dialog</name>
<modal>false</modal>
<width>400</width>
<layout>vbox</layout>
<text>
<label>Sound Configuration</label>
</text>
<hrule/>
<group>
<layout>hbox</layout>
<text>
<halign>right</halign>
<label>Sound Device:</label>
</text>
<combo>
<name>source-selection</name>
<halign>fill</halign>
<stretch>true</stretch>
<property>sim/gui/dialogs/sound-dialog/source-selection</property>
<binding>
<command>dialog-apply</command>
<object-name>source-selection</object-name>
</binding>
<binding>
<command>dialog-update</command>
<object-name>sound-dialog</object-name>
</binding>
</combo>
</group>
<hrule/>
<group>
<layout>table</layout>
<halign>center</halign>
<text>
<row>0</row>
<col>0</col>
<label>Channel</label>
<padding>10</padding>
</text>
<text>
<row>0</row>
<col>1</col>
<label>Enabled</label>
<padding>10</padding>
</text>
<text>
<row>0</row>
<col>2</col>
<label>Volume</label>
<padding>10</padding>
</text>
<text>
<row>0</row>
<col>3</col>
<label>External</label>
<padding>10</padding>
</text>
<text>
<row>1</row>
<col>0</col>
<label>Master</label>
<halign>left</halign>
</text>
<checkbox>
<row>1</row>
<col>1</col>
<property>/sim/sound/enabled</property>
<binding>
<command>dialog-apply</command>
</binding>
</checkbox>
<slider>
<row>1</row>
<col>2</col>
<property>/sim/sound/volume</property>
<binding>
<command>dialog-apply</command>
</binding>
</slider>
<text>
<row>2</row>
<col>0</col>
<label>Effects</label>
<halign>left</halign>
</text>
<checkbox>
<row>2</row>
<col>1</col>
<property>/sim/sound/effects/enabled</property>
<binding>
<command>dialog-apply</command>
</binding>
</checkbox>
<slider>
<row>2</row>
<col>2</col>
<property>/sim/sound/effects/volume</property>
<binding>
<command>dialog-apply</command>
</binding>
</slider>
<text>
<row>3</row>
<col>0</col>
<label>Chatter</label>
<halign>left</halign>
</text>
<checkbox>
<row>3</row>
<col>1</col>
<property>/sim/sound/chatter/enabled</property>
<binding>
<command>dialog-apply</command>
</binding>
</checkbox>
<slider>
<row>3</row>
<col>2</col>
<property>/sim/sound/chatter/volume</property>
<binding>
<command>dialog-apply</command>
</binding>
</slider>
<text>
<row>4</row>
<col>0</col>
<label>Avionics</label>
<halign>left</halign>
</text>
<checkbox>
<row>4</row>
<col>1</col>
<property>/sim/sound/avionics/enabled</property>
<binding>
<command>dialog-apply</command>
</binding>
</checkbox>
<slider>
<row>4</row>
<col>2</col>
<property>/sim/sound/avionics/volume</property>
<binding>
<command>dialog-apply</command>
</binding>
</slider>
<checkbox>
<row>4</row>
<col>3</col>
<property>/sim/sound/avionics/external-view</property>
<binding>
<command>dialog-apply</command>
</binding>
</checkbox>
<text>
<row>5</row>
<col>0</col>
<label>ATC</label>
<halign>left</halign>
</text>
<checkbox>
<row>5</row>
<col>1</col>
<property>/sim/sound/atc/enabled</property>
<binding>
<command>dialog-apply</command>
</binding>
</checkbox>
<slider>
<row>5</row>
<col>2</col>
<property>/sim/sound/atc/volume</property>
<binding>
<command>dialog-apply</command>
</binding>
</slider>
<checkbox>
<row>5</row>
<col>3</col>
<property>/sim/sound/atc/external-view</property>
<binding>
<command>dialog-apply</command>
</binding>
</checkbox>
</group>
<hrule/>
<group>
<layout>hbox</layout>
<default-padding>10</default-padding>
<button>
<legend>Apply</legend>
<key>Enter</key>
<binding>
<command>nasal</command>
<script>apply()</script>
</binding>
<binding>
<command>dialog-apply</command>
</binding>
</button>
<button>
<legend>Close</legend>
<default>true</default>
<key>Esc</key>
<binding>
<command>dialog-close</command>
</binding>
</button>
</group>
<nasal>
<open><![CDATA[
var dlg_root = cmdarg();
var findElementByName = func(rootN, name) {
foreach( var child; rootN.getChildren() ) {
var n = child.getNode( "name" );
if( n != nil and n.getValue() == name )
return child;
var f = findElementByName(child,name);
if( f != nil ) return f;
}
return nil;
};
# Fill the sound device combo box
var combo = findElementByName( dlg_root, "source-selection" );
var wsn = props.globals.getNode( "sim/sound/devices" );
if( wsn != nil ) {
var devices = wsn.getChildren("device");
forindex (var i; devices )
combo.getChild("value", i, 1).setValue(devices[i].getValue());
}
var apply = func {
var new = getprop("sim/gui/dialogs/sound-dialog/source-selection");
var current = getprop("sim/sound/device-name");
if (cmp(current, new) != 0) {
setprop("sim/sound/devices/name", new);
setprop("sim/sound/device-name", new);
}
}
# initialization
var default_device = getprop("sim/sound/device-name");
setprop( "sim/gui/dialogs/sound-dialog/source-selection", default_device);
]]></open>
</nasal>
</PropertyList>