Debian Codegraph @

mew-demo.el

raw
1 ;;; mew-demo.el --- Startup demo for Mew
2
3 ;; Author: Kazu Yamamoto <[email protected]>
4 ;; Created: Oct 2, 1996
5
6 ;;; Code:
7
8 (require 'mew-vars)
9
10 (defvar mew-logo nil)
11
12 (defconst mew-icon-mew "Mew.png")
13
14 (defconst mew-hello-message
15 "
16
17 Welcome to Mew world.
18
19 Mew -- Messaging in the Emacs World
20
21 %s
22
23 Copyright (C) 1994-2018 Kazu Yamamoto
24
25 Please send comments to [email protected].
26
27 "
28 )
29
30 (defconst mew-demo-string
31 '(
32 "/\\\\ - \\\\/"
33
34 "-\\\\ - \\\\/" "\\\\\\ - \\\\/" "|\\\\ - \\\\/" "/\\\\ - \\\\/"
35 "-\\\\ - \\\\/" "\\\\\\ - \\\\/" "|\\\\ - \\\\/" "/\\\\ - \\\\/"
36
37 "/|\\ - \\\\/" "//\\ - \\\\/" "/-\\ - \\\\/" "/\\\\ - \\\\/"
38 "/|\\ - \\\\/" "//\\ - \\\\/" "/-\\ - \\\\/" "/\\\\ - \\\\/"
39
40 "/\\| - \\\\/" "/\\/ - \\\\/" "/\\- - \\\\/" "/\\\\ - \\\\/"
41 "/\\| - \\\\/" "/\\/ - \\\\/" "/\\- - \\\\/" "/\\\\ - \\\\/"
42
43 "/\\\\ - |\\/" "/\\\\ - /\\/" "/\\\\ - -\\/" "/\\\\ - \\\\/"
44 "/\\\\ - |\\/" "/\\\\ - /\\/" "/\\\\ - -\\/" "/\\\\ - \\\\/"
45
46 "/\\\\ - \\|/" "/\\\\ - \\//" "/\\\\ - \\-/" "/\\\\ - \\\\/"
47 "/\\\\ - \\|/" "/\\\\ - \\//" "/\\\\ - \\-/" "/\\\\ - \\\\/"
48
49 "/\\\\ - \\\\-" "/\\\\ - \\\\\\" "/\\\\ - \\\\|" "/\\\\ - \\\\/"
50 "/\\\\ - \\\\-" "/\\\\ - \\\\\\" "/\\\\ - \\\\|" "/\\\\ - \\\\/"
51 )
52 )
53
54 (defun mew-hello ()
55 (let ((time mew-demo-sit-for)
56 (left-margin 0)
57 (fill-column (window-width))
58 indent)
59 (if (not (integerp time)) (setq time 0))
60 (insert (format mew-hello-message mew-version))
61 (center-region (point-min) (point-max))
62 (if (null mew-demo-picture)
63 (mew-hello-text time)
64 (cond
65 ((and window-system
66 (fboundp 'image-type-available-p)
67 (image-type-available-p 'png))
68 (goto-char (point-max))
69 (setq mew-logo (mew-create-image
70 (expand-file-name mew-icon-mew mew-icon-directory)))
71 (setq indent (/ (- (window-width)
72 (truncate (car (image-size mew-logo)))) 2))
73 (setq indent (max 0 indent))
74 (insert (make-string indent mew-sp))
75 (insert-image mew-logo)
76 (goto-char (point-min))
77 (mew-redraw time))
78 (t
79 (mew-hello-text time)))
80 (set-buffer-modified-p nil))))
81
82 (defun mew-hello-text (time)
83 (insert "/\\\\ - \\\\/")
84 (center-line)
85 (end-of-line)
86 (insert (make-string (1- (- (window-width) (current-column))) mew-sp))
87 (end-of-line)
88 (mew-redraw time)
89 (if (and mew-demo window-system) (mew-demo)))
90
91 (defun mew-demo (&optional string)
92 (let* ((strs (or string mew-demo-string))
93 (wl (window-width))
94 (ul (length (regexp-quote "/\\ - \\/")))
95 (pl (/ (- wl ul) 2))
96 (pre (make-string pl mew-sp))
97 (suf (make-string (1- (- (- wl pl) ul)) mew-sp)))
98 (save-window-excursion
99 (dolist (str strs)
100 (mew-demo-print str pre suf)
101 (mew-demo-loop)))))
102
103 (defun mew-demo-print (string prefix suffix)
104 (goto-char (point-max))
105 (let ((end (point)))
106 (beginning-of-line)
107 (delete-region (point) end))
108 (insert prefix string suffix))
109
110 (defun mew-demo-loop ()
111 (mew-redraw 0.02))
112
113 (provide 'mew-demo)
114
115 ;;; Copyright Notice:
116
117 ;; Copyright (C) 1996-2015 Mew developing team.
118 ;; All rights reserved.
119
120 ;; Redistribution and use in source and binary forms, with or without
121 ;; modification, are permitted provided that the following conditions
122 ;; are met:
123 ;;
124 ;; 1. Redistributions of source code must retain the above copyright
125 ;; notice, this list of conditions and the following disclaimer.
126 ;; 2. Redistributions in binary form must reproduce the above copyright
127 ;; notice, this list of conditions and the following disclaimer in the
128 ;; documentation and/or other materials provided with the distribution.
129 ;; 3. Neither the name of the team nor the names of its contributors
130 ;; may be used to endorse or promote products derived from this software
131 ;; without specific prior written permission.
132 ;;
133 ;; THIS SOFTWARE IS PROVIDED BY THE TEAM AND CONTRIBUTORS ``AS IS'' AND
134 ;; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
135 ;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
136 ;; PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE TEAM OR CONTRIBUTORS BE
137 ;; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
138 ;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
139 ;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
140 ;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
141 ;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
142 ;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
143 ;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
144
145 ;;; mew-demo.el ends here