diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp
index ec5acf43b..dfa783927 100644
--- a/src/libslic3r/PrintConfig.cpp
+++ b/src/libslic3r/PrintConfig.cpp
@@ -131,7 +131,7 @@ void PrintConfigDef::init_fff_params()
"as [layer_num] and [layer_z].");
def->multiline = true;
def->full_width = true;
- def->height = 50;
+ def->height = 5;
def->mode = comExpert;
def->default_value = new ConfigOptionString("");
@@ -140,7 +140,7 @@ void PrintConfigDef::init_fff_params()
def->tooltip = L("This code is inserted between objects when using sequential printing. By default extruder and bed temperature are reset using non-wait command; however if M104, M109, M140 or M190 are detected in this custom code, Slic3r will not add temperature commands. Note that you can use placeholder variables for all Slic3r settings, so you can put a \"M109 S[first_layer_temperature]\" command wherever you want.");
def->multiline = true;
def->full_width = true;
- def->height = 120;
+ def->height = 12;
def->mode = comExpert;
def->default_value = new ConfigOptionString("");
@@ -360,7 +360,7 @@ void PrintConfigDef::init_fff_params()
"Note that you can use placeholder variables for all Slic3r settings.");
def->multiline = true;
def->full_width = true;
- def->height = 120;
+ def->height = 12;
def->mode = comExpert;
def->default_value = new ConfigOptionString("M104 S0 ; turn off temperature\nG28 X0 ; home X axis\nM84 ; disable motors\n");
@@ -539,7 +539,7 @@ void PrintConfigDef::init_fff_params()
def->tooltip = L("If layer print time is estimated below this number of seconds, fan will be enabled "
"and its speed will be calculated by interpolating the minimum and maximum speeds.");
def->sidetext = L("approximate seconds");
- def->width = 60;
+ def->width = 6;
def->min = 0;
def->max = 1000;
def->mode = comExpert;
@@ -556,7 +556,7 @@ void PrintConfigDef::init_fff_params()
def->tooltip = L("You can put your notes regarding the filament here.");
def->multiline = true;
def->full_width = true;
- def->height = 130;
+ def->height = 13;
def->mode = comAdvanced;
def->default_value = new ConfigOptionStrings { "" };
@@ -1007,7 +1007,7 @@ void PrintConfigDef::init_fff_params()
def->label = L("Inherits profile");
def->tooltip = L("Name of the profile, from which this profile inherits.");
def->full_width = true;
- def->height = 50;
+ def->height = 5;
def->default_value = new ConfigOptionString();
def->cli = ConfigOptionDef::nocli;
@@ -1034,7 +1034,7 @@ void PrintConfigDef::init_fff_params()
def->cli = "after-layer-gcode|layer-gcode";
def->multiline = true;
def->full_width = true;
- def->height = 50;
+ def->height = 5;
def->mode = comExpert;
def->default_value = new ConfigOptionString("");
@@ -1053,7 +1053,7 @@ void PrintConfigDef::init_fff_params()
def->mode = comExpert;
def->default_value = new ConfigOptionBool(true);
- const int machine_limits_opt_width = 70;
+ const int machine_limits_opt_width = 7;
{
struct AxisDefault {
std::string name;
@@ -1252,7 +1252,7 @@ void PrintConfigDef::init_fff_params()
"header comments.");
def->multiline = true;
def->full_width = true;
- def->height = 130;
+ def->height = 13;
def->mode = comAdvanced;
def->default_value = new ConfigOptionString("");
@@ -1387,7 +1387,7 @@ void PrintConfigDef::init_fff_params()
def->gui_flags = "serialized";
def->multiline = true;
def->full_width = true;
- def->height = 60;
+ def->height = 6;
def->mode = comExpert;
def->default_value = new ConfigOptionStrings();
@@ -1402,7 +1402,7 @@ void PrintConfigDef::init_fff_params()
def->tooltip = L("You can put your notes regarding the printer here.");
def->multiline = true;
def->full_width = true;
- def->height = 130;
+ def->height = 13;
def->mode = comAdvanced;
def->default_value = new ConfigOptionString("");
@@ -1589,7 +1589,7 @@ void PrintConfigDef::init_fff_params()
def->label = "";
def->full_label = L("Serial port");
def->tooltip = L("USB/serial port for printer connection.");
- def->width = 200;
+ def->width = 20;
def->default_value = new ConfigOptionString("");
def = this->add("serial_speed", coInt);
@@ -1635,7 +1635,7 @@ void PrintConfigDef::init_fff_params()
def->tooltip = L("If layer print time is estimated below this number of seconds, print moves "
"speed will be scaled down to extend duration to this value.");
def->sidetext = L("approximate seconds");
- def->width = 60;
+ def->width = 6;
def->min = 0;
def->max = 1000;
def->mode = comExpert;
@@ -1742,7 +1742,7 @@ void PrintConfigDef::init_fff_params()
"a \"M109 S[first_layer_temperature]\" command wherever you want.");
def->multiline = true;
def->full_width = true;
- def->height = 120;
+ def->height = 12;
def->mode = comExpert;
def->default_value = new ConfigOptionString("G28 ; home all axes\nG1 Z5 F5000 ; lift nozzle\n");
@@ -1758,7 +1758,7 @@ void PrintConfigDef::init_fff_params()
"in extruder order.");
def->multiline = true;
def->full_width = true;
- def->height = 120;
+ def->height = 12;
def->mode = comExpert;
def->default_value = new ConfigOptionStrings { "; Filament gcode\n" };
@@ -2008,7 +2008,7 @@ void PrintConfigDef::init_fff_params()
"as [previous_extruder] and [next_extruder].");
def->multiline = true;
def->full_width = true;
- def->height = 50;
+ def->height = 5;
def->mode = comExpert;
def->default_value = new ConfigOptionString("");
@@ -2330,7 +2330,7 @@ void PrintConfigDef::init_sla_params()
def->tooltip = L("You can put your notes regarding the SLA print material here.");
def->multiline = true;
def->full_width = true;
- def->height = 130;
+ def->height = 13;
def->mode = comAdvanced;
def->default_value = new ConfigOptionString("");
diff --git a/src/slic3r/GUI/AboutDialog.cpp b/src/slic3r/GUI/AboutDialog.cpp
index 86b12a95f..fb1450ba1 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, wxString::Format(_(L("About %s")), SLIC3R_APP_NAME), wxDefaultPosition, wxDefaultSize, wxCAPTION)
+ : DPIDialog(NULL, wxID_ANY, wxString::Format(_(L("About %s")), SLIC3R_APP_NAME), 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,9 @@ 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 = ScalableBitmap(this, "Slic3r_192px.png", 192);
+ m_logo = new wxStaticBitmap(this, wxID_ANY, m_logo_bitmap.bmp());
+ hsizer->Add(m_logo, 1, wxALIGN_CENTER_VERTICAL);
wxBoxSizer* vsizer = new wxBoxSizer(wxVERTICAL);
hsizer->Add(vsizer, 2, wxEXPAND|wxLEFT, 20);
@@ -51,8 +55,7 @@ AboutDialog::AboutDialog()
// title
{
wxStaticText* title = new wxStaticText(this, wxID_ANY, SLIC3R_APP_NAME, wxDefaultPosition, wxDefaultSize);
- wxFont title_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
- title_font.SetWeight(wxFONTWEIGHT_BOLD);
+ wxFont title_font = GUI::wxGetApp().bold_font();
title_font.SetFamily(wxFONTFAMILY_ROMAN);
title_font.SetPointSize(24);
title->SetFont(title_font);
@@ -63,9 +66,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();
#ifdef __WXMSW__
- version_font.SetPointSize(9);
+ version_font.SetPointSize(version_font.GetPointSize()-1);
#else
version_font.SetPointSize(11);
#endif
@@ -74,18 +77,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();
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 +104,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 +121,29 @@ AboutDialog::AboutDialog()
main_sizer->SetSizeHints(this);
}
+void AboutDialog::on_dpi_changed(const wxRect &suggested_rect)
+{
+ m_logo_bitmap.msw_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 01f7564c5..7019b21f6 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
{
+ ScalableBitmap 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/BedShapeDialog.cpp b/src/slic3r/GUI/BedShapeDialog.cpp
index 7bbf1ac7f..00ebf117c 100644
--- a/src/slic3r/GUI/BedShapeDialog.cpp
+++ b/src/slic3r/GUI/BedShapeDialog.cpp
@@ -18,6 +18,7 @@ namespace GUI {
void BedShapeDialog::build_dialog(ConfigOptionPoints* default_pt)
{
+ SetFont(wxGetApp().normal_font());
m_panel = new BedShapePanel(this);
m_panel->build_panel(default_pt);
@@ -36,6 +37,22 @@ void BedShapeDialog::build_dialog(ConfigOptionPoints* default_pt)
}));
}
+void BedShapeDialog::on_dpi_changed(const wxRect &suggested_rect)
+{
+ const int& em = em_unit();
+ m_panel->m_shape_options_book->SetMinSize(wxSize(25 * em, -1));
+
+ for (auto og : m_panel->m_optgroups)
+ og->msw_rescale();
+
+ const wxSize& size = wxSize(50 * em, -1);
+
+ SetMinSize(size);
+ SetSize(size);
+
+ Refresh();
+}
+
void BedShapePanel::build_panel(ConfigOptionPoints* default_pt)
{
// on_change(nullptr);
@@ -125,7 +142,7 @@ ConfigOptionsGroupShp BedShapePanel::init_shape_options_page(wxString title)
ConfigOptionsGroupShp optgroup;
optgroup = std::make_shared(panel, _(L("Settings")));
- optgroup->label_width = 10*wxGetApp().em_unit();//100;
+ optgroup->label_width = 10;
optgroup->m_on_change = [this](t_config_option_key opt_key, boost::any value) {
update_shape();
};
diff --git a/src/slic3r/GUI/BedShapeDialog.hpp b/src/slic3r/GUI/BedShapeDialog.hpp
index 538fccc34..72e50a05d 100644
--- a/src/slic3r/GUI/BedShapeDialog.hpp
+++ b/src/slic3r/GUI/BedShapeDialog.hpp
@@ -16,11 +16,8 @@ namespace GUI {
using ConfigOptionsGroupShp = std::shared_ptr;
class BedShapePanel : public wxPanel
{
- wxChoicebook* m_shape_options_book;
Bed_2D* m_canvas;
- std::vector m_optgroups;
-
public:
BedShapePanel(wxWindow* parent) : wxPanel(parent, wxID_ANY) {}
~BedShapePanel() {}
@@ -35,18 +32,25 @@ public:
// Returns the resulting bed shape polygon. This value will be stored to the ini file.
std::vector GetValue() { return m_canvas->m_bed_shape; }
+
+ wxChoicebook* m_shape_options_book;
+ std::vector m_optgroups;
+
};
-class BedShapeDialog : public wxDialog
+class BedShapeDialog : public DPIDialog
{
BedShapePanel* m_panel;
public:
- BedShapeDialog(wxWindow* parent) : wxDialog(parent, wxID_ANY, _(L("Bed Shape")),
+ BedShapeDialog(wxWindow* parent) : DPIDialog(parent, wxID_ANY, _(L("Bed Shape")),
wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) {}
~BedShapeDialog() {}
void build_dialog(ConfigOptionPoints* default_pt);
std::vector GetValue() { return m_panel->GetValue(); }
+
+protected:
+ void on_dpi_changed(const wxRect &suggested_rect) override;
};
} // GUI
diff --git a/src/slic3r/GUI/BitmapCache.cpp b/src/slic3r/GUI/BitmapCache.cpp
index bb4145107..db116a5dd 100644
--- a/src/slic3r/GUI/BitmapCache.cpp
+++ b/src/slic3r/GUI/BitmapCache.cpp
@@ -23,6 +23,8 @@ void BitmapCache::clear()
{
for (std::pair &bitmap : m_map)
delete bitmap.second;
+
+ m_map.clear();
}
static wxBitmap wxImage_to_wxBitmap_with_alpha(wxImage &&image, float scale = 1.0f)
@@ -259,9 +261,6 @@ wxBitmap* BitmapCache::load_svg(const std::string &bitmap_name, unsigned target_
wxBitmap BitmapCache::mksolid(size_t width, size_t height, unsigned char r, unsigned char g, unsigned char b, unsigned char transparency)
{
- width = width * 0.1f * Slic3r::GUI::wxGetApp().em_unit() + 0.5f;
- height = height * 0.1f * Slic3r::GUI::wxGetApp().em_unit() + 0.5f;
-
wxImage image(width, height);
image.InitAlpha();
unsigned char* imgdata = image.GetData();
diff --git a/src/slic3r/GUI/ButtonsDescription.cpp b/src/slic3r/GUI/ButtonsDescription.cpp
index fb4c24286..9def34749 100644
--- a/src/slic3r/GUI/ButtonsDescription.cpp
+++ b/src/slic3r/GUI/ButtonsDescription.cpp
@@ -7,6 +7,7 @@
#include "GUI.hpp"
#include "GUI_App.hpp"
#include "I18N.hpp"
+#include "wxExtensions.hpp"
namespace Slic3r {
namespace GUI {
@@ -23,7 +24,7 @@ ButtonsDescription::ButtonsDescription(wxWindow* parent, t_icon_descriptions* ic
// Icon description
for (auto pair : *m_icon_descriptions)
{
- auto icon = new wxStaticBitmap(this, wxID_ANY, *pair.first);
+ auto icon = new wxStaticBitmap(this, wxID_ANY, /***/pair.first->bmp());
grid_sizer->Add(icon, -1, wxALIGN_CENTRE_VERTICAL);
std::istringstream f(pair.second);
diff --git a/src/slic3r/GUI/ButtonsDescription.hpp b/src/slic3r/GUI/ButtonsDescription.hpp
index 81baaf191..69005d2a5 100644
--- a/src/slic3r/GUI/ButtonsDescription.hpp
+++ b/src/slic3r/GUI/ButtonsDescription.hpp
@@ -4,10 +4,12 @@
#include
#include
+class ScalableBitmap;
+
namespace Slic3r {
namespace GUI {
-using t_icon_descriptions = std::vector>;
+using t_icon_descriptions = std::vector>;
class ButtonsDescription : public wxDialog
{
@@ -15,8 +17,6 @@ class ButtonsDescription : public wxDialog
public:
ButtonsDescription(wxWindow* parent, t_icon_descriptions* icon_descriptions);
~ButtonsDescription() {}
-
-
};
} // GUI
diff --git a/src/slic3r/GUI/ConfigSnapshotDialog.cpp b/src/slic3r/GUI/ConfigSnapshotDialog.cpp
index 205e84f57..dd3e46229 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 f43fb8ed1..9b8b69ecf 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/ConfigWizard.cpp b/src/slic3r/GUI/ConfigWizard.cpp
index e0bfccf30..5e9327ffb 100644
--- a/src/slic3r/GUI/ConfigWizard.cpp
+++ b/src/slic3r/GUI/ConfigWizard.cpp
@@ -642,16 +642,21 @@ void PageTemperatures::apply_custom_config(DynamicPrintConfig &config)
ConfigWizardIndex::ConfigWizardIndex(wxWindow *parent)
: wxPanel(parent)
- // XXX: use create_scaled_bitmap:
+ /* #ys_FIXME_delete_after_testing by VK
, bg(GUI::from_u8(Slic3r::var("Slic3r_192px_transparent.png")), wxBITMAP_TYPE_PNG)
, bullet_black(GUI::from_u8(Slic3r::var("bullet_black.png")), wxBITMAP_TYPE_PNG)
, bullet_blue(GUI::from_u8(Slic3r::var("bullet_blue.png")), wxBITMAP_TYPE_PNG)
, bullet_white(GUI::from_u8(Slic3r::var("bullet_white.png")), wxBITMAP_TYPE_PNG)
+ */
+ , bg(ScalableBitmap(parent, "Slic3r_192px_transparent.png", 192))
+ , bullet_black(ScalableBitmap(parent, "bullet_black.png"))
+ , bullet_blue(ScalableBitmap(parent, "bullet_blue.png"))
+ , bullet_white(ScalableBitmap(parent, "bullet_white.png"))
, item_active(0)
, item_hover(-1)
, last_page((size_t)-1)
{
- SetMinSize(bg.GetSize());
+ SetMinSize(bg.bmp().GetSize());
const wxSize size = GetTextExtent("m");
em_w = size.x;
@@ -663,7 +668,10 @@ ConfigWizardIndex::ConfigWizardIndex(wxWindow *parent)
// In some cases it didn't work at all. And so wxStaticBitmap is used here instead,
// because it has all the platform quirks figured out.
auto *sizer = new wxBoxSizer(wxVERTICAL);
+ /* #ys_FIXME_delete_after_testing by VK
auto *logo = new wxStaticBitmap(this, wxID_ANY, bg);
+ */
+ logo = new wxStaticBitmap(this, wxID_ANY, bg.bmp());
sizer->AddStretchSpacer();
sizer->Add(logo);
SetSizer(sizer);
@@ -771,8 +779,12 @@ void ConfigWizardIndex::on_paint(wxPaintEvent & evt)
wxPaintDC dc(this);
+ /* #ys_FIXME_delete_after_testing by VK
const auto bullet_w = bullet_black.GetSize().GetWidth();
const auto bullet_h = bullet_black.GetSize().GetHeight();
+ */
+ const auto bullet_w = bullet_black.bmp().GetSize().GetWidth();
+ const auto bullet_h = bullet_black.bmp().GetSize().GetHeight();
const int yoff_icon = bullet_h < em_h ? (em_h - bullet_h) / 2 : 0;
const int yoff_text = bullet_h > em_h ? (bullet_h - em_h) / 2 : 0;
const int yinc = item_height();
@@ -785,10 +797,16 @@ void ConfigWizardIndex::on_paint(wxPaintEvent & evt)
unsigned x = em_w/2 + item.indent * em_w;
if (i == item_active || item_hover >= 0 && i == (size_t)item_hover) {
+ /*#ys_FIXME_delete_after_testing by VK
dc.DrawBitmap(bullet_blue, x, y + yoff_icon, false);
}
else if (i < item_active) { dc.DrawBitmap(bullet_black, x, y + yoff_icon, false); }
else if (i > item_active) { dc.DrawBitmap(bullet_white, x, y + yoff_icon, false); }
+ */
+ dc.DrawBitmap(bullet_blue.bmp(), x, y + yoff_icon, false);
+ }
+ else if (i < item_active) { dc.DrawBitmap(bullet_black.bmp(), x, y + yoff_icon, false); }
+ else if (i > item_active) { dc.DrawBitmap(bullet_white.bmp(), x, y + yoff_icon, false); }
x += + bullet_w + em_w/2;
const auto text_size = dc.GetTextExtent(item.label);
@@ -821,6 +839,18 @@ void ConfigWizardIndex::on_mouse_move(wxMouseEvent &evt)
evt.Skip();
}
+void ConfigWizardIndex::msw_rescale()
+{
+ bg.msw_rescale();
+ SetMinSize(bg.bmp().GetSize());
+ logo->SetBitmap(bg.bmp());
+
+ bullet_black.msw_rescale();
+ bullet_blue.msw_rescale();
+ bullet_white.msw_rescale();
+ Refresh();
+}
+
// priv
@@ -995,9 +1025,10 @@ void ConfigWizard::priv::apply_config(AppConfig *app_config, PresetBundle *prese
// Public
ConfigWizard::ConfigWizard(wxWindow *parent, RunReason reason)
- : wxDialog(parent, wxID_ANY, _(name().ToStdString()), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
+ : DPIDialog(parent, wxID_ANY, _(name().ToStdString()), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
, p(new priv(this))
{
+ this->SetFont(wxGetApp().normal_font());
p->run_reason = reason;
p->load_vendors();
@@ -1141,5 +1172,11 @@ const wxString& ConfigWizard::name(const bool from_menu/* = false*/)
return from_menu ? config_wizard_name_menu : config_wizard_name;
}
+void ConfigWizard::on_dpi_changed(const wxRect &suggested_rect)
+{
+ p->index->msw_rescale();
+ Refresh();
+}
+
}
}
diff --git a/src/slic3r/GUI/ConfigWizard.hpp b/src/slic3r/GUI/ConfigWizard.hpp
index c9ee05529..b707e525b 100644
--- a/src/slic3r/GUI/ConfigWizard.hpp
+++ b/src/slic3r/GUI/ConfigWizard.hpp
@@ -5,6 +5,8 @@
#include
+#include "GUI_Utils.hpp"
+
namespace Slic3r {
class PresetBundle;
@@ -13,7 +15,7 @@ class PresetUpdater;
namespace GUI {
-class ConfigWizard: public wxDialog
+class ConfigWizard: public DPIDialog
{
public:
// Why is the Wizard run
@@ -35,6 +37,10 @@ public:
bool run(PresetBundle *preset_bundle, const PresetUpdater *updater);
static const wxString& name(const bool from_menu = false);
+
+protected:
+ void on_dpi_changed(const wxRect &suggested_rect) override ;
+
private:
struct priv;
std::unique_ptr p;
diff --git a/src/slic3r/GUI/ConfigWizard_private.hpp b/src/slic3r/GUI/ConfigWizard_private.hpp
index 792b92015..31a990b60 100644
--- a/src/slic3r/GUI/ConfigWizard_private.hpp
+++ b/src/slic3r/GUI/ConfigWizard_private.hpp
@@ -210,6 +210,7 @@ public:
void go_to(ConfigWizardPage *page);
void clear();
+ void msw_rescale();
int em() const { return em_w; }
private:
@@ -224,18 +225,27 @@ private:
int em_w;
int em_h;
-
+ /* #ys_FIXME_delete_after_testing by VK
const wxBitmap bg;
const wxBitmap bullet_black;
const wxBitmap bullet_blue;
const wxBitmap bullet_white;
+ */
+ ScalableBitmap bg;
+ ScalableBitmap bullet_black;
+ ScalableBitmap bullet_blue;
+ ScalableBitmap bullet_white;
+ wxStaticBitmap* logo;
std::vector- items;
size_t item_active;
ssize_t item_hover;
size_t last_page;
+ /* #ys_FIXME_delete_after_testing by VK
int item_height() const { return std::max(bullet_black.GetSize().GetHeight(), em_w) + em_w; }
+ */
+ int item_height() const { return std::max(bullet_black.bmp().GetSize().GetHeight(), em_w) + em_w; }
void on_paint(wxPaintEvent &evt);
void on_mouse_move(wxMouseEvent &evt);
diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp
index 6da0800d9..822361c5d 100644
--- a/src/slic3r/GUI/Field.cpp
+++ b/src/slic3r/GUI/Field.cpp
@@ -33,21 +33,11 @@ wxString double_to_string(double const value, const int max_precision /*= 4*/)
void Field::PostInitialize()
{
auto color = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
- m_Undo_btn = new MyButton(m_parent, wxID_ANY, "", wxDefaultPosition,wxDefaultSize, wxBU_EXACTFIT | wxNO_BORDER);
- m_Undo_to_sys_btn = new MyButton(m_parent, wxID_ANY, "", wxDefaultPosition,wxDefaultSize, wxBU_EXACTFIT | wxNO_BORDER);
- if (wxMSW) {
- m_Undo_btn->SetBackgroundColour(color);
- m_Undo_btn->SetBackgroundStyle(wxBG_STYLE_PAINT);
- m_Undo_to_sys_btn->SetBackgroundColour(color);
- m_Undo_to_sys_btn->SetBackgroundStyle(wxBG_STYLE_PAINT);
- }
- m_Undo_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent) { on_back_to_initial_value(); }));
- m_Undo_to_sys_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent) { on_back_to_sys_value(); }));
+ m_Undo_btn = new RevertButton(m_parent, "bullet_white.png");
+ m_Undo_to_sys_btn = new RevertButton(m_parent, "bullet_white.png");
- //set default bitmap
- wxBitmap bmp = create_scaled_bitmap(m_parent, "bullet_white.png");
- set_undo_bitmap(&bmp);
- set_undo_to_sys_bitmap(&bmp);
+ m_Undo_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent) { on_back_to_initial_value(); }));
+ m_Undo_to_sys_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent) { on_back_to_sys_value(); }));
switch (m_opt.type)
{
@@ -65,6 +55,9 @@ void Field::PostInitialize()
break;
}
+ // initialize m_unit_value
+ m_em_unit = em_unit(m_parent);
+
BUILD();
}
@@ -212,8 +205,8 @@ bool is_defined_input_value(wxWindow* win, const ConfigOptionType& type)
void TextCtrl::BUILD() {
auto size = wxSize(wxDefaultSize);
- if (m_opt.height >= 0) size.SetHeight(m_opt.height);
- if (m_opt.width >= 0) size.SetWidth(m_opt.width);
+ if (m_opt.height >= 0) size.SetHeight(m_opt.height*m_em_unit);
+ if (m_opt.width >= 0) size.SetWidth(m_opt.width*m_em_unit);
wxString text_value = wxString("");
@@ -357,6 +350,21 @@ boost::any& TextCtrl::get_value()
return m_value;
}
+void TextCtrl::msw_rescale()
+{
+ Field::msw_rescale();
+ auto size = wxSize(wxDefaultSize);
+ if (m_opt.height >= 0) size.SetHeight(m_opt.height*m_em_unit);
+ if (m_opt.width >= 0) size.SetWidth(m_opt.width*m_em_unit);
+
+ if (size != wxDefaultSize)
+ {
+ wxTextCtrl* field = dynamic_cast(window);
+ field->SetMinSize(size);
+ }
+
+}
+
void TextCtrl::enable() { dynamic_cast(window)->Enable(); dynamic_cast(window)->SetEditable(true); }
void TextCtrl::disable() { dynamic_cast(window)->Disable(); dynamic_cast(window)->SetEditable(false); }
@@ -379,7 +387,8 @@ void CheckBox::BUILD() {
static_cast(m_opt.default_value)->get_at(m_opt_idx) :
false;
- auto temp = new wxCheckBox(m_parent, wxID_ANY, wxString(""), wxDefaultPosition, size);
+ // Set Label as a string of at least one space simbol to correct system scaling of a CheckBox
+ auto temp = new wxCheckBox(m_parent, wxID_ANY, wxString(" "), wxDefaultPosition, size);
temp->SetFont(Slic3r::GUI::wxGetApp().normal_font());
temp->SetBackgroundStyle(wxBG_STYLE_PAINT);
temp->SetValue(check_value);
@@ -408,8 +417,8 @@ int undef_spin_val = -9999; //! Probably, It's not necessary
void SpinCtrl::BUILD() {
auto size = wxSize(wxDefaultSize);
- if (m_opt.height >= 0) size.SetHeight(m_opt.height);
- if (m_opt.width >= 0) size.SetWidth(m_opt.width);
+ if (m_opt.height >= 0) size.SetHeight(m_opt.height*m_em_unit);
+ if (m_opt.width >= 0) size.SetWidth(m_opt.width*m_em_unit);
wxString text_value = wxString("");
int default_value = 0;
@@ -504,10 +513,18 @@ void SpinCtrl::propagate_value()
on_change_field();
}
+void SpinCtrl::msw_rescale()
+{
+ Field::msw_rescale();
+
+ wxSpinCtrl* field = dynamic_cast(window);
+ field->SetMinSize(wxSize(-1, int(1.9f*field->GetFont().GetPixelSize().y)));
+}
+
void Choice::BUILD() {
- wxSize size(15 * wxGetApp().em_unit(), -1);
- if (m_opt.height >= 0) size.SetHeight(m_opt.height);
- if (m_opt.width >= 0) size.SetWidth(m_opt.width);
+ wxSize size(m_width * m_em_unit, -1);
+ if (m_opt.height >= 0) size.SetHeight(m_opt.height*m_em_unit);
+ if (m_opt.width >= 0) size.SetWidth(m_opt.width*m_em_unit);
wxBitmapComboBox* temp;
if (!m_opt.gui_type.empty() && m_opt.gui_type.compare("select_open") != 0) {
@@ -816,11 +833,53 @@ boost::any& Choice::get_value()
return m_value;
}
+void Choice::msw_rescale()
+{
+ Field::msw_rescale();
+
+ wxBitmapComboBox* field = dynamic_cast(window);
+
+ const wxString selection = field->GetString(field->GetSelection());
+
+ /* To correct scaling (set new controll size) of a wxBitmapCombobox
+ * we need to refill control with new bitmaps. So, in our case :
+ * 1. clear conrol
+ * 2. add content
+ * 3. add scaled "empty" bitmap to the at least one item
+ */
+ field->Clear();
+ wxSize size(wxDefaultSize);
+ if (m_opt.height >= 0) size.SetHeight(m_opt.height * m_em_unit);
+ size.SetWidth((m_opt.width > 0 ? m_opt.width : m_width) * m_em_unit);
+
+ field->SetSize(size);
+
+ size_t idx, counter = idx = 0;
+ if (m_opt.enum_labels.empty() && m_opt.enum_values.empty()) {}
+ else{
+ for (auto el : m_opt.enum_labels.empty() ? m_opt.enum_values : m_opt.enum_labels) {
+ const wxString& str = _(el);
+ field->Append(str);
+ if (el.compare(selection) == 0)
+ idx = counter;
+ ++counter;
+ }
+ }
+
+ wxBitmap empty_bmp(1, field->GetFont().GetPixelSize().y + 2);
+ empty_bmp.SetWidth(0);
+ field->SetItemBitmap(0, empty_bmp);
+
+ idx == m_opt.enum_values.size() ?
+ field->SetValue(selection) :
+ field->SetSelection(idx);
+}
+
void ColourPicker::BUILD()
{
auto size = wxSize(wxDefaultSize);
- if (m_opt.height >= 0) size.SetHeight(m_opt.height);
- if (m_opt.width >= 0) size.SetWidth(m_opt.width);
+ if (m_opt.height >= 0) size.SetHeight(m_opt.height*m_em_unit);
+ if (m_opt.width >= 0) size.SetWidth(m_opt.width*m_em_unit);
// Validate the color
wxString clr_str(static_cast(m_opt.default_value)->get_at(m_opt_idx));
@@ -855,7 +914,7 @@ void PointCtrl::BUILD()
{
auto temp = new wxBoxSizer(wxHORIZONTAL);
- const wxSize field_size(4 * wxGetApp().em_unit(), -1);
+ const wxSize field_size(4 * m_em_unit, -1);
auto default_pt = static_cast(m_opt.default_value)->values.at(0);
double val = default_pt(0);
@@ -898,6 +957,16 @@ void PointCtrl::BUILD()
y_textctrl->SetToolTip(get_tooltip_text(X+", "+Y));
}
+void PointCtrl::msw_rescale()
+{
+ Field::msw_rescale();
+
+ const wxSize field_size(4 * m_em_unit, -1);
+
+ x_textctrl->SetMinSize(field_size);
+ y_textctrl->SetMinSize(field_size);
+}
+
void PointCtrl::propagate_value(wxTextCtrl* win)
{
if (!win->GetValue().empty())
@@ -943,8 +1012,8 @@ boost::any& PointCtrl::get_value()
void StaticText::BUILD()
{
auto size = wxSize(wxDefaultSize);
- if (m_opt.height >= 0) size.SetHeight(m_opt.height);
- if (m_opt.width >= 0) size.SetWidth(m_opt.width);
+ if (m_opt.height >= 0) size.SetHeight(m_opt.height*m_em_unit);
+ if (m_opt.width >= 0) size.SetWidth(m_opt.width*m_em_unit);
const wxString legend(static_cast(m_opt.default_value)->value);
auto temp = new wxStaticText(m_parent, wxID_ANY, legend, wxDefaultPosition, size, wxST_ELLIPSIZE_MIDDLE);
@@ -958,6 +1027,21 @@ void StaticText::BUILD()
temp->SetToolTip(get_tooltip_text(legend));
}
+void StaticText::msw_rescale()
+{
+ Field::msw_rescale();
+
+ auto size = wxSize(wxDefaultSize);
+ if (m_opt.height >= 0) size.SetHeight(m_opt.height*m_em_unit);
+ if (m_opt.width >= 0) size.SetWidth(m_opt.width*m_em_unit);
+
+ if (size != wxDefaultSize)
+ {
+ wxStaticText* field = dynamic_cast(window);
+ field->SetSize(size);
+ }
+}
+
void SliderCtrl::BUILD()
{
auto size = wxSize(wxDefaultSize);
diff --git a/src/slic3r/GUI/Field.hpp b/src/slic3r/GUI/Field.hpp
index 128d60d47..516570ea8 100644
--- a/src/slic3r/GUI/Field.hpp
+++ b/src/slic3r/GUI/Field.hpp
@@ -19,6 +19,7 @@
#include "libslic3r/Utils.hpp"
#include "GUI.hpp"
+#include "wxExtensions.hpp"
#ifdef __WXMSW__
#define wxMSW true
@@ -36,19 +37,24 @@ using t_back_to_init = std::function;
wxString double_to_string(double const value, const int max_precision = 4);
-class MyButton : public wxButton
+class RevertButton : public ScalableButton
{
bool hidden = false; // never show button if it's hidden ones
public:
- MyButton() {}
- MyButton(wxWindow* parent, wxWindowID id, const wxString& label = wxEmptyString,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize, long style = 0,
- const wxValidator& validator = wxDefaultValidator,
- const wxString& name = wxTextCtrlNameStr)
- {
- this->Create(parent, id, label, pos, size, style, validator, name);
- }
+// RevertButton() {}
+// RevertButton(wxWindow* parent, wxWindowID id, const wxString& label = wxEmptyString,
+// const wxPoint& pos = wxDefaultPosition,
+// const wxSize& size = wxDefaultSize, long style = 0,
+// const wxValidator& validator = wxDefaultValidator,
+// const wxString& name = wxTextCtrlNameStr)
+// {
+// this->Create(parent, id, label, pos, size, style, validator, name);
+// }
+ RevertButton(
+ wxWindow *parent,
+ const std::string& icon_name = ""
+ ) :
+ ScalableButton(parent, wxID_ANY, icon_name) {}
// overridden from wxWindow base class
virtual bool
@@ -154,19 +160,19 @@ public:
return std::move(p); //!p;
}
- bool set_undo_bitmap(const wxBitmap *bmp) {
+ bool set_undo_bitmap(const ScalableBitmap *bmp) {
if (m_undo_bitmap != bmp) {
m_undo_bitmap = bmp;
- m_Undo_btn->SetBitmap(*bmp);
+ m_Undo_btn->SetBitmap_(*bmp);
return true;
}
return false;
}
- bool set_undo_to_sys_bitmap(const wxBitmap *bmp) {
+ bool set_undo_to_sys_bitmap(const ScalableBitmap *bmp) {
if (m_undo_to_sys_bitmap != bmp) {
m_undo_to_sys_bitmap = bmp;
- m_Undo_to_sys_btn->SetBitmap(*bmp);
+ m_Undo_to_sys_btn->SetBitmap_(*bmp);
return true;
}
return false;
@@ -211,15 +217,23 @@ public:
m_side_text = side_text;
}
+ virtual void msw_rescale() {
+ m_Undo_to_sys_btn->msw_rescale();
+ m_Undo_btn->msw_rescale();
+
+ // update em_unit value
+ m_em_unit = em_unit(m_parent);
+ }
+
protected:
- MyButton* m_Undo_btn = nullptr;
+ RevertButton* m_Undo_btn = nullptr;
// Bitmap and Tooltip text for m_Undo_btn. The wxButton will be updated only if the new wxBitmap pointer differs from the currently rendered one.
- const wxBitmap* m_undo_bitmap = nullptr;
- const wxString* m_undo_tooltip = nullptr;
- MyButton* m_Undo_to_sys_btn = nullptr;
+ const ScalableBitmap* m_undo_bitmap = nullptr;
+ const wxString* m_undo_tooltip = nullptr;
+ RevertButton* m_Undo_to_sys_btn = nullptr;
// Bitmap and Tooltip text for m_Undo_to_sys_btn. The wxButton will be updated only if the new wxBitmap pointer differs from the currently rendered one.
- const wxBitmap* m_undo_to_sys_bitmap = nullptr;
- const wxString* m_undo_to_sys_tooltip = nullptr;
+ const ScalableBitmap* m_undo_to_sys_bitmap = nullptr;
+ const wxString* m_undo_to_sys_tooltip = nullptr;
wxStaticText* m_Label = nullptr;
// Color for Label. The wxColour will be updated only if the new wxColour pointer differs from the currently rendered one.
@@ -230,6 +244,8 @@ protected:
// current value
boost::any m_value;
+ int m_em_unit;
+
bool bEnterPressed = false;
friend class OptionsGroup;
@@ -273,6 +289,8 @@ public:
}
boost::any& get_value() override;
+
+ void msw_rescale() override;
virtual void enable();
virtual void disable();
@@ -337,6 +355,8 @@ public:
return m_value = tmp_value;
}
+ void msw_rescale() override;
+
void enable() override { dynamic_cast(window)->Enable(); }
void disable() override { dynamic_cast(window)->Disable(); }
wxWindow* getWindow() override { return window; }
@@ -344,6 +364,7 @@ public:
class Choice : public Field {
using Field::Field;
+ int m_width{ 15 };
public:
Choice(const ConfigOptionDef& opt, const t_config_option_key& id) : Field(opt, id) {}
Choice(wxWindow* parent, const ConfigOptionDef& opt, const t_config_option_key& id) : Field(parent, opt, id) {}
@@ -363,6 +384,8 @@ public:
void set_values(const std::vector &values);
boost::any& get_value() override;
+ void msw_rescale() override;
+
void enable() override { dynamic_cast(window)->Enable(); };
void disable() override{ dynamic_cast(window)->Disable(); };
wxWindow* getWindow() override { return window; }
@@ -414,6 +437,8 @@ public:
void set_value(const boost::any& value, bool change_event = false);
boost::any& get_value() override;
+ void msw_rescale() override;
+
void enable() override {
x_textctrl->Enable();
y_textctrl->Enable(); }
@@ -446,6 +471,8 @@ public:
boost::any& get_value()override { return m_value; }
+ void msw_rescale() override;
+
void enable() override { dynamic_cast(window)->Enable(); };
void disable() override{ dynamic_cast(window)->Disable(); };
wxWindow* getWindow() override { return window; }
diff --git a/src/slic3r/GUI/FirmwareDialog.cpp b/src/slic3r/GUI/FirmwareDialog.cpp
index 8095a3237..4fdc57679 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 ad048bf5d..a1eac00de 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/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp
index d06fe3cfd..340b0ea9a 100644
--- a/src/slic3r/GUI/GLCanvas3D.cpp
+++ b/src/slic3r/GUI/GLCanvas3D.cpp
@@ -706,6 +706,7 @@ void GLCanvas3D::WarningTexture::activate(WarningTexture::Warning warning, bool
m_warnings.erase(it);
if (m_warnings.empty()) { // nothing remains to be shown
reset();
+ m_msg_text = "";// save information for rescaling
return;
}
}
@@ -726,6 +727,10 @@ void GLCanvas3D::WarningTexture::activate(WarningTexture::Warning warning, bool
}
_generate(text, canvas, red_colored); // GUI::GLTexture::reset() is called at the beginning of generate(...)
+
+ // save information for rescaling
+ m_msg_text = text;
+ m_is_colored_red = red_colored;
}
@@ -794,7 +799,9 @@ bool GLCanvas3D::WarningTexture::_generate(const std::string& msg_utf8, const GL
wxMemoryDC memDC;
// select default font
const float scale = canvas.get_canvas_size().get_scale_factor();
- wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).Scale(scale);
+// wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).Scale(scale);
+ wxFont font = wxGetApp().normal_font();//! #ys_FIXME_experiment
+
font.MakeLarger();
font.MakeBold();
memDC.SetFont(font);
@@ -895,6 +902,14 @@ void GLCanvas3D::WarningTexture::render(const GLCanvas3D& canvas) const
}
}
+void GLCanvas3D::WarningTexture::rescale(const GLCanvas3D& canvas)
+{
+ if (m_msg_text.empty())
+ return;
+
+ _generate(m_msg_text, canvas, m_is_colored_red);
+}
+
const unsigned char GLCanvas3D::LegendTexture::Squares_Border_Color[3] = { 64, 64, 64 };
const unsigned char GLCanvas3D::LegendTexture::Default_Background_Color[3] = { (unsigned char)(DEFAULT_BG_LIGHT_COLOR[0] * 255.0f), (unsigned char)(DEFAULT_BG_LIGHT_COLOR[1] * 255.0f), (unsigned char)(DEFAULT_BG_LIGHT_COLOR[2] * 255.0f) };
const unsigned char GLCanvas3D::LegendTexture::Error_Background_Color[3] = { (unsigned char)(ERROR_BG_LIGHT_COLOR[0] * 255.0f), (unsigned char)(ERROR_BG_LIGHT_COLOR[1] * 255.0f), (unsigned char)(ERROR_BG_LIGHT_COLOR[2] * 255.0f) };
@@ -965,7 +980,8 @@ bool GLCanvas3D::LegendTexture::generate(const GCodePreviewData& preview_data, c
const int scaled_border = Px_Border * scale;
// select default font
- wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).Scale(scale_gl);
+// wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).Scale(scale_gl);
+ wxFont font = wxGetApp().normal_font();//! #ys_FIXME_experiment
#ifdef __WXMSW__
// Disabling ClearType works, but the font returned is very different (much thicker) from the default.
// msw_disable_cleartype(font);
@@ -3285,6 +3301,11 @@ void GLCanvas3D::set_cursor(ECursorType type)
}
}
+void GLCanvas3D::msw_rescale()
+{
+ m_warning_texture.rescale(*this);
+}
+
bool GLCanvas3D::_is_shown_on_screen() const
{
return (m_canvas != nullptr) ? m_canvas->IsShownOnScreen() : false;
@@ -4009,7 +4030,8 @@ void GLCanvas3D::_render_gizmos_overlay() const
#if ENABLE_RETINA_GL
m_gizmos.set_overlay_scale(m_retina_helper->get_scale_factor());
#else
- m_gizmos.set_overlay_scale(m_canvas->GetContentScaleFactor());
+// m_gizmos.set_overlay_scale(m_canvas->GetContentScaleFactor());
+ m_gizmos.set_overlay_scale(wxGetApp().em_unit()*0.1f);//! #ys_FIXME_experiment
#endif /* __WXMSW__ */
m_gizmos.render_overlay(*this, m_selection);
@@ -4021,7 +4043,8 @@ void GLCanvas3D::_render_toolbar() const
#if ENABLE_RETINA_GL
m_toolbar.set_scale(m_retina_helper->get_scale_factor());
#else
- m_toolbar.set_scale(m_canvas->GetContentScaleFactor());
+// m_toolbar.set_scale(m_canvas->GetContentScaleFactor());
+ m_toolbar.set_scale(wxGetApp().em_unit()*0.1f);//! #ys_FIXME_experiment
#endif // ENABLE_RETINA_GL
Size cnv_size = get_canvas_size();
@@ -4084,7 +4107,8 @@ void GLCanvas3D::_render_view_toolbar() const
#if ENABLE_RETINA_GL
m_view_toolbar.set_scale(m_retina_helper->get_scale_factor());
#else
- m_view_toolbar.set_scale(m_canvas->GetContentScaleFactor());
+// m_view_toolbar.set_scale(m_canvas->GetContentScaleFactor());
+ m_view_toolbar.set_scale(wxGetApp().em_unit()*0.1f); //! #ys_FIXME_experiment
#endif // ENABLE_RETINA_GL
Size cnv_size = get_canvas_size();
diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp
index 1f139a2b1..e29b78f8d 100644
--- a/src/slic3r/GUI/GLCanvas3D.hpp
+++ b/src/slic3r/GUI/GLCanvas3D.hpp
@@ -352,6 +352,9 @@ class GLCanvas3D
void activate(WarningTexture::Warning warning, bool state, const GLCanvas3D& canvas);
void render(const GLCanvas3D& canvas) const;
+ // function used to get an information for rescaling of the warning
+ void rescale(const GLCanvas3D& canvas);
+
private:
static const unsigned char Background_Color[3];
static const unsigned char Opacity;
@@ -359,6 +362,10 @@ class GLCanvas3D
int m_original_width;
int m_original_height;
+ // information for rescaling of the warning legend
+ std::string m_msg_text = "";
+ bool m_is_colored_red{false};
+
// Information about which warnings are currently active.
std::vector m_warnings;
@@ -612,6 +619,7 @@ public:
double get_size_proportional_to_max_bed_size(double factor) const;
void set_cursor(ECursorType type);
+ void msw_rescale();
private:
bool _is_shown_on_screen() const;
diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp
index 62b8581be..154b4475f 100644
--- a/src/slic3r/GUI/GUI_App.cpp
+++ b/src/slic3r/GUI/GUI_App.cpp
@@ -325,6 +325,17 @@ void GUI_App::init_fonts()
#endif /*__WXMAC__*/
}
+void GUI_App::update_fonts()
+{
+ /* Only normal and bold fonts are used for an application rescale,
+ * because of under MSW small and normal fonts are the same.
+ * To avoid same rescaling twice, just fill this values
+ * from rescaled MainFrame
+ */
+ m_normal_font = mainframe->normal_font();
+ m_bold_font = mainframe->normal_font().Bold();
+}
+
void GUI_App::set_label_clr_modified(const wxColour& clr) {
m_color_label_modified = clr;
auto clr_str = wxString::Format(wxT("#%02X%02X%02X"), clr.Red(), clr.Green(), clr.Blue());
@@ -669,6 +680,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(
@@ -718,7 +735,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_App.hpp b/src/slic3r/GUI/GUI_App.hpp
index 3537f98e4..d3c9e0afa 100644
--- a/src/slic3r/GUI/GUI_App.hpp
+++ b/src/slic3r/GUI/GUI_App.hpp
@@ -98,6 +98,7 @@ public:
void init_label_colours();
void update_label_colours_from_appconfig();
void init_fonts();
+ void update_fonts();
void set_label_clr_modified(const wxColour& clr);
void set_label_clr_sys(const wxColour& clr);
diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp
index f8ad8b7bb..f9df2649c 100644
--- a/src/slic3r/GUI/GUI_ObjectList.cpp
+++ b/src/slic3r/GUI/GUI_ObjectList.cpp
@@ -163,7 +163,7 @@ void ObjectList::create_objects_ctrl()
m_sizer = new wxBoxSizer(wxVERTICAL);
m_sizer->Add(this, 1, wxGROW);
- m_objects_model = new PrusaObjectDataViewModel;
+ m_objects_model = new ObjectDataViewModel;
AssociateModel(m_objects_model);
m_objects_model->SetAssociatedControl(this);
#if wxUSE_DRAG_AND_DROP && wxUSE_UNICODE
@@ -173,7 +173,7 @@ void ObjectList::create_objects_ctrl()
// column 0(Icon+Text) of the view control:
// And Icon can be consisting of several bitmaps
- AppendColumn(new wxDataViewColumn(_(L("Name")), new PrusaBitmapTextRenderer(),
+ AppendColumn(new wxDataViewColumn(_(L("Name")), new BitmapTextRenderer(),
0, 20*wxGetApp().em_unit()/*200*/, wxALIGN_LEFT, wxDATAVIEW_COL_RESIZABLE));
// column 1 of the view control:
@@ -203,7 +203,7 @@ void ObjectList::set_tooltip_for_item(const wxPoint& pt)
if (col->GetTitle() == " " && GetSelectedItemsCount()<2)
GetMainWindow()->SetToolTip(_(L("Right button click the icon to change the object settings")));
else if (col->GetTitle() == _("Name") &&
- m_objects_model->GetBitmap(item).GetRefData() == m_bmp_manifold_warning.GetRefData()) {
+ m_objects_model->GetBitmap(item).GetRefData() == m_bmp_manifold_warning.bmp().GetRefData()) {
int obj_idx = m_objects_model->GetIdByItem(item);
auto& stats = (*m_objects)[obj_idx]->volumes[0]->mesh.stl.stats;
int errors = stats.degenerate_facets + stats.edges_fixed + stats.facets_removed +
@@ -395,27 +395,71 @@ void ObjectList::update_name_in_model(const wxDataViewItem& item) const
void ObjectList::init_icons()
{
- m_bmp_modifiermesh = create_scaled_bitmap(nullptr, "add_modifier");
- m_bmp_solidmesh = create_scaled_bitmap(nullptr, "add_part");
- m_bmp_support_enforcer = create_scaled_bitmap(nullptr, "support_enforcer");
- m_bmp_support_blocker = create_scaled_bitmap(nullptr, "support_blocker");
-
+ m_bmp_modifiermesh = ScalableBitmap(nullptr, "add_modifier"); // Add part
+ m_bmp_solidmesh = ScalableBitmap(nullptr, "add_part"); // Add modifier
+ m_bmp_support_enforcer = ScalableBitmap(nullptr, "support_enforcer");// Add support enforcer
+ m_bmp_support_blocker = ScalableBitmap(nullptr, "support_blocker"); // Add support blocker
m_bmp_vector.reserve(4); // bitmaps for different types of parts
- m_bmp_vector.push_back(&m_bmp_solidmesh); // Add part
- m_bmp_vector.push_back(&m_bmp_modifiermesh); // Add modifier
- m_bmp_vector.push_back(&m_bmp_support_enforcer); // Add support enforcer
- m_bmp_vector.push_back(&m_bmp_support_blocker); // Add support blocker
+ m_bmp_vector.push_back(&m_bmp_solidmesh.bmp());
+ m_bmp_vector.push_back(&m_bmp_modifiermesh.bmp());
+ m_bmp_vector.push_back(&m_bmp_support_enforcer.bmp());
+ m_bmp_vector.push_back(&m_bmp_support_blocker.bmp());
+
+
+ // Set volumes default bitmaps for the model
m_objects_model->SetVolumeBitmaps(m_bmp_vector);
// init icon for manifold warning
- m_bmp_manifold_warning = create_scaled_bitmap(nullptr, "exclamation");
+ m_bmp_manifold_warning = ScalableBitmap(nullptr, "exclamation");
// init bitmap for "Split to sub-objects" context menu
- m_bmp_split = create_scaled_bitmap(nullptr, "split_parts_SMALL");
+ m_bmp_split = ScalableBitmap(nullptr, "split_parts_SMALL");
// init bitmap for "Add Settings" context menu
- m_bmp_cog = create_scaled_bitmap(nullptr, "cog");
+ m_bmp_cog = ScalableBitmap(nullptr, "cog");
+}
+
+void ObjectList::rescale_icons()
+{
+ m_bmp_vector.clear();
+ m_bmp_vector.reserve(4); // bitmaps for different types of parts
+ for (ScalableBitmap* bitmap : std::vector {
+ &m_bmp_modifiermesh, // Add part
+ &m_bmp_solidmesh, // Add modifier
+ &m_bmp_support_enforcer, // Add support enforcer
+ &m_bmp_support_blocker }) // Add support blocker
+ {
+ bitmap->msw_rescale();
+ m_bmp_vector.push_back(& bitmap->bmp());
+ }
+ // Set volumes default bitmaps for the model
+ m_objects_model->SetVolumeBitmaps(m_bmp_vector);
+
+ m_bmp_manifold_warning.msw_rescale();
+ m_bmp_split.msw_rescale();
+ m_bmp_cog.msw_rescale();
+
+
+ // Update CATEGORY_ICON according to new scale
+ {
+ // Note: `this` isn't passed to create_scaled_bitmap() here because of bugs in the widget,
+ // see note in PresetBundle::load_compatible_bitmaps()
+
+ // ptFFF
+ CATEGORY_ICON[L("Layers and Perimeters")] = create_scaled_bitmap(nullptr, "layers");
+ CATEGORY_ICON[L("Infill")] = create_scaled_bitmap(nullptr, "infill");
+ CATEGORY_ICON[L("Support material")] = create_scaled_bitmap(nullptr, "support");
+ CATEGORY_ICON[L("Speed")] = create_scaled_bitmap(nullptr, "time");
+ CATEGORY_ICON[L("Extruders")] = create_scaled_bitmap(nullptr, "funnel");
+ CATEGORY_ICON[L("Extrusion Width")] = create_scaled_bitmap(nullptr, "funnel");
+// CATEGORY_ICON[L("Skirt and brim")] = create_scaled_bitmap(nullptr, "skirt+brim");
+// CATEGORY_ICON[L("Speed > Acceleration")] = create_scaled_bitmap(nullptr, "time");
+ CATEGORY_ICON[L("Advanced")] = create_scaled_bitmap(nullptr, "wrench");
+ // ptSLA
+ CATEGORY_ICON[L("Supports")] = create_scaled_bitmap(nullptr, "support"/*"sla_supports"*/);
+ CATEGORY_ICON[L("Pad")] = create_scaled_bitmap(nullptr, "pad");
+ }
}
@@ -463,8 +507,7 @@ void ObjectList::paste_volumes_into_list(int obj_idx, const ModelVolumePtrs& vol
items.Add(vol_item);
}
- m_parts_changed = true;
- parts_changed(obj_idx);
+ changed_object(obj_idx);
if (items.size() > 1)
{
@@ -490,9 +533,7 @@ void ObjectList::paste_objects_into_list(const std::vector& object_idxs)
items.Add(m_objects_model->GetItemById(object));
}
- m_parts_changed = true;
wxGetApp().plater()->changed_objects(object_idxs);
- m_parts_changed = false;
select_items(items);
#ifndef __WXOSX__ //#ifdef __WXMSW__ // #ys_FIXME
@@ -534,7 +575,7 @@ void ObjectList::OnContextMenu(wxDataViewEvent&)
if (title == " ")
show_context_menu();
else if (title == _("Name") && pt.x >15 &&
- m_objects_model->GetBitmap(item).GetRefData() == m_bmp_manifold_warning.GetRefData())
+ m_objects_model->GetBitmap(item).GetRefData() == m_bmp_manifold_warning.bmp().GetRefData())
{
if (is_windows10())
fix_through_netfabb();
@@ -703,8 +744,7 @@ void ObjectList::OnDrop(wxDataViewEvent &event)
select_item(m_objects_model->ReorganizeChildren(from_volume_id, to_volume_id,
m_objects_model->GetParent(item)));
- m_parts_changed = true;
- parts_changed(m_dragged_data.obj_idx());
+ changed_object(m_dragged_data.obj_idx());
m_dragged_data.clear();
}
@@ -1000,12 +1040,12 @@ void ObjectList::append_menu_items_add_volume(wxMenu* menu)
wxMenuItem* ObjectList::append_menu_item_split(wxMenu* menu)
{
return append_menu_item(menu, wxID_ANY, _(L("Split to parts")), "",
- [this](wxCommandEvent&) { split(); }, m_bmp_split, menu);
+ [this](wxCommandEvent&) { split(); }, m_bmp_split.bmp(), menu);
}
wxMenuItem* ObjectList::append_menu_item_settings(wxMenu* menu_)
{
- PrusaMenu* menu = dynamic_cast(menu_);
+ MenuWithSeparators* menu = dynamic_cast(menu_);
const wxString menu_name = _(L("Add settings"));
// Delete old items from settings popupmenu
@@ -1053,7 +1093,7 @@ wxMenuItem* ObjectList::append_menu_item_settings(wxMenu* menu_)
if (printer_technology() == ptFFF ||
menu->GetMenuItems().size() > 0 && !menu->GetMenuItems().back()->IsSeparator())
- menu->m_separator_frst = menu->AppendSeparator();
+ menu->SetFirstSeparator();
// Add frequently settings
create_freq_settings_popupmenu(menu);
@@ -1061,11 +1101,11 @@ wxMenuItem* ObjectList::append_menu_item_settings(wxMenu* menu_)
if (mode == comAdvanced)
return nullptr;
- menu->m_separator_scnd = menu->AppendSeparator();
+ menu->SetSecondSeparator();
// Add full settings list
auto menu_item = new wxMenuItem(menu, wxID_ANY, menu_name);
- menu_item->SetBitmap(m_bmp_cog);
+ menu_item->SetBitmap(m_bmp_cog.bmp());
menu_item->SetSubMenu(create_settings_popupmenu(menu));
@@ -1290,7 +1330,7 @@ void ObjectList::load_subobject(ModelVolumeType type)
wxArrayString part_names;
load_part((*m_objects)[obj_idx], part_names, type);
- parts_changed(obj_idx);
+ changed_object(obj_idx);
for (int i = 0; i < part_names.size(); ++i) {
const wxDataViewItem sel_item = m_objects_model->AddVolumeChild(item, part_names.Item(i), type);
@@ -1306,7 +1346,6 @@ void ObjectList::load_part( ModelObject* model_object,
{
wxWindow* parent = wxGetApp().tab_panel()->GetPage(0);
- m_parts_changed = false;
wxArrayString input_files;
wxGetApp().import_model(parent, input_files);
for (int i = 0; i < input_files.size(); ++i) {
@@ -1342,8 +1381,6 @@ void ObjectList::load_part( ModelObject* model_object,
// set a default extruder value, since user can't add it manually
new_volume->config.set_key_value("extruder", new ConfigOptionInt(0));
-
- m_parts_changed = true;
}
}
}
@@ -1493,8 +1530,7 @@ void ObjectList::load_generic_subobject(const std::string& type_name, const Mode
// set a default extruder value, since user can't add it manually
new_volume->config.set_key_value("extruder", new ConfigOptionInt(0));
- m_parts_changed = true;
- parts_changed(obj_idx);
+ changed_object(obj_idx);
const auto object_item = m_objects_model->GetTopParent(GetSelection());
select_item(m_objects_model->AddVolumeChild(object_item, name, type));
@@ -1558,8 +1594,7 @@ void ObjectList::del_instances_from_object(const int obj_idx)
(*m_objects)[obj_idx]->invalidate_bounding_box(); // ? #ys_FIXME
- m_parts_changed = true;
- parts_changed(obj_idx);
+ changed_object(obj_idx);
}
bool ObjectList::del_subobject_from_object(const int obj_idx, const int idx, const int type)
@@ -1604,8 +1639,7 @@ bool ObjectList::del_subobject_from_object(const int obj_idx, const int idx, con
else
return false;
- m_parts_changed = true;
- parts_changed(obj_idx);
+ changed_object(obj_idx);
return true;
}
@@ -1655,8 +1689,7 @@ void ObjectList::split()
if (parent == item)
Expand(parent);
- m_parts_changed = true;
- parts_changed(obj_idx);
+ changed_object(obj_idx);
}
bool ObjectList::get_volume_by_item(const wxDataViewItem& item, ModelVolume*& volume)
@@ -1713,17 +1746,10 @@ bool ObjectList::can_split_instances()
return selection.is_multiple_full_instance() || selection.is_single_full_instance();
}
-void ObjectList::part_settings_changed()
+// NO_PARAMETERS function call means that changed object index will be determine from Selection()
+void ObjectList::changed_object(const int obj_idx/* = -1*/) const
{
- m_part_settings_changed = true;
- wxGetApp().plater()->changed_object(get_selected_obj_idx());
- m_part_settings_changed = false;
-}
-
-void ObjectList::parts_changed(int obj_idx)
-{
- wxGetApp().plater()->changed_object(obj_idx);
- m_parts_changed = false;
+ wxGetApp().plater()->changed_object(obj_idx < 0 ? get_selected_obj_idx() : obj_idx);
}
void ObjectList::part_selection_changed()
@@ -1826,7 +1852,7 @@ void ObjectList::add_object_to_list(size_t obj_idx)
stats.facets_added + stats.facets_reversed + stats.backwards_edges;
if (errors > 0) {
wxVariant variant;
- variant << PrusaDataViewBitmapText(item_name, m_bmp_manifold_warning);
+ variant << DataViewBitmapText(item_name, m_bmp_manifold_warning.bmp());
m_objects_model->SetValue(variant, item, 0);
}
@@ -2446,8 +2472,7 @@ void ObjectList::change_part_type()
volume->set_type(new_type);
m_objects_model->SetVolumeType(item, new_type);
- m_parts_changed = true;
- parts_changed(get_selected_obj_idx());
+ changed_object(get_selected_obj_idx());
// Update settings showing, if we have it
//(we show additional settings for Part and Modifier and hide it for Support Blocker/Enforcer)
@@ -2627,7 +2652,7 @@ void ObjectList::rename_item()
wxVariant valueOld;
m_objects_model->GetValue(valueOld, item, 0);
- PrusaDataViewBitmapText bmpText;
+ DataViewBitmapText bmpText;
bmpText << valueOld;
// But replace the text with the value entered by user.
@@ -2675,11 +2700,29 @@ void ObjectList::update_item_error_icon(const int obj_idx, const int vol_idx) co
if (errors == 0) {
// delete Error_icon if all errors are fixed
wxVariant variant;
- variant << PrusaDataViewBitmapText(from_u8(model_object->name), wxNullBitmap);
+ variant << DataViewBitmapText(from_u8(model_object->name), wxNullBitmap);
m_objects_model->SetValue(variant, item, 0);
}
}
+void ObjectList::msw_rescale()
+{
+ // update min size !!! A width of control shouldn't be a wxDefaultCoord
+ SetMinSize(wxSize(1, 15 * wxGetApp().em_unit()));
+
+ GetColumn(0)->SetWidth(19 * wxGetApp().em_unit());
+ GetColumn(1)->SetWidth(8 * wxGetApp().em_unit());
+ GetColumn(2)->SetWidth(int(2 * wxGetApp().em_unit()));
+
+ // rescale all icons, used by ObjectList
+ rescale_icons();
+
+ // rescale/update existingitems with bitmaps
+ m_objects_model->Rescale();
+
+ Layout();
+}
+
void ObjectList::ItemValueChanged(wxDataViewEvent &event)
{
if (event.GetColumn() == 0)
@@ -2693,7 +2736,7 @@ void ObjectList::OnEditingDone(wxDataViewEvent &event)
if (event.GetColumn() != 0)
return;
- const auto renderer = dynamic_cast(GetColumn(0)->GetRenderer());
+ const auto renderer = dynamic_cast(GetColumn(0)->GetRenderer());
if (renderer->WasCanceled())
show_error(this, _(L("The supplied name is not valid;")) + "\n" +
diff --git a/src/slic3r/GUI/GUI_ObjectList.hpp b/src/slic3r/GUI/GUI_ObjectList.hpp
index a0343100a..da082d1d4 100644
--- a/src/slic3r/GUI/GUI_ObjectList.hpp
+++ b/src/slic3r/GUI/GUI_ObjectList.hpp
@@ -13,8 +13,8 @@
class wxBoxSizer;
class wxMenuItem;
-class PrusaObjectDataViewModel;
-class PrusaMenu;
+class ObjectDataViewModel;
+class MenuWithSeparators;
namespace Slic3r {
class ConfigOptionsGroup;
@@ -108,18 +108,18 @@ class ObjectList : public wxDataViewCtrl
wxBoxSizer *m_sizer {nullptr};
wxWindow *m_parent {nullptr};
- wxBitmap m_bmp_modifiermesh;
- wxBitmap m_bmp_solidmesh;
- wxBitmap m_bmp_support_enforcer;
- wxBitmap m_bmp_support_blocker;
- wxBitmap m_bmp_manifold_warning;
- wxBitmap m_bmp_cog;
- wxBitmap m_bmp_split;
+ ScalableBitmap m_bmp_modifiermesh;
+ ScalableBitmap m_bmp_solidmesh;
+ ScalableBitmap m_bmp_support_enforcer;
+ ScalableBitmap m_bmp_support_blocker;
+ ScalableBitmap m_bmp_manifold_warning;
+ ScalableBitmap m_bmp_cog;
+ ScalableBitmap m_bmp_split;
- PrusaMenu m_menu_object;
- PrusaMenu m_menu_part;
- PrusaMenu m_menu_sla_object;
- PrusaMenu m_menu_instance;
+ MenuWithSeparators m_menu_object;
+ MenuWithSeparators m_menu_part;
+ MenuWithSeparators m_menu_sla_object;
+ MenuWithSeparators m_menu_instance;
wxMenuItem* m_menu_item_split { nullptr };
wxMenuItem* m_menu_item_split_part { nullptr };
wxMenuItem* m_menu_item_settings { nullptr };
@@ -139,9 +139,6 @@ class ObjectList : public wxDataViewCtrl
// update_settings_items - updating canvas selection is undesirable,
// because it would turn off the gizmos (mainly a problem for the SLA gizmo)
- bool m_parts_changed = false;
- bool m_part_settings_changed = false;
-
int m_selected_row = 0;
wxDataViewItem m_last_selected_item {nullptr};
@@ -157,7 +154,7 @@ public:
std::map CATEGORY_ICON;
- PrusaObjectDataViewModel *m_objects_model{ nullptr };
+ ObjectDataViewModel *m_objects_model{ nullptr };
DynamicPrintConfig *m_config {nullptr};
std::vector *m_objects{ nullptr };
@@ -176,6 +173,7 @@ public:
void update_extruder_values_for_items(const int max_extruder);
void init_icons();
+ void rescale_icons();
void set_tooltip_for_item(const wxPoint& pt);
@@ -225,11 +223,8 @@ public:
wxBoxSizer* get_sizer() {return m_sizer;}
int get_selected_obj_idx() const;
DynamicPrintConfig& get_item_config(const wxDataViewItem& item) const;
- bool is_parts_changed() const { return m_parts_changed; }
- bool is_part_settings_changed() const { return m_part_settings_changed; }
- void part_settings_changed();
- void parts_changed(int obj_idx);
+ void changed_object(const int obj_idx = -1) const;
void part_selection_changed();
// Add object to the list
@@ -291,6 +286,8 @@ public:
void paste_volumes_into_list(int obj_idx, const ModelVolumePtrs& volumes);
void paste_objects_into_list(const std::vector& object_idxs);
+ void msw_rescale();
+
private:
void OnChar(wxKeyEvent& event);
void OnContextMenu(wxDataViewEvent &event);
diff --git a/src/slic3r/GUI/GUI_ObjectManipulation.cpp b/src/slic3r/GUI/GUI_ObjectManipulation.cpp
index f9284a19b..53f1923fd 100644
--- a/src/slic3r/GUI/GUI_ObjectManipulation.cpp
+++ b/src/slic3r/GUI/GUI_ObjectManipulation.cpp
@@ -23,7 +23,7 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent) :
#endif // __APPLE__
{
m_og->set_name(_(L("Object Manipulation")));
- m_og->label_width = 12 * wxGetApp().em_unit();//125;
+ m_og->label_width = 12;//125;
m_og->set_grid_vgap(5);
m_og->m_on_change = std::bind(&ObjectManipulation::on_change, this, std::placeholders::_1, std::placeholders::_2);
@@ -45,11 +45,11 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent) :
def.label = L("Name");
def.gui_type = "legend";
def.tooltip = L("Object name");
- def.width = 21 * wxGetApp().em_unit();
+ def.width = 21;
def.default_value = new ConfigOptionString{ " " };
m_og->append_single_option_line(Option(def, "object_name"));
- const int field_width = 5 * wxGetApp().em_unit()/*50*/;
+ const int field_width = 5;
// Legend for object modification
auto line = Line{ "", "" };
@@ -78,7 +78,7 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent) :
// Add "uniform scaling" button in front of "Scale" option
if (option_name == "Scale") {
line.near_label_widget = [this](wxWindow* parent) {
- auto btn = new PrusaLockButton(parent, wxID_ANY);
+ auto btn = new LockButton(parent, wxID_ANY);
btn->Bind(wxEVT_BUTTON, [btn, this](wxCommandEvent &event){
event.Skip();
wxTheApp->CallAfter([btn, this]() { set_uniform_scaling(btn->IsLocked()); });
@@ -117,15 +117,13 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent) :
m_og->append_line(add_og_to_object_settings(L("Scale"), "%"), &m_scale_Label);
m_og->append_line(add_og_to_object_settings(L("Size"), "mm"));
- /* Unused parameter at this time
- def.label = L("Place on bed");
- def.type = coBool;
- def.tooltip = L("Automatic placing of models on printing bed in Y axis");
- def.gui_type = "";
- def.sidetext = "";
- def.default_value = new ConfigOptionBool{ false };
- m_og->append_single_option_line(Option(def, "place_on_bed"));
- */
+ // call back for a rescale of button "Set uniform scale"
+ m_og->rescale_near_label_widget = [this](wxWindow* win) {
+ auto *ctrl = dynamic_cast(win);
+ if (ctrl == nullptr)
+ return;
+ ctrl->msw_rescale();
+ };
}
void ObjectManipulation::Show(const bool show)
diff --git a/src/slic3r/GUI/GUI_ObjectManipulation.hpp b/src/slic3r/GUI/GUI_ObjectManipulation.hpp
index a5a180a56..d7b45e3c8 100644
--- a/src/slic3r/GUI/GUI_ObjectManipulation.hpp
+++ b/src/slic3r/GUI/GUI_ObjectManipulation.hpp
@@ -7,7 +7,7 @@
#include "GLCanvas3D.hpp"
class wxStaticText;
-class PrusaLockButton;
+class LockButton;
namespace Slic3r {
namespace GUI {
@@ -76,7 +76,7 @@ class ObjectManipulation : public OG_Settings
Vec3d m_new_size;
bool m_new_enabled;
bool m_uniform_scale {true};
- PrusaLockButton* m_lock_bnt{ nullptr };
+ LockButton* m_lock_bnt{ nullptr };
#ifndef __APPLE__
// Currently focused option name (empty if none)
diff --git a/src/slic3r/GUI/GUI_ObjectSettings.cpp b/src/slic3r/GUI/GUI_ObjectSettings.cpp
index 72eeb76de..b7ba2d4fc 100644
--- a/src/slic3r/GUI/GUI_ObjectSettings.cpp
+++ b/src/slic3r/GUI/GUI_ObjectSettings.cpp
@@ -59,6 +59,8 @@ ObjectSettings::ObjectSettings(wxWindow* parent) :
m_settings_list_sizer = new wxBoxSizer(wxVERTICAL);
m_og->sizer->Add(m_settings_list_sizer, 1, wxEXPAND | wxLEFT, 5);
+
+ m_bmp_delete = ScalableBitmap(parent, "cross");
}
void ObjectSettings::update_settings_list()
@@ -77,14 +79,11 @@ void ObjectSettings::update_settings_list()
{
auto opt_key = (line.get_options())[0].opt_id; //we assume that we have one option per line
- auto btn = new wxBitmapButton(parent, wxID_ANY, create_scaled_bitmap(m_parent, "cross"/*"colorchange_delete_on.png"*/),
- wxDefaultPosition, wxDefaultSize, wxBORDER_NONE);
-#ifdef __WXMSW__
- btn->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
-#endif // __WXMSW__
+ auto btn = new ScalableButton(parent, wxID_ANY, m_bmp_delete);
+
btn->Bind(wxEVT_BUTTON, [opt_key, config, this](wxEvent &event) {
config->erase(opt_key);
- wxGetApp().obj_list()->part_settings_changed();
+ wxGetApp().obj_list()->changed_object();
wxTheApp->CallAfter([this]() {
wxWindowUpdateLocker noUpdates(m_parent);
update_settings_list();
@@ -123,22 +122,31 @@ void ObjectSettings::update_settings_list()
continue;
auto optgroup = std::make_shared(m_og->ctrl_parent(), cat.first, config, false, extra_column);
- optgroup->label_width = 15 * wxGetApp().em_unit();
- optgroup->sidetext_width = 5.5 * wxGetApp().em_unit();
+ optgroup->label_width = 15;
+ optgroup->sidetext_width = 5.5;
optgroup->m_on_change = [](const t_config_option_key& opt_id, const boost::any& value) {
- wxGetApp().obj_list()->part_settings_changed(); };
+ wxGetApp().obj_list()->changed_object(); };
for (auto& opt : cat.second)
{
if (opt == "extruder")
continue;
Option option = optgroup->get_option(opt);
- option.opt.width = 12 * wxGetApp().em_unit();
+ option.opt.width = 12;
optgroup->append_single_option_line(option);
}
optgroup->reload_config();
m_settings_list_sizer->Add(optgroup->sizer, 0, wxEXPAND | wxALL, 0);
+
+ // call back for rescaling of the extracolumn control
+ optgroup->rescale_extra_column_item = [this](wxWindow* win) {
+ auto *ctrl = dynamic_cast(win);
+ if (ctrl == nullptr)
+ return;
+ ctrl->SetBitmap_(m_bmp_delete);
+ };
+
m_og_settings.push_back(optgroup);
categories.push_back(cat.first);
@@ -163,5 +171,13 @@ void ObjectSettings::UpdateAndShow(const bool show)
OG_Settings::UpdateAndShow(show);
}
+void ObjectSettings::msw_rescale()
+{
+ m_bmp_delete.msw_rescale();
+
+ for (auto group : m_og_settings)
+ group->msw_rescale();
+}
+
} //namespace GUI
} //namespace Slic3r
\ No newline at end of file
diff --git a/src/slic3r/GUI/GUI_ObjectSettings.hpp b/src/slic3r/GUI/GUI_ObjectSettings.hpp
index 12115e208..3d49f13b7 100644
--- a/src/slic3r/GUI/GUI_ObjectSettings.hpp
+++ b/src/slic3r/GUI/GUI_ObjectSettings.hpp
@@ -4,6 +4,7 @@
#include
#include
#include
+#include "wxExtensions.hpp"
class wxBoxSizer;
@@ -37,12 +38,15 @@ class ObjectSettings : public OG_Settings
// option groups for settings
std::vector > m_og_settings;
+ ScalableBitmap m_bmp_delete;
+
public:
ObjectSettings(wxWindow* parent);
~ObjectSettings() {}
void update_settings_list();
void UpdateAndShow(const bool show) override;
+ void msw_rescale();
};
}}
diff --git a/src/slic3r/GUI/GUI_Preview.cpp b/src/slic3r/GUI/GUI_Preview.cpp
index 206253451..88fea933e 100644
--- a/src/slic3r/GUI/GUI_Preview.cpp
+++ b/src/slic3r/GUI/GUI_Preview.cpp
@@ -396,6 +396,18 @@ void Preview::refresh_print()
load_print(true);
}
+void Preview::msw_rescale()
+{
+ // rescale slider
+ if (m_slider) m_slider->msw_rescale();
+
+ // rescale warning legend on the canvas
+ get_canvas3d()->msw_rescale();
+
+ // rescale legend
+ refresh_print();
+}
+
void Preview::bind_event_handlers()
{
this->Bind(wxEVT_SIZE, &Preview::on_size, this);
@@ -507,7 +519,7 @@ void Preview::on_checkbox_shells(wxCommandEvent& evt)
void Preview::create_double_slider()
{
- m_slider = new PrusaDoubleSlider(this, wxID_ANY, 0, 0, 0, 100);
+ m_slider = new DoubleSlider(this, wxID_ANY, 0, 0, 0, 100);
m_double_slider_sizer->Add(m_slider, 0, wxEXPAND, 0);
// sizer, m_canvas_widget
diff --git a/src/slic3r/GUI/GUI_Preview.hpp b/src/slic3r/GUI/GUI_Preview.hpp
index a2929f2e6..2540980f4 100644
--- a/src/slic3r/GUI/GUI_Preview.hpp
+++ b/src/slic3r/GUI/GUI_Preview.hpp
@@ -13,7 +13,7 @@ class wxStaticText;
class wxChoice;
class wxComboCtrl;
class wxCheckBox;
-class PrusaDoubleSlider;
+class DoubleSlider;
namespace Slic3r {
@@ -99,7 +99,7 @@ class Preview : public wxPanel
bool m_loaded;
bool m_enabled;
- PrusaDoubleSlider* m_slider {nullptr};
+ DoubleSlider* m_slider {nullptr};
public:
Preview(wxWindow* parent, Bed3D& bed, Camera& camera, GLToolbar& view_toolbar, Model* model, DynamicPrintConfig* config,
@@ -120,6 +120,8 @@ public:
void reload_print(bool keep_volumes = false);
void refresh_print();
+ void msw_rescale();
+
private:
bool init(wxWindow* parent, Bed3D& bed, Camera& camera, GLToolbar& view_toolbar, Model* model);
diff --git a/src/slic3r/GUI/GUI_Utils.hpp b/src/slic3r/GUI/GUI_Utils.hpp
index e12153625..25cf25b16 100644
--- a/src/slic3r/GUI/GUI_Utils.hpp
+++ b/src/slic3r/GUI/GUI_Utils.hpp
@@ -16,6 +16,7 @@
#include
#include
#include
+#include
class wxCheckBox;
class wxTopLevelWindow;
@@ -58,35 +59,119 @@ 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;
+
recalc_font();
this->Bind(EVT_DPI_CHANGED, [this](const DpiChangedEvent &evt) {
m_scale_factor = (float)evt.dpi / (float)DPI_DEFAULT;
- on_dpi_changed(evt.rect);
+
+ if (!m_can_rescale)
+ return;
+
+ if (is_new_scale_factor())
+ rescale(evt.rect);
+ });
+
+ this->Bind(wxEVT_MOVE_START, [this](wxMoveEvent& event)
+ {
+ event.Skip();
+
+ // Suppress application rescaling, when a MainFrame moving is not ended
+ m_can_rescale = false;
+ });
+
+ this->Bind(wxEVT_MOVE_END, [this](wxMoveEvent& event)
+ {
+ event.Skip();
+
+ m_can_rescale = is_new_scale_factor();
+
+ // If scale factor is different after moving of MainFrame ...
+ if (m_can_rescale)
+ // ... rescale application
+ rescale(event.GetRect());
+ else
+ // set value to _true_ in purpose of possibility of a display dpi changing from System Settings
+ m_can_rescale = true;
});
}
virtual ~DPIAware() {}
- float scale_factor() const { return m_scale_factor; }
- int em_unit() const { return m_em_unit; }
- int font_size() const { return m_font_size; }
+ float scale_factor() const { return m_scale_factor; }
+ float prev_scale_factor() const { return m_prev_scale_factor; }
+
+ 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;
private:
- int m_scale_factor;
+ float m_scale_factor;
int m_em_unit;
int m_font_size;
+ wxFont m_normal_font;
+ float m_prev_scale_factor;
+ bool m_can_rescale{ true };
+
void recalc_font()
{
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
+ bool is_new_scale_factor() const { return fabs(m_scale_factor - m_prev_scale_factor) > 0.001; }
+
+ // recursive function for scaling fonts for all controls in Window
+ void scale_controls_fonts(wxWindow *window, const float scale_f)
+ {
+ auto children = window->GetChildren();
+
+ for (auto child : children) {
+ scale_controls_fonts(child, scale_f);
+ child->SetFont(child->GetFont().Scaled(scale_f));
+ }
+
+ window->Layout();
+ }
+
+ 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, 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);
+
+ this->Layout();
+ this->Thaw();
+
+ // reset previous scale factor from current scale factor value
+ m_prev_scale_factor = m_scale_factor;
+ }
+
};
typedef DPIAware DPIFrame;
diff --git a/src/slic3r/GUI/KBShortcutsDialog.cpp b/src/slic3r/GUI/KBShortcutsDialog.cpp
index 65abba319..7f77474f2 100644
--- a/src/slic3r/GUI/KBShortcutsDialog.cpp
+++ b/src/slic3r/GUI/KBShortcutsDialog.cpp
@@ -10,26 +10,28 @@ namespace Slic3r {
namespace GUI {
KBShortcutsDialog::KBShortcutsDialog()
- : wxDialog(NULL, wxID_ANY, wxString(SLIC3R_APP_NAME) + " - " + _(L("Keyboard Shortcuts")), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
+ : DPIDialog(NULL, wxID_ANY, wxString(SLIC3R_APP_NAME) + " - " + _(L("Keyboard Shortcuts")),
+ wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
{
- SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
+ SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
auto main_sizer = new wxBoxSizer(wxVERTICAL);
// logo
- const wxBitmap logo_bmp = create_scaled_bitmap(this, "Slic3r_32px.png", 32);
+ m_logo_bmp = ScalableBitmap(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;
#ifdef __WXOSX__
head_font.SetPointSize(14);
#else
- head_font.SetPointSize(12);
+ head_font.SetPointSize(bold_font.GetPointSize() + 2);
#endif // __WXOSX__
- const wxFont& font = wxGetApp().small_font();
- const wxFont& bold_font = wxGetApp().bold_font();
-
fill_shortcuts();
auto panel = new wxPanel(this);
@@ -43,22 +45,25 @@ KBShortcutsDialog::KBShortcutsDialog()
wxBoxSizer* r_sizer = new wxBoxSizer(wxVERTICAL);
main_grid_sizer->Add(r_sizer, 0);
+ m_head_bitmaps.reserve(m_full_shortcuts.size());
+ const wxSize topic_size = wxSize(10 * wxGetApp().em_unit(), -1);
+
for (auto& sc : m_full_shortcuts)
{
-// auto sizer = sc.first == _(L("Main Shortcuts")) ? l_sizer : r_sizer;
- auto sizer = sc.second.second == 0 ? l_sizer : r_sizer;
+ auto sizer = sc.second.second == szLeft ? l_sizer : r_sizer;
wxBoxSizer* hsizer = new wxBoxSizer(wxHORIZONTAL);
sizer->Add(hsizer, 0, wxEXPAND | wxTOP | wxBOTTOM, 10);
// logo
- auto *logo = new wxStaticBitmap(panel, wxID_ANY, logo_bmp);
- hsizer->Add(logo, 0, wxEXPAND | wxLEFT | wxRIGHT, 15);
+ m_head_bitmaps.push_back(new wxStaticBitmap(panel, wxID_ANY, m_logo_bmp.bmp()));
+ hsizer->Add(m_head_bitmaps.back(), 0, wxEXPAND | wxLEFT | wxRIGHT, 15);
// head
- wxStaticText* head = new wxStaticText(panel, wxID_ANY, sc.first, wxDefaultPosition, wxSize(20 * wxGetApp().em_unit(), -1));
+ wxStaticText* head = new wxStaticText(panel, wxID_ANY, sc.first, wxDefaultPosition, topic_size);
head->SetFont(head_font);
hsizer->Add(head, 0, wxALIGN_CENTER_VERTICAL);
+
// Shortcuts list
auto grid_sizer = new wxFlexGridSizer(2, 5, 15);
sizer->Add(grid_sizer, 0, wxEXPAND | wxLEFT| wxRIGHT, 15);
@@ -121,7 +126,7 @@ void KBShortcutsDialog::fill_shortcuts()
main_shortcuts.push_back(Shortcut("?" ,L("Show keyboard shortcuts list")));
main_shortcuts.push_back(Shortcut(ctrl+"LeftMouse" ,L("Select multiple object/Move multiple object")));
- m_full_shortcuts.push_back(std::make_pair( _(L("Main Shortcuts")), std::make_pair(main_shortcuts, 0) ));
+ m_full_shortcuts.push_back(std::make_pair(_(L("Main Shortcuts")), std::make_pair(main_shortcuts, szLeft)));
Shortcuts plater_shortcuts;
@@ -148,7 +153,7 @@ void KBShortcutsDialog::fill_shortcuts()
plater_shortcuts.push_back(Shortcut("O", L("Zoom out")));
plater_shortcuts.push_back(Shortcut("ESC", L("Unselect gizmo, keep object selection")));
- m_full_shortcuts.push_back(std::make_pair(_(L("Plater Shortcuts")), std::make_pair(plater_shortcuts, 1)));
+ m_full_shortcuts.push_back(std::make_pair(_(L("Plater Shortcuts")), std::make_pair(plater_shortcuts, szRight)));
// Shortcuts gizmo_shortcuts;
@@ -168,7 +173,7 @@ void KBShortcutsDialog::fill_shortcuts()
preview_shortcuts.push_back(Shortcut("U", L("Upper Layer")));
preview_shortcuts.push_back(Shortcut("D", L("Lower Layer")));
- m_full_shortcuts.push_back(std::make_pair( _(L("Preview Shortcuts")), std::make_pair(preview_shortcuts, 0) ));
+ m_full_shortcuts.push_back(std::make_pair(_(L("Preview Shortcuts")), std::make_pair(preview_shortcuts, szLeft)));
Shortcuts layers_slider_shortcuts;
@@ -181,7 +186,23 @@ void KBShortcutsDialog::fill_shortcuts()
layers_slider_shortcuts.push_back(Shortcut("+", L("Add color change marker for current layer")));
layers_slider_shortcuts.push_back(Shortcut("-", L("Delete color change marker for current layer")));
- m_full_shortcuts.push_back(std::make_pair( _(L("Layers Slider Shortcuts")), std::make_pair(layers_slider_shortcuts, 1) ));
+ m_full_shortcuts.push_back(std::make_pair(_(L("Layers Slider Shortcuts")), std::make_pair(layers_slider_shortcuts, szRight)));
+}
+
+void KBShortcutsDialog::on_dpi_changed(const wxRect &suggested_rect)
+{
+ m_logo_bmp.msw_rescale();
+
+ for (wxStaticBitmap* bmp : m_head_bitmaps)
+ bmp->SetBitmap(m_logo_bmp.bmp());
+
+ const int& em = em_unit();
+ const wxSize& size = wxSize(85 * em, 75 * em);
+
+ SetMinSize(size);
+ SetSize(size);
+
+ Refresh();
}
void KBShortcutsDialog::onCloseDialog(wxEvent &)
diff --git a/src/slic3r/GUI/KBShortcutsDialog.hpp b/src/slic3r/GUI/KBShortcutsDialog.hpp
index d8905e1ce..66fe7c399 100644
--- a/src/slic3r/GUI/KBShortcutsDialog.hpp
+++ b/src/slic3r/GUI/KBShortcutsDialog.hpp
@@ -5,24 +5,38 @@
#include