Mercurial > emacs
comparison lisp/gnus/gnus-ems.el @ 111573:e89dd9c3633b
merge trunk
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Mon, 08 Nov 2010 14:19:54 +0900 |
parents | b75e6634a171 |
children | 417b1e4d63cd |
comparison
equal
deleted
inserted
replaced
111572:b3f9490f0b7f | 111573:e89dd9c3633b |
---|---|
160 mark-active) ; aliased to region-exists-p in XEmacs. | 160 mark-active) ; aliased to region-exists-p in XEmacs. |
161 | 161 |
162 (autoload 'gnus-alive-p "gnus-util") | 162 (autoload 'gnus-alive-p "gnus-util") |
163 (autoload 'mm-disable-multibyte "mm-util") | 163 (autoload 'mm-disable-multibyte "mm-util") |
164 | 164 |
165 (defun gnus-x-splash () | |
166 "Show a splash screen using a pixmap in the current buffer." | |
167 (interactive) | |
168 (unless window-system | |
169 (error "`gnus-x-splash' requires running on the window system")) | |
170 (switch-to-buffer (gnus-get-buffer-create (if (or (gnus-alive-p) | |
171 (interactive-p)) | |
172 "*gnus-x-splash*" | |
173 gnus-group-buffer))) | |
174 (let ((inhibit-read-only t) | |
175 (file (nnheader-find-etc-directory "images/gnus/x-splash" t)) | |
176 pixmap fcw fch width height fringes sbars left yoffset top ls) | |
177 (erase-buffer) | |
178 (sit-for 0) ;; Necessary for measuring the window size correctly. | |
179 (when (and file | |
180 (ignore-errors | |
181 (let ((coding-system-for-read 'raw-text)) | |
182 (with-temp-buffer | |
183 (mm-disable-multibyte) | |
184 (insert-file-contents file) | |
185 (goto-char (point-min)) | |
186 (setq pixmap (read (current-buffer))))))) | |
187 (setq fcw (float (frame-char-width)) | |
188 fch (float (frame-char-height)) | |
189 width (/ (car pixmap) fcw) | |
190 height (/ (cadr pixmap) fch) | |
191 fringes (if (fboundp 'window-fringes) | |
192 (eval '(window-fringes)) | |
193 '(10 11 nil)) | |
194 sbars (frame-parameter nil 'vertical-scroll-bars)) | |
195 (cond ((eq sbars 'right) | |
196 (setq sbars | |
197 (cons 0 (/ (or (frame-parameter nil 'scroll-bar-width) 14) | |
198 fcw)))) | |
199 (sbars | |
200 (setq sbars | |
201 (cons (/ (or (frame-parameter nil 'scroll-bar-width) 14) | |
202 fcw) | |
203 0))) | |
204 (t | |
205 (setq sbars '(0 . 0)))) | |
206 (setq left (- (* (round (/ (1- (/ (+ (window-width) | |
207 (car sbars) (cdr sbars) | |
208 (/ (+ (or (car fringes) 0) | |
209 (or (cadr fringes) 0)) | |
210 fcw)) | |
211 width)) | |
212 2)) | |
213 width) | |
214 (car sbars) | |
215 (/ (or (car fringes) 0) fcw)) | |
216 yoffset (cadr (window-edges)) | |
217 top (max 0 (- (* (max (if (and (boundp 'tool-bar-mode) | |
218 tool-bar-mode | |
219 (not (featurep 'gtk)) | |
220 (eq (frame-first-window) | |
221 (selected-window))) | |
222 1 0) | |
223 (round (/ (1- (/ (+ (1- (window-height)) | |
224 (* 2 yoffset)) | |
225 height)) | |
226 2))) | |
227 height) | |
228 yoffset)) | |
229 ls (/ (or line-spacing 0) fch) | |
230 height (max 0 (- height ls))) | |
231 (cond ((>= (- top ls) 1) | |
232 (insert | |
233 (propertize | |
234 " " | |
235 'display `(space :width 0 :ascent 100)) | |
236 "\n" | |
237 (propertize | |
238 " " | |
239 'display `(space :width 0 :height ,(- top ls 1) :ascent 100)) | |
240 "\n")) | |
241 ((> (- top ls) 0) | |
242 (insert | |
243 (propertize | |
244 " " | |
245 'display `(space :width 0 :height ,(- top ls) :ascent 100)) | |
246 "\n"))) | |
247 (if (and (> width 0) (> left 0)) | |
248 (insert (propertize | |
249 " " | |
250 'display `(space :width ,left :height ,height :ascent 0))) | |
251 (setq width (+ width left))) | |
252 (when (> width 0) | |
253 (insert (propertize | |
254 " " | |
255 'display `(space :width ,width :height ,height :ascent 0) | |
256 'face `(gnus-splash :stipple ,pixmap)))) | |
257 (goto-char (if (<= (- top ls) 0) (1- (point)) (point-min))) | |
258 (redraw-frame (selected-frame)) | |
259 (sit-for 0)))) | |
260 | |
261 ;;; Image functions. | 165 ;;; Image functions. |
262 | 166 |
263 (defun gnus-image-type-available-p (type) | 167 (defun gnus-image-type-available-p (type) |
264 (and (fboundp 'image-type-available-p) | 168 (and (fboundp 'image-type-available-p) |
265 (image-type-available-p type) | 169 (image-type-available-p type) |
275 (ignore-errors | 179 (ignore-errors |
276 (apply 'create-image file type data-p props)))) | 180 (apply 'create-image file type data-p props)))) |
277 | 181 |
278 (defun gnus-put-image (glyph &optional string category) | 182 (defun gnus-put-image (glyph &optional string category) |
279 (let ((point (point))) | 183 (let ((point (point))) |
280 (insert-image glyph (or string "*")) | 184 (insert-image glyph (or string " ")) |
281 (put-text-property point (point) 'gnus-image-category category) | 185 (put-text-property point (point) 'gnus-image-category category) |
282 (unless string | 186 (unless string |
283 (put-text-property (1- (point)) (point) | 187 (put-text-property (1- (point)) (point) |
284 'gnus-image-text-deletable t)) | 188 'gnus-image-text-deletable t)) |
285 glyph)) | 189 glyph)) |