Copyright Ó 1983, 1984, 1985 , 1992by Xerox Corporation. All rights reserved.
File: AdobeToolContextImplA.mesa
Freedman  19-Jul-83 11:26:51
RSF   28-Feb-84 16:25:10
JCS   31-Jul-85 15:48:58
Philip James, February 1, 1991 10:57 am PST
DIRECTORY
AdobeOps,
AdobeToolContext,
BasicTime USING [nullGMT],
Rope USING [ROPE];
AdobeToolContextImplA: CEDAR PROGRAM
EXPORTS AdobeToolContext =
BEGIN
sequence used for Table Lookup
ValueSequencePtr: TYPE = REF ValueSequence;
ValueSequence: TYPE = RECORD [seq: SEQUENCE length: CARDINAL OF Rope.ROPE];
loginName: Rope.ROPE ¬ NIL;
InitializeUserContext: PUBLIC PROCEDURE [
arSH: AdobeOps.ARSystemHandle, tool: AdobeOps.ToolType]
RETURNS [userContext: AdobeToolContext.UserContext] =
BEGIN
allocate user context with object the size of field list
userContext ¬ NEW[AdobeToolContext .UserContextRec[arSH.fieldList.length]];
userContext.arSH ¬ arSH;
InitializedToNonDisplayed[userContext];
SetDisplayed[userContext, tool];
END;
UCOR: TYPE ~ AdobeToolContext.UserContextObjectRec;
UCBR: TYPE ~ AdobeToolContext.UserContextBodyRec;
InitializedToNonDisplayed: PROCEDURE [
userContext: AdobeToolContext.UserContext] =
BEGIN
FOR i: CARDINAL IN [0..userContext.length) DO
userContext[i] ¬ NEW[UCOR.nonDisplayedField ¬ [FALSE, nonDisplayedField[NIL]]]
ENDLOOP;
END;
SetDisplayed: PROCEDURE [
uC: AdobeToolContext.UserContext, tool: AdobeOps.ToolType] =
BEGIN
formOrder: AdobeOps.UserSpecifiedOrder ¬ uC.arSH.formSWOrderArray[tool];
fL: AdobeOps.FieldList ¬ uC.arSH.fieldList;
FOR i: CARDINAL IN [0..formOrder.length) DO
WITH fL[formOrder[i]] SELECT FROM
body: AdobeOps.ArFIO =>
uC[formOrder[i]] ¬ NEW[UCOR.displayedField ¬
[FALSE, displayedField[NEW[UCBR ¬ [arId[AdobeOps.nilARNumber]]]]]];
body: AdobeOps.FixFIO =>
uC[formOrder[i]] ¬ NEW[UCOR.displayedField ¬
[FALSE, displayedField[NEW[UCBR ¬ [fixedLengthString[NIL]]]]]];
body: AdobeOps.StrFIO => uC[formOrder[i]] ¬ NEW[UCOR.displayedField ¬
[FALSE, displayedField[NEW[UCBR ¬ [string[NIL]]]]]];
body: AdobeOps.DateFIO =>
uC[formOrder[i]] ¬ NEW[UCOR.displayedField ¬
[FALSE, displayedField[NEW[UCBR ¬ [dateTime[NIL, BasicTime.nullGMT]]]]]];
body: AdobeOps.NumFIO => uC[formOrder[i]] ¬ NEW[UCOR.displayedField ¬
[FALSE, displayedField[NEW[UCBR ¬ [numeric[0]]]]]];
body: AdobeOps.EnumFIO =>
uC[formOrder[i]] ¬ NEW[UCOR.displayedField ¬
[FALSE, displayedField[NEW[UCBR ¬ [enumerated[AdobeOps.nilEnum]]]]]];
ENDCASE;
ENDLOOP;
END;
FreeUserContext: PUBLIC PROCEDURE [uCPtr: REF AdobeToolContext.UserContext] = {
ResetUserContext[uCPtr­];
};
ResetUserContext: PUBLIC PROCEDURE [uC: AdobeToolContext.UserContext] = {
FOR i: CARDINAL IN [0..uC.length) DO
WITH uC[i] SELECT FROM
type: REF UCOR.nonDisplayedField => {}; --z.FREE[@type.readOnlyField];
type: REF UCOR.displayedField =>
WITH type.editableField SELECT FROM
body: REF UCBR.arId => body.arn ¬ AdobeOps.nilARNumber;
body: REF UCBR.dateTime => {}; --z.FREE[@body.temp];
body: REF UCBR.numeric => body.num ¬ 0;
body: REF UCBR.fixedLengthString => {}; --z.FREE[@body.s];
body: REF UCBR.string => {}; --z.FREE[@body.s];
body: REF UCBR.enumerated => body.value ¬ AdobeOps.nilEnum;
ENDCASE;
ENDCASE;
ENDLOOP;
};
ClearUserContext: PUBLIC PROCEDURE [uC: AdobeToolContext.UserContext] = {
FOR i: CARDINAL IN [0..uC.length) DO
WITH uC[i] SELECT FROM
type: REF UCOR.displayedField =>
WITH type.editableField SELECT FROM
body: REF UCBR.arId => body.arn ¬ AdobeOps.nilARNumber;
body: REF UCBR.dateTime => IF body.temp # NIL THEN body.temp ¬ NIL; --.Length ¬ 0;
body: REF UCBR.numeric => body.num ¬ 0;
body: REF UCBR.fixedLengthString => IF body.s # NIL THEN body.s ¬ NIL; -- body.s.Length ¬ 0;
body: REF UCBR.string => IF body.s # NIL THEN body.s ¬ NIL; -- body.s.Length ¬ 0;
body: REF UCBR.enumerated => body.value ¬ AdobeOps.nilEnum;
ENDCASE;
ENDCASE;
ENDLOOP};
END.....