From b360c2ad6270f30142ae0eaa48cb9e27125d6328 Mon Sep 17 00:00:00 2001 From: mfranz Date: Tue, 5 Aug 2008 05:28:27 +0000 Subject: [PATCH] use false flag for widgets that shouldn't be drawn instead of true. This is consistent with other places in fgfs, like menu entries, hud elements, subsystem switches, etc. --- Nasal/gui.nas | 26 ++++++++++++-------------- gui/dialogs/atc-dialog.xml | 2 +- gui/dialogs/atc-freq-display.xml | 2 +- gui/dialogs/atc-freq-search.xml | 4 ++-- gui/dialogs/message.xml | 4 ++-- gui/dialogs/nasal-console.xml | 4 ++-- gui/dialogs/view.xml | 2 -- 7 files changed, 20 insertions(+), 24 deletions(-) diff --git a/Nasal/gui.nas b/Nasal/gui.nas index 1d05b99e7..ac6fae8b4 100644 --- a/Nasal/gui.nas +++ b/Nasal/gui.nas @@ -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 entry and -# sets their flag according to "show". +# sets their 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); } diff --git a/gui/dialogs/atc-dialog.xml b/gui/dialogs/atc-dialog.xml index 1391f2676..31db0e374 100644 --- a/gui/dialogs/atc-dialog.xml +++ b/gui/dialogs/atc-dialog.xml @@ -15,7 +15,7 @@ vbox - true + false LEGEND true PROPERTY diff --git a/gui/dialogs/atc-freq-display.xml b/gui/dialogs/atc-freq-display.xml index 192452a0a..fcf4b0777 100644 --- a/gui/dialogs/atc-freq-display.xml +++ b/gui/dialogs/atc-freq-display.xml @@ -14,7 +14,7 @@ vbox - true + false hbox left diff --git a/gui/dialogs/atc-freq-search.xml b/gui/dialogs/atc-freq-search.xml index c7153f4fc..c3aab8201 100644 --- a/gui/dialogs/atc-freq-search.xml +++ b/gui/dialogs/atc-freq-search.xml @@ -14,7 +14,7 @@ hbox center - true + false ICAO property-assign @@ -29,7 +29,7 @@ no-atc-in-range - true + false diff --git a/gui/dialogs/message.xml b/gui/dialogs/message.xml index faff9e8c3..fffb4f6fd 100644 --- a/gui/dialogs/message.xml +++ b/gui/dialogs/message.xml @@ -7,7 +7,7 @@ 6 - 1 + false hbox 0 @@ -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); } diff --git a/gui/dialogs/nasal-console.xml b/gui/dialogs/nasal-console.xml index 98b14a0a0..bede40ad9 100644 --- a/gui/dialogs/nasal-console.xml +++ b/gui/dialogs/nasal-console.xml @@ -55,7 +55,7 @@ 4 - 1 + false fill 20 20 @@ -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()); diff --git a/gui/dialogs/view.xml b/gui/dialogs/view.xml index e23205df8..171a56328 100644 --- a/gui/dialogs/view.xml +++ b/gui/dialogs/view.xml @@ -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");