1
0
Fork 0
fgdata/gui/dialogs/instruments.xml
jimishol f5a5ba60ca Fix Equipment-Instrument Settings inconsistency toward Altimeter Indicator.
Altimeter Indicator seems to respect even rounding. So, if on settings
appear 29.9299 it shows 29.93. Equipment-Instrument Settings do not and
shows 29.92. If user sets 29.93 then settings keep the rest previous digits
and shows 29.9399. So, altimeter indicator shows 29.94 but instrument
settings keep the difference of 0.01 and shows 29.93.
Same phenomenon happens to hpa value too.

In code with '+0.05' we create even rounding and because the coversion
of one unit to the other many times leaves decimals of values to end
to series of 9, thus Instrument Settings keeps showing 29.929999 as 29.92,
we add artificial small value 0.00001 so as to make significant digits exact.
2021-11-23 11:06:59 +00:00

446 lines
10 KiB
XML

<?xml version="1.0"?>
<PropertyList>
<name>instruments</name>
<modal>false</modal>
<layout>vbox</layout>
<nasal>
<open><![CDATA[
var update = func(){
setprop("/instrumentation/altimeter/setting-hpa-formatted", sprintf("%6.1f", math.round(getprop("/instrumentation/altimeter/setting-hpa"),.1)));
setprop("/instrumentation/altimeter/setting-inhg-formatted", sprintf("%5.2f", math.round(getprop("/instrumentation/altimeter/setting-inhg"),0.01)));
}
var hpaListener = setlistener("/instrumentation/altimeter/setting-hpa", update);
var inhgListener = setlistener("/instrumentation/altimeter/setting-inhg", update);
update();
]]></open>
<close><![CDATA[
removelistener(hpaListener);
removelistener(inhgListener);
]]></close>
</nasal>
<group>
<layout>hbox</layout>
<empty><stretch>1</stretch></empty>
<text>
<label>Instrument Settings</label>
</text>
<empty><stretch>1</stretch></empty>
<button>
<pref-width>16</pref-width>
<pref-height>16</pref-height>
<legend></legend>
<keynum>27</keynum>
<border>2</border>
<binding>
<command>dialog-close</command>
</binding>
</button>
</group>
<hrule/>
<group>
<layout>table</layout>
<default-padding>5</default-padding>
<text>
<row>0</row>
<col>0</col>
<halign>right</halign>
<label> QNH Setting:</label>
</text>
<group>
<row>0</row>
<col>1</col>
<layout>hbox</layout>
<default-padding>0</default-padding>
<button>
<width>35</width>
<height>26</height>
<border>1</border>
<legend>&lt;</legend>
<binding>
<command>property-adjust</command>
<property>/instrumentation/altimeter/setting-hpa</property>
<step type="double">-1</step>
</binding>
<binding>
<command>dialog-update</command>
</binding>
</button>
</group>
<input>
<row>0</row>
<col>3</col>
<width>75</width>
<height>25</height>
<live>true</live>
<property>/instrumentation/altimeter/setting-hpa-formatted</property>
<binding>
<command>dialog-apply</command>
</binding>
</input>
<text>
<row>0</row>
<col>4</col>
<padding>0</padding>
<halign>left</halign>
<label>hPa</label>
</text>
<group>
<layout>hbox</layout>
<row>0</row>
<col>5</col>
<default-padding>0</default-padding>
<button>
<width>35</width>
<height>26</height>
<border>1</border>
<legend>&gt;</legend>
<binding>
<command>property-adjust</command>
<property>/instrumentation/altimeter/setting-hpa</property>
<step type="double">1</step>
</binding>
<binding>
<command>dialog-update</command>
</binding>
</button>
</group>
<text>
<row>1</row>
<col>0</col>
<halign>right</halign>
<label>ALT Setting:</label>
</text>
<group>
<row>1</row>
<col>1</col>
<layout>hbox</layout>
<default-padding>0</default-padding>
<button>
<width>35</width>
<height>26</height>
<border>1</border>
<legend>&lt;</legend>
<binding>
<command>property-adjust</command>
<property>/instrumentation/altimeter/setting-inhg</property>
<step type="double">-0.01</step>
</binding>
<binding>
<command>dialog-update</command>
</binding>
</button>
<button>
<width>35</width>
<height>26</height>
<border>1</border>
<legend>&lt;&lt;</legend>
<binding>
<command>property-adjust</command>
<property>/instrumentation/altimeter/setting-inhg</property>
<step type="double">-0.10</step>
</binding>
<binding>
<command>dialog-update</command>
</binding>
</button>
</group>
<input>
<row>1</row>
<col>3</col>
<width>75</width>
<height>25</height>
<live>true</live>
<property>/instrumentation/altimeter/setting-inhg-formatted</property>
<binding>
<command>dialog-apply</command>
</binding>
</input>
<text>
<row>1</row>
<col>4</col>
<padding>0</padding>
<halign>left</halign>
<label>inHg</label>
</text>
<group>
<layout>hbox</layout>
<row>1</row>
<col>5</col>
<default-padding>0</default-padding>
<button>
<width>35</width>
<height>26</height>
<border>1</border>
<legend>&gt;&gt;</legend>
<binding>
<command>property-adjust</command>
<property>/instrumentation/altimeter/setting-inhg</property>
<step type="double">0.10</step>
</binding>
<binding>
<command>dialog-update</command>
</binding>
</button>
<button>
<row>1</row>
<col>6</col>
<width>35</width>
<height>26</height>
<border>1</border>
<legend>&gt;</legend>
<binding>
<command>property-adjust</command>
<property>/instrumentation/altimeter/setting-inhg</property>
<step type="double">0.01</step>
</binding>
<binding>
<command>dialog-update</command>
</binding>
</button>
<!-- only for a gap -->
<text>
<label> </label>
</text>
</group>
<text>
<row>2</row>
<col>0</col>
<halign>right</halign>
<label>HI Offset:</label>
</text>
<group>
<layout>hbox</layout>
<default-padding>0</default-padding>
<row>2</row>
<col>1</col>
<button>
<width>35</width>
<height>26</height>
<border>1</border>
<legend>&lt;</legend>
<binding>
<command>property-adjust</command>
<property>/instrumentation/heading-indicator/offset-deg</property>
<step type="double">-1.0</step>
</binding>
<binding>
<command>dialog-update</command>
</binding>
</button>
<button>
<width>35</width>
<height>26</height>
<border>1</border>
<legend>&lt;&lt;</legend>
<binding>
<command>property-adjust</command>
<property>/instrumentation/heading-indicator/offset-deg</property>
<step type="double">-10.0</step>
</binding>
<binding>
<command>dialog-update</command>
</binding>
</button>
</group>
<input>
<row>2</row>
<col>3</col>
<width>75</width>
<height>25</height>
<live>true</live>
<property>/instrumentation/heading-indicator/offset-deg</property>
<binding>
<command>dialog-apply</command>
</binding>
</input>
<text>
<row>2</row>
<col>4</col>
<padding>0</padding>
<halign>left</halign>
<label>deg</label>
</text>
<group>
<layout>hbox</layout>
<default-padding>0</default-padding>
<row>2</row>
<col>5</col>
<button>
<width>35</width>
<height>26</height>
<border>1</border>
<legend>&gt;&gt;</legend>
<binding>
<command>property-adjust</command>
<property>/instrumentation/heading-indicator/offset-deg</property>
<step type="double">10.0</step>
</binding>
<binding>
<command>dialog-update</command>
</binding>
</button>
<button>
<width>35</width>
<height>26</height>
<border>1</border>
<legend>&gt;</legend>
<binding>
<command>property-adjust</command>
<property>/instrumentation/heading-indicator/offset-deg</property>
<step type="double">1.0</step>
</binding>
<binding>
<command>dialog-update</command>
</binding>
</button>
<!-- only for a gap -->
<text>
<label> </label>
</text>
</group>
</group>
<hrule/>
<group>
<layout>hbox</layout>
<text>
<halign>right</halign>
<label>Local magnetic variation:</label>
</text>
<text>
<halign>left</halign>
<label>12345678</label>
<format>%.1f deg</format>
<live>true</live>
<property>/environment/magnetic-variation-deg</property>
</text>
</group>
<hrule/>
<group>
<layout>hbox</layout>
<default-padding>5</default-padding>
<empty><stretch>1</stretch></empty>
<text>
<halign>right</halign>
<label>Instrument lighting:</label>
</text>
<input>
<width>50</width>
<height>25</height>
<live>true</live>
<property>/controls/lighting/instruments-norm</property>
<binding>
<command>dialog-apply</command>
</binding>
</input>
<empty><stretch>0</stretch></empty>
<!-- +/- buttons, one above the other. -->
<group>
<layout>vbox</layout>
<default-padding>0</default-padding>
<button>
<pref-width>20</pref-width>
<pref-height>20</pref-height>
<legend>+</legend>
<binding>
<command>property-adjust</command>
<property>/controls/lighting/instruments-norm</property>
<step>+0.1</step>
<max>1</max>
</binding>
<binding>
<command>property-adjust</command>
<property>/controls/lighting/panel-norm</property>
<step>+0.1</step>
<max>1</max>
</binding>
<binding>
<command>dialog-update</command>
</binding>
</button>
<button>
<pref-width>20</pref-width>
<pref-height>20</pref-height>
<legend>-</legend>
<binding>
<command>property-adjust</command>
<property>/controls/lighting/instruments-norm</property>
<step>-0.1</step>
<min>0</min>
</binding>
<binding>
<command>property-adjust</command>
<property>/controls/lighting/panel-norm</property>
<step>-0.1</step>
<min>0</min>
</binding>
<binding>
<command>dialog-update</command>
</binding>
</button>
</group>
<empty><stretch>1</stretch></empty>
</group>
<hrule/>
<button>
<legend>Close</legend>
<default>true</default>
<key>Esc</key>
<binding>
<command>dialog-close</command>
</binding>
</button>
</PropertyList>