From d3e6455cf7916355f88c8ee1aadbb0f87c9d87c3 Mon Sep 17 00:00:00 2001 From: "liz.li" Date: Wed, 23 Nov 2022 17:48:55 +0800 Subject: [PATCH] FIX:linux hms text display bug Change-Id: Ia7c51c8233acba2e529a2ba878698bf9c1f567f6 --- src/slic3r/GUI/HMSPanel.cpp | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/src/slic3r/GUI/HMSPanel.cpp b/src/slic3r/GUI/HMSPanel.cpp index 944b0a3a9..94ef89d2d 100644 --- a/src/slic3r/GUI/HMSPanel.cpp +++ b/src/slic3r/GUI/HMSPanel.cpp @@ -62,7 +62,8 @@ HMSNotifyItem::HMSNotifyItem(wxWindow *parent, HMSItem& item) this->SetSizer(main_sizer); this->Layout(); - m_hms_content->Bind(wxEVT_ENTER_WINDOW, [this](wxMouseEvent &e) { +#ifdef __linux__ + m_panel_hms->Bind(wxEVT_ENTER_WINDOW, [this](wxMouseEvent& e) { e.Skip(); if (!m_url.empty()) { auto font = m_hms_content->GetFont(); @@ -72,7 +73,7 @@ HMSNotifyItem::HMSNotifyItem(wxWindow *parent, HMSItem& item) SetCursor(wxCURSOR_HAND); } }); - m_hms_content->Bind(wxEVT_LEAVE_WINDOW, [this](wxMouseEvent &e) { + m_panel_hms->Bind(wxEVT_LEAVE_WINDOW, [this](wxMouseEvent& e) { e.Skip(); if (!m_url.empty()) { auto font = m_hms_content->GetFont(); @@ -82,9 +83,37 @@ HMSNotifyItem::HMSNotifyItem(wxWindow *parent, HMSItem& item) SetCursor(wxCURSOR_ARROW); } }); - m_hms_content->Bind(wxEVT_LEFT_UP, [this](wxMouseEvent &e) { + m_panel_hms->Bind(wxEVT_LEFT_UP, [this](wxMouseEvent& e) { if (!m_url.empty()) wxLaunchDefaultBrowser(m_url); - }); + }); + m_hms_content->Bind(wxEVT_LEFT_UP, [this](wxMouseEvent& e) { + if (!m_url.empty()) wxLaunchDefaultBrowser(m_url); + }); +#else + m_hms_content->Bind(wxEVT_ENTER_WINDOW, [this](wxMouseEvent& e) { + e.Skip(); + if (!m_url.empty()) { + auto font = m_hms_content->GetFont(); + font.SetUnderlined(true); + m_hms_content->SetFont(font); + Layout(); + SetCursor(wxCURSOR_HAND); + } + }); + m_hms_content->Bind(wxEVT_LEAVE_WINDOW, [this](wxMouseEvent& e) { + e.Skip(); + if (!m_url.empty()) { + auto font = m_hms_content->GetFont(); + font.SetUnderlined(false); + m_hms_content->SetFont(font); + Layout(); + SetCursor(wxCURSOR_ARROW); + } + }); + m_hms_content->Bind(wxEVT_LEFT_UP, [this](wxMouseEvent& e) { + if (!m_url.empty()) wxLaunchDefaultBrowser(m_url); + }); +#endif } HMSNotifyItem ::~HMSNotifyItem() { ;