<?xml version="1.0"?>
<PropertyList>

  <path>rmi.ac</path>

  <animation>
    <type>rotate</type>
    <object-name>RMI.compass</object-name>
    <property>orientation/heading-magnetic-deg</property>
    <axis>
      <x>1.0</x>
      <y>0</y>
      <z>0.0</z>
    </axis>
  </animation>

  <!-- Left button and single-stemmed needle -->
  
  <animation>
    <type>pick</type>
    <object-name>RMI.left_button</object-name>
    <action>
      <button>0</button>
      <binding>
        <command>property-cycle</command>
        <property>/instrumentation/rmi/single-needle/selected-input</property>
        <value>ADF</value>
        <value>VOR</value>
      </binding>
      <binding>
        <command>nasal</command>
        <script>
          var selected_input = getprop ("/instrumentation/rmi/single-needle/selected-input");
          var dest_node = props.globals.getNode ("/instrumentation/rmi/single-needle/in-range", 1);
          dest_node.unalias ();
          if (selected_input == "ADF") {
             var source_node = props.globals.getNode ("/instrumentation/adf/in-range");
             dest_node.alias (source_node);
          }
          elsif (selected_input == "VOR") {
             var source_node = props.globals.getNode ("/instrumentation/nav[0]/in-range");
             dest_node.alias (source_node);
          }
        </script>
      </binding>
    </action>
  </animation>

  <animation>
    <type>rotate</type>
    <object-name>RMI.single_needle</object-name>
    <property>/instrumentation/rmi/single-needle/position-deg</property>
    <axis>
      <x>-1.0</x>
      <y>0</y>
      <z>0</z>
    </axis>
  </animation>

  <animation>
    <type>select</type>
    <object-name>RMI.SingleArrow.SelectionIndicator.ADF</object-name>
    <condition>
      <equals>
        <property>/instrumentation/rmi/single-needle/selected-input</property>
        <value>ADF</value>
      </equals>
    </condition>
  </animation>
  <animation>
    <type>select</type>
    <object-name>RMI.SingleArrow.SelectionIndicator.VOR</object-name>
    <condition>
      <equals>
        <property>/instrumentation/rmi/single-needle/selected-input</property>
        <value>VOR</value>
      </equals>
    </condition>
  </animation>
  <animation>
    <type>select</type>
    <object-name>RMI.SingleArrow.RadioContactIndicator</object-name>
    <condition>
      <property>/instrumentation/rmi/single-needle/in-range</property>
    </condition>
  </animation>
  
  <!-- Right button and double-stemmed needle -->

  <animation>
    <type>pick</type>
    <object-name>RMI.right_button</object-name>
    <action>
      <button>0</button>
      <binding>
        <command>property-cycle</command>
        <property>/instrumentation/rmi/double-needle/selected-input</property>
        <value>ADF</value>
        <value>VOR</value>
      </binding>
      <binding>
        <command>nasal</command>
        <script>
          var selected_input = getprop ("/instrumentation/rmi/double-needle/selected-input");
          var dest_node = props.globals.getNode ("/instrumentation/rmi/double-needle/in-range", 1);
          dest_node.unalias ();
          if (selected_input == "ADF") {
             var source_node = props.globals.getNode ("/instrumentation/adf/in-range");
             dest_node.alias (source_node);
          }
          elsif (selected_input == "VOR") {
             var source_node = props.globals.getNode ("/instrumentation/nav[1]/in-range");
             dest_node.alias (source_node);
          }
        </script>
      </binding>
    </action>
  </animation>

  <animation>
    <type>rotate</type>
    <object-name>RMI.double_needle</object-name>
    <property>/instrumentation/rmi/double-needle/position-deg</property>
    <axis>
      <x>-1.0</x>
      <y>0</y>
      <z>0</z>
    </axis>
  </animation>
  
  <animation>
    <type>select</type>
    <object-name>RMI.DoubleArrow.SelectionIndicator.ADF</object-name>
    <condition>
      <equals>
        <property>/instrumentation/rmi/double-needle/selected-input</property>
        <value>ADF</value>
      </equals>
    </condition>
  </animation>
  <animation>
    <type>select</type>
    <object-name>RMI.DoubleArrow.SelectionIndicator.VOR</object-name>
    <condition>
      <equals>
        <property>/instrumentation/rmi/double-needle/selected-input</property>
        <value>VOR</value>
      </equals>
    </condition>
  </animation>
  <animation>
    <type>select</type>
    <object-name>RMI.DoubleArrow.RadioContactIndicator</object-name>
    <condition>
      <property>/instrumentation/rmi/double-needle/in-range</property>
    </condition>
  </animation>

</PropertyList>
