mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-16 10:02:12 +00:00
FIX:fixed some amscontrol issue
jira:[for fix amscontrol issue] Change-Id: Id62ffd047403bf80f6aba732b8ce31d782bcea57 (cherry picked from commit 55898ab88ee844dd7da17d992ad8f79e439f96a0)
This commit is contained in:
@@ -118,6 +118,7 @@ public:
|
||||
void on_picker_color(wxCommandEvent& color);
|
||||
MachineObject* obj{ nullptr };
|
||||
int ams_id { 0 }; /* 0 ~ 3 */
|
||||
int slot_id { 0 }; /* 0 ~ 3 */
|
||||
int tray_id { 0 }; /* 0 ~ 3 */
|
||||
|
||||
std::string ams_filament_id;
|
||||
|
||||
@@ -3686,34 +3686,26 @@ void StatusPanel::on_filament_edit(wxCommandEvent &event)
|
||||
|
||||
if (obj) {
|
||||
m_filament_setting_dlg->obj = obj;
|
||||
std::string ams_id;
|
||||
int ams_id_int = 0;
|
||||
int tray_id_int = 0;
|
||||
int tray_id = event.GetInt();
|
||||
if (tray_id == VIRTUAL_TRAY_ID) {
|
||||
ams_id = std::to_string(tray_id);
|
||||
}
|
||||
else{
|
||||
ams_id = std::to_string(tray_id / 4);
|
||||
}
|
||||
|
||||
if (ams_id.compare(std::to_string(VIRTUAL_TRAY_ID)) == 0) {
|
||||
tray_id_int = VIRTUAL_TRAY_ID;
|
||||
int ams_id = event.GetInt();
|
||||
int slot_id = event.GetString().IsEmpty() ? 0 : std::stoi(event.GetString().ToStdString());
|
||||
|
||||
/* if (ams_id.compare(std::to_string(VIRTUAL_TRAY_MAIN_ID)) == 0) {
|
||||
tray_id_int = VIRTUAL_TRAY_MAIN_ID;
|
||||
m_filament_setting_dlg->ams_id = ams_id_int;
|
||||
m_filament_setting_dlg->tray_id = tray_id_int;
|
||||
wxString k_val;
|
||||
wxString n_val;
|
||||
k_val = wxString::Format("%.3f", obj->vt_tray.k);
|
||||
n_val = wxString::Format("%.3f", obj->vt_tray.n);
|
||||
k_val = wxString::Format("%.3f", obj->vt_slot[0].k);
|
||||
n_val = wxString::Format("%.3f", obj->vt_slot[0].n);
|
||||
m_filament_setting_dlg->Move(wxPoint(current_position_x, current_position_y));
|
||||
m_filament_setting_dlg->Popup(wxEmptyString, wxEmptyString, wxEmptyString, wxEmptyString, k_val, n_val);
|
||||
} else {
|
||||
} else {*/
|
||||
//std::string tray_id = event.GetString().ToStdString(); // m_ams_control->GetCurrentCan(ams_id);
|
||||
try {
|
||||
ams_id_int = tray_id / 4;
|
||||
tray_id_int = tray_id % 4;
|
||||
m_filament_setting_dlg->ams_id = ams_id_int;
|
||||
m_filament_setting_dlg->tray_id = tray_id_int;
|
||||
m_filament_setting_dlg->ams_id = ams_id;
|
||||
m_filament_setting_dlg->slot_id = slot_id;
|
||||
//m_filament_setting_dlg->tray_id = 254;
|
||||
|
||||
std::string sn_number;
|
||||
std::string filament;
|
||||
@@ -3721,9 +3713,9 @@ void StatusPanel::on_filament_edit(wxCommandEvent &event)
|
||||
std::string temp_min;
|
||||
wxString k_val;
|
||||
wxString n_val;
|
||||
auto it = obj->amsList.find(std::to_string(ams_id_int));
|
||||
auto it = obj->amsList.find(std::to_string(ams_id));
|
||||
if (it != obj->amsList.end()) {
|
||||
auto tray_it = it->second->trayList.find(std::to_string(tray_id));
|
||||
auto tray_it = it->second->trayList.find(std::to_string(slot_id));
|
||||
if (tray_it != it->second->trayList.end()) {
|
||||
k_val = wxString::Format("%.3f", tray_it->second->k);
|
||||
n_val = wxString::Format("%.3f", tray_it->second->n);
|
||||
@@ -3761,7 +3753,7 @@ void StatusPanel::on_filament_edit(wxCommandEvent &event)
|
||||
catch (...) {
|
||||
;
|
||||
}
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3776,12 +3768,16 @@ void StatusPanel::on_ext_spool_edit(wxCommandEvent &event)
|
||||
current_position_y = current_position_y + m_filament_setting_dlg->GetSize().GetHeight() > drect ? drect - m_filament_setting_dlg->GetSize().GetHeight() : current_position_y;
|
||||
|
||||
if (obj) {
|
||||
int tray_id = event.GetInt();
|
||||
int ams_id = tray_id;
|
||||
m_filament_setting_dlg->obj = obj;
|
||||
|
||||
int ams_id = event.GetInt();
|
||||
int slot_id = event.GetString().IsEmpty() ? 0 : std::stoi(event.GetString().ToStdString());
|
||||
|
||||
m_filament_setting_dlg->ams_id = ams_id;
|
||||
m_filament_setting_dlg->slot_id = slot_id;
|
||||
m_filament_setting_dlg->tray_id = VIRTUAL_TRAY_ID;
|
||||
|
||||
try {
|
||||
m_filament_setting_dlg->tray_id = VIRTUAL_TRAY_ID;
|
||||
std::string sn_number;
|
||||
std::string filament;
|
||||
std::string temp_max;
|
||||
|
||||
@@ -262,7 +262,8 @@ AMSControl::AMSControl(wxWindow *parent, wxWindowID id, const wxPoint &pos, cons
|
||||
auto vams_panel = new wxWindow(m_panel_virtual, wxID_ANY);
|
||||
vams_panel->SetBackgroundColour(AMS_CONTROL_DEF_BLOCK_BK_COLOUR);
|
||||
|
||||
m_vams_lib = new AMSLib(vams_panel, "0", m_vams_info);
|
||||
m_vams_lib = new AMSLib(vams_panel, m_vams_info.can_id, m_vams_info);
|
||||
m_vams_lib->m_slot_id = m_vams_info.can_id;
|
||||
m_vams_road = new AMSRoad(vams_panel, wxID_ANY, m_vams_info, -1, -1, wxDefaultPosition, AMS_CAN_ROAD_SIZE);
|
||||
|
||||
m_vams_lib->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {
|
||||
|
||||
@@ -100,7 +100,8 @@ bool AMSinfo::parse_ams_info(MachineObject *obj, Ams *ams, bool remain_flag, boo
|
||||
info.n = it->second->n;
|
||||
}
|
||||
} else {
|
||||
info.can_id = i;
|
||||
//info.can_id = i;
|
||||
info.can_id = std::to_string(i);
|
||||
info.material_state = AMSCanType::AMS_CAN_TYPE_EMPTY;
|
||||
}
|
||||
cans.push_back(info);
|
||||
@@ -1332,9 +1333,10 @@ void AMSLib::Update(Caninfo info, std::string ams_idx, bool refresh)
|
||||
if (info.material_colour.Alpha() != 0 && info.material_colour.Alpha() != 255 && info.material_colour.Alpha() != 254 && m_info.material_colour != info.material_colour) {
|
||||
transparent_changed = true;
|
||||
}
|
||||
|
||||
m_info = info;
|
||||
m_ams_id = ams_idx;
|
||||
Layout();
|
||||
m_slot_id = info.can_id;
|
||||
if (refresh) Refresh();
|
||||
}
|
||||
|
||||
@@ -1352,9 +1354,10 @@ void AMSLib::OnSelected()
|
||||
|
||||
void AMSLib::post_event(wxCommandEvent &&event)
|
||||
{
|
||||
int tray_id = atoi(m_ams_id.c_str()) * 4 + atoi(m_info.can_id.c_str());
|
||||
//int tray_id = atoi(m_ams_id.c_str()) * 4 + atoi(m_info.can_id.c_str());
|
||||
//event.SetString(m_info.can_id);
|
||||
event.SetInt(tray_id);
|
||||
event.SetString(m_slot_id);
|
||||
event.SetInt(std::stoi(m_ams_id));
|
||||
event.SetEventObject(m_parent);
|
||||
wxPostEvent(m_parent, event);
|
||||
event.Skip();
|
||||
@@ -1759,7 +1762,9 @@ void AmsCans::AddCan(Caninfo caninfo, int canindex, int maxcan, wxBoxSizer* size
|
||||
});
|
||||
|
||||
|
||||
m_panel_lib->m_ams_model = m_ams_model;
|
||||
m_panel_lib->m_ams_model = m_ams_model;
|
||||
m_panel_lib->m_ams_id = m_info.ams_id;
|
||||
m_panel_lib->m_slot_id = caninfo.can_id;
|
||||
m_panel_lib->m_info.can_id = caninfo.can_id;
|
||||
m_panel_lib->m_can_index = canindex;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user