;;; -*- Package: ALTER-USER; Mode: SCHEME; Base: 10; Syntax: Scheme; -*-
(in-package "ALTER-USER")
;;; -------------------------------------------------------------------
;;; --- File:           invent.sty
;;; --- Created:        [jmaloney:19950822.1530CST]
;;; --- Last Update:    
;;; --- System:         DoME 4.01
;;; ---
;;; --- This Alter module provides the definitions for a stylesheet
;;; --- that provides instructions to a formatter on how to format
;;; --- an instance of the invent DTD.
;;; -------------------------------------------------------------------

;;; -------------------------------------------------------------------
;;; the name of the operation can be anything
;;; but be careful not to redefine a pre-existing operation that
;;; you use in this stylesheet or elsewhere
;;; -------------------------------------------------------------------
(find-operation style-op)

;;; -------------------------------------------------------------------
;;; implementation for each of the ELEMENT types in the DTD
;;; -------------------------------------------------------------------
(add-method (style-op (invent-invent) self f)
   (let ( (cf (current-font f))
	  (cs (current-style f)) )
        (set-family! cf "Courier")           ; Courier font family
	(set-sp-before! cs (pt 12))          ; 12 point space before new para's
	(process-children f style-op self) ) )

(add-method (style-op (invent-title) self f)
   (set-size! (current-font f) (pt 14))      ; larger font
   (set-bold! (current-font f) #t)           ; bold-face type
   (set-sp-after! (current-style f) (pt 12)) ; 12 pt space after para
   (set-underline! (current-font f) #t)      ; underlined
   (start-para f)                            ; new para for title
   (put-string f (contents self)) )

(add-method (style-op (invent-entry) self f)
   (start-para f)                            ; new para for entry
   (process-children f style-op self) )

(add-method (style-op (invent-name) self f)
   (put-string f (contents self)) )

(add-method (style-op (invent-type) self f)
   (letrec ( (cf (current-font f)) 
	     (cfi (italic cf)) )
	   (put-string f " (")
	   (if (not cfi) (set-italic! cf #t))
	   (put-string f (contents self))  ; print type in italics
	   (if (not cfi) (set-italic! cf #f))
	   (put-string f ")") ) )

(add-method (style-op (invent-prop) self f)
   (let ( (cs (current-style f)) )
        (set-sp-before! cs (pt 2))
	(set-sp-after! cs (pt 0))
	(set-sindent! cs (in (/ 1 4)))
	(start-para f)
	(process-children f style-op self) ) )

(add-method (style-op (invent-propname) self f)
   (set-bold! (current-font f) #t)          ; print propname in bold-face
   (put-string f (contents self))
   (put-string f ": ") )

(add-method (style-op (invent-propval) self f)
   (put-string f (contents self)) )

style-op          ; stylesheet operation
