IconManagerImpl.mesa; Edited by McGregor on August 30, 1982 10:11 am
Last Edited by: Maxwell, December 7, 1982 11:11 am
DIRECTORY
Cursors USING [SetCursor],
IconManager,
InputFocus USING [GetInputFocus, SetInputFocus],
MessageWindow USING [Append, Blink, Confirm],
Process USING [Detach],
Rope USING [Cat],
TIPUser USING [InstantiateNewTIPTable, TIPScreenCoords, TIPTable],
ViewerOps USING [DestroyViewer, OpenIcon, PaintViewer, ChangeColumn],
ViewerClasses,
WindowManager USING [colorDisplayOn];
IconManagerImpl: PROGRAM
IMPORTS Cursors, InputFocus, MessageWindow, Process, Rope, TIPUser, ViewerOps,
WindowManager
EXPORTS IconManager
SHARES ViewerClasses =
BEGIN OPEN Cursors, ViewerClasses;
IconNotify:
PUBLIC ViewerClasses.NotifyProc =
BEGIN
mx, my: INTEGER;
closeOthers, switchDisplays: BOOL ← FALSE;
FOR l:
LIST
OF
REF
ANY ← input, l.rest
UNTIL l =
NIL
DO
WITH l.first
SELECT
FROM
z: TIPUser.TIPScreenCoords => [mx, ----, my] ← z^;
z:
ATOM =>
SELECT z
FROM
$CloseOthers => closeOthers ← TRUE;
$Color =>
IF WindowManager.colorDisplayOn
THEN
ViewerOps.ChangeColumn[self, color];
$Delete => DestroyIcon[self];
$Left => ViewerOps.ChangeColumn[self, left];
$MouseMove => Cursors.SetCursor[textPointer];
$Open => ViewerOps.OpenIcon[self, closeOthers];
$Right => ViewerOps.ChangeColumn[self, right];
$Select => SelectIcon[self];
$TogglePos => ViewerOps.ChangeColumn[self,
SELECT self.column
FROM
left => right,
right => left,
color => left,
ENDCASE => ERROR];
ENDCASE => NULL;
ENDCASE => NULL;
ENDLOOP;
END;
IconModify:
PUBLIC ViewerClasses.ModifyProc =
BEGIN
SELECT change
FROM
set => ViewerOps.PaintViewer[self, all];
kill => {selectedIcon ← NIL; ViewerOps.PaintViewer[self, all]};
ENDCASE;
END;
selectedIcon: PUBLIC ViewerClasses.Viewer ← NIL;
DestroyIcon:
PROC [icon: Viewer] =
BEGIN
IF icon.inhibitDestroy
THEN {
MessageWindow.Append["That icon cannot be destroyed.", TRUE];
MessageWindow.Blink[];
RETURN};
IF icon.link =
NIL
AND (icon.newVersion
OR icon.newFile)
THEN
[] ← Process.Detach[FORK ConfirmDestroyIcon[icon]] -- fork for confirmation
ELSE ViewerOps.DestroyViewer[icon];
END;
ConfirmDestroyIcon:
PROC [icon: Viewer] =
BEGIN
IF MessageWindow.Confirm[Rope.Cat["Confirm delete (and loss of edits) for icon: ", icon.name]]
THEN ViewerOps.DestroyViewer[icon];
END;
SelectIcon:
PROC [viewer: Viewer] =
BEGIN
IF InputFocus.GetInputFocus[].owner#viewer
THEN
BEGIN
InputFocus.SetInputFocus[NIL]; -- kill old so we don't smash selectedIcon
selectedIcon ← viewer;
InputFocus.SetInputFocus[viewer];
END;
END;
Open: PROC [viewer: Viewer, closeOthers: BOOL] = {ViewerOps.OpenIcon[viewer, closeOthers]};
iconTIP:
PUBLIC TIPUser.TIPTable ←
TIPUser.InstantiateNewTIPTable["/Indigo/CedarViewers/Viewers/Icons.tip"] ;
END.