home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / TCL / BLT / BLT1.7L1 / BLT1 / blt-1.7 / applications / kosherdill / scripts / hyperhelp.tcl next >
Encoding:
Text File  |  1994-01-04  |  19.2 KB  |  565 lines

  1. #
  2. # Hyperhelp
  3. # ----------------------------------------------------------------------
  4. # Utility calls to implement a hypertext help function
  5. #
  6. #   AUTHOR:  Michael J. McLennan       Phone: (215)770-2842
  7. #            AT&T Bell Laboratories   E-mail: michael.mclennan@att.com
  8. #
  9. #      RCS:  hyperhelp.tcl,v 1.2 1994/01/04 16:09:39 mmc Exp
  10. # ----------------------------------------------------------------------
  11. #                 Copyright (c) 1993  AT&T Bell Laboratories
  12. # ======================================================================
  13. # Permission to use, copy, modify, and distribute this software and its
  14. # documentation for any purpose and without fee is hereby granted,
  15. # provided that the above copyright notice appear in all copies and that
  16. # both that the copyright notice and warranty disclaimer appear in
  17. # supporting documentation, and that the names of AT&T Bell Laboratories
  18. # any of their entities not be used in advertising or publicity
  19. # pertaining to distribution of the software without specific, written
  20. # prior permission.
  21. #
  22. # AT&T disclaims all warranties with regard to this software, including
  23. # all implied warranties of merchantability and fitness.  In no event
  24. # shall AT&T be liable for any special, indirect or consequential
  25. # damages or any damages whatsoever resulting from loss of use, data or
  26. # profits, whether in an action of contract, negligence or other
  27. # tortuous action, arising out of or in connection with the use or
  28. # performance of this software.
  29. # ======================================================================
  30. #
  31. # USAGE:
  32. #   Each application must register its intent to use HyperHelp by
  33. #   invoking "hyperhelp_init" near the start of the application:
  34. #
  35. #     hyperhelp_init <application-name>
  36. #
  37. #   Thereafter, help files are displayed using one of the following
  38. #   calls:
  39. #
  40. #     hyperhelp_file <file> [ <line> ]  <== call to display info in file
  41. #     hyperhelp_mesg <mesg> [ <line> ]  <== call to display string info
  42. #
  43. # HYPERLINKS:
  44. #   To handle hypertext jumping between help files, edit the help
  45. #   files and embed commands of the form:
  46. #
  47. #      %% hyperhelp_link <label> <jumpFile> [<jumpMarker>] %%
  48. #
  49. #   For example:
  50. #
  51. #      Pop-up menus can be implemented using the %%
  52. #        hyperhelp_link "menu" Doc/Menu/Overview
  53. #      %% command.
  54. #      Given a few basic arguments, this command will
  55. #      create a pop-up menu that can be attached to a
  56. #      button using the %%
  57. #        hyperhelp_link "menubutton" Doc/Menu/Menubuttons MenuIntro
  58. #      %% command.
  59. #
  60. #   The optional parameter <jumpMarker> is a string refering to a
  61. #   marker declared within the <jumpFile>.  For example, the file
  62. #   "Doc/Menu/Menubuttons" might look like this:
  63. #
  64. #      blah blah blah...
  65. #      .
  66. #      .
  67. #      %% hyperhelp_mark MenuIntro %%
  68. #      INTRODUCTION TO MENUS
  69. #        Menus are really quite simple when you get the
  70. #        hang of them.  Consider the example below...
  71. #
  72. # ----------------------------------------------------------------------
  73.  
  74. # ----------------------------------------------------------------------
  75. #  X-DEFAULTS
  76. # ----------------------------------------------------------------------
  77. set class [winfo class .]
  78. option add $class*hyperhelp.view.file.height \
  79.     4i startupFile
  80. option add $class*hyperhelp.view.file*Font \
  81.     -*-lucidatypewriter-bold-r-normal-*-*-120-*-*-*-*-*-* startupFile
  82. option add $class*hyperhelp.view.file.cursor \
  83.     dot startupFile
  84. option add $class*hyperhelp.view.file*Button*Pad \
  85.     0 startupFile
  86.  
  87. option add $class*hyperhelp*topics*Button.relief \
  88.     flat startupFile
  89.  
  90. if {[winfo screenvisual .] == "staticgray"} {
  91.     option add $class*hyperhelp.view.file*Button*foreground \
  92.         white startupFile
  93.     option add $class*hyperhelp.view.file*Button*background \
  94.         black startupFile
  95.     option add $class*hyperhelp.view.file*Button*activeForeground \
  96.         black startupFile
  97.     option add $class*hyperhelp.view.file*Button*activeBackground \
  98.         white startupFile
  99.     option add $class*hyperhelp.view.file.background \
  100.         white startupFile
  101. } else {
  102.     option add $class*hyperhelp.view.file*Button*foreground \
  103.         white startupFile
  104.     option add $class*hyperhelp.view.file*Button*background \
  105.         maroon startupFile
  106.     option add $class*hyperhelp.view.file*Button*activeForeground \
  107.         white startupFile
  108.     option add $class*hyperhelp.view.file*Button*activeBackground \
  109.         red startupFile
  110.     option add $class*hyperhelp.view.file.background \
  111.         white startupFile
  112. }
  113.  
  114. bind Blt_htext <ButtonPress-2> {%W scan mark 0 %y}
  115. bind Blt_htext <B2-Motion> {%W scan dragto 0 %y}
  116.  
  117. # ----------------------------------------------------------------------
  118. #  BITMAPS
  119. # ----------------------------------------------------------------------
  120. blt_bitmap define hyperhelp-logo { {31 31} {
  121.    0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
  122.    0x00, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xe7, 0xf3, 0x03,
  123.    0x00, 0xf8, 0x0f, 0x00, 0xf0, 0xfd, 0xdf, 0x07, 0x00, 0xfe, 0x3f, 0x00,
  124.    0x78, 0xff, 0x7f, 0x0f, 0x00, 0x3f, 0x7e, 0x00, 0x7c, 0xdf, 0x7d, 0x1f,
  125.    0x00, 0x1f, 0x7c, 0x00, 0x7e, 0xdf, 0x7d, 0x3f, 0x00, 0x00, 0x7e, 0x00,
  126.    0xfe, 0x3f, 0xbf, 0x3f, 0x00, 0x80, 0x1f, 0x00, 0xfe, 0xdf, 0xef, 0x3f,
  127.    0x00, 0xe0, 0x07, 0x00, 0xfc, 0xef, 0xf7, 0x1f, 0x00, 0xe0, 0x07, 0x00,
  128.    0xf8, 0xef, 0xf7, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xef, 0xf7, 0x07,
  129.    0x00, 0xe0, 0x07, 0x00, 0xe0, 0xef, 0xf7, 0x03, 0x00, 0x00, 0x00, 0x00,
  130.    0x00, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00,
  131.    0x00, 0x00, 0x00, 0x00
  132. } }
  133.  
  134. blt_bitmap define hyperhelp-fullpage { {15 15} {
  135.    0x00, 0x00, 0xff, 0x0f, 0x01, 0x08, 0x7d, 0x09, 0x01, 0x08, 0xed, 0x59,
  136.    0x01, 0x28, 0xbd, 0x5b, 0x01, 0x28, 0x7d, 0x5b, 0x01, 0x08, 0xbd, 0x09,
  137.    0x01, 0x08, 0xff, 0x0f, 0x00, 0x00
  138. } }
  139.  
  140. blt_bitmap define hyperhelp-emptypage { {15 15} {
  141.    0x00, 0x00, 0xff, 0x0f, 0x01, 0x08, 0x01, 0x08, 0x01, 0x08, 0x01, 0x58,
  142.    0x01, 0x28, 0x01, 0x58, 0x01, 0x28, 0x01, 0x58, 0x01, 0x08, 0x01, 0x08,
  143.    0x01, 0x08, 0xff, 0x0f, 0x00, 0x00
  144. } }
  145.  
  146. # ----------------------------------------------------------------------
  147. #  USAGE: hyperhelp_init <application-name> <help-dir>
  148. #
  149. #  Creates the HyperHelp display window and initializes HyperHelp
  150. #  variables.  Should be invoked at the start of each application
  151. #  to set up for HyperHelp support.
  152. # ----------------------------------------------------------------------
  153. proc hyperhelp_init {appName helpdir} {
  154.     if {[file readable $helpdir] && [file isdirectory $helpdir]} {
  155.         hyperhelp_path $helpdir
  156.     } else {
  157.         error "invalid help directory: $helpdir"
  158.     }
  159.  
  160.     toplevel .hyperhelp
  161.     frame .hyperhelp.panel
  162.     label .hyperhelp.panel.icon -bitmap hyperhelp-logo -padx 3 -pady 3
  163.     pack .hyperhelp.panel.icon -side left -padx 4 -pady 4
  164.  
  165.     label .hyperhelp.panel.label -text "HyperHelp Topics: "
  166.     pack .hyperhelp.panel.label -side left
  167.     frame .hyperhelp.panel.topics
  168.     pack .hyperhelp.panel.topics -side left -expand yes -fill x
  169.  
  170.     frame .hyperhelp.cntl -borderwidth 1 -relief raised
  171.     button .hyperhelp.cntl.back -text " Go Back " \
  172.         -command "hyperhelp_discard"
  173.     frame .hyperhelp.cntl.d -borderwidth 2 -relief sunken
  174.     button .hyperhelp.cntl.d.done -text " Dismiss " \
  175.         -command "hyperhelp_close"
  176.     pack .hyperhelp.cntl.d.done -side top -padx 4 -pady 4
  177.  
  178.     blt_table .hyperhelp.cntl \
  179.         .hyperhelp.cntl.back 0,0 -anchor c -padx 8 -pady 8 \
  180.         .hyperhelp.cntl.d 0,1 -anchor c -padx 8 -pady 8
  181.  
  182.     bind .hyperhelp <Key-Return> {
  183.         .hyperhelp.cntl.d.done flash
  184.         .hyperhelp.cntl.d.done invoke
  185.     }
  186.  
  187.     frame .hyperhelp.view -borderwidth 2 -relief sunken
  188.     scrollbar .hyperhelp.view.sbar -command ".hyperhelp.view.file yview" \
  189.         -orient vertical
  190.     blt_htext .hyperhelp.view.file -yscrollcommand ".hyperhelp.view.sbar set"
  191.     pack .hyperhelp.view.sbar -side right -fill y
  192.     pack .hyperhelp.view.file -side top -expand yes -fill both
  193.  
  194.     pack .hyperhelp.panel -side top -fill x
  195.     pack .hyperhelp.view -side top -expand yes -fill both -padx 4 -pady 4
  196.     pack .hyperhelp.cntl -side bottom -fill x
  197.  
  198.     wm title .hyperhelp "$appName: HyperHelp"
  199.     wm withdraw .hyperhelp
  200. }
  201.  
  202. # ----------------------------------------------------------------------
  203. #  USAGE: hyperhelp_file <file> [<jumpMarker>]
  204. #
  205. #  This command loads a file into the list of help information
  206. #  displays.  An optional <jumpMarker> can be specified, causing
  207. #  the help display to jump to that position in the file whenever
  208. #  this bit of help information is displayed.
  209. # ----------------------------------------------------------------------
  210. proc hyperhelp_file {file args} {
  211.     global hhPlace
  212.  
  213.     if {[llength $args] >= 1} {
  214.         set jumpMarker [lindex $args 0]
  215.     } else {
  216.         set jumpMarker null
  217.     }
  218.     hyperhelp_open
  219.     hyperhelp_insert end -file [hyperhelp_find $file] $jumpMarker
  220.     hyperhelp_display [expr $hhPlace+1]
  221. }
  222.  
  223. # ----------------------------------------------------------------------
  224. #  USAGE: hyperhelp_mesg <mesg> [<jumpMarker>]
  225. #
  226. #  This command loads a string message into the list of help
  227. #  information displays.  An optional <jumpMarker> can be specified,
  228. #  causing the help display to jump to that position in the message
  229. #  whenever this bit of help information is displayed.
  230. # ----------------------------------------------------------------------
  231. proc hyperhelp_mesg {mesg args} {
  232.     global hhPlace
  233.  
  234.     if {[llength $args] >= 1} {
  235.         set jumpMarker [lindex $args 0]
  236.     } else {
  237.         set jumpMarker null
  238.     }
  239.  
  240.     hyperhelp_open
  241.     hyperhelp_insert end -text "$mesg" $jumpMarker
  242.     hyperhelp_display [expr $hhPlace+1]
  243. }
  244.  
  245. # ----------------------------------------------------------------------
  246. #  USAGE: hyperhelp_link <label> <jumpFile> [<jumpMarker>]
  247. #
  248. #  Implements a hypertext link to load and display a new file.
  249. #  This command is normally embedded in a help information file,
  250. #  set off by %% delimiters:
  251. #
  252. #     EXAMPLE HELP FILE:
  253. #
  254. #       Pop-up menus can be implemented using the %%
  255. #         hyperhelp_link "menu" Doc/Menu/Overview
  256. #       %% command.
  257. #       Given a few basic arguments, this command will ...
  258. #
  259. #  NOTE:  If the <label> begins with "@" then it is interpreted
  260. #         as the name of a bitmap image.
  261. #
  262. # ----------------------------------------------------------------------
  263. proc hyperhelp_link {label filename args} {
  264.     global blt_htext hhCount
  265.  
  266.     if {$args != ""} {
  267.         set jumpMarker $args
  268.     } else {
  269.         set jumpMarker null
  270.     }
  271.     set jumpFile [hyperhelp_find $filename]
  272.  
  273.     if {$jumpFile == ""} then {
  274.         puts stderr "
  275.   / \\   HyperHelp:  HELP DOCUMENTATION ERROR
  276.  / ! \\  //        TROUBLE:  hyperhelp_link file not found
  277.  -----  //    FILE NEEDED:  $filename
  278.         //  REFERENCED BY:  $blt_htext(file) line $blt_htext(line)
  279. "
  280.     }
  281.  
  282.     if {[string index $label 0] == "@"} {
  283.         button .hyperhelp.view.file.$hhCount -bitmap $label \
  284.             -command "hyperhelp_jump -file $jumpFile $jumpMarker"
  285.     } else {
  286.         button .hyperhelp.view.file.$hhCount -text "$label" \
  287.             -command "hyperhelp_jump -file $jumpFile $jumpMarker"
  288.     }
  289.     .hyperhelp.view.file append .hyperhelp.view.file.$hhCount
  290.  
  291.     incr hhCount
  292. }
  293.  
  294. # ----------------------------------------------------------------------
  295. #  USAGE: hyperhelp_mark <marker>
  296. #
  297. #  This command associates the <marker> string with the current
  298. #  position in a help file.  It is used to define the <jumpMarker>
  299. #  positions referred to by the "hyperhelp_link" command.
  300. # ----------------------------------------------------------------------
  301. proc hyperhelp_mark {marker} {
  302.     global blt_htext hhLinks
  303.  
  304.     set hhLinks($marker) $blt_htext(line)
  305. }
  306.  
  307. # ----------------------------------------------------------------------
  308. #  USAGE: hyperhelp_path <dir-path>
  309. #
  310. #  Sets the search path for help files to the given file path.
  311. #  Help files specified in any "hyperhelp_file" or "hyperhelp_link"
  312. #  command can then be specified relative to any directory in
  313. #  this path, and the proper file name will be automatically
  314. #  expanded.
  315. # ----------------------------------------------------------------------
  316. proc hyperhelp_path {path} {
  317.     global hhPath
  318.  
  319.     if {[info exists hhPath]} {
  320.         set hhPath $hhPath:$path
  321.     } else {
  322.         set hhPath $path
  323.     }
  324. }
  325.  
  326. # ----------------------------------------------------------------------
  327. #  USAGE: hyperhelp_find <file-name>
  328. #
  329. #  Searches for the given file name on the search path specified
  330. #  via "hyperhelp_path".  Returns the proper (expanded) file name,
  331. #  or the original name if the file is not found.
  332. # ----------------------------------------------------------------------
  333. proc hyperhelp_find {fname} {
  334.     global hhPath
  335.  
  336.     foreach dir [split $hhPath :] {
  337.         if {[file readable $dir/$fname]} {
  338.             return "$dir/$fname"
  339.         }
  340.     }
  341.     return $fname
  342. }
  343.  
  344. # ======================================================================
  345. # Internal Commands
  346. # ======================================================================
  347.  
  348. # ----------------------------------------------------------------------
  349. #  USAGE: hyperhelp_open
  350. #
  351. #  Called whenever something is about to be displayed, to make sure
  352. #  that the help window is mapped.
  353. # ----------------------------------------------------------------------
  354. proc hyperhelp_open {} {
  355.     if {![winfo exists .hyperhelp]} {
  356.         error "HyperHelp not properly initialized\n(must invoke hyperhelp_init before using help facilities)"
  357.     }
  358.     if {![winfo ismapped .hyperhelp]} {
  359.         global hhPlace hhCmds hhSources hhMarkers
  360.         set hhPlace -1
  361.         set hhCmds {}
  362.         set hhSources {}
  363.         set hhMarkers {}
  364.     }
  365.     hyperhelp_map .hyperhelp
  366. }
  367.  
  368. # ----------------------------------------------------------------------
  369. #  USAGE: hyperhelp_close
  370. #
  371. #  Causes the help window to disappear.
  372. # ----------------------------------------------------------------------
  373. proc hyperhelp_close {} {
  374.     .hyperhelp.view.file config -text ""
  375.     hyperhelp_unmap .hyperhelp
  376. }
  377.  
  378. # ----------------------------------------------------------------------
  379. #  USAGE: hyperhelp_discard
  380. #
  381. #  Discards the current help topic being displayed.
  382. # ----------------------------------------------------------------------
  383. proc hyperhelp_discard {} {
  384.     global hhPlace hhSources
  385.  
  386.     hyperhelp_delete $hhPlace
  387.  
  388.     if {[llength $hhSources] > 0} then {
  389.         set newPlace $hhPlace
  390.         set hhPlace -1
  391.         hyperhelp_display $newPlace
  392.     } else {
  393.         hyperhelp_close
  394.     }
  395. }
  396.  
  397. # ----------------------------------------------------------------------
  398. #  USAGE: hyperhelp_jump <jumpCmd> <jumpSource> <jumpMarker>
  399. #
  400. #  Loads the given help information and causes it to be the
  401. #  current topic for display.  <jumpCmd> contains the configure
  402. #  key passed to the htext widget (usually "-file" or "-text").
  403. #  <jumpSource> contains the name of the help file or the
  404. #  message to be displayed.  <jumpMarker> indicates the starting
  405. #  position in the message for display.
  406. # ----------------------------------------------------------------------
  407. proc hyperhelp_jump {jumpCmd jumpSource jumpMarker} {
  408.     global hhPlace
  409.  
  410.     hyperhelp_insert $hhPlace $jumpCmd $jumpSource $jumpMarker
  411.     hyperhelp_display [expr $hhPlace+1]
  412. }
  413.  
  414. # ----------------------------------------------------------------------
  415. #  USAGE: hyperhelp_insert <pos> <jumpCmd> <jumpSource> <jumpMarker>
  416. #
  417. #  Inserts the given <jumpCmd>, <jumpSource> and <jumpMarker>
  418. #  information into the global lists keeping track of this help
  419. #  display.  The new elements are inserted *after* the given
  420. #  position <pos> in the list; if <pos> is "end", then new elements
  421. #  are appended at the end of the list.
  422. # ----------------------------------------------------------------------
  423. proc hyperhelp_insert {pos jumpCmd jumpSource jumpMarker} {
  424.     global hhCmds hhSources hhMarkers
  425.  
  426.     if {$pos == "end"} {
  427.         set pos [llength $hhSources]
  428.     }
  429.     set after [expr $pos+1]
  430.  
  431.     set hhCmds    [linsert $hhCmds    $after $jumpCmd]
  432.     set hhSources [linsert $hhSources $after $jumpSource]
  433.     set hhMarkers [linsert $hhMarkers $after $jumpMarker]
  434. }
  435.  
  436. # ----------------------------------------------------------------------
  437. #  USAGE: hyperhelp_delete <pos>
  438. #
  439. #  Deletes the help topic at the given position in the global lists
  440. #  that maintain the state of this help display.
  441. # ----------------------------------------------------------------------
  442. proc hyperhelp_delete {pos} {
  443.     global hhPlace hhCmds hhSources hhMarkers
  444.  
  445.     set hhCmds    [lreplace $hhCmds    $pos $pos]
  446.     set hhSources [lreplace $hhSources $pos $pos]
  447.     set hhMarkers [lreplace $hhMarkers $pos $pos]
  448.  
  449.     if {$hhPlace >= [llength $hhCmds]} then {
  450.         set hhPlace [expr [llength $hhCmds]-1]
  451.     }
  452. }
  453.  
  454. # ----------------------------------------------------------------------
  455. #  USAGE: hyperhelp_display <entry>
  456. #
  457. #  Updates the help display, making the given entry the current
  458. #  topic.
  459. # ----------------------------------------------------------------------
  460. proc hyperhelp_display {entry} {
  461.     global hhPlace hhCmds hhSources hhMarkers hhLinks hhCount
  462.  
  463.     set ypos [.hyperhelp.view.file gotoline]
  464.     if {$ypos >= 0 && $hhPlace != -1} {
  465.         set hhMarkers [lreplace $hhMarkers $hhPlace $hhPlace "@$ypos"]
  466.     }
  467.  
  468.     set hhPlace $entry
  469.  
  470.     set jumpCmd    [lindex $hhCmds $entry]
  471.     set jumpSource [lindex $hhSources $entry]
  472.     set jumpMarker [lindex $hhMarkers $entry]
  473.  
  474.     set hhCount 0
  475.     set hhLinks(null) 1
  476.     .hyperhelp.view.file config $jumpCmd $jumpSource
  477.  
  478.     if {[string match @* $jumpMarker]} {
  479.         scan $jumpMarker "@%d" ypos
  480.         .hyperhelp.view.file gotoline $ypos
  481.     } else {
  482.         if {$jumpMarker != ""} {
  483.             set jumpLine $hhLinks($jumpMarker)
  484.  
  485.             if {$jumpMarker == ""} {
  486.                 puts stderr "
  487.   / \\   HyperHelp:  INTERNAL ERROR
  488.  / ! \\  |
  489.  -----  |        TROUBLE:  hyperhelp_link marker not recognized
  490.   ///   |         MARKER:  $jumpMarker
  491.   ///   | NOT DEFINED IN:  $jumpSource
  492. "
  493.                 set jumpLine 1
  494.             }
  495.         } else {
  496.             set jumpLine 1
  497.         }
  498.         .hyperhelp.view.file gotoline $jumpLine
  499.     }
  500.     hyperhelp_pages
  501. }
  502.  
  503. # ----------------------------------------------------------------------
  504. #  USAGE: hyperhelp_pages
  505. #
  506. #  Updates a picture of the list of available help topics.  This
  507. #  picture is a row of icons representing the help topics.  One
  508. #  icon picture will be drawn differently to represent the current
  509. #  topic in the list.
  510. # ----------------------------------------------------------------------
  511. proc hyperhelp_pages {} {
  512.     global hhPlace hhCmds hhSources hhMarkers
  513.  
  514.     foreach i [winfo children .hyperhelp.panel.topics] {
  515.         destroy $i
  516.     }
  517.     set pages [llength $hhCmds]
  518.     for {set i 0} {$i < $pages} {set i [expr $i+1]} {
  519.         button .hyperhelp.panel.topics.page$i \
  520.             -bitmap hyperhelp-emptypage -padx 0 -pady 0 \
  521.             -command "hyperhelp_display $i"
  522.  
  523.         if {$i == $hhPlace} then {
  524.             .hyperhelp.panel.topics.page$i config \
  525.                 -bitmap hyperhelp-fullpage
  526.         }
  527.         pack .hyperhelp.panel.topics.page$i -side left
  528.     }
  529. }
  530.  
  531. # ----------------------------------------------------------------------
  532. #  USAGE:  hyperhelp_map <win>
  533. #
  534. #  Used instead of "wm deiconify" to map a window.  If the window has
  535. #  already been mapped and has placement information, this is set just
  536. #  before the window is mapped to put the window back in the proper
  537. #  place.  Needed for proper interaction with virtual window managers
  538. #  when windows are in outlying quadrants.
  539. # ----------------------------------------------------------------------
  540. proc hyperhelp_map {win} {
  541.     global hhGeom
  542.  
  543.     if {[info exists hhGeom($win)]} {
  544.         wm geometry $win $hhGeom($win)
  545.     }
  546.     wm deiconify $win
  547.     raise $win
  548.     focus $win
  549. }
  550.  
  551. # ----------------------------------------------------------------------
  552. #  USAGE:  hyperhelp_unmap <win>
  553. #
  554. #  Used instead of "wm withdraw" to unmap a window.  Saves current
  555. #  placement information for the window, for the next call to
  556. #  hyperhelp_map.  Needed for proper interaction with virtual window
  557. #  managers when windows are in outlying quadrants.
  558. # ----------------------------------------------------------------------
  559. proc hyperhelp_unmap {win} {
  560.     global hhGeom
  561.  
  562.     set hhGeom($win) "+[winfo rootx $win]+[winfo rooty $win]"
  563.     wm withdraw $win
  564. }
  565.