feat: Allow layouts to be deleted again

This commit is contained in:
WerWolv
2023-05-21 10:43:35 +02:00
parent 6dbaac4283
commit 1b88b3704d
2 changed files with 15 additions and 3 deletions

View File

@@ -456,9 +456,15 @@ namespace hex::plugin::builtin {
LayoutManager::loadString(std::string(romfs::get("layouts/default.hexlyt").string()));
}
bool shift = ImGui::GetIO().KeyShift;
for (auto &[name, path] : LayoutManager::getLayouts()) {
if (ImGui::MenuItem(name.c_str(), "", false, ImHexApi::Provider::isValid())) {
LayoutManager::load(path);
if (ImGui::MenuItem(hex::format("{}{}", name, shift ? " [X]" : "").c_str(), "", false, ImHexApi::Provider::isValid())) {
if (shift) {
wolv::io::fs::remove(path);
LayoutManager::reload();
}
else
LayoutManager::load(path);
}
}
});