diff --git a/addon-main.nas b/addon-main.nas index 5e7b969..b6fd078 100644 --- a/addon-main.nas +++ b/addon-main.nas @@ -1,5 +1,5 @@ # -# Starter addon +# VFR Navigator addon # # Slawek Mikula, August 2018 @@ -16,11 +16,11 @@ var main = func( addon ) { } var data = { - label : "VFR Starter", + label : "VFR Starter", name : "vfrstarter", binding : { command : "dialog-show", "dialog-name" : "vfrstarter" }, enabled : "true", - }; + }; foreach(var item; props.getNode("/sim/menubar/default/menu[2]").getChildren("item")) { if (item.getValue("name") == "vfrstarter") { @@ -28,7 +28,23 @@ var main = func( addon ) { } } - props.globals.getNode("/sim/menubar/default/menu[2]").addChild("item").setValues(data); + props.globals.getNode("/sim/menubar/default/menu[2]").addChild("item").setValues(data); - fgcommand("gui-redraw"); + fgcommand("gui-redraw"); + + var fdm_init_listener = _setlistener("/sim/signals/fdm-initialized", func { + removelistener(fdm_init_listener); + + if (getprop("/addons/by-id/" ~ my_addon_id ~ "/showvfrstarter") == 1) { + gui.showDialog("vfrstarter"); + } + }); + + var reinit_listener = _setlistener("/sim/signals/reinit", func { + removelistener(reinit_listener); + + if (getprop("/addons/by-id/" ~ my_addon_id ~ "/showvfrstarter") == 1) { + gui.showDialog("vfrstarter"); + } + }); } diff --git a/gui/vfrmap.xml b/gui/vfrmap.xml index ba7a502..32c6a3b 100644 --- a/gui/vfrmap.xml +++ b/gui/vfrmap.xml @@ -10,7 +10,7 @@ 3 - 1.0 + 0.7 @@ -26,7 +26,6 @@ fgcommand("dialog-show", n); } } - setTransparency(0); var reinit = func() { setTransparency(1); @@ -71,8 +70,8 @@ - - 22 + + 16 %d /gui/map/zoom true @@ -92,6 +91,18 @@ + + 1 @@ -163,17 +174,21 @@ /autopilot/route-manager/wp[0]/eta true - - - WB %.0f - /environment/wind-from-heading-deg - true - - - - WS %.0f - /environment/wind-speed-kt - true - + + hbox + 2 + + + W %.0f + /environment/wind-from-heading-deg + true + + + + /%.0f + /environment/wind-speed-kt + true + + diff --git a/gui/vfrstarter.xml b/gui/vfrstarter.xml index 219a0bd..76221ee 100644 --- a/gui/vfrstarter.xml +++ b/gui/vfrstarter.xml @@ -13,6 +13,16 @@ 0.7 + + + setprop("/addons/by-id/com.slawekmikula.flightgear.VfrNavigator/showvfrstarter", 1); + + + + setprop("/addons/by-id/com.slawekmikula.flightgear.VfrNavigator/showvfrstarter", 0); + + + hbox 1 diff --git a/todo.txt b/todo.txt index 917b10f..8b13789 100644 --- a/todo.txt +++ b/todo.txt @@ -1,4 +1 @@ -- wczytywanie planu lotu z PLN -- wczytywanie planu lotu z VfrFlight -- panel planu lotu (vfr) -- wyƛwietlanie kursu wg. aktualnego leg'a planu logu +