(DEFINE-FILE-INFO PACKAGE "IL" READTABLE "INTERLISP" BASE 10)
(FILECREATED "10-May-88 11:06:15" {PEACH}<MACDONALD>COEDS>DWMPATCH003.;20 19834  

      changes to%:  (FNS NC.AddSketchCard NC.MakeSketchCardReadWrite NC.SketchKillCharInput 
                         NC.MakeSketchCardReadOnly)
                    (VARS DWMPATCH003COMS)

      previous date%: " 9-May-88 16:33:53" {PEACH}<MACDONALD>COEDS>DWMPATCH003.;18)


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

(PRETTYCOMPRINT DWMPATCH003COMS)

(RPAQQ DWMPATCH003COMS (
          
          (* ;; "dwm 03/02/88 changes for read only sketch cards ")

                        (P (NC.LoadFileFromDirectories 'NCSKETCHCARD))
                        
          
          (* ;; "changes to NCSKETCHCARD")

                        (FNS NC.AddSketchCard)
                        
          
          (* ;; "new for NCSKETCHCARD")

                        (FNS NC.MakeSketchCardReadOnly NC.MakeSketchCardReadWrite 
                             NC.SaveOrRevertSketchCard NC.ReadOnlySKETCH.COMMANDMENU 
                             NC.SketchKillCharInput)
                        
          
          (* ;; "new for something, it is actually a Sketch workaround. ")

                        (ADVISE \SKED.INSERT)
                        (PROP ADVICE \SKED.INSERT)
                        
          
          (* ;; "changes for NCINTERFACE")

                        (FNS NC.CopyMenu)
                        [P (NC.RecomputeCardType 'Sketch
                                  `((MakeReadOnlyFn ,(FUNCTION NC.MakeSketchCardReadOnly))
                                    (MakeReadWriteFn ,(FUNCTION NC.MakeSketchCardReadWrite]
                        (PROP (FILETYPE MAKEFILE-ENVIRONMENT)
                              DWMPATCH003)))



(* ;; "dwm 03/02/88 changes for read only sketch cards ")

(NC.LoadFileFromDirectories 'NCSKETCHCARD)



(* ;; "changes to NCSKETCHCARD")

(DEFINEQ

(NC.AddSketchCard
  [LAMBDA NIL                                            (* ; "Edited 10-May-88 10:40 by MacDonald")

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

(* ;;; "dwm 5/10/88; Added MakeReadOnlyFn and MakeReadWriteFn")

    (DECLARE (GLOBALVARS NC.SketchCardIcon))
    (NC.AddCardType 'Sketch 'NoteCard `[(MakeFn ,(FUNCTION NC.MakeSketchCard))
                                        (EditFn ,(FUNCTION NC.BringUpSketchCard))
                                        (MakeReadOnlyFn ,(FUNCTION NC.MakeSketchCardReadOnly))
                                        (MakeReadWriteFn ,(FUNCTION NC.MakeSketchCardReadWrite))
                                        (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]
           `((DefaultWidth 400)
             (DefaultHeight 350)
             (LinkAnchorModesSupported T)
             (LinkDisplayMode Title)
             (DisplayedInMenuFlg T)
             (LinkIconAttachedBitMap ,NC.SketchCardIcon])
)



(* ;; "new for NCSKETCHCARD")

(DEFINEQ

(NC.MakeSketchCardReadOnly
  [LAMBDA (Card New-Safe-Items New-Safe-Sub-Items)       (* ; "Edited 10-May-88 10:08 by MacDonald")

(* ;;; "Make a SketchCard Read-Only")

    (DECLARE (GLOBALVARS NC.ShowPropListMenu NC.SafeMiddleButtonItems NC.SafeLeftButtonItems 
                    NC.SafeMiddleButtonSubItems NC.SafeLeftButtonSubItems))
    (LET ((Window (NC.FetchWindow Card))
          [Safe-Menu-Items (APPEND New-Safe-Items NC.SafeMiddleButtonItems NC.SafeLeftButtonItems
                                  '(Grid Move% View HardCopy Put]
          [Safe-Menu-Sub-Items (APPEND New-Safe-Sub-Items NC.SafeMiddleButtonSubItems 
                                      NC.SafeLeftButtonSubItems
                                      '(|Turn grid ON| |Turn grid OFF| LARGER% Grid smaller% Grid 
                                              Display% grid |Remove grid display| Move% View AutoZoom 
                                              Home |Fit to window| Coord% window]
          PropListEditor)
         (NC.ProtectedCardOperation Card "Make Read-Only" Window (if (NC.CardSomehowDirtyP Card)
                                                                     then (NC.SaveOrRevertSketchCard
                                                                           Card Window))
                (NC.SetUserDataProp Card 'ReadOnly T)
                (if (WINDOWP (SETQ PropListEditor (NC.PropListEditorOpenP Window)))
                    then (NC.MakeTEditReadOnly PropListEditor)
                         (WINDOWPROP PropListEditor 'TEDIT.MENU NC.ShowPropListMenu))
                (NC.MakeMenusReadOnly Window Safe-Menu-Items Safe-Menu-Sub-Items)
                (REMOVEWINDOW (WINDOWPROP Window 'SKETCHFIXEDMENU))
                (if (for W in (ATTACHEDWINDOWS Window) thereis (WINDOWPROP W 'NoteFileIndicator))
                    then (NC.AttachNoteFileName Window T)
                         (NC.AttachNoteFileName Window))
                (WINDOWPROP Window 'SKETCHPOPUPMENU (SKETCH.COMMANDMENU (
                                                                        NC.ReadOnlySKETCH.COMMANDMENU
                                                                         )))
                (WINDOWPROP Window 'SKETCHPOPUPMENUCACHE (MENUWINDOW (NC.ReadOnlySKETCH.COMMANDMENU)
                                                                T))
                (PUTSKETCHPROP Window 'PRECHANGEFN (FUNCTION NC.Don'tDoIt))
                (PUTSKETCHPROP Window 'PREEDITFN (FUNCTION NC.Don'tDoIt))
                (PUTSKETCHPROP Window 'PREMOVEFN (FUNCTION NC.Don'tDoIt))
                (PUTSKETCHPROP Window 'PRECOPYFN (FUNCTION NC.Don'tDoIt))
                (PUTSKETCHPROP Window 'WHENADDEDFN (FUNCTION NC.Don'tDoIt))
                (PUTSKETCHPROP Window 'WHENCHANGEDFN (FUNCTION NC.Don'tDoIt))
                (PUTSKETCHPROP Window 'WHENDELETEDFN (FUNCTION NC.Don'tDoIt))
                (PUTSKETCHPROP Window 'WHENMOVEDFN (FUNCTION NC.Don'tDoIt))
                (PUTSKETCHPROP Window 'WHENGROUPEDFN (FUNCTION NC.Don'tDoIt))
                (PUTSKETCHPROP Window 'WHENUNGROUPEDFN (FUNCTION NC.Don'tDoIt))
                (for ELEMENT in (SKETCH.ELEMENTS.OF.SKETCH Window)
                   do ((PUTSKETCHELEMENTPROP ELEMENT 'RWPROTECTION (GETSKETCHELEMENTPROP ELEMENT
                                                                          'PROTECTION))
                       (PUTSKETCHELEMENTPROP ELEMENT 'PROTECTION T])

(NC.MakeSketchCardReadWrite
  [LAMBDA (Card)                                         (* ; "Edited 10-May-88 10:46 by MacDonald")

(* ;;; "Make a SketchCard Read-Write")

    (DECLARE (GLOBALVARS NC.EditPropListMenu))
    (LET ((Window (NC.FetchWindow Card))
          PropListEditor FixedMenu NFIndicator)
         (NC.ProtectedCardOperation Card "Make Read-Write" Window (if (WINDOWP (SETQ PropListEditor
                                                                                (
                                                                               NC.PropListEditorOpenP
                                                                                 Window)))
                                                                      then (NC.MakeTEditReadWrite
                                                                            PropListEditor)
                                                                           (WINDOWPROP PropListEditor
                                                                                  'TEDIT.MENU 
                                                                                  NC.EditPropListMenu
                                                                                  ))
                (NC.MakeMenusReadWrite Window)
                (if [SETQ NFIndicator (for W in (ATTACHEDWINDOWS Window)
                                         thereis (WINDOWPROP W 'NoteFileIndicator]
                    then (NC.AttachNoteFileName Window T))
                (WINDOWPROP Window 'SKETCHPOPUPMENU (SKETCH.COMMANDMENU (SKETCH.COMMANDMENU.ITEMS
                                                                         NIL T Window)))
                (WINDOWPROP Window 'SKETCHPOPUPMENUCACHE (MENUWINDOW (WINDOWPROP Window '
                                                                            SKETCHPOPUPMENU)
                                                                T))
                (WINDOWPROP Window 'SKETCHFIXEDMENU (ATTACHMENU (SKETCH.COMMANDMENU (
                                                                             SKETCH.COMMANDMENU.ITEMS
                                                                                     NIL T))
                                                           Window
                                                           'RIGHT
                                                           'TOP))
                (if NFIndicator
                    then (NC.AttachNoteFileName Window))
                (PUTSKETCHPROP Window 'PRECHANGEFN NIL)
                (PUTSKETCHPROP Window 'PRECOPYFN NIL)
                (PUTSKETCHPROP Window 'PREEDITFN NIL)
                (PUTSKETCHPROP Window 'PREMOVEFN NIL)
                (PUTSKETCHPROP Window 'WHENADDEDFN NIL)
                (PUTSKETCHPROP Window 'WHENCHANGEDFN NIL)
                (PUTSKETCHPROP Window 'WHENDELETEDFN NIL)
                (PUTSKETCHPROP Window 'WHENMOVEDFN NIL)
                (PUTSKETCHPROP Window 'WHENGROUPEDFN NIL)
                (PUTSKETCHPROP Window 'WHENUNGROUPEDFN NIL)
                [for ELEMENT in (SKETCH.ELEMENTS.OF.SKETCH Window)
                   do (PUTSKETCHELEMENTPROP ELEMENT 'PROTECTION (GETSKETCHELEMENTPROP ELEMENT
                                                                       'RWPROTECTION]
                (NC.SetUserDataProp Card 'ReadOnly NIL])

(NC.SaveOrRevertSketchCard
  [LAMBDA (Card Window)                             (* ; "Edited  2-Mar-88 10:58 by Dale.MacDonald")

    (ALLOW.BUTTON.EVENTS)
    (if (MENU (create MENU
                     TITLE ← "Card has been edited"
                     ITEMS ← '(("Save Changes" T "Save edited version of card in NoteFile")
                               ("Revert" NIL "Discard edits, refetch card contents from NoteFile"))
                     CENTERFLG ← T))
        then (NC.CardSaveFn Card NIL Window)
      else (NC.GetNoteCard Card)
           (SKETCHW.CREATE (NC.FetchSubstance Card)
                  Window
                  (NC.DetermineDisplayRegion Card RegionOrPosition)
                  (NC.RetrieveTitle Card)
                  NIL
                  (NC.GetCardTypeField MiddleButtonMenuItems CardType))
           (NC.MarkCardDirty Card T])

(NC.ReadOnlySKETCH.COMMANDMENU
  [LAMBDA NIL                                            (* ; "Edited  8-Mar-88 13:08 by MacDonald")
          
          (* ;; "creates a read-only suitable sketch command menu")

    (SKETCH.COMMANDMENU '((Grid SK.SET.GRID "Flips between using the grid and not using the grid."
                                (SUBITEMS (|Turn grid ON| SK.TURN.GRID.ON 
                                            "turns on a grid.  Only pts on the grid can be selected."
                                                 )
                                       (|Turn grid OFF| SK.TURN.GRID.OFF 
                                              "turns off the grid.  Any point can be selected.")
                                       (LARGER% Grid SK.MAKE.GRID.LARGER 
                                              "doubles the distance between the grid points.")
                                       (smaller% Grid SK.MAKE.GRID.SMALLER 
                                              "halves the distance between the grid points.")
                                       ("Display grid" SK.DISPLAY.GRID 
                          "XORs a point at each grid point.  If grid is visible, this will erase it."
                                              )
                                       ("Remove grid display" SK.TAKE.DOWN.GRID 
                          "XORs a point at each grid point.  If grid is visible, this will erase it."
                                              )))
                          ("Move view" SKETCH.ZOOM 
                                 "makes a new region the part of the sketch visible."
                                 (SUBITEMS ("Move view" SKETCH.ZOOM 
                                                  "changes the scale of the display.")
                                        (AutoZoom SKETCH.AUTOZOOM 
                                               "changes the scale around a selected point.")
                                        (Home SKETCH.HOME 
                                              "returns to the origin at the original scale")
                                        ("Fit to window" SK.FRAME.IT 
                                            "moves so that the entire sketch just fits in the window"
                                               (SUBITEMS ("Fit to window" SK.FRAME.IT 
                                            "moves so that the entire sketch just fits in the window"
                                                                )
                                                      ("Fit window to sketch" 
                                                             SK.FRAME.WINDOW.TO.SKETCH 
                                            "reshapes the window so that the entire sketch just fits"
                                                             )))
                                        ("Coord window" ADD.GLOBAL.DISPLAY 
                                      "creates a window that shows the cursor in global coordinates."
                                               (SUBITEMS ("Coord window" ADD.GLOBAL.DISPLAY 
                             "creates a window that shows the cursor position in global coordinates."
                                                                )
                                                      ("Grid coord window" ADD.GLOBAL.GRIDDED.DISPLAY 
            "creates a window that shows the grid position nearest the cursor in global coordinates."
                                                             )))
                                        (New% window SKETCH.NEW.VIEW 
                                               "opens another viewer onto this sketch")))
                          (HardCopy SK.HARDCOPYIMAGEW 
                                "sends a copy of the current window contents on the default printer."
                                 (SUBITEMS ("To a file" SK.HARDCOPYIMAGEW.TOFILE 
                                              "Puts image on a file; prompts for filename and format"
                                                  )
                                        ("To a printer" SK.HARDCOPYIMAGEW.TOPRINTER 
                                               "Sends image to a printer of your choosing")
                                        ("Whole sketch" SK.LIST.IMAGE 
                           "Sends the image of the whole sketch at the current scale to the printer."
                                               (SUBITEMS ("To a file" SK.LIST.IMAGE.ON.FILE 
                                "Sends the image of the whole sketch at the current scale on a file."
                                                                )
                                                      ("To a printer" SK.LIST.IMAGE 
                           "Sends the image of the whole sketch at the current scale to the printer."
                                                             )))
                                        (Hardcopy% Display SK.SET.HARDCOPY.MODE 
                         "Makes the display correspond to the hardcopy image on the default printer."
                                               )
                                        (Normal% Display SK.UNSET.HARDCOPY.MODE 
                                               "Changes the display to use display fonts.")))
                          (Put SK.PUT.ON.FILE "saves this sketch on a file"])

(NC.SketchKillCharInput
  [LAMBDA (CHARCODES SKW ATSCALE)                        (* ; "Edited 10-May-88 10:52 by MacDonald")

(* ;;; "Used as advise to \SKED.INSERT.  \SKED.INSERT doesn't do this check at the appropriate time and then will try to illegally enter text into the sketch. ")

    (NOT (SK.CHECK.PREEDITFN SKW])
)



(* ;; "new for something, it is actually a Sketch workaround. ")

[XCL:REINSTALL-ADVICE '\SKED.INSERT :AROUND '((:FIRST (OR (NC.SketchKillCharInput CHARCODES SKW 
                                                                 ATSCALE)
                                                          *]
(READVISE \SKED.INSERT)

(PUTPROPS \SKED.INSERT ADVICE NIL)



(* ;; "changes for NCINTERFACE")

(DEFINEQ

(NC.CopyMenu
  [LAMBDA (Menu)                                         (* ; "Edited  7-Apr-88 15:28 by MacDonald")
          
          (* ;; "dwm 4/5/88: added condition for NIL menu.")

    (COND
       (Menu (create MENU
                    ITEMS ← (COPY (fetch (MENU ITEMS) of Menu))
                    CHANGEOFFSETFLG ← (fetch (MENU CHANGEOFFSETFLG) of Menu)
                    MENUOFFSET ← (fetch (MENU MENUOFFSET) of Menu)
                    CENTERFLG ← (fetch (MENU CENTERFLG) of Menu)
                    TITLE ← (fetch (MENU TITLE) of Menu)
                    MENUTITLEFONT ← (fetch (MENU MENUTITLEFONT) of Menu)
                    MENUFONT ← (fetch (MENU MENUFONT) of Menu)
                    ITEMHEIGHT ← (fetch (MENU ITEMHEIGHT) of Menu)
                    WHENSELECTEDFN ← (fetch (MENU WHENSELECTEDFN) of Menu)))
       (T (create MENU])
)
[NC.RecomputeCardType 'Sketch `((MakeReadOnlyFn ,(FUNCTION NC.MakeSketchCardReadOnly))
                                (MakeReadWriteFn ,(FUNCTION NC.MakeSketchCardReadWrite]

(PUTPROPS DWMPATCH003 FILETYPE :TCOMPL)

(PUTPROPS DWMPATCH003 MAKEFILE-ENVIRONMENT (:PACKAGE "IL" :READTABLE "INTERLISP" :BASE 10))
(PUTPROPS DWMPATCH003 COPYRIGHT ("Xerox Corporation" 1988))
(DECLARE%: DONTCOPY
  (FILEMAP (NIL (1989 4288 (NC.AddSketchCard 1999 . 4286)) (4327 18058 (NC.MakeSketchCardReadOnly 4337
 . 7868) (NC.MakeSketchCardReadWrite 7870 . 11328) (NC.SaveOrRevertSketchCard 11330 . 12217) (
NC.ReadOnlySKETCH.COMMANDMENU 12219 . 17715) (NC.SketchKillCharInput 17717 . 18056)) (18469 19434 (
NC.CopyMenu 18479 . 19432)))))
STOP