Skip to content
This repository has been archived by the owner on Mar 10, 2024. It is now read-only.

Commit

Permalink
ACTUALLY made it not use hardcoded paths
Browse files Browse the repository at this point in the history
  • Loading branch information
sceleri committed Apr 20, 2021
1 parent a9970ab commit 0c3f791
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 35 deletions.
108 changes: 85 additions & 23 deletions @Resources/includes/Variables.inc
Original file line number Diff line number Diff line change
@@ -1,99 +1,161 @@
[Variables]
; Font
; Scroll indicator very internal variables
s_ScrollIndicatorMaxHeight=([#s_PanelH] - ([#s_scrollIndicatorYPadding] * 2))
s_scrollIndicatorYPadding=[#s_ValueYPadding]
; Generator
s_GeneratorRightPanelWidth=350
s_GeneratorLeftPanelWidth=50
s_GeneratorPanelHeight=300

;@About | Name Internal settings | Description You better know what you're doing.
;?Info | Name Disclaimer | Description The RainDoc syntax will not change but this internal variables file is bound to change, frequently.

;@Default | Name Font
;? |
s_FontFace=Segoe UI
;? |
s_IconFontFace=Segoe MDL2 Assets
;? |
s_FontColor=0,0,0
;? |
s_FontSize5=8
;? |
s_FontSize4=10
;? |
s_FontSize3=12
;? |
s_FontSize2=16
;? |
s_FontSize1=20
;? |
s_SelectedFontWeight=500
;? |
s_FontWeight=400

; Items
;@ | Name Items
;? |
s_ValueYPadding=10
;? |
s_VariableXPadding=20

; Category titles
;@ | Name Category
;? |
s_CategoryTitleTopPadding=35
;? |
s_CategoryTitleBottomPadding=20
;? |
s_CategoryTitleXPadding=20
; Visually center the Icon
;? | Description Visually center the category icon
s_CategoryIconTopPadding=([#s_CategoryTitleTopPadding] + 5)
; Fix the literal 1px offset caused by the title and description using different font sizes
;? | Description Fix the literal 1px offset caused by the title and description using different font sizes
s_VarTitleNudge=-1
;? |
s_CategoryTitleFontWeight=500
;? |
s_CategoryDescriptionFontWeight=500

; Variable titles
;? |
s_VariableTitleFontWeight=[#s_FontWeight]

; Toggle
;@ | Name Toggle
;? |
s_ToggleActiveColor=[#s_SelectedColor]
;? |
s_ToggleInactiveColor=[#s_RightPanelBackgroundColor]
;? |
s_ToggleSize=20
;? |
s_TogglePadding=2.5
;? |
s_ToggleLength=25

; Selector
;@ | Name Selector
;? |
s_SelectorPadding=8
;? |
s_SelectorWidth=3
;? |
s_SelectorRounding=[#s_SelectorWidth]
;? |
s_SelectedColor=007acc

; Color variables
;@ | Name Color
;? |
s_ColorSize=15
;? |
s_ColorStrokeWidth=1
;? |
s_ColorStrokeWidthSelected=2
;? |
s_ColorStrokeColor=200,200,200
;? |
s_ColorStringLeftPadding=10

; Category list
;@ | Name Category list
;? |
s_ListAboutTopPadding=35
;? |
s_ListAboutLeftPadding=8
;? |
s_ListDefaultLeftPadding=20
;? |
s_ListTopicLeftPadding=10

;? |
s_ListYPadding=7
; Used for width calculations ClipString=2
;? | Description Used for width calculations ClipString=2
s_ListRightPadding=10


; Background
;@ | Name Background
;? |
s_RightPanelBackgroundColor=255,255,255,255
;? |
s_LeftPanelBackgroundColor=200,200,200,255
;? |
s_BackgroundRounding=5
;? |
s_LeftPanelW=200
;? |
s_RightPanelW=600
;? |
s_PanelH=700

; Scroll indicator
;@ | Name Scroll indicator
;? |
s_ScrollIndicatorWidth=5
s_scrollIndicatorYPadding=[#s_ValueYPadding]
;? |
s_scrollIndicatorXPadding=5
s_ScrollIndicatorMaxHeight=([#s_PanelH] - ([#s_scrollIndicatorYPadding] * 2))
;? |
s_ScrollIndicatorBackgroundColor=0,0,0,100
;? |
s_ScrollIndicatorColor=200,200,200
;? |
s_ScrollIndicatorRounding=5

; Generator
s_GeneratorRightPanelWidth=350
s_GeneratorLeftPanelWidth=50
s_GeneratorPanelHeight=300

; Internal
;? |
s_CurrentCategory=0
;? |
s_ScrollSpeed=10
;? |
s_ScrollRightPanel=0
;? |
s_ScrollLeftPanel=0
;? |
s_InputTextFontSize=[#s_FontSize3]
;? |
s_ScrollTreshold=([#s_PanelH] - ([#s_PanelH] / 4))

; Debug
;@ | Name Debug colors
s_DebugColors=0
;? |
s_DebugTitleColor1=255,0,0,100
;? |
s_DebugValueColor1=,0,0,100
;? |
s_DebugDescriptionColor1=255,0,0,100
;? |
s_DebugListColor1=255,0,0,100
s_DebugIconColor1=255,0,0,100
;? |
s_DebugIconColor1=255,0,0,100

19 changes: 10 additions & 9 deletions @Resources/scripts/generator.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,18 @@ function Pipe-Variable {
# Get unfiltered data
$Variable = Filter-Hashtable -String $String -Properties @{"KeyValue" = $Patterns.KeyValue; "UnfilteredProperties" = $Patterns.UnfilteredProperties}


# Get the key and value from the unformatted line
$Variable.KeyValue = Filter-Hashtable -String $Variable.KeyValue -Properties @{"Key" = $Patterns.Key; "Value" = $Patterns.Value}
# Add Key and Value from KeyValue to the main object
$Variable.KeyValue.GetEnumerator() | ForEach-Object {
$Variable.Add("$($_.Key)", "$($_.Value)")
}

# Get the variable properties

# Make the Properties hashtable
$Variable.Properties = @{}
$Variable.Properties = @{"Name" = $Variable.Key}

# Get type
if("$($Variable.UnfilteredProperties)" -match "$($Patterns.Type)") {
Expand All @@ -152,7 +160,7 @@ function Pipe-Variable {
if($UnfilteredProperty -match $Patterns.PropertyKey) {
$key = Remove-Whitespace -String $Matches[1]
# $RmAPI.Log("Got variable key $key from $($UnfilteredProperty)")
$Variable.Properties.Add("$key", "$value")
$Variable.Properties["$key"] = "$value"
}
}
}
Expand All @@ -161,13 +169,6 @@ function Pipe-Variable {
# $RmAPI.Log("$($Variable.Properties.Name) properties: $($Variable.Properties.Keys)")
# $RmAPI.Log("This variable is: $($Variable.Properties.Name) from $Category")

# Get the key and value from the unformatted line
$Variable.KeyValue = Filter-Hashtable -String $Variable.KeyValue -Properties @{"Key" = $Patterns.Key; "Value" = $Patterns.Value}
# Add Key and Value from KeyValue to the main object
$Variable.KeyValue.GetEnumerator() | ForEach-Object {
$Variable.Add("$($_.Key)", "$($_.Value)")
}

return $Variable

}
Expand Down
6 changes: 3 additions & 3 deletions generator.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ Update=-1
@IncludeListItems=#@#includes\ListItems.inc

[Variables]
s_SettingsFile=C:\Users\Sceleri\Documents\Rainmeter\Skins\Settings\@Resources\example.inc
s_Directory=C:\Users\Sceleri\Documents\Rainmeter\Skins\Settings\@Resources
s_SettingsFile=#SKINSPATH#Settings\@Resources\example.inc
s_Directory=#SKINSPATH#Settings\@Resources
s_DynamicPath=Settings\@Resources\example.inc
s_File=example
s_Type=inc
Expand All @@ -17,7 +17,7 @@ ProcessPath=[!EnableMeasure MeasureSkinsPath][!UpdateMeasure MeasureSkinsPath]
Measure=Plugin
Plugin=Drag&Drop
Action=Path
OnDropAction=[!WriteKeyValue Variables "s_GenCurrentCategory" 0][!SetVariable "s_SettingsFile" $File$][#ProcessPath][!WriteKeyValue Variables "s_Directory" $Directory$][!WriteKeyValue Variables "s_File" $Name$][!WriteKeyValue Variables "s_Type" $Type$]
OnDropAction=[!WriteKeyValue Variables "s_GenCurrentCategory" 0][!WriteKeyValue Variables "s_SettingsFile" $File$][!SetOption MeasureSkinsPath String $File$][!WriteKeyValue Variables "s_Directory" $Directory$][!WriteKeyValue Variables "s_File" $Name$][!WriteKeyValue Variables "s_Type" $Type$][#ProcessPath]

;Regex the skins path out and replace with #SKINSPOATH#
[MeasureSkinsPath]
Expand Down

0 comments on commit 0c3f791

Please sign in to comment.