JunoCursorJunk.mesa

Last edited by Stolfi May 18, 1984 10:33:59 pm PDT

Removed May 18, 1984 10:23:47 pm PDT PDT from JunoCursorMenuImpl.mesa:

From RemoveCursor:

IF ix=-1 THEN                -- DEBUG
{ViewerOps.NotifyViewer            -- DEBUG
[menu.parent, LIST[$Debug, $NotFound, name]];     -- DEBUG
RETURN};                 -- DEBUG

From PickUpCursor:

IF ix=-1 THEN               -- DEBUG
{ViewerOps.NotifyViewer            -- DEBUG
[menu.parent, LIST[$Debug, $NotFound, name]];     -- DEBUG
RETURN};                 -- DEBUG

From HighlightCursor:

IF champ=-1 THEN               -- DEBUG
{ViewerOps.NotifyViewer             -- DEBUG
[menu.parent, LIST[$Debug, $NotFound, name]];     -- DEBUG
RETURN};                 -- DEBUG

From MousedCursor:

IF table.cursor[champ].type = blank THEN -- no luck

BEGIN

Try exhaustive search

champ ← -1;

zcol, zrow: INTEGER;
xc, yc: INTEGER; -- center of current candidate cursor
ix: INTEGER ← 0;
champDist: INTEGER ← 2*cursorDelta+1; -- distance between champ and click
dist: INTEGER;

yc ← extraMargin+cursorMargin+8 + (table.rows-1)*cursorDelta;
FOR zrow IN [1..table.rows] DO
xc ← extraMargin+cursorMargin+8;
FOR zcol IN [1..table.cols] DO
IF table.cursor[ix].type # blank THEN
{dist ← MAX [ABS[y - yc], ABS[x - xc]];
IF dist < champDist THEN
{champ ← ix; champDist ← dist; col ← zcol; row ← zrow}};
ix ← ix+1;
xc ← xc + cursorDelta
ENDLOOP;
yc ← yc - cursorDelta
ENDLOOP

END;

From ProcessMenuClicks:

ViewerOps.NotifyViewer [self.parent, CONS [$Debug, input]];  -- DEBUG

IF champ = -1 THEN        -- DEBUG
{ViewerOps.NotifyViewer      -- DEBUG
[self.parent, LIST[$Debug, $Missed]];   -- DEBUG
RETURN};          -- DEBUG

Removed May 18, 1984 10:20:30 pm PDT from JunoCursorTest.mesa:

ItemsChanged: CONDITION;

GetNewItems: ENTRY PROC RETURNS [start, lim: LIST OF Item] =

BEGIN
WAIT ItemsChanged;
RETURN [items, olditems];
END;

WatchNewItems: PROC =

BEGIN

old, new: LIST OF Item ← NIL;

DO

new← GetNewItems[];
FOR p: LIST OF Item ← new, p.rest WHILE p#old DO
ViewerOps.PaintViewer
[viewer: viewer, hint: client, clearClient: FALSE, whatChanged: p.first]
ENDLOOP;
old ← new

ENDLOOP

END;

Process.Detach[FORK WatchNewItems[]]