annotate lisp/obsolete/sun-curs.el @ 66402:ade0d81f63a9

(defimage): Add `doc-string' declaration.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 24 Oct 2005 16:43:03 +0000
parents 4377043d399d
children e8a3fb527b77 a3716f7538f2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
39022
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1 ;;; sun-curs.el --- cursor definitions for Sun windows
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
2
64751
5b1a238fcbb4 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64085
diff changeset
3 ;; Copyright (C) 1987, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
39022
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
4
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
5 ;; Author: Jeff Peck <peck@sun.com>
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
6 ;; Keywords: hardware
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
7
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
9
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
13 ;; any later version.
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
14
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
18 ;; GNU General Public License for more details.
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
19
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
64085
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
23 ;; Boston, MA 02110-1301, USA.
39022
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
24
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
25 ;;; Commentary:
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
26
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
27 ;;; Code:
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
28
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
29 ;;;
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
30 ;;; Added some more cursors and moved the hot spots
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
31 ;;; Cursor defined by 16 pairs of 16-bit numbers
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
32 ;;;
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
33 ;;; 9-dec-86 Jeff Peck, Sun Microsystems Inc. <peck@sun.com>
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
34
65137
4377043d399d Move the `defvar's to the top level.
Juanma Barranquero <lekktu@gmail.com>
parents: 65103
diff changeset
35 (eval-when-compile (require 'cl))
4377043d399d Move the `defvar's to the top level.
Juanma Barranquero <lekktu@gmail.com>
parents: 65103
diff changeset
36
4377043d399d Move the `defvar's to the top level.
Juanma Barranquero <lekktu@gmail.com>
parents: 65103
diff changeset
37 (defvar *edit-icon*)
4377043d399d Move the `defvar's to the top level.
Juanma Barranquero <lekktu@gmail.com>
parents: 65103
diff changeset
38 (defvar char)
4377043d399d Move the `defvar's to the top level.
Juanma Barranquero <lekktu@gmail.com>
parents: 65103
diff changeset
39 ;; These are from term/sun-mouse.el
4377043d399d Move the `defvar's to the top level.
Juanma Barranquero <lekktu@gmail.com>
parents: 65103
diff changeset
40 (defvar *mouse-window*)
4377043d399d Move the `defvar's to the top level.
Juanma Barranquero <lekktu@gmail.com>
parents: 65103
diff changeset
41 (defvar *mouse-x*)
4377043d399d Move the `defvar's to the top level.
Juanma Barranquero <lekktu@gmail.com>
parents: 65103
diff changeset
42 (defvar *mouse-y*)
4377043d399d Move the `defvar's to the top level.
Juanma Barranquero <lekktu@gmail.com>
parents: 65103
diff changeset
43 (defvar menu)
65103
27425eb4706a (icon-edit, *mouse-window*, *mouse-x*, *mouse-y*, menu, char):
Juanma Barranquero <lekktu@gmail.com>
parents: 64751
diff changeset
44
39022
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
45 (require 'sun-fns)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
46
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
47 (eval-and-compile
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
48 (defvar sc::cursors nil "List of known cursors"))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
49
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
50 (defmacro defcursor (name x y string)
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 39022
diff changeset
51 (if (not (memq name sc::cursors))
39022
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
52 (setq sc::cursors (cons name sc::cursors)))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
53 (list 'defconst name (list 'vector x y string)))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
54
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
55 ;;; push should be defined in common lisp, but if not use this:
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
56 ;(defmacro push (v l)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
57 ; "The ITEM is evaluated and consed onto LIST, a list-valued atom"
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
58 ; (list 'setq l (list 'cons v l)))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
59
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
60 ;;;
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
61 ;;; The standard default cursor
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
62 ;;;
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
63 (defcursor sc:right-arrow 15 0
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
64 (concat '(0 1 0 3 0 7 0 15 0 31 0 63 0 127 0 15
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
65 0 27 0 25 0 48 0 48 0 96 0 96 0 192 0 192)))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
66
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
67 ;;(sc:set-cursor sc:right-arrow)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
68
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
69 (defcursor sc:fat-left-arrow 0 8
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
70 (concat '(1 0 3 0 7 0 15 0 31 0 63 255 127 255 255 255
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
71 255 255 127 255 63 255 31 0 15 0 7 0 3 0 1 0)))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
72
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
73 (defcursor sc:box 8 8
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
74 (concat '(15 252 8 4 8 4 8 4 8 4 8 4 8 4 8 4
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
75 8 132 8 4 8 4 8 4 8 4 8 4 8 4 15 252)))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
76
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
77 (defcursor sc:hourglass 8 8
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
78 (concat "\177\376\100\002\040\014\032\070"
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
79 "\017\360\007\340\003\300\001\200"
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
80 "\001\200\002\100\005\040\010\020"
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
81 "\021\210\043\304\107\342\177\376"))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
82
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
83 (defun sc:set-cursor (icon)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
84 "Change the Sun mouse cursor to ICON.
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
85 If ICON is nil, switch to the system default cursor,
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
86 Otherwise, ICON should be a vector or the name of a vector of [x y 32-chars]"
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
87 (interactive "XIcon Name: ")
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
88 (if (symbolp icon) (setq icon (symbol-value icon)))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
89 (sun-change-cursor-icon icon))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
90
65103
27425eb4706a (icon-edit, *mouse-window*, *mouse-x*, *mouse-y*, menu, char):
Juanma Barranquero <lekktu@gmail.com>
parents: 64751
diff changeset
91 ;; This does not make much sense...
39022
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
92 (make-local-variable '*edit-icon*)
65103
27425eb4706a (icon-edit, *mouse-window*, *mouse-x*, *mouse-y*, menu, char):
Juanma Barranquero <lekktu@gmail.com>
parents: 64751
diff changeset
93
27425eb4706a (icon-edit, *mouse-window*, *mouse-x*, *mouse-y*, menu, char):
Juanma Barranquero <lekktu@gmail.com>
parents: 64751
diff changeset
94 (defvar icon-edit nil)
39022
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
95 (make-variable-buffer-local 'icon-edit)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
96 (or (assq 'icon-edit minor-mode-alist)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
97 (push '(icon-edit " IconEdit") minor-mode-alist))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
98
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
99 (defun sc:edit-cursor (icon)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
100 "convert icon to rectangle, edit, and repack"
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
101 (interactive "XIcon Name: ")
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
102 (if (not icon) (setq icon (sc::menu-choose-cursor (selected-window) 1 1)))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
103 (if (symbolp icon) (setq icon (symbol-value icon)))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
104 (if (get-buffer "icon-edit") (kill-buffer "icon-edit"))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
105 (switch-to-buffer "icon-edit")
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
106 (local-set-mouse '(text right) 'sc::menu-function)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
107 (local-set-mouse '(text left) '(sc::pic-ins-at-mouse 32))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
108 (local-set-mouse '(text middle) '(sc::pic-ins-at-mouse 64))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
109 (local-set-mouse '(text left middle) 'sc::hotspot)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
110 (sc::display-icon icon)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
111 (picture-mode)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
112 (setq icon-edit t) ; for mode line display
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
113 )
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
114
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
115 (defun sc::pic-ins-at-mouse (char)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
116 "Picture insert char at mouse location"
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
117 (mouse-move-point *mouse-window* (min 15 *mouse-x*) (min 15 *mouse-y*))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
118 (move-to-column (1+ (min 15 (current-column))) t)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
119 (delete-char -1)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
120 (insert char)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
121 (sc::goto-hotspot))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 39022
diff changeset
122
39022
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
123 (defmenu sc::menu
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
124 ("Cursor Menu")
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
125 ("Pack & Use" sc::pack-buffer-to-cursor)
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 39022
diff changeset
126 ("Pack to Icon" sc::pack-buffer-to-icon
39022
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
127 (sc::menu-choose-cursor *menu-window* *menu-x* *menu-y*))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
128 ("New Icon" call-interactively 'sc::make-cursor)
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 39022
diff changeset
129 ("Edit Icon" sc:edit-cursor
39022
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
130 (sc::menu-choose-cursor *menu-window* *menu-x* *menu-y*))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
131 ("Set Cursor" sc:set-cursor
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 39022
diff changeset
132 (sc::menu-choose-cursor *menu-window* *menu-x* *menu-y*))
39022
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
133 ("Reset Cursor" sc:set-cursor nil)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
134 ("Help" sc::edit-icon-help-menu)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
135 ("Quit" sc::quit-edit)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
136 )
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
137
65103
27425eb4706a (icon-edit, *mouse-window*, *mouse-x*, *mouse-y*, menu, char):
Juanma Barranquero <lekktu@gmail.com>
parents: 64751
diff changeset
138 (defun sc::menu-function (window x y)
27425eb4706a (icon-edit, *mouse-window*, *mouse-x*, *mouse-y*, menu, char):
Juanma Barranquero <lekktu@gmail.com>
parents: 64751
diff changeset
139 (sun-menu-evaluate window (1+ x) y sc::menu))
27425eb4706a (icon-edit, *mouse-window*, *mouse-x*, *mouse-y*, menu, char):
Juanma Barranquero <lekktu@gmail.com>
parents: 64751
diff changeset
140
39022
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
141 (defun sc::quit-edit ()
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
142 (interactive)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
143 (bury-buffer (current-buffer))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
144 (switch-to-buffer (other-buffer) 'no-record))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
145
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
146 (defun sc::make-cursor (symbol)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
147 (interactive "SIcon Name: ")
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
148 (eval (list 'defcursor symbol 0 0 ""))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
149 (sc::pack-buffer-to-icon (symbol-value symbol)))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
150
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
151 (defmenu sc::edit-icon-help-menu
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
152 ("Simple Icon Editor")
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
153 ("Left => CLEAR")
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
154 ("Middle => SET")
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
155 ("L & M => HOTSPOT")
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
156 ("Right => MENU"))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
157
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
158 (defun sc::edit-icon-help ()
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
159 (message "Left=> CLEAR Middle=> SET Left+Middle=> HOTSPOT Right=> MENU"))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
160
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
161 (defun sc::pack-buffer-to-cursor ()
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
162 (sc::pack-buffer-to-icon *edit-icon*)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
163 (sc:set-cursor *edit-icon*))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
164
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
165 (defun sc::menu-choose-cursor (window x y)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
166 "Presents a menu of cursor names, and returns one or nil"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 39022
diff changeset
167 (let ((curs sc::cursors)
39022
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
168 (items))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
169 (while curs
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
170 (push (sc::menu-item-for-cursor (car curs)) items)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
171 (setq curs (cdr curs)))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
172 (push (list "Choose Cursor") items)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
173 (setq menu (menu-create items))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
174 (sun-menu-evaluate window x y menu)))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
175
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
176 (defun sc::menu-item-for-cursor (cursor)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
177 "apply function to selected cursor"
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
178 (list (symbol-name cursor) 'quote cursor))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
179
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
180 (defun sc::hotspot (window x y)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
181 (aset *edit-icon* 0 x)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
182 (aset *edit-icon* 1 y)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
183 (sc::goto-hotspot))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
184
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
185 (defun sc::goto-hotspot ()
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
186 (goto-line (1+ (aref *edit-icon* 1)))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
187 (move-to-column (aref *edit-icon* 0)))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
188
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
189 (defun sc::display-icon (icon)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
190 (setq *edit-icon* (copy-sequence icon))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
191 (let ((string (aref *edit-icon* 2))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
192 (index 0))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
193 (while (< index 32)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
194 (let ((char (aref string index))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
195 (bit 128))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
196 (while (> bit 0)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
197 (insert (sc::char-at-bit char bit))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
198 (setq bit (lsh bit -1))))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
199 (if (eq 1 (% index 2)) (newline))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
200 (setq index (1+ index))))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
201 (sc::goto-hotspot))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
202
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
203 (defun sc::char-at-bit (char bit)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
204 (if (> (logand char bit) 0) "@" " "))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
205
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
206 (defun sc::pack-buffer-to-icon (icon)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
207 "Pack 16 x 16 field into icon string"
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
208 (goto-char (point-min))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
209 (aset icon 0 (aref *edit-icon* 0))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
210 (aset icon 1 (aref *edit-icon* 1))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
211 (aset icon 2 (mapconcat 'sc::pack-one-line "1234567890123456" ""))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
212 (sc::goto-hotspot)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
213 )
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 39022
diff changeset
214
39022
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
215 (defun sc::pack-one-line (dummy)
65103
27425eb4706a (icon-edit, *mouse-window*, *mouse-x*, *mouse-y*, menu, char):
Juanma Barranquero <lekktu@gmail.com>
parents: 64751
diff changeset
216 (let (char chr1 chr2)
39022
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
217 (setq char 0 chr1 (mapconcat 'sc::pack-one-char "12345678" "") chr1 char)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
218 (setq char 0 chr2 (mapconcat 'sc::pack-one-char "12345678" "") chr2 char)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
219 (forward-line 1)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
220 (concat (char-to-string chr1) (char-to-string chr2))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
221 ))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
222
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
223 (defun sc::pack-one-char (dummy)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
224 "pack following char into char, unless eolp"
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
225 (if (or (eolp) (char-equal (following-char) 32))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 39022
diff changeset
226 (setq char (lsh char 1))
39022
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
227 (setq char (1+ (lsh char 1))))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
228 (if (not (eolp))(forward-char)))
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
229
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
230 (provide 'sun-curs)
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
231
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49598
diff changeset
232 ;;; arch-tag: 7cc861e5-e2d9-4191-b211-2baaaab54e78
39022
9a10bb9ac325 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
233 ;;; sun-curs.el ends here