Mercurial > emacs
annotate lisp/sun-curs.el @ 16842:72276b334084 before-thomas-posix1996 glibc-2_0_2 libc-970108 libc-970109 libc-970110 libc-970111 libc-970112 libc-970113 libc-970114 libc-970115 libc-970116 libc-970117 libc-970118 libc-970119 libc-970120 libc-970121 libc-970122 libc-970123 libc-970124 libc-970125 libc-970126 libc-970127 libc-970128 libc-970129 libc-970130 libc-970131 libc-970201 libc-970202 libc-970203 libc-970204 libc-970205 libc-970206 libc-970207 libc-970208 libc-970209 libc-970210 libc-970211 libc-970212 libc-970213 libc-970214 libc-970215 libc-970216 libc-970217 libc-970218 libc-970219 libc-970220 libc-970221 libc-970222 libc-970223 libc-970224 libc-970225 libc-970226 libc-970227 libc-970228 libc-970301 libc-970302 libc-970303 libc-970304 libc-970305 libc-970306 libc-970307 libc-970308 libc-970309 libc-970310 libc-970311 libc-970312 libc-970313 libc-970314 libc-970315 libc-970316 libc-970317 libc-970318 libc-970319 libc-970320 libc-970321 libc-970322 libc-970323 libc-970324 libc20x-970306 libc20x-97031 libc20x-970316 libc20x-970318 libc20x-970319 libc20x-970404 root-libc-2_0_x-branch
Add hppa1.1-hitachi-hiuxmpp support, passed along by rms.
author | David J. MacKenzie <djm@gnu.org> |
---|---|
date | Tue, 07 Jan 1997 19:29:28 +0000 |
parents | 17f87f2d29fd |
children | 720d1f98ae42 |
rev | line source |
---|---|
2531
fd182baaa0a3
Name changed from sun-cursors.el to protect the innocents.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2247
diff
changeset
|
1 ;;; sun-curs.el --- cursor definitions for Sun windows |
658
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
584
diff
changeset
|
2 |
840
113281b361ec
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
807
diff
changeset
|
3 ;; Copyright (C) 1987 Free Software Foundation, Inc. |
113281b361ec
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
807
diff
changeset
|
4 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
5 ;; Author: Jeff Peck <peck@sun.com> |
2247
2c7997f249eb
Add or correct keywords
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
923
diff
changeset
|
6 ;; Keywords: hardware |
35 | 7 |
8 ;; This file is part of GNU Emacs. | |
9 | |
10 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;; it under the terms of the GNU General Public License as published by | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
12 ;; the Free Software Foundation; either version 2, or (at your option) |
35 | 13 ;; any later version. |
14 | |
15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
14169 | 21 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
23 ;; Boston, MA 02111-1307, USA. | |
35 | 24 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
25 ;;; Code: |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
26 |
35 | 27 ;;; |
28 ;;; Added some more cursors and moved the hot spots | |
29 ;;; Cursor defined by 16 pairs of 16-bit numbers | |
30 ;;; | |
31 ;;; 9-dec-86 Jeff Peck, Sun Microsystems Inc. <peck@sun.com> | |
32 | |
923 | 33 (require 'cl) |
34 | |
35 | 35 (defvar sc::cursors nil "List of known cursors") |
36 | |
37 (defmacro defcursor (name x y string) | |
38 (if (not (memq name sc::cursors)) | |
39 (setq sc::cursors (cons name sc::cursors))) | |
40 (list 'defconst name (list 'vector x y string))) | |
41 | |
42 ;;; push should be defined in common lisp, but if not use this: | |
43 ;(defmacro push (v l) | |
44 ; "The ITEM is evaluated and consed onto LIST, a list-valued atom" | |
45 ; (list 'setq l (list 'cons v l))) | |
46 | |
47 ;;; | |
48 ;;; The standard default cursor | |
49 ;;; | |
50 (defcursor sc:right-arrow 15 0 | |
51 (concat '(0 1 0 3 0 7 0 15 0 31 0 63 0 127 0 15 | |
52 0 27 0 25 0 48 0 48 0 96 0 96 0 192 0 192))) | |
53 | |
54 ;;(sc:set-cursor sc:right-arrow) | |
55 | |
56 (defcursor sc:fat-left-arrow 0 8 | |
57 (concat '(1 0 3 0 7 0 15 0 31 0 63 255 127 255 255 255 | |
58 255 255 127 255 63 255 31 0 15 0 7 0 3 0 1 0))) | |
59 | |
60 (defcursor sc:box 8 8 | |
61 (concat '(15 252 8 4 8 4 8 4 8 4 8 4 8 4 8 4 | |
62 8 132 8 4 8 4 8 4 8 4 8 4 8 4 15 252))) | |
63 | |
64 (defcursor sc:hourglass 8 8 | |
65 (concat "\177\376\100\002\040\014\032\070" | |
66 "\017\360\007\340\003\300\001\200" | |
67 "\001\200\002\100\005\040\010\020" | |
68 "\021\210\043\304\107\342\177\376")) | |
69 | |
70 (defun sc:set-cursor (icon) | |
71 "Change the Sun mouse cursor to ICON. | |
72 If ICON is nil, switch to the system default cursor, | |
73 Otherwise, ICON should be a vector or the name of a vector of [x y 32-chars]" | |
74 (interactive "XIcon Name: ") | |
75 (if (symbolp icon) (setq icon (symbol-value icon))) | |
76 (sun-change-cursor-icon icon)) | |
77 | |
78 (make-local-variable '*edit-icon*) | |
79 (make-variable-buffer-local 'icon-edit) | |
80 (setq-default icon-edit nil) | |
81 (or (assq 'icon-edit minor-mode-alist) | |
82 (push '(icon-edit " IconEdit") minor-mode-alist)) | |
83 | |
84 (defun sc:edit-cursor (icon) | |
85 "convert icon to rectangle, edit, and repack" | |
86 (interactive "XIcon Name: ") | |
87 (if (not icon) (setq icon (sc::menu-choose-cursor (selected-window) 1 1))) | |
88 (if (symbolp icon) (setq icon (symbol-value icon))) | |
89 (if (get-buffer "icon-edit") (kill-buffer "icon-edit")) | |
90 (switch-to-buffer "icon-edit") | |
91 (local-set-mouse '(text right) 'sc::menu-function) | |
92 (local-set-mouse '(text left) '(sc::pic-ins-at-mouse 32)) | |
93 (local-set-mouse '(text middle) '(sc::pic-ins-at-mouse 64)) | |
94 (local-set-mouse '(text left middle) 'sc::hotspot) | |
95 (sc::display-icon icon) | |
96 (picture-mode) | |
97 (setq icon-edit t) ; for mode line display | |
98 ) | |
99 | |
100 (defun sc::pic-ins-at-mouse (char) | |
101 "Picture insert char at mouse location" | |
102 (mouse-move-point *mouse-window* (min 15 *mouse-x*) (min 15 *mouse-y*)) | |
923 | 103 (move-to-column (1+ (min 15 (current-column))) t) |
35 | 104 (delete-char -1) |
105 (insert char) | |
106 (sc::goto-hotspot)) | |
107 | |
108 (defun sc::menu-function (window x y) | |
109 (sun-menu-evaluate window (1+ x) y sc::menu)) | |
110 | |
111 (defmenu sc::menu | |
112 ("Cursor Menu") | |
113 ("Pack & Use" sc::pack-buffer-to-cursor) | |
114 ("Pack to Icon" sc::pack-buffer-to-icon | |
115 (sc::menu-choose-cursor *menu-window* *menu-x* *menu-y*)) | |
116 ("New Icon" call-interactively 'sc::make-cursor) | |
117 ("Edit Icon" sc:edit-cursor | |
118 (sc::menu-choose-cursor *menu-window* *menu-x* *menu-y*)) | |
119 ("Set Cursor" sc:set-cursor | |
120 (sc::menu-choose-cursor *menu-window* *menu-x* *menu-y*)) | |
121 ("Reset Cursor" sc:set-cursor nil) | |
15256 | 122 ("Help" sc::edit-icon-help-menu) |
35 | 123 ("Quit" sc::quit-edit) |
124 ) | |
125 | |
126 (defun sc::quit-edit () | |
127 (interactive) | |
128 (bury-buffer (current-buffer)) | |
129 (switch-to-buffer (other-buffer) 'no-record)) | |
130 | |
131 (defun sc::make-cursor (symbol) | |
132 (interactive "SIcon Name: ") | |
133 (eval (list 'defcursor symbol 0 0 "")) | |
134 (sc::pack-buffer-to-icon (symbol-value symbol))) | |
135 | |
136 (defmenu sc::edit-icon-help-menu | |
137 ("Simple Icon Editor") | |
138 ("Left => CLEAR") | |
139 ("Middle => SET") | |
140 ("L & M => HOTSPOT") | |
141 ("Right => MENU")) | |
142 | |
143 (defun sc::edit-icon-help () | |
144 (message "Left=> CLEAR Middle=> SET Left+Middle=> HOTSPOT Right=> MENU")) | |
145 | |
146 (defun sc::pack-buffer-to-cursor () | |
147 (sc::pack-buffer-to-icon *edit-icon*) | |
148 (sc:set-cursor *edit-icon*)) | |
149 | |
150 (defun sc::menu-choose-cursor (window x y) | |
151 "Presents a menu of cursor names, and returns one or nil" | |
152 (let ((curs sc::cursors) | |
153 (items)) | |
154 (while curs | |
155 (push (sc::menu-item-for-cursor (car curs)) items) | |
156 (setq curs (cdr curs))) | |
157 (push (list "Choose Cursor") items) | |
158 (setq menu (menu-create items)) | |
159 (sun-menu-evaluate window x y menu))) | |
160 | |
161 (defun sc::menu-item-for-cursor (cursor) | |
162 "apply function to selected cursor" | |
163 (list (symbol-name cursor) 'quote cursor)) | |
164 | |
165 (defun sc::hotspot (window x y) | |
166 (aset *edit-icon* 0 x) | |
167 (aset *edit-icon* 1 y) | |
168 (sc::goto-hotspot)) | |
169 | |
170 (defun sc::goto-hotspot () | |
171 (goto-line (1+ (aref *edit-icon* 1))) | |
172 (move-to-column (aref *edit-icon* 0))) | |
173 | |
174 (defun sc::display-icon (icon) | |
175 (setq *edit-icon* (copy-sequence icon)) | |
176 (let ((string (aref *edit-icon* 2)) | |
177 (index 0)) | |
178 (while (< index 32) | |
179 (let ((char (aref string index)) | |
180 (bit 128)) | |
181 (while (> bit 0) | |
182 (insert (sc::char-at-bit char bit)) | |
183 (setq bit (lsh bit -1)))) | |
184 (if (eq 1 (% index 2)) (newline)) | |
185 (setq index (1+ index)))) | |
186 (sc::goto-hotspot)) | |
187 | |
188 (defun sc::char-at-bit (char bit) | |
189 (if (> (logand char bit) 0) "@" " ")) | |
190 | |
191 (defun sc::pack-buffer-to-icon (icon) | |
192 "Pack 16 x 16 field into icon string" | |
193 (goto-char (point-min)) | |
194 (aset icon 0 (aref *edit-icon* 0)) | |
195 (aset icon 1 (aref *edit-icon* 1)) | |
196 (aset icon 2 (mapconcat 'sc::pack-one-line "1234567890123456" "")) | |
197 (sc::goto-hotspot) | |
198 ) | |
199 | |
200 (defun sc::pack-one-line (dummy) | |
201 (let* (char chr1 chr2) | |
202 (setq char 0 chr1 (mapconcat 'sc::pack-one-char "12345678" "") chr1 char) | |
203 (setq char 0 chr2 (mapconcat 'sc::pack-one-char "12345678" "") chr2 char) | |
204 (forward-line 1) | |
205 (concat (char-to-string chr1) (char-to-string chr2)) | |
206 )) | |
207 | |
208 (defun sc::pack-one-char (dummy) | |
209 "pack following char into char, unless eolp" | |
210 (if (or (eolp) (char-equal (following-char) 32)) | |
211 (setq char (lsh char 1)) | |
212 (setq char (1+ (lsh char 1)))) | |
213 (if (not (eolp))(forward-char))) | |
214 | |
584 | 215 (provide 'sm-cursors) |
216 | |
2531
fd182baaa0a3
Name changed from sun-cursors.el to protect the innocents.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2247
diff
changeset
|
217 ;;; sun-curs.el ends here |