Follow-up 34848f0f : fixed non-MSW build

This commit is contained in:
YuSanka 2023-11-09 16:03:22 +01:00
parent dd20cc5750
commit dad1f2727c
3 changed files with 10 additions and 7 deletions

View File

@ -243,7 +243,7 @@ ErrorDialog::ErrorDialog(wxWindow *parent, const wxString &msg, bool monospaced_
create(m_content, monospaced_font ? 48 : 84);
}
ErrorDialog::ErrorDialog(wxWindow *parent, const wxString &msg, const std::function<void(const std::string&)> &on_link_clicked)
ErrorDialog::ErrorDialog(wxWindow *parent, const wxString &msg, const t_link_clicked& on_link_clicked)
: MsgDialog(parent, wxString::Format(_L("%s error"), SLIC3R_APP_NAME),
wxString::Format(_L("%s has encountered an error"), SLIC3R_APP_NAME), wxOK)
, m_content(HtmlContent{ msg, false, true, on_link_clicked })

View File

@ -24,12 +24,14 @@ namespace Slic3r {
namespace GUI {
using t_link_clicked = std::function<void(const std::string&)>;
struct HtmlContent
{
wxString msg{ wxEmptyString };
bool is_monospaced_font{ false };
bool is_marked_msg{ false };
std::function<void(const std::string&)> on_link_clicked{ nullptr };
wxString msg{ wxEmptyString };
bool is_monospaced_font{ false };
bool is_marked_msg{ false };
t_link_clicked on_link_clicked{ nullptr };
};
// A message / query dialog with a bitmap on the left and any content on the right
@ -75,7 +77,7 @@ public:
// If monospaced_font is true, the error message is displayed using html <code><pre></pre></code> tags,
// so that the code formatting will be preserved. This is useful for reporting errors from the placeholder parser.
ErrorDialog(wxWindow *parent, const wxString &msg, bool courier_font);
ErrorDialog(wxWindow *parent, const wxString &msg, const std::function<void(const std::string&)>& on_link_clicked);
ErrorDialog(wxWindow *parent, const wxString &msg, const t_link_clicked& on_link_clicked);
ErrorDialog(ErrorDialog &&) = delete;
ErrorDialog(const ErrorDialog &) = delete;
ErrorDialog &operator=(ErrorDialog &&) = delete;

View File

@ -5202,7 +5202,8 @@ void Plater::export_gcode(bool prefer_removable)
wxString error_str;
if (check_for_error(output_path, error_str)) {
ErrorDialog(this, error_str, [](const std::string& key) -> void { wxGetApp().jump_to_option(key); }).ShowModal();
const t_link_clicked on_link_clicked = [](const std::string& key) -> void { wxGetApp().jump_to_option(key); };
ErrorDialog(this, error_str, on_link_clicked).ShowModal();
output_path.clear();
} else {
alert_when_exporting_binary_gcode(wxGetApp().preset_bundle->prints.get_edited_preset().config.opt_bool("gcode_binary"),