From d1fd61c728e7333d0f2ac65acbd971f16ebc54ae Mon Sep 17 00:00:00 2001 From: mfranz <mfranz> Date: Tue, 11 Nov 2008 14:54:51 +0000 Subject: [PATCH] gui.nas: use nasal-dir-initialized signal for INIT func, so that it's earlier available. (The settimer/1 was a workaround for another problem that should be fixed by now.) globals.nas: load $FG_HOME/Nasal/ files as first settimer(0) function, so that it always comes after all nasal-dir-initialized callbacks This should fix the glide_slope_tunnel/popupTip bug and makes the startup order clearer and cleaner. --- Nasal/globals.nas | 4 ++-- Nasal/gui.nas | 13 ++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Nasal/globals.nas b/Nasal/globals.nas index d6604ccb5..9a3d5a3b4 100644 --- a/Nasal/globals.nas +++ b/Nasal/globals.nas @@ -131,11 +131,11 @@ var printlog = func(level, args...) { # Load and execute ~/.fgfs/Nasal/*.nas files in alphabetic order # after all $FG_ROOT/Nasal/*.nas files were loaded. # -_setlistener("/sim/signals/nasal-dir-initialized", func { +settimer(func { var path = getprop("/sim/fg-home") ~ "/Nasal"; if((var dir = directory(path)) == nil) return; foreach(var file; sort(dir, cmp)) if(size(file) > 4 and substr(file, -4) == ".nas") io.load_nasal(path ~ "/" ~ file, substr(file, 0, size(file) - 4)); -}); +}, 0); diff --git a/Nasal/gui.nas b/Nasal/gui.nas index 00d4ab084..03257c376 100644 --- a/Nasal/gui.nas +++ b/Nasal/gui.nas @@ -87,7 +87,7 @@ var fdm = getprop("/sim/flight-model"); var screenHProp = nil; var tipArg = nil; -var INIT = func { +_setlistener("/sim/signals/nasal-dir-initialized", func { screenHProp = props.globals.getNode("/sim/startup/ysize"); tipArg = props.Node.new({ "dialog-name" : "PopTip" }); @@ -104,10 +104,13 @@ var INIT = func { var fps = props.globals.getNode("/sim/rendering/fps-display", 1); setlistener(fps, fpsDisplay, 1); - setlistener("/sim/startup/xsize", - func { if (fps.getValue()) { fpsDisplay(0); fpsDisplay(1) } }); -} -settimer(INIT, 1); + setlistener("/sim/startup/xsize", func { + if (fps.getValue()) { + fpsDisplay(0); + fpsDisplay(1); + } + }); +}); ##