comparison lisp/w3/w3-display.el @ 100:4be1180a9e89 r20-1b2

Import from CVS: tag r20-1b2
author cvs
date Mon, 13 Aug 2007 09:15:11 +0200
parents 0d2f883870bc
children a145efe76779
comparison
equal deleted inserted replaced
99:2d83cbd90d8d 100:4be1180a9e89
1 ;;; w3-display.el --- display engine v99999 1 ;;; w3-display.el --- display engine v99999
2 ;; Author: wmperry 2 ;; Author: wmperry
3 ;; Created: 1997/02/14 17:51:17 3 ;; Created: 1997/02/15 23:38:28
4 ;; Version: 1.127 4 ;; Version: 1.128
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.
454 (defmacro w3-handle-content (node) 454 (defmacro w3-handle-content (node)
455 (` 455 (`
456 (progn 456 (progn
457 (push (cons tag args) w3-display-open-element-stack) 457 (push (cons tag args) w3-display-open-element-stack)
458 (push content content-stack) 458 (push content content-stack)
459 (setq content (nth 2 node))))) 459 (setq content (nth 2 (, node))))))
460 460
461 (defmacro w3-display-handle-list-type () 461 (defmacro w3-display-handle-list-type ()
462 (` 462 (`
463 (case (car break-style) 463 (case (car break-style)
464 (list-item 464 (list-item
557 (otherwise ; Assume 'inline' rendering as default 557 (otherwise ; Assume 'inline' rendering as default
558 nil)) 558 nil))
559 ) 559 )
560 ) 560 )
561 561
562 (defmacro w3-display-progress-meter ()
563 (`
564 (url-lazy-message "Drawing... %c" (aref "/|\\-" (random 4)))))
565
562 (defmacro w3-display-handle-end-break () 566 (defmacro w3-display-handle-end-break ()
563 (` 567 (`
564 (case (pop break-style) 568 (case (pop break-style)
565 (block ; Full paragraph break 569 (block ; Full paragraph break
566 (w3-display-line-break 1) 570 (w3-display-line-break 1)
1214 ;;(if align (push (intern (downcase align)) w3-display-alignment-stack)) 1218 ;;(if align (push (intern (downcase align)) w3-display-alignment-stack))
1215 (save-excursion 1219 (save-excursion
1216 (save-restriction 1220 (save-restriction
1217 (narrow-to-region (point) (point)) 1221 (narrow-to-region (point) (point))
1218 (setq fill-column avgwidth 1222 (setq fill-column avgwidth
1219 ;; inhibit-read-only t 1223 inhibit-read-only t
1220 w3-last-fill-pos (point-min) 1224 w3-last-fill-pos (point-min)
1221 i 0) 1225 i 0)
1222 ;; skip over columns that have leftover content 1226 ;; skip over columns that have leftover content
1223 (while (and (< i num-cols) 1227 (while (and (< i num-cols)
1224 (/= 0 (aref table-rowspans i))) 1228 (/= 0 (aref table-rowspans i)))
1490 (defun w3-display-node (node &optional nofaces) 1494 (defun w3-display-node (node &optional nofaces)
1491 (let ( 1495 (let (
1492 (content-stack (list (list node))) 1496 (content-stack (list (list node)))
1493 (right-margin-stack (list fill-column)) 1497 (right-margin-stack (list fill-column))
1494 (left-margin-stack (list 0)) 1498 (left-margin-stack (list 0))
1495 ;; (inhibit-read-only t) 1499 (inhibit-read-only t)
1496 node 1500 node
1497 insert-before 1501 insert-before
1498 insert-after 1502 insert-after
1499 tag 1503 tag
1500 args 1504 args
1507 ) 1511 )
1508 (while content-stack 1512 (while content-stack
1509 (setq content (pop content-stack)) 1513 (setq content (pop content-stack))
1510 (pop w3-active-faces) 1514 (pop w3-active-faces)
1511 (pop w3-active-voices) 1515 (pop w3-active-voices)
1516 (w3-display-progress-meter)
1512 (case (car (pop w3-display-open-element-stack)) 1517 (case (car (pop w3-display-open-element-stack))
1513 ;; Any weird, post-display-of-content stuff for specific tags 1518 ;; Any weird, post-display-of-content stuff for specific tags
1514 ;; goes here. Couldn't think of any better way to do this when we 1519 ;; goes here. Couldn't think of any better way to do this when we
1515 ;; are iterative. *sigh* 1520 ;; are iterative. *sigh*
1516 (a 1521 (a
1539 (pop insert-after) 1544 (pop insert-after)
1540 (w3-display-handle-end-break) 1545 (w3-display-handle-end-break)
1541 (w3-pop-all-face-info) 1546 (w3-pop-all-face-info)
1542 ;; Handle the element's content 1547 ;; Handle the element's content
1543 (while content 1548 (while content
1549 (w3-display-progress-meter)
1544 (if (stringp (car content)) 1550 (if (stringp (car content))
1545 (w3-handle-string-content (pop content)) 1551 (w3-handle-string-content (pop content))
1546 (setq node (pop content) 1552 (setq node (pop content)
1547 tag (nth 0 node) 1553 tag (nth 0 node)
1548 args (nth 1 node) 1554 args (nth 1 node)
1638 (w3-display-chop-into-table node 2))))) 1644 (w3-display-chop-into-table node 2)))))
1639 (w3-handle-content node)) 1645 (w3-handle-content node))
1640 (img ; inlined image 1646 (img ; inlined image
1641 (w3-handle-image) 1647 (w3-handle-image)
1642 (w3-handle-empty-tag)) 1648 (w3-handle-empty-tag))
1649 (frameset
1650 (if w3-display-frames
1651 (w3-handle-content node)
1652 (w3-handle-empty-tag)))
1653 (frame
1654 (let* ((href (or (w3-get-attribute 'src)
1655 (w3-get-attribute 'href)))
1656 (name (or (w3-get-attribute 'name)
1657 (w3-get-attribute 'title)
1658 (w3-get-attribute 'alt)
1659 "Unknown frame name")))
1660 (w3-handle-content
1661 (list tag args
1662 (list
1663 (list 'p nil
1664 (list
1665 (list 'a
1666 (cons (cons 'href href)
1667 args)
1668 (list
1669 "Fetch frame: "
1670 name)))))))))
1671 (noframes
1672 (if w3-display-frames
1673 (w3-handle-empty-tag)
1674 (w3-handle-content node)))
1643 (script ; Scripts 1675 (script ; Scripts
1644 (w3-handle-empty-tag)) 1676 (w3-handle-empty-tag))
1645 ((embed object) ; Embedded images/content 1677 ((embed object) ; Embedded images/content
1646 (w3-handle-content node) 1678 (w3-handle-content node)
1647 ) 1679 )
1761 fill-column (min (- (or w3-strict-width (window-width)) 1793 fill-column (min (- (or w3-strict-width (window-width))
1762 w3-right-margin) 1794 w3-right-margin)
1763 (or w3-maximum-line-length 1795 (or w3-maximum-line-length
1764 (window-width))) 1796 (window-width)))
1765 fill-prefix "") 1797 fill-prefix "")
1766 ;; (set (make-local-variable 'inhibit-read-only) t) 1798 (set (make-local-variable 'inhibit-read-only) t))
1767 )
1768 (w3-handle-content node) 1799 (w3-handle-content node)
1769 ) 1800 )
1770 (*invisible 1801 (*invisible
1771 (w3-handle-empty-tag)) 1802 (w3-handle-empty-tag))
1772 (meta 1803 (meta