aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog9
-rw-r--r--lisp/doc-view.el28
2 files changed, 35 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 474216b6a2..4b333ca8ab 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,12 @@
+2007-11-15 Stefan Monnier <[email protected]>
+
+ * doc-view.el (doc-view-ghostscript-options): Remove resolution arg.
+ (doc-view-resolution): New custom var.
+ (doc-view-pdf/ps->png): Use it.
+ (doc-view-shrink-factor): New var.
+ (doc-view-enlarge, doc-view-shrink): New commands.
+ (doc-view-mode-map): Use them.
+
2007-11-15 Juanma Barranquero <[email protected]>
* ediff-wind.el (ediff-window-setup-function):
diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index c07f5b5967..e7d96f3713 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -102,7 +102,8 @@
;; - better menu.
;; - don't use `find-file'.
;; - Bind slicing to a drag event.
-;; - zoom (the whole document and/or just the region around the cursor).
+;; - doc-view-fit-doc-to-window and doc-view-fit-window-to-doc.
+;; - zoom a the region around the cursor (like xdvi).
;; - get rid of the silly arrow in the fringe.
;; - improve anti-aliasing (pdf-utils gets it better).
@@ -154,11 +155,16 @@
'("-dSAFER" ;; Avoid security problems when rendering files from untrusted
;; sources.
"-dNOPAUSE" "-sDEVICE=png16m" "-dTextAlphaBits=4"
- "-dBATCH" "-dGraphicsAlphaBits=4" "-dQUIET" "-r100")
+ "-dBATCH" "-dGraphicsAlphaBits=4" "-dQUIET")
"A list of options to give to ghostscript."
:type '(repeat string)
:group 'doc-view)
+(defcustom doc-view-resolution 100
+ "Dots per inch resolution used to render the documents.
+Higher values result in larger images."
+ :type 'number)
+
(defcustom doc-view-dvipdfm-program (executable-find "dvipdfm")
"Program to convert DVI files to PDF.
@@ -253,6 +259,9 @@ has finished."
(define-key map (kbd "M-<") 'doc-view-first-page)
(define-key map (kbd "M->") 'doc-view-last-page)
(define-key map [remap goto-line] 'doc-view-goto-page)
+ ;; Zoom in/out.
+ (define-key map "+" 'doc-view-enlarge)
+ (define-key map "-" 'doc-view-shrink)
;; Killing/burying the buffer (and the process)
(define-key map (kbd "q") 'bury-buffer)
(define-key map (kbd "k") 'doc-view-kill-proc-and-buffer)
@@ -448,6 +457,20 @@ It's a subdirectory of `doc-view-cache-directory'."
;;;; Conversion Functions
+(defvar doc-view-shrink-factor 1.125)
+
+(defun doc-view-enlarge (factor)
+ "Enlarge the document."
+ (interactive (list doc-view-shrink-factor))
+ (set (make-local-variable 'doc-view-resolution)
+ (* factor doc-view-resolution))
+ (doc-view-reconvert-doc))
+
+(defun doc-view-shrink (factor)
+ "Shrink the document."
+ (interactive (list doc-view-shrink-factor))
+ (doc-view-enlarge (/ 1.0 factor)))
+
(defun doc-view-reconvert-doc ()
"Reconvert the current document.
Should be invoked when the cached images aren't up-to-date."
@@ -503,6 +526,7 @@ Should be invoked when the cached images aren't up-to-date."
(append (list "pdf/ps->png" doc-view-conversion-buffer
doc-view-ghostscript-program)
doc-view-ghostscript-options
+ (list (format "-r%d" (round doc-view-resolution)))
(list (concat "-sOutputFile=" png))
(list pdf-ps)))
mode-line-process (list (format ":%s" doc-view-current-converter-process)))