comparison lisp/w3/w3-display.el @ 173:8eaf7971accc r20-3b13

Import from CVS: tag r20-3b13
author cvs
date Mon, 13 Aug 2007 09:49:09 +0200
parents 15872534500d
children 3d6bfa290dbd
comparison
equal deleted inserted replaced
172:a38aed19690b 173:8eaf7971accc
1 ;;; w3-display.el --- display engine v99999 1 ;;; w3-display.el --- display engine v99999
2 ;; Author: wmperry 2 ;; Author: wmperry
3 ;; Created: 1997/07/01 15:54:50 3 ;; Created: 1997/07/08 13:58:52
4 ;; Version: 1.192 4 ;; Version: 1.195
5 ;; Keywords: faces, help, hypermedia 5 ;; Keywords: faces, help, hypermedia
6 6
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8 ;;; Copyright (c) 1996 by William M. Perry (wmperry@cs.indiana.edu) 8 ;;; Copyright (c) 1996 by William M. Perry (wmperry@cs.indiana.edu)
9 ;;; Copyright (c) 1996, 1997 Free Software Foundation, Inc. 9 ;;; Copyright (c) 1996, 1997 Free Software Foundation, Inc.
49 (w3-d-s-var-def w3-display-open-element-stack) 49 (w3-d-s-var-def w3-display-open-element-stack)
50 (w3-d-s-var-def w3-display-alignment-stack) 50 (w3-d-s-var-def w3-display-alignment-stack)
51 (w3-d-s-var-def w3-display-list-stack) 51 (w3-d-s-var-def w3-display-list-stack)
52 (w3-d-s-var-def w3-display-form-id) 52 (w3-d-s-var-def w3-display-form-id)
53 (w3-d-s-var-def w3-display-whitespace-stack) 53 (w3-d-s-var-def w3-display-whitespace-stack)
54 (w3-d-s-var-def w3-display-liststyle-stack)
54 (w3-d-s-var-def w3-display-font-family-stack) 55 (w3-d-s-var-def w3-display-font-family-stack)
55 (w3-d-s-var-def w3-display-font-weight-stack) 56 (w3-d-s-var-def w3-display-font-weight-stack)
56 (w3-d-s-var-def w3-display-font-variant-stack) 57 (w3-d-s-var-def w3-display-font-variant-stack)
57 (w3-d-s-var-def w3-display-font-size-stack) 58 (w3-d-s-var-def w3-display-font-size-stack)
58 (w3-d-s-var-def w3-face-color) 59 (w3-d-s-var-def w3-face-color)
314 (setq string (substring string 0 (match-beginning 0)))) 315 (setq string (substring string 0 (match-beginning 0))))
315 string) 316 string)
316 317
317 318
318 (if (not (fboundp 'char-before)) 319 (if (not (fboundp 'char-before))
319 (fset 'char-before 'preceding-char)) 320 (defun char-before (&optional pos)
321 (char-after (1- (or pos (point))))))
320 322
321 (defsubst w3-display-line-break (n) 323 (defsubst w3-display-line-break (n)
322 (if (or 324 (if (or
323 (memq (car w3-display-whitespace-stack) '(pre nowrap)) ; Been told 325 (memq (car w3-display-whitespace-stack) '(pre nowrap)) ; Been told
324 (= w3-last-fill-pos (point)) 326 (= w3-last-fill-pos (point))
486 (add-text-properties 488 (add-text-properties
487 (point) 489 (point)
488 (progn 490 (progn
489 (case (car break-style) 491 (case (car break-style)
490 (list-item 492 (list-item
491 (let ((list-style (w3-get-style-info 'list-style-type node)) 493 (let ((list-style (or (car w3-display-liststyle-stack) 'disc))
492 (list-num (if (car w3-display-list-stack) 494 (list-num (if (car w3-display-list-stack)
493 (incf (car w3-display-list-stack)) 495 (incf (car w3-display-list-stack))
494 1)) 496 1))
495 (margin (1- (car left-margin-stack))) 497 (margin (1- (car left-margin-stack)))
496 (indent (w3-get-style-info 'text-indent node 0))) 498 (indent (w3-get-style-info 'text-indent node 0)))
564 (push 566 (push
565 (w3-get-style-info 'white-space node 567 (w3-get-style-info 'white-space node
566 (car w3-display-whitespace-stack)) 568 (car w3-display-whitespace-stack))
567 w3-display-whitespace-stack) 569 w3-display-whitespace-stack)
568 (push 570 (push
571 (or (w3-get-attribute 'foobarblatz)
572 (w3-get-style-info 'list-style-type node
573 (car w3-display-liststyle-stack)))
574 w3-display-liststyle-stack)
575 (push
569 (or (w3-get-attribute 'align) 576 (or (w3-get-attribute 'align)
570 (w3-get-style-info 'text-align node 577 (w3-get-style-info 'text-align node
571 (car w3-display-alignment-stack))) 578 (car w3-display-alignment-stack)))
572 w3-display-alignment-stack) 579 w3-display-alignment-stack)
573 (and w3-do-incremental-display (w3-pause))) 580 (and w3-do-incremental-display (w3-pause)))
574 ((line list-item) ; Single line break 581 ((line list-item) ; Single line break
575 (w3-display-line-break 0) 582 (w3-display-line-break 0)
576 (w3-display-set-margins) 583 (w3-display-set-margins)
584 (push
585 (or (w3-get-attribute 'foobarblatz)
586 (w3-get-style-info 'list-style-type node
587 (car w3-display-liststyle-stack)))
588 w3-display-liststyle-stack)
577 (push 589 (push
578 (w3-get-style-info 'white-space node 590 (w3-get-style-info 'white-space node
579 (car w3-display-whitespace-stack)) 591 (car w3-display-whitespace-stack))
580 w3-display-whitespace-stack) 592 w3-display-whitespace-stack)
581 (push 593 (push
597 (case (pop break-style) 609 (case (pop break-style)
598 (block ; Full paragraph break 610 (block ; Full paragraph break
599 (w3-display-line-break 1) 611 (w3-display-line-break 1)
600 (w3-display-restore-margins) 612 (w3-display-restore-margins)
601 (pop w3-display-whitespace-stack) 613 (pop w3-display-whitespace-stack)
614 (pop w3-display-liststyle-stack)
602 (pop w3-display-alignment-stack) 615 (pop w3-display-alignment-stack)
603 (and w3-do-incremental-display (w3-pause))) 616 (and w3-do-incremental-display (w3-pause)))
604 ((line list-item) ; Single line break 617 ((line list-item) ; Single line break
605 (w3-display-restore-margins) 618 (w3-display-restore-margins)
606 (w3-display-line-break 0) 619 (w3-display-line-break 0)
607 (pop w3-display-whitespace-stack) 620 (pop w3-display-whitespace-stack)
621 (pop w3-display-liststyle-stack)
608 (pop w3-display-alignment-stack)) 622 (pop w3-display-alignment-stack))
609 (otherwise ; Assume 'inline' rendering as default 623 (otherwise ; Assume 'inline' rendering as default
610 nil)) 624 nil))
611 ) 625 )
612 ) 626 )
1681 plist (plist-put plist 'default default) 1695 plist (plist-put plist 'default default)
1682 plist (plist-put plist 'internal-form-number w3-current-form-number) 1696 plist (plist-put plist 'internal-form-number w3-current-form-number)
1683 plist (plist-put plist 'action w3-display-form-id) 1697 plist (plist-put plist 'action w3-display-form-id)
1684 plist (plist-put plist 'maxlength maxlength)) 1698 plist (plist-put plist 'maxlength maxlength))
1685 plist)) 1699 plist))
1700
1701 (defun w3-resurrect-images ()
1702 )
1686 1703
1687 (defun w3-resurrect-hyperlinks () 1704 (defun w3-resurrect-hyperlinks ()
1688 (let ((st (point-min)) 1705 (let ((st (point-min))
1689 (inhibit-read-only t) 1706 (inhibit-read-only t)
1690 info nd node face) 1707 info nd node face)
2281 (setq w3-current-stylesheet w3-user-stylesheet) 2298 (setq w3-current-stylesheet w3-user-stylesheet)
2282 (while tree 2299 (while tree
2283 (w3-display-node (car tree)) 2300 (w3-display-node (car tree))
2284 (setq tree (cdr tree))) 2301 (setq tree (cdr tree)))
2285 (w3-display-fix-widgets) 2302 (w3-display-fix-widgets)
2286 (w3-resurrect-hyperlinks) 2303 (let ((inhibit-read-only t))
2287 (w3-form-resurrect-widgets)) 2304 (put-text-property (point-min) (point-max) 'read-only t)
2305 (w3-resurrect-images)
2306 (w3-resurrect-hyperlinks)
2307 (w3-form-resurrect-widgets)))
2288 2308
2289 (defun time-display (&optional tree) 2309 (defun time-display (&optional tree)
2290 ;; Return the # of seconds it took to draw 'tree' 2310 ;; Return the # of seconds it took to draw 'tree'
2291 (let ((st (nth 1 (current-time))) 2311 (let ((st (nth 1 (current-time)))
2292 (nd nil)) 2312 (nd nil))