mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-16 18:12:10 +00:00
FIX: update the display of AMSHumidity
jira: [STUDIO-10119] Change-Id: I7a1be57bd0dff13be149d6450b36fb54ffa9521d (cherry picked from commit c3a8690987005e0f53bbd5f9622a670e76bed93a)
This commit is contained in:
@@ -48,12 +48,13 @@ bool AMSinfo::parse_ams_info(MachineObject *obj, Ams *ams, bool remain_flag, boo
|
||||
|
||||
if (ams->type == 1 || ams->type == 3){
|
||||
this->ams_humidity = ams->humidity;
|
||||
this->humidity_raw = ams->humidity_raw;
|
||||
}
|
||||
else{
|
||||
this->ams_humidity = -1;
|
||||
this->humidity_raw = -1;
|
||||
}
|
||||
|
||||
this->humidity_raw = ams->humidity_raw;
|
||||
this->left_dray_time = ams->left_dry_time;
|
||||
this->ams_type = AMSModel(ams->type);
|
||||
|
||||
nozzle_id = ams->nozzle;
|
||||
@@ -2762,13 +2763,15 @@ AMSHumidity::AMSHumidity() {}
|
||||
AMSHumidity::AMSHumidity(wxWindow* parent, wxWindowID id, AMSinfo info, const wxPoint& pos, const wxSize& size)
|
||||
: AMSHumidity()
|
||||
{
|
||||
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_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)); }
|
||||
|
||||
ams_sun_img = ScalableBitmap(this, "ams_drying", 16);
|
||||
create(parent, id, pos, wxDefaultSize);
|
||||
ams_drying_img = ScalableBitmap(this, "ams_is_drying", 16);
|
||||
|
||||
Bind(wxEVT_PAINT, &AMSHumidity::paintEvent, this);
|
||||
//wxWindow::SetBackgroundColour(AMS_CONTROL_DEF_HUMIDITY_BK_COLOUR);
|
||||
@@ -2807,23 +2810,27 @@ void AMSHumidity::Update(AMSinfo amsinfo)
|
||||
if (m_amsinfo != amsinfo)
|
||||
{
|
||||
m_amsinfo = amsinfo;
|
||||
if (m_amsinfo.humidity_raw != -1)
|
||||
{
|
||||
SetSize(AMS_HUMIDITY_SIZE);
|
||||
SetMinSize(AMS_HUMIDITY_SIZE);
|
||||
SetMaxSize(AMS_HUMIDITY_SIZE);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetSize(AMS_HUMIDITY_NO_PERCENT_SIZE);
|
||||
SetMinSize(AMS_HUMIDITY_NO_PERCENT_SIZE);
|
||||
SetMaxSize(AMS_HUMIDITY_NO_PERCENT_SIZE);
|
||||
}
|
||||
|
||||
update_size();
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
void AMSHumidity::update_size()
|
||||
{
|
||||
wxSize size;
|
||||
if (m_amsinfo.humidity_raw != -1) {
|
||||
size = AMS_HUMIDITY_SIZE;
|
||||
} else {
|
||||
size = AMS_HUMIDITY_NO_PERCENT_SIZE;
|
||||
}
|
||||
|
||||
if (!m_amsinfo.support_drying()) { size.x -= AMS_HUMIDITY_DRY_WIDTH; }
|
||||
|
||||
SetMaxSize(size);
|
||||
SetMinSize(size);
|
||||
SetSize(size);
|
||||
}
|
||||
|
||||
|
||||
void AMSHumidity::paintEvent(wxPaintEvent& evt)
|
||||
{
|
||||
@@ -2919,20 +2926,25 @@ void AMSHumidity::doRender(wxDC& dc)
|
||||
pot.x = pot.x + hum_img.GetBmpSize().x + FromDIP(3);
|
||||
}
|
||||
|
||||
//vertical line
|
||||
dc.SetPen(wxPen(wxColour(194, 194, 194)));
|
||||
dc.SetBrush(wxBrush(wxColour(194, 194, 194)));
|
||||
//dc.DrawLine(FromDIP(GetSize().x * 0.64), FromDIP(GetSize().y / 2 - 10), FromDIP(GetSize().x * 0.64), FromDIP(GetSize().y / 2 + 10));
|
||||
dc.DrawLine(pot.x, GetSize().y / 2 - FromDIP(10), pot.x, GetSize().y / 2 + FromDIP(10));
|
||||
|
||||
//sun image
|
||||
/*pot.x = FromDIP(size.x * 0.69);
|
||||
pot.y = FromDIP((size.y - ams_sun_img.GetBmpHeight()) / 2);*/
|
||||
pot.x = pot.x + (ams_sun_img.GetBmpWidth() / 2);
|
||||
pot.y = (size.y - ams_sun_img.GetBmpHeight()) / 2;
|
||||
dc.SetPen(wxPen(*wxTRANSPARENT_PEN));
|
||||
dc.DrawBitmap(ams_sun_img.bmp(), pot);
|
||||
if (m_amsinfo.support_drying())
|
||||
{
|
||||
// vertical line
|
||||
dc.SetPen(wxPen(wxColour(194, 194, 194)));
|
||||
dc.SetBrush(wxBrush(wxColour(194, 194, 194)));
|
||||
dc.DrawLine(pot.x, GetSize().y / 2 - FromDIP(10), pot.x, GetSize().y / 2 + FromDIP(10));
|
||||
|
||||
// sun image
|
||||
dc.SetPen(wxPen(*wxTRANSPARENT_PEN));
|
||||
if (m_amsinfo.left_dray_time > 0) {
|
||||
pot.x = pot.x + (ams_drying_img.GetBmpWidth() / 2);
|
||||
pot.y = (size.y - ams_drying_img.GetBmpHeight()) / 2;
|
||||
dc.DrawBitmap(ams_drying_img.bmp(), pot);
|
||||
} else {
|
||||
pot.x = pot.x + (ams_sun_img.GetBmpWidth() / 2);
|
||||
pot.y = (size.y - ams_sun_img.GetBmpHeight()) / 2;
|
||||
dc.DrawBitmap(ams_sun_img.bmp(), pot);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
//to do ...
|
||||
@@ -2945,6 +2957,7 @@ void AMSHumidity::msw_rescale() {
|
||||
for (auto &img : ams_humidity_no_num_imgs) { img.msw_rescale(); }
|
||||
for (auto &img : ams_humidity_no_num_dark_imgs) { img.msw_rescale(); }
|
||||
ams_sun_img.msw_rescale();
|
||||
ams_drying_img.msw_rescale();
|
||||
|
||||
Layout();
|
||||
Refresh();
|
||||
|
||||
@@ -160,8 +160,11 @@ enum FilamentStepType {
|
||||
#define AMS_EXTRUDER_SINGLE_NOZZLE_BITMAP_SIZE wxSize(FromDIP(18), FromDIP(36))
|
||||
#define AMS_BODY_SIZE wxSize(FromDIP(36), FromDIP(55))
|
||||
#define AMS_DOWN_ROAD_SIZE wxSize(FromDIP(568), FromDIP(10))
|
||||
|
||||
#define AMS_HUMIDITY_SIZE wxSize(FromDIP(93), FromDIP(26))
|
||||
#define AMS_HUMIDITY_NO_PERCENT_SIZE wxSize(FromDIP(60), FromDIP(26))
|
||||
#define AMS_HUMIDITY_DRY_WIDTH FromDIP(35)
|
||||
|
||||
#define AMS_PANEL_SIZE wxSize(FromDIP(264), FromDIP(150))
|
||||
|
||||
#define GENERIC_AMS_SLOT_NUM 4
|
||||
@@ -215,6 +218,7 @@ public:
|
||||
int curreent_filamentstep;
|
||||
int ams_humidity = 0;
|
||||
int humidity_raw = -1;
|
||||
int left_dray_time = 0;
|
||||
AMSModel ams_type = AMSModel::GENERIC_AMS;
|
||||
AMSModelOriginType ext_type = AMSModelOriginType::GENERIC_EXT;
|
||||
|
||||
@@ -229,6 +233,7 @@ public:
|
||||
current_action == other.current_action &&
|
||||
curreent_filamentstep == other.curreent_filamentstep &&
|
||||
ams_humidity == other.ams_humidity &&
|
||||
left_dray_time == other.left_dray_time &&
|
||||
ams_type == other.ams_type &&
|
||||
ext_type == other.ext_type)
|
||||
{
|
||||
@@ -250,6 +255,8 @@ public:
|
||||
|
||||
bool parse_ams_info(MachineObject* obj, Ams *ams, bool remain_flag = false, bool humidity_flag = false);
|
||||
void parse_ext_info(MachineObject* obj, AmsTray tray);
|
||||
|
||||
bool support_drying() const { return (ams_type == AMSModel::N3S_AMS) || (ams_type == AMSModel::N3F_AMS); };
|
||||
};
|
||||
|
||||
/*************************************************
|
||||
@@ -719,7 +726,8 @@ public:
|
||||
std::vector<ScalableBitmap> ams_humidity_no_num_imgs;
|
||||
std::vector<ScalableBitmap> ams_humidity_no_num_dark_imgs;
|
||||
|
||||
ScalableBitmap ams_sun_img;
|
||||
ScalableBitmap ams_sun_img;
|
||||
ScalableBitmap ams_drying_img;
|
||||
|
||||
|
||||
int m_humidity = { 0 };
|
||||
@@ -731,6 +739,9 @@ public:
|
||||
void render(wxDC& dc);
|
||||
void doRender(wxDC& dc);
|
||||
void msw_rescale();
|
||||
|
||||
private:
|
||||
void update_size();
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user