(FILECREATED "22-May-85 11:36:47" {PHYLUM}<NOTECARDS>RELEASE1.2>LIBRARY>ARIDEMO.;8 8508   

      changes to:  (VARS ARIDEMOCOMS)
		   (FNS ARI.RunDemo)

      previous date: "30-Apr-85 11:46:09" {PHYLUM}<NOTECARDS>RELEASE1.2>LIBRARY>ARIDEMO.;6)


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

(PRETTYCOMPRINT ARIDEMOCOMS)

(RPAQQ ARIDEMOCOMS ((GLOBALVARS ARI.DemoFileName ARI.ContentsCardPosition 
				ARI.DefaultLessonCardPosition ARI.MainMenuFont ARI.MainMenuTitleFont 
				ARI.MainMenuPosition ARI.LessonMenuFont ARI.LessonMenuTitleFont 
				ARI.LessonMenuPosition ARI.StartingFileBox)
		    (VARS (ARI.DemoFileName (QUOTE {PHYLUM}<NOTECARDS>RELEASE1.2>DEMO>7STEPSDEMO))
			  (ARI.ContentsCardPosition (QUOTE (400 . 500)))
			  (ARI.MainMenuFont (FONTCREATE (QUOTE TIMESROMAN)
							14
							(QUOTE MRR)))
			  (ARI.MainMenuTitleFont (FONTCREATE (QUOTE TIMESROMAN)
							     14
							     (QUOTE BRR)))
			  (ARI.MainMenuPosition (QUOTE (900 . 600)))
			  (ARI.LessonMenuFont (FONTCREATE (QUOTE TIMESROMAN)
							  14
							  (QUOTE MRR)))
			  (ARI.LessonMenuTitleFont (FONTCREATE (QUOTE TIMESROMAN)
							       14
							       (QUOTE BRR)))
			  (ARI.LessonMenuPosition (QUOTE (800 . 500)))
			  (ARI.DefaultLessonCardPosition (QUOTE (100 . 500))))
		    (INITVARS (ARI.StartingFileBox (QUOTE NC00001)))
		    (FNS ARI.RunDemo ARI.LessonCardPosition ARI.ReturnDaughterCardsInOrder 
			 ARI.DeactivateCards)))
(DECLARE: DOEVAL@COMPILE DONTCOPY

(GLOBALVARS ARI.DemoFileName ARI.ContentsCardPosition ARI.DefaultLessonCardPosition ARI.MainMenuFont 
	    ARI.MainMenuTitleFont ARI.MainMenuPosition ARI.LessonMenuFont ARI.LessonMenuTitleFont 
	    ARI.LessonMenuPosition ARI.StartingFileBox)
)

(RPAQQ ARI.DemoFileName {PHYLUM}<NOTECARDS>RELEASE1.2>DEMO>7STEPSDEMO)

(RPAQQ ARI.ContentsCardPosition (400 . 500))

(RPAQ ARI.MainMenuFont (FONTCREATE (QUOTE TIMESROMAN)
				   14
				   (QUOTE MRR)))

(RPAQ ARI.MainMenuTitleFont (FONTCREATE (QUOTE TIMESROMAN)
					14
					(QUOTE BRR)))

(RPAQQ ARI.MainMenuPosition (900 . 600))

(RPAQ ARI.LessonMenuFont (FONTCREATE (QUOTE TIMESROMAN)
				     14
				     (QUOTE MRR)))

(RPAQ ARI.LessonMenuTitleFont (FONTCREATE (QUOTE TIMESROMAN)
					  14
					  (QUOTE BRR)))

(RPAQQ ARI.LessonMenuPosition (800 . 500))

(RPAQQ ARI.DefaultLessonCardPosition (100 . 500))

(RPAQ? ARI.StartingFileBox (QUOTE NC00001))
(DEFINEQ

(ARI.RunDemo
  (LAMBDA NIL                                                (* rht: "22-May-85 11:30")

          (* * Run the 7 steps demo. Open the proper notefile, and provide menus for bringing up lessons and stepping through 
	  the cards for each lesson. All done under programmer's interface control.)


    (PROG (LessonBoxes MainMenu LessonMenuItems)
          (SETQ LessonMenuItems (LIST (QUOTE (Next (QUOTE Next)
						   "Move to next element of this lesson."))
				      (QUOTE (Previous (QUOTE Previous)
						       "Go back to previous element of this lesson."))
				      (QUOTE (First (QUOTE First)
						    "Bring up first element of this lesson."))
				      (QUOTE (End% Lesson (QUOTE End% Lesson)
							  
						 "End this lesson returning to main lesson menu."))))
                                                             (* Open the ARI demo notefile.)
          (NCP.OpenNoteFile ARI.DemoFileName T)              (* Get the lesson file boxes and activate now for speed
							     and convenience.)
          (NCP.ActivateCards (SETQ LessonBoxes (ARI.ReturnDaughterCardsInOrder ARI.StartingFileBox)))
                                                             (* Set up the menu for selecting next lesson.)
          (SETQ MainMenu (create MENU
				 TITLE ← "Choose next lesson"
				 ITEMS ←(NCONC1 (for Box in LessonBoxes
						   collect (BQUOTE (, (NCP.CardTitle Box)
								      (QUOTE , Box)
								      "Work on this lesson next.")))
						(QUOTE (**QUIT** (QUOTE **QUIT**)
								 
					      "End this instructional session and close up shop.")))
				 MENUFONT ← ARI.MainMenuFont
				 MENUTITLEFONT ← ARI.MainMenuTitleFont
				 MENUPOSITION ← ARI.MainMenuPosition))
                                                             (* Outer loop moves to next lesson, getting lesson 
							     cards and bringing up the first one gratis.)
          (for bind Cards FirstCard LessonBox until (EQ (SETQ LessonBox (MENU MainMenu))
							(QUOTE **QUIT**))
	     when LessonBox
	     do (SETQ Cards (ARI.ReturnDaughterCardsInOrder LessonBox))
		(SETQ FirstCard (CAR Cards))
		(NCP.BringUpCard FirstCard (ARI.LessonCardPosition FirstCard)) 
                                                             (* Inner loop lets user choose from a menu for next 
							     lesson element. Ensures that only one lesson element is
							     up at a time.)
		(for bind (CurrentCard ← FirstCard)
			  NextCard
		   do (SELECTQ (MENU (create MENU
					     TITLE ←(NCP.CardTitle LessonBox)
					     ITEMS ← LessonMenuItems
					     MENUFONT ← ARI.LessonMenuFont
					     MENUTITLEFONT ← ARI.LessonMenuTitleFont
					     MENUPOSITION ← ARI.LessonMenuPosition))
			       (First (SETQ NextCard (if (EQ FirstCard CurrentCard)
							 then (PROMPTPRINT 
					    "You're already looking at the first lesson element.")
							      NIL
						       else FirstCard)))
			       (Previous (SETQ NextCard (for RestOfCards on Cards
							   when (EQ (CADR RestOfCards)
								    CurrentCard)
							   do (RETURN (CAR RestOfCards))))
					 (if (NULL NextCard)
					     then (PROMPTPRINT "You're at the first lesson element!"))
					 )
			       (Next (SETQ NextCard (for RestOfCards on Cards
						       when (EQ (CAR RestOfCards)
								CurrentCard)
						       do (RETURN (CADR RestOfCards))))
				     (if (NULL NextCard)
					 then (PROMPTPRINT "You're at the last lesson element!")))
			       (End% Lesson (ARI.DeactivateCards CurrentCard)
					    (RETURN))
			       (SETQ NextCard NIL))
		      (if NextCard
			  then (ARI.DeactivateCards CurrentCard)
			       (NCP.BringUpCard NextCard (ARI.LessonCardPosition NextCard))
			       (SETQ CurrentCard NextCard))))
                                                             (* We're through. Close up contents card and then close
							     notefile.)
          (ARI.DeactivateCards LessonBoxes)
          (NCP.CloseNoteFile))))

(ARI.LessonCardPosition
  (LAMBDA (Card)                                             (* rht: "28-Mar-85 22:48")

          (* * Return the position at which to bring up this lesson card. Take a position off the card's prop list if there's 
	  one there, otherwise default to a global var's value.)


    (OR (NCP.CardProp Card (QUOTE POSITION))
	ARI.DefaultLessonCardPosition)))

(ARI.ReturnDaughterCardsInOrder
  (LAMBDA (Card)                                             (* rht: "29-Mar-85 14:01")

          (* * This is trivial in release1.2, i.e. just can use NCP.FileBoxChildren, assuming you know that Card is a box, or 
	  NCP.GetLinks in general. But in 1.1, To links are not maintained in order. Thus the following hack.)


    (PROG ((ActiveFlg (NCP.ActiveCardP Card)))
          (OR ActiveFlg (NCP.ActivateCards Card))
          (RETURN (PROG1 (for Link in (CAR (APPLY* (NCP.CardTypeInheritedFn (NCP.CardType Card)
									    (QUOTE 
									     CollectLinksInCardFn))
						   Card NIL NIL))
			    collect (fetch (NOTECARDLINK DESTINATIONID) of Link))
			 (OR ActiveFlg (NCP.DeactivateCards Card)))))))

(ARI.DeactivateCards
  (LAMBDA (Cards)                                            (* rht: "30-Apr-85 11:45")

          (* * Just like NCP.DeactivateCards but first move cards off screen.)


    (for Card in (MKLIST Cards) bind Win
       do (if (SETQ Win (NCP.CardWindow Card))
	      then (MOVEW Win 1500 1500))
	  (NCP.DeactivateCards Card))))
)
(PUTPROPS ARIDEMO COPYRIGHT ("Xerox Corporation" 1985))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (2434 8430 (ARI.RunDemo 2444 . 6786) (ARI.LessonCardPosition 6788 . 7194) (
ARI.ReturnDaughterCardsInOrder 7196 . 8024) (ARI.DeactivateCards 8026 . 8428)))))
STOP