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

<!-- Bendix/King KAP 140 Autopilot Control Dialog -->
<!-- Copyright (c) 2020 Sascha Reißner (WoodSTokk) -->
<PropertyList include="../../Models/Interior/Panel/Instruments/kap140/kap140-config.xml">

	<name>autopilot</name>
	<layout>vbox</layout>

	<group>
		<layout>hbox</layout>
		<text>
			<halign>left</halign>
			<label>Bendix/King KAP 140</label>
		</text>
		<empty><stretch>1</stretch></empty>
		<button>
			<row>0</row>
			<col>0</col>
			<pref-width>20</pref-width>
			<pref-height>20</pref-height>
			<legend>?</legend>
			<binding>
				<command>nasal</command>
				<script>gui.popupTip("Please refer to the POH, this autopilot operates as per the manual.");</script>
			</binding>
		</button>
		<button>
			<row>0</row>
			<col>1</col>
			<pref-width>20</pref-width>
			<pref-height>20</pref-height>
			<legend>X</legend>
			<key>Esc</key>
			<binding>
				<command>dialog-close</command>
			</binding>
		</button>
	</group>
	
	<hrule/>
	
	<group>
		<layout>table</layout>
		
		<text>
			<row>0</row>
			<col>0</col>
			<label>PFT1</label>
			<visible>
				<equals>
					<property>/autopilot/kap140/panel/state</property>
					<value>1</value>
				</equals>
			</visible>
		</text>
		
		<text>
			<row>0</row>
			<col>0</col>
			<label>PFT2</label>
			<visible>
				<equals>
					<property>/autopilot/kap140/panel/state</property>
					<value>2</value>
				</equals>
			</visible>
		</text>
		
		<text>
			<row>0</row>
			<col>0</col>
			<label>PFT3</label>
			<visible>
				<equals>
					<property>/autopilot/kap140/panel/state</property>
					<value>3</value>
				</equals>
			</visible>
		</text>
		
		<text>
			<row>0</row>
			<col>0</col>
			<label>BARO</label>
			<visible>
				<equals>
					<property>/autopilot/kap140/panel/state</property>
					<value>4</value>
				</equals>
			</visible>
		</text>
		
		<text>
			<row>0</row>
			<col>0</col>
			<label>STBY</label>
			<visible>
				<equals>
					<property>/autopilot/kap140/panel/state</property>
					<value>5</value>
				</equals>
			</visible>
		</text>
		
		<text>
			<row>0</row>
			<col>0</col>
			<label>CWS</label>
			<visible>
				<equals>
					<property>/autopilot/kap140/panel/state</property>
					<value>6</value>
				</equals>
				<property>/autopilot/kap140/settings/cws</property>
			</visible>
		</text>
		
		<text>
			<row>0</row>
			<col>0</col>
			<label>FAIL</label>
			<visible>
				<property>/autopilot/kap140/bad-condition</property>
			</visible>
		</text>
		
		<text>
			<row>0</row>
			<col>1</col>
			<label>ROL</label>
			<visible>
				<equals>
					<property>/autopilot/kap140/settings/lateral-mode</property>
					<value>1</value>
				</equals>
				<less-than>
					<property>/autopilot/kap140/panel/hdg-timer</property>
					<value>1</value>
				</less-than>
			</visible>
		</text>
		
		<text>
			<row>0</row>
			<col>1</col>
			<label>HDG</label>
			<visible>
				<equals>
					<property>/autopilot/kap140/settings/lateral-mode</property>
					<value>2</value>
				</equals>
				<less-than>
					<property>/autopilot/kap140/panel/hdg-timer</property>
					<value>1</value>
				</less-than>
				<not><property>autopilot/kap140/settings/from-hdg</property></not>
			</visible>
		</text>
		
		<text>
			<row>0</row>
			<col>1</col>
			<label>HDG</label>
			<color>
				<red>0.95</red>
				<green>0.05</green>
				<blue>0.05</blue>
			</color>
			<visible>
				<greater-than>
					<property>/autopilot/kap140/panel/hdg-timer</property>
					<value>1</value>
				</greater-than>
			</visible>
		</text>
		
		<text>
			<row>0</row>
			<col>1</col>
			<label>NAV</label>
			<visible>
				<equals>
					<property>autopilot/kap140/settings/lateral-mode</property>
					<value>3</value>
				</equals>
				<less-than>
					<property>autopilot/kap140/panel/nav-timer</property>
					<value>1</value>
				</less-than>
			</visible>
		</text>
		
		<text>
			<row>0</row>
			<col>1</col>
			<label>NAV</label>
			<color>
				<red>0.95</red>
				<green>0.05</green>
				<blue>0.05</blue>
			</color>
			<visible>
				<equals>
					<property>autopilot/kap140/settings/lateral-mode</property>
					<value>3</value>
				</equals>
				<greater-than>
					<property>autopilot/kap140/panel/nav-timer</property>
					<value>1</value>
				</greater-than>
			</visible>
		</text>
		
		<text>
			<row>0</row>
			<col>1</col>
			<label>APR</label>
			<visible>
				<equals>
					<property>/autopilot/kap140/settings/lateral-mode</property>
					<value>4</value>
				</equals>
				<less-than>
					<property>autopilot/kap140/panel/nav-timer</property>
					<value>1</value>
				</less-than>
			</visible>
		</text>
		
		<text>
			<row>0</row>
			<col>1</col>
			<label>APR</label>
			<color>
				<red>0.95</red>
				<green>0.05</green>
				<blue>0.05</blue>
			</color>
			<visible>
				<equals>
					<property>/autopilot/kap140/settings/lateral-mode</property>
					<value>4</value>
				</equals>
				<greater-than>
					<property>autopilot/kap140/panel/nav-timer</property>
					<value>1</value>
				</greater-than>
			</visible>
		</text>
		
		<text>
			<row>0</row>
			<col>1</col>
			<label>REV</label>
			<visible>
				<equals>
					<property>/autopilot/kap140/settings/lateral-mode</property>
					<value>5</value>
				</equals>
				<less-than>
					<property>autopilot/kap140/panel/nav-timer</property>
					<value>1</value>
				</less-than>
			</visible>
		</text>
		
		<text>
			<row>0</row>
			<col>1</col>
			<label>REV</label>
			<color>
				<red>0.95</red>
				<green>0.05</green>
				<blue>0.05</blue>
			</color>
			<visible>
				<equals>
					<property>/autopilot/kap140/settings/lateral-mode</property>
					<value>5</value>
				</equals>
				<greater-than>
					<property>autopilot/kap140/panel/nav-timer</property>
					<value>1</value>
				</greater-than>
			</visible>
		</text>
		
		<text>
			<row>0</row>
			<col>2</col>
			<label>VS</label>
			<visible>
				<equals>
					<property>/autopilot/kap140/settings/vertical-mode</property>
					<value>1</value>
				</equals>
			</visible>
		</text>
		
		<text>
			<row>0</row>
			<col>2</col>
			<label>ALT</label>
			<visible>
				<equals>
					<property>/autopilot/kap140/settings/vertical-mode</property>
					<value>2</value>
				</equals>
			</visible>
		</text>
		
		<text>
			<row>0</row>
			<col>2</col>
			<label>GS</label>
			<visible>
				<equals>
					<property>/autopilot/kap140/settings/vertical-mode</property>
					<value>3</value>
				</equals>
			</visible>
		</text>
		
		<text>
			<row>0</row>
			<col>3</col>
			<visible>
				<equals>
					<property>/autopilot/kap140/settings/vertical-mode</property>
					<value>1</value>
				</equals>
			</visible>
			<label>FPM: 99999</label>
			<format>FPM: %-4d</format>
			<property>/autopilot/internal/target-climb-rate</property>
			<live>1</live>
		</text>
		
		<text>
			<row>0</row>
			<col>3</col>
			<visible>
				<equals>
					<property>/autopilot/kap140/settings/vertical-mode</property>
					<value>2</value>
				</equals>
			</visible>
			<label>RefPress: 99.999</label>
			<format>RefPress: %-2.3f</format>
			<property>/autopilot/internal/target-pressure</property>
			<live>1</live>
		</text>
		
		<text>
			<row>0</row>
			<col>4</col>
			<visible>
				<greater-than>
					<property>/autopilot/kap140/panel/state</property>
					<value>4</value>
				</greater-than>
			</visible>
			<label>Preselect:</label>
		</text>
		
		<text>
			<row>0</row>
			<col>5</col>
			<visible>
				<greater-than>
					<property>/autopilot/kap140/panel/state</property>
					<value>4</value>
				</greater-than>
			</visible>
			<label>999999</label>
			<format>%-5d</format>
			<property>/autopilot/internal/target-altitude</property>
			<live>1</live>
		</text>
		
		<group>
			<layout>hbox</layout>
			<row>1</row>
			<col>0</col>
			<visible>
				<or>
					<property>/autopilot/kap140/pitch-axis-fail</property>
					<property>/autopilot/kap140/roll-axis-fail</property>
				</or>
			</visible>
			<text>
				<row>0</row>
				<col>0</col>
				<label>P</label>
				<color>
					<red>0.95</red>
					<green>0.05</green>
					<blue>0.05</blue>
				</color>
				<visible>
					<property>/autopilot/kap140/pitch-axis-fail</property>
				</visible>
			</text>
			<text>
				<row>0</row>
				<col>1</col>
				<label>R</label>
				<color>
					<red>0.95</red>
					<green>0.05</green>
					<blue>0.05</blue>
				</color>
				<visible>
					<property>/autopilot/kap140/roll-axis-fail</property>
				</visible>
			</text>
		</group>

		<!-- if your KAP 140 can use different navigation sources
			you can named it here -->
		<group>
			<row>1</row>
			<col>0</col>
			<visible>
				<not><property>/autopilot/kap140/pitch-axis-fail</property></not>
				<not><property>/autopilot/kap140/roll-axis-fail</property></not>
				<greater-than>
					<property>/autopilot/kap140/panel/state</property>
					<value>4</value>
				</greater-than>
			</visible>
			<text>
				<label>NAV1</label>
				<visible>
					<equals>
						<property>instrumentation/nav-source/selector</property>
						<value>0</value>
					</equals>
				</visible>
			</text>
			<text>
				<label>NAV2</label>
				<visible>
					<equals>
						<property>instrumentation/nav-source/selector</property>
						<value>1</value>
					</equals>
				</visible>
			</text>
			<text>
				<label>GPSS</label>
				<visible>
					<equals>
						<property>instrumentation/nav-source/selector</property>
						<value>2</value>
					</equals>
				</visible>
			</text>
		</group>

		<text>
			<row>1</row>
			<col>1</col>
			<label>NAV ARM</label>
			<visible>
				<equals>
					<property>/autopilot/kap140/settings/lateral-arm</property>
					<value>3</value>
				</equals>
			</visible>
		</text>
		
		<text>
			<row>1</row>
			<col>1</col>
			<label>APR ARM</label>
			<visible>
				<equals>
					<property>/autopilot/kap140/settings/lateral-arm</property>
					<value>4</value>
				</equals>
			</visible>
		</text>
		
		<text>
			<row>1</row>
			<col>1</col>
			<label>REV ARM</label>
			<visible>
				<equals>
					<property>/autopilot/kap140/settings/lateral-arm</property>
					<value>5</value>
				</equals>
			</visible>
		</text>
		
		<text>
			<row>1</row>
			<col>1</col>
			<label>GS ARM</label>
			<visible>
				<equals>
					<property>/autopilot/kap140/settings/lateral-arm</property>
					<value>6</value>
				</equals>
			</visible>
		</text>
		
		<text>
			<row>1</row>
			<col>2</col>
			<label>ALT ARM</label>
			<visible>
				<equals>
					<property>/autopilot/kap140/settings/vertical-arm</property>
					<value>2</value>
				</equals>
			</visible>
		</text>
		
		<text>
			<row>1</row>
			<col>3</col>
			<label>PT UP</label>
			<visible>
				<property>/autopilot/kap140/sensors/pitch-up</property>
			</visible>
		</text>
		
		<text>
			<row>1</row>
			<col>3</col>
			<label>PT DOWN</label>
			<visible>
				<property>/autopilot/kap140/sensors/pitch-down</property>
			</visible>
		</text>
		
		<text>
			<row>1</row>
			<col>4</col>
			<visible>
				<greater-than>
					<property>/autopilot/kap140/panel/state</property>
					<value>3</value>
				</greater-than>
				<not><property>autopilot/kap140/panel/baro-mode</property></not>
			</visible>
			<label>InHg:</label>
		</text>
		<text>
			<row>1</row>
			<col>4</col>
			<visible>
				<greater-than>
					<property>/autopilot/kap140/panel/state</property>
					<value>3</value>
				</greater-than>
				<property>autopilot/kap140/panel/baro-mode</property>
			</visible>
			<label>hPa:</label>
		</text>
		
		<text>
			<row>1</row>
			<col>5</col>
			<visible>
				<greater-than>
					<property>/autopilot/kap140/panel/state</property>
					<value>3</value>
				</greater-than>
				<not><property>autopilot/kap140/panel/baro-mode</property></not>
			</visible>
			<label>99.999</label>
			<format>%-2.2f</format>
			<property alias="/params/baro-inhg" />
			<live>1</live>
		</text>
		
		<text>
			<row>1</row>
			<col>5</col>
			<visible>
				<greater-than>
					<property>/autopilot/kap140/panel/state</property>
					<value>3</value>
				</greater-than>
				<property>autopilot/kap140/panel/baro-mode</property>
			</visible>
			<label>99999</label>
			<format>%-4.0f</format>
			<property alias="/params/baro-hpa" />
			<live>1</live>
		</text>
	</group>
	
	<hrule/>
	
	<group>
		<layout>hbox</layout>
		
		<button>
			<legend>AP</legend>
			<pref-width>40</pref-width>
			<binding>
				<command>property-assign</command>
				<property>autopilot/kap140/panel/button-ap</property>
				<value>0.000001</value>
			</binding>
			<binding>
				<condition>
					<greater-than>
						<property>autopilot/kap140/panel/state</property>
						<value>4</value>
					</greater-than>
					<not><property>autopilot/kap140/roll-axis-fail</property></not>
					<not><property>autopilot/kap140/pitch-axis-fail</property></not>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/panel/state-old</property>
				<property>autopilot/kap140/panel/state</property>
			</binding>
			<binding>
				<condition>
					<greater-than>
						<property>autopilot/kap140/panel/state</property>
						<value>4</value>
					</greater-than>
					<not><property>autopilot/kap140/roll-axis-fail</property></not>
					<not><property>autopilot/kap140/pitch-axis-fail</property></not>
				</condition>
				<command>property-assign</command>
				<property>autopilot/internal/target-climb-rate</property>
				<property>autopilot/internal/vert-speed-fpm</property>
			</binding>
		</button>
		
		<button>
			<legend>HDG</legend>
			<pref-width>40</pref-width>
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
					<equals>
						<property>autopilot/kap140/settings/lateral-mode</property>
						<value>2</value>
					</equals>
					<less-than>
						<property>autopilot/kap140/settings/lateral-arm</property>
						<value>3</value>
					</less-than>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/settings/lateral-mode</property>
				<value>-1</value>
			</binding>
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
					<equals>
						<property>autopilot/kap140/settings/lateral-mode</property>
						<value>1</value>
					</equals>
					<less-than>
						<property>autopilot/kap140/settings/lateral-arm</property>
						<value>3</value>
					</less-than>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/settings/lateral-mode</property>
				<value>2</value>
			</binding>
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
					<greater-than>
						<property>autopilot/kap140/settings/lateral-mode</property>
						<value>2</value>
					</greater-than>
					<less-than>
						<property>autopilot/kap140/settings/lateral-mode</property>
						<value>6</value>
					</less-than>
					<property>autopilot/kap140/settings/from-hdg</property>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/settings/lateral-mode</property>
				<value>2</value>
			</binding>
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
					<greater-than>
						<property>autopilot/kap140/settings/lateral-mode</property>
						<value>2</value>
					</greater-than>
					<less-than>
						<property>autopilot/kap140/settings/lateral-mode</property>
						<value>6</value>
					</less-than>
					<not><property>autopilot/kap140/settings/from-hdg</property></not>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/settings/lateral-mode</property>
				<value>1</value>
			</binding>
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
					<less-than>
						<property>autopilot/kap140/settings/lateral-mode</property>
						<value>0</value>
					</less-than>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/settings/lateral-mode</property>
				<value>1</value>
			</binding>
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
					<less-than>
						<property>autopilot/kap140/settings/lateral-mode</property>
						<value>3</value>
					</less-than>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/settings/from-hdg</property>
				<value>0</value>
			</binding>
			<binding>
				<command>property-assign</command>
				<property>autopilot/kap140/settings/lateral-arm</property>
				<value>0</value>
			</binding>
			<binding>
				<command>property-assign</command>
				<property>autopilot/internal/target-roll-deg</property>
				<value>0</value>
			</binding>
			<binding>
				<command>property-assign</command>
				<property>autopilot/internal/target-intercept-angle</property>
				<value>0</value>
			</binding>
			<binding>
				<command>property-assign</command>
				<property>autopilot/kap140/panel/hdg-timer</property>
				<value>0</value>
			</binding>
			<binding>
				<command>property-assign</command>
				<property>autopilot/kap140/panel/nav-timer</property>
				<value>0</value>
			</binding>
		</button>
		
		<button>
			<legend>NAV</legend>
			<pref-width>40</pref-width>
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
					<not-equals>
						<property>autopilot/kap140/settings/lateral-mode</property>
						<value>3</value>
					</not-equals>
					<equals>
						<property>autopilot/kap140/settings/lateral-arm</property>
						<value>3</value>
					</equals>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/settings/lateral-arm</property>
				<value>-1</value>
			</binding>
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
					<not-equals>
						<property>autopilot/kap140/settings/lateral-mode</property>
						<value>3</value>
					</not-equals>
					<greater-than>
						<property>autopilot/kap140/settings/lateral-arm</property>
						<value>-1</value>
					</greater-than>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/settings/lateral-arm</property>
				<value>3</value>
			</binding>
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
					<not-equals>
						<property>autopilot/kap140/settings/lateral-mode</property>
						<value>3</value>
					</not-equals>
					<less-than>
						<property>autopilot/kap140/settings/lateral-arm</property>
						<value>0</value>
					</less-than>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/settings/lateral-arm</property>
				<value>0</value>
			</binding>
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
					<equals>
						<property>autopilot/kap140/settings/lateral-arm</property>
						<value>3</value>
					</equals>
					<not><property alias="/params/hsi-installed"/></not>
					<equals>
						<property>autopilot/kap140/settings/lateral-mode</property>
						<value>2</value>
					</equals>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/settings/from-hdg</property>
				<value>1</value>
			</binding>
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
					<equals>
						<property>autopilot/kap140/settings/lateral-arm</property>
						<value>0</value>
					</equals>
					<not><property alias="/params/hsi-installed"/></not>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/settings/from-hdg</property>
				<value>0</value>
			</binding>
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
					<equals>
						<property>autopilot/kap140/settings/lateral-arm</property>
						<value>3</value>
					</equals>
					<not><property alias="/params/hsi-installed"/></not>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/panel/hdg-timer</property>
				<property>sim/time/elapsed-sec</property>
			</binding>
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
					<equals>
						<property>autopilot/kap140/settings/lateral-arm</property>
						<value>0</value>
					</equals>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/panel/hdg-timer</property>
				<value>0</value>
			</binding>
			<binding>
				<command>property-assign</command>
				<property>autopilot/kap140/panel/nav-timer</property>
				<value>0</value>
			</binding>
		</button>
		
		<button>
			<legend>APR</legend>
			<pref-width>40</pref-width>
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
					<not-equals>
						<property>autopilot/kap140/settings/lateral-mode</property>
						<value>4</value>
					</not-equals>
					<equals>
						<property>autopilot/kap140/settings/lateral-arm</property>
						<value>4</value>
					</equals>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/settings/lateral-arm</property>
				<value>-1</value>
			</binding>
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
					<not-equals>
						<property>autopilot/kap140/settings/lateral-mode</property>
						<value>4</value>
					</not-equals>
					<greater-than>
						<property>autopilot/kap140/settings/lateral-arm</property>
						<value>-1</value>
					</greater-than>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/settings/lateral-arm</property>
				<value>4</value>
			</binding>
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
					<not-equals>
						<property>autopilot/kap140/settings/lateral-mode</property>
						<value>4</value>
					</not-equals>
					<less-than>
						<property>autopilot/kap140/settings/lateral-arm</property>
						<value>0</value>
					</less-than>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/settings/lateral-arm</property>
				<value>0</value>
			</binding>
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
					<equals>
						<property>autopilot/kap140/settings/lateral-arm</property>
						<value>4</value>
					</equals>
					<not><property alias="/params/hsi-installed"/></not>
					<equals>
						<property>autopilot/kap140/settings/lateral-mode</property>
						<value>2</value>
					</equals>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/settings/from-hdg</property>
				<value>1</value>
			</binding>
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
					<equals>
						<property>autopilot/kap140/settings/lateral-arm</property>
						<value>0</value>
					</equals>
					<not><property alias="/params/hsi-installed"/></not>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/settings/from-hdg</property>
				<value>0</value>
			</binding>
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
					<equals>
						<property>autopilot/kap140/settings/lateral-arm</property>
						<value>4</value>
					</equals>
					<not><property alias="/params/hsi-installed"/></not>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/panel/hdg-timer</property>
				<property>sim/time/elapsed-sec</property>
			</binding>
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
					<equals>
						<property>autopilot/kap140/settings/lateral-arm</property>
						<value>0</value>
					</equals>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/panel/hdg-timer</property>
				<value>0</value>
			</binding>
			<binding>
				<command>property-assign</command>
				<property>autopilot/kap140/panel/nav-timer</property>
				<value>0</value>
			</binding>
		</button>
		
		<button>
			<legend>REV</legend>
			<pref-width>40</pref-width>
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
					<not-equals>
						<property>autopilot/kap140/settings/lateral-mode</property>
						<value>5</value>
					</not-equals>
					<equals>
						<property>autopilot/kap140/settings/lateral-arm</property>
						<value>5</value>
					</equals>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/settings/lateral-arm</property>
				<value>-1</value>
			</binding>
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
					<not-equals>
						<property>autopilot/kap140/settings/lateral-mode</property>
						<value>5</value>
					</not-equals>
					<greater-than>
						<property>autopilot/kap140/settings/lateral-arm</property>
						<value>-1</value>
					</greater-than>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/settings/lateral-arm</property>
				<value>5</value>
			</binding>
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
					<not-equals>
						<property>autopilot/kap140/settings/lateral-mode</property>
						<value>5</value>
					</not-equals>
					<less-than>
						<property>autopilot/kap140/settings/lateral-arm</property>
						<value>0</value>
					</less-than>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/settings/lateral-arm</property>
				<value>0</value>
			</binding>
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
					<equals>
						<property>autopilot/kap140/settings/lateral-arm</property>
						<value>5</value>
					</equals>
					<not><property alias="/params/hsi-installed"/></not>
					<equals>
						<property>autopilot/kap140/settings/lateral-mode</property>
						<value>2</value>
					</equals>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/settings/from-hdg</property>
				<value>1</value>
			</binding>
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
					<equals>
						<property>autopilot/kap140/settings/lateral-arm</property>
						<value>0</value>
					</equals>
					<not><property alias="/params/hsi-installed"/></not>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/settings/from-hdg</property>
				<value>0</value>
			</binding>
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
					<equals>
						<property>autopilot/kap140/settings/lateral-arm</property>
						<value>5</value>
					</equals>
					<not><property alias="/params/hsi-installed"/></not>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/panel/hdg-timer</property>
				<property>sim/time/elapsed-sec</property>
			</binding>
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
					<equals>
						<property>autopilot/kap140/settings/lateral-arm</property>
						<value>0</value>
					</equals>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/panel/hdg-timer</property>
				<value>0</value>
			</binding>
			<binding>
				<command>property-assign</command>
				<property>autopilot/kap140/panel/nav-timer</property>
				<value>0</value>
			</binding>
		</button>
		
		<button>
			<legend>ALT</legend>
			<pref-width>40</pref-width>
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
					<equals>
						<property>autopilot/kap140/settings/vertical-mode</property>
						<value>2</value>
					</equals>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/settings/vertical-mode</property>
				<value>-1</value>
			</binding>
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
					<equals>
						<property>autopilot/kap140/settings/vertical-mode</property>
						<value>1</value>
					</equals>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/settings/vertical-mode</property>
				<value>2</value>
			</binding>
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
					<equals>
						<property>autopilot/kap140/settings/vertical-mode</property>
						<value>-1</value>
					</equals>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/settings/vertical-mode</property>
				<value>1</value>
			</binding>
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/panel/gs-timer</property>
				<value>0</value>
			</binding>
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
					<equals>
						<property>autopilot/kap140/settings/vertical-mode</property>
						<value>1</value>
					</equals>
				</condition>
				<command>property-assign</command>
				<property>autopilot/internal/target-pressure</property>
				<value>0.0</value>
			</binding>
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
					<equals>
						<property>autopilot/kap140/settings/vertical-mode</property>
						<value>2</value>
					</equals>
				</condition>
				<command>property-assign</command>
				<property>autopilot/internal/target-pressure</property>
				<property alias="/params/pressure-source"/>
			</binding>
		</button>
		
		<vrule/>
		
		<button>
			<legend>DOWN</legend>
			<pref-width>45</pref-width>
<!-- FPM setting -->
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
					<equals>
						<property>autopilot/kap140/settings/vertical-mode</property>
						<value>1</value>
					</equals>
				</condition>
				<command>property-adjust</command>
				<property>autopilot/internal/target-climb-rate</property>
				<step>-100</step>
				<min>-2000</min>
				<max>2000</max>
				<wrap>false</wrap>
			</binding>
			<binding>
				<command>property-assign</command>
				<property>autopilot/kap140/panel/fpm-old</property>
				<property>autopilot/internal/target-climb-rate</property>
			</binding>
<!--altitude setting-->
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
					<equals>
						<property>autopilot/kap140/settings/vertical-mode</property>
						<value>2</value>
					</equals>
				</condition>
				<command>property-adjust</command>
				<property>autopilot/internal/target-pressure</property>
				<step>0.022</step>
				<min>5.0</min>
				<max>35.0</max>
				<wrap>false</wrap>
			</binding>
		</button>
		
		<button>
			<legend>UP</legend>
			<pref-width>45</pref-width>
<!-- FPM setting -->
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
					<equals>
						<property>autopilot/kap140/settings/vertical-mode</property>
						<value>1</value>
					</equals>
				</condition>
				<command>property-adjust</command>
				<property>autopilot/internal/target-climb-rate</property>
				<step>100</step>
				<min>-2000</min>
				<max>2000</max>
				<wrap>false</wrap>
			</binding>
			<binding>
				<command>property-assign</command>
				<property>autopilot/kap140/panel/fpm-old</property>
				<property>autopilot/internal/target-climb-rate</property>
			</binding>
<!--altitude setting-->
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
					<equals>
						<property>autopilot/kap140/settings/vertical-mode</property>
						<value>2</value>
					</equals>
				</condition>
				<command>property-adjust</command>
				<property>autopilot/internal/target-pressure</property>
				<step>-0.022</step>
				<min>5.0</min>
				<max>35.0</max>
				<wrap>false</wrap>
			</binding>
		</button>

		<vrule/>

		<button>
			<legend>ARM</legend>
			<pref-width>40</pref-width>
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
					<equals>
						<property>autopilot/kap140/settings/vertical-arm</property>
						<value>2</value>
					</equals>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/settings/vertical-arm</property>
				<value>-1</value>
			</binding>
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
					<equals>
						<property>autopilot/kap140/settings/vertical-arm</property>
						<value>0</value>
					</equals>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/settings/vertical-arm</property>
				<value>2</value>
			</binding>
			<binding>
				<condition>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>6</value>
					</equals>
					<less-than>
						<property>autopilot/kap140/settings/vertical-arm</property>
						<value>0</value>
					</less-than>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/settings/vertical-arm</property>
				<value>0</value>
			</binding>
		</button>

		<button>
			<legend>BARO</legend>
			<pref-width>40</pref-width>
			<binding>
				<condition>
					<greater-than>
						<property>autopilot/kap140/panel/state</property>
						<value>3</value>
					</greater-than>
				</condition>
				<command>property-toggle</command>
				<property>autopilot/kap140/panel/baro-mode</property>
			</binding>
			<binding>
				<condition>
					<not><value alias="/params/baro-tied"/></not>
					<equals>
						<property>autopilot/kap140/panel/state</property>
						<value>4</value>
					</equals>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/panel/state</property>
				<value>5</value>
			</binding>
		</button>
	</group>

	<hrule/>

	<group>
		<layout>hbox</layout>
		<group>
			<layout>hbox</layout>
			<visible><not><value alias="/params/baro-tied"/></not></visible>
			<button>
				<legend>&lt;&lt;</legend>
				<pref-width>30</pref-width>
				<binding>
					<condition>
						<not><value alias="/params/baro-tied"/></not>
						<greater-than>
							<property>autopilot/kap140/panel/state</property>
							<value>3</value>
						</greater-than>
						<equals>
							<property>autopilot/kap140/panel/baro-mode</property>
							<value>0</value>
						</equals>
					</condition>
					<command>property-adjust</command>
					<property alias="/params/baro-inhg"/>
					<step>-0.10</step>
					<min>26.0</min>
					<max>33.0</max>
					<wrap>false</wrap>
				</binding>
				<binding>
					<condition>
						<not><value alias="/params/baro-tied"/></not>
						<greater-than>
							<property>autopilot/kap140/panel/state</property>
							<value>3</value>
						</greater-than>
						<equals>
							<property>autopilot/kap140/panel/baro-mode</property>
							<value>1</value>
						</equals>
					</condition>
					<command>property-adjust</command>
					<property alias="/params/baro-hpa"/>
					<step>-10</step>
					<min>880</min>
					<max>1118</max>
					<wrap>false</wrap>
				</binding>
				<binding>
					<condition>
						<not><value alias="/params/baro-tied"/></not>
						<equals>
							<property>autopilot/kap140/panel/state</property>
							<value>4</value>
						</equals>
					</condition>
					<command>property-assign</command>
					<property>autopilot/kap140/panel/state</property>
					<value>5</value>
				</binding>
			</button>
			<button>
				<legend>&lt;</legend>
				<pref-width>30</pref-width>
				<binding>
					<condition>
						<not><value alias="/params/baro-tied"/></not>
						<greater-than>
							<property>autopilot/kap140/panel/state</property>
							<value>3</value>
						</greater-than>
						<equals>
							<property>autopilot/kap140/panel/baro-mode</property>
							<value>0</value>
						</equals>
					</condition>
					<command>property-adjust</command>
					<property alias="/params/baro-inhg"/>
					<step>-0.01</step>
					<min>26.0</min>
					<max>33.0</max>
					<wrap>false</wrap>
				</binding>
				<binding>
					<condition>
						<not><value alias="/params/baro-tied"/></not>
						<greater-than>
							<property>autopilot/kap140/panel/state</property>
							<value>3</value>
						</greater-than>
						<equals>
							<property>autopilot/kap140/panel/baro-mode</property>
							<value>1</value>
						</equals>
					</condition>
					<command>property-adjust</command>
					<property alias="/params/baro-hpa"/>
					<step>-1</step>
					<min>880</min>
					<max>1118</max>
					<wrap>false</wrap>
				</binding>
				<binding>
					<condition>
						<not><value alias="/params/baro-tied"/></not>
						<equals>
							<property>autopilot/kap140/panel/state</property>
							<value>4</value>
						</equals>
					</condition>
					<command>property-assign</command>
					<property>autopilot/kap140/panel/state</property>
					<value>5</value>
				</binding>
			</button>
			<group>
				<layout>vbox</layout>
				<text>
					<label>Barometric</label>
				</text>
				<text>
					<label>Pressure</label>
				</text>
			</group>
			<button>
				<legend>&gt;</legend>
				<pref-width>30</pref-width>
				<binding>
					<condition>
						<not><value alias="/params/baro-tied"/></not>
						<greater-than>
							<property>autopilot/kap140/panel/state</property>
							<value>3</value>
						</greater-than>
						<equals>
							<property>autopilot/kap140/panel/baro-mode</property>
							<value>0</value>
						</equals>
					</condition>
					<command>property-adjust</command>
					<property alias="/params/baro-inhg"/>
					<step>0.01</step>
					<min>26.0</min>
					<max>33.0</max>
					<wrap>false</wrap>
				</binding>
				<binding>
					<condition>
						<not><value alias="/params/baro-tied"/></not>
						<greater-than>
							<property>autopilot/kap140/panel/state</property>
							<value>3</value>
						</greater-than>
						<equals>
							<property>autopilot/kap140/panel/baro-mode</property>
							<value>1</value>
						</equals>
					</condition>
					<command>property-adjust</command>
					<property alias="/params/baro-hpa"/>
					<step>1</step>
					<min>880</min>
					<max>1118</max>
					<wrap>false</wrap>
				</binding>
				<binding>
					<condition>
						<not><value alias="/params/baro-tied"/></not>
						<equals>
							<property>autopilot/kap140/panel/state</property>
							<value>4</value>
						</equals>
					</condition>
					<command>property-assign</command>
					<property>autopilot/kap140/panel/state</property>
					<value>5</value>
				</binding>
			</button>
			<button>
				<legend>&gt;&gt;</legend>
				<pref-width>30</pref-width>
				<binding>
					<condition>
						<not><value alias="/params/baro-tied"/></not>
						<greater-than>
							<property>autopilot/kap140/panel/state</property>
							<value>3</value>
						</greater-than>
						<equals>
							<property>autopilot/kap140/panel/baro-mode</property>
							<value>0</value>
						</equals>
					</condition>
					<command>property-adjust</command>
					<property alias="/params/baro-inhg"/>
					<step>0.10</step>
					<min>26.0</min>
					<max>33.0</max>
					<wrap>false</wrap>
				</binding>
				<binding>
					<condition>
						<not><value alias="/params/baro-tied"/></not>
						<greater-than>
							<property>autopilot/kap140/panel/state</property>
							<value>3</value>
						</greater-than>
						<equals>
							<property>autopilot/kap140/panel/baro-mode</property>
							<value>1</value>
						</equals>
					</condition>
					<command>property-adjust</command>
					<property alias="/params/baro-hpa"/>
					<step>10</step>
					<min>880</min>
					<max>1118</max>
					<wrap>false</wrap>
				</binding>
				<binding>
					<condition>
						<not><value alias="/params/baro-tied"/></not>
						<equals>
							<property>autopilot/kap140/panel/state</property>
							<value>4</value>
						</equals>
					</condition>
					<command>property-assign</command>
					<property>autopilot/kap140/panel/state</property>
					<value>5</value>
				</binding>
			</button>
		</group>
		<empty><stretch>1</stretch></empty>
		<vrule/>
		<empty><stretch>1</stretch></empty>

		<button>
			<legend>&lt;&lt;</legend>
			<pref-width>30</pref-width>
			<binding>
				<condition>
					<greater-than>
						<property>autopilot/kap140/panel/state</property>
						<value>4</value>
					</greater-than>
				</condition>
				<command>property-adjust</command>
				<property>autopilot/internal/target-altitude</property>
				<step>-1000</step>
				<min>-1000</min>
				<max>35000</max>
				<wrap>false</wrap>
			</binding>
			<binding>
				<condition>
					<greater-than>
						<property>autopilot/kap140/panel/state</property>
						<value>5</value>
					</greater-than>
					<equals>
						<property>autopilot/kap140/settings/vertical-arm</property>
						<value>0</value>
					</equals>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/settings/vertical-arm</property>
				<value>2</value>
			</binding>
		</button>
		<button>
			<legend>&lt;</legend>
			<pref-width>30</pref-width>
			<binding>
				<condition>
					<greater-than>
						<property>autopilot/kap140/panel/state</property>
						<value>4</value>
					</greater-than>
				</condition>
				<command>property-adjust</command>
				<property>autopilot/internal/target-altitude</property>
				<step>-100</step>
				<min>-1000</min>
				<max>35000</max>
				<wrap>false</wrap>
			</binding>
			<binding>
				<condition>
					<greater-than>
						<property>autopilot/kap140/panel/state</property>
						<value>5</value>
					</greater-than>
					<equals>
						<property>autopilot/kap140/settings/vertical-arm</property>
						<value>0</value>
					</equals>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/settings/vertical-arm</property>
				<value>2</value>
			</binding>
		</button>
		<group>
			<layout>vbox</layout>
			<text>
				<label>Altitude</label>
			</text>
			<text>
				<label>Preselect</label>
			</text>
		</group>
		<button>
			<legend>&gt;</legend>
			<pref-width>30</pref-width>
			<binding>
				<condition>
					<greater-than>
						<property>autopilot/kap140/panel/state</property>
						<value>4</value>
					</greater-than>
				</condition>
				<command>property-adjust</command>
				<property>autopilot/internal/target-altitude</property>
				<step>100</step>
				<min>-1000</min>
				<max>35000</max>
				<wrap>false</wrap>
			</binding>
			<binding>
				<condition>
					<greater-than>
						<property>autopilot/kap140/panel/state</property>
						<value>5</value>
					</greater-than>
					<equals>
						<property>autopilot/kap140/settings/vertical-arm</property>
						<value>0</value>
					</equals>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/settings/vertical-arm</property>
				<value>2</value>
			</binding>
		</button>
		<button>
			<legend>&gt;&gt;</legend>
			<pref-width>30</pref-width>
			<binding>
				<condition>
					<greater-than>
						<property>autopilot/kap140/panel/state</property>
						<value>4</value>
					</greater-than>
				</condition>
				<command>property-adjust</command>
				<property>autopilot/internal/target-altitude</property>
				<step>1000</step>
				<min>-1000</min>
				<max>35000</max>
				<wrap>false</wrap>
			</binding>
			<binding>
				<condition>
					<greater-than>
						<property>autopilot/kap140/panel/state</property>
						<value>5</value>
					</greater-than>
					<equals>
						<property>autopilot/kap140/settings/vertical-arm</property>
						<value>0</value>
					</equals>
				</condition>
				<command>property-assign</command>
				<property>autopilot/kap140/settings/vertical-arm</property>
				<value>2</value>
			</binding>
		</button>
	</group>

</PropertyList>