diff --git a/resources/images/filament_not_mactch.svg b/resources/images/filament_not_mactch.svg
new file mode 100644
index 000000000..b65a4a239
--- /dev/null
+++ b/resources/images/filament_not_mactch.svg
@@ -0,0 +1,3 @@
+
diff --git a/src/slic3r/GUI/AmsMappingPopup.cpp b/src/slic3r/GUI/AmsMappingPopup.cpp
index 2e9397226..b86168ebc 100644
--- a/src/slic3r/GUI/AmsMappingPopup.cpp
+++ b/src/slic3r/GUI/AmsMappingPopup.cpp
@@ -37,6 +37,7 @@ wxDEFINE_EVENT(EVT_SET_FINISH_MAPPING, wxCommandEvent);
m_transparent_mitem = ScalableBitmap(this, "transparent_material_item", 52);
//m_ams_wheel_mitem = ScalableBitmap(this, "ams_wheel", FromDIP(25));
m_ams_wheel_mitem = ScalableBitmap(this, "ams_wheel_narrow", 25);
+ m_ams_not_match = ScalableBitmap(this, "filament_not_mactch", 25);
m_material_coloul = mcolour;
m_material_name = mname;
@@ -128,6 +129,17 @@ void MaterialItem::paintEvent(wxPaintEvent &evt)
void MaterialItem::render(wxDC &dc)
{
+
+ wxString mapping_txt = wxEmptyString;
+ if (m_ams_name.empty()) {
+ mapping_txt = "-";
+ } else {
+ mapping_txt = m_ams_name;
+ }
+
+ if (mapping_txt == "-") { m_match = false;}
+ else {m_match = true;}
+
#ifdef __WXMSW__
wxSize size = GetSize();
wxMemoryDC memdc;
@@ -169,24 +181,24 @@ void MaterialItem::render(wxDC &dc)
dc.DrawText(m_material_name, wxPoint((GetSize().x - material_txt_size.x) / 2, ((float)GetSize().y * 2 / 5 - material_txt_size.y) / 2));
- // mapping num
-
- wxString mapping_txt = wxEmptyString;
- if (m_ams_name.empty()) {
- mapping_txt = "-";
- } else {
- mapping_txt = m_ams_name;
- }
-
auto mapping_txt_size = dc.GetTextExtent(mapping_txt);
dc.SetTextForeground(StateColor::darkModeColorFor(wxColour(0x26, 0x2E, 0x30)));
dc.SetFont(::Label::Head_12);
m_text_pos_y =((float)GetSize().y * 3 / 5 - mapping_txt_size.y) / 2 + (float)GetSize().y * 2 / 5;
- dc.DrawText(mapping_txt, wxPoint(GetSize().x / 2 + (GetSize().x / 2 - mapping_txt_size.x) / 2 - FromDIP(6), m_text_pos_y));
+
+ if (m_match) {
+ dc.DrawText(mapping_txt, wxPoint(GetSize().x / 2 + (GetSize().x / 2 - mapping_txt_size.x) / 2 - FromDIP(6), m_text_pos_y));
+ }
}
+void MaterialItem::match(bool mat)
+{
+ m_match = mat;
+ Refresh();
+}
+
void MaterialItem::doRender(wxDC& dc)
{
wxSize size = GetSize();
@@ -249,7 +261,6 @@ void MaterialItem::doRender(wxDC& dc)
dc.SetPen(*wxTRANSPARENT_PEN);
dc.SetBrush(wxBrush(wxColour(acolor)));
dc.DrawRectangle((size.x / 2 - MATERIAL_REC_WHEEL_SIZE.x) / 2 + FromDIP(3), up, MATERIAL_REC_WHEEL_SIZE.x - FromDIP(1), MATERIAL_REC_WHEEL_SIZE.y);
-
}
@@ -265,6 +276,7 @@ void MaterialItem::doRender(wxDC& dc)
dc.DrawRoundedRectangle(1, 1, MATERIAL_ITEM_SIZE.x - 1, MATERIAL_ITEM_SIZE.y - 1, 5);
}
#else
+
dc.SetPen(wxColour(0xAC, 0xAC, 0xAC));
dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.DrawRoundedRectangle(0, 0, MATERIAL_ITEM_SIZE.x, MATERIAL_ITEM_SIZE.y, 5);
@@ -275,7 +287,7 @@ void MaterialItem::doRender(wxDC& dc)
dc.DrawRoundedRectangle(0, 0, MATERIAL_ITEM_SIZE.x, MATERIAL_ITEM_SIZE.y, 5);
}
#endif
- if (m_text_pos_y > 0) {
+ if (m_text_pos_y > 0 && m_match) {
// arrow (remove arrow)
if ((acolor.Red() > 160 && acolor.Green() > 160 && acolor.Blue() > 160) && (acolor.Red() < 180 && acolor.Green() < 180 && acolor.Blue() < 180)) {
dc.DrawBitmap(m_arraw_bitmap_white.bmp(), size.x - m_arraw_bitmap_white.GetBmpSize().x - FromDIP(2), m_text_pos_y + FromDIP(3));
@@ -284,8 +296,15 @@ void MaterialItem::doRender(wxDC& dc)
}
}
- //wheel
- dc.DrawBitmap(m_ams_wheel_mitem.bmp(), (GetSize().x / 2 - m_ams_wheel_mitem.GetBmpSize().x) / 2 + FromDIP(2), ((float)GetSize().y * 0.6 - m_ams_wheel_mitem.GetBmpSize().y) / 2 + (float)GetSize().y * 0.4);
+ auto wheel_left = (GetSize().x / 2 - m_ams_wheel_mitem.GetBmpSize().x) / 2 + FromDIP(2);
+ auto wheel_top = ((float)GetSize().y * 0.6 - m_ams_wheel_mitem.GetBmpSize().y) / 2 + (float)GetSize().y * 0.4;
+
+ dc.DrawBitmap(m_ams_wheel_mitem.bmp(), wheel_left, wheel_top);
+
+ if (!m_match) {
+ wheel_left += m_ams_wheel_mitem.GetBmpSize().x;
+ dc.DrawBitmap(m_ams_not_match.bmp(), wheel_left + FromDIP(5), wheel_top);
+ }
}
AmsMapingPopup::AmsMapingPopup(wxWindow *parent)
@@ -360,7 +379,6 @@ AmsMapingPopup::AmsMapingPopup(wxWindow *parent)
left_tips->SetFont(::Label::Body_13);
left_tips->SetLabel(_L("Select filament that installed to the left nozzle"));
-
auto right_tips = new Label(m_right_marea_panel);
right_tips->SetForegroundColour(0x262E30);
right_tips->SetBackgroundColour(*wxWHITE);
@@ -368,7 +386,8 @@ AmsMapingPopup::AmsMapingPopup(wxWindow *parent)
right_tips->SetLabel(_L("Select filament that installed to the right nozzle"));
m_sizer_ams_left->Add(left_tips, 0, wxEXPAND|wxBOTTOM, FromDIP(8));
- m_sizer_ams_left->Add(create_split_sizer(m_left_marea_panel, _L("Left AMS")), 0, wxEXPAND, 0);
+ m_left_split_ams_sizer = create_split_sizer(m_left_marea_panel, _L("Left AMS"));
+ m_sizer_ams_left->Add(m_left_split_ams_sizer, 0, wxEXPAND, 0);
m_sizer_ams_left->Add(m_sizer_ams_basket_left, 0, wxEXPAND|wxTOP, FromDIP(8));
m_sizer_ams_left->Add(create_split_sizer(m_left_marea_panel, _L("External")), 0, wxEXPAND|wxTOP, FromDIP(8));
//m_sizer_ams_left->Add(m_left_extra_slot, 0, wxEXPAND|wxTOP, FromDIP(8));
@@ -391,19 +410,16 @@ AmsMapingPopup::AmsMapingPopup(wxWindow *parent)
m_sizer_ams->Add(m_right_marea_panel, 1, wxEXPAND, FromDIP(0));
- m_warning_text = new wxStaticText(this, wxID_ANY, wxEmptyString);
+ m_warning_text = new Label(this);
m_warning_text->SetForegroundColour(wxColour(0xFF, 0x6F, 0x00));
m_warning_text->SetFont(::Label::Body_12);
- auto cant_not_match_tip = _L("Note: Only the AMS slots loaded with the same material type can be selected.");
- m_warning_text->SetLabel(format_text(cant_not_match_tip));
- /*m_warning_text->SetMinSize(wxSize(FromDIP(248), FromDIP(-1)));
- m_warning_text->Wrap(FromDIP(248));*/
- /*m_warning_text->SetMinSize(wxSize(FromDIP(496), FromDIP(-1)));
- m_warning_text->Wrap(FromDIP(496));*/
+ m_warning_text->SetLabel(_L("Note: Only the AMS slots loaded with the same material type can be selected."));
m_sizer_main->Add(title_panel, 0, wxEXPAND | wxALL, FromDIP(2));
m_sizer_main->Add(m_sizer_ams, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(14));
- m_sizer_main->Add(m_warning_text, 0, wxEXPAND | wxALL, FromDIP(6));
+ m_sizer_main->Add( 0, 0, 0, wxTOP, FromDIP(8));
+ m_sizer_main->Add(m_warning_text, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(14));
+ m_sizer_main->Add( 0, 0, 0, wxTOP, FromDIP(8));
SetSizer(m_sizer_main);
Layout();
@@ -448,26 +464,6 @@ AmsMapingPopup::AmsMapingPopup(wxWindow *parent)
return sizer_split_ams;
}
- wxString AmsMapingPopup::format_text(wxString &m_msg)
- {
- if (wxGetApp().app_config->get("language") != "zh_CN") { return m_msg; }
-
- wxString out_txt = m_msg;
- wxString count_txt = "";
- int new_line_pos = 0;
-
- for (int i = 0; i < m_msg.length(); i++) {
- auto text_size = m_warning_text->GetTextExtent(count_txt);
- if (text_size.x < (FromDIP(280))) {
- count_txt += m_msg[i];
- } else {
- out_txt.insert(i - 1, '\n');
- count_txt = "";
- }
- }
- return out_txt;
- }
-
void AmsMapingPopup::update_materials_list(std::vector list)
{
m_materials_list = list;
@@ -566,9 +562,11 @@ void AmsMapingPopup::update(MachineObject* obj)
/*ext*/
const auto& full_config = wxGetApp().preset_bundle->full_config();
size_t nozzle_nums = full_config.option("nozzle_diameter")->values.size();
+
+ m_warning_text->SetMinSize(wxSize(FromDIP(248), FromDIP(-1)));
+ m_warning_text->Wrap(FromDIP(248));
+
if (nozzle_nums == 1) {
- m_warning_text->SetMinSize(wxSize(FromDIP(248), FromDIP(-1)));
- m_warning_text->Wrap(FromDIP(248));
m_left_marea_panel->Hide();
m_left_extra_slot->Hide();
//m_left_marea_panel->Show();
@@ -581,11 +579,6 @@ void AmsMapingPopup::update(MachineObject* obj)
m_right_marea_panel->Hide();
m_left_extra_slot->Hide();
m_right_extra_slot->Hide();
- if (m_show_type != ShowType::LEFT_AND_RIGHT)
- {
- m_warning_text->SetMinSize(wxSize(FromDIP(248), FromDIP(-1)));
- m_warning_text->Wrap(FromDIP(248));
- }
if (m_show_type == ShowType::LEFT)
{
m_left_marea_panel->Show();
@@ -714,12 +707,25 @@ void AmsMapingPopup::update(MachineObject* obj)
m_sizer_ams_basket_left->Add(ams_mapping_item_container, 0, wxLEFT, 0);
}
+ if (m_sizer_ams_basket_left->GetChildren().size() <= 0) {
+ m_left_split_ams_sizer->Show(false);
+ } else {
+ m_left_split_ams_sizer->Show(true);
+ }
+
+ if (m_sizer_ams_basket_right->GetChildren().size() == 0) {
+ m_right_split_ams_sizer->Show(false);
+ } else {
+ m_right_split_ams_sizer->Show(true);
+ }
+
//m_warning_text->Show(m_has_unmatch_filament);
}
else if(ams_type == 4){ //4:n3s
}
}
+ Refresh();
Layout();
Fit();
}
diff --git a/src/slic3r/GUI/AmsMappingPopup.hpp b/src/slic3r/GUI/AmsMappingPopup.hpp
index 6a8e70e74..1f29866e3 100644
--- a/src/slic3r/GUI/AmsMappingPopup.hpp
+++ b/src/slic3r/GUI/AmsMappingPopup.hpp
@@ -91,9 +91,11 @@ public:
ScalableBitmap m_arraw_bitmap_white;
ScalableBitmap m_transparent_mitem;
ScalableBitmap m_ams_wheel_mitem;
+ ScalableBitmap m_ams_not_match;
bool m_selected {false};
bool m_warning{false};
+ bool m_match {true};
void msw_rescale();
void set_ams_info(wxColour col, wxString txt, int ctype=0, std::vector cols= std::vector());
@@ -107,6 +109,7 @@ public:
void on_left_down(wxMouseEvent &evt);
void paintEvent(wxPaintEvent &evt);
void render(wxDC &dc);
+ void match(bool mat);
void doRender(wxDC &dc);
};
@@ -156,7 +159,7 @@ public:
~AmsMapingPopup() {};
wxWindow* send_win{ nullptr };
- wxStaticText * m_warning_text{nullptr};
+ Label* m_warning_text{nullptr};
std::vector m_materials_list;
std::vector m_amsmapping_container_sizer_list;
std::vector m_amsmapping_container_list;
@@ -181,6 +184,7 @@ public:
wxPanel* m_left_marea_panel;
wxPanel* m_right_marea_panel;
+ wxBoxSizer * m_left_split_ams_sizer{nullptr};
wxBoxSizer * m_right_split_ams_sizer{nullptr};
wxBoxSizer* m_sizer_split_ams_left;
@@ -188,7 +192,6 @@ public:
void set_sizer_title(wxBoxSizer *sizer, wxString text);
wxBoxSizer* create_split_sizer(wxWindow* parent, wxString text);
- wxString format_text(wxString &m_msg);
void set_send_win(wxWindow* win) {send_win = win;};
void update_materials_list(std::vector list);
void set_tag_texture(std::string texture);
diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp
index 59ff73246..364cf6791 100644
--- a/src/slic3r/GUI/SelectMachine.cpp
+++ b/src/slic3r/GUI/SelectMachine.cpp
@@ -548,7 +548,7 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
m_txt_change_filament_times->SetBackgroundColour(*wxWHITE);
m_txt_change_filament_times->SetLabel(wxEmptyString);
m_change_filament_times_sizer->Add(m_img_change_filament_times, 0, wxTOP, FromDIP(2));
- m_change_filament_times_sizer->Add(m_txt_change_filament_times, 0, wxTOP, 0);
+ m_change_filament_times_sizer->Add(m_txt_change_filament_times, 0, wxTOP, FromDIP(2));
/*Advanced Options*/
wxBoxSizer* sizer_split_options = new wxBoxSizer(wxHORIZONTAL);
@@ -1102,11 +1102,8 @@ void SelectMachineDialog::sync_ams_mapping_result(std::vector &res
if (f->tray_id == VIRTUAL_TRAY_MAIN_ID || f->tray_id == VIRTUAL_TRAY_DEPUTY_ID)
{
ams_id = "Ext";
- }
-
- else if (f->tray_id >= 0) {
+ }else if (f->tray_id >= 0) {
ams_id = wxGetApp().transition_tridid(f->tray_id);
- //ams_id = wxString::Format("%02d", f->tray_id + 1);
} else {
ams_id = "-";
}