From 88de5f6be40e9425faf9aa01c6ab9457c547e431 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Fri, 11 Jul 2025 14:55:25 +0200 Subject: [PATCH] impr: Better font settings window --- plugins/fonts/source/font_settings.cpp | 27 ++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/plugins/fonts/source/font_settings.cpp b/plugins/fonts/source/font_settings.cpp index be724a0b0..3ed85fb00 100644 --- a/plugins/fonts/source/font_settings.cpp +++ b/plugins/fonts/source/font_settings.cpp @@ -5,6 +5,8 @@ #include #include +#include + #include "hex/api/imhex_api.hpp" namespace hex::fonts { @@ -118,16 +120,25 @@ namespace hex::fonts { ImGui::PushID(name.c_str()); ON_SCOPE_EXIT { ImGui::PopID(); }; - if (ImGui::Button(m_fontFilePicker.getSelectedFontName().c_str(), ImVec2(300_scaled, 0))) { - ImGui::OpenPopup("Fonts"); + bool changed = false; + if (ImGui::CollapsingHeader(name.c_str())) { + if (ImGuiExt::BeginBox()) { + if (m_fontFilePicker.draw("hex.fonts.setting.font.custom_font"_lang)) changed = true; + + ImGui::BeginDisabled(m_fontFilePicker.isPixelPerfectFontSelected()); + { + if (m_fontSize.draw("hex.fonts.setting.font.font_size"_lang)) changed = true; + if (m_bold.draw("hex.fonts.setting.font.font_bold"_lang)) changed = true; + if (m_italic.draw("hex.fonts.setting.font.font_italic"_lang)) changed = true; + if (m_antiAliased.draw("hex.fonts.setting.font.font_antialias"_lang)) changed = true; + } + ImGui::EndDisabled(); + + ImGuiExt::EndBox(); + } } - ImGui::SameLine(); - - ImGui::TextUnformatted(name.c_str()); - - ImGui::SetNextWindowPos(ImGui::GetCursorScreenPos()); - return drawPopup(); + return changed; } nlohmann::json FontSelector::store() {