<?xml version="1.0"?>

<!-- SUMPAC
 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>
    <resizable>false</resizable>
    <modal>false</modal>
    <draggable>true</draggable>

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

    <group>
        <layout>hbox</layout>

        <empty><stretch>true</stretch></empty>
        <text>
            <label>Aircraft Options</label>
        </text>
        <empty><stretch>true</stretch></empty>

        <button>
            <legend/>
            <key>Esc</key>
            <pref-width>16</pref-width>
            <pref-height>16</pref-height>
            <binding>
                <command>dialog-close</command>
            </binding>
        </button>
    </group>

    <hrule/>

    <group>
        <layout>vbox</layout>
        <padding>6</padding>

        <group>
            <layout>vbox</layout>

            <checkbox>
                <halign>left</halign>
                <label>Two axis control</label>
                <property>/controls/flight/two-axis-control</property>
                <live>true</live>
                <binding>
                    <command>property-toggle</command>
                    <property>/controls/flight/two-axis-control</property>
                </binding>
            </checkbox>

            <checkbox>
                <halign>left</halign>
                <label>High detail</label>
                <property>/sim/rendering/high-detail</property>
                <live>true</live>
                <binding>
                    <command>property-toggle</command>
                    <property>/sim/rendering/high-detail</property>
                </binding>
            </checkbox>

            <checkbox>
                <halign>left</halign>
                <label>Mylar Covering</label>
                <property>/sim/model/covering</property>
                <binding>
                    <command>property-toggle</command>
                    <property>/sim/model/covering</property>
                </binding>
            </checkbox>

            <checkbox>
                <halign>left</halign>
                <label>Power Output On/Off</label>
                <property>/sim/gui/show-power-output</property>
                <binding>
                    <command>property-toggle</command>
                    <property>/sim/gui/show-power-output</property>
                </binding>
            </checkbox>

            <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>

          <hrule/>

            <checkbox>
                <halign>left</halign>
                <label>Kremer Prize Course</label>
                <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>
            </checkbox>

            <group>
	            <layout>vbox</layout>
	            <text>
		            <label>Kremer Course Pole Type</label>
		            <halign>center</halign>
	            </text>
	            <group>
		            <layout>hbox</layout>
		            <radio>
			            <halign>left</halign>
			            <label>Goal post</label>
			            <property>sim/model/sumpac/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/sumpac/poletype_flag_0", 1);
					            setprop("sim/model/sumpac/poletype_flag_1", 0);
				            </script>
			            </binding>
		            </radio>
	
		            <radio>
			            <halign>left</halign>
			            <label>T pole</label>
			            <property>sim/model/sumpac/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/sumpac/poletype_flag_0", 0);
					            setprop("sim/model/sumpac/poletype_flag_1", 1);
				            </script>
			            </binding>
		            </radio>
		          </group>
            </group>
          <hrule/>

            <!--checkbox>
                <halign>left</halign>
                <label>Show shadow</label>
                <property>/sim/rendering/shadow-volume</property>
                <live>true</live>
                <binding>
                    <command>property-toggle</command>
                    <property>/sim/rendering/shadow-volume</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>
    </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>
