EditToolPrivate.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Edited by Paxton on December 30, 1982 10:21 am
Edited by McGregor on June 11, 1982 1:50 pm
Russ Atkinson, July 22, 1983 11:09 am
Michael Plass, March 28, 1985 8:59:29 am PST
Doug Wyatt, April 14, 1985 5:20:52 pm PST
DIRECTORY
Buttons USING [Button],
EditToolBuilder USING [Layout],
Labels USING [Label],
Menus USING [ClickProc],
Rope USING [ROPE],
RopeReader USING [Ref],
TEditDocument USING [Selection],
TEditInput USING [CommandProc],
TextFind USING [PatternErrorCode],
TextLooks USING [Looks],
TextNode USING [Ref, RefTextNode],
TiogaOps USING [SearchDir],
TreeFind USING [CommentControl, Finder],
UndoEvent USING [Ref],
ViewerClasses USING [Viewer];
EditToolPrivate: CEDAR DEFINITIONS
= BEGIN
command registration stuff
Register: PROC [atom: ATOM, op: TEditInput.CommandProc] RETURNS [LIST OF REF];
general stuff
DoButton:
PROC [redList, blueList:
LIST
OF
REF ←
NIL,
redButton:
BOOL ←
FALSE, viewer: ViewerClasses.Viewer ←
NIL];
numHeights: CARDINAL = 4;
NodeKind: TYPE = {forRoot, forSelectedNodes, forSelectedChars};
SearchWhere: TYPE = [0..2];
anywhere: SearchWhere = 0;
words: SearchWhere = 1;
nodes: SearchWhere = 2;
Info: TYPE = REF InfoRec;
InfoRec:
TYPE =
RECORD [
heights: ARRAY [0..numHeights) OF CARDINAL,
currentHeightIndex: [0..numHeights),
interrupt: REF BOOL,
searchWhere: SearchWhere,
looksExact: BOOL,
ignoreLooks: BOOL,
ignoreText: BOOL,
ignoreFormat: BOOL,
ignoreStyle: BOOL,
ignoreComment: BOOL,
literal: BOOL,
ignoreCase: BOOL,
doReplace: BOOL,
forceInitCap: BOOL,
caretFormat: BOOL,
subsRange: [0..2],
sortIncreasing: BOOL,
sortKind: [0..2],
caretLooks: BOOL,
formatNode: NodeKind,
styleNode: NodeKind,
propNode: NodeKind,
targetArg: ViewerClasses.Viewer,
sourceArg: ViewerClasses.Viewer,
looksArg: ViewerClasses.Viewer,
formatNameArg: ViewerClasses.Viewer,
styleNameArg: ViewerClasses.Viewer,
propNameArg: ViewerClasses.Viewer,
propValueArg: ViewerClasses.Viewer,
propPatternArg: ViewerClasses.Viewer,
substituteButton: Buttons.Button,
textButton: Buttons.Button,
looksButton: Buttons.Button,
formatButton: Buttons.Button,
styleButton: Buttons.Button,
commentButton: Buttons.Button,
doitButton: Buttons.Button,
sortOrderLabel: Labels.Label,
sortKindLabel: Labels.Label,
operationLabel: Labels.Label,
propNodeLabel: Labels.Label,
opsArg: ViewerClasses.Viewer,
filesArg: ViewerClasses.Viewer,
wdirArg: ViewerClasses.Viewer,
initCapLabel: Labels.Label,
caretFormatLabel: Labels.Label,
comArg: ViewerClasses.Viewer,
subsRangeLabel: Labels.Label,
looksMatchLabel: Labels.Label,
looksLabel: Labels.Label,
literalLabel: Labels.Label,
caseLabel: Labels.Label,
wordLabel: Labels.Label,
caretLooksLabel: Labels.Label,
formatNodeLabel: Labels.Label,
styleNodeLabel: Labels.Label,
finder: TreeFind.Finder,
varNode: TextNode.Ref,
layout: EditToolBuilder.Layout
];
SubsInfo: TYPE = REF SubsInfoRec;
SubsInfoRec:
TYPE =
RECORD [
substitute: BOOL,
searchLooks, targetLooks, sourceLooks: TextLooks.Looks,
last: TextNode.Ref,
lastLen, sourceLen: INT,
styleRope: Rope.ROPE,
sourceNode: TextNode.Ref,
sourceFormat: ATOM,
sourceStyle: ATOM,
sourceComment: BOOL,
rdr: RopeReader.Ref,
event: UndoEvent.Ref
];
editTool: ViewerClasses.Viewer;
mainToolInfo: Info;
Event: TYPE = UndoEvent.Ref;
tSel: TEditDocument.Selection;
ChangeState: PROC [flag: BOOL, trueList, falseList: LIST OF REF];
CycleTriple: PROC [state: [0..2], list0, list1, list2: LIST OF REF];
SavePSel: PROC; -- if pSel is not in data field of Edit Tool, save it for later
FixPSel: PROC; -- if pSel is in data field of Edit Tool, restore prior
Menu procs
DoSubstituteMenuButton: Menus.ClickProc;
DoYesMenuButton: Menus.ClickProc;
DoNoMenuButton: Menus.ClickProc;
DoItMenuButton: Menus.ClickProc;
DoCountMenuButton: Menus.ClickProc;
DoSearchMenuButton: Menus.ClickProc;
Search related stuff
BuildSearchButtons: PROC [info: Info];
BuildTargetEntry: PROC [info: Info];
Search: PROC [whichDir: TiogaOps.SearchDir, info: Info];
TrySearch: PROC [whichDir: TiogaOps.SearchDir, info: Info] RETURNS [found: BOOL];
CheckPSel:
PROC [pSel: TEditDocument.Selection, typescriptOK:
BOOL ←
TRUE]
RETURNS [ok:
BOOL];
GetPatternNode: PROC [info: Info] RETURNS [pattern: TextNode.RefTextNode];
Extend:
PROC[info: Info, forward:
BOOL,
searchLooks: TextLooks.Looks, where: TextNode.RefTextNode, at, atEnd:
INT,
last: TextNode.Ref ←
NIL, lastLen:
INT ←
INT.
LAST]
RETURNS [newAt, newAtEnd:
INT];
ReportPatternError: PROC [ec: TextFind.PatternErrorCode];
Substitute related stuff
withinSel: [0..2] = 0;
afterSel: [0..2] = 1;
entireDoc: [0..2] = 2;
GetLooksAndPatternInfo:
PROC [pattern: TextNode.RefTextNode, info: Info
]
RETURNS [
pat: TextNode.RefTextNode,
lit:
BOOL,
searchLooks: TextLooks.Looks,
format:
ATOM,
style:
ATOM,
commentControl: TreeFind.CommentControl
];
BuildSourceEntry: PROC [info: Info];
BuildDoItEntries: PROC [info: Info];
BuildOperationEntry: PROC [info: Info];
BuildInitCapEntry: PROC [info: Info];
BuildOperationField: PROC [info: Info];
BuildGetAndSetOpsEntries: PROC [info: Info];
BuildFileListEntries: PROC [info: Info];
BuildComNumField: PROC [info: Info];
BuildSubstituteEntry: PROC [info: Info];
BuildPatternDocEntry: PROC [info: Info];
BuildMiniPatternDocEntry:
PROC [info: Info];
GetOps: PROC [info: Info] RETURNS [list: LIST OF REF ANY];
DoOpsCom: PROC [info: Info];
Sort related stuff
BuildSortButtons: PROC [info: Info];
sortText: [0..2] = 0;
sortLines: [0..2] = 1;
sortBranches: [0..2] = 2;
Looks related stuff
BuildLooksButtons: PROC [info: Info];
Miscellaneous related stuff
BuildFormatButtons: PROC [info: Info];
BuildStyleButtons: PROC [info: Info];
BuildPropertyButtons: PROC [info: Info];
BuildExtraButtons: PROC [info: Info];
BuildExtraOverflow: PROC [info: Info];
DoList: PROC [list: LIST OF REF ANY, typescriptOK: BOOL ← TRUE];
DoList2: PROC [list: LIST OF REF ANY, typescriptOK: BOOL ← TRUE];
END.