Imports TMDock.Common
Imports System.Drawing.Drawing2D
Namespace TMDock
Public Class DockMargins
Public Property Path As String
Public Property LeftMargin As Single
Public Property TopMargin As Single
Public Property RightMargin As Single
Public Property BottomMargin As Single
Public Property OuterLeftMargin As Single
Public Property OuterTopMargin As Single
Public Property OuterRightMargin As Single
Public Property OuterBottomMargin As Single
End Class
Public Class DockInfo
Public Property BackGround As DockMargins
Public Property Separetor As DockMargins
Friend Sub New(ByVal SkinPath As String)
Dim pConfigFile As New IniFile
pConfigFile.Load(SkinPath & "\background.ini")
'Dim iniSection As IniFile.IniSection = pConfigFile.GetSection("Background")
'Dim pKeys As Collection = iniSection.Keys
BackGround = New DockMargins
With BackGround
.Path = SkinPath & "\" & pConfigFile.GetSection("Background").GetKey("Image").Value.Trim
.LeftMargin = pConfigFile.GetSection("Background").GetKey("LeftMargin").Value.Trim
.TopMargin = pConfigFile.GetSection("Background").GetKey("TopMargin").Value.Trim
.RightMargin = pConfigFile.GetSection("Background").GetKey("RightMargin").Value.Trim
.BottomMargin = pConfigFile.GetSection("Background").GetKey("BottomMargin").Value.Trim
.OuterLeftMargin = pConfigFile.GetSection("Background").GetKey("Outside-LeftMargin").Value.Trim
.OuterTopMargin = pConfigFile.GetSection("Background").GetKey("Outside-TopMargin").Value.Trim
.OuterRightMargin = pConfigFile.GetSection("Background").GetKey("Outside-RightMargin").Value.Trim
.OuterBottomMargin = pConfigFile.GetSection("Background").GetKey("Outside-BottomMargin").Value.Trim
End With
End Sub
End Class
Public Class Settings
Public Property General As cGeneral
Public Property Icons As cIcons
Public Property Position As cPosition
Public Property Style As cStyle
Public Property Behavior As cBehavior
Public Property Labels As cLabel
Private m_ConfigPathName As String
Private m_IniFile As IniFile
Public Sub New(ByVal pConfigSettingPath As String)
m_ConfigPathName = pConfigSettingPath
m_IniFile = New IniFile
m_IniFile.Load(m_ConfigPathName)
General = New cGeneral(m_IniFile)
Icons = New cIcons(m_IniFile)
Position = New cPosition(m_IniFile)
Style = New cStyle(m_IniFile)
Behavior = New cBehavior(m_IniFile)
Labels = New cLabel(m_IniFile)
End Sub
Public Sub Save()
General.Save()
Icons.Save()
Position.Save()
Style.Save()
Behavior.save()
Labels.Save()
m_IniFile.Save(m_ConfigPathName)
End Sub
Protected Overrides Sub Finalize()
MyBase.Finalize()
End Sub
End Class
Public Class cGeneral
Public Property RunAtStartUp As Boolean = False
Public Property PortableINI As Boolean = False
Public Property MinWindowsToDock As Boolean = False
Public Property LockItems As Boolean = False
Public Property OpenInstance As Boolean = False
Private m_ConfigFile As IniFile
Friend Sub New(ByRef pIniFile As IniFile)
m_ConfigFile = pIniFile
SynchIniData()
End Sub
Private Sub SynchIniData()
RunAtStartUp = IIf(m_ConfigFile.GetSection("General").GetKey("RunAtStartUp").Value.ToLower = "true", True, False)
PortableINI = IIf(m_ConfigFile.GetSection("General").GetKey("PortableINI").Value.ToLower = "true", True, False)
MinWindowsToDock = IIf(m_ConfigFile.GetSection("General").GetKey("MinWindowsToDock").Value.ToLower = "true", True, False)
LockItems = m_ConfigFile.GetSection("General").GetKey("LockItems").Value
OpenInstance = IIf(m_ConfigFile.GetSection("General").GetKey("OpenInstance").Value.ToLower = "true", True, False)
End Sub
Friend Sub Save()
m_ConfigFile.SetKeyValue("General", "RunAtStartUp", RunAtStartUp.ToString)
m_ConfigFile.SetKeyValue("General", "PortableINI", PortableINI.ToString)
m_ConfigFile.SetKeyValue("General", "MinWindowsToDock", MinWindowsToDock.ToString)
m_ConfigFile.SetKeyValue("General", "LockItems", LockItems.ToString)
m_ConfigFile.SetKeyValue("General", "OpenInstance", OpenInstance.ToString)
End Sub
End Class
Public Class cIcons
Public Property Quality As IconQuality = IconQuality.Average
Public Property Opacity As Single = 100
Public Property SizePx As Single = 48
Public Property ZoomPx As Single = 48
Public Property ZoomWidth As Single = 4
Public Property ZoomDurationMs As Single = 100
Public Enum IconQuality
Low = 1
Average = 2
High = 3
End Enum
Private m_ConfigFile As IniFile
Friend Sub New(ByRef pIniFile As IniFile)
m_ConfigFile = pIniFile
SynchIniData()
End Sub
Private Sub SynchIniData()
Quality = m_ConfigFile.GetSection("Icons").GetKey("Quality").Value
Opacity = m_ConfigFile.GetSection("Icons").GetKey("Opacity").Value
SizePx = m_ConfigFile.GetSection("Icons").GetKey("SizePx").Value
ZoomPx = m_ConfigFile.GetSection("Icons").GetKey("ZoomPx").Value
ZoomWidth = m_ConfigFile.GetSection("Icons").GetKey("ZoomWidth").Value
ZoomDurationMs = m_ConfigFile.GetSection("Icons").GetKey("ZoomDurationMs").Value
End Sub
Friend Sub Save()
m_ConfigFile.SetKeyValue("Icons", "Quality", Quality)
m_ConfigFile.SetKeyValue("Icons", "Opacity", Opacity)
m_ConfigFile.SetKeyValue("Icons", "SizePx", SizePx)
m_ConfigFile.SetKeyValue("Icons", "ZoomPx", ZoomPx)
m_ConfigFile.SetKeyValue("Icons", "ZoomWidth", ZoomWidth)
m_ConfigFile.SetKeyValue("Icons", "ZoomDurationMs", ZoomDurationMs)
End Sub
End Class
Public Class cPosition
Public Property Monitor As String = ""
Public Property ScreenPosition As ScreenPos = ScreenPos.Top
Public Property Layering As ScreenLayer = ScreenLayer.Top
Public Property Centering As Single = 0
Public Property EdgeOffsetPx As Single = 0
Public Property posX As Integer = 0
Public Property posY As Integer = 0
Public Enum ScreenPos
Top = 1
Bottom = 2
Left = 3
Right = 4
End Enum
Public Enum ScreenLayer
Top = 1
Normal = 2
Bottom = 3
End Enum
Private m_ConfigFile As IniFile
Friend Sub New(ByRef pIniFile As IniFile)
m_ConfigFile = pIniFile
SynchIniData()
End Sub
Private Sub SynchIniData()
Monitor = m_ConfigFile.GetSection("Position").GetKey("Monitor").Value
ScreenPosition = m_ConfigFile.GetSection("Position").GetKey("ScreenPosition").Value
Layering = m_ConfigFile.GetSection("Position").GetKey("Layering").Value
Centering = m_ConfigFile.GetSection("Position").GetKey("Centering").Value
EdgeOffsetPx = m_ConfigFile.GetSection("Position").GetKey("EdgeOffsetPx").Value
posX = m_ConfigFile.GetSection("Position").GetKey("X").Value
posY = m_ConfigFile.GetSection("Position").GetKey("Y").Value
End Sub
Friend Sub Save()
m_ConfigFile.SetKeyValue("Position", "Monitor", Monitor)
m_ConfigFile.SetKeyValue("Position", "ScreenPosition", ScreenPosition)
m_ConfigFile.SetKeyValue("Position", "Layering", Layering)
m_ConfigFile.SetKeyValue("Position", "Centering", Centering)
m_ConfigFile.SetKeyValue("Position", "EdgeOffsetPx", EdgeOffsetPx)
m_ConfigFile.SetKeyValue("Position", "X", posX)
m_ConfigFile.SetKeyValue("Position", "Y", posY)
End Sub
End Class
Public Class cStyle
Public Property SkinDockInfo As DockInfo
Public Property Opacity As Single = 100
Public Property ShadowColor As String = ColorToHex(Color.Black)
Public Property OutLineColor As String = ColorToHex(Color.Black)
Public Property OutLineOpacity As Single = 55
Public Property ShadowOpacity As Single = 25
Private m_theme As String
Private m_ConfigFile As IniFile
Friend Sub New(ByRef pIniFile As IniFile)
m_ConfigFile = pIniFile
SynchIniData()
End Sub
Private Sub SynchIniData()
Theme = m_ConfigFile.GetSection("Style").GetKey("Theme").Value
Opacity = m_ConfigFile.GetSection("Style").GetKey("Opacity").Value
ShadowColor = m_ConfigFile.GetSection("Style").GetKey("ShadowColor").Value
OutLineColor = m_ConfigFile.GetSection("Style").GetKey("OutLineColor").Value
OutLineOpacity = m_ConfigFile.GetSection("Style").GetKey("OutLineOpacity").Value
ShadowOpacity = m_ConfigFile.GetSection("Style").GetKey("ShadowOpacity").Value
End Sub
Friend Sub Save()
m_ConfigFile.SetKeyValue("Style", "Theme", Theme)
m_ConfigFile.SetKeyValue("Style", "Opacity", Opacity)
m_ConfigFile.SetKeyValue("Style", "ShadowColor", ShadowColor)
m_ConfigFile.SetKeyValue("Style", "OutLineColor", OutLineColor)
m_ConfigFile.SetKeyValue("Style", "OutLineOpacity", OutLineOpacity)
m_ConfigFile.SetKeyValue("Style", "ShadowOpacity", ShadowOpacity)
End Sub
Public Property Theme() As String
Get
Return m_theme
End Get
Set(ByVal Value As String)
m_theme = Value
SkinDockInfo = New DockInfo(Application.StartupPath & "\Skins\" & m_theme)
End Set
End Property
End Class
Public Class cBehavior
Public Property IconEffect As IconEffects = IconEffects.Bounce
Public Property AutoHide As Boolean = False
Public Property AutoHideDurationMs As Single = 250
Public Property AutoHideDelayMs As Single = 250
Public Property PopUpOnMouseOver As Boolean = False
Public Property PopUpDelayMs As Single = 350
Public Property TopMostWindows As Boolean = False
Public Property Floating As Boolean = False
Public Property Dock As Integer = -1
Public Property AnimatedIcons As Boolean = True
Public Enum IconEffects
None = 1
Umber = 2
Bounce = 3
End Enum
Private m_ConfigFile As IniFile
Friend Sub New(ByRef pIniFile As IniFile)
m_ConfigFile = pIniFile
SynchIniData()
End Sub
Private Sub SynchIniData()
IconEffect = m_ConfigFile.GetSection("Behavior").GetKey("IconEffect").Value
AutoHide = IIf(m_ConfigFile.GetSection("Behavior").GetKey("AutoHide").Value.ToLower = "true", True, False)
AutoHideDurationMs = m_ConfigFile.GetSection("Behavior").GetKey("AutoHideDurationMs").Value
AutoHideDelayMs = m_ConfigFile.GetSection("Behavior").GetKey("AutoHideDelayMs").Value
PopUpOnMouseOver = IIf(m_ConfigFile.GetSection("Behavior").GetKey("PopUpOnMouseOver").Value.ToLower = "true", True, False)
PopUpDelayMs = m_ConfigFile.GetSection("Behavior").GetKey("PopUpDelayMs").Value
TopMostWindows = IIf(m_ConfigFile.GetSection("Behavior").GetKey("TopMostWindows").Value.ToLower = "true", True, False)
Floating = IIf(m_ConfigFile.GetSection("Behavior").GetKey("Floating").Value.ToLower = "true", True, False)
Dock = m_ConfigFile.GetSection("Behavior").GetKey("Dock").Value
AnimatedIcons = IIf(m_ConfigFile.GetSection("Behavior").GetKey("AnimatedIcons").Value.ToLower = "true", True, False)
End Sub
Friend Sub save()
m_ConfigFile.SetKeyValue("Behavior", "IconEffect", IconEffect)
m_ConfigFile.SetKeyValue("Behavior", "AutoHide", AutoHide.ToString)
m_ConfigFile.SetKeyValue("Behavior", "AutoHideDurationMs", AutoHideDurationMs)
m_ConfigFile.SetKeyValue("Behavior", "AutoHideDelayMs", AutoHideDelayMs)
m_ConfigFile.SetKeyValue("Behavior", "PopUpOnMouseOver", PopUpOnMouseOver.ToString)
m_ConfigFile.SetKeyValue("Behavior", "PopUpDelayMs", PopUpDelayMs)
m_ConfigFile.SetKeyValue("Behavior", "TopMostWindows", TopMostWindows.ToString)
m_ConfigFile.SetKeyValue("Behavior", "Floating", Floating.ToString)
m_ConfigFile.SetKeyValue("Behavior", "Dock", Dock)
m_ConfigFile.SetKeyValue("Behavior", "AnimatedIcons", AnimatedIcons)
End Sub
End Class
Public Class cLabel
Public Property FontName As String = "Tahoma"
Public Property FontSize As Single = 10
Public Property FontStyle As Single = 0 'regular
Public Property ShowLabel As Boolean = True
Public Property ShowFrame As Boolean = True
Public Property ShowFrameBorder As Boolean = True
Public Property BorderLabelFrameWidth As Integer = 4
Public Property LabelAlignement As Integer = StringAlignment.Center
Public Property LabelForeColor As String = ColorToHex(Color.Yellow)
Public Property Label3D As Boolean = False
Public Property LabelShadow As Boolean = False
Public Property ShowGradientBackground As Boolean = True
Public Property GradientOrientation As Integer = LinearGradientMode.BackwardDiagonal
Public Property FrameBorderColor As String = ColorToHex(Color.Yellow)
Public Property FrameBackColor As String = ColorToHex(Color.Yellow)
Public Property FrameFirstColor As String = ColorToHex(Color.Yellow)
Public Property FrameSecondColor As String = ColorToHex(Color.Yellow)
Public Property FrameRoundedCorners As Boolean = True
Public Property FrameRadius As Integer = 10
Public Property Opacity As Single = 100
Public Property TopMargin As Single = 130
Private m_ConfigFile As IniFile
Friend Sub New(ByVal pIniFile As IniFile)
m_ConfigFile = pIniFile
SynchIniData()
End Sub
Private Sub SynchIniData()
FontName = m_ConfigFile.GetSection("Label").GetKey("FontName").Value
FontSize = m_ConfigFile.GetSection("Label").GetKey("FontSize").Value
FontStyle = m_ConfigFile.GetSection("Label").GetKey("FontStyle").Value
ShowLabel = IIf(m_ConfigFile.GetSection("Label").GetKey("ShowLabel").Value.ToLower = "true", True, False)
ShowFrame = IIf(m_ConfigFile.GetSection("Label").GetKey("ShowFrame").Value.ToLower = "true", True, False)
ShowFrameBorder = IIf(m_ConfigFile.GetSection("Label").GetKey("ShowFrameBorder").Value.ToLower = "true", True, False)
BorderLabelFrameWidth = m_ConfigFile.GetSection("Label").GetKey("BorderLabelFrameWidth").Value
LabelAlignement = m_ConfigFile.GetSection("Label").GetKey("LabelAlignement").Value
LabelForeColor = m_ConfigFile.GetSection("Label").GetKey("LabelForeColor").Value
ShowGradientBackground = IIf(m_ConfigFile.GetSection("Label").GetKey("ShowGradientBackground").Value.ToLower = "true", True, False)
GradientOrientation = m_ConfigFile.GetSection("Label").GetKey("GradientOrientation").Value
Label3D = IIf(m_ConfigFile.GetSection("Label").GetKey("Label3D").Value.ToLower = "true", True, False)
LabelShadow = IIf(m_ConfigFile.GetSection("Label").GetKey("LabelShadow").Value.ToLower = "true", True, False)
FrameBorderColor = m_ConfigFile.GetSection("Label").GetKey("FrameBorderColor").Value
FrameBackColor = m_ConfigFile.GetSection("Label").GetKey("FrameBackColor").Value
FrameFirstColor = m_ConfigFile.GetSection("Label").GetKey("FrameFirstColor").Value
FrameSecondColor = m_ConfigFile.GetSection("Label").GetKey("FrameSecondColor").Value
FrameRoundedCorners = IIf(m_ConfigFile.GetSection("Label").GetKey("FrameRoundedCorners").Value.ToLower = "true", True, False)
FrameRadius = m_ConfigFile.GetSection("Label").GetKey("FrameRadius").Value
Opacity = m_ConfigFile.GetSection("Label").GetKey("Opacity").Value
TopMargin = m_ConfigFile.GetSection("Label").GetKey("TopMargin").Value
End Sub
Friend Sub Save()
m_ConfigFile.SetKeyValue("Label", "FontName", FontName)
m_ConfigFile.SetKeyValue("Label", "FontSize", FontSize)
m_ConfigFile.SetKeyValue("Label", "FontStyle", FontStyle)
m_ConfigFile.SetKeyValue("Label", "ShowLabel", ShowLabel.ToString)
m_ConfigFile.SetKeyValue("Label", "ShowFrame", ShowFrame.ToString)
m_ConfigFile.SetKeyValue("Label", "ShowFrameBorder", ShowFrameBorder.ToString)
m_ConfigFile.SetKeyValue("Label", "BorderLabelFrameWidth", BorderLabelFrameWidth)
m_ConfigFile.SetKeyValue("Label", "LabelAlignement", LabelAlignement)
m_ConfigFile.SetKeyValue("Label", "LabelForeColor", LabelForeColor)
m_ConfigFile.SetKeyValue("Label", "ShowGradientBackground", ShowGradientBackground.ToString)
m_ConfigFile.SetKeyValue("Label", "GradientOrientation", GradientOrientation.ToString)
m_ConfigFile.SetKeyValue("Label", "Label3D", Label3D.ToString)
m_ConfigFile.SetKeyValue("Label", "LabelShadow", LabelShadow.ToString)
m_ConfigFile.SetKeyValue("Label", "FrameBorderColor", FrameBorderColor)
m_ConfigFile.SetKeyValue("Label", "FrameBackColor", FrameBackColor)
m_ConfigFile.SetKeyValue("Label", "FrameFirstColor", FrameFirstColor)
m_ConfigFile.SetKeyValue("Label", "FrameSecondColor", FrameSecondColor)
m_ConfigFile.SetKeyValue("Label", "FrameRoundedCorners", FrameRoundedCorners)
m_ConfigFile.SetKeyValue("Label", "FrameRadius", FrameRadius)
m_ConfigFile.SetKeyValue("Label", "Opacity", Opacity)
m_ConfigFile.SetKeyValue("Label", "TopMargin", TopMargin)
End Sub
End Class
End Namespace