NEW:update the style when the virtual tray is empty

Change-Id: I40fc05ce31ed9225e5dea6d080fdbff138b2f9d8
This commit is contained in:
tao wang 2023-05-25 14:28:53 +08:00 committed by Lane.Wei
parent c1010e5d0e
commit 73d3b37979
4 changed files with 35 additions and 5 deletions

View File

@ -631,6 +631,13 @@ void AMSMaterialsSetting::on_select_close(wxCommandEvent &event)
void AMSMaterialsSetting::set_color(wxColour color)
{
//m_clrData->SetColour(color);
m_clr_picker->is_empty(false);
m_clr_picker->set_color(color);
}
void AMSMaterialsSetting::set_empty_color(wxColour color)
{
m_clr_picker->is_empty(true);
m_clr_picker->set_color(color);
}
@ -1032,6 +1039,13 @@ void ColorPicker::doRender(wxDC& dc)
dc.DrawBitmap(m_bitmap_border, wxPoint(0, 0));
}
}
if (m_is_empty) {
dc.SetTextForeground(*wxBLACK);
auto tsize = dc.GetTextExtent("?");
auto pot = wxPoint((size.x - tsize.x) / 2, (size.y - tsize.y) / 2);
dc.DrawText("?", pot);
}
}
ColorPickerPopup::ColorPickerPopup(wxWindow* parent)

View File

@ -38,7 +38,8 @@ public:
std::vector<wxColour> m_cols;
bool m_selected{false};
bool m_show_full{false};
bool m_is_empty{false};
ColorPicker(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize);
~ColorPicker();
@ -47,6 +48,7 @@ public:
void set_colors(std::vector<wxColour> cols);
void set_selected(bool sel) {m_selected = sel;Refresh();};
void set_show_full(bool full) {m_show_full = full;Refresh();};
void is_empty(bool empty) {m_is_empty = empty;};
void paintEvent(wxPaintEvent& evt);
void render(wxDC& dc);
@ -101,6 +103,7 @@ public:
void post_select_event();
void msw_rescale();
void set_color(wxColour color);
void set_empty_color(wxColour color);
void set_colors(std::vector<wxColour> colors);
void on_picker_color(wxCommandEvent& color);

View File

@ -2975,7 +2975,12 @@ void StatusPanel::on_filament_edit(wxCommandEvent &event)
cols.push_back( AmsTray::decode_color(col));
}
m_filament_setting_dlg->set_colors(cols);
if (m_filament_setting_dlg->ams_filament_id.empty()) {
m_filament_setting_dlg->set_empty_color(color);
}
else {
m_filament_setting_dlg->set_color(color);
}
m_filament_setting_dlg->ams_filament_id = tray_it->second->setting_id;
m_filament_setting_dlg->m_is_third = !MachineObject::is_bbl_filament(tray_it->second->tag_uid);
@ -3014,8 +3019,16 @@ void StatusPanel::on_ext_spool_edit(wxCommandEvent &event)
k_val = wxString::Format("%.3f", obj->vt_tray.k);
n_val = wxString::Format("%.3f", obj->vt_tray.n);
wxColor color = AmsTray::decode_color(obj->vt_tray.color);
m_filament_setting_dlg->set_color(color);
m_filament_setting_dlg->ams_filament_id = obj->vt_tray.setting_id;
if (m_filament_setting_dlg->ams_filament_id.empty()) {
m_filament_setting_dlg->set_empty_color(color);
}
else {
m_filament_setting_dlg->set_color(color);
}
m_filament_setting_dlg->m_is_third = !MachineObject::is_bbl_filament(obj->vt_tray.tag_uid);
if (!m_filament_setting_dlg->m_is_third) {
sn_number = obj->vt_tray.uuid;

View File

@ -736,10 +736,10 @@ void AMSLib::render(wxDC &dc)
|| m_info.material_state == AMSCanType::AMS_CAN_TYPE_BRAND
|| m_info.material_state == AMSCanType::AMS_CAN_TYPE_VIRTUAL) {
if (m_info.material_name.empty() && m_info.material_state != AMSCanType::AMS_CAN_TYPE_VIRTUAL) {
if (m_info.material_name.empty() /*&& m_info.material_state != AMSCanType::AMS_CAN_TYPE_VIRTUAL*/) {
auto tsize = dc.GetMultiLineTextExtent("?");
auto pot = wxPoint(0, 0);
if (m_show_kn) {
if (m_obj->is_function_supported(PrinterFunction::FUNC_EXTRUSION_CALI)) {
pot = wxPoint((libsize.x - tsize.x) / 2, (libsize.y - tsize.y) / 2 - FromDIP(9));
} else {
pot = wxPoint((libsize.x - tsize.x) / 2, (libsize.y - tsize.y) / 2 + FromDIP(3));