1 ;;; wl-demo.el -- Opening demo on Wanderlust.
3 ;; Copyright 1998,1999,2000 Yuuichi Teranishi <teranisi@gohome.org>
5 ;; Author: Yuuichi Teranishi <teranisi@gohome.org>
6 ;; Keywords: mail, net news
7 ;; Time-stamp: <2000-03-30 15:56:54 teranisi>
9 ;; This file is part of Wanderlust (Yet Another Message Interface on Emacsen).
11 ;; This program is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
16 ;; This program is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
35 (if (featurep 'xemacs)
39 (defun-maybe device-on-window-system-p ())
40 (defun-maybe glyph-height (a))
41 (defun-maybe glyph-width (a))
42 (defun-maybe make-extent (a b))
43 (defun-maybe make-glyph (a))
44 (defun-maybe set-extent-end-glyph (a b))
45 (defun-maybe startup-center-spaces (a))
46 (defun-maybe window-pixel-height ())
47 (defun-maybe window-pixel-width ())
51 (defun-maybe bitmap-compose (a))
52 (defun-maybe bitmap-decode-xbm (a))
53 (defun-maybe bitmap-read-xbm-file (a))
54 (unless (boundp ':data)
55 (set (make-local-variable ':data) nil))
56 (unless (boundp ':type)
57 (set (make-local-variable ':type) nil))
61 (defun-maybe frame-char-height ())
62 (defun-maybe frame-char-width ())
63 (defun-maybe image-type-available-p (a)))
65 (static-condition-case nil
67 (insert-image '(image))
68 (defalias 'wl-insert-image 'insert-image))
69 (wrong-number-of-arguments
70 (defun wl-insert-image (image)
71 (insert-image image "x")))
73 (defun wl-insert-image (image))))
79 (cond ((or (featurep 'xemacs) (featurep 'image))
80 (defmacro wl-title-logo ()
81 (let ((file (expand-file-name "wl-logo.xpm" wl-icon-dir)))
82 (if (file-exists-p file)
83 (let ((buffer (generate-new-buffer " *wl-logo*"))
84 (coding-system-for-read 'binary)
85 buffer-file-format format-alist
86 insert-file-contents-post-hook
87 insert-file-contents-pre-hook)
91 (insert-file-contents file)
93 (kill-buffer buffer)))))))
97 (defmacro wl-title-logo ()
98 (let ((file (expand-file-name "wl-logo.xbm" wl-icon-dir)))
99 (if (file-exists-p file)
101 (bitmap-decode-xbm (bitmap-read-xbm-file file))
102 (error (message "Bitmap Logo is not used.")))))))
104 (defmacro wl-title-logo ()))))
106 (defconst wl-title-logo
107 (cond ((or (and (featurep 'xemacs)
109 (device-on-window-system-p))
110 (and (eval-when-compile (featurep 'image))
111 (image-type-available-p 'xpm)))
117 (let ((cmp (wl-title-logo)))
120 (let ((len (length cmp))
121 (bitmap (bitmap-compose (aref cmp 0)))
124 (setq bitmap (concat bitmap "\n"
125 (bitmap-compose (aref cmp i)))
132 (let ((demo-buf (get-buffer-create "*WL Demo*"))
134 (switch-to-buffer demo-buf)
136 (if (and wl-demo-display-logo wl-title-logo)
139 (let ((wl-logo (make-glyph (vector 'xpm :data wl-title-logo))))
140 (insert-char ?\n (max 1 (/ (- (window-height) 6
141 (/ (glyph-height wl-logo)
142 (/ (window-pixel-height)
143 (window-height)))) 2)))
144 (indent-to (startup-center-spaces wl-logo))
145 (insert-char ?\ (max 0 (/ (- (window-width)
146 (/ (glyph-width wl-logo)
147 (/ (window-pixel-width)
148 (window-width)))) 2)))
149 (setq logo-ext (make-extent (point)(point)))
150 (set-extent-end-glyph logo-ext wl-logo)))
152 (let ((wl-logo (list 'image :type 'xpm :data wl-title-logo))
153 pixel-width pixel-height)
155 (insert wl-title-logo)
156 (goto-char (point-min))
157 (skip-syntax-forward "^\"")
158 (when (looking-at "\"[ \t]*\\([0-9]+\\)[ \t]*\\([0-9]+\\)")
159 (setq pixel-width (string-to-int (match-string 1))
160 pixel-height (string-to-int (match-string 2)))))
161 (insert-char ?\n (max 1 (/ (- (window-height) 6
163 (frame-char-height))) 2)))
164 (insert-char ?\ (max 0 (/ (- (window-width)
166 (frame-char-width))) 2)))
167 (wl-insert-image wl-logo)
170 (insert wl-title-logo)
171 (indent-rigidly (point-min) (point-max)
172 (max 0 (/ (- (window-width) (current-column)) 2)))
174 (goto-char (point-min))
175 (insert-char ?\n (max 0 (/ (- (window-height)
176 (count-lines (point) (point-max))
178 (goto-char (point-max))))
179 (insert-char ?\n (max 1 (- (/ (window-height) 3) 2))))
181 (insert "\n" (if (and wl-demo-display-logo wl-title-logo)
183 (concat wl-appname "\n")))
184 (let ((fill-column (window-width)))
185 (center-region start (point)))
187 (put-text-property (point-min) (point) 'face 'wl-highlight-logo-face)
188 (insert (format "\nversion %s - \"%s\"\n\n"
189 wl-version wl-codename
191 (insert "Copyright (C) 1998-2000 Yuuichi Teranishi <teranisi@gohome.org>")
192 (put-text-property start (point-max) 'face 'wl-highlight-demo-face)
193 (let ((fill-column (window-width)))
194 (center-region start (point)))
195 (goto-char (point-min))
197 (if (featurep 'lisp-float-type) (/ (float 5) (float 10)) 1))
198 ;;(if (featurep 'xemacs) (delete-extent logo-ext))
201 ;;; wl-demo.el ends here