1
0
mirror of synced 2024-11-28 17:40:51 +01:00

ux: Moved bookmark remove button from body to header

This commit is contained in:
WerWolv 2022-03-26 16:55:48 +01:00
parent 4b6a76bf02
commit a4d3173da9
3 changed files with 12 additions and 18 deletions

View File

@ -238,9 +238,7 @@ namespace hex::plugin::builtin {
ImGui::SameLine();
if (ImGui::IconButton(ICON_VS_FOLDER_OPENED, ImGui::GetStyleColorVec4(ImGuiCol_Text))) {
return fs::openFileBrowser("hex.builtin.setting.font.font_path", fs::DialogMode::Open, {
{"TTF Font", "ttf"}
},
return fs::openFileBrowser("hex.builtin.setting.font.font_path", fs::DialogMode::Open, { {"TTF Font", "ttf"} },
[&](const std::fs::path &path) {
fontPath = path.string();
setting = fontPath;

View File

@ -73,7 +73,9 @@ namespace hex::plugin::builtin {
ImGui::PushStyleColor(ImGuiCol_Header, color);
ImGui::PushStyleColor(ImGuiCol_HeaderActive, color);
ImGui::PushStyleColor(ImGuiCol_HeaderHovered, u32(hoverColor));
if (ImGui::CollapsingHeader((name + "###bookmark").c_str())) {
bool open = true;
if (ImGui::CollapsingHeader(name.c_str(), &open)) {
ImGui::TextUnformatted("hex.builtin.view.bookmarks.title.info"_lang);
ImGui::Separator();
ImGui::TextFormatted("hex.builtin.view.bookmarks.address"_lang, region.address, region.address + region.size - 1, region.size);
@ -127,10 +129,6 @@ namespace hex::plugin::builtin {
ImHexApi::HexEditor::setSelection(region);
ImGui::SameLine(0, 15);
if (ImGui::Button("hex.builtin.view.bookmarks.button.remove"_lang))
bookmarkToRemove = iter;
ImGui::SameLine(0, 15);
if (locked) {
if (ImGui::Button(ICON_FA_LOCK)) locked = false;
} else {
@ -161,6 +159,10 @@ namespace hex::plugin::builtin {
ImGui::NewLine();
}
if (!open)
bookmarkToRemove = iter;
ImGui::PopID();
ImGui::PopStyleColor(3);
id++;

View File

@ -299,9 +299,7 @@ namespace hex::plugin::builtin {
ImGui::InputText("##nolabel", this->m_loaderScriptScriptPath.data(), this->m_loaderScriptScriptPath.length(), ImGuiInputTextFlags_ReadOnly);
ImGui::SameLine();
if (ImGui::Button("hex.builtin.view.hex_editor.script.script"_lang)) {
fs::openFileBrowser("hex.builtin.view.hex_editor.script.script.title"_lang, fs::DialogMode::Open, {
{"Python Script", "py"}
},
fs::openFileBrowser("hex.builtin.view.hex_editor.script.script.title"_lang, fs::DialogMode::Open, { {"Python Script", "py"} },
[this](const auto &path) {
this->m_loaderScriptScriptPath = path.string();
});
@ -919,9 +917,7 @@ namespace hex::plugin::builtin {
this->getWindowOpenState() = true;
});
} else if (name == "Open Project") {
fs::openFileBrowser("hex.builtin.view.hex_editor.open_project"_lang, fs::DialogMode::Open, {
{"Project File", "hexproj"}
},
fs::openFileBrowser("hex.builtin.view.hex_editor.open_project"_lang, fs::DialogMode::Open, { {"Project File", "hexproj"} },
[this](const auto &path) {
ProjectFile::load(path);
this->getWindowOpenState() = true;
@ -1096,8 +1092,7 @@ namespace hex::plugin::builtin {
bool providerValid = ImHexApi::Provider::isValid();
if (ImGui::MenuItem("hex.builtin.view.hex_editor.menu.file.open_project"_lang, "")) {
fs::openFileBrowser("hex.builtin.view.hex_editor.menu.file.open_project"_lang, fs::DialogMode::Open, {
{"Project File", "hexproj"}
fs::openFileBrowser("hex.builtin.view.hex_editor.menu.file.open_project"_lang, fs::DialogMode::Open, { {"Project File", "hexproj"}
},
[](const auto &path) {
ProjectFile::load(path);
@ -1106,8 +1101,7 @@ namespace hex::plugin::builtin {
if (ImGui::MenuItem("hex.builtin.view.hex_editor.menu.file.save_project"_lang, "", false, providerValid && provider->isWritable())) {
if (ProjectFile::getProjectFilePath() == "") {
fs::openFileBrowser("hex.builtin.view.hex_editor.save_project"_lang, fs::DialogMode::Save, {
{"Project File", "hexproj"}
fs::openFileBrowser("hex.builtin.view.hex_editor.save_project"_lang, fs::DialogMode::Save, { {"Project File", "hexproj"}
},
[](std::fs::path path) {
if (path.extension() != ".hexproj") {