1
0
Fork 0

Merge branch 'work' of D:\Git_New\fgdata

This commit is contained in:
Vivian Meazza 2011-08-23 22:52:24 +01:00
commit 3ca2539064
13 changed files with 526 additions and 306 deletions

View file

@ -32,12 +32,14 @@
<animation>
<type>material</type>
<object-name>egt</object-name>
<object-name>Needle</object-name>
<object-name>Bug</object-name>
<object-name>Face</object-name>
<emission>
<red-prop>sim/model/instrument-lighting/emission/red</red-prop>
<green-prop>sim/model/instrument-lighting/emission/green</green-prop>
<blue-prop>sim/model/instrument-lighting/emission/blue</blue-prop>
<factor-prop>controls/lighting/instruments-norm</factor-prop>
<red>1.0</red>
<green>0.2</green>
<blue>0.0</blue>
<factor-prop>sim/model/material/instruments/factor</factor-prop>
</emission>
</animation>

View file

@ -4,6 +4,10 @@
<name>Ctrl-c</name>
<desc>Panel hotspots and labels</desc>
</key>
<key>
<name>l/L</name>
<desc>Increase/decrease panel lighting</desc>
</key>
<line/>
<line>_________Engine Start Checklist_________</line>
<line>Mixture: Rich</line>

View file

@ -241,23 +241,47 @@ Started October 23 2001 by John Check, fgpanels@rockfish.net
</payload>
<input>
<keyboard>
<key n="115">
<name>s</name>
<desc>Toggle Starter Switch</desc>
<binding>
<command>property-assign</command>
<property>/controls/switches/starter</property>
<value >1</value>
</binding>
<mod-up>
<binding>
<command>property-assign</command>
<property>/controls/switches/starter</property>
<value>0</value>
</binding>
</mod-up>
</key>
<keyboard>
<key n="76">
<name>L</name>
<desc>Decrease Panel lighting</desc>
<binding>
<command>property-adjust</command>
<property>controls/lighting/instruments-norm</property>
<step>-0.1</step>
<min>0</min>
<max>1.0</max>
<wrap>0</wrap>
</binding>
</key>
<key n="108">
<name>l</name>
<desc>Increase Panel lighting</desc>
<binding>
<command>property-adjust</command>
<property>controls/lighting/instruments-norm</property>
<step>0.1</step>
<min>0</min>
<max>1.0</max>
<wrap>0</wrap>
</binding>
</key>
<key n="115">
<name>s</name>
<desc>Toggle Starter Switch</desc>
<binding>
<command>property-assign</command>
<property>/controls/switches/starter</property>
<value >1</value>
</binding>
<mod-up>
<binding>
<command>property-assign</command>
<property>/controls/switches/starter</property>
<value>0</value>
</binding>
</mod-up>
</key>
</keyboard>
</input>

View file

@ -160,9 +160,9 @@ properties, though they will ignore any that are not relevant:
default - true if this is the default object for when the user
presses the [RETURN] key.
hide - if set to true, hides the whole widget that it is used
visible - if set to false, hides the whole widget that it is used
in, along with its children. There's no empty space reserved
for such widgets. The "hide" property can also be used to hide
for such widgets. The "visible" property can also be used to hide
other XML groups from the layouter.
Objects may appear nested within the top-level dialog or a "group"

View file

@ -4,6 +4,9 @@
<parameters>
<texture n ="0">
</texture>
<range>
<use>/sim/rendering/clouds3d-vis-range</use>
</range>
</parameters>
<technique n="10">
<predicate>
@ -63,6 +66,11 @@
<type>sampler-2d</type>
<value type="int">0</value>
</uniform>
<uniform>
<name>range</name>
<type>float</type>
<value><use>range</use></value>
</uniform>
<vertex-program-two-side>true</vertex-program-two-side>
</pass>
</technique>

View file

@ -0,0 +1,58 @@
<?xml version="1.0"?>
<!--
************************************************************************
* Setup for Saitek Pro Combat Rudder Pedals.
*
* These are USB rudder pedals with toe brakes. Bindings are as
* follow:
*
* Axis 0 (left pedal): left brake
* Axis 1 (right pedal): right brake
* Axis 2 (sliding both pedals): rudder (and nosewheel)
************************************************************************
$Id$
-->
<PropertyList>
<name>Saitek Pro Flight Combat Rudder Pedals</name>
<name>Saitek Saitek Pro Flight Combat Rudder Pedals</name>
<axis n="0">
<desc>Brake left</desc>
<binding>
<command>property-scale</command>
<property>/controls/gear/brake-left</property>
<offset>1.0</offset>
<factor>0.5</factor>
</binding>
</axis>
<axis n="1">
<desc>Brake right</desc>
<binding>
<command>property-scale</command>
<property>/controls/gear/brake-right</property>
<offset>1.0</offset>
<factor>0.5</factor>
</binding>
</axis>
<axis n="2">
<number>
<windows>3</windows>
<mac>2</mac>
<unix>2</unix>
</number>
<desc>Rudder</desc>
<binding>
<command>property-scale</command>
<property>/controls/flight/rudder</property>
<factor>1.0</factor>
<offset>0.0</offset>
<power type="double">2.0</power>
</binding>
</axis>
</PropertyList>

View file

@ -1,265 +1,301 @@
<?xml version="1.0"?>
<!-- Saitek Pro Flight Yoke
Copyright (C) 2008 Oliver Schroeder (fgfs(at)o-schroeder.de)
This file is released under the GPL license.
-->
Copyright (C) 2008 Oliver Schroeder (fgfs(at)o-schroeder.de)
This file is released under the GPL license.
-->
<PropertyList>
<name>Saitek Saitek Pro Flight Yoke</name>
<name>Saitek Pro Flight Yoke</name>
<axis n="0">
<desc>Aileron</desc>
<binding>
<command>property-scale</command>
<property>/controls/flight/aileron</property>
<squared type="bool">true</squared>
</binding>
</axis>
<axis n="1">
<desc>Elevator</desc>
<binding>
<command>property-scale</command>
<property>/controls/flight/elevator</property>
<factor type="double">-1.0</factor>
<squared type="bool">true</squared>
</binding>
</axis>
<!-- Throttle Quadrant -->
<axis n="2">
<desc>Throttle</desc>
<binding>
<command>nasal</command>
<script>controls.throttleAxis()</script>
</binding>
</axis>
<axis n="3">
<desc>Prop Pitch</desc>
<binding>
<command>nasal</command>
<script>controls.propellerAxis()</script>
</binding>
</axis>
<axis n="4">
<desc>Mixture </desc>
<binding>
<command>nasal</command>
<script>controls.mixtureAxis()</script>
</binding>
</axis>
<axis n="5">
<desc>View Direction</desc>
<low>
<repeatable>true</repeatable>
<binding>
<command>property-adjust</command>
<property>/sim/current-view/goal-heading-offset-deg</property>
<step type="double">1.0</step>
</binding>
</low>
<high>
<repeatable>true</repeatable>
<binding>
<command>property-adjust</command>
<property>/sim/current-view/goal-heading-offset-deg</property>
<step type="double">-1.0</step>
</binding>
</high>
</axis>
<axis n="6">
<desc>View Elevation</desc>
<low>
<repeatable>true</repeatable>
<binding>
<command>property-adjust</command>
<property>/sim/current-view/goal-pitch-offset-deg</property>
<step type="double">1.0</step>
</binding>
</low>
<high>
<repeatable>true</repeatable>
<binding>
<command>property-adjust</command>
<property>/sim/current-view/goal-pitch-offset-deg</property>
<step type="double">-1.0</step>
</binding>
</high>
</axis>
<!-- Buttons on the Yoke -->
<button n="0">
<desc>Cycle View</desc>
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>view.stepView(1)</script>
</binding>
</button>
<button n="1"> <!-- Labled as D -->
<desc>Toggle parking break</desc>
<binding>
<command>property-toggle</command>
<property>/controls/gear/brake-parking</property>
</binding>
</button>
<button n="2"> <!-- Labled as A1 -->
<desc>Elevator trim down</desc>
<repeatable>true</repeatable>
<binding>
<command>nasal</command>
<script>controls.elevatorTrim(0.75)</script>
</binding>
</button>
<button n="3"> <!-- Labled as A2 -->
<desc>Elevator trim up</desc>
<repeatable>true</repeatable>
<binding>
<command>nasal</command>
<script>controls.elevatorTrim(-0.75)</script>
</binding>
</button>
<button n="4"> <!-- Labled as B1 -->
<desc>Zoom In</desc>
<repeatable>true</repeatable>
<binding>
<command>property-adjust</command>
<property>/sim/current-view/field-of-view</property>
<step type="double">-0.5</step>
</binding>
</button>
<button n="5"> <!-- LAbled as B2 -->
<desc>Zoom Out</desc>
<repeatable>true</repeatable>
<binding>
<command>property-adjust</command>
<property>/sim/current-view/field-of-view</property>
<step type="double">+0.5</step>
</binding>
</button>
<button n="6"> <!-- Labled as C1 -->
<desc>Aileron trim left</desc>
<repeatable>true</repeatable>
<binding>
<command>nasal</command>
<script>controls.aileronTrim(-0.75)</script>
</binding>
</button>
<button n="7"> <!-- Labled as C2 -->
<desc>Aileron trim right</desc>
<repeatable>true</repeatable>
<binding>
<command>nasal</command>
<script>controls.aileronTrim(0.75)</script>
</binding>
</button>
<!-- Buttons on the throttle Quadrant -->
<button n="14"> <!-- Labled as T1 -->
<desc>Flaps up</desc>
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>controls.flapsDown(-1)</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>controls.flapsDown(0)</script>
</binding>
</mod-up>
</button>
<button n="15"> <!-- Labled as T2 -->
<desc>Flaps down</desc>
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>controls.flapsDown(1)</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>controls.flapsDown(0)</script>
</binding>
</mod-up>
</button>
<button n="16"> <!-- Labled as T3 -->
<desc>Gear up</desc>
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>controls.gearDown(-1)</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>controls.gearDown(0)</script>
</binding>
</mod-up>
</button>
<button n="17"> <!-- Labled as T4 -->
<desc>Gear down</desc>
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>controls.gearDown(1)</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>controls.gearDown(0)</script>
</binding>
</mod-up>
</button>
<button n="18"> <!-- Labled as T5 -->
<desc>Retract Spoilers</desc>
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>controls.stepSpoilers(-1)</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>controls.stepSpoilers(0)</script>
</binding>
</mod-up>
</button>
<button n="19"> <!-- Labled as T6 -->
<desc>Deploy Spoilers</desc>
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>controls.stepSpoilers(1)</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>controls.stepSpoilers(0)</script>
</binding>
</mod-up>
</button>
<button n="20">
<desc>thrust reverse</desc>
<repeatable type="bool">false</repeatable>
<binding>
<command>nasal</command>
<script>
props.setAll("/controls/engines/engine", "reverser", 1);
props.setAll("/controls/engines/engine", "throttle", 1);
gui.popupTip("Thrust reverse on!");
</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>
props.setAll("/controls/engines/engine", "reverser", 0);
props.setAll("/controls/engines/engine", "throttle", 0);
gui.popupTip("Thrust reverse off!");
</script>
</binding>
</mod-up>
</button>
<name>Saitek Saitek Pro Flight Yoke</name>
<name>Saitek Pro Flight Yoke</name>
<axis n="0">
<desc>Aileron</desc>
<binding>
<command>property-scale</command>
<property>/controls/flight/aileron</property>
<squared type="bool">true</squared>
</binding>
</axis>
<axis n="1">
<desc>Elevator</desc>
<binding>
<command>property-scale</command>
<property>/controls/flight/elevator</property>
<factor type="double">-1.0</factor>
<squared type="bool">true</squared>
</binding>
</axis>
<!-- Throttle Quadrant -->
<axis n="2">
<desc>Throttle</desc>
<binding>
<command>nasal</command>
<script>controls.throttleAxis()</script>
</binding>
</axis>
<axis>
<number>
<unix>3</unix>
<windows>4</windows>
</number>
<desc>Prop Pitch</desc>
<binding>
<command>nasal</command>
<script>controls.propellerAxis()</script>
</binding>
</axis>
<axis>
<number>
<unix>4</unix>
<windows>3</windows>
</number>
<desc>Mixture</desc>
<binding>
<command>nasal</command>
<script>controls.mixtureAxis()</script>
</binding>
</axis>
<!-- Coolie Hat -->
<axis>
<number>
<unix>5</unix>
<windows>6</windows>
</number>
<desc>View Direction</desc>
<low>
<repeatable>true</repeatable>
<binding>
<command>property-adjust</command>
<property>/sim/current-view/goal-heading-offset-deg</property>
<step type="double">1.0</step>
</binding>
</low>
<high>
<repeatable>true</repeatable>
<binding>
<command>property-adjust</command>
<property>/sim/current-view/goal-heading-offset-deg</property>
<step type="double">-1.0</step>
</binding>
</high>
</axis>
<axis>
<number>
<unix>6</unix>
</number>
<desc>View Elevation</desc>
<low>
<repeatable>true</repeatable>
<binding>
<command>property-adjust</command>
<property>/sim/current-view/goal-pitch-offset-deg</property>
<step type="double">1.0</step>
</binding>
</low>
<high>
<repeatable>true</repeatable>
<binding>
<command>property-adjust</command>
<property>/sim/current-view/goal-pitch-offset-deg</property>
<step type="double">-1.0</step>
</binding>
</high>
</axis>
<axis>
<number>
<windows>7</windows>
</number>
<desc>View Elevation</desc>
<low>
<repeatable>true</repeatable>
<binding>
<command>property-adjust</command>
<property>/sim/current-view/goal-pitch-offset-deg</property>
<step type="double">-1.0</step>
</binding>
</low>
<high>
<repeatable>true</repeatable>
<binding>
<command>property-adjust</command>
<property>/sim/current-view/goal-pitch-offset-deg</property>
<step type="double">1.0</step>
</binding>
</high>
</axis>
<!-- Buttons on the Yoke -->
<button n="0">
<desc>Cycle View</desc>
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>view.stepView(1)</script>
</binding>
</button>
<button n="1"> <!-- Labled as D -->
<desc>Toggle parking break</desc>
<binding>
<command>property-toggle</command>
<property>/controls/gear/brake-parking</property>
</binding>
</button>
<button n="2"> <!-- Labled as A1 -->
<desc>Elevator trim down</desc>
<repeatable>true</repeatable>
<binding>
<command>nasal</command>
<script>controls.elevatorTrim(0.75)</script>
</binding>
</button>
<button n="3"> <!-- Labled as A2 -->
<desc>Elevator trim up</desc>
<repeatable>true</repeatable>
<binding>
<command>nasal</command>
<script>controls.elevatorTrim(-0.75)</script>
</binding>
</button>
<button n="4"> <!-- Labled as B1 -->
<desc>Zoom In</desc>
<repeatable>true</repeatable>
<binding>
<command>property-adjust</command>
<property>/sim/current-view/field-of-view</property>
<step type="double">-0.5</step>
</binding>
</button>
<button n="5"> <!-- LAbled as B2 -->
<desc>Zoom Out</desc>
<repeatable>true</repeatable>
<binding>
<command>property-adjust</command>
<property>/sim/current-view/field-of-view</property>
<step type="double">+0.5</step>
</binding>
</button>
<button n="6"> <!-- Labled as C1 -->
<desc>Aileron trim left</desc>
<repeatable>true</repeatable>
<binding>
<command>nasal</command>
<script>controls.aileronTrim(-0.75)</script>
</binding>
</button>
<button n="7"> <!-- Labled as C2 -->
<desc>Aileron trim right</desc>
<repeatable>true</repeatable>
<binding>
<command>nasal</command>
<script>controls.aileronTrim(0.75)</script>
</binding>
</button>
<!-- Buttons on the throttle Quadrant -->
<button n="14"> <!-- Labled as T1 -->
<desc>Flaps up</desc>
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>controls.flapsDown(-1)</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>controls.flapsDown(0)</script>
</binding>
</mod-up>
</button>
<button n="15"> <!-- Labled as T2 -->
<desc>Flaps down</desc>
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>controls.flapsDown(1)</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>controls.flapsDown(0)</script>
</binding>
</mod-up>
</button>
<button n="16"> <!-- Labled as T3 -->
<desc>Gear up</desc>
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>controls.gearDown(-1)</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>controls.gearDown(0)</script>
</binding>
</mod-up>
</button>
<button n="17"> <!-- Labled as T4 -->
<desc>Gear down</desc>
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>controls.gearDown(1)</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>controls.gearDown(0)</script>
</binding>
</mod-up>
</button>
<button n="18"> <!-- Labled as T5 -->
<desc>Retract Spoilers</desc>
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>controls.stepSpoilers(-1)</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>controls.stepSpoilers(0)</script>
</binding>
</mod-up>
</button>
<button n="19"> <!-- Labled as T6 -->
<desc>Deploy Spoilers</desc>
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>controls.stepSpoilers(1)</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>controls.stepSpoilers(0)</script>
</binding>
</mod-up>
</button>
<button n="20">
<desc>thrust reverse</desc>
<repeatable type="bool">false</repeatable>
<binding>
<command>nasal</command>
<script>
props.setAll("/controls/engines/engine", "reverser", 1);
props.setAll("/controls/engines/engine", "throttle", 1);
gui.popupTip("Thrust reverse on!");
</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>
props.setAll("/controls/engines/engine", "reverser", 0);
props.setAll("/controls/engines/engine", "throttle", 0);
gui.popupTip("Thrust reverse off!");
</script>
</binding>
</mod-up>
</button>
</PropertyList>

View file

@ -505,7 +505,7 @@ var OverlaySelector = {
# selector.open();
#
var FileSelector = {
new: func(callback, title, button, pattern = nil, dir = "", file = "", dotfiles = 0) {
new: func(callback, title, button, pattern = nil, dir = "", file = "", dotfiles = 0, show_files=1) {
var name = "file-select-";
var data = props.globals.getNode("/sim/gui/dialogs/", 1);
for (var i = 1; 1; i += 1)
@ -520,6 +520,7 @@ var FileSelector = {
m.set_button(button);
m.set_directory(dir);
m.set_file(file);
m.set_show_files(show_files);
m.set_dotfiles(dotfiles);
m.set_pattern(pattern);
m.cblistener = setlistener(data.getNode("path", 1), callback);
@ -530,6 +531,7 @@ var FileSelector = {
set_button: func(button) { me.data.getNode("button", 1).setValue(button) },
set_directory: func(dir) { me.data.getNode("directory", 1).setValue(dir) },
set_file: func(file) { me.data.getNode("selection", 1).setValue(file) },
set_show_files: func(show) { me.data.getNode("show-files", 1).setValue(show) },
set_dotfiles: func(dot) { me.data.getNode("dotfiles", 1).setBoolValue(dot) },
set_pattern: func(pattern) {
me.data.removeChildren("pattern");
@ -545,6 +547,14 @@ var FileSelector = {
},
};
##
# DirSelector - convenience "class" (indeed using a reconfigured FileSelector)
#
var DirSelector = {
new: func(callback, title, button, dir = "") {
return FileSelector.new(callback, title, button, nil, dir, "", 0, show_files=0);
}
};
##
# Save/load flight menu functions.
@ -573,6 +583,17 @@ var load_flight = func {
load_flight_sel.open();
}
##
# Screen-shot directory menu function
#
var set_screenshotdir_sel = nil;
var set_screenshotdir = func {
if (set_screenshotdir_sel == nil)
set_screenshotdir_sel = gui.DirSelector.new(
func(result) { setprop("/sim/paths/screenshot-dir", result.getValue()); },
"Select Screenshot Directory", "Ok", getprop("/sim/paths/screenshot-dir"));
set_screenshotdir_sel.open();
}
##
# Open property browser with given target path.

View file

@ -3,6 +3,8 @@
varying float fogFactor;
uniform float range; // From /sim/rendering/clouds3d-vis-range
attribute vec3 usrAttr1;
attribute vec3 usrAttr2;
@ -40,26 +42,30 @@ void main(void)
// Determine a lighting normal based on the vertex position from the
// center of the cloud, so that sprite on the opposite side of the cloud to the sun are darker.
float n = dot(normalize(-gl_LightSource[0].position.xyz),
normalize(vec3(gl_ModelViewMatrix * vec4(- gl_Position.xyz,0.0))));
normalize(vec3(gl_ModelViewMatrix * vec4(- gl_Position.x, - gl_Position.y, - gl_Position.z,0.0))));
// Determine the position - used for fog and shading calculations
vec3 ecPosition = vec3(gl_ModelViewMatrix * gl_Position);
float fogCoord = abs(ecPosition.z);
// Determine fractional height of vertex from 0 at the bottom, and 1 at mid-height.
// Used to determine shading.
float fract = smoothstep(0.0, cloud_height, gl_Position.z + cloud_height);
// Final position of the sprite
gl_Position = gl_ModelViewProjectionMatrix * gl_Position;
// Determine the shading of the sprite based on its vertical position and position relative to the sun.
// Determine the shading of the sprite based on its vertical position and position relative to the sun.
n = min(smoothstep(-0.5, 0.0, n), fract);
// Determine the shading based on a mixture from the backlight to the front
// Determine the shading based on a mixture from the backlight to the front
vec4 backlight = gl_LightSource[0].diffuse * shade;
gl_FrontColor = mix(backlight, gl_LightSource[0].diffuse, n);
gl_FrontColor += gl_FrontLightModelProduct.sceneColor;
// As we get within 100m of the sprite, it is faded out. Equally at large distances it also fades out.
gl_FrontColor.a = min(smoothstep(10.0, 100.0, fogCoord), 1.0 - smoothstep(15000.0, 20000.0, fogCoord));
gl_FrontColor.a = min(smoothstep(10.0, 100.0, fogCoord), 1.0 - smoothstep(range*0.8, range, fogCoord));
gl_BackColor = gl_FrontColor;
// Fog doesn't affect clouds as much as other objects.

View file

@ -94,6 +94,13 @@
<command>nasal</command>
<script>file_input()</script>
</binding>
<visible>
<equals> <!-- yes, odd condition. easier ways somehow fail,
since we're changing the values with Nasal below... -->
<value>1</value>
<value>1</value>
</equals>
</visible>
</input>
<button>
@ -134,6 +141,9 @@
var path = dlg.getNode("path", 1);
var dotfiles = dlg.getNode("dotfiles", 1);
dotfiles.setBoolValue(dotfiles.getValue());
# disable files to show a directory dialog only
self.show_files = dlg.getNode("show-files",1).getValue();
self.getNode("group[1]/input/visible/equals/value").setValue(self.show_files);
var kbdctrl = props.globals.getNode("/devices/status/keyboard/ctrl", 1);
var kbdshift = props.globals.getNode("/devices/status/keyboard/shift", 1);
@ -177,7 +187,7 @@
if (stat[11] == "dir")
append(dirs, e ~ "/");
elsif (!size(pattern) or matches(e))
elsif (self.show_files and (!size(pattern) or matches(e)))
append(files, e);
}
@ -239,7 +249,10 @@
var ok = func {
dir_input();
file_input();
if (self.show_files)
file_input();
else
current.file = "";
var p = string.normpath(current.dir ~ "/" ~ current.file);
var stat = io.stat(p);
path.setValue(stat != nil and stat[11] == "dir" ? p ~ "/" : p);
@ -254,7 +267,12 @@
var t = title.getValue();
if (t == nil or t == "")
t = "Select File";
{
if (self.show_files)
t = "Select Directory";
else
t = "Select File";
}
self.getNode("group[0]/text/label").setValue(t);
current.dir = (var d = dir.getValue()) != nil and d != "" ? d : getprop("/sim/fg-current");

View file

@ -6,8 +6,8 @@
<nasal>
<open>
p = props.globals.getNode("/sim/gui/dialogs/location-in-air/", 1);
mode = {
var p = props.globals.getNode("/sim/gui/dialogs/location-in-air/", 1);
var mode = {
airport: p.getNode("airport", 1),
lonlat: p.getNode("lonlat", 1),
vor: p.getNode("vor", 1),
@ -15,14 +15,14 @@
fix: p.getNode("fix", 1),
};
set_radio = func(m) {
foreach (k; keys(mode)) {
var set_radio = func(m) {
foreach (var k; keys(mode)) {
mode[k].setBoolValue(m == k);
}
}
initialized = 0;
foreach (k; keys(mode)) {
var initialized = 0;
foreach (var k; keys(mode)) {
if (mode[k].getType() == "NONE") {
mode[k].setBoolValue(0);
}
@ -31,6 +31,19 @@
if (!initialized) {
set_radio("airport");
}
var pickNearest = func(type,propname,freqpropname) {
var found = navinfo(type,getprop(propname));
if( found == nil or size(found) == 0 ) {
print(type, " ", getprop(propname), " NOT found");
setprop(propname, "");
setprop(freqpropname, "");
return;
}
setprop(propname, found[0].id);
setprop(freqpropname, found[0].frequency / 100.0);
}
</open>
<close># just kept for educational purposes :-)</close>
@ -300,10 +313,14 @@
if (!mode.vor.getBoolValue()) {
setprop("/sim/presets/vor-id", "");
} else {
pickNearest("vor","/sim/presets/vor-id","/sim/presets/vor-freq");
}
if (!mode.ndb.getBoolValue()) {
setprop("/sim/presets/ndb-id", "");
} else {
pickNearest("ndb","/sim/presets/ndb-id","/sim/presets/ndb-freq");
}
if (!mode.fix.getBoolValue()) {

View file

@ -67,16 +67,23 @@
<row>3</row>
<col>2</col><colspan>2</colspan>
<pref-width>400</pref-width>
<live>true</live>
<property>/sim/terrasync/scenery-dir</property>
<enable>
<property>/sim/terrasync/enabled</property>
</enable>
<binding>
<command>dialog-apply</command>
<object-name>scenery-dir</object-name>
</binding>
<enable><false/></enable>
</input>
<button>
<legend>Change</legend>
<equal>true</equal>
<border>2</border>
<row>3</row>
<col>4</col>
<binding>
<command>nasal</command>
<script>controller.open()</script>
</binding>
</button>
<text>
<row>4</row>
<col>2</col><colspan>3</colspan>
@ -428,4 +435,16 @@
<empty><stretch>true</stretch></empty>
</group>
<nasal>
<open><![CDATA[
var controller = gui.DirSelector.new(
func(result) { setprop("/sim/terrasync/scenery-dir", result.getValue()); },
"Select Target Directory for Downloads", "Ok", getprop("/sim/terrasync/scenery-dir"));
]]></open>
<close><![CDATA[
controller.close();
]]></close>
</nasal>
</PropertyList>

View file

@ -62,6 +62,13 @@
</script>
</binding>
</item>
<item>
<label>Screenshot Directory</label>
<binding>
<command>nasal</command>
<script>gui.set_screenshotdir()</script>
</binding>
</item>
<!--
<item>
<label>Last snapshot</label>