FIX: update the fan panel
jira: [STUDIO-10499] Change-Id: I5b760946229ea1cb24802ddddce250cc276986d6
This commit is contained in:
parent
2004e769ce
commit
418370ca5c
|
@ -1530,7 +1530,7 @@ wxBoxSizer *StatusBasePanel::create_misc_control(wxWindow *parent)
|
||||||
m_switch_fan->SetBorderWidth(0);
|
m_switch_fan->SetBorderWidth(0);
|
||||||
m_switch_fan->SetCornerRadius(0);
|
m_switch_fan->SetCornerRadius(0);
|
||||||
m_switch_fan->SetFont(::Label::Body_10);
|
m_switch_fan->SetFont(::Label::Body_10);
|
||||||
m_switch_fan->SetLabel(_L("panel"));
|
m_switch_fan->UseTextFan();
|
||||||
m_switch_fan->SetTextColor(
|
m_switch_fan->SetTextColor(
|
||||||
StateColor(std::make_pair(DISCONNECT_TEXT_COL, (int)StateColor::Disabled), std::make_pair(NORMAL_FAN_TEXT_COL, (int)StateColor::Normal)));
|
StateColor(std::make_pair(DISCONNECT_TEXT_COL, (int)StateColor::Disabled), std::make_pair(NORMAL_FAN_TEXT_COL, (int)StateColor::Normal)));
|
||||||
|
|
||||||
|
@ -2944,6 +2944,8 @@ void StatusPanel::update_misc_ctrl(MachineObject *obj)
|
||||||
m_fan_control_popup->Hide();
|
m_fan_control_popup->Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
obj->is_series_o() ? m_switch_fan->UseTextAirCondition() : m_switch_fan->UseTextFan();
|
||||||
|
|
||||||
//update cham fan
|
//update cham fan
|
||||||
|
|
||||||
/*other*/
|
/*other*/
|
||||||
|
|
|
@ -285,21 +285,23 @@ void FanSwitchButton::render(wxDC& dc)
|
||||||
|
|
||||||
if (icon.bmp().IsOk()) {
|
if (icon.bmp().IsOk()) {
|
||||||
dc.DrawBitmap(icon.bmp(), pt);
|
dc.DrawBitmap(icon.bmp(), pt);
|
||||||
pt.x += icon.GetBmpWidth() + FromDIP(9);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString fan_txt = _L("Fan");
|
if (!m_text.empty())
|
||||||
dc.SetFont(::Label::Head_15);
|
{
|
||||||
pt.y = FromDIP(9);
|
if (m_text == _L("Fan")) {
|
||||||
dc.DrawText(fan_txt, pt);
|
dc.SetFont(::Label::Head_15);
|
||||||
pt.y = size.y / 2 + FromDIP(3);
|
pt.x += icon.GetBmpWidth() + FromDIP(9);
|
||||||
wxString fan_num_txt = GetLabel();
|
} else if (m_text == _L("Air Condition")) {
|
||||||
|
dc.SetFont(::Label::Head_14);
|
||||||
|
pt.x += icon.GetBmpWidth() + FromDIP(6);
|
||||||
dc.SetFont(::Label::Body_12);
|
}
|
||||||
dc.SetTextForeground(0x6b6b6b);
|
|
||||||
dc.DrawText(fan_num_txt, pt);
|
|
||||||
|
|
||||||
|
auto text_size = dc.GetMultiLineTextExtent(m_text);
|
||||||
|
pt.y = (size.y - text_size.GetHeight()) / 2;
|
||||||
|
//dc.SetTextForeground(0x6b6b6b);
|
||||||
|
dc.DrawText(m_text, pt);
|
||||||
|
}
|
||||||
|
|
||||||
//int content_height = icon.GetBmpHeight() + textSize.y + m_padding;
|
//int content_height = icon.GetBmpHeight() + textSize.y + m_padding;
|
||||||
/*int content_height = m_padding;
|
/*int content_height = m_padding;
|
||||||
|
@ -361,6 +363,18 @@ void FanSwitchButton::setFanValue(int val)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FanSwitchButton::UseTextFan() { SetText(_L("Fan")); }
|
||||||
|
void FanSwitchButton::UseTextAirCondition() { SetText(_L("Air Condition")); }
|
||||||
|
|
||||||
|
void FanSwitchButton::SetText(const wxString &text)
|
||||||
|
{
|
||||||
|
if (m_text != text)
|
||||||
|
{
|
||||||
|
m_text = text;
|
||||||
|
Refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void FanSwitchButton::mouseDown(wxMouseEvent& event)
|
void FanSwitchButton::mouseDown(wxMouseEvent& event)
|
||||||
{
|
{
|
||||||
event.Skip();
|
event.Skip();
|
||||||
|
|
|
@ -64,6 +64,9 @@ public:
|
||||||
void Rescale();
|
void Rescale();
|
||||||
void setFanValue(int val);
|
void setFanValue(int val);
|
||||||
|
|
||||||
|
void UseTextFan();
|
||||||
|
void UseTextAirCondition();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void messureSize();
|
void messureSize();
|
||||||
void paintEvent(wxPaintEvent& evt);
|
void paintEvent(wxPaintEvent& evt);
|
||||||
|
@ -74,6 +77,8 @@ private:
|
||||||
void mouseLeaveWindow(wxMouseEvent& event);
|
void mouseLeaveWindow(wxMouseEvent& event);
|
||||||
void sendButtonEvent();
|
void sendButtonEvent();
|
||||||
|
|
||||||
|
void SetText(const wxString &text);
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -89,6 +94,8 @@ private:
|
||||||
int m_speed;
|
int m_speed;
|
||||||
|
|
||||||
wxString labels[2];
|
wxString labels[2];
|
||||||
|
|
||||||
|
wxString m_text;
|
||||||
StateColor text_color;
|
StateColor text_color;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue