diff --git a/src/libslic3r/Config.hpp b/src/libslic3r/Config.hpp index b8c046ceba..55d25e459e 100644 --- a/src/libslic3r/Config.hpp +++ b/src/libslic3r/Config.hpp @@ -1766,8 +1766,8 @@ public: // limit of a numeric input. // If not set, the is set to // By setting min=0, only nonnegative input is allowed. - int min = INT_MIN; - int max = INT_MAX; + float min = -FLT_MAX; + float max = FLT_MAX; // To check if it's not a typo and a % is missing double max_literal = 1; ConfigOptionMode mode = comSimple; diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index 8c5bfffc65..1a4eb5cc87 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -777,7 +777,7 @@ void SpinCtrl::BUILD() { break; } - const int min_val = m_opt.min == INT_MIN + const int min_val = m_opt.min == -FLT_MAX #ifdef __WXOSX__ // We will forcibly set the input value for SpinControl, since the value // inserted from the keyboard is not updated under OSX. @@ -786,8 +786,8 @@ void SpinCtrl::BUILD() { // less then min_val. || m_opt.min > 0 #endif - ? 0 : m_opt.min; - const int max_val = m_opt.max < 2147483647 ? m_opt.max : 2147483647; + ? (int)0 : (int)m_opt.min; + const int max_val = m_opt.max < FLT_MAX ? (int)m_opt.max : INT_MAX; auto temp = new wxSpinCtrl(m_parent, wxID_ANY, text_value, wxDefaultPosition, size, wxTE_PROCESS_ENTER | wxSP_ARROW_KEYS @@ -848,7 +848,7 @@ void SpinCtrl::BUILD() { if (!parsed || value < INT_MIN || value > INT_MAX) tmp_value = UNDEF_VALUE; else { - tmp_value = std::min(std::max((int)value, m_opt.min), m_opt.max); + tmp_value = std::min(std::max((int)value, temp->GetMin()), temp->GetMax()); #ifdef __WXOSX__ // Forcibly set the input value for SpinControl, since the value // inserted from the keyboard or clipboard is not updated under OSX @@ -1616,8 +1616,8 @@ void SliderCtrl::BUILD() auto temp = new wxBoxSizer(wxHORIZONTAL); auto def_val = m_opt.get_default_value()->value; - auto min = m_opt.min == INT_MIN ? 0 : m_opt.min; - auto max = m_opt.max == INT_MAX ? 100 : m_opt.max; + auto min = m_opt.min == -FLT_MAX ? 0 : (int)m_opt.min; + auto max = m_opt.max == FLT_MAX ? 100 : INT_MAX; m_slider = new wxSlider(m_parent, wxID_ANY, def_val * m_scale, min * m_scale, max * m_scale,