From 7f9b0fbb73ddb6e6cb4f34cbcf36c224c144829a Mon Sep 17 00:00:00 2001 From: mfranz <mfranz> Date: Sun, 3 Jul 2005 15:06:29 +0000 Subject: [PATCH] - add fgcommand to reload menubar; that's necessary to make changes visible at runtime. Example: <key n="99"> <name>c</name> <desc>Update completely useless menu entry.</desc> <binding> <command>nasal</command> <script> time = getprop("/sim/time/elapsed-sec"); setprop("/sim/menubar/default/menu[9]/label", time); </script> </binding> <binding> <command>menu-reload</command> </binding> </key> --- src/Main/fg_commands.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Main/fg_commands.cxx b/src/Main/fg_commands.cxx index 21e9975e5..ef67b98ca 100644 --- a/src/Main/fg_commands.cxx +++ b/src/Main/fg_commands.cxx @@ -1007,6 +1007,15 @@ do_data_logging_commit (const SGPropertyNode * arg) return true; } + +static bool +do_menu_reload (const SGPropertyNode *) +{ + globals->get_subsystem("gui")->reinit(); + return true; +} + + /** * Built-in command: Add a dialog to the GUI system. Does *not* * display the dialog. The property node should have the same format @@ -1340,6 +1349,7 @@ static struct { { "property-cycle", do_property_cycle }, { "property-randomize", do_property_randomize }, { "data-logging-commit", do_data_logging_commit }, + { "menu-reload", do_menu_reload }, { "dialog-new", do_dialog_new }, { "dialog-show", do_dialog_show }, { "dialog-close", do_dialog_close },