From eaeac42b19b322f56b501c0d2ce99c4a6b2fd050 Mon Sep 17 00:00:00 2001 From: "zhou.xu" Date: Mon, 6 Jan 2025 16:38:30 +0800 Subject: [PATCH] FIX:add mode for syscAMsInfoDialog jira: none Change-Id: Iabfc9953f86cd08a2357a9197d6e1afe8d781d9f --- src/libslic3r/AppConfig.cpp | 2 +- src/slic3r/GUI/AmsMappingPopup.cpp | 20 +- src/slic3r/GUI/AmsMappingPopup.hpp | 1 + src/slic3r/GUI/PartPlate.cpp | 2 +- src/slic3r/GUI/Plater.cpp | 17 +- src/slic3r/GUI/SelectMachine.cpp | 2 +- src/slic3r/GUI/SyncAmsInfoDialog.cpp | 400 ++++++++++++++++++++------- src/slic3r/GUI/SyncAmsInfoDialog.hpp | 48 +++- src/slic3r/GUI/Tab.cpp | 7 +- src/slic3r/GUI/Tab.hpp | 2 +- 10 files changed, 376 insertions(+), 125 deletions(-) diff --git a/src/libslic3r/AppConfig.cpp b/src/libslic3r/AppConfig.cpp index 5a4f298fd..23c6037c5 100644 --- a/src/libslic3r/AppConfig.cpp +++ b/src/libslic3r/AppConfig.cpp @@ -170,7 +170,7 @@ void AppConfig::set_defaults() set_bool("reverse_mouse_wheel_zoom", false); #endif if (get("enable_append_color_by_sync_ams").empty()) - set_bool("enable_append_color_by_sync_ams", true); + set_bool("enable_append_color_by_sync_ams", false); if (get("enable_merge_color_by_sync_ams").empty()) set_bool("enable_merge_color_by_sync_ams", true); diff --git a/src/slic3r/GUI/AmsMappingPopup.cpp b/src/slic3r/GUI/AmsMappingPopup.cpp index 70212547c..5f1365e96 100644 --- a/src/slic3r/GUI/AmsMappingPopup.cpp +++ b/src/slic3r/GUI/AmsMappingPopup.cpp @@ -24,7 +24,7 @@ #include "BindDialog.hpp" namespace Slic3r { namespace GUI { -#define MATERIAL_ITEM_SIZE wxSize(FromDIP(52), FromDIP(50)) +#define MATERIAL_ITEM_SIZE wxSize(FromDIP(65), FromDIP(50)) #define MATERIAL_REC_WHEEL_SIZE wxSize(FromDIP(17), FromDIP(16)) #define MAPPING_ITEM_REAL_SIZE wxSize(FromDIP(60), FromDIP(60)) wxDEFINE_EVENT(EVT_SET_FINISH_MAPPING, wxCommandEvent); @@ -182,7 +182,8 @@ void MaterialItem::render(wxDC &dc) dc.SetTextForeground(StateColor::darkModeColorFor(wxColour(0x26, 0x2E, 0x30))); dc.SetFont(::Label::Head_12); - dc.DrawText(mapping_txt, wxPoint(GetSize().x / 2 + (GetSize().x / 2 - mapping_txt_size.x) / 2 - FromDIP(2), ((float)GetSize().y * 3 / 5 - mapping_txt_size.y) / 2 + (float)GetSize().y * 2 / 5)); + 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)); } @@ -274,15 +275,14 @@ void MaterialItem::doRender(wxDC& dc) dc.DrawRoundedRectangle(0, 0, MATERIAL_ITEM_SIZE.x, MATERIAL_ITEM_SIZE.y, 5); } #endif - //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), size.y - m_arraw_bitmap_white.GetBmpSize().y); + if (m_text_pos_y > 0) { + // 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)); + } else { + dc.DrawBitmap(m_arraw_bitmap_gray.bmp(), size.x - m_arraw_bitmap_gray.GetBmpSize().x - FromDIP(2), m_text_pos_y + FromDIP(3)); + } } - else { - dc.DrawBitmap(m_arraw_bitmap_gray.bmp(), size.x - m_arraw_bitmap_gray.GetBmpSize().x - FromDIP(2), size.y - m_arraw_bitmap_gray.GetBmpSize().y); - }*/ - //wheel dc.DrawBitmap(m_ams_wheel_mitem.bmp(), (GetSize().x / 2 - m_ams_wheel_mitem.GetBmpSize().x) / 2 + FromDIP(3), ((float)GetSize().y * 0.6 - m_ams_wheel_mitem.GetBmpSize().y) / 2 + (float)GetSize().y * 0.4); diff --git a/src/slic3r/GUI/AmsMappingPopup.hpp b/src/slic3r/GUI/AmsMappingPopup.hpp index 0a6b0b983..7187552da 100644 --- a/src/slic3r/GUI/AmsMappingPopup.hpp +++ b/src/slic3r/GUI/AmsMappingPopup.hpp @@ -71,6 +71,7 @@ struct TrayData class MaterialItem: public wxPanel { + int m_text_pos_y = -1; public: MaterialItem(wxWindow *parent,wxColour mcolour, wxString mname); ~MaterialItem(); diff --git a/src/slic3r/GUI/PartPlate.cpp b/src/slic3r/GUI/PartPlate.cpp index 0a6b839f1..2d1898f69 100644 --- a/src/slic3r/GUI/PartPlate.cpp +++ b/src/slic3r/GUI/PartPlate.cpp @@ -4043,7 +4043,7 @@ PartPlate* PartPlateList::get_plate(int index) { PartPlate* plate = NULL; - if (index >= m_plate_list.size()) + if (index >= m_plate_list.size() || index < 0) { BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(":can not find index %1%, size %2%") % index % m_plate_list.size(); return NULL; diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 37e2e919d..66c351276 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -2756,7 +2756,18 @@ void Sidebar::sync_ams_list() temp_info.connected_printer = true; temp_info.first_sync = ams_filament_ids.empty(); SyncAmsInfoDialog sync_dlg(this, temp_info); - auto dlg_res = sync_dlg.ShowModal(); + int dlg_res{(int) wxID_CANCEL}; + if (sync_dlg.is_need_show()) { + if (sync_dlg.is_dirty_filament()){ + wxGetApp().get_tab(Preset::TYPE_FILAMENT)->select_preset(wxGetApp().preset_bundle->filament_presets[0], false, "", false, true); + wxGetApp().preset_bundle->export_selections(*wxGetApp().app_config); + dynamic_filament_list.update(); + } + sync_dlg.set_check_dirty_fialment(false); + dlg_res = sync_dlg.ShowModal(); + } else { + dlg_res =(int) wxID_YES; + } if (dlg_res == wxID_CANCEL) return; auto sync_result = sync_dlg.get_result(); @@ -2801,9 +2812,9 @@ void Sidebar::sync_ams_list() wxGetApp().plater()->on_filaments_change(n); for (auto& c : p->combos_filament) c->update(); - wxGetApp().get_tab(Preset::TYPE_FILAMENT)->select_preset(wxGetApp().preset_bundle->filament_presets[0]); + /*wxGetApp().get_tab(Preset::TYPE_FILAMENT)->select_preset(wxGetApp().preset_bundle->filament_presets[0]); wxGetApp().preset_bundle->export_selections(*wxGetApp().app_config); - dynamic_filament_list.update(); + dynamic_filament_list.update();*/ // Expand filament list p->m_panel_filament_content->SetMaxSize({-1, -1}); // BBS:Synchronized consumables information diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp index 7325be056..45b3675d2 100644 --- a/src/slic3r/GUI/SelectMachine.cpp +++ b/src/slic3r/GUI/SelectMachine.cpp @@ -3742,7 +3742,7 @@ void SelectMachineDialog::reset_and_sync_ams_list() item = new MaterialItem(m_filament_panel, colour_rgb, _L(display_materials[extruder])); m_sizer_ams_mapping->Add(item, 0, wxALL, FromDIP(5)); } - + item->SetToolTip(_L("Top half of combobox: Original\nDown half of combobox: Filament of AMS\nAnd you can click it to modify")); item->Bind(wxEVT_LEFT_UP, [this, item, materials, extruder](wxMouseEvent &e) {}); item->Bind(wxEVT_LEFT_DOWN, [this, item, materials, extruder](wxMouseEvent &e) { MaterialHash::iterator iter = m_materialList.begin(); diff --git a/src/slic3r/GUI/SyncAmsInfoDialog.cpp b/src/slic3r/GUI/SyncAmsInfoDialog.cpp index e83ed6c81..4de4677e9 100644 --- a/src/slic3r/GUI/SyncAmsInfoDialog.cpp +++ b/src/slic3r/GUI/SyncAmsInfoDialog.cpp @@ -13,7 +13,8 @@ #include "Widgets/TextInput.hpp" #include "Notebook.hpp" #include - +#include "Widgets/Button.hpp" +#include "CapsuleButton.hpp" using namespace Slic3r; using namespace Slic3r::GUI; @@ -24,7 +25,7 @@ namespace Slic3r { namespace GUI { wxDEFINE_EVENT(EVT_CLEAR_IPADDRESS, wxCommandEvent); wxDEFINE_EVENT(EVT_UPDATE_USER_MACHINE_LIST, wxCommandEvent); wxDEFINE_EVENT(EVT_PRINT_JOB_CANCEL, wxCommandEvent); - +#define SYNC_FLEX_GRID_COL 7 bool SyncAmsInfoDialog::Show(bool show) { if (show) { @@ -88,26 +89,39 @@ bool SyncAmsInfoDialog::Show(bool show) //print_time->Hide(); hide_no_use_controls(); } - if (!m_input_info.connected_printer || m_is_empty_project) { - show_sizer(m_plate_combox_sizer, false); - show_sizer(m_sizer_two_image, false); - m_filament_panel->Hide();//empty_project - m_filament_left_panel->Hide();//empty_project - m_filament_right_panel->Hide(); - m_tip_text->Hide(); - m_specify_color_cluster_title->Hide(); - m_are_you_sure_title->Hide(); - m_append_color_checkbox->Hide(); - m_merge_color_checkbox->Hide(); + bool dirty_filament = is_dirty_filament(); + if (!m_input_info.connected_printer || m_is_empty_project || dirty_filament) { + show_color_panel(false); + m_filament_left_panel->Show(false); // empty_project + m_filament_right_panel->Show(false); + m_are_you_sure_title->Show(false); + if (m_mode_combox_sizer) { + m_mode_combox_sizer->Show(false); + } } if (!m_input_info.connected_printer) { m_button_cancel->Hide(); - m_confirm_title->SetLabel(_L("No AMS filaments. Please select a printer in 'Device' page to load AMS info.")); - m_confirm_title->SetForegroundColour(wxColour(250, 10, 10, 255)); - } - else if (m_is_empty_project) { - m_confirm_title->SetLabel(_L("The current project is empty, do you want to directly map AMS materials?")); - m_confirm_title->SetForegroundColour(wxColour(0, 0, 0, 255)); + m_confirm_title->Show(); + m_confirm_title->SetLabel(_L("Printer not connected. Please connect or choose a printer on the Device page and try again.")); + SetMinSize(wxSize(FromDIP(700), -1)); + SetMaxSize(wxSize(FromDIP(700), -1)); + // m_confirm_title->SetForegroundColour(wxColour(250, 10, 10, 255)); + } else if (dirty_filament) { + m_confirm_title->Show(); + m_confirm_title->SetLabel(_L("Synchronizing AMS filaments will discard your modified but unsaved filament presets.\nAre you sure you want to continue?")); + SetMinSize(wxSize(FromDIP(700), -1)); + SetMaxSize(wxSize(FromDIP(700), -1)); + } else if (!m_check_dirty_fialment) { + show_color_panel(true); + m_filament_left_panel->Show(false); // empty_project + m_filament_right_panel->Show(false); + m_are_you_sure_title->Show(true); + if (m_mode_combox_sizer) { + m_mode_combox_sizer->Show(true); + } + m_confirm_title->SetLabel(_L("After sync, all currently configured filament presets and colors will be discarded.")); + SetMinSize(wxSize(SyncAmsInfoDialogWidth, -1)); + SetMaxSize(wxSize(SyncAmsInfoDialogWidth, -1)); } Layout(); Fit(); @@ -117,11 +131,15 @@ bool SyncAmsInfoDialog::Show(bool show) 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); + show_sizer(m_sizer_line, true); show_sizer(m_sizer_two_image, true); + m_attention_text->Show(); m_tip_text->Show(); - m_specify_color_cluster_title->Show(); + //m_specify_color_cluster_title->Show(); m_button_cancel->Show(); } @@ -225,11 +243,11 @@ void SyncAmsInfoDialog::set_default_normal(const ThumbnailData &data) m_right_image_button->SetBitmap(image); auto extruders = wxGetApp().plater()->get_partplate_list().get_plate(m_specify_plate_idx)->get_extruders(); if (wxGetApp().plater()->get_extruders_colors().size() == extruders.size()) { - m_used_colors_tip_text->Hide(); + //m_used_colors_tip_text->Hide(); } else { - m_used_colors_tip_text->Show(); - m_used_colors_tip_text->SetLabel(" (" + std::to_string(extruders.size()) + " " + _L("colors used") + ")"); + //m_used_colors_tip_text->Show(); + //m_used_colors_tip_text->SetLabel(" (" + std::to_string(extruders.size()) + " " + _L("colors used") + ")"); } } // disable pei bed @@ -250,7 +268,13 @@ bool SyncAmsInfoDialog::is_must_finish_slice_then_connected_printer() { void SyncAmsInfoDialog::update_printer_name() { if (m_printer_title) { - m_printer_title->SetLabel(_L("Printer:") + m_printer_name); + m_printer_device_name->SetLabel(m_printer_name); + if (!m_is_same_printer && m_printer_title->IsShown()) { + m_printer_is_map_title->Show(); + } + else { + m_printer_is_map_title->Show(false); + } Layout(); } } @@ -281,6 +305,10 @@ void SyncAmsInfoDialog::show_sizer(wxSizer *sizer, bool show) void SyncAmsInfoDialog::deal_ok() { if (m_input_info.connected_printer && !m_is_empty_project) { + if (m_map_mode == MapModeEnum::Override) { + m_is_empty_project = true; + return; + } m_result.direct_sync = false; m_result.sync_maps.clear(); for (size_t i = 0; i < m_ams_mapping_result.size(); i++) { @@ -299,20 +327,39 @@ bool SyncAmsInfoDialog::get_is_double_extruder() return use_double_extruder; } +bool SyncAmsInfoDialog::is_dirty_filament() { + PresetCollection *m_presets = &wxGetApp().preset_bundle->filaments; + if (m_check_dirty_fialment && m_presets && m_presets->get_edited_preset().is_dirty) { + return true; + } + return false; +} + +bool SyncAmsInfoDialog::is_need_show() +{ + if (!m_input_info.connected_printer) { + return true; + } + if (m_is_empty_project && !is_dirty_filament()) { + return false; + } + return true; +} + wxBoxSizer *SyncAmsInfoDialog::create_sizer_thumbnail(wxButton *image_button, bool left) { auto sizer_thumbnail = new wxBoxSizer(wxVERTICAL); sizer_thumbnail->Add(image_button, 0, wxALIGN_CENTER, 0); if (left) { wxBoxSizer *text_sizer = new wxBoxSizer(wxHORIZONTAL); - auto sync_text = new wxStaticText(this, wxID_ANY, _L("Current effect")); + auto sync_text = new wxStaticText(this, wxID_ANY, _L("Original")); sync_text->SetForegroundColour(wxColour(107, 107, 107, 100)); text_sizer->Add(sync_text, 0, wxALIGN_CENTER | wxALL, 0); sizer_thumbnail->Add(sync_text, FromDIP(0), wxALIGN_CENTER | wxALL, FromDIP(4)); } else { wxBoxSizer *text_sizer = new wxBoxSizer(wxHORIZONTAL); - auto sync_text = new wxStaticText(this, wxID_ANY, _L("Using AMS filaments effect")); + auto sync_text = new wxStaticText(this, wxID_ANY, _L("After mapping")); sync_text->SetForegroundColour(wxColour(107, 107, 107, 100)); text_sizer->Add(sync_text, 0, wxALIGN_CENTER | wxALL, 0); sizer_thumbnail->Add(sync_text, FromDIP(0), wxALIGN_CENTER | wxALL, FromDIP(4)); @@ -332,6 +379,117 @@ void SyncAmsInfoDialog::update_when_change_plate(int idx) { on_selection_changed(empty); } +void SyncAmsInfoDialog::update_when_change_map_mode(int idx) +{ + m_map_mode = (MapModeEnum) idx; + if (m_map_mode == MapModeEnum::ColorMap) { + m_are_you_sure_title->SetLabel(_L("Are you sure to synchronize according to the current effect?")); + show_color_panel(true); + } else if (m_map_mode == MapModeEnum::Override) { + m_are_you_sure_title->SetLabel(_L("Are you sure to directly override current filaments?")); + show_color_panel(false); + } +} + +void SyncAmsInfoDialog::update_when_change_map_mode(wxCommandEvent &e) +{ + int win_id = e.GetId(); + auto mode = PageType(win_id); + update_panel_status(mode); + update_when_change_map_mode(mode); +} + +void SyncAmsInfoDialog::update_panel_status(PageType page) +{ + std::vector button_list = {m_colormap_btn, m_override_btn}; + for (auto p : button_list) { + if (p && p->IsSelected()) { + p->Select(false); + } + } + for (size_t i = 0; i < button_list.size(); i++) { + if (i == int(page)) { + button_list[i]->Select(true); + break; + } + } +} + +void SyncAmsInfoDialog::show_color_panel(bool flag) { + show_sizer(m_plate_combox_sizer, flag); + if (m_sizer_line) { + show_sizer(m_sizer_line, flag); + } + show_sizer(m_sizer_two_image, flag); + + m_filament_panel->Show(flag); // empty_project + + m_attention_text->Show(flag); + m_tip_text->Show(flag); + m_more_setting_tips->Show(flag); + + if (!flag) { + m_append_color_checkbox->Show(false); + m_merge_color_checkbox->Show(false); + } + else { + update_more_setting(); + } + m_confirm_title->Show(flag); + if (flag) { + auto extruders = wxGetApp().plater()->get_partplate_list().get_plate(m_specify_plate_idx)->get_extruders(); + /*if (wxGetApp().plater()->get_extruders_colors().size() != extruders.size()) { + m_used_colors_tip_text->Show(); + }*/ + } else { + //m_used_colors_tip_text->Hide(); + } + update_printer_name(); + Layout(); + Fit(); +} + +void SyncAmsInfoDialog::update_more_setting(bool layout) +{ + m_append_color_checkbox->Show(m_expand_more_settings); + m_merge_color_checkbox->Show(m_expand_more_settings); + + if (layout) { + Layout(); + Fit(); + } +} + +void SyncAmsInfoDialog::add_two_image_control() +{// thumbnail + m_sizer_two_image = new wxBoxSizer(wxHORIZONTAL); + int left_right_gap = 70; + m_sizer_two_image->AddSpacer(FromDIP(left_right_gap)); + m_left_image_button = new wxButton(this, wxID_ANY, {}, wxDefaultPosition, wxSize(FromDIP(THUMBNAIL_SIZE_WIDTH), FromDIP(THUMBNAIL_SIZE_WIDTH)), wxBORDER_NONE | wxBU_AUTODRAW); + // m_left_image_button->SetBitmap(image); + m_left_image_button->SetCanFocus(false); + m_right_image_button = new wxButton(this, wxID_ANY, {}, wxDefaultPosition, wxSize(FromDIP(THUMBNAIL_SIZE_WIDTH), FromDIP(THUMBNAIL_SIZE_WIDTH)), + wxBORDER_NONE | wxBU_AUTODRAW); + // m_left_image_button->SetBitmap(image); + m_right_image_button->SetCanFocus(false); + + m_left_sizer_thumbnail = create_sizer_thumbnail(m_left_image_button, true); + m_sizer_two_image->Add(m_left_sizer_thumbnail, FromDIP(0), wxALIGN_LEFT | wxEXPAND | wxTOP, FromDIP(2)); + + /* wxBoxSizer *arrow_sizer = new wxBoxSizer(wxVERTICAL); + auto sync_text = new wxStaticText(this, wxID_ANY, _L("Synchronization")); + sync_text->SetForegroundColour(wxColour(107, 107, 107, 100)); + arrow_sizer->Add(sync_text, 0, wxALIGN_CENTER | wxALL, 0); + auto arrow_text = new wxStaticText(this, wxID_ANY, _L("--------------->")); + arrow_text->SetForegroundColour(wxColour(107, 107, 107, 100)); + arrow_sizer->Add(arrow_text, 0, wxALIGN_CENTER | wxALL, 0); + m_sizer_two_image->Add(arrow_sizer, FromDIP(0), wxALIGN_CENTER | wxLEFT | wxRIGHT, FromDIP(20));*/ + m_sizer_two_image->AddStretchSpacer(); + m_right_sizer_thumbnail = create_sizer_thumbnail(m_right_image_button, false); + m_sizer_two_image->Add(m_right_sizer_thumbnail, FromDIP(0), wxALIGN_RIGHT | wxEXPAND, FromDIP(0)); + m_sizer_two_image->AddSpacer(FromDIP(left_right_gap)); + m_sizer_main->Add(m_sizer_two_image, FromDIP(0), wxALIGN_LEFT | wxEXPAND | wxTOP, FromDIP(10)); +} SyncAmsInfoDialog::SyncAmsInfoDialog(wxWindow *parent, SyncInfo &info) : DPIDialog(static_cast(wxGetApp().mainframe), wxID_ANY, _L("Ams filaments synchronization"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX) @@ -376,7 +534,7 @@ SyncAmsInfoDialog::SyncAmsInfoDialog(wxWindow *parent, SyncInfo &info) : m_line_top = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1, 1), wxTAB_TRAVERSAL); m_line_top->SetBackgroundColour(wxColour(166, 169, 170)); m_sizer_main->Add(m_line_top, 0, wxEXPAND, 0); - m_sizer_main->Add(0, 0, 0, wxTOP, FromDIP(11)); + //m_sizer_main->Add(0, 0, 0, wxTOP, FromDIP(11)); auto &bSizer = m_sizer_main; { // content GUI::PartPlateList &plate_list = wxGetApp().plater()->get_partplate_list(); @@ -394,14 +552,30 @@ SyncAmsInfoDialog::SyncAmsInfoDialog(wxWindow *parent, SyncInfo &info) : } } if (m_is_empty_project == false) { + //use map mode + m_mode_combox_sizer = new wxBoxSizer(wxHORIZONTAL); + m_colormap_btn = new CapsuleButton(this, PageType::ptColorMap, _L("Maping"), true); + m_override_btn = new CapsuleButton(this, PageType::ptOverride, _L("Overwriting"), false); + m_mode_combox_sizer->AddSpacer(FromDIP(25)); + m_mode_combox_sizer->AddStretchSpacer(); + m_mode_combox_sizer->Add(m_colormap_btn, 0, wxALIGN_CENTER | wxEXPAND | wxALL, FromDIP(2)); + m_mode_combox_sizer->AddSpacer(FromDIP(8)); + m_mode_combox_sizer->Add(m_override_btn, 0, wxALIGN_CENTER | wxEXPAND | wxALL, FromDIP(2)); + m_mode_combox_sizer->AddStretchSpacer(); + + m_colormap_btn->Bind(wxEVT_BUTTON, &SyncAmsInfoDialog::update_when_change_map_mode,this); // update_when_change_map_mode(e.GetSelection()); + m_override_btn->Bind(wxEVT_BUTTON, &SyncAmsInfoDialog::update_when_change_map_mode,this); + + bSizer->Add(m_mode_combox_sizer, FromDIP(0), wxEXPAND | wxALIGN_LEFT | wxTOP, FromDIP(10)); m_specify_plate_idx = GUI::wxGetApp().plater()->get_partplate_list().get_curr_plate_index(); { // choose camera view angle type m_plate_combox_sizer = new wxBoxSizer(wxHORIZONTAL); - wxStaticText *combox_title = new wxStaticText(this, wxID_ANY, _L("Choose plate:")); - m_plate_combox_sizer->Add(combox_title, 0, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxEXPAND | wxTOP, FromDIP(2)); + m_plate_combox_sizer->AddSpacer(FromDIP(25)); + wxStaticText *chose_combox_title = new wxStaticText(this, wxID_ANY, _L("Plate")); + m_plate_combox_sizer->Add(chose_combox_title, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxEXPAND | wxTOP, FromDIP(6)); - wxStaticText *space_title = new wxStaticText(this, wxID_ANY, " "); - m_plate_combox_sizer->Add(space_title, FromDIP(0), wxALIGN_CENTER | wxALL, FromDIP(0)); + wxStaticText *space_title = new wxStaticText(this, wxID_ANY, " "); + m_plate_combox_sizer->Add(space_title, FromDIP(0), wxALIGN_LEFT | wxALL, FromDIP(0)); auto cur_combox = new ComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(FromDIP(50), -1), 0, NULL, wxCB_READONLY); for (size_t i = 0; i < choices.size(); i++) { @@ -419,54 +593,41 @@ SyncAmsInfoDialog::SyncAmsInfoDialog(wxWindow *parent, SyncInfo &info) : Fit(); } }); - m_plate_combox_sizer->Add(cur_combox, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxEXPAND | wxBOTTOM, FromDIP(5)); + m_plate_combox_sizer->Add(cur_combox, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM, FromDIP(3)); m_plate_combox_sizer->AddStretchSpacer(1); // m_plate_combox_sizer->AddSpacer(FromDIP(230)); - m_printer_title = new wxStaticText(this, wxID_ANY, _L("Printer:")); - //m_printer_title->SetForegroundColour(wxColour(242, 0, 10, 255)); - m_plate_combox_sizer->Add(m_printer_title, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxEXPAND | wxTOP, FromDIP(2)); + m_printer_title = new wxStaticText(this, wxID_ANY, _L("Printer") + ": "); + m_printer_title->SetForegroundColour(wxColour(107, 107, 107, 100)); + m_plate_combox_sizer->Add(m_printer_title, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxEXPAND | wxTOP , FromDIP(6)); + m_printer_device_name = new wxStaticText(this, wxID_ANY, ""); + m_plate_combox_sizer->Add(m_printer_device_name, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxEXPAND | wxTOP, FromDIP(6)); + m_printer_is_map_title = new wxStaticText(this, wxID_ANY, " " + _L("(Inconsistent)")); + // m_printer_is_map_title->SetBackgroundColour(wxColour(38, 46, 48, 255)); + m_printer_is_map_title->SetForegroundColour(wxColour(255, 111, 0, 255)); + m_printer_is_map_title->SetToolTip(_L("The device printer and the currently selected printer are not consistent. It is recommended to be consistent.")); + + m_plate_combox_sizer->Add(m_printer_is_map_title, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxEXPAND | wxTOP, FromDIP(6)); + m_plate_combox_sizer->AddSpacer(FromDIP(25)); - bSizer->Add(m_plate_combox_sizer, FromDIP(0), wxEXPAND |wxALIGN_LEFT | wxLEFT, FromDIP(25)); - } - { // thumbnail - m_sizer_two_image = new wxBoxSizer(wxHORIZONTAL); - - m_left_image_button = new wxButton(this, wxID_ANY, {}, wxDefaultPosition, wxSize(FromDIP(THUMBNAIL_SIZE_WIDTH), FromDIP(THUMBNAIL_SIZE_WIDTH)), - wxBORDER_NONE | wxBU_AUTODRAW); - //m_left_image_button->SetBitmap(image); - m_left_image_button->SetCanFocus(false); - m_right_image_button = new wxButton(this, wxID_ANY, {}, wxDefaultPosition, wxSize(FromDIP(THUMBNAIL_SIZE_WIDTH), FromDIP(THUMBNAIL_SIZE_WIDTH)), - wxBORDER_NONE | wxBU_AUTODRAW); - // m_left_image_button->SetBitmap(image); - m_right_image_button->SetCanFocus(false); - - m_left_sizer_thumbnail = create_sizer_thumbnail(m_left_image_button, true); - m_sizer_two_image->Add(m_left_sizer_thumbnail, FromDIP(0), wxALIGN_LEFT | wxLEFT, FromDIP(0)); - - wxBoxSizer *arrow_sizer = new wxBoxSizer(wxVERTICAL); - auto sync_text = new wxStaticText(this, wxID_ANY, _L("synchronization")); - sync_text->SetForegroundColour(wxColour(107, 107, 107, 100)); - arrow_sizer->Add(sync_text, 0, wxALIGN_CENTER | wxALL, 0); - auto arrow_text = new wxStaticText(this, wxID_ANY, _L("--------------->")); - arrow_text->SetForegroundColour(wxColour(107, 107, 107, 100)); - arrow_sizer->Add(arrow_text, 0, wxALIGN_CENTER | wxALL, 0); - m_sizer_two_image->Add(arrow_sizer, FromDIP(0), wxALIGN_CENTER | wxLEFT | wxRIGHT, FromDIP(20)); - - m_right_sizer_thumbnail = create_sizer_thumbnail(m_right_image_button, false); - m_sizer_two_image->Add(m_right_sizer_thumbnail, FromDIP(0), wxALIGN_LEFT | wxLEFT, FromDIP(2)); - - bSizer->Add(m_sizer_two_image, FromDIP(0), wxALIGN_LEFT | wxLEFT, FromDIP(25)); + bSizer->Add(m_plate_combox_sizer, FromDIP(0), wxEXPAND |wxALIGN_LEFT | wxBOTTOM, FromDIP(8)); + + m_sizer_line = new wxBoxSizer(wxVERTICAL); + auto staticline1 = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1, 1), wxTAB_TRAVERSAL); + staticline1->SetBackgroundColour(wxColour(224, 224, 224, 100)); + m_sizer_line->Add(staticline1, 0, wxEXPAND | wxBOTTOM, FromDIP(8)); + bSizer->Add(m_sizer_line, FromDIP(0), wxEXPAND | wxLEFT | wxRIGHT, FromDIP(25)); } + //add_two_image_control(); } - wxBoxSizer * snyc_ship_boxsizer = new wxBoxSizer(wxHORIZONTAL); - m_specify_color_cluster_title = new wxStaticText(this, wxID_ANY, _L("The synchronization correspondence is as follows:")); - //m_specify_color_cluster_title->SetFont(Label::Head_14); - snyc_ship_boxsizer->Add(m_specify_color_cluster_title, 0, wxALIGN_LEFT | wxTOP | wxBOTTOM, FromDIP(5)); - m_used_colors_tip_text = new wxStaticText(this, wxID_ANY, _L("colors used.")); - m_used_colors_tip_text->SetForegroundColour(wxColour(107, 107, 107, 100)); - m_used_colors_tip_text->Hide(); - snyc_ship_boxsizer->Add(m_used_colors_tip_text, 0, wxALIGN_LEFT | wxTOP| wxBOTTOM, FromDIP(5)); - bSizer->Add(snyc_ship_boxsizer, FromDIP(0), wxALIGN_LEFT | wxLEFT, FromDIP(25)); + // wxBoxSizer * snyc_ship_boxsizer = new wxBoxSizer(wxHORIZONTAL); + // m_specify_color_cluster_title = new wxStaticText(this, wxID_ANY, _L("The synchronization correspondence is as follows:")); + // //m_specify_color_cluster_title->SetFont(Label::Head_14); + // snyc_ship_boxsizer->Add(m_specify_color_cluster_title, 0, wxALIGN_LEFT | wxTOP | wxBOTTOM, FromDIP(5)); + ///* m_used_colors_tip_text = new wxStaticText(this, wxID_ANY, _L("colors used.")); + // m_used_colors_tip_text->SetForegroundColour(wxColour(107, 107, 107, 100));*/ + // m_used_colors_tip_text->Hide(); + // snyc_ship_boxsizer->Add(m_used_colors_tip_text, 0, wxALIGN_LEFT | wxTOP| wxBOTTOM, FromDIP(5)); + // bSizer->Add(snyc_ship_boxsizer, FromDIP(0), wxALIGN_LEFT | wxLEFT, FromDIP(25)); } m_basic_panel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL); @@ -694,14 +855,14 @@ SyncAmsInfoDialog::SyncAmsInfoDialog(wxWindow *parent, SyncInfo &info) : /*filament area*/ /*1 extruder*/ m_filament_panel = new StaticBox(this); - m_filament_panel->SetBackgroundColour(wxColour(0xF8F8F8)); + //m_filament_panel->SetBackgroundColour(wxColour(0xF8F8F8)); m_filament_panel->SetBorderWidth(0); 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 | wxLEFT , FromDIP(10)); + m_sizer_ams_mapping = new wxFlexGridSizer(0, SYNC_FLEX_GRID_COL, FromDIP(6), FromDIP(7)); + m_filament_panel_sizer->Add(m_sizer_ams_mapping, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(10)); m_filament_panel->SetSizer(m_filament_panel_sizer); m_filament_panel->Layout(); m_filament_panel->Fit(); @@ -996,42 +1157,58 @@ SyncAmsInfoDialog::SyncAmsInfoDialog(wxWindow *parent, SyncInfo &info) : m_sizer_main->Add(m_sw_print_failed_info, 0, wxALIGN_CENTER, 0);*/ {//new content//tip confirm ok button - wxBoxSizer *tip_sizer = new wxBoxSizer(wxVERTICAL); - m_tip_text = new wxStaticText(this, wxID_ANY, _L("Tip: Click to modify the matching relationship.")); + wxBoxSizer *tip_sizer = new wxBoxSizer(wxHORIZONTAL); + m_attention_text = new wxStaticText(this, wxID_ANY, _L("Attention") + ": "); + tip_sizer->Add(m_attention_text, 0, wxALIGN_LEFT | wxTOP, FromDIP(2)); + m_tip_text = new wxStaticText(this, wxID_ANY, _L("The mapping only influences filament type and color,without AMS slot information.")); m_tip_text->SetForegroundColour(wxColour(107, 107, 107, 100)); tip_sizer->Add(m_tip_text, 0, wxALIGN_LEFT | wxTOP, FromDIP(2)); - m_append_color_checkbox = new wxCheckBox(this, wxID_ANY, _L("enable append color"), wxDefaultPosition, wxDefaultSize, 0); - m_append_color_checkbox->SetToolTip(_L("when you click ok button,it will append unmapped color.")); - m_append_color_checkbox->SetForegroundColour(wxColour(107, 107, 107, 100)); + bSizer->Add(tip_sizer, 0, wxEXPAND | wxLEFT, FromDIP(25)); + + add_two_image_control(); + + wxBoxSizer * more_setting_sizer = new wxBoxSizer(wxVERTICAL); + m_more_setting_tips = new wxStaticText(this, wxID_ANY, _L("Advanced settings >")); + m_more_setting_tips->SetForegroundColour(wxColour(0, 174, 100)); + m_more_setting_tips->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { + m_expand_more_settings = !m_expand_more_settings; + update_more_setting(); + }); + more_setting_sizer->Add(m_more_setting_tips, 0, wxALIGN_LEFT | wxTOP, FromDIP(4)); + + m_append_color_checkbox = new wxCheckBox(this, wxID_ANY, _L("Unmatched AMS filaments should also be synchronized into thhe filaments list"), wxDefaultPosition, wxDefaultSize, 0); + m_append_color_checkbox->SetToolTip(_L("When you click ok button,it will append unmapped color.")); + //m_append_color_checkbox->SetForegroundColour(wxColour(107, 107, 107, 100)); m_append_color_checkbox->SetValue(wxGetApp().app_config->get_bool("enable_append_color_by_sync_ams")); m_append_color_checkbox->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent &e) { auto flag = wxGetApp().app_config->get_bool("enable_append_color_by_sync_ams"); wxGetApp().app_config->set_bool("enable_append_color_by_sync_ams",!flag); }); - tip_sizer->Add(m_append_color_checkbox, 0, wxALIGN_LEFT | wxTOP, FromDIP(2)); + m_append_color_checkbox->Hide(); + more_setting_sizer->Add(m_append_color_checkbox, 0, wxALIGN_LEFT | wxTOP, FromDIP(4)); - m_merge_color_checkbox = new wxCheckBox(this, wxID_ANY, _L("merge same ams to only one color"), wxDefaultPosition, wxDefaultSize, 0); - m_merge_color_checkbox->SetToolTip(_L("when you click ok button,it will merge same ams to only one color.")); - m_merge_color_checkbox->SetForegroundColour(wxColour(107, 107, 107, 100)); + m_merge_color_checkbox = new wxCheckBox(this, wxID_ANY, _L("Automatically merge the same colors in the model after matching"), wxDefaultPosition, wxDefaultSize, 0); + m_merge_color_checkbox->SetToolTip(_L("When you click ok button,it will merge same ams to only one color.")); + //m_merge_color_checkbox->SetForegroundColour(wxColour(107, 107, 107, 100)); m_merge_color_checkbox->SetValue(wxGetApp().app_config->get_bool("enable_merge_color_by_sync_ams")); m_merge_color_checkbox->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent &e) { auto flag = wxGetApp().app_config->get_bool("enable_merge_color_by_sync_ams"); wxGetApp().app_config->set_bool("enable_merge_color_by_sync_ams",!flag); }); - tip_sizer->Add(m_merge_color_checkbox, 0, wxALIGN_LEFT | wxTOP, FromDIP(2)); + m_merge_color_checkbox->Hide(); + more_setting_sizer->Add(m_merge_color_checkbox, 0, wxALIGN_LEFT | wxTOP, FromDIP(2)); - bSizer->Add(tip_sizer, 0, wxEXPAND | wxLEFT, FromDIP(25)); + bSizer->Add(more_setting_sizer, 0, wxEXPAND | wxLEFT, FromDIP(25)); wxBoxSizer *confirm_boxsizer = new wxBoxSizer(wxVERTICAL); m_confirm_title = new wxStaticText(this, wxID_ANY, - _L("After sync, all currently configured filament presets and colors will be discarded."), + _L("All of your configured filament presets and colors will discarded after sync."), wxDefaultPosition, wxDefaultSize); //m_confirm_title->Wrap(FromDIP(SyncAmsInfoDialogWidth - 50)); //m_confirm_title->SetFont(Label::Head_14); - confirm_boxsizer->Add(m_confirm_title, 0, wxALIGN_LEFT | wxTOP, FromDIP(10)); - m_are_you_sure_title = new wxStaticText( - this, wxID_ANY,_L("Are you sure to synchronize according to the current effect?")); + confirm_boxsizer->Add(m_confirm_title, 0, wxALIGN_LEFT | wxTOP | wxRIGHT, FromDIP(10)); + m_are_you_sure_title = new wxStaticText(this, wxID_ANY,_L("Are you sure to synchronize the filament?")); //m_are_you_sure_title->SetFont(Label::Head_14); confirm_boxsizer->Add(m_are_you_sure_title, 0, wxALIGN_LEFT | wxTOP, FromDIP(0)); bSizer->Add(confirm_boxsizer, 0, wxALIGN_LEFT | wxLEFT, FromDIP(25)); @@ -1829,7 +2006,11 @@ bool SyncAmsInfoDialog::has_tips(MachineObject *obj) void SyncAmsInfoDialog::show_status(PrintDialogStatus status, std::vector params) { - if (m_print_status != status) BOOST_LOG_TRIVIAL(info) << "select_machine_dialog: show_status = " << status << "(" << get_print_status_info(status) << ")"; + if (m_print_status != status) { + m_is_same_printer = true; + update_printer_name(); + BOOST_LOG_TRIVIAL(info) << "select_machine_dialog: show_status = " << status << "(" << get_print_status_info(status) << ")"; + } m_print_status = status; // m_comboBox_printer @@ -1994,7 +2175,8 @@ void SyncAmsInfoDialog::show_status(PrintDialogStatus status, std::vectorproject_config; m_filaments_map = wxGetApp().plater()->get_partplate_list().get_curr_plate()->get_real_filament_maps(project_config); } - + auto contronal_index = 0; + bool is_first_row = true; for (auto i = 0; i < extruders.size(); i++) { auto extruder = extruders[i] - 1; auto colour = wxGetApp().preset_bundle->project_config.opt_string("filament_colour", (unsigned int) extruder); @@ -3627,7 +3813,24 @@ void SyncAmsInfoDialog::reset_and_sync_ams_list() bmcache.parse_color4(colour, rgb); 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; + if (extruder >= materials.size() || extruder < 0 || extruder >= display_materials.size()) + continue; + + if (contronal_index % SYNC_FLEX_GRID_COL == 0) { + wxBoxSizer *ams_tip_sizer = new wxBoxSizer(wxVERTICAL); + if (is_first_row) { + is_first_row = false; + auto tip0_text = new wxStaticText(m_filament_panel, wxID_ANY, _L("Original")); + tip0_text->SetForegroundColour(wxColour(107, 107, 107, 100)); + ams_tip_sizer->Add(tip0_text, 0, wxALIGN_LEFT | wxTOP, FromDIP(2)); + + auto tip1_text = new wxStaticText(m_filament_panel, wxID_ANY, _L("AMS")); + tip1_text->SetForegroundColour(wxColour(107, 107, 107, 100)); + ams_tip_sizer->Add(tip1_text, 0, wxALIGN_LEFT | wxTOP, FromDIP(4)); + } + m_sizer_ams_mapping->Add(ams_tip_sizer, 0, wxALIGN_LEFT | wxTOP, FromDIP(2)); + contronal_index++; + } MaterialItem *item = nullptr; if (use_double_extruder) { @@ -3646,7 +3849,8 @@ void SyncAmsInfoDialog::reset_and_sync_ams_list() item = new MaterialItem(m_filament_panel, colour_rgb, _L(display_materials[extruder])); m_sizer_ams_mapping->Add(item, 0, wxALL, FromDIP(5)); } - + contronal_index++; + item->SetToolTip(_L("Top half of combobox: Original\nDown half of combobox: Filament of AMS\nAnd you can click it to modify")); item->Bind(wxEVT_LEFT_UP, [this, item, materials, extruder](wxMouseEvent &e) {}); item->Bind(wxEVT_LEFT_DOWN, [this, item, materials, extruder](wxMouseEvent &e) { MaterialHash::iterator iter = m_materialList.begin(); @@ -3725,7 +3929,7 @@ void SyncAmsInfoDialog::reset_and_sync_ams_list() //m_filament_left_panel->Hide();//SyncAmsInfoDialog::reset_and_sync_ams_list() //m_filament_right_panel->Hide(); m_filament_panel->Show();//SyncAmsInfoDialog::reset_and_sync_ams_list() - m_sizer_ams_mapping->SetCols(8); + m_sizer_ams_mapping->SetCols(SYNC_FLEX_GRID_COL); m_sizer_ams_mapping->Layout(); m_filament_panel_sizer->Layout(); } diff --git a/src/slic3r/GUI/SyncAmsInfoDialog.hpp b/src/slic3r/GUI/SyncAmsInfoDialog.hpp index cb69a2ccf..f49fa1836 100644 --- a/src/slic3r/GUI/SyncAmsInfoDialog.hpp +++ b/src/slic3r/GUI/SyncAmsInfoDialog.hpp @@ -5,14 +5,17 @@ #include #include "GUI_App.hpp" #include "GUI_Utils.hpp" -#include "Widgets/Button.hpp" + + #include "SelectMachine.hpp" #include "DeviceManager.hpp" class Button; namespace Slic3r { namespace GUI { +class CapsuleButton; class SyncAmsInfoDialog : public DPIDialog { + enum PageType { ptColorMap = 0, ptOverride }; int m_current_filament_id{0}; int m_print_plate_idx{0}; int m_print_plate_total{0}; @@ -133,7 +136,7 @@ protected: wxBoxSizer *m_filament_panel_right_sizer; wxBoxSizer *m_sizer_filament_2extruder; - wxGridSizer *m_sizer_ams_mapping{nullptr}; + wxFlexGridSizer *m_sizer_ams_mapping{nullptr}; wxGridSizer *m_sizer_ams_mapping_left{nullptr}; wxGridSizer *m_sizer_ams_mapping_right{nullptr}; @@ -250,10 +253,19 @@ public: void show_sizer(wxSizer *sizer, bool show); void deal_ok(); bool get_is_double_extruder(); + bool is_dirty_filament(); + bool is_need_show(); + void set_check_dirty_fialment(bool flag) { m_check_dirty_fialment = flag; }; private: wxBoxSizer *create_sizer_thumbnail(wxButton *image_button, bool left); void update_when_change_plate(int); + void update_when_change_map_mode(int); + void update_when_change_map_mode(wxCommandEvent &e); + void update_panel_status(PageType page); + void show_color_panel(bool); + void update_more_setting(bool layout = true); + void add_two_image_control(); private: SyncInfo & m_input_info; @@ -261,8 +273,10 @@ private: Button * m_button_ok = nullptr; Button * m_button_cancel = nullptr; + wxStaticText *m_attention_text{nullptr}; wxStaticText* m_tip_text{nullptr}; - wxStaticText* m_used_colors_tip_text{nullptr}; + //wxStaticText *m_specify_color_cluster_title = nullptr; + //wxStaticText* m_used_colors_tip_text{nullptr}; wxStaticText* m_warning_text{nullptr}; wxBoxSizer * m_left_sizer_thumbnail{nullptr}; wxBoxSizer * m_right_sizer_thumbnail{nullptr}; @@ -273,19 +287,35 @@ private: wxPanel * m_rename_edit_panel = nullptr; wxStaticText * m_confirm_title = nullptr; wxStaticText * m_are_you_sure_title = nullptr; - wxStaticText * m_specify_color_cluster_title = nullptr; - wxBoxSizer * m_plate_combox_sizer = nullptr; - wxBoxSizer * m_sizer_two_image = nullptr; - wxStaticText * m_printer_title = nullptr; + wxBoxSizer * m_plate_combox_sizer = nullptr; + wxBoxSizer * m_mode_combox_sizer = nullptr; + wxBoxSizer * m_sizer_two_image = nullptr; + wxBoxSizer * m_sizer_line = nullptr; + wxStaticText * m_printer_title = nullptr; + wxStaticText * m_printer_device_name = nullptr; + wxStaticText * m_printer_is_map_title = nullptr; + + CapsuleButton * m_colormap_btn = nullptr; + CapsuleButton * m_override_btn = nullptr; + wxStaticText * m_more_setting_tips = nullptr; wxCheckBox* m_append_color_checkbox = nullptr; wxCheckBox* m_merge_color_checkbox = nullptr; bool m_is_empty_project = true; - + bool m_is_same_printer = true; + bool m_check_dirty_fialment = true; + bool m_expand_more_settings = false; + bool m_image_is_top = false; std::vector m_plate_choices; const int THUMBNAIL_SIZE_WIDTH = 200; - int m_specify_plate_idx{-1}; + int m_specify_plate_idx{0}; wxString m_printer_name; + + enum class MapModeEnum { + ColorMap = 0, + Override, + }; + MapModeEnum m_map_mode{MapModeEnum::ColorMap}; }; }} // namespace Slic3r::GUI #endif // _STEP_MESH_DIALOG_H_ diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 87477ce2b..e71dc8bb8 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -4756,7 +4756,8 @@ void Tab::update_preset_choice() // Called by the UI combo box when the user switches profiles, and also to delete the current profile. // Select a preset by a name.If !defined(name), then the default preset is selected. // If the current profile is modified, user is asked to save the changes. -bool Tab::select_preset(std::string preset_name, bool delete_current /*=false*/, const std::string& last_selected_ph_printer_name/* =""*/, bool force_select) +bool Tab::select_preset( + std::string preset_name, bool delete_current /*=false*/, const std::string &last_selected_ph_printer_name /* =""*/, bool force_select, bool force_no_transfer) { BOOST_LOG_TRIVIAL(info) << boost::format("select preset, name %1%, delete_current %2%") %preset_name %delete_current; @@ -4818,6 +4819,10 @@ bool Tab::select_preset(std::string preset_name, bool delete_current /*=false*/, } else if (printer_tab) no_transfer = true; + + if (force_no_transfer) { + no_transfer = true; + } if (current_dirty && ! may_discard_current_dirty_preset(nullptr, preset_name, no_transfer) && !force_select) { canceled = true; BOOST_LOG_TRIVIAL(info) << boost::format("current dirty and cancelled"); diff --git a/src/slic3r/GUI/Tab.hpp b/src/slic3r/GUI/Tab.hpp index 06d4fabd4..482b0284e 100644 --- a/src/slic3r/GUI/Tab.hpp +++ b/src/slic3r/GUI/Tab.hpp @@ -333,7 +333,7 @@ public: void update_btns_enabling(); void update_preset_choice(); // Select a new preset, possibly delete the current one. - bool select_preset(std::string preset_name = "", bool delete_current = false, const std::string& last_selected_ph_printer_name = "", bool force_select = false); + bool select_preset(std::string preset_name = "", bool delete_current = false, const std::string &last_selected_ph_printer_name = "", bool force_select = false, bool force_no_transfer = false); bool may_discard_current_dirty_preset(PresetCollection* presets = nullptr, const std::string& new_printer_name = "", bool no_transfer = false, bool no_transfer_variant = false); virtual void clear_pages();