;;;;
;;;; Help management
;;;;
;;;; Copyright © 1993-1999 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
;;;; 
;;;; Permission to use, copy, modify, distribute,and license this
;;;; software and its documentation for any purpose is hereby granted,
;;;; provided that existing copyright notices are retained in all
;;;; copies and that this notice is included verbatim in any
;;;; distributions.  No written agreement, license, or royalty fee is
;;;; required for any of the authorized uses.
;;;; This software is provided ``AS IS'' without express or implied
;;;; warranty.
;;;;
;;;;           Author: Erick Gallesio [eg@unice.fr]
;;;;    Creation date: 14-Sep-1993 13:30
;;;; Last file update:  3-Sep-1999 19:52 (eg)
;;;;

(require "www-browser")

(select-module STk)

(define (STk:show-help-file name)
  ;; Show the file (after having found the Help directory)
  (let loop ((l *help-path*))
    (if (null? l)
	(error "Cannot find help file ~S" name)
	(let* ((f  (string-append (car l) "/" name))
	       (fd (open-file f "r")))
	  (catch (close-port fd))
	  (if fd
	      (www:browser :url f)
	      (loop (cdr l)))))))

(define (help . arg)
  (let ((browser (if (null? arg)
		     (STk:show-help-file "STk-hlp.html")
		     (STk:show-help-file (format #f "~A.n.html" (car arg))))))
    (wm 'deiconify (slot-ref browser 'parent))
    #f))

(provide "help")
