source: tags/pre_1_0_pre_hash_modifications/ccl/hemlock/src/keysym-defs.lisp @ 2475

Last change on this file since 2475 was 2475, checked in by anonymous, 14 years ago

This commit was manufactured by cvs2svn to create tag
'pre_1_0_pre_hash_modifications'.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 10.2 KB
Line 
1;;; -*- Log: hemlock.log; Mode: Lisp; Package: Hemlock-Internals -*-
2;;;
3;;; **********************************************************************
4;;; This code was written as part of the CMU Common Lisp project at
5;;; Carnegie Mellon University, and has been placed in the public domain.
6;;;
7#+CMU (ext:file-comment
8  "$Header$")
9;;;
10;;; **********************************************************************
11;;;
12;;; This file defines all the definitions of keysyms (see key-event.lisp).
13;;; These keysyms match those for X11.
14;;;
15;;; Written by Bill Chiles
16;;; Modified by Blaine Burks.
17;;;
18
19(in-package :hemlock-internals)
20
21
22
23
24;;; Function keys for the RT.
25;;;
26
27;;; This isn't the RT.
28(eval-when (:compile-toplevel :execute)
29  (ccl::use-interface-dir :cocoa))
30
31(hemlock-ext:define-keysym #$NSF1FunctionKey "F1")
32(hemlock-ext:define-keysym #$NSF2FunctionKey "F2")
33(hemlock-ext:define-keysym #$NSF3FunctionKey "F3")
34(hemlock-ext:define-keysym #$NSF4FunctionKey "F4")
35(hemlock-ext:define-keysym #$NSF5FunctionKey "F5")
36(hemlock-ext:define-keysym #$NSF6FunctionKey "F6")
37(hemlock-ext:define-keysym #$NSF7FunctionKey "F7")
38(hemlock-ext:define-keysym #$NSF8FunctionKey "F8")
39(hemlock-ext:define-keysym #$NSF9FunctionKey "F9")
40(hemlock-ext:define-keysym #$NSF10FunctionKey "F10")
41(hemlock-ext:define-keysym #$NSF11FunctionKey "F11")
42(hemlock-ext:define-keysym #$NSF12FunctionKey "F12")
43(hemlock-ext:define-keysym #$NSF13FunctionKey "F13")
44(hemlock-ext:define-keysym #$NSF14FunctionKey "F14")
45(hemlock-ext:define-keysym #$NSF15FunctionKey "F15")
46(hemlock-ext:define-keysym #$NSF16FunctionKey "F16")
47(hemlock-ext:define-keysym #$NSF17FunctionKey "F17")
48(hemlock-ext:define-keysym #$NSF18FunctionKey "F18")
49(hemlock-ext:define-keysym #$NSF19FunctionKey "F19")
50(hemlock-ext:define-keysym #$NSF20FunctionKey "F20")
51(hemlock-ext:define-keysym #$NSF21FunctionKey "F21")
52(hemlock-ext:define-keysym #$NSF22FunctionKey "F22")
53(hemlock-ext:define-keysym #$NSF23FunctionKey "F23")
54(hemlock-ext:define-keysym #$NSF24FunctionKey "F24")
55(hemlock-ext:define-keysym #$NSF25FunctionKey "F25")
56(hemlock-ext:define-keysym #$NSF26FunctionKey "F26")
57(hemlock-ext:define-keysym #$NSF27FunctionKey "F27")
58(hemlock-ext:define-keysym #$NSF28FunctionKey "F28")
59(hemlock-ext:define-keysym #$NSF29FunctionKey "F29")
60(hemlock-ext:define-keysym #$NSF30FunctionKey "F30")
61(hemlock-ext:define-keysym #$NSF31FunctionKey "F31")
62(hemlock-ext:define-keysym #$NSF32FunctionKey "F32")
63(hemlock-ext:define-keysym #$NSF33FunctionKey "F33")
64(hemlock-ext:define-keysym #$NSF34FunctionKey "F34")
65(hemlock-ext:define-keysym #$NSF35FunctionKey "F35")
66
67
68;;; Upper right key bank.
69;;;
70(hemlock-ext:define-keysym #$NSPrintScreenFunctionKey "Printscreen")
71;; Couldn't type scroll lock.
72(hemlock-ext:define-keysym #$NSPauseFunctionKey "Pause")
73
74;;; Middle right key bank.
75;;;
76(hemlock-ext:define-keysym #$NSInsertFunctionKey "Insert")
77(hemlock-ext:define-keysym #$NSDeleteFunctionKey "Del" "Rubout" (string (code-char 127)))
78(hemlock-ext:define-keysym #$NSHomeFunctionKey "Home")
79(hemlock-ext:define-keysym #$NSPageUpFunctionKey "Pageup")
80(hemlock-ext:define-keysym #$NSEndFunctionKey "End")
81(hemlock-ext:define-keysym #$NSPageDownFunctionKey "Pagedown")
82
83;;; Arrows.
84;;;
85(hemlock-ext:define-keysym #$NSLeftArrowFunctionKey "Leftarrow")
86(hemlock-ext:define-keysym #$NSUpArrowFunctionKey "Uparrow")
87(hemlock-ext:define-keysym #$NSDownArrowFunctionKey "Downarrow")
88(hemlock-ext:define-keysym #$NSRightArrowFunctionKey "Rightarrow")
89
90
91;;; "Named" keys.
92;;;
93(hemlock-ext:define-keysym 9 "Tab")
94(hemlock-ext:define-keysym 27 "Escape" "Altmode" "Alt")         ;escape
95(hemlock-ext:define-keysym 127 "Delete" "Backspace")                            ;backspace
96(hemlock-ext:define-keysym 13 "Return" "Newline")
97(hemlock-ext:define-keysym 3 "Enter" "LineFeed")
98(hemlock-ext:define-keysym 32 "Space" " ")
99
100;;; Letters.
101;;;
102(hemlock-ext:define-keysym 97 "a") (hemlock-ext:define-keysym 65 "A")
103(hemlock-ext:define-keysym 98 "b") (hemlock-ext:define-keysym 66 "B")
104(hemlock-ext:define-keysym 99 "c") (hemlock-ext:define-keysym 67 "C")
105(hemlock-ext:define-keysym 100 "d") (hemlock-ext:define-keysym 68 "D")
106(hemlock-ext:define-keysym 101 "e") (hemlock-ext:define-keysym 69 "E")
107(hemlock-ext:define-keysym 102 "f") (hemlock-ext:define-keysym 70 "F")
108(hemlock-ext:define-keysym 103 "g") (hemlock-ext:define-keysym 71 "G")
109(hemlock-ext:define-keysym 104 "h") (hemlock-ext:define-keysym 72 "H")
110(hemlock-ext:define-keysym 105 "i") (hemlock-ext:define-keysym 73 "I")
111(hemlock-ext:define-keysym 106 "j") (hemlock-ext:define-keysym 74 "J")
112(hemlock-ext:define-keysym 107 "k") (hemlock-ext:define-keysym 75 "K")
113(hemlock-ext:define-keysym 108 "l") (hemlock-ext:define-keysym 76 "L")
114(hemlock-ext:define-keysym 109 "m") (hemlock-ext:define-keysym 77 "M")
115(hemlock-ext:define-keysym 110 "n") (hemlock-ext:define-keysym 78 "N")
116(hemlock-ext:define-keysym 111 "o") (hemlock-ext:define-keysym 79 "O")
117(hemlock-ext:define-keysym 112 "p") (hemlock-ext:define-keysym 80 "P")
118(hemlock-ext:define-keysym 113 "q") (hemlock-ext:define-keysym 81 "Q")
119(hemlock-ext:define-keysym 114 "r") (hemlock-ext:define-keysym 82 "R")
120(hemlock-ext:define-keysym 115 "s") (hemlock-ext:define-keysym 83 "S")
121(hemlock-ext:define-keysym 116 "t") (hemlock-ext:define-keysym 84 "T")
122(hemlock-ext:define-keysym 117 "u") (hemlock-ext:define-keysym 85 "U")
123(hemlock-ext:define-keysym 118 "v") (hemlock-ext:define-keysym 86 "V")
124(hemlock-ext:define-keysym 119 "w") (hemlock-ext:define-keysym 87 "W")
125(hemlock-ext:define-keysym 120 "x") (hemlock-ext:define-keysym 88 "X")
126(hemlock-ext:define-keysym 121 "y") (hemlock-ext:define-keysym 89 "Y")
127(hemlock-ext:define-keysym 122 "z") (hemlock-ext:define-keysym 90 "Z")
128
129;;; Standard number keys.
130;;;
131(hemlock-ext:define-keysym 49 "1") (hemlock-ext:define-keysym 33 "!")
132(hemlock-ext:define-keysym 50 "2") (hemlock-ext:define-keysym 64 "@")
133(hemlock-ext:define-keysym 51 "3") (hemlock-ext:define-keysym 35 "#")
134(hemlock-ext:define-keysym 52 "4") (hemlock-ext:define-keysym 36 "$")
135(hemlock-ext:define-keysym 53 "5") (hemlock-ext:define-keysym 37 "%")
136(hemlock-ext:define-keysym 54 "6") (hemlock-ext:define-keysym 94 "^")
137(hemlock-ext:define-keysym 55 "7") (hemlock-ext:define-keysym 38 "&")
138(hemlock-ext:define-keysym 56 "8") (hemlock-ext:define-keysym 42 "*")
139(hemlock-ext:define-keysym 57 "9") (hemlock-ext:define-keysym 40 "(")
140(hemlock-ext:define-keysym 48 "0") (hemlock-ext:define-keysym 41 ")")
141
142;;; "Standard" symbol keys.
143;;;
144(hemlock-ext:define-keysym 96 "`") (hemlock-ext:define-keysym 126 "~")
145(hemlock-ext:define-keysym 45 "-") (hemlock-ext:define-keysym 95 "_")
146(hemlock-ext:define-keysym 61 "=") (hemlock-ext:define-keysym 43 "+")
147(hemlock-ext:define-keysym 91 "[") (hemlock-ext:define-keysym 123 "{")
148(hemlock-ext:define-keysym 93 "]") (hemlock-ext:define-keysym 125 "}")
149(hemlock-ext:define-keysym 92 "\\") (hemlock-ext:define-keysym 124 "|")
150(hemlock-ext:define-keysym 59 ";") (hemlock-ext:define-keysym 58 ":")
151(hemlock-ext:define-keysym 39 "'") (hemlock-ext:define-keysym 34 "\"")
152(hemlock-ext:define-keysym 44 ",") (hemlock-ext:define-keysym 60 "<")
153(hemlock-ext:define-keysym 46 ".") (hemlock-ext:define-keysym 62 ">")
154(hemlock-ext:define-keysym 47 "/") (hemlock-ext:define-keysym 63 "?")
155
156;;; Standard Mouse keysyms.
157;;;
158(hemlock-ext::define-mouse-keysym 1 25601 "Leftdown" "Super" :button-press)
159(hemlock-ext::define-mouse-keysym 1 25602 "Leftup" "Super" :button-release)
160
161(hemlock-ext::define-mouse-keysym 2 25603 "Middledown" "Super" :button-press)
162(hemlock-ext::define-mouse-keysym 2 25604 "Middleup" "Super" :button-release)
163
164(hemlock-ext::define-mouse-keysym 3 25605 "Rightdown" "Super" :button-press)
165(hemlock-ext::define-mouse-keysym 3 25606 "Rightup" "Super" :button-release)
166
167;;;
168
169;(hemlock-ext:define-keysym 65290 "linefeed")
170
171
172
173;;;; SETFs of KEY-EVENT-CHAR and CHAR-KEY-EVENT.
174
175;;; Converting ASCII control characters to Common Lisp control characters:
176;;; ASCII control character codes are separated from the codes of the
177;;; "non-controlified" characters by the code of atsign.  The ASCII control
178;;; character codes range from ^@ (0) through ^_ (one less than the code of
179;;; space).  We iterate over this range adding the ASCII code of atsign to
180;;; get the "non-controlified" character code.  With each of these, we turn
181;;; the code into a Common Lisp character and set its :control bit.  Certain
182;;; ASCII control characters have to be translated to special Common Lisp
183;;; characters outside of the loop.
184;;;    With the advent of Hemlock running under X, and all the key bindings
185;;; changing, we also downcase each Common Lisp character (where normally
186;;; control characters come in upcased) in an effort to obtain normal command
187;;; bindings.  Commands bound to uppercase modified characters will not be
188;;; accessible to terminal interaction.
189;;;
190(let ((@-code (char-code #\@)))
191  (dotimes (i (char-code #\space))
192    (setf (hemlock-ext:char-key-event (code-char i))
193          (hemlock-ext::make-key-event (string (char-downcase (code-char (+ i @-code))))
194                               (hemlock-ext:key-event-modifier-mask "control")))))
195(setf (hemlock-ext:char-key-event (code-char 9)) (hemlock-ext::make-key-event #k"Tab"))
196(setf (hemlock-ext:char-key-event (code-char 10)) (hemlock-ext::make-key-event #k"Linefeed"))
197(setf (hemlock-ext:char-key-event (code-char 13)) (hemlock-ext::make-key-event #k"Return"))
198(setf (hemlock-ext:char-key-event (code-char 27)) (hemlock-ext::make-key-event #k"Alt"))
199(setf (hemlock-ext:char-key-event (code-char 8)) (hemlock-ext::make-key-event #k"Backspace"))
200;;;
201;;; Other ASCII codes are exactly the same as the Common Lisp codes.
202;;;
203(do ((i (char-code #\space) (1+ i)))
204    ((= i 128))
205  (setf (hemlock-ext:char-key-event (code-char i))
206        (hemlock-ext::make-key-event (string (code-char i)))))
207
208;;; This makes KEY-EVENT-CHAR the inverse of CHAR-KEY-EVENT from the start.
209;;; It need not be this way, but it is.
210;;;
211(dotimes (i 128)
212  (let ((character (code-char i)))
213    (setf (hemlock-ext::key-event-char (hemlock-ext:char-key-event character)) character)))
214
215;;; Since we treated these characters specially above when setting
216;;; HEMLOCK-EXT:CHAR-KEY-EVENT above, we must set these HEMLOCK-EXT:KEY-EVENT-CHAR's specially
217;;; to make quoting characters into Hemlock buffers more obvious for users.
218;;;
219(setf (hemlock-ext:key-event-char #k"C-h") #\backspace)
220(setf (hemlock-ext:key-event-char #k"C-i") #\tab)
221(setf (hemlock-ext:key-event-char #k"C-j") #\linefeed)
222(setf (hemlock-ext:key-event-char #k"C-m") #\return)
Note: See TracBrowser for help on using the repository browser.