kfar: add mouse in menu dialogs, fix mouse alt+f12

git-svn-id: svn://kolibrios.org@9059 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2021-07-13 08:15:21 +00:00
parent 73c3929ff2
commit 7a4aed6e11
2 changed files with 74 additions and 26 deletions

View File

@ -49,7 +49,7 @@ GenericBox:
jz .redraw jz .redraw
dec eax dec eax
jz .key jz .key
sub eax,4 sub eax, 4
jz .mouse jz .mouse
jmp exit jmp exit
.redraw: .redraw:
@ -145,9 +145,11 @@ align 4
mov eax,SF_MOUSE_GET mov eax,SF_MOUSE_GET
mov ebx,SSF_BUTTON_EXT mov ebx,SSF_BUTTON_EXT
int 0x40 int 0x40
mov byte[mousestate], 1
bt eax,8 ;left but. down bt eax,8 ;left but. down
jnc .event jc @f
mov byte[mousestate], 0
@@:
mov eax,SF_MOUSE_GET mov eax,SF_MOUSE_GET
mov ebx,SSF_WINDOW_POSITION mov ebx,SSF_WINDOW_POSITION
int 0x40 int 0x40
@ -169,8 +171,6 @@ align 4
pop edx pop edx
mov ebx, [esp+24h+8] ;DLGTEMPLATE* dlg mov ebx, [esp+24h+8] ;DLGTEMPLATE* dlg
cmp dword[ebx+dlgtemplate.size], 0
jne .event ;¥á«¨ ¤¨ «®£®¢®¥ ®ª­® ­¥ áâ ­¤ àâ­®¥ (ᯨ᮪ §­ ç¥­¨©)
cmp edx, [ebx+dlgtemplate.y] cmp edx, [ebx+dlgtemplate.y]
jl .event jl .event
cmp eax, [ebx+dlgtemplate.x] cmp eax, [ebx+dlgtemplate.x]
@ -181,7 +181,32 @@ align 4
jge .event jge .event
cmp eax, [ebx+dlgtemplate.width] cmp eax, [ebx+dlgtemplate.width]
jge .event jge .event
cmp dword[ebx+dlgtemplate.size], 0
je .m_menu_end
;¥á«¨ ¤¨ «®£®¢®¥ ®ª­® ­¥ áâ ­¤ àâ­®¥ (ᯨ᮪ §­ ç¥­¨©)
cmp edx, [ebx+44]
jl @f
mov edx, [ebx+44]
dec edx
@@:
mov ecx, [ebx+48]
mov ecx, [ecx] ;¡¥à¥¬ 㪠§ â¥«ì ­  listitem[1]
sub ecx, [ebx+48] ;ecx - à §¬¥à ®¤­®£® listitem
mov [ebx+56], edx
imul edx, ecx
add edx, [ebx+48]
mov [ebx+40], edx
cmp byte[mousestate], 1
jne @f
mov [esp+28], edx ;save to eax
jmp .exit
@@:
call MenuDlgProc.dodraw
call draw_image
jmp .event
.m_menu_end:
cmp byte[mousestate], 1
jne .event
add ebx, dlgtemplate.size+12 add ebx, dlgtemplate.size+12
mov ecx, [ebx-4] mov ecx, [ebx-4]
or ecx, ecx or ecx, ecx
@ -193,8 +218,8 @@ align 4
je .m_comp je .m_comp
cmp [ebx+dlgitemtemplate.type], 3 ;edit cmp [ebx+dlgitemtemplate.type], 3 ;edit
je .m_comp je .m_comp
;cmp [ebx+dlgitemtemplate.type], 5 ;check cmp [ebx+dlgitemtemplate.type], 5 ;check
;je .m_comp je .m_comp
jmp .m_next jmp .m_next
align 4 align 4
.m_comp: .m_comp:
@ -212,6 +237,12 @@ align 4
mov [esp+28+8], ebx ;save to eax mov [esp+28+8], ebx ;save to eax
pop ecx ebx pop ecx ebx
jmp .exit jmp .exit
@@:
cmp [ebx+dlgitemtemplate.type], 5 ;check
jne @f
xor [ebx+dlgitemtemplate.flags], 10h
mov eax, ebx
jmp .m_new_focus
@@: @@:
mov eax, [ebx+dlgitemtemplate.flags] mov eax, [ebx+dlgitemtemplate.flags]
and eax, 4 and eax, 4
@ -744,11 +775,11 @@ menu_centered_in:
pushad pushad
mov ecx, 60 mov ecx, 60
; 40 bytes for dlgtemplate + additional: ; 40 bytes for dlgtemplate + additional:
; +40: dd cur_variant - [???] ; +40: dd cur_variant - 㪠§ â¥«ì ­  ¬ áᨢ listitem[num_variants]
; +44: dd num_variants - ᪮«ìª® í«¥¬¥­â®¢ ¢« §¨â ¢ ®ª­® ; +44: dd num_variants - ᪮«ìª® í«¥¬¥­â®¢ ¢ ᯨ᪥
; +48: dd begin_variant - [dd ..,..,???] ; +48: dd begin_variant - 㪠§ â¥«ì ­  listitem[0]
; +52: dd end_variant - [dd ..,..,???] ; +52: dd end_variant - 㪠§ â¥«ì ­  listitem[num_variants-1]
; +56: dd cur_variant_idx - ??? ; +56: dd cur_variant_idx - ¨­¤¥ªá ¢ë¡à ­­®£® í«¥¬¥­â  ®â 0 ¤® num_variants-1
call xpgalloc call xpgalloc
test eax, eax test eax, eax
jnz @f jnz @f
@ -1358,11 +1389,16 @@ ManagerDlgProc:
jz .draw jz .draw
dec eax dec eax
jz .key jz .key
;sub eax, 4
;jz .mouse
xor eax, eax xor eax, eax
ret 16 ret 16
.draw: .draw:
call .dodraw call .dodraw
ret 16 ret 16
;.mouse:
;todo
;ret 16
.key: .key:
; find item with focus ; find item with focus
add ebx, dlgtemplate.size+12 add ebx, dlgtemplate.size+12
@ -1824,9 +1860,12 @@ draw_checkbox:
@@: @@:
lodsb lodsb
test al, al test al, al
jz .ret jz .correct
stosw stosw
loop @b loop @b
ret
.correct:
sub [ebx+dlgitemtemplate.x2], ecx
.ret: .ret:
ret ret

View File

@ -984,11 +984,19 @@ get_keybar_ind:
ret ret
align 4 align 4
OnMouse_ctrl_f39: OnMouse_ctrl_f3_9:
sub eax, panels_mouse.ctrl+8 sub eax, panels_mouse.ctrl+8
shr eax, 2 shr eax, 2
add eax, 0x3D add eax, 0x3D
call panels_OnKey.ctrl_f39 call panels_OnKey.ctrl_f3_9
ret
align 4
OnMouse_alt_f1_2:
sub eax, panels_mouse.alt
shr eax, 2
add eax, 0x3B
call panels_OnKey.alt_f1_2
ret ret
align 16 align 16
@ -2241,7 +2249,7 @@ panels_OnKey:
pop edi pop edi
mov byte [edi], 0 mov byte [edi], 0
jmp .done_cmdbar jmp .done_cmdbar
.ctrl_f39: .ctrl_f3_9:
sub al, 0x3D sub al, 0x3D
add al, al add al, al
mov ah, [ebp + PanelData.sortmode] mov ah, [ebp + PanelData.sortmode]
@ -2277,7 +2285,7 @@ panels_OnKey:
inc ecx inc ecx
add [ebp + PanelData.start], ecx add [ebp + PanelData.start], ecx
jmp @b jmp @b
.alt_f12: .alt_f1_2:
mov ebp, panel1 mov ebp, panel1
cmp al, 0x3B cmp al, 0x3B
jz @f jz @f
@ -7566,16 +7574,17 @@ panels_mouse:
.ctrl: .ctrl:
rd 2 rd 2
repeat 9-3+1 repeat 9-3+1
dd OnMouse_ctrl_f39 dd OnMouse_ctrl_f3_9
end repeat end repeat
rd 3 rd 3
; Ctrl+Shift ; Ctrl+Shift
rd 12 rd 12
; Alt .alt:
rd 6 dd OnMouse_alt_f1_2
dd panels_OnKey.alt_f7 dd OnMouse_alt_f1_2
rd 4 rd 4
dd panels_OnKey.alt_f12 dd panels_OnKey.alt_f7
rd 5
; Alt+Shift ; Alt+Shift
rd 12 rd 12
; Alt+Ctrl ; Alt+Ctrl
@ -7636,12 +7645,12 @@ panels_ctrlkeys:
dd panels_OnKey.menu dd panels_OnKey.menu
repeat 9-3+1 repeat 9-3+1
dw 0x3D+%-1, 0x10 dw 0x3D+%-1, 0x10
dd panels_OnKey.ctrl_f39 dd panels_OnKey.ctrl_f3_9
end repeat end repeat
dw 0x3B, 0x100 dw 0x3B, 0x100
dd panels_OnKey.alt_f12 dd panels_OnKey.alt_f1_2
dw 0x3C, 0x100 dw 0x3C, 0x100
dd panels_OnKey.alt_f12 dd panels_OnKey.alt_f1_2
dw 0x58, 0 dw 0x58, 0
dd F12 dd F12
dw 0x13, 0x10 dw 0x13, 0x10