ùúùú  _0  '<  Ÿ  3 LÚ Zg É pö ¯¾ š

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*									    *
*	Get X and y offsets for window. Used for font scaling.		    *
*	You only need to run this once.					    *
*									    *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
GetScreenOffsets:
	move.l	ScreenAddress(a5),a0
	moveq	#0,d0
	add.b	sc_WBorLeft,d0
	move.w	d0,LeftOffset(a5)

	moveq	#0,d6
	add.b	sc_WBorTop(a0),d0	; mysc->WBorTop +
	move.l	sc_Font(a0),a0
	add.w	ta_YSize(a0),d0		; mysc->Font->ta_YSize
	move.w	d0,TopOffset(a5)

	move.l	a0,FontStruct(a5)
	move.w	ta_YSize(a0),FontSize(a5)

	rts


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*									    *
*	Adjust window height and width and iconify height and width.	    *
*	You must have run GetScreenOffsets before you use this.		    *
*	Inputs: a0 = WinHeight, a1 = WinWidth, a2 = WinZoom (or NULL)	    *
*									    *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
AdjustWindowSize:
	move.w	FontSize(a5),d1

	move.w	2(a0),d0		; Adjust height
	mulu	d1,d0
	asr.l	#3,d0

	add.w	TopOffset(a5),d0	; Add TopOffset to height
	move.w	d0,2(a0)

	move.w	2(a1),d0		; Adjust width
	mulu	d1,d0
	asr.l	#3,d0
	add.w	LeftOffset(a5),d0	; Add LeftOffset to width
	move.w	d0,2(a1)

	cmp.l	#0,a2
	beq	.NoZoom

	move.w	d0,4(a2)		; Adjust Zoom width

	add.w	TopOffset(a5),6(a2)	; Adjust Zoom height

.NoZoom:
	rts






* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*									    *
*	Create gadgets and adjust size and location.			    *
*	Inputs: a3 = GadgetList. a4 = GadgetPointer. Outputs: Z if error.   *
*									    *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
CreateGadgets:

	lea	NGadget(a5),a1		; Place for the new gadget

	move.l	FontStruct(a5),12(A1)	; Font to use
	move.l	VisualInfo(pc),22(A1)	; Pointer to VisualInfo
	move.w	(A3)+,D2		; Number of gadgets
	subq.w	#1,D2			; Subtract 1 because use of DBRA

	move.l	GadToolsBase(a5),a6
	move.w	TopOffset(a5),d6
	move.w	LeftOffset(a5),d4
	moveq.l	#0,d7

.Loop:
	addq.w	#1,d7
	move.l	(a4),a0			; Pointer to previous gadget
	lea	NGadget(a5),a1		; Pointer to new gadget

	move.w	(a3)+,d0		; LeftEdge
	mulu	d3,d0			; Gångra med font höjden
	asr.l	#3,d0
	add.w	d4,d0
	move.w	d0,(a1)

	move.w	(a3)+,d0		; TopEdge
	mulu	d3,d0			; Gångra med font höjden
	asr.l	#3,d0
	add.w	d6,d0
	move.w	d0,2(a1)

	move.w	(a3)+,d0
	mulu	d3,d0			; Gångra med font höjden
	asr.l	#3,d0
	move.w	d0,4(a1)		; Width

	move.w	(a3)+,d0
	mulu	d3,d0			; Gångra med font höjden
	asr.l	#3,d0
	move.w	d0,6(a1)		; Height

	move.w	d7,16(A1)		; Gadget ID
	move.l	(a3)+,18(a1)		; Gadget flags
	move.l	(a3)+,d0		; Gadget Kind
	move.l	(a3)+,8(a1)		; Gadget Label
	move.l	(a3)+,a2		; Tag list
	CallLib CreateGadgetA		; Create the gadget
	move.l	d0,(a4)			; Save gadgetpointer

	dbeq	d2,.Loop		; Jump back if gadgets left
	rts
