Page 1 of 1

Nesting MeterStyles?

Posted: May 14th, 2018, 2:49 pm
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

Re: Nesting MeterStyles?

Posted: May 14th, 2018, 2:55 pm
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.

Re: Nesting MeterStyles?

Posted: May 14th, 2018, 3:00 pm
by raiguard
Ah, I understand. Thanks anyway.

Re: Nesting MeterStyles?

Posted: May 14th, 2018, 5:03 pm
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

Re: Nesting MeterStyles?

Posted: May 14th, 2018, 5:05 pm
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.

Re: Nesting MeterStyles?

Posted: May 14th, 2018, 5:19 pm
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