<Gauge Name="HUDHornet HSI">
<Element>
<Visible>(A:ELECTRICAL MASTER BATTERY, bool)</Visible>
<Image Name="HSIBack.bmp" Bright="Yes" ImageSizes="456,456"/>
<Element>
	<Position X="0" Y="0"/>
	<Container/>
	<Update Frequency="15"/>
	<Element>
		(*--<Size X="200" Y="200"/>--*)
		<Visible>(A:Circuit general panel on, bool)</Visible>
		<Element>
			<Position X="228" Y="228"/>
			<Image Name="Rose3.bmp" Bright="Yes" ImageSizes="400,400">
				<Axis X="200" Y="200"/>  (*--y is 272 for alternate ladder0.bmp--*)
		    	</Image>
			<Rotate>
    	    			<Value>(A:PLANE HEADING DEGREES GYRO, radians) /-/</Value>
		   	</Rotate>
	
		</Element>
	</Element>
\\---Heading digital
     <Element>
	  <Position X="194" Y="27"/>
	  <Text X="65" Y="20" Bright="Yes" Length="3" Font="arial" Color="#00c000" Adjust="Center" VerticalAdjust="Center" Multiline="No" Fixed="No">
               <String>%((A:Plane heading degrees gyro, degrees))%!03d!%</String>
          </Text>
     </Element>
\\---HSI Localiser
<comment>
<Value>(L:Steering Switch, enum) 2 == if{ (A:NAV2 OBS, radians) (A:Plane heading degrees gyro, radians) - } els{ (L:Steering Switch, enum) 1 == if{ (A:NAV1 OBS, radians) (A:Plane heading degrees gyro, radians) -  } }</Value>
</comment>
	<Element>	
		<Position X="228" Y="228"/>  (*---loc at 118, 56, with axis on locind's 110,172---*)
            	<Image Name="LocInd2.bmp" Bright="Yes" ImageSizes="175,140">
               		<Axis X="110" Y="172"/>
            	</Image>
            	<Rotate>
                  	<Value>(A:NAV1 OBS, radians) (A:Plane heading degrees gyro, radians) -</Value>
            	</Rotate>
	</Element>
	<Element>
               	<Visible>(A:HSI has localizer, bool)</Visible>
               	<Position X="228" Y="228"/> (*---HSIH pos was 228,228; axis 4.5,70.5--*)
		<Image Name="LOc-HSI2.bmp" Bright="Yes" ImageSizes="36,340">
                        <Axis X="18" Y="170"/>
		</Image>
		<Shift>
               		<Value Minimum="-1" Maximum="1">(A:HSI CDI needle, number) 127 /</Value>
			<Nonlinearity>
				<Item Value="-1" X="119" Y="228"/>
				<Item Value="0" X="228" Y="228"/>
				<Item Value="1" X="333" Y="228"/>
			</Nonlinearity>
		</Shift>	
               <Rotate>
                  	<Value>(A:NAV1 OBS, radians) (A:Plane heading degrees gyro, radians) -</Value>
               </Rotate>
               <Clip/>
            </Element>
//-----160 pixels = HSI radius
//---VOR1arrow
     <Element>
	<Visible>(A:NAV1 HAS NAV, bool) </Visible>
	 <Position X="228" Y="228"/> (*--was 210, 60, added axis values--*)
	 <Image Name="VOR1arw.bmp" Bright="Yes" ImageSizes="36,452">
				<Axis X="18" Y="218"/> 
	 </Image>
	 <Rotate>
                 	<Value>(A:NAV1 Radial,radians) (A:Plane heading degrees gyro,radians) - pi  +</Value>
         	</Rotate>

     </Element>
//---VOR2arrow
     <Element>
	<Visible>(A:NAV2 HAS NAV, bool)</Visible>
	 <Position X="228" Y="228"/> (*--was 210, 60, added axis values--*)
	 <Image Name="VOR2arw2.bmp" Bright="Yes" ImageSizes="36,452">
				<Axis X="18" Y="218"/> 
	 </Image>
	 <Rotate>
                 	<Value>(A:NAV2 Radial,radians) (A:Plane heading degrees gyro,radians) - pi  +</Value>
         	</Rotate>
     </Element>



//---ADF arrow and text
     <Element>
	<Visible>(A:ADF1 signal, number) 0 &gt;</Visible>
	 <Position X="228" Y="228"/> (*--was 210, 60, added axis values--*)
	 <Image Name="ADFarw.bmp" Bright="Yes" ImageSizes="400,400">
				<Axis X="18" Y="218"/> 
	 </Image>
	 <Rotate>
                     <Value>(A:ADF1 radial, radians)</Value>
         </Rotate>
     </Element>
	<Element>
		<Visible>(A:ADF1 SIGNAL, number) 0 &gt;</Visible>
		<Position X="275" Y="44"/>
		<Text X="120" Y="17" Bright="Yes" Length="10" Font="Arial" Color="#00c000" Adjust="Center" VerticalAdjust="Center" Multiline="No" Fixed="No">
			<String>%ADF: %((A:ADF1 IDENT, string))%!s!%</String>
		</Text>

	</Element>

//---GPS arrow <Comment><Value>(A:GPS WP BEARING, radians) d360 (A:Plane heading degrees gyro, radians)  -</Value></Comment>
     <Element>
	
	 <Position X="228" Y="228"/> (*--was 210, 60, added axis values--*)
	 <Image Name="GPSarw.bmp" Bright="Yes" ImageSizes="36,452">
				<Axis X="18" Y="218"/> 
	 </Image>
	 <Rotate>
		<Value>(A:GPS WP TRUE BEARING, radians) (A:GPS GROUND TRUE HEADING, radians) -</Value>
         	</Rotate>
     </Element>

//---Heading Select Bug
     <Element>
	 <Position X="228" Y="228"/> 
	 <Image Name="HSelBug.bmp" Bright="Yes" ImageSizes="36,452">
				<Axis X="18" Y="218"/> 
	 </Image>
	<Rotate>
                 	<Value>(A:Autopilot heading lock dir, radians) (A:Plane heading degrees gyro, radians) -</Value>
         	</Rotate>
     </Element>

//---NAV1 text block
<Element>
<Comment><Visible>(A:GPS drives nav1,bool) ! (L:Steering Switch, enum) 2 &lt;= &amp;&amp;</Visible></Comment>
    <Element>
	  <Visible>(A:NAV1 HAS NAV, bool)</Visible>
	  <Position X="19" Y="27"/>
	  <Text X="160" Y="17" Bright="Yes" Length="24" Font="arial" Color="#00c000" Adjust="Right" VerticalAdjust="Center" Multiline="No" Fixed="No">
               <String>%((A:HSI distance, nmiles) s1 0 &gt;=)%{if}%(l1 100 &gt;=)%{if}%(l1)%!d!%{else}%(l1)%!0.1f!%{end}% %{else}--- %{end}%((A:Nav1 ident, string))%!s!% %{end}% %((A:NAV1 HAS LOCALIZER, bool) !)%{if}%((A:NAV1 Radial, degrees) dnor 180 + 360 % )%!03.0f!%{else}%----%{end}%</String>
          </Text>
     </Element>
    <Element>
	<Visible>(A:NAV1 HAS LOCALIZER, bool)</Visible>
	  <Position X="38" Y="61"/>
	  <Text X="55" Y="17" Bright="Yes" Length="3" Font="arial" Color="#00c000" Adjust="Left" VerticalAdjust="Center" Multiline="No" Fixed="No">
               <String>%LOC%</String>
          </Text>
     </Element>
     <Element>
	<Visible>(A:NAV1 HAS GLIDE SLOPE, bool)</Visible>
	  <Position X="89" Y="61"/>
	  <Text X="55" Y="17" Bright="Yes" Length="2" Font="arial" Color="#00c000" Adjust="Left" VerticalAdjust="Center" Multiline="No" Fixed="No">
               <String>%GS%</String>
          </Text>
     </Element>
</Element>
	
//---NAV2 text block
     <Element>
         <Visible>(A:NAV2 HAS NAV, bool)</Visible>
	  <Position X="277" Y="27"/>
	  <Text X="160" Y="17" Bright="Yes" Length="24" Font="arial" Color="#00c000" Adjust="Left" VerticalAdjust="Center" Multiline="No" Fixed="No">
               <String>%((A:NAV2 DME, nmiles) s1 0 &gt;=)%{if}%(l1 100 &gt;=)%{if}%(l1)%!d!%{else}%(l1)%!0.1f!%{end}% %{else}--- %{end}%((A:Nav2 ident, string))%!s!% %{end}% %((A:NAV2 HAS LOCALIZER, bool) !)%{if}%((A:NAV2 Radial, degrees) dnor 180 + 360 % )%!03.0f!%{else}%----%{end}%</String>
          </Text>
     </Element>
//---GPS text block
        <Element>
     	<Comment><Visible>(A:GPS drives nav1,bool)  (L:Steering Switch, enum) 3 == ||</Visible></Comment>
        <Element>
           <Position X="33" Y="44"/>
             <Text X="160" Y="17" Bright="Yes" Length="18" Font="arial" Color="#00c000" Adjust="Left" VerticalAdjust="Center" Multiline="No" Fixed="No">
                 <String>%((A:GPS WP DISTANCE, nmiles))%!4.1f!%/%((A:GPS WP BEARING, degrees) d360)%!03d!% %W:%((A:GPS WP NEXT ID, string))%!s!% </String>
	</Text>
        </Element>
   </Element>	
//---CRS and HDG text block
     <Element>
	  <Position X="19" Y="386"/>
	  <Text X="145" Y="17" Bright="Yes" Length="8" Font="arial" Color="#00c000" Adjust="Right" VerticalAdjust="Center" Multiline="No" Fixed="No">
		<String>%HSEL% %((A:AUTOPILOT HEADING LOCK DIR,degrees))%!03d!</String>               
          	</Text>
     </Element>	
     <Element>
	  <Position X="285" Y="386"/>
	  <Text X="145" Y="17" Bright="Yes" Length="9" Font="arial" Color="#00c000" Adjust="Left" VerticalAdjust="Center" Multiline="No" Fixed="No">
               	<String>%CSEL1% %((A:NAV1 OBS,degrees))%!03d!</String>
          	</Text>
     </Element>	
138,236; 57x22
//---- True Airspeed and Groundspeed
     	<Element>
	  	<Position X="146" Y="236"/>
	  	<Text X="57" Y="17" Bright="Yes" Length="4" Font="arial" Color="#00c000" Adjust="Right" VerticalAdjust="Center" Multiline="No" Fixed="No">
               		<String>%((A:AIRSPEED TRUE,knots))%!3d!%T%</String>
          		</Text>
    	 </Element>
	<Element>
	  	<Position X="254" Y="236"/>
	  	<Text X="57" Y="17" Bright="Yes" Length="4" Font="arial" Color="#00c000" Adjust="Left" VerticalAdjust="Center" Multiline="No" Fixed="No">
               		<String>%((A:GROUND VELOCITY,knots))%!3d!%G%</String>
          		</Text>
    	 </Element>
//---VOR moving symbols on HSI*************************************************************************************************************
<comment>
use rel. brg. and DME
bearing = { (A:NAV2 Radial, degrees) dnor 180 + 360 % (A:Plane heading degrees gyro, degrees) - }
DME must be ground distance to VOR, 
GDVOR ~=  { (A:Radio height, feet) (A:NAV2 DME, feet) / asin cos (A:NAV2 DME, feet) * } 
(any way to get VOR's altitude?)
*************************
VORSym image centered at 216,216 on background
asin (alt diff * actual DME) = ground dist to VOR (GDVOR);
on HSI:
X movement = sin(rel. BRG) x GDVOR/HSIrange
Ymovement = cos(rel. BRG) x GDVOR/HSIrange
**************************

</comment>

<Element>
	<Select>
         		<Value>(A:NAV2 Radial, degrees) dnor 180 + 360 % (A:Plane heading degrees gyro, degrees) dnor - dnor (>L:NAV2Brg, degrees)</Value>
      	</Select>
</Element>
<Element>
	<Select>
         		<Value>(A:NAV1 Radial, degrees) dnor 180 + 360 % (A:Plane heading degrees gyro, degrees) dnor - dnor (>L:NAV1Brg, degrees)</Value>
      	</Select>
</Element>
<Element>
	<Select>
         		<Value>(A:Radio height, feet) (A:NAV2 DME, feet) / asin cos (A:NAV2 DME, feet) * (>L:NAV2GroundDistance, feet)</Value>
      	</Select>
</Element>
<Element>
	<Select>
         		<Value>(A:Radio height, feet) (A:NAV1 DME, feet) / asin cos (A:NAV1 DME, feet) * (>L:NAV1GroundDistance, feet)</Value>
      	</Select>
</Element>
<Element>
	<Select>
         		<Value>(L:NAV2Brg, radians) sin (L:NAV2GroundDistance, nmiles) * (>L:NAV2XMovement, number)</Value>
      	</Select>
</Element>
<Element>
	<Select>
         		<Value>(L:NAV2Brg, radians) cos (L:NAV2GroundDistance, nmiles) * (>L:NAV2YMovement, number)</Value>
      	</Select>
</Element>
<Element>
	<Select>
         		<Value>(L:NAV1Brg, radians) sin (L:NAV1GroundDistance, nmiles) * (>L:NAV1XMovement, number)</Value>
      	</Select>
</Element>
<Element>
	<Select>
         		<Value>(L:NAV1Brg, radians) cos (L:NAV1GroundDistance, nmiles) * (>L:NAV1YMovement, number)</Value>
      	</Select>
</Element>
//----****************** for GPS, GPS WP DISTANCE is ground distance, not direct. ; GPS WP BEARING
<Element>
	<Select>
         		<Value>(A:GPS WP TRUE BEARING, radians) (A:GPS GROUND TRUE HEADING, radians) - sin (A:GPS WP DISTANCE, nmiles) * (>L:GPSXMovement, number)</Value>
      	</Select>
</Element>
<Element>
	<Select>
         		<Value>(A:GPS WP TRUE BEARING, radians) (A:GPS GROUND TRUE HEADING, radians) - cos (A:GPS WP DISTANCE, nmiles) * (>L:GPSYMovement, number)</Value>
      	</Select>
</Element>

//-----**********************HSI ZOOM
	<Element>
		<Select>
         			<Value> (L:HSIZoomSet, number) 0 == if{ 10 (>L:HSIZoomSet, number) }</Value>
      		</Select>
	</Element>
    	 <Element>
	 	 <Position X="170" Y="8"/>
	  	<Text X="112" Y="17" Bright="Yes" Length="7" Font="arial" Color="#00c000" Adjust="Center" VerticalAdjust="Center" Multiline="No" Fixed="No">
              		 <String>%SCL/%((L:HSIZoomSet, number))%!2d!%</String>
         		 </Text>
     	</Element>

//-----********************

     <Element>
	<Visible>(A:NAV2 HAS NAV, bool) (A:NAV2 HAS DME, bool) &amp;&amp; (L:NAV2GroundDistance, nmiles) (L:HSIZoomSet, number) / 1 &lt; &amp;&amp;</Visible>
	 <Position X="216" Y="216"/> (*--was 210, 60, added axis values--*)
	 <Image Name="VOR2sym3.bmp" Bright="Yes" ImageSizes="26,26">
	 </Image>
	<Shift>
               	<Value Minimum="-10" Maximum="10">10 (L:HSIZoomSet, number) / (L:NAV2XMovement, number) *</Value>
		<Nonlinearity>
			<Item Value="-10" X="64" Y="216"/>
			<Item Value="0" X="216" Y="216"/>
			<Item Value="10" X="368" Y="216"/>
		</Nonlinearity>
	</Shift>	
	<Shift>
               	<Value Minimum="-10" Maximum="10">10 (L:HSIZoomSet, number) / (L:NAV2YMovement, number) *</Value>
		<Nonlinearity>
			<Item Value="-10" X="216" Y="368"/>
			<Item Value="0" X="216" Y="216"/>
			<Item Value="10" X="216" Y="64"/>
		</Nonlinearity>
	</Shift>	
     </Element>
<Element>
	<Visible>(A:NAV1 HAS NAV, bool) (A:NAV1 HAS DME, bool) &amp;&amp; (A:NAV1 HAS LOC, bool) ! &amp;&amp; (L:NAV1GroundDistance, nmiles) (L:HSIZoomSet, number) / 1 &lt; &amp;&amp;</Visible>
	 <Position X="216" Y="216"/> (*--was 210, 60, added axis values--*)
	 <Image Name="VOR1sym3.bmp" Bright="Yes" ImageSizes="26,26">
	 </Image>
	<Shift>
               	<Value Minimum="-10" Maximum="10">10 (L:HSIZoomSet, number) / (L:NAV1XMovement, number) *</Value>
		<Nonlinearity>
			<Item Value="-10" X="54" Y="216"/>
			<Item Value="0" X="216" Y="216"/>
			<Item Value="10" X="378" Y="216"/>
		</Nonlinearity>
	</Shift>	
	<Shift>
               	<Value Minimum="-10" Maximum="10">10 (L:HSIZoomSet, number) / (L:NAV1YMovement, number) *</Value>
		<Nonlinearity>
			<Item Value="-10" X="216" Y="378"/>
			<Item Value="0" X="216" Y="216"/>
			<Item Value="10" X="216" Y="54"/>
		</Nonlinearity>
	</Shift>	
     </Element>
<Element>
	<Visible>(A:GPS WP DISTANCE, nmiles) (L:HSIZoomSet, number) / 1 &lt;</Visible>
	 <Position X="216" Y="216"/> (*--was 210, 60, added axis values--*)
	 <Image Name="GPSsym3.bmp" Bright="Yes" ImageSizes="26,26">
	 </Image>
	<Shift>
               	<Value Minimum="-10" Maximum="10">10 (L:HSIZoomSet, number) / (L:GPSXMovement, number) *</Value>
		<Nonlinearity>
			<Item Value="-10" X="54" Y="216"/>
			<Item Value="0" X="216" Y="216"/>
			<Item Value="10" X="378" Y="216"/>
		</Nonlinearity>
	</Shift>	
	<Shift>
               	<Value Minimum="-10" Maximum="10">10 (L:HSIZoomSet, number) / (L:GPSYMovement, number) *</Value>
		<Nonlinearity>
			<Item Value="-10" X="216" Y="378"/>
			<Item Value="0" X="216" Y="216"/>
			<Item Value="10" X="216" Y="54"/>
		</Nonlinearity>
	</Shift>	
     </Element>
//---END VOR moving symbols on HSI*************************************************************************************************************
	

</Element>
</Element>
//--------MOUSE *****************************************************************************

	
  	 <Mouse> 
		//------HSI zooms are 5, 10(default) 20, 40, 80nm
		<Area Left="190" Right="262" Top="0" Bottom="50">
        			 <Cursor Type="Hand"/>
         			<Click>(L:HSIZoomSet, number) 80 == if{ 5 (>L:HSIZoomSet, number) } els{ (L:HSIZoomSet, number) 2 * (>L:HSIZoomSet, number) }</Click>
			<Tooltip ID="">HSI range</Tooltip>
      		</Area>
		
  	 </Mouse>
	



</Gauge>
