(FILECREATED "15-Jul-87 12:13:34" {QV}<NOTECARDS>1.3KNEXT>PMIPATCH050.;2 14999  

      previous date: "14-Jul-87 14:35:23" {QV}<NOTECARDS>1.3KNEXT>PMIPATCH050.;1)


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

(PRETTYCOMPRINT PMIPATCH050COMS)

(RPAQQ PMIPATCH050COMS ((* * pmi 7/10/87: Fixes bug #194: Interface to session icon should have NCP 
			     fn to allow adding menu items. Provides functions to add menu items, 
			     remove menu items, and restore the menus to their original state. Also 
			     provides these functions for the NoteCards Icon menu.)
			  (* * New for NCINTERFACE after the ADDVARS for NC.CardOpsItems, 
			     NC.NoteFileOpsItems, and NC.OtherOpsItems.)
			  (GLOBALVARS NC.InitialCardOpsItems NC.InitialNoteFileOpsItems 
				      NC.InitialOtherOpsItems)
			  (VARS (NC.InitialCardOpsItems NC.CardOpsItems)
				(NC.InitialNoteFileOpsItems NC.NoteFileOpsItems)
				(NC.InitialOtherOpsItems NC.OtherOpsItems))
			  (* * New for NCINTERFACE after the ADDVARS for 
			     NC.NoteFileIconOperationsMenuItems, NC.NoteFileIconOpenOperations, and 
			     NC.NoteFileIconCloseOperations.)
			  (GLOBALVARS NC.InitialNoteFileIconOperationsMenuItems 
				      NC.InitialNoteFileIconOpenOperations 
				      NC.InitialNoteFileIconCloseOperations)
			  (VARS (NC.InitialNoteFileIconOperationsMenuItems 
							       NC.NoteFileIconOperationsMenuItems)
				(NC.InitialNoteFileIconOpenOperations NC.NoteFileIconOpenOperations)
				(NC.InitialNoteFileIconCloseOperations NC.NoteFileIconCloseOperations)
				)
			  (* * New for NCPROGINT)
			  (FNS NCP.AddSessionIconMenuItem NCP.RemoveSessionIconMenuItem 
			       NCP.RestoreSessionIconMenu NCP.AddNoteFileIconMenuItem 
			       NCP.RemoveNoteFileIconMenuItem NCP.RestoreNoteFileIconMenu 
			       NC.CreateSessionIconNoteFileMenuItem)))
(* * pmi 7/10/87: Fixes bug #194: Interface to session icon should have NCP fn to allow adding
 menu items. Provides functions to add menu items, remove menu items, and restore the menus to 
their original state. Also provides these functions for the NoteCards Icon menu.)

(* * New for NCINTERFACE after the ADDVARS for NC.CardOpsItems, NC.NoteFileOpsItems, and 
NC.OtherOpsItems.)

(DECLARE: DOEVAL@COMPILE DONTCOPY

(GLOBALVARS NC.InitialCardOpsItems NC.InitialNoteFileOpsItems NC.InitialOtherOpsItems)
)

(RPAQ NC.InitialCardOpsItems NC.CardOpsItems)

(RPAQ NC.InitialNoteFileOpsItems NC.NoteFileOpsItems)

(RPAQ NC.InitialOtherOpsItems NC.OtherOpsItems)
(* * New for NCINTERFACE after the ADDVARS for NC.NoteFileIconOperationsMenuItems, 
NC.NoteFileIconOpenOperations, and NC.NoteFileIconCloseOperations.)

(DECLARE: DOEVAL@COMPILE DONTCOPY

(GLOBALVARS NC.InitialNoteFileIconOperationsMenuItems NC.InitialNoteFileIconOpenOperations 
	    NC.InitialNoteFileIconCloseOperations)
)

(RPAQ NC.InitialNoteFileIconOperationsMenuItems NC.NoteFileIconOperationsMenuItems)

(RPAQ NC.InitialNoteFileIconOpenOperations NC.NoteFileIconOpenOperations)

(RPAQ NC.InitialNoteFileIconCloseOperations NC.NoteFileIconCloseOperations)
(* * New for NCPROGINT)

(DEFINEQ

(NCP.AddSessionIconMenuItem
  (LAMBDA (MenuName Item)                                    (* pmi: "13-Jul-87 17:51")

          (* * pmi 7/13/87: New function which allows users to add items to the Session Icon menus. MenuName should be either
	  Card, NoteFile, or Other. Item should be a full menu item.)


    (DECLARE (GLOBALVARS NC.CardOpsItems NC.CardOpsMenu NC.NoteFileOpsItems NC.NoteFileOpsMenu 
			     NC.OtherOpsItems NC.OtherOpsMenu))

          (* * Make sure we have a full menu item.)



          (* * Make sure MenuName in non-NIL)


    (if (NOT (LISTP Item))
	then (NC.ReportError (QUOTE NCP.AddSessionIconMenuItem)
				 "You must provide a FULL menu item.")
	       NIL
      elseif (NULL MenuName)
	then NIL
      else (SELECTQ MenuName
			(Card (if (NOT (MEMBER Item NC.CardOpsItems))
				  then (SETQ NC.CardOpsItems (APPEND NC.CardOpsItems
									   (LIST Item)))
					 (SETQ NC.CardOpsMenu NIL)))
			(NoteFile 

          (* * Since the NoteFile menu is different from the other two, we have to play games to set it up correctly.)


				  (if (for MenuItem in NC.NoteFileOpsItems
					   do (if (EQ (CAR Item)
							    (CAR MenuItem))
						    then (RETURN NIL))
					   finally (RETURN T))
				      then                 (* This item has not already been added to this menu, 
							     so add it.)
					     (SETQ NC.NoteFileOpsItems (APPEND
						 NC.NoteFileOpsItems
						 (LIST (NC.CreateSessionIconNoteFileMenuItem
							   Item))))
					     (SETQ NC.NoteFileOpsMenu NIL)))
			(Other (if (NOT (MEMBER Item NC.OtherOpsItems))
				   then (SETQ NC.OtherOpsItems (APPEND NC.OtherOpsItems
									     (LIST Item)))
					  (SETQ NC.OtherOpsMenu NIL)))
			NIL)
	     Item)))

(NCP.RemoveSessionIconMenuItem
  (LAMBDA (MenuName ItemName)                                (* pmi: "13-Jul-87 18:11")

          (* * pmi 7/13/87: New function which allows users to remove an item from the Session Icon menus.
	  MenuName should be either Card, NoteFile, or Other. ItemName should be just the name of the item 
	  (the first part of a full menu item.))


    (DECLARE (GLOBALVARS NC.CardOpsItems NC.CardOpsMenu NC.NoteFileOpsItems NC.NoteFileOpsMenu 
			     NC.OtherOpsItems NC.OtherOpsMenu))

          (* * Make sure we have only the name of a menu item.)



          (* * Make sure MenuName in non-NIL)


    (if (LISTP ItemName)
	then (NC.ReportError (QUOTE NCP.RemoveSessionIconMenuItem)
				 "You must provide only the name of the menu item as an atom.")
	       NIL
      elseif (NULL MenuName)
	then NIL
      else 

          (* * Select the appropriate menu.)


	     (SELECTQ MenuName
			(Card (for MenuItem in NC.CardOpsItems when (AND (LISTP MenuItem)
										 (EQ (CAR 
											 MenuItem)
										       ItemName))
				 do (SETQ NC.CardOpsItems (REMOVE MenuItem NC.CardOpsItems))
				      (SETQ NC.CardOpsMenu NIL)
				      (RETURN MenuItem)))
			(NoteFile (for MenuItem in NC.NoteFileOpsItems
				     when (AND (LISTP MenuItem)
						   (EQ (CAR MenuItem)
							 ItemName))
				     do (SETQ NC.NoteFileOpsItems (REMOVE MenuItem 
									      NC.NoteFileOpsItems))
					  (SETQ NC.NoteFileOpsMenu NIL)
					  (RETURN MenuItem)))
			(Other (for MenuItem in NC.OtherOpsItems
				  when (AND (LISTP MenuItem)
						(EQ (CAR MenuItem)
						      ItemName))
				  do (SETQ NC.OtherOpsItems (REMOVE MenuItem NC.OtherOpsItems))
				       (SETQ NC.OtherOpsMenu NIL)
				       (RETURN MenuItem)))
			NIL))))

(NCP.RestoreSessionIconMenu
  (LAMBDA (MenuName)                                         (* pmi: "13-Jul-87 18:12")

          (* * pmi 7/13/87: New function which allows users to restore the original menus of the Session Icon.
	  MenuName should be either Card, NoteFile, Other or NIL. NIL Signifies to restore all three of the Session Icon 
	  menus.)


    (DECLARE (GLOBALVARS NC.InitialCardOpsItems NC.CardOpsItems NC.CardOpsMenu 
			     NC.InitialNoteFileOpsItems NC.NoteFileOpsItems NC.NoteFileOpsMenu 
			     NC.InitialOtherOpsItems NC.OtherOpsItems NC.OtherOpsMenu))
    (SELECTQ MenuName
	       (Card (SETQ NC.CardOpsItems NC.InitialCardOpsItems)
		     (SETQ NC.CardOpsMenu NIL))
	       (NoteFile (SETQ NC.NoteFileOpsItems NC.InitialNoteFileOpsItems)
			 (SETQ NC.NoteFileOpsMenu NIL))
	       (Other (SETQ NC.OtherOpsItems NC.InitialOtherOpsItems)
		      (SETQ NC.OtherOpsMenu NIL))
	       (NIL (SETQ NC.CardOpsItems NC.InitialCardOpsItems)
		    (SETQ NC.CardOpsMenu NIL)
		    (SETQ NC.NoteFileOpsItems NC.InitialNoteFileOpsItems)
		    (SETQ NC.NoteFileOpsMenu NIL)
		    (SETQ NC.OtherOpsItems NC.InitialOtherOpsItems)
		    (SETQ NC.OtherOpsMenu NIL))
	       NIL)))

(NCP.AddNoteFileIconMenuItem
  (LAMBDA (Item OpenOrClosedOrBoth)                          (* pmi: "14-Jul-87 11:22")

          (* * pmi 7/14/87: New function which allows users to add items to the NoteFile Icon menu. Item should be a full 
	  3-part menu item. OpenOrClosedOrBoth should be one of the atoms: Open, Closed , or Both, to indicate whether the 
	  new item applies to open or closed notefiles.)


    (DECLARE (GLOBALVARS NC.NoteFileIconOperationsMenuItems NC.NoteFileIconOpenOperations 
			     NC.NoteFileIconCloseOperations))
    (PROG (ItemName)

          (* * Make sure OpenOrClosedOrBoth in non-NIL)


	    (if (NULL OpenOrClosedOrBoth)
		then (RETURN NIL))

          (* * Make sure we have a full menu item.)


	    (if (NOT (LISTP Item))
		then (NC.ReportError (QUOTE NCP.AddNoteFileIconMenuItem)
					 "You must provide a FULL menu item.")
		       (RETURN NIL))
	    (SETQ ItemName (CAR Item))

          (* * If this item is not already known, add it to the list.)


	    (if (NOT (MEMBER Item NC.NoteFileIconOperationsMenuItems))
		then (SETQ NC.NoteFileIconOperationsMenuItems (APPEND 
							       NC.NoteFileIconOperationsMenuItems
									    (LIST Item))))

          (* * Add the item as either for open notefiles, closed notefiles, or both.)


	    (SELECTQ OpenOrClosedOrBoth
		       (Open                                 (* Add the item to the open notefile list, if it isn't
							     already there.)
			     (if (NOT (MEMBER ItemName NC.NoteFileIconOpenOperations))
				 then (SETQ NC.NoteFileIconOpenOperations (CONS ItemName 
								    NC.NoteFileIconOpenOperations)))
                                                             (* Remove the item from the closed notefile list.)
			     (SETQ NC.NoteFileIconCloseOperations (REMOVE ItemName 
								   NC.NoteFileIconCloseOperations)))
		       (Closed                               (* Add the item to the closed notefile list, if it 
							     isn't already there.)
			       (if (NOT (MEMBER ItemName NC.NoteFileIconCloseOperations))
				   then (SETQ NC.NoteFileIconCloseOperations (CONS ItemName 
								   NC.NoteFileIconCloseOperations)))
                                                             (* Remove the item from the open notefile list.)
			       (SETQ NC.NoteFileIconOpenOperations (REMOVE ItemName 
								    NC.NoteFileIconOpenOperations)))
		       (Both                                 (* Add the item to the open notefile list, if it isn't
							     already there.)
			     (if (NOT (MEMBER ItemName NC.NoteFileIconOpenOperations))
				 then (SETQ NC.NoteFileIconOpenOperations (CONS ItemName 
								    NC.NoteFileIconOpenOperations)))
                                                             (* Add the item to the closed notefile list, if it 
							     isn't already there.)
			     (if (NOT (MEMBER ItemName NC.NoteFileIconCloseOperations))
				 then (SETQ NC.NoteFileIconCloseOperations (CONS ItemName 
								   NC.NoteFileIconCloseOperations))))
		       (RETURN NIL))

          (* * Recompute the menus.)


	    (NC.MakeNoteFileIconOperationsMenus)
	    (RETURN Item))))

(NCP.RemoveNoteFileIconMenuItem
  (LAMBDA (ItemName)                                         (* pmi: "14-Jul-87 11:23")

          (* * pmi 7/14/87: New function which allows users to remove an item from the NoteFile Icon menu.
	  ItemName should be either the full menu item or just the name of the item (the first part of a full menu item.))


    (DECLARE (GLOBALVARS NC.NoteFileIconOperationsMenuItems NC.NoteFileIconOpenOperations 
			     NC.NoteFileIconCloseOperations))

          (* * Make sure we have only the name of a menu item.)


    (if (LISTP ItemName)
	then (NC.ReportError (QUOTE NCP.AddSessionIconMenuItem)
				 "You must provide only the name of the menu item as an atom.")
	       NIL
      else 

          (* * (NIL Find) the full menu item and remove it.)


	     (for MenuItem in NC.NoteFileIconOperationsMenuItems
		when (AND (LISTP MenuItem)
			      (EQ (CAR MenuItem)
				    ItemName))
		do (SETQ NC.NoteFileIconOperationsMenuItems (REMOVE MenuItem 
							       NC.NoteFileIconOperationsMenuItems))
		     (SETQ NC.NoteFileIconOpenOperations (REMOVE ItemName 
								    NC.NoteFileIconOpenOperations))
		     (SETQ NC.NoteFileIconCloseOperations (REMOVE ItemName 
								   NC.NoteFileIconCloseOperations))
		     (NC.MakeNoteFileIconOperationsMenus)
		     (RETURN MenuItem)))))

(NCP.RestoreNoteFileIconMenu
  (LAMBDA NIL                                                (* pmi: "13-Jul-87 20:59")

          (* * pmi 7/13/87: New function which allows users to restore the NoteFile Icon menu to its original state.)


    (DECLARE (GLOBALVARS NC.InitialNoteFileIconOperationsMenuItems 
			     NC.NoteFileIconOperationsMenuItems NC.InitialNoteFileIconOpenOperations 
			     NC.NoteFileIconOpenOperations NC.InitialNoteFileIconCloseOperations 
			     NC.NoteFileIconCloseOperations))
    (SETQ NC.NoteFileIconOperationsMenuItems NC.InitialNoteFileIconOperationsMenuItems)
    (SETQ NC.NoteFileIconOpenOperations NC.InitialNoteFileIconOpenOperations)
    (SETQ NC.NoteFileIconCloseOperations NC.InitialNoteFileIconCloseOperations)
    (NC.MakeNoteFileIconOperationsMenus)))

(NC.CreateSessionIconNoteFileMenuItem
  (LAMBDA (Item)                                             (* pmi: "10-Jul-87 18:22")

          (* * pmi 7/10/87: Created to format the menu item for the NoteFile menu of the Session Icon.)


    (LET (MenuItem SubItemList SubItems)
         (SETQ MenuItem (BQUOTE (, (CAR Item)
				       (NC.DoNoteFileOp (QUOTE , (CADR Item)))
				       ,
				       (CADDR Item))))
         (SETQ SubItemList (CADDDR Item))
         (if (AND SubItemList (EQ (CAR SubItemList)
					(QUOTE SUBITEMS)))
	     then (SETQ SubItems (CDR SubItemList))
		    (APPEND MenuItem (LIST (ATTACH (QUOTE SUBITEMS)
							 (for SubItem in SubItems
							    collect (
							     NC.CreateSessionIconNoteFileMenuItem
									SubItem)))))
	   else MenuItem))))
)
(PUTPROPS PMIPATCH050 COPYRIGHT ("Xerox Corporation" 1987))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (3141 14917 (NCP.AddSessionIconMenuItem 3151 . 5085) (NCP.RemoveSessionIconMenuItem 5087
 . 7059) (NCP.RestoreSessionIconMenu 7061 . 8330) (NCP.AddNoteFileIconMenuItem 8332 . 11751) (
NCP.RemoveNoteFileIconMenuItem 11753 . 13188) (NCP.RestoreNoteFileIconMenu 13190 . 14019) (
NC.CreateSessionIconNoteFileMenuItem 14021 . 14915)))))
STOP