Purpose: To create a checkerboard interface to a checkers program. The
	interface will consist of a checkersboard, a three item,
	floating-button menu for controlling the checkers program, and
	a messages box. The interface can be created by running
	checkersboard.lisp. The checkers program can be executed by
	running checkers.lisp.

Loader File: The necessary files for this demo can be loaded from
	/afs/cs/user/bvz/garnet/lapidary/demo/demo-loader.lisp. 
	This file loads garnet, lapidary, the checkers program,
	and a function called which-color, which is used during the
	demo.

Demo Overview: First create the checkerboard, then the floating buttons,
	and finally the message box.

Getting Started: Before running the demo, you should do the following
	things to get all the necessary windows created and garbage collection
	out of the way:

	Hit the save gadget, load gadget, and interactors buttons (and
		when the interactors menu appears, hit the choice option). 

	Bring up the filling style menu, select the color button, and change
		the color to white.

	Create a second drawing window, which will be used to hold prototype
		prototype objects. This second window can be resized
		since it only has to hold four objects. 

	Make the window that you are going to create the checkers interface
		in somewhat larger, since it's going to have to hold
		a checkerboard that contains an 8x8 grid of 50 pixel wide 
		squares plus a menu. 

	Preload the bitmap you will need for this demo. To do this,
		select the bitmap button. A window will pop up asking for a 
		filename and a windowname. The window name should be the title
		of the prototype window's title bar (e.g., Drawing Window 2). 
		The filename for the bitmap is 
		/afs/cs/user/bvz/garnet/lapidary/demo/wstar.
		Make the draw function for the star be :xor (don't
		worry about changing the draw function a second time, objects
		are created with :copy as the default draw function).


Doing it:

1) Create the prototype for the squares in the checkerboard: 
	Create a rectangle
	make it be 50 pixels high and wide using the width and height 
		boxes in the box constraint menu.

2) Create the checkerboard: 
	Create a horizontal aggrelist that is 8x8 (the rectangle must be 
		selected when you do this). If you can't make it 8x8 (for 
		example, because the window is too small), let go and you 
		can resize it later (see troubleshooting notes). 

	A properties window will pop up (may be at the bottom of
		the screen if the drawing window is at the bottom of the 
		screen). Change the vertical and horizontal spacing to -1. 

3) Color the checkerboard:
	Insert a formula into the rectangle (the item prototype) that 
	determines the color of a square in the checkerboard. To do this,
	choose the filling-style button and then the constraint button
	in the filling-style menu. You will be prompted for a formula
	in the lisp listener. Enter:

	(which-color)

	This function has been predefined by the demo loader file.

4) Create a checker:
	Create a circle
	Make the filling style of the circle be green
	Move the star from the prototype window to the checkers window
	Center the star in the circle.
	Make the star and circle into an aggregate.
	Make the width and height of the circle be the width and height
		of the aggregate

5) Position the checker:
	Left and top align the checker in an arbitrary square of the
		checkerboard
	Make the checker have the same width and height as this square
		(note: after changing the width of the aggregate, the
		circle may temporarily be bigger than the aggregate--don't
		worry, changing the height of the aggregate will make
		the circle have the proper size again)

6) Save the checker
	You will be asked four separate times if a slot should be made
		into a parameter. Answer yes all four times (just hit 
		return when queried) and enter :objover as the link name
	 	when queried.

7) Move the checker to the prototype window (note: you should choose a corner
	grow box rather than one on the side. if you choose the grow
	box that only allows the object to move horizontal or vertically,
	then the object may seem to disappear when it is placed in the
	prototype window, when in fact, the window just isn't big enough
	to show it).

8) Move the rectangle prototype to the prototype window

9) Create a floating button

	Create the black shadow, gray rectangle, white rectangle, and a 
		text item reading "begin green", but do not constrain them
	Center the text item in the white rectangle
	If the white rectangle is not big enough to accommodate the text,
		make it bigger. Do not constrain the white rectangle to
		the text because we want all text buttons to have the
		same width (not vary based on text width).
	Center the white rectangle in the gray rectangle and constrain
		its width and height if desired

	*Important Step*: constrain the gray rectangle to the black
		rectangle, making its height and width be the same as
		the black rectangle, and making its left and top
		offsets be -10.

	Make the objects into an aggregate

	*Important Step*: make the width and height of the aggregate be
		10 pixels wider and higher than the black shadow

10) Make a text button menu

	Make a vertical aggrelist of three text buttons (button aggregate 
		should be already selected from last step)

	Make the vertical spacing be 15 pixels.

11) Change the label of the second button to "begin blue" and the
	third button to "quit"

12) Create the menu interactor

	Bring up the choice interactor 

	Make the menu aggregate be the start-where

	Select one of the buttons in the menu (the prototype won't work)
		and choose the by-demo button in interim feedback

	Select the gray rectangle and make it be aligned with the
		black rectangle

	Hit the OK button in the by-demo window (it may be obscured so
		you may have to bring it to the front)

	Hit the "create interactor" button

13) Test the menu

	Select the test button and test

14) Add the final function

	Select the build button

	Enter menu-handler as the final function
	
	Hit modify

15) Move the prototype button to the prototype window

16) Create the messages window

	Create a rectangle and a piece of text. Place the rectangle
	under the checkerboard, but left-align it with the menu. Make
	the rectangle extend to the end of the checkerboard.
	Left-align and center the text. Make the text be something like
	message.

17) Write out the window

	Deselect everything

	Save the window--you have to enter the name of the window as
		shown on the title bar

18) Run the checkers program

	Whatever file you stored the window in, load it

	Execute (checkers:do-go)

		
Troubleshooting Notes:

1) You can grow an aggrelist by selecting it and dragging it using the
	middle mouse button. Appropriate feedback will appear

2) The "list properties" button allows you to modify the properties of
	an aggrelist

3) If something crashes: first try (lapidary:fix-it)--it will try to 
	fix things by undoing the last command and deselecting everything
	(actually fix-it will undo the last filling-style, line-style,
	attach-constraint, or interactor creation change. if it has
	been a couple operations since this happened, it will still
	undo the last one that occured).
	If this doesn't work, try (lapidary:clean-up). It destroys
	all lapidary windows and creates a fresh one. It works very
	reliably. 

	*Note*: for some reason fix-it and clean-up always seem to
		crash in Allegro (but never in Lucid). It seems to
		be a problem with abort-interactor. If you type
		:reset (to get out of the debugger), (opal:update-all),
		and (inter:main-event-loop), everything seems to
		be ok.

4) If something goes wrong during by-demo, you can hit cancel and start
	over.