It is currently April 19th, 2024, 7:47 pm

[FEATURE] BevelType Color

Report bugs with the Rainmeter application and suggest features.
User avatar
Yincognito
Rainmeter Sage
Posts: 7128
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: [FEATURE] BevelType Color

Post by Yincognito »

Active Colors wrote: February 18th, 2022, 1:58 pm Thanks eclectic-tech for kicking in and great that Yincognito managed to move further :thumbup:

Yincognito's case reminded me of a similar case I had before https://forum.rainmeter.net/viewtopic.php?t=35740&start=10#p180485.
Based on that, my initial idea was similar to the workaround that eclectic-tech provided. But same as Yincognito I don't like using !Update to update and redraw everything. I would simply add an extra pair of [!UpdateMeter *][!Redraw] at the end of each bang and it would make it work as intended (in the similar manner described in my post from that thread above).

MouseScrollUpAction=[!SetVariable FSZ (Clamp(#FSZ#+#Step#,7,200))][!UpdateMeter *][!Redraw][!UpdateMeter *][!Redraw]
MouseScrollDownAction=[!SetVariable FSZ (Clamp(#FSZ#-#Step#,7,200))][!UpdateMeter *][!Redraw][!UpdateMeter *][!UpdateMeter *]

If you don't like seeing that in front of your eyes you can substitute that with a variable :D
TwinPeaks=[!UpdateMeter *][!Redraw][!UpdateMeter *][!Redraw]
change to !UpdateMeterGroup or #CURRENTSECTION# if needed.

The following answer could also possibly bring some more light about the situation: https://forum.rainmeter.net/viewtopic.php?t=35740&start=10#p180489

P.s. Don't forget that [!UpdateMeter] does not redraw the meter(s). If you have multiple "groups of bangs" in one action sometimes you would need to put [!Redraw] after each "group of bangs" instead of simply having one [!Redraw] as the final bang in the whole action.
Well, I didn't techincally move further, because I wasn't in a deadlock in the first place, but you asked for a sample skin and I provided it (though as you could see, I reused a sample from another topic regarding scaling, which explains the base code). My skins already use the method of initial invisible "template" meters to determine the maximum dimensions such meters would have, followed by subsequent visible meters that "fit" within the "template" previously set up. While eclectic-tech's solution (and your similar thoughts as well) is excellent and can be used, I still can't avoid using those "templates".

A much more similar example to what I have in my skins (using eclectic-tech's adjusted method in the uncommented code and my current method in the commented one) is:

Code: Select all

[Variables]
SC1=0,0,0
SC2=32,32,32
STC1=224,224,224
STC2=32,32,32
SCA=128
STA=255
STW=2
FSZ=16
Padding=#STW#
Step=1
; Additional Variables
MaxSizeTemplateW=([MaxSizeTemplate:W]-Trunc(#Padding#)*2)
MaxSizeTemplateH=([MaxSizeTemplate:H]-Trunc(#Padding#)*2)
SkinWidth=(#STW#*2+#Padding#*2+#MaxSizeTemplateW#)
SkinHeight=(#STW#*2+#Padding#*2+#MaxSizeTemplateH#)

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

---Meters---

; Eclectic-Tech's Adjusted Method (uncomment one method and comment the other to see differences and similarities)

[Background]
Meter=Shape
Shape=Rectangle (#STW#/2),(#STW#/2),(#CURRENTCONFIGWIDTH#-#STW#),(#CURRENTCONFIGHEIGHT#-#STW#) | Fill LinearGradient BackgroundGradient | StrokeWidth 0 | Stroke Color #STC#,#SCA#
Shape2=Path ULCorner | StrokeWidth #STW# | Stroke Color #STC1#,#STA#
ULCorner=(#STW#/2),(#CURRENTCONFIGHEIGHT#) | LineTo (#STW#/2),(#STW#/2) | LineTo (#CURRENTCONFIGWIDTH#),(#STW#/2)
Shape3=Path BRCorner | StrokeWidth #STW# | Stroke Color #STC2#,#STA#
BRCorner=(#CURRENTCONFIGWIDTH#-#STW#/2),(0) | LineTo (#CURRENTCONFIGWIDTH#-#STW#/2),(#CURRENTCONFIGHEIGHT#-#STW#/2) | LineTo (0),(#CURRENTCONFIGHEIGHT#-#STW#/2)
BackgroundGradient=90 | #SC1#,#SCA# ; 0.0 | #SC2#,#SCA# ; 1.0
UpdateDivider=-1
LeftMouseUpAction=[!SetVariable STC1 #STC2#][!SetVariable STC2 #STC1#][!UpdateMeter Background][!Redraw]
DynamicVariables=1

[MaxSizeTemplate]
Group=AllMetersGroup
Meter=String
FontFace=Consolas
FontColor=0,0,0,0
FontSize=#FSZ#
AntiAlias=1
Padding=#Padding#,#Padding#,#Padding#,#Padding#
X=(#STW#)
Y=(#STW#)
Text="00000"
UpdateDivider=-1
MouseScrollUpAction=[!SetVariable FSZ (Clamp(#FSZ#+#Step#,7,200))][!UpdateMeterGroup AllMetersGroup][!HideMeter Background][!Redraw][!UpdateMeter Background][!ShowMeter Background][!Redraw]
MouseScrollDownAction=[!SetVariable FSZ (Clamp(#FSZ#-#Step#,7,200))][!UpdateMeterGroup AllMetersGroup][!HideMeter Background][!Redraw][!UpdateMeter Background][!ShowMeter Background][!Redraw]
DynamicVariables=1

[ActualSizeValue]
Group=AllMetersGroup
Meter=String
FontFace=Consolas
FontColor=255,255,255,255
FontSize=#FSZ#
AntiAlias=1
Padding=#Padding#,#Padding#,#Padding#,#Padding#
StringAlign=Right
X=(#STW#+#Padding#*2+#MaxSizeTemplateW#)
Y=(#STW#)
W=(#MaxSizeTemplateW#)
H=(#MaxSizeTemplateH#)
Text="000"
UpdateDivider=-1
DynamicVariables=1

; Yincognito's Current Method (uncomment one method and comment the other to see differences and similarities)

; [MaxSizeTemplate]
; Group=AllMetersGroup
; Meter=String
; FontFace=Consolas
; FontColor=0,0,0,0
; FontSize=#FSZ#
; AntiAlias=1
; Padding=#Padding#,#Padding#,#Padding#,#Padding#
; X=(#STW#)
; Y=(#STW#)
; Text="00000"
; UpdateDivider=-1
; DynamicVariables=1

; [Background]
; Meter=Shape
; Shape=Rectangle (#STW#/2),(#STW#/2),(#SkinWidth#-#STW#),(#SkinHeight#-#STW#) | Fill LinearGradient BackgroundGradient | StrokeWidth 0 | Stroke Color #STC#,#SCA#
; Shape2=Path ULCorner | StrokeWidth #STW# | Stroke Color #STC1#,#STA#
; ULCorner=(#STW#/2),(#SkinHeight#) | LineTo (#STW#/2),(#STW#/2) | LineTo (#SkinWidth#),(#STW#/2)
; Shape3=Path BRCorner | StrokeWidth #STW# | Stroke Color #STC2#,#STA#
; BRCorner=(#SkinWidth#-#STW#/2),(0) | LineTo (#SkinWidth#-#STW#/2),(#SkinHeight#-#STW#/2) | LineTo (0),(#SkinHeight#-#STW#/2)
; BackgroundGradient=90 | #SC1#,#SCA# ; 0.0 | #SC2#,#SCA# ; 1.0
; UpdateDivider=-1
; MouseScrollUpAction=[!SetVariable FSZ (Clamp(#FSZ#+#Step#,7,200))][!UpdateMeter *][!Redraw]
; MouseScrollDownAction=[!SetVariable FSZ (Clamp(#FSZ#-#Step#,7,200))][!UpdateMeter *][!Redraw]
; LeftMouseUpAction=[!SetVariable STC1 #STC2#][!SetVariable STC2 #STC1#][!UpdateMeter *][!Redraw]
; DynamicVariables=1

; [ActualSizeValue]
; Group=AllMetersGroup
; Meter=String
; FontFace=Consolas
; FontColor=255,255,255,255
; FontSize=#FSZ#
; AntiAlias=1
; Padding=#Padding#,#Padding#,#Padding#,#Padding#
; StringAlign=Right
; X=(#STW#+#Padding#*2+#MaxSizeTemplateW#)
; Y=(#STW#)
; W=(#MaxSizeTemplateW#)
; H=(#MaxSizeTemplateH#)
; Text="000"
; UpdateDivider=-1
; DynamicVariables=1
As you can see, both methods work, with the 2nd not needing a double update (not that the said update would be a problem anyway). In other words, the posts have been quite useful for the general case, but less for mine. I'll keep the method and the idea in mind though, you never know when it might prove useful. ;-)

P.S. Just in case it isnt clear, the whole template thing comes from needing to know the maximum potential size of a string meter of a certain "style" (a maximum of 5 zeros in this case, but it could be anything, including a multiline string).
P.S.S. I liked your "Twin Peaks" reference, nice one! :lol:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5396
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: [FEATURE] BevelType Color

Post by eclectic-tech »

Thanks for the added info AC! :great:

Yes, I have used the invisible template meter method described by Yincognito, and it is just as effective in obtaining a meter's dimension for use in an earlier drawn meter and eliminates needing double updates.

I always like to see alternative methods because it lets the author decide which they want to use in different situations.

"Twin Peaks" :rolmfao:
User avatar
Yincognito
Rainmeter Sage
Posts: 7128
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: [FEATURE] BevelType Color

Post by Yincognito »

eclectic-tech wrote: February 18th, 2022, 4:30 pmYes, I have used the invisible template meter method described by Yincognito [...]
I always like to see alternative methods because it lets the author decide which they want to use in different situations.
Yeah, the invisible template meter method is useful in situations where you want to restrict a meter size to its maximum possible value - for example, a meter showing the CPU usage with 2 decimal digits won't be wider than 100.00%, or, better said, 000.00% since 0 is wider than 1 for proprtional fonts - but you also want that meter - and skin, by extension - to dynamically adapt to the current font and font size so that you can draw a bevel or an outline around the meter or skin.
eclectic-tech wrote: February 18th, 2022, 4:30 pm"Twin Peaks" :rolmfao:
Well, that was one strange, but quite exciting TV series. And Laura Palmer was a hottie, too bad she was dead in the show, LMAO. Or ... was she? O.O
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth