(FILECREATED " 8-Oct-85 19:13:12" {QV}<NOTECARDS>RELEASE1.2I>LIBRARY>NCFILESUBSTANCE.;8 19521 changes to: (VARS NCFILESUBSTANCECOMS) (FNS NC.EditFileSubstance NC.MakeFileCardCore NC.FileCardShrinkFn) previous date: "27-Aug-85 17:57:38" {QV}<NOTECARDS>RELEASE1.2I>LIBRARY>NCFILESUBSTANCE.;7) (* Copyright (c) 1985 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT NCFILESUBSTANCECOMS) (RPAQQ NCFILESUBSTANCECOMS ((* * Globalvars from elsewhere) (GLOBALVARS NC.DefaultFont PSA.Database NC.DeletedLinkImageObject NC.NoDeleteImageFns NC.AnnoFlg TEDIT.DEFAULT.MENU) (* * Substance functions) (FNS NC.MakeFileCard NC.EditFileSubstance NC.FileCopySubstance NC.FileSubstanceDirtyP NC.GetFileSubstance NC.MarkFileSubstanceDirty NC.PutFileSubstance NC.QuitFileSubstance NC.FileCardPutFile) (* * Utilities) (FNS NC.FileCardFileVersionNumber NC.FileCardLeftButtonMenu NC.FileCardMiddleButtonMenu NC.FileCardTitle NC.FetchTextStream NC.GetFileFromUser NC.MakeFileCardCore NC.SetTextStream NC.FileCardShrinkFn) (* * Add file substance type to SubstanceTypes list) (FNS NC.AddFileSubstanceType) (P (NC.AddFileSubstanceType)))) (* * Globalvars from elsewhere) (DECLARE: DOEVAL@COMPILE DONTCOPY (GLOBALVARS NC.DefaultFont PSA.Database NC.DeletedLinkImageObject NC.NoDeleteImageFns NC.AnnoFlg TEDIT.DEFAULT.MENU) ) (* * Substance functions) (DEFINEQ (NC.MakeFileCard (LAMBDA (ID Title NoDisplayFlg) (* fgh: "27-Aug-85 17:53") (* * Make a new card of type File -- ERSETQ around Core procedure here!) (LET (ReturnValue) (COND ((AND (ERSETQ (SETQ ReturnValue (NC.MakeFileCardCore ID Title NoDisplayFlg))) (CAR ReturnValue))) (T (AND (OPENWP (NC.FetchWindow ID)) (CLOSEW (NC.FetchWindow ID))) NIL))))) (NC.EditFileSubstance (LAMBDA (ID FileDesignator Region/Position) (* fgh: " 8-Oct-85 19:05") (* * Bring up a TEdit window for Card ID whose substance is specified by file designator in Region specified by Region/Position or by the user.) (PROG (Region TEditWindow TEditProcess Title NewFileName) (COND ((AND (SETQ TEditWindow (NC.FetchWindow ID)) (SETQ TEditProcess (WINDOWPROP TEditWindow (QUOTE PROCESS)))) (TOTOPW TEditWindow) (RPTQ 2 (FLASHW TEditWindow)) (TTY.PROCESS TEditProcess) (RETURN TEditWindow))) (SETQ Region (NC.DetermineDisplayRegion ID Region/Position)) (SETQ Title (NC.FetchTitle ID)) (SETQ TEditWindow (CREATEW Region Title NIL NIL)) (WINDOWPROP TEditWindow (QUOTE NoteCardID) ID) (WINDOWPROP TEditWindow (QUOTE SHRINKFN) (FUNCTION NC.FileCardShrinkFn)) (WINDOWPROP TEditWindow (QUOTE NoteCardsLeftButtonMenu) (NC.FileCardLeftButtonMenu)) (WINDOWPROP TEditWindow (QUOTE NoteCardsMiddleButtonMenu) (NC.FileCardMiddleButtonMenu)) (COND ((NULL (INFILEP FileDesignator)) (NC.PrintMsg TEditWindow T FileDesignator " is no longer a file." (CHARACTER 13)) (COND ((NC.YesP (NC.AskUser "Do you want to create the file?" " -- " "Yes" NIL TEditWindow NIL NIL T)) (CLOSEF (PROG1 (SETQ FileDesignator (OPENSTREAM FileDesignator (QUOTE OUTPUT) (QUOTE NEW))) (BOUT FileDesignator 32)))) ((NC.YesP (NC.AskUser "Do you want to respecify the file name?" " -- " "Yes" NIL TEditWindow NIL NIL T)) (SETQ FileDesignator (NC.GetFileFromUser TEditWindow T)) (NC.SetSubstance ID FileDesignator) (NC.MarkCardDirty ID) (NC.SetTitle ID (NC.FileCardTitle ID)) (NC.SetTitleDirtyFlg ID T) (WINDOWPROP TEditWindow (QUOTE TITLE) (NC.SetTitle ID (NC.FileCardTitle ID))) (NC.PutProp ID (QUOTE FileName) FileDesignator PSA.Database) (NC.SetPropListDirtyFlg ID T)) (T (CLOSEW TEditWindow) (RETURN NIL))))) (TEDIT FileDesignator TEditWindow NIL (LIST (QUOTE FONT) NC.DefaultFont (QUOTE TITLEMENUFN) (FUNCTION NC.TEditMenuFn))) (NC.SetTextStream ID (WINDOWPROP TEditWindow (QUOTE TEXTSTREAM))) (NC.PutProp ID (QUOTE FileVersion) (NC.FileCardFileVersionNumber ID)) (RETURN TEditWindow)))) (NC.FileCopySubstance (LAMBDA (ID FromStream ToStream) (* fgh: "26-Aug-85 23:51") (* * Copy file substance from FromStream to ToStream) (PROG (EndPtr EndPtrLoc FromStartPtr FromEndPtr ToStartPtr) (* * Get the FromStream start/end ptrs) (SETQ FromStartPtr (NC.GetPtr FromStream)) (SETQ FromEndPtr (NC.GetPtr FromStream)) (* * Set up the ToStream start/end ptrs) (SETQ ToStartPtr (IPLUS 6 (GETFILEPTR ToStream))) (NC.PutPtr ToStream ToStartPtr) (SETQ EndPtrLoc (GETFILEPTR ToStream)) (NC.PutPtr ToStream 0) (* * Copy the bytes) (COPYBYTES FromStream ToStream FromStartPtr FromEndPtr) (* * Fix up the ToStream end ptr) (SETQ EndPtr (GETFILEPTR ToStream)) (SETFILEPTR ToStream EndPtrLoc) (NC.PutPtr ToStream EndPtr) (RETURN T)))) (NC.FileSubstanceDirtyP (LAMBDA (ID) (* fgh: "12-Feb-85 23:37") (* * Return T is TextSubstance has been changed.) (PROG (TextStream) (RETURN (AND (SETQ TextStream (NC.FetchTextStream ID)) (TEDIT.STREAMCHANGEDP TextStream)))))) (NC.GetFileSubstance (LAMBDA (DatabaseStream) (* fgh: "24-Jan-85 19:07") (* * Read the File designator from DatabaseStream) (* * Skip the start/end ptrs) (NC.GetPtr DatabaseStream 6) (* * Read the file name) (READ DatabaseStream))) (NC.MarkFileSubstanceDirty (LAMBDA (ID ResetFlg) (* fgh: "29-Jan-85 12:34") (* * Mark or unmark TextStream of File being changed.) (PROG (TextObj (Window (NC.FetchWindow ID))) (AND Window (SETQ TextObj (WINDOWPROP Window (QUOTE TEXTOBJ))) (replace (TEXTOBJ \DIRTY) of TextObj with (COND (ResetFlg NIL) (T T))))))) (NC.PutFileSubstance (LAMBDA (ID DatabaseStream) (* fgh: "12-Feb-85 23:34") (* * Put a file designator onto DatabaseStream) (PROG (StartPtr EndPtr EndPtrLoc) (* * Save the file for this file card) (NC.FileCardPutFile ID DatabaseStream) (* * Save the file card stuff in the NoteFile) (SETQ StartPtr (IPLUS (GETFILEPTR DatabaseStream) 6)) (NC.PutPtr DatabaseStream StartPtr) (SETQ EndPtrLoc (GETFILEPTR DatabaseStream)) (NC.PutPtr DatabaseStream 0) (PRINT (NC.FetchSubstance ID) DatabaseStream) (SETQ EndPtr (GETFILEPTR DatabaseStream)) (SETFILEPTR DatabaseStream EndPtrLoc) (NC.PutPtr DatabaseStream EndPtr)))) (NC.QuitFileSubstance (LAMBDA (WindowOrTextStreamOrID) (* fgh: "12-Feb-85 23:46") (PROG (Window PromptWindow TextStream TextStreamChanged (ID (NC.CoerceToID WindowOrTextStreamOrID) )) (SETQ TextStream (NC.FetchTextStream ID)) (SETQ Window (NC.FetchWindow ID)) (COND (Window (WINDOWDELPROP Window (QUOTE CLOSEFN) (FUNCTION NC.QuitCard)) (TEDIT.QUIT TextStream) (AND (SETQ PromptWindow (fetch (TEXTOBJ PROMPTWINDOW) of (TEXTOBJ TextStream))) (CLOSEW PromptWindow)))) (NC.SetTextStream ID NIL) (NC.DeactivateCard ID)))) (NC.FileCardPutFile (LAMBDA (WindowOrID DatabaseStream QuittingFlg) (* fgh: "12-Feb-85 23:36") (* * Do the work to save a file card. That is you must put the file if its changed as well as write thee notecard info to the NoteFile) (PROG (Window TextStream (ID (NC.CoerceToID WindowOrID))) (SETQ TextStream (NC.FetchTextStream ID)) (COND ((TEDIT.STREAMCHANGEDP TextStream) (TEDIT.PUT TextStream (NC.FetchSubstance ID)) (AND (SETQ Window (NC.FetchWindow ID)) (WINDOWPROP Window (QUOTE TITLE) (NC.FileCardTitle ID))))) (NC.PutProp ID (QUOTE FileVersion) (NC.FileCardFileVersionNumber ID))))) ) (* * Utilities) (DEFINEQ (NC.FileCardFileVersionNumber (LAMBDA (ID) (* fgh: "12-Feb-85 23:39") (* * Return the current version number of the file reffered to by the file card ID) (FILENAMEFIELD (FULLNAME (fetch (TEXTOBJ TXTFILE) of (TEXTOBJ (NC.FetchTextStream ID)))) (QUOTE VERSION)))) (NC.FileCardLeftButtonMenu (LAMBDA NIL (* fgh: " 9-Feb-85 20:26") (* * Create left button menu for a file card) (\TEDIT.CREATEMENU (QUOTE ((Show/Edit% Properties (FUNCTION NC.EditProperties) "Brings up an editor for the property list of this card." (SUBITEMS (Edit% Property% List (FUNCTION NC.EditProperties) "Brings up an editor for the property list of this card.") (Show% Links (FUNCTION NC.ShowPointers) "Brings up a list of the links to and from this card."))) (Title/Sources/FileBoxes (FUNCTION (LAMBDA (TextStream) (NC.AssignTitle TextStream) (NC.AssignSources TextStream) (NC.FileNoteCard TextStream))) "Do all of the operations necessary to file this note card in a file box." (SUBITEMS (Assign% Title (FUNCTION NC.AssignTitle) "Assigns a (new) title to this note card.") (Designate% Sources (FUNCTION NC.AssignSources) "Designate the source(s) of the information in this card.") (File% in% FileBoxes (FUNCTION NC.AddParents) "File this note card in one or more file boxes.") (Unfile% from% FileBoxes (FUNCTION NC.UnfileNoteCard) "Remove this card from one or more of its file boxes.") (Delete% Source (FUNCTION NC.DeleteSource) "Delete one of the sources of this card."))) (Close% and% Save (FUNCTION NC.QuitCard) "Close this note card after saving it in the NoteFile." (SUBITEMS (Close% and% Save (FUNCTION NC.QuitCard) "Close this note card after saving it in the NoteFile.") (Close% w/o% Saving (FUNCTION NC.QuitWithoutSaving) "Close this note card without saving any changes made since the last Save.") (Save% in% NoteFile (FUNCTION NC.CardSaveFn) "Save this card in the NoteFile but don't close the card.") (Delete% Card (FUNCTION NC.DeleteNoteCards) "Permenantly delete this card from the NoteFile."))))) ))) (NC.FileCardMiddleButtonMenu (LAMBDA NIL (* fgh: " 8-Feb-85 21:08") (* * Make the Middle Button Menu fort a File card.) (\TEDIT.CREATEMENU (DREMOVE NIL (BQUOTE ((Restart% Editor (FUNCTION NC.ResetTEdit) "Resets and restarts the editor for this Card/Box.") , (AND NC.AnnoFlg (for Item in (fetch (MENU ITEMS) of TEDIT.DEFAULT.MENU) when (EQ (CAR Item) (QUOTE Annotate)) do (RETURN Item))) (Advanced% Editing% Menu (FUNCTION \TEDIT.EXPANDED.MENU) "Brings up the menu for the advanced editing commands.") (Change% Font (FUNCTION NC.\TEDIT.LOOKS) "Changes the font of the selected text.") (Hardcopy (FUNCTION TEDIT.HARDCOPY) "Send a copy to the default printer."))))))) (NC.FileCardTitle (LAMBDA (ID) (* fgh: " 8-Feb-85 22:07") (* * Determine the title for file card ID) (PROG ((FileName (NC.FetchSubstance ID))) (RETURN (CONCAT (FILENAMEFIELD FileName (QUOTE NAME)) "." (OR (FILENAMEFIELD FileName (QUOTE EXTENSION)) "")))))) (NC.FetchTextStream (LAMBDA (ID) (* fgh: "12-Feb-85 23:36") (GETPROP ID (QUOTE NoteCardTextStream)))) (NC.GetFileFromUser (LAMBDA (Window DontClearPromptFlg FirstTry) (* fgh: "27-Aug-85 17:20") (* * Create a file designator) (PROG (FileName FullFileName) (SETQ FileName (NC.AskUser "Enter file name" ": " FirstTry (NULL DontClearPromptFlg) Window T NIL T)) (RETURN (PROG1 (COND ((SETQ FullFileName (INFILEP FileName)) (PACKFILENAME (QUOTE VERSION) NIL (QUOTE BODY) FullFileName)) ((NULL (SETQ FullFileName (FULLNAME FileName (QUOTE NEW)))) (NC.PrintMsg Window T FileName " is not a legal file name." (CHARACTER 13) "Please try again." (CHARACTER 13)) (NC.GetFileFromUser Window T)) ((NC.YesP (NC.AskUser (CONCAT "Do you want me to create " FullFileName) " ? " "Yes" T Window NIL NIL T)) (PACKFILENAME (QUOTE VERSION) NIL (QUOTE BODY) (CLOSEF (PROG1 (SETQ FileName (OPENSTREAM FileName (QUOTE OUTPUT) (QUOTE NEW))) (BOUT FileName 32))))) ((NC.YesP (NC.AskUser "Do you want to specify another file name?" " -- " "No" T Window NIL NIL T)) (NC.GetFileFromUser Window DontClearPromptFlg FirstTry)) (T NIL)) (AND Window (REMOVEPROMPTWINDOW Window))))))) (NC.MakeFileCardCore (LAMBDA (ID Title NoDisplayFlg) (* fgh: " 8-Oct-85 19:05") (* * Make a new card of type File -- Core procedure) (PROG (FileName TextStream) (RETURN (COND ((NULL NoDisplayFlg) (PROG (Window) (SETQ Window (CREATEW (NC.DetermineDisplayRegion ID NIL) (OR Title "Creating File card ..."))) (WINDOWPROP Window (QUOTE NoteCardID) ID) (WINDOWPROP Window (QUOTE NoteCardsLeftButtonMenu) (NC.FileCardLeftButtonMenu)) (WINDOWPROP Window (QUOTE NoteCardsMiddleButtonMenu) (NC.FileCardMiddleButtonMenu)) (WINDOWPROP Window (QUOTE SHRINKFN) (FUNCTION NC.FileCardShrinkFn)) (TEDIT NIL Window NIL (LIST (QUOTE FONT) NC.DefaultFont (QUOTE TITLEMENUFN) (FUNCTION NC.TEditMenuFn))) (until (SETQ TextStream (NC.SetTextStream ID (WINDOWPROP Window (QUOTE TEXTSTREAM)))) do (BLOCK)) (COND ((SETQ FileName (NC.GetFileFromUser Window)) (TEDIT.INCLUDE (TEXTOBJ TextStream) FileName) (NC.SetSubstance ID FileName) (NC.SetTitle ID (NC.FileCardTitle ID)) (WINDOWPROP Window (QUOTE TITLE) (NC.SetTitle ID (NC.FileCardTitle ID))) (NC.PutProp ID (QUOTE FileName) FileName PSA.Database) (NC.PutProp ID (QUOTE FileVersion) (NC.FileCardFileVersionNumber ID)) (GIVE.TTY.PROCESS Window) (RETURN Window)) (T (TEDIT.QUIT TextStream) (NC.SetTextStream ID NIL) (WINDOWPROP Window (QUOTE NoteCardID) NIL) (RETURN NIL))))) (T (SETQ FileName (NC.GetFileFromUser)) (NC.SetSubstance ID FileName) (NC.SetTitle ID (NC.FileCardTitle ID)) ID)))))) (NC.SetTextStream (LAMBDA (ID TextStream) (* fgh: "12-Feb-85 23:45") (COND (TextStream (PUTPROP ID (QUOTE NoteCardTextStream) TextStream)) (T (REMPROP ID (QUOTE NoteCardTextStream)))))) (NC.FileCardShrinkFn (LAMBDA (W) (* fgh: " 8-Oct-85 19:08") (* * 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.) (PROG ((OldIconTitle (WINDOWPROP W (QUOTE NoteCardsIconTitle))) (Icon (WINDOWPROP W (QUOTE ICON))) (ID (NC.CoerceToID W)) IconTitle) (COND ((NULL Icon) (APPLY* (WINDOWPROP W (QUOTE ICONFN)) W) (SETQ Icon (WINDOWPROP W (QUOTE ICON))))) (COND ((NOT (EQUAL OldIconTitle (SETQ IconTitle (CONCAT "File Card" (CHARACTER 13) "NC: " (NC.FetchTitle ID))))) (ICONTITLE IconTitle NIL NIL Icon) (WINDOWPROP W (QUOTE NoteCardsIconTitle) IconTitle)))))) ) (* * Add file substance type to SubstanceTypes list) (DEFINEQ (NC.AddFileSubstanceType (LAMBDA NIL (* fgh: "19-Jun-85 11:34") (* * Add the file substance type to the substance types list) (NC.AddSubstanceType (QUOTE FILE) (BQUOTE ((CreateSubstanceFn , (FUNCTION NC.MakeFileCard)) (EditSubstanceFn , (FUNCTION NC.EditFileSubstance)) (QuitSubstanceFn , (FUNCTION NC.QuitFileSubstance)) (GetSubstanceFn , (FUNCTION NC.GetFileSubstance)) (PutSubstanceFn , (FUNCTION NC.PutFileSubstance)) (CopySubstanceFn , (FUNCTION NC.FileCopySubstance)) (MarkSubstanceDirtyFn , (FUNCTION NC.MarkFileSubstanceDirty)) (SubstanceDirtyPFn , (FUNCTION NC.FileSubstanceDirtyP)))) (BQUOTE ((SubstanceDefaultWidth 350) (SubstanceDefaultHeight 500) (SubstanceLinkAnchorModesSupported , (QUOTE Global))))))) ) (NC.AddFileSubstanceType) (PUTPROPS NCFILESUBSTANCE COPYRIGHT ("Xerox Corporation" 1985)) (DECLARE: DONTCOPY (FILEMAP (NIL (1480 9272 (NC.MakeFileCard 1490 . 1960) (NC.EditFileSubstance 1962 . 4747) ( NC.FileCopySubstance 4749 . 5761) (NC.FileSubstanceDirtyP 5763 . 6109) (NC.GetFileSubstance 6111 . 6449) (NC.MarkFileSubstanceDirty 6451 . 6914) (NC.PutFileSubstance 6916 . 7766) (NC.QuitFileSubstance 7768 . 8490) (NC.FileCardPutFile 8492 . 9270)) (9295 18428 (NC.FileCardFileVersionNumber 9305 . 9680) (NC.FileCardLeftButtonMenu 9682 . 12154) (NC.FileCardMiddleButtonMenu 12156 . 13134) (NC.FileCardTitle 13136 . 13534) (NC.FetchTextStream 13536 . 13705) (NC.GetFileFromUser 13707 . 15183) ( NC.MakeFileCardCore 15185 . 17225) (NC.SetTextStream 17227 . 17499) (NC.FileCardShrinkFn 17501 . 18426 )) (18488 19409 (NC.AddFileSubstanceType 18498 . 19407))))) STOP