LoadStepDialog: Changed default values

This commit is contained in:
YuSanka 2025-03-28 13:43:12 +01:00 committed by Lukas Matena
parent f46999b9f4
commit a10d697bce
2 changed files with 18 additions and 9 deletions

View File

@ -35,9 +35,9 @@
namespace Slic3r::GUI { namespace Slic3r::GUI {
static std::vector<std::pair<std::string, PrecisionParams>> default_step_import_params = { static std::vector<std::pair<std::string, PrecisionParams>> default_step_import_params = {
{"Low" , {0.1, 1. }}, {"Low" , {0.005, 1. }},
{"Medium" , {0.05, 0.5 }}, {"Medium" , {0.003, 0.5 }},
{"High" , {0.001, 0.03}}, {"High" , {0.001, 0.25}},
}; };
LoadStepDialog::LoadStepDialog(wxWindow* parent, const std::string& filename, double linear_precision, double angle_precision, bool multiple_loading) LoadStepDialog::LoadStepDialog(wxWindow* parent, const std::string& filename, double linear_precision, double angle_precision, bool multiple_loading)
@ -83,7 +83,7 @@ LoadStepDialog::LoadStepDialog(wxWindow* parent, const std::string& filename, do
SetSizer(main_sizer); SetSizer(main_sizer);
main_sizer->SetSizeHints(this); main_sizer->SetSizeHints(this);
m_custom_sizer->ShowItems(!m_default); enable_customs(!m_default);
// Update DarkUi just for buttons // Update DarkUi just for buttons
wxGetApp().UpdateDlgDarkUI(this, true); wxGetApp().UpdateDlgDarkUI(this, true);
@ -103,9 +103,9 @@ void LoadStepDialog::add_params(wxSizer* sizer)
m_params.linear = params_copy.linear; m_params.linear = params_copy.linear;
m_params.angle = params_copy.angle; m_params.angle = params_copy.angle;
m_custom_sizer->ShowItems(false); enable_customs(false);
}); });
bool is_selected = m_params.linear == params.linear && params.angle == params.angle; bool is_selected = m_params.linear == params.linear && m_params.angle == params.angle;
radio_def->SetValue(is_selected); radio_def->SetValue(is_selected);
m_default |= is_selected; m_default |= is_selected;
@ -117,7 +117,7 @@ void LoadStepDialog::add_params(wxSizer* sizer)
wxRadioButton* radio_custom = new wxRadioButton(this, wxID_ANY, _L("Custom")); wxRadioButton* radio_custom = new wxRadioButton(this, wxID_ANY, _L("Custom"));
radio_custom->Bind(wxEVT_RADIOBUTTON, [&, this](wxEvent&) { radio_custom->Bind(wxEVT_RADIOBUTTON, [&, this](wxEvent&) {
m_custom_sizer->ShowItems(true); enable_customs(true);
#ifdef __linux__ #ifdef __linux__
this->Fit(); this->Fit();
#endif // __linux__ #endif // __linux__
@ -183,7 +183,7 @@ void LoadStepDialog::add_params(wxSizer* sizer)
// Add "Linear precision" // Add "Linear precision"
m_linear_precision_slider = new wxSlider(this, wxID_ANY, m_linear_precision_sl.get_pos(m_params.linear), m_linear_precision_sl.beg_sl_pos, m_linear_precision_sl.end_sl_pos, wxDefaultPosition, def_slider_size, slyder_style); m_linear_precision_slider = new wxSlider(this, wxID_ANY, m_linear_precision_sl.get_pos(m_params.linear), m_linear_precision_sl.beg_sl_pos, m_linear_precision_sl.end_sl_pos, wxDefaultPosition, def_slider_size, slyder_style);
m_linear_precision_slider->SetTickFreq(10); m_linear_precision_slider->SetTickFreq(1);
m_linear_precision_slider->Bind(wxEVT_SLIDER, [this](wxCommandEvent e) { m_linear_precision_slider->Bind(wxEVT_SLIDER, [this](wxCommandEvent e) {
m_params.linear = m_linear_precision_sl.get_value(m_linear_precision_slider->GetValue()); m_params.linear = m_linear_precision_sl.get_value(m_linear_precision_slider->GetValue());
m_linear_precision_val->SetValue(format_wxstr("%1%", m_params.linear)); m_linear_precision_val->SetValue(format_wxstr("%1%", m_params.linear));
@ -208,7 +208,7 @@ void LoadStepDialog::add_params(wxSizer* sizer)
// Add "Angle precision" // Add "Angle precision"
m_angle_precision_slider = new wxSlider(this, wxID_ANY, m_angle_precision_sl.get_pos(m_params.angle), m_angle_precision_sl.beg_sl_pos, m_angle_precision_sl.end_sl_pos, wxDefaultPosition, def_slider_size, slyder_style); m_angle_precision_slider = new wxSlider(this, wxID_ANY, m_angle_precision_sl.get_pos(m_params.angle), m_angle_precision_sl.beg_sl_pos, m_angle_precision_sl.end_sl_pos, wxDefaultPosition, def_slider_size, slyder_style);
m_angle_precision_slider->SetTickFreq(10); m_angle_precision_slider->SetTickFreq(5);
m_angle_precision_slider->Bind(wxEVT_SLIDER, [this](wxCommandEvent e) { m_angle_precision_slider->Bind(wxEVT_SLIDER, [this](wxCommandEvent e) {
m_params.angle = m_angle_precision_sl.get_value(m_angle_precision_slider->GetValue()); m_params.angle = m_angle_precision_sl.get_value(m_angle_precision_slider->GetValue());
m_angle_precision_val->SetValue(format_wxstr("%1%", m_params.angle)); m_angle_precision_val->SetValue(format_wxstr("%1%", m_params.angle));
@ -238,6 +238,14 @@ void LoadStepDialog::add_params(wxSizer* sizer)
sizer->Add(main_sizer, 1, wxEXPAND | wxALL, em_unit()); sizer->Add(main_sizer, 1, wxEXPAND | wxALL, em_unit());
} }
void LoadStepDialog::enable_customs(bool enable)
{
m_linear_precision_slider->Enable(enable);
m_linear_precision_val->Enable(enable);
m_angle_precision_slider->Enable(enable);
m_angle_precision_val->Enable(enable);
}
bool LoadStepDialog::IsCheckBoxChecked() bool LoadStepDialog::IsCheckBoxChecked()
{ {
return m_remember_chb && m_remember_chb->GetValue(); return m_remember_chb && m_remember_chb->GetValue();

View File

@ -73,6 +73,7 @@ protected:
private: private:
void add_params(wxSizer* sizer); void add_params(wxSizer* sizer);
void enable_customs(bool enable);
private: private:
PrecisionParams m_params; PrecisionParams m_params;