-
-
Notifications
You must be signed in to change notification settings - Fork 39
/
frmPath.frm
241 lines (233 loc) · 6.82 KB
/
frmPath.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
'#########################################################
'# frmPath.bas #
'# This file is part of VisualFBEditor #
'# Authors: Xusinboy Bekchanov (bxusinboy@mail.ru) #
'#########################################################
#include once "frmPath.bi"
#include once "frmImageManager.bi"
'#Region "Form"
Constructor frmPath
' frmPath
With This
.Name = "frmPath"
.Text = ML("Path")
.StartPosition = FormStartPosition.CenterParent
.BorderStyle = FormBorderStyle.FixedDialog
.MaximizeBox = False
.MinimizeBox = False
.Designer = @This
.OnShow = @Form_Show_
.OnClose = @Form_Close_
.SetBounds 0, 0, 462, 177
End With
' cmdCancel
With cmdCancel
.Name = "cmdCancel"
.Text = ML("Cancel")
.SetBounds 336, 116, 112, 24
.Designer = @This
.OnClick = @cmdCancel_Click_
.Parent = @This
End With
' txtVersion
With txtVersion
.Name = "txtVersion"
.Text = ""
.SetBounds 100, 48, 348, 24
.Parent = @This
End With
' lblVersion
With lblVersion
.Name = "lblVersion"
.Text = ML("Version") & ":"
.SetBounds 8, 50, 84, 24
.Parent = @This
End With
' lblPath
With lblPath
.Name = "lblPath"
.Text = ML("Path") & ":"
.SetBounds 8, 18, 84, 24
.Parent = @This
End With
' txtPath
With txtPath
.Name = "txtPath"
.Text = ""
.SetBounds 100, 16, 316, 24
.Parent = @This
End With
' cmdPath
With cmdPath
.Name = "cmdPath"
.Text = "..."
.SetBounds 416, 16, 32, 24
.Caption = "..."
.Designer = @This
.OnClick = @cmdPath_Click_
.Parent = @This
End With
' cmdOK
With cmdOK
.Name = "cmdOK"
.Text = ML("OK")
.SetBounds 216, 116, 112, 24
.Designer = @This
.OnClick = @cmdOK_Click_
.Parent = @This
End With
' lblCommandLine
With lblCommandLine
.Name = "lblCommandLine"
.Text = ML("Command line") & ":"
.SetBounds 8, 82, 88, 24
.Parent = @This
End With
' txtCommandLine
With txtCommandLine
.Name = "txtCommandLine"
.SetBounds 100, 80, 128, 24
.Text = ""
.Parent = @This
End With
' lblExtensions
With lblExtensions
.Name = "lblExtensions"
.Text = ML("Extensions") & ":"
.SetBounds 238, 82, 88, 24
.Caption = ML("Extensions") & ":"
.Parent = @This
End With
' txtExtensions
With txtExtensions
.Name = "txtExtensions"
.SetBounds 320, 80, 128, 24
.Text = ""
.Parent = @This
End With
' cboType
With cboType
.Name = "cboType"
.Text = ""
.TabIndex = 11
.SetBounds 100, 80, 130, 21
.Visible = False
.Parent = @This
End With
End Constructor
Dim Shared frPath As frmPath
Dim Shared frPathImageList As frmPath
pfPath = @frPath
pfPathImageList = @frPathImageList
'#End Region
Private Sub frmPath.cmdOK_Click_(ByRef Sender As Control)
*Cast(frmPath Ptr, Sender.Designer).cmdOK_Click(Sender)
End Sub
Private Sub frmPath.cmdOK_Click(ByRef Sender As Control)
If Not ChooseFolder AndAlso Trim(txtVersion.Text) = "" Then
MsgBox ML("Enter version of program!")
This.BringToFront()
Exit Sub
ElseIf Trim(This.txtPath.Text) = "" Then
MsgBox ML("Select path of program!")
This.BringToFront()
Exit Sub
End If
This.ModalResult = ModalResults.OK
This.CloseForm
End Sub
Private Sub frmPath.cmdCancel_Click_(ByRef Sender As Control)
*Cast(frmPath Ptr, Sender.Designer).cmdCancel_Click(Sender)
End Sub
Private Sub frmPath.cmdCancel_Click(ByRef Sender As Control)
This.ModalResult = ModalResults.Cancel
This.CloseForm
End Sub
Private Sub frmPath.cmdPath_Click_(ByRef Sender As Control)
*Cast(frmPath Ptr, Sender.Designer).cmdPath_Click(Sender)
End Sub
Private Sub frmPath.cmdPath_Click(ByRef Sender As Control)
With This
If .WithKey AndAlso .cboType.ItemIndex = 0 Then
If pfImageManager->ShowModal(*pfrmMain) = ModalResults.OK Then
If pfImageManager->lvImages.SelectedItem <> 0 Then
.txtPath.Text = pfImageManager->lvImages.SelectedItem->Text(0)
.txtVersion.Text = .txtPath.Text
End If
End If
Else
Dim As UString FolderName
If .WithType Then
FolderName = GetFolderName(.ExeFileName)
Else
FolderName = GetFolderName(pApp->FileName)
End If
If .ChooseFolder Then
.BrowseD.InitialDir = GetFullPath(.txtPath.Text)
If .BrowseD.Execute Then
If FolderName <> "" AndAlso StartsWith(.BrowseD.Directory, FolderName) Then
.txtPath.Text = "." & Slash & Mid(.BrowseD.Directory, Len(FolderName) + 1)
Else
.txtPath.Text = .BrowseD.Directory
End If
End If
Else
.OpenD.Filter = ML("All Files") & "|*.*;"
If .OpenD.Execute Then
If FolderName <> "" AndAlso StartsWith(.OpenD.FileName, FolderName) Then
.txtPath.Text = "." & Slash & Mid(.OpenD.FileName, Len(FolderName) + 1)
Else
.txtPath.Text = .OpenD.FileName
End If
If EndsWith(.OpenD.FileName, ".chm") OrElse .SetFileNameToVersion Then
.txtVersion.Text = ..Left(GetFileName(.OpenD.FileName), Len(GetFileName(.OpenD.FileName)) - 4)
Else
.txtVersion.Text = GetFileName(GetFolderName(.OpenD.FileName, False))
If .txtVersion.Text = "bin" Then
.txtVersion.Text = GetFileName(GetFolderName(GetFolderName(.OpenD.FileName, False), False))
End If
End If
If .WithType Then
If EndsWith(LCase(.OpenD.FileName), ".bmp") Then
.cboType.ItemIndex = 0
ElseIf EndsWith(LCase(.OpenD.FileName), ".cur") Then
.cboType.ItemIndex = 1
ElseIf EndsWith(LCase(.OpenD.FileName), ".ico") Then
.cboType.ItemIndex = 2
ElseIf EndsWith(LCase(.OpenD.FileName), ".png") Then
.cboType.ItemIndex = 3
Else
.cboType.ItemIndex = 4
End If
End If
End If
End If
End If
.BringToFront()
End With
End Sub
Private Sub frmPath.Form_Show_(ByRef Sender As Form)
*Cast(frmPath Ptr, Sender.Designer).Form_Show(Sender)
End Sub
Private Sub frmPath.Form_Show(ByRef Sender As Form)
lblVersion.Visible = (Not WithoutVersion) AndAlso Not ChooseFolder
txtVersion.Visible = (Not WithoutVersion) AndAlso Not ChooseFolder
lblCommandLine.Visible = Not (WithoutCommandLine OrElse ChooseFolder)
txtCommandLine.Visible = Not (WithoutCommandLine OrElse ChooseFolder OrElse WithType)
lblExtensions.Visible = WithExtensions
txtExtensions.Visible = WithExtensions
cboType.Visible = WithType
lblPath.Text = IIf(WithKey, ML("Resource Name / Path") & ":", ML("Path") & ":")
lblVersion.Text = IIf(WithType, IIf(WithKey, ML("Key") & ":", ML("Resource Name") & ":"), ML("Version") & ":")
lblCommandLine.Text = IIf(WithType, ML("Type") & ":", ML("Command line") & ":")
End Sub
Private Sub frmPath.Form_Close_(ByRef Sender As Form, ByRef Action As Integer)
*Cast(frmPath Ptr, Sender.Designer).Form_Close(Sender, Action)
End Sub
Private Sub frmPath.Form_Close(ByRef Sender As Form, ByRef Action As Integer)
ChooseFolder = False
WithoutVersion = False
WithoutCommandLine = False
WithExtensions = False
WithType = False
End Sub