From 8dfd3bbb0c2b32ba95d942a662c4223b9001c40a Mon Sep 17 00:00:00 2001 From: Mack Date: Mon, 21 Oct 2024 09:49:04 +0800 Subject: [PATCH] ENH: update step mesh ui jira:nojira Change-Id: I7ba88d1ad80fa1e8152393c523bc301187e543d1 --- resources/images/step_mesh_info.svg | 5 ++++ src/slic3r/GUI/StepMeshDialog.cpp | 46 +++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 resources/images/step_mesh_info.svg diff --git a/resources/images/step_mesh_info.svg b/resources/images/step_mesh_info.svg new file mode 100644 index 000000000..c12b253a5 --- /dev/null +++ b/resources/images/step_mesh_info.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/slic3r/GUI/StepMeshDialog.cpp b/src/slic3r/GUI/StepMeshDialog.cpp index 5af7116d7..d2bc18f1e 100644 --- a/src/slic3r/GUI/StepMeshDialog.cpp +++ b/src/slic3r/GUI/StepMeshDialog.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include "GUI_App.hpp" #include "I18N.hpp" #include "MainFrame.hpp" @@ -29,6 +30,23 @@ static int _ITEM_WIDTH() { return _scale(30); } wxDEFINE_EVENT(wxEVT_THREAD_DONE, wxCommandEvent); +class CenteredStaticText : public wxStaticText +{ +public: + CenteredStaticText(wxWindow* parent, wxWindowID id, const wxString& label, const wxPoint& position, const wxSize& size = wxDefaultSize, long style = 0) + : wxStaticText(parent, id, label, position, size, style) { + CenterOnPosition(position); + } + + void CenterOnPosition(const wxPoint& position) { + int textWidth, textHeight; + GetTextExtent(GetLabel(), &textWidth, &textHeight); + int x = position.x - textWidth / 2; + int y = position.y - textHeight / 2; + SetPosition(wxPoint(x, y)); + } +}; + void StepMeshDialog::on_dpi_changed(const wxRect& suggested_rect) { }; @@ -67,6 +85,34 @@ 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); + 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"), + wxPoint(overlay_panel->GetSize().GetWidth() / 6, + overlay_panel->GetSize().GetHeight() / 2)); + CenteredStaticText* text_2 = new CenteredStaticText(overlay_panel, wxID_ANY, _L("Smooth"), + wxPoint(overlay_panel->GetSize().GetWidth() * 5 / 6, + overlay_panel->GetSize().GetHeight() / 2)); + CenteredStaticText* text_3 = new CenteredStaticText(overlay_panel, wxID_ANY, _L("Reduce Linear"), + wxPoint(overlay_panel->GetSize().GetWidth() / 2, + overlay_panel->GetSize().GetHeight() * 1.3 / 3)); + 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("Many faces"), + wxPoint(overlay_panel->GetSize().GetWidth() / 6, + overlay_panel->GetSize().GetHeight() * 2.8 / 3)); + CenteredStaticText* text_6 = new CenteredStaticText(overlay_panel, wxID_ANY, _L("Few faces"), + wxPoint(overlay_panel->GetSize().GetWidth() * 5 / 6, + overlay_panel->GetSize().GetHeight() * 2.8 / 3)); + + bSizer->Add(overlay_panel, 0, wxALIGN_CENTER | wxALL, 10); + wxBoxSizer* linear_sizer = new wxBoxSizer(wxHORIZONTAL); //linear_sizer->SetMinSize(wxSize(MIN_DIALOG_WIDTH, -1)); wxStaticText* linear_title = new wxStaticText(this,