mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-11 14:49:03 +08:00
Set the bitmap type (needed for wxMSW) and check that the load happens before trying to use it.
This commit is contained in:
parent
aba90c705a
commit
a57a9dc700
@ -17,12 +17,7 @@ MainFrame::MainFrame(const wxString& title, const wxPoint& pos, const wxSize& si
|
||||
: wxFrame(NULL, wxID_ANY, title, pos, size), loaded(false),
|
||||
tabpanel(nullptr), controller(nullptr), plater(nullptr), gui_config(_gui_config), preset_editor_tabs(std::map<wxWindowID, PresetEditor*>())
|
||||
{
|
||||
// Set icon to either the .ico if windows or png for everything else.
|
||||
if (the_os == OS::Windows)
|
||||
this->SetIcon(wxIcon(var("Slic3r.ico"), wxBITMAP_TYPE_ICO));
|
||||
else
|
||||
this->SetIcon(wxIcon(var("Slic3r_128px.png"), wxBITMAP_TYPE_PNG));
|
||||
|
||||
this->SetIcon(wxIcon(var("Slic3r_128px.png"), wxBITMAP_TYPE_PNG));
|
||||
|
||||
this->init_tabpanel();
|
||||
this->init_menubar();
|
||||
|
@ -115,8 +115,13 @@ void append_menu_item(wxMenu* menu, const wxString& name,const wxString& help, T
|
||||
tmp->SetAccel(a); // set the accelerator if and only if the accelerator is fine
|
||||
}
|
||||
tmp->SetHelp(help);
|
||||
if (!icon.IsEmpty())
|
||||
tmp->SetBitmap(wxBitmap(var(icon)));
|
||||
if (!icon.IsEmpty()) {
|
||||
wxBitmap ico;
|
||||
if(ico.LoadFile(var(icon), wxBITMAP_TYPE_PNG))
|
||||
tmp->SetBitmap(ico);
|
||||
else
|
||||
std::cerr<< var(icon) << " failed to load \n";
|
||||
}
|
||||
|
||||
if (typeid(lambda) != typeid(nullptr))
|
||||
menu->Bind(wxEVT_MENU, lambda, tmp->GetId(), tmp->GetId());
|
||||
|
Loading…
x
Reference in New Issue
Block a user