AdobeXTkImpl.mesa
Copyright Ó 1992, 1993 by Xerox Corporation. All rights reserved.
Philip James, March 20, 1992 11:06 am PST
Swen Johnson, September 10, 1993 4:21 pm PDT
DIRECTORY
AdobeCommon,
AdobeCommonInternal USING [EntryBytesType, InstanceData, ProcessUserDotCM, SetTypedInitialSystem, SystemNotFound],
AdobeOps USING [ARNumber, ARSystemHandle, ToolType, QueryList],
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],
Commander USING [CommandProc, Register],
CommanderOps USING [NextArgument, NumArgs],
CrRPC USING [Error],
IO USING [PutF],
MessageWindow USING [],
Rope USING [Cat, Concat, Equal, ROPE],
ViewerClasses USING [MouseButton],
ViewerTools USING [SelPos],
X11PopUpSelection USING [Request],
XCredentialTool USING [Create],
Xl USING [ButtonPressEvent, ButtonReleaseEvent, Connection, Geometry, GetPointerMapping, PointerMapping, SetOfEvent],
XlCutBuffers USING [Get],
XlICCCMTypes USING [],
XTk USING [DestroyWidget, dontUse, Event, NoteAndStartReconfigure, NoteGeometryChange, postConfigureKey, RegisterNotifier, StartReconfigureChildren, Widget, WidgetNotifyProc],
XTkXBiScroller USING [CreateXBiScroller, DirectSetState, FilterProc, SetFilterProc],
XTkContainers USING [CreateContainer],
XTkEditWidgets USING [CreateEditWidget, CreateStream, DisableKeyboardInput, EnableKeyboardInput, GetText, SetSelection, SetText],
XTkLabels USING [],
XTkShellWidgets USING [ICCCMHints, SetHeader, SetIconName],
XTkWidgets USING [AppendChild, ButtonHitProcType, CreateButton, CreateContainer, CreateLabel, CreateRuler, CreateShell, CreateXStack, CreateYStack, GetHints, GetText, RealizeShell, SetShellChild, SetStyleKey, SetText, Widget];
AdobeXTkImpl: CEDAR MONITOR
IMPORTS AdobeCommon, AdobeCommonInternal, AdobeTool, AdobeUI, Commander, CommanderOps, CrRPC, IO, Rope, X11PopUpSelection, XCredentialTool, Xl, XlCutBuffers, XTk, XTkXBiScroller, XTkContainers, XTkEditWidgets, XTkShellWidgets, XTkWidgets = {
Box: TYPE ~ AdobeCommon.Box;
ButtonData: TYPE = RECORD [
title: Rope.ROPE,
proc: XTkWidgets.ButtonHitProcType,
line: INT,
width: INT
];
ButtonsList: TYPE = LIST OF ButtonData;
nullButton: ButtonData ¬ ["NULL", NIL, -1, 0];
MakeXTkAdobeTool: 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;
my.systemHandle ¬ NIL;
my.report ¬ Report;
my.getContents ¬ XTkGetContentsProc;
my.getSelectionContents ¬ XTkGetSelectionContentsProc;
my.setContents ¬ XTkSetContentsProc;
my.setSelection ¬ XTkSetSelectionProc;
my.setDisplayStyle ¬ XTkSetDisplayStyleProc;
my.setIcon ¬ XTkSetIconProc;
my.addButtons ¬ AddButtons;
my.paintBox ¬ XTkPaintBoxProc;
my.popUpRequest ¬ XTkPopUpRequestProc;
my.reLabelBox ¬ XTkReLabelBoxProc;
my.newMenuEntry ¬ XTkNewMenuEntryProc;
my.findMenuEntry ¬ XTkFindMenuEntryProc;
my.replaceMenuEntry ¬ XTkReplaceMenuEntryProc;
my.makeAnotherTool ¬ MakeXTkAdobeTool;
my.inhibitEdits ¬ XTkInhibitEditsProc;
my.enableEdits ¬ XTkEnableEditsProc;
my.getBoxGeometry ¬ XTkGetBoxGeometryProc;
my.setBoxGeometry ¬ XTkSetBoxGeometryProc;
my.getBoxName ¬ XTkGetContentsProc;
my.destroyBox ¬ XTkDestroyBoxProc;
my.setBoxScrollable ¬ XTkSetBoxScrollableProc;
my.xBoundBox ¬ XTkXBoundBoxProc;
my.newFieldBox ¬ XTkNewFieldBoxProc;
my.newLabelBox ¬ XTkNewLabelBoxProc;
my.setContainerName ¬ XTkSetMainNameProc;
my.setMainName ¬ XTkSetMainNameProc;
my.getMainName ¬ XTkGetMainNameProc;
my.makeButton ¬ XTkMakeButtonProc;
my.assistLogin ¬ XTkAssistLoginProc;
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];
};
}
};
LineHeight: PROCEDURE[h: AdobeUI.Handle] RETURNS[height: INT ¬ 0] ~ {
FOR x: CARD IN [0..h.fieldViewer.buttons.length) DO
IF h.fieldViewer.buttons[x] .type = string THEN
height ¬ height + 5
ELSE height ¬ height + 1;
ENDLOOP;
};
ReconfigureProc: XTk.WidgetNotifyProc ~ {
handle: AdobeUI.Handle ¬ NARROW[registerData];
IF handle.fieldViewer.buttons # NIL THEN {
WidgetFromBox[handle.fieldViewer.outer].s.geometry.size.height ¬ buttonHeight * LineHeight[handle];
XTk.NoteAndStartReconfigure[WidgetFromBox[handle.fieldViewer.outer]];
};
};
AddSubContainers: PROCEDURE [handle: AdobeUI.Handle] = {
name: Rope.ROPE ¬ Rope.Concat["Adobe ", AdobeUI.RopeFromTool[handle.tool]];
tmpC, tmp, w: XTkWidgets.Widget ¬ NIL;
handle.outer ¬ XTkWidgets.CreateShell[widgetSpec: [ geometry: [size: [600, 750]]], windowHeader: name, iconName: name, className: $Adobe, standardMigration: TRUE, focusProtocol: TRUE];
w ¬ XTkWidgets.CreateYStack[[], LIST[WidgetFromBox[handle.menu]]];
handle.buttonViewer.outer ¬ XTkWidgets.CreateContainer[widgetSpec: [ geometry: [size: [XTk.dontUse, 55]]]];
w ¬ XTkWidgets.CreateYStack[[], LIST[w, WidgetFromBox[handle.buttonViewer.outer]]];
tmp ¬ XTkWidgets.CreateRuler[
widgetSpec: [
geometry: [pos: [0, 55], size: [2000, 1]]]];
w ¬ XTkWidgets.CreateYStack[[], LIST[w, tmp]];
handle.messageViewer.outer ¬ XTkEditWidgets.CreateEditWidget[
widgetSpec: [
geometry: [pos: [0, 56], size: [handle.getBoxGeometry[handle.outer].w, 50]]],
scrollable: TRUE,
keyboardAccepting: FALSE];
w ¬ XTkWidgets.CreateYStack[[], LIST[w, WidgetFromBox[handle.messageViewer.outer]]];
tmp ¬ XTkWidgets.CreateRuler[
widgetSpec: [
geometry: [pos: [0, 106], size: [2000, 1]]]];
w ¬ XTkWidgets.CreateYStack[[], LIST[w, tmp]];
handle.fieldViewer.outer ← XTkContainers.CreateContainer[];
tmp ← XTkXBiScroller.CreateXBiScroller[
widgetSpec: [
geometry: [pos: [0, 107], size: [handle.getBoxGeometry[handle.outer].w, handle.getBoxGeometry[handle.outer].h - 107]]],
child: WidgetFromBox[handle.fieldViewer.outer],
vsbar: TRUE,
hsbar: FALSE];
XTkXBiScroller.SetFilterProc[tmp, XBiScrollerFilterProc];
w ← XTkWidgets.CreateYStack[[], LIST[w, tmp]];
XTkWidgets.SetShellChild[WidgetFromBox[handle.outer], w];
XTk.RegisterNotifier[w, XTk.postConfigureKey, ReconfigureProc, handle];
XTkWidgets.RealizeShell[WidgetFromBox[handle.outer]];
handle.messageViewer.reportStream ¬ XTkEditWidgets.CreateStream[
w: WidgetFromBox[handle.messageViewer.outer]];
Containers.ChildXBound[handle.outer, handle.buttonViewer.outer];
Containers.ChildXBound[handle.outer, handle.fieldViewer.outer];
Containers.ChildXBound[handle.outer, handle.messageViewer.outer];
Containers.ChildYBound[handle.outer, handle.fieldViewer.outer];
ViewerOps.OpenIcon[handle.outer];
};
MenuMappingRef: TYPE ~ REF MenuMapping;
MenuMapping: TYPE ~ LIST OF MenuMatch;
MenuMatch: TYPE ~ RECORD [
name: Rope.ROPE,
widget: XTkWidgets.Widget];
AddMenus: PROCEDURE [handle: AdobeUI.Handle] = {
systemName: Rope.ROPE ¬ NIL;
name: Rope.ROPE ¬ NIL;
w: XTkWidgets.Widget ¬ NIL;
mr: MenuMappingRef ¬ NIL;
mMapping: MenuMapping ¬ NIL;
handle.menu ¬ NIL;
name ¬ "Tool:";
handle.menu ¬ XTkWidgets.CreateButton[widgetSpec: [geometry: [pos: [x: 2, y: 2], size: [width: XTk.dontUse, height: 15]]], text: name, hitProc: ToolMenuProc, registerData: handle];
mMapping ¬ CONS[[name, MenuFromAny[handle.menu]], mMapping];
name ¬ Rope.Concat["{", Rope.Concat[AdobeUI.RopeFromTool[handle.tool], "}"]];
w ¬ XTkWidgets.CreateButton[widgetSpec: [geometry: [pos: [x: 2, y: 2], size: [width: 100, height: 15]]], text: name, hitProc: DeadProc, registerData: handle];
mMapping ¬ CONS[[name, w], mMapping];
handle.menu ¬ XTkWidgets.CreateXStack[[], LIST[MenuFromAny[handle.menu], w]];
name ¬ "Another";
w ¬ XTkWidgets.CreateButton[widgetSpec: [geometry: [pos: [x: 2, y: 2], size: [width: XTk.dontUse, height: 15]]], text: name, hitProc: AnotherProc, registerData: handle];
mMapping ¬ CONS[[name, w], mMapping];
handle.menu ¬ XTkWidgets.CreateXStack[[], LIST[MenuFromAny[handle.menu], w]];
name ¬ "ChangeSystem";
w ¬ XTkWidgets.CreateButton[widgetSpec: [geometry: [pos: [x: 2, y: 2], size: [width: XTk.dontUse, height: 15]]], text: name, hitProc: ChangeSystemProc, registerData: handle];
mMapping ¬ CONS[[name, w], mMapping];
handle.menu ¬ XTkWidgets.CreateXStack[[], LIST[MenuFromAny[handle.menu], w]];
name ¬ "System:";
w ¬ XTkWidgets.CreateButton[widgetSpec: [geometry: [pos: [x: 2, y: 2], size: [width: XTk.dontUse, height: 15]]], text: name, hitProc: SystemMenuProc, registerData: handle];
mMapping ¬ CONS[[name, w], mMapping];
handle.menu ¬ XTkWidgets.CreateXStack[[], LIST[MenuFromAny[handle.menu], w]];
IF handle.system # LAST[CARDINAL] THEN
systemName ¬ handle.knownSystems.system[handle.system];
name ¬ systemName;
handle.systemMenuItem ¬ w ¬ XTkWidgets.CreateButton[widgetSpec: [geometry: [pos: [x: 2, y: 2], size: [width: XTk.dontUse, height: 15]]], text: name, hitProc: DeadProc, registerData: handle];
mMapping ¬ CONS[[name, w], mMapping];
handle.menu ¬ XTkWidgets.CreateXStack[[], LIST[MenuFromAny[handle.menu], w]];
mr ¬ NEW[MenuMapping ¬ mMapping];
handle.extraData ¬ mr;
};
buttonHeight: INTEGER ¬ 18;
buttonSpaceHeight: INTEGER ¬ buttonHeight + 4;
AddButtons: AdobeCommon.AddButtonsProc = {
currButton, lastButton: REF ANY ¬ NIL;
lastLine, currLine: INTEGER ¬ 1;
currX: INTEGER ¬ -1;
whichButtons: ButtonsList ¬ NIL;
tempButton: REF ANY ¬ 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] ¬ XTkEditWidgets.CreateEditWidget[
widgetSpec: [
geometry: [
pos: [
x: currX + 5,
y: ((currLine -1) * buttonSpaceHeight) - currLine + 1],
size: [
width: thisButton.width,
height: buttonHeight]]]
];
XTkWidgets.AppendChild[container: WidgetFromBox[h.buttonViewer.outer], child: WidgetFromBox[currButton], startReconfigure: 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] ¬ XTkWidgets.CreateButton[
widgetSpec: [
geometry: [
pos: [
x: currX + 5,
y: ((currLine -1) * buttonSpaceHeight) - currLine],
size: [
width: thisButton.width - 5,
height: buttonHeight]]],
text: thisButton.title,
hitProc: thisButton.proc,
registerData: h
];
XTkWidgets.AppendChild[container: WidgetFromBox[h.buttonViewer.outer], child: WidgetFromBox[h.controlButtons[buttonIndex]], startReconfigure: 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];
XTk.NoteAndStartReconfigure[WidgetFromBox[h.buttonViewer.outer]]
};
MenuFromAny: PROCEDURE [any: REF ANY] RETURNS [m: XTkWidgets.Widget] ~ {
m ¬ NARROW[any];
};
WidgetFromBox: PROCEDURE [b: Box] RETURNS [w: XTkWidgets.Widget] ~ {
w ¬ NARROW[b];
};
XTkGetContentsProc: AdobeCommon.GetContentsProc ~ {
did: BOOL;
[r, did] ¬ XTkEditWidgets.GetText[WidgetFromBox[box]];
IF ~did THEN
RETURN[XTkWidgets.GetText[WidgetFromBox[box]]];
};
XTkGetBoxGeometryProc: AdobeCommon.GetBoxGeometryProc ~ {
widget: XTkWidgets.Widget ¬ WidgetFromBox[box];
RETURN[widget.s.geometry.pos.x, widget.s.geometry.pos.y, widget.s.geometry.size.width, widget.s.geometry.size.height];
};
XTkSetBoxGeometryProc: AdobeCommon.SetBoxGeometryProc ~ {
g: Xl.Geometry ¬ [
pos: [x, y],
size: [w, h],
borderWidth: XTk.dontUse];
IF draw THEN
XTk.NoteAndStartReconfigure[WidgetFromBox[box], g]
ELSE
XTk.NoteGeometryChange[
widget: WidgetFromBox[box],
geometry: g];
};
AdjustStringHeight: XTk.WidgetNotifyProc ~ {};
XBiScrollerFilterProc: XTkXBiScroller.FilterProc ~ {
maxY: INT = xBiScroller.actual.size.height;
XTkXBiScroller.DirectSetState[
xBiScroller: xBiScroller,
p: [
x: p.x,
y: SELECT p.y FROM
< 0 => 0,
> maxY => maxY,
ENDCASE => p.y]];
};
CheckField: XTk.WidgetNotifyProc ~ {
enumData: AdobeCommon.EnumeratedTypes ¬ NARROW[registerData];
AdobeUI.CheckField[enumData];
};
CurrentButtonProc: XTk.WidgetNotifyProc ~ {
data: AdobeTool.CurrentButtonProcData ¬ NARROW[registerData];
AdobeUI.CurrentButton[data, widget];
};
HintMenuProc: XTk.WidgetNotifyProc ~ {
buttonData: AdobeCommon.EnumeratedTypes ¬ NARROW[registerData];
AdobeUI.HintMenu[buttonData, GetMouseButton[event]];
};
ListActionProc: XTk.WidgetNotifyProc ~ {
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeUI.ListAction[handle, GetMouseButton[event]];
};
SubmitFieldButtonProc: XTk.WidgetNotifyProc ~ {
data: AdobeTool.CurrentButtonProcData ¬ NARROW[registerData];
AdobeUI.SubmitFieldButton[data, GetMouseButton[event]];
};
XTkAssistLoginProc: AdobeCommon.AssistLoginProc ~ {
XCredentialTool.Create[NIL, TRUE];
};
XTkMakeButtonProc: AdobeCommon.MakeButtonProc ~ {
widget: XTkWidgets.Widget;
Proc: XTk.WidgetNotifyProc;
SELECT proc FROM
$AdjustStringHeight => Proc ¬ AdjustStringHeight;
$CheckField => Proc ¬ CheckField;
$CurrentButtonProc => Proc ¬ CurrentButtonProc;
$ListAction => Proc ¬ ListActionProc;
$HintMenuProc => Proc ¬ HintMenuProc;
$SubmitFieldButtonProc => Proc ¬ SubmitFieldButtonProc;
ENDCASE => ERROR;
widget ¬ XTkWidgets.CreateButton[
widgetSpec: [
geometry: [
pos: [
x: x,
y: y]]],
size: [
width: thisButton.width - 5,
height: buttonHeight]]],
text: name,
hitProc: Proc,
registerData: data];
paint: paint,
proc: Proc,
clientData: cData]];
XTkWidgets.AppendChild[WidgetFromBox[parent], widget];
RETURN [widget];
};
XTkNewFieldBoxProc: AdobeCommon.NewFieldBoxProc ~ {
widget: XTk.Widget;
widget ¬ XTkEditWidgets.CreateEditWidget[
widgetSpec: [
geometry: [
pos: [
x: x,
y: y],
size: [
width: w,
height: h]]],
scrollable: TRUE];
XTkWidgets.AppendChild[WidgetFromBox[parent], widget];
RETURN [widget];
};
XTkNewLabelBoxProc: AdobeCommon.NewLabelBoxProc ~ {
widget: XTkWidgets.Widget;
widget ¬ XTkWidgets.CreateLabel[
widgetSpec: [
geometry: [
pos: [
x: x,
y: y]]],
size: [
width: w,
height: h]]],
text: name];
XTkWidgets.AppendChild[WidgetFromBox[parent], widget];
RETURN [widget];
};
XTkGetSelectionContentsProc: AdobeCommon.GetSelectionContentsProc ~ {
RETURN[XlCutBuffers.Get[WidgetFromBox[box].connection]];
};
XTkSetBoxScrollableProc: AdobeCommon.SetBoxScrollableProc ~ {
HelpMe
};
XTkXBoundBoxProc: AdobeCommon.XBoundBoxProc ~ {
HelpMe
};
XTkSetContentsProc: AdobeCommon.SetContentsProc ~ {
IF ~ XTkEditWidgets.SetText[WidgetFromBox[box], r] THEN
XTkWidgets.SetText[WidgetFromBox[box], r];
};
XTkSetSelectionProc: AdobeCommon.SetSelectionProc ~ {
IF selection = NIL THEN
XTkEditWidgets.SetSelection[WidgetFromBox[box]]
ELSE
XTkEditWidgets.SetSelection[WidgetFromBox[box], selection.start, selection.length, IF selection.caretPos = before THEN before ELSE after];
};
XTkSetDisplayStyleProc: AdobeCommon.SetDisplayStyleProc ~ {
XTkWidgets.SetStyleKey[WidgetFromBox[box], style];
};
XTkPaintBoxProc: AdobeCommon.PaintBoxProc ~ {
HelpMe
SELECT which FROM
$all => {}; --ViewerOps.PaintViewer[WidgetFromBox[box], all, TRUE];
$caption => {}; --ViewerOps.PaintViewer[WidgetFromBox[box], caption, TRUE];
$client => {}; --VViewerOps.PaintViewer[WidgetFromBox[box], client, TRUE];
$menu => {};-- ViewerOps.PaintViewer[WidgetFromBox[box], menu, TRUE];
ENDCASE => ERROR;
XTk.StartReconfigureChildren[WidgetFromBox[box]];
};
XTkDestroyBoxProc: AdobeCommon.DestroyBoxProc ~ {
IF box # NIL THEN
XTk.DestroyWidget[WidgetFromBox[box], draw]
};
XTkReLabelBoxProc: AdobeCommon.ReLabelBoxProc ~ {
XTkWidgets.SetText[WidgetFromBox[box], newLabel]
};
XTkPopUpRequestProc: AdobeCommon.PopUpRequestProc ~ {
RETURN[X11PopUpSelection.Request[title, selections]];
};
XTkFindMenuEntryProc: AdobeCommon.FindMenuEntryProc ~ {
mr: MenuMappingRef ¬ NARROW[h.extraData];
FOR m: MenuMapping ¬ mr­, m.rest WHILE m # NIL DO
IF Rope.Equal[m.first.name, entryName] THEN
RETURN[m.first.widget];
ENDLOOP;
RETURN[NIL];
};
XTkNewMenuEntryProc: AdobeCommon.NewMenuEntryProc ~ {
RETURN[XTkWidgets.CreateButton[widgetSpec: [geometry: [pos: [x: -50, y: -50], size: [width: XTk.dontUse, height: 15]]], text: entryName, hitProc: DeadProc, registerData: NIL]];
};
XTkReplaceMenuEntryProc: AdobeCommon.ReplaceMenuEntryProc ~ {
mr: MenuMappingRef ¬ NARROW[h.extraData];
newText: Rope.ROPE ¬ XTkWidgets.GetText[MenuFromAny[newEntry]];
oldText: Rope.ROPE ¬ XTkWidgets.GetText[MenuFromAny[oldEntry]];
FOR m: MenuMapping ¬ mr­, m.rest WHILE m # NIL DO
IF Rope.Equal[m.first.name, oldText] THEN
m.first.name ¬ newText;
ENDLOOP;
XTkWidgets.SetText[MenuFromAny[oldEntry], newText];
XTk.DestroyWidget[MenuFromAny[newEntry]];
};
XTkSetMainNameProc: AdobeCommon.SetMainNameProc ~ {
XTkShellWidgets.SetHeader[WidgetFromBox[box], name];
XTkShellWidgets.SetIconName[WidgetFromBox[box], name];
};
XTkGetMainNameProc: AdobeCommon.GetMainNameProc ~ {
hints: REF XTkShellWidgets.ICCCMHints ¬ XTkWidgets.GetHints[WidgetFromBox[box]];
RETURN[hints.windowHeader];
};
XTkInhibitEditsProc: AdobeCommon.InhibitEditsProc ~ {
XTkEditWidgets.DisableKeyboardInput[WidgetFromBox[box]];
};
XTkEnableEditsProc: AdobeCommon.EnableEditsProc ~ {
XTkEditWidgets.EnableKeyboardInput[WidgetFromBox[box]];
};
XTkSetIconProc: AdobeCommon.SetIconProc ~ {
SELECT function FROM
$normal => {}; --h.outer.icon ¬ iconList[h.tool];
$editted => {}; --h.outer.icon ¬ edittedIcon
ENDCASE => ERROR;
};
Report: AdobeCommon.ReportProc ~ {
h.messageViewer.reportStream.PutF[format, v1, v2, v3];
};
ChangeTool: PROCEDURE RETURNS [change: BOOLEAN ¬ TRUE] = {
};
DeadBProc: XTkWidgets.ButtonHitProcType = {};
DeadProc: XTkWidgets.ButtonHitProcType = {};
AnotherProc: XTkWidgets.ButtonHitProcType = {
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeUI.AnotherTool[handle];
};
ChangeSystemProc: XTkWidgets.ButtonHitProcType ~ {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeUI.ChangeSystem[handle];
IF handle.fieldViewer.buttons # NIL THEN {
WidgetFromBox[handle.fieldViewer.outer].s.geometry.size.height ¬ buttonHeight * LineHeight[handle];
XTk.NoteAndStartReconfigure[WidgetFromBox[handle.fieldViewer.outer]];
};
};
SubmitProc: XTkWidgets.ButtonHitProcType ~ {
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeUI.Submit[handle];
};
SystemMenuProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeUI.SystemMenu[handle];
};
ToolMenuProc: ENTRY XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeUI.ToolMenu[handle];
IF handle.fieldViewer.buttons # NIL THEN {
WidgetFromBox[handle.fieldViewer.outer].s.geometry.size.height ¬ buttonHeight * LineHeight[handle];
XTk.NoteAndStartReconfigure[WidgetFromBox[handle.fieldViewer.outer]];
};
};
ExamineProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeUI.Examine[handle];
};
CheckInProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeUI.CheckIn[handle];
};
CheckInAndOutProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeUI.CheckInAndOut[handle];
};
CheckInAndExamineProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeUI.CheckInAndExamine[handle];
};
CheckOutProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeUI.CheckOut[handle];
};
AbortCheckOutProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeUI.AbortCheckOut[handle];
};
GetMouseButton: PROCEDURE [event: XTk.Event] RETURNS [b: ViewerClasses.MouseButton ¬ red] ~ {
p: Xl.PointerMapping ¬ Xl.GetPointerMapping[event.connection];
WITH event SELECT FROM
bp: Xl.ButtonPressEvent =>
SELECT p[bp.button] FROM
1 => RETURN[red];
2 => RETURN[yellow];
3 => RETURN[blue];
ENDCASE => RETURN[red];
br: Xl.ButtonReleaseEvent =>
SELECT p[br.button] FROM
1 => RETURN[red];
2 => RETURN[yellow];
3 => RETURN[blue];
ENDCASE => RETURN[red];
ENDCASE => ERROR;
};
NumberEqualsProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeUI.NumberEquals[handle, GetMouseButton[event]];
};
NextProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeUI.Next[handle];
};
PreviousProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeUI.Previous[handle];
};
EditFilenameProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeUI.EditFilename[handle, GetMouseButton[event]];
};
UseQLProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeUI.UseQL[handle];
};
WhichQLProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeUI.WhichQL[handle, GetMouseButton[event]];
};
WhichQLProc2: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeUI.WhichQL2[handle, GetMouseButton[event]];
};
ClearProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeUI.Clear[handle];
};
PutProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeUI.Put[handle];
};
GetProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeUI.Get[handle];
};
SubmitFileProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
[] ¬ AdobeUI.HandleField[handle, 1, GetMouseButton[event]];
};
ReportProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeTool.ReportCommandProc[handle];
};
QueryProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeTool.QueryCommandProc[handle];
};
ShowSortKeys: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeTool.ShowSortKeys[handle];
};
OutputFormatProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeUI.OutputFormat[handle];
};
WhichFormatProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
};
OverwriteProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeUI.Overwrite[handle];
};
SetFieldsProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeTool.SetProc[handle];
};
ResetProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeTool.ResetProc[handle, TRUE];
};
ReportOutputFileProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeUI.ReportOutputFile[handle, GetMouseButton[event]];
};
ReportTemplateFileProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeUI.ReportTemplateFile[handle, GetMouseButton[event]];
};
ClearFormProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeTool.EmptyContents[handle];
};
ShowElementsProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeUI.ShowElements[handle];
};
ResetQLProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeUI.ResetQL[handle];
};
UnionProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeTool.ChooseQLCmd[handle, 0];
};
IntersectionProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeTool.ChooseQLCmd[handle, 1];
};
ComplementProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeTool.ChooseQLCmd[handle, 2];
};
DifferenceProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeTool.ChooseQLCmd[handle, 3];
};
XORProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeTool.ChooseQLCmd[handle, 4];
};
CopyToQueryListProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeTool.ChooseQLCmd[handle, 5];
};
CopyToFileProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeTool.ChooseQLCmd[handle, 6];
};
QLOperandOneProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeUI.QLOperandProc[handle, GetMouseButton[event], 1, "Operand1"];
};
QLOperandTwoProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeUI.QLOperandProc[handle, GetMouseButton[event], 2, "Operand2"];
};
QLResultProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeUI.QLOperandProc[handle, GetMouseButton[event], 3, "Result"];
};
SortProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
AdobeTool.SortCommandProc[handle];
};
SortMaxOutputProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
[] ¬ AdobeUI.HandleField[handle, 1, GetMouseButton[event]];
};
SortInputProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
[] ¬ AdobeUI.HandleField[handle, 2, GetMouseButton[event]];
};
SortOutputProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
[] ¬ AdobeUI.HandleField[handle, 3, GetMouseButton[event]];
};
SortKeySpecsProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
[] ¬ AdobeUI.HandleField[handle, 4, GetMouseButton[event]];
};
ShowSortKeysProc: XTkWidgets.ButtonHitProcType = {
ENABLE UNWIND => NULL;
handle: AdobeUI.Handle ¬ NARROW[registerData];
};
XTkAdobeCommand: Commander.CommandProc = {
initTypedSystem: Rope.ROPE ¬ NIL;
numArgs:CARD ¬ CommanderOps.NumArgs[cmd];
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];
};
MakeXTkAdobeTool[NIL];
};
EditButtons: ButtonsList = LIST [
["Examine", ExamineProc, 1, 70],
["CheckIn", CheckInProc, 1, 70],
["CheckIn&Out", CheckInAndOutProc, 1, 100],
["CheckIn&Exam", CheckInAndExamineProc, 1, 110],
["CheckOut", CheckOutProc, 1, 75],
["AbortCheckOut", AbortCheckOutProc, 1, 120],
[" Next", NextProc, 2, 60],
[" Number=", NumberEqualsProc, 2, 70],
["SKIP", DeadBProc, 2, 90],
["Previous", PreviousProc, 2, 110],
["Filename:", EditFilenameProc, 2, 75],
["SKIP", DeadBProc, 2, 160],
[" UseQL", UseQLProc, 3, 60],
["QL to use:", WhichQLProc, 3, 90],
["SKIP", DeadBProc, 3, 190],
nullButton];
SubmitButtons: ButtonsList = LIST [
["Submit", SubmitProc, 1, 70],
["Clear", ClearProc, 1, 60],
["Put", PutProc, 1, 30],
["Get", GetProc, 1, 30],
["File:", SubmitFileProc, 1, 50],
["SKIP", DeadBProc, 1, 190],
nullButton];
ReportButtons: ButtonsList = LIST [
["Report", ReportProc, 1, 60],
["OutputFormat:", OutputFormatProc, 1, 110],
["{plain}", WhichFormatProc, 1, 95],
[" Overwrite", OverwriteProc, 1, 90],
["Reset", ResetProc, 1, 50],
["SetFields", SetFieldsProc, 1, 80],
["Output file:", ReportOutputFileProc, 2, 105],
["SKIP", DeadBProc, 2, 164],
["Template file:", ReportTemplateFileProc, 2, 120],
["SKIP", DeadBProc, 2, 190],
["QL to use:", WhichQLProc, 3, 100],
["SKIP", DeadBProc, 3, 190],
nullButton];
QueryButtons: ButtonsList = LIST [
["Query", QueryProc, 1, 50],
["ClearForm", ClearFormProc, 1, 90],
["ShowElements", ShowElementsProc, 1, 110],
["ResetQL", ResetQLProc, 1, 70],
["Query List Name:", WhichQLProc2, 2, 140],
["SKIP", DeadBProc, 2, 190],
nullButton];
QueryListButtons: ButtonsList = LIST [
["Union", UnionProc, 1, 60],
["Intersection", IntersectionProc, 1, 100],
["Complement", ComplementProc, 1, 90],
["Difference", DifferenceProc, 1, 90],
["XOR", XORProc, 1, 30],
["CopyToQueryList", CopyToQueryListProc, 1, 130],
["CopyToFile", CopyToFileProc, 1, 100],
["Operand1:", QLOperandOneProc, 2, 80],
["SKIP", DeadBProc, 2, 159],
["Operand2:", QLOperandTwoProc, 2, 80],
["SKIP", DeadBProc, 2, 160],
["Result:", QLResultProc, 3, 70],
["SKIP", DeadBProc, 3, 190],
nullButton];
SortButtons: ButtonsList = LIST [
["Sort", SortProc, 1, 60],
["ShowSortKeys", ShowSortKeys, 1, 100],
["Max output file length:", SortMaxOutputProc, 1, 200],
["SKIP", DeadBProc, 1, 80],
["Input File:", SortInputProc, 2, 90],
["SKIP", DeadBProc, 2, 160],
["Output File:", SortOutputProc, 2, 100],
["SKIP", DeadBProc, 2, 160],
["Key specs:", SortKeySpecsProc, 3, 90],
["SKIP", DeadBProc, 3, 170],
nullButton];
Commander.Register[key: "XAdobe", proc: XTkAdobeCommand, doc: "Create an instance of the XTk Adobe Tool."];
}.
Swen Johnson, September 10, 1993
Replace obsolete XTkScrollableContainers with XTkXBiScroller.
added: XBiScrollerFilterProc.
changes to: ReconfigureProc, ChangeSystemProc, ToolMenuProc: Replaced XTkScrollableContainers.SetHeight with XTk.NoteAndStartReconfigure. XTkSetContentsProc: removed call to XTkScrollableContainers.ScrollTo. AddSubContainers: changed code to create handle.fieldViewer.outer to use XTkContainers.CreateContainer and XTkXBiScroller.CreateXBiScroller instead of XTkScrollableContainers.Create and XTkScrollableContainers.ContainerFromScrollable; added call to XTkXBiScroller.SetFilterProc.