Fixed editable lower thumb of sequential slider when changing settings in preference dialog while the preview is hidden
This commit is contained in:
parent
f4311f67ef
commit
e6e3e98fd5
@ -12,6 +12,9 @@
|
||||
#include "I18N.hpp"
|
||||
#include "ExtruderSequenceDialog.hpp"
|
||||
#include "libslic3r/Print.hpp"
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
#include "libslic3r/AppConfig.hpp"
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
#include <wx/button.h>
|
||||
#include <wx/dialog.h>
|
||||
@ -45,17 +48,18 @@ static std::string gcode(Type type)
|
||||
{
|
||||
const PrintConfig& config = GUI::wxGetApp().plater()->fff_print().config();
|
||||
switch (type) {
|
||||
case ColorChange:
|
||||
return config.color_change_gcode;
|
||||
case PausePrint:
|
||||
return config.pause_print_gcode;
|
||||
case Template:
|
||||
return config.template_custom_gcode;
|
||||
default:
|
||||
return "";
|
||||
case ColorChange: return config.color_change_gcode;
|
||||
case PausePrint: return config.pause_print_gcode;
|
||||
case Template: return config.template_custom_gcode;
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
static bool is_lower_thumb_editable()
|
||||
{
|
||||
return Slic3r::GUI::get_app_config()->get("seq_top_layer_only") == "0";
|
||||
}
|
||||
|
||||
Control::Control( wxWindow *parent,
|
||||
wxWindowID id,
|
||||
int lowerValue,
|
||||
@ -959,7 +963,7 @@ int Control::get_value_from_position(const wxCoord x, const wxCoord y)
|
||||
bool Control::detect_selected_slider(const wxPoint& pt)
|
||||
{
|
||||
if (is_point_in_rect(pt, m_rect_lower_thumb))
|
||||
m_selection = m_lower_editable ? ssLower : ssUndef;
|
||||
m_selection = is_lower_thumb_editable() ? ssLower : ssUndef;
|
||||
else if(is_point_in_rect(pt, m_rect_higher_thumb))
|
||||
m_selection = ssHigher;
|
||||
else
|
||||
@ -1415,7 +1419,7 @@ void Control::OnWheel(wxMouseEvent& event)
|
||||
ssLower : ssHigher;
|
||||
}
|
||||
|
||||
if (m_selection == ssLower && !m_lower_editable)
|
||||
if (m_selection == ssLower && !is_lower_thumb_editable())
|
||||
m_selection = ssUndef;
|
||||
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
@ -1468,7 +1472,7 @@ void Control::OnKeyDown(wxKeyEvent &event)
|
||||
else if (key == WXK_UP || key == WXK_DOWN) {
|
||||
if (key == WXK_UP)
|
||||
m_selection = ssHigher;
|
||||
else if (key == WXK_DOWN && m_lower_editable)
|
||||
else if (key == WXK_DOWN && is_lower_thumb_editable())
|
||||
m_selection = ssLower;
|
||||
Refresh();
|
||||
}
|
||||
@ -1483,7 +1487,7 @@ void Control::OnKeyDown(wxKeyEvent &event)
|
||||
if (key == WXK_LEFT || key == WXK_RIGHT) {
|
||||
if (key == WXK_LEFT)
|
||||
m_selection = ssHigher;
|
||||
else if (key == WXK_RIGHT && m_lower_editable)
|
||||
else if (key == WXK_RIGHT && is_lower_thumb_editable())
|
||||
m_selection = ssLower;
|
||||
Refresh();
|
||||
}
|
||||
|
@ -228,7 +228,6 @@ 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_lower_editable(bool editable) { m_lower_editable = editable; }
|
||||
void set_render_as_disabled(bool value) { m_render_as_disabled = value; }
|
||||
bool is_rendering_as_disabled() const { return m_render_as_disabled; }
|
||||
|
||||
@ -340,7 +339,6 @@ private:
|
||||
int m_lower_value;
|
||||
int m_higher_value;
|
||||
|
||||
bool m_lower_editable{ true };
|
||||
bool m_render_as_disabled{ false };
|
||||
|
||||
ScalableBitmap m_bmp_thumb_higher;
|
||||
|
@ -346,7 +346,6 @@ bool Preview::init(wxWindow* parent, Model* model)
|
||||
right_sizer->Add(m_layers_slider_sizer, 1, wxEXPAND, 0);
|
||||
|
||||
m_moves_slider = new DoubleSlider::Control(m_bottom_toolbar_panel, wxID_ANY, 0, 0, 0, 100, wxDefaultPosition, wxSize(-1, 3 * GetTextExtent("m").y), wxSL_HORIZONTAL);
|
||||
m_moves_slider->set_lower_editable(get_app_config()->get("seq_top_layer_only") == "0");
|
||||
m_moves_slider->SetDrawMode(DoubleSlider::dmSequentialGCodeView);
|
||||
|
||||
wxBoxSizer* bottom_toolbar_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
@ -539,9 +538,6 @@ void Preview::refresh_print()
|
||||
return;
|
||||
|
||||
load_print(true);
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
m_moves_slider->set_lower_editable(get_app_config()->get("seq_top_layer_only") == "0");
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
}
|
||||
|
||||
void Preview::msw_rescale()
|
||||
|
Loading…
Reference in New Issue
Block a user