Fix of the change of the perimeters count in a vase-mode (part fix of #1649)

This commit is contained in:
YuSanka 2019-01-14 15:38:54 +01:00
parent 19a6461608
commit 66f998bdbf
4 changed files with 13 additions and 2 deletions

View file

@ -436,7 +436,7 @@ void SpinCtrl::BUILD() {
propagate_value();
}), temp->GetId());
temp->Bind(wxEVT_SPINCTRL, ([this](wxCommandEvent e) { on_change_field(); }), temp->GetId());
temp->Bind(wxEVT_SPINCTRL, ([this](wxCommandEvent e) { propagate_value(); }), temp->GetId());
temp->Bind(wxEVT_TEXT_ENTER, ([this](wxCommandEvent e)
{
@ -472,7 +472,7 @@ void SpinCtrl::propagate_value()
{
if (tmp_value < 0)
on_kill_focus();
else
else if (boost::any_cast<int>(m_value) != tmp_value)
on_change_field();
}

View file

@ -325,6 +325,7 @@ public:
void set_value(const boost::any& value, bool change_event = false) {
m_disable_change_event = !change_event;
tmp_value = boost::any_cast<int>(value);
m_value = value;
dynamic_cast<wxSpinCtrl*>(window)->SetValue(tmp_value);
m_disable_change_event = false;
}

View file

@ -1132,6 +1132,13 @@ void TabPrint::update()
if (m_preset_bundle->printers.get_selected_preset().printer_technology() == ptSLA)
return; // ys_FIXME
//! Temporary workaround for the correct updates of the SpinCtrl (like "perimeters"):
// KillFocus() for the wxSpinCtrl use CallAfter function. So,
// to except the duplicate call of the update() after dialog->ShowModal(),
// let check if this process is already started.
if (is_msg_dlg_already_exist)
return;
Freeze();
double fill_density = m_config->option<ConfigOptionPercent>("fill_density")->value;
@ -1147,6 +1154,7 @@ void TabPrint::update()
"- no ensure_vertical_shell_thickness\n"
"\nShall I adjust those settings in order to enable Spiral Vase?"));
auto dialog = new wxMessageDialog(parent(), msg_text, _(L("Spiral Vase")), wxICON_WARNING | wxYES | wxNO);
is_msg_dlg_already_exist = true;
DynamicPrintConfig new_conf = *m_config;
if (dialog->ShowModal() == wxID_YES) {
new_conf.set_key_value("perimeters", new ConfigOptionInt(1));
@ -1162,6 +1170,7 @@ void TabPrint::update()
}
load_config(new_conf);
on_value_change("fill_density", fill_density);
is_msg_dlg_already_exist = false;
}
if (m_config->opt_bool("wipe_tower") && m_config->opt_bool("support_material") &&

View file

@ -287,6 +287,7 @@ protected:
class TabPrint : public Tab
{
bool is_msg_dlg_already_exist {false};
public:
TabPrint(wxNotebook* parent) :
Tab(parent, _(L("Print Settings")), "print") {}