From: mfranz Date: Sun, 3 Jul 2005 14:43:47 +0000 (+0000) Subject: - make menubar reloadable ... again. This was lost because FGBindings does X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=11138e373920e3ce3f94ce6241c6d228be982afd;p=flightgear.git - make menubar reloadable ... again. This was lost because FGBindings does 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). --- diff --git a/src/GUI/menubar.cxx b/src/GUI/menubar.cxx index 364b3b414..a8a9e6612 100644 --- a/src/GUI/menubar.cxx +++ b/src/GUI/menubar.cxx @@ -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 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 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);