1
0
Fork 0

overlay-select.xml, gui.nas: fix overlay-dialog close(); add relpath() func

aircraft.nas: remove redundant data.add()
This commit is contained in:
mfranz 2008-10-19 12:34:09 +00:00
parent 94211721cf
commit c5fe446f58
3 changed files with 9 additions and 11 deletions

View file

@ -514,7 +514,6 @@ var livery = {
me.parents = [gui.OverlaySelector.new("Select Livery", dir, nameprop, sortprop,
"sim/model/livery/file")];
me.dialog = me.parents[0];
data.add(nameprop);
},
};

View file

@ -311,21 +311,19 @@ var OverlaySelector = {
m.parents = [OverlaySelector, Dialog];
m.dir = string.normpath(getprop("/sim/fg-root") ~ '/' ~ dir) ~ '/';
m.nameprop = nameprop;
m.sortprop = sortprop or nameprop;
var relpath = func(p) substr(p, p[0] == `/`);
m.nameprop = relpath(nameprop);
m.sortprop = relpath(sortprop or nameprop);
m.mpprop = mpprop;
m.callback = callback;
m.result = props.initNode(data.getNode("result", 1), "");
m.listener = setlistener(m.result, func(n) m.select(n.getValue()));
m.prop.getNode("group/text/label").setValue(title);
m.prop.getNode("group/button/binding/script").setValue('gui.Dialog.instance["' ~ name ~ '"].close()');
m.list = m.prop.getNode("list");
m.list.getNode("property").setValue(m.result.getPath());
if (m.nameprop[0] == `/`)
m.nameprop = substr(m.nameprop, 1);
if (m.sortprop[0] == `/`)
m.sortprop = substr(m.sortprop, 1);
if (m.mpprop)
aircraft.data.add(m.nameprop);

View file

@ -11,7 +11,7 @@
<empty><stretch>1</stretch></empty>
<text>
<label>set by gui.OverlaySelector</label>
<label>$name</label>
</text>
<empty><stretch>1</stretch></empty>
@ -25,7 +25,8 @@
<border>2</border>
<binding>
<command>dialog-close</command>
<command>nasal</command>
<script>$close</script>
</binding>
</button>
</group>
@ -35,10 +36,10 @@
<list>
<halign>fill</halign>
<pref-height>200</pref-height>
<property>set by gui.OverlaySelector</property>
<property>$result</property>
<binding>
<command>dialog-apply</command>
</binding>
<value>set by gui.OverlaySelector</value>
<value>$value</value>
</list>
</PropertyList>