diff --git a/resources/images/BambuStudioBlack.svg b/resources/images/BambuStudioBlack.svg new file mode 100644 index 000000000..3363a7e8c --- /dev/null +++ b/resources/images/BambuStudioBlack.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/slic3r/GUI/AmsMappingPopup.cpp b/src/slic3r/GUI/AmsMappingPopup.cpp index ee5a1f337..77ee3687a 100644 --- a/src/slic3r/GUI/AmsMappingPopup.cpp +++ b/src/slic3r/GUI/AmsMappingPopup.cpp @@ -554,7 +554,7 @@ void AmsMapingPopup::update(MachineObject* obj) m_left_extra_slot->Hide(); //m_left_marea_panel->Show(); m_right_marea_panel->Show(); - set_sizer_title(m_right_split_ams_sizer, _L("Ams")); + set_sizer_title(m_right_split_ams_sizer, _L("AMS")); m_right_extra_slot->Show(); } else if (nozzle_nums > 1) { diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index be5412ba5..20a415aa3 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -2747,8 +2747,10 @@ void Sidebar::load_ams_list(std::string const &device, MachineObject* obj) return; wxGetApp().preset_bundle->filament_ams_list = filament_ams_list; - for (auto c : p->combos_filament) + for (auto c : p->combos_filament){ c->update(); + c->ShowBadge(false);//change printer,then clear badge + } p->combo_printer->update(); } @@ -2859,9 +2861,8 @@ void Sidebar::sync_ams_list() } } auto badge_combox_filament = [](PlaterPresetComboBox *c) { - auto cur_tip = c->GetToolTip()->GetTip(); auto tip = _L("\nMaterial and color information have been synchronized, but slot information is not included."); - c->SetToolTip(cur_tip + tip); + c->SetToolTip(tip); c->ShowBadge(true); }; { // badge ams filament diff --git a/src/slic3r/GUI/PresetComboBoxes.cpp b/src/slic3r/GUI/PresetComboBoxes.cpp index ec9ea73df..4d4956aad 100644 --- a/src/slic3r/GUI/PresetComboBoxes.cpp +++ b/src/slic3r/GUI/PresetComboBoxes.cpp @@ -1204,8 +1204,10 @@ void PlaterPresetComboBox::update() if (m_type == Preset::TYPE_PRINTER) add_connected_printers("", true); - if (m_type == Preset::TYPE_FILAMENT) + if (m_type == Preset::TYPE_FILAMENT) { + set_replace_text("Bambu", "BambuStudioBlack"); add_ams_filaments(into_u8(selected_user_preset.empty() ? selected_system_preset : selected_user_preset), true); + } std::vector filament_orders = {"Bambu PLA Basic", "Bambu PLA Matte", "Bambu PETG HF", "Bambu ABS", "Bambu PLA Silk", "Bambu PLA-CF", "Bambu PLA Galaxy", "Bambu PLA Metal", "Bambu PLA Marble", "Bambu PETG-CF", "Bambu PETG Translucent", "Bambu ABS-GF"}; diff --git a/src/slic3r/GUI/SyncAmsInfoDialog.cpp b/src/slic3r/GUI/SyncAmsInfoDialog.cpp index eb5019737..e4dc15900 100644 --- a/src/slic3r/GUI/SyncAmsInfoDialog.cpp +++ b/src/slic3r/GUI/SyncAmsInfoDialog.cpp @@ -134,8 +134,6 @@ void SyncAmsInfoDialog::updata_ui_data_after_connected_printer() { if (!m_input_info.connected_printer) { return; } if (is_dirty_filament()) { return; } - show_sizer(m_plate_combox_sizer, true); - update_printer_name();//m_printer_is_map_title is in m_plate_combox_sizer show_sizer(m_sizer_line, true); show_sizer(m_sizer_two_image, true); @@ -1163,9 +1161,8 @@ SyncAmsInfoDialog::SyncAmsInfoDialog(wxWindow *parent, SyncInfo &info) : tip_sizer->Add(m_attention_text, 0, wxALIGN_LEFT | wxTOP, FromDIP(2)); m_tip_text = new wxStaticText(this, wxID_ANY, _L("Only synchronize filament type and color, not including AMS slot information.")); m_tip_text->SetForegroundColour(wxColour(107, 107, 107, 100)); - tip_sizer->AddSpacer(FromDIP(25)); tip_sizer->Add(m_tip_text, 0, wxALIGN_LEFT | wxTOP, FromDIP(2)); - + tip_sizer->AddSpacer(FromDIP(25)); bSizer->Add(tip_sizer, 0, wxEXPAND | wxLEFT, FromDIP(25)); add_two_image_control(); @@ -3207,6 +3204,9 @@ void SyncAmsInfoDialog::on_timer(wxTimerEvent &event) update_select_layout(obj_); update_ams_check(obj_); m_check_flag = true; + + show_sizer(m_plate_combox_sizer, true); + update_printer_name(); // m_printer_is_map_title is in m_plate_combox_sizer } if (!obj_ || obj_->amsList.empty() || obj_->ams_exist_bits == 0 || !obj_->is_support_filament_backup || !obj_->is_support_show_filament_backup || diff --git a/src/slic3r/GUI/Widgets/ComboBox.cpp b/src/slic3r/GUI/Widgets/ComboBox.cpp index c887aa5fe..d3e00a90b 100644 --- a/src/slic3r/GUI/Widgets/ComboBox.cpp +++ b/src/slic3r/GUI/Widgets/ComboBox.cpp @@ -119,8 +119,18 @@ void ComboBox::SetLabel(const wxString &value) { if (GetTextCtrl()->IsShown() || text_off) GetTextCtrl()->SetValue(value); - else - TextInput::SetLabel(value); + else { + if (is_replace_text_to_image) { + auto new_value = value; + new_value.Replace(replace_text, "", false);//replace first text + TextInput::SetIcon_1(image_for_text); + TextInput::SetLabel(new_value); + } + else { + TextInput::SetIcon_1(""); + TextInput::SetLabel(value); + } + } } wxString ComboBox::GetLabel() const @@ -199,6 +209,13 @@ void ComboBox::DoDeleteOneItem(unsigned int pos) unsigned int ComboBox::GetCount() const { return items.size(); } +void ComboBox::set_replace_text(wxString text, wxString image_name) +{ + replace_text = text; + image_for_text = image_name; + is_replace_text_to_image = true; +} + wxString ComboBox::GetString(unsigned int n) const { return n < items.size() ? items[n].text : wxString{}; } diff --git a/src/slic3r/GUI/Widgets/ComboBox.hpp b/src/slic3r/GUI/Widgets/ComboBox.hpp index 535c965c1..ae00144d7 100644 --- a/src/slic3r/GUI/Widgets/ComboBox.hpp +++ b/src/slic3r/GUI/Widgets/ComboBox.hpp @@ -15,6 +15,9 @@ class ComboBox : public wxWindowWithItems DropDown drop; bool drop_down = false; bool text_off = false; + bool is_replace_text_to_image = false; + wxString replace_text; + wxString image_for_text; public: ComboBox(wxWindow * parent, @@ -37,6 +40,7 @@ public: int Append(const wxString &item, const wxBitmap &bitmap, const wxString &group, void *clientData = nullptr); + void set_replace_text(wxString text, wxString image_name); unsigned int GetCount() const override; int GetSelection() const override; diff --git a/src/slic3r/GUI/Widgets/TextInput.cpp b/src/slic3r/GUI/Widgets/TextInput.cpp index d09aa2285..4e3beea64 100644 --- a/src/slic3r/GUI/Widgets/TextInput.cpp +++ b/src/slic3r/GUI/Widgets/TextInput.cpp @@ -110,6 +110,17 @@ void TextInput::SetIcon(const wxString &icon) Rescale(); } +void TextInput::SetIcon_1(const wxString &icon) { + if (this->icon_1.name() == icon.ToStdString()) + return; + if (icon.empty()) { + this->icon_1 = ScalableBitmap(); + return; + } + this->icon_1 = ScalableBitmap(this, icon.ToStdString(), 16); + Rescale(); +} + void TextInput::SetLabelColor(StateColor const &color) { label_color = color; @@ -126,6 +137,8 @@ void TextInput::Rescale() { if (!this->icon.name().empty()) this->icon.msw_rescale(); + if (!this->icon_1.name().empty()) + this->icon_1.msw_rescale(); messureSize(); Refresh(); } @@ -165,6 +178,10 @@ void TextInput::DoSetSize(int x, int y, int width, int height, int sizeFlags) wxSize szIcon = this->icon.GetBmpSize(); textPos.x += szIcon.x; } + if (this->icon_1.bmp().IsOk()) { + wxSize szIcon = this->icon_1.GetBmpSize(); + textPos.x += (szIcon.x); + } bool align_right = GetWindowStyle() & wxALIGN_RIGHT; if (align_right) textPos.x += labelSize.x; @@ -213,6 +230,16 @@ void TextInput::render(wxDC& dc) dc.DrawBitmap(icon.bmp(), pt); pt.x += szIcon.x + 0; } + if (icon_1.bmp().IsOk()) { + wxSize szIcon = icon_1.GetBmpSize(); + pt.y = (size.y - szIcon.y) / 2; + if (align_center) { + if (pt.x * 2 + szIcon.x + 0 + labelSize.x < size.x) + pt.x = (size.x - (szIcon.x + 0 + labelSize.x)) / 2; + } + dc.DrawBitmap(icon_1.bmp(), pt); + pt.x += szIcon.x + 0; + } auto text = wxWindow::GetLabel(); if (!text.IsEmpty()) { wxSize textSize = text_ctrl->GetSize(); diff --git a/src/slic3r/GUI/Widgets/TextInput.hpp b/src/slic3r/GUI/Widgets/TextInput.hpp index 61f729506..d44a4e630 100644 --- a/src/slic3r/GUI/Widgets/TextInput.hpp +++ b/src/slic3r/GUI/Widgets/TextInput.hpp @@ -9,6 +9,7 @@ class TextInput : public wxNavigationEnabled wxSize labelSize; ScalableBitmap icon; + ScalableBitmap icon_1; StateColor label_color; StateColor text_color; wxTextCtrl * text_ctrl; @@ -44,6 +45,8 @@ public: void SetIcon(const wxString & icon); + void SetIcon_1(const wxString &icon); + void SetLabelColor(StateColor const &color); void SetTextColor(StateColor const &color);