]> git.mxchange.org Git - flightgear.git/blobdiff - src/GUI/menubar.cxx
Mathias Fröhlich:
[flightgear.git] / src / GUI / menubar.cxx
index 364b3b414e258f1b79bdd6a6ace0f8d1271c950a..1bf4870f45d44d15362edb5bd068ea53355d7e85 100644 (file)
 // user-configured dialogs and new commands where necessary.
 ////////////////////////////////////////////////////////////////////////
 
-extern void saveFlight (puObject *);
-static bool
-do_save_dialog (const SGPropertyNode * arg)
-{
-    saveFlight(0);
-    return true;
-}
-
-extern void loadFlight (puObject *);
-static bool
-do_load_dialog (const SGPropertyNode * arg)
-{
-    loadFlight(0);
-    return true;
-}
-
 extern void reInit (puObject *);
 static bool
 do_reinit_dialog (const SGPropertyNode * arg)
@@ -72,14 +56,6 @@ do_print_dialog (const SGPropertyNode * arg)
 }
 #endif
 
-extern void PilotOffsetAdjust (puObject *);
-static bool
-do_pilot_offset_dialog (const SGPropertyNode * arg)
-{
-    PilotOffsetAdjust(0);
-    return true;
-}
-
 extern void fgHUDalphaAdjust (puObject *);
 static bool
 do_hud_alpha_dialog (const SGPropertyNode * arg)
@@ -150,8 +126,6 @@ static struct {
     const char * name;
     SGCommandMgr::command_t command;
 } deprecated_dialogs [] = {
-    { "old-save-dialog", do_save_dialog },
-    { "old-load-dialog", do_load_dialog },
     { "old-reinit-dialog", do_reinit_dialog },
 #if defined(TR_HIRES_SNAP)
     { "old-hires-snapshot-dialog", do_hires_snapshot_dialog },
@@ -159,7 +133,6 @@ static struct {
 #if defined( WIN32 ) && !defined( __CYGWIN__) && !defined(__MINGW32__)
     { "old-print-dialog", do_print_dialog },
 #endif
-    { "old-pilot-offset-dialog", do_pilot_offset_dialog },
     { "old-hud-alpha-dialog", do_hud_alpha_dialog },
     { "old-properties-dialog", do_properties_dialog },
     { "old-ap-add-waypoint-dialog", do_ap_add_waypoint_dialog },
@@ -270,17 +243,25 @@ FGMenuBar::make_menu (SGPropertyNode * node)
     for (unsigned int i = 0, j = item_nodes.size() - 1;
          i < item_nodes.size();
          i++, j--) {
-        
+
                                 // Set up the PUI entries for this item
         items[j] = strdup((char *)item_nodes[i]->getStringValue("label"));
         callbacks[j] = menu_callback;
 
                                 // Load all the bindings for this item
-        vector<SGPropertyNode_ptr> binding_nodes =
-            item_nodes[i]->getChildren("binding");
-
-        for (unsigned int k = 0; k < binding_nodes.size(); k++)
-            _bindings[items[j]].push_back(new FGBinding(binding_nodes[k]));
+        vector<SGPropertyNode_ptr> bindings = item_nodes[i]->getChildren("binding");
+        SGPropertyNode * dest = fgGetNode("/sim/bindings/menu", true);
+
+        for (unsigned int k = 0; k < bindings.size(); k++) {
+            unsigned int m = 0;
+            SGPropertyNode *binding;
+            while (dest->getChild("binding", m))
+                m++;
+
+            binding = dest->getChild("binding", m, true);
+            copyProperties(bindings[k], binding);
+            _bindings[items[j]].push_back(new FGBinding(binding));
+        }
     }
 
     _menuBar->add_submenu(name, items, callbacks);