X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FConfig%2FConfig_WidgetReader.cpp;h=a839b9662492366c16eb3494192bc6a07c396eea;hb=b5893b0a30fac08134c24de4565cb513a43affa6;hp=f0214657bb339201c81a8ee1d5fda147189b4838;hpb=0b2198f0640fcbd74365265ed8c65936823a75d6;p=modules%2Fshaper.git diff --git a/src/Config/Config_WidgetReader.cpp b/src/Config/Config_WidgetReader.cpp index f0214657b..a839b9662 100644 --- a/src/Config/Config_WidgetReader.cpp +++ b/src/Config/Config_WidgetReader.cpp @@ -1,3 +1,5 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + /* * Config_WidgetReader.cpp * @@ -20,7 +22,6 @@ #include #endif - Config_WidgetReader::Config_WidgetReader(const std::string& theXmlFile) : Config_XMLReader(theXmlFile) @@ -41,13 +42,12 @@ std::string Config_WidgetReader::featureDescription(const std::string& theFeatur return myDescriptionCache[theFeatureName]; } - void Config_WidgetReader::processNode(xmlNodePtr theNode) { if (isNode(theNode, NODE_FEATURE, NULL)) { - myCurrentFeature = getProperty(theNode, _ID); - myWidgetCache[myCurrentFeature] = dumpNode(theNode); - myDescriptionCache[myCurrentFeature] = getProperty(theNode, FEATURE_TEXT); + std::string aFeature = getProperty(theNode, _ID); + myWidgetCache[aFeature] = dumpNode(theNode); + myDescriptionCache[aFeature] = getProperty(theNode, FEATURE_TEXT); } //Process SOURCE nodes. Config_XMLReader::processNode(theNode); @@ -56,34 +56,34 @@ void Config_WidgetReader::processNode(xmlNodePtr theNode) bool Config_WidgetReader::processChildren(xmlNodePtr theNode) { //Read all nodes recursively, source and validator nodes have no children - return !isNode(theNode, NODE_VALIDATOR, NODE_SOURCE, NULL); + return !isNode(theNode, NODE_VALIDATOR, + NODE_SOURCE, NULL); } void Config_WidgetReader::resolveSourceNodes(xmlNodePtr theNode) { xmlNodePtr aNode = xmlFirstElementChild(theNode); std::list aSourceNodes; - while(aNode != NULL) { + while (aNode != NULL) { if (isNode(aNode, NODE_SOURCE, NULL)) { Config_XMLReader aSourceReader = Config_XMLReader(getProperty(aNode, SOURCE_FILE)); xmlNodePtr aSourceRoot = aSourceReader.findRoot(); - if (!aSourceRoot) { - continue; + if (aSourceRoot) { + xmlNodePtr aSourceNode = xmlFirstElementChild(aSourceRoot); + xmlNodePtr aTargetNode = xmlDocCopyNodeList(aNode->doc, aSourceNode); + while (aTargetNode != NULL) { + xmlNodePtr aNextNode = xmlNextElementSibling(aTargetNode); + xmlAddPrevSibling(aNode, aTargetNode); + aTargetNode = aNextNode; + } + aSourceNodes.push_back(aNode); } - xmlNodePtr aSourceNode = xmlFirstElementChild(aSourceRoot); - xmlNodePtr aTargetNode = xmlDocCopyNodeList(aNode->doc, aSourceNode); - while(aTargetNode != NULL) { - xmlNodePtr aNextNode = xmlNextElementSibling(aTargetNode); - xmlAddPrevSibling(aNode, aTargetNode); - aTargetNode = aNextNode; - } - aSourceNodes.push_back(aNode); } aNode = xmlNextElementSibling(aNode); } //Remove "SOURCE" node. std::list::iterator it = aSourceNodes.begin(); - for(; it != aSourceNodes.end(); it++) { + for (; it != aSourceNodes.end(); it++) { xmlUnlinkNode(*it); xmlFreeNode(*it); } @@ -93,6 +93,14 @@ std::string Config_WidgetReader::dumpNode(xmlNodePtr theNode) { std::string result = ""; if (!hasChild(theNode)) { + // feature which has the next property should be dumped itself + std::string anOwnPanel = getProperty(theNode, PROPERTY_PANEL_ID); + if (!anOwnPanel.empty()) { + xmlBufferPtr buffer = xmlBufferCreate(); + int size = xmlNodeDump(buffer, theNode->doc, theNode, 0, 0); + result = std::string((char*) (buffer->content)); + xmlBufferFree(buffer); + } return result; } //Replace all "source" nodes with content;