From 783b7b7551b197fdcfd384ac4a3d93302a073eaf Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 16 Feb 2013 11:20:21 -0800 Subject: [PATCH] * lisp/image-mode.el (image-mode-map): Give it a menu. --- lisp/ChangeLog | 4 ++++ lisp/image-mode.el | 50 ++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 52 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index dd738ca9430..17ecbd8bf31 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2013-02-16 Glenn Morris + + * image-mode.el (image-mode-map): Give it a menu. + 2013-02-16 Michael Albinus * net/tramp-cache.el (tramp-connection-properties): New customer diff --git a/lisp/image-mode.el b/lisp/image-mode.el index e539848675c..b6298adeb7e 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el @@ -359,6 +359,53 @@ call." (define-key map [remap move-end-of-line] 'image-eol) (define-key map [remap beginning-of-buffer] 'image-bob) (define-key map [remap end-of-buffer] 'image-eob) + (easy-menu-define image-mode-menu map "Menu for Image mode." + '("Image" + ["Show as Text" image-toggle-display :active t + :help "Show image as text"] + "--" + ["Fit Frame to Image" image-mode-fit-frame :active t + :help "Resize frame to match image"] + ["Fit to Window Height" image-transform-fit-to-height + :visible (eq image-type 'imagemagick) + :help "Resize image to match the window height"] + ["Fit to Window Width" image-transform-fit-to-width + :visible (eq image-type 'imagemagick) + :help "Resize image to match the window width"] + ["Rotate Image..." image-transform-set-rotation + :visible (eq image-type 'imagemagick) + :help "Rotate the image"] + "--" + ["Next Image" image-next-file :active t + :help "Move to next image in this directory"] + ["Previous Image" image-previous-file :active t + :help "Move to previous image in this directory"] + "--" + ["Animate Image" image-toggle-animation :style toggle + :selected (let ((image (image-get-display-property))) + (and image (image-animate-timer image))) + :active image-current-frame + :help "Toggle image animation"] + ["Loop Animation" + (lambda () (interactive) +;;; (make-variable-buffer-local 'image-animate-loop) + (setq image-animate-loop (not image-animate-loop)) + ;; FIXME this is a hacky way to make it affect a currently + ;; animating image. + (when (let ((image (image-get-display-property))) + (and image (image-animate-timer image))) + (image-toggle-animation) + (image-toggle-animation))) + :style toggle :selected image-animate-loop + :active image-current-frame + :help "Animate images once, or forever?"] + ["Next Frame" image-next-frame :active image-current-frame + :help "Show the next frame of this image"] + ["Previous Frame" image-previous-frame :active image-current-frame + :help "Show the previous frame of this image"] + ["Goto Frame..." image-goto-frame :active image-current-frame + :help "Show a specific frame of this image"] + )) map) "Mode keymap for `image-mode'.") @@ -637,8 +684,7 @@ current frame. Frames are indexed from 1." (interactive (list (or current-prefix-arg (read-number "Show frame number: ")))) - (let ((image (image-get-display-property)) - animation) + (let ((image (image-get-display-property))) (cond ((null image) (error "No image is present")) -- 2.11.4.GIT