summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Schmidt <christopher@ch.ristopher.com>2012-05-05 23:52:47 +0200
committerChristopher Schmidt <christopher@ch.ristopher.com>2012-05-05 23:52:47 +0200
commit83014ab59a051fcd20ed21212c584a429b9e6b7b (patch)
tree97d52bfea8470236bf70e5054caa2043ca81d6a9
parent40f82daa43699f8b1f916b45ee77f6cb8b84b0ef (diff)
downloademacs-83014ab59a051fcd20ed21212c584a429b9e6b7b.tar.gz
* ampc.el: Add tool-bar.
(ampc-tool-bar-map): New variable. (ampc-mode): Set tool-bar.
-rw-r--r--ampc.el31
1 files changed, 28 insertions, 3 deletions
diff --git a/ampc.el b/ampc.el
index 4bc82678120..f8c67244f95 100644
--- a/ampc.el
+++ b/ampc.el
@@ -497,6 +497,31 @@ all the time!"
["Toggle marks" ampc-toggle-marks
:visible (not (eq (car ampc-type) 'playlists))]))
+(defvar ampc-tool-bar-map
+ (let ((map (make-sparse-keymap)))
+ (tool-bar-local-item
+ "mpc/prev" 'ampc-previous 'previous map
+ :help "Previous")
+ (tool-bar-local-item
+ "mpc/play" 'ampc-toggle-play 'play map
+ :help "Play"
+ :visible '(and ampc-status
+ (not (equal (cdr (assq 'state ampc-status)) "play"))))
+ (tool-bar-local-item
+ "mpc/pause" 'ampc-toggle-play 'pause map
+ :help "Pause"
+ :visible '(and ampc-status
+ (equal (cdr (assq 'state ampc-status)) "play")))
+ (tool-bar-local-item
+ "mpc/stop" (lambda () (interactive) (ampc-toggle-play 4)) 'stop map
+ :help "Stop"
+ :visible '(and ampc-status
+ (equal (cdr (assq 'state ampc-status)) "play")))
+ (tool-bar-local-item
+ "mpc/next" 'ampc-next 'next map
+ :help "Next")
+ map))
+
;;; ** code
;;; *** macros
(defmacro ampc-with-buffer (type &rest body)
@@ -587,11 +612,11 @@ all the time!"
(define-derived-mode ampc-item-mode ampc-mode ""
nil)
-(define-derived-mode ampc-mode fundamental-mode "ampc"
+(define-derived-mode ampc-mode special-mode "ampc"
nil
(buffer-disable-undo)
- (setf buffer-read-only t
- truncate-lines ampc-truncate-lines
+ (set (make-local-variable 'tool-bar-map) ampc-tool-bar-map)
+ (setf truncate-lines ampc-truncate-lines
font-lock-defaults '((("^\\(\\*\\)\\(.*\\)$"
(1 'ampc-mark-face)
(2 'ampc-marked-face))