-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathM0.frm
More file actions
385 lines (352 loc) · 12 KB
/
M0.frm
File metadata and controls
385 lines (352 loc) · 12 KB
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
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
VERSION 5.00
Begin VB.Form M0
BorderStyle = 3 'Fixed Dialog
ClientHeight = 2535
ClientLeft = 45
ClientTop = 45
ClientWidth = 4050
ClipControls = 0 'False
ControlBox = 0 'False
BeginProperty Font
Name = "Arial"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2535
ScaleWidth = 4050
ShowInTaskbar = 0 'False
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton cmdClose
Caption = "&Close"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Left = 0
TabIndex = 6
Top = 2250
Visible = 0 'False
Width = 1635
End
Begin VB.Timer Timer1
Left = 2880
Top = 540
End
Begin VB.DirListBox Dir1
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 975
TabIndex = 5
Top = 1005
Visible = 0 'False
Width = 1215
End
Begin VB.PictureBox picItem
AutoRedraw = -1 'True
BorderStyle = 0 'None
BeginProperty Font
Name = "Arial"
Size = 9
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 300
Index = 0
Left = 0
ScaleHeight = 300
ScaleWidth = 4035
TabIndex = 4
Top = 0
Width = 4035
End
Begin VB.PictureBox picTemp
AutoRedraw = -1 'True
BorderStyle = 0 'None
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 300
Left = 1035
ScaleHeight = 20
ScaleMode = 3 'Pixel
ScaleWidth = 22
TabIndex = 3
Top = 1440
Visible = 0 'False
Width = 330
End
Begin VB.PictureBox picBlackArrow
AutoRedraw = -1 'True
BorderStyle = 0 'None
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Left = 1125
Picture = "M0.frx":0000
ScaleHeight = 285
ScaleWidth = 225
TabIndex = 2
Top = 585
Visible = 0 'False
Width = 225
End
Begin VB.PictureBox picWhiteArrow
AutoRedraw = -1 'True
BackColor = &H8000000D&
BorderStyle = 0 'None
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 1440
Picture = "M0.frx":058A
ScaleHeight = 240
ScaleWidth = 240
TabIndex = 1
Top = 615
Visible = 0 'False
Width = 240
End
Begin VB.FileListBox File1
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Left = 2235
TabIndex = 0
Top = 1065
Visible = 0 'False
Width = 915
End
End
Attribute VB_Name = "M0"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private OldIndex As Integer
Private MaxLen As Long 'Integer
Private fChild As M0
Private mParent As M0
Private CurY As Long
Private CurYIcon As Long
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub Form_Load()
Me.AutoRedraw = False 'faster
Me.ScaleMode = 3 'pixel
OldIndex = -1
End Sub
Private Sub Form_Unload(Cancel As Integer)
If Not (fChild Is Nothing) Then Unload fChild
End Sub
Public Sub UnloadAll()
If Not (mParent Is Nothing) Then mParent.UnloadAll
Unload Me
End Sub
Private Sub picItem_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
If Index > Dir1.ListCount - 1 Then
ShellExecute Me.hWnd, "open", Dir1.path & "\" & Right(picItem(Index).Tag, Len(picItem(Index).Tag) - 8), "", "", 1
mParent.UnloadAll
Unload Me
'HideStartMenu
s_Playsound "select"
End If
ElseIf Button = vbRightButton Then
End If
End Sub
Private Sub picItem_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
If Dir1.ListCount + File1.ListCount = 0 Then Exit Sub 'if there is nothing to show
If Index <> OldIndex Then 'Over(Index) = False Then
If OldIndex = -1 Then OldIndex = 0
' --- reset the old selection ---
picItem(OldIndex).Cls
picItem(OldIndex).BackColor = vbButtonFace
picItem(OldIndex).ForeColor = vbButtonText
picItem(OldIndex).CurrentY = CurY
picItem(OldIndex).Print picItem(OldIndex).Tag
If OldIndex >= Dir1.ListCount Then
DrawIcon Dir1.path & "\" & File1.List(OldIndex - Dir1.ListCount), OldIndex
Else
BitBlt picItem(OldIndex).hdc, Me.ScaleWidth - 18, CurY / Screen.TwipsPerPixelY, 18, 18, picBlackArrow.hdc, 0, 0, vbSrcCopy
DrawIcon Dir1.List(OldIndex), OldIndex
End If
' --- highlite new selection ---
picItem(Index).Cls
picItem(Index).BackColor = vbHighlight
picItem(Index).ForeColor = vbHighlightText
picItem(Index).CurrentY = CurY
picItem(Index).Print picItem(Index).Tag
If Index >= Dir1.ListCount Then 'If not a directory then
DrawIcon Dir1.path & "\" & File1.List(Index - Dir1.ListCount), Index ', False
Else 'index < Dir1.ListCount
BitBlt picItem(Index).hdc, Me.ScaleWidth - 18, CurY / Screen.TwipsPerPixelY, 16, 16, picWhiteArrow.hdc, 0, 0, vbSrcCopy
DrawIcon Dir1.List(Index), Index ', False
' --- show new child menu ---
Timer1.Interval = 100
End If
picTemp.ForeColor = vb3DHighlight
picTemp.Line (0, 0)-(19, 0)
picTemp.Line (0, 0)-(0, 19)
picTemp.ForeColor = vbButtonShadow
picTemp.Line (0, 19)-(19, 19)
picTemp.Line (19, 0)-(19, 19)
BitBlt picItem(Index).hdc, 0, CurYIcon, 20, 20, picTemp.hdc, 0, 0, vbSrcCopy
'picTemp.Cls
OldIndex = Index
If Not (fChild Is Nothing) Then Unload fChild
If Index < Dir1.ListCount Then
' s_Playsound "open"
Else
' s_Playsound "hover"
End If
End If
End Sub
Public Sub GetMenu(path As String, Optional Parent As M0 = Nothing)
Dim i As Long
Dim lTemp As Long
Set mParent = Parent
MaxLen = 0
' For i = 1 To picItem.UBound
' Unload picItem(i)
' Next
Dir1.path = path
File1.path = path
If File1.ListCount + Dir1.ListCount = 0 Then
picItem(0).CurrentY = ((picItem(0).Height * Screen.TwipsPerPixelY) - picItem(0).TextHeight("|")) / 2
picItem(0).Print "[ Empty ]"
MaxLen = picItem(0).TextWidth("[ Empty ]")
Else
For i = 1 To Dir1.ListCount + File1.ListCount - 1
Load picItem(i)
picItem(i).Visible = True
picItem(i).Top = picItem(0).Height * i
Next
CurYIcon = ((picItem(0).Height) - 20) / 2
CurY = ((picItem(0).Height * Screen.TwipsPerPixelY) - picItem(0).TextHeight("|")) / 2
For i = 0 To Dir1.ListCount - 1
DrawIcon Dir1.List(i), i
picItem(i).CurrentY = CurY
picItem(i).Tag = " " & ExtractFileName(Dir1.List(i))
picItem(i).Print picItem(i).Tag
lTemp = picItem(i).TextWidth(picItem(i).Tag)
If lTemp > MaxLen Then MaxLen = lTemp
Next
For i = 0 To File1.ListCount - 1
picTemp.BackColor = vbButtonFace
DrawIcon Dir1.path & "\" & File1.List(i), i + Dir1.ListCount
picItem(i + Dir1.ListCount).CurrentY = CurY
picItem(i + Dir1.ListCount).Tag = " " & Left(File1.List(i), Len(File1.List(i)) - 4)
picItem(i + Dir1.ListCount).Print picItem(i + Dir1.ListCount).Tag
lTemp = picItem(i + Dir1.ListCount).TextWidth(picItem(i + Dir1.ListCount).Tag)
If lTemp > MaxLen Then MaxLen = lTemp
Next
End If
Me.Width = MaxLen + 500
Me.Height = (picItem.Count * picItem(0).Height * Screen.TwipsPerPixelY) + 10
If mParent Is Nothing Then
cmdClose.Visible = True
Me.Height = Me.Height + cmdClose.Height * Screen.TwipsPerPixelY
cmdClose.Top = Me.Height / Screen.TwipsPerPixelY - cmdClose.Height
cmdClose.Width = Me.ScaleWidth
End If
'Me.Refresh
If Me.Top + Me.Height > Screen.Height Then Me.Top = Screen.Height - Me.Height
SetWindowPos Me.hWnd, -1, Me.Left / Screen.TwipsPerPixelX, Me.Top / Screen.TwipsPerPixelY, Me.ScaleWidth, Me.ScaleHeight + 10, SWP_NOREPOSITION
For i = 0 To picItem.Count - 1
picItem(i).Width = Me.ScaleWidth
Next
For i = 0 To Dir1.ListCount - 1
BitBlt picItem(i).hdc, Me.ScaleWidth - 18, CurY / Screen.TwipsPerPixelY, 18, 18, picBlackArrow.hdc, 0, 0, vbSrcCopy
Next
' --- You can uncomment the following lines for window effects ---
' Dim mWidth As Long, mHeight As Long, y As Long
' mWidth = Me.Width
' mHeight = Me.Height
' Me.Width = 100
' Me.Height = 100
Me.Show
Me.Refresh
' --- You can uncomment the following lines for window effects ---
' For i = 10 To 1 Step -1
' Me.Width = mWidth / i
' Me.Height = mHeight / i
' Me.Refresh
' Next
' Me.Width = mWidth
' Me.Height = mHeight
End Sub
Sub DrawIcon(path, Index, Optional blt = True)
Dim hImgLarge&
hImgLarge& = SHGetFileInfo(path, 0&, shinfo, Len(shinfo), _
BASIC_SHGFI_FLAGS Or SHGFI_SMALLICON)
picTemp.Cls
If blt Then
ImageList_Draw hImgLarge&, shinfo.iIcon, picTemp.hdc, 2, 2, ILD_TRANSPARENT
BitBlt picItem(Index).hdc, 0, CurYIcon, 20, 20, picTemp.hdc, 0, 0, vbSrcCopy
Else
ImageList_Draw hImgLarge&, shinfo.iIcon, picTemp.hdc, 2, 2, ILD_TRANSPARENT
End If
End Sub
Private Sub Timer1_Timer()
Timer1.Interval = 0
' --- show new child menu ---
If OldIndex < Dir1.ListCount Then
Set fChild = New M0
fChild.Top = Me.Top + picItem(OldIndex).Top * Screen.TwipsPerPixelX
fChild.Left = Me.Left + Me.Width - 50
fChild.GetMenu Dir1.path & "\" & Right(picItem(OldIndex).Tag, Len(picItem(OldIndex).Tag) - 8), Me
End If
End Sub