;;; wl-demo.el -- Opening demo on Wanderlust.
-;; Copyright 1998,1999,2000 Yuuichi Teranishi <teranisi@gohome.org>
+;; Copyright (C) 1998,1999,2000,2001 Yuuichi Teranishi <teranisi@gohome.org>
+;; Copyright (C) 2000,2001 Katsumi Yamaoka <yamaoka@jpl.org>
;; Author: Yuuichi Teranishi <teranisi@gohome.org>
+;; Katsumi Yamaoka <yamaoka@jpl.org>
;; Keywords: mail, net news
;; This file is part of Wanderlust (Yet Another Message Interface on Emacsen).
;;
(defconst wl-demo-copyright-notice
- "Copyright (C) 1998-2000 Yuuichi Teranishi <teranisi@gohome.org>")
+ "Copyright (C) 1998-2001 Yuuichi Teranishi <teranisi@gohome.org>")
(require 'wl-vars)
(require 'wl-version)
(require 'wl-highlight)
-(require 'product)
-(product-provide (provide 'wl-demo) (require 'wl-version))
+
+(defconst wl-demo-icon-name (concat "wl-" (wl-version-status) "-logo"))
;; Avoid byte compile warnings.
(eval-when-compile
(defalias-maybe 'insert-image 'ignore)
(defalias-maybe 'make-extent 'ignore)
(defalias-maybe 'make-glyph 'ignore)
+ (defalias-maybe 'propertize 'ignore)
(defalias-maybe 'set-extent-end-glyph 'ignore)
(defalias-maybe 'set-glyph-face 'ignore)
(defalias-maybe 'set-specifier 'ignore)
- (defalias-maybe 'tool-bar-mode 'ignore)
(defalias-maybe 'window-pixel-height 'ignore)
(defalias-maybe 'window-pixel-width 'ignore))
(eval-when-compile
(defmacro wl-logo-xpm ()
;; (WIDTH HEIGHT DATA)
- (let ((file (expand-file-name "wl-logo.xpm" wl-icon-dir)))
+ (let ((file (expand-file-name
+ (concat wl-demo-icon-name ".xpm")
+ wl-icon-dir)))
(if (file-exists-p file)
(wl-demo-with-temp-file-buffer file
(re-search-forward
(buffer-string))))))
(defmacro wl-logo-xbm ()
;; (WIDTH HEIGHT DATA)
- (let ((file (expand-file-name "wl-logo.xbm" wl-icon-dir)))
+ (let ((file (expand-file-name
+ (concat wl-demo-icon-name ".xbm")
+ wl-icon-dir)))
(if (file-exists-p file)
(wl-demo-with-temp-file-buffer file
(let ((case-fold-search t)
(list 'list width height (read (current-buffer))))))))
(defmacro wl-logo-bitmap ()
;; (DECODED-P . DATA)
- (let ((file (expand-file-name "wl-logo.xbm" wl-icon-dir)))
+ (let ((file (expand-file-name (concat wl-demo-icon-name ".xbm")
+ wl-icon-dir)))
(if (file-exists-p file)
(if (condition-case nil (require 'bitmap) (error nil))
(list 'cons t (bitmap-decode-xbm
"Demo on the startup screen.
Optional IMAGE-TYPE overrides the variable `wl-demo-display-logo'."
(interactive "P")
+ (if (and image-type (interactive-p))
+ (let* ((selection (append
+ (if (and (get 'wl-logo-xbm 'width)
+ (cond ((featurep 'xemacs)
+ (device-on-window-system-p))
+ (wl-on-emacs21
+ (display-graphic-p))
+ (t window-system)))
+ '(("xbm" . xbm)))
+ (if (and (get 'wl-logo-xpm 'width)
+ (or (and (featurep 'xemacs)
+ (featurep 'xpm)
+ (device-on-window-system-p))
+ (and wl-on-emacs21
+ (display-graphic-p)
+ (featurep 'image)
+ (image-type-available-p 'xpm))))
+ '(("xpm" . xpm)))
+ '(("ascii"))))
+ (type (completing-read "Image type: " selection nil t)))
+ (setq image-type (if (assoc type selection)
+ (cdr (assoc type selection)))))
+ (setq image-type (or image-type wl-demo-display-logo)))
(let ((demo-buf (let ((default-enable-multibyte-characters t)
(default-mc-flag t)
(default-line-spacing 0))
(get-buffer-create "*WL Demo*"))))
(switch-to-buffer demo-buf)
+ (erase-buffer)
+ (setq truncate-lines t)
(cond ((featurep 'xemacs)
(if (device-on-window-system-p)
(progn
nil demo-buf))
(set-specifier (symbol-value 'scrollbar-height) 0 demo-buf)
(set-specifier (symbol-value 'scrollbar-width) 0 demo-buf))))
- ((and (> emacs-major-version 20) (display-graphic-p))
+ ((and wl-on-emacs21 (display-graphic-p))
(make-local-hook 'kill-buffer-hook)
(let* ((frame (selected-frame))
(toolbar (frame-parameter frame 'tool-bar-lines)))
nil t)
(set-face-background 'fringe (face-background 'default frame)
frame))))
- (erase-buffer)
- (setq truncate-lines t)
- (let* ((wl-demo-display-logo
- (if (and image-type (interactive-p))
- (let* ((selection '(("xbm" . xbm) ("xpm" . xpm) ("ascii")))
- (type (completing-read "Image type: " selection nil t)))
- (if (assoc type selection)
- (cdr (assoc type selection))
- t))
- (or image-type wl-demo-display-logo)))
- (logo (if (cond ((featurep 'xemacs)
- (device-on-window-system-p))
- ((featurep 'image)
- (display-graphic-p))
- (t window-system))
- (cond ((and (eq 'xbm wl-demo-display-logo)
- (get 'wl-logo-xbm 'width))
- 'wl-logo-xbm)
- (wl-demo-display-logo
- (cond ((get 'wl-logo-xpm 'width)
- 'wl-logo-xpm)
- ((get 'wl-logo-xbm 'width)
- 'wl-logo-xbm))))))
- (ww (window-width))
- (wh (window-height))
- rest)
+ (let ((logo (cond ((eq 'xbm image-type)
+ (if (and (get 'wl-logo-xbm 'width)
+ (cond ((featurep 'xemacs)
+ (device-on-window-system-p))
+ (wl-on-emacs21
+ (display-graphic-p))
+ (t window-system)))
+ 'wl-logo-xbm))
+ ((eq 'xpm image-type)
+ (if (and (get 'wl-logo-xpm 'width)
+ (or (and (featurep 'xemacs)
+ (featurep 'xpm)
+ (device-on-window-system-p))
+ (and wl-on-emacs21
+ (display-graphic-p)
+ (featurep 'image)
+ (image-type-available-p 'xpm))))
+ 'wl-logo-xpm))))
+ (ww (window-width))
+ (wh (window-height))
+ rest)
(if logo
(let ((lw (get logo 'width))
(lh (get logo 'height))
(* lw ww))
2 (window-pixel-width))))
(set-extent-end-glyph (make-extent (point) (point)) image))
- ((featurep 'image)
+ ((and wl-on-emacs21
+ (display-graphic-p))
(if (eq 'wl-logo-xbm logo)
(let ((bg (face-background 'wl-highlight-logo-face))
(fg (face-foreground 'wl-highlight-logo-face)))
(plist-put (cdr image) ':foreground fg))))
(setq rest (/ (- (* wh (frame-char-height)) lh 1)
(frame-char-height)))
- (insert-char ?\ (max 0 (/ (- (* (frame-char-width) (1+ ww)) lw)
- 2 (frame-char-width))))
+ (insert (propertize " " 'display
+ (list 'space ':align-to
+ (max 0 (/ (- (* (frame-char-width)
+ (1+ ww)) lw)
+ 2 (frame-char-width))))))
(insert-image image))
(t
(insert image)
(insert-char ?\n (max 0 (/ (- rest 4) 2)))
(goto-char (point-max))
(insert "\n")
- (let ((start (point)))
- (insert (format (cond ((<= rest 2)
- "version %s - \"%s\"\n%s")
- ((eq rest 3)
- "version %s - \"%s\"\n\n%s")
- (t
- "\nversion %s - \"%s\"\n\n%s"))
- (product-version-string (product-find 'wl-version))
- (product-code-name (product-find 'wl-version))
- wl-demo-copyright-notice))
- (put-text-property start (point) 'face 'wl-highlight-demo-face)
+ (let ((start (point))
+ (text (format (cond ((<= rest 2)
+ "version %s - \"%s\"\n%s")
+ ((eq rest 3)
+ "version %s - \"%s\"\n\n%s")
+ (t
+ "\nversion %s - \"%s\"\n\n%s"))
+ (product-version-string (product-find 'wl-version))
+ (product-code-name (product-find 'wl-version))
+ wl-demo-copyright-notice)))
+ (if wl-on-emacs21
+ (let ((bg (face-background 'wl-highlight-demo-face))
+ (fg (face-foreground 'wl-highlight-demo-face)))
+ (insert (propertize text
+ 'face (nconc '(variable-pitch :slant oblique)
+ (if (stringp bg)
+ (list ':background bg))
+ (if (stringp fg)
+ (list ':foreground fg))))))
+ (insert text)
+ (put-text-property start (point) 'face 'wl-highlight-demo-face))
(let ((fill-column ww))
(center-region start (point))))
(goto-char (point-min))
(sit-for (if (featurep 'lisp-float-type) (/ (float 5) (float 10)) 1))
demo-buf)))
+(require 'product)
+(product-provide (provide 'wl-demo) (require 'wl-version))
+
;;; wl-demo.el ends here