flightgear-addon-vfrnavigator/addon-main.nas
Slawek Mikula d31829f691 initial commit
- starter dialog
- show small map action
- show route manager
- show stopwatch
2018-09-22 00:06:20 +02:00

35 lines
1.0 KiB
Plaintext

#
# Starter addon
#
# Slawek Mikula, August 2018
var main = func( addon ) {
var root = addon.basePath;
var my_addon_id = "com.slawekmikula.flightgear.VfrNavigator";
var my_version = getprop("/addons/by-id/" ~ my_addon_id ~ "/version");
var my_root_path = getprop("/addons/by-id/" ~ my_addon_id ~ "/path");
var dialogs = ["vfrmap-settings", "vfrmap", "vfrstarter", "vfrtable"];
forindex (var i; dialogs) {
gui.Dialog.new("/sim/gui/dialogs/" ~ dialogs[i] ~ "/dialog", my_root_path ~ "/gui/" ~ dialogs[i] ~ ".xml");
}
var data = {
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") {
return;
}
}
props.globals.getNode("/sim/menubar/default/menu[2]").addChild("item").setValues(data);
fgcommand("gui-redraw");
}