It is currently March 28th, 2024, 9:55 am

Nesting MeterStyles?

Report bugs with the Rainmeter application and suggest features.
Post Reply
User avatar
raiguard
Posts: 660
Joined: June 25th, 2015, 7:02 pm
Location: The Sky, USA
Contact:

Nesting MeterStyles?

Post by raiguard »

Would it be possible to add support for nesting MeterStyles? Here's an example of why I would like this:

I recently discovered the #CURRENTSECTION# variable, and I am working on standardizing all meters that have button hover effects (changing the text/image to a light red color) to use this single MeterStyle so the effects can be changed in bulk if I decide to in the future. However, it is still a pain to add this new MeterStyle to every meter that has a hover effect.

There are hundreds of meters in my suite that all use the same MeterStyle (e.g. toggle buttons in my settings skins). If I want to add hover effects to the toggle buttons, I either have to copy the text hover effect MeterStyle into the toggle button MeterStyle (which goes against the point of making that MeterStyle in the first place), or I have to go add it to each button's MeterStyle option individually (completely possible, but extremely tedious).

It would be great if I could "nest" meterstyles so I could add the hover effect style to the toggle button style and have done with it.

Something like this:

Code: Select all

[StyleStringButtonHover]
MouseOverAction=[!SetOption #CURRENTSECTION# FontColor "#colorButtonPress#"][!UpdateMeter #CURRENTSECTION#][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# FontColor ""][!UpdateMeter #CURRENTSECTION#][!Redraw]

[StyleToggleButton]
MeterStyle=StyleStringButtonHover
FontFace=ElegantIcons
FontColor=#colorAccent#
FontSize=12
X=#contentMargin#
Y=5R
Last edited by raiguard on May 14th, 2018, 2:55 pm, edited 1 time in total.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Nesting MeterStyles?

Post by jsmorley »

This is not so much "nesting" as it is "cascading", and that is really insanely complicated to do in the context of how MeterStyle is designed. I would not hold out much hope for this.
User avatar
raiguard
Posts: 660
Joined: June 25th, 2015, 7:02 pm
Location: The Sky, USA
Contact:

Re: Nesting MeterStyles?

Post by raiguard »

Ah, I understand. Thanks anyway.
oZone
Posts: 154
Joined: May 14th, 2018, 4:46 pm

Re: Nesting MeterStyles?

Post by oZone »

You could use

Code: Select all

[StyleStringButtonHover]
MouseOverAction=[!SetOption #CURRENTSECTION# FontColor "#colorButtonPress#"][!UpdateMeter #CURRENTSECTION#][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# FontColor ""][!UpdateMeter #CURRENTSECTION#][!Redraw]

[StyleToggleButton]
FontFace=ElegantIcons
FontColor=#colorAccent#
FontSize=12
X=#contentMargin#
Y=5R

[ToggleButton]
Meter=String
MeterStyle=StyleToggleButton | StyleStringButtonHover
You can also cascade more styles

Code: Select all

MeterStyle=Style1 | Style2 | Style3 | Style4 | Style5 | ... | StyleN
Take note of that for example Style3 will overwrite Style1 and Style2 if they have same parameters
User avatar
raiguard
Posts: 660
Joined: June 25th, 2015, 7:02 pm
Location: The Sky, USA
Contact:

Re: Nesting MeterStyles?

Post by raiguard »

oZone wrote:You could use

Code: Select all

[StyleStringButtonHover]
MouseOverAction=[!SetOption #CURRENTSECTION# FontColor "#colorButtonPress#"][!UpdateMeter #CURRENTSECTION#][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# FontColor ""][!UpdateMeter #CURRENTSECTION#][!Redraw]

[StyleToggleButton]
FontFace=ElegantIcons
FontColor=#colorAccent#
FontSize=12
X=#contentMargin#
Y=5R

[ToggleButton]
Meter=String
MeterStyle=StyleToggleButton | StyleStringButtonHover
You can also cascade more styles

Code: Select all

MeterStyle=Style1 | Style2 | Style3 | Style4 | Style5 | ... | StyleN
Take note of that for example Style3 will overwrite Style1 and Style2 if they have same parameters
I know about that. I was wondering about nesting meterstyles because I would otherwise have to add the extra style to over 100 meters by hand, which is tedious.
oZone
Posts: 154
Joined: May 14th, 2018, 4:46 pm

Re: Nesting MeterStyles?

Post by oZone »

Than you can add that style using regular expressions
if you don't know how to use it you can always use this
1)get notepad++ or similar text editor
2)select line or end part of it that you want to change (e.g. MeterStyle=sBase | sStyle1)
3)press ctrl+f
4)get to replace tab
5)copy line to "Replace with" box, and add "| sNextStyle" (e.g. MeterStyle=sBase | sStyle1 | sNextStyle)
6)if that line is same everywhere you can press replace all, if not or you want to decide where to add it press replace
Post Reply