Update wxWidgets to v3.2.1 (#2905)
* Upgrade wxWidgets to 3.2.1 Based on prusa3d/PrusaSlicer@9a7e024 Co-authored-by: tamasmeszaros <meszaros.q@gmail.com> * Implement BitmapCache * update wxExtensions while keeping legacy items * update dc.DrawBitmap calls to use get_bitmap * Fix GetSize/Width/Height calls * update BitmapComboBox * fix ifndef in wxExtensions.hpp * update my todos to OcraftyoneTODO * Get to a compilable state Everything seems to be working (including the plater). I am not seeing any graphical issues * fix extruder color icons * fix crash on opening support tab * remove GetBmpSize method from DropDown.cpp * Update TextInput to use bitmap bundles * update a TODO after testing * fix the rendering of the icons on combobox * fix a few todos * fix WipeTowerDialog.cpp * Overhaul WipeTowerDialog Removed simple version of the dialog since BBS removed the functionality but left the code. Center the table (only seen when the table is smaller than the minimum size of the dialog) Fix issue where editing a value causes the m_min_flush_label to change colors slightly Fix an issue where changing a value or running an auto calc changes the disabled value from "-" to "0" * update a few todos * Update some todos * Show dropdown when editing is started * Update NanoSVG.cmake Update NanoSVG to work with PR #2780 * Dim the icon on ComboBox when disabled * solve ObjectDataViewModel todos leaving colPrint and colEditing cases alone as it does not seem to impact anything * Update names in wxExtensions -Rename msw_rescale to sys_color_changed -Replace GetBmpSize, GetBmpWidth, GetBmpHeight with renamed version (same name without "Bmp") Both of these changes were also made by PrusaSlicer. Original Commit: Prusa3D/PrusaSlicer@066b567 Co-authored-by: YuSanka <yusanka@gmail.com> * update BitmapCache::from_svg disable finding bundle in the cache to match load_svg update to match values used in load_svg * Update ScalableButton change the signature and remove functions/vars pertaining to a default bmp fix TODOs in ScalableButton Original Commit: Prusa3D/PrusaSlicer@066b567 Co-authored-by: YuSanka <yusanka@gmail.com> * fix up some more todos in wxExtensions * update ScalableBitmap to use bmp bundles use wxBitmapBundle by default add flag to use old scaled bitmap function (specifically to solve issue with advanced toggle) * attempt to fix macos deps build * fix ubuntu build * Revert "attempt to fix macos deps build" Mistakenly made change to wrong file This reverts commit d9c20b51216db1d409aeb0420d9d901000ad1b00. * update wxWidgets patch an attempt to fix macOS build * Remove duplicate variable from OrcaSlicer.cpp * Fix macOS build issue * Fix blank DataViewItem being added to objects list * Filament ComboBox editor updates -Add show drop down feature to ObjectTable -Call finish editing when ComboBox is closed in ObjectList * remove Apple specific declarations missed during refactor * delete old wxWidgets patch * fix ubuntu seg fault * include patch from #2926 * update patch to include wxWidgets/wxWidgets@991a74c * fix deps not compiling on Windows * update WipeTowerDialog relocates the recalculate button back to its previous position changes the wording of the tip message label add spacing below the matrix * finish patching wxWidgets from prusa3d/PrusaSlicer@f8477d1 and prusa3d/PrusaSlicer@066b567 Co-authored-by: YuSanka <yusanka@gmail.com> * fix combobox crash * revert outside plate changes --------- Co-authored-by: tamasmeszaros <meszaros.q@gmail.com> Co-authored-by: YuSanka <yusanka@gmail.com>
This commit is contained in:
@@ -117,29 +117,21 @@ wxIcon ModelNode::get_bitmap(const wxString& color)
|
||||
wxBitmap ModelNode::get_bitmap(const wxString& color)
|
||||
#endif // __linux__
|
||||
{
|
||||
/* It's supposed that standard size of an icon is 48px*16px for 100% scaled display.
|
||||
* So set sizes for solid_colored icons used for filament preset
|
||||
* and scale them in respect to em_unit value
|
||||
*/
|
||||
const double em = em_unit(m_parent_win);
|
||||
const int icon_width = lround(6.4 * em);
|
||||
const int icon_height = lround(1.6 * em);
|
||||
|
||||
BitmapCache bmp_cache;
|
||||
ColorRGB rgb;
|
||||
decode_color(into_u8(color), rgb);
|
||||
// there is no need to scale created solid bitmap
|
||||
wxBitmap bmp = get_solid_bmp_bundle(64, 16, into_u8(color))->GetBitmapFor(m_parent_win);
|
||||
if (!m_toggle)
|
||||
bmp = bmp.ConvertToDisabled();
|
||||
#ifndef __linux__
|
||||
return bmp_cache.mksolid(icon_width, icon_height, rgb, true);
|
||||
return bmp;
|
||||
#else
|
||||
wxIcon icon;
|
||||
icon.CopyFromBitmap(bmp_cache.mksolid(icon_width, icon_height, rgb, true));
|
||||
icon.CopyFromBitmap(bmp);
|
||||
return icon;
|
||||
#endif // __linux__
|
||||
}
|
||||
|
||||
// option node
|
||||
ModelNode::ModelNode(ModelNode* parent, const wxString& text, const wxString& old_value, const wxString& new_value) :
|
||||
m_parent_win(parent->m_parent_win),
|
||||
m_parent(parent),
|
||||
m_old_color(old_value.StartsWith("#") ? old_value : ""),
|
||||
m_new_color(new_value.StartsWith("#") ? new_value : ""),
|
||||
@@ -204,18 +196,22 @@ void ModelNode::UpdateIcons()
|
||||
{
|
||||
// update icons for the colors, if any exists
|
||||
if (!m_old_color.IsEmpty())
|
||||
m_old_color_bmp = get_bitmap(m_toggle ? m_old_color : wxString::FromUTF8(grey.c_str()));
|
||||
m_old_color_bmp = get_bitmap(m_old_color);
|
||||
if (!m_new_color.IsEmpty())
|
||||
m_new_color_bmp = get_bitmap(m_toggle ? m_new_color : wxString::FromUTF8(grey.c_str()));
|
||||
m_new_color_bmp = get_bitmap(m_new_color);
|
||||
|
||||
// update main icon, if any exists
|
||||
if (m_icon_name.empty())
|
||||
return;
|
||||
|
||||
wxBitmap bmp = get_bmp_bundle(m_icon_name)->GetBitmapFor(m_parent_win);
|
||||
if (!m_toggle)
|
||||
bmp = bmp.ConvertToDisabled();
|
||||
|
||||
#ifdef __linux__
|
||||
m_icon.CopyFromBitmap(create_scaled_bitmap(m_icon_name, m_parent_win, 16, !m_toggle));
|
||||
m_icon.CopyFromBitmap(bmp);
|
||||
#else
|
||||
m_icon = create_scaled_bitmap(m_icon_name, m_parent_win, 16, !m_toggle);
|
||||
m_icon = bmp;
|
||||
#endif //__linux__
|
||||
}
|
||||
|
||||
@@ -1021,7 +1017,7 @@ void UnsavedChangesDialog::build(Preset::Type type, PresetCollection *dependent_
|
||||
// "Save" button
|
||||
if (ActionButtons::SAVE & m_buttons) add_btn(&m_save_btn, m_save_btn_id, "save", Action::Save, _L("Save"), false);
|
||||
|
||||
/* ScalableButton *cancel_btn = new ScalableButton(this, wxID_CANCEL, "cross", _L("Cancel"), wxDefaultSize, wxDefaultPosition, wxBORDER_DEFAULT, true, 24);
|
||||
/* ScalableButton *cancel_btn = new ScalableButton(this, wxID_CANCEL, "cross", _L("Cancel"), wxDefaultSize, wxDefaultPosition, wxBORDER_DEFAULT, 24);
|
||||
buttons->Add(cancel_btn, 1, wxLEFT | wxRIGHT, 5);
|
||||
cancel_btn->SetFont(btn_font);*/
|
||||
/* m_cancel_btn = new Button(this, _L("Cancel"));
|
||||
@@ -1708,7 +1704,7 @@ void UnsavedChangesDialog::on_dpi_changed(const wxRect& suggested_rect)
|
||||
void UnsavedChangesDialog::on_sys_color_changed()
|
||||
{
|
||||
//for (auto btn : { m_save_btn, m_transfer_btn, m_discard_btn } )
|
||||
//btn->msw_rescale();
|
||||
//btn->sys_color_changed();
|
||||
// msw_rescale updates just icons, so use it
|
||||
//m_tree->Rescale();
|
||||
|
||||
@@ -2115,10 +2111,16 @@ void DiffPresetDialog::on_dpi_changed(const wxRect&)
|
||||
const wxSize& size = wxSize(80 * em, 30 * em);
|
||||
SetMinSize(size);
|
||||
|
||||
auto rescale = [em](PresetComboBox* pcb) {
|
||||
pcb->msw_rescale();
|
||||
wxSize sz = wxSize(35 * em, -1);
|
||||
pcb->SetMinSize(sz);
|
||||
pcb->SetSize(sz);
|
||||
};
|
||||
|
||||
for (auto preset_combos : m_preset_combos) {
|
||||
preset_combos.presets_left->msw_rescale();
|
||||
preset_combos.equal_bmp->msw_rescale();
|
||||
preset_combos.presets_right->msw_rescale();
|
||||
rescale(preset_combos.presets_left);
|
||||
rescale(preset_combos.presets_right);
|
||||
}
|
||||
|
||||
m_tree->Rescale(em);
|
||||
@@ -2136,9 +2138,9 @@ void DiffPresetDialog::on_sys_color_changed()
|
||||
#endif
|
||||
|
||||
for (auto preset_combos : m_preset_combos) {
|
||||
preset_combos.presets_left->msw_rescale();
|
||||
preset_combos.equal_bmp->msw_rescale();
|
||||
preset_combos.presets_right->msw_rescale();
|
||||
preset_combos.presets_left->sys_color_changed();
|
||||
preset_combos.equal_bmp->sys_color_changed();
|
||||
preset_combos.presets_right->sys_color_changed();
|
||||
}
|
||||
// msw_rescale updates just icons, so use it
|
||||
m_tree->Rescale();
|
||||
|
||||
Reference in New Issue
Block a user