Resizing works but is a bit nasty

This commit is contained in:
Elliot Nunn 2021-03-27 14:50:31 +08:00
parent a6f2c1186f
commit 7b57d376d4
1 changed files with 99 additions and 5 deletions

View File

@ -89,7 +89,7 @@ DAOpen
st -(SP) ; visible
clr.l -(SP) ; value/min
clr.l -(SP) ; max/procID=pushbtn
move.l #OpenBtn-DAEntry,-(SP) ; refCon
move.l #$80000000+OpenBtn-DAEntry,-(SP) ; refCon (high flag means pin right)
dc.w $A954 ; _NewControl
move.l D3,-(SP) ; theWindow
@ -98,7 +98,7 @@ DAOpen
st -(SP) ; visible
clr.l -(SP) ; value/min
clr.l -(SP) ; max/procID=pushbtn
move.l #CloseBtn-DAEntry,-(SP) ; refCon
move.l #$80000000+CloseBtn-DAEntry,-(SP) ; refCon
dc.w $A954 ; _NewControl
move.l D3,-(SP) ; theWindow
@ -238,8 +238,11 @@ CtlEvtMouse
move.l (SP)+,D4
move.l D4,D0
bsr UseFakeGrowBox
beq .noControlClicked ; actually, we resized the window
bsr UseFakeGrowBox ; takes pt in D0, leaves old/new sizes in D0/D1
bne.s .didNotResize
bsr MoveWindowControls
bra.s .noControlClicked
.didNotResize
subq #2,SP ; List Manager to handle it?
move.l D4,-(SP)
@ -320,7 +323,7 @@ Exit
***************************** SUBROUTINES ****************************
UseFakeGrowBox ; takes D0 as point argument, returns NE if not inside
UseFakeGrowBox ; takes D0 as point argument, returns NE if not inside, old/new size in D0/D1
move.l (A5),A0
move.l (A0),A0
move.l $14(A0),D1
@ -338,6 +341,8 @@ UseFakeGrowBox ; takes D0 as point argument, returns NE if not inside
move.l A1,-(A1)
move.l A1,$7E(A0) ; insert the fake one
move.l $14(A0),-(SP) ; Keep botRight of old portRect
move.l A0,-(SP) ; _SizeWindow's theWindow
subq #4,SP ; _GrowWindow's return, _SizeWindow's w/h
move.l A0,-(SP) ; _GrowWindow's theWindow
@ -352,7 +357,11 @@ UseFakeGrowBox ; takes D0 as point argument, returns NE if not inside
st -(SP) ; _SizeWindow's fUpdate (do add to upd rgn)
dc.w $A91D ; _SizeWindow
move.l (A5),A0 ; return old/new size in D0/D1
move.l (A0),A0
move.l $14(A0),D1
clr.w D0 ; return EQ
movem.l (SP)+,D0 ; preserve D0 flag
.miss
rts
@ -416,6 +425,91 @@ kgbcnt equ 3
rts
MoveWindowControls ; takes old/new size in D0/D1
bsr SubPt
move.l D1,D3 ; keep delta safe because we use it a lot
move.l (A5),A2
move.l (A2),A2 ; A2 is window
; Erase everything below the list
move.l $98(A2),A3 ; list handle as ever is in window refcon
move.l (A3),A0
move.l $14(A2),-(SP) ; botRight of window
clr.w -(SP) ; left of window
move.w 4(A0),-(SP) ; bottom of list
move.l SP,-(SP)
dc.w $A8A3 ; _EraseRect
addq #8,SP
; Adjust the list
move.l $98(A2),A3 ; list handle as ever is in window refcon
move.l (A3),A0
move.l 4(A0),D1 ; current size field
move.l D3,D0 ; delta size
bsr AddPt
move.l D1,-(SP) ; listWidth/listHeight args to LSize
move.l A3,-(SP) ; lHandle
move.w #96,-(SP)
dc.w $A9E7 ; _LSize
; Move the buttons (what a pain!)
move.l $8C(A2),D0 ; handle to first control
.ctlLoop
beq.s .doneControls
move.l D0,A3
move.l A3,D2
move.l (A3),A3 ; deref the handle
tst.b $28(A3)
beq.s .skipControl
move.l D3,D0
btst.b #7,$24(A3) ; test high bit of refCon
bne.s .doHorizontalMove
clr.w D0
.doHorizontalMove
move.l 8(A3),D1 ; current topLeft of control
bsr AddPt
move.l D1,8(A3)
move.l 12(A3),D1 ; current botRight of control
bsr AddPt
move.l D1,12(A3)
.skipControl
move.l (A3),D0 ; get next control handle
bra.s .ctlLoop
.doneControls
move.l A2,-(SP)
dc.w $A969 ; _DrawControls
bsr DrawFakeGrowBox
rts
AddPt ; adds D0 to D1, preserving D0
add.w D0,D1
swap D0
swap D1
add.w D0,D1
swap D0
swap D1
rts
SubPt ; subtracts D0 from D1, preserving D0
sub.w D0,D1
swap D0
swap D1
sub.w D0,D1
swap D0
swap D1
rts
***************************** CONTROLS ****************************
OpenBtnRect dc.w kWinH-20,kWinW-76,kWinH-3,kWinW-20