From db233c605110c6db8610426f322f6bc8950a83c9 Mon Sep 17 00:00:00 2001 From: tao wang Date: Wed, 26 Oct 2022 14:42:08 +0800 Subject: [PATCH] FIX:fixed cant not link to wiki on macos Change-Id: I8c7fc943e9c6eb46c1f7a63dcd32f0a9a7f120d3 (cherry picked from commit 1fd7ef86e39c979e8b986c9f6d6db239949682cd) --- src/slic3r/GUI/SelectMachine.cpp | 8 +++++++- src/slic3r/GUI/SelectMachine.hpp | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp index 40cb0bc04..5255b2b29 100644 --- a/src/slic3r/GUI/SelectMachine.cpp +++ b/src/slic3r/GUI/SelectMachine.cpp @@ -643,7 +643,7 @@ void SelectMachinePopup::update_other_devices() m_placeholder_panel = new wxWindow(m_scrolledWindow, wxID_ANY, wxDefaultPosition, wxSize(-1,FromDIP(26))); wxBoxSizer* placeholder_sizer = new wxBoxSizer(wxVERTICAL); - auto m_hyperlink = new wxHyperlinkCtrl(m_placeholder_panel, wxID_ANY, _L("Can't find my devices?"), wxT("https://wiki.bambulab.com/en/software/bambu-studio/failed-to-connect-printer"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE); + m_hyperlink = new wxHyperlinkCtrl(m_placeholder_panel, wxID_ANY, _L("Can't find my devices?"), wxT("https://wiki.bambulab.com/en/software/bambu-studio/failed-to-connect-printer"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE); placeholder_sizer->Add(m_hyperlink, 0, wxALIGN_CENTER | wxALL, 5); @@ -860,6 +860,12 @@ void SelectMachinePopup::OnLeftUp(wxMouseEvent &event) wxPostEvent(p->mPanel, event); } } + + //hyper link + auto h_rect = m_hyperlink->ClientToScreen(wxPoint(0, 0)); + if (mouse_pos.x > h_rect.x && mouse_pos.y > h_rect.y && mouse_pos.x < (h_rect.x + m_hyperlink->GetSize().x) && mouse_pos.y < (h_rect.y + m_hyperlink->GetSize().y)) { + wxLaunchDefaultBrowser(wxT("https://wiki.bambulab.com/en/software/bambu-studio/failed-to-connect-printer")); + } } } diff --git a/src/slic3r/GUI/SelectMachine.hpp b/src/slic3r/GUI/SelectMachine.hpp index fe83a1cc6..1529ecb8b 100644 --- a/src/slic3r/GUI/SelectMachine.hpp +++ b/src/slic3r/GUI/SelectMachine.hpp @@ -198,6 +198,7 @@ private: int m_my_devices_count{0}; int m_other_devices_count{0}; wxWindow* m_placeholder_panel{nullptr}; + wxHyperlinkCtrl* m_hyperlink{nullptr}; wxBoxSizer * m_sizer_body{nullptr}; wxBoxSizer * m_sizer_my_devices{nullptr}; wxBoxSizer * m_sizer_other_devices{nullptr};