[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r111832: Rework recent image-multi-fr
From: |
Glenn Morris |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r111832: Rework recent image-multi-frame stuff a little |
Date: |
Tue, 19 Feb 2013 23:57:33 -0800 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 111832
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Tue 2013-02-19 23:57:33 -0800
message:
Rework recent image-multi-frame stuff a little
* image.el (image-current-frame): Change from variable to function.
(image-show-frame): Rename from image-nth-frame. Update callers.
* image-mode.el (image-multi-frame): New variable.
(image-mode-map, image-mode, image-goto-frame):
Use image-multi-frame rather than image-current-frame.
(image-mode, image-goto-frame):
Use image-current-frame as function rather than as variable.
modified:
lisp/ChangeLog
lisp/image-mode.el
lisp/image.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2013-02-20 02:07:07 +0000
+++ b/lisp/ChangeLog 2013-02-20 07:57:33 +0000
@@ -1,5 +1,13 @@
2013-02-20 Glenn Morris <address@hidden>
+ * image.el (image-current-frame): Change from variable to function.
+ (image-show-frame): Rename from image-nth-frame. Update callers.
+ * image-mode.el (image-multi-frame): New variable.
+ (image-mode-map, image-mode, image-goto-frame):
+ Use image-multi-frame rather than image-current-frame.
+ (image-mode, image-goto-frame): Use image-current-frame as
+ function rather than as variable.
+
* emacs-lisp/cl-lib.el (cl-floatp-safe): Make it an alias for floatp.
* emacs-lisp/cl-macs.el (cl--make-type-test)
(cl--compiler-macro-assoc): Use floatp rather than cl-floatp-safe.
=== modified file 'lisp/image-mode.el'
--- a/lisp/image-mode.el 2013-02-17 00:50:41 +0000
+++ b/lisp/image-mode.el 2013-02-20 07:57:33 +0000
@@ -329,6 +329,9 @@
"The image type for the current Image mode buffer.")
(make-variable-buffer-local 'image-type)
+(defvar-local image-multi-frame nil
+ "Non-nil if image for the current Image mode buffer has multiple frames.")
+
(defvar image-mode-previous-major-mode nil
"Internal variable to keep the previous non-image major mode.")
@@ -390,7 +393,7 @@
["Animate Image" image-toggle-animation :style toggle
:selected (let ((image (image-get-display-property)))
(and image (image-animate-timer image)))
- :active image-current-frame
+ :active image-multi-frame
:help "Toggle image animation"]
["Loop Animation"
(lambda () (interactive)
@@ -403,13 +406,13 @@
(image-toggle-animation)
(image-toggle-animation)))
:style toggle :selected image-animate-loop
- :active image-current-frame
+ :active image-multi-frame
:help "Animate images once, or forever?"]
- ["Next Frame" image-next-frame :active image-current-frame
+ ["Next Frame" image-next-frame :active image-multi-frame
:help "Show the next frame of this image"]
- ["Previous Frame" image-previous-frame :active image-current-frame
+ ["Previous Frame" image-previous-frame :active image-multi-frame
:help "Show the previous frame of this image"]
- ["Goto Frame..." image-goto-frame :active image-current-frame
+ ["Goto Frame..." image-goto-frame :active image-multi-frame
:help "Show a specific frame of this image"]
))
map)
@@ -471,12 +474,13 @@
((null image)
(message "%s" (concat msg1 "an image.")))
((setq animated (image-multi-frame-p image))
- (setq image-current-frame (or (plist-get (cdr image) :index) 0)
+ (setq image-multi-frame t
mode-line-process
- `(:eval (propertize (format " [%s/%s]"
- (1+ image-current-frame)
- ,(car animated))
- 'help-echo "Frame number")))
+ `(:eval (propertize
+ (format " [%s/%s]"
+ (1+ (image-current-frame ',image))
+ ,(car animated))
+ 'help-echo "Frame number")))
(message "%s"
(concat msg1 "text. This image has multiple frames.")))
;;; (substitute-command-keys
@@ -694,10 +698,13 @@
(cond
((null image)
(error "No image is present"))
- ((null image-current-frame)
+ ((null image-multi-frame)
(message "No image animation."))
(t
- (image-nth-frame image (if relative (+ n image-current-frame) (1-
n)))))))
+ (image-show-frame image
+ (if relative
+ (+ n (image-current-frame image))
+ (1- n)))))))
(defun image-next-frame (&optional n)
"Switch to the next frame of a multi-frame image.
=== modified file 'lisp/image.el'
--- a/lisp/image.el 2013-02-16 19:56:50 +0000
+++ b/lisp/image.el 2013-02-20 07:57:33 +0000
@@ -660,10 +660,11 @@
(defconst image-minimum-frame-delay 0.01
"Minimum interval in seconds between frames of an animated image.")
-(defvar-local image-current-frame nil
- "The frame index of the current animated image.")
+(defun image-current-frame (image)
+ "The current frame number of IMAGE, indexed from 0."
+ (or (plist-get (cdr image) :index) 0))
-(defun image-nth-frame (image n &optional nocheck)
+(defun image-show-frame (image n &optional nocheck)
"Show frame N of IMAGE.
Frames are indexed from 0. Optional argument NOCHECK non-nil means
do not check N is within the range of frames present in the image."
@@ -671,7 +672,6 @@
(if (< n 0) (setq n 0)
(setq n (min n (1- (car (image-multi-frame-p image)))))))
(plist-put (cdr image) :index n)
- (setq image-current-frame n)
(force-window-update))
;; FIXME? The delay may not be the same for different sub-images,
@@ -688,7 +688,7 @@
after displaying the last animation frame. Otherwise, stop
after LIMIT seconds have elapsed.
The minimum delay between successive frames is `image-minimum-frame-delay'."
- (image-nth-frame image n t)
+ (image-show-frame image n t)
(setq n (1+ n))
(let* ((time (float-time))
(animation (image-multi-frame-p image))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r111832: Rework recent image-multi-frame stuff a little,
Glenn Morris <=