(FILECREATED "17-Mar-87 15:44:34" {QV}<NOTECARDS>1.3K>NEXT>RHTPATCH208.;3 9654   

      changes to:  (VARS RHTPATCH208COMS)

      previous date: " 2-Mar-87 21:10:48" {QV}<NOTECARDS>1.3K>NEXT>RHTPATCH208.;2)


(* Copyright (c) 1987 by Xerox Corporation. All rights reserved.)

(PRETTYCOMPRINT RHTPATCH208COMS)

(RPAQQ RHTPATCH208COMS ((* * Fixes bugs #443, #451: Changes sketch cards so they store sketches as 
			     imageobjects on the notefile. Also fixes bug #419: Sketch doing needless 
			     SaveChanges after Put.)
			  (P (LOAD? (QUOTE {QV}<NOTECARDS>1.3K>NEXT>NCSKETCHCARD.DCOM)))
			  (* * Changes to NCSKETCHCARD)
			  (FNS NC.AddSketchCard NC.GetSketchSubstance NC.PutSketchSubstance 
			       NC.BringUpSketchCard NC.SketchDirtyP)
			  (* * Following only for the patch file. Not for integration.)
			  (P (NC.AddSketchCard))))
(* * Fixes bugs #443, #451: Changes sketch cards so they store sketches as imageobjects on the
 notefile. Also fixes bug #419: Sketch doing needless SaveChanges after Put.)

(LOAD? (QUOTE {QV}<NOTECARDS>1.3K>NEXT>NCSKETCHCARD.DCOM))
(* * Changes to NCSKETCHCARD)

(DEFINEQ

(NC.AddSketchCard
  (LAMBDA NIL                                                (* rht: "28-Feb-87 21:28")

          (* * fgh 11/14/85: Updated to conform to merging of cardTypes and SubstanceTypes.)



          (* * Added LinkIconAttachedBitMap field.)



          (* * rht 2/28/87: Ripped out old LAMBDA wrapper around GetFn.)


    (DECLARE (GLOBALVARS NC.SketchCardIcon))
    (NC.AddCardType (QUOTE Sketch)
		      (QUOTE NoteCard)
		      (BQUOTE ((MakeFn , (FUNCTION NC.MakeSketchCard))
				 (EditFn , (FUNCTION NC.BringUpSketchCard))
				 (QuitFn , (FUNCTION NC.SketchCardCloseFn))
				 (GetFn , (FUNCTION NC.GetSketchSubstance))
				 (PutFn , (FUNCTION NC.PutSketchSubstance))
				 (CopyFn , (FUNCTION NC.SketchCopySubstance))
				 (MarkDirtyFn , (FUNCTION NC.MarkSketchDirty))
				 (DirtyPFn , (FUNCTION NC.SketchDirtyP))
				 (CollectLinksFn , (FUNCTION NC.CollectReferencesInSketch))
				 (DeleteLinksFn , (FUNCTION NC.DelReferencesToCardFromSketch))
				 (UpdateLinkIconsFn , (FUNCTION NC.UpdateLinkImagesInSketch))
				 (InsertLinkFn , (FUNCTION NC.InsertLinkInSketch))
				 (TranslateWindowPositionFn , (FUNCTION 
						       NC.TranslateWindowPositionToSketchPosition))
				 (MiddleButtonMenuItems , (SKETCH.COMMANDMENU.ITEMS NIL T))))
		      (BQUOTE ((DefaultWidth 400)
				 (DefaultHeight 350)
				 (LinkAnchorModesSupported T)
				 (LinkDisplayMode Title)
				 (DisplayedInMenuFlg T)
				 (LinkIconAttachedBitMap , NC.SketchCardIcon))))))

(NC.GetSketchSubstance
  (LAMBDA (Card Length Stream SubstanceVersion)              (* rht: "28-Feb-87 21:40")

          (* Get sketch substance from Database stream. Database stream is positioned. READ the global sketch description, 
	  the locasl sketch scale and region viewed. Also read in any cached bit maps for the MAPS system.)



          (* * fgh 11/14/85 Updated to handle Card and NoteFile objects.)



          (* * fgh 11/20/85 NoteCards now passes start and enptrs down.)



          (* * 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 11/1/86: Now uses our readtable when reading.)



          (* * rht 2/28/87: Now uses new style of storing sketch on file whereby we package as imageobj.)


    (DECLARE (GLOBALVARS NC.OrigReadTable))

          (* * Get the substance)


    (SELECTQ SubstanceVersion
	       ((0 -1)

          (* * Old style wrote down Scale and RegionViewed separately.)


		 (LET ((Sketch (HREAD Stream)))
		      (NC.SetScale Card (READ Stream NC.OrigReadTable))
		      (NC.SetRegionViewed Card (READ Stream NC.OrigReadTable))
		      (while (EQ (READ Stream NC.OrigReadTable)
				     (QUOTE ###CACHEDMAP###))
			 do (NC.GetCachedMap Stream))
		  Sketch))
	       (1 

          (* * New style expects sketch to be packaged as imageobj.)


		  (LET ((Sketch (HREAD Stream)))
		       (while (EQ (READ Stream NC.OrigReadTable)
				      (QUOTE ###CACHEDMAP###))
			  do (NC.GetCachedMap Stream))
		   Sketch))
	       NIL)))

(NC.PutSketchSubstance
  (LAMBDA (Card Stream)                                      (* rht: " 2-Mar-87 20:42")

          (* Put the sketch substance for card ID to the database. Store the global sketch descriptor, the scale and region 
	  viewed for ID and any cached bit maps.)



          (* * fgh 11/14/85 Updated to handle Card object.)



          (* * fgh 11/20/85 NoteCards now takes care of setting the start and end pointers for the substance.)



          (* * rht 1/23/86: Now takes Stream as arg instead of computing from Card.)



          (* * fgh 2/6/86 Now returns version number.)



          (* * fgh&rht 8/25/86 Changed call to NC.PutCachedMap to remove use of SCREENELT record.)



          (* * rht&pmi 10/15/86: Changed outdated SK.REGION.VIEWED call to SKETCH.REGION.VIEWED.)



          (* * rht 11/1/86: Now uses our readtable when printing.)



          (* * rht 2/28/87: Writes out sketches by first packaging as imageobject. This changes the format on the file, since
	  we no longer need to write down region and scale separately.)


    (DECLARE (GLOBALVARS NC.OrigReadTable))
    (LET ((Substance (NC.FetchSubstance Card))
	  (Window (NC.FetchWindow Card)))
         (HPRINT (if (OPENWP Window)
		       then (MAKE.IMAGE.OBJECT.OF.SKETCH Window)
		     else Substance)
		   Stream NIL T)
         (AND Window (for Element in (SKETCH.LIST.OF.ELEMENTS (INSURE.SKETCH Substance)
								      (FUNCTION (LAMBDA (Element)
									  (EQ (
									     GETSKETCHELEMENTPROP
										  Element
										  (QUOTE TYPE))
										(QUOTE MAP))))
								      T)
			  do (NC.PutCachedMap Element Window Stream)))
         (PRINT (QUOTE ###ENDSKETCH###)
		  Stream NC.OrigReadTable)
     1)))

(NC.BringUpSketchCard
  (LAMBDA (Card Substance RegionOrPosition)                  (* rht: " 2-Mar-87 20:44")
                                                             (* 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.)



          (* * fgh 11/14/85 Updated to handle Card object.)



          (* * rht 5/5/86: Replaced call to NC.SetupTitleBarMenu with calls to NC.InstallTitleBarButtonEventFn and 
	  NC.InstallTitleBarLeftMenu and NC.InstallSketchTitleBarMiddleMenu.)



          (* * fgh 6/30/86 Added NC.SK.COPY.BUTTONEVENTFN to sketch window. Made Substance to be INSURE.SKETCH of the sketch 
	  window.)



          (* * rht 11/16/86: Now moves window to RegionOrPosition if already up.)



          (* * rht 3/2/87: No longer passes RegionViewed and Scale to SKETCHW.CREATE. SKETCHW.CREATE will extract them from 
	  the imageobj.)


    (LET ((SketchName (AND (NULL Substance)
			     (MKATOM (fetch (Card UID) of Card))))
	  Region Title SketchViewer CardType)
         (COND
	   ((SETQ SketchViewer (NC.FetchWindow Card))
	     (TOTOPW SketchViewer)
	     (if RegionOrPosition
		 then (SHAPEW SketchViewer (NC.DetermineDisplayRegion Card RegionOrPosition)))
	     (RPTQ 2 (FLASHW SketchViewer))
	     (TTY.PROCESS (WINDOWPROP SketchViewer (QUOTE PROCESS))))
	   (T (SETQ CardType (NC.RetrieveType Card))
	      (SETQ SketchViewer (SKETCHW.CREATE (OR Substance SketchName)
						     NIL
						     (NC.DetermineDisplayRegion Card 
										 RegionOrPosition)
						     (NC.RetrieveTitle Card)
						     NIL
						     (SKETCH.COMMANDMENU (NC.GetCardTypeField
									     MiddleButtonMenuItems 
									     CardType))))
	      (WINDOWPROP SketchViewer (QUOTE DONTQUERYCHANGES)
			    T)
	      (WINDOWPROP SketchViewer (QUOTE COPYBUTTONEVENTFN)
			    (FUNCTION NC.SK.COPY.BUTTONEVENTFN))
	      (WINDOWPROP SketchViewer (QUOTE SHRINKFN)
			    (FUNCTION NC.SketchCardShrinkFn))
	      (NC.InstallTitleBarButtonEventFn SketchViewer (FUNCTION 
						   NC.SketchTitleBarButtonEventFn))
	      (NC.InstallTitleBarLeftMenu SketchViewer CardType)
	      (OR Substance (NC.SetSubstance Card (INSURE.SKETCH SketchViewer)))))
     SketchViewer)))

(NC.SketchDirtyP
  (LAMBDA (Card)                                             (* rht: " 2-Mar-87 21:10")

          (* * 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.)



          (* * fgh 11/14/85 Updated to handle Card object.)



          (* * rht 3/2/87: Took out calls to NC.FetchSavedRegion and NC.FetchScale. Also fixed bug #419: sketch doing 
	  needless save after Put.)


    (EQ (WINDOWPROP (NC.FetchWindow Card)
			(QUOTE SKETCHCHANGED))
	  T)))
)
(* * Following only for the patch file. Not for integration.)

(NC.AddSketchCard)
(PUTPROPS RHTPATCH208 COPYRIGHT ("Xerox Corporation" 1987))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (1130 9485 (NC.AddSketchCard 1140 . 2704) (NC.GetSketchSubstance 2706 . 4437) (
NC.PutSketchSubstance 4439 . 6317) (NC.BringUpSketchCard 6319 . 8885) (NC.SketchDirtyP 8887 . 9483))))
)
STOP