comparison lisp/doc-view.el @ 112138:3d3d7ef762fd

Merge from mainline.
author Paul Eggert <eggert@cs.ucla.edu>
date Thu, 06 Jan 2011 21:16:15 -0800
parents 25ff862568d0
children 40ab7b8eb7a4
comparison
equal deleted inserted replaced
112120:aa1843c74710 112138:3d3d7ef762fd
163 :group 'doc-view) 163 :group 'doc-view)
164 164
165 (defcustom doc-view-resolution 100 165 (defcustom doc-view-resolution 100
166 "Dots per inch resolution used to render the documents. 166 "Dots per inch resolution used to render the documents.
167 Higher values result in larger images." 167 Higher values result in larger images."
168 :type 'number
169 :group 'doc-view)
170
171 (defcustom doc-view-image-width 850
172 "Default image width.
173 Has only an effect if imagemagick support is compiled into emacs."
168 :type 'number 174 :type 'number
169 :group 'doc-view) 175 :group 'doc-view)
170 176
171 (defcustom doc-view-dvipdfm-program (executable-find "dvipdfm") 177 (defcustom doc-view-dvipdfm-program (executable-find "dvipdfm")
172 "Program to convert DVI files to PDF. 178 "Program to convert DVI files to PDF.
639 (defvar doc-view-shrink-factor 1.125) 645 (defvar doc-view-shrink-factor 1.125)
640 646
641 (defun doc-view-enlarge (factor) 647 (defun doc-view-enlarge (factor)
642 "Enlarge the document." 648 "Enlarge the document."
643 (interactive (list doc-view-shrink-factor)) 649 (interactive (list doc-view-shrink-factor))
644 (set (make-local-variable 'doc-view-resolution) 650 (if (eq (plist-get (cdr (doc-view-current-image)) :type)
645 (* factor doc-view-resolution)) 651 'imagemagick)
646 (doc-view-reconvert-doc)) 652 ;; ImageMagick supports on-the-fly-rescaling
653 (progn
654 (set (make-local-variable 'doc-view-image-width)
655 (ceiling (* factor doc-view-image-width)))
656 (doc-view-insert-image (plist-get (cdr (doc-view-current-image)) :file)
657 :width doc-view-image-width))
658 (set (make-local-variable 'doc-view-resolution)
659 (ceiling (* factor doc-view-resolution)))
660 (doc-view-reconvert-doc)))
647 661
648 (defun doc-view-shrink (factor) 662 (defun doc-view-shrink (factor)
649 "Shrink the document." 663 "Shrink the document."
650 (interactive (list doc-view-shrink-factor)) 664 (interactive (list doc-view-shrink-factor))
651 (doc-view-enlarge (/ 1.0 factor))) 665 (doc-view-enlarge (/ 1.0 factor)))
947 (when doc-view-pending-cache-flush 961 (when doc-view-pending-cache-flush
948 (clear-image-cache) 962 (clear-image-cache)
949 (setq doc-view-pending-cache-flush nil)) 963 (setq doc-view-pending-cache-flush nil))
950 (let ((ol (doc-view-current-overlay)) 964 (let ((ol (doc-view-current-overlay))
951 (image (if (and file (file-readable-p file)) 965 (image (if (and file (file-readable-p file))
952 (apply 'create-image file 'png nil args))) 966 (if (not (fboundp 'imagemagick-types))
967 (apply 'create-image file 'png nil args)
968 (unless (member :width args)
969 (setq args (append args (list :width doc-view-image-width))))
970 (apply 'create-image file 'imagemagick nil args))))
953 (slice (doc-view-current-slice))) 971 (slice (doc-view-current-slice)))
954 (setf (doc-view-current-image) image) 972 (setf (doc-view-current-image) image)
955 (move-overlay ol (point-min) (point-max)) 973 (move-overlay ol (point-min) (point-max))
956 (overlay-put ol 'display 974 (overlay-put ol 'display
957 (cond 975 (cond