From 09eb246b2acde88a605641adb702d72003c6f129 Mon Sep 17 00:00:00 2001 From: past-due <30942300+past-due@users.noreply.github.com> Date: Mon, 28 Aug 2023 17:35:47 -0400 Subject: [PATCH] IntFancyButton: Add buttonBackgroundEmpty option --- data/base/images/intfac.img | 2 ++ .../images/intfac/image_but_empty_down.png | Bin 0 -> 436 bytes .../base/images/intfac/image_but_empty_up.png | Bin 0 -> 374 bytes src/intdisplay.cpp | 22 +++++++++++++----- src/intdisplay.h | 1 + src/intfac.h | 4 +++- 6 files changed, 22 insertions(+), 7 deletions(-) create mode 100644 data/base/images/intfac/image_but_empty_down.png create mode 100644 data/base/images/intfac/image_but_empty_up.png diff --git a/data/base/images/intfac.img b/data/base/images/intfac.img index 02c8d6197be..a72978822e0 100644 --- a/data/base/images/intfac.img +++ b/data/base/images/intfac.img @@ -444,3 +444,5 @@ 0,0,image_specstatsup.png 0,0,image_volume_up.png 0,0,image_volume_mute.png +0,0,image_but_empty_up.png +0,0,image_but_empty_down.png diff --git a/data/base/images/intfac/image_but_empty_down.png b/data/base/images/intfac/image_but_empty_down.png new file mode 100644 index 0000000000000000000000000000000000000000..34db6cb3be99f81fca96006155abc611c52961cb GIT binary patch literal 436 zcmeAS@N?(olHy`uVBq!ia0vp^HbAV$!3HEt9#uU8Qk(@Ik;M!Q+`=Ht$S`Y;1Oo$O znx~6nNJit^TZ;aN9V8kae&3}w<1gc~?JIp7Bve`y3?g{gSpV=dWi+`9h_E$3)#usR zR?u;AR_hW;l?4$3+0`9+zJdu6mp{CfyPB=F&%Au4)eK{;{WtDf8=fs|cUv8I&BplY z>xSj+*6Z~6H=ld+@W-2LCQ+p|vI}UUmY7npAJ@_wky^^j=o)83bteZE|K$RI@2 zqr9xNxOsMWcD{uKn_6Jr{yzSF>)NkJKZ+Z-U;j6e`9e@?dDdG#20n+yq3-3?atU5C8#LU?tM7f;|HSA1v$F766_?na zG)*k*sh_mfa(}JrMBZuV*u2x5mu^0I>1M*qoDC&r5mwSVbFmBGjbRV>n!TtZGFt4- zj%8dsmi7eelwX>rr?7X?_Sy}bL+<$;{aniMWS!i#EYr^NE&DhR2h=k9Zq9S$WDZCI PMgxPVtDnm{r-UW|skXXf literal 0 HcmV?d00001 diff --git a/data/base/images/intfac/image_but_empty_up.png b/data/base/images/intfac/image_but_empty_up.png new file mode 100644 index 0000000000000000000000000000000000000000..9fad6ab9b02cc67cbf95e2dce45e00439aa51e95 GIT binary patch literal 374 zcmeAS@N?(olHy`uVBq!ia0vp^HbAV$!3HEt9#uU8Qk(@Ik;M!Q+`=Ht$S`Y;1Oo%3 zhNp{TNJit^TZ%=80t6Z!{&!TFyUbWyNl8g-LI+2TUc+OB7xNbEVn6tmX$KdJP-92O ziW`!r0%m)<3N2&TNZIwq{PUUM-{-4~nCC8vFjeAI(ww#;Y(?Fsn|oLr7&gT0GgH!B zCE8vT&J=(5=lLXsx^rof_qWCEZwU}too03R=Z$^Sw@l>yzGCg11;YIA6M=> z@$I+nM31H{)`BB$8SB~nwmj_3n%b$-<8tYrH2a$)|H7Cb2E6l{I3=*WlI0vTUukao zEw@GQ9+}+HF~3;<{xtV}UjA+8n%90#cx`jTiU{Vryk_~#?=#m(UCw(J+cdwS{ot{k q`#56@mP8qz7r(jT^PRS=qx^L~o{v_!#OwzKB!j1`pUXO@geCxTnWY5) literal 0 HcmV?d00001 diff --git a/src/intdisplay.cpp b/src/intdisplay.cpp index 588f253d0e4..9a1909cf78c 100644 --- a/src/intdisplay.cpp +++ b/src/intdisplay.cpp @@ -938,14 +938,24 @@ bool intInitialiseGraphics() // Clear a button bitmap. ( copy the button background ). void IntFancyButton::displayClear(int xOffset, int yOffset) { - if (isDown()) - { - iV_DrawImage(IntImages, IMAGE_BUT0_DOWN + buttonType * 2, xOffset + x(), yOffset + y()); - } - else + UWORD buttonId = 0; + switch (buttonType) { - iV_DrawImage(IntImages, IMAGE_BUT0_UP + buttonType * 2, xOffset + x(), yOffset + y()); + case IntFancyButton::ButtonType::TOPBUTTON: + if (buttonBackgroundEmpty) + { + buttonId = (isDown() ? IMAGE_BUT_EMPTY_DOWN : IMAGE_BUT_EMPTY_UP); + } + else + { + buttonId = (isDown() ? IMAGE_BUT0_DOWN : IMAGE_BUT0_UP); + } + break; + case IntFancyButton::ButtonType::BTMBUTTON: + buttonId = (isDown() ? IMAGE_BUTB0_DOWN : IMAGE_BUTB0_UP); + break; } + iV_DrawImage(IntImages, buttonId, xOffset + x(), yOffset + y()); } // Create a button by rendering an IMD object into it. diff --git a/src/intdisplay.h b/src/intdisplay.h index 55b702033d8..f6dad0825c9 100644 --- a/src/intdisplay.h +++ b/src/intdisplay.h @@ -141,6 +141,7 @@ class IntFancyButton : public W_CLICKFORM int rate; } model; ButtonType buttonType; // TOPBUTTON is square, BTMBUTTON has a little up arrow. + bool buttonBackgroundEmpty = false; }; class IntObjectButton : public IntFancyButton diff --git a/src/intfac.h b/src/intfac.h index 06079dabc84..7e6cb08314d 100644 --- a/src/intfac.h +++ b/src/intfac.h @@ -477,7 +477,9 @@ enum INTFAC_TYPE IMAGE_SPECSTATS_DOWN, IMAGE_SPECSTATS_UP, IMAGE_INTFAC_VOLUME_UP, - IMAGE_INTFAC_VOLUME_MUTE + IMAGE_INTFAC_VOLUME_MUTE, + IMAGE_BUT_EMPTY_UP, + IMAGE_BUT_EMPTY_DOWN, }; #endif //__INCLUDED_SRC_INTFAC_H__