]> git.mxchange.org Git - flightgear.git/commitdiff
- add fgcommand to reload menubar; that's necessary to make changes visible
authormfranz <mfranz>
Sun, 3 Jul 2005 15:06:29 +0000 (15:06 +0000)
committermfranz <mfranz>
Sun, 3 Jul 2005 15:06:29 +0000 (15:06 +0000)
  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

index 21e9975e54c2169d30b810ee23ca5ef647efe66a..ef67b98ca0c39e4a6492cef129d797a7448b20c8 100644 (file)
@@ -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 },