From 86905a8a20d5887f3b13017e66cd897766334bd3 Mon Sep 17 00:00:00 2001 From: SoftFever <103989404+SoftFever@users.noreply.github.com> Date: Thu, 15 Oct 2026 20:28:13 +0800 Subject: [PATCH] Use a keyboard icon for the shortcut button and fix unreadable guide tooltips (#16515) * Fix unreadable text in wiki and video guide tooltips * Use a keyboard icon for the gizmo shortcut button * Fix blank tooltips on the Move and Scale gizmo combo boxes --- resources/images/toolbar_tooltip.svg | 2 +- src/slic3r/GUI/Gizmos/GLGizmoUtils.cpp | 10 ++++++---- src/slic3r/GUI/Gizmos/GizmoObjectManipulation.cpp | 9 ++++++--- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/resources/images/toolbar_tooltip.svg b/resources/images/toolbar_tooltip.svg index 49279b8ed9..d35366d600 100644 --- a/resources/images/toolbar_tooltip.svg +++ b/resources/images/toolbar_tooltip.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/slic3r/GUI/Gizmos/GLGizmoUtils.cpp b/src/slic3r/GUI/Gizmos/GLGizmoUtils.cpp index 2b52fc486e..a162ed3095 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoUtils.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoUtils.cpp @@ -83,11 +83,13 @@ namespace Slic3r::GUI::GLGizmoUtils { bool clicked = toolbar_circular_button(icon, "##wiki_guide_btn", scale); if (url && *url && clicked) wxLaunchDefaultBrowser(wxString::FromUTF8(url)); + // ImGuiWrapper::tooltip keeps the text readable on the dark tooltip background whatever text colour the + // host window pushed; a negative wrap position keeps the URL on one line. if (ImGui::IsItemHovered()){ if(url && *url) - ImGui::SetTooltip("%s\n%s", _u8L("Wiki Guide").c_str(), url); + wxGetApp().imgui()->tooltip(_u8L("Wiki Guide") + "\n" + url, -1.f); else - ImGui::SetTooltip("%s", _u8L("Wiki Guide").c_str()); + wxGetApp().imgui()->tooltip(_u8L("Wiki Guide"), -1.f); } return clicked; // for dynamically generated links } @@ -101,9 +103,9 @@ namespace Slic3r::GUI::GLGizmoUtils { wxLaunchDefaultBrowser(wxString::FromUTF8(url)); if (ImGui::IsItemHovered()){ if(url && *url) - ImGui::SetTooltip("%s\n%s", _u8L("Video Guide").c_str(), url); + wxGetApp().imgui()->tooltip(_u8L("Video Guide") + "\n" + url, -1.f); else - ImGui::SetTooltip("%s", _u8L("Video Guide").c_str()); + wxGetApp().imgui()->tooltip(_u8L("Video Guide"), -1.f); } return clicked; // for dynamically generated links } diff --git a/src/slic3r/GUI/Gizmos/GizmoObjectManipulation.cpp b/src/slic3r/GUI/Gizmos/GizmoObjectManipulation.cpp index 85e7f8180c..427eac8b9c 100644 --- a/src/slic3r/GUI/Gizmos/GizmoObjectManipulation.cpp +++ b/src/slic3r/GUI/Gizmos/GizmoObjectManipulation.cpp @@ -857,11 +857,12 @@ void GizmoObjectManipulation::do_render_move_window(ImGuiWrapper *imgui_wrapper, if (render_combo(imgui_wrapper, "", modes, selection_idx, 0, coord_combo_width)) { combox_changed = true; } + ImGuiWrapper::pop_combo_style(); + // After pop_combo_style(): its light popup background would hide the tooltip's white text. if (ImGui::IsItemHovered()) { auto tooltip_str = _L("Coordinate system used for transform actions."); imgui_wrapper->tooltip(tooltip_str, imgui_wrapper->calc_text_size(tooltip_str).x + 3 * space_size); } - ImGuiWrapper::pop_combo_style(); // ORCA use TextColored to match axes color float offset_to_center = (unit_size - ImGui::CalcTextSize("O").x) / 2; @@ -964,11 +965,12 @@ void GizmoObjectManipulation::do_render_move_window(ImGuiWrapper *imgui_wrapper, if (render_combo(imgui_wrapper, "", align_modes, align_mode_idx, 0, coord_combo_width)) m_align_to_parent = align_mode_idx + 1 == align_modes.size(); ImGui::PopID(); + ImGuiWrapper::pop_combo_style(); + // After pop_combo_style(): its light popup background would hide the tooltip's white text. if (ImGui::IsItemHovered()) { wxString tooltip_str = _L("Reference for alignment"); imgui_wrapper->tooltip(tooltip_str, imgui_wrapper->calc_text_size(tooltip_str).x + 3 * space_size); } - ImGuiWrapper::pop_combo_style(); const bool dark_mode = wxGetApp().dark_mode(); int current_axis = -1; @@ -1377,11 +1379,12 @@ void GizmoObjectManipulation::do_render_scale_input_window(ImGuiWrapper* imgui_w if (render_combo(imgui_wrapper, "", modes, selection_idx, 0, coord_combo_width)) { combox_changed = true; } + ImGuiWrapper::pop_combo_style(); + // After pop_combo_style(): its light popup background would hide the tooltip's white text. if (ImGui::IsItemHovered()) { auto tooltip_str = _L("Coordinate system used for transform actions."); imgui_wrapper->tooltip(tooltip_str, imgui_wrapper->calc_text_size(tooltip_str).x + 3 * space_size); } - ImGuiWrapper::pop_combo_style(); // ORCA use TextColored to match axes color float offset_to_center = (unit_size - ImGui::CalcTextSize("O").x) / 2;