Fix wx issues from upgrade (#3032)

* fix top bar resizing

* Attempt to fix bitmap bundle scaling issues

* Revert "Attempt to fix bitmap bundle scaling issues"

This reverts commit e94ba58d90.

* Fix AboutDialog and partially fix SwitchButton

* Fix switch button scaling on windows

* Fix dropdown icon size

* fixed sdcard/recording/timelapse icon size in device page

* Set use_legacy_bmp to true by default to it's back compatible

---------

Co-authored-by: Noisyfox <timemanager.rick@gmail.com>
Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
Ocraftyone 2023-12-21 03:27:02 -05:00 committed by GitHub
parent 401ac1adef
commit 53d752b606
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 148 additions and 93 deletions

View file

@ -9,8 +9,8 @@
SwitchButton::SwitchButton(wxWindow* parent, wxWindowID id)
: wxBitmapToggleButton(parent, id, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE | wxBU_EXACTFIT)
, m_on(this, "toggle_on", 16, false, false, true)
, m_off(this, "toggle_off", 16, false, false, true)
, m_on(this, "toggle_on", {28, 16})
, m_off(this, "toggle_off", {28, 16})
, text_color(std::pair{0xfffffe, (int) StateColor::Checked}, std::pair{0x6B6B6B, (int) StateColor::Normal})
, track_color(0xD9D9D9)
, thumb_color(std::pair{0x009688, (int) StateColor::Checked}, std::pair{0xD9D9D9, (int) StateColor::Normal})
@ -101,7 +101,8 @@ void SwitchButton::Rescale()
for (int i = 0; i < 2; ++i) {
wxMemoryDC memdc(&dc);
#ifdef __WXMSW__
wxBitmap bmp(trackSize.x, trackSize.y);
wxBitmap bmp;
bmp.CreateWithDIPSize(ToDIP(trackSize), GetDPIScaleFactor());
memdc.SelectObject(bmp);
memdc.SetBackground(wxBrush(GetBackgroundColour()));
memdc.Clear();
@ -145,4 +146,5 @@ void SwitchButton::Rescale()
void SwitchButton::update()
{
SetBitmap((GetValue() ? m_on : m_off).bmp());
}