From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: tumme testing Date: Tue, 14 Feb 2006 19:45:34 +0200 Organization: JURTA Message-ID: <87acct98z4.fsf@jurta.org> References: <87k6bzb0ts.fsf@jurta.org> <20060214061826.GC10615@www.trapp.net> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1139953081 25503 80.91.229.2 (14 Feb 2006 21:38:01 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 14 Feb 2006 21:38:01 +0000 (UTC) Cc: drew.adams@oracle.com, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Feb 14 22:37:55 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1F97rH-00066v-11 for ged-emacs-devel@m.gmane.org; Tue, 14 Feb 2006 22:37:17 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F97rG-0006Tc-0p for ged-emacs-devel@m.gmane.org; Tue, 14 Feb 2006 16:37:14 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1F94ef-00059k-Lz for emacs-devel@gnu.org; Tue, 14 Feb 2006 13:12:02 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1F94cS-0003o0-5d for emacs-devel@gnu.org; Tue, 14 Feb 2006 13:09:44 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F94La-0006Gp-Jr for emacs-devel@gnu.org; Tue, 14 Feb 2006 12:52:20 -0500 Original-Received: from [194.126.101.111] (helo=mail.neti.ee) by monty-python.gnu.org with esmtp (Exim 4.52) id 1F94QH-0007Wk-IL for emacs-devel@gnu.org; Tue, 14 Feb 2006 12:57:10 -0500 Original-Received: from mail.neti.ee (80-235-45-12-dsl.mus.estpak.ee [80.235.45.12]) by Relayhost1.neti.ee (Postfix) with ESMTP id D5FEC606C; Tue, 14 Feb 2006 19:52:12 +0200 (EET) Original-To: tomas@tuxteam.de (Tomas Zerolo) In-Reply-To: <20060214061826.GC10615@www.trapp.net> (Tomas Zerolo's message of "Tue, 14 Feb 2006 07:18:26 +0100") User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) X-Virus-Scanned: by amavisd-new-2.2.1 (20041222) (Debian) at neti.ee X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:50534 Archived-At: >> 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/