<?xml version="1.0"?>

<!-- DaSH
 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License as
 published by the Free Software Foundation; either version 2 of the
 License, or (at your option) any later version.

 This program is distributed in the hope that it will be useful, but
 WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 General Public License for more details.
-->

<PropertyList>

    <name>aircraft-dialog</name>
    <layout>vbox</layout>
	<default-padding>6</default-padding>
    <resizable>true</resizable>
    <draggable>true</draggable>

    <nasal>
        <open>   
            # Kremer prize course pole type
            var p = getprop("/sim/rendering/course-pole-type");
            setprop("sim/model/dash/poletype_flag_0", 0);
            setprop("sim/model/dash/poletype_flag_1", 0);
            setprop("sim/model/dash/poletype_flag_" ~ p, 1);

            # Channel Crossing Startup Positions
            var p = getprop("/sim/model/startup/location");
            setprop("sim/model/dash/startup/ramp_flag_0", 0);
            setprop("sim/model/dash/startup/ramp_flag_1", 0);
            setprop("sim/model/dash/startup/ramp_flag_2", 0);
            setprop("sim/model/dash/startup/ramp_flag_3", 0);
            setprop("sim/model/dash/startup/ramp_flag_" ~ p, 1);

        </open>
    </nasal>

	<group>
		<layout>hbox</layout>
		<default-padding>1</default-padding>
		<empty><stretch>true</stretch></empty>
		<text>
			<label>Aircraft Options</label>
		</text>
		<empty><stretch>true</stretch></empty>
		<button>
			<legend></legend>
			<key>Esc</key>
			<pref-width>16</pref-width>
			<pref-height>16</pref-height>
			<border>2</border>
			<binding>
				<command>dialog-close</command>
			</binding>
		</button>
	</group>

    <hrule/>

	<group>
		<layout>vbox</layout>
		<halign>left</halign>
        <empty><stretch>true</stretch></empty>
		<checkbox>
			<halign>left</halign>
			<label>Magnetic Compass</label>
			<property>/sim/rendering/compass</property>
			<live>true</live>
			<binding>
				<command>property-toggle</command>
				<property>/sim/rendering/compass</property>
			</binding>
		</checkbox>
		<checkbox>
			<halign>left</halign>
			<label>Human models</label>
			<property>/sim/model/occupants</property>
			<live>true</live>
			<binding>
				<command>dialog-apply</command>
			</binding>
		</checkbox>
	</group>

	<hrule/>

	<group>
		<layout>vbox</layout>
        <empty><stretch>true</stretch></empty>
		<checkbox>
			<halign>left</halign>
			<label>Folkestone Ramp</label>
			<property>/sim/rendering/ramp</property>
			<!--enable>
			  <and>
				<not>
				  <property>/sim/freeze/replay-state</property>
				</not>
				<property>/sim/startup/airport-location</property>
			  </and>
			</enable-->
			<binding>
				<command>property-toggle</command>
				<property>/sim/rendering/ramp</property>
			</binding>
		</checkbox>
	</group>

	<hrule/>

	<!--checkbox>
		<halign>left</halign>
		<label>Course Object Ranging On/Off</label>
		<property>/sim/gui/show-range</property>
		<binding>
			<command>property-toggle</command>
			<property>/sim/gui/show-range</property>
		</binding>
	</checkbox-->

	<group>
		<layout>vbox</layout>
        <empty><stretch>true</stretch></empty>
		<button>
			<halign>center</halign>
			<legend>Start Kremer Course</legend>
			<property>/sim/rendering/course</property>
			<enable>
				<and>
					<not>
						<property>/sim/freeze/replay-state</property>
					</not>
					<property>/sim/startup/airport-location</property>
				</and>
			</enable>
			<binding>
				<command>property-toggle</command>
				<property>/sim/rendering/course</property>
			</binding>
		</button>
		<layout>vbox</layout>
		<text>
			<label>Kremer Course Pole Type</label>
			<halign>center</halign>
		</text>
		<group>
			<layout>hbox</layout>
			<radio>
				<halign>center</halign>
				<label>Goal post</label>
				<property>sim/model/dash/poletype_flag_0</property>
				<live>true</live>
				<enable>
					<and>
						<not>
							<property>/sim/freeze/replay-state</property>
						</not>
						<property>/sim/rendering/course</property>
						<property>/sim/startup/airport-location</property>
						<not>
							<property>/sim/course/running</property>
						</not>
					</and>
				</enable>
				<binding>
					<command>dialog-apply</command>
				</binding>
				<binding>
					<command>nasal</command>
					<script>
						setprop("/sim/rendering/course-pole-type", 0);
						setprop("/sim/models/tpoleone/enable", 0);
						setprop("/sim/models/tpoletwo/enable", 0);
						setprop("/sim/models/heightpoleone/enable", 1);
						setprop("/sim/models/heightpoletwo/enable", 1);
						setprop("sim/model/dash/poletype_flag_0", 1);
						setprop("sim/model/dash/poletype_flag_1", 0);
					</script>
				</binding>
			</radio>

			<radio>
				<halign>left</halign>
				<label>T pole</label>
				<property>sim/model/dash/poletype_flag_1</property>
				<live>true</live>
				<enable>
					<and>
						<not>
							<property>/sim/freeze/replay-state</property>
						</not>
						<property>/sim/rendering/course</property>
						<property>/sim/startup/airport-location</property>
						<not>
							<property>/sim/course/running</property>
						</not>
					</and>
				</enable>
				<binding>
					<command>dialog-apply</command>
				</binding>
				<binding>
					<command>nasal</command>
					<script>
						setprop("/sim/rendering/course-pole-type", 1);
						setprop("/sim/models/heightpoleone/enable", 0);
						setprop("/sim/models/heightpoletwo/enable", 0);
						setprop("/sim/models/tpoleone/enable", 1);
						setprop("/sim/models/tpoletwo/enable", 1);
						setprop("sim/model/dash/poletype_flag_0", 0);
						setprop("sim/model/dash/poletype_flag_1", 1);
					</script>
				</binding>
			</radio>
		</group>
	</group>

	<hrule/>

	<group>
		<layout>vbox</layout>
		<text>
			<label>Channel Crossing Runways</label>
			<halign>center</halign>
		</text>
		<group>
			<layout>vbox</layout>
			<radio>
				<halign>left</halign>
				<label>Ramp 1</label>
				<property>sim/model/dash/startup/ramp_flag_0</property>
				<live>true</live>
				<enable>
					<not>
						<property>/sim/freeze/replay-state</property>
					</not>
				</enable>
				<binding>
					<command>dialog-apply</command>
				</binding>
				<binding>
					<command>nasal</command>
					<script>
						setprop("/sim/model/startup/location", 0);
						setprop("sim/model/dash/startup/ramp_flag_0", 1);
						setprop("sim/model/dash/startup/ramp_flag_1", 0);
						setprop("sim/model/dash/startup/ramp_flag_2", 0);
						setprop("sim/model/dash/startup/ramp_flag_3", 0);
						dash.resume_state(51.07693845, 1.186006474, 107);
					</script>
				</binding>
			</radio>

			<radio>
				<halign>left</halign>
				<label>Ramp 2</label>
				<property>sim/model/dash/startup/ramp_flag_1</property>
				<live>true</live>
				<enable>
					<not>
						<property>/sim/freeze/replay-state</property>
					</not>
				</enable>
				<binding>
					<command>dialog-apply</command>
				</binding>
				<binding>
					<command>nasal</command>
					<script>
						setprop("/sim/model/startup/location", 1);
						setprop("sim/model/dash/startup/ramp_flag_0", 0);
						setprop("sim/model/dash/startup/ramp_flag_1", 1);
						setprop("sim/model/dash/startup/ramp_flag_2", 0);
						setprop("sim/model/dash/startup/ramp_flag_3", 0);
						dash.resume_state(51.0767948, 1.18577691, 161);
					</script>
				</binding>
			</radio>

			<radio>
				<halign>left</halign>
				<label>Ramp 3</label>
				<property>sim/model/dash/startup/ramp_flag_2</property>
				<live>true</live>
				<enable>
					<not>
						<property>/sim/freeze/replay-state</property>
					</not>
				</enable>
				<binding>
					<command>dialog-apply</command>
				</binding>
				<binding>
					<command>nasal</command>
					<script>
						setprop("/sim/model/startup/location", 2);
						setprop("sim/model/dash/startup/ramp_flag_0", 0);
						setprop("sim/model/dash/startup/ramp_flag_1", 0);
						setprop("sim/model/dash/startup/ramp_flag_2", 1);
						setprop("sim/model/dash/startup/ramp_flag_3", 0);
						dash.resume_state(51.07679613, 1.185357623, 203);
					</script>
				</binding>
			</radio>

			<radio>
				<halign>left</halign>
				<label>Ramp 4</label>
				<property>sim/model/dash/startup/ramp_flag_3</property>
				<live>true</live>
				<enable>
					<not>
					<property>/sim/freeze/replay-state</property>
					</not>
				</enable>
				<binding>
					<command>dialog-apply</command>
				</binding>
				<binding>
					<command>nasal</command>
					<script>
						setprop("/sim/model/startup/location", 3);
						setprop("sim/model/dash/startup/ramp_flag_0", 0);
						setprop("sim/model/dash/startup/ramp_flag_1", 0);
						setprop("sim/model/dash/startup/ramp_flag_2", 0);
						setprop("sim/model/dash/startup/ramp_flag_3", 1);
						dash.resume_state(51.07697015, 1.185177025, 262);
					</script>
				</binding>
			</radio>
		</group>
	</group>

	<hrule/>

    <group>
        <layout>hbox</layout>
        <default-padding>6</default-padding>

        <empty><stretch>true</stretch></empty>

        <button>
            <legend>Close</legend>
            <equal>true</equal>
            <key>Esc</key>
            <default>true</default>
            <binding>
                <command>dialog-close</command>
            </binding>
        </button>
    </group>

</PropertyList>
