(DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP")
(FILECREATED "26-Aug-88 17:29:03" {QV}<NOTECARDS>1.3LNEXT>PMIPATCH106.;2 8465   

      changes to%:  (FNS NC.InsertLabelInGraph)
                    (VARS PMIPATCH106COMS)

      previous date%: "26-Aug-88 17:26:50" {QV}<NOTECARDS>1.3LNEXT>PMIPATCH106.;1)


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

(PRETTYCOMPRINT PMIPATCH106COMS)

(RPAQQ PMIPATCH106COMS
       (

(* ;;; "New file")

        (DECLARE%: DONTCOPY (PROPS (PMIPATCH106 MAKEFILE-ENVIRONMENT)
                                   (PMIPATCH106 FILETYPE)))
        [DECLARE%: FIRST (P (NC.LoadFileFromDirectories 'NCGRAPHCARD]
        
        (* ;; "pmi 8/26/88: Fixes some GraphCard problems I introduced a while back when adding a position argument to NC.InsertLabelInGraph and NC.InsertLinkInGraph")

        
        (* ;; "Changed in NCGRAPHCARD")

        (FNS NC.InsertLabelInGraph NC.InsertLinkInGraph NC.GraphAddNode)))



(* ;;; "New file")

(DECLARE%: DONTCOPY 

(PUTPROPS PMIPATCH106 MAKEFILE-ENVIRONMENT (:PACKAGE "INTERLISP" :READTABLE "INTERLISP"))

(PUTPROPS PMIPATCH106 FILETYPE :BCOMPL)
)
(DECLARE%: FIRST 

(NC.LoadFileFromDirectories 'NCGRAPHCARD)
)



(* ;; 
"pmi 8/26/88: Fixes some GraphCard problems I introduced a while back when adding a position argument to NC.InsertLabelInGraph and NC.InsertLinkInGraph"
)




(* ;; "Changed in NCGRAPHCARD")

(DEFINEQ

(NC.InsertLabelInGraph
  [LAMBDA (GraphCard Label Position Font Border LabelShade)  (* ; "Edited  5-Apr-88 17:55 by pmi")

    (* ;; "Insert a Label in GraphWindow at Position")

    (* ;; "Called from NCP.LocalGlobalLink to add a graph label to an existing card at a specified position.  Just sets up the proper ADDNODEFN in graph record, attaches arguments to the graph window, and invokes the grapher editor.")

    (* ;; 
    "pmi 8/26/88: Restores the original GRAPH.ADDNODEFN to this Graph after inserting this label.")

    (LET* [(Window (NCP.CardWindow GraphCard))
           (Graph (WINDOWPROP Window 'GRAPH]
          (WINDOWPROP Window 'NewLabelData (LIST 'Label Label 'Position Position 'Font Font
                                                 'Border Border 'LabelShade LabelShade))
          (RESETLST
              [RESETSAVE NIL `(PROGN (replace (GRAPH GRAPH.ADDNODEFN) of Graph
                                        with (FUNCTION ,(fetch (GRAPH GRAPH.ADDNODEFN) of Graph]
              (replace (GRAPH GRAPH.ADDNODEFN) of Graph with (FUNCTION NC.GraphAddLabel))
              (EDITADDNODE Window Position))])

(NC.InsertLinkInGraph
  [LAMBDA (GraphCard LinkOrLinkLabel DestinationCard DisplayMode Position)
                                                             (* ; "Edited  8-Apr-88 14:47 by pmi")

    (* ;; "Insert a Link to DestinationCard in GraphCard at Position")

    (* ;; "pmi 4/8/88: Called from NCP.LocalGlobalLink to add a graph node to an existing card at a specified position.  Just sets up the proper ADDNODEFN in graph record, attaches arguments to the graph window, and invokes the grapher editor.")

    (* ;; 
    "pmi 8/26/88: Restores the original GRAPH.ADDNODEFN to this Graph after inserting this link.")

    (LET* [(Window (NCP.CardWindow GraphCard))
           (Graph (WINDOWPROP Window 'GRAPH]
          (WINDOWPROP Window 'NewNodeData (LIST 'SourceCard GraphCard 'LinkOrLinkLabel 
                                                LinkOrLinkLabel 'DestinationCard DestinationCard
                                                'DisplayMode DisplayMode 'Position Position))
          (RESETLST
              [RESETSAVE NIL `(PROGN (replace (GRAPH GRAPH.ADDNODEFN) of Graph
                                        with (FUNCTION ,(fetch (GRAPH GRAPH.ADDNODEFN) of Graph]
              (replace (GRAPH GRAPH.ADDNODEFN) of Graph with (FUNCTION NC.GraphAddNode))
              (EDITADDNODE Window Position))])

(NC.GraphAddNode
  [LAMBDA (Graph GraphWindow)                                (* ; "Edited 12-Apr-88 17:26 by pmi")

    (* ;; "pmi 4/12/88: Called from Grapher to create a new node for Graph.  This is the addnodefn used by NC.InsertLinkInGraph.")

    (* ;; "pmi 8/26/88: fixed typo where Window was used instead of GraphWindow.")

    (DECLARE (GLOBALVARS NC.MsgDelay))
    (NC.ProtectedCardOperation (NC.CoerceToCard GraphWindow)
           "Add Node" GraphWindow
           (NCP.WithLockedCards (PROG (NewNodeData SourceCard LinkOrLinkLabel DestinationCard 
                                             DisplayMode Position GraphNodeID Card Node)

                                 (* ;; "Get information to add a node from the graph's window.")

                                      (SETQ NewNodeData (WINDOWPROP GraphWindow 'NewNodeData))
                                      (SETQ SourceCard (LISTGET NewNodeData 'SourceCard))
                                      (SETQ LinkOrLinkLabel (LISTGET NewNodeData 'LinkOrLinkLabel))
                                      (SETQ DestinationCard (LISTGET NewNodeData 'DestinationCard))
                                      (SETQ DisplayMode (LISTGET NewNodeData 'DisplayMode))
                                      (SETQ Position (LISTGET NewNodeData 'Position))
                                      (if [SETQ Link (COND
                                                        ((type? Link LinkOrLinkLabel)
                                                         LinkOrLinkLabel)
                                                        (T (NC.MakeLink GraphWindow LinkOrLinkLabel 
                                                                  DestinationCard SourceCard 
                                                                  DisplayMode]
                                          then 
                                               (* ;; 
                                      "Check to see if the node has already been added to the graph.")
                                                             (* ; 
                                                             "Create hash array if haven't already.")
                                               (NC.GetBrowserHashArray SourceCard Graph)
                                               [SETQ GraphNodeID (NC.GetBrowserNodeID
                                                                  SourceCard
                                                                  (SETQ Card (fetch (Link 
                                                                                      DestinationCard
                                                                                          )
                                                                                of Link]
                                               (COND
                                                  ((for GraphNode in (fetch (GRAPH GRAPHNODES)
                                                                        of Graph)
                                                      thereis (EQ GraphNodeID (NC.CoerceToGraphNodeID
                                                                               GraphNode)))
                                                   (NC.PrintMsg GraphWindow T "Node for card '"
                                                          (NC.RetrieveTitle Card)
                                                          "' already in graph.")
                                                   (DISMISS NC.MsgDelay)
                                                   (NCP.DeleteLinks Link)
                                                   (RETURN NIL)))
                                               (NC.MarkCardDirty SourceCard)
                                               (SETQ Node
                                                (NODECREATE GraphNodeID (NC.MakeLinkIcon Link)
                                                       (create POSITION
                                                              XCOORD ← -500
                                                              YCOORD ← -500)))
                                               (RETURN Node])
)
(PUTPROPS PMIPATCH106 COPYRIGHT ("Xerox Corporation" 1988))
(DECLARE%: DONTCOPY
  (FILEMAP (NIL (1477 8382 (NC.InsertLabelInGraph 1487 . 2679) (NC.InsertLinkInGraph 2681 . 4070) (
NC.GraphAddNode 4072 . 8380)))))
STOP