mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 13:45:59 +08:00
ConfigOptionDef: min/max values type are changed from INT to FLOAT.
This commit is contained in:
parent
656a1d262a
commit
f277bc80c2
@ -1766,8 +1766,8 @@ public:
|
|||||||
// <min, max> limit of a numeric input.
|
// <min, max> limit of a numeric input.
|
||||||
// If not set, the <min, max> is set to <INT_MIN, INT_MAX>
|
// If not set, the <min, max> is set to <INT_MIN, INT_MAX>
|
||||||
// By setting min=0, only nonnegative input is allowed.
|
// By setting min=0, only nonnegative input is allowed.
|
||||||
int min = INT_MIN;
|
float min = -FLT_MAX;
|
||||||
int max = INT_MAX;
|
float max = FLT_MAX;
|
||||||
// To check if it's not a typo and a % is missing
|
// To check if it's not a typo and a % is missing
|
||||||
double max_literal = 1;
|
double max_literal = 1;
|
||||||
ConfigOptionMode mode = comSimple;
|
ConfigOptionMode mode = comSimple;
|
||||||
|
@ -777,7 +777,7 @@ void SpinCtrl::BUILD() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
const int min_val = m_opt.min == INT_MIN
|
const int min_val = m_opt.min == -FLT_MAX
|
||||||
#ifdef __WXOSX__
|
#ifdef __WXOSX__
|
||||||
// We will forcibly set the input value for SpinControl, since the value
|
// We will forcibly set the input value for SpinControl, since the value
|
||||||
// inserted from the keyboard is not updated under OSX.
|
// inserted from the keyboard is not updated under OSX.
|
||||||
@ -786,8 +786,8 @@ void SpinCtrl::BUILD() {
|
|||||||
// less then min_val.
|
// less then min_val.
|
||||||
|| m_opt.min > 0
|
|| m_opt.min > 0
|
||||||
#endif
|
#endif
|
||||||
? 0 : m_opt.min;
|
? (int)0 : (int)m_opt.min;
|
||||||
const int max_val = m_opt.max < 2147483647 ? m_opt.max : 2147483647;
|
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,
|
auto temp = new wxSpinCtrl(m_parent, wxID_ANY, text_value, wxDefaultPosition, size,
|
||||||
wxTE_PROCESS_ENTER | wxSP_ARROW_KEYS
|
wxTE_PROCESS_ENTER | wxSP_ARROW_KEYS
|
||||||
@ -848,7 +848,7 @@ void SpinCtrl::BUILD() {
|
|||||||
if (!parsed || value < INT_MIN || value > INT_MAX)
|
if (!parsed || value < INT_MIN || value > INT_MAX)
|
||||||
tmp_value = UNDEF_VALUE;
|
tmp_value = UNDEF_VALUE;
|
||||||
else {
|
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__
|
#ifdef __WXOSX__
|
||||||
// Forcibly set the input value for SpinControl, since the value
|
// Forcibly set the input value for SpinControl, since the value
|
||||||
// inserted from the keyboard or clipboard is not updated under OSX
|
// inserted from the keyboard or clipboard is not updated under OSX
|
||||||
@ -1616,8 +1616,8 @@ void SliderCtrl::BUILD()
|
|||||||
auto temp = new wxBoxSizer(wxHORIZONTAL);
|
auto temp = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
|
||||||
auto def_val = m_opt.get_default_value<ConfigOptionInt>()->value;
|
auto def_val = m_opt.get_default_value<ConfigOptionInt>()->value;
|
||||||
auto min = m_opt.min == INT_MIN ? 0 : m_opt.min;
|
auto min = m_opt.min == -FLT_MAX ? 0 : (int)m_opt.min;
|
||||||
auto max = m_opt.max == INT_MAX ? 100 : m_opt.max;
|
auto max = m_opt.max == FLT_MAX ? 100 : INT_MAX;
|
||||||
|
|
||||||
m_slider = new wxSlider(m_parent, wxID_ANY, def_val * m_scale,
|
m_slider = new wxSlider(m_parent, wxID_ANY, def_val * m_scale,
|
||||||
min * m_scale, max * m_scale,
|
min * m_scale, max * m_scale,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user