It is currently July 16th, 2024, 11:32 am

Brain Bender Variables Issue Image Width for Progress Bar and image width

Get help with creating, editing & fixing problems with skins
User avatar
CodeCode
Posts: 1374
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Brain Bender Variables Issue Image Width for Progress Bar and image width

Post by CodeCode »

Hello,

I have been looking at this for a few hours.

I can't seem to get the graphic to change consistently with the progress bar and some extra images at each end - basically the total width some extra at each end is the desired product. But the width is not arranging correctly at both ends according to the artist - title and progress bar width - in the center at the top of a 1920 x 1080 screen.

The image is cut off, or the centering is off cant seem to find a happy medium.
Tunes Shower_x.rmskin
I hope I am just missing something rather than this being weirdly impossible - lol.

Thanks for any help. :)
You do not have the required permissions to view the files attached to this post.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
Yincognito
Rainmeter Sage
Posts: 7731
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Brain Bender Variables Issue Image Width for Progress Bar and image width

Post by Yincognito »

CodeCode wrote: November 20th, 2023, 9:04 pm Hello,

I have been looking at this for a few hours.

I can't seem to get the graphic to change consistently with the progress bar and some extra images at each end - basically the total width some extra at each end is the desired product. But the width is not arranging correctly at both ends according to the artist - title and progress bar width - in the center at the top of a 1920 x 1080 screen.

The image is cut off, or the centering is off cant seem to find a happy medium.

Tunes Shower_x.rmskin

I hope I am just missing something rather than this being weirdly impossible - lol.

Thanks for any help. :)
Well, it's probably just a simple math positional problem, after less than 1 minute looking at it. From what I can tell, the cutting off only happens on wider artist - title combos (and on the left side), the narrower ones are just fine. Then, since I didn't want to bother much with it, I just added a random 1 to make it X=(1962/2) - 27 in [CentreText] and the issue seemed to go away. So basically, it appears that you should increase that value. Why, I have no idea at this time of day, it's your code, lol...
Well, ok, I have an idea, but I suppose you'll realize as well that 962 is not 1920 (though there might be other more proper way to tackle this, I reckon)...
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
CodeCode
Posts: 1374
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Brain Bender Variables Issue Image Width for Progress Bar and image width

Post by CodeCode »

Yincognito wrote: November 20th, 2023, 9:31 pm Well, it's probably just a simple math positional problem...
Well, ok, I have an idea, but I suppose you'll realize as well that 962 is not 1920 (though there might be other more proper way to tackle this, I reckon)...
Happy to wait until the timing is better.

I have tried a lot of variations, Either getting the image cut off or being too far to the right.

I'll keep trying.

I have similar arrangements with similar code parts and everything is fine. but this part seems to dislike conformity. :p I surmise that it is the variable progress bar - but that part no matter how messed up things look stays fine with the main text meter. :?
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
Yincognito
Rainmeter Sage
Posts: 7731
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Brain Bender Variables Issue Image Width for Progress Bar and image width

Post by Yincognito »

CodeCode wrote: November 20th, 2023, 11:11 pm Happy to wait until the timing is better.

I have tried a lot of variations, Either getting the image cut off or being too far to the right.
Well, the above worked for me in terms of skin drawing (no cut off parts, for both short and long texts), so I'm not sure what you're referring to. In terms of screen coordinates though, you might want to add a !SetWindowPosition bang after redrawing the skin with the updated dimensions, so it's vertically at the top and horizontally centered on the screen:
https://docs.rainmeter.net/manual/bangs/#Skin

Doesn't this solve the issue? Obviously if the text is much wider than your screen's horizontal resolution, it goes without saying that it won't fit the screen anyway, unless you either wrap it, decrease the font size or make a marquee out of it...
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
CodeCode
Posts: 1374
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Brain Bender Variables Issue Image Width for Progress Bar and image width

Post by CodeCode »

Yep. SO that option was indeed explored. I tried this OnRefreshAction=[!SetWindowPosition "50%" "-100%" "50%" "0%"] as well. I dont think it matters but the Y position is actually -100%.

Still, the only actual issue is consistent centering of the text and thereby6 the rest of the skin should follow - but it doesnt.

I'll figure it out.

Thanks. :great:
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
Yincognito
Rainmeter Sage
Posts: 7731
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Brain Bender Variables Issue Image Width for Progress Bar and image width

Post by Yincognito »

CodeCode wrote: November 21st, 2023, 11:42 am Yep. SO that option was indeed explored. I tried this OnRefreshAction=[!SetWindowPosition "50%" "-100%" "50%" "0%"] as well. I dont think it matters but the Y position is actually -100%.

Still, the only actual issue is consistent centering of the text and thereby6 the rest of the skin should follow - but it doesnt.

I'll figure it out.

Thanks. :great:
Oh, now I see what you mean: you want to synchronize the display of text and images on track changes, since the coordinates of the latter depend on the former. I thought that was a "feature" of your skin and kinda liked it, lol. Anyway, the problem here is the order of meters: you try to compute the coordinates of a meter (e.g. [CentreAbove]) based on the coordinates of another meter placed AFTER the first one (e.g. [CentreText]). That means the values computed in the former need an additional skin update to get the values from the latter, since a measure / meter can only know what's BEFORE it during the same update cycle.

One solution would be to duplicate an invisible [CentreText] before [CentreAbove], so that the latter can use the dimensions of the former to calculate its own (did some other minor changes to the code):

Code: Select all

[Variables]
@include=#@#MainVariables.inc

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1
OnRefreshAction=[!SetWindowPosition "0" "0"]

---Measures---

[Artist]
Measure=NowPlaying
PlayerName=#Player#
PlayerType=Artist
Substitute="":"Artist"
DynamicVariables=1

[MeasureTrack]
Measure=NowPlaying
PlayerName=[Artist]
PlayerType=Title
Substitute="":"Title"
DynamicVariables=1

[MeasureBar]
Measure=NowPlaying
PlayerName=[Artist]
PlayerType=Progress
MinValue=0
MaxValue=100
DynamicVariables=1

[mDuration]
Measure=NowPlaying
PlayerName=[Artist]
PlayerType=DURATION

[mPosition]
Measure=NowPlaying
PlayerName=[Artist]
PlayerType=POSITION

[MinRemaining]
Measure=Calc
Formula=trunc((mDuration - mPosition)/60)
RegExpSubstitute=1
DynamicVariables=1

[SecRemaining]
Measure=Calc
Formula=((mDuration - mPosition) % 60)
RegExpSubstitute=1
Substitute="^(.)$":"0\1"
DynamicVariables=1

---Meters---

[CentreText]
Meter=String
MeasureName=Artist
MeasureName2=MeasureTrack
X=(#SCREENAREAWIDTH#/2)
Y=5
StringAlign=Center
StringCase=Lower
Text=%1 - %2 
StringEffect=Border
FontEffectColor=0,0,0,0
SolidColor=0,0,0,0
FontColor=0,0,0,0
FontFace=#ReportFont#
FontSize=25
DynamicVariables=1

[CentreAbove]
Meter=Image
ImageName=#@#Centre Above.png
ImageTint=#VolMain#
ImageAlpha=150
X=(([CentreText:X] - [ScrollL:W]) - 94)
Y=2
W=(([CentreText:W] + [ScrollL:W] + [ScrollR:W]) + 94 * 2)
H=100
DynamicVariables=1

[CentreTextVisible]
Meter=String
MeasureName=Artist
MeasureName2=MeasureTrack
X=(#SCREENAREAWIDTH#/2)
Y=5
StringAlign=Center
StringCase=Lower
Text=%1 - %2 
StringEffect=Border
FontEffectColor=0,0,0,255
SolidColor=0,0,0,1
FontColor=#AltColor#
FontFace=#ReportFont#
FontSize=25
DynamicVariables=1

[ScrollL]
Meter=Image
ImageName=#@#Edge.png
ImageFlip=None
ImageTint=#MainColor#
X=([CentreText:X]-[ScrollL:W] - 10)
Y=2
W=165
H=38
DynamicVariables=1
Hidden=0

[ScrollR]
Meter=Image
ImageName=#@#Edge.png
ImageFlip=Horizontal
ImageTint=#MainColor#
X=([CentreText:X]+[CentreText:W] + 10)
Y=r
W=165
H=38
DynamicVariables=1
Hidden=0

[ProgressBar]
Meter=Shape
X=[CentreText:X]
Y=0r
Shape=Rectangle 0,0,([CentreText:W]),9,2 | Fill Color 0,0,0,255 | StrokeWidth 1 | Stroke Color #VolMain#
Shape2=Rectangle 0,0,(([MeasureBar]*[CentreText:W])/100),9,2 | StrokeWidth 0 | Fill LinearGradient MyGradient
MyGradient=180 | 0,71,130,180; 0 | 0,146,205,180; 0.79 | 25,246,255,180; 0.99
DynamicVariables=1
AntiAlias=1

[ProgressText]
Meter=String
MeasureName=mPosition
SolidColor=0,0,0,1
FontFace=Calibri
FontSize=10
FontColor=#TotalbColor#
StringAlign=Left
X=([CentreText:X]-[ProgressText:W])-3
Y=-3r
Text=%1
DynamicVariables=1

[DurationText]
Meter=String
MeasureName=mDuration
SolidColor=0,0,0,1
FontFace=Calibri
FontSize=10
FontColor=#TotalbColor#
StringAlign=Left
X=([CentreText:X]+[CentreText:W])+3
Y=r
Text=%1
DynamicVariables=1
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
CodeCode
Posts: 1374
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Brain Bender Variables Issue Image Width for Progress Bar and image width

Post by CodeCode »

Cool.

Thanks for going through all of that code and setting things correctly for my need.

Empty it looks off, but with a title etc, it looks great! (it's never empty for long).

It looks great never mind that part of my post.

Thanks You Yincognito :rosegift:

EDIT:

Just wanted to add that your hashing out the intrinsic details was really insightful.

Thanks Again!
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
Yincognito
Rainmeter Sage
Posts: 7731
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Brain Bender Variables Issue Image Width for Progress Bar and image width

Post by Yincognito »

CodeCode wrote: November 22nd, 2023, 11:32 am Cool.

Thanks for going through all of that code and setting things correctly for my need.

Empty it looks off, but with a title etc, it looks great! (it's never empty for long).

It looks great never mind that part of my post.

Thanks You Yincognito :rosegift:

EDIT:

Just wanted to add that your hashing out the intrinsic details was really insightful.

Thanks Again!
No problem, glad you're OK with the outcome. ;-)

I guess the skin can get rid of the empty space at the left of its [CentreAbove] meter by adapting the [CentreText]'s X formula accordingly and using horizontally centered !SetWindowPosition parameters on track change instead of on refresh, but the above approach seemed simpler and more straightforward, without any real drawback, hence my earlier post.

Now, back to my AutoIt / AutoHotKey / WindowMessagePlugin window manager / spy / messenger skin project - need to see if it can be made even faster for a feasible real-time usage... sorry, was I still writing here instead of my head? :lol:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
CodeCode
Posts: 1374
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Brain Bender Variables Issue Image Width for Progress Bar and image width

Post by CodeCode »

I had to come back for this one, and say thanks again, so, thanks again!

I did actually contrive the scripts for it, like the invisible meter, and section hierarchy, but was not fully understanding how to proceed.

As always I get over complicated and spin out only to return another day, and bingo bango bongo! Coconuts fir everyone.

The biggest thrill was beginning on the right foot for a change.
:Medal
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
Yincognito
Rainmeter Sage
Posts: 7731
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Brain Bender Variables Issue Image Width for Progress Bar and image width

Post by Yincognito »

CodeCode wrote: November 28th, 2023, 3:54 pm I had to come back for this one, and say thanks again, so, thanks again!

I did actually contrive the scripts for it, like the invisible meter, and section hierarchy, but was not fully understanding how to proceed.

As always I get over complicated and spin out only to return another day, and bingo bango bongo! Coconuts fir everyone.

The biggest thrill was beginning on the right foot for a change.
:Medal
:thumbup: :great:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth