Follow-up of 3fdc48452e -> Modified logic to disable horizontal slider in preview

This commit is contained in:
enricoturri1966 2020-10-08 14:09:39 +02:00
parent 3fdc48452e
commit 6d00ed9e2f
3 changed files with 10 additions and 3 deletions

View File

@ -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);

View File

@ -228,6 +228,9 @@ public:
void SetModeAndOnlyExtruder(const bool is_one_extruder_printed_model, const int only_extruder);
void SetExtruderColors(const std::vector<std::string>& 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;

View File

@ -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();
}
}