[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bongo-patches] Display progress of the currently playing track directly
From: |
Daniel Brockman |
Subject: |
[bongo-patches] Display progress of the currently playing track directly in the playlist buffer |
Date: |
Thu, 26 Apr 2007 04:13:54 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.92 (gnu/linux) |
Display progress of the currently playing track directly in
the playlist buffer.
diff -rN -u old-bongo/bongo.el new-bongo/bongo.el
--- old-bongo/bongo.el 2007-04-26 04:13:40.000000000 +0200
+++ new-bongo/bongo.el 2007-04-26 04:13:40.000000000 +0200
@@ -1771,6 +1771,11 @@
"Face used for already played Bongo tracks."
:group 'bongo-faces)
+(defface bongo-elapsed-track-part
+ '((t (:strike-through "#808080")))
+ "Face used for the elapsed part of the currently playing Bongo track."
+ :group 'bongo-faces)
+
(defface bongo-currently-playing-track
'((t (:weight bold :inherit bongo-track)))
"Face used for the currently playing Bongo track."
@@ -4606,7 +4611,22 @@
(when bongo-header-line-mode
(bongo-update-header-line-string))
(when bongo-mode-line-indicator-mode
- (bongo-update-mode-line-indicator-string)))
+ (bongo-update-mode-line-indicator-string))
+ (catch 'abort
+ ;; While `save-excursion' is good for making sure
+ ;; that point stays on the same line in all cases,
+ ;; it cannot bring point back to the original column
+ ;; (because of how `bongo-redisplay-line' works).
+ (let ((point (when (bongo-current-track-line-p)
+ (point))))
+ (save-excursion
+ (goto-char (or (bongo-point-at-current-track-line)
+ (throw 'abort nil)))
+ (bongo-line-set-property 'bongo-track-length
+ (bongo-player-total-time player))
+ (bongo-redisplay-line))
+ (when point
+ (goto-char point)))))
(when (bufferp bongo-seek-buffer)
(bongo-seek-redisplay))))
@@ -8009,6 +8029,19 @@
(when (bongo-marked-track-line-p)
(let ((bongo-facify-below-existing-faces t))
(bongo-facify-current-line 'bongo-marked-track-line)))
+ (when (and (bongo-currently-playing-track-line-p)
+ (bongo-elapsed-time)
+ (bongo-total-time))
+ (let* ((end (- (window-width) 2))
+ (middle (floor (* end
+ (/ (bongo-elapsed-time)
+ (bongo-total-time))))))
+ (insert (make-string (max 0 (- end (current-column))) 32))
+ (goto-char (point-at-bol))
+ (while (< (current-column) middle)
+ (forward-char 1))
+ (bongo-facify-region (point-at-bol) (point)
+ 'bongo-elapsed-track-part)))
(when invisible
(put-text-property (bongo-point-before-line)
(bongo-point-after-line)
--
Daniel Brockman <address@hidden>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [bongo-patches] Display progress of the currently playing track directly in the playlist buffer,
Daniel Brockman <=