Fixes to support wxWidgets 3.1.6(7), 3.2.0

+Updated URL and URL HASH for wxWidgets v3.2.0-patched
This commit is contained in:
YuSanka 2022-07-25 14:19:03 +02:00 committed by Lukas Matena
parent 9a7e024f78
commit e21921f2eb
14 changed files with 93 additions and 39 deletions

View File

@ -13,8 +13,8 @@ if (UNIX AND NOT APPLE) # wxWidgets will not use char as the underlying type for
endif() endif()
prusaslicer_add_cmake_project(wxWidgets prusaslicer_add_cmake_project(wxWidgets
URL https://github.com/prusa3d/wxWidgets/archive/5412ac15586da3ecb6952fcc875d2a23366c998f.zip URL https://github.com/prusa3d/wxWidgets/archive/2a0b365df947138c513a888d707d46248d78a341.zip
URL_HASH SHA256=85a6e13152289fbf1ea51f221fbe1452e7914bbaa665b89536780810e93948a6 URL_HASH SHA256=9ab05cd5179196fad4ae702c78eaae9418e73a402cfd390f7438e469b13eb735
DEPENDS ${PNG_PKG} ${ZLIB_PKG} ${EXPAT_PKG} dep_TIFF dep_JPEG dep_NanoSVG DEPENDS ${PNG_PKG} ${ZLIB_PKG} ${EXPAT_PKG} dep_TIFF dep_JPEG dep_NanoSVG
CMAKE_ARGS CMAKE_ARGS
-DwxBUILD_PRECOMP=ON -DwxBUILD_PRECOMP=ON

View File

@ -223,8 +223,9 @@ AboutDialog::AboutDialog()
main_sizer->Add(hsizer, 0, wxEXPAND | wxALL, 20); main_sizer->Add(hsizer, 0, wxEXPAND | wxALL, 20);
// logo // logo
m_logo_bitmap = ScalableBitmap(this, wxGetApp().logo_name(), 192); // m_logo_bitmap = ScalableBitmap(this, wxGetApp().logo_name(), 192);
m_logo = new wxStaticBitmap(this, wxID_ANY, m_logo_bitmap.bmp()); // m_logo = new wxStaticBitmap(this, wxID_ANY, m_logo_bitmap.bmp());
m_logo = new wxStaticBitmap(this, wxID_ANY, wxBitmapBundle::FromSVGFile(Slic3r::var(wxGetApp().logo_name()+".svg"), wxSize(192, 192)));
hsizer->Add(m_logo, 1, wxALIGN_CENTER_VERTICAL); hsizer->Add(m_logo, 1, wxALIGN_CENTER_VERTICAL);
wxBoxSizer* vsizer = new wxBoxSizer(wxVERTICAL); wxBoxSizer* vsizer = new wxBoxSizer(wxVERTICAL);
@ -324,8 +325,8 @@ AboutDialog::AboutDialog()
void AboutDialog::on_dpi_changed(const wxRect &suggested_rect) void AboutDialog::on_dpi_changed(const wxRect &suggested_rect)
{ {
m_logo_bitmap.msw_rescale(); // m_logo_bitmap.msw_rescale();
m_logo->SetBitmap(m_logo_bitmap.bmp()); // m_logo->SetBitmap(m_logo_bitmap.bmp());
const wxFont& font = GetFont(); const wxFont& font = GetFont();
const int fs = font.GetPointSize() - 1; const int fs = font.GetPointSize() - 1;

View File

@ -166,7 +166,8 @@ int BitmapComboBox::Append(const wxString& item)
//2. But then set width to 0 value for no using of bitmap left and right spacing //2. But then set width to 0 value for no using of bitmap left and right spacing
//3. Set this empty bitmap to the at list one item and BitmapCombobox will be recreated correct //3. Set this empty bitmap to the at list one item and BitmapCombobox will be recreated correct
wxBitmap bitmap(1, int(1.6 * wxGetApp().em_unit() + 1)); // wxBitmap bitmap(1, int(1.6 * wxGetApp().em_unit() + 1));
wxBitmap bitmap(1, 16);
{ {
// bitmap.SetWidth(0); is depricated now // bitmap.SetWidth(0); is depricated now
// so, use next code // so, use next code
@ -268,6 +269,7 @@ void BitmapComboBox::DrawBackground_(wxDC& dc, const wxRect& rect, int WXUNUSED(
void BitmapComboBox::Rescale() void BitmapComboBox::Rescale()
{ {
return;
// Next workaround: To correct scaling of a BitmapCombobox // Next workaround: To correct scaling of a BitmapCombobox
// we need to refill control with new bitmaps // we need to refill control with new bitmaps
const wxString selection = this->GetValue(); const wxString selection = this->GetValue();

View File

@ -2099,6 +2099,15 @@ bool GUI_App::load_language(wxString language, bool initial)
{ {
// Allocating a temporary locale will switch the default wxTranslations to its internal wxTranslations instance. // Allocating a temporary locale will switch the default wxTranslations to its internal wxTranslations instance.
wxLocale temp_locale; wxLocale temp_locale;
#ifdef __WXOSX__
// ysFIXME - temporary workaround till it isn't fixed in wxWidgets:
// Use English as an initial language, because of under OSX it try to load "inappropriate" language for wxLANGUAGE_DEFAULT.
// For example in our case it's trying to load "en_CZ" and as a result PrusaSlicer catch warning message.
// But wxWidgets guys work on it.
temp_locale.Init(wxLANGUAGE_ENGLISH);
#else
temp_locale.Init();
#endif // __WXOSX__
// Set the current translation's language to default, otherwise GetBestTranslation() may not work (see the wxWidgets source code). // Set the current translation's language to default, otherwise GetBestTranslation() may not work (see the wxWidgets source code).
wxTranslations::Get()->SetLanguage(wxLANGUAGE_DEFAULT); wxTranslations::Get()->SetLanguage(wxLANGUAGE_DEFAULT);
// Let the wxFileTranslationsLoader enumerate all translation dictionaries for PrusaSlicer // Let the wxFileTranslationsLoader enumerate all translation dictionaries for PrusaSlicer
@ -2239,7 +2248,7 @@ void GUI_App::update_mode()
{ {
sidebar().update_mode(); sidebar().update_mode();
#ifdef _MSW_DARK_MODE #ifdef _WIN32 //_MSW_DARK_MODE
if (!wxGetApp().tabs_as_menu()) if (!wxGetApp().tabs_as_menu())
dynamic_cast<Notebook*>(mainframe->m_tabpanel)->UpdateMode(); dynamic_cast<Notebook*>(mainframe->m_tabpanel)->UpdateMode();
#endif #endif

View File

@ -142,13 +142,20 @@ std::map<std::string, std::string> SettingsFactory::CATEGORY_ICON =
{ L("Hollowing") , "hollowing" } { L("Hollowing") , "hollowing" }
}; };
wxBitmap SettingsFactory::get_category_bitmap(const std::string& category_name, bool menu_bmp /*= true*/) //wxBitmap SettingsFactory::get_category_bitmap(const std::string& category_name, bool menu_bmp /*= true*/)
wxBitmap SettingsFactory::get_category_bitmap_(const std::string& category_name, bool menu_bmp /*= true*/)
{ {
if (CATEGORY_ICON.find(category_name) == CATEGORY_ICON.end()) if (CATEGORY_ICON.find(category_name) == CATEGORY_ICON.end())
return wxNullBitmap; return wxNullBitmap;
return menu_bmp ? create_menu_bitmap(CATEGORY_ICON.at(category_name)) : create_scaled_bitmap(CATEGORY_ICON.at(category_name)); return /*menu_bmp ? create_menu_bitmap(CATEGORY_ICON.at(category_name)) : */create_scaled_bitmap(CATEGORY_ICON.at(category_name));
} }
wxBitmapBundle SettingsFactory::get_category_bitmap(const std::string& category_name)
{
if (CATEGORY_ICON.find(category_name) == CATEGORY_ICON.end())
return wxNullBitmap;
return create_menu_bitmap(CATEGORY_ICON.at(category_name));
}
//------------------------------------- //-------------------------------------
// MenuFactory // MenuFactory
@ -435,7 +442,8 @@ std::vector<wxBitmap> MenuFactory::get_volume_bitmaps()
std::vector<wxBitmap> volume_bmps; std::vector<wxBitmap> volume_bmps;
volume_bmps.reserve(ADD_VOLUME_MENU_ITEMS.size()); volume_bmps.reserve(ADD_VOLUME_MENU_ITEMS.size());
for (auto item : ADD_VOLUME_MENU_ITEMS) for (auto item : ADD_VOLUME_MENU_ITEMS)
volume_bmps.push_back(create_menu_bitmap(item.second)); // volume_bmps.push_back(create_menu_bitmap(item.second));
volume_bmps.push_back(create_scaled_bitmap(item.second, nullptr, 16, false, "", true));
return volume_bmps; return volume_bmps;
} }

View File

@ -25,7 +25,9 @@ struct SettingsFactory
typedef std::map<std::string, std::vector<std::string>> Bundle; typedef std::map<std::string, std::vector<std::string>> Bundle;
static std::map<std::string, std::string> CATEGORY_ICON; static std::map<std::string, std::string> CATEGORY_ICON;
static wxBitmap get_category_bitmap(const std::string& category_name, bool menu_bmp = true); // static wxBitmap get_category_bitmap(const std::string& category_name, bool menu_bmp = true);
static wxBitmap get_category_bitmap_(const std::string& category_name, bool menu_bmp = true);
static wxBitmapBundle get_category_bitmap(const std::string& category_name);
static Bundle get_bundle(const DynamicPrintConfig* config, bool is_object_settings); static Bundle get_bundle(const DynamicPrintConfig* config, bool is_object_settings);
static std::vector<std::string> get_options(bool is_part); static std::vector<std::string> get_options(bool is_part);
}; };

View File

@ -57,8 +57,8 @@ KBShortcutsDialog::KBShortcutsDialog()
void KBShortcutsDialog::on_dpi_changed(const wxRect& suggested_rect) void KBShortcutsDialog::on_dpi_changed(const wxRect& suggested_rect)
{ {
m_logo_bmp.msw_rescale(); //m_logo_bmp.msw_rescale();
m_header_bitmap->SetBitmap(m_logo_bmp.bmp()); //m_header_bitmap->SetBitmap(m_logo_bmp.bmp());
msw_buttons_rescale(this, em_unit(), { wxID_OK }); msw_buttons_rescale(this, em_unit(), { wxID_OK });
Layout(); Layout();
@ -266,8 +266,10 @@ wxPanel* KBShortcutsDialog::create_header(wxWindow* parent, const wxFont& bold_f
sizer->AddStretchSpacer(); sizer->AddStretchSpacer();
// logo // logo
m_logo_bmp = ScalableBitmap(this, wxGetApp().logo_name(), 32); //m_logo_bmp = ScalableBitmap(this, wxGetApp().logo_name(), 32);
m_header_bitmap = new wxStaticBitmap(panel, wxID_ANY, m_logo_bmp.bmp()); //m_header_bitmap = new wxStaticBitmap(panel, wxID_ANY, m_logo_bmp.bmp());
m_header_bitmap = new wxStaticBitmap(panel, wxID_ANY, wxBitmapBundle::FromSVGFile(Slic3r::var(wxGetApp().logo_name() + ".svg"), wxSize(32, 32)));
sizer->Add(m_header_bitmap, 0, wxEXPAND | wxLEFT | wxRIGHT, 10); sizer->Add(m_header_bitmap, 0, wxEXPAND | wxLEFT | wxRIGHT, 10);
// text // text

View File

@ -99,9 +99,17 @@ void MsgDialog::apply_style(long style)
if (style & wxNO) add_button(wxID_NO, (style & wxNO_DEFAULT)); if (style & wxNO) add_button(wxID_NO, (style & wxNO_DEFAULT));
if (style & wxCANCEL) add_button(wxID_CANCEL, (style & wxCANCEL_DEFAULT)); if (style & wxCANCEL) add_button(wxID_CANCEL, (style & wxCANCEL_DEFAULT));
#if 0
logo->SetBitmap( create_scaled_bitmap(style & wxICON_WARNING ? "exclamation" : logo->SetBitmap( create_scaled_bitmap(style & wxICON_WARNING ? "exclamation" :
style & wxICON_INFORMATION ? "info" : style & wxICON_INFORMATION ? "info" :
style & wxICON_QUESTION ? "question" : "PrusaSlicer", this, 64, style & wxICON_ERROR)); style & wxICON_QUESTION ? "question" : "PrusaSlicer", this, 64, style & wxICON_ERROR));
#else
std::string icon_name = style & wxICON_WARNING ? "exclamation" :
style & wxICON_INFORMATION ? "info" :
style & wxICON_QUESTION ? "question" : "PrusaSlicer";
icon_name += ".svg";
logo->SetBitmap(wxBitmapBundle::FromSVGFile(Slic3r::var(icon_name), wxSize(64, 64)));
#endif
} }
void MsgDialog::finalize() void MsgDialog::finalize()

View File

@ -191,7 +191,7 @@ void ObjectDataViewModelNode::update_settings_digest_bitmaps()
if (bmp == nullptr) { if (bmp == nullptr) {
std::vector<wxBitmap> bmps; std::vector<wxBitmap> bmps;
for (auto& category : m_opt_categories) for (auto& category : m_opt_categories)
bmps.emplace_back(SettingsFactory::get_category_bitmap(category, false)); bmps.emplace_back(SettingsFactory::get_category_bitmap_(category, false));
bmp = m_bitmap_cache->insert(scaled_bitmap_name, bmps); bmp = m_bitmap_cache->insert(scaled_bitmap_name, bmps);
} }

View File

@ -376,8 +376,8 @@ void PresetComboBox::msw_rescale()
{ {
m_em_unit = em_unit(this); m_em_unit = em_unit(this);
m_bitmapIncompatible.msw_rescale(); //m_bitmapIncompatible.msw_rescale();
m_bitmapCompatible.msw_rescale(); //m_bitmapCompatible.msw_rescale();
// parameters for an icon's drawing // parameters for an icon's drawing
fill_width_height(); fill_width_height();
@ -403,7 +403,8 @@ void PresetComboBox::fill_width_height()
* So set sizes for solid_colored icons used for filament preset * So set sizes for solid_colored icons used for filament preset
* and scale them in respect to em_unit value * and scale them in respect to em_unit value
*/ */
const float scale_f = (float)m_em_unit * 0.1f; // const float scale_f = (float)m_em_unit * 0.1f;
const float scale_f = 1.0f;
thin_icon_width = lroundf(8 * scale_f); // analogue to 8px; thin_icon_width = lroundf(8 * scale_f); // analogue to 8px;
wide_icon_width = norm_icon_width + thin_icon_width; wide_icon_width = norm_icon_width + thin_icon_width;

View File

@ -102,8 +102,10 @@ SysInfoDialog::SysInfoDialog()
main_sizer->Add(hsizer, 1, wxEXPAND | wxALL, 10); main_sizer->Add(hsizer, 1, wxEXPAND | wxALL, 10);
// logo // logo
m_logo_bmp = ScalableBitmap(this, wxGetApp().logo_name(), 192); //m_logo_bmp = ScalableBitmap(this, wxGetApp().logo_name(), 192);
m_logo = new wxStaticBitmap(this, wxID_ANY, m_logo_bmp.bmp()); //m_logo = new wxStaticBitmap(this, wxID_ANY, m_logo_bmp.bmp());
m_logo = new wxStaticBitmap(this, wxID_ANY, wxBitmapBundle::FromSVGFile(Slic3r::var(wxGetApp().logo_name() + ".svg"), wxSize(192, 192)));
hsizer->Add(m_logo, 0, wxALIGN_CENTER_VERTICAL); hsizer->Add(m_logo, 0, wxALIGN_CENTER_VERTICAL);
wxBoxSizer* vsizer = new wxBoxSizer(wxVERTICAL); wxBoxSizer* vsizer = new wxBoxSizer(wxVERTICAL);
@ -194,8 +196,8 @@ SysInfoDialog::SysInfoDialog()
void SysInfoDialog::on_dpi_changed(const wxRect &suggested_rect) void SysInfoDialog::on_dpi_changed(const wxRect &suggested_rect)
{ {
m_logo_bmp.msw_rescale(); //m_logo_bmp.msw_rescale();
m_logo->SetBitmap(m_logo_bmp.bmp()); //m_logo->SetBitmap(m_logo_bmp.bmp());
wxFont font = get_default_font(this); wxFont font = get_default_font(this);
const int fs = font.GetPointSize() - 1; const int fs = font.GetPointSize() - 1;

View File

@ -772,8 +772,11 @@ void Tab::update_changed_tree_ui()
void Tab::update_undo_buttons() void Tab::update_undo_buttons()
{ {
m_undo_btn-> SetBitmap_(m_is_modified_values ? m_bmp_value_revert: m_bmp_white_bullet); m_undo_btn-> SetBitmap_(m_is_modified_values ? m_bmp_value_revert.name(): m_bmp_white_bullet.name());
m_undo_to_sys_btn-> SetBitmap_(m_is_nonsys_values ? *m_bmp_non_system : m_bmp_value_lock); m_undo_to_sys_btn-> SetBitmap_(m_is_nonsys_values ? m_bmp_non_system->name() : m_bmp_value_lock.name());
//m_undo_btn-> SetBitmap_(m_is_modified_values ? m_bmp_value_revert: m_bmp_white_bullet);
//m_undo_to_sys_btn-> SetBitmap_(m_is_nonsys_values ? *m_bmp_non_system : m_bmp_value_lock);
m_undo_btn->SetToolTip(m_is_modified_values ? m_ttg_value_revert : m_ttg_white_bullet); m_undo_btn->SetToolTip(m_is_modified_values ? m_ttg_value_revert : m_ttg_white_bullet);
m_undo_to_sys_btn->SetToolTip(m_is_nonsys_values ? *m_ttg_non_system : m_ttg_value_lock); m_undo_to_sys_btn->SetToolTip(m_is_nonsys_values ? *m_ttg_non_system : m_ttg_value_lock);

View File

@ -16,6 +16,7 @@
#include "Plater.hpp" #include "Plater.hpp"
#include "../Utils/MacDarkMode.hpp" #include "../Utils/MacDarkMode.hpp"
#include "BitmapComboBox.hpp" #include "BitmapComboBox.hpp"
#include "libslic3r/Utils.hpp"
#include "OG_CustomCtrl.hpp" #include "OG_CustomCtrl.hpp"
#include "libslic3r/Color.hpp" #include "libslic3r/Color.hpp"
@ -26,11 +27,13 @@ static std::map<int, std::string> msw_menuitem_bitmaps;
#ifdef __WXMSW__ #ifdef __WXMSW__
void msw_rescale_menu(wxMenu* menu) void msw_rescale_menu(wxMenu* menu)
{ {
return;
struct update_icons { struct update_icons {
static void run(wxMenuItem* item) { static void run(wxMenuItem* item) {
const auto it = msw_menuitem_bitmaps.find(item->GetId()); const auto it = msw_menuitem_bitmaps.find(item->GetId());
if (it != msw_menuitem_bitmaps.end()) { if (it != msw_menuitem_bitmaps.end()) {
const wxBitmap& item_icon = create_menu_bitmap(it->second); // const wxBitmap& item_icon = create_menu_bitmap(it->second);
const wxBitmapBundle& item_icon = create_menu_bitmap(it->second);
if (item_icon.IsOk()) if (item_icon.IsOk())
item->SetBitmap(item_icon); item->SetBitmap(item_icon);
} }
@ -63,7 +66,8 @@ void enable_menu_item(wxUpdateUIEvent& evt, std::function<bool()> const cb_condi
} }
wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const wxString& description, wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const wxString& description,
std::function<void(wxCommandEvent& event)> cb, const wxBitmap& icon, wxEvtHandler* event_handler, // std::function<void(wxCommandEvent& event)> cb, const wxBitmap& icon, wxEvtHandler* event_handler,
std::function<void(wxCommandEvent& event)> cb, const wxBitmapBundle& icon, wxEvtHandler* event_handler,
std::function<bool()> const cb_condition, wxWindow* parent, int insert_pos/* = wxNOT_FOUND*/) std::function<bool()> const cb_condition, wxWindow* parent, int insert_pos/* = wxNOT_FOUND*/)
{ {
if (id == wxID_ANY) if (id == wxID_ANY)
@ -100,7 +104,9 @@ wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const
if (id == wxID_ANY) if (id == wxID_ANY)
id = wxNewId(); id = wxNewId();
const wxBitmap& bmp = !icon.empty() ? create_menu_bitmap(icon) : wxNullBitmap; // FIXME: pass window ptr // const wxBitmap& bmp = !icon.empty() ? create_menu_bitmap(icon) : wxNullBitmap; // FIXME: pass window ptr
const wxBitmapBundle& bmp = !icon.empty() ? create_menu_bitmap(icon) : wxNullBitmap; // FIXME: pass window ptr
//#ifdef __WXMSW__ //#ifdef __WXMSW__
#ifndef __WXGTK__ #ifndef __WXGTK__
if (bmp.IsOk()) if (bmp.IsOk())
@ -420,9 +426,11 @@ int mode_icon_px_size()
#endif #endif
} }
wxBitmap create_menu_bitmap(const std::string& bmp_name) //wxBitmap create_menu_bitmap(const std::string& bmp_name)
wxBitmapBundle create_menu_bitmap(const std::string& bmp_name)
{ {
return create_scaled_bitmap(bmp_name, nullptr, 16, false, "", true); // return create_scaled_bitmap(bmp_name, nullptr, 16, false, "", true);
return wxBitmapBundle::FromSVGFile(Slic3r::var(bmp_name + ".svg"), wxSize(16, 16));
} }
// win is used to get a correct em_unit value // win is used to get a correct em_unit value
@ -601,6 +609,7 @@ void LockButton::SetLock(bool lock)
void LockButton::msw_rescale() void LockButton::msw_rescale()
{ {
return;
m_bmp_lock_closed.msw_rescale(); m_bmp_lock_closed.msw_rescale();
m_bmp_lock_closed_f.msw_rescale(); m_bmp_lock_closed_f.msw_rescale();
m_bmp_lock_open.msw_rescale(); m_bmp_lock_open.msw_rescale();
@ -639,7 +648,8 @@ ModeButton::ModeButton( wxWindow* parent,
const wxString& mode/* = wxEmptyString*/, const wxString& mode/* = wxEmptyString*/,
const std::string& icon_name/* = ""*/, const std::string& icon_name/* = ""*/,
int px_cnt/* = 16*/) : int px_cnt/* = 16*/) :
ScalableButton(parent, wxID_ANY, ScalableBitmap(parent, icon_name, px_cnt), mode, wxBU_EXACTFIT) // ScalableButton(parent, wxID_ANY, ScalableBitmap(parent, icon_name, px_cnt), mode, wxBU_EXACTFIT)
ScalableButton(parent, wxID_ANY, icon_name, mode, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT)
{ {
Init(mode); Init(mode);
} }
@ -852,9 +862,10 @@ ScalableButton::ScalableButton( wxWindow * parent,
Slic3r::GUI::wxGetApp().UpdateDarkUI(this); Slic3r::GUI::wxGetApp().UpdateDarkUI(this);
if (!icon_name.empty()) { if (!icon_name.empty()) {
SetBitmap(create_scaled_bitmap(icon_name, parent, m_px_cnt)); // SetBitmap(create_scaled_bitmap(icon_name, parent, m_px_cnt));
if (m_use_default_disabled_bitmap) SetBitmap(wxBitmapBundle::FromSVGFile(Slic3r::var(icon_name + ".svg"), wxSize(m_px_cnt, m_px_cnt)));
SetBitmapDisabled(create_scaled_bitmap(m_current_icon_name, m_parent, m_px_cnt, true)); //if (m_use_default_disabled_bitmap)
// SetBitmapDisabled(create_scaled_bitmap(m_current_icon_name, m_parent, m_px_cnt, true));
if (!label.empty()) if (!label.empty())
SetBitmapMargins(int(0.5* em_unit(parent)), 0); SetBitmapMargins(int(0.5* em_unit(parent)), 0);
} }
@ -896,7 +907,8 @@ bool ScalableButton::SetBitmap_(const std::string& bmp_name)
if (m_current_icon_name.empty()) if (m_current_icon_name.empty())
return false; return false;
wxBitmap bmp = create_scaled_bitmap(m_current_icon_name, m_parent, m_px_cnt); // wxBitmap bmp = create_scaled_bitmap(m_current_icon_name, m_parent, m_px_cnt);
wxBitmapBundle bmp = wxBitmapBundle::FromSVGFile(Slic3r::var(m_current_icon_name + ".svg"), wxSize(16, 16));
SetBitmap(bmp); SetBitmap(bmp);
SetBitmapCurrent(bmp); SetBitmapCurrent(bmp);
SetBitmapPressed(bmp); SetBitmapPressed(bmp);
@ -931,7 +943,8 @@ void ScalableButton::msw_rescale()
{ {
Slic3r::GUI::wxGetApp().UpdateDarkUI(this, m_has_border); Slic3r::GUI::wxGetApp().UpdateDarkUI(this, m_has_border);
if (!m_current_icon_name.empty()) { // if (!m_current_icon_name.empty()) {
if (0) {
wxBitmap bmp = create_scaled_bitmap(m_current_icon_name, m_parent, m_px_cnt); wxBitmap bmp = create_scaled_bitmap(m_current_icon_name, m_parent, m_px_cnt);
SetBitmap(bmp); SetBitmap(bmp);
SetBitmapCurrent(bmp); SetBitmapCurrent(bmp);

View File

@ -8,6 +8,7 @@
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/menu.h> #include <wx/menu.h>
#include <wx/bmpcbox.h> #include <wx/bmpcbox.h>
#include <wx/bmpbndl.h>
#include <wx/statbmp.h> #include <wx/statbmp.h>
#include <wx/timer.h> #include <wx/timer.h>
@ -22,7 +23,8 @@ inline void msw_rescale_menu(wxMenu* /* menu */) {}
#endif /* __WXMSW__ */ #endif /* __WXMSW__ */
wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const wxString& description, wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const wxString& description,
std::function<void(wxCommandEvent& event)> cb, const wxBitmap& icon, wxEvtHandler* event_handler = nullptr, // std::function<void(wxCommandEvent& event)> cb, const wxBitmap& icon, wxEvtHandler* event_handler = nullptr,
std::function<void(wxCommandEvent& event)> cb, const wxBitmapBundle& icon, wxEvtHandler* event_handler = nullptr,
std::function<bool()> const cb_condition = []() { return true;}, wxWindow* parent = nullptr, int insert_pos = wxNOT_FOUND); std::function<bool()> const cb_condition = []() { return true;}, wxWindow* parent = nullptr, int insert_pos = wxNOT_FOUND);
wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const wxString& description, wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const wxString& description,
std::function<void(wxCommandEvent& event)> cb, const std::string& icon = "", wxEvtHandler* event_handler = nullptr, std::function<void(wxCommandEvent& event)> cb, const std::string& icon = "", wxEvtHandler* event_handler = nullptr,
@ -49,7 +51,8 @@ void msw_buttons_rescale(wxDialog* dlg, const int em_unit, const std::vector<
int em_unit(wxWindow* win); int em_unit(wxWindow* win);
int mode_icon_px_size(); int mode_icon_px_size();
wxBitmap create_menu_bitmap(const std::string& bmp_name); //wxBitmap create_menu_bitmap(const std::string& bmp_name);
wxBitmapBundle create_menu_bitmap(const std::string& bmp_name);
wxBitmap create_scaled_bitmap(const std::string& bmp_name, wxWindow *win = nullptr, wxBitmap create_scaled_bitmap(const std::string& bmp_name, wxWindow *win = nullptr,
const int px_cnt = 16, const bool grayscale = false, const int px_cnt = 16, const bool grayscale = false,