1
0
mirror of synced 2025-01-19 01:24:15 +01:00

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

@ -18,7 +18,12 @@ namespace hex::plugin::builtin {
ImGui::NewLine(); ImGui::NewLine();
ImGui::PushItemWidth(-1); ImGui::PushItemWidth(-1);
ImGui::SetKeyboardFocusHere();
if (this->m_justOpened) {
ImGui::SetKeyboardFocusHere();
this->m_justOpened = false;
}
ImGui::InputTextIcon("##input", ICON_VS_SYMBOL_KEY, this->m_input); ImGui::InputTextIcon("##input", ICON_VS_SYMBOL_KEY, this->m_input);
ImGui::PopItemWidth(); ImGui::PopItemWidth();
@ -57,6 +62,7 @@ namespace hex::plugin::builtin {
std::string m_message; std::string m_message;
std::function<void(std::string)> m_function; std::function<void(std::string)> m_function;
bool m_justOpened = true;
}; };
} }

View File

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