               PicApp: An Extensible Application Kernel
               ----------------------------------------

	PicApp consists of the following sources files:

		defs.l
		boss.l
		window.l
		docWin.l
		picApp.l

	Resources for menus are in the file "Rsrc".

	Provided is also a simple sample application in "sample.l".
	All the above files can be loaded by double-clicking on "*app.l".


								"defs.l"

	contains pre-defined constants and macros, and should be loaded first
	into the system. It defines resource ID's, indices for menu items
	and a small function for use as a read-time macro.


								"boss.l"

	creates the BOSS object. BOSS is the link between the Macintosh
	toolbox and the applications. It receives events from the toolbox in
	numeric form an passes them to the corresponding application.

	The function GO is used to define the system function *TASK, which is
	executed continuously in the interperter's background. *TASK will then
	perform periodic actions like SystemTask and garbage collection, and call
	GETEVENT to receive the next event from the Mac ROM.
	DOEVENT sends the number found in event.what to the BOSS object as a
	message. The BOSS in turn has methods defined for the most common events.

	In case of a mouseDown event, it determines the location of the mouseDown
	in the standard Macintosh fashion and takes appropriate actions.
	For MouseDown's in the menu bar he will send a packed-number event to the
	current application (in the variable $APP), unless it is the Apple-Menu
	which he will process by himself.
	SystemWindow-clicks and window-drags he will also perform by himself,
	while for inContent, inGrow, inGoAway and zooming he will send a symbolic
	message to the application object stored in the window's RefCon field.

	MouseUp's are just sent to the current application in $APP.

	Key-events are sent to the current application with the character code
	and the event-modifier data as arguments.

	Window update events will cause the message UPDATE to be sent to the
	application object that owns the window (via the Refcon field).

	Activate events must be separated in activate- and deactivate-events.
	A deactivate-event is just passed to the application.
	A true activate event will cause the ACTIVATE message to be sent to
	the application object. Besides this, however, when the previous active
	object (which is still in $APP) is not identical to the object being
	activated, the old object will receive the message END and the new object
	the message BEGIN. When the two objects prove to be of different type
	(as may be decided by the applications themselves with CLASSIFY), they will
	also receive a CLEANUP and SETUP message, respectively. Then $APP is set
	to the new application object.

	Network, driver and application-defined events are just passed to the
	current application.

	Besides these toolbox methods, BOSS also has methods for starting a new
	application , stopping and application, and for quitting back to the Finder.
	START pushes the new application in the list of currently living applicatins
	in $APPS.
	STOP removes an application from this list. If this was the last
	application, the standard default application IDLE will be activated.
	QUIT sends an END message to the current application and a CLOSE message
	to all open applications, then exits the program.


								"window.l"

	defines the basic WINDOW object. It will understand the messages CLOSE,
	REFRESH, UPDATE, SHOW and HIDE.
	The only non-trivial method is UPDATE. It receives a functional argument,
	which is applied between the standard BeginUpdate and EndUpdate toolbox
	calls.


								"docWin.l"

	DOCWIN is a subclass of WINDOW. The first two and a half pages in the
	listing define some utility functions to be used by the methods of DOCWIN.
	The T (= template) method of DOCWIN creates a new instance, which is
	basically a color window with two scroll bars.
	GROW accepts a point specifying the location of the mouse event and
	performs the standard Mac GrowWindow function.
	ZOOM does window zooming via the zoomBox.
	SCROLL receives the control and its part found by the mouseDown, together
	with the mouse location, and does the standard scroll bar manipulations.
	UPDATE recieves a functional argument, adds its own processing (which
	consists of drawing the scroll bars) and passes it all to the method
	it inherits from the WINDOW superClass (explicit inheritance with FROM).
	ACTIVATE and DEACTIVATE do the normal highlighting and showing/hiding
	of the grow box icon.
	CHANGE, finally, causes a DOCWIN object to change its size (H and/or V)
	or its name.


								"picApp.l"

	PICAPP is a sceleton object to be extended by the application programmer.
	In the current version, it has only default methods for closing an
	application and a CONTENT method.
	CONTENT expects a point (of the mouse-click), and optionally one or
	two functions. The function $BAR is called only for clicks in the scroll
	bars and may be supplied if additional processing is needed. The other
	function ($FOO) may process clicks in the rest of the window content.


						A Toy Sample Application
						------------------------

	Modelled after the 'Sample' application in Inside Macintosh Vol.1, this
	application lets you open windows, type and edit text and and close
	them again. Features not provided in Inside Mac, however, are:
		Multiple window editing
		Window scrolling and zooming

	The first function, INIT, opens the "Rsrc" resource file containing the
	menu definitions, installes the menu bar and starts the background task
	with GO.

	The next 13 lines in the listing add a few new methods to the PICAPP
	class, as responses to the NEW, OPEN, CLOSE and QUIT menu commands.

	Then the IDLE object is created. Any program that uses PICAPP must have
	this object defined. The IDLE object should at least respond to the
	initial NEW and OPEN commands as well as the QUIT command, and do some
	basic Menu endable/disabling. In the sample listing, ABLE simply enables
	the New, Open and Quit items in the File menu.

	Now the SAMPLE class is created as a subClass of PICAPP.
	The template method T initializes a new SAMPLE object by inheriting T
	from PICAPP (or DOCWIN in this case) and installing a TextEdit record
	with the toolbox call TENew.
	Then it informs BOSS of its existance.

	CLOSE disposes the TextEdit record and then invokes the CLOSE method of
	its superclass.

	BOSS sends an IDLE message when there are no other events to process.
	In our case, this causes the cursor to blink with TEIdle.

	BEGIN and END, as they are sent by the BOSS during toolbox update events
	(see above), call the TextEdit routines TEActivate and TEDeactivate,
	respectively.

	SAMPLE objects will send KeyDown and autoKey messages as menu commands
	to itself when the command key was hold down, otherwise TEClick is used.

	The menu commands Cut, Copy, Paste and Clear invoke the corresponding
	toolbox routines.

	UPDATE performs the updating inherited from DOCWIN, and calls TEUpdate
	for updating the window's text.

	CONTENT passes mouseDown events in the window's content region to
	PICAPP, using TEClick for clicks in the text part.

	ABLE first calculates a boolean flag S, saying whether the TextEdit
	record's selection start and end are different. Then, it constantly
	enables the New, Open, Close, Quit and Paste menu commands, and
	enables or disables the Cut, Copy or Clear commands depending on the
	value of S.

	The last method, SETCURSOR, simply sets the mouse cursor to an I-beam
	if it is inside the current window and to the standard arrow otherwise.
