1
0
Fork 0

Manual merge of merge request 95 from Hooray

This commit is contained in:
Stuart Buchanan 2012-11-03 22:05:37 +00:00
parent ca0afd7039
commit 9c6a35012b
3 changed files with 12 additions and 6 deletions

View file

@ -97,8 +97,8 @@ In the close block, you'll want to call "map.cleanup_listeners()" at the moment
.setupZoom( dialog:DIALOG_CANVAS ) # TODO: make zooming configurable for non GUI use
.pickupFeatures (DIALOG_CANVAS); # set up the features specified in the XML file
# FIXME: resource cleanup (listeners!)
update_info();
canvas.run_callbacks(); # WORKAROUND to run dialog-specific init code -
# must be set up via register_callback() in the dialog's open block currently
]]>
</load>
</nasal>

View file

@ -37,6 +37,12 @@
#
#FIXME: this is a hack so that dialogs can register their own
# callbacks that are automatically invoked at the end of the
# generic-canvas-map.xml file (canvas/nasal section)
var callbacks = [];
var register_callback = func(c) append(callbacks, c);
var run_callbacks = func foreach(var c; callbacks) c();
var DEBUG=0;
if (DEBUG) {
@ -418,7 +424,7 @@ LayeredMap.updateState = func {
#FIXME: listener management should be done at the MVC level, for each component - not as part of the LayeredMap!
LayeredMap.cleanup_listeners = func {
print("Cleaning up listeners");
# print("Cleaning up listeners");
foreach(var l; me.listeners)
removelistener(l);

View file

@ -190,14 +190,13 @@
}
}
update_info();
canvas.register_callback(update_info); # FIXME: this is a workaround to run dialog-specific code in the canvas block
]]>
</open>
<close>
fgcommand("clear-metar", var n = props.Node.new({ "path": "/sim/gui/dialogs/airports/selected-airport/metar",
"station": airport_id}));
# map.cleanup_listeners(); #TODO: We should be setting a signal when closing the dialog, so that cleanup code can be invoked automatically
map.cleanup_listeners(); #TODO: We should be setting a signal when closing the dialog, so that cleanup code can be invoked automatically
</close>
</nasal>
@ -657,6 +656,7 @@
<description>Show Tower</description>
<default>enabled</default>
</layer>
<!-- Uncomment this to add a navaid layer (not yet fully implemented, and no LOD yet)
<layer>
<name>navaids</name>