]> git.mxchange.org Git - flightgear.git/commitdiff
- make menubar reloadable ... again. This was lost because FGBindings does
authormfranz <mfranz>
Sun, 3 Jul 2005 14:43:47 +0000 (14:43 +0000)
committermfranz <mfranz>
Sun, 3 Jul 2005 14:43:47 +0000 (14:43 +0000)
  no longer save inaccessible bindings copies, but only pointer to the
  bindings in the property tree (which was desirable to get accurate
  error messages for Nasal bindings).

src/GUI/menubar.cxx

index 364b3b414e258f1b79bdd6a6ace0f8d1271c950a..a8a9e66121f9d56c0574cc558720c1695d6dc65c 100644 (file)
@@ -270,17 +270,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);