home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Westmount Technology 1994
- #
- # File: @(#)helptoc.tcl 1.3
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)helptoc.tcl 1.3 13 Apr 1995 Copyright 1994 Westmount Technology
-
- # Start user added include file section
-
- require helptocnod.tcl
-
- # End user added include file section
-
-
- Class HelpToc : {BrowsTree} {
- constructor
- method destructor
- method load
- attribute tool
- }
-
- global HelpToc::index
- set HelpToc::index 0
-
-
- constructor HelpToc {class this name} {
- set this [BrowsTree::constructor $class $this $name]
- # Start constructor user section
-
- $this rowCount 12
-
- # End constructor user section
- return $this
- }
-
- method HelpToc::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method HelpToc::load {this toc} {
- # Clean up old nodes
- foreach node [$this rootSet] {
- $node delete
- }
- # make new tree
- global HelpToc::index
- set fp [open $toc]
- set l [List new]
- set nodes [List new]
- set index -1
- while {[gets $fp line] >= 0} {
- if {[string range $line 0 0] == "#"} {
- continue
- }
- set chr {[^|][^|]*}
- set exp "($chr)\\|($chr)\\|($chr)"
- if {![regexp $exp $line dummy level title ref]} {
- puts stderr "Illegale formatted line '$line'"
- continue
- }
- set level [string trim $level]
- set title [string trim $title]
- set ref [string trim $ref]
- incr HelpToc::index
- set level [expr {[lindex $level 0] - 1}]
- set node [HelpTocNode new $this.${HelpToc::index} \
- -label $title \
- -reference $ref]
- $nodes append $node
- if {$level > 0} {
- set parent [$l index [expr {$level - 1}]]
- $parent hasChildren 1
- $node parent $parent
- }
- if {$level > $index} {
- $l append $node
- incr index
- } else {
- $l index $level $node
- }
- }
- close $fp
- # set icons
- $nodes foreach node {
- if [$node hasChildren] {
- $node icon sysv_16
- } else {
- $node icon docv_16
- }
- }
- }
-
- # Do not delete this line -- regeneration end marker
-
-