annotate lisp/tm/tm-image.el @ 108:360340f9fd5f r20-1b6

Import from CVS: tag r20-1b6
author cvs
date Mon, 13 Aug 2007 09:18:39 +0200
parents 0d2f883870bc
children fe104dbd9147
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1 ;;; tm-image.el --- tm-view filter to display images in XEmacs or MULE buffers
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
2
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
3 ;; Copyright (C) 1995,1996,1997 MORIOKA Tomohiko
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
4 ;; Copyright (C) 1996 Dan Rich
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
5
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
6 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
7 ;; Dan Rich <drich@morpheus.corp.sgi.com>
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
8 ;; Maintainer: MORIOKA Tomohiko <morioka@jaist.ac.jp>
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
9 ;; Created: 1995/12/15
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
10 ;; Version: $Id: tm-image.el,v 1.4 1997/02/15 22:21:29 steve Exp $
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
11
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
12 ;; Keywords: image, picture, X-Face, MIME, multimedia, mail, news
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
13
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
14 ;; This file is part of XEmacs.
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
15
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
16 ;; This program is free software; you can redistribute it and/or
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
17 ;; modify it under the terms of the GNU General Public License as
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
18 ;; published by the Free Software Foundation; either version 2, or (at
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
19 ;; your option) any later version.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
20
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
21 ;; This program is distributed in the hope that it will be useful, but
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
22 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
23 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
24 ;; General Public License for more details.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
25
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
26 ;; You should have received a copy of the GNU General Public License
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
27 ;; along with GNU XEmacs; see the file COPYING. If not, write to the
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
28 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
29 ;; Boston, MA 02111-1307, USA.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
30
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
31 ;;; Commentary:
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
32 ;; If you use this program with MULE, please install
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
33 ;; etl8x16-bitmap.bdf font included in tl package.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
34
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
35 ;;; Code:
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
36
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
37 (require 'tm-view)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
38
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
39 (cond (running-xemacs
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
40 (require 'images)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
41
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
42 (defun-maybe image-inline-p (format)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
43 (or (memq format image-native-formats)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
44 (find-if (function
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
45 (lambda (native)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
46 (image-converter-chain format native)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
47 ))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
48 image-native-formats)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
49 ))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
50
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
51 (image-register-netpbm-utilities)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
52 (image-register-converter 'pic 'ppm "pictoppm")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
53 (image-register-converter 'mag 'ppm "magtoppm")
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
54
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
55 (defun bitmap-insert-xbm-file (file)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
56 (let ((gl (make-glyph (list (cons 'x file))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
57 (e (make-extent (point) (point)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
58 )
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
59 (set-extent-end-glyph e gl)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
60 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
61
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
62 ;;
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
63 ;; X-Face
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
64 ;;
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
65 (autoload 'highlight-headers "highlight-headers")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
66
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
67 (defun mime-preview/x-face-function-use-highlight-headers ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
68 (highlight-headers (point-min) (re-search-forward "^$" nil t) t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
69 )
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
70
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
71 (add-hook 'mime-viewer/content-header-filter-hook
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
72 'mime-preview/x-face-function-use-highlight-headers)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
73
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
74 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
75 ((featurep 'mule)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
76 ;; for MULE 2.* or mule merged EMACS
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
77 (require 'x-face-mule)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
78
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
79 (defvar image-native-formats '(xbm))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
80
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
81 (defun-maybe image-inline-p (format)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
82 (memq format image-native-formats)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
83 )
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
84
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
85 (defun-maybe image-normalize (format data)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
86 (and (eq format 'xbm)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
87 (vector 'xbm ':data data)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
88 ))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
89
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
90 ;;
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
91 ;; X-Face
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
92 ;;
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
93 (if (file-installed-p uncompface-program exec-path)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
94 (add-hook 'mime-viewer/content-header-filter-hook
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
95 'x-face-decode-message-header)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
96 )
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
97 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
98
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
99 (or (fboundp 'image-invalid-glyph-p)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
100 (defsubst image-invalid-glyph-p (glyph)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
101 (or (null (aref glyph 0))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
102 (null (aref glyph 2))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
103 (equal (aref glyph 2) "")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
104 ))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
105 )
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
106
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
107 (defvar mime-viewer/image-converter-alist nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
108
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
109 (mapcar (function
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
110 (lambda (rule)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
111 (let ((ctype (car rule))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
112 (format (cdr rule))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
113 )
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
114 (if (image-inline-p format)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
115 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
116 (set-alist 'mime-viewer/content-filter-alist
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
117 ctype
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
118 (function mime-preview/filter-for-image))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
119 (set-alist 'mime-viewer/image-converter-alist
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
120 ctype format)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
121 (add-to-list
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
122 'mime-viewer/default-showing-Content-Type-list
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
123 ctype)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
124 )
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
125 ))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
126 '(("image/jpeg" . jpeg)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
127 ("image/gif" . gif)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
128 ("image/tiff" . tiff)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
129 ("image/x-tiff" . tiff)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
130 ("image/xbm" . xbm)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
131 ("image/x-xbm" . xbm)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
132 ("image/x-xpixmap" . xpm)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
133 ("image/x-pic" . pic)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
134 ("image/x-mag" . mag)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
135 ))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
136
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
137 (defvar mime-viewer/ps-to-gif-command "pstogif")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
138
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
139
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
140 ;;; @ content filter for images
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
141 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
142 ;; (for XEmacs 19.12 or later)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
143
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
144 (defun mime-preview/filter-for-image (ctype params encoding)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
145 (let* ((mode mime::preview/original-major-mode)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
146 (m (assq mode mime-viewer/code-converter-alist))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
147 (charset (assoc "charset" params))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
148 (beg (point-min)) (end (point-max))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
149 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
150 (remove-text-properties beg end '(face nil))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
151 (message "Decoding image...")
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
152 (mime-decode-region beg end encoding)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
153 (let* ((minor (assoc-value ctype mime-viewer/image-converter-alist))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
154 (gl (image-normalize minor (buffer-string)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
155 e)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
156 (delete-region (point-min)(point-max))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
157 (cond ((image-invalid-glyph-p gl)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
158 (setq gl nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
159 (message "Invalid glyph!")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
160 )
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
161 ((eq (aref gl 0) 'xbm)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
162 (let ((xbm-file
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
163 (make-temp-name (expand-file-name "tm" mime/tmp-dir))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
164 (insert (aref gl 2))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
165 (write-region (point-min)(point-max) xbm-file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
166 (message "Decoding image...")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
167 (delete-region (point-min)(point-max))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
168 (bitmap-insert-xbm-file xbm-file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
169 (delete-file xbm-file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
170 )
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
171 (message "Decoding image... done")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
172 )
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
173 (t
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
174 (setq gl (make-glyph gl))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
175 (setq e (make-extent (point) (point)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
176 (set-extent-end-glyph e gl)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
177 (message "Decoding image... done")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
178 ))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
179 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
180 (insert "\n")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
181 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
182
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
183
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
184 ;;; @ content filter for Postscript
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
185 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
186 ;; (for XEmacs 19.14 or later)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
187
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
188 (defun mime-preview/filter-for-application/postscript (ctype params encoding)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
189 (let* ((mode mime::preview/original-major-mode)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
190 (m (assq mode mime-viewer/code-converter-alist))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
191 (beg (point-min)) (end (point-max))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
192 (file-base (make-temp-name (expand-file-name "tm" mime/tmp-dir)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
193 (ps-file (concat file-base ".ps"))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
194 (gif-file (concat file-base ".gif"))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
195 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
196 (remove-text-properties beg end '(face nil))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
197 (message "Decoding Postscript...")
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
198 (mime-decode-region beg end encoding)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
199 (write-region (point-min)(point-max) ps-file)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
200 (message "Decoding Postscript...")
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
201 (delete-region (point-min)(point-max))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
202 (call-process mime-viewer/ps-to-gif-command nil nil nil ps-file)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
203 (set-extent-end-glyph (make-extent (point) (point))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
204 (make-glyph (vector 'gif :file gif-file)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
205 (message "Decoding Postscript... done")
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
206 (delete-file ps-file)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
207 (delete-file gif-file)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
208 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
209
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
210 (set-alist 'mime-viewer/content-filter-alist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
211 "application/postscript"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
212 (function mime-preview/filter-for-application/postscript))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
213
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
214 (if (featurep 'gif)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
215 (add-to-list 'mime-viewer/default-showing-Content-Type-list
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
216 "application/postscript")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
217 )
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
218
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
219
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
220 ;;; @ end
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
221 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
222
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
223 (provide 'tm-image)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
224
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
225 ;;; tm-image.el ends here