<?xml version="1.0"?>
<PropertyList>
    <name>autopilot-dlg</name>
    <layout>vbox</layout>

    <group>
        <layout>hbox</layout>

        <text>
            <halign>center</halign>
            <label>Flight Director / Autopilot Control</label>
        </text>

        <button>
            <halign>right</halign>
            <pref-width>25</pref-width>
            <legend>X</legend>
            <default>true</default>
            <key>Esc</key>
            <binding>
                <command>dialog-apply</command>
            </binding>
            <binding>
                <command>dialog-close</command>
            </binding>
        </button>
    </group>

    <group>
        <layout>hbox</layout>
        <text>
            <label>L-Armed</label>
        </text>
        <text>
            <label>Lateral</label>
        </text>
        <text>
            <label>Vertical</label>
        </text>
        <text>
            <label>V-Armed</label>
        </text>
    </group>

    <group>
        <layout>hbox</layout>

        <input>
            <pref-width>60</pref-width>
            <property>autopilot/locks/heading-armed</property>
            <live>true</live>
        </input>

        <input>
            <pref-width>60</pref-width>
            <property>autopilot/locks/heading</property>
            <live>true</live>
        </input>

        <input>
            <pref-width>60</pref-width>
            <property>autopilot/locks/altitude</property>
            <live>true</live>
        </input>

        <input>
            <pref-width>60</pref-width>
            <property>autopilot/locks/altitude-armed</property>
            <live>true</live>
        </input>
    </group>

    <group>
        <layout>hbox</layout>

        <checkbox>
            <label>B/C</label>
            <property>instrumentation/nav/back-course-btn</property>
            <live>true</live>
            <binding>
                <command>dialog-update</command>
            </binding>
        </checkbox>

        <input>
            <pref-width>70</pref-width>
            <property>autopilot/locks/AP-status</property>
            <live>true</live>
        </input>

        <button>
            <pref-width>45</pref-width>
            <legend>FMS</legend>
            <binding>
                <condition>
                    <property>autopilot/route-manager/route/num</property>
                </condition>
                <command>property-assign</command>
                <property>autopilot/locks/nav-src</property>
                <value>FMS</value>
            </binding>
        </button>

        <button>
            <pref-width>40</pref-width>
            <legend>NAV</legend>
            <binding>
                <command>property-cycle</command>
                <property>autopilot/locks/nav-src</property>
                <value>NAV1</value>
                <value>NAV2</value>
            </binding>
        </button>

        <input>
            <pref-width>50</pref-width>
            <property>autopilot/locks/nav-src</property>
            <live>true</live>
        </input>

    </group>



    <group>
        <layout>hbox</layout>

        <hrule>
            <stretch>true</stretch>
        </hrule>

        <text>
            <label>Flight Director Buttons</label>
        </text>

        <hrule>
            <stretch>true</stretch>
        </hrule>
    </group>

<!-- Flight Director Push Buttons-->
<!-- Row 1 -->

    <group>
        <layout>hbox</layout>
        <halign>center</halign>

        <button>
            <pref-width>70</pref-width>
            <legend>HDG</legend>
            <binding>
                <command>nasal</command>
                <script>FD.inputs("hdg",0);</script>
            </binding>
        </button>

        <button>
            <pref-width>70</pref-width>
            <legend>NAV</legend>
            <binding>
                <command>nasal</command>
                <script>FD.inputs("nav",0);</script>
            </binding>
        </button>

        <button>
            <pref-width>70</pref-width>
            <legend>APPR</legend>
            <binding>
                <command>nasal</command>
                <script>FD.inputs("apr",2);</script>
            </binding>
        </button>

        <button>
            <pref-width>70</pref-width>
            <legend>B/C</legend>
            <binding>
                <command>nasal</command>
                <script>FD.inputs("bc",0);</script>
            </binding>
        </button>
    </group>

<!-- Row 2 -->

    <group>
        <layout>hbox</layout>
        <halign>center</halign>

        <button>
            <pref-width>70</pref-width>
            <legend>VNAV</legend>
            <binding>
                <command>nasal</command>
                <script>FD.inputs("vnav",1);</script>
            </binding>
        </button>

        <button>
            <pref-width>70</pref-width>
            <legend>ALT</legend>
            <binding>
                <command>nasal</command>
                <script>FD.inputs("alt",1);</script>
            </binding>
        </button>

        <button>
            <pref-width>70</pref-width>
            <legend>VS</legend>
            <binding>
                <command>nasal</command>
                <script>FD.inputs("vs",1);</script>
            </binding>
        </button>

        <button>
            <pref-width>70</pref-width>
            <legend>SPD</legend>
            <binding>
                <command>nasal</command>
                <script>FD.inputs("spd",1);</script>
            </binding>
        </button>
    </group>

    <group>
        <layout>hbox</layout>

        <hrule>
            <stretch>true</stretch>
        </hrule>

        <text>
            <label>Instrument Settings</label>
        </text>

        <hrule>
            <stretch>true</stretch>
        </hrule>
    </group>

    <group>
        <layout>hbox</layout>
        <halign>center</halign>

        <text>
            <label>HDG BUG</label>
        </text>

        <input>
            <pref-width>80</pref-width>
            <property>autopilot/settings/heading-bug-deg</property>
            <binding>
                <command>dialog-apply</command>
            </binding>
            <binding>
                <command>dialog-update</command>
            </binding>
        </input>

        <button>
            <pref-width>60</pref-width>
            <legend>CNTR</legend>
            <binding>
                <command>property-assign</command>
                <property>autopilot/settings/heading-bug-deg</property>
                <property>/orientation/heading-magnetic-deg</property>
            </binding>
            <binding>
                <command>dialog-update</command>
            </binding>
        </button>
    </group>

    <group>
        <layout>hbox</layout>
        <halign>center</halign>

        <text>
            <label>NAV1 CRS</label>
        </text>

        <input>
            <property>instrumentation/nav/radials/selected-deg</property>
            <binding>
                <command>dialog-apply</command>
            </binding>
            <binding>
                <command>dialog-update</command>
            </binding>
        </input>

        <button>
            <pref-width>60</pref-width>
            <legend>CNTR</legend>
            <binding>
                <command>property-assign</command>
                <property>instrumentation/nav/radials/selected-deg</property>
                <property>/orientation/heading-magnetic-deg</property>
            </binding>
            <binding>
                <command>dialog-update</command>
            </binding>
        </button>
    </group>

    <group>
        <layout>hbox</layout>
        <halign>center</halign>

        <text>
            <label>NAV2 CRS</label>
        </text>

        <input>
            <property>instrumentation/nav[1]/radials/selected-deg</property>
            <binding>
                <command>dialog-apply</command>
            </binding>
            <binding>
                <command>dialog-update</command>
            </binding>
        </input>

        <button>
            <pref-width>60</pref-width>
            <legend>CNTR</legend>
            <binding>
                <command>property-assign</command>
                <property>instrumentation/nav[1]/radials/selected-deg</property>
                <property>/orientation/heading-magnetic-deg</property>
            </binding>
            <binding>
                <command>dialog-update</command>
            </binding>
        </button>
    </group>

    <group>
        <layout>hbox</layout>
        <halign>center</halign>

        <text>
            <label>ALT SET  </label>
        </text>

        <input>
            <property>autopilot/settings/target-altitude-ft</property>
            <binding>
                <command>dialog-apply</command>
            </binding>
            <binding>
                <command>dialog-update</command>
            </binding>
        </input>

        <button>
            <pref-width>65</pref-width>
            <legend>RESET</legend>
            <binding>
                <command>property-assign</command>
                <property>autopilot/settings/target-altitude-ft</property>
                <value>10000</value>
            </binding>
            <binding>
                <command>dialog-update</command>
            </binding>
        </button>
    </group>

    <group>
        <layout>hbox</layout>
        <hrule><stretch>true</stretch></hrule>
        <text><label>Autopilot Control</label></text>
        <hrule><stretch>true</stretch></hrule>
    </group>

    <group>
        <layout>hbox</layout>

        <group>
            <layout>vbox</layout>

            <button>
                <legend>DN</legend>
                <binding>
                    <command>nasal</command>
                    <script>FD.pitchwheel(-1)</script>
                </binding>
                <binding>
                    <command>dialog-update</command>
                </binding>
            </button>

            <input>
                <pref-width>60</pref-width>
                <label>V/S</label>
                <property>autopilot/settings/target-vs</property>
                <scale>100</scale>
                <binding>
                    <command>dialog-apply</command>
                </binding>
                <binding>
                    <command>dialog-update</command>
                </binding>
            </input>

            <input>
                <pref-width>60</pref-width>
                <label>PTCH</label>
                <property>autopilot/settings/target-pitch-deg</property>
                <binding>
                    <command>dialog-apply</command>
                </binding>
                <binding>
                    <command>dialog-update</command>
                </binding>
            </input>

            <input>
                <pref-width>60</pref-width>
                <label>IAS</label>
                <property>autopilot/settings/target-speed-kt</property>
                <binding>
                    <command>dialog-apply</command>
                </binding>
                <binding>
                    <command>dialog-update</command>
                </binding>
            </input>

            <button>
                <legend>UP</legend>
                <binding>
                    <command>nasal</command>
                    <script>FD.pitchwheel(1)</script>
                </binding>
                <binding>
                    <command>dialog-update</command>
                </binding>
            </button>

        </group>

        <group>
            <layout>vbox</layout>

            <button>
                <legend>LOW</legend>
                <binding>
                    <command>property-cycle</command>
                    <property>autopilot/settings/bank-limit</property>
                    <value>14</value>
                    <value>27</value>
                </binding>
            </button>

            <text>
                <label>99.99</label> <!-- placeholder for width -->
                <format>BANK % 2.0f *</format>
                <property>autopilot/settings/bank-limit</property>
                <live>true</live>
            </text>

            <button>
                <legend>A/P</legend>
                <binding>
                    <command>nasal</command>
                    <script>FD.inputs("ap",2);</script>
                </binding>
            </button>

            <button>
                <legend>Y/D</legend>
                <binding>
                    <command>property-toggle</command>
                    <property>autopilot/locks/yaw-damper</property>
                </binding>
            </button>

            <checkbox>
                <label>ON</label>
                <property>autopilot/locks/yaw-damper</property>
                <live>true</live>
            </checkbox>

            <group>
                <layout>hbox</layout>


            </group>

        </group>

        <group>
            <layout>vbox</layout>
            <text>
                <label>Roll Knob</label>
            </text>

            <dial>
                <pref-width>60</pref-width>
                <pref-height>60</pref-height>
                <property>autopilot/settings/target-roll-deg</property>
                <min>-30</min>
                <max>30</max>
                <wrap>false</wrap>
                <binding>
                    <command>dialog-apply</command>
                </binding>
                <binding>
                    <command>dialog-update</command>
                </binding>
            </dial>

            <text>
                <label>-99.99</label> <!-- placeholder for width -->
                <format>% 2.1f</format>
                <property>autopilot/settings/target-roll-deg</property>
                <live>true</live>
            </text>
        </group>



    </group>

</PropertyList>
