# HTML.GUI -- Test HTML widget. reset-server appInitialize html HTML { *objects:\ toplevel Layout helpLayout \ helpLayout Layout helpMenuLayout \ helpLayout Layout helpInfoLayout \ \ helpMenuLayout Command helpBack \ helpMenuLayout Command helpForward \ helpMenuLayout Command helpHome \ helpMenuLayout Command helpClose \ \ helpLayout Frame helpTextFrame\ helpTextFrame HTML helpText \ \ helpInfoLayout Label helpIRAFLogo \ helpInfoLayout Label helpInfo1 \ helpInfoLayout Label helpInfo2 \ helpInfoLayout Label helpInfo3 \ helpInfoLayout Label helpNOAOLogo *helpLayout*borderWidth: 0 *helpLayout.background: gray *helpLayout*Frame*frameType: sunken *helpLayout*Frame*frameWidth: 2 *helpLayout*Frame.background: gray *helpLayout*Layout.background: gray *helpLayout.layout: vertical { \ -1 \ horizontal { \ 0 < +0 -0 > \ helpMenuLayout < +inf -inf * > \ 0 < +0 -0 > \ } \ 0 < +0 -0 > \ horizontal { \ 0 < +0 -0 > \ helpTextFrame < +inf -inf * +inf -inf > \ 0 \ } \ 0 < +0 -0 > \ horizontal { \ 0 < +0 -0 > \ helpInfoLayout < +inf -inf * > \ 0 < +0 -0 > \ } \ -1 \ } *helptext*background: white *helptext*foreground: black *helpMenuLayout*background: gray *helpMenuLayout*Command.highlightThickness: 2 *helpMenuLayout*Command.internalHeight: 2 *helpMenuLayout*Command.font: -*-helvetica-bold-r-normal-*-12-*-*-* *helpMenuLayout.layout: vertical { \ 5 \ horizontal { \ 5 < +0 -5 > \ helpBack \ 2 < +0 -2 > \ helpForward \ 2 < +0 -2 > \ helpHome \ 2 < +inf -2 > \ helpClose \ 5 < +0 -5 > \ } \ 5 \ } *helpBack.label: Back *helpBack.sensitive: False *helpForward.label: Forward *helpForward.sensitive: False *helpHome.label: Home *helpClose.label: Close *helpInfoLayout*background: gray *helpInfoLayout*Label.justify: center *helpInfoLayout*Label.internalHeight: 0 *helpInfoLayout.layout: horizontal { \ 2 < +0 -2 > \ vertical { \ 5 \ helpIRAFLogo \ 5 \ } \ 1 < +0 -1 > \ vertical { \ 5 \ horizontal { \ 0 < +inf -inf > \ helpInfo1 \ 0 < +inf -inf > \ } \ 0 < +inf -0 > \ horizontal { \ 0 < +inf -inf > \ helpInfo2 \ 0 < +inf -inf > \ } \ 0 < +inf -inf > \ horizontal { \ 0 < +inf -inf > \ helpInfo3 \ 0 < +inf -inf > \ } \ 5 \ } \ 1 < +0 -1 > \ vertical { \ 5 \ helpNOAOLogo \ 5 \ } \ 2 < +0 -2 > \ } *helpInfo1.label: XImtool V1.0 -- Released: 11/4/96 *helpInfo2.label: iraf@noao.edu (520) 318-4160 *helpInfo3.label: NOAO is operated by AURA under cooperative agreement with the NSF *helpInfoLayout*helpInfo1.font: -*-helvetica-medium-r-normal-*-12-*-*-* *helpInfoLayout*helpInfo2.font: -*-helvetica-medium-r-normal-*-12-*-*-* *helpInfoLayout*helpInfo3.font: -*-helvetica-medium-r-normal-*-10-*-*-* *helpInfoLayout.helpIRAFLogo.internalWidth: 0 *helpInfoLayout.helpIRAFLogo.internalheight: 0 *helpInfoLayout.helpIRAFLogo.foreground: steelblue *helpInfoLayout.helpIRAFLogo.background: white *helpInfoLayout.helpNOAOLogo.internalWidth: 0 *helpInfoLayout.helpNOAOLogo.internalheight: 0 *helpInfoLayout.helpNOAOLogo.foreground: steelblue *helpInfoLayout.helpNOAOLogo.background: white *helpText.width: 450 *helpText.height: 500 *helpText.anchorUnderlines: 1 *helpText.visitedAnchorUnderlines: 1 *helpText.verticalScrollOnRight: true *helpText.plainFont: 6x13 } createObjects proc quit args { send client gkey q; deactivate unmap } send helpClose addCallback quit activate # Get list of viewable files in the current directory. proc loadFile {filename} { set fd [open $filename]; set text [read $fd]; close $fd if {[file extension $filename] == ".html"} { send helpText setText $text } else { send helpText setText "$text" } send helpText retestAnchors } # Load initial file. loadFile [lindex [glob *.html] 0] # Help Panel Bitmaps #------------------- createBitmap iraf_logo 45 45 { 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x80, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x80, 0xfc, 0xff, 0xff, 0xff, 0x3f, 0x84, 0xf8, 0xff, 0xff, 0xff, 0x1f, 0x84, 0xf4, 0xff, 0xff, 0xff, 0x1b, 0x04, 0x09, 0x00, 0xfc, 0xff, 0x11, 0x04, 0x11, 0xf8, 0xff, 0x7f, 0x10, 0x04, 0x21, 0xc0, 0xff, 0x1f, 0x10, 0x04, 0x41, 0xf0, 0xff, 0x00, 0x18, 0x04, 0x01, 0xe0, 0xff, 0x00, 0x18, 0x00, 0x81, 0xc0, 0xff, 0x00, 0x08, 0x00, 0x01, 0xe0, 0xff, 0x07, 0x08, 0x00, 0x01, 0xf1, 0xff, 0x1f, 0x08, 0x80, 0x21, 0xf0, 0xff, 0xff, 0x08, 0xc0, 0x41, 0xf4, 0xff, 0xff, 0x08, 0xc0, 0x41, 0xf8, 0xff, 0xff, 0x09, 0xc0, 0xc1, 0xf0, 0xff, 0xff, 0x0b, 0x80, 0xc1, 0xf1, 0xff, 0xff, 0x07, 0x80, 0x81, 0xe1, 0xff, 0xff, 0x07, 0x80, 0x01, 0xc1, 0xff, 0xff, 0x07, 0x00, 0x01, 0xc0, 0xff, 0xff, 0x07, 0xc2, 0x05, 0x81, 0xff, 0xff, 0x07, 0xf2, 0x07, 0x81, 0xff, 0xff, 0x07, 0xf2, 0x17, 0x03, 0xff, 0xff, 0x03, 0xfa, 0x7f, 0x02, 0xfe, 0xff, 0x03, 0xfe, 0xff, 0x02, 0xfe, 0xff, 0x03, 0xfe, 0xff, 0x03, 0xfc, 0xff, 0x03, 0xff, 0xff, 0x07, 0xfc, 0xff, 0x83, 0xff, 0xff, 0x0f, 0xf8, 0xff, 0xc1, 0xff, 0xff, 0x3f, 0xf0, 0xff, 0xe1, 0xff, 0xff, 0x7f, 0xf8, 0xff, 0xf1, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xe0, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xe7, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xef}; send helpIRAFLogo "set bitmap iraf_logo" createBitmap noao_logo 45 45 { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, 0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, 0xff, 0x3f, 0x00, 0xe0, 0xff, 0xff, 0xff, 0x3f, 0x00, 0xe0, 0xff, 0xff, 0xff, 0x1f, 0x00, 0xc0, 0xff, 0xff, 0xff, 0x1f, 0x00, 0xc0, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x80, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x80, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x03, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x01, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x01, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0x00, 0x00, 0x00, 0xf8, 0xff, 0x7f, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x3f, 0x00, 0x00, 0x00, 0xe0, 0xff}; send helpNOAOLogo "set bitmap noao_logo" # Stuff for keeping track of visited anchors. set links { 0 } set linkIndex 0 set visited(0) empty proc anchorSelected {widget cbtype event text href args} { global visited links linkIndex set anchID [send helpText anchorToId $href] set visited($href) 1 if {$linkIndex == 0} { send helpBack set sensitive True if {[lindex $links 1] != $anchID} { set links { 0 } send helpForward set sensitive False } } if {$linkIndex > 0 && [lindex $links [expr $linkIndex + 1]] != $anchID} { set links [lrange $links 0 $linkIndex] } if {[lindex $links [expr $linkIndex + 1]] != $anchID} { lappend links $anchID incr linkIndex } else { send helpForward set sensitive False incr linkIndex } if {$linkIndex == [expr [llength $links] - 1]} { send helpForward set sensitive False } send helpText gotoId $anchID send helpText retestAnchors }; send helpText addCallback anchorSelected anchor proc testAnchor {widget cbtype href} { global visited return [info exists visited($href)] }; send helpText addCallback testAnchor testAnchor # Callbacks to position forwards and backwards in link list. proc hlpForward args { global links linkIndex incr linkIndex if {$linkIndex <= [llength $links]} { set anchID [lindex $links $linkIndex] send helpText gotoId $anchID send helpText retestAnchors if {$linkIndex == [expr [llength $links] - 1]} { send helpForward set sensitive False send helpBack set sensitive True } else { send helpBack set sensitive True } } else { incr linkIndex -1 } }; send helpForward addCallback hlpForward proc hlpBack args { global links linkIndex incr linkIndex -1 if {$linkIndex >= 0} { set anchID [lindex $links $linkIndex] send helpText gotoId $anchID send helpText retestAnchors if {$linkIndex == 0} { send helpBack set sensitive False } if {$linkIndex >= 0} { send helpForward set sensitive True } } else { incr linkIndex 1 } }; send helpBack addCallback hlpBack proc hlpHome args { global links linkIndex set links { 0 } set linkIndex 0 send helpText gotoId 0 send helpForward set sensitive False send helpBack set sensitive False send helpText retestAnchors }; send helpHome addCallback hlpHome