~ubuntu-branches/ubuntu/intrepid/mit-scheme/intrepid-updates

« back to all changes in this revision

Viewing changes to src/edwin/key-w32.scm

  • Committer: Bazaar Package Importer
  • Author(s): Chris Hanson
  • Date: 2002-03-14 17:04:07 UTC
  • Revision ID: james.westby@ubuntu.com-20020314170407-m5lg1d6bdsl9lv0s
Tags: upstream-7.7.0
ImportĀ upstreamĀ versionĀ 7.7.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
;;; -*-Scheme-*-
 
2
;;;
 
3
;;; $Id: key-w32.scm,v 1.3 1999/01/02 06:11:34 cph Exp $
 
4
;;;
 
5
;;; Copyright (c) 1991-1999 Massachusetts Institute of Technology
 
6
;;;
 
7
;;; This program is free software; you can redistribute it and/or
 
8
;;; modify it under the terms of the GNU General Public License as
 
9
;;; published by the Free Software Foundation; either version 2 of the
 
10
;;; License, or (at your option) any later version.
 
11
;;;
 
12
;;; This program is distributed in the hope that it will be useful,
 
13
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
15
;;; General Public License for more details.
 
16
;;;
 
17
;;; You should have received a copy of the GNU General Public License
 
18
;;; along with this program; if not, write to the Free Software
 
19
;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
20
;;;
 
21
 
 
22
;;;; Windows Keys
 
23
;;; Package: (edwin win32-keys)
 
24
 
 
25
(declare (usual-integrations))
 
26
 
 
27
(define (initialize-package!)
 
28
  (set! end (make-special-key 'END 0))
 
29
  unspecific)
 
30
 
 
31
(define end)
 
32
 
 
33
(define (win32-make-special-key keysym bucky-bits)
 
34
  (cond ((vk-code->name keysym)
 
35
         => (lambda (name)
 
36
              (make-special-key name bucky-bits)))
 
37
        (else #F)))
 
38
 
 
39
(define (vk-code->name vk-code)
 
40
  (vector-ref win32-key-translation-vector vk-code))
 
41
 
 
42
;; This constructs a vector mapping VK_* codes (integers 0..255) to
 
43
;; special key names (symbols).  It doesn not include keys that are
 
44
;; affected by the Win32 API TranslateMessage, which are: any printing
 
45
;; character, backspace, enter, escape, tab
 
46
 
 
47
(define win32-key-translation-vector
 
48
  (let ((v (make-vector 256 #f)))
 
49
    (for-each (lambda (def)
 
50
                (if (not (null? (cddr def)))
 
51
                    (vector-set! v (second def) (third def))))
 
52
              '(;;VK_name          code    special-key name
 
53
                (VK_LBUTTON        #x01)
 
54
                (VK_RBUTTON        #x02)
 
55
                (VK_CANCEL         #x03)
 
56
                (VK_MBUTTON        #x04)
 
57
 
 
58
                (VK_BACK           #x08)
 
59
                (VK_TAB            #x09)
 
60
 
 
61
                (VK_CLEAR          #x0C)
 
62
                (VK_RETURN         #x0D)
 
63
 
 
64
                (VK_SHIFT          #x10)
 
65
                (VK_CONTROL        #x11)
 
66
                (VK_MENU           #x12)
 
67
                (VK_PAUSE          #x13    stop)
 
68
                (VK_CAPITAL        #x14)
 
69
 
 
70
                (VK_ESCAPE         #x1B)
 
71
 
 
72
                (VK_SPACE          #x20)
 
73
                (VK_PRIOR          #x21    prior)
 
74
                (VK_NEXT           #x22    next)
 
75
                (VK_END            #x23    end)
 
76
                (VK_HOME           #x24    home)
 
77
                (VK_LEFT           #x25    left)
 
78
                (VK_UP             #x26    up)
 
79
                (VK_RIGHT          #x27    right)
 
80
                (VK_DOWN           #x28    down)
 
81
                (VK_SELECT         #x29    select)
 
82
                (VK_PRINT          #x2A    print)
 
83
                (VK_EXECUTE        #x2B)
 
84
                (VK_SNAPSHOT       #x2C)
 
85
                (VK_INSERT         #x2D    insertchar)
 
86
                (VK_DELETE         #x2E    deletechar)
 
87
                (VK_HELP           #x2F)
 
88
 
 
89
                (VK_NUMPAD0        #x60)
 
90
                (VK_NUMPAD1        #x61)
 
91
                (VK_NUMPAD2        #x62)
 
92
                (VK_NUMPAD3        #x63)
 
93
                (VK_NUMPAD4        #x64)
 
94
                (VK_NUMPAD5        #x65)
 
95
                (VK_NUMPAD6        #x66)
 
96
                (VK_NUMPAD7        #x67)
 
97
                (VK_NUMPAD8        #x68)
 
98
                (VK_NUMPAD9        #x69)
 
99
                (VK_MULTIPLY       #x6A)
 
100
                (VK_ADD            #x6B)
 
101
                (VK_SEPARATOR      #x6C)
 
102
                (VK_SUBTRACT       #x6D)
 
103
                (VK_DECIMAL        #x6E)
 
104
                (VK_DIVIDE         #x6F)
 
105
                (VK_F1             #x70    f1)
 
106
                (VK_F2             #x71    f2)
 
107
                (VK_F3             #x72    f3)
 
108
                (VK_F4             #x73    f4)
 
109
                (VK_F5             #x74    f5)
 
110
                (VK_F6             #x75    f6)
 
111
                (VK_F7             #x76    f7)
 
112
                (VK_F8             #x77    f8)
 
113
                (VK_F9             #x78    f9)
 
114
                (VK_F10            #x79    f10)
 
115
                (VK_F11            #x7A    f11)
 
116
                (VK_F12            #x7B    f12)
 
117
                (VK_F13            #x7C    f13)
 
118
                (VK_F14            #x7D    f14)
 
119
                (VK_F15            #x7E    f15)
 
120
                (VK_F16            #x7F    f16)
 
121
                (VK_F17            #x80    f17)
 
122
                (VK_F18            #x81    f18)
 
123
                (VK_F19            #x82    f19)
 
124
                (VK_F20            #x83    f20)
 
125
                (VK_F21            #x84    f21)
 
126
                (VK_F22            #x85    f22)
 
127
                (VK_F23            #x86    f23)
 
128
                (VK_F24            #x87    f24)
 
129
 
 
130
                (VK_NUMLOCK        #x90)
 
131
                (VK_SCROLL         #x91)
 
132
 
 
133
                (VK_LSHIFT         #xA0)
 
134
                (VK_RSHIFT         #xA1)
 
135
                (VK_LCONTROL       #xA2)
 
136
                (VK_RCONTROL       #xA3)
 
137
                (VK_LMENU          #xA4)
 
138
                (VK_RMENU          #xA5)
 
139
 
 
140
                (VK_ATTN           #xF6)
 
141
                (VK_CRSEL          #xF7)
 
142
                (VK_EXSEL          #xF8)
 
143
                (VK_EREOF          #xF9)
 
144
                (VK_PLAY           #xFA)
 
145
                (VK_ZOOM           #xFB)
 
146
                (VK_NONAME         #xFC)
 
147
                (VK_PA1            #xFD)
 
148
                (VK_OEM_CLEAR      #xFE)))
 
149
    v))
 
 
b'\\ No newline at end of file'