<?xml version="1.0" encoding="UTF-8"?>

<PropertyList>

	<name>dualcontrol-dlg</name>
	<layout>vbox</layout>

	<group>
		<layout>hbox</layout>

		<empty>
			<stretch>1</stretch>
		</empty>

		<text>
			<label>Select pilot aircraft type</label>
		</text>

		<empty>
			<stretch>1</stretch>
		</empty>

		<button>
			<pref-width>16</pref-width>
			<pref-height>16</pref-height>
			<legend></legend>
			<keynum>27</keynum>
			<border>2</border>
			<binding>
				<command>dialog-close</command>
			</binding>
		</button>
	</group>

	<hrule/>

	<text>
		<label>Select the CRJ700 model the pilot is flying.</label>
	</text>

	<combo>
		<property>sim/gui/dialogs/dual-control/dialog/selected-model</property>
		<value>CRJ700</value>
		<value>CRJ900</value>
		<value>CRJ1000</value>
		<live type="bool">true</live>
		<binding>
			<command>dialog-apply</command>
		</binding>
	</combo>

	<group>
		<layout>vbox</layout>

		<button>
			<legend>OK</legend>
			<default>true</default>
			<padding>10</padding>
			<binding>
				<command>nasal</command>
				<script>
					var model = getprop("sim/gui/dialogs/dual-control/dialog/selected-model");
					
					var setN = io.read_properties("" ~ model ~ "-set.xml");
					setprop("sim/view[0]/config/z-offset-m", setN.getNode("sim/view[0]/config/z-offset-m").getValue());
					setprop("sim/view[100]/config/z-offset-m", setN.getNode("sim/view[100]/config/z-offset-m").getValue());
					setprop("sim/view[101]/config/z-offset-m", setN.getNode("sim/view[101]/config/z-offset-m").getValue());
					
					aircraft_dual_control.pilot_type = "Models/" ~ model ~ ".xml";
					dual_control_tools.copilot_dialog.show(aircraft_dual_control.pilot_type);
				</script>
			</binding>
			<binding>
				<command>dialog-close</command>
			</binding>
		</button>
	</group>

</PropertyList>
