From b813cb04dd438319c331d1b7ff533120bf65bd4a Mon Sep 17 00:00:00 2001 From: "xin.zhang" Date: Thu, 8 May 2025 16:56:43 +0800 Subject: [PATCH] ENH: update some GUI styles jira: [STUDIO-12074] Change-Id: I01bbf66577040d837c1768749b43500221e54fcb --- resources/images/print-time.svg | 24 +++---- resources/images/print-weight.svg | 26 +++----- .../images/print_options_bg_disabled.svg | 21 +++++++ src/slic3r/GUI/SelectMachine.cpp | 62 +++++++++++++------ src/slic3r/GUI/SelectMachine.hpp | 4 +- src/slic3r/GUI/Widgets/TextInput.cpp | 5 +- 6 files changed, 91 insertions(+), 51 deletions(-) create mode 100644 resources/images/print_options_bg_disabled.svg diff --git a/resources/images/print-time.svg b/resources/images/print-time.svg index 2693b7e59..ac79859c8 100644 --- a/resources/images/print-time.svg +++ b/resources/images/print-time.svg @@ -1,12 +1,12 @@ - - - - background - - - - Layer 1 - - - - \ No newline at end of file + + + + + + + + + + + + diff --git a/resources/images/print-weight.svg b/resources/images/print-weight.svg index 5b9e6777b..63b6eb32d 100644 --- a/resources/images/print-weight.svg +++ b/resources/images/print-weight.svg @@ -1,17 +1,9 @@ - - - - background - - - - Layer 1 - - - - - - - - - \ No newline at end of file + + + + + + + + + diff --git a/resources/images/print_options_bg_disabled.svg b/resources/images/print_options_bg_disabled.svg new file mode 100644 index 000000000..1704c3f3a --- /dev/null +++ b/resources/images/print_options_bg_disabled.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp index 6756dcf49..72c59cb36 100644 --- a/src/slic3r/GUI/SelectMachine.cpp +++ b/src/slic3r/GUI/SelectMachine.cpp @@ -177,7 +177,7 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater) rename_sizer_h = new wxBoxSizer(wxHORIZONTAL); m_rename_text = new wxStaticText(m_rename_normal_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxST_ELLIPSIZE_END); - m_rename_text->SetFont(::Label::Head_13); + m_rename_text->SetFont(::Label::Head_14); m_rename_text->SetBackgroundColour(*wxWHITE); m_rename_text->SetMaxSize(wxSize(FromDIP(340), -1)); rename_editable = new ScalableBitmap(m_scroll_area, "rename_edit", 20); @@ -252,7 +252,8 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater) m_sizer_basic_weight_time->Add(timeimg, 0, wxALIGN_CENTER, 0); m_sizer_basic_weight_time->Add(m_stext_time, 0, wxALIGN_CENTER|wxLEFT, FromDIP(6)); - m_sizer_basic_weight_time->Add(weightimg, 0, wxALIGN_CENTER|wxLEFT, FromDIP(30)); + m_sizer_basic_weight_time->AddSpacer(FromDIP(30)); + m_sizer_basic_weight_time->Add(weightimg, 0, wxALIGN_CENTER, 0); m_sizer_basic_weight_time->Add(m_stext_weight, 0, wxALIGN_CENTER|wxLEFT, FromDIP(6)); /*last & next page*/ @@ -312,7 +313,7 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater) wxBoxSizer* sizer_split_filament = new wxBoxSizer(wxHORIZONTAL); auto m_stext_filament_title = new Label(m_scroll_area, _L("Filament")); - m_stext_filament_title->SetFont(::Label::Body_14); + m_stext_filament_title->SetFont(::Label::Head_13); m_stext_filament_title->SetForegroundColour(0x909090); auto m_split_line_filament = new wxPanel(m_scroll_area, wxID_ANY, wxDefaultPosition, wxSize(-1, 1), wxTAB_TRAVERSAL); @@ -322,7 +323,7 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater) m_sizer_autorefill = new wxBoxSizer(wxHORIZONTAL); m_ams_backup_tip = new Label(m_scroll_area, _L("Auto Refill")); - m_ams_backup_tip->SetFont(::Label::Head_12); + m_ams_backup_tip->SetFont(::Label::Head_13); m_ams_backup_tip->SetForegroundColour(wxColour(0x00AE42)); m_ams_backup_tip->SetBackgroundColour(*wxWHITE); img_ams_backup = new wxStaticBitmap(m_scroll_area, wxID_ANY, create_scaled_bitmap("automatic_material_renewal", this, 16), wxDefaultPosition, wxSize(FromDIP(16), FromDIP(16)), 0); @@ -678,11 +679,11 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater) m_scroll_sizer->Add(m_filament_panel, 0, wxALIGN_CENTER|wxLEFT|wxRIGHT, FromDIP(15)); m_scroll_sizer->Add(m_sizer_filament_2extruder, 0, wxEXPAND|wxLEFT|wxRIGHT, FromDIP(15)); m_scroll_sizer->Add(0, 0, 0, wxTOP, FromDIP(6)); - m_scroll_sizer->Add(m_statictext_ams_msg, 0, wxLEFT|wxRIGHT, FromDIP(18)); + m_scroll_sizer->Add(m_statictext_ams_msg, 0, wxLEFT|wxRIGHT, FromDIP(15)); m_scroll_sizer->Add(0, 0, 0, wxTOP, FromDIP(10)); - m_scroll_sizer->Add(m_mapping_sugs_sizer, 0, wxLEFT|wxRIGHT, FromDIP(18)); - m_scroll_sizer->Add(m_change_filament_times_sizer, 0,wxLEFT|wxRIGHT, FromDIP(18)); - m_scroll_sizer->Add(m_link_edit_nozzle, 0, wxLEFT|wxRIGHT, FromDIP(18)); + m_scroll_sizer->Add(m_mapping_sugs_sizer, 0, wxLEFT|wxRIGHT, FromDIP(15)); + m_scroll_sizer->Add(m_change_filament_times_sizer, 0,wxLEFT|wxRIGHT, FromDIP(15)); + m_scroll_sizer->Add(m_link_edit_nozzle, 0, wxLEFT|wxRIGHT, FromDIP(15)); m_scroll_sizer->Add(sizer_split_options, 1, wxEXPAND|wxLEFT|wxRIGHT, FromDIP(15)); m_scroll_sizer->Add(0, 0, 0, wxTOP, FromDIP(10)); m_scroll_sizer->Add(m_options_other, 0, wxEXPAND|wxLEFT|wxRIGHT, FromDIP(15)); @@ -3598,8 +3599,8 @@ void SelectMachineDialog::Enable_Send_Button(bool en) if (!en) { if (m_button_ensure->IsEnabled()) { m_button_ensure->Disable(); - m_button_ensure->SetBackgroundColor(wxColour(0x90, 0x90, 0x90)); - m_button_ensure->SetBorderColor(wxColour(0x90, 0x90, 0x90)); + m_button_ensure->SetBackgroundColor(wxColour(200, 200, 200)); + m_button_ensure->SetBorderColor(wxColour(200, 200, 200)); } } else { if (!m_button_ensure->IsEnabled()) { @@ -4228,9 +4229,9 @@ void SelectMachineDialog::set_default_normal(const ThumbnailData &data) char weight[64]; if (wxGetApp().app_config->get("use_inches") == "1") { - ::sprintf(weight, " %.2f oz", aprint_stats.total_weight * 0.035274); + ::sprintf(weight, "%.2f oz", aprint_stats.total_weight * 0.035274); } else { - ::sprintf(weight, " %.2f g", aprint_stats.total_weight); + ::sprintf(weight, "%.2f g", aprint_stats.total_weight); } m_stext_time->SetLabel(time); @@ -4602,7 +4603,7 @@ SelectMachineDialog::~SelectMachineDialog() wxBoxSizer *sizer = new wxBoxSizer(wxHORIZONTAL); m_printoption_title = new Label(this, title); - m_printoption_title->SetFont(Label::Head_13); + m_printoption_title->SetFont(Label::Body_13); m_printoption_item = new PrintOptionItem(this, m_ops, param); m_printoption_item->SetFont(Label::Body_13); @@ -4653,6 +4654,20 @@ void PrintOption::doRender(wxDC &dc) dc.DrawRoundedRectangle(0, 0, size.x, size.y, FromDIP(3)); } +void PrintOption::enable(bool en) +{ + if (m_printoption_item->is_enabled() != en) + { + m_printoption_item->enable(en); + + if (en) { + m_printoption_title->SetForegroundColour("#262E30"); + } else { + m_printoption_title->SetForegroundColour(wxColour(144, 144, 144)); + } + } +} + void PrintOption::setValue(std::string value) { m_printoption_item->setValue(value); } @@ -4721,6 +4736,7 @@ PrintOptionItem::PrintOptionItem(wxWindow* parent, std::vector ops, std: Bind(wxEVT_LEFT_DOWN, &PrintOptionItem::on_left_down, this); m_selected_bk = ScalableBitmap(this, "print_options_bg", 22); + m_selected_disbabled_bk = ScalableBitmap(this, "print_options_bg_disabled", 22); // update the options update_options(ops); @@ -4806,7 +4822,11 @@ void PrintOptionItem::doRender(wxDC& dc) /*selected*/ auto selected_left = selected * PRINT_OPT_WIDTH + FromDIP(4); - dc.DrawBitmap(m_selected_bk.bmp(), selected_left, (size.y - m_selected_bk.GetBmpHeight()) / 2); + if (m_enable) { + dc.DrawBitmap(m_selected_bk.bmp(), selected_left, (size.y - m_selected_bk.GetBmpHeight()) / 2); + } else { + dc.DrawBitmap(m_selected_disbabled_bk.bmp(), selected_left, (size.y - m_selected_disbabled_bk.GetBmpHeight()) / 2); + } for (auto it = m_ops.begin(); it != m_ops.end(); ++it) { @@ -4819,7 +4839,7 @@ void PrintOptionItem::doRender(wxDC& dc) dc.SetPen(wxPen(clr)); dc.SetTextForeground(clr); - dc.SetFont(::Label::Head_13); + dc.SetFont(::Label::Body_13); auto text_size = dc.GetTextExtent(text_value); auto text_left = left + (PRINT_OPT_WIDTH - text_size.x) / 2; auto text_top = (size.y - text_size.y) / 2; @@ -4827,7 +4847,7 @@ void PrintOptionItem::doRender(wxDC& dc) } else { - const wxColour& clr = m_enable ? StateColor::darkModeColorFor(*wxBLACK) : StateColor::darkModeColorFor(wxColour(144, 144, 144)); + const wxColour& clr = m_enable ? StateColor::darkModeColorFor("#262E30") : StateColor::darkModeColorFor(wxColour(144, 144, 144)); dc.SetPen(wxPen(clr)); dc.SetTextForeground(clr); @@ -5096,7 +5116,7 @@ void PrinterInfoBox::Create() /*printer combobox*/ wxBoxSizer* sizer_split_printer = new wxBoxSizer(wxHORIZONTAL); m_stext_printer_title = new Label(this, _L("Printer"), wxALIGN_TOP); - m_stext_printer_title->SetFont(::Label::Body_14); + m_stext_printer_title->SetFont(::Label::Head_13); m_stext_printer_title->SetForegroundColour(0x909090); m_button_question = new ScalableButton(this, wxID_ANY, "icon_qusetion", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, true); @@ -5147,7 +5167,7 @@ void PrinterInfoBox::Create() auto bed_staticbox = new StaticBox(this); bed_staticbox->SetMinSize(wxSize(FromDIP(98), FromDIP(68))); bed_staticbox->SetMaxSize(wxSize(FromDIP(98), FromDIP(68))); - bed_staticbox->SetBorderColor(wxColour(0xCECECE)); + bed_staticbox->SetBorderColor(wxColour("#EEEEEE")); m_bed_image = new wxStaticBitmap(bed_staticbox, wxID_ANY, create_scaled_bitmap("bed_cool", this, 32)); m_bed_image->SetBackgroundColour(*wxWHITE); @@ -5155,11 +5175,13 @@ void PrinterInfoBox::Create() m_bed_image->SetMaxSize(wxSize(FromDIP(32), FromDIP(32))); m_text_bed_type = new Label(bed_staticbox); - m_text_bed_type->SetForegroundColour(0xCECECE); + m_text_bed_type->SetForegroundColour(wxColour(144, 144, 144)); m_text_bed_type->SetMaxSize(wxSize(FromDIP(80), FromDIP(24))); + m_text_bed_type->SetFont(Label::Body_13); - sizer_bed_staticbox->Add(0, 0, 0, wxTOP, FromDIP(16)); + sizer_bed_staticbox->Add(0, 0, 0, wxTOP, FromDIP(10)); sizer_bed_staticbox->Add(m_bed_image, 0, wxALIGN_CENTER, 0); + sizer_bed_staticbox->AddSpacer(FromDIP(6)); sizer_bed_staticbox->Add(m_text_bed_type, 0, wxALIGN_CENTER, 0); bed_staticbox->SetSizer(sizer_bed_staticbox); diff --git a/src/slic3r/GUI/SelectMachine.hpp b/src/slic3r/GUI/SelectMachine.hpp index 15614a6b8..da7817e58 100644 --- a/src/slic3r/GUI/SelectMachine.hpp +++ b/src/slic3r/GUI/SelectMachine.hpp @@ -158,6 +158,7 @@ public: } }; + bool is_enabled() const { return m_enable; } void enable(bool able) { if (m_enable != able) { @@ -176,6 +177,7 @@ private: private: ScalableBitmap m_selected_bk; + ScalableBitmap m_selected_disbabled_bk; std::vector m_ops; std::string selected_key; std::string m_param; @@ -196,7 +198,7 @@ public: ~PrintOption(){}; public: - void enable(bool en) { m_printoption_item->enable(en); } + void enable(bool en); void setValue(std::string value); std::string getValue(); diff --git a/src/slic3r/GUI/Widgets/TextInput.cpp b/src/slic3r/GUI/Widgets/TextInput.cpp index 2e17d8fbb..273171b6f 100644 --- a/src/slic3r/GUI/Widgets/TextInput.cpp +++ b/src/slic3r/GUI/Widgets/TextInput.cpp @@ -293,7 +293,10 @@ void TextInput::render(wxDC& dc) } dc.SetTextForeground(wxColour(144, 144, 144)); - dc.SetFont(GetFont()); + + wxFont font = GetFont(); + font.SetPointSize(font.GetPointSize() - 1);// use smaller font + dc.SetFont(font); dc.DrawText(static_tips, pt); } }