This commit is contained in:
bubnikv 2019-08-19 14:34:23 +02:00
commit 4717cdf2e1
2 changed files with 20 additions and 3 deletions

View file

@ -2306,13 +2306,13 @@ void PrintConfigDef::init_sla_params()
def->full_label = L("Number of pixels in");
def->label = ("X");
def->tooltip = L("Number of pixels in X");
def->min = 1;
def->min = 100;
def->set_default_value(new ConfigOptionInt(2560));
def = this->add("display_pixels_y", coInt);
def->label = ("Y");
def->tooltip = L("Number of pixels in Y");
def->min = 1;
def->min = 100;
def->set_default_value(new ConfigOptionInt(1440));
def = this->add("display_mirror_x", coBool);

View file

@ -559,7 +559,16 @@ void SpinCtrl::BUILD() {
break;
}
const int min_val = m_opt.min == INT_MIN ? 0: m_opt.min;
const int min_val = m_opt.min == INT_MIN
#ifdef __WXOSX__
// We will forcibly set the input value for SpinControl, since the value
// inserted from the keyboard is not updated under OSX.
// So, we can't set min control value bigger then 0.
// Otherwise, it couldn't be possible to input from keyboard value
// 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;
auto temp = new wxSpinCtrl(m_parent, wxID_ANY, text_value, wxDefaultPosition, size,
@ -631,6 +640,14 @@ void SpinCtrl::propagate_value()
if (tmp_value == UNDEF_VALUE) {
on_kill_focus();
} else {
#ifdef __WXOSX__
// check input value for minimum
if (m_opt.min > 0 && tmp_value < m_opt.min) {
wxSpinCtrl* spin = static_cast<wxSpinCtrl*>(window);
spin->SetValue(m_opt.min);
spin->GetText()->SetInsertionPointEnd();
}
#endif
on_change_field();
}
}