diff options
author | YuSanka <yusanka@gmail.com> | 2021-12-15 13:00:47 +0300 |
---|---|---|
committer | YuSanka <yusanka@gmail.com> | 2021-12-15 13:01:12 +0300 |
commit | 3ec78c4ccf4a3bc6caa12044ae217a75a5e47169 (patch) | |
tree | 29b3d9f7925b757df7b34385c6069c62361b1d2b | |
parent | b95a83aec19e6366f8eb76dd1cd1a7b96c5437a7 (diff) |
MsgDialog: Fix for scale of the message size, when mainframe wasn't created yet but InfoDialog is shown
-rw-r--r-- | src/slic3r/GUI/MsgDialog.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/slic3r/GUI/MsgDialog.cpp b/src/slic3r/GUI/MsgDialog.cpp index 6484ead73..a70a9b172 100644 --- a/src/slic3r/GUI/MsgDialog.cpp +++ b/src/slic3r/GUI/MsgDialog.cpp @@ -147,6 +147,20 @@ static void add_msg_content(wxWindow* parent, wxBoxSizer* content_sizer, wxStrin // calculate html page size from text wxSize page_size; int em = wxGetApp().em_unit(); + if (!wxGetApp().mainframe) { + // If mainframe is nullptr, it means that GUI_App::on_init_inner() isn't completed + // (We just show information dialog about configuration version now) + // And as a result the em_unit value wasn't created yet + // So, calculate it from the scale factor of Dialog +#if defined(__WXGTK__) + // Linux specific issue : get_dpi_for_window(this) still doesn't responce to the Display's scale in new wxWidgets(3.1.3). + // So, initialize default width_unit according to the width of the one symbol ("m") of the currently active font of this window. + em = std::max<size_t>(10, parent->GetTextExtent("m").x - 1); +#else + double scale_factor = (double)get_dpi_for_window(parent) / (double)DPI_DEFAULT; + em = std::max<size_t>(10, 10.0f * scale_factor); +#endif // __WXGTK__ + } // if message containes the table if (msg.Contains("<tr>")) { |