1
0
Fork 0

make system and aircraft views configurable in Menu->Views->View Options.

These are then skipped with view.stepView(n), unless the second, optional
argument is set to 1:  view.stepView(n, 1);
Whether a view is enabled or not, is saved in $FG_ROOT/.fgfs/autosave.xml
(system views) or $FG_ROOT/.fgfs/aircraft-data/<aircraft>.xml
This commit is contained in:
mfranz 2007-11-19 16:26:15 +00:00
parent d6be4c8303
commit 10c875f75e
4 changed files with 104 additions and 22 deletions

View file

@ -70,14 +70,19 @@ var resetViewDir = func {
} }
## ##
# Handler. Step to the next view. # Handler. Step to the next (force=1) or next enabled view.
# #
var stepView = func(n) { var stepView = func(n, force = 0) {
var i = getprop("/sim/current-view/view-number") + n; var i = getprop("/sim/current-view/view-number");
if (i < 0) while (1) {
i = size(views) - 1; i += n;
elsif (i >= size(views)) if (i < 0)
i = 0; i = size(views) - 1;
elsif (i >= size(views))
i = 0;
if (!i or force or (var e = views[i].getNode("enabled")) == nil or e.getValue())
break;
}
setprop("/sim/current-view/view-number", i); setprop("/sim/current-view/view-number", i);
# And pop up a nice reminder # And pop up a nice reminder

72
gui/dialogs/view.xml Normal file
View file

@ -0,0 +1,72 @@
<?xml version="1.0"?>
<PropertyList>
<name>view</name>
<modal>false</modal>
<layout>vbox</layout>
<text>
<label>Configure Active Views</label>
</text>
<hrule/>
<nasal>
<open>
var group = cmdarg().getNode("group");
var ac = getprop("/sim/aircraft");
group.removeChildren("checkbox");
group.removeChildren("hrule");
group.removeChildren("text");
var system = 1;
foreach (var v; view.views) {
var index = v.getIndex();
if (index == 0 or index >= 200)
continue;
if (index >= 100) {
if (system) {
group.getNode("hrule", 1);
var t = group.getNode("text", 1);
t.getNode("label", 1).setValue("\"" ~ ac ~ "\" Specific Views");
system = 0;
}
aircraft.data.add(v.getPath() ~ "/enabled");
}
if (v.getNode("enabled") == nil)
v.getNode("enabled", 1).setBoolValue(1);
var target = group.getChild("checkbox", index, 1);
props.copy(group.getNode("checkbox-template"), target);
target.getNode("label").setValue(v.getNode("name").getValue());
target.getNode("property").setValue(v.getPath() ~ "/enabled");
}
</open>
</nasal>
<group>
<layout>vbox</layout>
<halign>center</halign>
<checkbox-template>
<halign>left</halign>
<label><!----></label>
<property><!----></property>
<binding>
<command>dialog-apply</command>
</binding>
</checkbox-template>
</group>
<button>
<legend>Close</legend>
<default>true</default>
<key>Esc</key>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>dialog-close</command>
</binding>
</button>
</PropertyList>

View file

@ -19,16 +19,6 @@
</binding> </binding>
</item> </item>
<!--
<item>
<label>Load Aircraft</label>
<binding>
<command>dialog-show</command>
<dialog-name>aircraft</dialog-name>
</binding>
</item>
-->
<item> <item>
<label>Reset</label> <label>Reset</label>
<binding> <binding>
@ -117,7 +107,15 @@
</item> </item>
<item> <item>
<label>Rendering options</label> <label>View Options</label>
<binding>
<command>dialog-show</command>
<dialog-name>view</dialog-name>
</binding>
</item>
<item>
<label>Rendering Options</label>
<binding> <binding>
<command>dialog-show</command> <command>dialog-show</command>
<dialog-name>rendering</dialog-name> <dialog-name>rendering</dialog-name>
@ -156,7 +154,6 @@
</binding> </binding>
</item> </item>
<item> <item>
<label>Chat</label> <label>Chat</label>
<binding> <binding>
@ -164,7 +161,7 @@
<dialog-name>chat</dialog-name> <dialog-name>chat</dialog-name>
</binding> </binding>
</item> </item>
</menu> </menu>
<menu> <menu>
@ -380,7 +377,7 @@
<command>ATC-freq-search</command> <command>ATC-freq-search</command>
</binding> </binding>
</item> </item>
<item> <item>
<label>Options</label> <label>Options</label>
<binding> <binding>
@ -388,7 +385,7 @@
<dialog-name>atc-ai</dialog-name> <dialog-name>atc-ai</dialog-name>
</binding> </binding>
</item> </item>
</menu> </menu>
<menu> <menu>
@ -463,6 +460,7 @@
<command>dump-scenegraph</command> <command>dump-scenegraph</command>
</binding> </binding>
</item> </item>
</menu> </menu>
<menu> <menu>

View file

@ -260,6 +260,7 @@ Started September 2000 by David Megginson, david@megginson.com
<view> <view>
<name>Cockpit View</name> <name>Cockpit View</name>
<enabled type="bool" userarchive="y">true</enabled>
<type>lookfrom</type> <type>lookfrom</type>
<internal type="bool">false</internal> <internal type="bool">false</internal>
<config> <config>
@ -283,6 +284,7 @@ Started September 2000 by David Megginson, david@megginson.com
<view> <view>
<name>Helicopter View</name> <name>Helicopter View</name>
<enabled type="bool" userarchive="y">true</enabled>
<type>lookat</type> <type>lookat</type>
<config> <config>
<from-model type="bool">false</from-model> <from-model type="bool">false</from-model>
@ -308,6 +310,7 @@ Started September 2000 by David Megginson, david@megginson.com
<view> <view>
<name>Chase View</name> <name>Chase View</name>
<enabled type="bool" userarchive="y">true</enabled>
<type>lookat</type> <type>lookat</type>
<config> <config>
<from-model type="bool">false</from-model> <from-model type="bool">false</from-model>
@ -337,6 +340,7 @@ Started September 2000 by David Megginson, david@megginson.com
<view> <view>
<name>Tower View</name> <name>Tower View</name>
<enabled type="bool" userarchive="y">true</enabled>
<type>lookat</type> <type>lookat</type>
<config> <config>
<eye-lat-deg-path>/sim/tower/latitude-deg</eye-lat-deg-path> <eye-lat-deg-path>/sim/tower/latitude-deg</eye-lat-deg-path>
@ -360,6 +364,7 @@ Started September 2000 by David Megginson, david@megginson.com
<view> <view>
<name>Tower View Look From</name> <name>Tower View Look From</name>
<enabled type="bool" userarchive="y">true</enabled>
<type>lookfrom</type> <type>lookfrom</type>
<config> <config>
<eye-lat-deg-path>/sim/tower/latitude-deg</eye-lat-deg-path> <eye-lat-deg-path>/sim/tower/latitude-deg</eye-lat-deg-path>
@ -380,6 +385,7 @@ Started September 2000 by David Megginson, david@megginson.com
<view> <view>
<name>Chase View wo yaw</name> <name>Chase View wo yaw</name>
<enabled type="bool" userarchive="y">true</enabled>
<type>lookat</type> <type>lookat</type>
<config> <config>
<from-model type="bool">false</from-model> <from-model type="bool">false</from-model>
@ -402,6 +408,7 @@ Started September 2000 by David Megginson, david@megginson.com
<view> <view>
<name>Fly-By View</name> <name>Fly-By View</name>
<enabled type="bool" userarchive="y">true</enabled>
<type>lookat</type> <type>lookat</type>
<config> <config>
<eye-lon-deg-path>/sim/viewer/longitude-deg</eye-lon-deg-path> <eye-lon-deg-path>/sim/viewer/longitude-deg</eye-lon-deg-path>