diff --git a/src/slic3r/GUI/GUI_ObjectManipulation.cpp b/src/slic3r/GUI/GUI_ObjectManipulation.cpp index f763cc5a1..1cdf87be2 100644 --- a/src/slic3r/GUI/GUI_ObjectManipulation.cpp +++ b/src/slic3r/GUI/GUI_ObjectManipulation.cpp @@ -19,7 +19,7 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent) : OG_Settings(parent, true) { m_og->set_name(_(L("Object Manipulation"))); - m_og->label_width = 100; + m_og->label_width = 125; m_og->set_grid_vgap(5); m_og->m_on_change = [this](const std::string& opt_key, const boost::any& value) { @@ -150,7 +150,7 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent) : m_og->append_line(line); - auto add_og_to_object_settings = [](const std::string& option_name, const std::string& sidetext) + auto add_og_to_object_settings = [this](const std::string& option_name, const std::string& sidetext) { Line line = { _(option_name), "" }; ConfigOptionDef def; @@ -164,6 +164,26 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent) : def.max = 360; } + // Add "uniform scaling" button in front of "Scale" option + else if (option_name == "Scale") { + line.near_label_widget = [this](wxWindow* parent) { + auto btn = new PrusaLockButton(parent, wxID_ANY); + btn->Bind(wxEVT_BUTTON, [btn, this](wxCommandEvent &event){ + event.Skip(); + wxTheApp->CallAfter([btn, this]() { set_uniform_scaling(btn->IsLocked()); }); + }); + return btn; + }; + } + + // Add empty bmp (Its size have to be equal to PrusaLockButton) in front of "Size" option to label alignment + else if (option_name == "Size") { + line.near_label_widget = [this](wxWindow* parent) { + return new wxStaticBitmap(parent, wxID_ANY, wxNullBitmap, wxDefaultPosition, + wxBitmap(from_u8(var("one_layer_lock_on.png")), wxBITMAP_TYPE_PNG).GetSize()); + }; + } + const std::string lower_name = boost::algorithm::to_lower_copy(option_name); std::vector<std::string> axes{ "x", "y", "z" }; diff --git a/src/slic3r/GUI/GUI_ObjectManipulation.hpp b/src/slic3r/GUI/GUI_ObjectManipulation.hpp index 97cd2b639..57eb93b71 100644 --- a/src/slic3r/GUI/GUI_ObjectManipulation.hpp +++ b/src/slic3r/GUI/GUI_ObjectManipulation.hpp @@ -74,6 +74,7 @@ class ObjectManipulation : public OG_Settings Vec3d m_new_scale; Vec3d m_new_size; bool m_new_enabled; + bool m_uniform_scale {false}; public: ObjectManipulation(wxWindow* parent); @@ -88,6 +89,9 @@ public: // Called from the App to update the UI if dirty. void update_if_dirty(); + void set_uniform_scaling(const bool uniform_scale) { m_uniform_scale = uniform_scale;} + bool get_uniform_scaling() const { return m_uniform_scale; } + private: void reset_settings_value();