comparison lisp/thumbs.el @ 83463:38c49afb29d9

Merged from Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-31 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-503
author Karoly Lorentey <lorentey@elte.hu>
date Wed, 01 Feb 2006 02:04:15 +0000
parents 6511ba48ed7a
children 3bd95f4f2941 7432ca837c8d
comparison
equal deleted inserted replaced
83462:75949877b3ed 83463:38c49afb29d9
172 (defvar thumbs-current-dir nil 172 (defvar thumbs-current-dir nil
173 "Current directory.") 173 "Current directory.")
174 174
175 (defvar thumbs-marked-list nil 175 (defvar thumbs-marked-list nil
176 "List of marked files.") 176 "List of marked files.")
177 (make-variable-buffer-local 'thumbs-marked-list)
178 (put 'thumbs-marked-list 'permanent-local t)
177 179
178 (defalias 'thumbs-gensym 180 (defalias 'thumbs-gensym
179 (if (fboundp 'gensym) 181 (if (fboundp 'gensym)
180 'gensym 182 'gensym
181 ;; Copied from cl-macs.el 183 ;; Copied from cl-macs.el
332 ((string-match ".*\\.bmp\\'" img) 'bmp) 334 ((string-match ".*\\.bmp\\'" img) 'bmp)
333 ((string-match ".*\\.png\\'" img) 'png) 335 ((string-match ".*\\.png\\'" img) 'png)
334 ((string-match ".*\\.tiff?\\'" img) 'tiff))) 336 ((string-match ".*\\.tiff?\\'" img) 'tiff)))
335 337
336 (defun thumbs-file-size (img) 338 (defun thumbs-file-size (img)
337 (let ((i (image-size (find-image `((:type ,(thumbs-image-type img) :file ,img))) t))) 339 (let ((i (image-size
338 (concat (number-to-string (round (car i))) 340 (find-image `((:type ,(thumbs-image-type img) :file ,img))) t)))
339 "x" 341 (concat (number-to-string (round (car i))) "x"
340 (number-to-string (round (cdr i)))))) 342 (number-to-string (round (cdr i))))))
341 343
342 ;;;###autoload 344 ;;;###autoload
343 (defun thumbs-find-thumb (img) 345 (defun thumbs-find-thumb (img)
344 "Display the thumbnail for IMG." 346 "Display the thumbnail for IMG."
364 If MARKED is non-nil, the image is marked." 366 If MARKED is non-nil, the image is marked."
365 (thumbs-insert-image 367 (thumbs-insert-image
366 (thumbs-make-thumb img) 'jpeg thumbs-relief marked) 368 (thumbs-make-thumb img) 'jpeg thumbs-relief marked)
367 (add-text-properties (1- (point)) (point) 369 (add-text-properties (1- (point)) (point)
368 `(thumb-image-file ,img 370 `(thumb-image-file ,img
369 help-echo ,(file-name-nondirectory img)))) 371 help-echo ,(file-name-nondirectory img)
372 rear-nonsticky help-echo)))
370 373
371 (defun thumbs-do-thumbs-insertion (list) 374 (defun thumbs-do-thumbs-insertion (list)
372 "Insert all thumbnails into thumbs buffer." 375 "Insert all thumbnails into thumbs buffer."
373 (let* ((i 0) 376 (let* ((i 0)
374 (length (length list)) 377 (length (length list))
486 (with-current-buffer thumbs-buffer 489 (with-current-buffer thumbs-buffer
487 (save-excursion 490 (save-excursion
488 (let (list) 491 (let (list)
489 (goto-char (point-min)) 492 (goto-char (point-min))
490 (while (not (eobp)) 493 (while (not (eobp))
491 (unless (= 0 (mod (point) (1+ thumbs-per-line))) 494 (unless (eolp)
492 (if (thumbs-current-image) 495 (if (thumbs-current-image)
493 (push (cons (point-marker) 496 (push (cons (point-marker)
494 (thumbs-current-image)) 497 (thumbs-current-image))
495 list))) 498 list)))
496 (forward-char 1)) 499 (forward-char 1))
772 775
773 (put 'thumbs-mode 'mode-class 'special) 776 (put 'thumbs-mode 'mode-class 'special)
774 (define-derived-mode thumbs-mode 777 (define-derived-mode thumbs-mode
775 fundamental-mode "thumbs" 778 fundamental-mode "thumbs"
776 "Preview images in a thumbnails buffer" 779 "Preview images in a thumbnails buffer"
777 (setq buffer-read-only t) 780 (setq buffer-read-only t))
778 (set (make-local-variable 'thumbs-marked-list) nil))
779 781
780 (defvar thumbs-view-image-mode-map 782 (defvar thumbs-view-image-mode-map
781 (let ((map (make-sparse-keymap))) 783 (let ((map (make-sparse-keymap)))
782 (define-key map [prior] 'thumbs-previous-image) 784 (define-key map [prior] 'thumbs-previous-image)
783 (define-key map [next] 'thumbs-next-image) 785 (define-key map [next] 'thumbs-next-image)