<?xml version="1.0"?>

<PropertyList>
    <name>debug</name>
    <x>10</x>
    <y>2</y>
    <layout>vbox</layout>
    <default-padding>2</default-padding>
    <font>
        <name>HELVETICA_12</name>
    </font>
    <color>
        <red>0</red>
        <green>0</green>
        <blue>0</blue>
        <alpha>0.8</alpha>
    </color>
    <group>
        <layout>hbox</layout>
        <empty>
            <stretch>1</stretch>
        </empty>
        <text>
            <label>Autopilot debug</label>
        </text>
        <empty>
            <stretch>1</stretch>
        </empty>
        <button>
            <color>
                <red>0.5</red>
                <green>0.5</green>
                <blue>0.5</blue>
                <alpha>0.8</alpha>
            </color>
            <pref-width>16</pref-width>
            <pref-height>16</pref-height>
            <legend>X</legend>
            <keynum>27</keynum>
            <border>2</border>
            <binding>
                <command>dialog-close</command>
            </binding>
        </button>
    </group>

    <group>
        <layout>hbox</layout>
        <group>
            <layout>vbox</layout>
            <halign>left</halign>
            <text>
                <label>lat mode 0</label>
                <property>controls/autoflight/lat-mode</property>
                <format>lat_mode %1.0f </format>
                <live>true</live>
                <color>
                    <red>0.9</red>
                    <green>0.4</green>
                    <blue>0.2</blue>
                    <alpha>1</alpha>
                </color>
            </text>
            <text>
                <label>ref_roll -10.0 </label>
                <property>autopilot/ref/roll-deg</property>
                <format>ref_roll %2.1f </format>
                <live>true</live>
                <color>
                    <red>0.9</red>
                    <green>0.4</green>
                    <blue>0.2</blue>
                    <alpha>1</alpha>
                </color>
            </text>
            <text>
                <label>ref_hdg -100 </label>
                <property>autopilot/ref/roll-hdg</property>
                <format>ref_hdg %3.0f </format>
                <live>true</live>
                <color>
                    <red>0.9</red>
                    <green>0.4</green>
                    <blue>0.2</blue>
                    <alpha>1</alpha>
                </color>
            </text>
            <text>
                <label>HDG_err 000.0 </label>
                <property>autopilot/internal/heading-bug-error-deg</property>
                <format>HDG_err %3.1f </format>
                <live>true</live>
                <color>
                    <red>0.9</red>
                    <green>0.4</green>
                    <blue>0.2</blue>
                    <alpha>1</alpha>
                </color>
            </text>
            <text>
                <label>t_roll -00.00 </label>
                <property>autopilot/internal/target-roll-deg</property>
                <format>t_roll %2.3f </format>
                <live>true</live>
                <color>
                    <red>0.9</red>
                    <green>0.4</green>
                    <blue>0.2</blue>
                    <alpha>1</alpha>
                </color>
            </text>
            <text>
                <label>ind_roll -00.0 </label>
                <property>instrumentation/attitude-indicator[0]/indicated-roll-deg</property>
                <format>ind_roll %2.1f </format>
                <live>true</live>
                <color>
                    <red>0.9</red>
                    <green>0.4</green>
                    <blue>0.2</blue>
                    <alpha>1</alpha>
                </color>
            </text>
            <text>
                <label>error -0.000 </label>
                <property>autopilot/internal/roll-error</property>
                <format>err %1.3f </format>
                <live>true</live>
                <color>
                    <red>0.6</red>
                    <green>0.4</green>
                    <blue>0.2</blue>
                    <alpha>1</alpha>
                </color>
            </text>
            <text>
                <label>a_cmd -0.000 </label>
                <property>fcs/autopilot/aileron-cmd-norm</property>
                <format>a_cmd %1.3f </format>
                <live>true</live>
                <color>
                    <red>0.9</red>
                    <green>0.4</green>
                    <blue>0.2</blue>
                    <alpha>1</alpha>
                </color>
            </text>
            <text>
                <label>navsrc 0 </label>
                <property>controls/autoflight/nav-source</property>
                <format>navsrc %1d </format>
                <live>true</live>
                <color>
                    <red>0.9</red>
                    <green>0.2</green>
                    <blue>0.9</blue>
                    <alpha>1</alpha>
                </color>
            </text>

            <group>
                <layout>hbox</layout>
                <text>
                    <label>Mass-lbs</label>
                    <property>fdm/yasim/gross-weight-lbs</property>
                    <format>%5.0f lbs</format>
                    <live>true</live>
                    <color>
                        <red>0.2</red>
                        <green>0.7</green>
                        <blue>0.9</blue>
                        <alpha>1</alpha>
                    </color>
                </text>
                <text>
                    <label>Mass-kg</label>
                    <property>fdm/yasim/gross-weight-kg</property>
                    <format>%5.0f kg</format>
                    <live>true</live>
                    <color>
                        <red>0.2</red>
                        <green>0.7</green>
                        <blue>0.9</blue>
                        <alpha>1</alpha>
                    </color>
                </text>
            </group>
            <!-- mtow/mlw -->
            <group>
                <layout>hbox</layout>
                <text>
                    <label>000% MTOW</label>
                    <format>%02d%% MTOW</format>
                    <property>/fdm/yasim/mtow-percent</property>
                    <live>true</live>
                    <color>
                        <red>0.2</red>
                        <green>0.7</green>
                        <blue>0.9</blue>
                        <alpha>1</alpha>
                    </color>
                </text>
                <text>
                    <label>000% MLW</label>
                    <format>%02d%% MLW</format>
                    <property>/fdm/yasim/mlw-percent</property>
                    <live>true</live>
                    <color>
                        <red>0.2</red>
                        <green>0.7</green>
                        <blue>0.9</blue>
                        <alpha>1</alpha>
                    </color>
                </text>
            </group>
            <!-- CG range -->
            <group>
                <layout>hbox</layout>
                <text>
                    <label>0.00 - </label>
                    <property>fdm/yasim/model/cg-x-range-aft</property>
                    <format>%0.2f &lt; </format>
                    <live>true</live>
                    <color>
                        <red>0.2</red>
                        <green>0.7</green>
                        <blue>0.9</blue>
                        <alpha>1</alpha>
                    </color>
                </text>
                <text>
                    <label></label>
                    <property>fdm/yasim/cg-x-m</property>
                    <format> %0.2f</format>
                    <live>true</live>
                    <color>
                        <red>0.2</red>
                        <green>0.9</green>
                        <blue>0.2</blue>
                        <alpha>1</alpha>
                    </color>
                    <visible>
                        <and>
                            <greater-than-equals>
                                <property>fdm/yasim/cg-x-m</property>
                                <property>fdm/yasim/model/cg-x-range-aft</property>
                            </greater-than-equals>
                            <less-than-equals>
                                <property>fdm/yasim/cg-x-m</property>
                                <property>fdm/yasim/model/cg-x-range-front</property>
                            </less-than-equals>
                        </and>
                    </visible>
                </text>
                <text>
                    <label>-0.00</label>
                    <property>fdm/yasim/cg-x-m</property>
                    <format>%0.2f </format>
                    <live>true</live>
                    <color>
                        <red>0.9</red>
                        <green>0.2</green>
                        <blue>0.2</blue>
                        <alpha>1</alpha>
                    </color>
                    <visible>
                        <not><and>
                            <greater-than-equals>
                                <property>fdm/yasim/cg-x-m</property>
                                <property>fdm/yasim/model/cg-x-range-aft</property>
                            </greater-than-equals>
                            <less-than-equals>
                                <property>fdm/yasim/cg-x-m</property>
                                <property>fdm/yasim/model/cg-x-range-front</property>
                            </less-than-equals>
                        </and></not>
                    </visible>
                </text>
                <text>
                    <label> - 0.00</label>
                    <property>fdm/yasim/model/cg-x-range-front</property>
                    <format> &lt; %0.2f</format>
                    <live>true</live>
                    <color>
                        <red>0.2</red>
                        <green>0.7</green>
                        <blue>0.9</blue>
                        <alpha>1</alpha>
                    </color>
                </text>
            </group>

        </group>

        <group>
            <layout>vbox</layout>
            <text>
                <label>vert mode 0</label>
                <property>controls/autoflight/vert-mode</property>
                <format>vert_mode %1.0f </format>
                <live>true</live>
                <color>
                    <red>0.2</red>
                    <green>0.9</green>
                    <blue>0.4</blue>
                    <alpha>1</alpha>
                </color>
            </text>
            <text>
                <label>AltHold 00000</label>
                <property>autopilot/ref/alt-hold</property>
                <format>AltHold %5.0f</format>
                <live>true</live>
                <color>
                    <red>0.2</red>
                    <green>0.9</green>
                    <blue>0.4</blue>
                    <alpha>1</alpha>
                </color>
            </text>
            <text>
                <label>TgtFpm -0000 </label>
                <property>autopilot/internal/target-climb-rate-fpm</property>
                <format>TgtFpm %4.0f </format>
                <live>true</live>
                <color>
                    <red>0.2</red>
                    <green>0.9</green>
                    <blue>0.4</blue>
                    <alpha>1</alpha>
                </color>
            </text>
            <text>
                <label>CurFpm -0000 </label>
                <property>instrumentation/vertical-speed-indicator[0]/indicated-speed-fpm</property>
                <format>CurFpm %4.0f </format>
                <live>true</live>
                <color>
                    <red>0.2</red>
                    <green>0.9</green>
                    <blue>0.4</blue>
                    <alpha>1</alpha>
                </color>
            </text>
            <text>
                <label>TgtPitch -00.00 </label>
                <property>autopilot/internal/target-pitch-deg</property>
                <format>TgtPitch %2.2f </format>
                <live>true</live>
                <color>
                    <red>0.2</red>
                    <green>0.9</green>
                    <blue>0.4</blue>
                    <alpha>1</alpha>
                </color>
            </text>
            <text>
                <label>CurPitch -00.00 </label>
                <property>instrumentation/attitude-indicator[0]/indicated-pitch-deg</property>
                <format>CurPitch %2.2f </format>
                <live>true</live>
                <color>
                    <red>0.2</red>
                    <green>0.9</green>
                    <blue>0.4</blue>
                    <alpha>1</alpha>
                </color>
            </text>
            <text>
                <label>ElvTrim -0.0000 </label>
                <property>controls/flight/elevator-trim</property>
                <format>ElvTrim %1.4f </format>
                <live>true</live>
                <color>
                    <red>0.2</red>
                    <green>0.9</green>
                    <blue>0.4</blue>
                    <alpha>1</alpha>
                </color>
            </text>
            <text>
                <label>GS -10.0 deg</label>
                <property>instrumentation/nav[0]/gs-needle-deflection-deg</property>
                <format>GS %2.1f deg</format>
                <live>true</live>
                <color>
                    <red>0.9</red>
                    <green>0.1</green>
                    <blue>0.1</blue>
                    <alpha>1</alpha>
                </color>
                <visible>
                    <not>
                        <property>instrumentation/nav[0]/gs-in-range</property>
                    </not>
                </visible>
            </text>
            <text>
                <label>GS -10.0 deg</label>
                <property>instrumentation/nav[0]/gs-needle-deflection-deg</property>
                <format>GS %2.1f deg</format>
                <live>true</live>
                <color>
                    <red>0.1</red>
                    <green>0.9</green>
                    <blue>0.1</blue>
                    <alpha>1</alpha>
                </color>
                <visible>
                    <property>instrumentation/nav[0]/gs-in-range</property>
                </visible>
            </text>
            <text>
                <label>GS -1000 fpm</label>
                <property>instrumentation/nav[0]/gs-rate-of-climb-fpm</property>
                <format>GS %4.0f fpm</format>
                <live>true</live>
                <color>
                    <red>0.9</red>
                    <green>0.1</green>
                    <blue>0.1</blue>
                    <alpha>1</alpha>
                </color>
                <visible>
                    <not>
                        <property>instrumentation/nav[0]/gs-in-range</property>
                    </not>
                </visible>
            </text>
            <text>
                <label>GS -1000 fpm</label>
                <property>instrumentation/nav[0]/gs-rate-of-climb-fpm</property>
                <format>GS %4.0f fpm</format>
                <live>true</live>
                <color>
                    <red>0.1</red>
                    <green>0.9</green>
                    <blue>0.1</blue>
                    <alpha>1</alpha>
                </color>
                <visible>
                    <property>instrumentation/nav[0]/gs-in-range</property>
                </visible>
            </text>

        </group>
    </group>
    <nasal>
        <open><![CDATA[
            var mtow=getprop("/limits/mass-and-balance/maximum-takeoff-mass-lbs");
            var mlw=getprop("/limits/mass-and-balance/maximum-landing-mass-lbs");
            var weight_p_mtow = props.getNode("/fdm/yasim/mtow-percent",1);
            var weight_p_mlw = props.getNode("/fdm/yasim/mlw-percent",1);
            var weight_kg = props.getNode("/fdm/yasim/gross-weight-kg",1);
            var weightL = setlistener("/fdm/yasim/gross-weight-lbs", func(n){
                weight_p_mtow.setValue(n.getValue()*100/mtow);
                weight_p_mlw.setValue(n.getValue()*100/mlw);
                weight_kg.setValue(n.getValue()*0.45359);
            }, 1, 0);
        ]]></open>

        <close><![CDATA[
        removelistener(weightL);
        ]]></close>
    </nasal>
</PropertyList>
