CursorsImpl.mesa; written by S. McGregor
Last Edited by McGregor, July 21, 1983 2:18 pm
Last Edited by: Maxwell, January 3, 1983 1:55 pm
DIRECTORY
Cursors,
Inline USING[BITNOT, BITOR],
Interminal USING [SetCursorOffset, SetCursorPattern];
CursorsImpl: CEDAR MONITOR IMPORTS Inline, Interminal EXPORTS Cursors =
BEGIN OPEN Interminal, Cursors;
global variables and types
globalInfo: PUBLIC CursorInfo ← [last, 0, 0, FALSE];
globalBits: CursorArray;
lastUsedCursor: CursorType ← LAST[PredefinedCursor];
clientCursors: ARRAY ClientCursor OF CursorHandle;
procedures
SetCursor: PUBLIC ENTRY PROC [type: CursorType] = TRUSTED BEGIN
SELECT type FROM
bullseye => BEGIN
globalInfo ← [bullseye, -7,-7, FALSE];
SetCursorPattern[ globalBits ← [
003700B, 007740B, 014060B, 030030B,
060014B, 140006B, 141606B, 141606B,
141606B, 140006B, 060014B, 030030B,
014060B, 007740B, 003700B, 000000B] ];
END;
hourGlass => BEGIN
globalInfo ← [hourGlass, -7,-7, FALSE];
SetCursorPattern[ globalBits ← [
177777B, 100001B, 040002B, 034034B,
017170B, 007560B, 003740B, 001700B,
001100B, 002440B, 04220B, 010610B,
021704B, 047762B, 177777B, 177777B] ];
END;
menu => BEGIN
globalInfo ← [menu, 0,-7, FALSE];
SetCursorPattern[ globalBits ← [
000000B, 000000B, 000000B, 001000B,
003001B, 007003B, 036007B, 177776B,
177776B, 036007B, 007003B, 003001B,
001000B, 000000B, 000000B, 000000B] ];
END;
scrollUpDown => BEGIN
globalInfo ← [scrollUpDown, -7,-7, FALSE];
SetCursorPattern[ globalBits ← [
000400B, 001600B, 003700B, 007740B,
017760B, 001600B, 001600B, 001600B,
001600B, 001600B, 001600B, 017760B,
007740B, 003700B, 001600B, 000400B] ];
END;
textPointer => BEGIN
globalInfo ← [textPointer, 0,0, FALSE];
SetCursorPattern[ globalBits ← [
100000B, 140000B, 160000B, 170000B,
174000B, 176000B, 177000B, 170000B,
154000B, 114000B, 006000B, 006000B,
003000B, 003000B, 001400B, 001400B] ];
END;
activate => BEGIN
globalInfo ← [activate, -7,-7, FALSE];
SetCursorPattern[ globalBits ← [
177777B, 177777B, 140003B, 140003B,
140003B, 140003B, 140003B, 140003B,
140003B, 140003B, 140003B, 140003B,
140003B, 140003B, 177777B, 177777B] ];
END;
blank => BEGIN
globalInfo ← [blank, 0,0, FALSE];
SetCursorPattern[ globalBits ← [
000000B, 000000B, 000000B, 000000B,
000000B, 000000B, 000000B, 000000B,
000000B, 000000B, 000000B, 000000B,
000000B, 000000B, 000000B, 000000B] ];
END;
confirm => BEGIN
globalInfo ← [confirm, 0,0, FALSE];
SetCursorPattern[ globalBits ← [
000000B, 000000B, 167227B, 105324B,
105326B, 105264B, 167224B, 000000B,
000000B, 073642B, 022266B, 023652B,
022442B, 072242B, 000000B, 000000B] ];
END;
crossHairsCircle => BEGIN
globalInfo ← [crossHairsCircle, -7,-7, FALSE];
SetCursorPattern[ globalBits ← [
001700B, 007760B, 014630B, 030614B,
060606B, 040602B, 140603B, 177177B,
177177B, 140603B, 040602B, 060606B,
030614B, 014630B, 007760B, 001700B] ];
END;
ftp => BEGIN
globalInfo ← [ftp, -7,-7, FALSE];
SetCursorPattern[ globalBits ← [
000177B, 076077B, 040037B, 040017B,
070007B, 043703B, 040401B, 040400B,
000400B, 100436B, 140421B, 160421B,
170036B, 174020B, 176020B, 177020B] ];
END;
typeKey => BEGIN
globalInfo ← [typeKey, -7,-7, FALSE];
SetCursorPattern[ globalBits ← [
002000B, 074000B, 140000B, 012767B,
012525B, 053566B, 111113B, 163100B,
000000B, 000000B, 154000B, 053520B,
062520B, 053360B, 155440B, 000140B] ];
END;
move => BEGIN
globalInfo ← [move, -7,-7, FALSE];
SetCursorPattern[ globalBits ← [
000000B, 000000B, 000000B, 014030B,
016070B, 017170B, 017770B, 015730B,
014630B, 014030B, 014030B, 014030B,
014030B, 000000B, 000000B, 000000B] ];
END;
mouseBlue => BEGIN
globalInfo ← [mouseBlue, -2,0, FALSE];
SetCursorPattern[ globalBits ← [
037770B, 020010B, 025350B, 025350B,
025350B, 025350B, 025350B, 020010B,
020010B, 020010B, 020010B, 020010B,
020010B, 020010B, 020010B, 037770B] ];
END;
mouseRed => BEGIN
globalInfo ← [mouseRed, -2,0, FALSE];
SetCursorPattern[ globalBits ← [
037770B, 020010B, 027250B, 027250B,
027250B, 027250B, 027250B, 020010B,
020010B, 020010B, 020010B, 020010B,
020010B, 020010B, 020010B, 037770B] ];
END;
mouseYellow => BEGIN
globalInfo ← [mouseYellow, -2,0, FALSE];
SetCursorPattern[ globalBits ← [
037770B, 020010B, 025650B, 025650B,
025650B, 025650B, 025650B, 020010B,
020010B, 020010B, 020010B, 020010B,
020010B, 020010B, 020010B, 037770B] ];
END;
grow => BEGIN
globalInfo ← [grow, 0,0, FALSE];
SetCursorPattern[ globalBits ← [
000000B, 000000B, 000000B, 003740B,
007760B, 006060B, 014000B, 014370B,
014370B, 014030B, 006060B, 007760B,
003740B, 000000B, 000000B, 000000B] ];
END;
pointDown => BEGIN
globalInfo ← [pointDown, -7,-15, FALSE];
SetCursorPattern[ globalBits ← [
001700B, 001700B, 001700B, 001700B,
001700B, 001700B, 001700B, 001700B,
001700B, 001700B, 037774B, 017770B,
007760B, 003740B, 001700B, 000600B] ];
END;
pointLeft => BEGIN
globalInfo ← [pointLeft, 0,-7, FALSE];
SetCursorPattern[ globalBits ← [
000000B, 000000B, 020000B, 060000B,
016000B, 036000B, 077777B, 177777B,
177777B, 077777B, 036000B, 016000B,
060000B, 020000B, 000000B, 000000B] ];
END;
pointRight => BEGIN
globalInfo ← [pointRight, -15,-7, FALSE];
SetCursorPattern[ globalBits ← [
000000B, 000000B, 000040B, 000060B,
000070B, 000074B, 177776B, 177777B,
177777B, 177776B, 000074B, 000070B,
000060B, 000040B, 000000B, 000000B] ];
END;
pointUp => BEGIN
globalInfo ← [pointUp, -7,0, FALSE];
SetCursorPattern[ globalBits ← [
000600B, 001700B, 003740B, 007760B,
017770B, 037774B, 001700B, 001700B,
001700B, 001700B, 001700B, 001700B,
001700B, 001700B, 001700B, 001700B] ];
END;
questionMark => BEGIN
globalInfo ← [questionMark, -7,-7, FALSE];
SetCursorPattern[ globalBits ← [
017000B, 037600B, 060600B, 140300B,
140300B, 060300B, 000600B, 001400B,
003000B, 006000B, 006000B, 006000B,
000000B, 000000B, 006000B, 006000B] ];
END;
retry => BEGIN
globalInfo ← [retry, -7,-7, FALSE];
SetCursorPattern[ globalBits ← [
036370B, 021200B, 021200B, 036347B,
024200B, 022200B, 021370B, 000000B,
000000B, 175721B, 021052B, 021044B,
021704B, 021204B, 021104B, 021044B] ];
END;
scrollDown => BEGIN
globalInfo ← [scrollDown, -7,-7, FALSE];
SetCursorPattern[ globalBits ← [
007760B, 007760B, 007760B, 007760B,
007760B, 007760B, 007760B, 007760B,
007760B, 077776B, 037774B, 017770B,
007760B, 003740B, 001700B, 000600B] ];
END;
scrollLeft => BEGIN
globalInfo ← [scrollLeft, -7,-7, FALSE];
SetCursorPattern[ globalBits ← [
000000B, 001000B, 003000B, 007000B,
017777B, 037777B, 077777B, 177777B,
177777B, 077777B, 037777B, 017777B,
007000B, 003000B, 001000B, 000000B] ];
END;
scrollLeftRight => BEGIN
globalInfo ← [scrollLeftRight, -7,-7, FALSE];
SetCursorPattern[ globalBits ← [
000000B, 000000B, 000000B, 004020B,
014030B, 034034B, 077776B, 177777B,
177777B, 077776B, 034034B, 014030B,
004020B, 000000B, 000000B, 000000B] ];
END;
scrollUp => BEGIN
globalInfo ← [scrollUp, -7,-7, FALSE];
SetCursorPattern[ globalBits ← [
000600B, 001700B, 003740B, 007760B,
017770B, 037774B, 077776B, 007760B,
007760B, 007760B, 007760B, 007760B,
007760B, 007760B, 007760B, 007760B] ];
END;
scrollRight => BEGIN
globalInfo ← [scrollRight, -7,-7, FALSE];
SetCursorPattern[ globalBits ← [
000000B, 000100B, 000140B, 000160B,
177770B, 177774B, 177776B, 177777B,
177777B, 177776B, 177774B, 177770B,
000160B, 000140B, 000100B, 000000B] ];
END;
ENDCASE => BEGIN
globalInfo ← clientCursors[type].info;
SetCursorPattern[globalBits ← clientCursors[type].bits];
END;
SetCursorOffset[globalInfo.hotX, globalInfo.hotY];
END;
InvertCursor: PUBLIC ENTRY PROC = BEGIN
FOR n: CARDINAL IN [0..SIZE[CursorArray]) DO
globalBits[n] ← Inline.BITNOT[globalBits[n]];
ENDLOOP;
TRUSTED {SetCursorPattern[globalBits]};
globalInfo.inverted ← ~ globalInfo.inverted;
END;
NewCursor: PUBLIC ENTRY PROC [bits: CursorArray, hotX, hotY: INTEGER ← 0]
RETURNS [CursorType] = BEGIN
lastUsedCursor ← SUCC[lastUsedCursor];
clientCursors[lastUsedCursor] ← NEW[CursorRec ← [
[lastUsedCursor, hotX, hotY, FALSE],
bits
]];
RETURN[lastUsedCursor];
END;
AddCursorCorner: PUBLIC ENTRY PROC [cornerSide: CornerSide] =
BEGIN OPEN Inline;
i: CARDINAL[0..15];
SELECT cornerSide FROM
upperLeft =>
BEGIN
globalInfo.hotX ← globalInfo.hotY ← 0;
globalBits[0] ← 177777B;
globalBits[1] ← 177777B;
FOR i IN [2..16) DO
globalBits[i] ← BITOR[globalBits[i], 140000B];
ENDLOOP;
END;
upperRight =>
BEGIN
globalInfo.hotX ← -15;
globalInfo.hotY ← 0;
globalBits[0] ← 177777B;
globalBits[1] ← 177777B;
FOR i IN [2..16) DO
globalBits[i] ← BITOR[globalBits[i], 000003B];
ENDLOOP;
END;
lowerLeft =>
BEGIN
globalInfo.hotX ← 0;
globalInfo.hotY ← -15;
globalBits[14] ← 177777B;
globalBits[15] ← 177777B;
FOR i IN [0..14) DO
globalBits[i] ← BITOR[globalBits[i], 140000B];
ENDLOOP;
END;
lowerRight =>
BEGIN
globalInfo.hotX ← globalInfo.hotY ← -15;
globalBits[14] ← 177777B;
globalBits[15] ← 177777B;
FOR i IN [0..14) DO
globalBits[i] ← BITOR[globalBits[i], 000003B];
ENDLOOP;
END;
upperSide =>
BEGIN
globalBits[0] ← 177777B;
globalBits[1] ← 177777B;
END;
lowerSide =>
BEGIN
globalBits[14] ← 177777B;
globalBits[15] ← 177777B;
END;
leftSide =>
BEGIN
FOR i IN [0..16) DO
globalBits[i] ← BITOR[globalBits[i], 140000B];
ENDLOOP;
END;
rightSide =>
BEGIN
FOR i IN [0..16) DO
globalBits[i] ← BITOR[globalBits[i], 000003B];
ENDLOOP;
END;
ENDCASE;
TRUSTED {SetCursorPattern[globalBits]};
TRUSTED {SetCursorOffset[globalInfo.hotX, globalInfo.hotY]};
END;
END.