feat: Allow layouts to be deleted again
This commit is contained in:
parent
6dbaac4283
commit
1b88b3704d
@ -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;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user