(FILECREATED "30-Nov-87 16:24:33" {QV}<NOTECARDS>1.3KNEXT>NCSEARCHCARD.;3 4478   

      changes to:  (FNS NC.MakeSearchCard)
		   (FILES NCTEXTCARD)

      previous date: "14-Jul-87 20:34:16" {QV}<NOTECARDS>1.3KNEXT>NCSEARCHCARD.;2)


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

(PRETTYCOMPRINT NCSEARCHCARDCOMS)

(RPAQQ NCSEARCHCARDCOMS [(* * Stuff for the Notecards search card.)
			   (DECLARE: DONTEVAL@LOAD (FILES NCTEXTCARD))
			   (FNS NCAddStub.SearchCard)
			   (FNS NC.MakeSearchCard NC.AddSearchCard NC.TitleSearch)
			   (DECLARE: DONTEVAL@LOAD (P (NC.AddSearchCard])
(* * Stuff for the Notecards search card.)

(DECLARE: DONTEVAL@LOAD 
(FILESLOAD NCTEXTCARD)
)
(DEFINEQ

(NCAddStub.SearchCard
  [LAMBDA NIL                                                (* rht: " 8-Nov-86 19:20")

          (* * kirk 18Jun86 Add the Search card stub)



          (* * rht 11/7/86: Now passes down a \\FILLME// field.)


    (NC.AddCardTypeStub (QUOTE Search)
			  (QUOTE Text)
			  (QUOTE NCSEARCHCARD)
			  NIL
			  (QUOTE ((DisplayedInMenuFlg T)))
			  (QUOTE (LinkIconAttachedBitMap])
)
(DEFINEQ

(NC.MakeSearchCard
  [LAMBDA (Card Title NoDisplayFlg)                          (* rht: "25-Mar-87 17:11")

          (* Search for cards with specified characteristics and create a list card containing pointers to these cards.
	  For now search is limited to cards whose title contains a specified string.)



          (* * rht 11/8/84: Fixed some confusion between ListCardID and ID variables.)



          (* * fgh 11/17/85 Updated to handle multiple notefiles and crad objects.)



          (* * rht 4/11/86: changed to call NC.ApplySuper.)



          (* * rht 10/21/86: Now deletes card if no search string specified.)



          (* * rg 3/16/87 NC.DeleteNoteCards -> NC.DeleteNoteCard)


    (LET ((NoteFile (fetch (Card NoteFile) of Card))
	  SearchString HitCards WindowOrCard Window)
         (SPAWN.MOUSE)
         (SETQ WindowOrCard (NC.ApplySupersFn MakeFn Card (OR Title "SearchCard")
						NoDisplayFlg))
         (NC.ActivateCard Card)
         (SETQ Window (AND (WINDOWP WindowOrCard)
			       WindowOrCard))
         (SETQ SearchString (NC.AskUser "Please enter the search string: " NIL NIL T Window))
         (if (OR (EQUAL SearchString "")
		     (NOT SearchString))
	     then (NC.DeleteNoteCard Card NIL T)
		    NIL
	   else [NC.SetTitle Card (SETQ Title (OR Title (CONCAT "Cards with %"" 
									  SearchString "%" in title"]
		  (AND Window (WINDOWPROP Window (QUOTE TITLE)
					      Title))
		  (RESETLST (RESETSAVE (CURSOR WAITINGCURSOR))
			      (NC.PrintMsg Window T "Searching for cards ...")
			      (SETQ HitCards (NC.TitleSearch NoteFile SearchString))
			      (TEDIT.INSERT (NC.FetchSubstance Card)
					      (CONCAT " List compiled on: " (DATE)
							(CHARACTER 13)
							(CHARACTER 13))
					      1)
			      (for HitCard in HitCards unless (EQ HitCard Card)
				 do (NC.InsertLinkBeforeMarker Card HitCard 
								   NC.ListContentsLinkLabel NIL NIL))
			      (NC.PrintMsg Window NIL "Done!" (CHARACTER 13)))
		  (BLOCK 250)
		  (NC.ClearMsg Window T)
		  WindowOrCard])

(NC.AddSearchCard
  (LAMBDA NIL                                                (* fgh: "14-Nov-85 22:01")

          (* * fgh 11/14/85 Updated to ri of substance type param to add card type.)


    (NC.AddCardType (QUOTE Search)
		      (QUOTE Text)
		      (BQUOTE ((MakeFn , (FUNCTION NC.MakeSearchCard))))
		      (BQUOTE ((LinkDisplayMode Title)
				 (DisplayedInMenuFlg , T))))))

(NC.TitleSearch
  [LAMBDA (NoteFile SearchString)                            (* rht: "25-Mar-87 15:17")

          (* * Searchs all cards on NoteFile for ones with SearchString in their title.)



          (* * rht 3/25/87: Now only looks at non-deleted cards.)


    (NC.MapCards NoteFile (FUNCTION [LAMBDA (Card)
		     Card])
		 (FUNCTION (LAMBDA (Card)
		     (AND (NC.ValidCardP Card)
			    (STRPOS SearchString (NC.RetrieveTitle Card])
)
(DECLARE: DONTEVAL@LOAD 
(NC.AddSearchCard)
)
(PUTPROPS NCSEARCHCARD COPYRIGHT ("Xerox Corporation" 1986 1987))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (719 1173 (NCAddStub.SearchCard 729 . 1171)) (1174 4344 (NC.MakeSearchCard 1184 . 3435) 
(NC.AddSearchCard 3437 . 3857) (NC.TitleSearch 3859 . 4342)))))
STOP