// Text of project Souffl written on 5/22/96 at 8:10 PM
// Beginning of text file ChezDTS constants
/*
**      Newton Developer Technical Support Sample Code
**
**      Chez DTS - How to register application pieces and not waste heap 
**
**      by David Fedor, Newton Developer Technical Support
**
**      Copyright  1996 by Apple Computer, Inc.  All rights reserved.
**
**      You may incorporate this sample code into your applications without
**      restriction.  This sample code has been provided "AS IS" and the
**      responsibility for its operation is 100% yours.  You are not
**      permitted to modify and redistribute the source as "DTS Sample Code."
**      If you are going to re-distribute the source, we require that you
**      make it clear in the source that the code was descended from
**      Apple-provided sample code, but that you've made changes.
*/

// This is the symbol for the global registry
constant kChezDTSFrame := '|ChezDTSRegistry:DTS|;

// This is the symbol for the main application's base view
constant kChezDTSAppSym := '|ChezDTS:DTS|;



// The kChezDTSRegisterFunc and kChezDTSUnRegisterFunc functions are 
// just called by the auto parts... they're not used by the app at all.

DefConst('kChezDTSRegisterFunc, func(sym, frame) 
	begin
		// create the registry if necessary
		if not IsFrame(GetGlobalVar(kChezDTSFrame)) then
			DefGlobalVar(EnsureInternal(kChezDTSFrame), TotalClone('{}));
		
		// register this object
		GetGlobalVar(kChezDTSFrame).(EnsureInternal(sym)) := frame;
	
		// let the app know things changed.
		AddProcrastinatedCall(kChezDTSAppSym, 
			func() if GetRoot().(kChezDTSAppSym) then
				GetRoot().(kChezDTSAppSym):?ThingsChanged(), nil, 1);
	end);

DefConst('kChezDTSUnRegisterFunc, func(sym) 
	begin
		// unregister this object
		RemoveSlot(GetGlobalVar(kChezDTSFrame), sym);
		
		// let the app know things changed.
		AddProcrastinatedCall(kChezDTSAppSym, 
			func() if GetRoot().(kChezDTSAppSym) then
				GetRoot().(kChezDTSAppSym):?ThingsChanged(), nil, 1);
	end);
// End of text file ChezDTS constants
// Beginning of text file Souffl autopart
/*
**      Newton Developer Technical Support Sample Code
**
**      Chez DTS - How to register application pieces and not waste heap 
**      Auto part for Souffl (part of the Chez DTS sample)
**
**      by David Fedor, Newton Developer Technical Support
**
**      Copyright  1996 by Apple Computer, Inc.  All rights reserved.
**
**      You may incorporate this sample code into your applications without
**      restriction.  This sample code has been provided "AS IS" and the
**      responsibility for its operation is 100% yours.  You are not
**      permitted to modify and redistribute the source as "DTS Sample Code."
**      If you are going to re-distribute the source, we require that you
**      make it clear in the source that the code was descended from
**      Apple-provided sample code, but that you've made changes.
*/

// Doesn't do anything other than register itself in the "ChezDTS" frame,
// using just enough of the heap to survive card removal.

installScript := func(partFrame, removeFrame) 
	begin
		call kChezDTSRegisterFunc with (kAppSymbol, 
					'{title:	"Grand Marnier Souffl", 
					  color:	goldenBrown});
	end;

RemoveScript := func(partFrame) 
	begin
		call kChezDTSUnregisterFunc with (kAppSymbol);
	end;
// End of text file Souffl autopart



