mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-06 21:44:08 -06:00
ENH:add ams humidity tips and update new icon
Change-Id: I8f504fa911ef7a84ca8929af3c5d7c53d289761e
This commit is contained in:
parent
7de62693c7
commit
e962bcfec9
6 changed files with 192 additions and 12 deletions
|
@ -698,6 +698,125 @@ void AmsMapingTipPopup::OnDismiss() {}
|
|||
bool AmsMapingTipPopup::ProcessLeftDown(wxMouseEvent &event) {
|
||||
return wxPopupTransientWindow::ProcessLeftDown(event); }
|
||||
|
||||
|
||||
AmsHumidityTipPopup::AmsHumidityTipPopup(wxWindow* parent)
|
||||
:wxPopupTransientWindow(parent, wxBORDER_NONE)
|
||||
{
|
||||
SetBackgroundColour(*wxWHITE);
|
||||
|
||||
wxBoxSizer* main_sizer;
|
||||
main_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
|
||||
main_sizer->Add(0, 0, 0, wxTOP, 28);
|
||||
|
||||
wxBoxSizer* m_sizer_body;
|
||||
m_sizer_body = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
m_img = new wxStaticBitmap(this, wxID_ANY, create_scaled_bitmap("ams_humidity_tips", this, 125), wxDefaultPosition, wxSize(FromDIP(125), FromDIP(145)), 0);
|
||||
|
||||
m_sizer_body->Add(m_img, 0, wxEXPAND | wxALL, 2);
|
||||
|
||||
|
||||
m_sizer_body->Add(0, 0, 0, wxEXPAND | wxLEFT, FromDIP(18));
|
||||
|
||||
wxBoxSizer* m_sizer_tips = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
m_staticText1 = new Label(this, _L("Cabin humidity"));
|
||||
m_staticText1->SetForegroundColour(wxColour(0x352F2D));
|
||||
m_staticText1->SetFont(::Label::Head_13);
|
||||
|
||||
|
||||
m_staticText2 = new Label(this, _L("Green represents that AMS humidity is normal, orange and red represent that humidity is too high.(Lower the better)"));
|
||||
m_staticText2->SetFont(::Label::Body_13);
|
||||
m_staticText2->SetSize(wxSize(FromDIP(360), -1));
|
||||
m_staticText2->SetMinSize(wxSize(FromDIP(360), -1));
|
||||
m_staticText2->SetMaxSize(wxSize(FromDIP(360), -1));
|
||||
m_staticText2->Wrap(FromDIP(360));
|
||||
|
||||
|
||||
m_staticText3 = new Label(this, _L("Desiccant status"));
|
||||
m_staticText3->SetForegroundColour(wxColour(0x352F2D));
|
||||
m_staticText3->SetFont(::Label::Head_13);
|
||||
|
||||
|
||||
m_staticText4 = new Label(this, _L("Desiccant status lower than two bars indicates that desiccant can be inactive. Please change the desiccant.(Higher the better)"));
|
||||
m_staticText4->SetFont(::Label::Body_13);
|
||||
m_staticText4->SetSize(wxSize(FromDIP(360), -1));
|
||||
m_staticText4->SetMinSize(wxSize(FromDIP(360), -1));
|
||||
m_staticText4->SetMaxSize(wxSize(FromDIP(360), -1));
|
||||
m_staticText4->Wrap(FromDIP(360));
|
||||
|
||||
m_sizer_tips->Add(m_staticText1, 0, wxALL, 3);
|
||||
m_sizer_tips->Add(m_staticText2, 0, wxALL, 3);
|
||||
m_sizer_tips->Add(m_staticText3, 0, wxALL, 3);
|
||||
m_sizer_tips->Add(m_staticText4, 0, wxALL, 3);
|
||||
|
||||
|
||||
m_sizer_body->Add(m_sizer_tips, 0, wxEXPAND, 0);
|
||||
|
||||
|
||||
main_sizer->Add(m_sizer_body, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(30));
|
||||
|
||||
m_staticText_note = new Label(this, _L("Note: When the lid is open or the desiccant pack is changed, it can take hours or a night to absorb the moisture. Low temperatures also slow down the process. During this time, the indicator may not represent the chamber accurately."));
|
||||
m_staticText4->SetFont(::Label::Body_13);
|
||||
m_staticText_note->SetMinSize(wxSize(FromDIP(536), -1));
|
||||
m_staticText_note->SetMaxSize(wxSize(FromDIP(536), -1));
|
||||
m_staticText_note->Wrap(FromDIP(536));
|
||||
main_sizer->Add(m_staticText_note, 0, wxALL | wxLEFT | wxRIGHT, 34);
|
||||
|
||||
m_button_confirm = new Button(this, _L("OK"));
|
||||
StateColor btn_bg_green(std::pair<wxColour, int>(wxColour(27, 136, 68), StateColor::Pressed), std::pair<wxColour, int>(wxColour(0, 174, 66), StateColor::Normal));
|
||||
m_button_confirm->SetBackgroundColor(btn_bg_green);
|
||||
m_button_confirm->SetBorderColor(wxColour(0, 174, 66));
|
||||
m_button_confirm->SetTextColor(wxColour(0xFFFFFE));
|
||||
m_button_confirm->SetSize(wxSize(FromDIP(72), FromDIP(24)));
|
||||
m_button_confirm->SetMinSize(wxSize(FromDIP(72), FromDIP(24)));
|
||||
m_button_confirm->SetCornerRadius(FromDIP(12));
|
||||
|
||||
|
||||
m_button_confirm->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {
|
||||
Dismiss();
|
||||
});
|
||||
|
||||
Bind(wxEVT_LEFT_UP, [this](auto& e) {
|
||||
auto mouse_pos = ClientToScreen(e.GetPosition());
|
||||
auto rect = m_button_confirm->ClientToScreen(wxPoint(0, 0));
|
||||
if (mouse_pos.x > rect.x && mouse_pos.y > rect.y
|
||||
&& mouse_pos.x < (rect.x + m_button_confirm->GetSize().x)
|
||||
&& mouse_pos.y < (rect.y + m_button_confirm->GetSize().y))
|
||||
{
|
||||
Dismiss();
|
||||
}
|
||||
});
|
||||
main_sizer->Add(m_button_confirm, 0, wxALIGN_CENTER | wxALL, 0);
|
||||
|
||||
|
||||
main_sizer->Add(0, 0, 0, wxEXPAND | wxTOP, 18);
|
||||
|
||||
|
||||
SetSizer(main_sizer);
|
||||
Layout();
|
||||
Fit();
|
||||
|
||||
Bind(wxEVT_PAINT, &AmsHumidityTipPopup::paintEvent, this);
|
||||
wxGetApp().UpdateDarkUIWin(this);
|
||||
}
|
||||
|
||||
void AmsHumidityTipPopup::paintEvent(wxPaintEvent& evt)
|
||||
{
|
||||
wxPaintDC dc(this);
|
||||
dc.SetPen(wxColour(0xAC, 0xAC, 0xAC));
|
||||
dc.SetBrush(*wxTRANSPARENT_BRUSH);
|
||||
dc.DrawRoundedRectangle(0, 0, GetSize().x, GetSize().y, 0);
|
||||
}
|
||||
|
||||
void AmsHumidityTipPopup::OnDismiss() {}
|
||||
|
||||
bool AmsHumidityTipPopup::ProcessLeftDown(wxMouseEvent& event) {
|
||||
return wxPopupTransientWindow::ProcessLeftDown(event);
|
||||
}
|
||||
|
||||
AmsTutorialPopup::AmsTutorialPopup(wxWindow* parent)
|
||||
:wxPopupTransientWindow(parent, wxBORDER_NONE)
|
||||
{
|
||||
|
|
|
@ -161,6 +161,26 @@ public:
|
|||
wxStaticText * m_tip_disable_ams;
|
||||
};
|
||||
|
||||
class AmsHumidityTipPopup : public wxPopupTransientWindow
|
||||
{
|
||||
public:
|
||||
AmsHumidityTipPopup(wxWindow* parent);
|
||||
~AmsHumidityTipPopup() {};
|
||||
void paintEvent(wxPaintEvent& evt);
|
||||
|
||||
virtual void OnDismiss() wxOVERRIDE;
|
||||
virtual bool ProcessLeftDown(wxMouseEvent& event) wxOVERRIDE;
|
||||
|
||||
public:
|
||||
wxStaticBitmap* m_img;
|
||||
Label* m_staticText1;
|
||||
Label* m_staticText2;
|
||||
Label* m_staticText3;
|
||||
Label* m_staticText4;
|
||||
Label* m_staticText_note;
|
||||
Button* m_button_confirm;
|
||||
};
|
||||
|
||||
class AmsTutorialPopup : public wxPopupTransientWindow
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -34,6 +34,7 @@ wxDEFINE_EVENT(EVT_AMS_CLIBRATION_AGAIN, wxCommandEvent);
|
|||
wxDEFINE_EVENT(EVT_AMS_CLIBRATION_CANCEL, wxCommandEvent);
|
||||
wxDEFINE_EVENT(EVT_AMS_GUIDE_WIKI, wxCommandEvent);
|
||||
wxDEFINE_EVENT(EVT_AMS_RETRY, wxCommandEvent);
|
||||
wxDEFINE_EVENT(EVT_AMS_SHOW_HUMIDITY_TIPS, wxCommandEvent);
|
||||
|
||||
bool AMSinfo::parse_ams_info(Ams *ams, bool remain_flag, bool humidity_flag)
|
||||
{
|
||||
|
@ -757,7 +758,8 @@ bool AMSLib::Enable(bool enable) { return wxWindow::Enable(enable); }
|
|||
Description:AMSRoad
|
||||
**************************************************/
|
||||
AMSRoad::AMSRoad() : m_road_def_color(AMS_CONTROL_GRAY500), m_road_color(AMS_CONTROL_GRAY500) {}
|
||||
AMSRoad::AMSRoad(wxWindow *parent, wxWindowID id, Caninfo info, int canindex, int maxcan, const wxPoint &pos, const wxSize &size) : AMSRoad()
|
||||
AMSRoad::AMSRoad(wxWindow *parent, wxWindowID id, Caninfo info, int canindex, int maxcan, const wxPoint &pos, const wxSize &size)
|
||||
: AMSRoad()
|
||||
{
|
||||
m_info = info;
|
||||
m_canindex = canindex;
|
||||
|
@ -782,6 +784,19 @@ AMSRoad::AMSRoad(wxWindow *parent, wxWindowID id, Caninfo info, int canindex, in
|
|||
create(parent, id, pos, size);
|
||||
Bind(wxEVT_PAINT, &AMSRoad::paintEvent, this);
|
||||
wxWindow::SetBackgroundColour(AMS_CONTROL_DEF_BLOCK_BK_COLOUR);
|
||||
|
||||
Bind(wxEVT_MOTION, [this](wxMouseEvent& e) {
|
||||
if (m_canindex == 3) {
|
||||
auto mouse_pos = ClientToScreen(e.GetPosition());
|
||||
auto rect = ClientToScreen(wxPoint(0, 0));
|
||||
|
||||
if (mouse_pos.x > rect.x + GetSize().x - FromDIP(20) &&
|
||||
mouse_pos.y > rect.y + GetSize().y - FromDIP(40)) {
|
||||
wxCommandEvent event(EVT_AMS_SHOW_HUMIDITY_TIPS);
|
||||
wxPostEvent(GetParent()->GetParent(), event);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void AMSRoad::create(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size) { wxWindow::Create(parent, id, pos, size); }
|
||||
|
@ -1414,7 +1429,9 @@ void AmsCans::msw_rescale()
|
|||
Description:AMSControl
|
||||
**************************************************/
|
||||
// WX_DEFINE_OBJARRAY(AmsItemsHash);
|
||||
AMSControl::AMSControl(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size) : wxSimplebook(parent, wxID_ANY, pos, size)
|
||||
AMSControl::AMSControl(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size)
|
||||
: wxSimplebook(parent, wxID_ANY, pos, size)
|
||||
, m_Humidity_tip_popup(AmsHumidityTipPopup(this))
|
||||
{
|
||||
SetBackgroundColour(*wxWHITE);
|
||||
// normal mode
|
||||
|
@ -1705,6 +1722,12 @@ AMSControl::AMSControl(wxWindow *parent, wxWindowID id, const wxPoint &pos, cons
|
|||
e.Skip();
|
||||
});
|
||||
|
||||
Bind(EVT_AMS_SHOW_HUMIDITY_TIPS, [this](wxCommandEvent& evt) {
|
||||
wxPoint img_pos = ClientToScreen(wxPoint(0, 0));
|
||||
wxPoint popup_pos(img_pos.x, img_pos.y + GetRect().height);
|
||||
m_Humidity_tip_popup.Position(popup_pos, wxSize(0, 0));
|
||||
m_Humidity_tip_popup.Popup();
|
||||
});
|
||||
|
||||
|
||||
m_button_guide->Bind(wxEVT_BUTTON, [this](wxCommandEvent& e) {
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "Button.hpp"
|
||||
#include "../DeviceManager.hpp"
|
||||
#include "slic3r/GUI/Event.hpp"
|
||||
#include "slic3r/GUI/AmsMappingPopup.hpp"
|
||||
#include <wx/simplebook.h>
|
||||
#include <wx/hyperlink.h>
|
||||
#include <wx/animate.h>
|
||||
|
@ -484,7 +485,7 @@ protected:
|
|||
Button *m_button_retry = {nullptr};
|
||||
|
||||
wxHyperlinkCtrl *m_hyperlink = {nullptr};
|
||||
|
||||
AmsHumidityTipPopup m_Humidity_tip_popup;
|
||||
public:
|
||||
std::string GetCurentAms();
|
||||
std::string GetCurrentCan(std::string amsid);
|
||||
|
@ -540,6 +541,7 @@ wxDECLARE_EVENT(EVT_AMS_CLIBRATION_AGAIN, wxCommandEvent);
|
|||
wxDECLARE_EVENT(EVT_AMS_CLIBRATION_CANCEL, wxCommandEvent);
|
||||
wxDECLARE_EVENT(EVT_AMS_GUIDE_WIKI, wxCommandEvent);
|
||||
wxDECLARE_EVENT(EVT_AMS_RETRY, wxCommandEvent);
|
||||
wxDECLARE_EVENT(EVT_AMS_SHOW_HUMIDITY_TIPS, wxCommandEvent);
|
||||
|
||||
}} // namespace Slic3r::GUI
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue