From 38a4c341d5bd52513c8287d3a3403035fe3b865d Mon Sep 17 00:00:00 2001 From: YuSanka Date: Tue, 19 Sep 2023 15:58:21 +0200 Subject: [PATCH] EditGCodeDialog: Added info line with link to helper --- src/slic3r/GUI/EditGCodeDialog.cpp | 35 ++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/slic3r/GUI/EditGCodeDialog.cpp b/src/slic3r/GUI/EditGCodeDialog.cpp index fe163e30ef..60f12120f3 100644 --- a/src/slic3r/GUI/EditGCodeDialog.cpp +++ b/src/slic3r/GUI/EditGCodeDialog.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include "GUI.hpp" #include "GUI_App.hpp" @@ -40,6 +41,39 @@ EditGCodeDialog::EditGCodeDialog(wxWindow* parent, const std::string& key, const int border = 10; int em = em_unit(); + // append info line with link on printables.com + wxHtmlWindow* html_window = new wxHtmlWindow(this, wxID_ANY, wxDefaultPosition, wxSize(60 * em, 5 * em), wxHW_SCROLLBAR_NEVER); + + html_window->Bind(wxEVT_HTML_LINK_CLICKED, [](wxHtmlLinkEvent& event) { + wxGetApp().open_browser_with_warning_dialog(event.GetLinkInfo().GetHref()); + event.Skip(false); + }); + + const auto text_clr = wxGetApp().get_label_clr_default(); + const auto bgr_clr_str = wxGetApp().get_html_bg_color(parent); + const auto text_clr_str = encode_color(ColorRGB(text_clr.Red(), text_clr.Green(), text_clr.Blue())); + + //TRN this word-combination is a part of phraze "For more information about placeholders and its use visit our help page" + const wxString link = format_wxstr("%2%", "help.prusa3d.com/article/macros_1775", _L("help page")); + + // TRN ConfigWizard : Downloader : %1% = "help page" + const wxString main_text = format_wxstr(_L("For more information about placeholders and its use visit our %1%."), link); + + const wxFont& font = this->GetFont(); + const int fs = font.GetPointSize(); + int size[] = { fs,fs,fs,fs,fs,fs,fs }; + html_window->SetFonts(font.GetFaceName(), font.GetFaceName(), size); + + html_window->SetPage(format_wxstr( + "" + "%3%" + "" + , bgr_clr_str + , text_clr_str + , main_text + )); + + wxStaticText* label_top = new wxStaticText(this, wxID_ANY, _L("Built-in placeholders (Double click item to add to G-code)") + ":"); auto* grid_sizer = new wxFlexGridSizer(1, 3, 5, 15); @@ -80,6 +114,7 @@ EditGCodeDialog::EditGCodeDialog(wxWindow* parent, const std::string& key, const wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL); + topSizer->Add(html_window , 0, wxEXPAND | wxLEFT | wxTOP | wxRIGHT, border); topSizer->Add(label_top , 0, wxEXPAND | wxLEFT | wxTOP | wxRIGHT, border); topSizer->Add(grid_sizer , 1, wxEXPAND | wxLEFT | wxTOP | wxRIGHT, border); topSizer->Add(m_param_label , 0, wxEXPAND | wxLEFT | wxTOP | wxRIGHT, border);