From 9467209c1aedeee89657e63dda3498f10c31722e Mon Sep 17 00:00:00 2001 From: YuSanka Date: Wed, 14 Nov 2018 13:40:32 +0100 Subject: [PATCH] Fixed crashing on reset_settings_value() --- src/slic3r/GUI/GUI_ObjectManipulation.cpp | 43 ++++++++++++----------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/src/slic3r/GUI/GUI_ObjectManipulation.cpp b/src/slic3r/GUI/GUI_ObjectManipulation.cpp index 8484faae0..d1c67f20d 100644 --- a/src/slic3r/GUI/GUI_ObjectManipulation.cpp +++ b/src/slic3r/GUI/GUI_ObjectManipulation.cpp @@ -52,7 +52,7 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent): auto line = Line{ "", "" }; def.label = ""; def.type = coString; - def.width = 55; + def.width = 50; std::vector axes{ "x", "y", "z" }; for (const auto axis : axes) { @@ -83,7 +83,7 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent): ConfigOptionDef def; def.type = coFloat; def.default_value = new ConfigOptionFloat(0.0); - def.width = 55; + def.width = 50; if (option_name == "Rotation") def.min = -360; @@ -240,42 +240,45 @@ void ObjectManipulation::reset_settings_value() m_og->disable(); } +wxString def_0 {"0"}; +wxString def_100 {"100"}; + void ObjectManipulation::reset_position_value() { - m_og->set_value("position_x", "0"); - m_og->set_value("position_y", "0"); - m_og->set_value("position_z", "0"); + m_og->set_value("position_x", def_0); + m_og->set_value("position_y", def_0); + m_og->set_value("position_z", def_0); } void ObjectManipulation::reset_rotation_value() { - m_og->set_value("rotation_x", "0"); - m_og->set_value("rotation_y", "0"); - m_og->set_value("rotation_z", "0"); + m_og->set_value("rotation_x", def_0); + m_og->set_value("rotation_y", def_0); + m_og->set_value("rotation_z", def_0); } void ObjectManipulation::reset_scale_value() { m_is_percent_scale = true; m_og->set_value("scale_unit", _("%")); - m_og->set_value("scale_x", "100"); - m_og->set_value("scale_y", "100"); - m_og->set_value("scale_z", "100"); + m_og->set_value("scale_x", def_100); + m_og->set_value("scale_y", def_100); + m_og->set_value("scale_z", def_100); } void ObjectManipulation::update_values() { int selection = ol_selection(); if (selection < 0 || wxGetApp().mainframe->m_plater->model().objects.size() <= selection) { - m_og->set_value("position_x", "0"); - m_og->set_value("position_y", "0"); - m_og->set_value("position_z", "0"); - m_og->set_value("scale_x", "0"); - m_og->set_value("scale_y", "0"); - m_og->set_value("scale_z", "0"); - m_og->set_value("rotation_x", "0"); - m_og->set_value("rotation_y", "0"); - m_og->set_value("rotation_z", "0"); + m_og->set_value("position_x", def_0); + m_og->set_value("position_y", def_0); + m_og->set_value("position_z", def_0); + m_og->set_value("scale_x" , def_0); + m_og->set_value("scale_y" , def_0); + m_og->set_value("scale_z" , def_0); + m_og->set_value("rotation_x", def_0); + m_og->set_value("rotation_y", def_0); + m_og->set_value("rotation_z", def_0); m_og->disable(); return; }