From 583685c0496a3f485e5e743a4272c824daf49545 Mon Sep 17 00:00:00 2001
From: Robert Sprowson <rsprowson@gitlab.riscosopen.org>
Date: Sun, 14 Feb 2021 13:08:20 +0000
Subject: [PATCH] [378] Extra switches to set button true colours

WimpVisualFlags gains -ButtonColour -ButtonWellColour -ButtonHighlightColour to allow a theme designer to set the button/well/pressed colours for R1-R7 slabbing to some other colour, and -ButtonBorderFaceColour -ButtonBorderOppColour -ButtonBorderShallowColour for the outlines.
The given colours are only used when there is no 'C' validation.
---
 Resources/Germany/CmdHelp | Bin 7024 -> 7706 bytes
 Resources/UK/CmdHelp      | Bin 6874 -> 7413 bytes
 s/Wimp01                  |  71 ++++++++++++++++++++++++++++++++++----
 s/Wimp04                  |  41 +++++++++++++++++++++-
 4 files changed, 105 insertions(+), 7 deletions(-)

diff --git a/Resources/Germany/CmdHelp b/Resources/Germany/CmdHelp
index 3bbe94b0f928ffecf7def407c76be53b0c605e43..d920c8e6afe8492ba8592c3e91dcb05dd8a80385 100644
GIT binary patch
delta 372
zcmZvYze)o^5XQOE#!|d2fdLB(V+0{KT3w~p2^Oi>+evm|*a>@c?rRvf)0YtKeI_5l
zy^BZ!R}6g2Z@&5WbMtoh@m}68oi`loPRMzzUofZw03L}2#3IB21MfI+E*SE{Okdmb
zvp7=4Wz~tWPv7Ok+4CU5HSF8@KdLww3{O@QaZKCE#dW*W5S&>fXm6mg+IysNYrWa@
zwxrbQ$@qwjuco|$ak@mJzQH190XlG(CmLMojs$cgj{To=Z|i%vwv<D%^L%z#1<|61
X76}_c(_gy($n-jy9Us0fRcihV>imWe

delta 16
YcmbPb^TBMxY{|_JBv&v_ek-dB07PB~fB*mh

diff --git a/Resources/UK/CmdHelp b/Resources/UK/CmdHelp
index 2b7b59f62f9df46ef9fec1a457d2822c0ed9927f..5d6490c1683ef47284b4f6895d0d15ece1fc3e30 100644
GIT binary patch
delta 269
zcmca*`qgqnniQK;X-P?b-sF1{p2|sJrb1?NeqOPjG@~v=$|=7nCABCxBQYl@zkKpW
zNo}KI2wR~jGbKG$Au%sSAvq&4FE2F*yH@{#0+6=J)>0B;*sTCc>&xb+DPWfkPtC~z
z8DLrtWGEyS<(C3&Oi4{kEX^rVNK7ut%+G`BL~^x9W_m^r5SIXTs>`6NQYg<z%~L2&
P%}GrzNllrYBvk<bL{Vb9

delta 11
ScmexrdCPP|n$+Y*nGygZPX!VH

diff --git a/s/Wimp01 b/s/Wimp01
index 7d82473..f5dfa94 100644
--- a/s/Wimp01
+++ b/s/Wimp01
@@ -775,6 +775,12 @@ truemenuborderoppcolour         # 4	; colours to use for menu borders
 truewindowborderfacecolour      # 4
 truewindowborderoppcolour	# 4	; colours to use for window borders
 truewindowoutlinecolour         # 4     ; colour to use for window outline
+truebuttonborderfacecolour      # 4     ; global theme selection to override truefacecolour
+truebuttonbordershallowcolour   # 4     ; global theme selection to override trueoppcolour for R3/R4 icons
+truebuttonborderoppcolour       # 4     ; global theme selection to override trueoppcolour
+truebuttonwellcolour            # 4     ; global theme selection to override truewellcolour
+truebuttonbgcolour              # 4     ; global theme selection to override truebgcolour
+truebuttonbgcolour2             # 4     ; global theme selection to override truebgcolour2
  ]
  [ TrueIcon1
 truefgcolour    #       4               ; for 24-bit colour icons
@@ -1893,7 +1899,7 @@ sc_orange             * &E
 sc_lightblue          * &F
 
 rgb_white             * &FFFFFF00
-rgb_verylightgrey     * &DDDDDD00 ; Unused
+rgb_verylightgrey     * &DDDDDD00
 rgb_lightgrey         * &BBBBBB00
 rgb_midlightgrey      * &99999900
 rgb_middarkgrey       * &77777700
@@ -1904,7 +1910,7 @@ rgb_darkblue          * &99440000 ; Unused
 rgb_yellow            * &00EEEE00 ; Unused
 rgb_lightgreen        * &00CC0000 ; Unused
 rgb_red               * &0000DD00 ; Unused
-rgb_cream             * &BBEEEE00 ; Unused
+rgb_cream             * &BBEEEE00
 rgb_darkgreen         * &00885500 ; Unused
 rgb_orange            * &00BBFF00 ; Unused
 rgb_lightblue         * &FFBB0000 ; Unused
@@ -2343,6 +2349,18 @@ WimpVisualFlags_Help		DCB "*WimpVisualFlags changes some aspects of the visual a
 				DCB "   Set the colour of the top left portion of the menu border.",cr
 				DCB "-MenuBorderOppColour <&RRGGBB>",cr
 				DCB "   Set the colour of the bottom right portion of the menu border.",cr
+				DCB "-ButtonBorderFaceColour <&RRGGBB>",cr
+				DCB "   Set the colour of the top left portion of button icons.",cr
+				DCB "-ButtonBorderShallowColour <&RRGGBB>",cr
+				DCB "   Set the colour of ridge and channel icon shadows.",cr
+				DCB "-ButtonBorderOppColour <&RRGGBB>",cr
+				DCB "   Set the colour of the bottom right portion of button icons.",cr
+				DCB "-ButtonColour <&RRGGBB>",cr
+				DCB "   Set the colour of the top of button icons.",cr
+				DCB "-ButtonWellColour <&RRGGBB>",cr
+				DCB "   Set the colour of the well around default action buttons.",cr
+				DCB "-ButtonHighlightColour <&RRGGBB>",cr
+				DCB "   Set the colour of action buttons when selected.",cr
                                 DCB "-WindowOutlineColour <&RRGGBB>",cr
                                 DCB "   Set the colour of the window outline.",cr
 WimpVisualFlags_Syntax		DCB "Syntax: *WimpVisualFlags <options>",0
@@ -3775,12 +3793,21 @@ gotwork
 	LDR	R0,=rgb_white
 	STR	R0,truemenuborderfacecolour
 	STR	R0,truewindowborderfacecolour
+	STR	R0,truebuttonborderfacecolour
 	LDR	R0,=rgb_midlightgrey
 	STR	r0,truemenuborderoppcolour
+	STR	r0,truebuttonbgcolour2
 	LDR	R0,=rgb_middarkgrey
 	STR	r0,truewindowborderoppcolour
+	STR	r0,truebuttonborderoppcolour
 	LDR	R0,=rgb_black
 	STR	r0,truewindowoutlinecolour
+	LDR	R0,=rgb_cream
+	STR	r0,truebuttonwellcolour
+	LDR	R0,=rgb_verylightgrey
+	STR	r0,truebuttonbgcolour
+	LDR	R0,=rgb_lightgrey
+	STR	r0,truebuttonbordershallowcolour
       [ true
         MOV     R0,#arrowIconWidth_No3D
       |
@@ -7623,6 +7650,8 @@ WimpKillSprite_Code
 	DCB	"NoIconBoxesInTransWindows=NIBITW/S,Fully3DIconBar=F3DIB/S,All=A/S,"
 	DCB	"WindowBorderFaceColour=WBFC/E,WindowBorderOppColour=WBOC/E,"
 	DCB	"MenuBorderFaceColour=MBFC/E,MenuBorderOppColour=MBOC/E,"
+	DCB	"ButtonBorderFaceColour=BBFC/E,ButtonBorderShallowColour=BBSC/E,ButtonBorderOppColour=BBOC/E,"
+	DCB	"ButtonColour=BC/E,ButtonWellColour=BWC/E,ButtonHighlightColour=BHC/E,"
 	DCB	"NoFontBlending=NFB/S,FontBlending=FB/S,"
 	DCB     "WindowOutlineColour=WOC/E,WindowOutlineOver=WOO/S",0
 	ALIGN
@@ -7669,14 +7698,14 @@ WimpVisualFlags_Code
 	LDR	r1,[sp,#20]
 	TEQ	r1,#0
 	ORRNE	r2,r2,#ThreeDFlags_Fully3DIconBar
-;	LDR	r1,[sp,#44]
+;	LDR	r1,[sp,#68]
 ;	TEQ	r1,#0
 ;	ORRNE	r2,r2,#ThreeDFlags_NoFontBlending ; bit is already set!
-	LDR	r1,[sp,#48]
+	LDR	r1,[sp,#72]
 	TEQ	r1,#0
 	BICNE	r2,r2,#ThreeDFlags_NoFontBlending
 
-	LDR	r1,[sp,#56]
+	LDR	r1,[sp,#80]
 	TEQ	r1,#0
 	ORRNE	r2,r2,#ThreeDFlags_WindowOutlineOver
 
@@ -7700,7 +7729,37 @@ WimpVisualFlags_Code
 	LDRNE	r0,=rgb_midlightgrey
 	STR	r0,truemenuborderoppcolour
 
-	LDR	r1,[sp,#52]		; window outline colour
+	LDR	r1,[sp,#44]		; button border face colour
+	BL	%FT02
+	LDRNE	r0,=rgb_white
+	STR	r0,truebuttonborderfacecolour
+
+	LDR	r1,[sp,#48]		; button border shallow colour
+	BL	%FT02
+	LDRNE	r0,=rgb_lightgrey
+	STR	r0,truebuttonbordershallowcolour
+
+	LDR	r1,[sp,#52]		; button border opposite colour
+	BL	%FT02
+	LDRNE	r0,=rgb_middarkgrey
+	STR	r0,truebuttonborderoppcolour
+
+	LDR	r1,[sp,#56]		; button colour
+	BL	%FT02
+	LDRNE	r0,=rgb_verylightgrey
+	STR	r0,truebuttonbgcolour
+
+	LDR	r1,[sp,#60]		; button well colour
+	BL	%FT02
+	LDRNE	r0,=rgb_cream
+	STR	r0,truebuttonwellcolour
+
+	LDR	r1,[sp,#64]		; button highlight colour
+	BL	%FT02
+	LDRNE	r0,=rgb_midlightgrey
+	STR	r0,truebuttonbgcolour2
+
+	LDR	r1,[sp,#76]		; window outline colour
 	BL	%FT02
 	LDRNE	r0,=rgb_black
 	STR	r0,truewindowoutlinecolour
diff --git a/s/Wimp04 b/s/Wimp04
index cf4ee86..1598913 100644
--- a/s/Wimp04
+++ b/s/Wimp04
@@ -1049,6 +1049,7 @@ mungetruecolours ROUT
         LDRNEB  R0, fontforeground
         MOVEQ   R0, R1, LSR #ib_fcol
         AND     R0, R0, #&F
+        MOV     R2, R0
         LDR     R0, [R14, R0, LSL #2]   ; look up palette entry
         STR     R0, truefgcolour
 01
@@ -1059,28 +1060,61 @@ mungetruecolours ROUT
         LDRNEB  R0, fontbackground
         MOVEQ   R0, R1, LSR #ib_bcol
         AND     R0, R0, #&F
+      [ ThreeDPatch
+        TST     R1, #if_border
+        LDRNE   R3, border_type
+        TEQNE   R3, #border_normal
+        LDREQ   R0, [R14, R0, LSL #2]   ; look up palette entry
+        BEQ     %FT05                   ; there is a border, and it's not R0 validation
+        TEQ     R0, #sc_verylightgrey
+        TEQEQ   R2, #sc_black
+        LDREQ   R0, truebuttonbgcolour  ; theme it since it was the default fg/bg colours
+        LDRNE   R0, [R14, R0, LSL #2]   ; look up palette entry
+05
+      |
         LDR     R0, [R14, R0, LSL #2]   ; look up palette entry
+      ]
         STR     R0, truebgcolour
 01
         LDR     R0, truebgcolour2
         CMP     R0, #-1
+      [ ThreeDPatch
+        BNE     %FT05
+        LDR     R0, border_highlight
+        AND     R0, R0, #&F
+        TEQ     R0, #sc_midlightgrey
+        TEQEQ   R2, #sc_black
+        LDREQ   R0, truebuttonbgcolour2 ; theme it since it was the default fg/bg2 colours
+        LDRNE   R0, [R14, R0, LSL #2]   ; look up palette entry
+        STR     R0, truebgcolour2
+05
+      |
         LDREQ   R0, border_highlight
         ANDEQ   R0, R0, #&F
         LDREQ   R0, [R14, R0, LSL #2]   ; look up palette entry
         STREQ   R0, truebgcolour2
-
+      ]
         LDR     R0, truewellcolour
         CMP     R0, #-1
         BNE     %FT01
         LDR     R0, border_type
         TEQ     R0, #border_defaultaction
+      [ ThreeDPatch
+        LDREQ   R0, truebuttonwellcolour             ; default = Wimp cream  (default action)
+        LDRNE   R0, truebuttonbgcolour               ; default = Wimp grey 1 (editable)
+      |
         LDREQ   R0, [R14, #sc_cream :SHL: 2]         ; default = Wimp cream  (default action)
         LDRNE   R0, [R14, #sc_verylightgrey :SHL: 2] ; default = Wimp grey 1 (editable)
+      ]
         STR     R0, truewellcolour
 01
         LDR     R0, truefacecolour
         CMP     R0, #-1
+      [ ThreeDPatch
+        LDREQ   R0, truebuttonborderfacecolour       ; default = Wimp white
+      |
         LDREQ   R0, [R14, #sc_white :SHL: 2]         ; default = Wimp white
+      ]
         STREQ   R0, truefacecolour
 
         LDR     R0, trueoppcolour
@@ -1089,8 +1123,13 @@ mungetruecolours ROUT
         LDR     R0, border_type
         TEQ     R0, #border_ridge
         TEQNE   R0, #border_channel
+      [ ThreeDPatch
+        LDREQ   R0, truebuttonbordershallowcolour    ; default = Wimp grey 2 (shallow)
+        LDRNE   R0, truebuttonborderoppcolour        ; default = Wimp grey 4 (normal)
+      |
         LDREQ   R0, [R14, #sc_lightgrey :SHL: 2]     ; default = Wimp grey 2 (shallow)
         LDRNE   R0, [R14, #sc_middarkgrey :SHL: 2]   ; default = Wimp grey 4 (normal)
+      ]
         STR     R0, trueoppcolour
 01
         TST     R1, #is_inverted
-- 
GitLab