Fix H2D AMS render

This commit is contained in:
Noisyfox 2025-05-25 16:45:31 +08:00
parent 67ccaa3f6c
commit 59c2a453ab
2 changed files with 18 additions and 17 deletions

View file

@ -18,6 +18,7 @@ namespace Slic3r { namespace GUI {
#define AMS_CANS_SIZE wxSize(FromDIP(284), FromDIP(196))
#define AMS_CANS_WINDOW_SIZE wxSize(FromDIP(264), FromDIP(196))
#define IS_GENERIC_AMS(model) (model != AMSModel::AMS_LITE && model != AMSModel::EXT_AMS)
AMSControl::AMSControl(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size)
: wxSimplebook(parent, wxID_ANY, pos, size)
@ -851,7 +852,7 @@ void AMSControl::UpdateStepCtrl(bool is_extrusion)
m_filament_unload_step->DeleteAllItems();
m_filament_vt_load_step->DeleteAllItems();
if (m_ams_model == AMSModel::GENERIC_AMS || m_ext_model == AMSModel::GENERIC_AMS) {
if (IS_GENERIC_AMS(m_ams_model) || IS_GENERIC_AMS(m_ext_model)) {
if (is_extrusion) {
m_filament_load_step->AppendItem(FILAMENT_CHANGE_STEP_STRING[FilamentStep::STEP_HEAT_NOZZLE]);
m_filament_load_step->AppendItem(FILAMENT_CHANGE_STEP_STRING[FilamentStep::STEP_CUT_FILAMENT]);
@ -980,7 +981,7 @@ void AMSControl::show_noams_mode()
if (m_ams_model == AMSModel::EXT_AMS) {
EnterNoneAMSMode();
} else if(m_ams_model == AMSModel::GENERIC_AMS){
} else if (IS_GENERIC_AMS(m_ams_model)){
EnterGenericAMSMode();
} else if (m_ams_model == AMSModel::AMS_LITE) {
EnterExtraAMSMode();
@ -1090,7 +1091,7 @@ void AMSControl::UpdateAms(std::vector<AMSinfo> ams_info, bool is_reset)
Layout();
}
if (m_ams_model == AMSModel::GENERIC_AMS){
if (IS_GENERIC_AMS(m_ams_model)) {
m_ams_item_list = m_ams_generic_item_list;
}
else if (m_ams_model == AMSModel::AMS_LITE) {
@ -1247,7 +1248,7 @@ void AMSControl::SwitchAms(std::string ams_id)
AmsItem* item = ams_item.second;
if (item->get_ams_id() == ams_id) {
if (m_ams_model == AMSModel::GENERIC_AMS) {
if (IS_GENERIC_AMS(m_ams_model)) {
m_simplebook_generic_ams->SetSelection(item->get_selection());
}
else if (m_ams_model == AMSModel::AMS_LITE) {
@ -1385,7 +1386,7 @@ bool AMSControl::Enable(bool enable)
void AMSControl::SetExtruder(bool on_off, bool is_vams, std::string ams_now, wxColour col)
{
if (m_ams_model == AMSModel::GENERIC_AMS || m_ext_model == AMSModel::GENERIC_AMS ) {
if (IS_GENERIC_AMS(m_ams_model) || IS_GENERIC_AMS(m_ext_model)) {
if (!on_off) {
m_extruder->TurnOff();
m_vams_extra_road->OnVamsLoading(false);
@ -1459,7 +1460,7 @@ void AMSControl::SetAmsStep(std::string ams_id, std::string canid, AMSPassRoadTy
m_last_tray_id = canid;
if (m_ams_model == AMSModel::GENERIC_AMS) {
if (IS_GENERIC_AMS(m_ams_model)) {
if (step == AMSPassRoadSTEP::AMS_ROAD_STEP_NONE) {
ams->SetAmsStep(canid, type, AMSPassRoadSTEP::AMS_ROAD_STEP_NONE);
m_extruder->OnAmsLoading(false);

View file

@ -713,7 +713,7 @@ void AMSLib::on_left_down(wxMouseEvent &evt)
auto top = 0;
auto bottom = 0;
if (m_ams_model == AMSModel::GENERIC_AMS) {
if (m_ams_model == AMSModel::GENERIC_AMS || m_ams_model == AMSModel::N3F_AMS || m_ams_model == AMSModel::N3S_AMS || m_ams_model == AMSModel::EXT_AMS) {
top = (size.y - FromDIP(15) - m_bitmap_editable_light.GetBmpSize().y);
bottom = size.y - FromDIP(15);
}
@ -766,12 +766,12 @@ void AMSLib::render(wxDC &dc)
#endif
// text
if (m_ams_model == AMSModel::GENERIC_AMS) {
render_generic_text(dc);
}
else if (m_ams_model == AMSModel::AMS_LITE) {
if (m_ams_model == AMSModel::AMS_LITE) {
render_lite_text(dc);
}
else{
render_generic_text(dc);
}
}
void AMSLib::render_lite_text(wxDC& dc)
@ -983,12 +983,12 @@ void AMSLib::render_generic_text(wxDC &dc)
void AMSLib::doRender(wxDC &dc)
{
if (m_ams_model == AMSModel::GENERIC_AMS) {
render_generic_lib(dc);
}
else if (m_ams_model == AMSModel::AMS_LITE) {
if (m_ams_model == AMSModel::AMS_LITE) {
render_lite_lib(dc);
}
else {
render_generic_lib(dc);
}
}
void AMSLib::render_lite_lib(wxDC& dc)
@ -2143,7 +2143,7 @@ void AmsItem::AddCan(Caninfo caninfo, int canindex, int maxcan, wxBoxSizer* size
auto m_panel_road = new AMSRoad(amscan, wxID_ANY, caninfo, canindex, maxcan, wxDefaultPosition, AMS_CAN_ROAD_SIZE);
if (m_ams_model == AMSModel::GENERIC_AMS) {
if (m_ams_model != AMSModel::AMS_LITE && m_ams_model != AMSModel::EXT_AMS) {
//m_sizer_ams->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(2));
m_sizer_ams->Add(m_panel_refresh, 0, wxALIGN_CENTER_HORIZONTAL, 0);
//m_sizer_ams->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(2));
@ -2168,7 +2168,7 @@ void AmsItem::AddCan(Caninfo caninfo, int canindex, int maxcan, wxBoxSizer* size
amscan->Layout();
amscan->Fit();
if (m_ams_model == AMSModel::GENERIC_AMS) {
if (m_ams_model != AMSModel::AMS_LITE && m_ams_model != AMSModel::EXT_AMS) {
sizer->Add(amscan, 0, wxALL, 0);
}
else if (m_ams_model == AMSModel::AMS_LITE)