From 7a4aed6e118f446ff20263a8c098d6536bdc287b Mon Sep 17 00:00:00 2001 From: IgorA Date: Tue, 13 Jul 2021 08:15:21 +0000 Subject: [PATCH] kfar: add mouse in menu dialogs, fix mouse alt+f12 git-svn-id: svn://kolibrios.org@9059 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/fs/kfar/trunk/dialogs.inc | 67 +++++++++++++++++++++++------- programs/fs/kfar/trunk/kfar.asm | 33 +++++++++------ 2 files changed, 74 insertions(+), 26 deletions(-) diff --git a/programs/fs/kfar/trunk/dialogs.inc b/programs/fs/kfar/trunk/dialogs.inc index e881a685cb..4861865761 100644 --- a/programs/fs/kfar/trunk/dialogs.inc +++ b/programs/fs/kfar/trunk/dialogs.inc @@ -49,7 +49,7 @@ GenericBox: jz .redraw dec eax jz .key - sub eax,4 + sub eax, 4 jz .mouse jmp exit .redraw: @@ -145,9 +145,11 @@ align 4 mov eax,SF_MOUSE_GET mov ebx,SSF_BUTTON_EXT int 0x40 + mov byte[mousestate], 1 bt eax,8 ;left but. down - jnc .event - + jc @f + mov byte[mousestate], 0 +@@: mov eax,SF_MOUSE_GET mov ebx,SSF_WINDOW_POSITION int 0x40 @@ -169,8 +171,6 @@ align 4 pop edx mov ebx, [esp+24h+8] ;DLGTEMPLATE* dlg - cmp dword[ebx+dlgtemplate.size], 0 - jne .event ;если диалоговое окно не стандартное (список значений) cmp edx, [ebx+dlgtemplate.y] jl .event cmp eax, [ebx+dlgtemplate.x] @@ -181,7 +181,32 @@ align 4 jge .event cmp eax, [ebx+dlgtemplate.width] 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 mov ecx, [ebx-4] or ecx, ecx @@ -193,8 +218,8 @@ align 4 je .m_comp cmp [ebx+dlgitemtemplate.type], 3 ;edit je .m_comp - ;cmp [ebx+dlgitemtemplate.type], 5 ;check - ;je .m_comp + cmp [ebx+dlgitemtemplate.type], 5 ;check + je .m_comp jmp .m_next align 4 .m_comp: @@ -212,6 +237,12 @@ align 4 mov [esp+28+8], ebx ;save to eax pop ecx ebx 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] and eax, 4 @@ -744,11 +775,11 @@ menu_centered_in: pushad mov ecx, 60 ; 40 bytes for dlgtemplate + additional: -; +40: dd cur_variant - [???] -; +44: dd num_variants - сколько элементов влазит в окно -; +48: dd begin_variant - [dd ..,..,???] -; +52: dd end_variant - [dd ..,..,???] -; +56: dd cur_variant_idx - ??? +; +40: dd cur_variant - указатель на массив listitem[num_variants] +; +44: dd num_variants - сколько элементов в списке +; +48: dd begin_variant - указатель на listitem[0] +; +52: dd end_variant - указатель на listitem[num_variants-1] +; +56: dd cur_variant_idx - индекс выбранного элемента от 0 до num_variants-1 call xpgalloc test eax, eax jnz @f @@ -1358,11 +1389,16 @@ ManagerDlgProc: jz .draw dec eax jz .key + ;sub eax, 4 + ;jz .mouse xor eax, eax ret 16 .draw: call .dodraw ret 16 +;.mouse: + ;todo + ;ret 16 .key: ; find item with focus add ebx, dlgtemplate.size+12 @@ -1824,9 +1860,12 @@ draw_checkbox: @@: lodsb test al, al - jz .ret + jz .correct stosw loop @b + ret +.correct: + sub [ebx+dlgitemtemplate.x2], ecx .ret: ret diff --git a/programs/fs/kfar/trunk/kfar.asm b/programs/fs/kfar/trunk/kfar.asm index bae06ab209..cfa3ba2de9 100644 --- a/programs/fs/kfar/trunk/kfar.asm +++ b/programs/fs/kfar/trunk/kfar.asm @@ -984,11 +984,19 @@ get_keybar_ind: ret align 4 -OnMouse_ctrl_f39: +OnMouse_ctrl_f3_9: sub eax, panels_mouse.ctrl+8 shr eax, 2 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 align 16 @@ -2241,7 +2249,7 @@ panels_OnKey: pop edi mov byte [edi], 0 jmp .done_cmdbar -.ctrl_f39: +.ctrl_f3_9: sub al, 0x3D add al, al mov ah, [ebp + PanelData.sortmode] @@ -2277,7 +2285,7 @@ panels_OnKey: inc ecx add [ebp + PanelData.start], ecx jmp @b -.alt_f12: +.alt_f1_2: mov ebp, panel1 cmp al, 0x3B jz @f @@ -7566,16 +7574,17 @@ panels_mouse: .ctrl: rd 2 repeat 9-3+1 - dd OnMouse_ctrl_f39 + dd OnMouse_ctrl_f3_9 end repeat rd 3 ; Ctrl+Shift rd 12 -; Alt - rd 6 - dd panels_OnKey.alt_f7 +.alt: + dd OnMouse_alt_f1_2 + dd OnMouse_alt_f1_2 rd 4 - dd panels_OnKey.alt_f12 + dd panels_OnKey.alt_f7 + rd 5 ; Alt+Shift rd 12 ; Alt+Ctrl @@ -7636,12 +7645,12 @@ panels_ctrlkeys: dd panels_OnKey.menu repeat 9-3+1 dw 0x3D+%-1, 0x10 - dd panels_OnKey.ctrl_f39 + dd panels_OnKey.ctrl_f3_9 end repeat dw 0x3B, 0x100 - dd panels_OnKey.alt_f12 + dd panels_OnKey.alt_f1_2 dw 0x3C, 0x100 - dd panels_OnKey.alt_f12 + dd panels_OnKey.alt_f1_2 dw 0x58, 0 dd F12 dw 0x13, 0x10