diff --git a/resources/images/hum_level1_dark.svg b/resources/images/hum_level1_dark.svg index 16511f4f53..71c6e6b804 100644 --- a/resources/images/hum_level1_dark.svg +++ b/resources/images/hum_level1_dark.svg @@ -1,5 +1,5 @@ - + diff --git a/resources/images/hum_level1_light.svg b/resources/images/hum_level1_light.svg index 37870888f9..3d6ec046b3 100644 --- a/resources/images/hum_level1_light.svg +++ b/resources/images/hum_level1_light.svg @@ -1,5 +1,5 @@ - + diff --git a/resources/images/hum_level2_dark.svg b/resources/images/hum_level2_dark.svg index 66951ad474..4331b51a1f 100644 --- a/resources/images/hum_level2_dark.svg +++ b/resources/images/hum_level2_dark.svg @@ -1,5 +1,5 @@ - + diff --git a/resources/images/hum_level2_light.svg b/resources/images/hum_level2_light.svg index 4d62440ae4..47d16552e6 100644 --- a/resources/images/hum_level2_light.svg +++ b/resources/images/hum_level2_light.svg @@ -1,5 +1,5 @@ - + diff --git a/resources/images/hum_level3_dark.svg b/resources/images/hum_level3_dark.svg index be9f85965d..072f24bf73 100644 --- a/resources/images/hum_level3_dark.svg +++ b/resources/images/hum_level3_dark.svg @@ -1,5 +1,5 @@ - + diff --git a/resources/images/hum_level3_light.svg b/resources/images/hum_level3_light.svg index 2c0334ee35..c521fc487e 100644 --- a/resources/images/hum_level3_light.svg +++ b/resources/images/hum_level3_light.svg @@ -1,5 +1,5 @@ - + diff --git a/resources/images/hum_level4_dark.svg b/resources/images/hum_level4_dark.svg index 4dc749ccb9..1eba7119b5 100644 --- a/resources/images/hum_level4_dark.svg +++ b/resources/images/hum_level4_dark.svg @@ -1,5 +1,5 @@ - + diff --git a/resources/images/hum_level4_light.svg b/resources/images/hum_level4_light.svg index 299c1506c8..844af8b08c 100644 --- a/resources/images/hum_level4_light.svg +++ b/resources/images/hum_level4_light.svg @@ -1,5 +1,5 @@ - + diff --git a/resources/images/hum_level5_dark.svg b/resources/images/hum_level5_dark.svg index d7ef458e09..d7b16d50f8 100644 --- a/resources/images/hum_level5_dark.svg +++ b/resources/images/hum_level5_dark.svg @@ -1,5 +1,5 @@ - + diff --git a/resources/images/hum_level5_light.svg b/resources/images/hum_level5_light.svg index 4121832f98..4754a26591 100644 --- a/resources/images/hum_level5_light.svg +++ b/resources/images/hum_level5_light.svg @@ -1,5 +1,5 @@ - + diff --git a/src/slic3r/GUI/AmsMappingPopup.cpp b/src/slic3r/GUI/AmsMappingPopup.cpp index e076881063..2e9338949e 100644 --- a/src/slic3r/GUI/AmsMappingPopup.cpp +++ b/src/slic3r/GUI/AmsMappingPopup.cpp @@ -1814,18 +1814,6 @@ AmsHumidityTipPopup::AmsHumidityTipPopup(wxWindow* parent) wxGetApp().UpdateDarkUIWin(this); } -void AmsHumidityTipPopup::paintEvent(wxPaintEvent& evt) -{ - wxPaintDC dc(this); - render(dc); -} - -void AmsHumidityTipPopup::OnDismiss() {} - -bool AmsHumidityTipPopup::ProcessLeftDown(wxMouseEvent& event) { - return PopupWindow::ProcessLeftDown(event); -} - void AmsHumidityTipPopup::set_humidity_level(int level) { current_humidity_level = level; @@ -1838,6 +1826,29 @@ void AmsHumidityTipPopup::set_humidity_level(int level) curr_humidity_img->Update(); } +void AmsHumidityTipPopup::msw_rescale() +{ + // close image + close_img.msw_rescale(); + + // current humidity level image + std::string mode_string = wxGetApp().dark_mode() ? "_dark" : "_light"; + curr_humidity_img->SetBitmap(create_scaled_bitmap("hum_level" + std::to_string(current_humidity_level) + mode_string, this, 132)); + + // the list + humidity_level_list->msw_rescale(); + + // refresh + Refresh(); +} + + +void AmsHumidityTipPopup::paintEvent(wxPaintEvent& evt) +{ + wxPaintDC dc(this); + render(dc); +} + void AmsHumidityTipPopup::render(wxDC& dc) { #ifdef __WXMSW__ @@ -1870,6 +1881,8 @@ void AmsHumidityTipPopup::doRender(wxDC& dc) dc.DrawRoundedRectangle(0, 0, GetSize().x, GetSize().y, 0); } + + AmsTutorialPopup::AmsTutorialPopup(wxWindow* parent) :PopupWindow(parent, wxBORDER_NONE) { @@ -2669,7 +2682,19 @@ AmsHumidityLevelList::AmsHumidityLevelList(wxWindow* parent) void AmsHumidityLevelList::msw_rescale() { + background_img.msw_rescale(); + for (int i = 0; i < hum_level_img_light.size(); i++) + { + hum_level_img_light[i].msw_rescale(); + } + + for (int i = 0; i < hum_level_img_dark.size(); i++) + { + hum_level_img_dark[i].msw_rescale(); + } + + Refresh(); } void AmsHumidityLevelList::paintEvent(wxPaintEvent& evt) diff --git a/src/slic3r/GUI/AmsMappingPopup.hpp b/src/slic3r/GUI/AmsMappingPopup.hpp index 6b18b06ec5..c3ca8d067c 100644 --- a/src/slic3r/GUI/AmsMappingPopup.hpp +++ b/src/slic3r/GUI/AmsMappingPopup.hpp @@ -324,25 +324,18 @@ public: AmsHumidityLevelList(wxWindow* parent); ~AmsHumidityLevelList() {}; - ScalableBitmap background_img; - ScalableBitmap hum_level1_img; - ScalableBitmap hum_level2_img; - ScalableBitmap hum_level3_img; - ScalableBitmap hum_level4_img; - - std::vector hum_level_img_light; - std::vector hum_level_img_dark; - - wxStaticBitmap* hum_level1_bitmap; - wxStaticBitmap* hum_level2_bitmap; - wxStaticBitmap* hum_level3_bitmap; - wxStaticBitmap* hum_level4_bitmap; - wxStaticBitmap* hum_level5_bitmap; - +public: void msw_rescale(); + +private: void paintEvent(wxPaintEvent& evt); void render(wxDC& dc); void doRender(wxDC& dc); + +private: + ScalableBitmap background_img; + std::vector hum_level_img_light; + std::vector hum_level_img_dark; }; class AmsHumidityTipPopup : public PopupWindow @@ -350,24 +343,31 @@ class AmsHumidityTipPopup : public PopupWindow public: AmsHumidityTipPopup(wxWindow* parent); ~AmsHumidityTipPopup() {}; - void paintEvent(wxPaintEvent& evt); - - virtual void OnDismiss() wxOVERRIDE; - virtual bool ProcessLeftDown(wxMouseEvent& event) wxOVERRIDE; +public: void set_humidity_level(int level); + void msw_rescale(); + +private: + virtual void OnDismiss() wxOVERRIDE {}; + virtual bool ProcessLeftDown(wxMouseEvent& event) wxOVERRIDE { return PopupWindow::ProcessLeftDown(event); }; + + void paintEvent(wxPaintEvent& evt); void render(wxDC& dc); void doRender(wxDC& dc); -public: +private: int current_humidity_level = 0; ScalableBitmap close_img; + wxStaticBitmap* curr_humidity_img; - AmsHumidityLevelList* humidity_level_list{nullptr}; wxStaticBitmap* m_img; + Label* m_staticText;; Label* m_staticText_note; + + AmsHumidityLevelList* humidity_level_list{nullptr}; }; class AmsTutorialPopup : public PopupWindow diff --git a/src/slic3r/GUI/DeviceTab/uiAmsHumidityPopup.h b/src/slic3r/GUI/DeviceTab/uiAmsHumidityPopup.h index 7fd5a98f72..f5a2bc3037 100644 --- a/src/slic3r/GUI/DeviceTab/uiAmsHumidityPopup.h +++ b/src/slic3r/GUI/DeviceTab/uiAmsHumidityPopup.h @@ -6,6 +6,7 @@ //**********************************************************/ #pragma once +#include "slic3r/GUI/Widgets/AMSItem.hpp" #include "slic3r/GUI/Widgets/Label.hpp" #include "slic3r/GUI/Widgets/PopupWindow.hpp" @@ -19,6 +20,7 @@ namespace Slic3r { namespace GUI { struct uiAmsHumidityInfo { std::string ams_id; + AMSModel ams_type; int humidity_level = -1; int humidity_percent = -1; float current_temperature; diff --git a/src/slic3r/GUI/Widgets/AMSControl.cpp b/src/slic3r/GUI/Widgets/AMSControl.cpp index d838e412c6..5ef48dd72e 100644 --- a/src/slic3r/GUI/Widgets/AMSControl.cpp +++ b/src/slic3r/GUI/Widgets/AMSControl.cpp @@ -280,16 +280,7 @@ AMSControl::AMSControl(wxWindow *parent, wxWindowID id, const wxPoint &pos, cons 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_percent_humidity_dry_popup->GetSize().GetWidth() + FromDIP(150), img_pos.y - FromDIP(80)); - m_percent_humidity_dry_popup->Move(popup_pos); - m_percent_humidity_dry_popup->ShowModal(); - } - else + if (info->ams_type == AMSModel::GENERIC_AMS) { 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)); @@ -299,6 +290,15 @@ AMSControl::AMSControl(wxWindow *parent, wxWindowID id, const wxPoint &pos, cons if (humidity_value > 0 && humidity_value <= 5) { m_Humidity_tip_popup.set_humidity_level(humidity_value); } m_Humidity_tip_popup.Popup(); } + else + { + m_percent_humidity_dry_popup->Update(info); + + 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->Move(popup_pos); + m_percent_humidity_dry_popup->ShowModal(); + } } delete info; @@ -532,6 +532,8 @@ void AMSControl::msw_rescale() m_percent_humidity_dry_popup->msw_rescale(); } + m_Humidity_tip_popup.msw_rescale(); + Layout(); Refresh(); } diff --git a/src/slic3r/GUI/Widgets/AMSItem.cpp b/src/slic3r/GUI/Widgets/AMSItem.cpp index 1798005586..26dd90aa85 100644 --- a/src/slic3r/GUI/Widgets/AMSItem.cpp +++ b/src/slic3r/GUI/Widgets/AMSItem.cpp @@ -1885,7 +1885,7 @@ void AMSRoad::doRender(wxDC &dc) dc.DrawRoundedRectangle(size.x * 0.37 / 2, size.y * 0.6 - size.y / 6, size.x * 0.63, size.y / 3, m_radius); } - if (m_canindex == 3) { + if (m_canindex == 3) /*To check, tao.wang*/{ if (m_amsinfo.ams_humidity >= 1 && m_amsinfo.ams_humidity <= 5) {m_show_humidity = true;} else {m_show_humidity = false;} @@ -2795,8 +2795,8 @@ AMSHumidity::AMSHumidity(wxWindow* parent, wxWindowID id, AMSinfo info, const wx { create(parent, id, pos, wxDefaultSize); - for (int i = 1; i <= 5; i++) { ams_humidity_imgs.push_back(ScalableBitmap(this, "hum_level" + std::to_string(i) + "_light", 16));} - for (int i = 1; i <= 5; i++) { ams_humidity_dark_imgs.push_back(ScalableBitmap(this, "hum_level" + std::to_string(i) + "_dark", 16));} + for (int i = 1; i <= 5; i++) { ams_humidity_imgs.push_back(ScalableBitmap(this, "hum_level" + std::to_string(i) + "_light", 20));} + for (int i = 1; i <= 5; i++) { ams_humidity_dark_imgs.push_back(ScalableBitmap(this, "hum_level" + std::to_string(i) + "_dark", 20));} for (int i = 1; i <= 5; i++) { ams_humidity_no_num_imgs.push_back(ScalableBitmap(this, "hum_level" + std::to_string(i) + "_no_num_light", 16)); } for (int i = 1; i <= 5; i++) { ams_humidity_no_num_dark_imgs.push_back(ScalableBitmap(this, "hum_level" + std::to_string(i) + "_no_num_dark", 16)); } @@ -2808,10 +2808,6 @@ AMSHumidity::AMSHumidity(wxWindow* parent, wxWindowID id, AMSinfo info, const wx Bind(wxEVT_LEFT_UP, [this](wxMouseEvent& e) { if (m_show_humidity) { - if (m_amsinfo.ams_type == AMSModel::GENERIC_AMS) { - return;/*STUDIO-12083*/ - } - auto mouse_pos = ClientToScreen(e.GetPosition()); auto rect = ClientToScreen(wxPoint(0, 0)); @@ -2821,6 +2817,7 @@ AMSHumidity::AMSHumidity(wxWindow* parent, wxWindowID id, AMSinfo info, const wx uiAmsHumidityInfo *info = new uiAmsHumidityInfo; info->ams_id = m_amsinfo.ams_id; + info->ams_type = m_amsinfo.ams_type; info->humidity_level = m_amsinfo.ams_humidity; info->humidity_percent = m_amsinfo.humidity_raw; info->left_dry_time = m_amsinfo.left_dray_time; @@ -2853,10 +2850,10 @@ void AMSHumidity::Update(AMSinfo amsinfo) void AMSHumidity::update_size() { wxSize size; - if (m_amsinfo.humidity_raw != -1) { - size = AMS_HUMIDITY_SIZE; - } else { + if (m_amsinfo.ams_type == AMSModel::GENERIC_AMS) { size = AMS_HUMIDITY_NO_PERCENT_SIZE; + } else { + size = AMS_HUMIDITY_SIZE; } if (!m_amsinfo.support_drying()) { size.x -= AMS_HUMIDITY_DRY_WIDTH; } @@ -2911,7 +2908,20 @@ void AMSHumidity::doRender(wxDC& dc) dc.DrawRoundedRectangle(0, 0, (size.x), (size.y), (size.y / 2)); wxPoint pot; - if (m_amsinfo.humidity_raw != -1) /*image with no number + percentage*/ + if (m_amsinfo.ams_type == AMSModel::GENERIC_AMS) /*image with stage*/ + { + ScalableBitmap hum_img; + if (!wxGetApp().dark_mode()) { + hum_img = ams_humidity_imgs[m_amsinfo.ams_humidity - 1]; + } else { + hum_img = ams_humidity_dark_imgs[m_amsinfo.ams_humidity - 1]; + } + + pot = wxPoint((size.x - hum_img.GetBmpWidth()) / 2, ((size.y - hum_img.GetBmpSize().y) / 2)); + dc.DrawBitmap(hum_img.bmp(), pot); + pot.x = pot.x + hum_img.GetBmpSize().x; + } + else if (m_amsinfo.humidity_raw != -1) /*image with no number + percentage*/ { // hum image ScalableBitmap hum_img; @@ -2946,20 +2956,6 @@ void AMSHumidity::doRender(wxDC& dc) pot.x += tsize2.x; } - else /*image with number*/ - { - // hum image - ScalableBitmap hum_img; - if (!wxGetApp().dark_mode()) { - hum_img = ams_humidity_imgs[m_amsinfo.ams_humidity - 1]; - } else { - hum_img = ams_humidity_dark_imgs[m_amsinfo.ams_humidity - 1]; - } - - pot = wxPoint(FromDIP(5), ((size.y - hum_img.GetBmpSize().y) / 2)); - dc.DrawBitmap(hum_img.bmp(), pot); - pot.x = pot.x + hum_img.GetBmpSize().x; - } if (m_amsinfo.support_drying()) {