1303Fermer1305
FarewellLe 29/06/2017 à 00:14
;===============================================================================
;
;	void InformParentAboutReallocation
;
;	Called when a widget moves in memory. Make the parent aware of the new
;	address of its chid
;
;	in	a0	widget* OldPtr
;		a1	widget* NewPtr
;	out	nothing
;	destroy	std
;
;===============================================================================

InformParentAboutReallocation:
	;-----------------------------------------------------------------------
	;	Accelerator. Useless if there is no performance issue
	;-----------------------------------------------------------------------
;	cmpa.l	a0,a1
;	beq.s	\End

	;-----------------------------------------------------------------------
	;	Save registers and get the parent to modify
	;-----------------------------------------------------------------------
	movem.l	a0-a1,-(sp)
	movea.l	Widget.parent(a1),a0

	;-----------------------------------------------------------------------
	;	Special case for layouts
	;-----------------------------------------------------------------------
	btst.b	#Widget.flag.layout,Widget.flags(a0)
	beq.s	\NoLayout
		lea	Layout.firstchild(a0),a0
\Loop:		cmpm.l	(a0)+,(sp)+
		subq.l	#4,sp
		bne.s	\Loop
		subq.l	#4,a0
		bra.s	\SetNewPtr
\NoLayout:

	;-----------------------------------------------------------------------
	;	Else switch/case the type. Preload the child address
	;-----------------------------------------------------------------------
	move.b	Widget.type(a0),d0

	lea	Groupbox.layout(a0),a0				; Groupbox
	subq.b	#GROUPBOX-HORIZONTAL_LAYOUT,d0
;	beq.s	\SetNewPtr					; Remove when adding new widget


	;-----------------------------------------------------------------------
	;	Replace the old child's ptr with the new one
	;-----------------------------------------------------------------------
\SetNewPtr:
	addq.l	#4,sp						; Pop old ptr
	move.l	(sp)+,(a0)					; And set the new one
\End:	rts
Bon le bug est là. Je sais pas où exactement, mais il est là \o/