A2osX/LIB/LIBGUI.S.MBAR.txt
burniouf dad22dfc30 CC:SWITCH/CASE
ASM:added \%
KERNEL:BUGFIX in DevMgr
LIBGUI:New API
2022-10-18 07:56:59 +02:00

262 lines
4.2 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

NEW
AUTO 3,1
*--------------------------------------
* Y,A = MBAR definition
*--------------------------------------
MBAR.New >STYA ZPMENUPtr MBAR definition
>STYA ZPPtr1 for pass #2
lda #S.MBAR.Items+1 Ending\0
sta Counter
stz Counter+1
.10 lda (ZPMENUPtr)
beq .3
ldy #$ff
.1 iny
lda (ZPMENUPtr),y
bne .1
tya
sec text Ending\0
inc
inc skip pMENU
adc ZPMENUPtr
sta ZPMENUPtr
bcc .2
inc ZPMENUPtr+1
.2 tya
sec
adc #S.MBITEM
adc Counter
sta Counter
bcc .10
inc Counter+1
bra .10
.3 >LDYA Counter
>SYSCALL2 GetMem
bcs .9
>STYA ZPObjPtr
phx hMBAR
ldy #S.OBJ-1
lda #S.OBJ.T.MBAR
jsr OBJ.Init
lda #S.MBAR.Items
clc
adc ZPObjPtr
sta ZPObjPtr
bcc .4
inc ZPObjPtr+1
.4 stz DX
stz DX+1
.5 lda (ZPPtr1)
beq .8
>LDYA DX
jsr OBJ.AddWord S.MBITEM.X1
lda DX
clc
adc PREFS.MBARXMARGIN
sta DX
bcc .6
sta DX+1
.6 >LDYA DX
jsr OBJ.AddWord S.MBITEM.XT
>LDYA ZPPtr1 pTEXT
ldx hSYSFON
jsr FON.GetTextSize
lda DX
clc
adc CB.CACHE+S.CB.SrcW
sta DX
lda DX+1
adc CB.CACHE+S.CB.SrcW+1
sta DX+1
>LDYA DX
jsr OBJ.AddWord S.MBITEM.X2
>LDYA ZPPtr1 pTEXT
jsr OBJ.AddWord
jsr SkipStrZPtr1 skip "TEXT\0"
ldy #1
lda (ZPPtr1),y
jsr OBJ.AddByte pMENU+1
lda (ZPPtr1)
jsr OBJ.AddByte pMENU
lda ZPPtr1
clc
adc #2
sta ZPPtr1
bcc .5
inc ZPPtr1+1
bra .5 stkip pMENU
.8 pla hMBAR
clc
.9 rts
*--------------------------------------
*--------------------------------------
*--------------------------------------
* ZPWNDPtr = parent WND
*--------------------------------------
MBAR.Paint lda #S.CB.CMD.FILLRECT
jsr CB.InitCacheA
lda #S.CB.OP.SET
sta CB.Cache+S.CB.OP
lda #S.CB.M.MONO
sta CB.Cache+S.CB.M
lda PREFS.MBARCOLOR
sta CB.Cache+S.CB.COLOR
ldy #S.OBJ.X1
lda (ZPWNDPtr),y
sta CB.Cache+S.CB.X1
iny
lda (ZPWNDPtr),y
sta CB.Cache+S.CB.X1+1
ldy #S.OBJ.X2
lda (ZPWNDPtr),y
sta CB.Cache+S.CB.X2
iny
lda (ZPWNDPtr),y
sta CB.Cache+S.CB.X2+1
ldy #S.WND.MBarY1
lda (ZPWNDPtr),y
sta CB.Cache+S.CB.Y1
iny
lda (ZPWNDPtr),y
sta CB.Cache+S.CB.Y1+1
iny #S.WND.MBarY2
lda (ZPWNDPtr),y
sta CB.Cache+S.CB.Y2
iny
lda (ZPWNDPtr),y
sta CB.Cache+S.CB.Y2+1
jsr CB.Cache2CBBuf
ldy #S.WND.pMBAR
lda (ZPWNDPtr),y
sta ZPMENUPtr
iny
lda (ZPWNDPtr),y
sta ZPMENUPtr+1
.1 lda (ZPMENUPtr)
beq .8
jsr CB.ClearCache
lda #S.CB.CMD.DRAWTEXT2
sta CB.CACHE+S.CB.CMD
lda #S.CB.OP.SET+S.CB.OP.INVERSE
sta CB.Cache+S.CB.OP
lda #S.CB.M.MONO
sta CB.Cache+S.CB.M
lda hSYSFON
sta CB.CACHE+S.CB.hFont
ldy #S.MBITEM.XT
lda (ZPMENUPtr),y
clc
ldy #S.OBJ.X1
adc (ZPWNDPtr),y
sta CB.CACHE+S.CB.X1
ldy #S.MBITEM.XT+1
lda (ZPMENUPtr),y
ldy #S.OBJ.X1+1
adc (ZPWNDPtr),y
sta CB.CACHE+S.CB.X1+1
ldy #S.WND.MBarY1
lda (ZPWNDPtr),y
clc
adc #1
sta CB.CACHE+S.CB.Y1
iny
lda (ZPWNDPtr),y
adc #0
sta CB.CACHE+S.CB.Y1+1
lda #S.MBITEM.pTEXT
clc
adc ZPMENUPtr
sta CB.CACHE+S.CB.TxtPtr
lda #0
adc ZPMENUPtr+1
sta CB.CACHE+S.CB.TxtPtr+1
jsr CB.Cache2CBBuf
lda (ZPMENUPtr)
clc
adc ZPMENUPtr
sta ZPMENUPtr
bcc .1
inc ZPMENUPtr+1
bra .1
.8 clc
rts
*--------------------------------------
* ZPWNDPtr parent WND
* MSG.X1, MSG.Y1
*--------------------------------------
MBAR.Enter
* >DEBUG
*--------------------------------------
MBAR.Leave
clc
rts
*--------------------------------------
MAN
SAVE usr/src/lib/libgui.s.mbar
LOAD usr/src/lib/libgui.s
ASM