diff options
| author | Stefan Monnier | 2007-11-15 19:56:44 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2007-11-15 19:56:44 +0000 |
| commit | 05477667af17c9bfad2f66a6c04d6297b66f9d16 (patch) | |
| tree | 802437e8216f464d6cfa02a243903c3905790187 | |
| parent | ec5741dc7fcfd96ac1b9d4dc3759fce214e685f4 (diff) | |
| download | emacs-05477667af17c9bfad2f66a6c04d6297b66f9d16.tar.gz emacs-05477667af17c9bfad2f66a6c04d6297b66f9d16.zip | |
(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.
| -rw-r--r-- | lisp/ChangeLog | 9 | ||||
| -rw-r--r-- | lisp/doc-view.el | 28 |
2 files changed, 35 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 474216b6a22..4b333ca8ab8 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2007-11-15 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * doc-view.el (doc-view-ghostscript-options): Remove resolution arg. | ||
| 4 | (doc-view-resolution): New custom var. | ||
| 5 | (doc-view-pdf/ps->png): Use it. | ||
| 6 | (doc-view-shrink-factor): New var. | ||
| 7 | (doc-view-enlarge, doc-view-shrink): New commands. | ||
| 8 | (doc-view-mode-map): Use them. | ||
| 9 | |||
| 1 | 2007-11-15 Juanma Barranquero <lekktu@gmail.com> | 10 | 2007-11-15 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 11 | ||
| 3 | * ediff-wind.el (ediff-window-setup-function): | 12 | * ediff-wind.el (ediff-window-setup-function): |
diff --git a/lisp/doc-view.el b/lisp/doc-view.el index c07f5b5967a..e7d96f37137 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el | |||
| @@ -102,7 +102,8 @@ | |||
| 102 | ;; - better menu. | 102 | ;; - better menu. |
| 103 | ;; - don't use `find-file'. | 103 | ;; - don't use `find-file'. |
| 104 | ;; - Bind slicing to a drag event. | 104 | ;; - Bind slicing to a drag event. |
| 105 | ;; - zoom (the whole document and/or just the region around the cursor). | 105 | ;; - doc-view-fit-doc-to-window and doc-view-fit-window-to-doc. |
| 106 | ;; - zoom a the region around the cursor (like xdvi). | ||
| 106 | ;; - get rid of the silly arrow in the fringe. | 107 | ;; - get rid of the silly arrow in the fringe. |
| 107 | ;; - improve anti-aliasing (pdf-utils gets it better). | 108 | ;; - improve anti-aliasing (pdf-utils gets it better). |
| 108 | 109 | ||
| @@ -154,11 +155,16 @@ | |||
| 154 | '("-dSAFER" ;; Avoid security problems when rendering files from untrusted | 155 | '("-dSAFER" ;; Avoid security problems when rendering files from untrusted |
| 155 | ;; sources. | 156 | ;; sources. |
| 156 | "-dNOPAUSE" "-sDEVICE=png16m" "-dTextAlphaBits=4" | 157 | "-dNOPAUSE" "-sDEVICE=png16m" "-dTextAlphaBits=4" |
| 157 | "-dBATCH" "-dGraphicsAlphaBits=4" "-dQUIET" "-r100") | 158 | "-dBATCH" "-dGraphicsAlphaBits=4" "-dQUIET") |
| 158 | "A list of options to give to ghostscript." | 159 | "A list of options to give to ghostscript." |
| 159 | :type '(repeat string) | 160 | :type '(repeat string) |
| 160 | :group 'doc-view) | 161 | :group 'doc-view) |
| 161 | 162 | ||
| 163 | (defcustom doc-view-resolution 100 | ||
| 164 | "Dots per inch resolution used to render the documents. | ||
| 165 | Higher values result in larger images." | ||
| 166 | :type 'number) | ||
| 167 | |||
| 162 | (defcustom doc-view-dvipdfm-program (executable-find "dvipdfm") | 168 | (defcustom doc-view-dvipdfm-program (executable-find "dvipdfm") |
| 163 | "Program to convert DVI files to PDF. | 169 | "Program to convert DVI files to PDF. |
| 164 | 170 | ||
| @@ -253,6 +259,9 @@ has finished." | |||
| 253 | (define-key map (kbd "M-<") 'doc-view-first-page) | 259 | (define-key map (kbd "M-<") 'doc-view-first-page) |
| 254 | (define-key map (kbd "M->") 'doc-view-last-page) | 260 | (define-key map (kbd "M->") 'doc-view-last-page) |
| 255 | (define-key map [remap goto-line] 'doc-view-goto-page) | 261 | (define-key map [remap goto-line] 'doc-view-goto-page) |
| 262 | ;; Zoom in/out. | ||
| 263 | (define-key map "+" 'doc-view-enlarge) | ||
| 264 | (define-key map "-" 'doc-view-shrink) | ||
| 256 | ;; Killing/burying the buffer (and the process) | 265 | ;; Killing/burying the buffer (and the process) |
| 257 | (define-key map (kbd "q") 'bury-buffer) | 266 | (define-key map (kbd "q") 'bury-buffer) |
| 258 | (define-key map (kbd "k") 'doc-view-kill-proc-and-buffer) | 267 | (define-key map (kbd "k") 'doc-view-kill-proc-and-buffer) |
| @@ -448,6 +457,20 @@ It's a subdirectory of `doc-view-cache-directory'." | |||
| 448 | 457 | ||
| 449 | ;;;; Conversion Functions | 458 | ;;;; Conversion Functions |
| 450 | 459 | ||
| 460 | (defvar doc-view-shrink-factor 1.125) | ||
| 461 | |||
| 462 | (defun doc-view-enlarge (factor) | ||
| 463 | "Enlarge the document." | ||
| 464 | (interactive (list doc-view-shrink-factor)) | ||
| 465 | (set (make-local-variable 'doc-view-resolution) | ||
| 466 | (* factor doc-view-resolution)) | ||
| 467 | (doc-view-reconvert-doc)) | ||
| 468 | |||
| 469 | (defun doc-view-shrink (factor) | ||
| 470 | "Shrink the document." | ||
| 471 | (interactive (list doc-view-shrink-factor)) | ||
| 472 | (doc-view-enlarge (/ 1.0 factor))) | ||
| 473 | |||
| 451 | (defun doc-view-reconvert-doc () | 474 | (defun doc-view-reconvert-doc () |
| 452 | "Reconvert the current document. | 475 | "Reconvert the current document. |
| 453 | Should be invoked when the cached images aren't up-to-date." | 476 | 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." | |||
| 503 | (append (list "pdf/ps->png" doc-view-conversion-buffer | 526 | (append (list "pdf/ps->png" doc-view-conversion-buffer |
| 504 | doc-view-ghostscript-program) | 527 | doc-view-ghostscript-program) |
| 505 | doc-view-ghostscript-options | 528 | doc-view-ghostscript-options |
| 529 | (list (format "-r%d" (round doc-view-resolution))) | ||
| 506 | (list (concat "-sOutputFile=" png)) | 530 | (list (concat "-sOutputFile=" png)) |
| 507 | (list pdf-ps))) | 531 | (list pdf-ps))) |
| 508 | mode-line-process (list (format ":%s" doc-view-current-converter-process))) | 532 | mode-line-process (list (format ":%s" doc-view-current-converter-process))) |