home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Westmount Technology 1994
- #
- # File: @(#)helpindex.tcl 1.4
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)helpindex.tcl 1.4 29 Jun 1995 Copyright 1994 Westmount Technology
-
- # Start user added include file section
- # End user added include file section
-
- require "searchgrou.tcl"
-
- Class HelpIndex : {SearchGroup} {
- constructor
- method destructor
- method load
- method gotoSelected
- attribute urlDict
- attribute tool
- }
-
- constructor HelpIndex {class this name} {
- set this [SearchGroup::constructor $class $this $name]
- # Start constructor user section
-
- $this activated {%this gotoSelected}
-
- # End constructor user section
- return $this
- }
-
- method HelpIndex::destructor {this} {
- # Start destructor user section
- # End destructor user section
- $this SearchGroup::destructor
- }
-
- method HelpIndex::load {this index} {
- set fp [open $index]
- $this urlDict [Dictionary new]
- set dict [$this urlDict]
- set contents ""
- while {[gets $fp line] >= 0} {
- if {[regexp {^#} $line]} {
- continue
- }
- if {![regexp {([^|][^|]*)\|([^|][^|]*)} $line dummy idx url]} {
- error "illegal formatted index line '$line'"
- }
- set idx [string trimright $idx]
- set url [string trim $url]
- lappend contents $idx
- $dict set $idx $url
- }
- close $fp
- $this entrySet $contents
- }
-
- method HelpIndex::gotoSelected {this} {
- set selected [$this selected]
- if {$selected == ""} {
- return
- }
- set ref [[$this urlDict] set $selected]
- if {[string range $ref 0 0] != "/"} {
- set ref [[$this tool] root]/$ref
- }
- [$this tool] gotoURL $ref
- }
-
- # Do not delete this line -- regeneration end marker
-
-