From 01398dd848bee19609e67e1bf30a57c928dada41 Mon Sep 17 00:00:00 2001 From: Ocraftyone Date: Wed, 22 Nov 2023 02:01:36 -0500 Subject: [PATCH] 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 --- src/slic3r/GUI/AMSMaterialsSetting.cpp | 2 +- src/slic3r/GUI/AboutDialog.cpp | 8 ++-- src/slic3r/GUI/AmsMappingPopup.cpp | 8 ++-- src/slic3r/GUI/Auxiliary.cpp | 20 ++++----- src/slic3r/GUI/CalibrationPanel.cpp | 4 +- src/slic3r/GUI/CameraPopup.cpp | 8 ++-- src/slic3r/GUI/ConfigWizard.cpp | 12 +++--- src/slic3r/GUI/GUI_Factories.cpp | 4 +- src/slic3r/GUI/GUI_ObjectLayers.cpp | 8 ++-- src/slic3r/GUI/ImageGrid.cpp | 10 ++--- src/slic3r/GUI/KBShortcutsDialog.cpp | 2 +- src/slic3r/GUI/MediaFilePanel.cpp | 6 +-- src/slic3r/GUI/PresetComboBoxes.cpp | 8 ++-- src/slic3r/GUI/RecenterDialog.cpp | 4 +- src/slic3r/GUI/Search.cpp | 3 +- src/slic3r/GUI/SelectMachine.cpp | 44 +++++++++---------- src/slic3r/GUI/StatusPanel.cpp | 8 ++-- src/slic3r/GUI/Tab.cpp | 8 ++-- src/slic3r/GUI/TabButton.cpp | 8 ++-- src/slic3r/GUI/UpgradePanel.cpp | 20 ++++----- src/slic3r/GUI/Widgets/AMSControl.cpp | 43 +++++++++---------- src/slic3r/GUI/Widgets/AxisCtrlButton.cpp | 3 +- src/slic3r/GUI/Widgets/Button.cpp | 8 ++-- src/slic3r/GUI/Widgets/CheckBox.cpp | 24 +++++------ src/slic3r/GUI/Widgets/DropDown.cpp | 2 +- src/slic3r/GUI/Widgets/FanControl.cpp | 13 +++--- src/slic3r/GUI/Widgets/ImageSwitchButton.cpp | 12 +++--- src/slic3r/GUI/Widgets/RadioBox.cpp | 10 ++--- src/slic3r/GUI/Widgets/SideButton.cpp | 6 +-- src/slic3r/GUI/Widgets/SideTools.cpp | 36 ++++++++-------- src/slic3r/GUI/Widgets/StaticLine.cpp | 12 +++--- src/slic3r/GUI/Widgets/StepCtrl.cpp | 26 +++++------ src/slic3r/GUI/Widgets/SwitchButton.cpp | 6 +-- src/slic3r/GUI/Widgets/TempInput.cpp | 22 +++++----- src/slic3r/GUI/Widgets/TextInput.cpp | 2 +- src/slic3r/GUI/wxExtensions.cpp | 45 +++++++------------- src/slic3r/GUI/wxExtensions.hpp | 25 ++++++----- 37 files changed, 241 insertions(+), 249 deletions(-) diff --git a/src/slic3r/GUI/AMSMaterialsSetting.cpp b/src/slic3r/GUI/AMSMaterialsSetting.cpp index 197b232957..43852c43aa 100644 --- a/src/slic3r/GUI/AMSMaterialsSetting.cpp +++ b/src/slic3r/GUI/AMSMaterialsSetting.cpp @@ -1048,7 +1048,7 @@ void AMSMaterialsSetting::on_dpi_changed(const wxRect &suggested_rect) m_input_nozzle_max->GetTextCtrl()->SetSize(wxSize(-1, FromDIP(20))); m_input_nozzle_min->GetTextCtrl()->SetSize(wxSize(-1, FromDIP(20))); //m_clr_picker->msw_rescale(); - degree->msw_rescale(); + degree->sys_color_changed(); bitmap_max_degree->SetBitmap(degree->bmp()); bitmap_min_degree->SetBitmap(degree->bmp()); m_button_reset->SetMinSize(AMS_MATERIALS_SETTING_BUTTON_SIZE); diff --git a/src/slic3r/GUI/AboutDialog.cpp b/src/slic3r/GUI/AboutDialog.cpp index 8f3fe0f130..de4aca579c 100644 --- a/src/slic3r/GUI/AboutDialog.cpp +++ b/src/slic3r/GUI/AboutDialog.cpp @@ -19,7 +19,7 @@ AboutDialogLogo::AboutDialogLogo(wxWindow* parent) { this->SetBackgroundColour(*wxWHITE); this->logo = ScalableBitmap(this, Slic3r::var("OrcaSlicer_192px.png"), wxBITMAP_TYPE_PNG); - this->SetMinSize(this->logo.GetBmpSize()); + this->SetMinSize(this->logo.GetSize()); this->Bind(wxEVT_PAINT, &AboutDialogLogo::onRepaint, this); } @@ -30,8 +30,8 @@ void AboutDialogLogo::onRepaint(wxEvent &event) dc.SetBackgroundMode(wxTRANSPARENT); wxSize size = this->GetSize(); - int logo_w = this->logo.GetBmpWidth(); - int logo_h = this->logo.GetBmpHeight(); + int logo_w = this->logo.GetWidth(); + int logo_h = this->logo.GetHeight(); dc.DrawBitmap(this->logo.get_bitmap(), (size.GetWidth() - logo_w)/2, (size.GetHeight() - logo_h)/2, true); event.Skip(); @@ -380,7 +380,7 @@ AboutDialog::AboutDialog() void AboutDialog::on_dpi_changed(const wxRect &suggested_rect) { - m_logo_bitmap.msw_rescale(); + m_logo_bitmap.sys_color_changed(); m_logo->SetBitmap(m_logo_bitmap.bmp()); const wxFont& font = GetFont(); diff --git a/src/slic3r/GUI/AmsMappingPopup.cpp b/src/slic3r/GUI/AmsMappingPopup.cpp index 803d516aaa..c4bfac3e22 100644 --- a/src/slic3r/GUI/AmsMappingPopup.cpp +++ b/src/slic3r/GUI/AmsMappingPopup.cpp @@ -247,10 +247,10 @@ void MaterialItem::doRender(wxDC &dc) //arrow if ( (acolor.Red() > 160 && acolor.Green() > 160 && acolor.Blue() > 160) && (acolor.Red() < 180 && acolor.Green() < 180 && acolor.Blue() < 180)) { - dc.DrawBitmap(m_arraw_bitmap_white.get_bitmap(), GetSize().x - m_arraw_bitmap_white.GetBmpSize().x - FromDIP(7), GetSize().y - m_arraw_bitmap_white.GetBmpSize().y); + dc.DrawBitmap(m_arraw_bitmap_white.get_bitmap(), GetSize().x - m_arraw_bitmap_white.GetSize().x - FromDIP(7), GetSize().y - m_arraw_bitmap_white.GetSize().y); } else { - dc.DrawBitmap(m_arraw_bitmap_gray.get_bitmap(), GetSize().x - m_arraw_bitmap_gray.GetBmpSize().x - FromDIP(7), GetSize().y - m_arraw_bitmap_gray.GetBmpSize().y); + dc.DrawBitmap(m_arraw_bitmap_gray.get_bitmap(), GetSize().x - m_arraw_bitmap_gray.GetSize().x - FromDIP(7), GetSize().y - m_arraw_bitmap_gray.GetSize().y); } @@ -1493,7 +1493,7 @@ void AmsRMGroup::doRender(wxDC& dc) float startAngle = 0.0; float endAngle = 0.0; - dc.DrawBitmap(bitmap_bg.get_bitmap(), wxPoint((size.x - bitmap_bg.GetBmpSize().x) / 2, (size.y - bitmap_bg.GetBmpSize().y) / 2)); + dc.DrawBitmap(bitmap_bg.get_bitmap(), wxPoint((size.x - bitmap_bg.GetSize().x) / 2, (size.y - bitmap_bg.GetSize().y) / 2)); for (auto iter = m_group_info.rbegin(); iter != m_group_info.rend(); ++iter) { std::string tray_name = iter->first; @@ -1571,7 +1571,7 @@ void AmsRMGroup::doRender(wxDC& dc) dc.DrawEllipticArc(x - center_mask_radius, y - center_mask_radius, center_mask_radius * 2, center_mask_radius * 2, 0, 360); //draw center icon - dc.DrawBitmap(bitmap_backup_tips_0.get_bitmap(), wxPoint((size.x - bitmap_backup_tips_0.GetBmpSize().x) / 2, (size.y - bitmap_backup_tips_0.GetBmpSize().y) / 2)); + dc.DrawBitmap(bitmap_backup_tips_0.get_bitmap(), wxPoint((size.x - bitmap_backup_tips_0.GetSize().x) / 2, (size.y - bitmap_backup_tips_0.GetSize().y) / 2)); //dc.DrawBitmap(bitmap_backup_tips_1.bmp(), wxPoint((size.x - bitmap_backup_tips_1.GetBmpSize().x) / 2, (size.y - bitmap_backup_tips_1.GetBmpSize().y) / 2)); //draw material diff --git a/src/slic3r/GUI/Auxiliary.cpp b/src/slic3r/GUI/Auxiliary.cpp index 8f5aea81ac..2049fa88de 100644 --- a/src/slic3r/GUI/Auxiliary.cpp +++ b/src/slic3r/GUI/Auxiliary.cpp @@ -226,7 +226,7 @@ void AuFile::PaintBackground(wxDC &dc) dc.SetPen(AUFILE_GREY200); dc.SetBrush(AUFILE_GREY200); dc.DrawRoundedRectangle(0, 0, size.x, size.y, AUFILE_ROUNDING); - dc.DrawBitmap(m_file_bitmap.get_bitmap(), (size.x - m_file_bitmap.GetBmpWidth()) / 2, (size.y - m_file_bitmap.GetBmpHeight()) / 2); + dc.DrawBitmap(m_file_bitmap.get_bitmap(), (size.x - m_file_bitmap.GetWidth()) / 2, (size.y - m_file_bitmap.GetHeight()) / 2); } } @@ -257,7 +257,7 @@ void AuFile::PaintForeground(wxDC &dc) } if (m_type == MODEL_PICTURE) { - dc.DrawBitmap(m_file_edit_mask.get_bitmap(), 0, size.y - m_file_edit_mask.GetBmpSize().y); + dc.DrawBitmap(m_file_edit_mask.get_bitmap(), 0, size.y - m_file_edit_mask.GetSize().y); } @@ -268,14 +268,14 @@ void AuFile::PaintForeground(wxDC &dc) auto sizet = dc.GetTextExtent(cover_text_left); auto pos = wxPoint(0, 0); pos.x = (size.x / 2 - sizet.x) / 2; - pos.y = (size.y - (m_file_edit_mask.GetBmpSize().y + sizet.y) / 2); + pos.y = (size.y - (m_file_edit_mask.GetSize().y + sizet.y) / 2); dc.DrawText(cover_text_left, pos); // right text sizet = dc.GetTextExtent(cover_text_right); pos = wxPoint(0, 0); pos.x = size.x / 2 + (size.x / 2 - sizet.x) / 2; - pos.y = (size.y - (m_file_edit_mask.GetBmpSize().y + sizet.y) / 2); + pos.y = (size.y - (m_file_edit_mask.GetSize().y + sizet.y) / 2); dc.DrawText(cover_text_right, pos); // Split @@ -283,7 +283,7 @@ void AuFile::PaintForeground(wxDC &dc) dc.SetBrush(*wxWHITE); pos = wxPoint(0, 0); pos.x = size.x / 2 - 1; - pos.y = size.y - FromDIP(24) - (m_file_edit_mask.GetBmpSize().y - FromDIP(24)) / 2; + pos.y = size.y - FromDIP(24) - (m_file_edit_mask.GetSize().y - FromDIP(24)) / 2; dc.DrawRectangle(pos.x, pos.y, 2, FromDIP(24)); } else { // right text @@ -297,7 +297,7 @@ void AuFile::PaintForeground(wxDC &dc) if (m_cover) { dc.SetTextForeground(*wxWHITE); - dc.DrawBitmap(m_file_cover.get_bitmap(), size.x - m_file_cover.GetBmpSize().x, 0); + dc.DrawBitmap(m_file_cover.get_bitmap(), size.x - m_file_cover.GetSize().x, 0); dc.SetFont(Label::Body_12); auto sizet = dc.GetTextExtent(cover_text_cover); auto pos = wxPoint(0, 0); @@ -306,7 +306,7 @@ void AuFile::PaintForeground(wxDC &dc) dc.DrawText(cover_text_cover, pos); } - if (m_hover) { dc.DrawBitmap(m_file_delete.get_bitmap(), size.x - m_file_delete.GetBmpSize().x - FromDIP(10), FromDIP(10)); } + if (m_hover) { dc.DrawBitmap(m_file_delete.get_bitmap(), size.x - m_file_delete.GetSize().x - FromDIP(10), FromDIP(10)); } } void AuFile::on_mouse_enter(wxMouseEvent &evt) @@ -421,7 +421,7 @@ void AuFile::on_mouse_left_up(wxMouseEvent &evt) auto pos = evt.GetPosition(); // set cover - auto mask_size = wxSize(GetSize().x, m_file_edit_mask.GetBmpSize().y); + auto mask_size = wxSize(GetSize().x, m_file_edit_mask.GetSize().y); auto cover_left = 0; auto cover_top = size.y - mask_size.y; auto cover_right = mask_size.x / 2; @@ -443,10 +443,10 @@ void AuFile::on_mouse_left_up(wxMouseEvent &evt) if (pos.x > rename_left && pos.x < rename_right && pos.y > rename_top && pos.y < rename_bottom) { on_set_rename(); return; } // close - auto close_left = size.x - m_file_delete.GetBmpSize().x - FromDIP(10); + auto close_left = size.x - m_file_delete.GetSize().x - FromDIP(10); auto close_top = FromDIP(10); auto close_right = size.x - FromDIP(10); - auto close_bottom = m_file_delete.GetBmpSize().y + FromDIP(10); + auto close_bottom = m_file_delete.GetSize().y + FromDIP(10); if (pos.x > close_left && pos.x < close_right && pos.y > close_top && pos.y < close_bottom) { on_set_delete(); return; } exit_rename_mode(); diff --git a/src/slic3r/GUI/CalibrationPanel.cpp b/src/slic3r/GUI/CalibrationPanel.cpp index 2a17c9814a..f0d14f5943 100644 --- a/src/slic3r/GUI/CalibrationPanel.cpp +++ b/src/slic3r/GUI/CalibrationPanel.cpp @@ -102,9 +102,9 @@ void MObjectPanel::doRender(wxDC& dc) if (m_state == PrinterState::IN_LAN) { dwbitmap = m_printer_in_lan; } // dc.DrawCircle(left, size.y / 2, 3); - dc.DrawBitmap(dwbitmap.get_bitmap(), wxPoint(left, (size.y - dwbitmap.GetBmpSize().y) / 2)); + dc.DrawBitmap(dwbitmap.get_bitmap(), wxPoint(left, (size.y - dwbitmap.GetSize().y) / 2)); - left += dwbitmap.GetBmpSize().x + 8; + left += dwbitmap.GetSize().x + 8; dc.SetFont(Label::Body_13); dc.SetBackgroundMode(wxTRANSPARENT); dc.SetTextForeground(StateColor::darkModeColorFor(SELECT_MACHINE_GREY900)); diff --git a/src/slic3r/GUI/CameraPopup.cpp b/src/slic3r/GUI/CameraPopup.cpp index 0d1a40eb96..544e6faef6 100644 --- a/src/slic3r/GUI/CameraPopup.cpp +++ b/src/slic3r/GUI/CameraPopup.cpp @@ -470,8 +470,8 @@ CameraItem::CameraItem(wxWindow *parent, std::string normal, std::string hover) CameraItem::~CameraItem() {} void CameraItem::msw_rescale() { - m_bitmap_normal.msw_rescale(); - m_bitmap_hover.msw_rescale(); + m_bitmap_normal.sys_color_changed(); + m_bitmap_hover.sys_color_changed(); } void CameraItem::on_enter_win(wxMouseEvent &evt) @@ -519,9 +519,9 @@ void CameraItem::render(wxDC &dc) void CameraItem::doRender(wxDC &dc) { if (m_hover) { - dc.DrawBitmap(m_bitmap_hover.get_bitmap(), wxPoint((GetSize().x - m_bitmap_hover.GetBmpSize().x) / 2, (GetSize().y - m_bitmap_hover.GetBmpSize().y) / 2)); + dc.DrawBitmap(m_bitmap_hover.get_bitmap(), wxPoint((GetSize().x - m_bitmap_hover.GetSize().x) / 2, (GetSize().y - m_bitmap_hover.GetSize().y) / 2)); } else { - dc.DrawBitmap(m_bitmap_normal.get_bitmap(), wxPoint((GetSize().x - m_bitmap_normal.GetBmpSize().x) / 2, (GetSize().y - m_bitmap_normal.GetBmpSize().y) / 2)); + dc.DrawBitmap(m_bitmap_normal.get_bitmap(), wxPoint((GetSize().x - m_bitmap_normal.GetSize().x) / 2, (GetSize().y - m_bitmap_normal.GetSize().y) / 2)); } } diff --git a/src/slic3r/GUI/ConfigWizard.cpp b/src/slic3r/GUI/ConfigWizard.cpp index 6dff200df5..f59530ed0d 100644 --- a/src/slic3r/GUI/ConfigWizard.cpp +++ b/src/slic3r/GUI/ConfigWizard.cpp @@ -1655,9 +1655,9 @@ void ConfigWizardIndex::on_paint(wxPaintEvent & evt) } //draw logo - if (int y = size.y - bg.GetBmpHeight(); y>=0) { + if (int y = size.y - bg.GetHeight(); y>=0) { dc.DrawBitmap(bg.get_bitmap(), 0, y, false); - index_width = std::max(index_width, bg.GetBmpWidth() + em_w / 2); + index_width = std::max(index_width, bg.GetWidth() + em_w / 2); } if (GetMinSize().x < index_width) { @@ -1689,12 +1689,12 @@ void ConfigWizardIndex::msw_rescale() em_w = size.x; em_h = size.y; - bg.msw_rescale(); + bg.sys_color_changed(); SetMinSize(bg.GetSize()); - bullet_black.msw_rescale(); - bullet_blue.msw_rescale(); - bullet_white.msw_rescale(); + bullet_black.sys_color_changed(); + bullet_blue.sys_color_changed(); + bullet_white.sys_color_changed(); Refresh(); } diff --git a/src/slic3r/GUI/GUI_Factories.cpp b/src/slic3r/GUI/GUI_Factories.cpp index 899f3ddf83..849a2fd58e 100644 --- a/src/slic3r/GUI/GUI_Factories.cpp +++ b/src/slic3r/GUI/GUI_Factories.cpp @@ -1743,7 +1743,7 @@ void MenuFactory::update_default_menu() void MenuFactory::msw_rescale() { for (MenuWithSeparators* menu : { &m_object_menu, &m_sla_object_menu, &m_part_menu, &m_default_menu }) - msw_rescale_menu(dynamic_cast(menu)); + sys_color_changed_menu(dynamic_cast(menu)); } #ifdef _WIN32 @@ -1775,7 +1775,7 @@ static void update_menu_item_def_colors(T* item) void MenuFactory::sys_color_changed() { for (MenuWithSeparators* menu : { &m_object_menu, &m_sla_object_menu, &m_part_menu, &m_default_menu }) { - msw_rescale_menu(dynamic_cast(menu));// msw_rescale_menu updates just icons, so use it + sys_color_changed_menu(dynamic_cast(menu));// msw_rescale_menu updates just icons, so use it #ifdef _WIN32 // but under MSW we have to update item's bachground color for (wxMenuItem* item : menu->GetMenuItems()) diff --git a/src/slic3r/GUI/GUI_ObjectLayers.cpp b/src/slic3r/GUI/GUI_ObjectLayers.cpp index 135e109a6a..1e2b6db988 100644 --- a/src/slic3r/GUI/GUI_ObjectLayers.cpp +++ b/src/slic3r/GUI/GUI_ObjectLayers.cpp @@ -242,8 +242,8 @@ void ObjectLayers::UpdateAndShow(const bool show) void ObjectLayers::msw_rescale() { - m_bmp_delete.msw_rescale(); - m_bmp_add.msw_rescale(); + m_bmp_delete.sys_color_changed(); + m_bmp_add.sys_color_changed(); m_grid_sizer->SetHGap(wxGetApp().em_unit()); @@ -281,8 +281,8 @@ void ObjectLayers::msw_rescale() void ObjectLayers::sys_color_changed() { - m_bmp_delete.msw_rescale(); - m_bmp_add.msw_rescale(); + m_bmp_delete.sys_color_changed(); + m_bmp_add.sys_color_changed(); // rescale edit-boxes const int cells_cnt = m_grid_sizer->GetCols() * m_grid_sizer->GetEffectiveRowsCount(); diff --git a/src/slic3r/GUI/ImageGrid.cpp b/src/slic3r/GUI/ImageGrid.cpp index 59ce75023a..9b5a5dca1f 100644 --- a/src/slic3r/GUI/ImageGrid.cpp +++ b/src/slic3r/GUI/ImageGrid.cpp @@ -499,7 +499,7 @@ void ImageGrid::render(wxDC& dc) if (!m_file_sys || m_file_sys->GetCount() == 0) { dc.DrawRectangle({ 0, 0, size.x, size.y }); if (!m_status_msg.IsEmpty()) { - auto si = m_status_icon.GetBmpSize(); + auto si = m_status_icon.GetSize(); auto st = dc.GetTextExtent(m_status_msg); auto rect = wxRect{0, 0, max(st.x, si.x), si.y + 26 + st.y}.CenterIn(wxRect({0, 0}, size)); dc.DrawBitmap(m_status_icon.get_bitmap(), rect.x + (rect.width - si.x) / 2, rect.y); @@ -593,7 +593,7 @@ void Slic3r::GUI::ImageGrid::renderContent1(wxDC &dc, wxPoint const &pt, int ind bool show_download_state_always = true; // Draw checked icon if (m_selecting && !show_download_state_always) - dc.DrawBitmap(selected ? m_checked_icon.get_bitmap() : m_unchecked_icon.get_bitmap(), pt + wxPoint{10, m_content_rect.GetHeight() - m_checked_icon.GetBmpHeight() - 10}); + dc.DrawBitmap(selected ? m_checked_icon.get_bitmap() : m_unchecked_icon.get_bitmap(), pt + wxPoint{10, m_content_rect.GetHeight() - m_checked_icon.GetHeight() - 10}); // can't handle alpha // dc.GradientFillLinear({pt.x, pt.y, m_border_size.GetWidth(), 60}, wxColour(0x6F, 0x6F, 0x6F, 0x99), wxColour(0x6F, 0x6F, 0x6F, 0), wxBOTTOM); else if (m_file_sys->GetGroupMode() == PrinterFileSystem::G_NONE) { @@ -644,7 +644,7 @@ void Slic3r::GUI::ImageGrid::renderContent1(wxDC &dc, wxPoint const &pt, int ind dc.DrawText(date, pt + wxPoint{24, 16}); } if (m_selecting && show_download_state_always) - dc.DrawBitmap(selected ? m_checked_icon.get_bitmap() : m_unchecked_icon.get_bitmap(), pt + wxPoint{10, m_content_rect.GetHeight() - m_checked_icon.GetBmpHeight() - 10}); + dc.DrawBitmap(selected ? m_checked_icon.get_bitmap() : m_unchecked_icon.get_bitmap(), pt + wxPoint{10, m_content_rect.GetHeight() - m_checked_icon.GetHeight() - 10}); } void Slic3r::GUI::ImageGrid::renderContent2(wxDC &dc, wxPoint const &pt, int index, bool hit) @@ -736,8 +736,8 @@ void Slic3r::GUI::ImageGrid::renderText2(wxDC &dc, wxString text, wxRect const & void Slic3r::GUI::ImageGrid::renderIconText(wxDC & dc, ScalableBitmap const & icon, wxString text, wxRect const & rect) { - dc.DrawBitmap(icon.get_bitmap(), rect.x, rect.y + (rect.height - icon.GetBmpHeight()) / 2); - renderText2(dc, text, {rect.x + icon.GetBmpWidth() + 4, rect.y, rect.width - icon.GetBmpWidth() - 4, rect.height}); + dc.DrawBitmap(icon.get_bitmap(), rect.x, rect.y + (rect.height - icon.GetHeight()) / 2); + renderText2(dc, text, {rect.x + icon.GetWidth() + 4, rect.y, rect.width - icon.GetWidth() - 4, rect.height}); } }} diff --git a/src/slic3r/GUI/KBShortcutsDialog.cpp b/src/slic3r/GUI/KBShortcutsDialog.cpp index 7dde189cba..5d97dfaf01 100644 --- a/src/slic3r/GUI/KBShortcutsDialog.cpp +++ b/src/slic3r/GUI/KBShortcutsDialog.cpp @@ -155,7 +155,7 @@ wxWindow *KBShortcutsDialog::create_button(int id, wxString text) void KBShortcutsDialog::on_dpi_changed(const wxRect& suggested_rect) { - m_logo_bmp.msw_rescale(); + m_logo_bmp.sys_color_changed(); m_header_bitmap->SetBitmap(m_logo_bmp.bmp()); msw_buttons_rescale(this, em_unit(), { wxID_OK }); diff --git a/src/slic3r/GUI/MediaFilePanel.cpp b/src/slic3r/GUI/MediaFilePanel.cpp index a2f5e793c6..1ec805895b 100644 --- a/src/slic3r/GUI/MediaFilePanel.cpp +++ b/src/slic3r/GUI/MediaFilePanel.cpp @@ -347,9 +347,9 @@ void MediaFilePanel::SwitchStorage(bool external) void MediaFilePanel::Rescale() { - m_bmp_loading.msw_rescale(); - m_bmp_failed.msw_rescale(); - m_bmp_empty.msw_rescale(); + m_bmp_loading.sys_color_changed(); + m_bmp_failed.sys_color_changed(); + m_bmp_empty.sys_color_changed(); auto top_sizer = GetSizer()->GetItem((size_t) 0)->GetSizer(); top_sizer->SetMinSize({-1, 75 * em_unit(this) / 10}); diff --git a/src/slic3r/GUI/PresetComboBoxes.cpp b/src/slic3r/GUI/PresetComboBoxes.cpp index dec7c525be..fec529deac 100644 --- a/src/slic3r/GUI/PresetComboBoxes.cpp +++ b/src/slic3r/GUI/PresetComboBoxes.cpp @@ -417,8 +417,8 @@ void PresetComboBox::msw_rescale() m_em_unit = em_unit(this); Rescale(); - m_bitmapIncompatible.msw_rescale(); - m_bitmapCompatible.msw_rescale(); + m_bitmapIncompatible.sys_color_changed(); + m_bitmapCompatible.sys_color_changed(); // parameters for an icon's drawing fill_width_height(); @@ -437,8 +437,8 @@ void PresetComboBox::fill_width_height() { // To avoid asserts, each added bitmap to wxBitmapCombobox should be the same size, so // set a bitmap's height to m_bitmapCompatible->GetHeight() and norm_icon_width to m_bitmapCompatible->GetWidth() - icon_height = m_bitmapCompatible.GetBmpHeight(); - norm_icon_width = m_bitmapCompatible.GetBmpWidth(); + icon_height = m_bitmapCompatible.GetHeight(); + norm_icon_width = m_bitmapCompatible.GetWidth(); /* It's supposed that standard size of an icon is 16px*16px for 100% scaled display. * So set sizes for solid_colored icons used for filament preset diff --git a/src/slic3r/GUI/RecenterDialog.cpp b/src/slic3r/GUI/RecenterDialog.cpp index c852d42eca..783002b5fb 100644 --- a/src/slic3r/GUI/RecenterDialog.cpp +++ b/src/slic3r/GUI/RecenterDialog.cpp @@ -94,7 +94,7 @@ void RecenterDialog::render(wxDC& dc) { wxSize hint1_size = dc.GetTextExtent(hint1); wxPoint pos_hint1 = pos_start; - pos_hint1.y += (m_home_bmp.GetBmpWidth() - hint1_size.y) / 2; + pos_hint1.y += (m_home_bmp.GetWidth() - hint1_size.y) / 2; dc.DrawText(hint1, pos_hint1); wxPoint pos_bmp = pos_start; @@ -103,7 +103,7 @@ void RecenterDialog::render(wxDC& dc) { wxSize hint2_size = dc.GetTextExtent(hint2); wxPoint pos_hint2 = pos_hint1; - pos_hint2.x = pos_hint2.x + hint1_size.x + m_home_bmp.GetBmpWidth(); + pos_hint2.x = pos_hint2.x + hint1_size.x + m_home_bmp.GetWidth(); if (hint2_size.x + pos_hint2.x + BORDER > DRAW_PANEL_SIZE.x) { bool is_ch = false; diff --git a/src/slic3r/GUI/Search.cpp b/src/slic3r/GUI/Search.cpp index c7c0978b97..531f1965a7 100644 --- a/src/slic3r/GUI/Search.cpp +++ b/src/slic3r/GUI/Search.cpp @@ -875,7 +875,8 @@ void SearchListModel::Prepend(const std::string &label) void SearchListModel::msw_rescale() { - for (ScalableBitmap &bmp : m_icon) bmp.msw_rescale(); + for (ScalableBitmap &bmp : m_icon) + bmp.sys_color_changed(); } wxString SearchListModel::GetColumnType(unsigned int col) const diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp index 0346a2093c..efc35a6057 100644 --- a/src/slic3r/GUI/SelectMachine.cpp +++ b/src/slic3r/GUI/SelectMachine.cpp @@ -210,9 +210,9 @@ void MachineObjectPanel::doRender(wxDC &dc) if (m_state == PrinterState::IN_LAN) { dwbitmap = m_printer_in_lan; } // dc.DrawCircle(left, size.y / 2, 3); - dc.DrawBitmap(dwbitmap.get_bitmap(), wxPoint(left, (size.y - dwbitmap.GetBmpSize().y) / 2)); + dc.DrawBitmap(dwbitmap.get_bitmap(), wxPoint(left, (size.y - dwbitmap.GetSize().y) / 2)); - left += dwbitmap.GetBmpSize().x + 8; + left += dwbitmap.GetSize().x + 8; dc.SetFont(Label::Body_13); dc.SetBackgroundMode(wxTRANSPARENT); dc.SetTextForeground(StateColor::darkModeColorFor(SELECT_MACHINE_GREY900)); @@ -228,10 +228,10 @@ void MachineObjectPanel::doRender(wxDC &dc) auto text_end = 0; if (m_show_edit) { - text_end = size.x - m_unbind_img.GetBmpSize().x - 30; + text_end = size.x - m_unbind_img.GetSize().x - 30; } else { - text_end = size.x - m_unbind_img.GetBmpSize().x; + text_end = size.x - m_unbind_img.GetSize().x; } wxString finally_name = dev_name; @@ -259,14 +259,14 @@ void MachineObjectPanel::doRender(wxDC &dc) if (m_show_bind) { if (m_bind_state == ALLOW_UNBIND) { - left = size.x - m_unbind_img.GetBmpSize().x - 6; - dc.DrawBitmap(m_unbind_img.get_bitmap(), left, (size.y - m_unbind_img.GetBmpSize().y) / 2); + left = size.x - m_unbind_img.GetSize().x - 6; + dc.DrawBitmap(m_unbind_img.get_bitmap(), left, (size.y - m_unbind_img.GetSize().y) / 2); } } if (m_show_edit) { - left = size.x - m_unbind_img.GetBmpSize().x - 6 - m_edit_name_img.GetBmpSize().x - 6; - dc.DrawBitmap(m_edit_name_img.get_bitmap(), left, (size.y - m_edit_name_img.GetBmpSize().y) / 2); + left = size.x - m_unbind_img.GetSize().x - 6 - m_edit_name_img.GetSize().x - 6; + dc.DrawBitmap(m_edit_name_img.get_bitmap(), left, (size.y - m_edit_name_img.GetSize().y) / 2); } } @@ -296,10 +296,10 @@ void MachineObjectPanel::on_mouse_left_up(wxMouseEvent &evt) if (m_is_my_devices) { // show edit if (m_show_edit) { - auto edit_left = GetSize().x - m_unbind_img.GetBmpSize().x - 6 - m_edit_name_img.GetBmpSize().x - 6; - auto edit_right = edit_left + m_edit_name_img.GetBmpSize().x; - auto edit_top = (GetSize().y - m_edit_name_img.GetBmpSize().y) / 2; - auto edit_bottom = (GetSize().y - m_edit_name_img.GetBmpSize().y) / 2 + m_edit_name_img.GetBmpSize().y; + auto edit_left = GetSize().x - m_unbind_img.GetSize().x - 6 - m_edit_name_img.GetSize().x - 6; + auto edit_right = edit_left + m_edit_name_img.GetSize().x; + auto edit_top = (GetSize().y - m_edit_name_img.GetSize().y) / 2; + auto edit_bottom = (GetSize().y - m_edit_name_img.GetSize().y) / 2 + m_edit_name_img.GetSize().y; if ((evt.GetPosition().x >= edit_left && evt.GetPosition().x <= edit_right) && evt.GetPosition().y >= edit_top && evt.GetPosition().y <= edit_bottom) { wxCommandEvent event(EVT_EDIT_PRINT_NAME); event.SetEventObject(this); @@ -308,10 +308,10 @@ void MachineObjectPanel::on_mouse_left_up(wxMouseEvent &evt) } } if (m_show_bind) { - auto left = GetSize().x - m_unbind_img.GetBmpSize().x - 6; - auto right = left + m_unbind_img.GetBmpSize().x; - auto top = (GetSize().y - m_unbind_img.GetBmpSize().y) / 2; - auto bottom = (GetSize().y - m_unbind_img.GetBmpSize().y) / 2 + m_unbind_img.GetBmpSize().y; + auto left = GetSize().x - m_unbind_img.GetSize().x - 6; + auto right = left + m_unbind_img.GetSize().x; + auto top = (GetSize().y - m_unbind_img.GetSize().y) / 2; + auto bottom = (GetSize().y - m_unbind_img.GetSize().y) / 2 + m_unbind_img.GetSize().y; if ((evt.GetPosition().x >= left && evt.GetPosition().x <= right) && evt.GetPosition().y >= top && evt.GetPosition().y <= bottom) { wxCommandEvent event(EVT_UNBIND_MACHINE, GetId()); @@ -3421,16 +3421,16 @@ void SelectMachineDialog::Enable_Send_Button(bool en) void SelectMachineDialog::on_dpi_changed(const wxRect &suggested_rect) { - print_time->msw_rescale(); + print_time->sys_color_changed(); timeimg->SetBitmap(print_time->bmp()); - print_weight->msw_rescale(); + print_weight->sys_color_changed(); weightimg->SetBitmap(print_weight->bmp()); m_rename_button->msw_rescale(); - ams_editable->msw_rescale(); - ams_editable_light->msw_rescale(); - enable_ams_mapping->msw_rescale(); + ams_editable->sys_color_changed(); + ams_editable_light->sys_color_changed(); + enable_ams_mapping->sys_color_changed(); amsmapping_tip->SetBitmap(enable_ams_mapping->bmp()); - enable_ams->msw_rescale(); + enable_ams->sys_color_changed(); img_ams_tip->SetBitmap(enable_ams->bmp()); m_button_refresh->SetMinSize(SELECT_MACHINE_DIALOG_BUTTON_SIZE); diff --git a/src/slic3r/GUI/StatusPanel.cpp b/src/slic3r/GUI/StatusPanel.cpp index 3cfc14528e..47b9258a60 100644 --- a/src/slic3r/GUI/StatusPanel.cpp +++ b/src/slic3r/GUI/StatusPanel.cpp @@ -3973,8 +3973,8 @@ void StatusPanel::rescale_camera_icons() void StatusPanel::on_sys_color_changed() { m_project_task_panel->msw_rescale(); - m_bitmap_speed.msw_rescale(); - m_bitmap_speed_active.msw_rescale(); + m_bitmap_speed.sys_color_changed(); + m_bitmap_speed_active.sys_color_changed(); m_switch_speed->SetImages(m_bitmap_speed, m_bitmap_speed); m_ams_control->msw_rescale(); if (m_print_error_dlg) { m_print_error_dlg->msw_rescale(); } @@ -4012,8 +4012,8 @@ void StatusPanel::msw_rescale() m_tempCtrl_chamber->SetMinSize(TEMP_CTRL_MIN_SIZE); m_tempCtrl_chamber->Rescale(); - m_bitmap_speed.msw_rescale(); - m_bitmap_speed_active.msw_rescale(); + m_bitmap_speed.sys_color_changed(); + m_bitmap_speed_active.sys_color_changed(); m_switch_speed->SetImages(m_bitmap_speed, m_bitmap_speed); m_switch_speed->SetMinSize(MISC_BUTTON_2FAN_SIZE); diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 93b0437a85..c2b8ac26b4 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -1179,7 +1179,7 @@ void Tab::msw_rescale() for (const auto btn : m_scaled_buttons) btn->msw_rescale(); for (const auto bmp : m_scaled_bitmaps) - bmp->msw_rescale(); + bmp->sys_color_changed(); if (m_mode_view) m_mode_view->Rescale(); @@ -1189,7 +1189,7 @@ void Tab::msw_rescale() // rescale icons for tree_ctrl for (ScalableBitmap& bmp : m_scaled_icons_list) - bmp.msw_rescale(); + bmp.sys_color_changed(); // recreate and set new ImageList for tree_ctrl m_icons->RemoveAll(); m_icons = new wxImageList(m_scaled_icons_list.front().GetWidth(), m_scaled_icons_list.front().GetHeight(), false); @@ -1217,13 +1217,13 @@ void Tab::sys_color_changed() for (const auto btn : m_scaled_buttons) btn->msw_rescale(); for (const auto bmp : m_scaled_bitmaps) - bmp->msw_rescale(); + bmp->sys_color_changed(); if (m_detach_preset_btn) m_detach_preset_btn->msw_rescale(); // update icons for tree_ctrl for (ScalableBitmap& bmp : m_scaled_icons_list) - bmp.msw_rescale(); + bmp.sys_color_changed(); // recreate and set new ImageList for tree_ctrl m_icons->RemoveAll(); m_icons = new wxImageList(m_scaled_icons_list.front().GetWidth(), m_scaled_icons_list.front().GetHeight(), false); diff --git a/src/slic3r/GUI/TabButton.cpp b/src/slic3r/GUI/TabButton.cpp index 510696eb7e..66005a50ef 100644 --- a/src/slic3r/GUI/TabButton.cpp +++ b/src/slic3r/GUI/TabButton.cpp @@ -148,7 +148,7 @@ void TabButton::render(wxDC &dc) // BBS norrow size between text and icon szContent.x += 5; } - szIcon = icon.GetBmpSize(); + szIcon = icon.GetSize(); szContent.x += szIcon.x; if (szIcon.y > szContent.y) szContent.y = szIcon.y; } @@ -169,8 +169,8 @@ void TabButton::render(wxDC &dc) } if (icon.bmp().IsOk()) { - pt.x = size.x - icon.GetBmpWidth() - paddingSize.y; - pt.y = (size.y - icon.GetBmpHeight()) / 2; + pt.x = size.x - icon.GetWidth() - paddingSize.y; + pt.y = (size.y - icon.GetHeight()) / 2; dc.DrawBitmap(icon.get_bitmap(), pt); } } @@ -189,7 +189,7 @@ void TabButton::messureSize() // BBS norrow size between text and icon szContent.x += 5; } - wxSize szIcon = this->icon.GetBmpSize(); + wxSize szIcon = this->icon.GetSize(); szContent.x += szIcon.x; if (szIcon.y > szContent.y) szContent.y = szIcon.y; } diff --git a/src/slic3r/GUI/UpgradePanel.cpp b/src/slic3r/GUI/UpgradePanel.cpp index f83becd0e0..a42ebff985 100644 --- a/src/slic3r/GUI/UpgradePanel.cpp +++ b/src/slic3r/GUI/UpgradePanel.cpp @@ -317,15 +317,15 @@ void MachineInfoPanel::init_bitmaps() void MachineInfoPanel::rescale_bitmaps() { - m_img_printer.msw_rescale(); + m_img_printer.sys_color_changed(); m_printer_img->SetBitmap(m_img_printer.bmp()); - m_img_monitor_ams.msw_rescale(); + m_img_monitor_ams.sys_color_changed(); m_ams_img->SetBitmap(m_img_monitor_ams.bmp()); - m_img_ext.msw_rescale(); + m_img_ext.sys_color_changed(); m_ext_img->SetBitmap(m_img_ext.bmp()); - upgrade_green_icon.msw_rescale(); - upgrade_gray_icon.msw_rescale(); - upgrade_yellow_icon.msw_rescale(); + upgrade_green_icon.sys_color_changed(); + upgrade_gray_icon.sys_color_changed(); + upgrade_yellow_icon.sys_color_changed(); m_ota_new_version_img->SetBitmap(upgrade_green_icon.bmp()); } @@ -1145,8 +1145,8 @@ bool UpgradePanel::Show(bool show) } - void AmsPanel::msw_rescale() { - upgrade_green_icon.msw_rescale(); + void AmsPanel::msw_rescale() { + upgrade_green_icon.sys_color_changed(); m_ams_new_version_img->SetBitmap(upgrade_green_icon.bmp()); } @@ -1219,8 +1219,8 @@ bool UpgradePanel::Show(bool show) } void ExtensionPanel::msw_rescale() - { - upgrade_green_icon.msw_rescale(); + { + upgrade_green_icon.sys_color_changed(); m_ext_new_version_img->SetBitmap(upgrade_green_icon.bmp()); } diff --git a/src/slic3r/GUI/Widgets/AMSControl.cpp b/src/slic3r/GUI/Widgets/AMSControl.cpp index 335ebbb4f5..fb945a01fb 100644 --- a/src/slic3r/GUI/Widgets/AMSControl.cpp +++ b/src/slic3r/GUI/Widgets/AMSControl.cpp @@ -230,7 +230,7 @@ void AMSrefresh::paintEvent(wxPaintEvent &evt) auto colour = StateColor::darkModeColorFor(AMS_CONTROL_GRAY700); if (!wxWindow::IsEnabled()) { colour = AMS_CONTROL_GRAY500; } - auto pot = wxPoint((size.x - m_bitmap_selected.GetBmpSize().x) / 2, (size.y - m_bitmap_selected.GetBmpSize().y) / 2); + auto pot = wxPoint((size.x - m_bitmap_selected.GetSize().x) / 2, (size.y - m_bitmap_selected.GetSize().y) / 2); if (!m_disable_mode) { if (!m_play_loading) { @@ -360,7 +360,7 @@ void AMSextruderImage::doRender(wxDC &dc) dc.SetPen(*wxTRANSPARENT_PEN); dc.SetBrush(m_colour); dc.DrawRectangle(0, FromDIP(18), size.x, size.y - FromDIP(18) - FromDIP(5)); - dc.DrawBitmap(m_ams_extruder.get_bitmap(), wxPoint((size.x - m_ams_extruder.GetBmpSize().x) / 2, (size.y - m_ams_extruder.GetBmpSize().y) / 2)); + dc.DrawBitmap(m_ams_extruder.get_bitmap(), wxPoint((size.x - m_ams_extruder.GetSize().x) / 2, (size.y - m_ams_extruder.GetSize().y) / 2)); } @@ -688,11 +688,11 @@ void AMSLib::on_left_down(wxMouseEvent &evt) auto bottom = 0; if (m_ams_model == AMSModel::GENERIC_AMS) { - top = (size.y - FromDIP(15) - m_bitmap_editable_light.GetBmpSize().y); + top = (size.y - FromDIP(15) - m_bitmap_editable_light.GetSize().y); bottom = size.y - FromDIP(15); } else if (m_ams_model == AMSModel::EXTRA_AMS) { - top = (size.y - FromDIP(20) - m_bitmap_editable_light.GetBmpSize().y); + top = (size.y - FromDIP(20) - m_bitmap_editable_light.GetSize().y); bottom = size.y - FromDIP(20); } @@ -1015,21 +1015,21 @@ void AMSLib::render_extra_lib(wxDC& dc) if (m_info.material_state != AMSCanType::AMS_CAN_TYPE_EMPTY && m_info.material_state != AMSCanType::AMS_CAN_TYPE_NONE) { if (m_info.material_state == AMSCanType::AMS_CAN_TYPE_THIRDBRAND || m_info.material_state == AMSCanType::AMS_CAN_TYPE_VIRTUAL) - dc.DrawBitmap(temp_bitmap_third.get_bitmap(), (size.x - temp_bitmap_third.GetBmpSize().x) / 2 + FromDIP(2), (size.y - FromDIP(18) - temp_bitmap_third.GetBmpSize().y)); + dc.DrawBitmap(temp_bitmap_third.get_bitmap(), (size.x - temp_bitmap_third.GetSize().x) / 2 + FromDIP(2), (size.y - FromDIP(18) - temp_bitmap_third.GetSize().y)); if (m_info.material_state == AMSCanType::AMS_CAN_TYPE_BRAND) - dc.DrawBitmap(temp_bitmap_brand.get_bitmap(), (size.x - temp_bitmap_brand.GetBmpSize().x) / 2 + FromDIP(2), (size.y - FromDIP(18) - temp_bitmap_brand.GetBmpSize().y)); + dc.DrawBitmap(temp_bitmap_brand.get_bitmap(), (size.x - temp_bitmap_brand.GetSize().x) / 2 + FromDIP(2), (size.y - FromDIP(18) - temp_bitmap_brand.GetSize().y)); } } // selected & hover if (m_selected) { - dc.DrawBitmap(tray_bitmap_selected.get_bitmap(), (size.x - tray_bitmap_selected.GetBmpSize().x) / 2, (size.y - tray_bitmap_selected.GetBmpSize().y) / 2); + dc.DrawBitmap(tray_bitmap_selected.get_bitmap(), (size.x - tray_bitmap_selected.GetSize().x) / 2, (size.y - tray_bitmap_selected.GetSize().y) / 2); } else if (!m_selected && m_hover) { - dc.DrawBitmap(tray_bitmap_hover.get_bitmap(), (size.x - tray_bitmap_hover.GetBmpSize().x) / 2, (size.y - tray_bitmap_hover.GetBmpSize().y) / 2); + dc.DrawBitmap(tray_bitmap_hover.get_bitmap(), (size.x - tray_bitmap_hover.GetSize().x) / 2, (size.y - tray_bitmap_hover.GetSize().y) / 2); } else { - dc.DrawBitmap(tray_bitmap.get_bitmap(), (size.x - tray_bitmap.GetBmpSize().x) / 2, (size.y - tray_bitmap.GetBmpSize().y) / 2); + dc.DrawBitmap(tray_bitmap.get_bitmap(), (size.x - tray_bitmap.GetSize().x) / 2, (size.y - tray_bitmap.GetSize().y) / 2); } } @@ -1180,9 +1180,9 @@ void AMSLib::render_generic_lib(wxDC &dc) if (m_info.material_state != AMSCanType::AMS_CAN_TYPE_EMPTY && m_info.material_state != AMSCanType::AMS_CAN_TYPE_NONE) { if (m_info.material_state == AMSCanType::AMS_CAN_TYPE_THIRDBRAND || m_info.material_state == AMSCanType::AMS_CAN_TYPE_VIRTUAL) - dc.DrawBitmap(temp_bitmap_third.get_bitmap(), (size.x - temp_bitmap_third.GetBmpSize().x) / 2, (size.y - FromDIP(10) - temp_bitmap_third.GetBmpSize().y)); + dc.DrawBitmap(temp_bitmap_third.get_bitmap(), (size.x - temp_bitmap_third.GetSize().x) / 2, (size.y - FromDIP(10) - temp_bitmap_third.GetSize().y)); if (m_info.material_state == AMSCanType::AMS_CAN_TYPE_BRAND) - dc.DrawBitmap(temp_bitmap_brand.get_bitmap(), (size.x - temp_bitmap_brand.GetBmpSize().x) / 2, (size.y - FromDIP(10) - temp_bitmap_brand.GetBmpSize().y)); + dc.DrawBitmap(temp_bitmap_brand.get_bitmap(), (size.x - temp_bitmap_brand.GetSize().x) / 2, (size.y - FromDIP(10) - temp_bitmap_brand.GetSize().y)); } } } @@ -1237,8 +1237,7 @@ void AMSLib::UnSelected() bool AMSLib::Enable(bool enable) { return wxWindow::Enable(enable); } void AMSLib::msw_rescale() -{ - m_bitmap_transparent.msw_rescale(); +{ m_bitmap_transparent.sys_color_changed(); } /************************************************* @@ -1445,20 +1444,20 @@ void AMSRoad::doRender(wxDC &dc) else {m_show_humidity = false;} if (m_amsinfo.ams_humidity == 5) { - dc.DrawBitmap(ams_humidity_4.get_bitmap(), wxPoint(size.x - ams_humidity_4.GetBmpSize().x - FromDIP(4), size.y - ams_humidity_4.GetBmpSize().y - FromDIP(8))); + dc.DrawBitmap(ams_humidity_4.get_bitmap(), wxPoint(size.x - ams_humidity_4.GetSize().x - FromDIP(4), size.y - ams_humidity_4.GetSize().y - FromDIP(8))); } else if (m_amsinfo.ams_humidity == 4) { - dc.DrawBitmap(ams_humidity_3.get_bitmap(), wxPoint(size.x - ams_humidity_3.GetBmpSize().x - FromDIP(4), size.y - ams_humidity_3.GetBmpSize().y - FromDIP(8))); + dc.DrawBitmap(ams_humidity_3.get_bitmap(), wxPoint(size.x - ams_humidity_3.GetSize().x - FromDIP(4), size.y - ams_humidity_3.GetSize().y - FromDIP(8))); } else if (m_amsinfo.ams_humidity == 3) { - dc.DrawBitmap(ams_humidity_2.get_bitmap(), wxPoint(size.x - ams_humidity_2.GetBmpSize().x - FromDIP(4), size.y - ams_humidity_2.GetBmpSize().y - FromDIP(8))); + dc.DrawBitmap(ams_humidity_2.get_bitmap(), wxPoint(size.x - ams_humidity_2.GetSize().x - FromDIP(4), size.y - ams_humidity_2.GetSize().y - FromDIP(8))); } else if (m_amsinfo.ams_humidity == 2) { - dc.DrawBitmap(ams_humidity_1.get_bitmap(), wxPoint(size.x - ams_humidity_1.GetBmpSize().x - FromDIP(4), size.y - ams_humidity_1.GetBmpSize().y - FromDIP(8))); + dc.DrawBitmap(ams_humidity_1.get_bitmap(), wxPoint(size.x - ams_humidity_1.GetSize().x - FromDIP(4), size.y - ams_humidity_1.GetSize().y - FromDIP(8))); } else if (m_amsinfo.ams_humidity == 1) { - dc.DrawBitmap(ams_humidity_0.get_bitmap(), wxPoint(size.x - ams_humidity_0.GetBmpSize().x - FromDIP(4), size.y - ams_humidity_0.GetBmpSize().y - FromDIP(8))); + dc.DrawBitmap(ams_humidity_0.get_bitmap(), wxPoint(size.x - ams_humidity_0.GetSize().x - FromDIP(4), size.y - ams_humidity_0.GetSize().y - FromDIP(8))); } else { /*dc.DrawBitmap(ams_humidity_4.bmp(), wxPoint(size.x - ams_humidity_4.GetBmpSize().x - FromDIP(4), size.y - ams_humidity_4.GetBmpSize().y - FromDIP(8)));*/ @@ -2084,7 +2083,7 @@ void AmsCans::render(wxDC& dc) void AmsCans::doRender(wxDC& dc) { wxSize size = GetSize(); - dc.DrawBitmap(m_bitmap_extra_framework.get_bitmap(), (size.x - m_bitmap_extra_framework.GetBmpSize().x) / 2, (size.y - m_bitmap_extra_framework.GetBmpSize().y) / 2); + dc.DrawBitmap(m_bitmap_extra_framework.get_bitmap(), (size.x - m_bitmap_extra_framework.GetSize().x) / 2, (size.y - m_bitmap_extra_framework.GetSize().y) / 2); //road for extra if (m_ams_model == AMSModel::EXTRA_AMS) { @@ -2960,9 +2959,9 @@ void AMSControl::StopRridLoading(wxString amsid, wxString canid) void AMSControl::msw_rescale() { - m_button_ams_setting_normal.msw_rescale(); - m_button_ams_setting_hover.msw_rescale(); - m_button_ams_setting_press.msw_rescale(); + m_button_ams_setting_normal.sys_color_changed(); + m_button_ams_setting_hover.sys_color_changed(); + m_button_ams_setting_press.sys_color_changed(); m_button_ams_setting->SetBitmap(m_button_ams_setting_normal.bmp()); m_extruder->msw_rescale(); diff --git a/src/slic3r/GUI/Widgets/AxisCtrlButton.cpp b/src/slic3r/GUI/Widgets/AxisCtrlButton.cpp index b29ee22d51..d2a517cea5 100644 --- a/src/slic3r/GUI/Widgets/AxisCtrlButton.cpp +++ b/src/slic3r/GUI/Widgets/AxisCtrlButton.cpp @@ -212,7 +212,8 @@ void AxisCtrlButton::render(wxDC& dc) gc->DrawPath(home_path); if (m_icon.bmp().IsOk()) { - gc->DrawBitmap(m_icon.get_bitmap(), -1 * m_icon.GetBmpWidth() / 2, -1 * m_icon.GetBmpHeight() / 2, m_icon.GetBmpWidth(), m_icon.GetBmpHeight()); + gc->DrawBitmap(m_icon.get_bitmap(), -1 * m_icon.GetWidth() / 2, -1 * m_icon.GetHeight() / 2, m_icon.GetWidth(), + m_icon.GetHeight()); } gc->PopState(); diff --git a/src/slic3r/GUI/Widgets/Button.cpp b/src/slic3r/GUI/Widgets/Button.cpp index 43886e5862..cda2300599 100644 --- a/src/slic3r/GUI/Widgets/Button.cpp +++ b/src/slic3r/GUI/Widgets/Button.cpp @@ -146,10 +146,10 @@ bool Button::GetValue() const { return state_handler.states() & StateHandler::Ch void Button::Rescale() { if (this->active_icon.bmp().IsOk()) - this->active_icon.msw_rescale(); + this->active_icon.sys_color_changed(); if (this->inactive_icon.bmp().IsOk()) - this->inactive_icon.msw_rescale(); + this->inactive_icon.sys_color_changed(); messureSize(); } @@ -187,7 +187,7 @@ void Button::render(wxDC& dc) //BBS norrow size between text and icon szContent.x += padding; } - szIcon = icon.GetBmpSize(); + szIcon = icon.GetSize(); szContent.x += szIcon.x; if (szIcon.y > szContent.y) szContent.y = szIcon.y; @@ -239,7 +239,7 @@ void Button::messureSize() //BBS norrow size between text and icon szContent.x += 5; } - wxSize szIcon = this->active_icon.GetBmpSize(); + wxSize szIcon = this->active_icon.GetSize(); szContent.x += szIcon.x; if (szIcon.y > szContent.y) szContent.y = szIcon.y; diff --git a/src/slic3r/GUI/Widgets/CheckBox.cpp b/src/slic3r/GUI/Widgets/CheckBox.cpp index 8a9b05b50b..101ceedc0d 100644 --- a/src/slic3r/GUI/Widgets/CheckBox.cpp +++ b/src/slic3r/GUI/Widgets/CheckBox.cpp @@ -24,8 +24,8 @@ CheckBox::CheckBox(wxWindow *parent, int id) Bind(wxEVT_ENTER_WINDOW, &CheckBox::updateBitmap, this); Bind(wxEVT_LEAVE_WINDOW, &CheckBox::updateBitmap, this); #endif - SetSize(m_on.GetBmpSize()); - SetMinSize(m_on.GetBmpSize()); + SetSize(m_on.GetSize()); + SetMinSize(m_on.GetSize()); update(); } @@ -43,16 +43,16 @@ void CheckBox::SetHalfChecked(bool value) void CheckBox::Rescale() { - m_on.msw_rescale(); - m_half.msw_rescale(); - m_off.msw_rescale(); - m_on_disabled.msw_rescale(); - m_half_disabled.msw_rescale(); - m_off_disabled.msw_rescale(); - m_on_focused.msw_rescale(); - m_half_focused.msw_rescale(); - m_off_focused.msw_rescale(); - SetSize(m_on.GetBmpSize()); + m_on.sys_color_changed(); + m_half.sys_color_changed(); + m_off.sys_color_changed(); + m_on_disabled.sys_color_changed(); + m_half_disabled.sys_color_changed(); + m_off_disabled.sys_color_changed(); + m_on_focused.sys_color_changed(); + m_half_focused.sys_color_changed(); + m_off_focused.sys_color_changed(); + SetSize(m_on.GetSize()); update(); } diff --git a/src/slic3r/GUI/Widgets/DropDown.cpp b/src/slic3r/GUI/Widgets/DropDown.cpp index 193b9cd0e1..d6b12e8283 100644 --- a/src/slic3r/GUI/Widgets/DropDown.cpp +++ b/src/slic3r/GUI/Widgets/DropDown.cpp @@ -255,7 +255,7 @@ void DropDown::render(wxDC &dc) rcContent.x += 5; rcContent.width -= 5; if (check_bitmap.bmp().IsOk()) { - auto szBmp = check_bitmap.GetBmpSize(); + auto szBmp = check_bitmap.GetSize(); if (selection >= 0) { wxPoint pt = rcContent.GetLeftTop(); pt.y += (rcContent.height - szBmp.y) / 2; diff --git a/src/slic3r/GUI/Widgets/FanControl.cpp b/src/slic3r/GUI/Widgets/FanControl.cpp index 8488abc607..15bf78e5d6 100644 --- a/src/slic3r/GUI/Widgets/FanControl.cpp +++ b/src/slic3r/GUI/Widgets/FanControl.cpp @@ -62,8 +62,8 @@ void Fan::create(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSi // SetMinSize(wxSize(FromDIP(100), FromDIP(100) + FromDIP(6))); // SetMaxSize(wxSize(FromDIP(100), FromDIP(100) + FromDIP(6))); //#else - SetMinSize(wxSize(m_bitmap_bk.GetBmpSize().x, m_bitmap_bk.GetBmpSize().y + FromDIP(6))); - SetMaxSize(wxSize(m_bitmap_bk.GetBmpSize().x, m_bitmap_bk.GetBmpSize().y + FromDIP(6))); + SetMinSize(wxSize(m_bitmap_bk.GetSize().x, m_bitmap_bk.GetSize().y + FromDIP(6))); + SetMaxSize(wxSize(m_bitmap_bk.GetSize().x, m_bitmap_bk.GetSize().y + FromDIP(6))); //#endif // __APPLE__ Bind(wxEVT_PAINT, &Fan::paintEvent, this); @@ -133,7 +133,7 @@ void Fan::doRender(wxDC& dc) //fan pointer //auto pointer_central_point = wxPoint((size.x - m_img_pointer.GetSize().x) / 2, (size.y - m_img_pointer.GetSize().y) / 2); //auto bmp = m_img_pointer.Rotate(m_rotate_offsets[m_current_speeds].rotate, wxPoint(size.x / 2,size.y / 2)); - auto central_point = wxPoint((size.x - m_bitmap_scales[m_current_speeds].GetBmpSize().x) / 2, (size.y - m_bitmap_scales[m_current_speeds].GetBmpSize().y) / 2 - FromDIP(4)); + auto central_point = wxPoint((size.x - m_bitmap_scales[m_current_speeds].GetSize().x) / 2, (size.y - m_bitmap_scales[m_current_speeds].GetSize().y) / 2 - FromDIP(4)); dc.DrawBitmap(m_bitmap_scales[m_current_speeds].get_bitmap(), central_point.x, central_point.y); //fan val @@ -147,8 +147,7 @@ void Fan::doRender(wxDC& dc) //dc.DrawText(rpm, (size.x - dc.GetTextExtent(rpm).x) / 2, size.y - dc.GetTextExtent(rpm).y); } -void Fan::msw_rescale() { - m_bitmap_bk.msw_rescale(); +void Fan::msw_rescale() { m_bitmap_bk.sys_color_changed(); } void Fan::DoSetSize(int x, int y, int width, int height, int sizeFlags) @@ -280,8 +279,8 @@ void FanOperate::doRender(wxDC& dc) dc.DrawLine(left_fir, FromDIP(4), left_fir, size.y - FromDIP(4)); dc.DrawLine(left_fir * 2, FromDIP(4), left_fir * 2, size.y - FromDIP(4)); - dc.DrawBitmap(m_bitmap_decrease.get_bitmap(), (left_fir - m_bitmap_decrease.GetBmpSize().x) / 2, (size.y - m_bitmap_decrease.GetBmpSize().y) / 2); - dc.DrawBitmap(m_bitmap_add.get_bitmap(), (left_fir * 2 + (left_fir - m_bitmap_decrease.GetBmpSize().x) / 2), (size.y - m_bitmap_add.GetBmpSize().y) / 2); + dc.DrawBitmap(m_bitmap_decrease.get_bitmap(), (left_fir - m_bitmap_decrease.GetSize().x) / 2, (size.y - m_bitmap_decrease.GetSize().y) / 2); + dc.DrawBitmap(m_bitmap_add.get_bitmap(), (left_fir * 2 + (left_fir - m_bitmap_decrease.GetSize().x) / 2), (size.y - m_bitmap_add.GetSize().y) / 2); //txt dc.SetFont(::Label::Body_12); diff --git a/src/slic3r/GUI/Widgets/ImageSwitchButton.cpp b/src/slic3r/GUI/Widgets/ImageSwitchButton.cpp index 1f5d327f36..d14bbb03fd 100644 --- a/src/slic3r/GUI/Widgets/ImageSwitchButton.cpp +++ b/src/slic3r/GUI/Widgets/ImageSwitchButton.cpp @@ -110,12 +110,12 @@ void ImageSwitchButton::render(wxDC& dc) wxSize szContent = textSize; ScalableBitmap &icon = GetValue() ? m_on : m_off; - int content_height = icon.GetBmpHeight() + textSize.y + m_padding; + int content_height = icon.GetHeight() + textSize.y + m_padding; - wxPoint pt = wxPoint((size.x - icon.GetBmpWidth()) / 2, (size.y - content_height) / 2); + wxPoint pt = wxPoint((size.x - icon.GetWidth()) / 2, (size.y - content_height) / 2); if (icon.bmp().IsOk()) { dc.DrawBitmap(icon.get_bitmap(), pt); - pt.y += m_padding + icon.GetBmpHeight(); + pt.y += m_padding + icon.GetHeight(); } pt.x = (size.x - textSize.x) / 2; dc.SetFont(GetFont()); @@ -273,7 +273,7 @@ void FanSwitchButton::render(wxDC& dc) //int content_height = icon.GetBmpHeight() + textSize.y + m_padding; int content_height = m_padding; - wxPoint pt = wxPoint((size.x - icon.GetBmpWidth()) / 2, (size.y - content_height) / 2); + wxPoint pt = wxPoint((size.x - icon.GetWidth()) / 2, (size.y - content_height) / 2); pt.x = (size.x - textSize.x) / 2; dc.SetFont(GetFont()); @@ -298,10 +298,10 @@ void FanSwitchButton::render(wxDC& dc) dc.DrawText(fina_txt, wxPoint(pt.x, content_height)); } - pt = wxPoint((size.x - icon.GetBmpWidth()) / 2, content_height + textSize.y); + pt = wxPoint((size.x - icon.GetWidth()) / 2, content_height + textSize.y); if (icon.bmp().IsOk()) { dc.DrawBitmap(icon.get_bitmap(), pt); - pt.y += m_padding + icon.GetBmpHeight(); + pt.y += m_padding + icon.GetHeight(); } auto speed = wxString::Format("%d%%", m_speed); diff --git a/src/slic3r/GUI/Widgets/RadioBox.cpp b/src/slic3r/GUI/Widgets/RadioBox.cpp index 2720542e07..d4d530ba8a 100644 --- a/src/slic3r/GUI/Widgets/RadioBox.cpp +++ b/src/slic3r/GUI/Widgets/RadioBox.cpp @@ -10,8 +10,8 @@ RadioBox::RadioBox(wxWindow *parent) // SetBackgroundStyle(wxBG_STYLE_TRANSPARENT); if (parent) SetBackgroundColour(parent->GetBackgroundColour()); // Bind(wxEVT_TOGGLEBUTTON, [this](auto& e) { update(); e.Skip(); }); - SetSize(m_on.GetBmpSize()); - SetMinSize(m_on.GetBmpSize()); + SetSize(m_on.GetSize()); + SetMinSize(m_on.GetSize()); update(); } @@ -29,9 +29,9 @@ bool RadioBox::GetValue() void RadioBox::Rescale() { - m_on.msw_rescale(); - m_off.msw_rescale(); - SetSize(m_on.GetBmpSize()); + m_on.sys_color_changed(); + m_off.sys_color_changed(); + SetSize(m_on.GetSize()); update(); } diff --git a/src/slic3r/GUI/Widgets/SideButton.cpp b/src/slic3r/GUI/Widgets/SideButton.cpp index aeab1daf97..c657e519b7 100644 --- a/src/slic3r/GUI/Widgets/SideButton.cpp +++ b/src/slic3r/GUI/Widgets/SideButton.cpp @@ -157,7 +157,7 @@ bool SideButton::Enable(bool enable) void SideButton::Rescale() { if (this->icon.bmp().IsOk()) - this->icon.msw_rescale(); + this->icon.sys_color_changed(); messureSize(); } @@ -246,7 +246,7 @@ void SideButton::dorender(wxDC& dc, wxDC& text_dc) //BBS norrow size between text and icon szContent.x += 5; } - szIcon = icon.GetBmpSize(); + szIcon = icon.GetSize(); szContent.x += szIcon.x; if (szIcon.y > szContent.y) szContent.y = szIcon.y; @@ -299,7 +299,7 @@ void SideButton::messureSize() if (szContent.y > 0) { szContent.x += 5; } - wxSize szIcon = this->icon.GetBmpSize(); + wxSize szIcon = this->icon.GetSize(); szContent.x += szIcon.x; if (szIcon.y > szContent.y) szContent.y = szIcon.y; diff --git a/src/slic3r/GUI/Widgets/SideTools.cpp b/src/slic3r/GUI/Widgets/SideTools.cpp index 88245f5898..ea412c48c2 100644 --- a/src/slic3r/GUI/Widgets/SideTools.cpp +++ b/src/slic3r/GUI/Widgets/SideTools.cpp @@ -138,19 +138,19 @@ void SideToolsPanel::doRender(wxDC &dc) dc.SetBrush(SIDE_TOOLS_BRAND); dc.DrawRectangle(0, 0, size.x, size.y); - dc.DrawBitmap(m_none_printing_img.get_bitmap(), left, (size.y - m_none_printing_img.GetBmpSize().y) / 2); + dc.DrawBitmap(m_none_printing_img.get_bitmap(), left, (size.y - m_none_printing_img.GetSize().y) / 2); - left += (m_none_printing_img.GetBmpSize().x + FromDIP(15)); - dc.DrawBitmap(m_none_arrow_img.get_bitmap(), left, (size.y - m_none_arrow_img.GetBmpSize().y) / 2); + left += (m_none_printing_img.GetSize().x + FromDIP(15)); + dc.DrawBitmap(m_none_arrow_img.get_bitmap(), left, (size.y - m_none_arrow_img.GetSize().y) / 2); - left += (m_none_arrow_img.GetBmpSize().x + FromDIP(6)); + left += (m_none_arrow_img.GetSize().x + FromDIP(6)); dc.SetFont(::Label::Body_14); dc.SetBackgroundMode(wxTRANSPARENT); dc.SetTextForeground(*wxWHITE); wxString no_printer_str = _L("No printer"); auto sizet = dc.GetTextExtent(no_printer_str); - auto left_add_bitmap = size.x - FromDIP(30) - m_wifi_none_img.GetBmpSize().x - m_none_add_img.GetBmpSize().x; + auto left_add_bitmap = size.x - FromDIP(30) - m_wifi_none_img.GetSize().x - m_none_add_img.GetSize().x; auto size_width = left_add_bitmap - left; if (sizet.x > size_width) { @@ -169,21 +169,21 @@ void SideToolsPanel::doRender(wxDC &dc) dc.DrawText(no_printer_str, wxPoint(left, (size.y - sizet.y) / 2)); - left = size.x - FromDIP(30) - m_wifi_none_img.GetBmpSize().x; - dc.DrawBitmap(m_none_add_img.get_bitmap(), left, (size.y - m_none_add_img.GetBmpSize().y) / 2); + left = size.x - FromDIP(30) - m_wifi_none_img.GetSize().x; + dc.DrawBitmap(m_none_add_img.get_bitmap(), left, (size.y - m_none_add_img.GetSize().y) / 2); } else { - dc.DrawBitmap(m_printing_img.get_bitmap(), left, (size.y - m_printing_img.GetBmpSize().y) / 2); + dc.DrawBitmap(m_printing_img.get_bitmap(), left, (size.y - m_printing_img.GetSize().y) / 2); - left += (m_printing_img.GetBmpSize().x + FromDIP(5)); - dc.DrawBitmap(m_arrow_img.get_bitmap(), left, (size.y - m_arrow_img.GetBmpSize().y) / 2); + left += (m_printing_img.GetSize().x + FromDIP(5)); + dc.DrawBitmap(m_arrow_img.get_bitmap(), left, (size.y - m_arrow_img.GetSize().y) / 2); - left += (m_arrow_img.GetBmpSize().x + FromDIP(6)); + left += (m_arrow_img.GetSize().x + FromDIP(6)); dc.SetFont(::Label::Body_14); dc.SetBackgroundMode(wxTRANSPARENT); dc.SetTextForeground(StateColor::darkModeColorFor(SIDE_TOOLS_GREY900)); auto sizet = dc.GetTextExtent(m_dev_name); - auto text_end = size.x - m_wifi_none_img.GetBmpSize().x - 20; + auto text_end = size.x - m_wifi_none_img.GetSize().x - 20; std::string finally_name = m_dev_name.ToStdString(); if (sizet.x > (text_end - left)) { @@ -200,12 +200,12 @@ void SideToolsPanel::doRender(wxDC &dc) dc.DrawText(finally_name, wxPoint(left, (size.y - sizet.y) / 2)); - left = size.x - FromDIP(18) - m_wifi_none_img.GetBmpSize().x; - if (m_wifi_type == WifiSignal::NONE) dc.DrawBitmap(m_wifi_none_img.get_bitmap(), left, (size.y - m_wifi_none_img.GetBmpSize().y) / 2); - if (m_wifi_type == WifiSignal::WEAK) dc.DrawBitmap(m_wifi_weak_img.get_bitmap(), left, (size.y - m_wifi_weak_img.GetBmpSize().y) / 2); - if (m_wifi_type == WifiSignal::MIDDLE) dc.DrawBitmap(m_wifi_middle_img.get_bitmap(), left, (size.y - m_wifi_middle_img.GetBmpSize().y) / 2); - if (m_wifi_type == WifiSignal::STRONG) dc.DrawBitmap(m_wifi_strong_img.get_bitmap(), left, (size.y - m_wifi_strong_img.GetBmpSize().y) / 2); - if (m_wifi_type == WifiSignal::WIRED) dc.DrawBitmap(m_network_wired_img.get_bitmap(), left, (size.y - m_network_wired_img.GetBmpSize().y) / 2); + left = size.x - FromDIP(18) - m_wifi_none_img.GetSize().x; + if (m_wifi_type == WifiSignal::NONE) dc.DrawBitmap(m_wifi_none_img.get_bitmap(), left, (size.y - m_wifi_none_img.GetSize().y) / 2); + if (m_wifi_type == WifiSignal::WEAK) dc.DrawBitmap(m_wifi_weak_img.get_bitmap(), left, (size.y - m_wifi_weak_img.GetSize().y) / 2); + if (m_wifi_type == WifiSignal::MIDDLE) dc.DrawBitmap(m_wifi_middle_img.get_bitmap(), left, (size.y - m_wifi_middle_img.GetSize().y) / 2); + if (m_wifi_type == WifiSignal::STRONG) dc.DrawBitmap(m_wifi_strong_img.get_bitmap(), left, (size.y - m_wifi_strong_img.GetSize().y) / 2); + if (m_wifi_type == WifiSignal::WIRED) dc.DrawBitmap(m_network_wired_img.get_bitmap(), left, (size.y - m_network_wired_img.GetSize().y) / 2); } if (m_hover) { diff --git a/src/slic3r/GUI/Widgets/StaticLine.cpp b/src/slic3r/GUI/Widgets/StaticLine.cpp index 81f0113831..983e99786a 100644 --- a/src/slic3r/GUI/Widgets/StaticLine.cpp +++ b/src/slic3r/GUI/Widgets/StaticLine.cpp @@ -46,7 +46,7 @@ void StaticLine::SetLineColour(wxColour color) void StaticLine::Rescale() { if (this->icon.bmp().IsOk()) - this->icon.msw_rescale(); + this->icon.sys_color_changed(); messureSize(); } @@ -67,7 +67,7 @@ void StaticLine::messureSize() // BBS norrow size between text and icon szContent.x += 5; } - wxSize szIcon = this->icon.GetBmpSize(); + wxSize szIcon = this->icon.GetSize(); szContent.x += szIcon.x; if (szIcon.y > szContent.y) szContent.y = szIcon.y; } @@ -90,13 +90,13 @@ void StaticLine::render(wxDC& dc) auto label = GetLabel(); if (!label.IsEmpty()) textSize = dc.GetTextExtent(label); wxRect titleRect{{0, 0}, size}; - titleRect.height = wxMax(icon.GetBmpHeight(), textSize.GetHeight()); - int contentWidth = icon.GetBmpWidth() + ((icon.bmp().IsOk() && textSize.GetWidth() > 0) ? 5 : 0) + + titleRect.height = wxMax(icon.GetHeight(), textSize.GetHeight()); + int contentWidth = icon.GetWidth() + ((icon.bmp().IsOk() && textSize.GetWidth() > 0) ? 5 : 0) + textSize.GetWidth(); if (vertical) titleRect.Deflate((size.GetWidth() - contentWidth) / 2, 0); if (icon.bmp().IsOk()) { - dc.DrawBitmap(icon.get_bitmap(), {0, (size.y - icon.GetBmpHeight()) / 2}); - titleRect.x += icon.GetBmpWidth() + 5; + dc.DrawBitmap(icon.get_bitmap(), {0, (size.y - icon.GetHeight()) / 2}); + titleRect.x += icon.GetWidth() + 5; } if (!label.IsEmpty()) { dc.SetTextForeground(StateColor::darkModeColorFor(GetForegroundColour())); diff --git a/src/slic3r/GUI/Widgets/StepCtrl.cpp b/src/slic3r/GUI/Widgets/StepCtrl.cpp index 0ae2a841d1..289f6b1ef2 100644 --- a/src/slic3r/GUI/Widgets/StepCtrl.cpp +++ b/src/slic3r/GUI/Widgets/StepCtrl.cpp @@ -122,15 +122,15 @@ StepCtrl::StepCtrl(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wx , bmp_thumb(this, "step_thumb", 36) { StaticBox::border_width = 3; - radius = radius * bmp_thumb.GetBmpHeight() / 36; - bar_width = bar_width * bmp_thumb.GetBmpHeight() / 36; + radius = radius * bmp_thumb.GetHeight() / 36; + bar_width = bar_width * bmp_thumb.GetHeight() / 36; } void StepCtrl::Rescale() { - bmp_thumb.msw_rescale(); - radius = radius * bmp_thumb.GetBmpHeight() / 36; - bar_width = bar_width * bmp_thumb.GetBmpHeight() / 36; + bmp_thumb.sys_color_changed(); + radius = radius * bmp_thumb.GetHeight() / 36; + bar_width = bar_width * bmp_thumb.GetHeight() / 36; } void StepCtrl::mouseDown(wxMouseEvent &event) @@ -141,7 +141,7 @@ void StepCtrl::mouseDown(wxMouseEvent &event) int itemWidth = size.x / steps.size(); wxRect rcBar = {0, (size.y - 60) / 2, size.x, 60}; int circleX = itemWidth / 2 + itemWidth * step; - wxRect rcThumb = {{circleX, size.y / 2}, bmp_thumb.GetBmpSize()}; + wxRect rcThumb = {{circleX, size.y / 2}, bmp_thumb.GetSize()}; rcThumb.x -= rcThumb.width / 2; rcThumb.y -= rcThumb.height / 2; if (rcThumb.Contains(pt)) { @@ -235,7 +235,7 @@ void StepCtrl::doRender(wxDC &dc) dc.SetTextForeground(clr_tip.colorForStates(states)); wxSize sz = dc.GetTextExtent(tips[i]); dc.DrawText(tips[i], circleX - sz.x / 2, circleY - 20 - sz.y); - sz = bmp_thumb.GetBmpSize(); + sz = bmp_thumb.GetSize(); dc.DrawBitmap(bmp_thumb.get_bitmap(), circleX - sz.x / 2, circleY - sz.y / 2); } circleX += itemWidth; @@ -260,16 +260,16 @@ StepIndicator::StepIndicator(wxWindow *parent, wxWindowID id, const wxPoint &pos std::make_pair(0x6B6B6B, 0)); clr_tip = *wxWHITE; StaticBox::border_width = 0; - radius = bmp_ok.GetBmpHeight() / 2; - bar_width = bmp_ok.GetBmpHeight() / 20; + radius = bmp_ok.GetHeight() / 2; + bar_width = bmp_ok.GetHeight() / 20; if (bar_width < 2) bar_width = 2; } void StepIndicator::Rescale() { - bmp_ok.msw_rescale(); - radius = bmp_ok.GetBmpHeight() / 2; - bar_width = bmp_ok.GetBmpHeight() / 20; + bmp_ok.sys_color_changed(); + radius = bmp_ok.GetHeight() / 2; + bar_width = bmp_ok.GetHeight() / 20; if (bar_width < 2) bar_width = 2; } @@ -319,7 +319,7 @@ void StepIndicator::doRender(wxDC &dc) dc.DrawEllipse(circleX - radius, circleY - radius, radius * 2, radius * 2); // Draw content ( icon or text ) in circle if (disabled) { - wxSize sz = bmp_ok.GetBmpSize(); + wxSize sz = bmp_ok.GetSize(); dc.DrawBitmap(bmp_ok.get_bitmap(), circleX - radius, circleY - radius); } else { dc.SetFont(font_tip); diff --git a/src/slic3r/GUI/Widgets/SwitchButton.cpp b/src/slic3r/GUI/Widgets/SwitchButton.cpp index e3b7a5fc82..24af9530d4 100644 --- a/src/slic3r/GUI/Widgets/SwitchButton.cpp +++ b/src/slic3r/GUI/Widgets/SwitchButton.cpp @@ -58,8 +58,8 @@ void SwitchButton::SetValue(bool value) void SwitchButton::Rescale() { if (labels[0].IsEmpty()) { - m_on.msw_rescale(); - m_off.msw_rescale(); + m_on.sys_color_changed(); + m_off.sys_color_changed(); } else { SetBackgroundColour(StaticBox::GetParentBackgroundColor(GetParent())); @@ -138,7 +138,7 @@ void SwitchButton::Rescale() (i == 0 ? m_off : m_on).bmp() = bmp; } } - SetSize(m_on.GetBmpSize()); + SetSize(m_on.GetSize()); update(); } diff --git a/src/slic3r/GUI/Widgets/TempInput.cpp b/src/slic3r/GUI/Widgets/TempInput.cpp index 014df72cd9..99a9afcba7 100644 --- a/src/slic3r/GUI/Widgets/TempInput.cpp +++ b/src/slic3r/GUI/Widgets/TempInput.cpp @@ -280,8 +280,10 @@ void TempInput::SetLabelColor(StateColor const &color) void TempInput::Rescale() { - if (this->normal_icon.bmp().IsOk()) this->normal_icon.msw_rescale(); - if (this->degree_icon.bmp().IsOk()) this->degree_icon.msw_rescale(); + if (this->normal_icon.bmp().IsOk()) + this->normal_icon.sys_color_changed(); + if (this->degree_icon.bmp().IsOk()) + this->degree_icon.sys_color_changed(); messureSize(); } @@ -317,7 +319,7 @@ void TempInput::DoSetSize(int x, int y, int width, int height, int sizeFlags) auto left = padding_left; wxClientDC dc(this); if (normal_icon.bmp().IsOk()) { - wxSize szIcon = normal_icon.GetBmpSize(); + wxSize szIcon = normal_icon.GetSize(); left += szIcon.x; } @@ -379,7 +381,7 @@ void TempInput::render(wxDC &dc) // start draw wxPoint pt = {padding_left, 0}; if (actice_icon.bmp().IsOk() && actice) { - wxSize szIcon = actice_icon.GetBmpSize(); + wxSize szIcon = actice_icon.GetSize(); pt.y = (size.y - szIcon.y) / 2; dc.DrawBitmap(actice_icon.get_bitmap(), pt); pt.x += szIcon.x + 9; @@ -388,7 +390,7 @@ void TempInput::render(wxDC &dc) } if (normal_icon.bmp().IsOk() && !actice) { - wxSize szIcon = normal_icon.GetBmpSize(); + wxSize szIcon = normal_icon.GetSize(); pt.y = (size.y - szIcon.y) / 2; dc.DrawBitmap(normal_icon.get_bitmap(), pt); pt.x += szIcon.x + 9; @@ -435,7 +437,7 @@ void TempInput::render(wxDC &dc) // flag if (degree_icon.bmp().IsOk()) { auto pos = text_ctrl->GetPosition(); - wxSize szIcon = degree_icon.GetBmpSize(); + wxSize szIcon = degree_icon.GetSize(); pt.y = (size.y - szIcon.y) / 2; pt.x = pos.x + text_ctrl->GetSize().x; dc.DrawBitmap(degree_icon.get_bitmap(), pt); @@ -452,7 +454,7 @@ void TempInput::messureMiniSize() wxClientDC dc(this); if (normal_icon.bmp().IsOk()) { - wxSize szIcon = normal_icon.GetBmpSize(); + wxSize szIcon = normal_icon.GetSize(); width += szIcon.x; height = szIcon.y; } @@ -481,7 +483,7 @@ void TempInput::messureMiniSize() height = textSize.y > height ? textSize.y : height; // flag flag - auto flagSize = degree_icon.GetBmpSize(); + auto flagSize = degree_icon.GetSize(); width += flagSize.x; height = flagSize.y > height ? flagSize.y : height; @@ -506,7 +508,7 @@ void TempInput::messureSize() wxClientDC dc(this); if (normal_icon.bmp().IsOk()) { - wxSize szIcon = normal_icon.GetBmpSize(); + wxSize szIcon = normal_icon.GetSize(); width += szIcon.x; height = szIcon.y; } @@ -535,7 +537,7 @@ void TempInput::messureSize() height = textSize.y > height ? textSize.y : height; // flag flag - auto flagSize = degree_icon.GetBmpSize(); + auto flagSize = degree_icon.GetSize(); width += flagSize.x; height = flagSize.y > height ? flagSize.y : height; diff --git a/src/slic3r/GUI/Widgets/TextInput.cpp b/src/slic3r/GUI/Widgets/TextInput.cpp index 00f04f50b7..2291010912 100644 --- a/src/slic3r/GUI/Widgets/TextInput.cpp +++ b/src/slic3r/GUI/Widgets/TextInput.cpp @@ -116,7 +116,7 @@ void TextInput::SetTextColor(StateColor const& color) void TextInput::Rescale() { if (!this->icon.name().empty()) - this->icon.msw_rescale(); + this->icon.sys_color_changed(); messureSize(); Refresh(); } diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp index d76a3ccf0a..4a360d18c0 100644 --- a/src/slic3r/GUI/wxExtensions.cpp +++ b/src/slic3r/GUI/wxExtensions.cpp @@ -22,7 +22,7 @@ #ifndef __linux__ // msw_menuitem_bitmaps is used for MSW and OSX static std::map msw_menuitem_bitmaps; -void msw_rescale_menu(wxMenu* menu) //OcraftyoneTODO: PS RENAME (sys_color_changed_menu) +void sys_color_changed_menu(wxMenu* menu) { struct update_icons { static void run(wxMenuItem* item) { @@ -406,11 +406,6 @@ int mode_icon_px_size() #endif } -wxBitmap create_menu_bitmap(const std::string& bmp_name) -{ - return create_scaled_bitmap(bmp_name, nullptr, 16, false, "", true); -} - wxBitmapBundle* get_bmp_bundle(const std::string& bmp_name_in, int px_cnt/* = 16*/) { static Slic3r::GUI::BitmapCache cache; @@ -678,14 +673,14 @@ void LockButton::SetLock(bool lock) update_button_bitmaps(); } -void LockButton::msw_rescale() +void LockButton::sys_color_changed() { Slic3r::GUI::wxGetApp().UpdateDarkUI(this); - - m_bmp_lock_closed.msw_rescale(); - m_bmp_lock_closed_f.msw_rescale(); - m_bmp_lock_open.msw_rescale(); - m_bmp_lock_open_f.msw_rescale(); + + m_bmp_lock_closed.sys_color_changed(); + m_bmp_lock_closed_f.sys_color_changed(); + m_bmp_lock_open.sys_color_changed(); + m_bmp_lock_open_f.sys_color_changed(); update_button_bitmaps(); } @@ -830,7 +825,7 @@ void ModeSizer::set_items_border(int border) item->SetBorder(border); } -void ModeSizer::msw_rescale() +void ModeSizer::sys_color_changed() { // this->SetHGap(std::lround(m_hgap_unscaled * em_unit(m_parent))); //OcraftyoneTODO: LEGACY (PS removed) for (size_t m = 0; m < m_mode_btns.size(); m++) @@ -879,8 +874,8 @@ ScalableBitmap::ScalableBitmap( wxWindow *parent, if (px_cnt == 0) { m_px_cnt = GetHeight(); // scale unsigned int height = (unsigned int) (parent->FromDIP(m_px_cnt) + 0.5f); - if (height != GetBmpHeight()) - msw_rescale(); + if (height != GetHeight()) + sys_color_changed(); } //OcraftyoneTODO: PS replaces this function body with the following code // m_bmp = *get_bmp_bundle(icon_name, px_cnt); @@ -888,18 +883,8 @@ ScalableBitmap::ScalableBitmap( wxWindow *parent, } -//OcraftyoneTODO: Remove the following 3 functions when refactor complete -wxSize ScalableBitmap::GetBmpSize() const -{ return GetSize(); } -int ScalableBitmap::GetBmpWidth() const -{ return GetWidth(); } - -int ScalableBitmap::GetBmpHeight() const -{ return GetHeight(); } - - -void ScalableBitmap::msw_rescale() +void ScalableBitmap::sys_color_changed() { // BBS: support resize by fill border m_bmp = create_scaled_bitmap(m_icon_name, m_parent, m_px_cnt, m_grayscale, std::string(), false, m_resize); @@ -1009,7 +994,7 @@ void ScalableButton::UseDefaultBitmapDisabled() //OcraftyoneTODO: removed by ps SetBitmapDisabled(create_scaled_bitmap(m_current_icon_name, m_parent, m_px_cnt, true)); } -void ScalableButton::msw_rescale() //OcraftyoneTODO: renamed to sys_color_changed +void ScalableButton::msw_rescale() { Slic3r::GUI::wxGetApp().UpdateDarkUI(this, m_has_border); @@ -1037,9 +1022,9 @@ BlinkingBitmap::BlinkingBitmap(wxWindow* parent, const std::string& icon_name) : void BlinkingBitmap::msw_rescale() //OcraftyoneTODO: removed by ps { - bmp.msw_rescale(); - this->SetSize(bmp.GetBmpSize()); - this->SetMinSize(bmp.GetBmpSize()); + bmp.sys_color_changed(); + this->SetSize(bmp.GetSize()); + this->SetMinSize(bmp.GetSize()); } void BlinkingBitmap::invalidate() diff --git a/src/slic3r/GUI/wxExtensions.hpp b/src/slic3r/GUI/wxExtensions.hpp index 8eadea55f3..5d20638ea0 100644 --- a/src/slic3r/GUI/wxExtensions.hpp +++ b/src/slic3r/GUI/wxExtensions.hpp @@ -19,11 +19,14 @@ #include "Widgets/PopupWindow.hpp" #ifndef __linux__ -void msw_rescale_menu(wxMenu* menu); //OcraftyoneTODO: PS RENAME (sys_color_changed_menu) +void sys_color_changed_menu(wxMenu* menu); #else -inline void msw_rescale_menu(wxMenu* /* menu */) {} //OcraftyoneTODO: PS RENAME (sys_color_changed_menu) +inline void sys_color_changed_menu(wxMenu* /* menu */) {} #endif // no __linux__ +[[deprecated("Function renamed to sys_color_changed_menu. This function now redirects to sys_color_changed_menu")]] +inline void msw_rescale_menu(wxMenu* menu) { sys_color_changed_menu(menu); } + wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const wxString& description, std::function cb, wxBitmapBundle* icon, wxEvtHandler* event_handler = nullptr, std::function const cb_condition = []() { return true;}, wxWindow* parent = nullptr, int insert_pos = wxNOT_FOUND); @@ -171,11 +174,9 @@ public: ~ScalableBitmap() {} - wxSize GetBmpSize() const; // OcraftyoneTODO: REPLACE - int GetBmpWidth() const; - int GetBmpHeight() const; - - void msw_rescale(); //OcraftyoneTODO: PS RENAME (sys_color_changed) + [[deprecated("Function renamed to sys_color_changed. This function now redirects to sys_color_changed")]] + inline void msw_rescale() { sys_color_changed(); } + void sys_color_changed(); const wxBitmapBundle& bmp() const { return m_bmp; } wxBitmapBundle& bmp() { return m_bmp; } @@ -184,7 +185,7 @@ public: const std::string& name() const{ return m_icon_name; } int px_cnt() const { return m_px_cnt; } - wxSize GetSize() const { // OcraftyoneTODO: REPLACEMENTS + wxSize GetSize() const { #ifdef __APPLE__ return m_bmp.GetDefaultSize(); #else @@ -228,7 +229,9 @@ public: void enable() { m_disabled = false; } void disable() { m_disabled = true; } - void msw_rescale(); //OcraftyoneTODO: PS RENAME (sys_color_changed) + [[deprecated("Function renamed to sys_color_changed. This function now redirects to sys_color_changed")]] + inline void msw_rescale() { sys_color_changed(); } + void sys_color_changed(); protected: void update_button_bitmaps(); @@ -354,7 +357,9 @@ public: void set_items_flag(int flag); void set_items_border(int border); - void msw_rescale(); //OcraftyoneTODO: PS RENAME (sys_color_changed) + [[deprecated("Function renamed to sys_color_changed. This function now redirects to sys_color_changed")]] + inline void msw_rescale() { sys_color_changed(); } + void sys_color_changed(); const std::vector& get_btns() { return m_mode_btns; } private: