AdobeViewersImpl.mesa
Copyright Ó 1990, 1991, 1992, 1993 by Xerox Corporation. All rights reserved.
Philip James, March 10, 1992 3:28 pm PST
Foote, July 14, 1993 10:13 am PDT
Willie-s, August 2, 1993 6:24 pm PDT
Swen Johnson, August 24, 1993 5:32 pm PDT
DIRECTORY
AdobeCommon,
AdobeCommonInternal USING [EntryBytesType, InstanceData, ProcessUserDotCM, SetTypedInitialSystem, SystemNotFound],
AdobeOps USING [ARNumber, ARSystemHandle, ToolType, QueryList],
AdobeTip USING [AdjustStringField, defaultHeight],
AdobeTool USING [ChooseQLCmd, CurrentButtonProcData, EmptyContents, ReportCommandProc, ResetProc, SetProc, SetUpWindow, ShowSortKeys, SortCommandProc, QueryCommandProc],
AdobeUI USING [AbortCheckOut, AnotherTool, ChangeSystem, CheckField, CheckInAndExamine, CheckInAndOut, Clear, CheckIn, CheckOut, CurrentButton, EditFilename, Examine, Get, Handle, HandleField, HintMenu, ListAction, Next, NumberEquals, OutputFormat, Overwrite, Previous, Put, QLOperandProc, ReportOutputFile, ReportTemplateFile, RopeFromTool, ResetQL, ShowElements, Submit, SubmitFieldButton, SystemMenu, ToolMenu, UseQL, WhichQL, WhichQL2],
Buttons USING [Button, ButtonProc, Create, ReLabel, SetDisplayStyle],
Commander USING [CommandProc, Register],
CommanderOps USING [NextArgument, NumArgs],
Containers USING [ChildXBound, ChildYBound, Create],
CrRPC USING [Error],
Icons USING [IconFlavor, NewIconFromFile],
IO USING [PutF],
Labels USING [Create],
Menus USING [AppendMenuEntry, CreateEntry, CreateMenu, FindEntry, Menu, MenuEntry, MenuProc, ReplaceMenuEntry],
MessageWindow USING [],
PFS USING [GetWDir, RopeFromPath],
PopUpSelection USING [Request],
Rope USING [Cat, Concat, Equal, ROPE],
Rules USING [Create],
TypeScript USING [Create],
ViewerClasses USING [Viewer],
ViewerIO USING [CreateViewerStreams],
ViewerOps USING [DestroyViewer, MoveViewer, OpenIcon, PaintViewer],
ViewerTools USING [EnableUserEdits, GetContents, GetSelectionContents, InhibitUserEdits, MakeNewTextViewer, SelPos, SetContents, SetSelection];
AdobeViewersImpl: CEDAR MONITOR
IMPORTS AdobeCommon, AdobeCommonInternal, AdobeTip, AdobeTool, AdobeUI, Buttons, Commander, CommanderOps, Containers, CrRPC, Icons, IO, Labels, Menus, PFS, PopUpSelection, Rope, Rules, TypeScript, ViewerIO, ViewerOps, ViewerTools = {
Box: TYPE ~ AdobeCommon.Box;
ButtonData: TYPE = RECORD [
title: Rope.ROPE,
proc: Buttons.ButtonProc,
line: INT,
width: INT
];
ButtonsList: TYPE = LIST OF ButtonData;
nullButton: ButtonData ← ["NULL", NIL, -1, 0];
MakeViewerAdobeTool: AdobeCommon.AnotherToolProc = {
my: AdobeCommon.Handle ← NEW[AdobeCommon.AdobeViewerDataRec];
{
ENABLE {
AdobeCommonInternal.SystemNotFound => {
AdobeCommon.PostMessage[my, TRUE, "Initial system specified is invalid!"];
AdobeCommon.RemoveSystemFromKnownSystems[my.knownSystems.system[my.system], my.knownSystems];
GOTO errors;
};
};
my.isBusy ← TRUE;
IF iconList[sort] = unInit THEN {
check: Icons.IconFlavor ¬ Icons.NewIconFromFile[adobeIconPath, 0];
IF check # unInit THEN {
iconList[edit] ← check;
iconList[submit] ← Icons.NewIconFromFile[adobeIconPath, 1];
iconList[report] ← Icons.NewIconFromFile[adobeIconPath, 2];
iconList[sort] ← Icons.NewIconFromFile[adobeIconPath, 3];
iconList[query] ← Icons.NewIconFromFile[adobeIconPath, 4];
iconList[queryList] ← Icons.NewIconFromFile[adobeIconPath, 5];
submittingIcon ← Icons.NewIconFromFile[adobeIconPath, 6];
edittedIcon ← Icons.NewIconFromFile[adobeIconPath, 7];
};
};
my.systemHandle ← NIL;
my.report ← Report;
my.getContents ← ViewerGetContentsProc;
my.getSelectionContents ← ViewerGetSelectionContentsProc;
my.setContents ← ViewerSetContentsProc;
my.setSelection ← ViewerSetSelectionProc;
my.setDisplayStyle ← ViewerSetDisplayStyleProc;
my.setIcon ← ViewerSetIconProc;
my.addButtons ← AddButtons;
my.paintBox ← ViewerPaintBoxProc;
my.popUpRequest ← ViewerPopUpRequestProc;
my.reLabelBox ← ViewerReLabelBoxProc;
my.newMenuEntry ← ViewerNewMenuEntryProc;
my.findMenuEntry ← ViewerFindMenuEntryProc;
my.replaceMenuEntry ← ViewerReplaceMenuEntryProc;
my.makeAnotherTool ← MakeViewerAdobeTool;
my.inhibitEdits ← ViewerInhibitEditsProc;
my.enableEdits ← ViewerEnableEditsProc;
my.getBoxGeometry ← ViewerGetBoxGeometryProc;
my.setBoxGeometry ← ViewerSetBoxGeometryProc;
my.getBoxName ← ViewerGetBoxNameProc;
my.destroyBox ← ViewerDestroyBoxProc;
my.setBoxScrollable ← ViewerSetBoxScrollableProc;
my.xBoundBox ← ViewerXBoundBoxProc;
my.newFieldBox ← ViewerNewFieldBoxProc;
my.newLabelBox ← ViewerNewLabelBoxProc;
my.setContainerName ← ViewerSetContainerNameProc;
my.setMainName ← ViewerSetMainNameProc;
my.getMainName ← ViewerGetMainNameProc;
my.makeButton ← ViewerMakeButtonProc;
my.assistLogin ← ViewerAssistLoginProc;
IF parent = NIL THEN
AdobeCommonInternal.ProcessUserDotCM[my]
ELSE {
my.oldtool ← my.tool ← parent.tool;
my.knownSystems ← parent.knownSystems;
my.system ← my.oldsystem ← parent.system;
my.systemName ← parent.systemName;
my.systemHandle ← parent.systemHandle;
};
AddMenus[my];
AddSubContainers[my];
AddButtons[my];
SELECT my.tool FROM
edit => my.instanceData ← NEW[AdobeCommonInternal.InstanceData.edit];
submit => my.instanceData ← NEW[AdobeCommonInternal.InstanceData.submit];
report => my.instanceData ← NEW[AdobeCommonInternal.InstanceData.report];
query => my.instanceData ← NEW[AdobeCommonInternal.InstanceData.query];
sort => my.instanceData ← NEW[AdobeCommonInternal.InstanceData.sort];
queryList => my.instanceData ← NEW[AdobeCommonInternal.InstanceData.queryList];
ENDCASE;
IF my.systemHandle = NIL THEN
IF my.system # LAST[CARDINAL] THEN {
my.systemHandle ← AdobeCommon.FindSystem[NIL, my, my.knownSystems.system[my.system], FALSE !
CrRPC.Error => { my.systemHandle ← NIL; my.report[my, "Adobe server is down.\n"]; CONTINUE}
];
};
IF my.systemHandle # NIL THEN
AdobeTool.SetUpWindow[my];
my.isBusy ←FALSE;
EXITS
errors => {
my.isBusy ←FALSE;
my.system ← my.oldsystem ← LAST[CARDINAL];
};
}
};
AddSubContainers: PROCEDURE [handle: AdobeUI.Handle] = {
outerW, outerH: CARD;
handle.outer ← Containers.Create[
info: [
name: Rope.Concat["Adobe ", AdobeUI.RopeFromTool[handle.tool]],
iconic: TRUE,
column: left,
menu: MenuFromAny[handle.menu],
scrollable: FALSE,
icon: iconList[handle.tool]
]
];
[, , outerW, outerH] ← handle.getBoxGeometry[handle.outer];
handle.buttonViewer.outer ← Containers.Create[
info: [
parent: ViewerFromBox[handle.outer],
wx: 0,
wy: 0,
wh: 55,
ww: outerW,
border: FALSE,
scrollable: FALSE
]
];
[] ← Rules.Create[
info: [
parent: ViewerFromBox[handle.outer],
wx: 0, wy: 55,
ww: 2000, wh: 1],
paint: TRUE];
handle.messageViewer.outer ← TypeScript.Create[
info: [
parent: ViewerFromBox[handle.outer],
wx: 0,
wy: 56,
wh: 50,
ww: outerW,
border: FALSE,
scrollable: TRUE
]
];
[] ← Rules.Create[
info: [
parent: ViewerFromBox[handle.outer],
wx: 0, wy: 106,
ww: 2000, wh: 1],
paint: TRUE];
handle.fieldViewer.outer ← Containers.Create[
info: [
parent: ViewerFromBox[handle.outer],
wx: 0,
wy: 107,
wh: outerH,
ww: outerW,
border: FALSE,
scrollable: TRUE
]
];
handle.messageViewer.reportStream ← ViewerIO.CreateViewerStreams[
name: "Adobe Messages",
viewer: ViewerFromBox[handle.messageViewer.outer],
editedStream: FALSE
].out;
handle.xBoundBox[handle.outer, handle.buttonViewer.outer];
handle.xBoundBox[handle.outer, handle.fieldViewer.outer];
handle.xBoundBox[handle.outer, handle.messageViewer.outer];
Containers.ChildYBound[ViewerFromBox[handle.outer], ViewerFromBox[handle.fieldViewer.outer]];
ViewerOps.OpenIcon[ViewerFromBox[handle.outer]];
};
AddMenus: PROCEDURE [handle: AdobeUI.Handle] = {
systemName: Rope.ROPENIL;
handle.menu ← Menus.CreateMenu[lines: 1];
Menus.AppendMenuEntry[
menu: MenuFromAny[handle.menu],
entry: Menus.CreateEntry[
name: "Tool:",
proc: ToolMenuProc,
clientData: handle
]
];
Menus.AppendMenuEntry[
menu: MenuFromAny[handle.menu],
entry: Menus.CreateEntry[
name: Rope.Concat["{", Rope.Concat[AdobeUI.RopeFromTool[handle.tool], "}"]],
proc: DeadProc,
clientData: handle
]
];
Menus.AppendMenuEntry[
menu: MenuFromAny[handle.menu],
entry: Menus.CreateEntry[
name: "Another",
proc: AnotherProc,
clientData: handle
]
];
Menus.AppendMenuEntry[
menu: MenuFromAny[handle.menu],
entry: Menus.CreateEntry[
name: "ChangeSystem",
proc: ChangeSystemProc,
clientData: handle
]
];
Menus.AppendMenuEntry[
menu: MenuFromAny[handle.menu],
entry: Menus.CreateEntry[
name: "System:",
proc: SystemMenuProc,
clientData: handle
]
];
IF handle.system # LAST[CARDINAL] THEN
systemName ← handle.knownSystems.system[handle.system];
handle.systemMenuItem ← Menus.CreateEntry[
name: systemName,
proc: DeadProc,
clientData: handle
];
Menus.AppendMenuEntry[
menu: MenuFromAny[handle.menu],
entry: MenuEntryFromAny[handle.systemMenuItem]
];
};
AddButtons: AdobeCommon.AddButtonsProc = {
currButton, lastButton: Buttons.Button ← NIL;
lastLine, currLine: INTEGER ← 1;
buttonHeight: INTEGER ← 15;
buttonSpaceHeight: INTEGER ← buttonHeight + 2;
currX: INTEGER ← -1;
whichButtons: ButtonsList ← NIL;
tempButton: Buttons.Button ← NIL;
buttonCount, buttonIndex: CARD ← 0;
editorIndex: NAT ← 1;
FOR i: CARD IN [1..4] DO
h.destroyBox[h, h.editors[i], FALSE];
ENDLOOP;
IF h.controlButtons # NIL THEN
FOR i: CARD IN [0..h.controlButtons.len) DO
h.destroyBox[h, h.controlButtons[i], FALSE];
ENDLOOP;
WHILE handle.lastButton # NIL DO
tempButton ← handle.lastButton.sibling;
ViewerOps.DestroyViewer[handle.lastButton, TRUE];
handle.lastButton ← tempButton;
ENDLOOP;
SELECT h.tool FROM
edit => { whichButtons ← EditButtons };
submit => { whichButtons ← SubmitButtons };
report => { whichButtons ← ReportButtons };
query => { whichButtons ← QueryButtons };
sort => { whichButtons ← SortButtons };
queryList => { whichButtons ← QueryListButtons };
ENDCASE => { whichButtons ← EditButtons };
buttonCount ← 0;
FOR buttonLoop: ButtonsList ← whichButtons, buttonLoop.rest WHILE buttonLoop # NIL DO
buttonCount ← buttonCount + 1;
ENDLOOP;
h.controlButtons ← NEW[AdobeCommon.ControlSeqRec[buttonCount]];
buttonIndex ← 0;
FOR whichButtons ← whichButtons, whichButtons.rest WHILE whichButtons # NIL DO
thisButton: ButtonData ← whichButtons.first;
SELECT thisButton.title FROM
"NULL" => {};
"SKIP" => {
lastLine ← currLine;
currLine ← thisButton.line;
IF currLine # lastLine THEN
currX ← -1;
currButton ← h.editors[editorIndex] ← ViewerTools.MakeNewTextViewer[
info: [
parent: ViewerFromBox[h.buttonViewer.outer],
wx: currX + 5,
wy: ((currLine -1) * buttonSpaceHeight) - currLine + 1,
ww: thisButton.width,
wh: buttonHeight,
scrollable: FALSE,
sibling: lastButton,
border: FALSE
]
];
handle.lastButton ← currButton;
lastButton ← currButton;
editorIndex ← editorIndex + 1;
currX ← currX + thisButton.width - 1
};
ENDCASE => {
lastLine ← currLine;
currLine ← thisButton.line;
IF currLine # lastLine THEN
currX ← -1;
h.controlButtons[buttonIndex] ← Buttons.Create[
info: [
wx: currX + 5,
wy: ((currLine -1) * buttonSpaceHeight) - currLine,
ww: thisButton.width - 5,
wh: buttonHeight,
name: thisButton.title,
scrollable: FALSE,
sibling: lastButton,
parent: ViewerFromBox[h.buttonViewer.outer],
border: FALSE
],
proc: thisButton.proc,
clientData: h,
paint:FALSE
];
IF Rope.Equal[thisButton.title, "{plain}", FALSE] THEN
h.formatButton ← h.controlButtons[buttonIndex];
IF Rope.Equal[thisButton.title, " Overwrite", FALSE] THEN
h.overwriteButton ← h.controlButtons[buttonIndex];
IF Rope.Equal[thisButton.title, " UseQL", FALSE] THEN
h.useQLButton ← h.controlButtons[buttonIndex];
buttonIndex ← buttonIndex + 1;
handle.lastButton ← currButton;
lastButton ← currButton;
currX ← currX + thisButton.width - 1;
};
ENDLOOP;
h.paintBox[h.outer, $all];
};
MenuFromAny: PROCEDURE [any: REF ANY] RETURNS [m: Menus.Menu] ~ {
m ← NARROW[any];
};
MenuEntryFromAny: PROCEDURE [any: REF ANY] RETURNS [mE: Menus.MenuEntry] ~ {
mE ← NARROW[any];
};
ViewerFromBox: PROCEDURE [b: Box] RETURNS [v: ViewerClasses.Viewer] ~ {
v ← NARROW[b];
};
ViewerGetBoxNameProc: AdobeCommon.GetBoxNameProc ~ {
RETURN[ViewerFromBox[box].name];
};
ViewerGetMainNameProc: AdobeCommon.GetMainNameProc ~ {
RETURN[ViewerFromBox[box].name];
};
ViewerSetMainNameProc: AdobeCommon.SetMainNameProc ~ {
ViewerFromBox[box].name ← name;
};
ViewerSetContainerNameProc: AdobeCommon.SetContainerNameProc ~ {
ViewerFromBox[box].label ← name;
};
ViewerGetContentsProc: AdobeCommon.GetContentsProc ~ {
RETURN[ViewerTools.GetContents[ViewerFromBox[box]]];
};
ViewerXBoundBoxProc: AdobeCommon.XBoundBoxProc ~ {
Containers.ChildXBound[ViewerFromBox[parent], ViewerFromBox[box]];
};
ViewerDestroyBoxProc: AdobeCommon.DestroyBoxProc ~ {
ViewerOps.DestroyViewer[ViewerFromBox[box], FALSE];
};
ViewerSetBoxScrollableProc: AdobeCommon.SetBoxScrollableProc ~ {
ViewerFromBox[box].scrollable ← TRUE;
};
ViewerNewFieldBoxProc: AdobeCommon.NewFieldBoxProc ~ {
RETURN[
ViewerTools.MakeNewTextViewer[
info:[
parent: ViewerFromBox[parent],
wx: x,
wy: y,
ww: w,
wh: h,
border: FALSE,
scrollable: TRUE
]]];
};
ViewerNewLabelBoxProc: AdobeCommon.NewLabelBoxProc ~ {
RETURN[
Labels.Create[
info:[
parent: ViewerFromBox[parent],
wx: x,
wy: y,
border: FALSE,
scrollable: FALSE
]]];
};
ViewerGetBoxGeometryProc: AdobeCommon.GetBoxGeometryProc ~ {
v: ViewerClasses.Viewer ← ViewerFromBox[box];
RETURN[v.wx, v.wy, v.ww, v.wh];
};
ViewerSetBoxGeometryProc: AdobeCommon.SetBoxGeometryProc ~ {
ViewerOps.MoveViewer[ViewerFromBox[box], x, y, w, h, draw];
};
CurrentButtonProc: Buttons.ButtonProc = {
data: AdobeTool.CurrentButtonProcData ← NARROW[clientData];
AdobeUI.CurrentButton[data, parent];
};
SubmitFieldButtonProc: Buttons.ButtonProc = {
data: AdobeTool.CurrentButtonProcData ← NARROW[clientData];
AdobeUI.SubmitFieldButton[data, mouseButton];
};
AdjustStringHeight: Buttons.ButtonProc ~ {
buttonData: AdobeCommon.EnumeratedTypes ← NARROW[clientData, AdobeTool.CurrentButtonProcData].e;
handle: AdobeCommon.Handle ← buttonData.mainViewer;
buttons: AdobeCommon.ButtonsSeq ← handle.fieldViewer.buttons;
x, y, w, h: CARD;
offset: INT ← 0;
currentFieldNum: CARDLAST[CARD];
lines: INT ← AdobeTip.AdjustStringField[buttonData];
offset ← lines * AdobeTip.defaultHeight;
IF lines = 0 THEN RETURN;
FOR i: CARD IN [0..buttons.length) DO
IF buttons[i] = buttonData THEN
currentFieldNum ← i;
ENDLOOP;
IF currentFieldNum = LAST[CARD] THEN {
Report[handle, "Couldn't find field.\n"];
RETURN
};
[x, y, w, h] ← handle.getBoxGeometry[buttons[currentFieldNum].controllerOf];
handle.setBoxGeometry[buttons[currentFieldNum].controllerOf, x, y, w, h + offset, FALSE];
buttons[currentFieldNum].currentHeight ← buttons[currentFieldNum].currentHeight + lines;
FOR i: CARD IN (currentFieldNum..buttons.length) DO
IF buttons[i].adjButton # NIL THEN {
[x, y, w, h] ← handle.getBoxGeometry[buttons[i].adjButton];
handle.setBoxGeometry[buttons[i].adjButton, x, y + offset, w, h, FALSE];
};
[x, y, w, h] ← handle.getBoxGeometry[buttons[i].controllerOf];
handle.setBoxGeometry[buttons[i].controllerOf, x, y + offset, w, h, FALSE];
[x, y, w, h] ← handle.getBoxGeometry[buttons[i].button];
handle.setBoxGeometry[buttons[i].button, x, y + offset, w, h, FALSE];
ENDLOOP;
handle.paintBox[handle.fieldViewer.outer, $all];
};
HintMenuProc: PUBLIC Buttons.ButtonProc = {
buttonData: AdobeCommon.EnumeratedTypes ← NARROW[clientData];
AdobeUI.HintMenu[buttonData, mouseButton];
};
ListActionProc: PUBLIC Buttons.ButtonProc = {
handle: AdobeCommon.Handle ← NARROW[clientData];
AdobeUI.ListAction[handle, mouseButton];
};
ViewerAssistLoginProc: AdobeCommon.AssistLoginProc ~ {};
ViewerMakeButtonProc: AdobeCommon.MakeButtonProc ~ {
Proc: Buttons.ButtonProc;
SELECT proc FROM
$AdjustStringHeight => Proc ← AdjustStringHeight;
$CheckField => Proc ← CheckField;
$CurrentButtonProc => Proc ← CurrentButtonProc;
$HintMenuProc => Proc ← HintMenuProc;
$ListAction => Proc ← ListActionProc;
$SubmitFieldButtonProc => Proc ← SubmitFieldButtonProc;
ENDCASE => ERROR;
RETURN[Buttons.Create[
info: [
parent: ViewerFromBox[parent],
wx: x,
wy: y,
name: name,
border: FALSE,
data: data,
scrollable: scrollable
],
paint: paint,
proc: Proc,
clientData: cData]];
};
ViewerGetSelectionContentsProc: AdobeCommon.GetSelectionContentsProc ~ {
RETURN[ViewerTools.GetSelectionContents[]];
};
ViewerSetContentsProc: AdobeCommon.SetContentsProc ~ {
ViewerTools.SetContents[ViewerFromBox[box], r];
};
ViewerSetSelectionProc: AdobeCommon.SetSelectionProc ~ {
ViewerTools.SetSelection[ViewerFromBox[box], selection];
};
ViewerSetDisplayStyleProc: AdobeCommon.SetDisplayStyleProc ~ {
Buttons.SetDisplayStyle[ViewerFromBox[box], style];
};
ViewerPaintBoxProc: AdobeCommon.PaintBoxProc ~ {
SELECT which FROM
$all => ViewerOps.PaintViewer[ViewerFromBox[box], all, TRUE];
$caption => ViewerOps.PaintViewer[ViewerFromBox[box], caption, TRUE];
$client => ViewerOps.PaintViewer[ViewerFromBox[box], client, TRUE];
$menu => ViewerOps.PaintViewer[ViewerFromBox[box], menu, TRUE];
ENDCASE => ERROR;
};
ViewerReLabelBoxProc: AdobeCommon.ReLabelBoxProc ~ {
Buttons.ReLabel[ViewerFromBox[box], newLabel];
};
ViewerPopUpRequestProc: AdobeCommon.PopUpRequestProc ~ {
RETURN[PopUpSelection.Request[title, selections]];
};
ViewerFindMenuEntryProc: AdobeCommon.FindMenuEntryProc ~ {
RETURN[Menus.FindEntry[menu: MenuFromAny[h.menu], entryName: entryName]];
};
ViewerNewMenuEntryProc: AdobeCommon.NewMenuEntryProc ~ {
RETURN[Menus.CreateEntry[name: entryName, proc: DeadProc]];
};
ViewerReplaceMenuEntryProc: AdobeCommon.ReplaceMenuEntryProc ~ {
Menus.ReplaceMenuEntry[menu: MenuFromAny[menu], oldEntry: MenuEntryFromAny[oldEntry], newEntry: MenuEntryFromAny[newEntry]];
h.systemMenuItem ← newEntry;
};
ViewerInhibitEditsProc: AdobeCommon.InhibitEditsProc ~ {
ViewerTools.InhibitUserEdits[ViewerFromBox[box]];
};
ViewerEnableEditsProc: AdobeCommon.InhibitEditsProc ~ {
ViewerTools.EnableUserEdits[ViewerFromBox[box]];
};
ViewerSetIconProc: AdobeCommon.SetIconProc ~ {
SELECT function FROM
$normal => ViewerFromBox[h.outer].icon ← iconList[h.tool];
$editted => ViewerFromBox[h.outer].icon ← edittedIcon
ENDCASE => ERROR;
};
Report: AdobeCommon.ReportProc ~ {
h.messageViewer.reportStream.PutF[format, v1, v2, v3];
};
ChangeTool: PROCEDURE RETURNS [change: BOOLEANTRUE] = {
};
DeadBProc: Buttons.ButtonProc = {};
DeadProc: Menus.MenuProc = {};
AnotherProc: Menus.MenuProc = {
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeUI.AnotherTool[handle];
};
ChangeSystemProc: Menus.MenuProc ~ {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeUI.ChangeSystem[handle];
};
SubmitProc: Buttons.ButtonProc ~ {
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeUI.Submit[handle];
};
SystemMenuProc: Menus.MenuProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeUI.SystemMenu[handle];
};
ToolMenuProc: ENTRY Menus.MenuProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeUI.ToolMenu[handle];
};
ExamineProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeUI.Examine[handle];
};
CheckInProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeUI.CheckIn[handle];
};
CheckInAndOutProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeUI.CheckInAndOut[handle];
};
CheckInAndExamineProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeUI.CheckInAndExamine[handle];
};
CheckOutProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeUI.CheckOut[handle];
};
AbortCheckOutProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeUI.AbortCheckOut[handle];
};
NumberEqualsProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeUI.NumberEquals[handle, mouseButton];
};
NextProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeUI.Next[handle];
};
PreviousProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeUI.Previous[handle];
};
EditFilenameProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeUI.EditFilename[handle, mouseButton];
};
UseQLProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeUI.UseQL[handle];
};
WhichQLProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeUI.WhichQL[handle, mouseButton];
};
WhichQLProc2: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeUI.WhichQL2[handle, mouseButton];
};
ClearProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeUI.Clear[handle];
};
PutProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeUI.Put[handle];
};
GetProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeUI.Get[handle];
};
SubmitFileProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
[] ← AdobeUI.HandleField[handle, 1, mouseButton];
};
ReportProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeTool.ReportCommandProc[handle];
};
QueryProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeTool.QueryCommandProc[handle];
};
ShowSortKeys: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeTool.ShowSortKeys[handle];
};
OutputFormatProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeUI.OutputFormat[handle];
};
WhichFormatProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
};
OverwriteProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeUI.Overwrite[handle];
};
SetFieldsProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeTool.SetProc[handle];
};
ResetProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeTool.ResetProc[handle, TRUE];
};
ReportOutputFileProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeUI.ReportOutputFile[handle, mouseButton];
};
ReportTemplateFileProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeUI.ReportTemplateFile[handle, mouseButton];
};
[] ← AdobeUI.HandleField[handle, 2, mouseButton];
};
ClearFormProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeTool.EmptyContents[handle];
};
ShowElementsProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeUI.ShowElements[handle];
};
ResetQLProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeUI.ResetQL[handle];
};
ql: AdobeOps.QueryList ← NIL;
ql ← AdobeCommon.FindThisQL[ViewerTools.GetContents[handle.editors[1]], handle];
IF ql # NIL THEN ql.list ← NIL;
};
UnionProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeTool.ChooseQLCmd[handle, 0];
};
IntersectionProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeTool.ChooseQLCmd[handle, 1];
};
ComplementProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeTool.ChooseQLCmd[handle, 2];
};
DifferenceProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeTool.ChooseQLCmd[handle, 3];
};
XORProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeTool.ChooseQLCmd[handle, 4];
};
CopyToQueryListProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeTool.ChooseQLCmd[handle, 5];
};
CopyToFileProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
foo: Rope.ROPENIL;
AdobeTool.ChooseQLCmd[handle, 6];
};
QLOperandOneProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeUI.QLOperandProc[handle, mouseButton, 1, "Operand1"];
};
QLOperandTwoProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeUI.QLOperandProc[handle, mouseButton, 2, "Operand2"];
};
QLResultProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeUI.QLOperandProc[handle, mouseButton, 3, "Result"];
};
SortProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
AdobeTool.SortCommandProc[handle];
};
SortMaxOutputProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
[] ← AdobeUI.HandleField[handle, 1, mouseButton];
};
SortInputProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
[] ← AdobeUI.HandleField[handle, 2, mouseButton];
};
SortOutputProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
[] ← AdobeUI.HandleField[handle, 3, mouseButton];
};
SortKeySpecsProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
[] ← AdobeUI.HandleField[handle, 4, mouseButton];
};
ShowSortKeysProc: Buttons.ButtonProc = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ← NARROW[clientData];
};
CheckField: Buttons.ButtonProc = {
enumData: AdobeCommon.EnumeratedTypes ← NARROW[clientData];
AdobeUI.CheckField[enumData];
};
EditButtons: ButtonsList = LIST [
["Examine", ExamineProc, 1, 60],
[" CheckIn", CheckInProc, 1, 70],
["CheckIn&Out", CheckInAndOutProc, 1, 90],
["CheckIn&Exam", CheckInAndExamineProc, 1, 100],
["CheckOut", CheckOutProc, 1, 65],
["AbortCheckOut", AbortCheckOutProc, 1, 100],
[" Next", NextProc, 2, 60],
[" Number=", NumberEqualsProc, 2, 70],
["SKIP", DeadBProc, 2, 90],
[" Previous", PreviousProc, 2, 100],
["Filename:", EditFilenameProc, 2, 65],
["SKIP", DeadBProc, 2, 160],
[" UseQL", UseQLProc, 3, 60],
["QL to use:", WhichQLProc, 3, 70],
["SKIP", DeadBProc, 3, 190],
nullButton];
SubmitButtons: ButtonsList = LIST [
["Submit", SubmitProc, 1, 50],
["Clear", ClearProc, 1, 40],
["Put", PutProc, 1, 30],
["Get", GetProc, 1, 30],
["File:", SubmitFileProc, 1, 40],
["SKIP", DeadBProc, 1, 190],
nullButton];
ReportButtons: ButtonsList = LIST [
[" Report", ReportProc, 1, 80],
["OutputFormat:", OutputFormatProc, 1, 90],
["{plain}", WhichFormatProc, 1, 75],
[" Overwrite", OverwriteProc, 1, 90],
["Reset", ResetProc, 1, 45],
["SetFields", SetFieldsProc, 1, 60],
["Output file:", ReportOutputFileProc, 2, 80],
["SKIP", DeadBProc, 2, 164],
["Template file:", ReportTemplateFileProc, 2, 90],
["SKIP", DeadBProc, 2, 190],
[" QL to use:", WhichQLProc, 3, 80],
["SKIP", DeadBProc, 3, 190],
nullButton];
QueryButtons: ButtonsList = LIST [
["Query", QueryProc, 1, 70],
["ClearForm", ClearFormProc, 1, 70],
["ShowElements", ShowElementsProc, 1, 90],
["ResetQL", ResetQLProc, 1, 60],
["Query List Name:", WhichQLProc2, 2, 110],
["SKIP", DeadBProc, 2, 190],
nullButton];
QueryListButtons: ButtonsList = LIST [
[" Union", UnionProc, 1, 70],
[" Intersection", IntersectionProc, 1, 80],
["Complement", ComplementProc, 1, 80],
["Difference", DifferenceProc, 1, 70],
["XOR", XORProc, 1, 40],
["CopyToQueryList", CopyToQueryListProc, 1, 110],
[" CopyToFile", CopyToFileProc, 1, 80],
["Operand1:", QLOperandOneProc, 2, 70],
["SKIP", DeadBProc, 2, 159],
["Operand2:", QLOperandTwoProc, 2, 70],
["SKIP", DeadBProc, 2, 160],
[" Result:", QLResultProc, 3, 70],
["SKIP", DeadBProc, 3, 190],
nullButton];
SortButtons: ButtonsList = LIST [
[" Sort", SortProc, 1, 70],
["ShowSortKeys", ShowSortKeys, 1, 90],
["Max output file length:", SortMaxOutputProc, 1, 150],
["SKIP", DeadBProc, 1, 80],
["Input File:", SortInputProc, 2, 70],
["SKIP", DeadBProc, 2, 160],
["Output File:", SortOutputProc, 2, 80],
["SKIP", DeadBProc, 2, 160],
["Key specs:", SortKeySpecsProc, 3, 70],
["SKIP", DeadBProc, 3, 170],
nullButton];
iconList: ARRAY AdobeOps.ToolType OF Icons.IconFlavor ← ALL[unInit];
edittedIcon: Icons.IconFlavor ← unInit;
submittingIcon: Icons.IconFlavor ← unInit;
AdobeCommand: Commander.CommandProc = {
initTypedSystem: Rope.ROPENIL;
numArgs:CARD ← CommanderOps.NumArgs[cmd];
IF stateInfo = NIL THEN stateInfo ← NEW[
ToolStateType ← []];
IF numArgs > 1 THEN {
initTypedSystem ← CommanderOps.NextArgument[cmd];
numArgs ← numArgs - 1;
WHILE numArgs > 1 DO
initTypedSystem ← initTypedSystem.Cat[" ",CommanderOps.NextArgument[cmd]];
numArgs ← numArgs - 1;
ENDLOOP;
AdobeCommonInternal.SetTypedInitialSystem[initTypedSystem];
};
MakeViewerAdobeTool[NIL];
};
adobeIconPath: Rope.ROPE ~ Rope.Concat[PFS.RopeFromPath[PFS.GetWDir[]], "Adobe.icons"];
Commander.Register[key: "Adobe", proc: AdobeCommand, doc: "Create an instance of the Viewer Adobe Tool."];
}.
Swen Johnson, August 24, 1993
Bug fix: AdjustStringHeight was getting a NARROW fault when assigning buttonData.
changes to: AdjustStringHeight: NARROW clientData to AdobeTool.CurrentButtonProcData (instead of AdobeCommon.EnumeratedTypes), assign field e to buttonData.