home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / lisp / stk-3.002 / stk-3 / STk-3.1 / Lib / help.stk < prev    next >
Encoding:
Text File  |  1996-07-23  |  2.0 KB  |  57 lines

  1. ;;;;
  2. ;;;; Help management
  3. ;;;;
  4. ;;;; Copyright ⌐ 1993-1996 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
  5. ;;;; 
  6. ;;;; Permission to use, copy, and/or distribute this software and its
  7. ;;;; documentation for any purpose and without fee is hereby granted, provided
  8. ;;;; that both the above copyright notice and this permission notice appear in
  9. ;;;; all copies and derived works.  Fees for distribution or use of this
  10. ;;;; software or derived works may only be charged with express written
  11. ;;;; permission of the copyright holder.  
  12. ;;;; This software is provided ``as is'' without express or implied warranty.
  13. ;;;;
  14. ;;;;           Author: Erick Gallesio [eg@unice.fr]
  15. ;;;;    Creation date: 14-Sep-1993 13:30
  16. ;;;; Last file update: 23-Jul-1996 17:14
  17. ;;;;
  18.  
  19. (require "html")
  20.  
  21. (define (STk:show-help-file name)
  22.   (catch (destroy '.stk-help))
  23.   (toplevel '.stk-help)
  24.   (wm 'title .stk-help "STk help")
  25.  
  26.   ;; Scroll text widget
  27.   (pack (frame '.stk-help.f) 
  28.     :expand #t :fill "both" :side "top")
  29.   (pack (text '.stk-help.f.t :font "fixed" :width 90 :height 25
  30.           :yscroll (lambda args (apply .stk-help.f.s 'set args)))
  31.     :expand #t :fill "both" :side "left")
  32.   (pack (scrollbar '.stk-help.f.s :orient "vertical"
  33.            :command (lambda args (apply  .stk-help.f.t 'yview args)))
  34.     :expand #f :fill "y" :side "left")
  35.   ;; Quit button
  36.   (pack (button '.stk-help.b :text "Quit" :command (lambda () (destroy .stk-help)))
  37.     :expand #f :fill "x" :side "bottom")
  38.   
  39.   ;; Show the file (after having found the Help directory)
  40.   (let loop ((l *help-path*))
  41.     (if (null? l)
  42.     (error "Cannot find help file ~S" name)
  43.     (let* ((f  (string-append (car l) "/../Help/" name))
  44.            (fd (open-file f "r")))
  45.       (if fd
  46.           (begin
  47.         (html:set-base-directory! (string-append (car l) "/../Help"))
  48.         (html:view .stk-help.f.t fd)
  49.         (close-port fd))
  50.           (loop (cdr l)))))))
  51.  
  52. (define (help . arg)
  53.   (if (null? arg)
  54.       (STk:show-help-file "STk-hlp.html")
  55.       (STk:show-help-file (format #f "~A.n.html" (car arg)))))
  56.   
  57. (provide "help")