-- file: Insert.Mesa -- edited by Brotz, October 12, 1981 3:23 PM DIRECTORY exD: FROM "ExceptionDefs", inD: FROM "InteractorDefs", intCommon, opD: FROM "OperationsDefs", tsD: FROM "TOCSelectionDefs", vmD: FROM "VirtualMgrDefs"; Insert: PROGRAM IMPORTS exD, inD, intC: intCommon, opD, tsD, vmD = BEGIN tnp: inD.TOCTextNbrPtr = intC.tocTextNbr; toc: vmD.TOCHandle = tnp.toc; tocIndex: vmD.TOCIndex; key: CARDINAL; IF ~tnp.haveToc OR ~intC.cmTextNbr.haveMessage THEN exD.DisplayExceptionString["No toc or message"L] ELSE BEGIN worked: BOOLEAN; key _ vmD.WaitForLock[toc]; tocIndex _ IF tsD.TOCSelectionEmpty[toc, key] THEN 1 ELSE tsD.LastSelectedEntry[toc, key] + 1; inD.IndicateCommandBusy[intC.mailFileCommandHouse]; tsD.DeconsiderAll[tnp, key]; tsD.ResetTOCSelection[toc, key]; worked _ opD.ReplaceMailOperation [delete: FALSE, toc: toc, msg: intC.cmTextNbr.message, index: tocIndex, key: key]; IF worked THEN BEGIN tsD.SetTOCSelection[toc, key, tocIndex]; inD.Consider[tocIndex, tocIndex, tnp, key]; END; inD.UpdateTOCThumbLine[tnp, key]; vmD.UnlockTOC[toc, key]; inD.IndicateCommandFinished[intC.mailFileCommandHouse]; IF worked THEN BEGIN intC.composedMessageEdited _ FALSE; inD.IndicateCommandBusy[intC.displayCommandHouse]; inD.DisplayMessageCommand[intC.displayCommandHouse, TRUE]; inD.IndicateCommandFinished[intC.displayCommandHouse]; END ELSE exD.DisplayExceptionString["Not enough room to perform insert."L]; END; END. -- of Insert --(635)\f1