| 50 | } |
| 51 | |
| 52 | bool EditorWidgets::load(const MyGUI::UString& _fileName) |
| 53 | { |
| 54 | size_t index = _fileName.find("|"); |
| 55 | if (index != MyGUI::UString::npos) |
| 56 | { |
| 57 | MyGUI::UString fileName = _fileName.substr(0, index); |
| 58 | MyGUI::UString itemIndex = _fileName.substr(index + 1); |
| 59 | |
| 60 | return loadFromProject(fileName, MyGUI::utility::parseValue<size_t>(itemIndex)); |
| 61 | } |
| 62 | |
| 63 | mCurrentFileName = _fileName; |
| 64 | mCurrentItemName.clear(); |
| 65 | |
| 66 | MyGUI::xml::Document doc; |
| 67 | if (!doc.open(_fileName)) |
| 68 | { |
| 69 | MYGUI_LOGGING(LogSection, Error, getClassTypeName() << " : " << doc.getLastError()); |
| 70 | return false; |
| 71 | } |
| 72 | |
| 73 | MyGUI::xml::ElementPtr root = doc.getRoot(); |
| 74 | if ((nullptr == root) || (root->getName() != "MyGUI")) |
| 75 | { |
| 76 | MYGUI_LOGGING(LogSection, Error, getClassTypeName() << " : '" << _fileName << "', tag 'MyGUI' not found"); |
| 77 | return false; |
| 78 | } |
| 79 | |
| 80 | if (root->findAttribute("type") == "Layout") |
| 81 | { |
| 82 | loadWidgetsFromXmlNode(root); |
| 83 | } |
| 84 | else |
| 85 | { |
| 86 | return false; |
| 87 | } |
| 88 | |
| 89 | mWidgetsChanged = true; |
| 90 | return true; |
| 91 | } |
| 92 | |
| 93 | bool EditorWidgets::loadFromProject(const MyGUI::UString& _fileName, size_t _index) |
| 94 | { |
nothing calls this directly
no test coverage detected