From 0a3fc0085154bdb72f1dc6e219dc22f22da87087 Mon Sep 17 00:00:00 2001 From: Filip Sykala Date: Mon, 3 Jan 2022 15:40:24 +0100 Subject: [PATCH] Fix Rename window> size + text --- src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp b/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp index 5720e25d10..c9681bcadd 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp @@ -783,19 +783,21 @@ void GLGizmoEmboss::draw_font_list() // rename modal window popup const char * rename_popup_id = "Rename_font"; static size_t rename_id; + static std::string original_font_name; if (rename_index.has_value() && !ImGui::IsPopupOpen(rename_popup_id)) { ImGui::OpenPopup(rename_popup_id); rename_id = *rename_index; + original_font_name = m_font_list[rename_id].name; } - if (ImGui::BeginPopupModal(rename_popup_id)) { - FontItem & fi = m_font_list[rename_id]; - std::string rename_popup = - GUI::format(_u8L("Change font name (%1%): "), fi.name); - ImGui::Text("%s", rename_popup.c_str()); + + if (ImGui::BeginPopupModal(rename_popup_id, 0, ImGuiWindowFlags_AlwaysAutoResize)) { + std::string text_in_popup = GUI::format(_u8L("Change font name (%1%): "), original_font_name); + ImGui::Text("%s", text_in_popup.c_str()); ImGui::SetNextItemWidth(m_gui_cfg->combo_font_width); + FontItem & fi = m_font_list[rename_id]; if (ImGui::InputText("##font name", &fi.name, ImGuiInputTextFlags_EnterReturnsTrue) || - ImGui::Button("ok")) { + ImGui::Button(_u8L("ok").c_str())) { ImGui::CloseCurrentPopup(); store_font_list(); }