MachineDependentPoppingImpl.mesa
Copyright Ó 1991, 1992 by Xerox Corporation. All rights reserved.
Last tweaked by Mike Spreitzer on July 27, 1992 2:36 pm PDT
Bier, August 13, 1990 4:06 pm PDT
Willie-s, March 10, 1992 2:02 pm PST
Michael Plass, March 10, 1992 9:47 am PST
DIRECTORY CardTab, Cursors, FileNames, FS, MachineDependentPopping, PopUpButtons, Rope, SymTab, TIPPrivate, TIPUser, UserInput, UserInputDiscrimination, UserInputGetActions, VersionMap, VersionMapDefaults, ViewersWorld, ViewersWorldInstance;
MachineDependentPoppingImpl:
CEDAR
PROGRAM
IMPORTS CardTab, FileNames, FS, Rope, SymTab, TIPPrivate, UserInputDiscrimination, VersionMap, VersionMapDefaults, ViewersWorld, ViewersWorldInstance
EXPORTS MachineDependentPopping, PopUpButtons
=
BEGIN OPEN MachineDependentPopping;
ViewersWorldInst: TYPE ~ ViewersWorld.Ref;
maySetMouse: PUBLIC BOOL ¬ TRUE;
MayNotSetMouse: PUBLIC ERROR ~ CODE;
vw: ViewersWorldInst ~ ViewersWorldInstance.GetWorld[];
globToName: CardTab.Ref ~ CardTab.Create[];
versionMap: SymTab.Ref ¬ NIL;
mappedList: VersionMap.MapList ¬ NIL;
tipParseInfo: TIPPrivate.TIPParseInfo ¬ TIPPrivate.CreateParseInfo[];
GetCurrentMouse:
PUBLIC
PROC
RETURNS [ScreenCoords] ~
TRUSTED {
x, y: INTEGER;
display: REF;
[x, y, display] ¬ ViewersWorld.GetMousePosition[vw];
RETURN [[x: x, y: y, color: display#NIL]]};
SetMouse:
PUBLIC
PROC [sc: ScreenCoords] ~ {
ViewersWorld.SetMousePosition[viewersWorld: vw, x: sc.x, y: sc.y, display: IF sc.color THEN $color ELSE NIL];
};
ToScreenCoords:
PUBLIC
PROC [ra:
REF
ANY]
RETURNS [ScreenCoords] ~ {
WITH ra
SELECT
FROM
x: REF ScreenCoords => RETURN [x];
x: TIPUser.TIPScreenCoords => RETURN [[x: x.mouseX, y: x.mouseY, color: x.color]];
ENDCASE => IF ra=NIL THEN RETURN GetCurrentMouse[] ELSE ERROR;
};
GuessPackageName:
PUBLIC
PROC [packageGlobalFrame:
POINTER]
RETURNS [packageName:
ROPE]
~ {RETURN [NIL]};
GetFullFilename:
PUBLIC
PROC [hint, wDir:
ROPE]
RETURNS [full, ohneVersion:
ROPE] ~ {
cp: FS.ComponentPositions;
full ¬ NIL;
full ¬ FS.FileInfo[name: hint, wDir: wDir !FS.Error => CONTINUE].fullFName;
IF full=
NIL
THEN {
vm: VersionMap.MapList ~ VersionMapDefaults.GetMapList[$Source];
found: BOOL;
val: REF ANY;
IF versionMap=
NIL
OR mappedList#vm
THEN {
versionMap ¬ SymTab.Create[case: FALSE];
mappedList ¬ vm};
[found, val] ¬ versionMap.Fetch[hint];
IF
NOT found
THEN {
names: VersionMap.MapAndNameList ¬ VersionMap.ShortNameToNames[vm, hint];
FOR names ¬ names, names.rest
WHILE names #
NIL
DO
[full, cp] ¬ FS.ExpandName[names.first.name];
ohneVersion ¬ full.Substr[len: cp.ext.start + cp.ext.length];
full ¬ FS.FileInfo[ohneVersion !FS.Error => LOOP].fullFName;
[] ¬ versionMap.Store[hint, full];
RETURN;
ENDLOOP;
[] ¬ versionMap.Store[hint, NIL];
RETURN [NIL, NIL];
}
ELSE
IF val#
NIL
THEN {
[full, cp] ¬ FS.ExpandName[NARROW[val]];
ohneVersion ¬ full.Substr[len: cp.ext.start + cp.ext.length];
RETURN;
}
ELSE RETURN [NIL, NIL];
}
ELSE {
[full, cp] ¬ FS.ExpandName[full];
ohneVersion ¬ full.Substr[len: cp.ext.start + cp.ext.length];
RETURN};
};
GetWDir:
PUBLIC
PROC
RETURNS [
ROPE] ~ {
RETURN FileNames.CurrentWorkingDirectory[]};
SetTipTable: PUBLIC PROC [tt: TIPUser.TIPTable] ~ {tipParseInfo.tableHead ¬ tt};
MatchEvent:
PUBLIC
PROC [actionQueue, action:
REF
ANY]
RETURNS [
LIST
OF
REF
ANY] ~ {
posn: UserInput.Handle ~ UserInputDiscrimination.NarrowHandle[actionQueue];
rab: REF UserInputGetActions.InputActionBody ~ NARROW[action];
tipParseInfo.inCreek ¬ posn;
RETURN [TIPPrivate.WideMatchEvent[tipParseInfo, rab]]};
END.