It is currently September 21st, 2019, 1:37 am

Looking to be pointed in the right direction

Help with creating, editing & fixing problems with skins
User avatar
balala
Rainmeter Sage
Posts: 8631
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Looking to be pointed in the right direction

balala » March 14th, 2019, 9:23 pm

Ferbstorm wrote:
March 14th, 2019, 9:14 pm
So I've been screwing with this as well, and while yours is much more elegant than mine is, we've both got the same problem going. I want the mouse to be detected over the transformed bar so I can hover over it and change the volume with the mouse wheel. And I'm having the hardest time trying to figure out how to make that happen. I could of course just have the whole background of the image recognize the mouse, but that feels lazy to me.
Unfortunately when TransformationMatrix is applied, the mouse action is detected as if the meter wasn't altered. There is no possibility to change this. This is one of the majorest disadvantages of TransformationMatrix.
Tomorrow (here is almost midnight) I'll try something more, but... Let's see.
Ferbstorm
Posts: 36
Joined: March 9th, 2019, 12:50 am

Re: Looking to be pointed in the right direction

Ferbstorm » March 14th, 2019, 9:31 pm

Hey well thanks for all your help so far man. Looking forward to seeing what you come up with. It's mid day here, so maybe I'll beat you to it
User avatar
balala
Rainmeter Sage
Posts: 8631
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Looking to be pointed in the right direction

balala » March 14th, 2019, 9:37 pm

Ferbstorm wrote:
March 14th, 2019, 9:31 pm
It's mid day here, so maybe I'll beat you to it
Ok, let me know if you did beat me. :great:
Ferbstorm
Posts: 36
Joined: March 9th, 2019, 12:50 am

Re: Looking to be pointed in the right direction

Ferbstorm » March 14th, 2019, 10:00 pm

So, you might have a more elegant solution, but I came up with something that was good enough for me. If you want to see what I did visually set #Trans# to about 130

Code: Select all

[Rainmeter]
Update=1000
Backgroundmode=1
MouseActionCursor=0

[Variables]
Trans=0
VolumeBase=40,40,40,240
VolumeOver=237,237,237,100

[Style]
Meter=string
Fontface=#Font#
Fontcolor=237,237,237,100
Fontsize=10
AntiAlias=1
StringAlign=Centercenter

[MVolume]
Measure=Plugin
Plugin=Win7AudioPlugin

[MVolumeP]
Measure=Calc
Formula=MVolume

[BG]
meter=image
solidcolor=240,40,40,0
W=137
H=380

[MouseDet1]
meter=image
solidcolor=255,255,255,#Trans#
W=10
H=380
MouseScrollUpAction=[!CommandMeasure "MVolume" "ChangeVolume 5"] [!update]
MouseScrollDownAction=[!CommandMeasure "MVolume" "ChangeVolume -5"] [!update]

[MouseDet2]
meter=image
solidcolor=255,255,0,#Trans#
W=10
H=353
X=10
MouseScrollUpAction=[!CommandMeasure "MVolume" "ChangeVolume 5"] [!update]
MouseScrollDownAction=[!CommandMeasure "MVolume" "ChangeVolume -5"] [!update]

[MouseDet3]
meter=image
solidcolor=255,255,0,#Trans#
W=10
H=326
X=20
MouseScrollUpAction=[!CommandMeasure "MVolume" "ChangeVolume 5"] [!update]
MouseScrollDownAction=[!CommandMeasure "MVolume" "ChangeVolume -5"] [!update]

[MouseDet4]
meter=image
solidcolor=255,255,0,#Trans#
W=10
H=299
X=30
MouseScrollUpAction=[!CommandMeasure "MVolume" "ChangeVolume 5"] [!update]
MouseScrollDownAction=[!CommandMeasure "MVolume" "ChangeVolume -5"] [!update]

[MouseDet5]
meter=image
solidcolor=255,255,0,#Trans#
W=10
H=272
X=40
MouseScrollUpAction=[!CommandMeasure "MVolume" "ChangeVolume 5"] [!update]
MouseScrollDownAction=[!CommandMeasure "MVolume" "ChangeVolume -5"] [!update]

[MouseDet6]
meter=image
solidcolor=255,255,0,#Trans#
W=10
H=245
X=50
MouseScrollUpAction=[!CommandMeasure "MVolume" "ChangeVolume 5"] [!update]
MouseScrollDownAction=[!CommandMeasure "MVolume" "ChangeVolume -5"] [!update]

[MouseDet7]
meter=image
solidcolor=255,255,0,#Trans#
W=10
H=218
X=60
MouseScrollUpAction=[!CommandMeasure "MVolume" "ChangeVolume 5"] [!update]
MouseScrollDownAction=[!CommandMeasure "MVolume" "ChangeVolume -5"] [!update]

[MouseDet8]
meter=image
solidcolor=255,255,0,#Trans#
W=10
H=191
X=70
MouseScrollUpAction=[!CommandMeasure "MVolume" "ChangeVolume 5"] [!update]
MouseScrollDownAction=[!CommandMeasure "MVolume" "ChangeVolume -5"] [!update]

[MouseDet9]
meter=image
solidcolor=255,255,0,#Trans#
W=10
H=164
X=80
MouseScrollUpAction=[!CommandMeasure "MVolume" "ChangeVolume 5"] [!update]
MouseScrollDownAction=[!CommandMeasure "MVolume" "ChangeVolume -5"] [!update]

[MouseDet10]
meter=image
solidcolor=255,255,0,#Trans#
W=10
H=137
X=90
MouseScrollUpAction=[!CommandMeasure "MVolume" "ChangeVolume 5"] [!update]
MouseScrollDownAction=[!CommandMeasure "MVolume" "ChangeVolume -5"] [!update]

[MouseDet11]
meter=image
solidcolor=255,255,0,#Trans#
W=10
H=110
X=100
MouseScrollUpAction=[!CommandMeasure "MVolume" "ChangeVolume 5"] [!update]
MouseScrollDownAction=[!CommandMeasure "MVolume" "ChangeVolume -5"] [!update]

[MouseDet12]
meter=image
solidcolor=255,255,0,#Trans#
W=10
H=83
X=110
MouseScrollUpAction=[!CommandMeasure "MVolume" "ChangeVolume 5"] [!update]
MouseScrollDownAction=[!CommandMeasure "MVolume" "ChangeVolume -5"] [!update]

[MouseDet13]
meter=image
solidcolor=255,255,0,#Trans#
W=10
H=56
X=120
MouseScrollUpAction=[!CommandMeasure "MVolume" "ChangeVolume 5"] [!update]
MouseScrollDownAction=[!CommandMeasure "MVolume" "ChangeVolume -5"] [!update]

[MouseDet14]
meter=image
solidcolor=255,255,0,#Trans#
W=10
H=29
X=130
MouseScrollUpAction=[!CommandMeasure "MVolume" "ChangeVolume 5"] [!update]
MouseScrollDownAction=[!CommandMeasure "MVolume" "ChangeVolume -5"] [!update]

[VolumeBarImage1]
meter=image
solidcolor=#VolumeBase#
W=26
H=400
TransformationMatrix=0.93969;.34202;-.34202;.93969;113;-13

[VolumeBarImage2]
Measurename=MVolume
Meter=bar
barcolor=#VolumeOver#
W=26
H=400
TransformationMatrix=0.93969;.34202;-.34202;.93969;113;-13

[Volumepercent]
Meter=string
meterstyle=style
measurename=mVolumep
Text=%1
X=13
Y=200
TransformationMatrix=0.93969;.34202;-.34202;.93969;113;-13
**Edit**

So after setting my transparencies the way I wanted it, I noticed something really weird. The mouse wheel was only being detected directly on the volume bar, not inside the triangle. So thought huh, weird, maybe this has to do with the actual transparency of the color. So what I did is I remove all my little mouse detection slots and instead but the mouse scroll up/down on the background image itself, set its transparency to 0, and it works exactly the same! Who'd'a thunk it? This is the new code for my lil volume meter

Code: Select all

[Rainmeter]
Update=1000
Backgroundmode=1
MouseActionCursor=0

[Variables]
Trans=0
VolumeBase=40,40,40,240
VolumeOver=237,237,237,100

[Style]
Meter=string
Fontface=#Font#
Fontcolor=237,237,237,100
Fontsize=10
AntiAlias=1
StringAlign=Centercenter

[MVolume]
Measure=Plugin
Plugin=Win7AudioPlugin

[MVolumeP]
Measure=Calc
Formula=MVolume

[BG]
meter=image
solidcolor=240,40,40,0
W=137
H=380
MouseScrollUpAction=[!CommandMeasure "MVolume" "ChangeVolume 5"] [!update]
MouseScrollDownAction=[!CommandMeasure "MVolume" "ChangeVolume -5"] [!update]

[VolumeBarImage1]
meter=image
solidcolor=#VolumeBase#
W=26
H=400
TransformationMatrix=0.93969;.34202;-.34202;.93969;113;-13

[VolumeBarImage2]
Measurename=MVolume
Meter=bar
barcolor=#VolumeOver#
W=26
H=400
TransformationMatrix=0.93969;.34202;-.34202;.93969;113;-13

[Volumepercent]
Meter=string
meterstyle=style
measurename=mVolumep
Text=%1
X=13
Y=200
TransformationMatrix=0.93969;.34202;-.34202;.93969;113;-13
Last edited by jsmorley on March 14th, 2019, 10:57 pm, edited 1 time in total.
Reason: Please use [code] tags on long code snippets. It's the </> button.
Ferbstorm
Posts: 36
Joined: March 9th, 2019, 12:50 am

Re: Looking to be pointed in the right direction

Ferbstorm » March 15th, 2019, 3:39 am

Okay, so I've got another thing I'd like to do. What I'm thinking is it'd be nice to right click on the volume bar and have that bring up the playback devices menu. Is this a possibility? Actually, ideally, Left click would toggle between my two most used devices, and right click would bring up the menu
User avatar
balala
Rainmeter Sage
Posts: 8631
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Looking to be pointed in the right direction

balala » March 15th, 2019, 5:12 pm

Ferbstorm wrote:
March 14th, 2019, 10:00 pm
So after setting my transparencies the way I wanted it, I noticed something really weird. The mouse wheel was only being detected directly on the volume bar, not inside the triangle. So thought huh, weird, maybe this has to do with the actual transparency of the color. So what I did is I remove all my little mouse detection slots and instead but the mouse scroll up/down on the background image itself, set its transparency to 0, and it works exactly the same! Who'd'a thunk it? This is the new code for my lil volume meter
The Trans variable is used as the transparency of some meters, like [MouseDet1], [MouseDet2] and so on. If you set this transparency to 0, the meter can't detect the mouse actions (like scrolling), because it is completely transparent. To detect it, set its transparency to 1 (Trans=1 within the [Variables] section). With this value, the meter still remains invisible (having a transparency of 1 from 255 - so it's not visible), but it'll detect the mouse actions.
Note a few more details:
  • The posted TransformationMatrix options on the [VolumeBarImage1], [VolumeBarImage2] and [Volumepercent] meters are calculated correctly probably (the meters being rotated appropriately) but if you want to modify for example the rotation angle, you have to recalculate them. Better would be to use some sort of formulas into those TransformationMatrices, which use a variable (like Angle in my previous code), and with this, when you want to rotate the meters with a different angle, the only thing you have to do, is to rewrite the value of that variable within the [Variables] section.
  • Maybe there is no need to have 14 Image meters, used to detect the mouse scrolling ([MouseDet1] - [MouseDet14]). I'd use one single, rectangular meter, which would detect the mouse scrolling not just above the rotated Bar, but also below it. Would be mach simpler to use one single meter, instead of 14.
  • Not sure why have you introduced the [MVolumeP] Calc measure? Is there any need of using it? I don't see it...
  • When applying the posted TransformationMatrix options on the [VolumeBarImage1], [VolumeBarImage2] and [Volumepercent], I get the meters clipped. I'd move them a little bit to right and down, to have them completely visible.
Ferbstorm
Posts: 36
Joined: March 9th, 2019, 12:50 am

Re: Looking to be pointed in the right direction

Ferbstorm » March 15th, 2019, 6:35 pm

So the clipping is actually intentional for me. I got them just right so on the upper and lower ends you can still see the volume visually (as in at 5 there is a sliver that visually changes, and the same is true at 95) but so it's not just a floating rectangle in the corner of my screen. It's just there as a little ribbon.

And most of this code is stuff I cannibalized from a skin I downloaded and then changed around to meet my needs. The [MVolumeP] measure I have no idea what it's doing. I can just get rid of it?

And I also used the 14 meters cause I didn't necessarily want it to detect the mouse so far away from the volume bar. Currently I have two options, one with just a simple big transparent rectangle, making it so it only detects the mouse action on the bar itself, and then the one with the 14 meters with a transparency of 1 so it detects on the bar and above it. Gonna wait and see which one I like more. If you're curious, this is what it looks like after I spent last night tinkering with colors and adding shutdown and restart buttons.

https://imgur.com/TpG7TvP

If you can't tell, I'm going for something as unobtrusive as possible, since I love my background and it's already pretty busy. No need to make that worse
User avatar
balala
Rainmeter Sage
Posts: 8631
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Looking to be pointed in the right direction

balala » March 15th, 2019, 6:49 pm

Ferbstorm wrote:
March 15th, 2019, 6:35 pm
So the clipping is actually intentional for me. I got them just right so on the upper and lower ends you can still see the volume visually (as in at 5 there is a sliver that visually changes, and the same is true at 95) but so it's not just a floating rectangle in the corner of my screen. It's just there as a little ribbon.
Oh, ok, as you wish...
Ferbstorm wrote:
March 15th, 2019, 6:35 pm
And most of this code is stuff I cannibalized from a skin I downloaded and then changed around to meet my needs.
Don't worry, this is the best way to learn how to work with skins. Go ahead and fell always free to study other authors codes.
Ferbstorm wrote:
March 15th, 2019, 6:35 pm
The [MVolumeP] measure I have no idea what it's doing. I can just get rid of it?
Yep, you can, it seems. There is no need of it. Maybe in the original code it was used somehow, but here it is not, so you can remove it freely.
Ferbstorm wrote:
March 15th, 2019, 6:35 pm
And I also used the 14 meters cause I didn't necessarily want it to detect the mouse so far away from the volume bar. Currently I have two options, one with just a simple big transparent rectangle, making it so it only detects the mouse action on the bar itself, and then the one with the 14 meters with a transparency of 1 so it detects on the bar and above it. Gonna wait and see which one I like more.
Once again, this is your choice.
Ferbstorm wrote:
March 15th, 2019, 6:35 pm
If you're curious, this is what it looks like after I spent last night tinkering with colors and adding shutdown and restart buttons.

https://imgur.com/TpG7TvP

If you can't tell, I'm going for something as unobtrusive as possible, since I love my background and it's already pretty busy. No need to make that worse
I just can't see there the skin we are talking about in this topic.
Nice wallpaper, BTW.
Ferbstorm
Posts: 36
Joined: March 9th, 2019, 12:50 am

Re: Looking to be pointed in the right direction

Ferbstorm » March 15th, 2019, 7:59 pm

balala wrote:
March 15th, 2019, 6:49 pm
I just can't see there the skin we are talking about in this topic.
Nice wallpaper, BTW.
It's in the very top left, tinted green and slightly transparent

And thanks! I love it a lot
User avatar
balala
Rainmeter Sage
Posts: 8631
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Looking to be pointed in the right direction

balala » March 15th, 2019, 8:06 pm

Ferbstorm wrote:
March 15th, 2019, 7:59 pm
It's in the very top left, tinted green and slightly transparent
Indeed, it's there. Looking to the screenshot and seeing it there, I just realized why do you need the meters clipped, as you did. Now it makes sense. Good job...