From 11138e373920e3ce3f94ce6241c6d228be982afd Mon Sep 17 00:00:00 2001 From: mfranz Date: Sun, 3 Jul 2005 14:43:47 +0000 Subject: [PATCH] - 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). --- src/GUI/menubar.cxx | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) 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); -- 2.39.5