Im back with need of help. Im making some kind of scaling function for my suite and i have problem with TransformMatrix scaling width of the meter.
With this provided code, the skin scale depending on the value from scale variable but it looks kinda like this:
Showcase: I would like to know if i have done something wrong or maybe i forgot something.
Rainmter Code (date.ini):
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
DynamicVariables=1
Group=ashuramaru
; Background
Background=#@#\images\backgrounds\#background#_blank.png
BackgroundMode=3
BackgroundMargins=0,34,0,10
; Actions
RightMouseDownAction=[!CommandMeasure "Script" "ConfigActive_Toggle('#ROOTCONFIG#\\control\\context', 'context_menu.ini', '-1')"]
[MetaData]
Name=Date Utility
Information=Skin which is displaying current date information
Author=Kurou
[Variables]
;###################
; Imports
;###################
; Variables
@Include_Variables_Customization=#@#\variables\customization.inc
@Include_Variables_Settings=#@#\variables\settings.inc
; Styles
@Include_Style_String=#@#\styles\strings.inc
;###################
; Measures
;###################
[Script]
Measure=Script
ScriptFile=#@#\lua\clock.lua
[Measure_TranslucentRM]
Measure=Plugin
Plugin=TranslucentRM
Type=#background_effect#
Border=#background_border#
Taskbar=0
Corner=#background_corner#
[Measure_ConfigActive]
Measure=Plugin
Plugin=ConfigActive
; Upper
[Measure_Day_Name]
Measure=Time
Format=%A
FormatLocale=en_us
[Measure_Day_Number]
Measure=Time
Format=%d
FormatLocale=en_us
[Measure_Month_Name]
Measure=Time
Format=%b
FormatLocale=en_us
[Measure_Year_Number]
Measure=Time
Format=%Y
FormatLocale=en_us
; Lower
[Measure_Day_Count]
Measure=Time
Format=%#j
FormatLocale=en_us
[Measure_Week_Count]
Measure=Time
Format=%#V
FormatLocale=en_us
[Measure_Month_Count]
Measure=Time
Format=%#m
FormatLocale=en_us
[Measure_Quarter_Count]
Measure=Calc
Formula=Ceil([Measure_Month_Count] / 3)
;###################
; Meters
;###################
[Background]
Meter=Shape
Shape=Rectangle 0, 0, 200, 40 | Fill Color 0, 0, 0, 0 | StrokeWidth 0 | Stroke Color 0,0,0
X=0
Y=0
; Upper
[Day_Name]
Meter=String
MeasureName=Measure_Day_Name
MeterStyle=Date_Name
StringAlign=Center
X=([Background:W] / 4)
Y=([Background:W] / 20)
[Day_Count]
Meter=String
MeasureName=Measure_Day_Number
MeterStyle=Date_Count
X=([Background:W] / 1.8)
Y=0r
[Month_Name]
Meter=String
MeasureName=Measure_Month_Name
MeterStyle=Date_Name
X=([Background:W] / 1.6)
Y=0r
[Year_Count]
Meter=String
MeasureName=Measure_Year_Number
MeterStyle=Date_Count
X=([Background:W] - 10)
Y=0r
; Seperator
[Seperator]
Meter=Image
SolidColor=100, 100, 100, 170
W=([Background:W] - 10)
H=2
X=5
Y=20r
; Lower
[Day_Count_Name]
Meter=String
MeterStyle=Date_Name
StringCase=None
FontSize=9
Text=Day:
X=10
Y=10r
[Day_Count_Value]
Meter=String
MeasureName=Measure_Day_Count
MeterStyle=Date_Count
StringCase=None
FontSize=9
X=25R
Y=0r
[Week_Count_Name]
Meter=String
MeterStyle=Date_Name
StringCase=None
FontSize=9
StringAlign=Center
Text=Week:
X=([Background:W] / 2.5)
Y=0r
[Week_Count_Value]
Meter=String
MeasureName=Measure_Week_Count
MeterStyle=Date_Count
StringCase=None
FontSize=9
X=10R
Y=0r
[Quarter_Count_Name]
Meter=String
MeterStyle=Date_Name
StringCase=None
FontSize=9
Text=Quarter:
X=([Background:W] - 70)
Y=0r
[Quarter_Count_Value]
Meter=String
MeasureName=Measure_Quarter_Count
MeterStyle=Date_Count
StringCase=None
FontSize=9
X=([Background:W] - 10)
Y=0r
Code: Select all
-- Scale Function
function Scale()
-- Local variable
local scale = customization["scale"]
-- Check for scale
if scale > "1" then
if names["file"] == "clock.ini" then
-- Obtain values
local meter = SKIN:GetMeter('Background')
local scale_w = meter:GetW() * scale
local scale_h = meter:GetH() * scale
-- Transform Backgrund
SKIN:Bang("!SetOption", "Background", "Shape", "Rectangle 0,0,"..scale_w..","..scale_h.."| Fill Color 0, 0, 0, 0 | StrokeWidth 0 | Stroke Color 0,0,0")
-- Set scale
SKIN:Bang("!SetOption", "Time", "TransformationMatrix", scale..";0;0;"..scale..";"..scale..";"..scale)
SKIN:Bang("!SetOption", "Am_Pm", "TransformationMatrix", scale..";0;0;"..scale..";"..scale..";"..scale)
end
if names["file"] == "date.ini" then
-- Obtain values
local meter = SKIN:GetMeter('Background')
local scale_w = meter:GetW() * scale
local scale_h = meter:GetH() * scale
-- Transform Backgrund
SKIN:Bang("!SetOption", "Background", "Shape", "Rectangle 0,0,"..scale_w..","..scale_h.."| Fill Color 0, 0, 0, 0 | StrokeWidth 0 | Stroke Color 0,0,0")
-- Set scale
SKIN:Bang("!SetOption", "Day_Name", "TransformationMatrix", scale..";0;0;"..scale..";"..scale..";"..scale)
SKIN:Bang("!SetOption", "Day_Count", "TransformationMatrix", scale..";0;0;"..scale..";"..scale..";"..scale)
SKIN:Bang("!SetOption", "Month_Name", "TransformationMatrix", scale..";0;0;"..scale..";"..scale..";"..scale)
SKIN:Bang("!SetOption", "Year_Count", "TransformationMatrix", scale..";0;0;"..scale..";"..scale..";"..scale)
SKIN:Bang("!SetOption", "Seperator", "TransformationMatrix", scale..";0;0;"..scale..";"..scale..";"..scale)
SKIN:Bang("!SetOption", "Day_Count_Name", "TransformationMatrix", scale..";0;0;"..scale..";"..scale..";"..scale)
SKIN:Bang("!SetOption", "Day_Count_Value", "TransformationMatrix", scale..";0;0;"..scale..";"..scale..";"..scale)
SKIN:Bang("!SetOption", "Week_Count_Name", "TransformationMatrix", scale..";0;0;"..scale..";"..scale..";"..scale)
SKIN:Bang("!SetOption", "Week_Count_Value", "TransformationMatrix", scale..";0;0;"..scale..";"..scale..";"..scale)
SKIN:Bang("!SetOption", "Quarter_Count_Name", "TransformationMatrix", scale..";0;0;"..scale..";"..scale..";"..scale)
SKIN:Bang("!SetOption", "Quarter_Count_Value", "TransformationMatrix", scale..";0;0;"..scale..";"..scale..";"..scale)
end
-- Redraw
SKIN:Bang("!Redraw")
end
end
Code: Select all
function Initialize()
-- Include toolkit
dofile(SKIN:GetVariable('@')..'lua\\toolkit.lua')
-- Define variables arrey
settings = {}
customization = {}
-- Obtain rainmeter variables
ObtainDefaultVariables()
-- Convert variables
ConvertVariablesList('variables\\settings.inc' ,settings)
ConvertVariablesList('variables\\customization.inc' ,customization)
-- Change format
Change_Format()
Scale()
end
function Update()
end
-- Change time format
function Change_Format()
if settings["clock_format"] == "24" then
SKIN:Bang("!SetOption", "Time", "Text", "%1")
SKIN:Bang("!SetOption", "Time", "X", "([Background:W] / 2)")
SKIN:Bang("!SetOption", "Am_Pm", "Hidden", "1")
elseif settings["clock_format"] == "12" then
SKIN:Bang("!SetOption", "Time", "Text", "%2")
SKIN:Bang("!SetOption", "Time", "X", "5r")
SKIN:Bang("!SetOption", "Am_Pm", "Hidden", "0")
end
SKIN:Bang("!Redraw", names["root"].."\\skins\\clock", "clock.ini")
end