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

📄 compslct.tcl

📁 这是vxworks 的图形界面开发软件windML2.0和另一个CP2可以构成完整的界面开发。
💻 TCL
📖 第 1 页 / 共 4 页
字号:
}

#############################################################################
#
# partGuiUpdate - update the partListDlg GUI
#
# This procedure will update the partListDlg GUI
#
# SYNOPSIS
# .tS
# partGuiUpdate <guiPartIndex>
# .tE
#
# PARAMETERS:
# .IP guiPartIndex
# the index of selected part
#
# RETURNS: N/A
#
# ERRORS: N/A
#

proc partGuiUpdate {guiPartIndex} {
    partGuiChkLstUpdate $guiPartIndex
    partGuiSizeUpdate
}

#############################################################################
#
# partGuiChkLstUpdate - update the partListDlg GUI
#
# This procedure will update the partListDlg GUI
#
# SYNOPSIS
# .tS
# partGuiChkLstUpdate <guiPartIndex>
# .tE
#
# PARAMETERS:
# .IP guiPartIndex
# the index of selected part
#
# RETURNS: N/A
#
# ERRORS: N/A
#

proc partGuiChkLstUpdate {guiPartIndex} {
    global objGuiMap
    global ctrlVals

    set prodIndex [currSelProdIndexGet]

    if {"$prodIndex" == ""} {
        windowClose partListDlgHnd
        messageBox "Please select a product first"
    } else {
        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 formatMbSize [format "%7s MB" [byteToMbyte $size]]
            set desc " [partInfoGet desc $partIndex]\t$formatMbSize "
            lappend chkList [list $desc [partInfoGet instFlag $partIndex]]
            incr i
        }

        controlValuesSet partListDlgHnd.optionList $chkList
        controlFocusSet partListDlgHnd.optionList
        controlSelectionSet partListDlgHnd.optionList -noevent $guiPartIndex
    }
}

#############################################################################
#
# partGuiSizeUpdate - update the size of each Tornado part
#
# This procedure will update the size of each Tornado part
#
# SYNOPSIS
# .tS
# partGuiSizeUpdate
# .tE
#
# PARAMETERS: N/A
#
# RETURNS: N/A
#
# ERRORS: N/A
#

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

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

#############################################################################
#
# onPartListDlgOk - callback when OK button is pushed and close partListDlg
#                   dialog box and save changes
#
# This procedure is a callback whne OK button is pushed and
# close partListDlg dialog box and save changes
#
# SYNOPSIS
# .tS
# onPartListDlgOk
# .tE
#
# PARAMETERS: N/A
#
# RETURNS: N/A
#
# ERRORS: N/A
#

proc onPartListDlgOk {} {
    global objGuiMap

    set prodIndex [currSelProdIndexGet]
    windowClose partListDlgHnd

    switch [productInfoGet stateInfo $prodIndex] {
        changedIncr {
            productInfoSet instFlag \
                    [partInfoGet parent $objGuiMap(gui2part,0)] 1
            set desc [productInfoGet desc $prodIndex]
            set hostType [windHostTypeGet]
            set prodHostType [prodHostTypeGet $desc]
            if {[productInfoGet instFlag $prodIndex]} {
                if {$hostType != $prodHostType && $prodHostType != "unknown"} {
                    set msg "The product, $desc, is not meant for installation \
                        on this host type of $hostType.\nContinuing with the \
                        installation may lead to an incomplete installation \
                        due to missing host tools."
                    dialog ok "SETUP" $msg
                }
            }
        }

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

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

#############################################################################
#
# onPartListDlgCancel - callback when cancel button is pushed and restore
#                       the previous settings
#
# This procedure
#
# SYNOPSIS
# .tS
# onPartListDlgCancel
# .tE
#
# PARAMETERS: N/A
#
# RETURNS: N/A
#
# ERRORS: N/A
#

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

#############################################################################
#
# detailShow - enable detail button if the Tornado product has subparts
#
# This procedure will enable detail button if the Tornado product has subparts
#
# SYNOPSIS
# .tS
# detailShow
# .tE
#
# PARAMETERS: N/A
#
# RETURNS: N/A
#
# ERRORS: N/A
#

proc detailShow {} {
    global productObj
    global ctrlVals

    set hasSubPart [expr [llength [productInfoGet partIndexList \
                                                  [currSelProdIndexGet]]] > 1]
    set numSubPart \
        [llength [productInfoGet partIndexList [currSelProdIndexGet]]]
    if {$hasSubPart} {

        # add in indication of components/product selected

        set nCompSel 0
        set totComps 0
        foreach partIndex $productObj([currSelProdIndexGet],partIndexList) {
            if {"[partInfoGet instFlag $partIndex]" == "1"} {
                incr nCompSel
            }
            incr totComps
        }

        if {[productInfoGet instFlag [currSelProdIndexGet]] == 1} {
            controlValuesSet $ctrlVals(mainWindow).compSelected "You have \
               selected $nCompSel out of $totComps components for this product."
        } else {
            controlValuesSet $ctrlVals(mainWindow).compSelected "You have \
               selected 0 out of $totComps components for this product."
        }
        controlEnable $ctrlVals(mainWindow).partDetailButt 1
    } else { 
 
       # This is a single part product

        if {[productInfoGet instFlag [currSelProdIndexGet]] == 1} {
            controlValuesSet $ctrlVals(mainWindow).compSelected "You have \
               selected 1 out of 1 components for this product."
        } else {
            controlValuesSet $ctrlVals(mainWindow).compSelected "You have \
               selected 0 out of 1 components for this product."
        }
        controlEnable $ctrlVals(mainWindow).partDetailButt 0
    }
    return $hasSubPart
}

#############################################################################
#
# drvIndexGet - return the driverObjects/Header product index if it exists
#               on the CD.
#
# This procedure will returns the driverObjects/Header product index
# if it exists on the CD.
#
# SYNOPSIS
# .tS
# drvIndexGet
# .tE
#
# PARAMETERS:
# .IP currentProdIndex
# the current product index being selected or deselected
#
# RETURNS: Returns the index of the driverObjects product if the index of the
#          driverObjec is same as that of the current selected product
#          else returns -1
#
# ERRORS: N/A
#
proc drvIndexGet {currProdIndex} {
    global setupVals

    if {$setupVals(drvIndex) == -1} {
        return -1
    }

    foreach drvObj $setupVals(drvIndex) {
        set index [lindex $drvObj 0]
        if {$index == $currProdIndex} {
            return $index
        }
    }
    return -1
}

#############################################################################
#
# drvArchGet - return the driverObjects/Header product arch if it exists
#               on the CD.
#
# This procedure will return the driverObjects/Header product arch if it exists
# on the CD.
#
# SYNOPSIS
# .tS
# drvArchGet
# .tE
#
# PARAMETERS:
# .IP currentProdIndex
# the current product index being selected or deselected
#
# RETURNS: Returns the arch of the driverObjects product if the index of the
#          driverObjec is same as that of the current selected product
#          else returns -1
#
# ERRORS: N/A
#

proc drvArchGet {currProdIndex} {
    global setupVals

    if {$setupVals(drvIndex) == -1} {
        return -1
    }

    foreach drvObj $setupVals(drvIndex) {
        set index [lindex $drvObj 0]
        if {$index == $currProdIndex} {
            return [lindex $drvObj 1]
        }
    }
    return -1
}

#############################################################################
#
# prodHostTypeGet - proc to return a host type string
#
# SYNOPSIS
# .tS
# prodHostTypeGet
# .tE
#
# PARAMETERS: N/A
#
# RETURNS: the hos type (a string) if it exists, else "unknown"
#
# ERRORS: N/A
#
proc prodHostTypeGet {desc} {

    set descLen [string length $desc]
    set index [string first ":" $desc]
    set host [string range $desc [expr $index + 1] $descLen]
    set index [string first " x " $host]
    set host [string trim [string range $host 0 [expr $index - 1]]]

    switch -glob $host {
        solaris {set prodHostType sun4-solaris2}
        x86-win?? {set prodHostType x86-win32}
        Windows?? {set prodHostType x86-win32}
        hp9700 {set prodHostType parisc-hpux10}
        default {set prodHostType unknown}
    }

     # look for host specfic string in the description
 
     if {"$prodHostType" == "unknown" } {
         switch -glob $desc {
            *solaris*    {set prodHostType sun4-solaris2}
            *x86-win*    {set prodHostType x86-win32}
            *hp9700*     {set prodHostType parisc-hpux10}
            *simsolaris* {set prodHostType sun4-solaris2}
            *simnt*      {set prodHostType x86-win32}
            *simhppa*    {set prodHostType parisc-hpux10}
            *SIMHPPA*    {set prodHostType parisc-hpux10}
         }
     }

    return $prodHostType
}

#############################################################################
#
# onClickProdCheckList - callback procedure invoked when product is checked
#                        on compSelect page
#
# This procedure is a callback procedure invoked when product is checked
# on compSelect page
#
# SYNOPSIS
# .tS
# onClickProdCheckList
# .tE
#
# PARAMETERS: N/A
#
# RETURNS: N/A
#
# ERRORS: N/A
#

proc onClickProdCheckList {} {
    global ctrlVals
    global setupVals

    currSelProdIndexSet [controlSelectionGet $ctrlVals(mainWindow).optionList]
    set hasSubPart [detailShow]
    set currProdIndex [currSelProdIndexGet]

    if {[lindex [controlEventGet $ctrlVals(mainWindow).optionList] 0] == \
        "chkchange"} {
        set newState [lindex \
                [controlItemPropertyGet $ctrlVals(mainWindow).optionList \
                -checkstate] [currSelProdIndexGet gui]]

        # determine if customer is trying to uncheck a driverObject/Header prod

        set drvIndex [drvIndexGet $currProdIndex]
        set drvArch [drvArchGet $currProdIndex]
        set drvObjRestored 0

        if {[info exists setupVals(tornadoIndex)] && $drvIndex != -1} {
            foreach torObj $setupVals(tornadoIndex) {
                set tornadoSelected  [isTornadoSelected [lindex $torObj 0]]
                if {$tornadoSelected && [lindex $torObj 1] == $drvArch} {
                    set savedProdIndex -1
                    messageBox [strTableGet 5010_DRIVERS_INFO] -informationicon
                    set index [guiMapCtrlIndexGet $drvIndex]
                    controlItemPropertySet $ctrlVals(mainWindow).optionList \
                        -index $index -checkstate 1
                    set drvObjRestored 1
                    break
                }
            }
        }

        # warn user about non-native installations

        set desc [productInfoGet desc $currProdIndex]
        set hostType [windHostTypeGet]
        set prodHostType [prodHostTypeGet $desc]
        if {![productInfoGet instFlag $currProdIndex]} {
            if {$hostType != $prodHostType && $prodHostType != "unknown"} {
                set msg "The product, $desc, is not meant for installation on \
                        this host type of $hostType.\nContinuing with the \
                        installation may lead to an incomplete installation \
                        due to missing host tools."
                dialog ok "SETUP" $msg
            }
        }

        # commit the user's selection

        if {!$drvObjRestored} {
            set savedProdIndex $currProdIndex
            productInfoSet instFlag $currProdIndex $newState
            if {$newState && $hasSubPart} {
                productGuiChkLstUpdate [currSelProdIndexGet gui]
            }

            productGuiSizeUpdate $newState
            productInfoSet stateCommit $currProdIndex
            productInfoSet childStateCommit $currProdIndex
        }

        # check if product just selected is tornado-obj, if so we must
        # re-select the driver object products

        set drvObjRestored 0
        if {[info exists setupVals(tornadoIndex)]} {
            foreach torObj $setupVals(tornadoIndex) {

⌨️ 快捷键说明

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