From dbf81fc7fa3a1293d36ae9cc9821833d05083251 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Wed, 22 May 2024 12:32:38 +0200 Subject: [PATCH] Fixed some more compiler warnings --- src/slic3r/GUI/3DScene.cpp | 2 +- src/slic3r/GUI/GLCanvas3D.cpp | 10 +++------- src/slic3r/GUI/Tab.cpp | 5 +++-- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/slic3r/GUI/3DScene.cpp b/src/slic3r/GUI/3DScene.cpp index db588574a7..12c0ebe007 100644 --- a/src/slic3r/GUI/3DScene.cpp +++ b/src/slic3r/GUI/3DScene.cpp @@ -508,7 +508,7 @@ int GLVolumeCollection::load_wipe_tower_preview( // Because the GLVolume is also used for arrangement, it must be safely larger // than the actual extruded tower, otherwise the arranged tower ends up out of bed. - float offset = 0.3; + float offset = 0.3f; pos_x -= offset; pos_y -= offset; width += 2.f * offset; diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index f977125e60..2adf62ecdb 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -6539,14 +6539,10 @@ static void render_sla_layer_legend(const SLAPrint& print, int layer_idx, int cn ImGui::SetNextWindowBgAlpha(0.6f); imgui.begin(_u8L("Layer statistics"), ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoFocusOnAppearing); - // FIXME: The snprintf would better be replaced by GUI::format, but I don't want to - // touch translated strings before the release. - char text[50]; - snprintf(text, 50, _u8L("Layer area: %.0f mm²").c_str(), area); - ImGui::Text("%s", text); + ImGui::Text("%s", GUI::format(_u8L("Layer area: %1% mm²"), int(0.1 + std::round(area))).c_str()); + int area_percent_int = int(std::round(100. * area/display_area)); - snprintf(text, 50, GUI::format(_u8L("Area fill: %1% %%%%"), area_percent_int == 0 ? "<1" : std::to_string(area_percent_int)).c_str()); - ImGui::Text("%s", text); + ImGui::Text("%s", GUI::format(_u8L("Area fill: %1% %%"), area_percent_int == 0 ? "<1" : std::to_string(area_percent_int)).c_str()); ImGui::Separator(); ImGui::Text("%s", GUI::format(_u8L("Layer time: %1%"), get_time_dhms(time)).c_str()); std::string buffer_str = _u8L("Time since start: %1%"); diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index d1ddf343ee..13675b0183 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -5472,8 +5472,9 @@ void TabSLAMaterial::build_tilt_group(Slic3r::GUI::PageShp page) { if (key.find_first_of("use_tilt") == 0) toggle_tilt_options(key == "use_tilt#0"); - update_dirty(); - update(); + + update_dirty(); + update(); }; for (const std::string& opt_key : tilt_options())