Merge pull request #843 from MihailRis/common-vc-funcs

new functions and settings
This commit is contained in:
MihailRis 2026-06-01 00:27:11 +03:00 • committed by GitHub
commit 025e32eec1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 617 additions and 421 deletions

View file

@ -61,16 +61,19 @@ std::unique_ptr<UiDocument> UiDocument::read(
const scriptenv& penv,
const std::string& name,
const io::path& file,
const std::string& fileName
const std::string& fileName,
scriptenv&& env
) {
const std::string text = io::read_string(file);
auto xmldoc = xml::parse(file.string(), text);
auto env = penv == nullptr
? scripting::create_doc_environment(scripting::get_root_environment(), name)
: scripting::create_doc_environment(penv, name);
if (env == nullptr) {
env = penv == nullptr
? scripting::create_doc_environment(scripting::get_root_environment(), name)
: scripting::create_doc_environment(penv, name);
}
gui::UiXmlReader reader(gui, scriptenv(env));
gui::UiXmlReader reader(gui, env);
auto view = reader.readXML(file.string(), *xmldoc->getRoot());
view->setId("root");
UiDocScript script {};
@ -82,9 +85,3 @@ std::unique_ptr<UiDocument> UiDocument::read(
}
return std::make_unique<UiDocument>(name, script, view, env);
}
std::shared_ptr<gui::UINode> UiDocument::readElement(
gui::GUI& gui, const io::path& file, const std::string& fileName
) {
return read(gui, nullptr, file.name(), file, fileName)->getRoot();
}

View file

@ -50,9 +50,7 @@ public:
const scriptenv& parent_env,
const std::string& name,
const io::path& file,
const std::string& fileName
);
static std::shared_ptr<gui::UINode> readElement(
gui::GUI&, const io::path& file, const std::string& fileName
const std::string& fileName,
scriptenv&& env = nullptr
);
};