From 118e14d788b8c34700f5f6cef2bb66189329dca2 Mon Sep 17 00:00:00 2001 From: andrewleek Date: Sun, 26 Jan 2025 01:58:38 +0100 Subject: [PATCH] Gcode Statistics Panel Fixes (#8172) * Gcode Statistics Panel - Persist open/close state Bug: On slicing a model, the Statistics Panel would be reset to being open (regardless of if the user had shut it earlier) Fix: Now on app open the Statistics Panel will be open, but if the user closes it, its state will persist (regardless of slicing again) https://github.com/SoftFever/OrcaSlicer/discussions/6021 * Gcode Statistics Panel - fold/unfold button width fix Issue: The fold/unfold button width is too wide (It seems CalcTextSize is making the button wider than necessary) Fix: Set the width to a correct fixed value --- src/slic3r/GUI/GCodeViewer.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index 0190594182..31eb38b728 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -1056,8 +1056,6 @@ void GCodeViewer::load(const GCodeProcessorResult& gcode_result, const Print& pr set_view_type(EViewType::ColorPrint); } - m_fold = false; - bool only_gcode_3mf = false; PartPlate* current_plate = wxGetApp().plater()->get_partplate_list().get_curr_plate(); bool current_has_print_instances = current_plate->has_printable_instances(); @@ -4644,15 +4642,15 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv ImGui::SameLine(); std::wstring btn_name; if (m_fold) - btn_name = ImGui::UnfoldButtonIcon + boost::nowide::widen(std::string("")); + btn_name = ImGui::UnfoldButtonIcon; else - btn_name = ImGui::FoldButtonIcon + boost::nowide::widen(std::string("")); + btn_name = ImGui::FoldButtonIcon; ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0)); ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.0f, 0.59f, 0.53f, 1.00f)); ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.0f, 0.59f, 0.53f, 0.78f)); ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0.0f, 0.0f)); //ImGui::PushItemWidth( - float button_width = ImGui::CalcTextSize(into_u8(btn_name).c_str()).x; + float button_width = 34.0f; if (ImGui::Button(into_u8(btn_name).c_str(), ImVec2(button_width, 0))) { m_fold = !m_fold; }