Scaling in PrintHostDialogs, FirmwareDialog, UpdateDialogs
This commit is contained in:
parent
051ca410f6
commit
14b4685ecb
5 changed files with 30 additions and 21 deletions
|
@ -13,6 +13,7 @@
|
||||||
#include "libslic3r/Utils.hpp"
|
#include "libslic3r/Utils.hpp"
|
||||||
#include "avrdude/avrdude-slic3r.hpp"
|
#include "avrdude/avrdude-slic3r.hpp"
|
||||||
#include "GUI.hpp"
|
#include "GUI.hpp"
|
||||||
|
#include "GUI_App.hpp"
|
||||||
#include "I18N.hpp"
|
#include "I18N.hpp"
|
||||||
#include "MsgDialog.hpp"
|
#include "MsgDialog.hpp"
|
||||||
#include "../Utils/HexFile.hpp"
|
#include "../Utils/HexFile.hpp"
|
||||||
|
@ -36,7 +37,6 @@
|
||||||
#include <wx/collpane.h>
|
#include <wx/collpane.h>
|
||||||
#include <wx/msgdlg.h>
|
#include <wx/msgdlg.h>
|
||||||
#include <wx/filefn.h>
|
#include <wx/filefn.h>
|
||||||
#include "GUI_App.hpp"
|
|
||||||
|
|
||||||
|
|
||||||
namespace fs = boost::filesystem;
|
namespace fs = boost::filesystem;
|
||||||
|
@ -693,11 +693,16 @@ FirmwareDialog::FirmwareDialog(wxWindow *parent) :
|
||||||
enum {
|
enum {
|
||||||
DIALOG_MARGIN = 15,
|
DIALOG_MARGIN = 15,
|
||||||
SPACING = 10,
|
SPACING = 10,
|
||||||
MIN_WIDTH = 600,
|
MIN_WIDTH = 50,
|
||||||
MIN_HEIGHT = 200,
|
MIN_HEIGHT = 18,
|
||||||
MIN_HEIGHT_EXPANDED = 500,
|
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;
|
||||||
|
|
||||||
wxFont status_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
|
wxFont status_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
|
||||||
status_font.MakeBold();
|
status_font.MakeBold();
|
||||||
wxFont mono_font(wxFontInfo().Family(wxFONTFAMILY_TELETYPE));
|
wxFont mono_font(wxFontInfo().Family(wxFONTFAMILY_TELETYPE));
|
||||||
|
@ -769,10 +774,10 @@ FirmwareDialog::FirmwareDialog(wxWindow *parent) :
|
||||||
|
|
||||||
auto *topsizer = new wxBoxSizer(wxVERTICAL);
|
auto *topsizer = new wxBoxSizer(wxVERTICAL);
|
||||||
topsizer->Add(panel, 1, wxEXPAND | wxALL, DIALOG_MARGIN);
|
topsizer->Add(panel, 1, wxEXPAND | wxALL, DIALOG_MARGIN);
|
||||||
SetMinSize(wxSize(MIN_WIDTH, MIN_HEIGHT));
|
SetMinSize(wxSize(min_width, min_height));
|
||||||
SetSizerAndFit(topsizer);
|
SetSizerAndFit(topsizer);
|
||||||
const auto size = GetSize();
|
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>(min_width)), std::max(size.GetHeight(), static_cast<int>(min_height)));
|
||||||
Layout();
|
Layout();
|
||||||
|
|
||||||
SetEscapeId(wxID_CLOSE); // To close the dialog using "Esc" button
|
SetEscapeId(wxID_CLOSE); // To close the dialog using "Esc" button
|
||||||
|
@ -786,13 +791,13 @@ FirmwareDialog::FirmwareDialog(wxWindow *parent) :
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
p->spoiler->Bind(wxEVT_COLLAPSIBLEPANE_CHANGED, [this](wxCollapsiblePaneEvent &evt) {
|
p->spoiler->Bind(wxEVT_COLLAPSIBLEPANE_CHANGED, [=](wxCollapsiblePaneEvent &evt) {
|
||||||
if (evt.GetCollapsed()) {
|
if (evt.GetCollapsed()) {
|
||||||
this->SetMinSize(wxSize(MIN_WIDTH, MIN_HEIGHT));
|
this->SetMinSize(wxSize(min_width, min_height));
|
||||||
const auto new_height = this->GetSize().GetHeight() - this->p->txt_stdout->GetSize().GetHeight();
|
const auto new_height = this->GetSize().GetHeight() - this->p->txt_stdout->GetSize().GetHeight();
|
||||||
this->SetSize(this->GetSize().GetWidth(), new_height);
|
this->SetSize(this->GetSize().GetWidth(), new_height);
|
||||||
} else {
|
} else {
|
||||||
this->SetMinSize(wxSize(MIN_WIDTH, MIN_HEIGHT_EXPANDED));
|
this->SetMinSize(wxSize(min_width, min_height_expanded));
|
||||||
}
|
}
|
||||||
|
|
||||||
this->Layout();
|
this->Layout();
|
||||||
|
|
|
@ -78,6 +78,7 @@ IMPLEMENT_APP(GUI_App)
|
||||||
|
|
||||||
GUI_App::GUI_App()
|
GUI_App::GUI_App()
|
||||||
: wxApp()
|
: wxApp()
|
||||||
|
, m_em_unit(10)
|
||||||
#if ENABLE_IMGUI
|
#if ENABLE_IMGUI
|
||||||
, m_imgui(new ImGuiWrapper())
|
, m_imgui(new ImGuiWrapper())
|
||||||
#endif // ENABLE_IMGUI
|
#endif // ENABLE_IMGUI
|
||||||
|
|
|
@ -32,8 +32,8 @@ struct MsgDialog : wxDialog
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
enum {
|
enum {
|
||||||
CONTENT_WIDTH = 50,//500,
|
CONTENT_WIDTH = 50,
|
||||||
CONTENT_MAX_HEIGHT = 60,//600,
|
CONTENT_MAX_HEIGHT = 60,
|
||||||
BORDER = 30,
|
BORDER = 30,
|
||||||
VERT_SPACING = 15,
|
VERT_SPACING = 15,
|
||||||
HORIZ_SPACING = 5,
|
HORIZ_SPACING = 5,
|
||||||
|
|
|
@ -38,7 +38,7 @@ PrintHostSendDialog::PrintHostSendDialog(const fs::path &path)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
auto *label_dir_hint = new wxStaticText(this, wxID_ANY, _(L("Use forward slashes ( / ) as a directory separator if needed.")));
|
auto *label_dir_hint = new wxStaticText(this, wxID_ANY, _(L("Use forward slashes ( / ) as a directory separator if needed.")));
|
||||||
label_dir_hint->Wrap(CONTENT_WIDTH);
|
label_dir_hint->Wrap(CONTENT_WIDTH * wxGetApp().em_unit());
|
||||||
|
|
||||||
content_sizer->Add(txt_filename, 0, wxEXPAND);
|
content_sizer->Add(txt_filename, 0, wxEXPAND);
|
||||||
content_sizer->Add(label_dir_hint);
|
content_sizer->Add(label_dir_hint);
|
||||||
|
@ -135,10 +135,11 @@ PrintHostQueueDialog::PrintHostQueueDialog(wxWindow *parent)
|
||||||
, on_error_evt(this, EVT_PRINTHOST_ERROR, &PrintHostQueueDialog::on_error, this)
|
, on_error_evt(this, EVT_PRINTHOST_ERROR, &PrintHostQueueDialog::on_error, this)
|
||||||
, on_cancel_evt(this, EVT_PRINTHOST_CANCEL, &PrintHostQueueDialog::on_cancel, this)
|
, on_cancel_evt(this, EVT_PRINTHOST_CANCEL, &PrintHostQueueDialog::on_cancel, this)
|
||||||
{
|
{
|
||||||
enum { HEIGHT = 800, WIDTH = 400, SPACING = 5 };
|
enum { HEIGHT = 60, WIDTH = 30, SPACING = 5 };
|
||||||
|
|
||||||
SetSize(wxSize(HEIGHT, WIDTH));
|
const auto em = GetTextExtent("m").x;
|
||||||
SetSize(GetMinSize());
|
|
||||||
|
SetSize(wxSize(HEIGHT * em, WIDTH * em));
|
||||||
|
|
||||||
auto *topsizer = new wxBoxSizer(wxVERTICAL);
|
auto *topsizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "libslic3r/libslic3r.h"
|
#include "libslic3r/libslic3r.h"
|
||||||
#include "libslic3r/Utils.hpp"
|
#include "libslic3r/Utils.hpp"
|
||||||
#include "GUI.hpp"
|
#include "GUI.hpp"
|
||||||
|
#include "GUI_App.hpp"
|
||||||
#include "I18N.hpp"
|
#include "I18N.hpp"
|
||||||
#include "ConfigWizard.hpp"
|
#include "ConfigWizard.hpp"
|
||||||
|
|
||||||
|
@ -34,7 +35,8 @@ MsgUpdateSlic3r::MsgUpdateSlic3r(const Semver &ver_current, const Semver &ver_on
|
||||||
|
|
||||||
auto *text = new wxStaticText(this, wxID_ANY, _(L("To download, follow the link below.")));
|
auto *text = new wxStaticText(this, wxID_ANY, _(L("To download, follow the link below.")));
|
||||||
const auto link_width = link->GetSize().GetWidth();
|
const auto link_width = link->GetSize().GetWidth();
|
||||||
text->Wrap(CONTENT_WIDTH > link_width ? CONTENT_WIDTH : link_width);
|
const int content_width = CONTENT_WIDTH * wxGetApp().em_unit();
|
||||||
|
text->Wrap(content_width > link_width ? content_width : link_width);
|
||||||
content_sizer->Add(text);
|
content_sizer->Add(text);
|
||||||
content_sizer->AddSpacer(VERT_SPACING);
|
content_sizer->AddSpacer(VERT_SPACING);
|
||||||
|
|
||||||
|
@ -75,7 +77,7 @@ MsgUpdateConfig::MsgUpdateConfig(const std::unordered_map<std::string, std::stri
|
||||||
"should there be a problem with the new version.\n\n"
|
"should there be a problem with the new version.\n\n"
|
||||||
"Updated configuration bundles:"
|
"Updated configuration bundles:"
|
||||||
)));
|
)));
|
||||||
text->Wrap(CONTENT_WIDTH);
|
text->Wrap(CONTENT_WIDTH * wxGetApp().em_unit());
|
||||||
content_sizer->Add(text);
|
content_sizer->Add(text);
|
||||||
content_sizer->AddSpacer(VERT_SPACING);
|
content_sizer->AddSpacer(VERT_SPACING);
|
||||||
|
|
||||||
|
@ -115,16 +117,16 @@ MsgDataIncompatible::MsgDataIncompatible(const std::unordered_map<std::string, w
|
||||||
"You may either exit Slic3r and try again with a newer version, or you may re-run the initial configuration. "
|
"You may either exit Slic3r and try again with a newer version, or you may re-run the initial configuration. "
|
||||||
"Doing so will create a backup snapshot of the existing configuration before installing files compatible with this Slic3r.\n"
|
"Doing so will create a backup snapshot of the existing configuration before installing files compatible with this Slic3r.\n"
|
||||||
)));
|
)));
|
||||||
text->Wrap(CONTENT_WIDTH);
|
text->Wrap(CONTENT_WIDTH * wxGetApp().em_unit());
|
||||||
content_sizer->Add(text);
|
content_sizer->Add(text);
|
||||||
|
|
||||||
auto *text2 = new wxStaticText(this, wxID_ANY, wxString::Format(_(L("This Slic3r PE version: %s")), SLIC3R_VERSION));
|
auto *text2 = new wxStaticText(this, wxID_ANY, wxString::Format(_(L("This Slic3r PE version: %s")), SLIC3R_VERSION));
|
||||||
text2->Wrap(CONTENT_WIDTH);
|
text2->Wrap(CONTENT_WIDTH * wxGetApp().em_unit());
|
||||||
content_sizer->Add(text2);
|
content_sizer->Add(text2);
|
||||||
content_sizer->AddSpacer(VERT_SPACING);
|
content_sizer->AddSpacer(VERT_SPACING);
|
||||||
|
|
||||||
auto *text3 = new wxStaticText(this, wxID_ANY, _(L("Incompatible bundles:")));
|
auto *text3 = new wxStaticText(this, wxID_ANY, _(L("Incompatible bundles:")));
|
||||||
text3->Wrap(CONTENT_WIDTH);
|
text3->Wrap(CONTENT_WIDTH * wxGetApp().em_unit());
|
||||||
content_sizer->Add(text3);
|
content_sizer->Add(text3);
|
||||||
content_sizer->AddSpacer(VERT_SPACING);
|
content_sizer->AddSpacer(VERT_SPACING);
|
||||||
|
|
||||||
|
@ -175,7 +177,7 @@ MsgDataLegacy::MsgDataLegacy() :
|
||||||
)),
|
)),
|
||||||
ConfigWizard::name()
|
ConfigWizard::name()
|
||||||
));
|
));
|
||||||
text->Wrap(CONTENT_WIDTH);
|
text->Wrap(CONTENT_WIDTH * wxGetApp().em_unit());
|
||||||
content_sizer->Add(text);
|
content_sizer->Add(text);
|
||||||
content_sizer->AddSpacer(VERT_SPACING);
|
content_sizer->AddSpacer(VERT_SPACING);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue