mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-03 00:20:38 +08:00
Changed small_font to be a function; avoids initialization segfault (calling wxSystemSettings before wx is initialized).
This commit is contained in:
parent
4781a5ac4b
commit
339e5c1013
@ -154,7 +154,7 @@ Plater::Plater(wxWindow* parent, const wxString& title, std::shared_ptr<Settings
|
||||
auto* sizer {new wxBoxSizer(wxHORIZONTAL)};
|
||||
object_info_sizer->Add(sizer, 0, wxEXPAND | wxBOTTOM, 5);
|
||||
auto* text {new wxStaticText(this, wxID_ANY, _("Object:"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT)};
|
||||
text->SetFont(small_font);
|
||||
text->SetFont(small_font());
|
||||
sizer->Add(text, 0, wxALIGN_CENTER_VERTICAL);
|
||||
|
||||
/* We supply a bogus width to wxChoice (sizer will override it and stretch
|
||||
@ -162,7 +162,7 @@ Plater::Plater(wxWindow* parent, const wxString& title, std::shared_ptr<Settings
|
||||
* too much according to the contents, and this is bad with long file names.
|
||||
*/
|
||||
this->object_info.choice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxSize(100, -1));
|
||||
this->object_info.choice->SetFont(small_font);
|
||||
this->object_info.choice->SetFont(small_font());
|
||||
sizer->Add(this->object_info.choice, 1, wxALIGN_CENTER_VERTICAL);
|
||||
|
||||
// Select object on change.
|
||||
@ -183,11 +183,11 @@ Plater::Plater(wxWindow* parent, const wxString& title, std::shared_ptr<Settings
|
||||
{
|
||||
wxString name {"Manifold:"};
|
||||
auto* text {new wxStaticText(parent, wxID_ANY, name, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT)};
|
||||
text->SetFont(small_font);
|
||||
text->SetFont(small_font());
|
||||
grid_sizer->Add(text, 0);
|
||||
|
||||
this->object_info.manifold = new wxStaticText(parent, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
|
||||
this->object_info.manifold->SetFont(small_font);
|
||||
this->object_info.manifold->SetFont(small_font());
|
||||
|
||||
this->object_info.manifold_warning_icon = new wxStaticBitmap(this, wxID_ANY, wxBitmap(var("error.png"), wxBITMAP_TYPE_PNG));
|
||||
this->object_info.manifold_warning_icon->Hide();
|
||||
@ -1088,7 +1088,7 @@ void Plater::build_preset_chooser() {
|
||||
break;
|
||||
}
|
||||
auto* text {new wxStaticText(this, wxID_ANY, name, wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT)};
|
||||
text->SetFont(small_font);
|
||||
text->SetFont(small_font());
|
||||
|
||||
auto* choice {new wxBitmapComboBox(this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_READONLY)};
|
||||
this->preset_choosers[static_cast<int>(group)] = choice;
|
||||
|
@ -266,11 +266,11 @@ template <typename T>
|
||||
static void add_info_field(wxWindow* parent, T*& field, wxString name, wxGridSizer* sizer) {
|
||||
name << ":";
|
||||
auto* text {new wxStaticText(parent, wxID_ANY, name, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT)};
|
||||
text->SetFont(small_font);
|
||||
text->SetFont(small_font());
|
||||
sizer->Add(text, 0);
|
||||
|
||||
field = new wxStaticText(parent, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
|
||||
field->SetFont(small_font);
|
||||
field->SetFont(small_font());
|
||||
sizer->Add(field, 0);
|
||||
}
|
||||
|
||||
|
@ -147,5 +147,7 @@ std::vector<wxString> open_model(wxWindow* parent, const Settings& settings, wxW
|
||||
return tmp;
|
||||
}
|
||||
|
||||
wxFont small_font() { return wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); }
|
||||
|
||||
}} // namespace Slic3r::GUI
|
||||
|
||||
|
@ -51,8 +51,8 @@ constexpr bool isDev = false;
|
||||
|
||||
constexpr bool threaded = false;
|
||||
|
||||
const wxFont small_font { wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT) };
|
||||
|
||||
/// Font definition
|
||||
wxFont small_font();
|
||||
|
||||
// hopefully the compiler is smart enough to figure this out
|
||||
const std::map<const std::string, const std::string> FILE_WILDCARDS {
|
||||
|
Loading…
x
Reference in New Issue
Block a user