mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 00:37:51 -06:00
Added "uniform scaling" button
This commit is contained in:
parent
4d0c0ac748
commit
24e0c9b79e
2 changed files with 26 additions and 2 deletions
|
@ -19,7 +19,7 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent) :
|
||||||
OG_Settings(parent, true)
|
OG_Settings(parent, true)
|
||||||
{
|
{
|
||||||
m_og->set_name(_(L("Object Manipulation")));
|
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->set_grid_vgap(5);
|
||||||
|
|
||||||
m_og->m_on_change = [this](const std::string& opt_key, const boost::any& value) {
|
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);
|
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), "" };
|
Line line = { _(option_name), "" };
|
||||||
ConfigOptionDef def;
|
ConfigOptionDef def;
|
||||||
|
@ -164,6 +164,26 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent) :
|
||||||
def.max = 360;
|
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);
|
const std::string lower_name = boost::algorithm::to_lower_copy(option_name);
|
||||||
|
|
||||||
std::vector<std::string> axes{ "x", "y", "z" };
|
std::vector<std::string> axes{ "x", "y", "z" };
|
||||||
|
|
|
@ -74,6 +74,7 @@ class ObjectManipulation : public OG_Settings
|
||||||
Vec3d m_new_scale;
|
Vec3d m_new_scale;
|
||||||
Vec3d m_new_size;
|
Vec3d m_new_size;
|
||||||
bool m_new_enabled;
|
bool m_new_enabled;
|
||||||
|
bool m_uniform_scale {false};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ObjectManipulation(wxWindow* parent);
|
ObjectManipulation(wxWindow* parent);
|
||||||
|
@ -88,6 +89,9 @@ public:
|
||||||
// Called from the App to update the UI if dirty.
|
// Called from the App to update the UI if dirty.
|
||||||
void update_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:
|
private:
|
||||||
void reset_settings_value();
|
void reset_settings_value();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue