From 90c1b982de07ec47caaaeeb24ffd3f90c7ae24b0 Mon Sep 17 00:00:00 2001
From: Anders Gidenstam <anders@gidenstam.org>
Date: Sun, 19 May 2013 20:50:58 +0200
Subject: [PATCH] Aircraft/Generic/DualControl/Instruments/VIR-32: Converted to
 knob animations and added panel lighting.

---
 .../Instruments/VIR-32/ctl32-nav.xml          | 271 ++++++++++--------
 .../Instruments/VIR-32/ctl32-nav1.xml         |   1 +
 .../Instruments/VIR-32/ctl32-nav2.xml         |   1 +
 .../DualControl/Instruments/VIR-32/ctl32.ac   |  44 +--
 4 files changed, 153 insertions(+), 164 deletions(-)

diff --git a/Aircraft/Generic/DualControl/Instruments/VIR-32/ctl32-nav.xml b/Aircraft/Generic/DualControl/Instruments/VIR-32/ctl32-nav.xml
index f1ccf3548..752c6d219 100644
--- a/Aircraft/Generic/DualControl/Instruments/VIR-32/ctl32-nav.xml
+++ b/Aircraft/Generic/DualControl/Instruments/VIR-32/ctl32-nav.xml
@@ -15,9 +15,11 @@ NOTE: ctl32.nas MUST be loaded as Nasal module VIR32.
 
 <PropertyList>
 
+ <!-- Overlay these for the second etc radio. -->
  <params>
   <serviceable>instrumentation/nav[0]/serviceable</serviceable>
   <electrical-supply>systems/electrical/outputs/nav[0]</electrical-supply>
+  <volume-norm>instrumentation/nav[0]/volume</volume-norm>
   <selected-freq-mhz>instrumentation/nav[0]/frequencies/selected-mhz</selected-freq-mhz>
   <standby-freq-mhz>instrumentation/nav[0]/frequencies/standby-mhz</standby-freq-mhz>
   <swap-script>VIR32.swap(0);</swap-script>
@@ -25,10 +27,12 @@ NOTE: ctl32.nas MUST be loaded as Nasal module VIR32.
   <small-dec-script>VIR32.adjust_frequency(0, -0.05);</small-dec-script>
   <big-inc-script>VIR32.adjust_frequency(0,  1.0);</big-inc-script>
   <big-dec-script>VIR32.adjust_frequency(0, -1.0);</big-dec-script>
+
+  <lighting-norm>controls/lighting/panel-norm</lighting-norm>
  </params>
 
  <path>ctl32.ac</path>
- 
+
  <animation>
   <type>select</type>
   <object-name>freq.001</object-name>
@@ -38,10 +42,13 @@ NOTE: ctl32.nas MUST be loaded as Nasal module VIR32.
   <object-name>freq.004</object-name>
   <object-name>freq.005</object-name>
   <condition>
-   <greater-than>
-    <property alias="../../../../params/electrical-supply"/>
-    <value>1</value>
-   </greater-than>
+   <and>
+    <property alias="../../../../params/serviceable"/>
+    <greater-than>
+     <property alias="../../../../../params/electrical-supply"/>
+     <value>1</value>
+    </greater-than>
+   </and>
   </condition>
  </animation>
 
@@ -54,10 +61,13 @@ NOTE: ctl32.nas MUST be loaded as Nasal module VIR32.
   <object-name>stby.004</object-name>
   <object-name>stby.005</object-name>
   <condition>
-   <greater-than>
-    <property alias="../../../../params/electrical-supply"/>
-    <value>1</value>
-   </greater-than>
+   <and>
+    <property alias="../../../../params/serviceable"/>
+    <greater-than>
+     <property alias="../../../../../params/electrical-supply"/>
+     <value>1</value>
+    </greater-than>
+   </and>
   </condition>
  </animation>
 
@@ -65,31 +75,42 @@ NOTE: ctl32.nas MUST be loaded as Nasal module VIR32.
   <type>select</type>
   <object-name>mem.annun</object-name>
   <condition>
-   <greater-than>
-    <property alias="../../../../params/electrical-supply"/>
-    <value>1</value>
-   </greater-than>
+   <and>
+    <property alias="../../../../params/serviceable"/>
+    <greater-than>
+     <property alias="../../../../../params/electrical-supply"/>
+     <value>1</value>
+    </greater-than>
+   </and>
   </condition>
  </animation>
 
  <animation>
-  <type>rotate</type>
-  <object-name>CTL-32.pwr</object-name>
-  <property alias="../../params/serviceable"/>
-  <interpolation>
-   <entry><ind>0</ind><dep>0</dep></entry>
-   <entry><ind>1.0</ind><dep>30</dep></entry>
-  </interpolation>
-  <center>
-   <x-m>0.0</x-m>
-   <y-m>-0.014</y-m>
-   <z-m>-0.018</z-m>
-  </center>
-  <axis>
-   <x>-1</x>
-   <y>0</y>
-   <z>0</z>
-  </axis>
+  <type>select</type>
+  <object-name>CTL-32.xfr</object-name>
+  <condition>
+   <and>
+    <property alias="../../../../params/serviceable"/>
+    <greater-than>
+     <property alias="../../../../../params/electrical-supply"/>
+     <value>1</value>
+    </greater-than>
+   </and>
+  </condition>
+ </animation>
+
+ <animation>
+  <type>select</type>
+  <object-name>CTL-32.mem</object-name>
+  <condition>
+   <and>
+    <property alias="../../../../params/serviceable"/>
+    <greater-than>
+     <property alias="../../../../../params/electrical-supply"/>
+     <value>1</value>
+    </greater-than>
+   </and>
+  </condition>
  </animation>
 
 <!--    Active Frequency   -->
@@ -137,31 +158,31 @@ NOTE: ctl32.nas MUST be loaded as Nasal module VIR32.
  </animation>
 
  <animation>
-   <type>textranslate</type>
-   <object-name>freq.004</object-name>
-   <property alias="../../params/selected-freq-mhz"/>
-   <factor>1</factor>
-   <step>0.1</step>
-   <bias>0.0005</bias>
-   <axis>
-    <x>0</x>
-    <y>1</y>
-    <z>0</z>
-   </axis>
+  <type>textranslate</type>
+  <object-name>freq.004</object-name>
+  <property alias="../../params/selected-freq-mhz"/>
+  <factor>1.0</factor>
+  <step>0.1</step>
+  <bias>0.0005</bias>
+  <axis>
+   <x>0</x>
+   <y>1</y>
+   <z>0</z>
+  </axis>
  </animation>
 
  <animation>
-   <type>textranslate</type>
-   <object-name>freq.005</object-name>
-   <property alias="../../params/selected-freq-mhz"/>
-   <factor>10</factor>
-   <step>0.01</step>
-   <bias>0.0005</bias>
-   <axis>
-    <x>0</x>
-    <y>1</y>
-    <z>0</z>
-   </axis>
+  <type>textranslate</type>
+  <object-name>freq.005</object-name>
+  <property alias="../../params/selected-freq-mhz"/>
+  <factor>10.0</factor>
+  <step>0.01</step>
+  <bias>0.0005</bias>
+  <axis>
+   <x>0</x>
+   <y>1</y>
+   <z>0</z>
+  </axis>
  </animation>
 
 <!--    Preselected Frequency     -->
@@ -212,7 +233,7 @@ NOTE: ctl32.nas MUST be loaded as Nasal module VIR32.
   <type>textranslate</type>
   <object-name>stby.004</object-name>
   <property alias="../../params/standby-freq-mhz"/>
-  <factor>1</factor>
+  <factor>1.0</factor>
   <step>0.1</step>
   <bias>0.0005</bias>
   <axis>
@@ -226,7 +247,7 @@ NOTE: ctl32.nas MUST be loaded as Nasal module VIR32.
   <type>textranslate</type>
   <object-name>stby.005</object-name>
   <property alias="../../params/standby-freq-mhz"/>
-  <factor>10</factor>
+  <factor>10.0</factor>
   <step>0.01</step>
   <bias>0.0005</bias>
   <axis>
@@ -250,109 +271,117 @@ NOTE: ctl32.nas MUST be loaded as Nasal module VIR32.
  </animation>
 
  <animation>
-  <type>pick</type>
-  <object-name>pwr.off</object-name>
+  <type>knob</type>
+  <object-name>CTL-32.pwr</object-name>
+  <property alias="../../params/serviceable"/>
+  <interpolation>
+   <entry><ind>0</ind><dep>0</dep></entry>
+   <entry><ind>1.0</ind><dep>30</dep></entry>
+  </interpolation>
+  <center>
+   <x-m>0.0</x-m>
+   <y-m>-0.014</y-m>
+   <z-m>-0.018</z-m>
+  </center>
+  <axis>
+   <x>-1</x>
+   <y>0</y>
+   <z>0</z>
+  </axis>
   <action>
-   <button>0</button>
-   <repeatable>false</repeatable>
    <binding>
-    <command>property-assign</command>
+    <command>property-toggle</command>
     <property alias="../../../../params/serviceable"/>
-    <value>false</value>
+    <value type="bool">0</value>
+    <value type="bool">1</value>
    </binding>
   </action>
  </animation>
 
  <animation>
-  <type>pick</type>
-  <object-name>pwr.on</object-name>
+  <type>knob</type>
+  <object-name>CTL-32.vol</object-name>
+  <property alias="../../params/volume-norm"/>
+  <factor>300</factor>
+  <center>
+   <x-m>0.0</x-m>
+   <y-m>-0.0138</y-m>
+   <z-m>-0.0183</z-m>
+  </center>
+  <axis>
+   <x>-1</x>
+   <y>0</y>
+   <z>0</z>
+  </axis>
   <action>
-   <button>0</button>
-   <repeatable>false</repeatable>
    <binding>
-    <command>property-assign</command>
-    <property alias="../../../../params/serviceable"/>
-    <value>true</value>
+    <command>property-adjust</command>
+    <property alias="../../../../params/volume-norm"/>
+    <factor type="double">0.02</factor>
+    <min type="double">0.0</min>
+    <max type="double">1.0</max>
    </binding>
   </action>
  </animation>
 
  <animation>
-  <type>pick</type>
+  <type>knob</type>
   <object-name>freq.knob.kHz</object-name>
-  <action>
-   <button>0</button>
-   <repeatable>true</repeatable>
-   <interval-sec>0.2</interval-sec>
+  <increase>
    <binding>
     <command>nasal</command>
     <script alias="../../../../params/small-inc-script"/>
    </binding>
-  </action>
-  <action>
-   <button>1</button>
-   <repeatable>true</repeatable>
-   <interval-sec>0.2</interval-sec>
+  </increase>
+  <decrease>
    <binding>
     <command>nasal</command>
     <script alias="../../../../params/small-dec-script"/>
    </binding>
-  </action>
-  <action>
-   <button>3</button>
-   <repeatable>false</repeatable>
-   <binding>
-    <command>nasal</command>
-    <script alias="../../../../params/small-dec-script"/>
-   </binding>
-  </action>
-  <action>
-   <button>4</button>
-   <repeatable>false</repeatable>
-   <binding>
-    <command>nasal</command>
-    <script alias="../../../../params/small-inc-script"/>
-   </binding>
-  </action>
+  </decrease>
  </animation>
 
  <animation>
-  <type>pick</type>
+  <type>knob</type>
   <object-name>freq.knob.MHz</object-name>
-  <action>
-   <button>0</button>
-   <repeatable>true</repeatable>
-   <interval-sec>0.2</interval-sec>
+  <increase>
    <binding>
     <command>nasal</command>
     <script alias="../../../../params/big-inc-script"/>
    </binding>
-  </action>
-  <action>
-   <button>1</button>
-   <repeatable>true</repeatable>
-   <interval-sec>0.2</interval-sec>
+  </increase>
+  <decrease>
    <binding>
     <command>nasal</command>
     <script alias="../../../../params/big-dec-script"/>
    </binding>
-  </action>
-  <action>
-   <button>3</button>
-   <repeatable>false</repeatable>
-   <binding>
-    <command>nasal</command>
-    <script alias="../../../../params/big-dec-script"/>
-   </binding>
-  </action>
-  <action>
-   <button>4</button>
-   <repeatable>false</repeatable>
-   <binding>
-    <command>nasal</command>
-    <script alias="../../../../params/big-inc-script"/>
-   </binding>
-  </action>
+  </decrease>
+ </animation>
+
+ <animation>
+  <type>material</type>
+  <object-name>freq.knob.kHz</object-name>
+  <object-name>freq.knob.MHz</object-name>
+  <object-name>CTL-32.vol</object-name>
+  <object-name>act.btn</object-name>
+  <object-name>sto.btn</object-name>
+  <object-name>test.btn</object-name>
+  <emission>
+   <factor-prop alias="../../../params/lighting-norm"/>
+   <red>0.4</red>
+   <green>0.4</green>
+   <blue>0.4</blue>
+  </emission>
+ </animation>
+ <animation>
+  <type>material</type>
+  <object-name>CTL-32</object-name>
+  <emission>
+   <factor-prop alias="../../../params/lighting-norm"/>
+   <red>0.15</red>
+   <green>0.15</green>
+   <blue>0.15</blue>
+  </emission>
  </animation>
 
 </PropertyList>
diff --git a/Aircraft/Generic/DualControl/Instruments/VIR-32/ctl32-nav1.xml b/Aircraft/Generic/DualControl/Instruments/VIR-32/ctl32-nav1.xml
index b1b405a76..29dada8e8 100644
--- a/Aircraft/Generic/DualControl/Instruments/VIR-32/ctl32-nav1.xml
+++ b/Aircraft/Generic/DualControl/Instruments/VIR-32/ctl32-nav1.xml
@@ -18,6 +18,7 @@ NOTE: ctl32.nas MUST be loaded as Nasal module VIR32.
  <params>
   <serviceable>instrumentation/nav[0]/serviceable</serviceable>
   <electrical-supply>systems/electrical/outputs/nav[0]</electrical-supply>
+  <volume-norm>instrumentation/nav[0]/volume</volume-norm>
   <selected-freq-mhz>instrumentation/nav[0]/frequencies/selected-mhz</selected-freq-mhz>
   <standby-freq-mhz>instrumentation/nav[0]/frequencies/standby-mhz</standby-freq-mhz>
   <swap-script>VIR32.swap(0);</swap-script>
diff --git a/Aircraft/Generic/DualControl/Instruments/VIR-32/ctl32-nav2.xml b/Aircraft/Generic/DualControl/Instruments/VIR-32/ctl32-nav2.xml
index 0c58b771b..088c7709f 100644
--- a/Aircraft/Generic/DualControl/Instruments/VIR-32/ctl32-nav2.xml
+++ b/Aircraft/Generic/DualControl/Instruments/VIR-32/ctl32-nav2.xml
@@ -18,6 +18,7 @@ NOTE: ctl32.nas MUST be loaded as Nasal module VIR32.
  <params>
   <serviceable>instrumentation/nav[1]/serviceable</serviceable>
   <electrical-supply>systems/electrical/outputs/nav[1]</electrical-supply>
+  <volume-norm>instrumentation/nav[1]/volume</volume-norm>
   <selected-freq-mhz>instrumentation/nav[1]/frequencies/selected-mhz</selected-freq-mhz>
   <standby-freq-mhz>instrumentation/nav[1]/frequencies/standby-mhz</standby-freq-mhz>
   <swap-script>VIR32.swap(1);</swap-script>
diff --git a/Aircraft/Generic/DualControl/Instruments/VIR-32/ctl32.ac b/Aircraft/Generic/DualControl/Instruments/VIR-32/ctl32.ac
index 642f054c6..2310445cf 100644
--- a/Aircraft/Generic/DualControl/Instruments/VIR-32/ctl32.ac
+++ b/Aircraft/Generic/DualControl/Instruments/VIR-32/ctl32.ac
@@ -4,7 +4,7 @@ MATERIAL "DefaultWhite.001" rgb 1 1 1 amb 1 1 1 emis 0 0 0 spec 0.5 0.5 0.5 shi
 MATERIAL "dimlit" rgb 1 1 1 amb 1 1 1 emis 0.5 0.5 0.5 spec 0.5 0.5 0.5 shi 64 trans 0
 MATERIAL "lit" rgb 1 1 1 amb 1 1 1 emis 1 1 1 spec 0.5 0.5 0.5 shi 64 trans 0
 OBJECT world
-kids 27
+kids 25
 OBJECT poly
 name "CTL-32"
 data 8
@@ -1709,48 +1709,6 @@ refs 4
 1 0.135480225086 0.035107113421
 kids 0
 OBJECT poly
-name "pwr.off"
-data 9
-Plane.048
-texture "ctl-32.png"
-texrep 1 1
-crease 30.000000
-numvert 4
-0.002944 -0.026036 0.021504
-0.002944 -0.010631 0.021504
-0.002944 -0.026036 0.013802
-0.002944 -0.010631 0.013802
-numsurf 1
-SURF 0x00
-mat 1
-refs 4
-0 0.114473424852 0.201592057943
-2 0.220019072294 0.201592057943
-3 0.220019072294 0.412683337927
-1 0.114473424852 0.412683337927
-kids 0
-OBJECT poly
-name "pwr.on"
-data 9
-Plane.052
-texture "ctl-32.png"
-texrep 1 1
-crease 30.000000
-numvert 4
-0.002944 -0.010631 0.013802
-0.002944 -0.026036 0.013802
-0.002944 -0.026036 0.0061
-0.002944 -0.010632 0.0061
-numsurf 1
-SURF 0x00
-mat 1
-refs 4
-3 0.325564712286 0.412683337927
-0 0.220019072294 0.412683337927
-1 0.220019072294 0.201592057943
-2 0.325564712286 0.201592057943
-kids 0
-OBJECT poly
 name "stby.001"
 data 9
 Plane.041