diff --git a/src/slic3r/GUI/AboutDialog.cpp b/src/slic3r/GUI/AboutDialog.cpp
index af3b655301..44d1972bcd 100644
--- a/src/slic3r/GUI/AboutDialog.cpp
+++ b/src/slic3r/GUI/AboutDialog.cpp
@@ -32,8 +32,11 @@ void AboutDialogLogo::onRepaint(wxEvent &event)
}
AboutDialog::AboutDialog()
- : wxDialog(NULL, wxID_ANY, _(L("About Slic3r")), wxDefaultPosition, wxDefaultSize, wxCAPTION)
+ : DPIDialog(NULL, wxID_ANY, _(L("About Slic3r")), wxDefaultPosition,
+ wxDefaultSize, /*wxCAPTION*/wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
{
+ SetFont(wxGetApp().normal_font());
+
wxColour bgr_clr = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
SetBackgroundColour(bgr_clr);
wxBoxSizer* hsizer = new wxBoxSizer(wxHORIZONTAL);
@@ -42,8 +45,10 @@ AboutDialog::AboutDialog()
main_sizer->Add(hsizer, 0, wxEXPAND | wxALL, 20);
// logo
- auto *logo = new wxStaticBitmap(this, wxID_ANY, create_scaled_bitmap(this, "Slic3r_192px.png", 192));
- hsizer->Add(logo, 1, wxALIGN_CENTER_VERTICAL);
+ m_logo_bitmap = PrusaBitmap(this, "Slic3r_192px.png", 192);
+ m_logo = new wxStaticBitmap(this, wxID_ANY, m_logo_bitmap.bmp());
+// auto *logo = new wxStaticBitmap(this, wxID_ANY, create_scaled_bitmap(this, "Slic3r_192px.png", 192));
+ hsizer->Add(m_logo, 1, wxALIGN_CENTER_VERTICAL);
wxBoxSizer* vsizer = new wxBoxSizer(wxVERTICAL);
hsizer->Add(vsizer, 2, wxEXPAND|wxLEFT, 20);
@@ -51,8 +56,8 @@ AboutDialog::AboutDialog()
// title
{
wxStaticText* title = new wxStaticText(this, wxID_ANY, "Slic3r Prusa Edition", wxDefaultPosition, wxDefaultSize);
- wxFont title_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
- title_font.SetWeight(wxFONTWEIGHT_BOLD);
+ wxFont title_font = GUI::wxGetApp().bold_font();// wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
+// title_font.SetWeight(wxFONTWEIGHT_BOLD);
title_font.SetFamily(wxFONTFAMILY_ROMAN);
title_font.SetPointSize(24);
title->SetFont(title_font);
@@ -63,9 +68,9 @@ AboutDialog::AboutDialog()
{
auto version_string = _(L("Version"))+ " " + std::string(SLIC3R_VERSION);
wxStaticText* version = new wxStaticText(this, wxID_ANY, version_string.c_str(), wxDefaultPosition, wxDefaultSize);
- wxFont version_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
+ wxFont version_font = GetFont();//wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
#ifdef __WXMSW__
- version_font.SetPointSize(9);
+ version_font.SetPointSize(/*9*/version_font.GetPointSize()-1);
#else
version_font.SetPointSize(11);
#endif
@@ -74,18 +79,18 @@ AboutDialog::AboutDialog()
}
// text
- wxHtmlWindow* html = new wxHtmlWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO/*NEVER*/);
+ m_html = new wxHtmlWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO/*NEVER*/);
{
- html->SetMinSize(wxSize(-1, 16 * wxGetApp().em_unit()));
- wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
+ m_html->SetMinSize(wxSize(-1, 16 * wxGetApp().em_unit()));
+ wxFont font = GetFont();//GUI::wxGetApp().normal_font(); // wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
const auto text_clr = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
auto text_clr_str = wxString::Format(wxT("#%02X%02X%02X"), text_clr.Red(), text_clr.Green(), text_clr.Blue());
auto bgr_clr_str = wxString::Format(wxT("#%02X%02X%02X"), bgr_clr.Red(), bgr_clr.Green(), bgr_clr.Blue());
const int fs = font.GetPointSize()-1;
int size[] = {fs,fs,fs,fs,fs,fs,fs};
- html->SetFonts(font.GetFaceName(), font.GetFaceName(), size);
- html->SetBorders(2);
+ m_html->SetFonts(font.GetFaceName(), font.GetFaceName(), size);
+ m_html->SetBorders(2);
const auto text = wxString::Format(
""
"
"
@@ -101,9 +106,9 @@ AboutDialog::AboutDialog()
""
""
"", bgr_clr_str, text_clr_str, text_clr_str);
- html->SetPage(text);
- vsizer->Add(html, 1, wxEXPAND | wxBOTTOM, 10);
- html->Bind(wxEVT_HTML_LINK_CLICKED, &AboutDialog::onLinkClicked, this);
+ m_html->SetPage(text);
+ vsizer->Add(m_html, 1, wxEXPAND | wxBOTTOM, 10);
+ m_html->Bind(wxEVT_HTML_LINK_CLICKED, &AboutDialog::onLinkClicked, this);
}
wxStdDialogButtonSizer* buttons = this->CreateStdDialogButtonSizer(wxCLOSE);
@@ -118,6 +123,29 @@ AboutDialog::AboutDialog()
main_sizer->SetSizeHints(this);
}
+void AboutDialog::on_dpi_changed(const wxRect &suggested_rect)
+{
+ m_logo_bitmap.rescale();
+ m_logo->SetBitmap(m_logo_bitmap.bmp());
+
+ const wxFont& font = GetFont();
+ const int fs = font.GetPointSize() - 1;
+ int font_size[] = { fs, fs, fs, fs, fs, fs, fs };
+ m_html->SetFonts(font.GetFaceName(), font.GetFaceName(), font_size);
+
+ const int& em = em_unit();
+
+ m_html->SetMinSize(wxSize(-1, 16 * em));
+ m_html->Refresh();
+
+ const wxSize& size = wxSize(65 * em, 30 * em);
+
+ SetMinSize(size);
+ SetSize(size);
+
+ Refresh();
+}
+
void AboutDialog::onLinkClicked(wxHtmlLinkEvent &event)
{
wxLaunchDefaultBrowser(event.GetLinkInfo().GetHref());
diff --git a/src/slic3r/GUI/AboutDialog.hpp b/src/slic3r/GUI/AboutDialog.hpp
index 01f7564c50..f74ab52f3f 100644
--- a/src/slic3r/GUI/AboutDialog.hpp
+++ b/src/slic3r/GUI/AboutDialog.hpp
@@ -7,6 +7,9 @@
#include
#include
+#include "GUI_Utils.hpp"
+#include "wxExtensions.hpp"
+
namespace Slic3r {
namespace GUI {
@@ -20,10 +23,16 @@ private:
void onRepaint(wxEvent &event);
};
-class AboutDialog : public wxDialog
+class AboutDialog : public DPIDialog
{
+ PrusaBitmap m_logo_bitmap;
+ wxHtmlWindow* m_html;
+ wxStaticBitmap* m_logo;
public:
AboutDialog();
+
+protected:
+ void on_dpi_changed(const wxRect &suggested_rect) override;
private:
void onLinkClicked(wxHtmlLinkEvent &event);
diff --git a/src/slic3r/GUI/ConfigSnapshotDialog.cpp b/src/slic3r/GUI/ConfigSnapshotDialog.cpp
index 205e84f571..dd3e462299 100644
--- a/src/slic3r/GUI/ConfigSnapshotDialog.cpp
+++ b/src/slic3r/GUI/ConfigSnapshotDialog.cpp
@@ -95,21 +95,26 @@ static wxString generate_html_page(const Config::SnapshotDB &snapshot_db, const
}
ConfigSnapshotDialog::ConfigSnapshotDialog(const Config::SnapshotDB &snapshot_db, const wxString &on_snapshot)
- : wxDialog(NULL, wxID_ANY, _(L("Configuration Snapshots")), wxDefaultPosition,
+ : DPIDialog(NULL, wxID_ANY, _(L("Configuration Snapshots")), wxDefaultPosition,
wxSize(45 * wxGetApp().em_unit(), 40 * wxGetApp().em_unit()),
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMAXIMIZE_BOX)
{
+ this->SetFont(wxGetApp().normal_font());
this->SetBackgroundColour(*wxWHITE);
wxBoxSizer* vsizer = new wxBoxSizer(wxVERTICAL);
this->SetSizer(vsizer);
// text
- wxHtmlWindow* html = new wxHtmlWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO);
+ html = new wxHtmlWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO);
{
- wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
+ wxFont font = wxGetApp().normal_font();//wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
#ifdef __WXMSW__
- int size[] = {8,8,8,8,11,11,11};
+ const int fs = font.GetPointSize();
+ const int fs1 = static_cast(0.8f*fs);
+ const int fs2 = static_cast(1.1f*fs);
+ int size[] = {fs1, fs1, fs1, fs1, fs2, fs2, fs2};
+// int size[] = {8,8,8,8,11,11,11};
#else
int size[] = {11,11,11,11,14,14,14};
#endif
@@ -127,6 +132,26 @@ ConfigSnapshotDialog::ConfigSnapshotDialog(const Config::SnapshotDB &snapshot_db
vsizer->Add(buttons, 0, wxEXPAND | wxRIGHT | wxBOTTOM, 3);
}
+void ConfigSnapshotDialog::on_dpi_changed(const wxRect &suggested_rect)
+{
+ wxFont font = GetFont();
+ const int fs = font.GetPointSize();
+ const int fs1 = static_cast(0.8f*fs);
+ const int fs2 = static_cast(1.1f*fs);
+ int font_size[] = { fs1, fs1, fs1, fs1, fs2, fs2, fs2 };
+
+ html->SetFonts(font.GetFaceName(), font.GetFaceName(), font_size);
+ html->Refresh();
+
+ const int& em = em_unit();
+ const wxSize& size = wxSize(45 * em, 40 * em);
+
+ SetMinSize(size);
+ SetSize(size);
+
+ Refresh();
+}
+
void ConfigSnapshotDialog::onLinkClicked(wxHtmlLinkEvent &event)
{
m_snapshot_to_activate = event.GetLinkInfo().GetHref();
diff --git a/src/slic3r/GUI/ConfigSnapshotDialog.hpp b/src/slic3r/GUI/ConfigSnapshotDialog.hpp
index f43fb8ed16..9b8b69ecfe 100644
--- a/src/slic3r/GUI/ConfigSnapshotDialog.hpp
+++ b/src/slic3r/GUI/ConfigSnapshotDialog.hpp
@@ -2,6 +2,7 @@
#define slic3r_GUI_ConfigSnapshotDialog_hpp_
#include "GUI.hpp"
+#include "GUI_Utils.hpp"
#include
#include
@@ -14,18 +15,23 @@ namespace Config {
class SnapshotDB;
}
-class ConfigSnapshotDialog : public wxDialog
+class ConfigSnapshotDialog : public DPIDialog
{
public:
ConfigSnapshotDialog(const Config::SnapshotDB &snapshot_db, const wxString &id);
const std::string& snapshot_to_activate() const { return m_snapshot_to_activate; }
+protected:
+ void on_dpi_changed(const wxRect &suggested_rect) override;
+
private:
void onLinkClicked(wxHtmlLinkEvent &event);
void onCloseDialog(wxEvent &);
// If set, it contains a snapshot ID to be restored after the dialog closes.
std::string m_snapshot_to_activate;
+
+ wxHtmlWindow* html;
};
} // namespace GUI
diff --git a/src/slic3r/GUI/FirmwareDialog.cpp b/src/slic3r/GUI/FirmwareDialog.cpp
index 8095a3237c..4fdc576792 100644
--- a/src/slic3r/GUI/FirmwareDialog.cpp
+++ b/src/slic3r/GUI/FirmwareDialog.cpp
@@ -732,7 +732,7 @@ const char* FirmwareDialog::priv::avr109_dev_name(Avr109Pid usb_pid) {
// Public
FirmwareDialog::FirmwareDialog(wxWindow *parent) :
- wxDialog(parent, wxID_ANY, _(L("Firmware flasher")), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
+ GUI::DPIDialog(parent, wxID_ANY, _(L("Firmware flasher")), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
p(new priv(this))
{
enum {
@@ -748,7 +748,13 @@ FirmwareDialog::FirmwareDialog(wxWindow *parent) :
int min_height = MIN_HEIGHT * em;
int min_height_expanded = MIN_HEIGHT_EXPANDED * em;
- wxFont status_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
+ /* get current font from application,
+ * because of wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT) function
+ * returns font for primary Display
+ */
+ const wxFont& font = GUI::wxGetApp().normal_font();
+ SetFont(font);
+ wxFont status_font = font;//wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
status_font.MakeBold();
wxFont mono_font(wxFontInfo().Family(wxFONTFAMILY_TELETYPE));
mono_font.MakeSmaller();
diff --git a/src/slic3r/GUI/FirmwareDialog.hpp b/src/slic3r/GUI/FirmwareDialog.hpp
index ad048bf5d3..a1eac00de3 100644
--- a/src/slic3r/GUI/FirmwareDialog.hpp
+++ b/src/slic3r/GUI/FirmwareDialog.hpp
@@ -4,12 +4,13 @@
#include
#include
+#include "GUI_Utils.hpp"
namespace Slic3r {
-class FirmwareDialog: public wxDialog
+class FirmwareDialog: public GUI::DPIDialog
{
public:
FirmwareDialog(wxWindow *parent);
@@ -20,6 +21,9 @@ public:
~FirmwareDialog();
static void run(wxWindow *parent);
+
+protected:
+ void on_dpi_changed(const wxRect &suggested_rect) override{;}
private:
struct priv;
std::unique_ptr p;
diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp
index 39628a9cbd..42385bd637 100644
--- a/src/slic3r/GUI/GUI_App.cpp
+++ b/src/slic3r/GUI/GUI_App.cpp
@@ -682,6 +682,12 @@ void GUI_App::add_config_menu(wxMenuBar *menu)
// Take a configuration snapshot.
if (check_unsaved_changes()) {
wxTextEntryDialog dlg(nullptr, _(L("Taking configuration snapshot")), _(L("Snapshot name")));
+
+ // set current normal font for dialog children,
+ // because of just dlg.SetFont(normal_font()) has no result;
+ for (auto child : dlg.GetChildren())
+ child->SetFont(normal_font());
+
if (dlg.ShowModal() == wxID_OK)
app_config->set("on_snapshot",
Slic3r::GUI::Config::SnapshotDB::singleton().take_snapshot(
@@ -731,7 +737,6 @@ void GUI_App::add_config_menu(wxMenuBar *menu)
get_installed_languages(names, identifiers);
if (select_language(names, identifiers)) {
save_language();
-// show_info(mainframe->m_tabpanel, _(L("Application will be restarted")), _(L("Attention!")));
_3DScene::remove_all_canvases();// remove all canvas before recreate GUI
recreate_GUI();
}
diff --git a/src/slic3r/GUI/GUI_Utils.hpp b/src/slic3r/GUI/GUI_Utils.hpp
index ac367a22ed..9da6bc8d88 100644
--- a/src/slic3r/GUI/GUI_Utils.hpp
+++ b/src/slic3r/GUI/GUI_Utils.hpp
@@ -58,6 +58,9 @@ public:
: P(parent, id, title, pos, size, style, name)
{
m_scale_factor = (float)get_dpi_for_window(this) / (float)DPI_DEFAULT;
+ m_normal_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
+ // An analog of em_unit value from GUI_App.
+ m_em_unit = std::max(10, 10 * m_scale_factor);
m_prev_scale_factor = m_scale_factor;
@@ -104,6 +107,7 @@ public:
int em_unit() const { return m_em_unit; }
int font_size() const { return m_font_size; }
+ const wxFont& normal_font() const { return m_normal_font; }
protected:
virtual void on_dpi_changed(const wxRect &suggested_rect) = 0;
@@ -113,6 +117,7 @@ private:
int m_em_unit;
int m_font_size;
+ wxFont m_normal_font;
float m_prev_scale_factor;
bool m_can_rescale{ true };
@@ -121,7 +126,7 @@ private:
wxClientDC dc(this);
const auto metrics = dc.GetFontMetrics();
m_font_size = metrics.height;
- m_em_unit = metrics.averageWidth;
+// m_em_unit = metrics.averageWidth;
}
// check if new scale is differ from previous
@@ -143,9 +148,18 @@ private:
void rescale(const wxRect &suggested_rect)
{
this->Freeze();
+ const float relative_scale_factor = m_scale_factor / m_prev_scale_factor;
// rescale fonts of all controls
- scale_controls_fonts(this, m_scale_factor / m_prev_scale_factor);
+ scale_controls_fonts(this, relative_scale_factor);
+ this->SetFont(this->GetFont().Scaled(relative_scale_factor));
+
+
+ // rescale normal_font value
+ m_normal_font = m_normal_font.Scaled(relative_scale_factor);
+
+ // An analog of em_unit value from GUI_App.
+ m_em_unit = std::max(10, 10 * m_scale_factor);
// rescale missed controls sizes and images
on_dpi_changed(suggested_rect);
diff --git a/src/slic3r/GUI/KBShortcutsDialog.cpp b/src/slic3r/GUI/KBShortcutsDialog.cpp
index bf2ff82863..63f331b926 100644
--- a/src/slic3r/GUI/KBShortcutsDialog.cpp
+++ b/src/slic3r/GUI/KBShortcutsDialog.cpp
@@ -13,7 +13,7 @@ KBShortcutsDialog::KBShortcutsDialog()
: DPIDialog(NULL, wxID_ANY, _(L("Slic3r Prusa Edition - Keyboard Shortcuts")),
wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
{
- SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
+ SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
main_sizer = new wxBoxSizer(wxVERTICAL);
@@ -21,16 +21,17 @@ KBShortcutsDialog::KBShortcutsDialog()
m_logo_bmp = PrusaBitmap(this, "Slic3r_32px.png", 32);
// fonts
- wxFont head_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).Bold();
+ const wxFont& font = wxGetApp().normal_font();
+ const wxFont& bold_font = wxGetApp().bold_font();
+ SetFont(font);
+
+ wxFont head_font = bold_font;// wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).Bold();
#ifdef __WXOSX__
head_font.SetPointSize(14);
#else
- head_font.SetPointSize(12);
+ head_font.SetPointSize(/*12*/bold_font.GetPointSize() + 2);
#endif // __WXOSX__
- const wxFont& font = wxGetApp().normal_font();
- const wxFont& bold_font = wxGetApp().bold_font();
-
fill_shortcuts();
auto panel = new wxPanel(this);
diff --git a/src/slic3r/GUI/SysInfoDialog.cpp b/src/slic3r/GUI/SysInfoDialog.cpp
index 052656974e..0067e6438e 100644
--- a/src/slic3r/GUI/SysInfoDialog.cpp
+++ b/src/slic3r/GUI/SysInfoDialog.cpp
@@ -41,10 +41,12 @@ std::string get_main_info(bool format_as_html)
}
SysInfoDialog::SysInfoDialog()
- : wxDialog(NULL, wxID_ANY, _(L("Slic3r Prusa Edition - System Information")), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
+ : DPIDialog(NULL, wxID_ANY, _(L("Slic3r Prusa Edition - System Information")), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
{
wxColour bgr_clr = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
SetBackgroundColour(bgr_clr);
+ SetFont(wxGetApp().normal_font());
+
wxBoxSizer* hsizer = new wxBoxSizer(wxHORIZONTAL);
hsizer->SetMinSize(wxSize(50 * wxGetApp().em_unit(), -1));
@@ -52,8 +54,10 @@ SysInfoDialog::SysInfoDialog()
main_sizer->Add(hsizer, 1, wxEXPAND | wxALL, 10);
// logo
- auto *logo = new wxStaticBitmap(this, wxID_ANY, create_scaled_bitmap(this, "Slic3r_192px.png", 192));
- hsizer->Add(logo, 0, wxALIGN_CENTER_VERTICAL);
+ m_logo_bmp = PrusaBitmap(this, "Slic3r_192px.png", 192);
+// auto *logo = new wxStaticBitmap(this, wxID_ANY, create_scaled_bitmap(this, "Slic3r_192px.png", 192));
+ m_logo = new wxStaticBitmap(this, wxID_ANY, m_logo_bmp.bmp());
+ hsizer->Add(m_logo, 0, wxALIGN_CENTER_VERTICAL);
wxBoxSizer* vsizer = new wxBoxSizer(wxVERTICAL);
hsizer->Add(vsizer, 1, wxEXPAND|wxLEFT, 20);
@@ -61,8 +65,8 @@ SysInfoDialog::SysInfoDialog()
// title
{
wxStaticText* title = new wxStaticText(this, wxID_ANY, SLIC3R_FORK_NAME, wxDefaultPosition, wxDefaultSize);
- wxFont title_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
- title_font.SetWeight(wxFONTWEIGHT_BOLD);
+ wxFont title_font = wxGetApp().bold_font();//wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
+// title_font.SetWeight(wxFONTWEIGHT_BOLD);
title_font.SetFamily(wxFONTFAMILY_ROMAN);
title_font.SetPointSize(22);
title->SetFont(title_font);
@@ -70,7 +74,7 @@ SysInfoDialog::SysInfoDialog()
}
// main_info_text
- wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
+ wxFont font = wxGetApp().normal_font();//wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
const auto text_clr = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
auto text_clr_str = wxString::Format(wxT("#%02X%02X%02X"), text_clr.Red(), text_clr.Green(), text_clr.Blue());
auto bgr_clr_str = wxString::Format(wxT("#%02X%02X%02X"), bgr_clr.Red(), bgr_clr.Green(), bgr_clr.Blue());
@@ -78,10 +82,10 @@ SysInfoDialog::SysInfoDialog()
const int fs = font.GetPointSize() - 1;
int size[] = { static_cast(fs*1.5), static_cast(fs*1.4), static_cast(fs*1.3), fs, fs, fs, fs };
- wxHtmlWindow* html = new wxHtmlWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_NEVER);
+ m_html = new wxHtmlWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_NEVER);
{
- html->SetFonts(font.GetFaceName(), font.GetFaceName(), size);
- html->SetBorders(2);
+ m_html->SetFonts(font.GetFaceName(), font.GetFaceName(), size);
+ m_html->SetBorders(2);
const auto text = wxString::Format(
""
""
@@ -91,16 +95,16 @@ SysInfoDialog::SysInfoDialog()
""
"", bgr_clr_str, text_clr_str, text_clr_str,
get_main_info(true));
- html->SetPage(text);
- vsizer->Add(html, 1, wxEXPAND | wxBOTTOM, wxGetApp().em_unit());
+ m_html->SetPage(text);
+ vsizer->Add(m_html, 1, wxEXPAND | wxBOTTOM, wxGetApp().em_unit());
}
// opengl_info
- wxHtmlWindow* opengl_info_html = new wxHtmlWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO);
+ m_opengl_info_html = new wxHtmlWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO);
{
- opengl_info_html->SetMinSize(wxSize(-1, 16 * wxGetApp().em_unit()));
- opengl_info_html->SetFonts(font.GetFaceName(), font.GetFaceName(), size);
- opengl_info_html->SetBorders(10);
+ m_opengl_info_html->SetMinSize(wxSize(-1, 16 * wxGetApp().em_unit()));
+ m_opengl_info_html->SetFonts(font.GetFaceName(), font.GetFaceName(), size);
+ m_opengl_info_html->SetBorders(10);
const auto text = wxString::Format(
""
""
@@ -110,8 +114,8 @@ SysInfoDialog::SysInfoDialog()
""
"", bgr_clr_str, text_clr_str, text_clr_str,
_3DScene::get_gl_info(true, true));
- opengl_info_html->SetPage(text);
- main_sizer->Add(opengl_info_html, 1, wxEXPAND | wxBOTTOM, 15);
+ m_opengl_info_html->SetPage(text);
+ main_sizer->Add(m_opengl_info_html, 1, wxEXPAND | wxBOTTOM, 15);
}
wxStdDialogButtonSizer* buttons = this->CreateStdDialogButtonSizer(wxOK);
@@ -130,6 +134,32 @@ SysInfoDialog::SysInfoDialog()
main_sizer->SetSizeHints(this);
}
+void SysInfoDialog::on_dpi_changed(const wxRect &suggested_rect)
+{
+ m_logo_bmp.rescale();
+ m_logo->SetBitmap(m_logo_bmp.bmp());
+
+ wxFont font = GetFont();
+ const int fs = font.GetPointSize() - 1;
+ int font_size[] = { static_cast(fs*1.5), static_cast(fs*1.4), static_cast(fs*1.3), fs, fs, fs, fs };
+
+ m_html->SetFonts(font.GetFaceName(), font.GetFaceName(), font_size);
+ m_html->Refresh();
+
+ const int& em = em_unit();
+
+ m_opengl_info_html->SetMinSize(wxSize(-1, 16 * em));
+ m_opengl_info_html->SetFonts(font.GetFaceName(), font.GetFaceName(), font_size);
+ m_opengl_info_html->Refresh();
+
+ const wxSize& size = wxSize(65 * em, 55 * em);
+
+ SetMinSize(size);
+ SetSize(size);
+
+ Refresh();
+}
+
void SysInfoDialog::onCopyToClipboard(wxEvent &)
{
wxTheClipboard->Open();
diff --git a/src/slic3r/GUI/SysInfoDialog.hpp b/src/slic3r/GUI/SysInfoDialog.hpp
index ee1b85ce60..6215d90ca9 100644
--- a/src/slic3r/GUI/SysInfoDialog.hpp
+++ b/src/slic3r/GUI/SysInfoDialog.hpp
@@ -4,14 +4,25 @@
#include
#include
+#include "GUI_Utils.hpp"
+#include "wxExtensions.hpp"
+
namespace Slic3r {
namespace GUI {
-class SysInfoDialog : public wxDialog
+class SysInfoDialog : public DPIDialog
{
wxString text_info {wxEmptyString};
+ PrusaBitmap m_logo_bmp;
+ wxStaticBitmap* m_logo;
+ wxHtmlWindow* m_opengl_info_html;
+ wxHtmlWindow* m_html;
+
public:
SysInfoDialog();
+
+protected:
+ void on_dpi_changed(const wxRect &suggested_rect) override;
private:
void onCopyToClipboard(wxEvent &);
diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp
index 5708723634..4dc6b6e2a4 100644
--- a/src/slic3r/GUI/wxExtensions.cpp
+++ b/src/slic3r/GUI/wxExtensions.cpp
@@ -428,16 +428,11 @@ void PrusaCollapsiblePaneMSW::Collapse(bool collapse)
* Displays with different HDPI */
int em_unit(wxWindow* win)
{
- if (win) {
- // get TopLevelWindow for some window
- wxWindow* top_win = win;
- while (!top_win->IsTopLevel())
- top_win = top_win->GetParent();
-
- Slic3r::GUI::DPIDialog* dlg = dynamic_cast(top_win);
+ if (win)
+ {
+ Slic3r::GUI::DPIDialog* dlg = dynamic_cast(Slic3r::GUI::find_toplevel_parent(win));
if (dlg)
- // An analog of em_unit value from GUI_App.
- return 10 * dlg->scale_factor();
+ return dlg->em_unit();
}
return Slic3r::GUI::wxGetApp().em_unit();
@@ -2574,10 +2569,6 @@ void PrusaModeButton::SetState(const bool state)
void PrusaModeButton::focus_button(const bool focus)
{
-// const wxBitmap& bmp = focus ? m_bmp_on : m_bmp_off;
-// SetBitmap(bmp);
-
-// const wxFont& new_font = focus ? Slic3r::GUI::wxGetApp().bold_font() : Slic3r::GUI::wxGetApp().small_font();
wxFont font = GetFont();
const wxFont& new_font = focus ? font.Bold() : font.GetBaseFont();