[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bongo-patches] Add [Fast-forward] and [Rewind] and combined [Fast-forwa
From: |
Daniel Brockman |
Subject: |
[bongo-patches] Add [Fast-forward] and [Rewind] and combined [Fast-forward/Next] and [Rewind/Previous] mode line buttons and display the combined buttons by default |
Date: |
Sat, 28 Apr 2007 00:59:42 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.92 (gnu/linux) |
Add [Fast-forward] and [Rewind] and combined [Fast-forward/Next]
and [Rewind/Previous] mode line buttons and display the combined
buttons by default.
diff -rN -u old-bongo/bongo.el new-bongo/bongo.el
--- old-bongo/bongo.el 2007-04-28 00:58:53.000000000 +0200
+++ new-bongo/bongo.el 2007-04-28 00:58:53.000000000 +0200
@@ -1020,10 +1020,10 @@
(defcustom bongo-mode-line-indicator-format
'((bongo-mode-line-pad-string)
(when (bongo-hyphen-padded-mode-line-p) "[")
- (bongo-mode-line-previous-button)
+ (bongo-mode-line-backward/previous-button)
(bongo-mode-line-pause/resume-button)
(bongo-mode-line-start/stop-button)
- (bongo-mode-line-next-button)
+ (bongo-mode-line-forward/next-button)
(when (bongo-playing-p) " ")
(when (bongo-playing-p)
(cond ((and (bongo-elapsed-time) (bongo-total-time))
@@ -1055,6 +1055,14 @@
(bongo-mode-line-previous-button))
(const :tag "[Next] button"
(bongo-mode-line-next-button))
+ (const :tag "[Fast-forward] button"
+ (bongo-mode-line-forward-button))
+ (const :tag "[Rewind] button"
+ (bongo-mode-line-backward-button))
+ (const :tag "Combined [Rewind/Previous] button"
+ (bongo-mode-line-backward/previous-button))
+ (const :tag "Combined [Fast-forward/Next] button"
+ (bongo-mode-line-forward/next-button))
(const :tag "Elapsed time"
(when (bongo-playing-p)
(bongo-format-seconds (bongo-elapsed-time))))
@@ -1288,6 +1296,112 @@
\"....................\",
\"....................\",
\"....................\",
+\"....###.......##....\",
+\"....###......###....\",
+\"....###.....####....\",
+\"....###....#####....\",
+\"....###...######....\",
+\"....###...######....\",
+\"....###....#####....\",
+\"....###.....####....\",
+\"....###......###....\",
+\"....###.......##....\",
+\"....................\",
+\"....................\",
+\"....................\",
+\"....................\"
+};"))
+ "Bongo [Previous] button icon (18 pixels tall)")
+
+(defvar bongo-mode-line-previous-icon-11
+ '`(image :type xpm :ascent center :data ,(concat "/* XPM */
+static char *previous_11[] = {
+/* width height number of colors number of characters per pixel */
+\" 11 11 2 1\",
+/* colors */
+\"# c " bongo-mode-line-icon-color "\",
+\". c None\",
+/* pixels */
+\"...........\",
+\"...........\",
+\"..##....#..\",
+\"..##...##..\",
+\"..##..###..\",
+\"..##.####..\",
+\"..##..###..\",
+\"..##...##..\",
+\"..##....#..\",
+\"...........\",
+\"...........\"
+};"))
+ "Bongo [Previous] button icon (11 pixels tall).")
+
+(defvar bongo-mode-line-next-icon-18
+ '`(image :type xpm :ascent center :data ,(concat "/* XPM */
+static char *next_18[] = {
+/* width height number of colors number of characters per pixel */
+\" 20 18 2 1\",
+/* colors */
+\"# c " bongo-mode-line-icon-color "\",
+\". c None\",
+/* pixels */
+\"....................\",
+\"....................\",
+\"....................\",
+\"....................\",
+\"....##.......###....\",
+\"....###......###....\",
+\"....####.....###....\",
+\"....#####....###....\",
+\"....######...###....\",
+\"....######...###....\",
+\"....#####....###....\",
+\"....####.....###....\",
+\"....###......###....\",
+\"....##.......###....\",
+\"....................\",
+\"....................\",
+\"....................\",
+\"....................\"
+};"))
+ "Bongo [Next] button icon (18 pixels tall)")
+
+(defvar bongo-mode-line-next-icon-11
+ '`(image :type xpm :ascent center :data ,(concat "/* XPM */
+static char *next_11[] = {
+/* width height number of colors number of characters per pixel */
+\" 11 11 2 1\",
+/* colors */
+\"# c " bongo-mode-line-icon-color "\",
+\". c None\",
+/* pixels */
+\"...........\",
+\"...........\",
+\"..#....##..\",
+\"..##...##..\",
+\"..###..##..\",
+\"..####.##..\",
+\"..###..##..\",
+\"..##...##..\",
+\"..#....##..\",
+\"...........\",
+\"...........\"
+};"))
+ "Bongo [Next] button icon (11 pixels tall).")
+
+(defvar bongo-mode-line-backward-icon-18
+ '`(image :type xpm :ascent center :data ,(concat "/* XPM */
+static char *previous_18[] = {
+/* width height number of colors number of characters per pixel */
+\" 20 18 2 1\",
+/* colors */
+\"# c " bongo-mode-line-icon-color "\",
+\". c None\",
+/* pixels */
+\"....................\",
+\"....................\",
+\"....................\",
+\"....................\",
\"....................\",
\"......##......##....\",
\".....###.....###....\",
@@ -1303,9 +1417,9 @@
\"....................\",
\"....................\"
};"))
- "Bongo [Previous] button icon (18 pixels tall).")
+ "Bongo [Rewind] button icon (18 pixels tall).")
-(defvar bongo-mode-line-previous-icon-11
+(defvar bongo-mode-line-backward-icon-11
'`(image :type xpm :ascent center :data ,(concat "/* XPM */
static char *previous_11[] = {
/* width height number of colors number of characters per pixel */
@@ -1326,9 +1440,9 @@
\"...........\",
\"...........\"
};"))
- "Bongo [Previous] button icon (11 pixels tall).")
+ "Bongo [Rewind] button icon (11 pixels tall).")
-(defvar bongo-mode-line-next-icon-18
+(defvar bongo-mode-line-forward-icon-18
'`(image :type xpm :ascent center :data ,(concat "/* XPM */
static char *next_18[] = {
/* width height number of colors number of characters per pixel */
@@ -1356,9 +1470,9 @@
\"....................\",
\"....................\"
};"))
- "Bongo [Next] button icon (18 pixels tall).")
+ "Bongo [Fast-forward] button icon (18 pixels tall).")
-(defvar bongo-mode-line-next-icon-11
+(defvar bongo-mode-line-forward-icon-11
'`(image :type xpm :ascent center :data ,(concat "/* XPM */
static char *next_11[] = {
/* width height number of colors number of characters per pixel */
@@ -1379,7 +1493,7 @@
\"...........\",
\"...........\"
};"))
- "Bongo [Next] button icon (11 pixels tall).")
+ "Bongo [Fast-forward] button icon (11 pixels tall).")
(defvar bongo-mode-line-start-map
(let ((map (make-sparse-keymap)))
@@ -1433,17 +1547,41 @@
(define-key map [mode-line mouse-3]
(lambda (e)
(interactive "e")
+ (bongo-play-previous))))))
+
+(defvar bongo-mode-line-next-map
+ (let ((map (make-sparse-keymap)))
+ (prog1 map
+ (define-key map [mode-line mouse-1]
+ (lambda (e)
+ (interactive "e")
+ (bongo-play-next)))
+ (define-key map [mode-line mouse-3]
+ (lambda (e)
+ (interactive "e")
+ (bongo-play-next))))))
+
+(defvar bongo-mode-line-backward-map
+ (let ((map (make-sparse-keymap)))
+ (prog1 map
+ (define-key map [mode-line mouse-1]
+ (lambda (e)
+ (interactive "e")
+ (bongo-seek-backward-10)))
+ (define-key map [mode-line mouse-3]
+ (lambda (e)
+ (interactive "e")
(if (bongo-buffer-p)
(bongo-switch-buffers)
(bongo)))))))
-(defvar bongo-mode-line-next-map
+(defvar bongo-mode-line-forward-map
(let ((map (make-sparse-keymap)))
(prog1 map
(define-key map [mode-line mouse-1]
(lambda (e)
(interactive "e")
- (bongo-play-next)))
+ (bongo-seek-forward-10)))
(define-key map [mode-line mouse-3]
(lambda (e)
(interactive "e")
@@ -1451,6 +1589,30 @@
(bongo-switch-buffers)
(bongo)))))))
+(defvar bongo-mode-line-backward/previous-map
+ (let ((map (make-sparse-keymap)))
+ (prog1 map
+ (define-key map [mode-line mouse-1]
+ (lambda (e)
+ (interactive "e")
+ (bongo-seek-backward-10)))
+ (define-key map [mode-line mouse-3]
+ (lambda (e)
+ (interactive "e")
+ (bongo-previous))))))
+
+(defvar bongo-mode-line-forward/next-map
+ (let ((map (make-sparse-keymap)))
+ (prog1 map
+ (define-key map [mode-line mouse-1]
+ (lambda (e)
+ (interactive "e")
+ (bongo-seek-forward-10)))
+ (define-key map [mode-line mouse-3]
+ (lambda (e)
+ (interactive "e")
+ (bongo-next))))))
+
(defun bongo-face-height (face-name)
"Return the height of the font used for FACE-NAME, or nil.
If running without a window system, signal an error."
@@ -1483,7 +1645,14 @@
(eval bongo-mode-line-resume-icon-18))
((= icon-size 11)
(eval bongo-mode-line-resume-icon-11)))
- 'help-echo (concat "mouse-1: start playback")
+ 'help-echo
+ (let ((position (bongo-point-at-current-track-line)))
+ (concat "mouse-1: "
+ (if position
+ (concat "play "
+ (bongo-format-infoset
+ (bongo-line-infoset position)))
+ "start playback")))
'local-map bongo-mode-line-start-map
'mouse-face 'highlight)
(when (>= emacs-major-version 22)
@@ -1594,6 +1763,130 @@
(when (>= emacs-major-version 22)
(propertize " " 'display '(space :width (1))))))))
+(defun bongo-mode-line-backward-button ()
+ "Return the string to use as [Backward] button in the mode line."
+ (when (and window-system (bongo-playing-p) (bongo-seeking-supported-p))
+ (let ((icon-size (bongo-mode-line-icon-size)))
+ (concat
+ (when (>= emacs-major-version 22)
+ (propertize " " 'display '(space :width (1))))
+ (propertize " "
+ 'display (cond ((= icon-size 18)
+ (eval bongo-mode-line-backward-icon-18))
+ ((= icon-size 11)
+ (eval bongo-mode-line-backward-icon-11)))
+ 'help-echo "mouse-1: rewind 10 seconds"
+ 'local-map bongo-mode-line-backward-map
+ 'mouse-face 'highlight)
+ (when (>= emacs-major-version 22)
+ (propertize " " 'display '(space :width (1))))))))
+
+(defun bongo-mode-line-forward-button ()
+ "Return the string to use as [Forward] button in the mode line."
+ (when (and window-system (bongo-playing-p) (bongo-seeking-supported-p))
+ (let ((icon-size (bongo-mode-line-icon-size)))
+ (concat
+ (when (>= emacs-major-version 22)
+ (propertize " " 'display '(space :width (1))))
+ (propertize " "
+ 'display (cond ((= icon-size 18)
+ (eval bongo-mode-line-forward-icon-18))
+ ((= icon-size 11)
+ (eval bongo-mode-line-forward-icon-11)))
+ 'help-echo "mouse-1: fast-forward 10 seconds"
+ 'local-map bongo-mode-line-forward-map
+ 'mouse-face 'highlight)
+ (when (>= emacs-major-version 22)
+ (propertize " " 'display '(space :width (1))))))))
+
+(defun bongo-mode-line-backward/previous-button ()
+ "Return the string to use as [Rewind/Previous] button."
+ (when (and window-system
+ ;; This condition could be made optional.
+ (bongo-playing-p))
+ (let ((icon-size (bongo-mode-line-icon-size)))
+ (concat
+ (when (>= emacs-major-version 22)
+ (propertize " " 'display '(space :width (1))))
+ (propertize " "
+ 'display
+ (if (bongo-playing-p)
+ (cond ((= icon-size 18)
+ (eval bongo-mode-line-backward-icon-18))
+ ((= icon-size 11)
+ (eval bongo-mode-line-backward-icon-11)))
+ (cond ((= icon-size 18)
+ (eval bongo-mode-line-previous-icon-18))
+ ((= icon-size 11)
+ (eval bongo-mode-line-previous-icon-11))))
+ 'help-echo
+ (let ((position
+ (and (bongo-point-at-current-track-line)
+ (bongo-point-at-previous-track-line
+ (bongo-point-at-current-track-line)))))
+ (concat (when (and (bongo-playing-p)
+ (bongo-seeking-supported-p))
+ "mouse-1: rewind 10 seconds")
+ (if position
+ (concat (if (bongo-playing-p)
+ "\nmouse-3: "
+ "mouse-1: ")
+ "play "
+ (bongo-format-infoset
+ (bongo-line-infoset position)))
+ (unless (bongo-playing-p)
+ "No previous track"))))
+ 'local-map (if (bongo-playing-p)
+ bongo-mode-line-backward/previous-map
+ bongo-mode-line-backward-map)
+ 'mouse-face 'highlight)
+ (when (>= emacs-major-version 22)
+ (propertize " " 'display '(space :width (1))))))))
+
+(defun bongo-mode-line-forward/next-button ()
+ "Return the string to use as [Fast-forward/Next] button."
+ (when (and window-system
+ ;; This condition could be made optional.
+ (bongo-playing-p))
+ (let ((icon-size (bongo-mode-line-icon-size)))
+ (concat
+ (when (>= emacs-major-version 22)
+ (propertize " " 'display '(space :width (1))))
+ (propertize " "
+ 'display
+ (if (bongo-playing-p)
+ (cond ((= icon-size 18)
+ (eval bongo-mode-line-forward-icon-18))
+ ((= icon-size 11)
+ (eval bongo-mode-line-forward-icon-11)))
+ (cond ((= icon-size 18)
+ (eval bongo-mode-line-next-icon-18))
+ ((= icon-size 11)
+ (eval bongo-mode-line-next-icon-11))))
+ 'help-echo
+ (let ((position
+ (and (bongo-point-at-current-track-line)
+ (bongo-point-at-next-track-line
+ (bongo-point-at-current-track-line)))))
+ (concat (when (and (bongo-playing-p)
+ (bongo-seeking-supported-p))
+ "mouse-1: fast-forward 10 seconds")
+ (if position
+ (concat (if (bongo-playing-p)
+ "\nmouse-3: "
+ "mouse-1: ")
+ "play "
+ (bongo-format-infoset
+ (bongo-line-infoset position)))
+ (unless (bongo-playing-p)
+ "No next track"))))
+ 'local-map (if (bongo-playing-p)
+ bongo-mode-line-forward/next-map
+ bongo-mode-line-next-map)
+ 'mouse-face 'highlight)
+ (when (>= emacs-major-version 22)
+ (propertize " " 'display '(space :width (1))))))))
+
(defvar bongo-mode-line-indicator-string nil
"Bongo mode line indicator string.
Value is derived from `bongo-mode-line-indicator-format'.
--
Daniel Brockman <address@hidden>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [bongo-patches] Add [Fast-forward] and [Rewind] and combined [Fast-forward/Next] and [Rewind/Previous] mode line buttons and display the combined buttons by default,
Daniel Brockman <=