📄 instw32.tcl
字号:
}
proc folderValueReadFromRegistry {} {
global setupVals
# Load folder from the previous installtion if any
if {"[defGroupGet]" == ""} {
if {![catch {sysRegistryValueRead HKEY_CURRENT_USER \
"Software\\$setupVals(WRS)" "folder"} folder]} {
defGroupSet $folder
} {
defGroupSet "Tornado"
}
}
return [defGroupGet]
}
proc storeFolderIntoRegistry {} {
global setupVals
regValueWriteLog HKEY_CURRENT_USER "Software\\$setupVals(WRS)" \
folder [defGroupGet]
}
proc pageCreate(wlmdDetect) {} {
global ctrlVals
global setupVals
set ctrlVals(volatileFrm) [list \
[list label -name msg0 \
-title [strTableGet 1358_LICENSE_SERVER_DETECT]\
-x 100 -y 10 -w 205 -h 64] \
]
set w [dlgFrmCreate "[strTableGet 1261_LICENSE] Detect"]
nextCallback
}
proc pageProcess(wlmdDetect) {} {
global setupVals ctrlVals
for {set i 0} {$i < 10} {incr i} {
uiEventProcess
}
beginWaitCursor
set setupVals(isWlmdRunning) [pingServer [info host]]
endWaitCursor
if {[needUpdateWlmd] && $setupVals(isWlmdRunning)} {
messageBox -ok -stopicon [strTableGet 1359_LICENSE_SERVER_SHUTDOWN]
applicationExit
} {
set ctrlVals(currPage) welcome
pageRemove wlmdDetect
return 1
}
}
proc needUpdateWlmd {} {
global ctrlVals setupVals
set retVal 0
set installedWlmd [systemDirGet]\\WLMD.EXE
set cdWlmd $setupVals(WLM_DIR)\\WLMD.EXE
if {[file exists $installedWlmd]} {
set retVal [expr [file mtime $installedWlmd] < [file mtime $cdWlmd]]
}
return $retVal
}
proc constructPages {mode} {
global ctrlVals
global setupVals
global dll
set retVal 1
set ctrlVals(pageList) {}
switch $mode {
license {
# Load the Support.dll which contains the mail API
if [catch {dllLoad [cdromBinDirGet]\\SUPPORT.DLL} dll(1)] {
messageBox -ok -stopicon $dll(1)
return 0
}
# Load the TGensock.dll which contains the socket API
if [catch {dllLoad "[cdromBinDirGet]\\TGENSOCK.DLL"} dll(2)] {
messageBox -ok -stopicon $dll(2)
return 0
}
# Load the wlmUtils.dll which contains the License API
if [catch {dllLoad "[cdromBinDirGet]\\WLMUTCL.DLL"} dll(3)] {
messageBox -ok -stopicon $dll(3)
return 0
}
cdromDescSet [strTableGet 1261_LICENSE]
if {($ctrlVals(admin) != "1") && ($ctrlVals(NT) == "1")} {
messageBox -ok -stopicon [strTableGet 1352_LICENSE_WARNING]
set retVal 0
} {
source [cdromRootDirGet]\\RESOURCE\\TCL\\SMTP.TCL
set ctrlVals(pageList) {welcome wlmdDetect registration destDir
folderSelect licenseChoice
remoteLicenseHost licEmail licCall
licenseKey licenseFinish}
set setupVals(hostName) [string toupper [info host]]
}
}
icon {
set ctrlVals(pageList) {welcome destDir folderSelect iconFinish}
cdromDescSet "Remote Icons"
}
default {
set ctrlVals(pageList) {welcome privilege registration destDir \
compSelect folderSelect filesCopy \
libUpdate portMapper torRegistry \
remoteRegistryHost finish}
catch {setupPortmapDetect} detect
if {$detect} {
pageRemove portMapper
}
if {($ctrlVals(admin) == "1") || ($ctrlVals(NT) != "1")} {
pageRemove privilege
}
}
}
set ctrlVals(currPage) [lindex $ctrlVals(pageList) 0]
set ctrlVals(pageListBack) $ctrlVals(pageList)
return $retVal
}
proc dlgFrmCreate {title} {
global ctrlVals
global setupVals
if {[windowExists $ctrlVals(mainWindow)] != 1 } {
set controls [list \
[list bitmap -name bitmap \
-title $ctrlVals(dlgImage) -stretch \
-x 10 -y 10 -w 80 -h 160] \
[list frame -gray -name frm2 -x 10 -y 178 -w 295 -h 2] \
[list button -name backButt -title "< &Back" \
-callback backCallback \
-disable -x 147 -y 185 -w 50 -h 14] \
[list button -name nextButt -title "&Next >" \
-default -callback nextCallback \
-x 197 -y 185 -w 50 -h 14] \
[list button -name cancelButt -title "Cancel" \
-callback quitCallback \
-x 255 -y 185 -w 50 -h 14] \
]
dialogCreate -name $ctrlVals(mainWindow) \
-topmost -title $title -w 315 -h 204 \
-parent $ctrlVals(parentDialog) \
-nocontexthelp \
-modeless \
-controls $controls
set ctrlVals(parentDialog) $ctrlVals(mainWindow)
windowQueryCloseCallbackSet $ctrlVals(mainWindow) quitCallback
}
customizeMainWindow $title
return $ctrlVals(mainWindow)
}
proc customizeMainWindow {title} {
global ctrlVals
windowTitleSet $ctrlVals(mainWindow) $title
foreach ctrl $ctrlVals(volatileFrm) {
controlCreate $ctrlVals(mainWindow) $ctrl
}
set ctrlVals(jumpBack) 1
}
proc destroyVolatileFrm {} {
global ctrlVals
foreach ctrl $ctrlVals(volatileFrm) {
set pos [lsearch $ctrl "-name"]
if {$pos != "-1"} {
controlDestroy \
$ctrlVals(mainWindow).[lindex $ctrl [expr $pos + 1]]
}
}
set ctrlVals(volatileFrm) ""
}
proc backCallback {} {
global ctrlVals
# decrement the dialog index and re-create previous page
set currPageIndex [lsearch $ctrlVals(pageList) $ctrlVals(currPage)]
set prevPageIndex [expr $currPageIndex - 1]
if {"$prevPageIndex" >= "0"} {
set ctrlVals(currPage) [lindex $ctrlVals(pageList) $prevPageIndex]
destroyVolatileFrm
pageCreate($ctrlVals(currPage))
} else {
messageBox "Can't go back further!"
}
}
proc nextCallback {} {
global ctrlVals
set retVal 0
if {"$ctrlVals(currPage)" != "" && \
[pageProcess($ctrlVals(currPage))] == "1"} {
set currPageIndex [lsearch $ctrlVals(pageList) $ctrlVals(currPage)]
if {"$currPageIndex" != "-1"} {
set nextPageIndex [expr $currPageIndex + 1]
set nextPage [lindex $ctrlVals(pageList) $nextPageIndex]
if {"$nextPage" != ""} {
set ctrlVals(currPage) $nextPage
destroyVolatileFrm
pageCreate($nextPage)
set retVal 1
} {
applicationExit
}
} {
puts "error: page $ctrlVals(currPage) not found!"
}
}
return $retVal
}
proc dialog {dialogType title message args} {
global ctrlVals
switch $dialogType {
retry_cancel {
switch [messageBox -retrycancel -questionicon $message] {
retry { return 0 }
cancel { return 1 }
}
}
yes_no {
switch [messageBox -yesno -questionicon $message] {
yes { return 0 }
no { return 1 }
}
}
resume_exit {
set dlgName "resume_exit"
set controls [list \
[list label -name message -title $message \
-x 10 -y 10 -w 205 -h 90] \
[list button -name Resume -title "Resume" \
-callback {windowClose $dlgName;
return 0} \
-x 116 -y 92 -w 50 -h 14] \
[list button -name Exit -title "Exit Setup" \
-callback {windowClose $dlgName;
return 1} \
-x 169 -y 92 -w 50 -h 14] \
]
set width 230
set xpos [expr ($ctrlVals(screenW) / 2) - ($width / 2)]
set height 114
set ypos [expr ($ctrlVals(screenH) / 2) - ($height / 2)]
dialogCreate -name $dlgName \
-title "$title" \
-nocontexthelp \
-parent $ctrlVals(parentDialog) \
-x $xpos -y $ypos \
-w $width -h $height \
-controls $controls
}
re_ig_cancel {
switch [messageBox -abortretryignore -questionicon $message] {
abort { return 2 }
retry { return 0 }
ignore { return 1 }
}
}
re_ig_cancel_old {
set controls [list \
[list label -name message -title $message \
-x 10 -y 7 -w 194 -h 90] \
[list button -name retry -title "&Retry" \
-callback {windowClose dlg;
return 0} \
-x 10 -y 56 -w 50 -h 14] \
[list button -name ignore -title "&Ignore" \
-callback {windowClose dlg;
return 1} \
-x 80 -y 56 -w 50 -h 14] \
[list button -name cancel -title "&Cancel" \
-callback {windowClose dlg;
return 2} \
-x 150 -y 56 -w 50 -h 14] \
]
dialogCreate -name "re_ig_cancel" \
-title "$title" \
-parent $ctrlVals(parentDialog) \
-nocontexthelp \
-w 205 -h 76 \
-controls $controls
}
ok {
switch [messageBox -ok -information $message] {
ok { return 0 }
}
}
ok_cancel {
switch [messageBox -okcancel -questionicon $message] {
ok { return 0 }
cancel { return 1 }
}
}
}
}
proc quitCallback {} {
global setupVals
global ctrlVals
if {"$setupVals(cancel)" != "1"} {
switch [dialog resume_exit "Setup" [strTableGet 1360_QUIT_CALLBACK]] {
0 {
return 0
}
1 {
set setupVals(cancel) 1
catch {uninstLog setupLog "\tUser aborted!"}
if {"filesCopy" != "$ctrlVals(currPage)"} {
applicationExit
}
return 1
}
}
}
}
proc applicationExit {} {
global ctrlVals
windowClose $ctrlVals(backgroundWindow)
}
proc onTextChange {control var} {
global ctrlVals
global setupVals
set setupVals($var) [controlValuesGet $ctrlVals(mainWindow).$control]
}
proc onTorRegOptSel {opt} {
global ctrlVals
set ctrlVals(torRegAction) $opt
}
proc onFolderName {} {
global ctrlVals
global setupVals
defGroupSet [controlValuesGet $ctrlVals(mainWindow).folderName]
}
proc mailSend {} {
global ctrlVals
dialogCreate \
-name mailConfirmDlg \
-parent $ctrlVals(mainWindow) \
-title "Mail Confirmation" \
-width 181 -height 133 \
-init mailSendInit \
-controls { \
{ button -title "Send" -name sendButt -default \
-xpos 66 -ypos 112 -width 50 -height 14 \
-callback onMailSend }
{ button -title "Cancel" -name cancelButt \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -