FIX:STEP mesh crashes in specific language

1.fix dark model

2.fix reload file

3.fix macos ui

jira: STUDIO-8722
Change-Id: I17c723cbf88b97b187c72fbc6f65fc2da591465f
(cherry picked from commit 6c48a8e40b3a28859d5883b13106683cbe61c73d)
This commit is contained in:
Mack 2024-11-13 15:27:44 +08:00 committed by Noisyfox
parent 0bc2444079
commit 9b439ff5a2
4 changed files with 36 additions and 32 deletions

View file

@ -66,7 +66,7 @@ bool StepMeshDialog:: validate_number_range(const wxString& value, double min, d
return (num >= min && num <= max);
}
StepMeshDialog::StepMeshDialog(wxWindow* parent, Slic3r::Step& file)
StepMeshDialog::StepMeshDialog(wxWindow* parent, Slic3r::Step& file, double linear_init, double angle_init)
: DPIDialog(parent ? parent : static_cast<wxWindow *>(wxGetApp().mainframe),
wxID_ANY,
_(L("Step file import parameters")),
@ -74,6 +74,9 @@ StepMeshDialog::StepMeshDialog(wxWindow* parent, Slic3r::Step& file)
wxDefaultSize,
wxDEFAULT_DIALOG_STYLE /* | wxRESIZE_BORDER*/), m_file(file)
{
m_linear_last = wxString::Format("%.3f", linear_init);
m_angle_last = wxString::Format("%.2f", angle_init);
Bind(wxEVT_THREAD_DONE, &StepMeshDialog::on_task_done, this);
std::string icon_path = (boost::format("%1%/images/BambuStudioTitle.ico")
@ -85,17 +88,16 @@ StepMeshDialog::StepMeshDialog(wxWindow* parent, Slic3r::Step& file)
wxBoxSizer* bSizer = new wxBoxSizer(wxVERTICAL);
bSizer->SetMinSize(wxSize(MIN_DIALOG_WIDTH, -1));
auto image_bitmap = create_scaled_bitmap("step_mesh_info", this, FromDIP(120), false, std::string(), false, false, true);
int image_width = image_bitmap.GetWidth();
int image_height = image_bitmap.GetHeight();
wxPanel* overlay_panel = new wxPanel(this, wxID_ANY, wxDefaultPosition, image_bitmap.GetSize(), wxTAB_TRAVERSAL);
auto image_bitmap = create_scaled_bitmap("step_mesh_info", this, FromDIP(120));
wxPanel* overlay_panel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(FromDIP(image_bitmap.GetWidth()), FromDIP(image_bitmap.GetHeight())), wxTAB_TRAVERSAL);
overlay_panel->SetBackgroundStyle(wxBG_STYLE_PAINT);
wxStaticBitmap *image = new wxStaticBitmap(overlay_panel, wxID_ANY, image_bitmap, wxDefaultPosition, wxDefaultSize, 0);
CenteredStaticText* text_1 = new CenteredStaticText (overlay_panel, wxID_ANY, _L("Rough"),
CenteredStaticText* text_1 = new CenteredStaticText (overlay_panel, wxID_ANY, _L("Smooth"),
wxPoint(overlay_panel->GetSize().GetWidth() / 6,
overlay_panel->GetSize().GetHeight() / 2));
CenteredStaticText* text_2 = new CenteredStaticText(overlay_panel, wxID_ANY, _L("Smooth"),
CenteredStaticText* text_2 = new CenteredStaticText(overlay_panel, wxID_ANY, _L("Rough"),
wxPoint(overlay_panel->GetSize().GetWidth() * 5 / 6,
overlay_panel->GetSize().GetHeight() / 2));
CenteredStaticText* text_3 = new CenteredStaticText(overlay_panel, wxID_ANY, _L("Reduce Linear"),
@ -104,10 +106,10 @@ StepMeshDialog::StepMeshDialog(wxWindow* parent, Slic3r::Step& file)
CenteredStaticText* text_4 = new CenteredStaticText(overlay_panel, wxID_ANY, _L("Reduce Angle"),
wxPoint(overlay_panel->GetSize().GetWidth() / 2,
overlay_panel->GetSize().GetHeight() * 2 / 3));
CenteredStaticText* text_5 = new CenteredStaticText(overlay_panel, wxID_ANY, _L("Fewer faces"),
CenteredStaticText* text_5 = new CenteredStaticText(overlay_panel, wxID_ANY, _L("More faces"),
wxPoint(overlay_panel->GetSize().GetWidth() / 6,
overlay_panel->GetSize().GetHeight() * 2.8 / 3));
CenteredStaticText* text_6 = new CenteredStaticText(overlay_panel, wxID_ANY, _L("More faces"),
CenteredStaticText* text_6 = new CenteredStaticText(overlay_panel, wxID_ANY, _L("Fewer faces"),
wxPoint(overlay_panel->GetSize().GetWidth() * 5 / 6,
overlay_panel->GetSize().GetHeight() * 2.8 / 3));
@ -251,8 +253,8 @@ StepMeshDialog::StepMeshDialog(wxWindow* parent, Slic3r::Step& file)
if (m_checkbox->IsChecked()) {
wxGetApp().app_config->set_bool("enable_step_mesh_setting", false);
}
wxGetApp().app_config->set("linear_defletion", std::to_string(get_linear_defletion()));
wxGetApp().app_config->set("angle_defletion", std::to_string(get_angle_defletion()));
wxGetApp().app_config->set("linear_defletion", float_to_string_decimal_point(get_linear_defletion(), 3));
wxGetApp().app_config->set("angle_defletion", float_to_string_decimal_point(get_angle_defletion(), 2));
EndModal(wxID_OK);
}