
		LOAD		'Macros.dump'

		INCLUDE	'SS.equ'

		INCLUDE	'Driver.equ'
		INCLUDE	'Heap.aii.i'

;-----------------------------------------------
;
;	Imported addresses
;
;-----------------------------------------------

		IMPORT	S_ActiveWindow
		IMPORT	S_CurDefFormat
		IMPORT	S_CurEditFlag
		IMPORT	S_CurFormat
		IMPORT	S_CurTLSelect
		IMPORT	S_DoChecks
		IMPORT	S_DoDefaultDlog
		IMPORT	S_GetCellPtr
		IMPORT	S_ListFormulasDlog
		IMPORT	S_SetCurFormat
		IMPORT	S_SwapIn

;---------------------------------------------------------------------------
;
; S_SetDefaults 
;

S_SetDefaults	PROC		EXPORT
			;Using	S_CurrentData

			local	CellPtr:l
			BEGIN	+b

			Call		S_SwapIn,in=(S_ActiveWindow:l)

			in		S_CurDefFormat:l
			out		S_CurDefFormat:l
			XCall	S_DoDefaultDlog

			lda		S_CurEditFlag
			and		#S_EditingBit
			beq		doChecks					; not editting

			in		S_CurTLSelect:l
			out		CellPtr:l
			XCall	S_GetCellPtr

			ora		CellPtr
			beq		setFormat					; cell empty

			MoveWord	[CellPtr]:#S_CellFormat,a
			bpl		doChecks					; cell not empty

setFormat
			MoveLong	S_CurDefFormat,S_CurFormat

doChecks
			Call		S_DoChecks

			RETURN
			ENDP

;----------------------------------------------------------------------------
;
;

S_ListFormulas	PROC		EXPORT
			;Using	S_CurrentData

			BEGIN	+b

			Call		S_SwapIn,in=(S_ActiveWindow:l)

			lda		S_CurEditFlag
			and		#S_EditingBit
			bne		stopIdle

			Call		S_SetCurFormat,in=(S_CurTLSelect:l)
			bra		doDlog

stopIdle

doDlog
			Call		S_ListFormulasDlog

			RETURN
			ENDP
			END

