Linux specific: Follow-up fdc4ee7542 - Fix to "Post processigs..." line works like a link

This commit is contained in:
YuSanka 2023-01-06 09:12:57 +01:00
parent fc6ed2eb6e
commit a17a694604
2 changed files with 36 additions and 10 deletions

View File

@ -1038,25 +1038,50 @@ void ogStaticText::SetText(const wxString& value, bool wrap/* = true*/)
void ogStaticText::SetPathEnd(const std::string& link) void ogStaticText::SetPathEnd(const std::string& link)
{ {
#ifndef __linux__
Bind(wxEVT_ENTER_WINDOW, [this, link](wxMouseEvent& event) {
SetToolTip(OptionsGroup::get_url(get_app_config()->get("suppress_hyperlinks") != "1" ? link : std::string()));
FocusText(true);
event.Skip();
});
Bind(wxEVT_LEAVE_WINDOW, [this](wxMouseEvent& event) { FocusText(false); event.Skip(); });
Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent& event) { Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent& event) {
if (HasCapture()) if (HasCapture())
return; return;
this->CaptureMouse(); this->CaptureMouse();
event.Skip(); event.Skip();
} ); });
Bind(wxEVT_LEFT_UP, [link, this](wxMouseEvent& event) { Bind(wxEVT_LEFT_UP, [link, this](wxMouseEvent& event) {
if (!HasCapture()) if (!HasCapture())
return; return;
ReleaseMouse(); ReleaseMouse();
OptionsGroup::launch_browser(link); OptionsGroup::launch_browser(link);
event.Skip(); event.Skip();
} ); });
Bind(wxEVT_ENTER_WINDOW, [this, link](wxMouseEvent& event) {
#else
// Workaround: On Linux wxStaticText doesn't receive wxEVT_ENTER(LEAVE)_WINDOW events,
// so implement this behaviour trough wxEVT_MOTION events for this control and it's parent
Bind(wxEVT_MOTION, [link, this](wxMouseEvent& event) {
SetToolTip(OptionsGroup::get_url(!get_app_config()->get_bool("suppress_hyperlinks") ? link : std::string())); SetToolTip(OptionsGroup::get_url(!get_app_config()->get_bool("suppress_hyperlinks") ? link : std::string()));
FocusText(true); FocusText(true);
event.Skip(); event.Skip();
}); });
Bind(wxEVT_LEAVE_WINDOW, [this](wxMouseEvent& event) { FocusText(false); event.Skip(); }); GetParent()->Bind(wxEVT_MOTION, [this](wxMouseEvent& event) {
FocusText(false);
event.Skip();
});
// On Linux a mouse capturing causes a totally application freeze
Bind(wxEVT_LEFT_UP, [link, this](wxMouseEvent& event) {
OptionsGroup::launch_browser(link);
event.Skip();
});
#endif
} }
void ogStaticText::FocusText(bool focus) void ogStaticText::FocusText(bool focus)
@ -1066,6 +1091,9 @@ void ogStaticText::FocusText(bool focus)
SetFont(focus ? Slic3r::GUI::wxGetApp().link_font() : SetFont(focus ? Slic3r::GUI::wxGetApp().link_font() :
Slic3r::GUI::wxGetApp().normal_font()); Slic3r::GUI::wxGetApp().normal_font());
#ifdef __linux__
this->GetContainingSizer()->Layout();
#endif
Refresh(); Refresh();
} }

View File

@ -1732,9 +1732,7 @@ void TabPrint::update_description_lines()
if (m_post_process_explanation) { if (m_post_process_explanation) {
m_post_process_explanation->SetText( m_post_process_explanation->SetText(
_L("Post processing scripts shall modify G-code file in place.")); _L("Post processing scripts shall modify G-code file in place."));
#ifndef __linux__
m_post_process_explanation->SetPathEnd("post-processing-scripts_283913"); m_post_process_explanation->SetPathEnd("post-processing-scripts_283913");
#endif // __linux__
} }
// upadte G-code substitutions from the current configuration // upadte G-code substitutions from the current configuration
{ {