LIBGUI:fixes

This commit is contained in:
burniouf 2022-10-19 08:26:48 +02:00
parent 64a22a4d37
commit 97593445bd
2 changed files with 80 additions and 66 deletions

Binary file not shown.

View File

@ -7,8 +7,8 @@ MENU.New >PULLW DY
>PULLW DX >PULLW DX
>PULLYA >PULLYA
>STYA ZPPtr1 MENU definition >STYA ZPPtr1 MENU definition
>STYA ZPMENUPtr for pass #2 >STYA ZPObjPtr for pass #2
ldy MENU.Stack.Cnt ldy MENU.Stack.Cnt
cpy #MENU.MAX cpy #MENU.MAX
beq .90 beq .90
@ -17,37 +17,42 @@ MENU.New >PULLW DY
>SYSCALL2 GetMem >SYSCALL2 GetMem
bcs .99 bcs .99
>STYA ZPObjPtr >STYA ZPMENUPtr
txa hMenu txa hMenu
ldx MENU.Stack.Cnt ldx MENU.Stack.Cnt
sta MENU.Stack,x sta MENU.Stack,x
lda #S.OBJ.T.MENU lda #S.OBJ.T.MENU
sta (ZPObjPtr) S.OBJ.T sta (ZPMENUPtr) S.OBJ.T
lda #0 lda #0
ldy #S.MENU.Items-1 ldy #S.MENU.Items-1
.1 sta (ZPObjPtr),y .1 sta (ZPMENUPtr),y
dey dey
bne .1 bne .1
>LDYA ZPMENUPtr
>STYA ZPPtr1
jsr MENU.GetData
ldx #3 ldx #3
ldy #S.OBJ.X1+3 ldy #S.OBJ.X1+3
.2 lda DX,x .2 lda DX,x
sta (ZPObjPtr),y sta (ZPMENUPtr),y
dey dey
dex dex
bpl .2 bpl .2
>LDYA ZPObjPtr
>STYA ZPPtr1 MENU definition
jsr MENU.GetData
ldx MENU.Stack.Cnt
lda MENU.Stack,x
>SYSCALL2 GetMemPtr
>STYA ZPMENUPtr
jsr MENU.SetMenuSizePos jsr MENU.SetMenuSizePos
ldx MENU.Stack.Cnt ldx MENU.Stack.Cnt
@ -106,25 +111,20 @@ MENU.GetSize lda #S.MENU.Items+1 Ending\0
rts rts
*-------------------------------------- *--------------------------------------
* ZPPtr1 = defintion * ZPPtr1 = defintion
* ZPObjPtr = DstBuf * ZPMENUPtr = DstBuf
*-------------------------------------- *--------------------------------------
MENU.GetData lda #S.MENU.Items MENU.GetData lda ZPMENUPtr
clc clc
adc ZPObjPtr adc #S.MENU.Items
sta ZPObjPtr sta ZPMENUPtr
bcc .1 bcc .1
inc ZPMENUPtr+1
inc ZPObjPtr+1
.1 lda (ZPPtr1) .1 lda (ZPPtr1)
sta (ZPObjPtr) sta (ZPMENUPtr)
beq .8 beq .8
ldy #S.MITEM.S
lda #0
sta (ZPObjPtr),y
lda (ZPPtr1)
cmp #S.MITEM.T.SEP cmp #S.MITEM.T.SEP
bne .2 bne .2
@ -140,7 +140,7 @@ MENU.GetData lda #S.MENU.Items
ldy #1 T+ID+KEMOD+KEY+pICON+"text" ldy #1 T+ID+KEMOD+KEY+pICON+"text"
lda (ZPPtr1),y lda (ZPPtr1),y
ldy #S.MITEM.ID ldy #S.MITEM.ID
sta (ZPObjPtr),y sta (ZPMENUPtr),y
ldy #2 ldy #2
lda (ZPPtr1),y lda (ZPPtr1),y
@ -149,10 +149,10 @@ MENU.GetData lda #S.MENU.Items
lda (ZPPtr1),y lda (ZPPtr1),y
ldy #S.MITEM.KEYMOD+1 ldy #S.MITEM.KEYMOD+1
sta (ZPObjPtr),y sta (ZPMENUPtr),y
dey KEY dey KEY
txa txa
sta (ZPObjPtr),y sta (ZPMENUPtr),y
lda #4 lda #4
bra .4 skip 4 bytes bra .4 skip 4 bytes
@ -164,10 +164,10 @@ MENU.GetData lda #S.MENU.Items
lda (ZPPtr1),y lda (ZPPtr1),y
ldy #S.MITEM.pMENU+1 ldy #S.MITEM.pMENU+1
sta (ZPObjPtr),y sta (ZPMENUPtr),y
dey dey
txa txa
sta (ZPObjPtr),y sta (ZPMENUPtr),y
lda #3 skip 3 bytes lda #3 skip 3 bytes
.4 jsr SkipAPtr1 .4 jsr SkipAPtr1
@ -175,30 +175,34 @@ MENU.GetData lda #S.MENU.Items
ldy #1 ldy #1
lda (ZPPtr1),y lda (ZPPtr1),y
ldy #S.MITEM.pICON+1 ldy #S.MITEM.pICON+1
sta (ZPObjPtr),y sta (ZPMENUPtr),y
dey dey
lda (ZPPtr1) lda (ZPPtr1)
sta (ZPObjPtr),y sta (ZPMENUPtr),y
lda #2 skip pICON lda #2 skip pICON
jsr SkipAPtr1 jsr SkipAPtr1
.5 ldy #S.MITEM.pTEXT .5 ldy #S.MITEM.pTEXT
lda ZPPtr1 lda ZPPtr1
sta (ZPObjPtr),y sta (ZPMENUPtr),y
iny iny
lda ZPPtr1+1 lda ZPPtr1+1
sta (ZPObjPtr),y sta (ZPMENUPtr),y
jsr SkipStrZPtr1 skip "TEXT\0" jsr SkipStrZPtr1 skip "TEXT\0"
.7 lda ZPObjPtr ldy #S.MITEM.S
lda #0
sta (ZPMENUPtr),y
lda ZPMENUPtr
clc clc
adc #S.MITEM adc #S.MITEM
sta ZPObjPtr sta ZPMENUPtr
bcc .1 bcc .1
inc ZPObjPtr+1 inc ZPMENUPtr+1
bra .1 bra .1
.8 clc .8 clc
@ -211,6 +215,7 @@ MENU.SetMenuSizePos
stz IE+1 stz IE+1
stz INE Max Mod-Key W stz INE Max Mod-Key W
stz INE+1
lda #2 2px Borders lda #2 2px Borders
sta DY Menu H sta DY Menu H
@ -221,8 +226,12 @@ MENU.SetMenuSizePos
.1 lda (ZPPtr1) .1 lda (ZPPtr1)
beq .3 beq .3
cmp #S.MITEM.T.SEP
beq .2
jsr MENU.GetMItemW jsr MENU.GetMItemW
jsr MENU.NextMItemDY
.2 jsr MENU.NextMItemDY
bra .1 bra .1
.3 lda #2+MENU.LMargin+MENU.RMargin 2px Borders+5 LMARGIN (Checked) +5 RMARGIN (SubMenu) .3 lda #2+MENU.LMargin+MENU.RMargin 2px Borders+5 LMARGIN (Checked) +5 RMARGIN (SubMenu)
@ -267,7 +276,7 @@ MENU.SetMenuSizePos
lda IY lda IY
sta (ZPMENUPtr),y sta (ZPMENUPtr),y
iny #S.MENU.tW ldy #S.MENU.tW
lda IE lda IE
sta (ZPMENUPtr),y sta (ZPMENUPtr),y
iny iny
@ -313,11 +322,7 @@ MENU.SetMenuSizePos
rts rts
*-------------------------------------- *--------------------------------------
MENU.GetMItemW lda (ZPPtr1) MENU.GetMItemW ldy #S.MITEM.pICON
cmp #S.MITEM.T.SEP
beq .8
ldy #S.MITEM.pICON
lda (ZPPtr1),y lda (ZPPtr1),y
iny iny
ora (ZPPtr1),y ora (ZPPtr1),y
@ -346,11 +351,15 @@ MENU.GetMItemW lda (ZPPtr1)
ldx hSYSFON ldx hSYSFON
jsr FON.GetTextSize jsr FON.GetTextSize
lda CB.Cache+S.CB.SrcW ldx CB.Cache+S.CB.SrcW
cmp INE cmp INE
lda CB.Cache+S.CB.SrcW+1
sbc INE+1
bcc .8 bcc .8
sta INE set Max Mod-key W stx INE set Max Mod-key W
lda CB.Cache+S.CB.SrcW+1
sta INE+1
.8 rts .8 rts
*-------------------------------------- *--------------------------------------
@ -467,8 +476,8 @@ MENU.Enter jsr MENU.GetDXWIE X1,W,X2
>LDYA L.WND.Screen >LDYA L.WND.Screen
jsr DrawCBBufToYA jsr DrawCBBufToYA
* jsr MENU.NewSubMenu jsr MENU.NewSubMenu
* bcs .9 bcs .9
bra .1 bra .1
@ -527,7 +536,7 @@ MENU.NewSubMenu lda DX
*-------------------------------------- *--------------------------------------
MENU.Draw >SYSCALL2 GetMemPtr MENU.Draw >SYSCALL2 GetMemPtr
>STYA ZPMENUPtr >STYA ZPMENUPtr
jsr MENU.Save jsr MENU.Save
bcs .9 bcs .9
@ -541,15 +550,17 @@ MENU.Draw >SYSCALL2 GetMemPtr
jsr MENU.GetMItems jsr MENU.GetMItems
.6 lda (ZPPtr1) .1 lda (ZPPtr1)
beq .8 beq .8
jsr MENU.DrawMItem jsr MENU.DrawMItem
jsr MENU.NextMItemDY jsr MENU.NextMItemDY
bra .6 bra .1
.8 >LDYA L.WND.Screen .8 >LDYA L.WND.Screen
jmp DrawCBBufToYA jsr DrawCBBufToYA
>DEBUG
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
@ -619,7 +630,9 @@ MENU.DrawBorders
jmp CB.Cache2CBBuf jmp CB.Cache2CBBuf
*-------------------------------------- *--------------------------------------
MENU.DrawMItem lda (ZPPtr1) MENU.DrawMItem jsr MENU.GetDX
lda (ZPPtr1)
cmp #S.MITEM.T.SEP cmp #S.MITEM.T.SEP
bne MENU.DrawMItem1 bne MENU.DrawMItem1
@ -761,12 +774,13 @@ MENU.DrawMItem1 lda #S.CB.CMD.FILLRECT
ldx #BM.ID.RIGHT ldx #BM.ID.RIGHT
jsr DRAW.xBMAtDXDY jsr DRAW.xBMAtDXDY
.8 lda DY .8
bne .80 * lda DY
* bne .80
dec DY+1 * dec DY+1
.80 dec DY *.80 dec DY
clc clc
rts rts
@ -994,17 +1008,7 @@ MENU.Destroy clc
.8 clc .8 clc
rts rts
*-------------------------------------- *--------------------------------------
MENU.GetDXWIE ldy #S.OBJ.X1 MENU.GetDXWIE ldy #S.OBJ.W
lda (ZPMENUPtr),y
clc
adc #1
sta DX
iny
lda (ZPMENUPtr),y
adc #0
sta DX+1
ldy #S.OBJ.W
lda (ZPMENUPtr),y lda (ZPMENUPtr),y
sec sec
sbc #3 2Px border + correction from W sbc #3 2Px border + correction from W
@ -1023,6 +1027,16 @@ MENU.GetDXWIE ldy #S.OBJ.X1
adc DX+1 adc DX+1
sta IE+1 sta IE+1
MENU.GetDX ldy #S.OBJ.X1
lda (ZPMENUPtr),y
clc
adc #1
sta DX
iny
lda (ZPMENUPtr),y
adc #0
sta DX+1
rts rts
*-------------------------------------- *--------------------------------------
MENU.GetDY ldy #S.OBJ.Y1 MENU.GetDY ldy #S.OBJ.Y1