home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
custsort.tcl
< prev
next >
Wrap
Text File
|
1996-05-29
|
1KB
|
54 lines
proc sortView {objA objB} {
set labelA [$objA label]
set labelB [$objB label]
if {$labelA > $labelB} {
return 1
} elseif {$labelA < $labelB} {
return -1
} else {
return 0
#return [custSort $objA $objB]
}
}
proc sortObjType {objA objB} {
set labelA [$objA label]
set labelB [$objB label]
if {$labelA > $labelB} {
return 1
} elseif {$labelA < $labelB} {
return -1
} else {
return 0
#return [custSort $objA $objB]
}
}
proc custSort { objA objB} {
set specLevelA [$objA specLevel]
if {$specLevelA == "user"} {
set specLevelA 5
} else {
set specLevelA $icaseLevelInt($specLevelA)
}
set specLevelB [$objB specLevel]
if {$specLevelB == "user"} {
set specLevelB 5
} else {
set specLevelB $icaseLevelInt($specLevelB)
}
if {$specLevelA > $specLevelB} {
return 1
} elseif {$specLevelA < $specLevelB} {
return -1
} else {
set scopeA [$objA scope]
set scopeB [$objB scope]
return [expr {[llength $scopeA] - [llength $scopeB]}]
}
}