(FILECREATED "12-Jun-86 18:26:00" {QV}<NOTECARDS>1.3K>RHTPATCH050.;1 6152   

      changes to:  (VARS RHTPATCH050COMS)
		   (FNS NC.BuildCardInspectorMenu))


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

(PRETTYCOMPRINT RHTPATCH050COMS)

(RPAQQ RHTPATCH050COMS ((* * Change to NCREPAIR)
			  (FNS NC.BuildCardInspectorMenu)))
(* * Change to NCREPAIR)

(DEFINEQ

(NC.BuildCardInspectorMenu
  (LAMBDA (Cards BadNewsList NoteFile MessageWin)            (* rht: "12-Jun-86 18:25")

          (* * Build a list of menu containing all valid cards giving ID #s and indicators as to problems, if any.
	  ID #s can be invoked causing a window/menu containing info on the card to be brought up.)



          (* * rht 12/8/85: Modified to reflect new card and notefile object formats.)



          (* * rht 6/12/86: Fixed loop that does SHADEITEMS.)


    (LET (MenuWindows TotalMenus FirstWindow FirstWindowSize AttachedMenu)
         (if (NOT (WINDOWP MessageWin))
	     then (NC.ReportError "NC.BuildCardInspectorMenu" (CONCAT "Arg not window: " 
									    MessageWin)))
         (NC.SortCardsBySlotNums Cards)
         (SETQ TotalMenus (ADD1 (QUOTIENT (SUB1 (LENGTH Cards))
						NC.CardsPerMenuLimit)))
                                                             (* Build the attached menu for global menu operations 
							     including moving to next or previous page if 
							     necessary.)
         (SETQ AttachedMenu (create MENU
					ITEMS ←(BQUOTE ((Abort (QUOTE Abort)
								 
					   "Abort the repair process, throwing away all changes.")
							  (Done (QUOTE Done)
								
			      "Integrate changes (i.e. checkpoint notefile) and continue repair.")
							  (Search (QUOTE Search)
								  
				       "Find IDs for cards with titles containing search string.")
							  ,@(if (GEQ TotalMenus 2)
								then (QUOTE
									 ((Previous% Page
									     (QUOTE Previous% Page)
									     
						       "Move to menu for previous page of cards.")
									   (Next% Page (QUOTE
											 Next% Page)
										       
						       "Move to menu for previous page of cards.")
									   (First% Page (QUOTE
											  First% Page)
											
							  "Move to menu for first page of cards.")))))
							 )
					CENTERFLG ← T
					MENUCOLUMNS ← 1
					WHENSELECTEDFN ←(FUNCTION 
					  NC.CardInspectorAttachedMenuWhenSelectedFn)
					MENUFONT ← NC.ScavengerAttachedMenuFont))
                                                             (* Build the menus and attachments and store on 
							     message window prop.)
         (WINDOWPROP MessageWin (QUOTE MENUWINDOWS)
		       (SETQ MenuWindows
			 (for MenuNum from 1 to TotalMenus bind (RestOfCards ← Cards)
									Menu Window Items 
									AttachedWindow
			    collect (SETQ Menu
					(create MENU
						  ITEMS ←(SETQ Items
						    (for old RestOfCards on RestOfCards
						       as i from 1 to NC.CardsPerMenuLimit
						       bind Card ProblemIdentifierAtom TitleString
						       collect 

          (* * Build string to display in menu entry by concat'ing together the card's slot num with the first few characters
	  of card's title with problem identification chars.)


								 (SETQ Card (CAR RestOfCards))
								 (SETQ ProblemIdentifierAtom
								   (CADDR (FASSOC Card 
										      BadNewsList)))
								 (SETQ TitleString
								   (CONCAT (NC.FetchSlotNum
									       Card)
									     ": "
									     (NC.ShaveTitleString
									       (
								   NC.FetchTitleFromScavengerInfo
										 Card))))
								 (LIST (if ProblemIdentifierAtom
									     then (CONCAT 
										      TitleString "|" 
									    ProblemIdentifierAtom)
									   else TitleString)
									 Card)))
						  TITLE ←(CONCAT "Card inspector: Page " MenuNum 
								   " of "
								   TotalMenus)
						  WHENSELECTEDFN ←(FUNCTION 
						    NC.CardInspectorMenuWhenSelectedFn)
						  MENUROWS ←(MIN 30 (LENGTH Items))))
				      (SETQ Window (ADDMENU Menu NIL NC.OffScreenPosition)) 
                                                             (* Shade the troublesome items in this menu.)
				      (for News in BadNewsList
					 do (LET* ((BadCard (CAR News))
						     (Item (for Item in Items
							      when (NC.SameCardP BadCard
										     (CADR Item))
							      do (RETURN Item))))
						    (if Item
							then (SHADEITEM Item Menu NC.LightShade 
									    Window))))
				      (WINDOWPROP Window (QUOTE NOTEFILE)
						    NoteFile)
                                                             (* Rig so that lines through deleted entries will be 
							     drawn whenever menu is redisplayed.)
				      (WINDOWADDPROP Window (QUOTE REPAINTFN)
						       (FUNCTION NC.CardInspectorRepaintFn))
                                                             (* This makes closing the cards inspector menu same as
							     selecting "abort" from the attached menu.
							     That is, abort the repair process.)
				      (WINDOWADDPROP Window (QUOTE CLOSEFN)
						       (FUNCTION NC.CardInspectorCloseFn)
						       (QUOTE FIRST))
				      (ATTACHWINDOW (ADDMENU AttachedMenu NIL 
								 NC.OffScreenPosition)
						      Window
						      (QUOTE RIGHT)
						      (QUOTE TOP))
				      Window)))              (* Attach the first menu with its attached operations 
							     menu to message window's lower left edge.)
         (SETQ FirstWindow (CAR MenuWindows))
         (ATTACHWINDOW FirstWindow MessageWin (QUOTE BOTTOM)
			 (QUOTE LEFT))
         (REDISPLAYW FirstWindow))))
)
(PUTPROPS RHTPATCH050 COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (390 6070 (NC.BuildCardInspectorMenu 400 . 6068)))))
STOP