⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 instw32.tcl

📁 开发VxWorks图形界面所必须的媒体库WindML2.0的补丁windml2-cp2。
💻 TCL
📖 第 1 页 / 共 5 页
字号:
    nextCallback
}    


proc pageProcess(iconFinish) {} {
    return 1
}
 

###############################################################################
# Miscellaneous routines 
#

proc partListDlg {} {
    global ctrlVals

    dialogCreate \
        -name partListDlgHnd \
        -title "Select Parts" \
        -width 263 -height 195 \
        -nocontexthelp \
        -init partListDlgInit \
        -parent $ctrlVals(mainWindow) \
        -controls { \
                { button -title "Cancel" -name cancelButt \
                        -xpos 206 -ypos 173 -width 50 -height 14  \
                        -callback onPartListDlgCancel \
                }
                { button -title "OK" -name okButt -default \
                        -xpos 150 -ypos 173 -width 50 -height 14  \
                        -callback onPartListDlgOk \
                }
                { checklist -name optionList  \
                        -xpos 7 -ypos 42 -width 249 -height 83  \
                        -callback onClickPartCheckList \
                }
                { group -name frm1 -title "Information" \
                        -xpos 7 -ypos 130 -width 249 -height 37 \
                }
                { label -title "Space Required:" -name spaceRequireLabel  \
                        -xpos 16 -ypos 149 -width 170 -height 8  \
                }
                { label -title "In the part list below  click \
                                to select items you want to install or\
                                clear items you don't want to install." \
                        -name label3  \
                        -xpos 7 -ypos 7 -width 249 -height 18  \
                }
                { label -title "Parts:" -name label2  \
                        -xpos 8 -ypos 31 -width 86 -height 8  \
                }
        }
}

proc partListDlgInit {} {
    partGuiUpdate 0
}


proc currSelProdIndexSet {index} {
    global ctrlVals

    set ctrlVals(currSelProdIndex) $index
}

proc currSelProdIndexGet {{info obj}} {
    global objGuiMap ctrlVals

    if {"$info" != "obj"} {
        set retVal $ctrlVals(currSelProdIndex)
    } {
        set retVal $objGuiMap(gui2prod,$ctrlVals(currSelProdIndex))
    }

    return $retVal
}

proc onClickPartCheckList {} {

    partObjUpdate
    partGuiSizeUpdate
}


proc partObjUpdate {} {
    global ctrlVals objGuiMap

    set i 0
    foreach itemState \
                [controlItemCheckGet partListDlgHnd.optionList -all] {

        partInfoSet instFlag $objGuiMap(gui2part,$i) $itemState
        incr i
    }
}

proc partGuiUpdate {guiPartIndex} {
    partGuiChkLstUpdate $guiPartIndex
    partGuiSizeUpdate
}


proc partGuiChkLstUpdate {guiPartIndex} {
    global objGuiMap

    set prodIndex [currSelProdIndexGet]

    if {"$prodIndex" == ""} {
        windowClose partListDlgHnd
        messageBox "Please select a product first"
    } {
        set chkList {}
        set i 0

        foreach partIndex [productInfoGet partIndexList $prodIndex] {
            set objGuiMap(gui2part,$i) $partIndex
            set objGuiMap(part2gui,$partIndex) $i
            set size [partInfoGet size $partIndex]
            set mbSize [byteToMbyte $size]
            set desc " [partInfoGet desc $partIndex]\t$mbSize "
            lappend chkList [list $desc [partInfoGet instFlag $partIndex]]
            incr i
        }
    
        controlValuesSet partListDlgHnd.optionList $chkList
        controlFocusSet partListDlgHnd.optionList
        controlSelectionSet partListDlgHnd.optionList -noevent $guiPartIndex
    }
}

proc partGuiSizeUpdate {} {
    set totalSize [byteToMbyte [productInfoGet size [currSelProdIndexGet]]]

    controlValuesSet partListDlgHnd.spaceRequireLabel \
           "Space Required:  $totalSize MB"
}

proc onPartListDlgOk {} {
    global objGuiMap

    set prodIndex [currSelProdIndexGet]
    windowClose partListDlgHnd

    switch [productInfoGet stateInfo $prodIndex] {
        changedIncr {
            productInfoSet instFlag \
                    [partInfoGet parent $objGuiMap(gui2part,0)] 1
        }

        changedToNone {
            productInfoSet instFlag \
                    [partInfoGet parent $objGuiMap(gui2part,0)] 0
        }
    }

    productGuiChkLstUpdate [currSelProdIndexGet gui]
    productInfoSet stateCommit [currSelProdIndexGet]
    productInfoSet childStateCommit [currSelProdIndexGet]
    productGuiSizeUpdate
}


proc onPartListDlgCancel {} {
    windowClose partListDlgHnd
    productInfoSet childStateRestore [currSelProdIndexGet]
}


proc parseCmdLine {switches} {
    global setupVals tornadoInstalled

    set usageError [expr [llength $switches] > 1]

    if {!$usageError && ([llength $switches] == 1)} {
        set switches [string toupper $switches]
        switch -regexp ($switches) {
            \-L -
            /L -
            /LICENSE {
                instTypeSet license
            }
            \-I -
            /I -
            /ICON {
                instTypeSet icon
		set tornadoInstalled 1
            }
            /? -
            /H -
            /HELP -
            default {
                set usageError 1
            }
        }
    }

    if {$usageError} {
        messageBox -ok -informationico [strTableGet 1550_USAGE]
    }

    return $usageError
}


proc groupCreateLog {folder mode {log true}} {
    global ctrlVals

    catch {setupGroupCreate $folder $mode}

    if {[lsearch $ctrlVals(folders) $folder] == "-1" && $log == "true"} {
        lappend ctrlVals(folders) $folder
        uninstLog resource "folder\t$folder\t$mode"
    }
}


proc itemCreateLog {folder item exe dir mode {fMin 0} {iconIndex 0}\
                    {iconPath ""}} {

    set added 0
    set new 0

    if [catch {setupItemDelete $folder $item $mode} error] {
        set new 1
    }

    if {$iconPath == "" && ![catch {setupItemCreate $folder \
                                    $item \
                                    $exe \
                                    $dir \
                                    $mode \
                                    $fMin} error]} {
        set added 1
        
    } elseif {![catch {setupItemCreate $folder \
                                    $item \
                                    $exe \
                                    $dir \
                                    $mode \
                                    $fMin \
                                    $iconIndex \
                                    $iconPath} error]} {
        set added 1
    } {
        puts "error when creating item $item in $folder: $error"
    }

    if {$new && $added} {
        uninstLog resource "icon\t$folder\t$item\t$mode"
    }
}


proc regKeyCreateLog {rootKey subKey key {log true}} {
    global setupVals

    lappend setupVals(commandQueue) \
        [list regKeyCreateLogHelper $rootKey $subKey $key $log]  
}


proc regKeyCreateLogHelper {rootKey subKey key log} {

    if {[catch {setupRegKeyExists $rootKey "$subKey\\$key"} error] &&
       ![catch {sysRegistryKeyCreate $rootKey $subKey $key} error] && 
       "$log" == "true"} {

         uninstLog resource "regkey\t$rootKey\t$subKey\\$key"
    }
}


proc regValueExists {rootKey subKey value} {
    set retVal 0
    if {[lsearch [setupRegValueEnum $rootKey $subKey] $value] != -1} {
        set retVal 1
    } 
    return $retVal
}


proc regValueWriteLog {rootKey key valueName value {log true}} {
    global setupVals

    lappend setupVals(commandQueue) \
        [list regValueWriteLogHelper $rootKey $key $valueName $value $log]  
}


proc regValueWriteLogHelper {rootKey key valueName value log} {

    if {[catch {sysRegistryValueWrite $rootKey $key $valueName $value} error]} {
        puts "error when writing value $valueName: $error"

    } elseif {"$log" == "true" && ![regValueExists $rootKey $key $valueName]} {
        uninstLog resource "regValue\t$rootKey\t$key\t$valueName"
    }
}


proc queueExecute {} {
    global setupVals

    foreach command $setupVals(commandQueue) {
        eval $command
    }    
}

proc windLmHostValueRead {} {
    global setupVals
    global ctrlVals

    if ![info exists setupVals(licenseHost)] {
        set setupVals(licenseHost) ""

        if {![catch {sysRegistryValueRead HKEY_CURRENT_USER \
                "Software\\$setupVals(WRS)\\$setupVals(prodRegEntry)" \
                WIND_LMHOST} retVal]} {

            set setupVals(licenseHost) $retVal
        }
    }

    return $setupVals(licenseHost)
}

proc windRegValueRead {} {
    global setupVals
    global ctrlVals

    # Load WIND_REGISTRY from the previous installtion if any

    if ![info exists setupVals(registry)] { 
        set setupVals(registry) ""

        if {![catch {sysRegistryValueRead HKEY_CURRENT_USER \
                "Software\\$setupVals(WRS)\\$setupVals(prodRegEntry)" \
                WIND_REGISTRY} retVal]} { 

            set setupVals(registry) $retVal

        } elseif {![catch {sysRegistryValueRead HKEY_LOCAL_MACHINE \
                "SOFTWARE\\$setupVals(WRS)\\$setupVals(prodRegEntry)" \
                WIND_REGISTRY} retVal]} {

            set setupVals(registry) $retVal
        }
    }

    return $setupVals(registry)
}


proc windBaseReadFromRegistry {} {
    global setupVals

    # Initialize wind_base from registry

    if {"[destDirGet]" == ""} {   
        if {![catch {sysRegistryValueRead HKEY_CURRENT_USER \
                "Software\\$setupVals(WRS)" "WIND_BASE"} destDir]} {

            destDirSet $destDir

        } elseif {![catch {sysRegistryValueRead HKEY_LOCAL_MACHINE \
                "SOFTWARE\\$setupVals(WRS)" "WIND_BASE"} destDir]} {

            destDirSet $destDir
        } {
            destDirSet "C:\\Tornado"
        }
    }
}


proc registrationValuesReadFromRegistry {} {
    global setupVals

    # Load user name from the previous installtion if any

    if {"[userNameGet]" == ""} {
        if {![catch {sysRegistryValueRead HKEY_CURRENT_USER \
                 "Software\\$setupVals(WRS)" "name"} name]} {

            userNameSet $name

        } elseif {![catch {sysRegistryValueRead HKEY_LOCAL_MACHINE \
                 "SOFTWARE\\$setupVals(WRS)" "name"} name]} {

            userNameSet $name
        } {
            userNameSet ""
        }
    }

    # Load company name from the previous installtion if any

    if {"[companyNameGet]" == ""} {
        if {![catch {sysRegistryValueRead HKEY_CURRENT_USER \
                 "Software\\$setupVals(WRS)" "company"} company]} {

            companyNameSet $company

        } elseif {![catch {sysRegistryValueRead HKEY_LOCAL_MACHINE \
                 "SOFTWARE\\$setupVals(WRS)" "company"} company]} {

            companyNameSet $company
        } {
            companyNameSet ""
        }
    }

    # Load installation key from the previous installtion if any

    if {"[instKeyGet]" == ""} {
        if {![catch {sysRegistryValueRead HKEY_CURRENT_USER \
                 "Software\\$setupVals(WRS)" "key"} key]} {

            instKeySet $key

        } elseif {![catch {sysRegistryValueRead HKEY_LOCAL_MACHINE \
                 "SOFTWARE\\$setupVals(WRS)" "key"} key]} {

            instKeySet $key
        } {
            instKeySet ""
        }
    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -