diff --git a/plugins/builtin/source/content/views/view_pattern_editor.cpp b/plugins/builtin/source/content/views/view_pattern_editor.cpp index a8dc75d05..3c8492cdf 100644 --- a/plugins/builtin/source/content/views/view_pattern_editor.cpp +++ b/plugins/builtin/source/content/views/view_pattern_editor.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -571,7 +572,7 @@ namespace hex::plugin::builtin { ImGui::TableSetupScrollFreeze(0, 1); ImGui::TableSetupColumn("hex.ui.common.name"_lang, ImGuiTableColumnFlags_WidthStretch, 0.5F); ImGui::TableSetupColumn("hex.ui.common.size"_lang, ImGuiTableColumnFlags_WidthStretch, 0.5F); - ImGui::TableSetupColumn("##button", ImGuiTableColumnFlags_WidthFixed, 20_scaled); + ImGui::TableSetupColumn("##button", ImGuiTableColumnFlags_WidthFixed, 50_scaled); ImGui::TableHeadersRow(); @@ -589,7 +590,7 @@ namespace hex::plugin::builtin { ImGui::TableNextColumn(); ImGuiExt::TextFormatted("{} | 0x{:02X}", hex::toByteString(section.data.size()), section.data.size()); ImGui::TableNextColumn(); - if (ImGuiExt::IconButton(ICON_VS_OPEN_PREVIEW, ImGui::GetStyleColorVec4(ImGuiCol_Text))) { + if (ImGuiExt::DimmedIconButton(ICON_VS_OPEN_PREVIEW, ImGui::GetStyleColorVec4(ImGuiCol_Text))) { auto dataProvider = std::make_shared(section.data); auto hexEditor = auto(m_sectionHexEditor); @@ -636,6 +637,18 @@ namespace hex::plugin::builtin { patternDrawer->draw(patterns, &runtime, 150_scaled); }; } + ImGui::SameLine(); + if (ImGuiExt::DimmedIconButton(ICON_VS_SAVE_AS, ImGui::GetStyleColorVec4(ImGuiCol_Text))) { + fs::openFileBrowser(fs::DialogMode::Save, {}, [this, id, &runtime](const auto &path) { + wolv::io::File file(path, wolv::io::File::Mode::Create); + if (!file.isValid()) { + ui::ToastError::open("hex.builtin.popup.error.create"_lang); + return; + } + + file.writeVector(runtime.getSection(id)); + }); + } ImGui::PopID(); }