From 6d00ed9e2f9629cf4a89914bb034228e5e3aafa7 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Thu, 8 Oct 2020 14:09:39 +0200 Subject: [PATCH] Follow-up of 3fdc48452e65290ccc40cb5b438ec8bbc35b573f -> Modified logic to disable horizontal slider in preview --- src/slic3r/GUI/DoubleSlider.cpp | 2 +- src/slic3r/GUI/DoubleSlider.hpp | 6 ++++++ src/slic3r/GUI/GUI_Preview.cpp | 5 +++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/DoubleSlider.cpp b/src/slic3r/GUI/DoubleSlider.cpp index 8507e5ed2..f56e4176c 100644 --- a/src/slic3r/GUI/DoubleSlider.cpp +++ b/src/slic3r/GUI/DoubleSlider.cpp @@ -447,7 +447,7 @@ void Control::render() // and only in a case of no-empty m_values draw_colored_band(dc); - if (this->IsEnabled()) { + if (!m_render_as_disabled) { // draw line draw_scroll_line(dc, lower_pos, higher_pos); diff --git a/src/slic3r/GUI/DoubleSlider.hpp b/src/slic3r/GUI/DoubleSlider.hpp index fb87ac4a9..e2372e6d7 100644 --- a/src/slic3r/GUI/DoubleSlider.hpp +++ b/src/slic3r/GUI/DoubleSlider.hpp @@ -228,6 +228,9 @@ public: void SetModeAndOnlyExtruder(const bool is_one_extruder_printed_model, const int only_extruder); void SetExtruderColors(const std::vector& extruder_colors); + void set_render_as_disabled(bool value) { m_render_as_disabled = value; } + bool is_rendering_as_disabled() const { return m_render_as_disabled; } + bool is_horizontal() const { return m_style == wxSL_HORIZONTAL; } bool is_one_layer() const { return m_is_one_layer; } bool is_lower_at_min() const { return m_lower_value == m_min_value; } @@ -334,6 +337,9 @@ private: int m_max_value; int m_lower_value; int m_higher_value; + + bool m_render_as_disabled{ false }; + ScalableBitmap m_bmp_thumb_higher; ScalableBitmap m_bmp_thumb_lower; ScalableBitmap m_bmp_add_tick_on; diff --git a/src/slic3r/GUI/GUI_Preview.cpp b/src/slic3r/GUI/GUI_Preview.cpp index c15686db6..aa4f322c7 100644 --- a/src/slic3r/GUI/GUI_Preview.cpp +++ b/src/slic3r/GUI/GUI_Preview.cpp @@ -1173,8 +1173,9 @@ void Preview::update_moves_slider() void Preview::enable_moves_slider(bool enable) { - if (m_moves_slider != nullptr && m_moves_slider->IsEnabled() != enable) { - m_moves_slider->Enable(enable); + bool render_as_disabled = !enable; + if (m_moves_slider != nullptr && m_moves_slider->is_rendering_as_disabled() != render_as_disabled) { + m_moves_slider->set_render_as_disabled(render_as_disabled); m_moves_slider->Refresh(); } }