forked from lee-soft/ViPad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
newFirstTimeWarning.frm
275 lines (216 loc) · 7.32 KB
/
newFirstTimeWarning.frm
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
VERSION 5.00
Begin VB.Form FirstTimeWarning
AutoRedraw = -1 'True
BackColor = &H00FFFFFF&
BorderStyle = 1 'Fixed Single
Caption = " "
ClientHeight = 3075
ClientLeft = 45
ClientTop = 375
ClientWidth = 9975
ClipControls = 0 'False
ControlBox = 0 'False
BeginProperty Font
Name = "Tahoma"
Size = 15
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form2"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 205
ScaleMode = 3 'Pixel
ScaleWidth = 665
StartUpPosition = 2 'CenterScreen
End
Attribute VB_Name = "FirstTimeWarning"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'
'
'
Option Explicit
Private m_glassMode As Boolean
Private m_textLayer As ViTextLayer
'Private m_addURL As ViText
Private m_URL As ViText
Private WithEvents m_cmdCancel As ViCommandButton
Attribute m_cmdCancel.VB_VarHelpID = -1
Private WithEvents m_cmdYes As ViCommandButton
Attribute m_cmdYes.VB_VarHelpID = -1
Private WithEvents m_cmdNo As ViCommandButton
Attribute m_cmdNo.VB_VarHelpID = -1
Private m_viComponents As Collection
Private m_backBuffer As GDIPBitmap
Private m_graphicsWindow As GDIPGraphics
Private m_activeObject As Object
Public Event onLoad()
Public Event onCancel()
Public Event onConfirm()
Public AddDesktopShortcuts As Boolean
Public Property Get URL() As String
URL = m_URL.Caption
End Property
Public Property Let URL(newURL As String)
Dim initialDifference As Long
initialDifference = (m_URL.CalculateWidth - Me.ScaleWidth) / m_URL.Size
m_URL.Caption = newURL
If m_URL.CalculateWidth > Me.ScaleWidth - 30 Then
While (m_URL.CalculateWidth > Me.ScaleWidth - 33)
m_URL.Caption = Mid(m_URL.Caption, 1, Len(m_URL.Caption) - 1)
Wend
m_URL.Caption = m_URL.Caption & "..."
End If
ReDrawComponents
End Property
Private Sub Form_Load()
InitializeGDIIfNotInitialized
SetIcon Me.hWnd, "APPICON", True
'Set m_glassText = InitializeFormForGlassText(Me)
Set m_viComponents = New Collection
Set m_backBuffer = New GDIPBitmap
Set m_graphicsWindow = New GDIPGraphics
Set m_cmdCancel = New ViCommandButton
Set m_cmdYes = New ViCommandButton
Set m_cmdNo = New ViCommandButton
Set m_textLayer = New ViTextLayer
m_textLayer.Parent = Me
m_viComponents.Add m_textLayer
m_viComponents.Add m_cmdNo
m_viComponents.Add m_cmdYes
m_viComponents.Add m_cmdCancel
m_cmdCancel.Y = 160
m_cmdCancel.X = 16
m_cmdCancel.Width = 109
m_cmdCancel.Caption = "Cancel"
m_cmdYes.Y = 160
m_cmdYes.X = 424
m_cmdYes.Width = 109
m_cmdYes.Caption = "Yes"
m_cmdNo.Y = 160
m_cmdNo.X = 544
m_cmdNo.Width = 109
m_cmdNo.Caption = "No"
If ApplyGlassIfPossible(Me.hWnd) = False Then
Else
m_glassMode = True
End If
m_textLayer.CreateChild "This looks like the first time you've used ViPad.", _
12, _
16, _
Me.FontName, _
Me.fontSize
m_textLayer.CreateChild "To help you get started ViPad can automatically add the shortcuts already on your desktop.", _
12, _
40, _
Me.FontName, _
Me.fontSize
m_textLayer.CreateChild "Would you like me to do that now for you?", _
12, _
112, _
Me.FontName, _
Me.fontSize
m_graphicsWindow.FromHDC Me.hdc
m_graphicsWindow.SmoothingMode = SmoothingModeHighQuality
m_graphicsWindow.InterpolationMode = InterpolationModeHighQualityBicubic
m_graphicsWindow.TextRenderingHint = TextRenderingHintClearTypeGridFit
ReDrawComponents
End Sub
Private Sub ReDrawComponents()
If m_viComponents Is Nothing Then Exit Sub
If m_glassMode Then
m_graphicsWindow.Clear
Else
m_graphicsWindow.Clear Me.BackColor
End If
Dim thisObject As Object
For Each thisObject In m_viComponents
thisObject.Draw m_graphicsWindow
Next
Me.Refresh
End Sub
Private Sub Form_Resize()
m_graphicsWindow.FromHDC Me.hdc
m_graphicsWindow.SmoothingMode = SmoothingModeHighQuality
m_graphicsWindow.InterpolationMode = InterpolationModeHighQualityBicubic
m_graphicsWindow.TextRenderingHint = TextRenderingHintClearTypeGridFit
ReDrawComponents
End Sub
Private Sub m_cmdCancel_onClicked()
Unload Me
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim thisObject As Object
Dim redrawMe As Boolean
Dim Dimensions As RECTL
For Each thisObject In m_viComponents
Dimensions = Unserialize_RectL(thisObject.Dimensions_Serialized)
If IsMouseInsideRect(CLng(X), CLng(Y), Dimensions) Then
thisObject.onMouseDown CLng(Button), X - Dimensions.Left, Y - Dimensions.Top
If thisObject.RedrawRequest Then
redrawMe = True
End If
End If
Next
If redrawMe Then
ReDrawComponents
End If
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim thisObject As Object
Dim redrawMe As Boolean
Dim Dimensions As RECTL
For Each thisObject In m_viComponents
Dimensions = Unserialize_RectL(thisObject.Dimensions_Serialized)
If IsMouseInsideRect(CLng(X), CLng(Y), Dimensions) Then
thisObject.onMouseMove CLng(Button), X - Dimensions.Left, Y - Dimensions.Top
If thisObject.RedrawRequest Then
redrawMe = True
End If
End If
Next
If redrawMe Then
ReDrawComponents
End If
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim thisObject As Object
Dim redrawMe As Boolean
Dim Dimensions As RECTL
For Each thisObject In m_viComponents
Dimensions = Unserialize_RectL(thisObject.Dimensions_Serialized)
If IsMouseInsideRect(CLng(X), CLng(Y), Dimensions) Then
thisObject.onMouseUp CLng(Button), X - Dimensions.Left, Y - Dimensions.Top
If thisObject.RedrawRequest Then
redrawMe = True
End If
Else
If Not m_activeObject Is Nothing Then
m_activeObject.onMouseOut
Set m_activeObject = Nothing
End If
End If
Next
If redrawMe Then
ReDrawComponents
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set m_graphicsWindow = Nothing
Set m_viComponents = Nothing
Set m_textLayer = Nothing
End Sub
Private Sub m_cmdNo_onClicked()
AddDesktopShortcuts = False
Unload Me
End Sub
Private Sub m_cmdYes_onClicked()
AddDesktopShortcuts = True
Unload Me
End Sub