From 2b8edfccc866af927f8c791521eecde182946cee Mon Sep 17 00:00:00 2001 From: "xin.zhang" Date: Thu, 15 May 2025 15:16:36 +0800 Subject: [PATCH] ENH: update dark mode supports of print option jira: [STUDIO-12188] Change-Id: I0d38bcab502415dd733d9b58835e1e50dd00bd22 --- resources/images/print_options_bg_dark.png | Bin 0 -> 318 bytes .../images/print_options_bg_disabled_dark.png | Bin 0 -> 310 bytes src/slic3r/GUI/SelectMachine.cpp | 21 +++++++++++++----- src/slic3r/GUI/SelectMachine.hpp | 4 +++- 4 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 resources/images/print_options_bg_dark.png create mode 100644 resources/images/print_options_bg_disabled_dark.png diff --git a/resources/images/print_options_bg_dark.png b/resources/images/print_options_bg_dark.png new file mode 100644 index 0000000000000000000000000000000000000000..267765cbf5873b926c865b2745cacf60bae8ae99 GIT binary patch literal 318 zcmeAS@N?(olHy`uVBq!ia0vp^IzTMO!3HFEr`DYUQk(@Ik;M!Q+`=Ht$S`Y;1W=H% zILO_JVcj{Imp~3nx}&cn1H;CC?mvmFK>lS<7srqa#<$lk`I;OUS|1+gIib|LR5Z{; zN_#Ko+-YKRXKr0ud}9Zz^2KA9Bo6K4kmxr!IpIus)BcLHlV#E)@1+Uqbu(lxXXxjd zf2b(bho9}qbBkl8pBne_F5F-ALF1+1j@NoqLYOSiGxL=HId;wJJ<~Nim%S`PrzNj% ztY0>LVV8Bh=0?( z;={JlpG~gs+8u$os~f*h{rJ0N@#1T9{PPzp82qe}^Kx1hvDb1@{G?q@;m=c}Gl1S> N@O1TaS?83{1OU#6cf|kz literal 0 HcmV?d00001 diff --git a/resources/images/print_options_bg_disabled_dark.png b/resources/images/print_options_bg_disabled_dark.png new file mode 100644 index 0000000000000000000000000000000000000000..def651c6af70f2ccdae2030b7ecc3e612d16955a GIT binary patch literal 310 zcmeAS@N?(olHy`uVBq!ia0vp^IzTMO!3HFEr`DYUQk(@Ik;M!Q+`=Ht$S`Y;1W=H% zILO_JVcj{Imp~3nx}&cn1H;CC?mvmFK>le@7srqa#<$lmay1!9v^~s^epqDnUeUn7 z;FXun>s_xGG_|~QOkH{*BKo2#kJ=l{I~Py?@VC2U;y(GgwuhzzhhxW) zLY$VY*!DF4GVkHn)^^|9=l=a<;D1ZEcU^FqWbY4#S!oVaswdko1$v9Y)78&qol`;+ E0I}|S^Z)<= literal 0 HcmV?d00001 diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp index 0ec6651a2..5dbdeadd0 100644 --- a/src/slic3r/GUI/SelectMachine.cpp +++ b/src/slic3r/GUI/SelectMachine.cpp @@ -4752,9 +4752,9 @@ void PrintOption::enable(bool en) m_printoption_item->enable(en); if (en) { - m_printoption_title->SetForegroundColour("#262E30"); + m_printoption_title->SetForegroundColour(StateColor::darkModeColorFor("#262E30")); } else { - m_printoption_title->SetForegroundColour(wxColour(144, 144, 144)); + m_printoption_title->SetForegroundColour(StateColor::darkModeColorFor(wxColour(144, 144, 144))); } } } @@ -4827,7 +4827,9 @@ PrintOptionItem::PrintOptionItem(wxWindow* parent, std::vector ops, std: Bind(wxEVT_LEFT_DOWN, &PrintOptionItem::on_left_down, this); m_selected_bk = ScalableBitmap(this, "print_options_bg", 22); - m_selected_disbabled_bk = ScalableBitmap(this, "print_options_bg_disabled", 22); + m_selected_bk_dark = ScalableBitmap(this, "print_options_bg_dark", 22); + m_selected_disabled_bk = ScalableBitmap(this, "print_options_bg_disabled", 22); + m_selected_disabled_bk_dark = ScalableBitmap(this, "print_options_bg_disabled_dark", 22); // update the options update_options(ops); @@ -4914,9 +4916,18 @@ void PrintOptionItem::doRender(wxDC& dc) /*selected*/ auto selected_left = selected * PRINT_OPT_WIDTH + FromDIP(4); if (m_enable) { - dc.DrawBitmap(m_selected_bk.bmp(), selected_left, (size.y - m_selected_bk.GetBmpHeight()) / 2); + if (!wxGetApp().dark_mode()) { + dc.DrawBitmap(m_selected_bk.bmp(), selected_left, (size.y - m_selected_bk.GetBmpHeight()) / 2); + } else { + dc.DrawBitmap(m_selected_bk_dark.bmp(), selected_left, (size.y - m_selected_bk_dark.GetBmpHeight()) / 2); + } + } else { - dc.DrawBitmap(m_selected_disbabled_bk.bmp(), selected_left, (size.y - m_selected_disbabled_bk.GetBmpHeight()) / 2); + if (!wxGetApp().dark_mode()) { + dc.DrawBitmap(m_selected_disabled_bk.bmp(), selected_left, (size.y - m_selected_disabled_bk.GetBmpHeight()) / 2); + } else { + dc.DrawBitmap(m_selected_bk_dark.bmp(), selected_left, (size.y - m_selected_bk_dark.GetBmpHeight()) / 2); + } } for (auto it = m_ops.begin(); it != m_ops.end(); ++it) diff --git a/src/slic3r/GUI/SelectMachine.hpp b/src/slic3r/GUI/SelectMachine.hpp index a20037917..962bd2cb4 100644 --- a/src/slic3r/GUI/SelectMachine.hpp +++ b/src/slic3r/GUI/SelectMachine.hpp @@ -177,7 +177,9 @@ private: private: ScalableBitmap m_selected_bk; - ScalableBitmap m_selected_disbabled_bk; + ScalableBitmap m_selected_bk_dark; + ScalableBitmap m_selected_disabled_bk; + ScalableBitmap m_selected_disabled_bk_dark; std::vector m_ops; std::string selected_key; std::string m_param;