<?xml version="1.0"?>

<!-- McDonnell Douglas DC-10 Performance Applet -->
<!-- Copyright (c) 2026 Josh Davidson (Octal450) -->

<PropertyList>
	
	<name>performance</name>
	<layout>vbox</layout>
	
	<x>0</x>
	<y>0</y>
	
	<nasal>
		<open>
			setprop("/sim/gui/dialogs/performance/cg-percent-mac", sprintf("%4.1f", math.round(getprop("/fdm/jsbsim/inertia/cg-percent-mac"), 0.1)) ~ "% MAC");
			setprop("/sim/gui/dialogs/performance/zfwcg-percent-mac", sprintf("%4.1f", math.round(getprop("/fdm/jsbsim/inertia/zfwcg-percent-mac"), 0.1)) ~ "% MAC");
			
			setprop("/sim/gui/dialogs/performance/current-stabilizer-deg-round", sprintf("%4.1f", math.round(getprop("/systems/fcs/stabilizer/final-deg"), 0.1) * -1) ~ " DEG");
			
			setprop("/sim/gui/dialogs/performance/opt-fl-fmt", "FL" ~ math.round(getprop("/systems/performance/opt-fl")));
			setprop("/sim/gui/dialogs/performance/max-fl-fmt", "FL" ~ math.round(getprop("/systems/performance/max-fl")));
			setprop("/sim/gui/dialogs/performance/flap-retract-round", math.round(getprop("/systems/performance/flap-retract")));
			setprop("/sim/gui/dialogs/performance/slat-retract-round", math.round(getprop("/systems/performance/slat-retract")));
			setprop("/sim/gui/dialogs/performance/min-maneuver-round", math.round(getprop("/systems/performance/min-maneuver")));
			
			setprop("/sim/gui/dialogs/performance/v1-round", math.round(getprop("/systems/performance/v1")));
			setprop("/sim/gui/dialogs/performance/vr-round", math.round(getprop("/systems/performance/vr")));
			setprop("/sim/gui/dialogs/performance/v2-round", math.round(getprop("/systems/performance/v2")));
			setprop("/sim/gui/dialogs/performance/stabilizer-deg-round", sprintf("%4.1f", math.round(getprop("/systems/performance/stabilizer-deg"), 0.1)) ~ " DEG");
			
			setprop("/sim/gui/dialogs/performance/vapp-round", math.round(getprop("/systems/performance/vapp")));
			setprop("/sim/gui/dialogs/performance/vref-round", math.round(getprop("/systems/performance/vref")));
			
			var loop = maketimer(0.1, func() {
				setprop("/sim/gui/dialogs/performance/cg-percent-mac", sprintf("%4.1f", math.round(getprop("/fdm/jsbsim/inertia/cg-percent-mac"), 0.1)) ~ "% MAC");
				setprop("/sim/gui/dialogs/performance/zfwcg-percent-mac", sprintf("%4.1f", math.round(getprop("/fdm/jsbsim/inertia/zfwcg-percent-mac"), 0.1)) ~ "% MAC");
				
				setprop("/sim/gui/dialogs/performance/current-stabilizer-deg-round", sprintf("%4.1f", math.round(getprop("/systems/fcs/stabilizer/final-deg"), 0.1) * -1) ~ " DEG");
				
				setprop("/sim/gui/dialogs/performance/opt-fl-fmt", "FL" ~ math.round(getprop("/systems/performance/opt-fl")));
				setprop("/sim/gui/dialogs/performance/max-fl-fmt", "FL" ~ math.round(getprop("/systems/performance/max-fl")));
				setprop("/sim/gui/dialogs/performance/flap-retract-round", math.round(getprop("/systems/performance/flap-retract")));
				setprop("/sim/gui/dialogs/performance/slat-retract-round", math.round(getprop("/systems/performance/slat-retract")));
				setprop("/sim/gui/dialogs/performance/min-maneuver-round", math.round(getprop("/systems/performance/min-maneuver")));
				
				setprop("/sim/gui/dialogs/performance/v1-round", math.round(getprop("/systems/performance/v1")));
				setprop("/sim/gui/dialogs/performance/vr-round", math.round(getprop("/systems/performance/vr")));
				setprop("/sim/gui/dialogs/performance/v2-round", math.round(getprop("/systems/performance/v2")));
				setprop("/sim/gui/dialogs/performance/stabilizer-deg-round", sprintf("%4.1f", math.round(getprop("/systems/performance/stabilizer-deg"), 0.1)) ~ " DEG");
				
				setprop("/sim/gui/dialogs/performance/vapp-round", math.round(getprop("/systems/performance/vapp")));
				setprop("/sim/gui/dialogs/performance/vref-round", math.round(getprop("/systems/performance/vref")));
			});
			loop.start();
		</open>
		<close>
			loop.stop();
		</close>
	</nasal>
	
	<group>
		<layout>hbox</layout>
		
		<text>
			<halign>left</halign>
			<label>Performance Applet</label>
		</text>
		
		<button>
			<halign>right</halign>
			<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>CG: </label>
		</text>
		<text>
			<row>0</row>
			<col>1</col>
			<label>999999999</label>
			<live>true</live>
			<property>/sim/gui/dialogs/performance/cg-percent-mac</property>
		</text>
		<text>
			<row>1</row>
			<col>0</col>
			<label>ZFWCG: </label>
		</text>
		<text>
			<row>1</row>
			<col>1</col>
			<label>999999999</label>
			<live>true</live>
			<property>/sim/gui/dialogs/performance/zfwcg-percent-mac</property>
		</text>
	</group>
	
	<hrule/>
	
	<group>
		<layout>table</layout>
		
		<text>
			<row>0</row>
			<col>0</col>
			<label>CURRENT STAB: </label>
		</text>
		<text>
			<row>0</row>
			<col>1</col>
			<label>9999999</label>
			<live>true</live>
			<property>/sim/gui/dialogs/performance/current-stabilizer-deg-round</property>
		</text>
	</group>
	
	<hrule/>
	
	<group>
		<layout>table</layout>
		
		<text>
			<row>0</row>
			<col>0</col>
			<label>OPT CRZ FL: </label>
		</text>
		<text>
			<row>0</row>
			<col>1</col>
			<label>99999</label>
			<live>true</live>
			<property>/sim/gui/dialogs/performance/opt-fl-fmt</property>
		</text>
		
		<text>
			<row>1</row>
			<col>0</col>
			<label>MAX CRZ FL: </label>
		</text>
		<text>
			<row>1</row>
			<col>1</col>
			<label>99999</label>
			<live>true</live>
			<property>/sim/gui/dialogs/performance/max-fl-fmt</property>
		</text>
		
		<text>
			<row>2</row>
			<col>0</col>
			<label>FLAP RET: </label>
		</text>
		<text>
			<row>2</row>
			<col>1</col>
			<label>999</label>
			<live>true</live>
			<property>/sim/gui/dialogs/performance/flap-retract-round</property>
		</text>
		
		<text>
			<row>3</row>
			<col>0</col>
			<label>SLAT RET: </label>
		</text>
		<text>
			<row>3</row>
			<col>1</col>
			<label>999</label>
			<live>true</live>
			<property>/sim/gui/dialogs/performance/slat-retract-round</property>
		</text>
		
		<text>
			<row>4</row>
			<col>0</col>
			<label>CLEAN MNVR: </label>
		</text>
		<text>
			<row>4</row>
			<col>1</col>
			<label>999</label>
			<live>true</live>
			<property>/sim/gui/dialogs/performance/min-maneuver-round</property>
		</text>
	</group>
	
	<hrule/>
	
	<group>
		<layout>table</layout>
		
		<text>
			<row>0</row>
			<col>0</col>
			<label>Takeoff Flap:</label>
		</text>
		
		<button>
			<row>0</row>
			<col>1</col>
			<pref-width>25</pref-width>
			<pref-height>25</pref-height>
			<legend>&lt;</legend>
			<binding>
				<command>property-adjust</command>
				<property>/systems/performance/to-flaps</property>
				<step>-1</step>
				<min>10</min>
				<max>25</max>
			</binding>
		</button>

		<input>
			<row>0</row>
			<col>2</col>
			<pref-width>50</pref-width>
			<property>/systems/performance/to-flaps</property>
			<live>true</live>
		</input>
		
		<button>
			<row>0</row>
			<col>3</col>
			<pref-width>25</pref-width>
			<pref-height>25</pref-height>
			<legend>&gt;</legend>
			<binding>
				<command>property-adjust</command>
				<property>/systems/performance/to-flaps</property>
				<step>1</step>
				<min>10</min>
				<max>25</max>
			</binding>
		</button>
	</group>
	
	<hrule/>
	
	<group>
		<layout>table</layout>
		
		<text>
			<row>0</row>
			<col>0</col>
			<label>V1: </label>
		</text>
		<text>
			<row>0</row>
			<col>1</col>
			<label>999</label>
			<live>true</live>
			<property>/sim/gui/dialogs/performance/v1-round</property>
		</text>
		
		<text>
			<row>1</row>
			<col>0</col>
			<label>VR: </label>
		</text>
		<text>
			<row>1</row>
			<col>1</col>
			<label>999</label>
			<live>true</live>
			<property>/sim/gui/dialogs/performance/vr-round</property>
		</text>
		
		<text>
			<row>2</row>
			<col>0</col>
			<label>V2: </label>
		</text>
		<text>
			<row>2</row>
			<col>1</col>
			<label>999</label>
			<live>true</live>
			<property>/sim/gui/dialogs/performance/v2-round</property>
		</text>
		
		<text>
			<row>3</row>
			<col>0</col>
			<label>T/O STAB: </label>
		</text>
		<text>
			<row>3</row>
			<col>1</col>
			<label>9999999</label>
			<live>true</live>
			<property>/sim/gui/dialogs/performance/stabilizer-deg-round</property>
		</text>
	</group>
	
	<button>
		<pref-width>190</pref-width>
		<pref-height>25</pref-height>
		<legend>Set Takeoff ASI Bugs</legend>
		<binding>
			<command>nasal</command>
			<script>cockpit.setAsiBugs(0);</script>
		</binding>
	</button>
	
	<hrule/>
	
	<group>
		<layout>table</layout>
		
		<text>
			<row>0</row>
			<col>0</col>
			<label>Landing Flap:</label>
		</text>
		
		<button>
			<row>0</row>
			<col>1</col>
			<pref-width>25</pref-width>
			<pref-height>25</pref-height>
			<legend>&lt;</legend>
			<binding>
				<condition>
					<greater-than>
						<property>/systems/performance/land-flaps</property>
						<value>0</value>
					</greater-than>
				</condition>
				<command>property-cycle</command>
				<property>/systems/performance/land-flaps</property>
				<value>50</value>
				<value>35</value>
				<value>22</value>
				<value>15</value>
				<value>0</value>
			</binding>
		</button>
		
		<input>
			<row>0</row>
			<col>2</col>
			<pref-width>50</pref-width>
			<property>/systems/performance/land-flaps</property>
			<live>true</live>
		</input>
		
		<button>
			<row>0</row>
			<col>3</col>
			<pref-width>25</pref-width>
			<pref-height>25</pref-height>
			<legend>&gt;</legend>
			<binding>
				<condition>
					<less-than>
						<property>/systems/performance/land-flaps</property>
						<value>50</value>
					</less-than>
				</condition>
				<command>property-cycle</command>
				<property>/systems/performance/land-flaps</property>
				<value>0</value>
				<value>15</value>
				<value>22</value>
				<value>35</value>
				<value>50</value>
			</binding>
		</button>
	</group>
	
	<group>
		<layout>table</layout>
		
		<checkbox>
			<label>Slats Retracted Landing</label>
			<halign>left</halign>
			<property>/systems/performance/land-no-slats</property>
			<binding>
				<command>dialog-apply</command>
			</binding>
			<live>true</live>
		</checkbox>
	</group>
	
	<hrule/>
	
	<group>
		<layout>table</layout>
		
		<text>
			<row>0</row>
			<col>0</col>
			<label>VAPP: </label>
		</text>
		<text>
			<row>0</row>
			<col>1</col>
			<label>999</label>
			<live>true</live>
			<property>/sim/gui/dialogs/performance/vapp-round</property>
		</text>
		
		<text>
			<row>1</row>
			<col>0</col>
			<label>VREF: </label>
		</text>
		<text>
			<row>1</row>
			<col>1</col>
			<label>999</label>
			<live>true</live>
			<property>/sim/gui/dialogs/performance/vref-round</property>
		</text>
	</group>
	
	<button>
		<pref-width>190</pref-width>
		<pref-height>25</pref-height>
		<legend>Set Landing ASI Bugs</legend>
		<binding>
			<command>nasal</command>
			<script>cockpit.setAsiBugs(1);</script>
		</binding>
	</button>

</PropertyList>
