mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 12:41:20 -06:00 
			
		
		
		
	NEW:support for filament backup and edit
Change-Id: Id0a83e56df75253046cc07d972e9ad156690bbe7
This commit is contained in:
		
							parent
							
								
									2c00a44de6
								
							
						
					
					
						commit
						80d6479bee
					
				
					 9 changed files with 295 additions and 272 deletions
				
			
		
							
								
								
									
										4
									
								
								resources/images/back_up_ts_bk.svg
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								resources/images/back_up_ts_bk.svg
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,4 @@ | |||
| <svg width="162" height="162" viewBox="0 0 162 162" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||||
| <circle cx="81" cy="81" r="81" fill="white"/> | ||||
| <path fill-rule="evenodd" clip-rule="evenodd" d="M161.375 70.875C161.789 74.1919 162 77.5713 162 81H151.875V70.875H161.375ZM156.113 50.625C157.438 53.8989 158.555 57.2793 159.449 60.75H151.875V50.625H156.113ZM151.875 41.7559V50.625H141.75V40.5H151.164C151.406 40.9165 151.641 41.335 151.875 41.7559ZM101.25 2.55176C104.719 3.44482 108.102 4.56299 111.375 5.88818V10.125H101.25V2.55176ZM60.75 2.55176C64.0469 1.70264 67.4297 1.05615 70.875 0.626465V10.125H60.75V2.55176ZM0.625 70.875C1.05469 67.4282 1.70312 64.0483 2.55078 60.75H10.125V70.875H0.625ZM0.625 91.125C0.210938 87.8081 0 84.4287 0 81H10.125V91.125H0.625ZM5.88672 111.375C4.5625 108.101 3.44531 104.721 2.55078 101.25H10.125V111.375H5.88672ZM10.125 120.244V111.375H20.25V121.5H10.8359C10.5938 121.083 10.3594 120.665 10.125 120.244ZM60.75 159.448C57.2812 158.555 53.8984 157.437 50.625 156.112V151.875H60.75V159.448ZM101.25 159.448C97.9531 160.297 94.5703 160.944 91.125 161.374V151.875H101.25V159.448ZM161.375 91.125C160.945 94.5718 160.297 97.9517 159.449 101.25H151.875V91.125H161.375ZM141.75 91.125V81H151.875V91.125H141.75ZM141.75 101.25V91.125H131.625V81H141.75V70.875H151.875V60.75H141.75V50.625H131.625V40.5H141.75V30.375H144.234C143.43 29.3711 142.602 28.3862 141.75 27.4224V30.375H131.625V20.25H134.578C133.613 19.3989 132.629 18.5708 131.625 17.7661V20.25H121.5V10.8364C121.082 10.5957 120.668 10.3584 120.246 10.125H111.375V20.25H101.25V10.125H91.125V0.626465C87.8086 0.212891 84.4297 0 81 0V10.125H70.875V20.25H60.75V10.125H50.625V5.88818C47.5703 7.12402 44.6094 8.54053 41.7539 10.125H50.625V20.25H40.5V10.8364C36.9453 12.8926 33.5625 15.2114 30.375 17.7661V20.25H27.4219C24.8828 22.4893 22.4883 24.8853 20.25 27.4224V30.375H17.7656C15.2109 33.5615 12.8906 36.9453 10.8359 40.5H20.25V50.625H10.125V41.7559C8.53906 44.6108 7.12109 47.5718 5.88672 50.625H10.125V60.75H20.25V70.875H10.125V81H20.25V91.125H10.125V101.25H20.25V111.375H30.375V121.5H20.25V131.625H17.7656C18.5703 132.629 19.3984 133.614 20.25 134.578V131.625H30.375V141.75H27.4219C28.3867 142.601 29.3711 143.429 30.375 144.234V141.75H40.5V151.164C40.918 151.404 41.332 151.642 41.7539 151.875H50.625V141.75H60.75V151.875H70.875V161.374C74.1914 161.787 77.5703 162 81 162V151.875H91.125V141.75H101.25V151.875H111.375V156.112C114.43 154.876 117.391 153.459 120.246 151.875H111.375V141.75H121.5V151.164C125.055 149.107 128.438 146.789 131.625 144.234V141.75H134.578C137.117 139.511 139.512 137.115 141.75 134.578V131.625H144.234C146.789 128.438 149.109 125.055 151.164 121.5H141.75V111.375H151.875V120.244C153.461 117.389 154.879 114.428 156.113 111.375H151.875V101.25H141.75ZM131.625 101.25H141.75V111.375H131.625V101.25ZM121.5 101.25H131.625V91.125H121.5V81H131.625V70.875H141.75V60.75H131.625V50.625H121.5V40.5H131.625V30.375H121.5V20.25H111.375V30.375H101.25V20.25H91.125V10.125H81V20.25H70.875V30.375H60.75V20.25H50.625V30.375H40.5V20.25H30.375V30.375H20.25V40.5H30.375V50.625H20.25V60.75H30.375V70.875H20.25V81H30.375V91.125H20.25V101.25H30.375V111.375H40.5V121.5H30.375V131.625H40.5V141.75H50.625V131.625H60.75V141.75H70.875V151.875H81V141.75H91.125V131.625H101.25V141.75H111.375V131.625H121.5V141.75H131.625V131.625H141.75V121.5H131.625V111.375H121.5V101.25ZM111.375 101.25H121.5V91.125H111.375V81H121.5V70.875H131.625V60.75H121.5V50.625H111.375V40.5H121.5V30.375H111.375V40.5H101.25V30.375H91.125V20.25H81V30.375H70.875V40.5H60.75V30.375H50.625V40.5H40.5V30.375H30.375V40.5H40.5V50.625H30.375V60.75H40.5V70.875H30.375V81H40.5V91.125H30.375V101.25H40.5V111.375H50.625V121.5H40.5V131.625H50.625V121.5H60.75V131.625H70.875V141.75H81V131.625H91.125V121.5H101.25V131.625H111.375V121.5H121.5V131.625H131.625V121.5H121.5V111.375H111.375V101.25ZM101.25 101.25H111.375V91.125H101.25V81H111.375V70.875H121.5V60.75H111.375V50.625H101.25V40.5H91.125V30.375H81V40.5H70.875V50.625H60.75V40.5H50.625V50.625H40.5V60.75H50.625V70.875H40.5V81H50.625V91.125H40.5V101.25H50.625V111.375H60.75V121.5H70.875V131.625H81V121.5H91.125V111.375H101.25V121.5H111.375V111.375H101.25V101.25ZM91.125 101.25H101.25V91.125H91.125V81H101.25V70.875H111.375V60.75H101.25V50.625H91.125V40.5H81V50.625H70.875V60.75H60.75V50.625H50.625V60.75H60.75V70.875H50.625V81H60.75V91.125H50.625V101.25H60.75V111.375H70.875V121.5H81V111.375H91.125V101.25ZM81 101.25H91.125V91.125H81V81H91.125V70.875H101.25V60.75H91.125V50.625H81V60.75H70.875V70.875H60.75V81H70.875V91.125H60.75V101.25H70.875V111.375H81V101.25ZM81 101.25H70.875V91.125H81V101.25ZM81 70.875H91.125V60.75H81V70.875ZM81 70.875H70.875V81H81V70.875Z" fill="#D9D9D9"/> | ||||
| </svg> | ||||
| After Width: | Height: | Size: 4.6 KiB | 
							
								
								
									
										3
									
								
								resources/images/backup_current_use1.svg
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								resources/images/backup_current_use1.svg
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,3 @@ | |||
| <svg width="11" height="8" viewBox="0 0 11 8" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||||
| <path d="M1.25391 3.68839L4.3354 6.76988C4.44084 6.87532 4.6118 6.87532 4.71724 6.76988L10.1868 1.30029" stroke="white" stroke-width="1.08" stroke-linecap="round"/> | ||||
| </svg> | ||||
| After Width: | Height: | Size: 266 B | 
							
								
								
									
										3
									
								
								resources/images/backup_current_use2.svg
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								resources/images/backup_current_use2.svg
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,3 @@ | |||
| <svg width="11" height="8" viewBox="0 0 11 8" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||||
| <path d="M1.25391 3.68839L4.3354 6.76988C4.44084 6.87532 4.6118 6.87532 4.71724 6.76988L10.1868 1.30029" stroke="#262E30" stroke-width="1.08" stroke-linecap="round"/> | ||||
| </svg> | ||||
| After Width: | Height: | Size: 268 B | 
							
								
								
									
										8
									
								
								resources/images/backup_tips_img.svg
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								resources/images/backup_tips_img.svg
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,8 @@ | |||
| <svg width="95" height="92" xmlns="http://www.w3.org/2000/svg" data-name="图层 1"> | ||||
| 
 | ||||
|  <g> | ||||
|   <title>Layer 1</title> | ||||
|   <path fill-rule="evenodd" fill="#20e86a" d="m90.53,44.88c-0.4,-11.48 -5.07,-22.4 -13.09,-30.55c-8.4,-8.54 -19.79,-13.33 -31.66,-13.33s-23.27,4.79 -31.67,13.33c-5.02,5.11 -8.72,11.3 -10.89,18.04l3.9,0.32c2.02,-5.82 5.3,-11.18 9.67,-15.63c7.68,-7.81 18.11,-12.19 28.97,-12.19s21.29,4.39 28.97,12.19c7.31,7.43 11.57,17.37 11.97,27.82l-3.51,0l5.4,7.12l5.4,-7.12l-3.47,0l0.01,0z" class="cls-1" id="path2"/> | ||||
|   <path fill-rule="evenodd" fill="#20e86a" d="m87.87,59.31c-2.02,5.82 -5.3,11.18 -9.67,15.63c-7.68,7.81 -18.11,12.19 -28.97,12.19s-21.29,-4.39 -28.97,-12.19c-7.31,-7.43 -11.57,-17.37 -11.97,-27.82l3.51,0l-5.4,-7.12l-5.4,7.12l3.47,0c0.4,11.48 5.07,22.4 13.09,30.55c8.4,8.53 19.79,13.33 31.66,13.33s23.26,-4.79 31.66,-13.33c5.02,-5.11 8.72,-11.3 10.89,-18.04l-3.9,-0.32z" class="cls-1" id="path1"/> | ||||
|  </g> | ||||
| </svg> | ||||
| After Width: | Height: | Size: 929 B | 
|  | @ -15,6 +15,7 @@ | |||
| #include <wx/progdlg.h> | ||||
| #include <wx/clipbrd.h> | ||||
| #include <wx/dcgraph.h> | ||||
| #include <wx/graphics.h> | ||||
| #include <miniz.h> | ||||
| #include <algorithm> | ||||
| #include "Plater.hpp" | ||||
|  | @ -606,11 +607,6 @@ void MappingItem::render(wxDC &dc) | |||
|     if (m_coloul.Alpha() == 0) txt_colour = wxColour(0x26, 0x2E, 0x30); | ||||
|     dc.SetTextForeground(txt_colour); | ||||
| 
 | ||||
|     /*if (dc.GetTextExtent(m_name).x > GetSize().x - 10) {
 | ||||
|         dc.SetFont(::Label::Body_10); | ||||
|         m_name = m_name.substr(0, 3) + "." + m_name.substr(m_name.length() - 1); | ||||
|     }*/ | ||||
| 
 | ||||
|     auto txt_size = dc.GetTextExtent(m_tray_index); | ||||
|     auto top = (GetSize().y - MAPPING_ITEM_REAL_SIZE.y) / 2 + FromDIP(8); | ||||
|     dc.DrawText(m_tray_index, wxPoint((GetSize().x - txt_size.x) / 2, top)); | ||||
|  | @ -1123,8 +1119,11 @@ void MappingContainer::doRender(wxDC& dc) | |||
| } | ||||
| 
 | ||||
| AmsReplaceMaterialDialog::AmsReplaceMaterialDialog(wxWindow* parent) | ||||
|     : DPIDialog(parent, wxID_ANY, _L("Filaments replace"), wxDefaultPosition, wxDefaultSize, wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX) | ||||
|     : DPIDialog(parent, wxID_ANY, _L("Filaments Auto refill"), wxDefaultPosition, wxDefaultSize, wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX) | ||||
| { | ||||
| #ifdef __WINDOWS__ | ||||
|     SetDoubleBuffered(true); | ||||
| #endif //__WINDOWS__
 | ||||
|     SetBackgroundColour(*wxWHITE); | ||||
|     create(); | ||||
|     wxGetApp().UpdateDlgDarkUI(this); | ||||
|  | @ -1132,14 +1131,13 @@ AmsReplaceMaterialDialog::AmsReplaceMaterialDialog(wxWindow* parent) | |||
| 
 | ||||
| void AmsReplaceMaterialDialog::create() | ||||
| { | ||||
|     SetSize(wxSize(FromDIP(376), -1)); | ||||
|     SetMinSize(wxSize(FromDIP(376), -1)); | ||||
|     SetMaxSize(wxSize(FromDIP(376), -1)); | ||||
|     SetSize(wxSize(FromDIP(445), -1)); | ||||
|     SetMinSize(wxSize(FromDIP(445), -1)); | ||||
|     SetMaxSize(wxSize(FromDIP(445), -1)); | ||||
| 
 | ||||
|     // set icon for dialog
 | ||||
|     std::string icon_path = (boost::format("%1%/images/BambuStudioTitle.ico") % resources_dir()).str(); | ||||
|     SetIcon(wxIcon(encode_path(icon_path.c_str()), wxBITMAP_TYPE_ICO)); | ||||
|     SetSizeHints(wxDefaultSize, wxDefaultSize); | ||||
| 
 | ||||
|     m_main_sizer = new wxBoxSizer(wxVERTICAL); | ||||
|     auto m_top_line = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1, 1), wxTAB_TRAVERSAL); | ||||
|  | @ -1147,6 +1145,17 @@ void AmsReplaceMaterialDialog::create() | |||
|     m_main_sizer->Add(m_top_line, 0, wxEXPAND, 0); | ||||
| 
 | ||||
| 
 | ||||
|     auto label_title = new Label(this, _L("Auto refill")); | ||||
|     label_title->SetFont(Label::Head_14); | ||||
|     label_title->SetForegroundColour(0x00AE42); | ||||
|     auto label_txt = new Label(this, _L("When the current material run out,the printer will continue to print in the following order.")); | ||||
|     label_txt->SetFont(Label::Body_13); | ||||
|     label_txt->SetForegroundColour(0x323A3D); | ||||
|     label_txt->SetMinSize(wxSize(FromDIP(380), -1)); | ||||
|     label_txt->SetMaxSize(wxSize(FromDIP(380), -1)); | ||||
|     label_txt->Wrap(FromDIP(380)); | ||||
| 
 | ||||
|     m_groups_sizer = new wxWrapSizer( wxHORIZONTAL, wxWRAPSIZER_DEFAULT_FLAGS ); | ||||
|     auto m_button_sizer = new wxBoxSizer(wxHORIZONTAL); | ||||
|      | ||||
|     StateColor btn_bg_white(std::pair<wxColour, int>(AMS_CONTROL_DISABLE_COLOUR, StateColor::Disabled), | ||||
|  | @ -1160,26 +1169,32 @@ void AmsReplaceMaterialDialog::create() | |||
|     StateColor btn_text_white(std::pair<wxColour, int>(wxColour(255, 255, 254), StateColor::Disabled), | ||||
|         std::pair<wxColour, int>(wxColour(38, 46, 48), StateColor::Enabled)); | ||||
| 
 | ||||
|     auto m_button_close = new Button(this, _L("Close")); | ||||
|     m_button_close->SetCornerRadius(FromDIP(11)); | ||||
|     m_button_close->SetBackgroundColor(btn_bg_white); | ||||
|     m_button_close->SetBorderColor(btn_bd_white); | ||||
|     m_button_close->SetTextColor(btn_text_white); | ||||
|     m_button_close->SetFont(Label::Body_13); | ||||
|     m_button_close->SetMinSize(wxSize(FromDIP(42), FromDIP(24))); | ||||
|     m_button_close->Bind(wxEVT_BUTTON, [this](auto& e) { | ||||
|         EndModal(wxCLOSE); | ||||
|     }); | ||||
| 
 | ||||
|     StateColor btn_bg_green(std::pair<wxColour, int>(wxColour(27, 136, 68), StateColor::Pressed), std::pair<wxColour, int>(wxColour(0, 174, 66), StateColor::Normal)); | ||||
|     /* auto m_button_add = new Button(this, _L("Add substitute relationship"));
 | ||||
|      m_button_add->SetBackgroundColor(btn_bg_green); | ||||
|      m_button_add->SetBorderColor(wxColour(0, 174, 66)); | ||||
|      m_button_add->SetTextColor(wxColour(255, 255, 255)); | ||||
|      m_button_add->SetSize(wxSize(-1, FromDIP(24))); | ||||
|      m_button_add->SetMinSize(wxSize(-1, FromDIP(24))); | ||||
|      m_button_add->SetCornerRadius(FromDIP(12)); | ||||
| 
 | ||||
| 
 | ||||
|      m_button_add->Bind(wxEVT_BUTTON, [this](auto& e) { | ||||
|          EndModal(wxCLOSE); | ||||
|      });*/ | ||||
| 
 | ||||
|     m_button_sizer->Add( 0, 0, 1, wxEXPAND, 0 ); | ||||
|     m_button_sizer->Add(m_button_close, 0, wxALIGN_CENTER, 0); | ||||
|     //m_button_sizer->Add(m_button_add, 0, wxALIGN_CENTER, 0);
 | ||||
| 
 | ||||
| 
 | ||||
|     m_groups_sizer = new wxBoxSizer(wxVERTICAL); | ||||
|     m_main_sizer->Add(0,0,0, wxTOP, FromDIP(12)); | ||||
|     m_main_sizer->Add(m_groups_sizer,0,wxEXPAND|wxLEFT|wxRIGHT, FromDIP(16)); | ||||
|     m_main_sizer->Add(label_title,0, wxLEFT, FromDIP(30)); | ||||
|     m_main_sizer->Add(0,0,0, wxTOP, FromDIP(4)); | ||||
|     m_main_sizer->Add(label_txt,0, wxLEFT, FromDIP(30)); | ||||
|     m_main_sizer->Add(0,0,0, wxTOP, FromDIP(16)); | ||||
|     m_main_sizer->Add(m_groups_sizer,0, wxALIGN_CENTER, 0); | ||||
|     m_main_sizer->Add(0,0,0, wxTOP, FromDIP(20)); | ||||
|     m_main_sizer->Add(m_button_sizer,0,wxEXPAND|wxLEFT|wxRIGHT, FromDIP(16)); | ||||
|     m_main_sizer->Add(m_button_sizer,0,wxALIGN_CENTER, FromDIP(16)); | ||||
|     m_main_sizer->Add(0,0,0, wxTOP, FromDIP(20)); | ||||
|      | ||||
| 
 | ||||
|  | @ -1233,19 +1248,18 @@ void AmsReplaceMaterialDialog::update_machine_obj(MachineObject* obj) | |||
|     for (int filam : m_obj->filam_bak) { | ||||
|          auto status_list = GetStatus(filam); | ||||
| 
 | ||||
|          wxColour       group_color; | ||||
|          std::map<std::string, wxColour> group_info; | ||||
|          std::string    group_material; | ||||
| 
 | ||||
|          //get color & material
 | ||||
|          for (auto i = 0; i < status_list.size(); i++) { | ||||
|              if (status_list[i] && tray_list[i] != nullptr) { | ||||
|                  group_color = AmsTray::decode_color(tray_list[i]->color); | ||||
|                  group_info[wxGetApp().transition_tridid(i).ToStdString()] = AmsTray::decode_color(tray_list[i]->color); | ||||
|                  group_material = tray_list[i]->get_display_filament_type(); | ||||
|              } | ||||
|          } | ||||
| 
 | ||||
|          m_groups_sizer->Add(create_split_line(wxString::Format("%s%d", _L("Group"), group_index), group_color, group_material, status_list), 0, wxEXPAND, 0); | ||||
|          m_groups_sizer->Add(0, 0, 0, wxTOP, FromDIP(12)); | ||||
|          m_groups_sizer->Add(create_backup_group(wxString::Format("%s%d", _L("Group"), group_index), group_info, group_material, status_list), 0, wxALL, FromDIP(10)); | ||||
|          group_index++; | ||||
|     } | ||||
| 
 | ||||
|  | @ -1253,92 +1267,10 @@ void AmsReplaceMaterialDialog::update_machine_obj(MachineObject* obj) | |||
|     Fit(); | ||||
| } | ||||
| 
 | ||||
| wxWindow* AmsReplaceMaterialDialog::create_split_line(wxString gname, wxColour col, wxString material, std::vector<bool> status_list) | ||||
| AmsRMGroup* AmsReplaceMaterialDialog::create_backup_group(wxString gname, std::map<std::string, wxColour> group_info, wxString material, std::vector<bool> status_list) | ||||
| { | ||||
|     wxColour background_color = wxColour(0xF4F4F4); | ||||
| 
 | ||||
|     if (abs(col.Red() - background_color.Red()) <= 5 &&  | ||||
|         abs(col.Green() - background_color.Green()) <= 5 &&  | ||||
|         abs(col.Blue() - background_color.Blue()) <= 5) { | ||||
|         background_color = wxColour(0xE6E6E6); | ||||
|     } | ||||
| 
 | ||||
|     auto m_panel_group = new StaticBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE); | ||||
|     m_panel_group->SetCornerRadius(FromDIP(4)); | ||||
|     m_panel_group->SetBackgroundColor(StateColor(std::pair<wxColour, int>(background_color, StateColor::Normal))); | ||||
| 
 | ||||
|     m_panel_group->SetSize(wxSize(FromDIP(344), -1)); | ||||
|     m_panel_group->SetMinSize(wxSize(FromDIP(344), -1)); | ||||
|     m_panel_group->SetMaxSize(wxSize(FromDIP(344), -1)); | ||||
| 
 | ||||
|     wxBoxSizer* group_sizer = new wxBoxSizer(wxVERTICAL); | ||||
| 
 | ||||
|     //group title
 | ||||
|     wxBoxSizer* title_sizer = new wxBoxSizer(wxHORIZONTAL); | ||||
|     auto group_name = new Label(m_panel_group, gname); | ||||
|     group_name->SetFont(::Label::Head_12); | ||||
| 
 | ||||
|     Button* material_info = new Button(m_panel_group, material); | ||||
|     material_info->SetFont(Label::Head_12); | ||||
|     material_info->SetCornerRadius(FromDIP(2)); | ||||
|     material_info->SetBorderColor(background_color); | ||||
| 
 | ||||
|     if (col.GetLuminance() < 0.5) | ||||
|         material_info->SetTextColor(*wxWHITE); | ||||
|     else | ||||
|         material_info->SetTextColor(0x6B6B6B); | ||||
|      | ||||
|     material_info->SetMinSize(wxSize(-1, FromDIP(24))); | ||||
|     material_info->SetBackgroundColor(col); | ||||
| 
 | ||||
| 
 | ||||
|     title_sizer->Add(group_name, 0, wxALIGN_CENTER, 0); | ||||
|     title_sizer->Add(0, 0, 0, wxLEFT, FromDIP(10)); | ||||
|     title_sizer->Add(material_info, 0, wxALIGN_CENTER, 0); | ||||
| 
 | ||||
| 
 | ||||
|     //group item
 | ||||
|     wxGridSizer* grid_Sizer = new wxGridSizer(0, 8, 0, 0); | ||||
| 
 | ||||
|     for (int i = 0; i < status_list.size(); i++) { | ||||
|         if (status_list[i]) { | ||||
|             AmsRMItem* amsitem = new AmsRMItem(m_panel_group, wxID_ANY, wxDefaultPosition, wxDefaultSize); | ||||
|             amsitem->set_color(col); | ||||
| 
 | ||||
|             //set current tray
 | ||||
|             if (!m_obj->m_tray_now.empty() && m_obj->m_tray_now == std::to_string(i)) { | ||||
|                 amsitem->set_focus(true); | ||||
|             } | ||||
| 
 | ||||
|             amsitem->set_type(RMTYPE_NORMAL); | ||||
|             amsitem->set_index(wxGetApp().transition_tridid(i).ToStdString()); | ||||
|             amsitem->SetBackgroundColour(background_color); | ||||
|             grid_Sizer->Add(amsitem, 0, wxALIGN_CENTER | wxTOP | wxBottom, FromDIP(10)); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     //add the first tray
 | ||||
|     for (int i = 0; i < status_list.size(); i++) { | ||||
|         if (status_list[i]) { | ||||
|             AmsRMItem* amsitem = new AmsRMItem(m_panel_group, wxID_ANY, wxDefaultPosition, wxDefaultSize); | ||||
|             amsitem->set_color(col); | ||||
|             amsitem->set_type(RMTYPE_VIRTUAL); | ||||
|             amsitem->set_index(wxGetApp().transition_tridid(i).ToStdString()); | ||||
|             amsitem->SetBackgroundColour(background_color); | ||||
|             grid_Sizer->Add(amsitem, 0, wxALIGN_CENTER | wxTOP | wxBottom, FromDIP(10)); | ||||
|             break; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     group_sizer->Add(0, 0, 0, wxTOP, FromDIP(10)); | ||||
|     group_sizer->Add(title_sizer, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(12)); | ||||
|     group_sizer->Add(grid_Sizer, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(12)); | ||||
|     group_sizer->Add(0, 0, 0, wxTOP, FromDIP(10)); | ||||
| 
 | ||||
|     m_panel_group->SetSizer(group_sizer); | ||||
|     m_panel_group->Layout(); | ||||
|     group_sizer->Fit(m_panel_group); | ||||
|     return m_panel_group; | ||||
|     auto grp = new AmsRMGroup(this, group_info, material, gname); | ||||
|     return grp; | ||||
| } | ||||
| 
 | ||||
| void AmsReplaceMaterialDialog::paintEvent(wxPaintEvent& evt) | ||||
|  | @ -1354,119 +1286,105 @@ void AmsReplaceMaterialDialog::on_dpi_changed(const wxRect& suggested_rect) | |||
| 
 | ||||
| } | ||||
| 
 | ||||
| AmsRMItem::AmsRMItem(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size) | ||||
| AmsRMGroup::AmsRMGroup(wxWindow* parent, std::map<std::string, wxColour> group_info, wxString mname, wxString group_index) | ||||
| { | ||||
|     wxWindow::Create(parent, id, pos, size); | ||||
|     m_group_info.clear(); | ||||
|     m_group_info = group_info; | ||||
|     m_material_name = mname; | ||||
|     m_group_index   = group_index; | ||||
| 
 | ||||
|     SetSize(wxSize(FromDIP(42), FromDIP(32))); | ||||
|     SetMinSize(wxSize(FromDIP(42), FromDIP(32))); | ||||
|     SetMaxSize(wxSize(FromDIP(42), FromDIP(32))); | ||||
|       | ||||
|      /*m_group_info["A1"] = wxColour(255,0,255);
 | ||||
|      m_group_info["A2"] = wxColour(255,215,0); | ||||
|      m_group_info["A3"] = wxColour(0,191,255); | ||||
|      m_group_info["A4"] = wxColour(255,255,255); | ||||
|      m_group_info["A4"] = wxColour(218,165,32); | ||||
|      m_group_info["B1"] = wxColour(220, 20, 60); | ||||
|      m_group_info["B2"] = wxColour(255, 215, 0); | ||||
|      m_group_info["B3"] = wxColour(0, 191, 255); | ||||
|      m_group_info["B4"] = wxColour(218, 165, 32); | ||||
|      m_group_info["C1"] = wxColour(220, 20, 60); | ||||
|      m_group_info["C2"] = wxColour(255, 215, 0); | ||||
|      m_group_info["C3"] = wxColour(0, 191, 255); | ||||
|      m_group_info["C4"] = wxColour(218, 165, 32); | ||||
|      m_group_info["D1"] = wxColour(220, 20, 60); | ||||
|      m_group_info["D2"] = wxColour(255, 215, 0); | ||||
|      m_group_info["D3"] = wxColour(0, 191, 255);*/ | ||||
| 
 | ||||
|     SetBackgroundColour(*wxWHITE); | ||||
| 
 | ||||
|     Bind(wxEVT_PAINT, &AmsRMItem::paintEvent, this); | ||||
| } | ||||
| 
 | ||||
| void AmsRMItem::paintEvent(wxPaintEvent& evt) | ||||
| { | ||||
|     wxPaintDC dc(this); | ||||
|     render(dc); | ||||
| } | ||||
| 
 | ||||
| void AmsRMItem::render(wxDC& dc) | ||||
| { | ||||
| #ifdef __WXMSW__ | ||||
|     wxSize     size = GetSize(); | ||||
|     wxMemoryDC memdc; | ||||
|     wxBitmap   bmp(size.x, size.y); | ||||
|     memdc.SelectObject(bmp); | ||||
|     memdc.Blit({ 0, 0 }, size, &dc, { 0, 0 }); | ||||
| 
 | ||||
|     { | ||||
|         wxGCDC dc2(memdc); | ||||
|         doRender(dc2); | ||||
|     } | ||||
| 
 | ||||
|     memdc.SelectObject(wxNullBitmap); | ||||
|     dc.DrawBitmap(bmp, 0, 0); | ||||
| #else | ||||
|     doRender(dc); | ||||
| #endif | ||||
| } | ||||
| 
 | ||||
| void AmsRMItem::doRender(wxDC& dc) | ||||
| { | ||||
|     wxSize size = GetSize(); | ||||
| 
 | ||||
|     if (m_type == RMTYPE_NORMAL) { | ||||
|         dc.SetPen(wxPen(m_color, 2)); | ||||
|         dc.SetBrush(*wxTRANSPARENT_BRUSH); | ||||
|     } | ||||
|     else { | ||||
|         dc.SetPen(wxPen(m_color, 2, wxSHORT_DASH)); | ||||
|         dc.SetBrush(*wxTRANSPARENT_BRUSH); | ||||
|     } | ||||
| 
 | ||||
|     //top bottom line
 | ||||
|     dc.DrawLine(FromDIP(0), FromDIP(4), size.x - FromDIP(5), FromDIP(4)); | ||||
|     dc.DrawLine(FromDIP(0), size.y - FromDIP(4), size.x - FromDIP(5), size.y - FromDIP(4)); | ||||
| 
 | ||||
|     //left right line
 | ||||
|     dc.DrawLine(FromDIP(1), FromDIP(4), FromDIP(1), FromDIP(11)); | ||||
|     dc.DrawLine(FromDIP(1), FromDIP(22), FromDIP(1), size.y - FromDIP(4)); | ||||
| 
 | ||||
|     dc.DrawLine(size.x - FromDIP(5), FromDIP(4), size.x - FromDIP(5), FromDIP(11)); | ||||
|     dc.DrawLine(size.x - FromDIP(5), FromDIP(22), size.x - FromDIP(5), size.y - FromDIP(4)); | ||||
| 
 | ||||
|     //delta
 | ||||
|     dc.DrawLine(FromDIP(0), FromDIP(11), FromDIP(5), size.y / 2); | ||||
|     dc.DrawLine(FromDIP(0), FromDIP(22), FromDIP(5), size.y / 2); | ||||
| 
 | ||||
|     dc.DrawLine(size.x - FromDIP(5), FromDIP(11), size.x - FromDIP(1), size.y / 2); | ||||
|     dc.DrawLine(size.x - FromDIP(5), FromDIP(22), size.x - FromDIP(1), size.y / 2); | ||||
| 
 | ||||
| 
 | ||||
|     if (m_focus) { | ||||
|         dc.SetPen(wxPen(wxColour(0x00AE42), 2)); | ||||
|         dc.SetBrush(*wxTRANSPARENT_BRUSH); | ||||
|         dc.DrawLine(FromDIP(0), FromDIP(1), size.x - FromDIP(5), FromDIP(1)); | ||||
|         dc.DrawLine(FromDIP(0), size.y - FromDIP(1), size.x - FromDIP(5), size.y - FromDIP(1)); | ||||
|     } | ||||
| 
 | ||||
|     if (m_selected) { | ||||
|     } | ||||
| 
 | ||||
|     auto tsize = dc.GetMultiLineTextExtent(m_index); | ||||
|     auto tpot = wxPoint((size.x - tsize.x) / 2 - FromDIP(2), (size.y - tsize.y) / 2 + FromDIP(2)); | ||||
|     dc.SetTextForeground(wxColour(0x6B6B6B)); | ||||
|     dc.SetFont(::Label::Head_12); | ||||
|     dc.DrawText(m_index, tpot); | ||||
| } | ||||
| 
 | ||||
| AmsRMArrow::AmsRMArrow(wxWindow* parent) | ||||
| { | ||||
| 
 | ||||
|     wxWindow::Create(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize); | ||||
|     SetSize(wxSize(FromDIP(166), FromDIP(166))); | ||||
|     SetMinSize(wxSize(FromDIP(166), FromDIP(166))); | ||||
|     SetMaxSize(wxSize(FromDIP(166), FromDIP(166))); | ||||
|     SetBackgroundColour(*wxWHITE); | ||||
|     Bind(wxEVT_PAINT, &AmsRMArrow::paintEvent, this); | ||||
| 
 | ||||
|     m_bitmap_left = ScalableBitmap(this, "replace_arrow_left", 7); | ||||
|     m_bitmap_right = ScalableBitmap(this, "replace_arrow_right", 7); | ||||
|     m_bitmap_down = ScalableBitmap(this, "replace_arrow_down", 7); | ||||
|     backup_current_use_white    =  ScalableBitmap(this, "backup_current_use1",8); | ||||
|     backup_current_use_black    =  ScalableBitmap(this, "backup_current_use2", 8); | ||||
|     bitmap_backup_tips_0        =  ScalableBitmap(this, "backup_tips_img", 90); | ||||
|     bitmap_editable             = ScalableBitmap(this, "ams_editable", 14); | ||||
|     bitmap_bg                   = ScalableBitmap(this, "back_up_ts_bk", 162); | ||||
|     bitmap_editable_light       = ScalableBitmap(this, "ams_editable_light", 14); | ||||
| 
 | ||||
| 
 | ||||
|         SetSize(wxSize(FromDIP(16), FromDIP(32))); | ||||
|         SetMinSize(wxSize(FromDIP(16), FromDIP(32))); | ||||
|         SetMaxSize(wxSize(FromDIP(16), FromDIP(32))); | ||||
|     Bind(wxEVT_PAINT, &AmsRMGroup::paintEvent, this); | ||||
|     Bind(wxEVT_LEFT_DOWN, &AmsRMGroup::on_mouse_move, this); | ||||
| } | ||||
| 
 | ||||
| void AmsRMArrow::paintEvent(wxPaintEvent& evt) | ||||
| double AmsRMGroup::GetAngle(wxPoint pointA, wxPoint pointB) | ||||
| { | ||||
|     double deltaX = pointA.x - pointB.x; | ||||
|     double deltaY = pointA.y - pointB.y; | ||||
|     double angle = atan2(deltaY, deltaX); | ||||
| 
 | ||||
|     angle = angle * 180.0 / M_PI; | ||||
| 
 | ||||
|     if (angle < 0) | ||||
|         angle += 360.0; | ||||
| 
 | ||||
|     return angle; | ||||
| } | ||||
| 
 | ||||
| void AmsRMGroup::on_mouse_move(wxMouseEvent& evt) | ||||
| { | ||||
|     wxSize     size = GetSize(); | ||||
|     auto mouseX = evt.GetPosition().x; | ||||
|     auto mouseY = evt.GetPosition().y; | ||||
| 
 | ||||
|     auto click_angle = 360.0 - GetAngle(wxPoint(mouseX,mouseY), wxPoint(size.x / 2, size.x / 2)); | ||||
| 
 | ||||
| 
 | ||||
|     float ev_angle = 360.0 / m_group_info.size(); | ||||
|     float startAngle = 0.0; | ||||
|     float endAngle = 0.0; | ||||
| 
 | ||||
|     for (auto iter = m_group_info.rbegin(); iter != m_group_info.rend(); ++iter) { | ||||
|         std::string tray_name = iter->first; | ||||
|         wxColour tray_color = iter->second; | ||||
| 
 | ||||
|         int x = size.x / 2; | ||||
|         int y = size.y / 2; | ||||
|         int radius = size.x / 2; | ||||
|         endAngle += ev_angle; | ||||
| 
 | ||||
|         if (click_angle >= startAngle && click_angle < endAngle) { | ||||
|             //to do
 | ||||
|             set_index(tray_name); | ||||
|             Refresh(); | ||||
|             return; | ||||
|         } | ||||
|        | ||||
|         startAngle += ev_angle; | ||||
|     } | ||||
| 
 | ||||
|     evt.Skip(); | ||||
| } | ||||
| 
 | ||||
| void AmsRMGroup::paintEvent(wxPaintEvent& evt) | ||||
| { | ||||
|     wxPaintDC dc(this); | ||||
|     render(dc); | ||||
| } | ||||
| 
 | ||||
| void AmsRMArrow::render(wxDC& dc) | ||||
| void AmsRMGroup::render(wxDC& dc) | ||||
| { | ||||
| #ifdef __WXMSW__ | ||||
|     wxSize     size = GetSize(); | ||||
|  | @ -1487,17 +1405,121 @@ void AmsRMArrow::render(wxDC& dc) | |||
| #endif | ||||
| } | ||||
| 
 | ||||
| void AmsRMArrow::doRender(wxDC& dc) | ||||
| wxPoint AmsRMGroup::CalculateEndpoint(const wxPoint& startPoint, int angle, int length) | ||||
| { | ||||
|     int endX = startPoint.x + length * cos(angle * M_PI / 180); | ||||
|     int endY = startPoint.y + length * sin(angle * M_PI / 180); | ||||
|     return wxPoint(endX, endY); | ||||
| } | ||||
| 
 | ||||
| void AmsRMGroup::doRender(wxDC& dc) | ||||
| { | ||||
|     wxSize size = GetSize(); | ||||
|      | ||||
|     float center_mask_radius = FromDIP(52); | ||||
|     float selected_radius = FromDIP(53); | ||||
| 
 | ||||
|     dc.SetPen(wxPen(wxColour(0, 174, 66))); | ||||
|     dc.SetBrush(*wxTRANSPARENT_BRUSH); | ||||
|     float ev_angle = 360.0 / m_group_info.size(); | ||||
|     float startAngle = 0.0; | ||||
|     float endAngle = 0.0; | ||||
| 
 | ||||
|     dc.DrawBitmap(bitmap_bg.bmp(), wxPoint((size.x - bitmap_bg.GetBmpSize().x) / 2, (size.y - bitmap_bg.GetBmpSize().y) / 2)); | ||||
| 
 | ||||
|     dc.SetPen(wxPen(wxColour(0xACACAC))); | ||||
|     dc.SetBrush(wxBrush(wxColour(0xACACAC))); | ||||
|     dc.DrawCircle(size.x / 2, size.y / 2, FromDIP(7)); | ||||
|     for (auto iter = m_group_info.rbegin(); iter != m_group_info.rend(); ++iter) { | ||||
|         std::string tray_name = iter->first; | ||||
|         wxColour tray_color = iter->second; | ||||
| 
 | ||||
|         dc.SetPen(*wxTRANSPARENT_PEN); | ||||
| 
 | ||||
|         if (tray_color == *wxWHITE) dc.SetPen(wxPen(wxColour(0xEEEEEE), 2)); | ||||
|         dc.SetBrush(wxBrush(tray_color)); | ||||
| 
 | ||||
|         int x = size.x / 2; | ||||
|         int y = size.y / 2; | ||||
|         int radius = size.x / 2 - FromDIP(2); | ||||
|         endAngle += ev_angle; | ||||
| 
 | ||||
|   | ||||
|         //draw body
 | ||||
|         if (tray_color.Alpha() != 0) { | ||||
|             dc.DrawEllipticArc(x - radius, y - radius, radius * 2, radius * 2, startAngle, endAngle); | ||||
|             if (tray_color == *wxWHITE) dc.DrawEllipticArc(x - center_mask_radius, y - center_mask_radius, center_mask_radius * 2, center_mask_radius * 2, startAngle, endAngle); | ||||
|         } | ||||
| 
 | ||||
|         //draw selected
 | ||||
|         if (!m_selected_index.empty() && m_selected_index == tray_name) { | ||||
|             dc.SetPen(wxPen(0xCECECE, 2)); | ||||
|             dc.SetBrush(*wxTRANSPARENT_BRUSH); | ||||
|             dc.DrawEllipticArc(x - radius, y - radius, radius * 2, radius * 2, startAngle, endAngle); | ||||
|             dc.DrawEllipticArc(x - selected_radius, y - selected_radius,selected_radius * 2, selected_radius * 2,  startAngle, endAngle); | ||||
|         } | ||||
| 
 | ||||
|         //...
 | ||||
|         startAngle += ev_angle; | ||||
|     } | ||||
| 
 | ||||
|     //draw text
 | ||||
|     startAngle = 0.0; | ||||
|     endAngle = 0.0; | ||||
|     for (auto iter = m_group_info.rbegin(); iter != m_group_info.rend(); ++iter) { | ||||
|         std::string tray_name = iter->first; | ||||
|         wxColour tray_color = iter->second; | ||||
| 
 | ||||
|         int x = size.x / 2; | ||||
|         int y = size.y / 2; | ||||
|         float radius = size.x / 2 - 15.0; | ||||
|         endAngle += ev_angle; | ||||
| 
 | ||||
|         float midAngle = (startAngle + endAngle) / 2; | ||||
|         float x_center = size.x / 2 + radius * cos(midAngle * M_PI / 180.0); | ||||
|         float y_center = size.y / 2 + radius * sin(midAngle * M_PI / 180.0); | ||||
| 
 | ||||
|         //draw tray
 | ||||
|         dc.SetFont(::Label::Body_12); | ||||
|         auto text_size = dc.GetTextExtent(tray_name); | ||||
|         dc.SetTextForeground(tray_color.GetLuminance() < 0.5 ? *wxWHITE : wxColour(0x262E30)); | ||||
|         dc.DrawText(tray_name, x_center - text_size.x / 2, size.y - y_center - text_size.y / 2); | ||||
| 
 | ||||
|         //draw split line
 | ||||
|         dc.SetPen(wxPen(*wxWHITE, 2)); | ||||
|         dc.SetBrush(*wxTRANSPARENT_BRUSH); | ||||
|         auto pos_sp_start = CalculateEndpoint(wxPoint(x, y), (360 - startAngle),  size.x / 2 - FromDIP(3)); | ||||
|         dc.DrawLine(wxPoint(x, y), pos_sp_start); | ||||
| 
 | ||||
|         //draw current
 | ||||
|         //dc.DrawBitmap(backup_current_use_white.bmp(), x_center - text_size.x / 2 + FromDIP(3), size.y - y_center - text_size.y / 2 + FromDIP(11));
 | ||||
|         //...
 | ||||
|         startAngle += ev_angle; | ||||
|     } | ||||
| 
 | ||||
|     //draw center mask
 | ||||
|     dc.SetPen(*wxTRANSPARENT_PEN); | ||||
|     dc.SetBrush(wxBrush(*wxWHITE)); | ||||
| 
 | ||||
|     int x = size.x / 2; | ||||
|     int y = size.y / 2; | ||||
|     dc.DrawEllipticArc(x - center_mask_radius, y - center_mask_radius, center_mask_radius * 2, center_mask_radius * 2, 0, 360); | ||||
| 
 | ||||
|     //draw center icon
 | ||||
|     dc.DrawBitmap(bitmap_backup_tips_0.bmp(), wxPoint((size.x - bitmap_backup_tips_0.GetBmpSize().x) / 2, (size.y - bitmap_backup_tips_0.GetBmpSize().y) / 2)); | ||||
|     //dc.DrawBitmap(bitmap_backup_tips_1.bmp(), wxPoint((size.x - bitmap_backup_tips_1.GetBmpSize().x) / 2, (size.y - bitmap_backup_tips_1.GetBmpSize().y) / 2));
 | ||||
| 
 | ||||
|     //draw material
 | ||||
|     dc.SetTextForeground(wxColour(0x323A3D)); | ||||
|     dc.SetFont(Label::Head_15); | ||||
|     auto text_size = dc.GetTextExtent(m_material_name); | ||||
|     dc.DrawText(m_material_name, (size.x - text_size.x) / 2,(size.y - text_size.y) / 2 - FromDIP(12)); | ||||
| 
 | ||||
|     dc.SetFont(Label::Body_13); | ||||
|     text_size = dc.GetTextExtent(m_group_index); | ||||
|     dc.DrawText(m_group_index, (size.x - text_size.x) / 2, (size.y - text_size.y) / 2 + FromDIP(10)); | ||||
| 
 | ||||
|     /* if (wxGetApp().dark_mode()) {
 | ||||
|          dc.DrawBitmap(bitmap_editable_light.bmp(), wxPoint((size.x - bitmap_editable_light.GetBmpSize().x) / 2, (size.y - bitmap_editable_light.GetBmpSize().y) / 2 + FromDIP(15))); | ||||
|      } | ||||
|      else { | ||||
|          dc.DrawBitmap(bitmap_editable.bmp(), wxPoint((size.x - bitmap_editable_light.GetBmpSize().x) / 2, (size.y - bitmap_editable_light.GetBmpSize().y) / 2 + FromDIP(15))); | ||||
|      }*/ | ||||
| } | ||||
| 
 | ||||
| }} // namespace Slic3r::GUI
 | ||||
|  |  | |||
|  | @ -244,6 +244,35 @@ public: | |||
| }; | ||||
| 
 | ||||
| 
 | ||||
| class AmsRMGroup : public wxWindow | ||||
| { | ||||
| public: | ||||
|     AmsRMGroup(wxWindow* parent, std::map<std::string, wxColour> group_info, wxString mname, wxString group_index); | ||||
|     ~AmsRMGroup() {}; | ||||
| 
 | ||||
| public: | ||||
|     void set_index(std::string index) {m_selected_index = index;}; | ||||
|     void paintEvent(wxPaintEvent& evt); | ||||
|     void render(wxDC& dc); | ||||
|     void doRender(wxDC& dc); | ||||
|     void on_mouse_move(wxMouseEvent& evt); | ||||
|      | ||||
|     double GetAngle(wxPoint pointA, wxPoint pointB); | ||||
|     wxPoint CalculateEndpoint(const wxPoint& startPoint, int angle, int length); | ||||
| private: | ||||
|     std::map<std::string, wxColour> m_group_info; | ||||
|     std::string     m_selected_index; | ||||
|     ScalableBitmap  backup_current_use_white; | ||||
|     ScalableBitmap  backup_current_use_black; | ||||
|     ScalableBitmap  bitmap_backup_tips_0; | ||||
|     ScalableBitmap  bitmap_backup_tips_1; | ||||
|     ScalableBitmap  bitmap_editable; | ||||
|     ScalableBitmap  bitmap_bg; | ||||
|     ScalableBitmap  bitmap_editable_light; | ||||
|     wxString        m_material_name; | ||||
|     wxString        m_group_index; | ||||
| }; | ||||
| 
 | ||||
| class AmsReplaceMaterialDialog : public DPIDialog | ||||
| { | ||||
| public: | ||||
|  | @ -251,68 +280,21 @@ public: | |||
|     ~AmsReplaceMaterialDialog() {}; | ||||
| 
 | ||||
| public: | ||||
|     wxWindow*   create_split_line(wxString gname, wxColour col, wxString material, std::vector<bool> status_list); | ||||
|     AmsRMGroup* create_backup_group(wxString gname, std::map<std::string, wxColour> group_info, wxString material, std::vector<bool> status_list); | ||||
|     void        create(); | ||||
|     void        update_machine_obj(MachineObject* obj); | ||||
|     void        on_left_down(wxMouseEvent& evt); | ||||
|     void        paintEvent(wxPaintEvent& evt); | ||||
|     void        on_dpi_changed(const wxRect &suggested_rect) override; | ||||
|     void        on_dpi_changed(const wxRect& suggested_rect) override; | ||||
|     std::vector<bool>        GetStatus(unsigned int status); | ||||
| 
 | ||||
| public: | ||||
|     wxBoxSizer* m_main_sizer{nullptr}; | ||||
|     wxBoxSizer* m_groups_sizer{nullptr}; | ||||
|     wxBoxSizer* m_main_sizer{ nullptr }; | ||||
|     wxWrapSizer* m_groups_sizer{ nullptr }; | ||||
| 
 | ||||
|     MachineObject* m_obj{nullptr}; | ||||
|     MachineObject* m_obj{ nullptr }; | ||||
| }; | ||||
| 
 | ||||
| 
 | ||||
| enum RMTYPE { | ||||
|     RMTYPE_NORMAL   = 0, | ||||
|     RMTYPE_VIRTUAL  = 1, | ||||
| }; | ||||
| 
 | ||||
| class AmsRMItem : public wxWindow | ||||
| { | ||||
| public: | ||||
|     AmsRMItem(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize); | ||||
|     ~AmsRMItem() {}; | ||||
| 
 | ||||
| public: | ||||
|     void set_color(wxColour col) {m_color = col;}; | ||||
|     void set_type(RMTYPE type) {m_type = type;}; | ||||
|     void set_index(std::string index) {m_index = index;}; | ||||
|     void set_focus(bool focus) {m_focus = focus;}; | ||||
| 
 | ||||
|     void paintEvent(wxPaintEvent& evt); | ||||
|     void render(wxDC& dc); | ||||
|     void doRender(wxDC& dc); | ||||
| 
 | ||||
| private: | ||||
|     RMTYPE      m_type; | ||||
|     wxColour    m_color; | ||||
|     std::string m_index; | ||||
|     bool        m_focus = false; | ||||
|     bool        m_selected = false; | ||||
| }; | ||||
| 
 | ||||
| class AmsRMArrow : public wxWindow | ||||
| { | ||||
| public: | ||||
|     AmsRMArrow(wxWindow* parent); | ||||
|     ~AmsRMArrow() {}; | ||||
| 
 | ||||
| public: | ||||
|     void paintEvent(wxPaintEvent& evt); | ||||
|     void render(wxDC& dc); | ||||
|     void doRender(wxDC& dc); | ||||
| 
 | ||||
| private: | ||||
|     ScalableBitmap m_bitmap_left; | ||||
|     ScalableBitmap m_bitmap_right; | ||||
|     ScalableBitmap m_bitmap_down; | ||||
| }; | ||||
| 
 | ||||
| wxDECLARE_EVENT(EVT_SET_FINISH_MAPPING, wxCommandEvent); | ||||
| 
 | ||||
| }} // namespace Slic3r::GUI
 | ||||
|  |  | |||
|  | @ -1554,7 +1554,7 @@ void SelectMachineDialog::popup_filament_backup() | |||
| { | ||||
|     DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager(); | ||||
|     if (!dev) return; | ||||
|     if (dev->get_selected_machine() && dev->get_selected_machine()->filam_bak.size() > 0) { | ||||
|     if (dev->get_selected_machine()/* && dev->get_selected_machine()->filam_bak.size() > 0*/) { | ||||
|         AmsReplaceMaterialDialog* m_replace_material_popup = new AmsReplaceMaterialDialog(this); | ||||
|         m_replace_material_popup->update_machine_obj(dev->get_selected_machine()); | ||||
|         m_replace_material_popup->ShowModal(); | ||||
|  |  | |||
|  | @ -2842,7 +2842,7 @@ void StatusPanel::on_ams_unload(SimpleEvent &event) | |||
| 
 | ||||
| void StatusPanel::on_ams_filament_backup(SimpleEvent& event) | ||||
| { | ||||
|     if (obj && obj->filam_bak.size() > 0) { | ||||
|     if (obj /*&& obj->filam_bak.size() > 0*/) { | ||||
|         AmsReplaceMaterialDialog* m_replace_material_popup = new AmsReplaceMaterialDialog(this); | ||||
|         m_replace_material_popup->update_machine_obj(obj); | ||||
|         m_replace_material_popup->ShowModal(); | ||||
|  |  | |||
|  | @ -13,6 +13,7 @@ | |||
| #include <wx/animate.h> | ||||
| #include <wx/dynarray.h> | ||||
| 
 | ||||
| #define FILAMENT_BACKUP 1 | ||||
| #define AMS_CONTROL_BRAND_COLOUR wxColour(0, 174, 66) | ||||
| #define AMS_CONTROL_GRAY700 wxColour(107, 107, 107) | ||||
| #define AMS_CONTROL_GRAY800 wxColour(50, 58, 61) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 tao wang
						tao wang