It is currently December 10th, 2018, 8:50 pm

New Container meter option

Changes made during the Rainmeter 4.3 beta cycle.
User avatar
jsmorley
Developer
Posts: 18445
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

New Container meter option

jsmorley » December 1st, 2018, 1:06 am

Container=SomeMeter

Define a meter to be used as a "container" for the "contents" of another meter.

The documentation and a bunch of examples for Container are at https://docs.rainmeter.net/manual-beta/meters/general-options/container/

The intent of this is two-fold:

A meter that has a Container option will in effect be put "inside" the container meter. It will be positioned relative to the container, and will be visibly constrained by it. Only the part of the content that is "inside" the container will be drawn.

Think sliding content, a menu or launcher for instance, into view without needing to start outside the entire skin.

The content will be "masked" into any solid pixels in the container meter. So only the part of the content that is masked into a "solid" pixel in the container will be drawn.

Think masking an image into a String meter, or an image into a Shape meter.

An existing discussion about this feature is at https://forum.rainmeter.net/viewtopic.php?f=123&t=30121#p155025.

The following issues found during the early "alpha" testing were corrected:
1) Corrected an issue when a "container" meter is resized dynamically.
2) Corrected an issue of duplicate "masking" when a "content" meter is switched dynamically from one "container" meter to another.
3) Corrected an issue when a "container" meter is "hidden", or otherwise has either W or H set to zero.


As with all the best features, this is very simple in principle, and very easy to wrap your head around, while being VERY powerful and flexible, and allowing for a lot of creativity. Go nuts!
User avatar
jsmorley
Developer
Posts: 18445
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: New Container meter option

jsmorley » December 1st, 2018, 2:45 pm

Here is what the various examples in the .rmskin at the bottom of the Container documentation look like:


Click to animate larger .gif files

HelloWorld.gif
BarMeter.gif
ClipString.gif
ImageInString.gif
IrisShape.gif
MaskImage.png
MaskShape.png
NiceWeather.jpg
RainyWeather.gif
Relative.png].png
RoundLineGradient.gif
ScaleShapeMask.gif
ScrollText.gif
SizeContainer.gif
Teleport.gif
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 18445
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: New Container meter option

jsmorley » December 1st, 2018, 6:33 pm

Here is another example. You can have as many "content" meters in a "container" as you want:

Code: Select all

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

[Variables]
ContainerH=48
U=[!UpdateMeasure Slider][!UpdateMeter *][!Redraw]

;[GATHER MEMORY]==================================

[MeasurePhysMemTotal]
Measure=PhysicalMemory
Total=1
UpdateDivider=-1

[MeasurePhysMemUsed]
Measure=PhysicalMemory
UpdateDivider=2

[MeasurePhysMemFree]
Measure=PhysicalMemory
InvertMeasure=1
UpdateDivider=2

[MeasureSwapMemTotal]
Measure=SwapMemory
Total=1
UpdateDivider=2

[MeasureSwapMemUsed]
Measure=SwapMemory
UpdateDivider=2

[MeasureSwapMemFree]
Measure=SwapMemory
InvertMeasure=1
UpdateDivider=2

[MeasurePageTotal]
Measure=Calc
Formula=MeasureSwapMemTotal - MeasurePhysMemTotal
UpdateDivider=2

[MeasurePageUsedPercent]
Measure=Plugin
Plugin=UsageMonitor
Category=Paging File
Counter=% Usage
UpdateDivider=2

[MeasurePageUsed]
Measure=Calc
Formula=MeasurePageTotal * (MeasurePageUsedPercent / 100)
UpdateDivider=2

[MeasurePageFree]
Measure=Calc
Formula=MeasurePageTotal - MeasurePageUsed
UpdateDivider=2

;[BACKGROUND CONTAINER]============================

[MeterBackVisible]
Meter=Shape
Shape=Rectangle 1,1,220,#ContainerH# | StrokeWidth 2 | Stroke Color 155,155,155,255 | Fill Color 47,47,47,255
DynamicVariables=1
MouseOverAction=[!CommandMeasure Slider "Stop 2"][!CommandMeasure Slider "Execute 1"]
MouseLeaveAction=[!CommandMeasure Slider "Stop 1"][!CommandMeasure Slider "Execute 2"]

[MeterBackContainer]
Meter=Shape
Shape=Rectangle 1,1,220,#ContainerH# | StrokeWidth 2
DynamicVariables=1

;[METERSTYLES]====================================

[AllStyle]
FontSize=11
FontWeight=600
FontColor=255,255,255,255
SolidColor=0,0,0,1
AntiAlias=1
AutoScale=1
NumOfDecimals=1
Container=MeterBackContainer

[LeftStyle]
StringAlign=Left

[RightStyle]
StringAlign=Right

;[ALWAYS DISPLAY]=================================

[MeterRAMTitle]
Meter=String
X=10
Y=10
FontSize=15
FontWeight=600
FontColor=255,255,255,255
SolidColor=0,0,0,1
StringAlign=Left
AntiAlias=1
Text=RAM

[MeterRAMValue]
Meter=String
MeasureName=MeasurePhysMemFree
X=210
Y=10
FontSize=15
FontWeight=600
FontColor=255,255,255,255
SolidColor=0,0,0,1
StringAlign=Right
AutoScale=1
AntiAlias=1
Text=%1B

[MeterPhysMemoryBar]
Meter=Bar
MeasureName=MeasurePhysMemUsed
BarOrientation=Horizontal
BarColor=0,255,0,255
SolidColor=80,80,80,255
X=10
Y=2R
W=200
H=2

;[SLIDE CONTAINER]===================================

[Slider]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat SlideDown,3,46
SlideDown=[!SetVariable ContainerH "(Clamp(#ContainerH#+4,48,230))"]#U#
ActionList2=Repeat SlideUp,3,46
SlideUp=[!SetVariable ContainerH "(Clamp(#ContainerH#-4,48,230))"]#U#
DynamicVariables=1

;[CONTAINER CONTENT]=================================

[MeterPhysTotalTitle]
Meter=String
MeterStyle=AllStyle | LeftStyle
; Note that this is 10 X  and 50 Y pixels relative to the starting X and Y of the
; Container meter, [MeterBackContainer].
X=10
Y=50
Text=Physical Total

[MeterPhysTotalValue]
Meter=String
MeterStyle=AllStyle | RightStyle
MeasureName=MeasurePhysMemTotal
; This "content" meter will be relative to the preceding content meter, [MeterPhysTotalTitle]. 
X=210
Y=0r
Text=%1B

[MeterPhysUsedTitle]
Meter=String
MeterStyle=AllStyle | LeftStyle
X=10
Y=2R
Text=Physical Used

[MeterPhysUsedValue]
Meter=String
MeterStyle=AllStyle | RightStyle
MeasureName=MeasurePhysMemUsed
X=210
Y=0r
Text=%1B

[MeterPhysFreeTitle]
Meter=String
MeterStyle=AllStyle | LeftStyle
X=10
Y=2R
Text=Physical Free

[MeterPhysFreeValue]
Meter=String
MeterStyle=AllStyle | RightStyle
MeasureName=MeasurePhysMemFree
X=210
Y=0r
Text=%1B

[MeterSwapTotalTitle]
Meter=String
MeterStyle=AllStyle | LeftStyle
X=10
Y=7R
Text=Swap Total

[MeterSwapTotalValue]
Meter=String
MeterStyle=AllStyle | RightStyle
MeasureName=MeasureSwapMemTotal
X=210
Y=0r
Text=%1B

[MeterSwapUsedTitle]
Meter=String
MeterStyle=AllStyle | LeftStyle
X=10
Y=2R
Text=Swap Used

[MeterSwapUsedValue]
Meter=String
MeterStyle=AllStyle | RightStyle
MeasureName=MeasureSwapMemUsed
X=210
Y=0r
Text=%1B

[MeterSwapFreeTitle]
Meter=String
MeterStyle=AllStyle | LeftStyle
X=10
Y=2R
Text=Swap Free

[MeterSwapFreeValue]
Meter=String
MeterStyle=AllStyle | RightStyle
MeasureName=MeasureSwapMemFree
X=210
Y=0r
Text=%1B

[MeterPageTotalTitle]
Meter=String
MeterStyle=AllStyle | LeftStyle
X=10
Y=7R
Text=Page Total

[MeterPageTotalValue]
Meter=String
MeterStyle=AllStyle | RightStyle
MeasureName=MeasurePageTotal
X=210
Y=0r
Text=%1B

[MeterPageUsedTitle]
Meter=String
MeterStyle=AllStyle | LeftStyle
X=10
Y=2R
Text=Page Used

[MeterPageUsedValue]
Meter=String
MeterStyle=AllStyle | RightStyle
MeasureName=MeasurePageUsed
X=210
Y=0r
Text=%1B

[MeterPageFreeTitle]
Meter=String
MeterStyle=AllStyle | LeftStyle
X=10
Y=2R
Text=Page Free

[MeterPageFreeValue]
Meter=String
MeterStyle=AllStyle | RightStyle
MeasureName=MeasurePageFree
X=210
Y=0r
Text=%1B
SlideMemory.gif
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 18445
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: New Container meter option

jsmorley » Yesterday, 3:15 pm

You can slide the "content" around in and out of the "container", OR you can slide the "container" itself...

Code: Select all

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

[Variables]
Start=0
End=400

[MeasureLoop]
Measure=Loop
StartValue=#Start#
EndValue=#End#
Increment=6
LoopCount=1
IfCondition=MeasureLoop = #End#
IfTrueAction=[!Delay 1000][!SetOption MeasureLoop InvertMeasure 1][!UpdateMeasure MeasureLoop]
IfCondition2=MeasureLoop = #Start#
IfTrueAction2=[!Delay 1000][!SetOption MeasureLoop InvertMeasure 0][!UpdateMeasure MeasureLoop]

[MeterContainerVisible]
Meter=Shape
X=[MeasureLoop]
DynamicVariables=1
Shape=Rectangle 2,2,100,34 | StrokeWidth 4 | Stroke Color 160,160,160,255 | Fill Color 15,20,25,255

[MeterContainer]
Meter=Shape
X=[MeasureLoop]
DynamicVariables=1
Shape=Rectangle 4,4,96,30 | StrokeWidth 0

[MeterStringVisible]
Meter=String
X=10
Y=7
FontSize=16
FontWeight=400
FontColor=255,255,255,100
SolidColor=0,0,0,1
AntiAlias=1
DynamicVariables=1
Text=If at first you don't succeed, skydiving is not for you.

[MeterStringContent]
Meter=String
; Since the content meter will be relative to the start of the container meter,
; we need to move the content meter "left" as the container meter moves "right".
; That will keep the contents in a static position, as the container moves.
X=(10 - [MeasureLoop])
Y=7
FontSize=16
FontWeight=400
FontColor=255,255,255,255
SolidColor=0,0,0,1
AntiAlias=1
DynamicVariables=1
Container=MeterContainer
Text=If at first you don't succeed, skydiving is not for you.

Click to animate:
GIF.gif
You do not have the required permissions to view the files attached to this post.