unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
Cc: drew.adams@oracle.com, emacs-devel@gnu.org
Subject: Re: tumme testing
Date: Tue, 14 Feb 2006 19:45:34 +0200	[thread overview]
Message-ID: <87acct98z4.fsf@jurta.org> (raw)
In-Reply-To: <20060214061826.GC10615@www.trapp.net> (Tomas Zerolo's message of "Tue, 14 Feb 2006 07:18:26 +0100")

>> Quick! - which is bigger, Enormous or Huge? Such names are opaque on their
>> own - users will need to look up what they mean anyway.
>
> Ot1h you're right...
>
>> Why not just use the size as the name, without adding the vague translation?
>> "256x256" is a perfectly good name, and it gives you a clear idea of the
>> size.
>
> ...otoh, a layer of indirection allows adapting to different screen
> resolutions and user preferences with more ease. Personally, I'd prefer
> the size names, to be able to change the mapping to real sizes as a
> whole.

Nothing prevents us from having both types of size specifications:

Index: lisp/tumme.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/tumme.el,v
retrieving revision 1.17
diff -c -r1.17 tumme.el
*** lisp/tumme.el	13 Feb 2006 14:45:58 -0000	1.17
--- lisp/tumme.el	14 Feb 2006 17:44:04 -0000
***************
*** 428,447 ****
    :type '(repeat string)
    :group 'tumme)
  
! (defcustom tumme-thumb-size (if (eq 'standard tumme-thumbnail-storage) 128 100)
!   "Size of thumbnails, in pixels.
! This is the default size for both `tumme-thumb-width' and `tumme-thumb-height'."
!   :type 'integer
!   :group 'tumme)
! 
! (defcustom tumme-thumb-width tumme-thumb-size
!   "Width of thumbnails, in pixels."
!   :type 'integer
!   :group 'tumme)
! 
! (defcustom tumme-thumb-height tumme-thumb-size
!   "Height of thumbnails, in pixels."
!   :type 'integer
    :group 'tumme)
  
  (defcustom tumme-thumb-relief 2
--- 428,449 ----
    :type '(repeat string)
    :group 'tumme)
  
! (defvar tumme-thumb-size-name-geometry-alist
!   '(("Very small" .  "32x32")
!     ("Small"      .  "64x64")
!     ("Medium"     . "128x128")
!     ("Normal"     . "128x128")
!     ("Large"      . "256x256"))
!   "Size name to geometry mapping.")
! 
! (defcustom tumme-thumb-geometry "Normal"
!   "Default thumbnail geometry.
! This should have either a form like \"128x128\" where the first number is the
! thumbnail width and the second number is the thumbnail height, or a size name
! matching one of the size names in `tumme-thumb-size-name-geometry-alist'."
!   :type `(choice ,@(mapcar (lambda (e) `(const ,(car e)))
!                            tumme-thumb-size-name-geometry-alist)
!                  (string :tag "Geometry"))
    :group 'tumme)
  
  (defcustom tumme-thumb-relief 2
***************
*** 622,630 ****
                   ;; "cryptographically" good so a faster one could
                   ;; be used here.
                   (md5 (file-name-as-directory (file-name-directory f)))))
!            (format "%s%s%s.thumb.%s"
                     (file-name-as-directory (expand-file-name (tumme-dir)))
                     (file-name-sans-extension (file-name-nondirectory f))
                     (if md5-hash (concat "_" md5-hash) "")
                     (file-name-extension f))))
          ((eq 'per-directory tumme-thumbnail-storage)
--- 624,633 ----
                   ;; "cryptographically" good so a faster one could
                   ;; be used here.
                   (md5 (file-name-as-directory (file-name-directory f)))))
!            (format "%s%s_%s%s.thumb.%s"
                     (file-name-as-directory (expand-file-name (tumme-dir)))
                     (file-name-sans-extension (file-name-nondirectory f))
+                    tumme-thumb-geometry
                     (if md5-hash (concat "_" md5-hash) "")
                     (file-name-extension f))))
          ((eq 'per-directory tumme-thumbnail-storage)
***************
*** 634,643 ****
                     (file-name-sans-extension (file-name-nondirectory f))
                     (file-name-extension f))))))
  
  (defun tumme-create-thumb (original-file thumbnail-file)
    "For ORIGINAL-FILE, create thumbnail image named THUMBNAIL-FILE."
!   (let* ((width (int-to-string tumme-thumb-width))
!          (height (int-to-string tumme-thumb-height))
           (modif-time (format "%.0f" (float-time (nth 5 (file-attributes
                                                          original-file)))))
           (thumbnail-nq8-file (replace-regexp-in-string ".png\\'" "-nq8.png"
--- 637,660 ----
                     (file-name-sans-extension (file-name-nondirectory f))
                     (file-name-extension f))))))
  
+ (defun tumme-thumb-width-and-height (&optional geometry)
+   "Return a cons-cell of pixels for width and height of thumbnail geometry.
+ Extract these numbers either from the optional argument `geometry' or
+ the default value of `tumme-thumb-geometry'.
+ Use `tumme-thumb-size-name-geometry-alist' as the size name to geometry mapping."
+   (setq geometry (or (cdr (assoc (or geometry tumme-thumb-geometry)
+                                  tumme-thumb-size-name-geometry-alist))
+                      (or geometry tumme-thumb-geometry)))
+   (save-match-data
+     (if (string-match "\\([0-9]+\\)x\\([0-9]+\\)" geometry)
+         (cons (match-string 1 geometry)
+               (match-string 2 geometry)))))
+ 
  (defun tumme-create-thumb (original-file thumbnail-file)
    "For ORIGINAL-FILE, create thumbnail image named THUMBNAIL-FILE."
!   (let* ((width-and-height (tumme-thumb-width-and-height))
!          (width (car width-and-height))
!          (height (cdr width-and-height))
           (modif-time (format "%.0f" (float-time (nth 5 (file-attributes
                                                          original-file)))))
           (thumbnail-nq8-file (replace-regexp-in-string ".png\\'" "-nq8.png"
***************
*** 1705,1711 ****
           (/ width
              (+ (* 2 tumme-thumb-relief)
                 (* 2 tumme-thumb-margin)
!                tumme-thumb-width char-width))))
      (tumme-line-up)))
  
  (defun tumme-line-up-interactive ()
--- 1722,1728 ----
           (/ width
              (+ (* 2 tumme-thumb-relief)
                 (* 2 tumme-thumb-margin)
!                (car (tumme-thumb-width-and-height)) char-width))))
      (tumme-line-up)))
  
  (defun tumme-line-up-interactive ()

-- 
Juri Linkov
http://www.jurta.org/emacs/

  reply	other threads:[~2006-02-14 17:45 UTC|newest]

Thread overview: 124+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-25  1:08 thumbs.el and transparency Nick Roberts
2006-01-25  7:59 ` Juri Linkov
2006-01-25  9:20   ` Nick Roberts
2006-01-26 18:54     ` Mathias Dahl
2006-01-26 21:59       ` Nick Roberts
2006-01-27  3:46         ` Miles Bader
2006-01-27  9:27           ` Nick Roberts
2006-01-28  4:50             ` Richard M. Stallman
2006-01-28 23:58               ` Nick Roberts
2006-01-29 13:41                 ` Mathias Dahl
2006-01-29 21:10                   ` Nick Roberts
2006-01-29 22:42                     ` Mathias Dahl
2006-01-30 10:26                 ` Kim F. Storm
2006-01-30 11:23                   ` Juanma Barranquero
2006-01-30 15:12                     ` Chong Yidong
2006-01-30 15:41                       ` Juanma Barranquero
2006-01-30 18:43                         ` Chong Yidong
2006-01-31 15:31                         ` CUA-related problem (was: Re: thumbs.el and transparency) Kim F. Storm
2006-01-31 15:41                           ` Juanma Barranquero
2006-01-31 18:19                             ` Luc Teirlinck
2006-01-31 19:32                               ` Juanma Barranquero
2006-01-31 18:04                         ` thumbs.el and transparency Richard M. Stallman
2006-01-31 19:47                           ` Juanma Barranquero
2006-01-31 21:10                             ` Luc Teirlinck
2006-01-31 23:08                               ` Kim F. Storm
2006-01-31 23:45                                 ` Luc Teirlinck
2006-02-01 10:41                                   ` Kim F. Storm
2006-02-02  2:07                                     ` Luc Teirlinck
2006-02-02  9:26                                       ` Juanma Barranquero
2006-02-02  9:35                                       ` Kim F. Storm
2006-01-31 23:54                                 ` Luc Teirlinck
2006-02-01 10:45                                 ` Juanma Barranquero
2006-01-30 23:25                     ` Richard M. Stallman
2006-01-31  9:26                       ` Juanma Barranquero
2006-01-29  9:38               ` Sascha Wilde
2006-01-29 13:46                 ` Mathias Dahl
2006-01-29 16:38                   ` Miles Bader
2006-01-29 18:13                     ` David Kastrup
2006-01-29 22:35                     ` Mathias Dahl
2006-01-29 16:50                   ` David Kastrup
2006-01-29 22:33                     ` Mathias Dahl
2006-01-27 16:53           ` Mathias Dahl
2006-01-29  0:03             ` Nick Roberts
2006-01-30  0:56               ` Richard M. Stallman
2006-01-30 11:35                 ` Mathias Dahl
2006-01-29  2:33             ` Miles Bader
2006-01-29 14:07               ` Mathias Dahl
2006-01-29 14:34               ` Mathias Dahl
2006-01-29 16:22             ` Robert J. Chassell
2006-01-29 18:01               ` Chong Yidong
2006-01-29 20:13               ` Nick Roberts
2006-01-30  1:04                 ` Robert J. Chassell
2006-01-30  2:08                   ` Nick Roberts
2006-01-30 14:44                     ` Robert J. Chassell
2006-01-29 22:04               ` Mathias Dahl
2006-01-29 23:13                 ` Chong Yidong
2006-01-30 11:57                   ` Mathias Dahl
2006-01-30 14:18                   ` Mathias Dahl
2006-01-30  1:49                 ` Robert J. Chassell
2006-01-30 12:08                   ` Mathias Dahl
2006-01-28  4:51           ` Richard M. Stallman
2006-01-29 16:01             ` Mathias Dahl
2006-01-30 18:46               ` Richard M. Stallman
2006-01-30 21:49                 ` Mathias Dahl
2006-01-30 22:16                   ` Mathias Dahl
2006-01-31 18:03                   ` Richard M. Stallman
2006-02-01 10:44                     ` Mathias Dahl
2006-02-02  4:16                       ` Richard M. Stallman
2006-02-02 16:34                         ` Mathias Dahl
2006-02-04 18:27                           ` Richard M. Stallman
2006-02-05 12:03                             ` Mathias Dahl
2006-02-05 20:36                               ` Juri Linkov
2006-02-05 22:05                                 ` Mathias Dahl
2006-02-06  0:22                                   ` Miles Bader
2006-02-06  7:27                                     ` Juri Linkov
2006-02-06 17:37                                     ` Mathias Dahl
2006-02-07 10:59                                       ` Juri Linkov
2006-02-07 17:46                                         ` Mathias Dahl
2006-02-08  9:17                                           ` Juri Linkov
2006-02-08 15:27                                             ` Mathias Dahl
2006-02-09 17:29                                               ` Juri Linkov
2006-02-09 22:46                                                 ` Mathias Dahl
2006-02-10  1:29                                                   ` Juri Linkov
2006-02-10 10:14                                                     ` Mathias Dahl
2006-02-10 10:28                                                       ` Miles Bader
2006-02-10 13:45                                                       ` tumme testing Robert J. Chassell
2006-02-10 14:26                                                         ` Mattis
2006-02-10 18:18                                                           ` Robert J. Chassell
2006-02-11  0:17                                                             ` Mattis
2006-02-11 12:57                                                               ` Robert J. Chassell
2006-02-11 21:54                                                                 ` Mathias Dahl
2006-02-11  1:22                                                           ` Juri Linkov
2006-02-11  9:21                                                             ` Mathias Dahl
2006-02-12 17:45                                                               ` Juri Linkov
2006-02-12 21:21                                                                 ` Mathias Dahl
2006-02-12 23:41                                                                   ` Mathias Dahl
2006-02-13  0:24                                                                     ` Robert J. Chassell
2006-02-13 17:55                                                                       ` Juri Linkov
2006-02-13 18:41                                                                         ` Drew Adams
2006-02-14  6:18                                                                           ` Tomas Zerolo
2006-02-14 17:45                                                                             ` Juri Linkov [this message]
2006-02-13 20:21                                                                         ` Mathias Dahl
2006-02-10 16:47                                                         ` Mathias Dahl
2006-02-11 16:45                                                     ` thumbs.el and transparency Richard M. Stallman
2006-02-09 23:47                                                 ` Miles Bader
2006-02-10 10:12                                                   ` Mathias Dahl
2006-02-10 23:02                                                 ` Richard M. Stallman
2006-02-10 23:56                                                   ` Mathias Dahl
2006-02-11  1:21                                                     ` Juri Linkov
2006-02-11  9:30                                                       ` Mathias Dahl
2006-02-12 17:45                                                         ` Juri Linkov
2006-02-12 18:35                                                           ` Mathias Dahl
2006-02-12  4:30                                                     ` Richard M. Stallman
2006-02-12 14:38                                                       ` Mattis
2006-02-12 17:47                                                         ` Juri Linkov
2006-02-12 18:39                                                           ` Mathias Dahl
2006-02-13 17:57                                                             ` Juri Linkov
2006-02-06  2:06                               ` Richard M. Stallman
2006-02-06 21:19                                 ` Can someone verify my changes to tumme and dired? (was: thumbs.el and transparency) Mathias Dahl
2006-02-06 22:17                                   ` Can someone verify my changes to tumme and dired? Mathias Dahl
2006-02-06 23:33                                     ` David Kastrup
2006-02-07 12:58                                       ` Mathias Dahl
2006-01-27  4:12         ` thumbs.el and transparency Miles Bader
2006-01-27  4:50           ` Nick Roberts

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87acct98z4.fsf@jurta.org \
    --to=juri@jurta.org \
    --cc=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).