From c54386d958cd14dad37ea3faf99baf2455a182d1 Mon Sep 17 00:00:00 2001 From: SoftFever Date: Sun, 3 Sep 2023 10:17:42 +0800 Subject: [PATCH] tweak gcodeviewer --- src/slic3r/GUI/GCodeViewer.cpp | 6 +++--- src/slic3r/GUI/GCodeViewer.hpp | 5 +++++ src/slic3r/GUI/GLCanvas3D.cpp | 9 ++------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index 97c85990bf..d1c458e649 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -788,9 +788,9 @@ const GCodeViewer::Color GCodeViewer::Neutral_Color = { 0.25f, 0.25f, 0.25f, 1.0 GCodeViewer::GCodeViewer() { m_moves_slider = new IMSlider(0, 0, 0, 100, wxSL_HORIZONTAL); - m_moves_slider->set_scale(0.6f); + m_moves_slider->set_scale(GCODE_VIEWER_SLIDER_SCALE); m_layers_slider = new IMSlider(0, 0, 0, 100, wxSL_VERTICAL); - m_layers_slider->set_scale(0.6f); + m_layers_slider->set_scale(GCODE_VIEWER_SLIDER_SCALE); m_extrusions.reset_role_visibility_flags(); // m_sequential_view.skip_invisible_moves = true; @@ -1296,7 +1296,7 @@ void GCodeViewer::render(int canvas_width, int canvas_height, int right_margin) } //BBS fixed bottom_margin for space to render horiz slider - int bottom_margin = 39; + int bottom_margin = SLIDER_BOTTOM_MARGIN; m_sequential_view.m_show_gcode_window = m_sequential_view.m_show_gcode_window || (m_sequential_view.current.last != m_sequential_view.endpoints.last && !m_no_render_path); diff --git a/src/slic3r/GUI/GCodeViewer.hpp b/src/slic3r/GUI/GCodeViewer.hpp index 5b8cd0ebb8..592afb591c 100644 --- a/src/slic3r/GUI/GCodeViewer.hpp +++ b/src/slic3r/GUI/GCodeViewer.hpp @@ -26,6 +26,11 @@ namespace GUI { class PartPlateList; class OpenGLManager; +static const float GCODE_VIEWER_SLIDER_SCALE = 0.6f; +static const float SLIDER_DEFAULT_RIGHT_MARGIN = 10.0f; +static const float SLIDER_DEFAULT_BOTTOM_MARGIN = 10.0f; +static const float SLIDER_RIGHT_MARGIN = 124.0f * GCODE_VIEWER_SLIDER_SCALE; +static const float SLIDER_BOTTOM_MARGIN = 64.0f * GCODE_VIEWER_SLIDER_SCALE; class GCodeViewer { using IBufferType = unsigned short; diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 2b16986016..d0efe06b18 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -76,11 +76,6 @@ static constexpr const float TRACKBALLSIZE = 0.8f; -static const float SLIDER_DEFAULT_RIGHT_MARGIN = 10.0f; -static const float SLIDER_DEFAULT_BOTTOM_MARGIN = 10.0f; -static const float SLIDER_RIGHT_MARGIN = 124.0f; -static const float SLIDER_BOTTOM_MARGIN = 64.0f; - float GLCanvas3D::DEFAULT_BG_LIGHT_COLOR[3] = { 0.906f, 0.906f, 0.906f }; float GLCanvas3D::DEFAULT_BG_LIGHT_COLOR_DARK[3] = { 0.329f, 0.329f, 0.353f }; float GLCanvas3D::ERROR_BG_LIGHT_COLOR[3] = { 0.753f, 0.192f, 0.039f }; @@ -6952,8 +6947,8 @@ void GLCanvas3D::_check_and_update_toolbar_icon_scale() IMSlider* m_layers_slider = get_gcode_viewer().get_layers_slider(); IMSlider* m_moves_slider = get_gcode_viewer().get_moves_slider(); const float sc = m_retina_helper->get_scale_factor(); - m_layers_slider->set_scale(sc); - m_moves_slider->set_scale(sc); + m_layers_slider->set_scale(sc * m_layers_slider->m_scale); + m_moves_slider->set_scale(sc * m_layers_slider->m_scale); m_gcode_viewer.set_scale(sc); auto* m_notification = wxGetApp().plater()->get_notification_manager();