diff --git a/src/slic3r/GUI/Widgets/AMSControl.cpp b/src/slic3r/GUI/Widgets/AMSControl.cpp index 73dfd89edc..a882f50075 100644 --- a/src/slic3r/GUI/Widgets/AMSControl.cpp +++ b/src/slic3r/GUI/Widgets/AMSControl.cpp @@ -4,6 +4,8 @@ #include "../I18N.hpp" #include "../GUI_App.hpp" +#include "slic3r/GUI/DeviceTab/uiAmsHumidityPopup.h" + #include #include @@ -21,6 +23,7 @@ namespace Slic3r { namespace GUI { AMSControl::AMSControl(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size) : wxSimplebook(parent, wxID_ANY, pos, size) , m_Humidity_tip_popup(AmsHumidityTipPopup(this)) + , m_percent_humidity_dry_popup(new uiAmsPercentHumidityDryPopup(this)) , m_ams_introduce_popup(AmsIntroducePopup(this)) { Slic3r::DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager(); @@ -270,15 +273,31 @@ AMSControl::AMSControl(wxWindow *parent, wxWindowID id, const wxPoint &pos, cons }); Bind(EVT_AMS_SHOW_HUMIDITY_TIPS, [this](wxCommandEvent& evt) { + uiAmsHumidityInfo *info = (uiAmsHumidityInfo *) evt.GetClientData(); + if (info) + { + if (info->humidity_percent >= 0) + { + m_percent_humidity_dry_popup->Update(info); - wxPoint img_pos = ClientToScreen(wxPoint(0, 0)); - wxPoint popup_pos(img_pos.x - m_Humidity_tip_popup.GetSize().GetWidth() + FromDIP(150), img_pos.y - FromDIP(80)); - m_Humidity_tip_popup.Position(popup_pos, wxSize(0, 0)); - int humidity_value = evt.GetInt(); - if (humidity_value > 0 && humidity_value <= 5) { - m_Humidity_tip_popup.set_humidity_level(humidity_value); + wxPoint img_pos = ClientToScreen(wxPoint(0, 0)); + wxPoint popup_pos(img_pos.x - m_percent_humidity_dry_popup->GetSize().GetWidth() + FromDIP(150), img_pos.y - FromDIP(80)); + m_percent_humidity_dry_popup->Position(popup_pos, wxSize(0, 0)); + m_percent_humidity_dry_popup->Popup(); + } + else + { + wxPoint img_pos = ClientToScreen(wxPoint(0, 0)); + wxPoint popup_pos(img_pos.x - m_Humidity_tip_popup.GetSize().GetWidth() + FromDIP(150), img_pos.y - FromDIP(80)); + m_Humidity_tip_popup.Position(popup_pos, wxSize(0, 0)); + + int humidity_value = info->humidity_level; + if (humidity_value > 0 && humidity_value <= 5) { m_Humidity_tip_popup.set_humidity_level(humidity_value); } + m_Humidity_tip_popup.Popup(); + } } - m_Humidity_tip_popup.Popup(); + + delete info; }); Bind(EVT_AMS_ON_SELECTED, &AMSControl::AmsSelectedSwitch, this); } @@ -496,6 +515,10 @@ void AMSControl::msw_rescale() m_down_road->msw_rescale(); } + if (m_percent_humidity_dry_popup){ + m_percent_humidity_dry_popup->msw_rescale(); + } + Layout(); Refresh(); } diff --git a/src/slic3r/GUI/Widgets/AMSControl.hpp b/src/slic3r/GUI/Widgets/AMSControl.hpp index ff7b885856..20d8673335 100644 --- a/src/slic3r/GUI/Widgets/AMSControl.hpp +++ b/src/slic3r/GUI/Widgets/AMSControl.hpp @@ -17,6 +17,9 @@ namespace Slic3r { namespace GUI { +//Previous definitions +class uiAmsPercentHumidityDryPopup; + class AMSControl : public wxSimplebook { public: @@ -112,6 +115,7 @@ protected: ScalableBitmap m_button_ams_setting_press; AmsHumidityTipPopup m_Humidity_tip_popup; + uiAmsPercentHumidityDryPopup* m_percent_humidity_dry_popup; std::string m_last_ams_id = ""; std::string m_last_tray_id = ""; diff --git a/src/slic3r/GUI/Widgets/AMSItem.cpp b/src/slic3r/GUI/Widgets/AMSItem.cpp index b8fd455c01..bf3c9d67e8 100644 --- a/src/slic3r/GUI/Widgets/AMSItem.cpp +++ b/src/slic3r/GUI/Widgets/AMSItem.cpp @@ -5,6 +5,8 @@ #include "../GUI_App.hpp" #include "../Utils/WxFontUtils.hpp" +#include "slic3r/GUI/DeviceTab/uiAmsHumidityPopup.h" + #include #include @@ -55,6 +57,7 @@ bool AMSinfo::parse_ams_info(MachineObject *obj, Ams *ams, bool remain_flag, boo this->humidity_raw = ams->humidity_raw; this->left_dray_time = ams->left_dry_time; + this->current_temperature = ams->current_temperature; this->ams_type = AMSModel(ams->type); nozzle_id = ams->nozzle; @@ -2784,7 +2787,13 @@ AMSHumidity::AMSHumidity(wxWindow* parent, wxWindowID id, AMSinfo info, const wx if (mouse_pos.x > rect.x && mouse_pos.y > rect.y) { wxCommandEvent show_event(EVT_AMS_SHOW_HUMIDITY_TIPS); - show_event.SetInt(m_amsinfo.ams_humidity); + + uiAmsHumidityInfo *info = new uiAmsHumidityInfo; + info->humidity_level = m_amsinfo.ams_humidity; + info->humidity_percent = m_amsinfo.humidity_raw; + info->left_dry_time = m_amsinfo.left_dray_time; + info->current_temperature = m_amsinfo.current_temperature; + show_event.SetClientData(info); wxPostEvent(GetParent()->GetParent(), show_event); #ifdef __WXMSW__ diff --git a/src/slic3r/GUI/Widgets/AMSItem.hpp b/src/slic3r/GUI/Widgets/AMSItem.hpp index 60135e42bd..dfdd6c52d9 100644 --- a/src/slic3r/GUI/Widgets/AMSItem.hpp +++ b/src/slic3r/GUI/Widgets/AMSItem.hpp @@ -219,6 +219,7 @@ public: int ams_humidity = 0; int humidity_raw = -1; int left_dray_time = 0; + float current_temperature = INVALID_AMS_TEMPERATURE; AMSModel ams_type = AMSModel::GENERIC_AMS; AMSModelOriginType ext_type = AMSModelOriginType::GENERIC_EXT; @@ -234,6 +235,7 @@ public: curreent_filamentstep == other.curreent_filamentstep && ams_humidity == other.ams_humidity && left_dray_time == other.left_dray_time && + current_temperature == other.current_temperature && ams_type == other.ams_type && ext_type == other.ext_type) {