forked from lee-soft/ViPad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ViSettings.cls
151 lines (119 loc) · 4.9 KB
/
ViSettings.cls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "ViSettings"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
Public MinimizeAfterLauch As Boolean
Public HideDesktopOnBoot As Boolean
Public ShowControlBox As Boolean
Public TopMostWindow As Boolean
Public ShowOnTaskBar As Boolean
Public IconSize As Long
Public StickToDesktop As Boolean
Public DockMode As Boolean
Public SplashUpdater As Boolean
Public VisibleToTaskBar As Boolean
Public ForceLayeredMode As Boolean
Public InstanceMode As Boolean
Public ShowTrayIcon As Boolean
Public CatchWebLinks As Boolean
Public MiddleMouseActivation As Boolean
Public WindowState As FormWindowStateConstants
Private m_MainWindowDimensions As GdiPlus.RECTL
Public Property Get MainWindowRect() As GdiPlus.RECTL
MainWindowRect = m_MainWindowDimensions
End Property
Public Property Let MainWindowRect(newRect As GdiPlus.RECTL)
m_MainWindowDimensions = newRect
End Property
Private Function ReadSettings()
On Error GoTo Handler
Dim settingsXml As New DOMDocument
Dim thisChild As IXMLDOMElement
'Set Defaults
IconSize = 70
MinimizeAfterLauch = True
DockMode = False
ShowTrayIcon = True
SplashUpdater = True
VisibleToTaskBar = True
WindowState = vbNormal
CatchWebLinks = True
MiddleMouseActivation = True
If settingsXml.Load(MiscSupport.ApplicationDataPath & "\settings.xml") = False Then
Exit Function
End If
For Each thisChild In settingsXml.selectSingleNode("settings").childNodes
Select Case thisChild.tagName
Case "MinimizeAfterLauch"
MinimizeAfterLauch = CBool(thisChild.Text)
Case "HideDesktopOnBoot"
HideDesktopOnBoot = CBool(thisChild.Text)
Case "ShowControlBox"
ShowControlBox = CBool(thisChild.Text)
Case "TopMostWindow"
TopMostWindow = CBool(thisChild.Text)
Case "StickToDesktop"
StickToDesktop = CBool(thisChild.Text)
Case "IconSize"
IconSize = CLng(thisChild.Text)
Case "DockMode"
DockMode = CBool(thisChild.Text)
Case "SplashUpdater"
SplashUpdater = CBool(thisChild.Text)
Case "VisibleToTaskBar"
VisibleToTaskBar = CBool(thisChild.Text)
Case "WindowState"
WindowState = CInt(thisChild.Text)
Case "ForceLayeredMode"
ForceLayeredMode = CBool(thisChild.Text)
Case "InstanceMode"
InstanceMode = CBool(thisChild.Text)
Case "ShowTrayIcon"
ShowTrayIcon = CBool(thisChild.Text)
Case "CatchWebLinks"
CatchWebLinks = CBool(thisChild.Text)
Case "MiddleMouseActivation"
MiddleMouseActivation = CBool(thisChild.Text)
End Select
Next
Handler:
End Function
Private Function DumpSettings() As Boolean
Dim szXML As String
Dim thisSettingsFile As New DOMDocument
szXML = "<settings>" & vbCrLf & _
"<IconSize>" & CLng(IconSize) & "</IconSize>" & vbCrLf & _
"<MinimizeAfterLauch>" & BoolToXML(MinimizeAfterLauch) & "</MinimizeAfterLauch>" & vbCrLf & _
"<HideDesktopOnBoot>" & BoolToXML(HideDesktopOnBoot) & "</HideDesktopOnBoot>" & vbCrLf & _
"<ShowControlBox>" & BoolToXML(ShowControlBox) & "</ShowControlBox>" & vbCrLf & _
"<TopMostWindow>" & BoolToXML(TopMostWindow) & "</TopMostWindow>" & vbCrLf & _
"<StickToDesktop>" & BoolToXML(StickToDesktop) & "</StickToDesktop>" & vbCrLf & _
"<DockMode>" & BoolToXML(DockMode) & "</DockMode>" & vbCrLf & _
"<SplashUpdater>" & BoolToXML(SplashUpdater) & "</SplashUpdater>" & vbCrLf & _
"<VisibleToTaskBar>" & BoolToXML(VisibleToTaskBar) & "</VisibleToTaskBar>" & vbCrLf & _
"<ForceLayeredMode>" & BoolToXML(ForceLayeredMode) & "</ForceLayeredMode>" & vbCrLf & _
"<InstanceMode>" & BoolToXML(InstanceMode) & "</InstanceMode>" & vbCrLf & _
"<ShowTrayIcon>" & BoolToXML(ShowTrayIcon) & "</ShowTrayIcon>" & vbCrLf & _
"<CatchWebLinks>" & BoolToXML(CatchWebLinks) & "</CatchWebLinks>" & vbCrLf & _
"<MiddleMouseActivation>" & BoolToXML(MiddleMouseActivation) & "</MiddleMouseActivation>" & vbCrLf & _
"</settings>"
If thisSettingsFile.loadXML(szXML) Then
thisSettingsFile.Save MiscSupport.ApplicationDataPath & "\settings.xml"
End If
End Function
Private Sub Class_Initialize()
ReadSettings
End Sub
Private Sub Class_Terminate()
DumpSettings
End Sub