From 9752fb5810612123164eef8f7dbc2863813ec876 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Mon, 8 Nov 2021 08:29:19 +0100 Subject: [PATCH] Tech ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT - Additional button, added to imgui float slider, using svg icon --- resources/icons/edit_button_white.svg | 91 +++++++++++++++++++++++++++ src/imgui/imconfig.h | 3 +- src/slic3r/GUI/ImGuiWrapper.cpp | 13 +++- 3 files changed, 103 insertions(+), 4 deletions(-) create mode 100644 resources/icons/edit_button_white.svg diff --git a/resources/icons/edit_button_white.svg b/resources/icons/edit_button_white.svg new file mode 100644 index 000000000..9f5cda9c9 --- /dev/null +++ b/resources/icons/edit_button_white.svg @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/imgui/imconfig.h b/src/imgui/imconfig.h index c5627f16b..e95ae3adf 100644 --- a/src/imgui/imconfig.h +++ b/src/imgui/imconfig.h @@ -154,7 +154,8 @@ namespace ImGui const wchar_t DocumentationHoverButton = 0x2601; const wchar_t ClippyMarker = 0x2602; const wchar_t InfoMarker = 0x2603; - + const wchar_t SliderFloatEditBtnIcon = 0x2604; + // void MyFunction(const char* name, const MyMatrix44& v); } diff --git a/src/slic3r/GUI/ImGuiWrapper.cpp b/src/slic3r/GUI/ImGuiWrapper.cpp index d18b7bf91..edd1ed2d9 100644 --- a/src/slic3r/GUI/ImGuiWrapper.cpp +++ b/src/slic3r/GUI/ImGuiWrapper.cpp @@ -8,6 +8,9 @@ #include #include #include +#if ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT +#include +#endif // ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT #include #include @@ -48,7 +51,9 @@ static const std::map font_icons = { {ImGui::RightArrowHoverButton , "notification_right_hover" }, {ImGui::PreferencesButton , "notification_preferences" }, {ImGui::PreferencesHoverButton , "notification_preferences_hover"}, - +#if ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT + {ImGui::SliderFloatEditBtnIcon, "edit_button_white" }, +#endif // ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT }; static const std::map font_icons_large = { {ImGui::CloseNotifButton , "notification_close" }, @@ -492,8 +497,10 @@ bool ImGuiWrapper::slider_float(const char* label, float* v, float v_min, float const ImGuiStyle& style = ImGui::GetStyle(); ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, { 1, style.ItemSpacing.y }); ImGui::SameLine(); - const std::string btn_name = "..." + std::string(label); - if (ImGui::Button(btn_name.c_str())) { + + std::wstring btn_name; + btn_name = ImGui::SliderFloatEditBtnIcon + boost::nowide::widen(std::string(label)); + if (ImGui::Button(into_u8(btn_name).c_str())) { ImGui::SetKeyboardFocusHere(-1); this->set_requires_extra_frame(); }