use <enabled>false</enabled> flag for widgets that shouldn't be drawn
instead of <hide>true</hide>. This is consistent with other places in fgfs, like menu entries, hud elements, subsystem switches, etc.
This commit is contained in:
parent
2040b96b4f
commit
b360c2ad62
7 changed files with 20 additions and 24 deletions
|
@ -374,12 +374,10 @@ var property_browser = func(dir = nil) {
|
|||
elsif (isa(dir, props.Node))
|
||||
dir = dir.getPath();
|
||||
var dlgname = "property-browser";
|
||||
foreach (var module; keys(globals)) {
|
||||
if (find("__dlg:" ~ dlgname, module) == 0) {
|
||||
globals[module].clone(dir);
|
||||
return;
|
||||
}
|
||||
}
|
||||
foreach (var module; keys(globals))
|
||||
if (find("__dlg:" ~ dlgname, module) == 0)
|
||||
return globals[module].clone(dir);
|
||||
|
||||
setprop("/sim/gui/dialogs/" ~ dlgname ~ "/last", dir);
|
||||
fgcommand("dialog-show", props.Node.new({"dialog-name": dlgname}));
|
||||
}
|
||||
|
@ -406,9 +404,9 @@ settimer(func {
|
|||
#
|
||||
var dialog_apply = func(dialog, objects...) {
|
||||
var n = props.Node.new({ "dialog-name" : dialog });
|
||||
if (!size(objects)) {
|
||||
if (!size(objects))
|
||||
return fgcommand("dialog-apply", n);
|
||||
}
|
||||
|
||||
var name = n.getNode("object-name", 1);
|
||||
foreach (var o; objects) {
|
||||
name.setValue(o);
|
||||
|
@ -423,9 +421,9 @@ var dialog_apply = func(dialog, objects...) {
|
|||
#
|
||||
var dialog_update = func(dialog, objects...) {
|
||||
var n = props.Node.new({ "dialog-name" : dialog });
|
||||
if (!size(objects)) {
|
||||
if (!size(objects))
|
||||
return fgcommand("dialog-update", n);
|
||||
}
|
||||
|
||||
var name = n.getNode("object-name", 1);
|
||||
foreach (var o; objects) {
|
||||
name.setValue(o);
|
||||
|
@ -436,13 +434,13 @@ var dialog_update = func(dialog, objects...) {
|
|||
|
||||
##
|
||||
# Searches a dialog tree for widgets with a particular <name> entry and
|
||||
# sets their <hide> flag according to "show".
|
||||
# sets their <enabled> flag.
|
||||
#
|
||||
var enable_widgets = func(node, name, show = 1) {
|
||||
var enable_widgets = func(node, name, enable = 1) {
|
||||
foreach (var n; node.getChildren())
|
||||
enable_widgets(n, name, show);
|
||||
enable_widgets(n, name, enable);
|
||||
if ((var n = node.getNode("name")) != nil and n.getValue() == name)
|
||||
node.getNode("hide", 1).setBoolValue(!show);
|
||||
node.getNode("enabled", 1).setBoolValue(enable);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<layout>vbox</layout>
|
||||
<!-- using one copy of button-template per ATC message -->
|
||||
<button-template>
|
||||
<hide>true</hide>
|
||||
<enabled>false</enabled>
|
||||
<legend>LEGEND</legend>
|
||||
<equal>true</equal>
|
||||
<property>PROPERTY</property>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<layout>vbox</layout>
|
||||
<!-- using one copy of group-template per frequency line -->
|
||||
<group-template>
|
||||
<hide>true</hide>
|
||||
<enabled>false</enabled>
|
||||
<layout>hbox</layout>
|
||||
<text>
|
||||
<halign>left</halign>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<layout>hbox</layout>
|
||||
<halign>center</halign>
|
||||
<button-template>
|
||||
<hide>true</hide>
|
||||
<enabled>false</enabled>
|
||||
<legend>ICAO</legend>
|
||||
<binding>
|
||||
<command>property-assign</command>
|
||||
|
@ -29,7 +29,7 @@
|
|||
|
||||
<text>
|
||||
<name>no-atc-in-range</name>
|
||||
<hide>true</hide>
|
||||
<enabled>false</enabled>
|
||||
<label>No ATC in range 50 nm.</label>
|
||||
</text>
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<default-padding>6</default-padding>
|
||||
|
||||
<group-template>
|
||||
<hide>1</hide>
|
||||
<enabled>false</enabled>
|
||||
<layout>hbox</layout>
|
||||
<default-padding>0</default-padding>
|
||||
<text>
|
||||
|
@ -49,7 +49,7 @@
|
|||
var target = self.getNode("group/group").getChild("group", i, 1);
|
||||
props.copy(textgroup, target);
|
||||
target.getNode("text/label").setValue(lines[i]);
|
||||
target.getNode("hide").setValue(0);
|
||||
target.getNode("enabled").setValue(1);
|
||||
}
|
||||
</open>
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
<default-padding>4</default-padding>
|
||||
|
||||
<button-template>
|
||||
<hide>1</hide>
|
||||
<enabled>false</enabled>
|
||||
<halign>fill</halign>
|
||||
<pref-width>20</pref-width>
|
||||
<pref-height>20</pref-height>
|
||||
|
@ -231,7 +231,7 @@
|
|||
state.setBoolValue(0);
|
||||
|
||||
props.copy(template, button);
|
||||
button.getNode("hide").setValue(0);
|
||||
button.getNode("enabled").setBoolValue(1);
|
||||
button.getNode("legend").setIntValue(i);
|
||||
button.getNode("binding[1]/script").setValue("select(" ~ i ~ ")");
|
||||
button.getNode("property").setValue(state.getPath());
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
group.removeChildren("text");
|
||||
var mode = 0;
|
||||
foreach (var v; view.views) {
|
||||
if ((var hide = v.getNode("hide")) != nil and hide.getBoolValue())
|
||||
continue;
|
||||
var index = v.getIndex();
|
||||
var enabled = v.getNode("enabled", 1);
|
||||
props.initNode(enabled, 1, "BOOL");
|
||||
|
|
Loading…
Reference in a new issue