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

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuSanka <yusanka@gmail.com>2019-04-25 16:06:44 +0300
committerYuSanka <yusanka@gmail.com>2019-04-25 16:09:12 +0300
commit708037158e78dfe0552b3ed5d9498da1832e031b (patch)
tree0400c2bc1421a673f4e1ff599ddad83a40580fd6 /src/slic3r/GUI/FirmwareDialog.cpp
parent3f978f6afe95411ebe25fd8fcb38986b6d8ecbc4 (diff)
Added msw_buttons_rescale() - Function for a scaling Dialog's buttons under MSW
Diffstat (limited to 'src/slic3r/GUI/FirmwareDialog.cpp')
-rw-r--r--src/slic3r/GUI/FirmwareDialog.cpp47
1 files changed, 32 insertions, 15 deletions
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();
+}
}