(FILECREATED "10-Oct-85 20:05:51" {QV}<NOTECARDS>RELEASE1.2I>NCSKETCHSUBSTANCE.;7 11290 changes to: (FNS NC.BringUpSketchCard) previous date: "26-Aug-85 11:47:59" {QV}<NOTECARDS>RELEASE1.2I>NCSKETCHSUBSTANCE.;6) (* Copyright (c) 1985 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT NCSKETCHSUBSTANCECOMS) (RPAQQ NCSKETCHSUBSTANCECOMS ((E (SETQ NC.SystemDate (DATE)) (PUTPROP (QUOTE NC.SystemDate) (QUOTE NewestFile) (ROOTFILENAME (FULLNAME (OUTPUT))))) (* * Stuff for the SKETCH Notecards substance.) (FILES NCTYPESMECH) (GLOBALVARS NC.SketchTitleBarMenu NC.DeletedLinkImageObject) (FNS NC.BringUpSketchCard NC.SketchDirtyP NC.SketchCardCloseFn NC.SketchCardShrinkFn NC.SketchCopySubstance NC.MarkSketchDirty NC.CollectReferencesInSketch NC.SketchBasedP) (ADVISE CREATE.SKETCHW.COMMANDMENU) (* * This stuff supports the "push-copy" method of copying links in NC) (FNS NC.TranslateWindowPositionToSketchPosition) (* * Add sketch substance type to SubstanceTypes list) (FNS NC.AddSketchSubstance) (P (NC.AddSketchSubstance)))) (* * Stuff for the SKETCH Notecards substance.) (FILESLOAD NCTYPESMECH) (DECLARE: DOEVAL@COMPILE DONTCOPY (GLOBALVARS NC.SketchTitleBarMenu NC.DeletedLinkImageObject) ) (DEFINEQ (NC.BringUpSketchCard (LAMBDA (ID Substance Region/Position) (* rht: "10-Oct-85 19:04") (* Bring up a sketch card containing substance in specified region) (* * rht 2/1/85: Added windowprop to prevent sketch asking about saving changes.) (* * rht 10/10/85: Now sets substance if was nil.) (LET (Region Title SketchViewer) (if (SETQ SketchViewer (NC.FetchWindow ID)) then (RPTQ 2 (FLASHW SketchViewer)) (TOTOPW SketchViewer) (TTY.PROCESS (WINDOWPROP SketchViewer (QUOTE PROCESS))) else (SETQ SketchViewer (SKETCHW.CREATE (OR Substance ID) (NC.FetchRegionViewed ID) (NC.DetermineDisplayRegion ID Region/Position) (NC.FetchTitle ID) (NC.FetchScale ID))) (WINDOWPROP SketchViewer (QUOTE DONTQUERYCHANGES) T) (WINDOWPROP SketchViewer (QUOTE SHRINKFN) (FUNCTION NC.SketchCardShrinkFn)) (NC.SetupTitleBarMenu SketchViewer ID (QUOTE Sketch)) (OR Substance (NC.SetSubstance ID (GETPROP ID (QUOTE SKETCH))))) SketchViewer))) (NC.SketchDirtyP (LAMBDA (ID) (* rht: " 1-Feb-85 15:47") (* * rht 2/1/85: No longer checks FILEPKGCHANGES. Now uses window prop. Note that we really should have a flag on the sketch object itself.) (OR (WINDOWPROP (NC.FetchWindow ID) (QUOTE SKETCHCHANGED)) (NULL (NC.FetchScale ID)) (NULL (NC.FetchRegionViewed ID))))) (NC.SketchCardCloseFn (LAMBDA (WindowOrID) (* rht: "22-May-85 15:40") (* Quit from a sketch card, saving information on the database) (* * rht 12/20/84: Added ugly kludge, setting SKETCHCHANGED to nil, to keep sketch from asking whether to save changes or not.) (* * rht 2/1/85: Removed above mentioned ugly kludge. It's now taken care of by a windowprop. Now closes all sketch viewers for this sketch.) (PROG (ID Window OldRegion NewRegion) (SETQ ID (NC.CoerceToID WindowOrID)) (SETQ Window (NC.FetchWindow ID)) (COND (Window (for Viewer in (ALL.SKETCH.VIEWERS (NC.FetchSubstance ID)) do (SKETCHW.CLOSEFN Viewer)) (SKED.CLEAR.SELECTION Window) (for AttachedWindow in (ATTACHEDWINDOWS Window) do (DETACHWINDOW AttachedWindow) (CLOSEW AttachedWindow)))) (COND (Window (REMOVEPROMPTWINDOW Window) (WINDOWPROP Window (QUOTE SKETCHOPMENU) NIL))) (TTY.PROCESS T) (NC.DeactivateCard ID)))) (NC.SketchCardShrinkFn (LAMBDA (W) (* rht: "31-May-85 15:03") (* * Check to make sure that icon's title agrees with card title. If not, retitle the icon. If this is first shrink then create a new icon and fill in title.) (PROG ((OldIconTitle (WINDOWPROP W (QUOTE SKETCH.ICON.TITLE))) (Icon (WINDOWPROP W (QUOTE ICON))) (ID (NC.CoerceToID W)) IconTitle) (if (NOT Icon) then (SK.SHRINK.ICONCREATE W) (SETQ Icon (WINDOWPROP W (QUOTE ICON)))) (if (NOT (EQUAL OldIconTitle (SETQ IconTitle (CONCAT "NC: " (NC.FetchTitle ID))))) then (WINDOWPROP W (QUOTE SKETCH.ICON.TITLE) IconTitle) (ICONTITLE IconTitle NIL NIL Icon))))) (NC.SketchCopySubstance (LAMBDA (ID FromStream ToStream) (* fgh: "23-Oct-84 11:43") (* * Copy a sketch substance from FromStream to ToStream.) (PROG (FromStartPtr FromEndPtr ToEndPtrLoc ToEndPtr ToStartPtr) (* * Set up start/end pointers on ToStream) (SETQ ToStartPtr (IPLUS (GETFILEPTR ToStream) 6)) (NC.PutPtr ToStream ToStartPtr) (SETQ ToEndPtrLoc (GETFILEPTR ToStream)) (NC.PutPtr ToStream 0) (* * Get FromStream start/end pointers) (SETQ FromStartPtr (NC.GetPtr FromStream 3)) (SETQ FromEndPtr (NC.GetPtr FromStream 3)) (* * Copy the bytes) (COPYBYTES FromStream ToStream FromStartPtr FromEndPtr) (* * Set up the ned ptr on the ToStream) (SETQ ToEndPtr (GETFILEPTR ToStream)) (SETFILEPTR ToStream ToEndPtrLoc) (NC.PutPtr ToStream ToEndPtr) (RETURN T)))) (NC.MarkSketchDirty (LAMBDA (ID ResetFlg) (* rht: " 1-Feb-85 15:37") (* * Mark or unmark sketch as having been changed.) (* * rht 2/1/85: Now goes through window prop rather than FILEPKG.) (WINDOWPROP (NC.FetchWindow ID) (QUOTE SKETCHCHANGED) ResetFlg))) (NC.CollectReferencesInSketch (LAMBDA (ID CheckAndDeleteFlg DatabaseStream ReturnLinkIconsFlg ReturnLocationsFlg) (* rht: "20-Aug-85 22:53") (* * Return a list of all links in sketch substance Substance. If CheckAndDeleteFlg, then delete any links found that are not valid links.) (* * rht 8/20/85: Rewritten to use Richard's sketch programmer's interface. Eliminates references to sketch records.) (LET ((SketchSubstance (NC.FetchSubstance ID)) DirtyFlg) (CONS (for SketchElt in (SKETCH.LIST.OF.ELEMENTS SketchSubstance (FUNCTION NC.LinkIconSketchElementP)) bind LinkIcon CollectItem ActualLink when (PROGN (SETQ ActualLink (NC.FetchLinkFromLinkIcon (SETQ LinkIcon ( SKETCH.IMAGEOBJ.OF.ELEMENT SketchElt)))) (COND ((NULL CheckAndDeleteFlg) (* No checking required) T) ((AND (LISTP CheckAndDeleteFlg) (FMEMB (fetch (NOTECARDLINK DESTINATIONID) of ActualLink) CheckAndDeleteFlg)) (* Already checked since ID cached on CheckAndDeleteFlg list) T) ((NC.ValidLinkP ActualLink DatabaseStream) (* Link is valid) T) (T (* Link is bad. Replace it with the DeletedLink image object.) (NC.DeleteLinkIconSketchElement SketchElt ID) (SETQ DirtyFlg T) NIL))) collect (SETQ CollectItem (COND (ReturnLinkIconsFlg LinkIcon) (T ActualLink))) (if ReturnLocationsFlg then (CONS CollectItem (SKETCH.POSITION.OF.ELEMENT SketchElt)) else CollectItem)) DirtyFlg)))) (NC.SketchBasedP (LAMBDA (NoteCardType) (* fgh: "20-Aug-84 01:57") (* * Returns T if NoteCardType is a note card type that is based on Sketch or else an ID of such a note card. NIL otherise.) (PROG ((SketchType (QUOTE (SKETCH)))) (RETURN (OR (FMEMB NoteCardType SketchType) (AND (NC.IDP NoteCardType) (FMEMB (NC.FetchType NoteCardType) SketchType))))))) ) (PUTPROPS CREATE.SKETCHW.COMMANDMENU READVICE (NIL (AFTER NIL (NC.RemoveSketchMenuItems !VALUE)))) (READVISE CREATE.SKETCHW.COMMANDMENU) (* * This stuff supports the "push-copy" method of copying links in NC) (DEFINEQ (NC.TranslateWindowPositionToSketchPosition (LAMBDA (Window WindowPositionX WindowPositionY) (* fgh: "15-Feb-85 22:01") (create POSITION XCOORD ← WindowPositionX YCOORD ← WindowPositionY))) ) (* * Add sketch substance type to SubstanceTypes list) (DEFINEQ (NC.AddSketchSubstance (LAMBDA NIL (* fgh: "19-Jun-85 16:31") (NC.AddSubstanceType (QUOTE SKETCH) (BQUOTE ((CreateSubstanceFn , (FUNCTION NC.MakeSketchCard)) (EditSubstanceFn , (FUNCTION NC.BringUpSketchCard)) (QuitSubstanceFn , (FUNCTION NC.SketchCardCloseFn)) (GetSubstanceFn , (FUNCTION (LAMBDA (Stream ID Region) (PROG ((Value (NC.GetSketchSubstance Stream))) (NC.SetScale ID (CADR Value)) (NC.SetRegionViewed ID (CADDR Value)) (RETURN (CAR Value)))))) (PutSubstanceFn , (FUNCTION NC.PutSketchSubstance)) (CopySubstanceFn , (FUNCTION NC.SketchCopySubstance)) (MarkSubstanceDirtyFn , (FUNCTION NC.MarkSketchDirty)) (SubstanceDirtyPFn , (FUNCTION NC.SketchDirtyP)) (CollectLinksInSubstanceFn , (FUNCTION NC.CollectReferencesInSketch) ) (DeleteLinksInSubstanceFn , (FUNCTION NC.DelReferencesToCardFromSketch)) (UpdateLinkIconsInSubstanceFn , (FUNCTION NC.UpdateLinkImagesInSketch)) (InsertLinkInSubstanceFn , (FUNCTION NC.InsertLinkInSketch)) (TranslateWindowPositionToSubstancePositionFn , (FUNCTION NC.TranslateWindowPositionToSketchPosition)))) (QUOTE ((SubstanceDefaultWidth 400) (SubstanceDefaultHeight 350) (SubstanceLinkAnchorModesSupported T)))))) ) (NC.AddSketchSubstance) (PUTPROPS NCSKETCHSUBSTANCE COPYRIGHT ("Xerox Corporation" 1985)) (DECLARE: DONTCOPY (FILEMAP (NIL (1369 9137 (NC.BringUpSketchCard 1379 . 2647) (NC.SketchDirtyP 2649 . 3092) ( NC.SketchCardCloseFn 3094 . 4380) (NC.SketchCardShrinkFn 4382 . 5242) (NC.SketchCopySubstance 5244 . 6295) (NC.MarkSketchDirty 6297 . 6652) (NC.CollectReferencesInSketch 6654 . 8640) (NC.SketchBasedP 8642 . 9135)) (9358 9597 (NC.TranslateWindowPositionToSketchPosition 9368 . 9595)) (9659 11178 ( NC.AddSketchSubstance 9669 . 11176))))) STOP