bongo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bongo-devel] Re: Line icons


From: Daniel Brockman
Subject: Re: [bongo-devel] Re: Line icons
Date: Sat, 10 Feb 2007 17:31:55 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.51 (gnu/linux)

address@hidden (Daniel Jensen) writes:

> Daniel Brockman <address@hidden> writes:
>
>> We could use GNOME icons instead.  Look at this:
>>
>>    <http://wigwam.brockman.se/~daniel/bongo-line-icons.png>
>>
>> Using GNOME icons is probably a good idea anyway, though,
>> for the purpose of visual desktop consistency.
>
> Yes, this makes sense.
>
> I like the video icons, and I was about to propose that
> idea.  How about using the following code?  It has other
> uses too.
>
> (defcustom bongo-video-file-name-extensions
>   '("asf" "avi" "flv" "mka" "mov" "mp4" "mpeg" "mpg"
>     "ogm" "qt" "rm" "rmvb" "ts" "vob" "wmv")
>   "A list of video file name extensions recognized by Bongo."
>   :type '(repeat string)
>   :group 'bongo-file-names)
>
> (defun bongo-video-file-name-p (file-name)
>   "True if FILE-NAME has a recognized video file name extension.
> See `bongo-video-file-name-extensions' for the list of extensions."
>   (bongo-file-name-matches-p
>     file-name `(local-file ,@bongo-video-file-name-extensions)))

Yeah.  Here's the patch I'm using now:

diff -rN -u old-bongo/bongo.el new-bongo/bongo.el
--- old-bongo/bongo.el  2007-02-10 16:39:15.000000000 +0100
+++ new-bongo/bongo.el  2007-02-10 16:39:15.000000000 +0100
@@ -661,6 +661,127 @@
   :type 'string
   :group 'bongo-display)
 
+(defgroup bongo-line-icons nil
+  "Display of line icons in Bongo playlist and library buffers."
+  :group 'bongo-display)
+
+(defcustom bongo-display-track-line-icons t
+  "Whether to display icons for track lines in Bongo buffers."
+  :type 'boolean
+  :group 'bongo-line-icons
+  :group 'bongo-display)
+
+(defcustom bongo-display-mark-icons t
+  "Whether to display icons for marks in Bongo buffers."
+  :type 'boolean
+  :group 'bongo-line-icons
+  :group 'bongo-display)
+
+(defcustom bongo-unknown-local-file-track-icon
+  "unknown-local-file-track.png"
+  "File name of icon to use for unknown local file tracks."
+  :type '(choice file (const :tag "None" nil))
+  :group 'bongo-line-icons)
+
+(defcustom bongo-local-audio-file-track-icon
+  "local-audio-file-track.png"
+  "File name of icon to use for local audio file tracks.
+If nil, use the same icon as for unknown local file tracks."
+  :type '(choice file (const :tag "\
+Same as for unknown local file tracks" nil))
+  :group 'bongo-line-icons)
+
+(defcustom bongo-local-video-file-track-icon
+  "local-video-file-track.png"
+  "File name of icon to use for video file tracks.
+If nil, use the same icon as for unknown file tracks."
+  :type '(choice file (const :tag "\
+Same as for unknown local file tracks" nil))
+  :group 'bongo-line-icons)
+
+(defcustom bongo-audio-cd-track-icon "audio-cd-track.png"
+  "File name of icon to use for audio CD tracks.
+If nil, use the same icon as for local audio file tracks."
+  :type '(choice file (const :tag "\
+Same as for local audio file tracks" nil))
+  :group 'bongo-line-icons)
+
+(defcustom bongo-uri-track-icon "uri-track.png"
+  "File name of icon to use for URI tracks.
+If nil, do not use any icon at all."
+  :type '(choice file (const :tag "None" nil))
+  :group 'bongo-line-icons)
+
+(defcustom bongo-action-track-icon "action-track.png"
+  "File name of icon to use for action tracks.
+If nil, do not use any icon at all."
+  :type '(choice file (const :tag "None" nil))
+  :group 'bongo-line-icons)
+
+(defcustom bongo-currently-playing-track-icon nil
+  "File name of icon to use for currently playing tracks.
+If nil, use the same icon as for other tracks."
+  :type '(choice file (const :tag "Same as for other tracks" nil))
+  :group 'bongo-line-icons)
+
+(defcustom bongo-played-track-icon nil
+  "File name of icon to use for played track lines.
+If nil, use the same icon as for unplayed tracks."
+  :type '(choice file (const :tag "Same as for other tracks" nil))
+  :group 'bongo-line-icons)
+
+(defcustom bongo-expanded-header-icon nil
+  "File name of icon to use for header lines of expanded sections.
+If nil, do not use any icon."
+  :type '(choice file (const :tag "None" nil))
+  :group 'bongo-line-icons)
+
+(defcustom bongo-collapsed-header-icon nil
+  "File name of icon to use for header lines of collapsed sections.
+If nil, do not use any icon."
+  :type '(choice file (const :tag "None" nil))
+  :group 'bongo-line-icons)
+
+(defcustom bongo-mark-icon "white-flag.png"
+  "File name of icon to use for track marks.
+If nil, use `bongo-mark-format'."
+  :type '(choice file (const :tag "None" nil))
+  :group 'bongo-line-icons)
+
+(defun bongo-track-icon-for-line ()
+  "Return the track image to use for the current line."
+  (let ((icon-file
+         (cond ((bongo-header-line-p)
+                (if (bongo-collapsed-header-line-p)
+                    bongo-collapsed-header-icon
+                  bongo-expanded-header-icon))
+               ((and (bongo-currently-playing-track-line-p)
+                     bongo-currently-playing-track-icon)
+                bongo-currently-playing-track-icon)
+               ((and (bongo-played-track-line-p)
+                     bongo-played-track-icon)
+                bongo-played-track-icon)
+               ((bongo-audio-cd-track-line-p)
+                bongo-audio-cd-track-icon)
+               ((bongo-uri-track-line-p)
+                bongo-uri-track-icon)
+               ((bongo-action-track-line-p)
+                bongo-action-track-icon)
+               ((bongo-local-audio-file-track-line-p)
+                (or bongo-local-audio-file-track-icon
+                    bongo-unknown-local-file-track-icon))
+               ((bongo-local-video-file-track-line-p)
+                (or bongo-local-video-file-track-icon
+                    bongo-unknown-local-file-track-icon))
+               ((bongo-local-file-track-line-p)
+                bongo-unknown-local-file-track-icon))))
+    (when icon-file
+      (find-image
+       (list (list :ascent 'center
+                   :file icon-file
+                   :type (image-type-from-file-name icon-file)
+                   :background (face-background 'default)))))))
+
 (defgroup bongo-header-line nil
   "Display of header lines in Bongo playlist buffers."
   :group 'bongo
@@ -2580,11 +2701,46 @@
   (and (bongo-file-track-line-p point)
        (bongo-uri-p (bongo-line-file-name point))))
 
+(defun bongo-audio-cd-track-line-p (&optional point)
+  "Return non-nil if the line at POINT is an audio CD track line."
+  (and (bongo-file-track-line-p point)
+       (bongo-file-name-matches-p (bongo-line-file-name point)
+                                  '("cdda:" . t))))
+                    
 (defun bongo-local-file-track-line-p (&optional point)
   "Return non-nil if the line at POINT is a local file track line."
   (and (bongo-file-track-line-p point)
        (not (bongo-uri-track-line-p point))))
 
+(defcustom bongo-audio-file-name-extensions
+  `("ogg" "flac" "spx" "mka" "mp3" "wav" "wma"
+    "mid" "midi" "mod" "rcp" "r36" "g18" "g36"
+    "669" "amf" "dsm" "far" "gdm" "imf"
+    "it" "med" "mod" "mtm" "okt" "s3m"
+    "stm" "stx" "ult" "uni" "apun" "xm")
+  "List of file name extensions of audio files."
+  :type '(repeat string)
+  :group 'bongo-file-names)
+
+(defun bongo-local-audio-file-track-line-p (&optional point)
+  "Return non-nil if the line at POINT is an audio file track line."
+  (and (bongo-local-file-track-line-p point)
+       (member (file-name-extension (bongo-line-file-name point))
+               bongo-audio-file-name-extensions)))
+
+(defcustom bongo-video-file-name-extensions
+  `("ogm" "avi" "mpg" "mpeg" "mp4" "vob" "mkv"
+    "mov" "asf" "wmv" "rm" "rmvb" "ts")
+  "List of file name extensions of video files."
+  :type '(repeat string)
+  :group 'bongo-file-names)
+
+(defun bongo-local-video-file-track-line-p (&optional point)
+  "Return non-nil if the line at POINT is an video file track line."
+  (and (bongo-local-file-track-line-p point)
+       (member (file-name-extension (bongo-line-file-name point))
+               bongo-video-file-name-extensions)))
+
 (defun bongo-action-track-line-p (&optional point)
   "Return non-nil if the line at POINT is an action track line."
   (bongo-line-action point))
@@ -3132,7 +3288,8 @@
 (defcustom bongo-mark-format '("* ")
   "Template for displaying marks in Bongo.
 Value is a list of expressions, each evaluating to a string or nil.
-The values of the expressions are concatenated."
+The values of the expressions are concatenated.
+This is overridden by the variable `bongo-mark-icon', if non-nil."
   :type '(repeat sexp)
   :group 'bongo-display)
 
@@ -6899,6 +7056,11 @@
           (delete-char (min (length mark-string)
                             (- (bongo-point-at-eol) (point)))))
         (bongo-end-of-line))
+      (when bongo-display-track-line-icons
+        (let ((icon (bongo-track-icon-for-line))) 
+          (when icon
+            (insert-image icon)
+            (insert " "))))
       (let* ((bongo-infoset-formatting-target
               (current-buffer))
              (bongo-infoset-formatting-target-line
So I independently wrote almost the same thing.  Your video
file name extension list is more extensive, however. :-)

Also, you're right in that `bongo-video-file-name-p' is in
itself useful.  (Your stop hack could use it, for example.)

> Daniel Brockman <address@hidden> also writes:
>
>> I'm thinking that at 16x16, maybe we shouldn't try to
>> squeeze too much into one icon.  Putting two icons next to
>> each other makes more sense to me --- especially if you
>> consider how much easier it is to handle N + M simple icons
>> compared to N * M complex icons (one for each combination).
>
> I don't know about two icons on one line, seems a little
> weird to me.

Well, I was talking mainly about the fringe icons.
We have `playing', `paused', and `stopped' icons there.

> I'm thinking now that the best default setting is to have
> only the simple icons (tracks, headers).  The extra stuff
> might be a bit too redundant.

Yeah, I think so too.

> But we can have it set using the icons for played tracks,
> playing tracks, playing URI tracks and so on, and they
> will default to the simpler icons.  So the user that wants
> the full icon show can customize that.

Although the patch I posted above does support `playing'
and `played' icons, it does not support the N * M setup.


Anyway, I don't have any icons for header lines yet.
Suggestions anyone?


-- 
Daniel Brockman <address@hidden>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]