Using of wxWidgets 3.1.6 WIP:

* Create Cache of wxBitmapBundles instead of wxBitmaps
* Use wxBitmapBundles instead of wxBitmap for most of Widgets
* Use empty bitmabundles instead of wxNullBitmap for wxBitmapComboBoxes.
* Updated wxWidgets.cmake
* OSX specific: Discard BitmapComboBox overrides
+ some code cleaning
This commit is contained in:
YuSanka 2022-05-10 12:24:04 +02:00 committed by Lukas Matena
parent e21921f2eb
commit 066b567714
45 changed files with 930 additions and 867 deletions

View file

@ -180,7 +180,6 @@ public:
bool showing_manifold_warning_icon;
void show_sizer(bool show);
void msw_rescale();
void update_warning_icon(const std::string& warning_icon_name);
};
@ -210,7 +209,7 @@ ObjectInfo::ObjectInfo(wxWindow *parent) :
init_info_label(&info_size, _L("Size"));
info_icon = new wxStaticBitmap(parent, wxID_ANY, create_scaled_bitmap("info"));
info_icon = new wxStaticBitmap(parent, wxID_ANY, *get_bmp_bundle("info"));
info_icon->SetToolTip(_L("For a multipart object, this value isn't accurate.\n"
"It doesn't take account of intersections and negative volumes."));
auto* volume_info_sizer = new wxBoxSizer(wxHORIZONTAL);
@ -223,7 +222,7 @@ ObjectInfo::ObjectInfo(wxWindow *parent) :
info_manifold = new wxStaticText(parent, wxID_ANY, "");
info_manifold->SetFont(wxGetApp().small_font());
manifold_warning_icon = new wxStaticBitmap(parent, wxID_ANY, create_scaled_bitmap(m_warning_icon_name));
manifold_warning_icon = new wxStaticBitmap(parent, wxID_ANY, *get_bmp_bundle(m_warning_icon_name));
auto *sizer_manifold = new wxBoxSizer(wxHORIZONTAL);
sizer_manifold->Add(manifold_warning_icon, 0, wxLEFT, 2);
sizer_manifold->Add(info_manifold, 0, wxLEFT, 2);
@ -242,17 +241,11 @@ void ObjectInfo::show_sizer(bool show)
manifold_warning_icon->Show(showing_manifold_warning_icon && show);
}
void ObjectInfo::msw_rescale()
{
manifold_warning_icon->SetBitmap(create_scaled_bitmap(m_warning_icon_name));
info_icon->SetBitmap(create_scaled_bitmap("info"));
}
void ObjectInfo::update_warning_icon(const std::string& warning_icon_name)
{
if ((showing_manifold_warning_icon = !warning_icon_name.empty())) {
m_warning_icon_name = warning_icon_name;
manifold_warning_icon->SetBitmap(create_scaled_bitmap(m_warning_icon_name));
manifold_warning_icon->SetBitmap(*get_bmp_bundle(m_warning_icon_name));
}
}
@ -350,9 +343,6 @@ void FreqChangedParams::msw_rescale()
{
m_og->msw_rescale();
m_og_sla->msw_rescale();
for (auto btn: m_empty_buttons)
btn->msw_rescale();
}
void FreqChangedParams::sys_color_changed()
@ -361,7 +351,7 @@ void FreqChangedParams::sys_color_changed()
m_og_sla->sys_color_changed();
for (auto btn: m_empty_buttons)
btn->msw_rescale();
btn->sys_color_changed();
wxGetApp().UpdateDarkUI(m_wiping_dialog_button, true);
}
@ -450,7 +440,7 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent) :
*/
auto empty_widget = [this] (wxWindow* parent) {
auto sizer = new wxBoxSizer(wxHORIZONTAL);
auto btn = new ScalableButton(parent, wxID_ANY, "mirroring_transparent.png", wxEmptyString,
auto btn = new ScalableButton(parent, wxID_ANY, "mirroring_transparent", wxEmptyString,
wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER | wxTRANSPARENT_WINDOW);
sizer->Add(btn, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, int(0.3 * wxGetApp().em_unit()));
m_empty_buttons.push_back(btn);
@ -508,7 +498,7 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent) :
}
}));
auto btn = new ScalableButton(parent, wxID_ANY, "mirroring_transparent.png", wxEmptyString,
auto btn = new ScalableButton(parent, wxID_ANY, "mirroring_transparent", wxEmptyString,
wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER | wxTRANSPARENT_WINDOW);
sizer->Add(btn , 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT,
int(0.3 * wxGetApp().em_unit()));
@ -1103,9 +1093,6 @@ void Sidebar::msw_rescale()
{
SetMinSize(wxSize(40 * wxGetApp().em_unit(), -1));
if (p->mode_sizer)
p->mode_sizer->msw_rescale();
for (PlaterPresetComboBox* combo : std::vector<PlaterPresetComboBox*> { p->combo_print,
p->combo_sla_print,
p->combo_sla_material,
@ -1117,14 +1104,8 @@ void Sidebar::msw_rescale()
p->frequently_changed_parameters->msw_rescale();
p->object_list->msw_rescale();
p->object_manipulation->msw_rescale();
p->object_settings->msw_rescale();
p->object_layers->msw_rescale();
p->object_info->msw_rescale();
p->btn_send_gcode->msw_rescale();
// p->btn_eject_device->msw_rescale();
p->btn_export_gcode_removable->msw_rescale();
#ifdef _WIN32
const int scaled_height = p->btn_export_gcode_removable->GetBitmapHeight();
#else
@ -1145,14 +1126,13 @@ void Sidebar::sys_color_changed()
for (wxWindow* win : std::vector<wxWindow*>{ this, p->sliced_info->GetStaticBox(), p->object_info->GetStaticBox(), p->btn_reslice, p->btn_export_gcode })
wxGetApp().UpdateDarkUI(win);
p->object_info->msw_rescale();
for (wxWindow* win : std::vector<wxWindow*>{ p->scrolled, p->presets_panel })
wxGetApp().UpdateAllStaticTextDarkUI(win);
for (wxWindow* btn : std::vector<wxWindow*>{ p->btn_reslice, p->btn_export_gcode })
wxGetApp().UpdateDarkUI(btn, true);
if (p->mode_sizer)
p->mode_sizer->msw_rescale();
p->mode_sizer->sys_color_changed();
p->frequently_changed_parameters->sys_color_changed();
p->object_settings->sys_color_changed();
#endif
@ -1170,11 +1150,12 @@ void Sidebar::sys_color_changed()
p->object_layers->sys_color_changed();
// btn...->msw_rescale() updates icon on button, so use it
p->btn_send_gcode->msw_rescale();
p->btn_send_gcode->sys_color_changed();
// p->btn_eject_device->msw_rescale();
p->btn_export_gcode_removable->msw_rescale();
p->btn_export_gcode_removable->sys_color_changed();
p->scrolled->Layout();
p->scrolled->Refresh();
p->searcher.dlg_sys_color_changed();
}
@ -6974,8 +6955,6 @@ void Plater::msw_rescale()
p->sidebar->msw_rescale();
p->menus.msw_rescale();
Layout();
GetParent()->Layout();
}