-- EditToolExtraImpl.mesa; Edited by Paxton on June 6, 1983 3:46 pm
-- Edited by McGregor on August 30, 1982 2:33 pm
DIRECTORY
EditToolPrivate,
EditToolBuilder,
Buttons,
TEditDocument,
TEditOps,
Rope,
ViewerClasses;
EditToolExtraImpl: CEDAR PROGRAM
IMPORTS EditToolPrivate, EditToolBuilder, TEditOps
EXPORTS EditToolPrivate =
{ OPEN EditToolPrivate, EditToolBuilder;
----------------------------
BuildExtraButtons: PUBLIC PROC [info: Info] = {
{ OPEN info;
BuildOne: PROC [info: Layout, name: Rope.ROPE, proc: Buttons.ButtonProc] = {
[] ← BuildButton[info: info, name: name, proc: proc, gapAfter: FALSE] };
BuildOne[layout, "CaretBefore", CaretBefore];
BuildOne[layout, "CaretAfter", CaretAfter];
BuildOne[layout, "CaretOnly", MakePointSelection];
BuildOne[layout, "Grow", GrowSelection];
BuildOne[layout, "Document", Everything];
ToNext[layout,TRUE];
BuildOne[layout, "PendingDelete", MakePendingDelete];
BuildOne[layout, "NotPendingDelete", MakeNotPendingDelete];
ToNext[layout,TRUE];
BuildOne[layout, "MakeSecondary", MakeSecondary];
BuildOne[layout, "MakePrimary", MakePrimary];
BuildOne[layout, "CancelSecondary", CancelSecondary];
BuildOne[layout, "CancelPrimary", CancelPrimary];
ToNext[layout,TRUE];
BuildOne[layout, "ToPrimary", ToPrimary];
BuildOne[layout, "ToSecondary", ToSecondary];
BuildOne[layout, "Transpose", Transpose];
ToNext[layout,TRUE];
BuildOne[layout, "GoToNextChar", GoToNextChar];
BuildOne[layout, "GoToNextWord", GoToNextWord];
BuildOne[layout, "GoToNextNode", GoToNextNode];
ToNext[layout,TRUE];
BuildOne[layout, "SaveSel-A", SaveSelectionA];
BuildOne[layout, "RestoreSel-A", RestoreSelectionA];
BuildOne[layout, "SaveSel-B", SaveSelectionB];
BuildOne[layout, "RestoreSel-B", RestoreSelectionB];
ToNext[layout,TRUE];
BuildOne[layout, "(...)", SelectMatchingParens];
BuildOne[layout, "<...>", SelectMatchingAngleBrackets];
BuildOne[layout, "{...}", SelectMatchingCurlyBrackets];
BuildOne[layout, "[...]", SelectMatchingSquareBrackets];
BuildOne[layout, "\"...\"", SelectMatchingDoubleQuotes];
BuildOne[layout, "'...'", SelectMatchingSingleQuotes];
BuildOne[layout, "-...-", SelectMatchingDashBrackets];
BuildOne[layout, "...", SelectMatchingPlaceholderBrackets];
BuildOne[layout, "Next...", NextPlaceholder];
BuildOne[layout, "Prev...", PreviousPlaceholder];
ToNext[layout,TRUE];
BuildOne[layout, "Delete", Delete];
BuildOne[layout, "Paste", Paste];
BuildOne[layout, "SaveForPaste", SaveForPaste];
BuildOne[layout, "Repeat", Repeat];
BuildOne[layout, "Undo", Undo];
ToNext[layout,TRUE];
BuildExtraOverflow[info] }};
----------------------------
DoList: PUBLIC PROC [list: LIST OF REF ANY, typescriptOK: BOOLTRUE] = {
pSel: TEditDocument.Selection = TEditOps.GetSelData[primary: TRUE];
IF ~CheckPSel[pSel, typescriptOK] THEN RETURN;
pSel.viewer.class.notify[pSel.viewer, list]};
DoList2: PUBLIC PROC [list: LIST OF REF ANY, typescriptOK: BOOLTRUE] = {
sSel: TEditDocument.Selection = TEditOps.GetSelData[primary: FALSE];
IF ~CheckPSel[sSel, typescriptOK] THEN RETURN;
sSel.viewer.class.notify[sSel.viewer, list]};
----------------------------
toprimary: LIST OF REF ANY = LIST[$ToPrimary,$DoEdit];
ToPrimary: Buttons.ButtonProc = {DoList[toprimary]}; 
tosecondary: LIST OF REF ANY = LIST[$ToSecondary,$DoEdit];
ToSecondary: Buttons.ButtonProc = {DoList[tosecondary]}; 
transpose: LIST OF REF ANY = LIST[$ToBoth,$DoEdit];
Transpose: Buttons.ButtonProc = {DoList[transpose]}; 
pdel: LIST OF REF ANY = LIST[$MakePendingDelete];
MakePendingDelete: Buttons.ButtonProc = {DoList[pdel]}; 
makesecondary: LIST OF REF ANY = LIST[$MakeSecondary];
MakeSecondary: Buttons.ButtonProc = {DoList[makesecondary]};
makeprimary: LIST OF REF ANY = LIST[$MakePrimary];
MakePrimary: Buttons.ButtonProc = {DoList2[makeprimary]};
cancelsecondary: LIST OF REF ANY = LIST[$CancelSecondary];
CancelSecondary: Buttons.ButtonProc = {DoList2[cancelsecondary]};
cancelprimary: LIST OF REF ANY = LIST[$CancelPrimary];
CancelPrimary: Buttons.ButtonProc = {DoList[cancelprimary]};
notpdel: LIST OF REF ANY = LIST[$MakeNotPendingDelete];
MakeNotPendingDelete: Buttons.ButtonProc = {DoList[notpdel]};
caretbefore: LIST OF REF ANY = LIST[$CaretBefore];
CaretBefore: Buttons.ButtonProc = {DoList[caretbefore]};
caretafter: LIST OF REF ANY = LIST[$CaretAfter];
CaretAfter: Buttons.ButtonProc = {DoList[caretafter]};
makepointselection: LIST OF REF ANY = LIST[$MakePointSelection];
MakePointSelection: Buttons.ButtonProc = {DoList[makepointselection]};
growselection: LIST OF REF ANY = LIST[$GrowSelection];
GrowSelection: Buttons.ButtonProc = {DoList[growselection]};
everything: LIST OF REF ANY = LIST[$Everything];
Everything: Buttons.ButtonProc = {DoList[everything]};
int: PROC [i: INT] RETURNS [REF] = { RETURN [NEW[INT ← i]] };
gotonextchar: LIST OF REF ANY = LIST[int[1],$GoToNextChar];
gotopreviouschar: LIST OF REF ANY = LIST[int[1],$GoToPreviousChar];
GoToNextChar: Buttons.ButtonProc = {
DoList[IF mouseButton=red THEN gotonextchar ELSE gotopreviouschar,TRUE]};
gotonextword: LIST OF REF ANY = LIST[int[1],$GoToNextWord];
gotopreviousword: LIST OF REF ANY = LIST[int[1],$GoToPreviousWord];
GoToNextWord: Buttons.ButtonProc = {
DoList[IF mouseButton=red THEN gotonextword ELSE gotopreviousword,TRUE]};
gotonextnode: LIST OF REF ANY = LIST[int[1],$GoToNextNode];
gotopreviousnode: LIST OF REF ANY = LIST[int[1],$GoToPreviousNode];
GoToNextNode: Buttons.ButtonProc = {
DoList[IF mouseButton=red THEN gotonextnode ELSE gotopreviousnode]};
saveselectionA: LIST OF REF ANY = LIST[$SaveSelectionA];
SaveSelectionA: Buttons.ButtonProc = {DoList[saveselectionA]};
restoreselectionA: LIST OF REF ANY = LIST[$RestoreSelectionA];
RestoreSelectionA: Buttons.ButtonProc = {DoList[restoreselectionA]};
saveselectionB: LIST OF REF ANY = LIST[$SaveSelectionB];
SaveSelectionB: Buttons.ButtonProc = {DoList[saveselectionB]};
restoreselectionB: LIST OF REF ANY = LIST[$RestoreSelectionB];
RestoreSelectionB: Buttons.ButtonProc = {DoList[restoreselectionB]};
selectmatchingparens: LIST OF REF ANY = LIST[$SelectMatchingParens];
SelectMatchingParens: Buttons.ButtonProc = {DoList[selectmatchingparens]};
selectmatchingdashbrackets: LIST OF REF ANY = LIST[$SelectMatchingDashBrackets];
SelectMatchingDashBrackets: Buttons.ButtonProc = {DoList[selectmatchingdashbrackets]};
selectmatchinganglebrackets: LIST OF REF ANY = LIST[$SelectMatchingAngleBrackets];
SelectMatchingAngleBrackets: Buttons.ButtonProc = {DoList[selectmatchinganglebrackets]};
selectmatchingcurlybrackets: LIST OF REF ANY = LIST[$SelectMatchingCurlyBrackets];
SelectMatchingCurlyBrackets: Buttons.ButtonProc = {DoList[selectmatchingcurlybrackets]};
selectmatchingsquarebrackets: LIST OF REF ANY = LIST[$SelectMatchingSquareBrackets];
SelectMatchingSquareBrackets: Buttons.ButtonProc = {DoList[selectmatchingsquarebrackets]};
selectmatchingplaceholderbrackets: LIST OF REF ANY = LIST[$SelectMatchingPlaceholderBrackets];
SelectMatchingPlaceholderBrackets: Buttons.ButtonProc =
{DoList[selectmatchingplaceholderbrackets]};
selectmatchingdoublequotes: LIST OF REF ANY = LIST[$SelectMatchingDoubleQuotes];
SelectMatchingDoubleQuotes: Buttons.ButtonProc = {DoList[selectmatchingdoublequotes]};
selectmatchingsinglequotes: LIST OF REF ANY = LIST[$SelectMatchingSingleQuotes];
SelectMatchingSingleQuotes: Buttons.ButtonProc = {DoList[selectmatchingsinglequotes]};
nextplaceholder: LIST OF REF ANY = LIST[$NextPlaceholder];
NextPlaceholder: Buttons.ButtonProc = {DoList[nextplaceholder]};
previousplaceholder: LIST OF REF ANY = LIST[$PreviousPlaceholder];
PreviousPlaceholder: Buttons.ButtonProc = {DoList[previousplaceholder]};
delete: LIST OF REF ANY = LIST[$Delete];
Delete: Buttons.ButtonProc = {DoList[delete]};
paste: LIST OF REF ANY = LIST[$Paste];
Paste: Buttons.ButtonProc = {DoList[paste]};
saveforpaste: LIST OF REF ANY = LIST[$SaveForPaste];
SaveForPaste: Buttons.ButtonProc = {DoList[saveforpaste]};
repeat: LIST OF REF ANY = LIST[$Repeat];
Repeat: Buttons.ButtonProc = {DoList[repeat]};
undo: LIST OF REF ANY = LIST[$Undo];
Undo: Buttons.ButtonProc = {DoList[undo]};
}.
..
Selection related:
MakePendingDelete MakeNotPendingDelete
CaretBefore CaretAfter
MakePointSelection
GrowSelection
Everything
GoToNextChar GoToPreviousChar
GoToNextWord GoToPreviousWord
GoToNextNode GoToPreviousNode
PushSelection PopSelection
SelectMatchingParens SelectMatchingAngleBrackets SelectMatchingCurlyBrackets SelectMatchingSquareBrackets SelectMatchingPlaceholderBrackets
NextPlaceholder PreviousPlaceholder
NextViewer PreviousViewer
Editing:
Delete Paste
Repeat Cancel
BackSpace BackWord
DeleteNextChar DeleteNextWord
ParenBrackets DashBrackets AngleBrackets DoubleQuoteBrackets SingleQuoteBrackets CurlyBrackets SquareBrackets PlaceholderBrackets
AllCaps AllLower InitialCaps FirstCap
MakeOctalCharacter MakeControlCharacter
ExpandAbbrev
SetMesaLooks
SetComment SetNotComment
Break Join
Nest UnNest
here is the EditTool program I used to create all the button procs:
PushSelection EditToolMatchCase EditToolMatchLiterally EditToolClearSearchFor "Everything" PopSelection EditToolSearchForward EditToolDoIt EditToolSearchForward EditToolDoIt EditToolIgnoreCase EditToolSearchForward EditToolDoIt AllLower PushSelection EditToolClearSearchFor "{everything}: LIST" PopSelection EditToolMatchPattern EditToolSearchBackwards EditToolDoIt AllLower
just put the name, such as "MakeControlCharacter", in the "Replace by:" field,
select just before a copy of the Everything stuff, the do the command.