Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/slic3r/GUI/AboutDialog.cpp4
-rw-r--r--src/slic3r/GUI/ConfigSnapshotDialog.cpp7
-rw-r--r--src/slic3r/GUI/ConfigWizard.cpp23
-rw-r--r--src/slic3r/GUI/ConfigWizard_private.hpp4
-rw-r--r--src/slic3r/GUI/Field.cpp18
-rw-r--r--src/slic3r/GUI/Field.hpp2
-rw-r--r--src/slic3r/GUI/FirmwareDialog.cpp47
-rw-r--r--src/slic3r/GUI/FirmwareDialog.hpp10
-rw-r--r--src/slic3r/GUI/KBShortcutsDialog.cpp7
-rw-r--r--src/slic3r/GUI/OptionsGroup.cpp8
-rw-r--r--src/slic3r/GUI/Preferences.cpp11
-rw-r--r--src/slic3r/GUI/PrintHostDialogs.cpp15
-rw-r--r--src/slic3r/GUI/PrintHostDialogs.hpp4
-rw-r--r--src/slic3r/GUI/SysInfoDialog.cpp11
-rw-r--r--src/slic3r/GUI/SysInfoDialog.hpp2
-rw-r--r--src/slic3r/GUI/wxExtensions.cpp16
-rw-r--r--src/slic3r/GUI/wxExtensions.hpp3
17 files changed, 149 insertions, 43 deletions
diff --git a/src/slic3r/GUI/AboutDialog.cpp b/src/slic3r/GUI/AboutDialog.cpp
index fb1450ba1..b1a2556e7 100644
--- a/src/slic3r/GUI/AboutDialog.cpp
+++ b/src/slic3r/GUI/AboutDialog.cpp
@@ -133,13 +133,15 @@ void AboutDialog::on_dpi_changed(const wxRect &suggested_rect)
const int& em = em_unit();
+ msw_buttons_rescale(this, em, { wxID_CLOSE });
+
m_html->SetMinSize(wxSize(-1, 16 * em));
m_html->Refresh();
const wxSize& size = wxSize(65 * em, 30 * em);
SetMinSize(size);
- SetSize(size);
+ Fit();
Refresh();
}
diff --git a/src/slic3r/GUI/ConfigSnapshotDialog.cpp b/src/slic3r/GUI/ConfigSnapshotDialog.cpp
index dd3e46229..b8634918b 100644
--- a/src/slic3r/GUI/ConfigSnapshotDialog.cpp
+++ b/src/slic3r/GUI/ConfigSnapshotDialog.cpp
@@ -6,6 +6,7 @@
#include "libslic3r/Utils.hpp"
#include "GUI_App.hpp"
+#include "wxExtensions.hpp"
namespace Slic3r {
namespace GUI {
@@ -144,10 +145,12 @@ void ConfigSnapshotDialog::on_dpi_changed(const wxRect &suggested_rect)
html->Refresh();
const int& em = em_unit();
- const wxSize& size = wxSize(45 * em, 40 * em);
+ msw_buttons_rescale(this, em, { wxID_CLOSE});
+
+ const wxSize& size = wxSize(45 * em, 40 * em);
SetMinSize(size);
- SetSize(size);
+ Fit();
Refresh();
}
diff --git a/src/slic3r/GUI/ConfigWizard.cpp b/src/slic3r/GUI/ConfigWizard.cpp
index 3d41285bb..93cf1c73f 100644
--- a/src/slic3r/GUI/ConfigWizard.cpp
+++ b/src/slic3r/GUI/ConfigWizard.cpp
@@ -194,6 +194,9 @@ PrinterPicker::PrinterPicker(wxWindow *parent, const VendorProfile &vendor, wxSt
title_sizer->Add(sel_all_std, 0, wxRIGHT, BTN_SPACING);
title_sizer->Add(sel_all, 0, wxRIGHT, BTN_SPACING);
title_sizer->Add(sel_none);
+
+ // fill button indexes used later for buttons rescaling
+ m_button_indexes = { sel_all_std->GetId(), sel_all->GetId(), sel_none->GetId() };
}
sizer->Add(title_sizer, 0, wxEXPAND | wxBOTTOM, BTN_SPACING);
@@ -1057,8 +1060,8 @@ ConfigWizard::ConfigWizard(wxWindow *parent, RunReason reason)
topsizer->AddSpacer(INDEX_MARGIN);
topsizer->Add(p->hscroll, 1, wxEXPAND);
- auto *btn_sel_all = new wxButton(this, wxID_ANY, _(L("Select all standard printers")));
- p->btnsizer->Add(btn_sel_all);
+ p->btn_sel_all = new wxButton(this, wxID_ANY, _(L("Select all standard printers")));
+ p->btnsizer->Add(p->btn_sel_all);
p->btn_prev = new wxButton(this, wxID_ANY, _(L("< &Back")));
p->btn_next = new wxButton(this, wxID_ANY, _(L("&Next >")));
@@ -1130,7 +1133,7 @@ ConfigWizard::ConfigWizard(wxWindow *parent, RunReason reason)
p->btn_finish->Bind(wxEVT_BUTTON, [this](const wxCommandEvent &) { this->EndModal(wxID_OK); });
p->btn_finish->Hide();
- btn_sel_all->Bind(wxEVT_BUTTON, [this](const wxCommandEvent &) {
+ p->btn_sel_all->Bind(wxEVT_BUTTON, [this](const wxCommandEvent &) {
p->page_fff->select_all(true, false);
p->page_msla->select_all(true, false);
p->index->go_to(p->page_update);
@@ -1179,6 +1182,20 @@ const wxString& ConfigWizard::name(const bool from_menu/* = false*/)
void ConfigWizard::on_dpi_changed(const wxRect &suggested_rect)
{
p->index->msw_rescale();
+
+ const int& em = em_unit();
+
+ msw_buttons_rescale(this, em, { wxID_APPLY,
+ wxID_CANCEL,
+ p->btn_sel_all->GetId(),
+ p->btn_next->GetId(),
+ p->btn_prev->GetId() });
+
+ for (auto printer_picker: p->page_fff->printer_pickers)
+ msw_buttons_rescale(this, em, printer_picker->get_button_indexes());
+
+ // FIXME VK SetSize(???)
+
Refresh();
}
diff --git a/src/slic3r/GUI/ConfigWizard_private.hpp b/src/slic3r/GUI/ConfigWizard_private.hpp
index 31a990b60..95411e2aa 100644
--- a/src/slic3r/GUI/ConfigWizard_private.hpp
+++ b/src/slic3r/GUI/ConfigWizard_private.hpp
@@ -69,8 +69,11 @@ struct PrinterPicker: wxPanel
void on_checkbox(const Checkbox *cbox, bool checked);
int get_width() const { return width; }
+ const std::vector<int>& get_button_indexes() { return m_button_indexes; }
private:
int width;
+
+ std::vector<int> m_button_indexes;
};
struct ConfigWizardPage: wxPanel
@@ -267,6 +270,7 @@ struct ConfigWizard::priv
wxBoxSizer *btnsizer = nullptr;
ConfigWizardPage *page_current = nullptr;
ConfigWizardIndex *index = nullptr;
+ wxButton *btn_sel_all = nullptr;
wxButton *btn_prev = nullptr;
wxButton *btn_next = nullptr;
wxButton *btn_finish = nullptr;
diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp
index 822361c5d..738ec2e00 100644
--- a/src/slic3r/GUI/Field.cpp
+++ b/src/slic3r/GUI/Field.cpp
@@ -379,8 +379,8 @@ void TextCtrl::change_field_value(wxEvent& event)
void CheckBox::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);
bool check_value = m_opt.type == coBool ?
m_opt.default_value->getBool() : m_opt.type == coBools ?
@@ -413,6 +413,14 @@ boost::any& CheckBox::get_value()
return m_value;
}
+void CheckBox::msw_rescale()
+{
+ Field::msw_rescale();
+
+ wxCheckBox* field = dynamic_cast<wxCheckBox*>(window);
+ field->SetMinSize(wxSize(-1, int(1.5f*field->GetFont().GetPixelSize().y +0.5f)));
+}
+
int undef_spin_val = -9999; //! Probably, It's not necessary
void SpinCtrl::BUILD() {
@@ -849,9 +857,11 @@ void Choice::msw_rescale()
*/
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);
-
+
+ // Set rescaled min height to correct layout
+ field->SetMinSize(wxSize(-1, int(1.5f*field->GetFont().GetPixelSize().y + 0.5f)));
+ // Set rescaled size
field->SetSize(size);
size_t idx, counter = idx = 0;
diff --git a/src/slic3r/GUI/Field.hpp b/src/slic3r/GUI/Field.hpp
index 516570ea8..88ea39036 100644
--- a/src/slic3r/GUI/Field.hpp
+++ b/src/slic3r/GUI/Field.hpp
@@ -319,6 +319,8 @@ public:
}
boost::any& get_value() override;
+ void msw_rescale() override;
+
void enable() override { dynamic_cast<wxCheckBox*>(window)->Enable(); }
void disable() override { dynamic_cast<wxCheckBox*>(window)->Disable(); }
wxWindow* getWindow() override { return window; }
diff --git a/src/slic3r/GUI/FirmwareDialog.cpp b/src/slic3r/GUI/FirmwareDialog.cpp
index 4fdc57679..5de5626db 100644
--- a/src/slic3r/GUI/FirmwareDialog.cpp
+++ b/src/slic3r/GUI/FirmwareDialog.cpp
@@ -18,6 +18,7 @@
#include "MsgDialog.hpp"
#include "../Utils/HexFile.hpp"
#include "../Utils/Serial.hpp"
+#include "wxExtensions.hpp"
// wx includes need to come after asio because of the WinSock.h problem
#include "FirmwareDialog.hpp"
@@ -118,6 +119,10 @@ struct FirmwareDialog::priv
wxTimer timer_pulse;
+ int min_width;
+ int min_height;
+ int min_height_expanded;
+
// Async modal dialog during flashing
std::mutex mutex;
int modal_response;
@@ -735,18 +740,10 @@ FirmwareDialog::FirmwareDialog(wxWindow *parent) :
GUI::DPIDialog(parent, wxID_ANY, _(L("Firmware flasher")), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
p(new priv(this))
{
- enum {
- DIALOG_MARGIN = 15,
- SPACING = 10,
- MIN_WIDTH = 50,
- MIN_HEIGHT = 18,
- MIN_HEIGHT_EXPANDED = 40,
- };
-
const int em = GUI::wxGetApp().em_unit();
- int min_width = MIN_WIDTH * em;
- int min_height = MIN_HEIGHT * em;
- int min_height_expanded = MIN_HEIGHT_EXPANDED * em;
+ p->min_width = MIN_WIDTH * em;
+ p->min_height = MIN_HEIGHT * em;
+ p->min_height_expanded = MIN_HEIGHT_EXPANDED * em;
/* get current font from application,
* because of wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT) function
@@ -825,10 +822,10 @@ FirmwareDialog::FirmwareDialog(wxWindow *parent) :
auto *topsizer = new wxBoxSizer(wxVERTICAL);
topsizer->Add(panel, 1, wxEXPAND | wxALL, DIALOG_MARGIN);
- SetMinSize(wxSize(min_width, min_height));
+ SetMinSize(wxSize(p->min_width, p->min_height));
SetSizerAndFit(topsizer);
const auto size = GetSize();
- SetSize(std::max(size.GetWidth(), static_cast<int>(min_width)), std::max(size.GetHeight(), static_cast<int>(min_height)));
+ SetSize(std::max(size.GetWidth(), static_cast<int>(p->min_width)), std::max(size.GetHeight(), static_cast<int>(p->min_height)));
Layout();
SetEscapeId(wxID_CLOSE); // To close the dialog using "Esc" button
@@ -844,11 +841,11 @@ FirmwareDialog::FirmwareDialog(wxWindow *parent) :
p->spoiler->Bind(wxEVT_COLLAPSIBLEPANE_CHANGED, [=](wxCollapsiblePaneEvent &evt) {
if (evt.GetCollapsed()) {
- this->SetMinSize(wxSize(min_width, min_height));
+ this->SetMinSize(wxSize(p->min_width, p->min_height));
const auto new_height = this->GetSize().GetHeight() - this->p->txt_stdout->GetSize().GetHeight();
this->SetSize(this->GetSize().GetWidth(), new_height);
} else {
- this->SetMinSize(wxSize(min_width, min_height_expanded));
+ this->SetMinSize(wxSize(p->min_width, p->min_height_expanded));
}
this->Layout();
@@ -903,5 +900,25 @@ void FirmwareDialog::run(wxWindow *parent)
dialog.ShowModal();
}
+void FirmwareDialog::on_dpi_changed(const wxRect &suggested_rect)
+{
+ const int& em = em_unit();
+
+ msw_buttons_rescale(this, em, { p->btn_close->GetId(),
+ p->btn_rescan->GetId(),
+ p->btn_flash->GetId(),
+ p->hex_picker->GetPickerCtrl()->GetId()
+ });
+
+ p->min_width = MIN_WIDTH * em;
+ p->min_height = MIN_HEIGHT * em;
+ p->min_height_expanded = MIN_HEIGHT_EXPANDED * em;
+
+ const int min_height = p->spoiler->IsExpanded() ? p->min_height_expanded : p->min_height;
+ SetMinSize(wxSize(p->min_width, min_height));
+ Fit();
+
+ Refresh();
+}
}
diff --git a/src/slic3r/GUI/FirmwareDialog.hpp b/src/slic3r/GUI/FirmwareDialog.hpp
index a1eac00de..7c688d379 100644
--- a/src/slic3r/GUI/FirmwareDialog.hpp
+++ b/src/slic3r/GUI/FirmwareDialog.hpp
@@ -12,6 +12,14 @@ namespace Slic3r {
class FirmwareDialog: public GUI::DPIDialog
{
+ enum {
+ DIALOG_MARGIN = 15,
+ SPACING = 10,
+ MIN_WIDTH = 50,
+ MIN_HEIGHT = /*18*/25,
+ MIN_HEIGHT_EXPANDED = 40,
+ };
+
public:
FirmwareDialog(wxWindow *parent);
FirmwareDialog(FirmwareDialog &&) = delete;
@@ -23,7 +31,7 @@ public:
static void run(wxWindow *parent);
protected:
- void on_dpi_changed(const wxRect &suggested_rect) override{;}
+ void on_dpi_changed(const wxRect &suggested_rect) override;
private:
struct priv;
std::unique_ptr<priv> p;
diff --git a/src/slic3r/GUI/KBShortcutsDialog.cpp b/src/slic3r/GUI/KBShortcutsDialog.cpp
index 7f77474f2..066bc54fa 100644
--- a/src/slic3r/GUI/KBShortcutsDialog.cpp
+++ b/src/slic3r/GUI/KBShortcutsDialog.cpp
@@ -196,11 +196,14 @@ void KBShortcutsDialog::on_dpi_changed(const wxRect &suggested_rect)
for (wxStaticBitmap* bmp : m_head_bitmaps)
bmp->SetBitmap(m_logo_bmp.bmp());
- const int& em = em_unit();
+ const int em = em_unit();
+
+ msw_buttons_rescale(this, em, { wxID_OK });
+
const wxSize& size = wxSize(85 * em, 75 * em);
SetMinSize(size);
- SetSize(size);
+ Fit();
Refresh();
}
diff --git a/src/slic3r/GUI/OptionsGroup.cpp b/src/slic3r/GUI/OptionsGroup.cpp
index fdbe3b038..099ebc8ba 100644
--- a/src/slic3r/GUI/OptionsGroup.cpp
+++ b/src/slic3r/GUI/OptionsGroup.cpp
@@ -516,17 +516,19 @@ void ConfigOptionsGroup::msw_rescale()
{
auto label = dynamic_cast<wxStaticText*>(label_item->GetWindow());
if (label != nullptr) {
- label->SetMinSize(wxSize(label_width*em, -1));
+ const int label_height = int(1.5f*label->GetFont().GetPixelSize().y + 0.5f);
+ label->SetMinSize(wxSize(label_width*em, /*-1*/label_height));
}
}
- else if (label_item->IsSizer()) // case when we nave near_label_widget
+ else if (label_item->IsSizer()) // case when we have near_label_widget
{
const wxSizerItem* l_item = label_item->GetSizer()->GetItem(1);
if (l_item->IsWindow())
{
auto label = dynamic_cast<wxStaticText*>(l_item->GetWindow());
if (label != nullptr) {
- label->SetMinSize(wxSize(label_width*em, -1));
+ const int label_height = int(1.5f*label->GetFont().GetPixelSize().y + 0.5f);
+ label->SetMinSize(wxSize(label_width*em, /*-1*/label_height));
}
}
}
diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp
index 69f4e3493..81d242d4f 100644
--- a/src/slic3r/GUI/Preferences.cpp
+++ b/src/slic3r/GUI/Preferences.cpp
@@ -8,7 +8,7 @@ namespace GUI {
PreferencesDialog::PreferencesDialog(wxWindow* parent) :
DPIDialog(parent, wxID_ANY, _(L("Preferences")), wxDefaultPosition,
- wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
+ wxDefaultSize, wxDEFAULT_DIALOG_STYLE)
{
build();
}
@@ -146,11 +146,14 @@ void PreferencesDialog::on_dpi_changed(const wxRect &suggested_rect)
{
m_optgroup->msw_rescale();
- const int& em = em_unit();
- const wxSize& size = wxSize(50 * em, 29 * em);
+ const int em = em_unit();
+
+ msw_buttons_rescale(this, em, { wxID_OK, wxID_CANCEL });
+
+ const wxSize& size = wxSize(47 * em, 28 * em);
SetMinSize(size);
- SetSize(size);
+ Fit();
Refresh();
}
diff --git a/src/slic3r/GUI/PrintHostDialogs.cpp b/src/slic3r/GUI/PrintHostDialogs.cpp
index 4fb03594b..2b6e4f2a2 100644
--- a/src/slic3r/GUI/PrintHostDialogs.cpp
+++ b/src/slic3r/GUI/PrintHostDialogs.cpp
@@ -19,6 +19,7 @@
#include "MsgDialog.hpp"
#include "I18N.hpp"
#include "../Utils/PrintHost.hpp"
+#include "wxExtensions.hpp"
namespace fs = boost::filesystem;
@@ -136,8 +137,6 @@ PrintHostQueueDialog::PrintHostQueueDialog(wxWindow *parent)
, on_error_evt(this, EVT_PRINTHOST_ERROR, &PrintHostQueueDialog::on_error, this)
, on_cancel_evt(this, EVT_PRINTHOST_CANCEL, &PrintHostQueueDialog::on_cancel, this)
{
- enum { HEIGHT = 60, WIDTH = 30, SPACING = 5 };
-
const auto em = GetTextExtent("m").x;
SetSize(wxSize(HEIGHT * em, WIDTH * em));
@@ -202,6 +201,18 @@ void PrintHostQueueDialog::append_job(const PrintHostJob &job)
job_list->AppendItem(fields, static_cast<wxUIntPtr>(ST_NEW));
}
+void PrintHostQueueDialog::on_dpi_changed(const wxRect &suggested_rect)
+{
+ const int& em = em_unit();
+
+ msw_buttons_rescale(this, em, { wxID_DELETE, wxID_CANCEL, btn_error->GetId() });
+
+ SetMinSize(wxSize(HEIGHT * em, WIDTH * em));
+
+ Fit();
+ Refresh();
+}
+
PrintHostQueueDialog::JobState PrintHostQueueDialog::get_state(int idx)
{
wxCHECK_MSG(idx >= 0 && idx < job_list->GetItemCount(), ST_ERROR, "Out of bounds access to job list");
diff --git a/src/slic3r/GUI/PrintHostDialogs.hpp b/src/slic3r/GUI/PrintHostDialogs.hpp
index e6c46aae6..427c4f6bf 100644
--- a/src/slic3r/GUI/PrintHostDialogs.hpp
+++ b/src/slic3r/GUI/PrintHostDialogs.hpp
@@ -64,7 +64,7 @@ public:
void append_job(const PrintHostJob &job);
protected:
- void on_dpi_changed(const wxRect &suggested_rect) override { Refresh(); }
+ void on_dpi_changed(const wxRect &suggested_rect) override;
private:
enum Column {
@@ -85,6 +85,8 @@ private:
ST_COMPLETED,
};
+ enum { HEIGHT = 60, WIDTH = 30, SPACING = 5 };
+
wxButton *btn_cancel;
wxButton *btn_error;
wxDataViewListCtrl *job_list;
diff --git a/src/slic3r/GUI/SysInfoDialog.cpp b/src/slic3r/GUI/SysInfoDialog.cpp
index 31f75a926..162a36c75 100644
--- a/src/slic3r/GUI/SysInfoDialog.cpp
+++ b/src/slic3r/GUI/SysInfoDialog.cpp
@@ -117,9 +117,10 @@ SysInfoDialog::SysInfoDialog()
}
wxStdDialogButtonSizer* buttons = this->CreateStdDialogButtonSizer(wxOK);
- auto btn_copy_to_clipboard = new wxButton(this, wxID_ANY, "Copy to Clipboard", wxDefaultPosition, wxDefaultSize);
- buttons->Insert(0, btn_copy_to_clipboard, 0, wxLEFT, 5);
- btn_copy_to_clipboard->Bind(wxEVT_BUTTON, &SysInfoDialog::onCopyToClipboard, this);
+ m_btn_copy_to_clipboard = new wxButton(this, wxID_ANY, "Copy to Clipboard", wxDefaultPosition, wxDefaultSize);
+
+ buttons->Insert(0, m_btn_copy_to_clipboard, 0, wxLEFT, 5);
+ m_btn_copy_to_clipboard->Bind(wxEVT_BUTTON, &SysInfoDialog::onCopyToClipboard, this);
this->SetEscapeId(wxID_OK);
this->Bind(wxEVT_BUTTON, &SysInfoDialog::onCloseDialog, this, wxID_OK);
@@ -146,6 +147,8 @@ void SysInfoDialog::on_dpi_changed(const wxRect &suggested_rect)
const int& em = em_unit();
+ msw_buttons_rescale(this, em, { wxID_OK, m_btn_copy_to_clipboard->GetId() });
+
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();
@@ -153,7 +156,7 @@ void SysInfoDialog::on_dpi_changed(const wxRect &suggested_rect)
const wxSize& size = wxSize(65 * em, 55 * em);
SetMinSize(size);
- SetSize(size);
+ Fit();
Refresh();
}
diff --git a/src/slic3r/GUI/SysInfoDialog.hpp b/src/slic3r/GUI/SysInfoDialog.hpp
index dec4b5635..3b1459648 100644
--- a/src/slic3r/GUI/SysInfoDialog.hpp
+++ b/src/slic3r/GUI/SysInfoDialog.hpp
@@ -17,6 +17,8 @@ class SysInfoDialog : public DPIDialog
wxHtmlWindow* m_opengl_info_html;
wxHtmlWindow* m_html;
+ wxButton* m_btn_copy_to_clipboard;
+
public:
SysInfoDialog();
diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp
index 277494034..573106ae7 100644
--- a/src/slic3r/GUI/wxExtensions.cpp
+++ b/src/slic3r/GUI/wxExtensions.cpp
@@ -267,6 +267,22 @@ void wxDataViewTreeCtrlComboPopup::OnDataViewTreeCtrlSelection(wxCommandEvent& e
cmb->SetText(selected);
}
+/* Function for rescale of buttons in Dialog under MSW if dpi is changed.
+ * btn_ids - vector of buttons identifiers
+ */
+void msw_buttons_rescale(wxDialog* dlg, const int em_unit, const std::vector<int>& btn_ids)
+{
+ const wxSize& btn_size = wxSize(-1, int(2.5f * em_unit + 0.5f));
+
+ for (int btn_id : btn_ids) {
+ // There is a case [FirmwareDialog], when we have wxControl instead of wxButton
+ // so let casting everything to the wxControl
+ wxControl* btn = static_cast<wxControl*>(dlg->FindWindowById(btn_id, dlg));
+ if (btn)
+ btn->SetMinSize(btn_size);
+ }
+}
+
/* Function for getting of em_unit value from correct parent.
* In most of cases it is m_em_unit value from GUI_App,
* but for DPIDialogs it's its own value.
diff --git a/src/slic3r/GUI/wxExtensions.hpp b/src/slic3r/GUI/wxExtensions.hpp
index 7d63438c0..69369b3ff 100644
--- a/src/slic3r/GUI/wxExtensions.hpp
+++ b/src/slic3r/GUI/wxExtensions.hpp
@@ -31,7 +31,8 @@ wxMenuItem* append_submenu(wxMenu* menu, wxMenu* sub_menu, int id, const wxStrin
wxMenuItem* append_menu_radio_item(wxMenu* menu, int id, const wxString& string, const wxString& description,
std::function<void(wxCommandEvent& event)> cb, wxEvtHandler* event_handler);
-int em_unit(wxWindow* win);
+void msw_buttons_rescale(wxDialog* dlg, const int em_unit, const std::vector<int>& btn_ids);
+int em_unit(wxWindow* win);
wxBitmap create_scaled_bitmap(wxWindow *win, const std::string& bmp_name, const int px_cnt = 16, const bool is_horizontal = false);