NEW:support new mapping type

jira:[support new mapping]

Change-Id: I88e5d3b6966d4ed1e8098d13fe9335fecf6e01c4
(cherry picked from commit c0932e16ff9fcae0e900c6e0cac9a5b496d0cc0e)
This commit is contained in:
tao wang
2024-06-18 20:09:11 +08:00
committed by Noisyfox
parent 7fe421b1b3
commit e4d8c2e440
7 changed files with 567 additions and 354 deletions

View File

@@ -968,6 +968,9 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
SetDoubleBuffered(true);
#endif //__WINDOWS__
SetMinSize(wxSize(FromDIP(688), -1));
SetMaxSize(wxSize(FromDIP(688), -1));
// bind
Bind(wxEVT_CLOSE_WINDOW, &SelectMachineDialog::on_cancel, this);
@@ -984,54 +987,77 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
SetBackgroundColour(m_colour_def_color);
m_sizer_main = new wxBoxSizer(wxVERTICAL);
m_sizer_main->SetMinSize(wxSize(0, -1));
m_line_top = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1, 1), wxTAB_TRAVERSAL);
m_line_top->SetBackgroundColour(wxColour(166, 169, 170));
m_scrollable_view = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize);
m_sizer_scrollable_view = new wxBoxSizer(wxVERTICAL);
m_scrollable_region = new wxPanel(m_scrollable_view, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
m_sizer_scrollable_region = new wxBoxSizer(wxVERTICAL);
m_basic_panel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
m_basic_panel->SetBackgroundColour(*wxWHITE);
m_basicl_sizer = new wxBoxSizer(wxHORIZONTAL);
/*basic info*/
//rename normal
m_rename_switch_panel = new wxSimplebook(m_scrollable_region);
m_rename_switch_panel->SetSize(wxSize(FromDIP(420), FromDIP(25)));
m_rename_switch_panel->SetMinSize(wxSize(FromDIP(420), FromDIP(25)));
m_rename_switch_panel->SetMaxSize(wxSize(FromDIP(420), FromDIP(25)));
/*thumbnail*/
auto m_sizer_thumbnail_area = new wxBoxSizer(wxHORIZONTAL);
auto m_panel_image = new wxPanel(m_basic_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
m_panel_image->SetBackgroundColour(m_colour_def_color);
m_sizer_thumbnail = new wxBoxSizer(wxHORIZONTAL);
m_thumbnailPanel = new ThumbnailPanel(m_panel_image);
m_thumbnailPanel->SetSize(wxSize(FromDIP(198), FromDIP(198)));
m_thumbnailPanel->SetMinSize(wxSize(FromDIP(198), FromDIP(198)));
m_thumbnailPanel->SetMaxSize(wxSize(FromDIP(198), FromDIP(198)));
m_thumbnailPanel->SetBackgroundColour(*wxWHITE);
m_sizer_thumbnail->Add(m_thumbnailPanel, 0, wxALIGN_CENTER, 0);
m_panel_image->SetSizer(m_sizer_thumbnail);
m_panel_image->Layout();
m_sizer_thumbnail_area->Add(m_panel_image, 0, wxALIGN_CENTER, 0);
m_sizer_thumbnail_area->Layout();
/*basic info right*/
auto sizer_basic_right_info = new wxBoxSizer(wxVERTICAL);
/*rename*/
auto sizer_rename = new wxBoxSizer(wxHORIZONTAL);
m_rename_switch_panel = new wxSimplebook(m_basic_panel);
m_rename_switch_panel->SetBackgroundColour(*wxWHITE);
m_rename_switch_panel->SetSize(wxSize(FromDIP(360), FromDIP(25)));
m_rename_switch_panel->SetMinSize(wxSize(FromDIP(360), FromDIP(25)));
m_rename_switch_panel->SetMaxSize(wxSize(FromDIP(360), FromDIP(25)));
m_rename_normal_panel = new wxPanel(m_rename_switch_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
m_rename_normal_panel->SetBackgroundColour(*wxWHITE);
rename_sizer_v = new wxBoxSizer(wxVERTICAL);
rename_sizer_h = new wxBoxSizer(wxHORIZONTAL);
m_rename_text = new wxStaticText(m_rename_normal_panel, wxID_ANY, wxT("MyLabel"), wxDefaultPosition, wxDefaultSize, wxST_ELLIPSIZE_END);
m_rename_text = new wxStaticText(m_rename_normal_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxST_ELLIPSIZE_END);
m_rename_text->SetFont(::Label::Body_13);
m_rename_text->SetMaxSize(wxSize(FromDIP(390), -1));
m_rename_button = new ScalableButton(m_rename_normal_panel, wxID_ANY, "ams_editable");
ams_editable = new ScalableBitmap(this, "ams_editable", 13);
ams_editable_light = new ScalableBitmap(this, "ams_editable_light", 13);
m_rename_button->SetBackgroundColour(*wxWHITE);
m_rename_text->SetBackgroundColour(*wxWHITE);
m_rename_text->SetMaxSize(wxSize(FromDIP(340), -1));
rename_editable = new ScalableBitmap(this, "rename_edit", 20);
rename_editable_light = new ScalableBitmap(this, "rename_edit", 20);
m_rename_button = new wxStaticBitmap(m_rename_normal_panel, wxID_ANY, rename_editable->bmp(), wxDefaultPosition, wxSize(FromDIP(20), FromDIP(20)), 0);
m_rename_button->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) {SetCursor(wxCURSOR_HAND); });
m_rename_button->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) {SetCursor(wxCURSOR_ARROW); });
rename_sizer_h->Add(m_rename_text, 0, wxALIGN_CENTER, 0);
rename_sizer_h->Add(m_rename_text, 0, wxALIGN_CENTER|wxTOP, FromDIP(2));
rename_sizer_h->Add(m_rename_button, 0, wxALIGN_CENTER, 0);
rename_sizer_v->Add(rename_sizer_h, 1, wxALIGN_CENTER, 0);
rename_sizer_v->Add(rename_sizer_h, 1, wxTOP, 0);
m_rename_normal_panel->SetSizer(rename_sizer_v);
m_rename_normal_panel->Layout();
rename_sizer_v->Fit(m_rename_normal_panel);
//rename edit
auto m_rename_edit_panel = new wxPanel(m_rename_switch_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
m_rename_edit_panel->SetBackgroundColour(*wxWHITE);
auto rename_edit_sizer_v = new wxBoxSizer(wxVERTICAL);
m_rename_input = new ::TextInput(m_rename_edit_panel, wxEmptyString, wxEmptyString, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER);
m_rename_input->GetTextCtrl()->SetFont(::Label::Body_13);
m_rename_input->SetSize(wxSize(FromDIP(380), FromDIP(24)));
m_rename_input->SetMinSize(wxSize(FromDIP(380), FromDIP(24)));
m_rename_input->SetMaxSize(wxSize(FromDIP(380), FromDIP(24)));
m_rename_input->SetSize(wxSize(FromDIP(360), FromDIP(24)));
m_rename_input->SetMinSize(wxSize(FromDIP(360), FromDIP(24)));
m_rename_input->SetMaxSize(wxSize(FromDIP(360), FromDIP(24)));
m_rename_input->Bind(wxEVT_TEXT_ENTER, [this](auto& e) {on_rename_enter();});
m_rename_input->Bind(wxEVT_KILL_FOCUS, [this](auto& e) {
if (!m_rename_input->HasFocus() && !m_rename_text->HasFocus())
@@ -1045,7 +1071,7 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
m_rename_edit_panel->Layout();
rename_edit_sizer_v->Fit(m_rename_edit_panel);
m_rename_button->Bind(wxEVT_BUTTON, &SelectMachineDialog::on_rename_click, this);
m_rename_button->Bind(wxEVT_LEFT_DOWN, &SelectMachineDialog::on_rename_click, this);
m_rename_switch_panel->AddPage(m_rename_normal_panel, wxEmptyString, true);
m_rename_switch_panel->AddPage(m_rename_edit_panel, wxEmptyString, false);
@@ -1065,91 +1091,124 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
}
});
auto m_sizer_thumbnail_area = new wxBoxSizer(wxHORIZONTAL);
auto last_plate_panel = new wxWindow(m_scrollable_region, wxID_ANY);
last_plate_panel->SetBackgroundColour(*wxWHITE);
auto last_plate_sizer = new wxBoxSizer(wxVERTICAL);
last_plate_panel->SetMinSize(wxSize(FromDIP(32), FromDIP(32)));
m_bitmap_last_plate = new wxStaticBitmap(last_plate_panel, wxID_ANY, create_scaled_bitmap("go_last_plate", this, 32), wxDefaultPosition, wxSize(FromDIP(32), FromDIP(32)), 0);
last_plate_sizer->Add(m_bitmap_last_plate, 0, wxALIGN_CENTER, 0);
last_plate_panel->SetSizer(last_plate_sizer);
m_panel_image = new wxPanel(m_scrollable_region, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
m_panel_image->SetBackgroundColour(m_colour_def_color);
m_sizer_thumbnail = new wxBoxSizer(wxHORIZONTAL);
m_thumbnailPanel = new ThumbnailPanel(m_panel_image);
m_thumbnailPanel->SetSize(wxSize(FromDIP(256), FromDIP(256)));
m_thumbnailPanel->SetMinSize(wxSize(FromDIP(256), FromDIP(256)));
m_thumbnailPanel->SetMaxSize(wxSize(FromDIP(256), FromDIP(256)));
m_thumbnailPanel->SetBackgroundColour(*wxRED);
m_sizer_thumbnail->Add(m_thumbnailPanel, 0, wxALIGN_CENTER, 0);
m_panel_image->SetSizer(m_sizer_thumbnail);
m_panel_image->Layout();
auto next_plate_panel = new wxWindow(m_scrollable_region, wxID_ANY);
next_plate_panel->SetBackgroundColour(*wxWHITE);
auto next_plate_sizer = new wxBoxSizer(wxVERTICAL);
next_plate_panel->SetMinSize(wxSize(FromDIP(32), FromDIP(32)));
m_bitmap_next_plate = new wxStaticBitmap(next_plate_panel, wxID_ANY, create_scaled_bitmap("go_next_plate", this, 32), wxDefaultPosition, wxSize(FromDIP(32), FromDIP(32)), 0);
next_plate_sizer->Add(m_bitmap_next_plate, 0, wxALIGN_CENTER, 0);
next_plate_panel->SetSizer(next_plate_sizer);
m_sizer_thumbnail_area->Add(last_plate_panel, 0, wxALIGN_CENTER, 0);
m_sizer_thumbnail_area->Add(m_panel_image, 0, wxALIGN_CENTER|wxLEFT|wxRIGHT, FromDIP(24));
m_sizer_thumbnail_area->Add(next_plate_panel, 0, wxALIGN_CENTER, 0);
wxBoxSizer *m_sizer_basic = new wxBoxSizer(wxHORIZONTAL);
wxBoxSizer *m_sizer_basic_weight = new wxBoxSizer(wxHORIZONTAL);
wxBoxSizer *m_sizer_basic_time = new wxBoxSizer(wxHORIZONTAL);
/*weight & time*/
wxBoxSizer *m_sizer_basic_weight_time = new wxBoxSizer(wxHORIZONTAL);
print_time = new ScalableBitmap(this, "print-time", 18);
timeimg = new wxStaticBitmap(m_scrollable_region, wxID_ANY, print_time->bmp(), wxDefaultPosition, wxSize(FromDIP(18), FromDIP(18)), 0);
m_sizer_basic_weight->Add(timeimg, 1, wxEXPAND | wxALL, FromDIP(5));
m_stext_time = new wxStaticText(m_scrollable_region, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
m_sizer_basic_weight->Add(m_stext_time, 0, wxALL, FromDIP(5));
m_sizer_basic->Add(m_sizer_basic_weight, 0, wxALIGN_CENTER, 0);
m_sizer_basic->Add(0, 0, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(30));
timeimg = new wxStaticBitmap(m_basic_panel, wxID_ANY, print_time->bmp(), wxDefaultPosition, wxSize(FromDIP(18), FromDIP(18)), 0);
m_stext_time = new Label(m_basic_panel, wxEmptyString);
m_stext_time->SetFont(Label::Body_13);
print_weight = new ScalableBitmap(this, "print-weight", 18);
weightimg = new wxStaticBitmap(m_scrollable_region, wxID_ANY, print_weight->bmp(), wxDefaultPosition, wxSize(FromDIP(18), FromDIP(18)), 0);
m_sizer_basic_time->Add(weightimg, 1, wxEXPAND | wxALL, FromDIP(5));
m_stext_weight = new wxStaticText(m_scrollable_region, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
m_sizer_basic_time->Add(m_stext_weight, 0, wxALL, FromDIP(5));
m_sizer_basic->Add(m_sizer_basic_time, 0, wxALIGN_CENTER, 0);
weightimg = new wxStaticBitmap(m_basic_panel, wxID_ANY, print_weight->bmp(), wxDefaultPosition, wxSize(FromDIP(18), FromDIP(18)), 0);
m_stext_weight = new Label(m_basic_panel, wxEmptyString);
m_stext_weight->SetFont(Label::Body_13);
wxBoxSizer* m_sizer_material_area = new wxBoxSizer(wxHORIZONTAL);
wxBoxSizer* m_sizer_material_tips = new wxBoxSizer(wxHORIZONTAL);
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->Add(m_stext_weight, 0, wxALIGN_CENTER|wxLEFT, FromDIP(6));
enable_ams_mapping = new ScalableBitmap(this, "enable_ams", 16);
img_amsmapping_tip = new wxStaticBitmap(m_scrollable_region, wxID_ANY, enable_ams_mapping->bmp(), wxDefaultPosition, wxSize(FromDIP(16), FromDIP(16)), 0);
m_sizer_material_tips->Add(img_amsmapping_tip, 0, wxALIGN_CENTER | wxLEFT, FromDIP(5));
/*bed type*/
auto m_text_bed_type = new Label(m_basic_panel, "Plate: Textured PEI");
m_text_bed_type->SetFont(Label::Body_13);
img_amsmapping_tip->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) {
wxPoint img_pos = img_amsmapping_tip->ClientToScreen(wxPoint(0, 0));
wxPoint popup_pos(img_pos.x, img_pos.y + img_amsmapping_tip->GetRect().height);
m_mapping_tutorial_popup.Position(popup_pos, wxSize(0, 0));
m_mapping_tutorial_popup.Popup();
if (m_mapping_tutorial_popup.ClientToScreen(wxPoint(0, 0)).y < img_pos.y) {
m_mapping_tutorial_popup.Dismiss();
popup_pos = wxPoint(img_pos.x, img_pos.y - m_mapping_tutorial_popup.GetRect().height);
m_mapping_tutorial_popup.Position(popup_pos, wxSize(0, 0));
m_mapping_tutorial_popup.Popup();
}
});
img_amsmapping_tip->Bind(wxEVT_LEAVE_WINDOW, [this](wxMouseEvent& e) {
m_mapping_tutorial_popup.Dismiss();
});
m_sizer_material = new wxGridSizer(0, 4, 0, FromDIP(5));
/*last & next page*/
m_sizer_material_area->Add(m_sizer_material_tips, 0, wxALIGN_CENTER|wxLEFT, FromDIP(8));
m_sizer_material_area->Add(m_sizer_material, 0, wxLEFT, FromDIP(15));
auto last_plate_sizer = new wxBoxSizer(wxVERTICAL);
m_bitmap_last_plate = new wxStaticBitmap(m_basic_panel, wxID_ANY, create_scaled_bitmap("go_last_plate", this, 25), wxDefaultPosition, wxSize(FromDIP(25), FromDIP(25)), 0);
last_plate_sizer->Add(m_bitmap_last_plate, 0, wxALIGN_CENTER, 0);
m_sizer_backup = new wxBoxSizer(wxHORIZONTAL);
auto next_plate_sizer = new wxBoxSizer(wxVERTICAL);
m_bitmap_next_plate = new wxStaticBitmap(m_basic_panel, wxID_ANY, create_scaled_bitmap("go_next_plate", this, 25), wxDefaultPosition, wxSize(FromDIP(25), FromDIP(25)), 0);
next_plate_sizer->Add(m_bitmap_next_plate, 0, wxALIGN_CENTER, 0);
sizer_rename->Add(m_rename_switch_panel, 0, wxALIGN_CENTER, 0);
sizer_rename->Add(0, 0, 0, wxEXPAND, 0);
sizer_rename->Add(m_bitmap_last_plate, 0, wxALIGN_CENTER, 0);
sizer_rename->Add(m_bitmap_next_plate, 0, wxALIGN_CENTER, 0);
/*printer combobox*/
wxBoxSizer* m_sizer_printer = new wxBoxSizer(wxHORIZONTAL);
wxBoxSizer* sizer_split_printer = new wxBoxSizer(wxHORIZONTAL);
m_stext_printer_title = new Label(m_basic_panel, _L("Printer"));
m_stext_printer_title->SetFont(::Label::Body_14);
m_stext_printer_title->SetForegroundColour(0x909090);
auto m_split_line = new wxPanel(m_basic_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
m_split_line->SetBackgroundColour(0xeeeeee);
m_split_line->SetMinSize(wxSize(-1, 1));
m_split_line->SetMaxSize(wxSize(-1, 1));
sizer_split_printer->Add(0, 0, 0, wxEXPAND, 0);
sizer_split_printer->Add(m_stext_printer_title, 0, wxALIGN_CENTER, 0);
sizer_split_printer->Add(m_split_line, 1, wxALIGN_CENTER_VERTICAL, 0);
m_comboBox_printer = new ::ComboBox(m_basic_panel, wxID_ANY, "", wxDefaultPosition, wxSize(FromDIP(300), -1), 0, nullptr, wxCB_READONLY);
m_comboBox_printer->SetMinSize(wxSize(FromDIP(300), -1));
m_comboBox_printer->SetMaxSize(wxSize(FromDIP(300), -1));
m_comboBox_printer->Bind(wxEVT_COMBOBOX, &SelectMachineDialog::on_selection_changed, this);
m_btn_bg_enable = StateColor(std::pair<wxColour, int>(wxColour(27, 136, 68), StateColor::Pressed), std::pair<wxColour, int>(wxColour(61, 203, 115), StateColor::Hovered),
std::pair<wxColour, int>(wxColour(0, 174, 66), StateColor::Normal));
m_button_refresh = new Button(m_basic_panel, _L("Refresh"));
m_button_refresh->SetBackgroundColor(m_btn_bg_enable);
m_button_refresh->SetBorderColor(m_btn_bg_enable);
m_button_refresh->SetTextColor(StateColor::darkModeColorFor("#FFFFFE"));
m_button_refresh->SetSize(SELECT_MACHINE_DIALOG_BUTTON_SIZE);
m_button_refresh->SetMinSize(SELECT_MACHINE_DIALOG_BUTTON_SIZE);
m_button_refresh->SetCornerRadius(FromDIP(10));
m_button_refresh->Bind(wxEVT_BUTTON, &SelectMachineDialog::on_refresh, this);
m_sizer_printer->Add(m_comboBox_printer, 0, wxEXPAND, 0);
m_sizer_printer->Add(m_button_refresh, 0, wxALL | wxLEFT, FromDIP(5));
m_text_printer_msg = new wxStaticText(m_basic_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
m_text_printer_msg->SetMinSize(wxSize(FromDIP(420), -1));
m_text_printer_msg->SetMaxSize(wxSize(FromDIP(420), -1));
m_text_printer_msg->SetFont(::Label::Body_13);
m_text_printer_msg->Hide();
sizer_basic_right_info->Add(sizer_rename, 0, wxTOP, 0);
sizer_basic_right_info->Add(0, 0, 0, wxTOP, FromDIP(5));
sizer_basic_right_info->Add(m_sizer_basic_weight_time, 0, wxTOP, 0);
sizer_basic_right_info->Add(0, 0, 0, wxTOP, FromDIP(10));
sizer_basic_right_info->Add(m_text_bed_type, 0, wxTOP, 0);
sizer_basic_right_info->Add(0, 0, 0, wxTOP, FromDIP(15));
sizer_basic_right_info->Add(sizer_split_printer, 1, wxEXPAND, 0);
sizer_basic_right_info->Add(0, 0, 0, wxTOP, FromDIP(8));
sizer_basic_right_info->Add(m_sizer_printer, 0, wxTOP, 0);
sizer_basic_right_info->Add(0, 0, 0, wxTOP, FromDIP(4));
sizer_basic_right_info->Add(m_text_printer_msg, 0, wxLEFT, 0);
m_basicl_sizer->Add(m_sizer_thumbnail_area, 0, wxLEFT, 0);
m_basicl_sizer->Add(0, 0, 0, wxLEFT, FromDIP(8));
m_basicl_sizer->Add(sizer_basic_right_info, 0, wxLEFT, 0);
m_basic_panel->SetSizer(m_basicl_sizer);
m_basic_panel->Layout();
/*filaments info*/
wxBoxSizer* sizer_split_filament = new wxBoxSizer(wxHORIZONTAL);
auto m_stext_filament_title = new Label(this, _L("Filament"));
m_stext_filament_title->SetFont(::Label::Body_14);
m_stext_filament_title->SetForegroundColour(0x909090);
auto m_split_line_filament = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1, 1), wxTAB_TRAVERSAL);
m_split_line_filament->SetBackgroundColour(0xeeeeee);
m_split_line_filament->SetMinSize(wxSize(-1, 1));
m_split_line_filament->SetMaxSize(wxSize(-1, 1));
m_sizer_autorefill = new wxBoxSizer(wxHORIZONTAL);
m_ams_backup_tip = new Label(this, _L("Auto Refill"));
m_ams_backup_tip->SetFont(::Label::Head_12);
m_ams_backup_tip->SetForegroundColour(wxColour(0x009688));
@@ -1157,9 +1216,9 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
img_ams_backup = new wxStaticBitmap(this, wxID_ANY, create_scaled_bitmap("automatic_material_renewal", this, 16), wxDefaultPosition, wxSize(FromDIP(16), FromDIP(16)), 0);
img_ams_backup->SetBackgroundColour(*wxWHITE);
m_sizer_backup->Add(0, 0, 1, wxEXPAND, 0);
m_sizer_backup->Add(img_ams_backup, 0, wxALL, FromDIP(3));
m_sizer_backup->Add(m_ams_backup_tip, 0, wxTOP, FromDIP(5));
m_sizer_autorefill->Add(0, 0, 1, wxEXPAND, 0);
m_sizer_autorefill->Add(img_ams_backup, 0, wxALL, FromDIP(3));
m_sizer_autorefill->Add(m_ams_backup_tip, 0, wxTOP, FromDIP(5));
m_ams_backup_tip->Hide();
img_ams_backup->Hide();
@@ -1170,71 +1229,135 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
m_ams_backup_tip->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) {SetCursor(wxCURSOR_ARROW); });
img_ams_backup->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) {SetCursor(wxCURSOR_ARROW); });
m_ams_backup_tip->Bind(wxEVT_LEFT_DOWN, [this](auto& e) { if (!m_is_in_sending_mode) {popup_filament_backup(); on_rename_enter();} });
img_ams_backup->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {if (!m_is_in_sending_mode) popup_filament_backup();on_rename_enter(); });
m_ams_backup_tip->Bind(wxEVT_LEFT_DOWN, [this](auto& e) { if (!m_is_in_sending_mode) { popup_filament_backup(); on_rename_enter(); } });
img_ams_backup->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {if (!m_is_in_sending_mode) popup_filament_backup(); on_rename_enter(); });
sizer_split_filament->Add(0, 0, 0, wxEXPAND, 0);
sizer_split_filament->Add(m_stext_filament_title, 0, wxALIGN_CENTER, 0);
sizer_split_filament->Add(m_split_line_filament, 1, wxALIGN_CENTER_VERTICAL, 0);
sizer_split_filament->Add(m_sizer_autorefill, 0, wxALIGN_CENTER, 0);
//wxBoxSizer* m_sizer_ams_mapping_tips = new wxBoxSizer(wxHORIZONTAL);
/* ams_mapping_help_icon = new ScalableBitmap(this, "enable_ams", 16);
img_amsmapping_tip = new wxStaticBitmap(this, wxID_ANY, ams_mapping_help_icon->bmp(), wxDefaultPosition, wxSize(FromDIP(16), FromDIP(16)), 0);
m_sizer_ams_mapping_tips->Add(img_amsmapping_tip, 0, wxALIGN_CENTER | wxLEFT, FromDIP(5));
img_amsmapping_tip->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) {
wxPoint img_pos = img_amsmapping_tip->ClientToScreen(wxPoint(0, 0));
wxPoint popup_pos(img_pos.x, img_pos.y + img_amsmapping_tip->GetRect().height);
m_mapping_tutorial_popup.Position(popup_pos, wxSize(0, 0));
m_mapping_tutorial_popup.Popup();
if (m_mapping_tutorial_popup.ClientToScreen(wxPoint(0, 0)).y < img_pos.y) {
m_mapping_tutorial_popup.Dismiss();
popup_pos = wxPoint(img_pos.x, img_pos.y - m_mapping_tutorial_popup.GetRect().height);
m_mapping_tutorial_popup.Position(popup_pos, wxSize(0, 0));
m_mapping_tutorial_popup.Popup();
}
});
img_amsmapping_tip->Bind(wxEVT_LEAVE_WINDOW, [this](wxMouseEvent& e) {
m_mapping_tutorial_popup.Dismiss();
});
m_sizer_filament->Add(m_sizer_ams_mapping_tips, 0, wxALIGN_CENTER|wxLEFT, FromDIP(8));*/
/*filament area*/
/*1 extruder*/
m_filament_panel = new wxPanel(this, wxID_ANY);
m_filament_panel->SetBackgroundColour(wxColour(0xf8f8f8));
m_filament_panel->SetMinSize(wxSize(FromDIP(637), -1));
m_filament_panel->SetMaxSize(wxSize(FromDIP(637), -1));
m_filament_panel_sizer = new wxBoxSizer(wxVERTICAL);
m_sizer_ams_mapping = new wxGridSizer(0, 10, FromDIP(7), FromDIP(7));
m_filament_panel_sizer->Add(m_sizer_ams_mapping, 0, wxEXPAND|wxALL, FromDIP(10));
m_filament_panel->SetSizer(m_filament_panel_sizer);
m_filament_panel->Layout();
m_filament_panel->Fit();
/*left & right extruder*/
m_sizer_filament_2extruder = new wxBoxSizer(wxHORIZONTAL);
m_filament_left_panel = new wxPanel(this, wxID_ANY);
m_filament_right_panel = new wxPanel(this, wxID_ANY);
m_filament_left_panel->SetBackgroundColour(wxColour(0xf8f8f8));
m_filament_right_panel->SetBackgroundColour(wxColour(0xf8f8f8));
m_filament_left_panel->SetMinSize(wxSize(FromDIP(315), 180));
m_filament_left_panel->SetMaxSize(wxSize(FromDIP(315), 180));
m_filament_right_panel->SetMinSize(wxSize(FromDIP(315), 180));
m_filament_right_panel->SetMaxSize(wxSize(FromDIP(315), 180));
m_filament_panel_left_sizer = new wxBoxSizer(wxVERTICAL);
m_sizer_ams_mapping_left = new wxGridSizer(0, 5, FromDIP(7), FromDIP(7));
m_filament_panel_left_sizer->Add(m_sizer_ams_mapping_left, 0, wxEXPAND | wxALL, FromDIP(10));
m_filament_left_panel->SetSizer(m_filament_panel_left_sizer);
m_filament_left_panel->Layout();
m_filament_left_panel->Fit();
m_filament_panel_right_sizer = new wxBoxSizer(wxVERTICAL);
m_sizer_ams_mapping_right = new wxGridSizer(0, 5, FromDIP(7), FromDIP(7));
m_filament_panel_right_sizer->Add(m_sizer_ams_mapping_right, 0, wxEXPAND | wxALL, FromDIP(10));
m_filament_right_panel->SetSizer(m_filament_panel_right_sizer);
m_filament_right_panel->Layout();
m_filament_right_panel->Fit();
m_sizer_filament_2extruder->Add(m_filament_left_panel, 0, wxALIGN_CENTER, 0);
m_sizer_filament_2extruder->Add(0, 0, 0, wxLEFT, FromDIP(7));
m_sizer_filament_2extruder->Add(m_filament_right_panel, 0, wxALIGN_CENTER, 0);
m_sizer_filament_2extruder->Layout();
m_filament_left_panel->Hide();
m_filament_right_panel->Hide();
m_statictext_ams_msg = new wxStaticText(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_HORIZONTAL);
m_statictext_ams_msg->SetFont(::Label::Body_13);
m_statictext_ams_msg->Hide();
m_line_materia = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1, 1), wxTAB_TRAVERSAL);
m_line_materia->SetForegroundColour(wxColour(238, 238, 238));
m_line_materia->SetBackgroundColour(wxColour(238, 238, 238));
wxBoxSizer *m_sizer_printer = new wxBoxSizer(wxHORIZONTAL);
m_stext_printer_title = new wxStaticText(this, wxID_ANY, _L("Printer"), wxDefaultPosition, wxSize(-1, -1), 0);
m_stext_printer_title->SetFont(::Label::Head_14);
m_stext_printer_title->Wrap(-1);
m_stext_printer_title->SetForegroundColour(m_colour_bold_color);
m_stext_printer_title->SetBackgroundColour(m_colour_def_color);
/*options*/
wxBoxSizer* sizer_split_options = new wxBoxSizer(wxHORIZONTAL);
auto m_stext_options_title = new Label(this, _L("Print Options"));
m_stext_options_title->SetFont(::Label::Body_14);
m_stext_options_title->SetForegroundColour(0x909090);
auto m_split_options_line = new wxPanel(this, wxID_ANY);
m_split_options_line->SetBackgroundColour(0xeeeeee);
m_split_options_line->SetSize(wxSize(-1, FromDIP(1)));
m_split_options_line->SetMinSize(wxSize(-1, FromDIP(1)));
m_split_options_line->SetMaxSize(wxSize(-1, FromDIP(1)));
sizer_split_options->Add(0, 0, 0, wxEXPAND, 0);
sizer_split_options->Add(m_stext_options_title, 0, wxALIGN_CENTER, 0);
sizer_split_options->Add(m_split_options_line, 1, wxALIGN_CENTER_VERTICAL, 0);
m_sizer_printer->Add(m_stext_printer_title, 0, wxALL | wxLEFT, FromDIP(5));
m_sizer_printer->Add(0, 0, 0, wxEXPAND | wxLEFT, FromDIP(12));
m_comboBox_printer = new ::ComboBox(this, wxID_ANY, "", wxDefaultPosition, wxSize(FromDIP(250), -1), 0, nullptr, wxCB_READONLY);
m_comboBox_printer->Bind(wxEVT_COMBOBOX, &SelectMachineDialog::on_selection_changed, this);
m_sizer_printer->Add(m_comboBox_printer, 1, wxEXPAND | wxRIGHT, FromDIP(5));
m_btn_bg_enable = StateColor(std::pair<wxColour, int>(wxColour(0, 137, 123), StateColor::Pressed), std::pair<wxColour, int>(wxColour(38, 166, 154), StateColor::Hovered),
std::pair<wxColour, int>(wxColour(0, 150, 136), StateColor::Normal));
m_button_refresh = new Button(this, _L("Refresh"));
m_button_refresh->SetBackgroundColor(m_btn_bg_enable);
m_button_refresh->SetBorderColor(m_btn_bg_enable);
m_button_refresh->SetTextColor(StateColor::darkModeColorFor("#FFFFFE"));
m_button_refresh->SetSize(SELECT_MACHINE_DIALOG_BUTTON_SIZE);
m_button_refresh->SetMinSize(SELECT_MACHINE_DIALOG_BUTTON_SIZE);
m_button_refresh->SetCornerRadius(FromDIP(10));
m_button_refresh->Bind(wxEVT_BUTTON, &SelectMachineDialog::on_refresh, this);
m_sizer_printer->Add(m_button_refresh, 0, wxALL | wxLEFT, FromDIP(5));
m_statictext_printer_msg = new wxStaticText(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_HORIZONTAL);
m_statictext_printer_msg->SetFont(::Label::Body_13);
m_statictext_printer_msg->Hide();
//m_sizer_select = new wxGridSizer(0, 2, 0, 0);
m_sizer_select = new wxWrapSizer();
m_sizer_options = new wxBoxSizer(wxHORIZONTAL);
select_bed = create_item_checkbox(_L("Bed Leveling"), this, _L("Bed Leveling"), "bed_leveling");
select_flow = create_item_checkbox(_L("Flow Dynamics Calibration"), this, _L("Flow Dynamics Calibration"), "flow_cali");
select_timelapse = create_item_checkbox(_L("Timelapse"), this, _L("Timelapse"), "timelapse");
select_use_ams = create_ams_checkbox(_L("Enable AMS"), this, _L("Enable AMS"));
m_sizer_select->Add(select_bed, 0, wxLEFT | wxRIGHT, WRAP_GAP);
m_sizer_select->Add(select_flow, 0, wxLEFT | wxRIGHT, WRAP_GAP);
m_sizer_select->Add(select_timelapse, 0, wxLEFT | wxRIGHT, WRAP_GAP);
m_sizer_select->Add(select_use_ams, 0, wxLEFT | wxRIGHT, WRAP_GAP);
m_sizer_options->Add(select_bed, 0, wxLEFT | wxRIGHT, WRAP_GAP);
m_sizer_options->Add(select_flow, 0, wxLEFT | wxRIGHT, WRAP_GAP);
m_sizer_options->Add(select_timelapse, 0, wxLEFT | wxRIGHT, WRAP_GAP);
m_sizer_options->Add(select_use_ams, 0, wxLEFT | wxRIGHT, WRAP_GAP);
select_bed->Show(false);
select_flow->Show(false);
select_timelapse->Show(false);
select_use_ams->Show(false);
m_sizer_select->Layout();
m_sizer_options->Layout();
// line schedule
m_line_schedule = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1, 1));
m_line_schedule->SetBackgroundColour(wxColour(238, 238, 238));
m_simplebook = new wxSimplebook(this, wxID_ANY, wxDefaultPosition, SELECT_MACHINE_DIALOG_SIMBOOK_SIZE, 0);
@@ -1259,7 +1382,7 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
m_button_ensure->SetSize(SELECT_MACHINE_DIALOG_BUTTON_SIZE);
m_button_ensure->SetMinSize(SELECT_MACHINE_DIALOG_BUTTON_SIZE);
m_button_ensure->SetMinSize(SELECT_MACHINE_DIALOG_BUTTON_SIZE);
m_button_ensure->SetCornerRadius(FromDIP(12));
m_button_ensure->SetCornerRadius(FromDIP(5));
m_button_ensure->Bind(wxEVT_BUTTON, &SelectMachineDialog::on_ok_btn, this);
m_sizer_pcont->Add(0, 0, 1, wxEXPAND, 0);
@@ -1384,37 +1507,25 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
sizer_print_failed_info->Add(0, 0, 0, wxTOP, FromDIP(3));
sizer_print_failed_info->Add(sizer_extra_info, 0, wxLEFT, 5);
m_sizer_scrollable_region->Add(m_rename_switch_panel, 0, wxALIGN_CENTER_HORIZONTAL, 0);
m_sizer_scrollable_region->Add(0, 0, 0, wxTOP, FromDIP(8));
m_sizer_scrollable_region->Add(m_sizer_thumbnail_area, 0, wxALIGN_CENTER_HORIZONTAL, 0);
m_sizer_scrollable_region->Add(0, 0, 0, wxTOP, FromDIP(10));
m_sizer_scrollable_region->Add(m_sizer_basic, 0, wxALIGN_CENTER_HORIZONTAL, 0);
//m_sizer_scrollable_region->Add(m_sizer_material, 0, wxALIGN_CENTER_HORIZONTAL, 0);
m_sizer_scrollable_region->Add(m_sizer_material_area, 0, wxLEFT, FromDIP(10));
//m_basic_panel_sizer->Add(m_sizer_material_area, 0, wxLEFT, FromDIP(10));
m_scrollable_region->SetSizer(m_sizer_scrollable_region);
m_scrollable_region->Layout();
m_scrollable_view->SetSizer(m_sizer_scrollable_view);
m_scrollable_view->Layout();
m_sizer_scrollable_view->Add(m_scrollable_region, 0, wxEXPAND, 0);
m_sizer_main->Add(m_line_top, 0, wxEXPAND, 0);
m_sizer_main->Add(0, 0, 0, wxTOP, FromDIP(13));
m_sizer_main->Add(m_scrollable_view, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT, FromDIP(25));
m_sizer_main->Add(m_sizer_backup, 0, wxALIGN_CENTER_HORIZONTAL, 0);
m_sizer_main->Add(0, 0, 0, wxTOP, FromDIP(12));
m_sizer_main->Add(m_basic_panel, 0, wxEXPAND|wxLEFT|wxRIGHT, FromDIP(15));
m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(14));
m_sizer_main->Add(sizer_split_filament, 1, wxEXPAND|wxLEFT|wxRIGHT, FromDIP(15));
m_sizer_main->Add(m_filament_panel, 0, wxALIGN_CENTER|wxLEFT|wxRIGHT, FromDIP(15));
m_sizer_main->Add(m_sizer_filament_2extruder, 0, wxALIGN_CENTER|wxLEFT|wxRIGHT, FromDIP(15));
m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(6));
m_sizer_main->Add(m_statictext_ams_msg, 0, wxALIGN_CENTER_HORIZONTAL, 0);
m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(6));
m_sizer_main->Add(m_line_materia, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(30));
m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(12));
m_sizer_main->Add(m_sizer_printer, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(30));
m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(11));
m_sizer_main->Add(m_statictext_printer_msg, 0, wxALIGN_CENTER_HORIZONTAL, 0);
m_sizer_main->Add(0, 1, 0, wxTOP, FromDIP(16));
m_sizer_main->Add(m_sizer_select, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT, FromDIP(30));
m_sizer_main->Add(0, 1, 0, wxTOP, FromDIP(10));
m_sizer_main->Add(m_line_schedule, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(30));
m_sizer_main->Add(m_statictext_ams_msg, 0, wxLEFT, 0);
m_sizer_main->Add(0, 0, 0, wxTOP, FromDIP(16));
m_sizer_main->Add(sizer_split_options, 1, wxEXPAND|wxLEFT|wxRIGHT, FromDIP(15));
m_sizer_main->Add(m_sizer_options, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT| wxRIGHT, FromDIP(15));
m_sizer_main->Add(0, 0, 0, wxTOP, FromDIP(10));
m_sizer_main->Add(m_simplebook, 0, wxALIGN_CENTER_HORIZONTAL, 0);
m_sizer_main->Add(m_sw_print_failed_info, 0, wxALIGN_CENTER, 0);
m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(18));
@@ -1442,7 +1553,7 @@ void SelectMachineDialog::init_bind()
Bind(EVT_SET_FINISH_MAPPING, &SelectMachineDialog::on_set_finish_mapping, this);
Bind(wxEVT_LEFT_DOWN, [this](auto& e) {check_fcous_state(this);e.Skip();});
m_panel_prepare->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {check_fcous_state(this);e.Skip();});
m_scrollable_region->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {check_fcous_state(this);e.Skip();});
m_basic_panel->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {check_fcous_state(this);e.Skip();});
m_bitmap_last_plate->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) {SetCursor(wxCURSOR_HAND); });
m_bitmap_last_plate->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) {SetCursor(wxCURSOR_ARROW); });
m_bitmap_next_plate->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) {SetCursor(wxCURSOR_HAND); });
@@ -1695,7 +1806,7 @@ void SelectMachineDialog::update_select_layout(MachineObject *obj)
select_timelapse->Hide();
}
m_sizer_select->Layout();
m_sizer_options->Layout();
Layout();
Fit();
}
@@ -1923,8 +2034,14 @@ bool SelectMachineDialog::get_ams_mapping_result(std::string &mapping_array_str,
/*new ams mapping data*/
mapping_item_v1["ams_id"] = m_ams_mapping_result[k].ams_id;
mapping_item_v1["slot_id"] = m_ams_mapping_result[k].slot_id;
try
{
mapping_item_v1["ams_id"] = std::stoi(m_ams_mapping_result[k].ams_id);
mapping_item_v1["slot_id"] = std::stoi(m_ams_mapping_result[k].slot_id);
}
catch (...)
{
}
}
}
mapping_v0_json.push_back(tray_id);
@@ -1985,12 +2102,12 @@ void SelectMachineDialog::update_ams_status_msg(wxString msg, bool is_warning)
void SelectMachineDialog::update_priner_status_msg(wxString msg, bool is_warning)
{
auto colour = is_warning ? wxColour(0xFF, 0x6F, 0x00) : wxColour(0x6B, 0x6B, 0x6B);
m_statictext_printer_msg->SetForegroundColour(colour);
m_text_printer_msg->SetForegroundColour(colour);
if (msg.empty()) {
if (!m_statictext_printer_msg->GetLabel().empty()) {
m_statictext_printer_msg->SetLabel(wxEmptyString);
m_statictext_printer_msg->Hide();
if (!m_text_printer_msg->GetLabel().empty()) {
m_text_printer_msg->SetLabel(wxEmptyString);
m_text_printer_msg->Hide();
Layout();
Fit();
}
@@ -2000,16 +2117,16 @@ void SelectMachineDialog::update_priner_status_msg(wxString msg, bool is_warning
auto str_new = msg.utf8_string();
stripWhiteSpace(str_new);
auto str_old = m_statictext_printer_msg->GetLabel().utf8_string();
auto str_old = m_text_printer_msg->GetLabel().utf8_string();
stripWhiteSpace(str_old);
if (str_new != str_old) {
if (m_statictext_printer_msg->GetLabel() != msg) {
m_statictext_printer_msg->SetLabel(msg);
m_statictext_printer_msg->SetMinSize(wxSize(FromDIP(400), -1));
m_statictext_printer_msg->SetMaxSize(wxSize(FromDIP(400), -1));
m_statictext_printer_msg->Wrap(FromDIP(400));
m_statictext_printer_msg->Show();
if (m_text_printer_msg->GetLabel() != msg) {
m_text_printer_msg->SetLabel(msg);
m_text_printer_msg->SetMinSize(wxSize(FromDIP(420), -1));
m_text_printer_msg->SetMaxSize(wxSize(FromDIP(420), -1));
m_text_printer_msg->Wrap(FromDIP(420));
m_text_printer_msg->Show();
Layout();
Fit();
}
@@ -2962,7 +3079,7 @@ void SelectMachineDialog::on_set_finish_mapping(wxCommandEvent &evt)
BOOST_LOG_TRIVIAL(info) << "The ams mapping selection result: data is " << selection_data;
if (selection_data_arr.size() == 6) {
if (selection_data_arr.size() == 8) {
auto ams_colour = wxColour(wxAtoi(selection_data_arr[0]), wxAtoi(selection_data_arr[1]), wxAtoi(selection_data_arr[2]), wxAtoi(selection_data_arr[3]));
int old_filament_id = (int) wxAtoi(selection_data_arr[5]);
if (m_print_type == PrintFromType::FROM_NORMAL) {//todo:support sd card
@@ -2994,6 +3111,9 @@ void SelectMachineDialog::on_set_finish_mapping(wxCommandEvent &evt)
m_ams_mapping_result[i].color = color.ToStdString();
m_ams_mapping_result[i].ctype = ctype;
m_ams_mapping_result[i].colors = tray_cols;
m_ams_mapping_result[i].ams_id = selection_data_arr[6].ToStdString();
m_ams_mapping_result[i].slot_id = selection_data_arr[7].ToStdString();
}
BOOST_LOG_TRIVIAL(trace) << "The ams mapping result: id is " << m_ams_mapping_result[i].id << "tray_id is " << m_ams_mapping_result[i].tray_id;
}
@@ -3181,7 +3301,7 @@ void SelectMachineDialog::update_user_printer()
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "for send task, current printer id = " << m_printer_last_select << std::endl;
}
void SelectMachineDialog::on_rename_click(wxCommandEvent& event)
void SelectMachineDialog::on_rename_click(wxMouseEvent& event)
{
m_is_rename_mode = true;
m_rename_input->GetTextCtrl()->SetValue(m_current_project_name);
@@ -3768,11 +3888,10 @@ void SelectMachineDialog::on_dpi_changed(const wxRect &suggested_rect)
timeimg->SetBitmap(print_time->bmp());
print_weight->msw_rescale();
weightimg->SetBitmap(print_weight->bmp());
m_rename_button->msw_rescale();
ams_editable->msw_rescale();
ams_editable_light->msw_rescale();
enable_ams_mapping->msw_rescale();
img_amsmapping_tip->SetBitmap(enable_ams_mapping->bmp());
rename_editable->msw_rescale();
rename_editable_light->msw_rescale();
ams_mapping_help_icon->msw_rescale();
img_amsmapping_tip->SetBitmap(ams_mapping_help_icon->bmp());
enable_ams->msw_rescale();
img_use_ams_tip->SetBitmap(enable_ams->bmp());
@@ -4006,8 +4125,8 @@ void SelectMachineDialog::reset_and_sync_ams_list()
delete item;
iter++;
}
m_sizer_material->Clear();
m_sizer_ams_mapping->Clear();
m_materialList.clear();
m_filaments.clear();
@@ -4020,8 +4139,8 @@ void SelectMachineDialog::reset_and_sync_ams_list()
auto colour_rgb = wxColour((int) rgb[0], (int) rgb[1], (int) rgb[2], (int) rgb[3]);
if (extruder >= materials.size() || extruder < 0 || extruder >= display_materials.size()) continue;
MaterialItem *item = new MaterialItem(m_scrollable_region, colour_rgb, _L(display_materials[extruder]));
m_sizer_material->Add(item, 0, wxALL, FromDIP(4));
MaterialItem *item = new MaterialItem(m_filament_panel, colour_rgb, _L(display_materials[extruder]));
m_sizer_ams_mapping->Add(item, 0, wxALL, FromDIP(5));
item->Bind(wxEVT_LEFT_UP, [this, item, materials, extruder](wxMouseEvent &e) {});
item->Bind(wxEVT_LEFT_DOWN, [this, item, materials, extruder](wxMouseEvent &e) {
@@ -4078,12 +4197,16 @@ void SelectMachineDialog::reset_and_sync_ams_list()
}
}
if (extruders.size() <= 4) {
m_sizer_material->SetCols(extruders.size());
} else {
m_sizer_material->SetCols(4);
/*if (extruders.size() <= 10) {
m_sizer_ams_mapping->SetCols(extruders.size());
}
else {
m_sizer_ams_mapping->SetCols(10);
}*/
m_sizer_ams_mapping->SetCols(8);
m_sizer_ams_mapping->Layout();
m_filament_panel_sizer->Layout();
// reset_ams_material();//show "-"
}
@@ -4354,16 +4477,12 @@ void SelectMachineDialog::set_default_normal(const ThumbnailData &data)
image.SetAlpha((int)c, (int)r, px[3]);
}
}
image = image.Rescale(FromDIP(256), FromDIP(256));
image = image.Rescale(FromDIP(198), FromDIP(198));
m_thumbnailPanel->set_thumbnail(image);
}
m_scrollable_region->Layout();
m_scrollable_region->Fit();
m_scrollable_view->SetSize(m_scrollable_region->GetSize());
m_scrollable_view->SetMinSize(m_scrollable_region->GetSize());
m_scrollable_view->SetMaxSize(m_scrollable_region->GetSize());
m_basic_panel->Layout();
m_basic_panel->Fit();
//disable pei bed
DeviceManager* dev_manager = Slic3r::GUI::wxGetApp().getDeviceManager();
@@ -4375,16 +4494,7 @@ void SelectMachineDialog::set_default_normal(const ThumbnailData &data)
auto dialogSize = this->GetSize();
#ifdef __WINDOWS__
if (screenSize.GetHeight() < dialogSize.GetHeight()) {
m_need_adaptation_screen = true;
m_scrollable_view->SetScrollRate(0, 5);
m_scrollable_view->SetSize(wxSize(-1, FromDIP(220)));
m_scrollable_view->SetMinSize(wxSize(-1, FromDIP(220)));
m_scrollable_view->SetMaxSize(wxSize(-1, FromDIP(220)));
}
else {
m_scrollable_view->SetScrollRate(0, 0);
}
#endif // __WXOSX_MAC__
// basic info
auto aprint_stats = m_plater->get_partplate_list().get_current_fff_print().print_statistics();
@@ -4416,7 +4526,7 @@ void SelectMachineDialog::set_default_from_sdcard()
if (data.pixels.size() > 0) {
wxMemoryInputStream mis((unsigned char*)data.pixels.data(), data.pixels.size());
wxImage image = wxImage(mis);
image = image.Rescale(FromDIP(256), FromDIP(256));
image = image.Rescale(FromDIP(198), FromDIP(198));
m_thumbnailPanel->set_thumbnail(image);
}
@@ -4443,7 +4553,7 @@ void SelectMachineDialog::set_default_from_sdcard()
}
m_ams_mapping_result.clear();
m_sizer_material->Clear();
m_sizer_ams_mapping->Clear();
m_materialList.clear();
m_filaments.clear();
@@ -4451,8 +4561,8 @@ void SelectMachineDialog::set_default_from_sdcard()
for (auto i = 0; i < m_required_data_plate_data_list[m_print_plate_idx]->slice_filaments_info.size(); i++) {
FilamentInfo fo = m_required_data_plate_data_list[m_print_plate_idx]->slice_filaments_info[i];
MaterialItem* item = new MaterialItem(m_scrollable_region, wxColour(fo.color), fo.type);
m_sizer_material->Add(item, 0, wxALL, FromDIP(4));
MaterialItem* item = new MaterialItem(m_filament_panel, wxColour(fo.color), fo.type);
m_sizer_ams_mapping->Add(item, 0, wxALL, FromDIP(5));
item->Bind(wxEVT_LEFT_UP, [this, item, materials](wxMouseEvent& e) {});
item->Bind(wxEVT_LEFT_DOWN, [this, item, materials, fo](wxMouseEvent& e) {
@@ -4509,38 +4619,21 @@ void SelectMachineDialog::set_default_from_sdcard()
}
if (m_required_data_plate_data_list[m_print_plate_idx]->slice_filaments_info.size() <= 4) {
m_sizer_material->SetCols(m_required_data_plate_data_list[m_print_plate_idx]->slice_filaments_info.size());
m_sizer_ams_mapping->SetCols(m_required_data_plate_data_list[m_print_plate_idx]->slice_filaments_info.size());
}
else {
m_sizer_material->SetCols(4);
m_sizer_ams_mapping->SetCols(4);
}
m_scrollable_region->Layout();
m_scrollable_region->Fit();
m_basic_panel->Layout();
m_basic_panel->Fit();
m_scrollable_view->SetSize(m_scrollable_region->GetSize());
m_scrollable_view->SetMinSize(m_scrollable_region->GetSize());
m_scrollable_view->SetMaxSize(m_scrollable_region->GetSize());
set_flow_calibration_state(true);
wxSize screenSize = wxGetDisplaySize();
auto dialogSize = this->GetSize();
#ifdef __WINDOWS__
if (screenSize.GetHeight() < dialogSize.GetHeight()) {
m_need_adaptation_screen = true;
m_scrollable_view->SetScrollRate(0, 5);
m_scrollable_view->SetSize(wxSize(-1, FromDIP(220)));
m_scrollable_view->SetMinSize(wxSize(-1, FromDIP(220)));
m_scrollable_view->SetMaxSize(wxSize(-1, FromDIP(220)));
}
else {
m_scrollable_view->SetScrollRate(0, 0);
}
#endif // __WXOSX_MAC__
reset_ams_material();
// basic info
@@ -4559,32 +4652,32 @@ void SelectMachineDialog::set_default_from_sdcard()
void SelectMachineDialog::update_page_turn_state(bool show)
{
m_bitmap_last_plate->Show(show);
m_bitmap_next_plate->Show(show);
/* m_bitmap_last_plate->Show(show);
m_bitmap_next_plate->Show(show);
if (show) {
if (m_print_plate_idx <= 0) { m_bitmap_last_plate->Hide(); }
else { m_bitmap_last_plate->Show(); }
if (show) {
if (m_print_plate_idx <= 0) { m_bitmap_last_plate->Hide(); }
else { m_bitmap_last_plate->Show(); }
if ((m_print_plate_idx + 1) >= m_print_plate_total) { m_bitmap_next_plate->Hide(); }
else { m_bitmap_next_plate->Show(); }
if ((m_print_plate_idx + 1) >= m_print_plate_total) { m_bitmap_next_plate->Hide(); }
else { m_bitmap_next_plate->Show(); }
if (m_print_plate_total == 1) {
m_bitmap_last_plate->Show(false);
m_bitmap_next_plate->Show(false);
}
}
if (m_print_plate_total == 1) {
m_bitmap_last_plate->Show(false);
m_bitmap_next_plate->Show(false);
}
}*/
}
void SelectMachineDialog::sys_color_changed()
{
if (wxGetApp(). dark_mode()) {
//rename_button->SetIcon("ams_editable_light");
m_rename_button->SetBitmap(ams_editable_light->bmp());
m_rename_button->SetBitmap(rename_editable_light->bmp());
}
else {
m_rename_button->SetBitmap(ams_editable->bmp());
m_rename_button->SetBitmap(rename_editable->bmp());
}
m_rename_button->Refresh();
}