<?xml version="1.0"?>

<!--
  Copy-and-modify from the Default HSI gauge instrument.
  Fixes to heading bug and compass textures to align properly.

HSI instrument
Started 24-7-01 by Timothy Gale
-->

<PropertyList>
    <name>HSI</name>
    <w-base>128</w-base>
    <h-base>128</h-base>

 <params>
  <nav-gs-needle-deflection>/instrumentation/nav[0]/gs-needle-deflection-norm</nav-gs-needle-deflection>
  <hsi-has-gs-needle>/sim/instrument-options/hsi[0]/has-gs-needle</hsi-has-gs-needle>
  <hsi-gs-in-range>/instrumentation/nav[0]/gs-in-range</hsi-gs-in-range>
 </params>

 <layers>
     <layer>
      <name>compass rose</name>
       <texture>
	<path>Aircraft/Instruments/Textures/faces-1-hi.rgb</path>
	<x1>0.0</x1>
	<y1>0.5</y1>
	<x2>0.5</x2>
	<y2>1.0</y2>
      </texture>
      <w>104</w>
      <h>104</h>
     <transformations>
      <transformation>
      <type>rotation</type>
      <property>/orientation/heading-magnetic-deg</property>
      <min>-360.0</min>
      <max>360.0</max>
      <scale>-1.0</scale>
      </transformation>
    </transformations>
   </layer>
	
<!-- Taken from Nav1.xml -->
  <layer>
   <name>TO/FROM/OFF flag</name>
   <type>switch</type>
   <layer>
    <condition>
     <property>/instrumentation/nav[0]/to-flag</property>
    </condition>
    <name>TO flag</name>
    <texture>
     <path>Aircraft/Instruments/Textures/misc-1.rgb</path>
     <x1>0.9375</x1>
     <y1>0.578125</y1>
     <x2>1.0</x2>
     <y2>0.625</y2>
    </texture>
    <w>14</w>
    <h>14</h>
   </layer>
   <layer>
    <name>FROM/OFF flag</name>
    <type>switch</type>
    <layer>
     <condition>
      <property>/instrumentation/nav[0]/from-flag</property>
     </condition>
     <name>FROM flag</name>
     <texture>
      <path>Aircraft/Instruments/Textures/misc-1.rgb</path>
      <x1>0.9375</x1>
      <y1>0.625</y1>
      <x2>1.0</x2>
      <y2>0.671875</y2>
     </texture>
     <w>14</w>
     <h>14</h>
    </layer>
    <layer>
     <name>OFF flag</name>
     <texture>
      <path>Aircraft/Instruments/Textures/misc-1.rgb</path>
      <x1>0.9375</x1>
      <y1>0.5</y1>
      <x2>1.0</x2>
      <y2>0.546875</y2>
     </texture>
     <w>14</w>
     <h>14</h>
    </layer>
   </layer>
   <transformations>
    <transformation>
    <type>rotation</type>
    <property>/orientation/heading-magnetic-deg</property>
    <min>0.0</min>
    <max>360</max>
    <scale>-1.0</scale>
   </transformation>
   <transformation>
    <type>rotation</type>
    <property>/instrumentation/nav[0]/radials/selected-deg</property>
    <min>0.0</min>
    <max>360.0</max>
    <scale>1.0</scale>
   </transformation>
   <transformation>
     <type>y-shift</type>
     <offset>16</offset>
    </transformation>
   </transformations>
  </layer>

  <layer>
  <name>glidescope needle</name>
  <condition>
   <equals>
     <property alias="../../../../../params/hsi-has-gs-needle"/>
     <value>1</value>
   </equals>
   <property alias="../../../../params/hsi-gs-in-range"/>
  </condition>
  <texture>
   <path>Aircraft/Instruments/Textures/misc-1.rgb</path>
   <x1>0.439</x1>
   <y1>0.5</y1>
   <x2>0.4575</x2>
   <y2>1.0</y2>
  </texture>
  <w>6</w>
  <h>64</h>
  <transformations>
   <transformation>
    <type>y-shift</type>
    <property alias="../../../../../params/nav-gs-needle-deflection"/>
    <scale>24.5</scale>
   </transformation>
   <transformation>
    <type>rotation</type>
    <offset>90</offset>
   </transformation>
  </transformations>
  </layer>

   <layer>
    <name>Nav1</name>
    <texture>
     <path>Aircraft/Instruments/Textures/hsi.rgb</path>
     <x1>0.0</x1>
     <y1>0.75</y1>
     <x2>0.25</x2>
     <y2>1.0</y2>
    </texture>
    <w>72</w>
    <h>72</h>
    <transformations>
     <transformation>
     <type>rotation</type>
     <property>/orientation/heading-magnetic-deg</property>
     <min>0.0</min>
     <max>360</max>
     <scale>-1.0</scale>
    </transformation>
    <transformation>
     <type>rotation</type>
     <property>/instrumentation/nav[0]/radials/selected-deg</property>
     <min>0.0</min>
     <max>360.0</max>
     <scale>1.0</scale>
    </transformation>
   </transformations>
  </layer>

  <layer>
   <name>Nav1_deviation</name>
   <texture>
   <path>Aircraft/Instruments/Textures/hsi.rgb</path>
   <x1>0.25</x1>
   <y1>0.75</y1>
   <x2>0.5</x2>
   <y2>1.0</y2>
   </texture>
   <w>72</w>
   <h>72</h>
   <transformations>
    <transformation>
    <type>rotation</type>
    <property>/orientation/heading-magnetic-deg</property>
    <min>0.0</min>
    <max>360</max>
    <scale>-1.0</scale>
   </transformation>
    <transformation>
    <type>rotation</type>
    <property>/instrumentation/nav[0]/radials/selected-deg</property>
    <min>0.0</min>
    <max>360</max>
    <scale>1.0</scale>
   </transformation>
   <transformation>
    <type>x-shift</type>
    <property>/instrumentation/nav[0]/heading-needle-deflection</property>
    <min>-10.0</min>
    <max>10.0</max>
    <scale>3.2</scale>
   </transformation>
  </transformations>
 </layer>


  <layer>
   <name>Plane</name>
   <texture>
    <path>Aircraft/Instruments/Textures/misc-1.rgb</path>
    <x1>0.5</x1>
    <y1>0.734375</y1>
    <x2>0.59375</x2>
    <y2>0.828125</y2>
   </texture>
   <w>25</w>
   <h>25</h>
   <transformations>
    <transformation>
     <type>y-shift</type>
     <offset>-6</offset>
    </transformation>
   </transformations>
  </layer>

 <layer>
   <name>Background</name>
   <texture>
   <path>Aircraft/Instruments/Textures/hsi.rgb</path>
   <x1>0.0</x1>
   <y1>0.0</y1>
   <x2>0.5</x2>
   <y2>0.5</y2>
   </texture>
   <w>104</w>
   <h>104</h>
  </layer>

  <!-- Copied from gyro.xml -->
  <layer>
   <name>heading bug</name>
   <texture>
    <path>Aircraft/Instruments/Textures/misc-1.rgb</path>
    <x1>0.946</x1>
    <y1>0.4375</y1>
    <x2>1.0</x2>
    <y2>0.5</y2>
   </texture>
   <w>16</w>
   <h>16</h>
   <transformations>
    <transformation>
     <type>rotation</type>
     <property>/autopilot/settings/heading-bug-deg</property>
     <min>-360.0</min>
     <max>360.0</max>
    </transformation>
    <transformation>
     <type>rotation</type>
     <property>/orientation/heading-magnetic-deg</property>
     <min>-360.0</min>
     <max>360.0</max>
     <scale>-1.0</scale>
    </transformation>
    <transformation>
     <type>y-shift</type>
     <offset>50</offset>
    </transformation>
   </transformations>
  </layer>
 
<!-- skip bezels for B-52F hack panel
<layer>
  <name>bezel</name>
  <condition>
   <not-equals>
    <property>/sim/aero</property>
    <value>c310u3a</value>
   </not-equals>
  </condition>
  <texture>
  <path>Aircraft/Instruments/Textures/bezel.rgb</path>
  <x1>0.0</x1>
  <y1>0.0</y1>
  <x2>1.0</x2>
  <y2>1.0</y2>
  </texture>
  <transformations>
   <transformation>
   <type>x-shift</type>
   <offset>-1</offset>
   </transformation>
  </transformations>
</layer> 
-->

  <layer>
   <name>glare shield</name>
   <texture>
    <path>Aircraft/Instruments/Textures/bezel1.rgb</path>
    <x1>0.5</x1>
    <y1>0.0</y1>
    <x2>1.0</x2>
    <y2>0.5</y2>
   </texture>
  <w>124</w>
  <h>124</h>
   <transformations>
    <transformation>
     <type>x-shift</type>
     <offset>2</offset>
    </transformation>
    <transformation>
     <type>y-shift</type>
     <offset>-2</offset>
    </transformation>
    </transformations>
  </layer>
 <layer>
   <name>Heading Knob</name>
   <texture>
    <path>Aircraft/Instruments/Textures/blister.rgb</path>
    <x1>0.25</x1>
    <y1>0.75</y1>
    <x2>0.5</x2>
    <y2>1.0</y2>
   </texture>
   <h>24</h>
   <w>24</w>
   <transformations>
    <transformation>
     <type>x-shift</type>
     <offset>45</offset>
    </transformation>
    <transformation>
     <type>y-shift</type>
     <offset>-45</offset>
    </transformation>
    <transformation>
     <type>rotation</type>
     <offset>180</offset>
    </transformation>
   </transformations>
  </layer>
  <layer>
   <name>Heading label</name>
   <texture>
    <path>Aircraft/Instruments/Textures/misc-1.rgb</path>
    <x1>0.0078125</x1>
    <y1>0.5</y1>
    <x2>0.1640625</x2>
    <y2>0.6640625</y2>
   </texture>
   <w>15</w>
   <h>15</h>
   <transformations>
    <transformation>
     <type>x-shift</type>
     <offset>45</offset>
    </transformation>
    <transformation>
     <type>y-shift</type>
     <offset>-45</offset>
    </transformation>
    <transformation>
     <type>rotation</type>
     <property>/autopilot/settings/heading-bug-deg</property>
    </transformation>
   </transformations>
  </layer>

 <layer>
   <name>OBS Knob</name>
   <texture>
    <path>Aircraft/Instruments/Textures/blister.rgb</path>
    <x1>0.25</x1>
    <y1>0.75</y1>
    <x2>0.5</x2>
    <y2>1.0</y2>
   </texture>
   <h>24</h>
   <w>24</w>
   <transformations>
    <transformation>
     <type>x-shift</type>
     <offset>-45</offset>
    </transformation>
    <transformation>
     <type>y-shift</type>
     <offset>-45</offset>
    </transformation>
    <transformation>
     <type>rotation</type>
     <offset>180</offset>
    </transformation>
   </transformations>
  </layer>

  <layer>
   <name>OBS label</name>
   <texture>
    <path>Aircraft/Instruments/Textures/misc-1.rgb</path>
    <x1>0.0078125</x1>
    <y1>0.66015625</y1>
    <x2>0.1640625</x2>
    <y2>0.8242185</y2>
   </texture>
   <w>15</w>
   <h>15</h>
   <transformations>
    <transformation>
     <type>x-shift</type>
     <offset>-45</offset>
    </transformation>
    <transformation>
     <type>y-shift</type>
     <offset>-45</offset>
    </transformation>
    <transformation>
     <type>rotation</type>
     <property>/instrumentation/nav[0]/radials/selected-deg</property>
     <min>0</min>
     <max>360</max>
    </transformation>
   </transformations>
  </layer>
</layers>

  <actions>
   <action>
    <name>OBS small clockwise rotation</name>
    <button>0</button>
    <x>-56</x>
    <y>-56</y>
    <w>12</w>
    <h>24</h>
    <binding>
    <command>property-adjust</command>
    <property>/instrumentation/nav[0]/radials/selected-deg</property>
    <step>-1.0</step>
    <min>0</min>
    <max>360</max>
    <wrap>1</wrap>
    </binding>
  </action>

  <action>
   <name>OBS large clockwise rotation</name>
   <button>1</button>
   <x>-56</x>
   <y>-56</y>
   <w>12</w>
   <h>24</h>
   <binding>
   <command>property-adjust</command>
   <property>/instrumentation/nav[0]/radials/selected-deg</property>
   <step>-5.0</step>
   <min>0</min>
   <max>360</max>
   <wrap>1</wrap>
   </binding>
  </action>

  <action>
   <name>OBS small counter-clockwise rotation</name>
   <button>0</button>
   <x>-46</x>
   <y>-56</y>
   <w>12</w>
   <h>24</h>
   <binding>
   <command>property-adjust</command>
   <property>/instrumentation/nav[0]/radials/selected-deg</property>
   <step>1.0</step>
   <min>0</min>
   <max>360</max>
   <wrap>1</wrap>
   </binding>
  </action>

  <action>
    <name>OBS large counter-clockwise rotation</name>
    <button>1</button>
    <x>-46</x>
    <y>-56</y>
    <w>12</w>
    <h>24</h>
    <binding>
    <command>property-adjust</command>
    <property>/instrumentation/nav[0]/radials/selected-deg</property>
    <step>5.0</step>
    <min>0</min>
    <max>360</max>
    <wrap>1</wrap>
    </binding>
  </action>

  <action>
    <name>Heading hold small clockwise rotation</name>
    <button>0</button>
    <x>36</x>
    <y>-56</y>
    <w>12</w>
    <h>24</h>
    <binding>
    <command>property-adjust</command>
    <property>/autopilot/settings/heading-bug-deg</property>
    <step>-1.0</step>
    <min>0</min>
    <max>360</max>
    <wrap>1</wrap>
    </binding>
  </action>

  <action>
    <name>Heading hold large clockwise rotation</name>
    <button>1</button>
    <x>36</x>
    <y>-56</y>
    <w>12</w>
    <h>24</h>
    <binding>
    <command>property-adjust</command>
    <property>/autopilot/settings/heading-bug-deg</property>
    <step>-5.0</step>
    <min>0</min>
    <max>360</max>
    <wrap>1</wrap>
    </binding>
  </action>

  <action>
    <name>Heading hold  small counter-clockwise rotation</name>
    <button>0</button>
    <x>46</x>
    <y>-56</y>
    <w>12</w>
    <h>24</h>
    <binding>
    <command>property-adjust</command>
    <property>/autopilot/settings/heading-bug-deg</property>
    <step>1.0</step>
    <min>0</min>
    <max>360</max>
    <wrap>1</wrap>
    </binding>
  </action>

  <action>
    <name>Heading hold large counter-clockwise rotation</name>
    <button>1</button>
    <x>46</x>
    <y>-56</y>
    <w>12</w>
    <h>24</h>
    <binding>
    <command>property-adjust</command>
    <property>/autopilot/settings/heading-bug-deg</property>
    <step>5.0</step>
    <min>0</min>
    <max>360</max>
    <wrap>1</wrap>
    </binding>
    </action>
  </actions>

</PropertyList>


