It is currently March 29th, 2024, 2:08 am

New Container option

General topics related to Rainmeter.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Test of new Container option

Post by balala »

EDIT: Sorry jsmorley, you beat me (again).
dvo wrote: November 18th, 2018, 4:57 pm @Js Morley rainy doesn't work with me i only see the rain instead of rainy in rain..... :-(
copied script and put anim in the right folder if loaded i see only the rain updated to the latest version....
Have you upgraded Rainmeter to the latest version (4.3.0.3261)? I think you haven't and are using an older version. Because for this feature the latest Rainmeter is needed. Download it in the The latest BUILD: section of the first post of this thread, install, then retry it.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Test of new Container option

Post by eclectic-tech »

[Ditto...] :p
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Test of new Container option

Post by jsmorley »

Code: Select all

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

[Variables]
ContainerW=300
StringX=0
U=[!UpdateMeter *][!Redraw]

[Slider]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat SlideLeft, 1, #StringWDelta#
SlideLeft=[!SetVariable StringX "(Clamp(#StringX#-5,-#StringWDelta#,0))"]#U#
ActionList2=Repeat SlideRight, 1, #StringWDelta#
SlideRight=[!SetVariable StringX "(Clamp(#StringX#+5,-#StringWDelta#,0))"]#U#
DynamicVariables=1

[MeterContainerVisible]
Meter=Image
W=(#ContainerW#+10)
H=32
SolidColor=47,47,47,255

[MeterContainer]
Meter=Image
X=5
Y=5
W=#ContainerW#
H=27
SolidColor=0,0,0,255
MouseOverAction=[!CommandMeasure Slider "Stop 2"][!CommandMeasure Slider "Execute 1"]
MouseLeaveAction=[!CommandMeasure Slider "Stop 1"][!CommandMeasure Slider "Execute 2"]

[MeterLongString]
Meter=String
X=#StringX#
FontSize=15
FontWeight=400
FontColor=255,255,255,255
SolidColor=0,0,0,1
AntiAlias=1
DynamicVariables=1
OnUpdateAction=[!SetVariable StringWDelta "(Abs(#ContainerW#-[MeterLongString:W]))"][!UpdateMeasure Slider]
Container=MeterContainer
Text=This is a long string to be clipped in a container. And I mean really, really long. No, longer than that. I mean a long, long string.
GIF.gif
You do not have the required permissions to view the files attached to this post.
User avatar
ikarus1969
Posts: 571
Joined: February 28th, 2011, 3:20 pm
Location: Vienna, Austria

Re: Test of new Container option

Post by ikarus1969 »

It's pure fun to play around with this new feature!

I've made the following to display the activity of the cores of your cpu. Should adapt up to 16 cores automatically.

Can't record an animated gif so i provide a static screenshot only:
Screenshot.png
INI-file:

Code: Select all

[Rainmeter]
Update=250
DefaultUpdateDivider=4
AccurateText=1
OnWakeAction=[!Refresh]
DynamicWindowSize=1
; BackgroundMode=2
; SolidColor=4080C040
ContextTitle="cc: #CURRENTCONFIGWIDTH#×#CURRENTCONFIGHEIGHT# @ (#CURRENTCONFIGX#, #CURRENTCONFIGY#)"
ContextAction=[!Redraw]

[Variables]
CPUOnly.Offset=2

CPUOnly.Border_WH=8

CPUOnly.Border.X=(#WORKAREAX# + 0.5 * #CPUOnly.Border_WH#)
CPUOnly.Border.Y=(#WORKAREAY# + 0.5 * #CPUOnly.Border_WH#)
CPUOnly.Border.W=([Meter_Visible:W] + 25 - #CPUOnly.Border_WH#)
CPUOnly.Border.H=([Meter_Visible:H] - 15 - #CPUOnly.Border_WH#)

CPUOnly.BG.X=(#CPUOnly.Border.X# + 0.5 * #CPUOnly.Border_WH#)
CPUOnly.BG.Y=(#CPUOnly.Border.Y# + 0.5 * #CPUOnly.Border_WH#)
CPUOnly.BG.W=(#CPUOnly.Border.W# - #CPUOnly.Border_WH#)
CPUOnly.BG.H=(#CPUOnly.Border.H# - #CPUOnly.Border_WH#)


CPUOnly.Core.W=(([Meter_Visible:W] - 0) / (%NUMBER_OF_PROCESSORS% - 1))
CPUOnly.Cores.X=0
CPUOnly.Cores.Y=25
CPUOnly.Cores.H=([Meter_Visible:H] - 44)

; --------------------------------------------------------------------------------
CPUOnly.Core.1.Center.X=((#CPUOnly.Cores.X# + ( 1 - 1) * #CPUOnly.Core.W#) + 6)
CPUOnly.Core.2.Center.X=(#CPUOnly.Cores.X# +  ( 2 - 1) * #CPUOnly.Core.W#)
CPUOnly.Core.3.Center.X=(#CPUOnly.Cores.X# +  ( 3 - 1) * #CPUOnly.Core.W#)
CPUOnly.Core.4.Center.X=(#CPUOnly.Cores.X# +  ( 4 - 1) * #CPUOnly.Core.W#)
CPUOnly.Core.5.Center.X=(#CPUOnly.Cores.X# +  ( 5 - 1) * #CPUOnly.Core.W#)
CPUOnly.Core.6.Center.X=(#CPUOnly.Cores.X# +  ( 6 - 1) * #CPUOnly.Core.W#)
CPUOnly.Core.7.Center.X=(#CPUOnly.Cores.X# +  ( 7 - 1) * #CPUOnly.Core.W#)
CPUOnly.Core.8.Center.X=(#CPUOnly.Cores.X# +  ( 8 - 1) * #CPUOnly.Core.W#)
CPUOnly.Core.9.Center.X=(#CPUOnly.Cores.X# +  ( 9 - 1) * #CPUOnly.Core.W#)
CPUOnly.Core.10.Center.X=(#CPUOnly.Cores.X# + (10 - 1) * #CPUOnly.Core.W#)
CPUOnly.Core.11.Center.X=(#CPUOnly.Cores.X# + (11 - 1) * #CPUOnly.Core.W#)
CPUOnly.Core.12.Center.X=(#CPUOnly.Cores.X# + (12 - 1) * #CPUOnly.Core.W#)
CPUOnly.Core.13.Center.X=(#CPUOnly.Cores.X# + (13 - 1) * #CPUOnly.Core.W#)
CPUOnly.Core.14.Center.X=(#CPUOnly.Cores.X# + (14 - 1) * #CPUOnly.Core.W#)
CPUOnly.Core.15.Center.X=(#CPUOnly.Cores.X# + (15 - 1) * #CPUOnly.Core.W#)
CPUOnly.Core.16.Center.X=(#CPUOnly.Cores.X# + (16 - 1) * #CPUOnly.Core.W#)

CPUOnly.Core.1.Center.Y= (#CPUOnly.Cores.Y# + #CPUOnly.Cores.H# - (#CPUOnly.Cores.H# * [Measure_CPU_C1])  / 100)
CPUOnly.Core.2.Center.Y= (#CPUOnly.Cores.Y# + #CPUOnly.Cores.H# - (#CPUOnly.Cores.H# * [Measure_CPU_C2])  / 100)
CPUOnly.Core.3.Center.Y= (#CPUOnly.Cores.Y# + #CPUOnly.Cores.H# - (#CPUOnly.Cores.H# * [Measure_CPU_C3])  / 100)
CPUOnly.Core.4.Center.Y= (#CPUOnly.Cores.Y# + #CPUOnly.Cores.H# - (#CPUOnly.Cores.H# * [Measure_CPU_C4])  / 100)
CPUOnly.Core.5.Center.Y= (#CPUOnly.Cores.Y# + #CPUOnly.Cores.H# - (#CPUOnly.Cores.H# * [Measure_CPU_C5])  / 100)
CPUOnly.Core.6.Center.Y= (#CPUOnly.Cores.Y# + #CPUOnly.Cores.H# - (#CPUOnly.Cores.H# * [Measure_CPU_C6])  / 100)
CPUOnly.Core.7.Center.Y= (#CPUOnly.Cores.Y# + #CPUOnly.Cores.H# - (#CPUOnly.Cores.H# * [Measure_CPU_C7])  / 100)
CPUOnly.Core.8.Center.Y= (#CPUOnly.Cores.Y# + #CPUOnly.Cores.H# - (#CPUOnly.Cores.H# * [Measure_CPU_C8])  / 100)
CPUOnly.Core.9.Center.Y= (#CPUOnly.Cores.Y# + #CPUOnly.Cores.H# - (#CPUOnly.Cores.H# * [Measure_CPU_C9])  / 100)
CPUOnly.Core.10.Center.Y=(#CPUOnly.Cores.Y# + #CPUOnly.Cores.H# - (#CPUOnly.Cores.H# * [Measure_CPU_C10]) / 100)
CPUOnly.Core.11.Center.Y=(#CPUOnly.Cores.Y# + #CPUOnly.Cores.H# - (#CPUOnly.Cores.H# * [Measure_CPU_C11]) / 100)
CPUOnly.Core.12.Center.Y=(#CPUOnly.Cores.Y# + #CPUOnly.Cores.H# - (#CPUOnly.Cores.H# * [Measure_CPU_C12]) / 100)
CPUOnly.Core.13.Center.Y=(#CPUOnly.Cores.Y# + #CPUOnly.Cores.H# - (#CPUOnly.Cores.H# * [Measure_CPU_C13]) / 100)
CPUOnly.Core.14.Center.Y=(#CPUOnly.Cores.Y# + #CPUOnly.Cores.H# - (#CPUOnly.Cores.H# * [Measure_CPU_C14]) / 100)
CPUOnly.Core.15.Center.Y=(#CPUOnly.Cores.Y# + #CPUOnly.Cores.H# - (#CPUOnly.Cores.H# * [Measure_CPU_C15]) / 100)
CPUOnly.Core.16.Center.Y=(#CPUOnly.Cores.Y# + #CPUOnly.Cores.H# - (#CPUOnly.Cores.H# * [Measure_CPU_C16]) / 100)
; --------------------------------------------------------------------------------


; --------------------------------------------------------------------------------
; Measures
; --------------------------------------------------------------------------------
[Measure_LUA]
Measure=SCRIPT
ScriptFile=Cores.lua
UpdateDivider=-1


[Measure_CPU_C1]
Measure=CPU
Processor=1
AverageSize=2
UpdateDivider=1
Disabled=(%NUMBER_OF_PROCESSORS% < 1 ? 1 : 0)
; Measure=CALC
; Formula=100
; UpdateDivider=1
; Disabled=(%NUMBER_OF_PROCESSORS% < 1 ? 1 : 0)

[Measure_CPU_C2]
Measure=CPU
Processor=2
AverageSize=2
UpdateDivider=1
Disabled=(%NUMBER_OF_PROCESSORS% < 2 ? 1 : 0)

[Measure_CPU_C3]
Measure=CPU
Processor=3
AverageSize=2
UpdateDivider=1
Disabled=(%NUMBER_OF_PROCESSORS% < 3 ? 1 : 0)

[Measure_CPU_C4]
Measure=CPU
Processor=4
AverageSize=2
UpdateDivider=1
Disabled=(%NUMBER_OF_PROCESSORS% < 4 ? 1 : 0)

[Measure_CPU_C5]
Measure=CPU
Processor=5
AverageSize=2
UpdateDivider=1
Disabled=(%NUMBER_OF_PROCESSORS% < 5 ? 1 : 0)

[Measure_CPU_C6]
Measure=CPU
Processor=6
AverageSize=2
UpdateDivider=1
Disabled=(%NUMBER_OF_PROCESSORS% < 6 ? 1 : 0)

[Measure_CPU_C7]
Measure=CPU
Processor=7
AverageSize=2
UpdateDivider=1
Disabled=(%NUMBER_OF_PROCESSORS% < 7 ? 1 : 0)

[Measure_CPU_C8]
Measure=CPU
Processor=8
AverageSize=2
UpdateDivider=1
Disabled=(%NUMBER_OF_PROCESSORS% < 8 ? 1 : 0)

[Measure_CPU_C9]
Measure=CPU
Processor=9
AverageSize=2
UpdateDivider=1
Disabled=(%NUMBER_OF_PROCESSORS% < 9 ? 1 : 0)

[Measure_CPU_C10]
Measure=CPU
Processor=10
AverageSize=2
UpdateDivider=1
Disabled=(%NUMBER_OF_PROCESSORS% < 10 ? 1 : 0)

[Measure_CPU_C11]
Measure=CPU
Processor=11
AverageSize=2
UpdateDivider=1
Disabled=(%NUMBER_OF_PROCESSORS% < 11 ? 1 : 0)

[Measure_CPU_C12]
Measure=CPU
Processor=12
AverageSize=2
UpdateDivider=1
Disabled=(%NUMBER_OF_PROCESSORS% < 12 ? 1 : 0)

[Measure_CPU_C13]
Measure=CPU
Processor=13
AverageSize=2
UpdateDivider=1
Disabled=(%NUMBER_OF_PROCESSORS% < 13 ? 1 : 0)

[Measure_CPU_C14]
Measure=CPU
Processor=14
AverageSize=2
UpdateDivider=1
Disabled=(%NUMBER_OF_PROCESSORS% < 14 ? 1 : 0)

[Measure_CPU_C15]
Measure=CPU
Processor=15
AverageSize=2
UpdateDivider=1
Disabled=(%NUMBER_OF_PROCESSORS% < 15 ? 1 : 0)

[Measure_CPU_C16]
Measure=CPU
Processor=16
AverageSize=2
UpdateDivider=1
Disabled=(%NUMBER_OF_PROCESSORS% < 16 ? 1 : 0)


; --------------------------------------------------------------------------------
; Meters
; --------------------------------------------------------------------------------
[Meter_BG]
Meter=SHAPE
Shape=Rectangle #CPUOnly.Border.X#, #CPUOnly.Border.Y#, #CPUOnly.Border.W#, #CPUOnly.Border.H# | Extend Format_Border
Format_Border=StrokeWidth #CPUOnly.Border_WH# | Stroke Color FFFFFF80 | Fill Color FFFFFF00

Shape2=Rectangle #CPUOnly.BG.X#, #CPUOnly.BG.Y#, #CPUOnly.BG.W#, #CPUOnly.BG.H# | Extend Format_BG
Format_BG=StrokeWidth 0 | Stroke Color 00000000 | Fill Color FFFFFFFF

AntiAlias=1
DynamicVariables=1

; --------------------------------------------------------------------------------

[Meter_Visible_Shadow]
Meter=STRING
Text="RAINMETER"
X=10
Y=-10
InlineSetting= Face   | Arial
InlineSetting2=Size   | 48
InlineSetting3=Weight | 900
InlineSetting4=Color  | FFFFFFFF
InlineSetting5=Shadow | 2 | 2 | 3.5 | 0,0,0,255
AntiAlias=1

[Meter_Container]
Meter=STRING
Text="RAINMETER"
X=10
Y=-10
InlineSetting= Face   | Arial
InlineSetting2=Size   | 48
InlineSetting3=Weight | 900
AntiAlias=1

[Meter_Visible]
Meter=STRING
Text="RAINMETER"
X=10
Y=-10
InlineSetting= Face   | Arial
InlineSetting2=Size   | 48
InlineSetting3=Weight | 900
; InlineSetting4=Color  | 00000010
InlineSetting4=Color  | 00408030
AntiAlias=1
; --------------------------------------------------------------------------------

[Meter_Peaks]
Meter=SHAPE
Container=Meter_Container
Shape=Path Path_Cores | Stroke Color 004080FF | Fill Color 80BFFFFF
Path_Cores=#CPUOnly.Core.1.Center.X#, #CPUOnly.Core.1.Center.Y# | LineTo #CPUOnly.Core.2.Center.X#, #CPUOnly.Core.2.Center.Y#
UpdateDivider=1
AntiAlias=1
DynamicVariables=1
LUA-code

Code: Select all

function Initialize()

  local current_core;
  local curveStr;
  local path_str = '#CPUOnly.Core.1.Center.X#, (#CPUOnly.Cores.Y# + #CPUOnly.Cores.H#) | LineTo #CPUOnly.Core.1.Center.X#, #CPUOnly.Core.1.Center.Y#';

  for current_core = 2, tonumber(os.getenv('NUMBER_OF_PROCESSORS'))
    do
      curveStr = 'CurveTo #CPUOnly.Core.'..current_core..'.Center.X#, #CPUOnly.Core.'..current_core..'.Center.Y#, ';
      curveStr = curveStr..'(#CPUOnly.Core.'..(current_core - 1)..'.Center.X# + 20), (#CPUOnly.Core.'..(current_core - 1)..'.Center.Y#), ';
      curveStr = curveStr..'(#CPUOnly.Core.'..(current_core - 0)..'.Center.X# - 20), (#CPUOnly.Core.'..(current_core - 0)..'.Center.Y#)';

      path_str = path_str..' | '..curveStr;
    end
    
  path_str = path_str..' | LineTo #CPUOnly.Core.'..tonumber(os.getenv('NUMBER_OF_PROCESSORS'))..'.Center.X#, (#CPUOnly.Cores.Y# + #CPUOnly.Cores.H#)';

  SKIN:Bang('!SetOption', 'Meter_Peaks', 'Path_Cores', path_str);

  SKIN:Bang('!UpdateMeter', '*');

  return 0;

end -- function Initialize

function Update()

  return 1;

end -- function Update
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Test of new Container option

Post by jsmorley »

ikarus1969 wrote: November 22nd, 2018, 9:42 am Can't record an animated gif so i provide a static screenshot only:
http://blog.bahraniapps.com/gifcam/

Be aware when attaching or linking to animated .gif files, that if they exceed 500px in width or height, they will create a "thumbnail" in the post, and will need to be clicked on by the user to see the animated version .
User avatar
ikarus1969
Posts: 571
Joined: February 28th, 2011, 3:20 pm
Location: Vienna, Austria

Re: Test of new Container option

Post by ikarus1969 »

jsmorley wrote: November 23rd, 2018, 2:44 pm

http://blog.bahraniapps.com/gifcam/

Be aware when attaching or linking to animated .gif files, that if they exceed 500px in width or height, they will create a "thumbnail" in the post, and will need to be clicked on by the user to see the animated version .
Here's an anuimated view:
Screenshot Container.gif
You do not have the required permissions to view the files attached to this post.
User avatar
raiguard
Posts: 660
Joined: June 25th, 2015, 7:02 pm
Location: The Sky, USA

Re: Test of new Container option

Post by raiguard »

A note that transformationmatrix definitely does NOT play nice with container meters. :(

Anyway, here is a line graph with rounded corners. You can scale the skin by scrolling the mouse wheel.
2018-11-23 23_16_46-.png

Code: Select all

[Rainmeter]
MiddleMouseUpAction=[!Refresh]
AccurateText=1
DynamicWindowSize=1
Update=100

[Variables]
scale=5

[MeasureCpuUsage]
Measure=CPU
MinValue=0
MaxValue=100

[MeterBackground]
Meter=Shape
Shape=Rectangle 0,0,(144 * #scale#),(40 * #scale#),(3 * #scale#) | Fill Color 50,50,50 | StrokeWidth 0
Shape2=Rectangle #scale#,#scale#,(142 * #scale#),(38 * #scale#),(3 * #scale#) | Fill Color 25,25,25 | StrokeWidth 0
MouseScrollUpAction=[!WriteKeyValue Variables scale "(clamp((#scale# + 0.5),1,5))"][!Refresh]
MouseScrollDownAction=[!WriteKeyValue Variables scale "(clamp((#scale# - 0.5),1,5))"][!Refresh]

[MeterGraphContainer]
Meter=Shape
Shape=Rectangle #scale#,#scale#,(142 * #scale#),(38 * #scale#),(3 * #scale#) | StrokeWidth 0

[MeterLineGraph]
Meter=Line
LineCount=1
MeasureName=MeasureCpuUsage
LineColor=43,224,224
Container=MeterGraphContainer
W=142
H=38
TransformationMatrix=#scale#;0;0;#scale#;#scale#;#scale#
Antialias=1
You do not have the required permissions to view the files attached to this post.
”We are pretty sure that r2922 resolves the regression in resolution caused by a reversion to a revision.” - jsmorley, 2017
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Test of new Container option

Post by balala »

raiguard wrote: November 24th, 2018, 6:14 am A note that transformationmatrix definitely does NOT play nice with container meters. :(

Anyway, here is a line graph with rounded corners. You can scale the skin by scrolling the mouse wheel.
But what is the issue? Because me personally at least couldn't find one. The code works as it should. Am I missing something?
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Test of new Container option

Post by eclectic-tech »

I agree with balala, I do not see an issue with the Container...

However, I would ask why you design a skin with a scale starting at times 5?!
That simply over-complicates the design.

I would suggest to design at a scale of 1, then modify it using the available scaling tools.
With Shape meters, I always prefer to use the SCALE modifier rather than adding unnecessary formulas in the W & H.

For comparison here is a modified version of your skin showing an alternate approach to scaling.
The graph looks different because I did not scale it up 5 times by default...

Code: Select all

[Rainmeter]
MiddleMouseUpAction=[!WriteKeyValue Variables scale 1][!Refresh]
AccurateText=1
DynamicWindowSize=1
Update=100

[Variables]
scale=1

[MeasureCpuUsage]
Measure=CPU
MinValue=0
MaxValue=100

[MeterBackground]
Meter=Shape
Shape=Rectangle 0,0,720,200,15 | Fill Color 200,200,200 | StrokeWidth 0 | Scale #scale#,#scale#,0,0
Shape2=Rectangle (5*#scale#),(5*#scale#),710,190,15 | Fill Color 25,25,25 | StrokeWidth 0 | Scale #scale#,#scale#,0,0
MouseScrollUpAction=[!WriteKeyValue Variables scale "(clamp((#scale# + 0.1),0.2,2))"][!Refresh]
MouseScrollDownAction=[!WriteKeyValue Variables scale "(clamp((#scale# - 0.1),0.2,2))"][!Refresh]

[MeterGraphContainer]
Meter=Shape
Shape=Rectangle (5*#scale#),(5*#scale#),710,190,15 | StrokeWidth 0 | Scale #scale#,#scale#,0,0

[MeterLineGraph]
Meter=Line
LineCount=1
MeasureName=MeasureCpuUsage
LineColor=43,224,224
Container=MeterGraphContainer
X=(5*#scale#)
Y=(5*#scale#)
W=710
H=190
TransformationMatrix=#scale#;0;0;#scale#;((1-#scale#)*[#CURRENTSECTION#:X]);((1-#scale#)*[#CURRENTSECTION#:Y])
Antialias=1
There is nothing wrong with your code, just offering alternate suggestions. :rosegift:
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Test of new Container option

Post by jsmorley »

I have no expectation that Container is going to work well with TransformationMatrix. The core of the issue is that Container is entirely based on the W and H of the meter being used as a container, and TransformationMatrix does not alter the meter shape or size when it transforms the stuff in the meter. There might be some limited success with scale, as long as you scale the W and H along with any change to content, but I can't imagine that any rotate or skew is ever going to work right.

I'm no expert on TransformationMatrix, and in fact avoid it like the plague, as I find it really hard to wrap my head around. (that's just me...). I'd be delighted if we could get some examples of what works and what doesn't work. Not so much to "fix" anything, as we may be pretty limited in what we can do, but to set some "rules" that can be documented.