| 139 | } |
| 140 | |
| 141 | bool EditorWidgets::save(const MyGUI::UString& _fileName) |
| 142 | { |
| 143 | size_t index = _fileName.find("|"); |
| 144 | if (index != MyGUI::UString::npos) |
| 145 | { |
| 146 | MyGUI::UString fileName = _fileName.substr(0, index); |
| 147 | MyGUI::UString itemIndex = _fileName.substr(index + 1); |
| 148 | |
| 149 | return saveToProject(fileName, MyGUI::utility::parseValue<size_t>(itemIndex)); |
| 150 | } |
| 151 | |
| 152 | mCurrentFileName = _fileName; |
| 153 | mCurrentItemName.clear(); |
| 154 | |
| 155 | MyGUI::xml::Document doc; |
| 156 | doc.createDeclaration(); |
| 157 | MyGUI::xml::ElementPtr root = doc.createRoot("MyGUI"); |
| 158 | root->addAttribute("type", "Layout"); |
| 159 | |
| 160 | saveWidgetsToXmlNode(root, true); |
| 161 | |
| 162 | if (!doc.save(_fileName)) |
| 163 | { |
| 164 | MYGUI_LOGGING(LogSection, Error, getClassTypeName() << " : " << doc.getLastError()); |
| 165 | return false; |
| 166 | } |
| 167 | |
| 168 | return true; |
| 169 | } |
| 170 | |
| 171 | bool EditorWidgets::saveToProject(const MyGUI::UString& _fileName, size_t _index) |
| 172 | { |
no test coverage detected