(FILECREATED "24-Apr-87 11:22:25" {QV}<NOTECARDS>1.3K>NEXT>NCTEXTCARD.;47 41996 changes to: (FNS NC.TEditMenuFn) (VARS NCTEXTCARDCOMS) previous date: "23-Apr-87 19:45:57" {QV}<NOTECARDS>1.3K>NEXT>NCTEXTCARD.;46) (* Copyright (c) 1985, 1986, 1987 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT NCTEXTCARDCOMS) (RPAQQ NCTEXTCARDCOMS ((* * Stuff for the Text card type.) (FILES NCTYPESMECH TEDIT) (GLOBALVARS TEDIT.DEFAULT.MENU TEDIT.TITLED.ICON.TEMPLATE TEDIT.ICON.FONT NC.TEditPasswordDividedBy100 NC.DefaultFont NC.DeletedLinkImageObject NC.CardTypes NC.AnnoFlg NC.UseDeletedLinkIconIndicatorsFlg NC.DelTEditProcessAtShrinkFlg NC.TextCardIcon NC.UserSpecifiedTEditProps) (* * basic fns) (FNS NC.MakeTEditCard NC.BringUpTEditCard NC.CollectReferencesInText NC.InstallTextTitleBarMiddleMenu NC.MarkTextDirty NC.ResetTEdit NC.ResetTEditProcess NC.TEditBasedP NC.TEditCloseFn NC.TEditMenuFn NC.TEditQuitFn NC.TextCopySubstance NC.TextDirtyP NC.TextCardShrinkFn NC.PutTextSubstance NC.GetTextSubstance NC.UpdateLinkImagesInText NC.CharPosFromTextObject NC.DelReferencesToCardFromText) (VARS (TEDIT.DEFAULT.PROPS (CONS (QUOTE SLOWUPDATE) (CONS (QUOTE T) TEDIT.DEFAULT.PROPS))) (NC.TEditPasswordDividedBy100 314)) (* * This stuff supports the "push-copy" method of copying links in NC) (FNS NC.TranslateWindowPositionToTEditPosition NC.InsertLinkInTextWindow) (* * New FNS) (GLOBALVARS NC.ExternalPutLinkIconImageFns) (FNS NC.CardFromTextStream NC.TEditPutFn NC.TEditPutFnAuxiliary NC.TEditGetFn NC.MakeTEditPropsList NC.TEditPropsListQuitFn NC.DelTEditProcesses) (* * prevent TEdit splitwindow facilities) (ADVISE \TEDIT.SPLITW) (* * Add the Text card type to the card types list.) (FNS NC.AddTextCard NC.ComputeTextCardMiddleButtonMenuItems) (BITMAPS NC.TextCardIcon) (P (NC.AddTextCard)) (FNS NCAddStub.TextCard) (ADVISE TEDIT.ADD.MENUITEM TEDIT.REMOVE.MENUITEM))) (* * Stuff for the Text card type.) (FILESLOAD NCTYPESMECH TEDIT) (DECLARE: DOEVAL@COMPILE DONTCOPY (GLOBALVARS TEDIT.DEFAULT.MENU TEDIT.TITLED.ICON.TEMPLATE TEDIT.ICON.FONT NC.TEditPasswordDividedBy100 NC.DefaultFont NC.DeletedLinkImageObject NC.CardTypes NC.AnnoFlg NC.UseDeletedLinkIconIndicatorsFlg NC.DelTEditProcessAtShrinkFlg NC.TextCardIcon NC.UserSpecifiedTEditProps) ) (* * basic fns) (DEFINEQ (NC.MakeTEditCard [LAMBDA (Card Title NoDisplayFlg ParamList) (* rht: "17-Apr-87 16:18") (* Make up a blank text card and display it.) (* * rht 9/10/85: Fixed call to NC.MakeTEditPropsList so prompt window gets fixed up before card is brought up.) (* * fgh 11/13/85 Updated to handle Card object.) (* * rht 4/11/86: Now passes type to NC.MakeTEditMiddleMenu.) (* * rht 5/6/86: Now calls NC.InstallTitleBarLeftMenu and NC.InstallTextTitleBarMiddleMenu.) (* * rht 9/8/86: No longer hangs Card off NoteCardObject windowprop. THis is done in NC.MakeNoteCard.) (* * rht 9/19/86: Mod to above fix. Now calls NC.MakeNewCardWindow a new fn that creates window and hangs Card off windowprop. Also takes ParamList arg.) (* * rht&pmi 11/19/86: Now passes NoteFile arg to NC.MakeTEditPropsList.) (* * rht 4/17/87: Now makes a prompt window before opening the window.) (LET (TextStream Window Type) (COND (NoDisplayFlg [SETQ TextStream (OPENTEXTSTREAM "" NIL NIL NIL (NC.MakeTEditPropsList NIL (LISTGET ParamList (QUOTE Don'tAttachUserSpecifiedPropsFlg] (NC.SetSubstance Card TextStream) (STREAMPROP TextStream (QUOTE NoteCardObject) Card) Card) (T (SETQ Window (NC.MakeNewCardWindow Card (OR Title "Untitled") NIL T)) (* Make a prompt window "invisibly" so it gets hooked in.) (NC.AttachPromptWindowOffScreen Window) (SETQ Type (NC.RetrieveType Card)) (NC.InstallTitleBarLeftMenu Window Type) (NC.InstallTextTitleBarMiddleMenu Window Type) (WINDOWADDPROP Window (QUOTE SHRINKFN) (FUNCTION NC.TextCardShrinkFn)) (TEDIT NIL Window NIL (NC.MakeTEditPropsList Window (NC.FileBoxP Card T) (fetch (Card NoteFile) of Card))) (until (WINDOWPROP Window (QUOTE TEXTSTREAM)) do (BLOCK)) (SETQ TextStream (WINDOWPROP Window (QUOTE TEXTSTREAM))) (NC.SetSubstance Card TextStream) (STREAMPROP TextStream (QUOTE NoteCardObject) Card) Window]) (NC.BringUpTEditCard [LAMBDA (Card TextStream RegionOrPosition) (* rht: "17-Apr-87 16:11") (* Bring up a TEdit window for Card ID whose text stream is TextStream in Region specified by RegionOrPosition or by the user.) (* * rht 9/10/85: Fixed call to NC.MakeTEditPropsList so prompt window gets fixed up before card is brought up.) (* * fgh 11/13/85 Updated to handle Card objects.) (* * kirk 2Dec85 Removed illegal RETURN) (* * rht 4/11/86: Added Type arg to call to NC.MakeTEditMiddleMenu and changed names of menu windowprops.) (* * rht 5/5/86: Now calls NC.InstallTitleBarLeftMenu and NC.InstallTextTitleBarMiddleMenu.) (* * rht 8/2/86: Now doesn't throw in any extra tedit props if card is a filebox.) (* * rht 11/16/86: Now moves window to RegionOrPosition if already up.) (* * rht&pmi 11/19/86: Now passes NoteFile arg to NC.MakeTEditPropsList.) (* * rht & pmi 12/16/86: Changed the way we get TEditWindow.) (* * rht 1/30/87: Now calls RESTART-PROCESS-OF-TEDIT-WINDOW from Bagley's TEDIT-PROCESS-KILLER package.) (* * rht 4/17/87: Now makes a prompt window before opening the window.) (LET (Region TEditWindow TEditProcess Title TextStreamDirtyFlg Type) (if (SETQ TEditWindow (NC.FetchWindow Card)) then (TOTOPW TEditWindow) (if RegionOrPosition then (SHAPEW TEditWindow (NC.DetermineDisplayRegion Card RegionOrPosition))) (RPTQ 2 (FLASHW TEditWindow)) (if (SETQ TEditProcess (WINDOWPROP TEditWindow (QUOTE PROCESS))) then (TTY.PROCESS TEditProcess) else (* Process may have been turned off. Try to restart.) (SETQ TEditProcess (RESTART-PROCESS-OF-TEDIT-WINDOW TEditWindow))) TEditWindow else (SETQ Region (NC.DetermineDisplayRegion Card RegionOrPosition)) (SETQ Title (NC.RetrieveTitle Card)) (SETQ Type (NC.RetrieveType Card)) (SETQ TEditWindow (CREATEW Region Title NIL T)) (* Make a prompt window "invisibly" so it gets hooked in.) (NC.AttachPromptWindowOffScreen TEditWindow) (WINDOWADDPROP TEditWindow (QUOTE SHRINKFN) (FUNCTION NC.TextCardShrinkFn)) (NC.InstallTitleBarLeftMenu TEditWindow Type) (NC.InstallTextTitleBarMiddleMenu TEditWindow Type) (SETQ TextStreamDirtyFlg (NC.CardDirtyP Card)) (TEDIT TextStream TEditWindow NIL (NC.MakeTEditPropsList TEditWindow (NC.FileBoxP Card T) (fetch (Card NoteFile) of Card))) (AND TextStreamDirtyFlg (NC.MarkCardDirty Card))) TEditWindow]) (NC.CollectReferencesInText (LAMBDA (Card CheckAndDeleteFlg ReturnLinkIconsFlg ReturnLocationsFlg) (* fgh: "17-Nov-85 16:20") (* * Return a list of all links or link icons in text substance Substance. If CheckAndDeleteFlg, then delete any links found that are not valid links.) (* * fgh 11/13/85 Updated to handle Card object. Eliminated DatabaseStream argument.) (PROG (ActualLink DirtyFlg Links (Substance (NC.FetchSubstance Card))) (SETQ Links (for ImageObjectDecriptor in (TEDIT.LIST.OF.OBJECTS (TEXTOBJ Substance) (FUNCTION NC.LinkIconImageObjP)) when (PROGN (SETQ ActualLink (NC.FetchLinkFromLinkIcon (CAR ImageObjectDecriptor))) (COND ((NULL CheckAndDeleteFlg) (* No checking required) T) ((AND (LISTP CheckAndDeleteFlg) (FMEMB (fetch (Link DestinationCard) of ActualLink) CheckAndDeleteFlg)) (* Already checked since ID cached on CheckAndDeleteFlg list) T) ((NC.ValidLinkP ActualLink) (* Link is valid) T) (T (* Link is bad. Replace it with the DeletedLink image object.) (create IMAGEOBJ smashing (CAR ImageObjectDecriptor) OBJECTDATUM ←(fetch (IMAGEOBJ OBJECTDATUM) of NC.DeletedLinkImageObject) IMAGEOBJPLIST ←(fetch (IMAGEOBJ IMAGEOBJPLIST) of NC.DeletedLinkImageObject) IMAGEOBJFNS ←(fetch (IMAGEOBJ IMAGEOBJFNS) of NC.DeletedLinkImageObject)) (SETQ DirtyFlg T) NIL))) collect (COND ((AND ReturnLinkIconsFlg (NOT ReturnLocationsFlg)) (CAR ImageObjectDecriptor)) ((AND ReturnLinkIconsFlg ReturnLocationsFlg) (CONS (CAR ImageObjectDecriptor) (CADR ImageObjectDecriptor))) ((AND (NOT ReturnLinkIconsFlg) ReturnLocationsFlg) (CONS ActualLink (CADR ImageObjectDecriptor))) (T ActualLink)))) (RETURN (CONS Links DirtyFlg))))) (NC.InstallTextTitleBarMiddleMenu [LAMBDA (Window CardType) (* pmi: " 2-Apr-87 10:23") (* * Make a text card middle button title bar menu and install.) (* * pmi 4/1/87: Changed to replace MENUFONT with NC.MenuFont) (DECLARE (GLOBALVARS NC.MenuFont)) (LET (Menu) [WINDOWPROP Window (QUOTE TitleBarMiddleButtonMenu) (SETQ Menu (\TEDIT.CREATEMENU (NC.GetCardTypeField MiddleButtonMenuItems CardType] (replace (MENU MENUFONT) of Menu with NC.MenuFont) (replace (MENU ITEMHEIGHT) of Menu with (IPLUS (FONTPROP NC.MenuFont (QUOTE HEIGHT)) 1)) (replace (MENU IMAGE) of Menu with NIL]) (NC.MarkTextDirty (LAMBDA (Card ResetFlg) (* fgh: "13-Nov-85 23:19") (* * Mark or unmark TextStream as being changed.) (* * rht 2/1/85: Updated to use the documented function.) (* * fgh 11/13/85 Updated to use Card) (TEDIT.STREAMCHANGEDP (TEXTSTREAM (NC.FetchSubstance Card)) ResetFlg))) (NC.ResetTEdit (LAMBDA (TextStream) (* NoteCards% User "17-Jun-84 01:58") (* * Kill the Tedit process running on TextStream and the restart a new one. Goal is to clean up display if TEdit goea awary.) (ADD.PROCESS (LIST (FUNCTION NC.ResetTEditProcess) TextStream) (QUOTE NAME) (QUOTE ResetTEdit)))) (NC.ResetTEditProcess (LAMBDA (TextStream) (* fgh: " 7-Jun-86 19:16") (* * Added-process that actually does the works for NC.ResetTEdit. Kill the Tedit process running on TextStream and the restart a new one. Goal is to clean up display if TEdit goea awary.) (* * rht 2/1/85: Changed to calls to NC.MarkCardDirty and NC.CardDirtyP.) (* * rht 10/8/85: Now closes prompt window if TEDIT call brought it up.) (* * fgh 11/13/85 Updated to handle Card object.) (* * fgh 6/7/86 Upodated to use NC.GETPROMPTWINDOW. Added WINDOWADDPROP call to make sure that NC.QUitCard is first on the CLOSEFN list) (LET ((Window (WINDOW.FROM.TEDIT.THING TextStream)) (TextObj (TEXTOBJ TextStream)) DirtyFlg Card PromptWin) (COND ((AND (WINDOWP Window) (SETQ Card (NC.CoerceToCard Window))) (SETQ DirtyFlg (NC.CardDirtyP Card)) (TEDIT.KILL TextStream) (until (NULL (WINDOWPROP Window (QUOTE TEXTSTREAM))) do (BLOCK)) (TEDIT TextStream Window) (until (TEXTSTREAMP (WINDOWPROP Window (QUOTE TEXTSTREAM))) do (BLOCK)) (COND ((OPENWP (SETQ PromptWin (NC.GETPROMPTWINDOW Window NIL NIL T))) (CLOSEW PromptWin))) (NC.MarkCardDirty Card (NOT DirtyFlg)) (WINDOWPROP Window (QUOTE TITLE) (NC.RetrieveTitle Card)) (WINDOWADDPROP Window (QUOTE CLOSEFN) (FUNCTION NC.QuitCard) T)))))) (NC.TEditBasedP (LAMBDA (CardOrTypeName) (* fgh: "17-Nov-85 19:21") (* * Returns T if Type is a note card type that is based on TEdit or else an ID of such a note card. NIL otherise.) (* * rht 11/8/84: Hacked to reflect notecards typing mechanism. Seems gross to have to search the types list to get the record.) (* * fgh 11/13/85 Updated to handle Card object.) (LET ((TypeName (COND ((NC.CardP CardOrTypeName) (NC.RetrieveType CardOrTypeName)) (T CardOrTypeName)))) (NC.IsSubTypeOfP TypeName (QUOTE Text))))) (NC.TEditCloseFn (LAMBDA (CardIdentifier) (* fgh: "13-Nov-85 23:21") (* Close this TEdit window by Quitting from TEdit) (* * rht 11/12/84: Changed call to TEXTSTREAM to a WINDOWPROP call.) (* * fgh 11/13/85 Updated to handle Card objects.) (LET (Window (Card (NC.CoerceToCard CardIdentifier))) (SETQ Window (NC.FetchWindow Card)) (NC.TEditQuitFn Card) (COND (Window (WINDOWDELPROP Window (QUOTE CLOSEFN) (FUNCTION NC.QuitCard)) (TEDIT.QUIT (TEXTSTREAM Window))))))) (NC.TEditMenuFn [LAMBDA (Window) (* Randy.Gobbel "23-Apr-87 15:32") (* * Gets called from LEFT or MIDDLE button press in title bar of TEdit window. If LEFT press bring up the Notecards Manipulation Window. IF MIDDLE press bring up the TEdit specific NoteCard operations menu. Bring up menus using TEDIT.DEFAULT.MENUFN) (* * rht 4/11/86: No only calls TEDIT.DEFAULT.MENUFN for middle button press. On left button press, works like graph and sketch cards.) (* * rg 4/23/87 added contention lock) (if (LASTMOUSESTATE LEFT) then (APPLY* (OR (MENU (WINDOWPROP Window (QUOTE TitleBarLeftButtonMenu))) (FUNCTION NILL)) Window) else (WINDOWPROP Window (QUOTE TEDIT.MENU) (WINDOWPROP Window (QUOTE TitleBarMiddleButtonMenu))) (NC.ProtectedCardOperation (NC.CoerceToCard Window) "Perform TEdit Operation" Window (TEDIT.DEFAULT.MENUFN Window]) (NC.TEditQuitFn (LAMBDA (CardIdentifier) (* rht: "14-Jul-86 00:09") (* Called by TEdit when quitting out of a TEdit-based note card. Close up attached windows,) (* * fgh 11/13/85 Updated to handle Card objects.) (* * fgh 5/2/86 Removed assumption that there is a window when looking for the prompt window) (* * rht 7/14/86: No longer calls NC.DeactivateCard.) (LET ((Card (NC.CoerceToCard CardIdentifier)) PromptWindow Window) (SETQ Window (NC.FetchWindow Card)) (SETQ PromptWindow (GETPROMPTWINDOW Window NIL NIL T)) (AND Window (for AttachedWindow in (ALLATTACHEDWINDOWS Window) unless (EQ AttachedWindow PromptWindow) do (DETACHWINDOW AttachedWindow) (CLOSEW AttachedWindow) (until (NULL (OPENWP AttachedWindow)) do (BLOCK)))) (* * Obsolete (* MAke sure TEdit won't close the database file) (replace (TEXTOBJ TXTFILE) of (TEXTOBJ TextStream) with NIL) (TEDIT.MAPPIECES (TEXTOBJ TextStream) (FUNCTION (LAMBDA (CH# PC PC# OBL) (replace (PIECE PFILE) of PC with NIL))))) (* * Setting the PromptWindow PROCESS to NIL is to break a circularity caused by TEXTOBJ -> PROMPTWINDOW -> PROCESS -> TEXTSTREAM -> TEXTOBJ) (AND Window PromptWindow (WINDOWPROP PromptWindow (QUOTE PROCESS) NIL) (REMOVEPROMPTWINDOW Window)) T))) (NC.TextCopySubstance (LAMBDA (Card FromStream ToStream Length) (* fgh: "21-Nov-85 21:26") (* * Copy a text substance from FromStream to ToStream.) (* * fgh 11/20/85 NoteCards now passes the Start and End pointers of the FromStream as args and properly sets the pointers on the ToStream) (* * fgh 11/21/85 Now passed Length instead of start and end ptrs.) (LET* ((FromStartPtr (GETFILEPTR FromStream)) (FromEndPtr (PLUS Length FromStartPtr))) (COPYBYTES FromStream ToStream FromStartPtr FromEndPtr)) T)) (NC.TextDirtyP (LAMBDA (Card) (* fgh: "13-Nov-85 23:19") (* * Return T is TextSubstance has been changed.) (* * fgh 11/13/85 Updated to handle Card objects.) (TEDIT.STREAMCHANGEDP (TEXTSTREAM (NC.FetchSubstance Card))))) (NC.TextCardShrinkFn [LAMBDA (W) (* rht: "30-Jan-87 19:48") (* * This is in order to get the right title on the TEdit icon. This is a kludgy finesse around TEdit's shrunken icon title facility.) (* * rht 4/30/86: Now optionally kills TEdit process at shrink time.) (* * fgh 6/5/86 Fixed to KLUDGE around problem that TEdit will call GETBOXPOSITION even when SHRINKW is called with a position argument. Kludge involves looking up the stack for the position being specified in SHRINKW since its not passed down to here.) (* * rg 11/18/86 Added GLOBALVARS) (* * rht 1/30/87: Changed NC.DelTEditProcessAtShrinkFlg stuff to use Bagley's package via KILL-PROCESS-OF-TEDIT-WINDOW.) (DECLARE (GLOBALVARS TEDIT.ICON.FONT TEDIT.TITLED.ICON.TEMPLATE NC.DelTEditProcessAtShrinkFlg) ) (LET ((OldIconTitle (WINDOWPROP W (QUOTE NoteCardsIconTitle))) (Icon (WINDOWPROP W (QUOTE ICON))) (Card (NC.CoerceToCard W)) IconTitle) [if (NULL Icon) then (WINDOWPROP W (QUOTE TEDIT.ICON.TITLE) "") (WINDOWPROP W (QUOTE ICON) (TITLEDICONW TEDIT.TITLED.ICON.TEMPLATE "" TEDIT.ICON.FONT (LET [(StkPos (STKPOS (QUOTE SHRINKW] (if StkPos then (PROG1 (STKARG (QUOTE ICONPOSITION) StkPos) (RELSTK StkPos)) else NIL)) T T NIL)) (APPLY* (WINDOWPROP W (QUOTE ICONFN)) W) (SETQ Icon (WINDOWPROP W (QUOTE ICON] (if [NOT (EQUAL OldIconTitle (SETQ IconTitle (CONCAT "NC: " (NC.RetrieveTitle Card] then (ICONTITLE IconTitle NIL NIL Icon) (WINDOWPROP W (QUOTE NoteCardsIconTitle) IconTitle)) (if NC.DelTEditProcessAtShrinkFlg then (KILL-PROCESS-OF-TEDIT-WINDOW W]) (NC.PutTextSubstance (LAMBDA (Card Stream) (* rht: "20-Aug-86 18:46") (* Put text substance from card ID on the database file) (* * rht 9/13/85: Now doesn't try to write piece table at all if substance has zero length.) (* * fgh 11/13/85 Updated to handle NoteFile, Card objects.) (* * fgh 11/20/85 removed code to handle start and end pointers) (* * rht 1/23/86: Now takes Stream as arg instead of computing from Card.) (* * fgh 2/6/86 Now returns a version number.) (* * Now checks to make sure that TEXTLEN > 0 before FORMATTEDP call.) (* * rht 8/20/86: No longer trust TEDIT.FORMATTEDFILEP. Now decide whether there's formatting info based on how many bytes were written down by TEDIT.PUT.PCTB.) (LET ((Substance (NC.FetchSubstance Card)) StartPtr StartFormatPtr EOFPtr TextLen) (* * Save the location of the start of this text stream.) (SETQ StartPtr (GETFILEPTR Stream)) (* * The write down the text stream) (COND ((NOT (ZEROP (SETQ TextLen (fetch (TEXTOBJ TEXTLEN) of (TEXTOBJ Substance)))) ) (TEDIT.PUT.PCTB (TEXTOBJ Substance) Stream))) (* * fix up the file absolute pointerts to be file textstream relative pointers.) (if (GREATERP (DIFFERENCE (GETFILEPTR Stream) StartPtr) TextLen) then (SETFILEPTR Stream (IDIFFERENCE (SETQ EOFPtr (GETEOFPTR Stream)) 8)) (SETQ StartFormatPtr (\DWIN Stream)) (SETFILEPTR Stream (IDIFFERENCE EOFPtr 8)) (\DWOUT Stream (DIFFERENCE StartFormatPtr StartPtr))) (* * Set stream file ptr to eof.) (SETFILEPTR Stream -1) 0))) (NC.GetTextSubstance [LAMBDA (Card Length Stream) (* rht: " 2-Feb-87 17:51") (* Get a text stream from the database file) (* * fgh 11/13/85 Updated to handle Card objects.) (* * fgh 11/20/85 NoteCards now passes down start and end pointer as args.) (* * fgh 11/21/85 Now passed Length instead of start and end ptrs.) (* * rht 1/23/86: Now takes Stream as arg instead of computing from Card.) (* * rht 2/2/87: Fixed bug in the way NC.MakeTEditPropsList was being called.) (LET ((TempStream (OPENSTREAM (QUOTE {NODIRCORE}) (QUOTE BOTH) (QUOTE NEW))) TextStream StartPtr) (* * Copy text stream to a NODIRCORE file from the current location. Number of bytes copied should be Length minus the 4 bytes already read for OriginalLocation) (COPYBYTES Stream TempStream (SETQ StartPtr (GETFILEPTR Stream)) (PLUS StartPtr Length)) (* * return an open textstream on the temp file) [SETQ TextStream (OPENTEXTSTREAM TempStream NIL NIL NIL (NC.MakeTEditPropsList NIL (NC.FileBoxP Card T) (fetch (Card NoteFile) of Card] (STREAMPROP TextStream (QUOTE NoteCardObject) Card) TextStream]) (NC.UpdateLinkImagesInText (LAMBDA (SourceCardOrWindow DestinationCard) (* fgh: "17-Nov-85 15:24") (* * Update the notecard link image objects that point to DestinationID fromn text card SourceCardIDOrWindow) (* * rht 2/8/85: Makes sure not to dirty the card if it wasn't dirty before.) (* * fgh 11/17/85 Updated to handle card objects.) (LET (Window TextObject ListOfNoteCardLinks SourceCard WasDirtyFlg) (SETQ Window (COND ((WINDOWP SourceCardOrWindow) SourceCardOrWindow) (T (NC.FetchWindow SourceCardOrWindow)))) (SETQ TextObject (WINDOWPROP Window (QUOTE TEXTOBJ))) (SETQ ListOfNoteCardLinks (TEDIT.LIST.OF.OBJECTS TextObject (FUNCTION NC.LinkIconImageObjP))) (SETQ WasDirtyFlg (NC.CardDirtyP (SETQ SourceCard (NC.CoerceToCard Window)))) (for Link in ListOfNoteCardLinks when (NC.SameCardP (fetch (Link DestinationCard) of ( NC.FetchLinkFromLinkIcon (CAR Link))) DestinationCard) do (TEDIT.OBJECT.CHANGED TextObject (CAR Link))) (NC.MarkCardDirty SourceCard (NOT WasDirtyFlg))))) (NC.CharPosFromTextObject (LAMBDA (TextObject) (* rht: "27-Jun-85 15:38") (* * Return the position # of current selection in TextObject) (PROG (Selection) (RETURN (AND (fetch (SELECTION SET) of (SETQ Selection (fetch (TEXTOBJ SEL) of TextObject))) (TEDIT.GETPOINT TextObject Selection)))))) (NC.DelReferencesToCardFromText [LAMBDA (SourceCard LinkOrDestinationCard Don'tCreateDeletedImageObjFlg) (* rht: " 4-Nov-86 21:01") (* Delete all IMAGEOBJECTS in textstream specified by Substance that are Link Icons whose DESTINATIONID is eq to Destination ID) (* * rht 9/12/85: Fixed so restores old selection after putting in deleted link icon.) (* * kirk: 14Nov85: changed EQs to NC.Sames. Deleted use of LinkID.) (* * rht 4/30/86: Now only inserts NC.DeletedLinkImageObject if NC.UseDeletedLinkIconIndicators is non-nil.) (* * rht 11/4/86: Now takes Don'tCreateDeletedImageObjFlg arg.) (DECLARE (GLOBALVARS NC.NoDeleteImageFns NC.UseDeletedLinkIconIndicatorsFlg NC.DeletedLinkImageObject)) (LET ((LinkFlg (type? Link LinkOrDestinationCard)) DestinationCard Substance) (COND [LinkFlg (OR (NC.CardP SourceCard) (SETQ SourceCard (fetch (Link SourceCard) of LinkOrDestinationCard] (T (SETQ DestinationCard LinkOrDestinationCard))) (SETQ Substance (NC.FetchSubstance SourceCard)) (for Link in (TEDIT.LIST.OF.OBJECTS (TEXTOBJ Substance) (FUNCTION NC.LinkIconImageObjP)) bind OldSel when [COND [LinkFlg (NC.SameLinkP LinkOrDestinationCard (NC.FetchLinkFromLinkIcon (CAR Link] (T (NC.SameCardP DestinationCard (fetch (Link DestinationCard) of ( NC.FetchLinkFromLinkIcon (CAR Link] do (replace (IMAGEOBJ IMAGEOBJFNS) of (CAR Link) with NC.NoDeleteImageFns) (* WHENDELETEDFN taken care of earlier in delete cycle) (SETQ OldSel (TEDIT.GETSEL Substance)) (TEDIT.DELETE Substance (CADR Link) 1) (AND NC.UseDeletedLinkIconIndicatorsFlg (NOT Don'tCreateDeletedImageObjFlg) (TEDIT.INSERT.OBJECT NC.DeletedLinkImageObject Substance (CADR Link))) (TEDIT.SETSEL Substance OldSel]) ) (RPAQ TEDIT.DEFAULT.PROPS (CONS (QUOTE SLOWUPDATE) (CONS (QUOTE T) TEDIT.DEFAULT.PROPS))) (RPAQQ NC.TEditPasswordDividedBy100 314) (* * This stuff supports the "push-copy" method of copying links in NC) (DEFINEQ (NC.TranslateWindowPositionToTEditPosition (LAMBDA (Card Window WindowPositionX WindowPositionY) (* fgh: " 6-Feb-86 22:12") (* * fgh 2/6/86 Added Card argument.) (PROG (TextObj) (COND ((AND (WINDOWP Window) (type? TEXTOBJ (SETQ TextObj (WINDOWPROP Window (QUOTE TEXTOBJ))))) (RETURN (fetch (SELECTION CH#) of (TEDIT.SELECT WindowPositionX WindowPositionY TextObj (fetch (TEXTOBJ MOUSEREGION) of TextObj) NIL NIL Window)))))))) (NC.InsertLinkInTextWindow (LAMBDA (Card TextWindow LinkOrLinkLabel CharacterPosition) (* fgh: " 6-Feb-86 22:12") (* * Given a Window and a Link, insert the Link at CharacterPosition in the TextStream of Window) (* * fgh 2/6/86 Added Card argument) (PROG ((TextStream (WINDOWPROP TextWindow (QUOTE TEXTSTREAM)))) (RETURN (NC.InsertLinkInText TextStream LinkOrLinkLabel NIL NIL NIL CharacterPosition) )))) ) (* * New FNS) (DECLARE: DOEVAL@COMPILE DONTCOPY (GLOBALVARS NC.ExternalPutLinkIconImageFns) ) (DEFINEQ (NC.CardFromTextStream (LAMBDA (TextStream) (* fgh: "13-Nov-85 23:34") (* * Return the NoteCards ID for a TextStream) (* * fgh 11/13/85 Updated to handle Card object.) (STREAMPROP TextStream (QUOTE NoteCardObject)))) (NC.TEditPutFn (LAMBDA (TextStream FileName When?) (* fgh: " 7-May-86 12:55") (* * This function designed to be attached to the PUTFN Tedit property of NC textstreams.) (* * Before actions: Mark the card dirty for NoteCards, if TEdit thinks the card is dirty. Also, change the link icons to be ExternalPut Link Icons so that thety are no longer active in the file being put to. Necessary when a put is done outside the normal NoteCards mechanism.) (* * fgh 5/7/86 Added kludge to get around bug in TEDIT.PUT that causes FileName to be NIL most of the time. Submitted AR #5621 about TEDIT.PUT bug. Also added scheme to temporarily set the TEXPROP CACHE in order to prevent TEDIT.PUT from updating the file info in the piece table.) (SELECTQ When? (BEFORE (PROG ((TextObj (TEXTOBJ TextStream)) LinkIcons) (* * Kludge to get around bug in TEDIT.PUT described in AR #5621. Note the OFILE is called freely!!!) (SETQ FileName (COND (FileName (FULLNAME (PACKFILENAME (QUOTE VERSION) NIL (QUOTE BODY) FileName (QUOTE VERSION) NIL) (QUOTE NEW))) (T (FULLNAME OFILE (QUOTE NEW))))) (* * first Mark the card dirty NoteCards style, if necessary) (COND ((TEDIT.STREAMCHANGEDP TextStream) (NC.MarkCardDirty (NC.CardFromTextStream (TEXTSTREAM TextStream))))) (RESETLST (* * Remove this PUTFN from the TEXTOBJ temporarily) (RESETSAVE (TEXTPROP TextObj (QUOTE PUTFN) NIL) (BQUOTE (TEXTPROP , TextObj PUTFN , (TEXTPROP TextObj (QUOTE PUTFN))))) (* * Collect all the link icons in the TextStream) (SETQ LinkIcons (TEDIT.LIST.OF.OBJECTS TextObj (FUNCTION NC.LinkIconImageObjP))) (* * Temporarily set them to be ExternalPut link icons) (RESETSAVE (NC.TEditPutFnAuxiliary LinkIcons NC.ExternalPutLinkIconImageFns) (BQUOTE (NC.TEditPutFnAuxiliary , LinkIcons , NC.LinkIconImageFns))) (* * Fix up the title on the way out) (RESETSAVE NIL (BQUOTE (AND , (WINDOW.FROM.TEDIT.THING TextStream) (WINDOWPROP , ( WINDOW.FROM.TEDIT.THING TextStream) (QUOTE TITLE) , (NC.RetrieveTitle ( NC.CardFromTextStream TextStream)))))) (* * Temporarily set TEdit to think this is CAHCEd so that the piece table doesn't get messed up.) (RESETSAVE (TEXTPROP (TEXTOBJ TextStream) (QUOTE CACHE) T) (BQUOTE (TEXTPROP , (TEXTOBJ TextStream) CACHE , (TEXTPROP (TEXTOBJ TextStream) (QUOTE CACHE))))) (* * Put the file as usual. NOTE: FORCENEW UNFORMATTED? OLDFORMAT? used freely!!!!) (TEDIT.PUT TextStream FileName FORCENEW UNFORMATTED? OLDFORMAT?)) (RETURN (QUOTE DON'T)))) NIL))) (NC.TEditPutFnAuxiliary (LAMBDA (LinkIcons NewImageFns) (* fgh: "30-May-85 17:29") (* * For a list of link icons as returned by TEDIT.LIST.OF.OBJECTS, replace all the IMAGEFNS of the objects with NewImageFns) (for LinkIconPair in LinkIcons do (replace (IMAGEOBJ IMAGEOBJFNS) of (CAR LinkIconPair) with NewImageFns)))) (NC.TEditGetFn (LAMBDA (TextStream FileName When?) (* fgh: "19-May-86 13:09") (* * This function called from the GETFN for all NC TextStreams) (* * fgh 5/19/86 Added WINDOWP check to make sure that the window title isn't changed if there is no window.) (SELECTQ When? (BEFORE (LET ((LinkIcons (TEDIT.LIST.OF.OBJECTS (TEXTOBJ TextStream) (FUNCTION NC.LinkIconImageObjP)))) (* * Delete all the links currentluy in the text stream) (for LinkIconPair in LinkIcons do (TEDIT.DELETE TextStream (CADR LinkIconPair) 1)))) (AFTER (LET ((Card (NC.CardFromTextStream TextStream))) (* * Mark the card dirty ala NoteCards) (NC.MarkCardDirty Card) (* * Reset the NC title) (AND (WINDOWP (WINDOW.FROM.TEDIT.THING TextStream)) (WINDOWPROP (WINDOW.FROM.TEDIT.THING TextStream) (QUOTE TITLE) (NC.RetrieveTitle Card))))) NIL))) (NC.MakeTEditPropsList [LAMBDA (TEditWindow Don'tAttachUserSpecifiedPropsFlg NoteFile) (* rht: " 9-Mar-87 11:00") (* * Create the props list to hand to all TEdit and OPENTEXTSTREAM calls) (* * rht 9/10/85: Now takes a TEditWindow arg so can compute a prompt window.) (* * 5/1/86: Now appends NC-specific props in front of TEdit props specified as global param by user.) (* * rht 8/2/86: Added Don'tAttachUserSpecifiedPropsFlg to override attaching user-specified props. For use by fileboxes.) (* * rht&pmi 11/19/86: Added another set of props at the notefile level stashed on NoteFile user data. Also added NoteFile argument.) (* * rht 3/9/87: Now passes DON'T to PROMPTWINDOW to fix things for lyric.) (DECLARE (GLOBALVARS NC.UserSpecifiedTEditProps NC.DefaultFont)) (APPEND (LIST (QUOTE TITLEMENUFN) (FUNCTION NC.TEditMenuFn) (QUOTE PUTFN) (FUNCTION NC.TEditPutFn) (QUOTE GETFN) (FUNCTION NC.TEditGetFn) (QUOTE QUITFN) [LIST (FUNCTION NC.TEditPropsListQuitFn) (FUNCTION (LAMBDA NIL (QUOTE DON'T] (QUOTE PROMPTWINDOW) (QUOTE DON'T)) (LIST (QUOTE FONT) (OR (AND (type? NoteFile NoteFile) (NC.NoteFileProp NoteFile (QUOTE Font))) NC.DefaultFont)) (if Don'tAttachUserSpecifiedPropsFlg then NIL else (OR (AND (type? NoteFile NoteFile) (NC.NoteFileProp NoteFile (QUOTE ExtraTEditProps))) NC.UserSpecifiedTEditProps]) (NC.TEditPropsListQuitFn (LAMBDA (Window TextStream TextObj) (* fgh: " 4-Jun-86 20:15") (* * QuitFn to be part of the props list when calling TEDit.) (* * fgh 6/4/86 First created.) (NC.QuitCard Window T))) (NC.DelTEditProcesses (LAMBDA (Window) (* rht: "30-Apr-86 20:13") (* * Kill any TEdit processes running on Window and its attached windows. Notice recursive call to handle attached windows of attached windows.) (LET (Process) (if (PROCESSP (SETQ Process (WINDOWPROP Window (QUOTE PROCESS)))) then (DEL.PROCESS Process)) (for AttachedWin in (ATTACHEDWINDOWS Window) do (NC.DelTEditProcesses AttachedWin)) ))) ) (* * prevent TEdit splitwindow facilities) (PUTPROPS \TEDIT.SPLITW READVICE [NIL (BEFORE NIL (if (NC.CardP (WINDOWPROP WINDOW (QUOTE NoteCardObject))) then (NC.PrintMsg WINDOW T "Can't split a TEdit NoteCard. Sorry" (CHARACTER 13)) (RETURN NIL]) (READVISE \TEDIT.SPLITW) (* * Add the Text card type to the card types list.) (DEFINEQ (NC.AddTextCard [LAMBDA NIL (* rht: "17-Oct-86 20:49") (* * fgh 2/17/86 Added attached bit map field.) (* * rht 4/7/86: Now you get all TEdit menu items on middle button as well as Restart% Editor.) (NC.AddCardType (QUOTE Text) (QUOTE NoteCard) [BQUOTE ((MakeFn , (FUNCTION NC.MakeTEditCard)) (EditFn , (FUNCTION NC.BringUpTEditCard)) (QuitFn , (FUNCTION NC.TEditCloseFn)) (GetFn , (FUNCTION NC.GetTextSubstance)) (PutFn , (FUNCTION NC.PutTextSubstance)) (CopyFn , (FUNCTION NC.TextCopySubstance)) (MarkDirtyFn , (FUNCTION NC.MarkTextDirty)) (DirtyPFn , (FUNCTION NC.TextDirtyP)) (CollectLinksFn , (FUNCTION NC.CollectReferencesInText)) (DeleteLinksFn , (FUNCTION NC.DelReferencesToCardFromText)) (UpdateLinkIconsFn , (FUNCTION NC.UpdateLinkImagesInText)) (InsertLinkFn , (FUNCTION NC.InsertLinkInTextWindow)) (TranslateWindowPositionFn , (FUNCTION NC.TranslateWindowPositionToTEditPosition] (BQUOTE ((LinkDisplayMode Title) (DisplayedInMenuFlg T) (DefaultWidth 300) (DefaultHeight 200) (LinkAnchorModesSupported T) (LinkIconAttachedBitMap , NC.TextCardIcon) (MiddleButtonMenuItems , (NC.ComputeTextCardMiddleButtonMenuItems]) (NC.ComputeTextCardMiddleButtonMenuItems [LAMBDA NIL (* rht: "17-Oct-86 20:53") (* * Using TEDIT.DEFAULT.MENU, build the list of middle button menu items for Text cards.) (DECLARE (GLOBALVARS TEDIT.DEFAULT.MENU)) (APPEND (for Item in (fetch (MENU ITEMS) of TEDIT.DEFAULT.MENU) collect (if (EQ Item (QUOTE Quit)) then (QUOTE (Quit (FUNCTION NC.QuitCard) "Close this note card after saving it in the NoteFile.")) else Item)) (QUOTE ((Restart% Editor (FUNCTION NC.ResetTEdit) "Resets and restarts the editor for this Card/Box."]) ) (RPAQ NC.TextCardIcon (READBITMAP)) (21 18 "OOOOOH@@" "OOOOOH@@" "OOOOOH@@" "OOOOOH@@" "H@@@@H@@" "H@@@@H@@" "H@@@@H@@" "H@@@@H@@" "H@@@@H@@" "H@@@@H@@" "H@@@@H@@" "H@@@@H@@" "H@@@@H@@" "H@@@@H@@" "H@@@@H@@" "H@@@@H@@" "H@@@@H@@" "OOOOOH@@") (NC.AddTextCard) (DEFINEQ (NCAddStub.TextCard (LAMBDA NIL (* kirk: "19-Jun-86 20:52") (* * kirk 18Jun86 Add the text card stub) (NC.AddCardTypeStub (QUOTE Text) (QUOTE NoteCard) (QUOTE NCTEXTCARD) NIL (QUOTE ((DisplayedInMenuFlg . T)))))) ) (PUTPROPS TEDIT.ADD.MENUITEM READVICE [NIL (AFTER NIL (if (EQ MENU TEDIT.DEFAULT.MENU) then (NCP.ChangeCardTypeFields (QUOTE Text) NIL (BQUOTE ((MiddleButtonMenuItems , ( NC.ComputeTextCardMiddleButtonMenuItems]) (PUTPROPS TEDIT.REMOVE.MENUITEM READVICE [NIL (AFTER NIL (if (EQ MENU TEDIT.DEFAULT.MENU) then (NCP.ChangeCardTypeFields (QUOTE Text) NIL (BQUOTE ((MiddleButtonMenuItems , ( NC.ComputeTextCardMiddleButtonMenuItems]) (READVISE TEDIT.ADD.MENUITEM TEDIT.REMOVE.MENUITEM) (PUTPROPS NCTEXTCARD COPYRIGHT ("Xerox Corporation" 1985 1986 1987)) (DECLARE: DONTCOPY (FILEMAP (NIL (2435 28577 (NC.MakeTEditCard 2445 . 4922) (NC.BringUpTEditCard 4924 . 8033) ( NC.CollectReferencesInText 8035 . 10615) (NC.InstallTextTitleBarMiddleMenu 10617 . 11449) ( NC.MarkTextDirty 11451 . 11857) (NC.ResetTEdit 11859 . 12270) (NC.ResetTEditProcess 12272 . 13929) ( NC.TEditBasedP 13931 . 14602) (NC.TEditCloseFn 14604 . 15300) (NC.TEditMenuFn 15302 . 16369) ( NC.TEditQuitFn 16371 . 18002) (NC.TextCopySubstance 18004 . 18627) (NC.TextDirtyP 18629 . 18953) ( NC.TextCardShrinkFn 18955 . 21036) (NC.PutTextSubstance 21038 . 23056) (NC.GetTextSubstance 23058 . 24513) (NC.UpdateLinkImagesInText 24515 . 25826) (NC.CharPosFromTextObject 25828 . 26261) ( NC.DelReferencesToCardFromText 26263 . 28575)) (28808 29969 (NC.TranslateWindowPositionToTEditPosition 28818 . 29419) (NC.InsertLinkInTextWindow 29421 . 29967)) (30071 38081 (NC.CardFromTextStream 30081 . 30391) (NC.TEditPutFn 30393 . 33873) (NC.TEditPutFnAuxiliary 33875 . 34314) (NC.TEditGetFn 34316 . 35446) (NC.MakeTEditPropsList 35448 . 37228) (NC.TEditPropsListQuitFn 37230 . 37511) ( NC.DelTEditProcesses 37513 . 38079)) (38483 40649 (NC.AddTextCard 38493 . 39912) ( NC.ComputeTextCardMiddleButtonMenuItems 39914 . 40647)) (40910 41252 (NCAddStub.TextCard 40920 . 41250 ))))) STOP