kfar: clean code, mouse can change button focus in dialogs

opendial: remove old code

git-svn-id: svn://kolibrios.org@9014 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2021-07-06 20:44:16 +00:00
parent 678de81f24
commit 0994411664
6 changed files with 393 additions and 400 deletions

View File

@ -25,6 +25,7 @@ dlgtemplate:
.size = $
end virtual
align 16
GenericBox:
push [cursor_x]
push [cursor_y]
@ -49,7 +50,7 @@ GenericBox:
dec eax
jz .key
sub eax,4
jz .event ;todo: mouse
jz .mouse
jmp exit
.redraw:
call draw_window
@ -86,7 +87,7 @@ GenericBox:
push eax
push 2
push ebx
call ecx
call ecx ;DlgProc
test eax, eax
jz .event
mov [esp+28], eax
@ -139,6 +140,97 @@ GenericBox:
.ralt_up:
and [ctrlstate], not 0x20
jmp .event
align 4
.mouse:
mov eax,SF_MOUSE_GET
mov ebx,SSF_BUTTON_EXT
int 0x40
bt eax,8 ;left but. down
jnc .event
mov eax,SF_MOUSE_GET
mov ebx,SSF_WINDOW_POSITION
int 0x40
cmp ax, word[skinh]
jl .event
sub ax, word[skinh]
xor dx,dx
mov bx, font_height
div bx
movzx edx,ax
shr eax,16
sub eax, 5 ;window border
push edx
xor dx,dx
mov bx, font_width
div bx
movzx eax,ax
pop edx
mov ebx, [esp+24h+8] ;DLGTEMPLATE* dlg
cmp edx, [ebx+dlgtemplate.y]
jl .event
cmp eax, [ebx+dlgtemplate.x]
jl .event
sub edx, [ebx+dlgtemplate.y]
sub eax, [ebx+dlgtemplate.x]
cmp edx, [ebx+dlgtemplate.height]
jge .event
cmp eax, [ebx+dlgtemplate.width]
jge .event
add ebx, dlgtemplate.size+12
mov ecx, [ebx-4]
or ecx, ecx
jz .event
push ebx ecx
.m_loop:
cmp [ebx+dlgitemtemplate.type], 2 ;button
je .m_comp
cmp [ebx+dlgitemtemplate.type], 3 ;edit
je .m_comp
;cmp [ebx+dlgitemtemplate.type], 5 ;check
;je .m_comp
jmp .m_next
align 4
.m_comp:
cmp [ebx+dlgitemtemplate.x1], eax
jg .m_next
cmp [ebx+dlgitemtemplate.y1], edx
jg .m_next
cmp [ebx+dlgitemtemplate.x2], eax
jl .m_next
cmp [ebx+dlgitemtemplate.y2], edx
jl .m_next
mov eax, [ebx+dlgitemtemplate.flags]
and eax, 4
jnz .m_old_focus
mov eax, ebx
jmp .m_new_focus
align 4
.m_next:
add ebx, sizeof.DlgBtn
loop .m_loop
.m_old_focus:
pop ecx ebx
jmp .event
align 4
.m_new_focus:
pop ecx ebx
call DlgClearFocus
or dword[eax+dlgitemtemplate.flags], 4
sub ebx, dlgtemplate.size+12
push ebp
mov ebp, ebx
call ManagerDlgProc.dodraw
pop ebp
call draw_image
jmp .event
align 4
.exit:
popad
push eax
@ -153,7 +245,21 @@ GenericBox:
popad
ret 8
;input:
; ebx - pointer to first item
; ecx - count items
align 4
DlgClearFocus:
push ebx ecx
@@:
and byte [ebx+dlgitemtemplate.flags], not 4
add ebx, sizeof.DlgBtn
loop @b
pop ecx ebx
ret
; int __stdcall ShowGenericBox(DLGTEMPLATE* dlg, void* DlgProc);
align 16
ShowGenericBox:
pushad
mov ebx, [esp+20h+4]
@ -471,6 +577,7 @@ DrawGenericBox:
ret 8
; void __stdcall HideGenericBox(DLGTEMPLATE* dlg, int bRedrawWindow);
align 16
HideGenericBox:
; void __stdcall HideDialogBox(DLGDATA* dlg, int bRedrawWindow);
HideDialogBox:
@ -1104,6 +1211,65 @@ get_ascii_char:
movzx eax, byte [layout+eax]
ret
struct DlgLbl
type dd 1
x1 dd ?
y1 dd ?
x2 dd ?
y2 dd ?
text dd ?
flags dd ?
ends
struct DlgBtn
type dd 2
x1 dd ?
y1 dd ?
x2 dd ?
y2 dd ?
text dd ?
flags dd ?
ends
struct DlgEdit
type dd 3
x1 dd ?
y1 dd ?
x2 dd ?
y2 dd ?
text dd ?
flags dd ?
ends
struct DlgLine
type dd 4
x1 dd ?
y1 dd ?
x2 dd ?
y2 dd ?
dq 0
ends
struct DlgCheck
type dd 5
x1 dd ?
y1 dd ?
x2 dd ?
y2 dd ?
text dd ?
flags dd ?
ends
struct DlgList
type dd 6
x1 dd ?
y1 dd ?
x2 dd ?
y2 dd ?
text dd ?
flags dd ?
ends
virtual at 0
dlgitemtemplate:
; <EFBFBD>«¥¬¥­âë:
@ -1152,6 +1318,7 @@ end virtual
; DLGITEMTEMPLATE items[]; /* array of dialog items */
; }
; int __stdcall DialogBox(DLGDATA* dlg);
align 16
DialogBox:
push ManagerDlgProc
push dword [esp+8]
@ -1172,6 +1339,7 @@ DrawDialogBox:
call DrawGenericBox
ret 4
align 16
ManagerDlgProc:
mov ebp, ebx
mov eax, [esp+8]
@ -1399,6 +1567,7 @@ ManagerDlgProc:
inc dword [edx+4]
@@: jmp .ret_test
align 4
.dodraw:
or [cursor_x], -1
or [cursor_y], -1
@ -1432,6 +1601,7 @@ label draw_functions dword
draw_functions_num = ($ - draw_functions) / 4
endg
align 4
draw_static_text:
; à¨á㥬 áâ â¨ç¥áª¨© ⥪áâ
mov ah, [dialog_main_color]
@ -1533,6 +1703,7 @@ draw_text_esi:
.ret2:
ret
align 4
draw_button:
mov ecx, dialog_colors
test byte [ebp+dlgtemplate.flags], 2
@ -1546,6 +1717,7 @@ draw_button:
@@:
jmp draw_text
align 4
draw_editbox:
mov edx, [ebx+dlgitemtemplate.data]
test [ebx+dlgitemtemplate.flags], 4
@ -1574,6 +1746,7 @@ draw_editbox:
add esi, 12
jmp draw_text_esi
align 4
dlgitem_get_console_ptr:
mov eax, [ebx+dlgitemtemplate.x1]
mov edx, [ebx+dlgitemtemplate.y1]
@ -1582,6 +1755,7 @@ dlgitem_get_console_ptr:
add edx, [ebp+dlgtemplate.y]
jmp get_console_ptr
align 4
draw_h_separator:
; à¨á㥬 £®à¨§®­â «ì­ë© à §¤¥«¨â¥«ì
call dlgitem_get_console_ptr
@ -1603,6 +1777,7 @@ draw_h_separator:
.done:
ret
align 4
draw_checkbox:
; à¨á㥬 ä« ¦®ª
call dlgitem_get_console_ptr
@ -1644,6 +1819,7 @@ draw_checkbox:
.ret:
ret
align 4
draw_listbox:
; à¨á㥬 ᯨ᮪
call dlgitem_get_console_ptr
@ -1752,6 +1928,7 @@ draw_listbox:
.noscrollbar:
ret
align 4
listbox_key:
mov edx, [ebx+dlgitemtemplate.data]
cmp al, 0x48
@ -1914,6 +2091,7 @@ SayErrTitle:
; int __stdcall Message(const char* title,
; int num_strings, const char* strings[],
; int num_buttons, const char* buttons[]);
align 16
Message:
push 1
@@:

View File

@ -2220,11 +2220,11 @@ editor_OnKey:
cmp byte [ebx], al
jz .f7.ret
mov esi, tolower_table
test [find_in_file_dlgdata.flags_case], 10h
test [find_in_file_dlgdata.case.flags], 10h
jz @f
mov esi, identical_table
@@:
test [find_in_file_dlgdata.flags_whole], 10h
test [find_in_file_dlgdata.whole.flags], 10h
setnz al
push eax
push dword [ebp+editor_data.encoding]; always cp866 for now
@ -2239,7 +2239,7 @@ editor_OnKey:
push ebx esi
push edi
push edi
test [find_in_file_dlgdata.flags_whole], 10h
test [find_in_file_dlgdata.whole.flags], 10h
jnz @f
movzx eax, byte [esi+ebx]
jmp .search_loop_next
@ -2284,7 +2284,7 @@ editor_OnKey:
jc .f7.nonextblock
.f7.notfound_pop:
; last chance - if we are looking for a whole word, EOF is ok for last symbol
test [find_in_file_dlgdata.flags_whole], 10h
test [find_in_file_dlgdata.whole.flags], 10h
jz @f
mov esi, [ebp + editor_data.last_block]
add esi, ebp
@ -2300,7 +2300,7 @@ editor_OnKey:
or [ebp + editor_data.cur_delta], -1
sub ebx, ecx
inc ebx
test [find_in_file_dlgdata.flags_whole], 10h
test [find_in_file_dlgdata.whole.flags], 10h
jz @f
inc ebx
@@:
@ -2324,7 +2324,7 @@ editor_OnKey:
pop edi
; esi:ebx -> last symbol of match, eax = row, edi = delta in lines
pop esi ebx
test [find_in_file_dlgdata.flags_whole], 10h
test [find_in_file_dlgdata.whole.flags], 10h
jz @f
dec ecx
@@:
@ -2550,23 +2550,23 @@ find_in_file_dlg:
mov [ebx + dlgtemplate.width], eax
dec eax
dec eax
mov [ebx - find_in_file_dlgdata + find_in_file_dlgdata.width2], eax
mov [ebx + FindInFileDlgdata.efind.x2], eax
shr eax, 1
dec eax
dec eax
mov [ebx - find_in_file_dlgdata + find_in_file_dlgdata.search_x2], eax
mov [ebx + FindInFileDlgdata.search.x2], eax
sub eax, aSearchBLength-1
mov [ebx - find_in_file_dlgdata + find_in_file_dlgdata.search_x1], eax
mov [ebx + FindInFileDlgdata.search.x1], eax
add eax, aSearchBLength+3
mov [ebx - find_in_file_dlgdata + find_in_file_dlgdata.cnl_x1], eax
mov [ebx + FindInFileDlgdata.cnl.x1], eax
add eax, aCancelBLength - 1
mov [ebx - find_in_file_dlgdata + find_in_file_dlgdata.cnl_x2], eax
mov byte [ebx - find_in_file_dlgdata + find_in_file_dlgdata.flags0], 0xC
and byte [ebx - find_in_file_dlgdata + find_in_file_dlgdata.flags1], not 4
and byte [ebx - find_in_file_dlgdata + find_in_file_dlgdata.flags2], not 4
and byte [ebx - find_in_file_dlgdata + find_in_file_dlgdata.flags_case], not 4
and byte [ebx - find_in_file_dlgdata + find_in_file_dlgdata.flags_whole], not 4
mov [ebx + FindInFileDlgdata.cnl.x2], eax
mov byte [ebx + FindInFileDlgdata.efind.flags], 0xC
and byte [ebx + FindInFileDlgdata.search.flags], not 4
and byte [ebx + FindInFileDlgdata.cnl.flags], not 4
and byte [ebx + FindInFileDlgdata.case.flags], not 4
and byte [ebx + FindInFileDlgdata.whole.flags], not 4
push ebx
call DialogBox
cmp eax, find_in_file_dlgdata.search_btn
cmp eax, find_in_file_dlgdata.search
ret

View File

@ -977,8 +977,8 @@ filesearch_data:
.list.head dd ?
.list.curitem dd ?
.list.end dd ?
.query_dlgdata rb filesearch_query_template.size
.search_dlgdata rb filesearch_search_template.size
.query_dlgdata rb sizeof.FileSearch_QueryTemplate
.search_dlgdata rb sizeof.FileSearch_SearchTemplate
.mask.maxlen dd ?
.mask.pos dd ?
.mask.start dd ?
@ -1013,36 +1013,36 @@ panels_OnKey.alt_f7:
ret
@@:
mov [ebp+filesearch_data.prev_screen_vtable], panels_vtable
mov ecx, (filesearch_query_template.size + filesearch_search_template.size) / 4
mov ecx, (sizeof.FileSearch_QueryTemplate + sizeof.FileSearch_SearchTemplate) / 4
mov esi, filesearch_query_template
lea edi, [ebp+filesearch_data.query_dlgdata]
rep movsd
lea eax, [ebp+filesearch_data.string.maxlen]
xor ebx, ebx
mov dword [ebp+filesearch_data.query_dlgdata+filesearch_query_template.editptr2-filesearch_query_template], eax
mov dword [ebp+filesearch_data.query_dlgdata+FileSearch_QueryTemplate.edit2.text], eax
mov dword [eax], 253
mov [eax+4], ebx
mov [eax+8], ebx
mov [eax+12], bl
sub eax, filesearch_data.string - filesearch_data.mask
mov dword [ebp+filesearch_data.query_dlgdata+filesearch_query_template.editptr1-filesearch_query_template], eax
mov dword [ebp+filesearch_data.query_dlgdata+FileSearch_QueryTemplate.edit1.text], eax
mov dword [eax], 511
mov [eax+8], ebx
inc ebx
mov word [eax+12], '*'
mov [eax+4], ebx
mov eax, [find_in_file_dlgdata.flags_case]
mov eax, [find_in_file_dlgdata.case.flags]
and al, 10h
or al, 8
mov dword [ebp+filesearch_data.query_dlgdata+filesearch_query_template.flags_case-filesearch_query_template], eax
mov eax, [find_in_file_dlgdata.flags_whole]
mov dword [ebp+filesearch_data.query_dlgdata+FileSearch_QueryTemplate.case.flags], eax
mov eax, [find_in_file_dlgdata.whole.flags]
and al, 10h
or al, 8
mov dword [ebp+filesearch_data.query_dlgdata+filesearch_query_template.flags_whole-filesearch_query_template], eax
mov dword [ebp+filesearch_data.query_dlgdata+FileSearch_QueryTemplate.whole.flags], eax
lea edi, [ebp+filesearch_data.caption]
mov dword [ebp+dlgtemplate.title+filesearch_data.search_dlgdata], edi
lea eax, [ebp+filesearch_data.list.curitemptr]
mov dword [ebp+filesearch_data.search_dlgdata+filesearch_search_template.data1-filesearch_search_template], eax
mov dword [ebp+filesearch_data.search_dlgdata+FileSearch_SearchTemplate.list1.text], eax
.reinit:
xor ebx, ebx
or [ebp+filesearch_data.tid], -1
@ -1081,18 +1081,18 @@ filesearch_OnRedraw:
mov [ebx + dlgtemplate.width], eax
dec eax
dec eax
mov [ebx - filesearch_query_template + filesearch_query_template.width2], eax
mov [ebx - filesearch_query_template + filesearch_query_template.width3], eax
mov [ebx + FileSearch_QueryTemplate.edit1.x2], eax
mov [ebx + FileSearch_QueryTemplate.edit2.x2], eax
shr eax, 1
dec eax
dec eax
mov [ebx - filesearch_query_template + filesearch_query_template.search_x2], eax
mov [ebx + FileSearch_QueryTemplate.search.x2], eax
sub eax, aSearchBLength-1
mov [ebx - filesearch_query_template + filesearch_query_template.search_x1], eax
mov [ebx + FileSearch_QueryTemplate.search.x1], eax
add eax, aSearchBLength+3
mov [ebx - filesearch_query_template + filesearch_query_template.cnl_x1], eax
mov [ebx + FileSearch_QueryTemplate.cnl.x1], eax
add eax, aCancelBLength-1
mov [ebx - filesearch_query_template + filesearch_query_template.cnl_x2], eax
mov [ebx + FileSearch_QueryTemplate.cnl.x2], eax
mov eax, [cur_height]
sub eax, [ebx + dlgtemplate.height]
shr eax, 1
@ -1121,11 +1121,11 @@ filesearch_OnRedraw:
shr edx, 1
mov [ebx + dlgtemplate.x], edx
dec eax
mov [ebx + filesearch_search_template.width1 - filesearch_search_template], eax
mov [ebx + filesearch_search_template.width4 - filesearch_search_template], eax
mov [ebx + FileSearch_SearchTemplate.list1.x2], eax
mov [ebx + FileSearch_SearchTemplate.lbl2.x2], eax
cmp [ebp + filesearch_data.slot], 0
jnz @f
mov [ebx + filesearch_search_template.width3 - filesearch_search_template], eax
mov [ebx + FileSearch_SearchTemplate.lbl1.x2], eax
@@:
sub eax, aNewSearchLen + aGotoLen + aViewLen + aCancelB2Length - 1
cdq
@ -1135,21 +1135,21 @@ filesearch_OnRedraw:
sar edx, 1
add edx, eax
inc eax
mov [ebx + filesearch_search_template.btn1x1 - filesearch_search_template], edx
mov [ebx + FileSearch_SearchTemplate.btn1.x1], edx
add edx, aNewSearchLen-1
mov [ebx + filesearch_search_template.btn1x2 - filesearch_search_template], edx
mov [ebx + FileSearch_SearchTemplate.btn1.x2], edx
add edx, eax
mov [ebx + filesearch_search_template.btn2x1 - filesearch_search_template], edx
mov [ebx + FileSearch_SearchTemplate.btn2.x1], edx
add edx, aGotoLen-1
mov [ebx + filesearch_search_template.btn2x2 - filesearch_search_template], edx
mov [ebx + FileSearch_SearchTemplate.btn2.x2], edx
add edx, eax
mov [ebx + filesearch_search_template.btn3x1 - filesearch_search_template], edx
mov [ebx + FileSearch_SearchTemplate.btn3.x1], edx
add edx, aViewLen-1
mov [ebx + filesearch_search_template.btn3x2 - filesearch_search_template], edx
mov [ebx + FileSearch_SearchTemplate.btn3.x2], edx
add edx, eax
mov [ebx + filesearch_search_template.btn4x1 - filesearch_search_template], edx
mov [ebx + FileSearch_SearchTemplate.btn4.x1], edx
add edx, aCancelB2Length-1
mov [ebx + filesearch_search_template.btn4x2 - filesearch_search_template], edx
mov [ebx + FileSearch_SearchTemplate.btn4.x2], edx
mov eax, [cur_height]
mov edx, eax
sub eax, 8
@ -1162,19 +1162,19 @@ filesearch_OnRedraw:
shr edx, 1
mov [ebx + dlgtemplate.y], edx
dec eax
mov [ebx + filesearch_search_template.btn1y - filesearch_search_template], eax
mov [ebx + filesearch_search_template.btn2y - filesearch_search_template], eax
mov [ebx + filesearch_search_template.btn3y - filesearch_search_template], eax
mov [ebx + filesearch_search_template.btn4y - filesearch_search_template], eax
mov [ebx + FileSearch_SearchTemplate.btn1.y1], eax
mov [ebx + FileSearch_SearchTemplate.btn2.y1], eax
mov [ebx + FileSearch_SearchTemplate.btn3.y1], eax
mov [ebx + FileSearch_SearchTemplate.btn4.y1], eax
dec eax
mov [ebx + filesearch_search_template.y5 - filesearch_search_template], eax
mov [ebx + FileSearch_SearchTemplate.lin2.y1], eax
dec eax
mov [ebx + filesearch_search_template.y3 - filesearch_search_template], eax
mov [ebx + filesearch_search_template.y4 - filesearch_search_template], eax
mov [ebx + FileSearch_SearchTemplate.lbl1.y1], eax
mov [ebx + FileSearch_SearchTemplate.lbl2.y1], eax
dec eax
mov [ebx + filesearch_search_template.y2 - filesearch_search_template], eax
mov [ebx + FileSearch_SearchTemplate.lin1.y1], eax
dec eax
mov [ebx + filesearch_search_template.height1 - filesearch_search_template], eax
mov [ebx + FileSearch_SearchTemplate.list1.y2], eax
.dlg_prepared:
call draw_dialog_shadow
push ebx
@ -1267,13 +1267,13 @@ filesearch_OnKey:
cmp eax, -1
jz .esc
sub eax, ebp
cmp eax, filesearch_data.query_dlgdata+filesearch_query_template.search_btn-filesearch_query_template
cmp eax, filesearch_data.query_dlgdata+FileSearch_QueryTemplate.search
jz .query
cmp eax, filesearch_data.search_dlgdata+filesearch_search_template.btn1-filesearch_search_template
cmp eax, filesearch_data.search_dlgdata+FileSearch_SearchTemplate.btn1
jz .newsearch
cmp eax, filesearch_data.search_dlgdata+filesearch_search_template.btn2-filesearch_search_template
cmp eax, filesearch_data.search_dlgdata+FileSearch_SearchTemplate.btn2
jz .goto
cmp eax, filesearch_data.search_dlgdata+filesearch_search_template.btn3-filesearch_search_template
cmp eax, filesearch_data.search_dlgdata+FileSearch_SearchTemplate.btn3
jz .view
.esc:
cmp dword [ebp+filesearch_data.slot], 0
@ -1417,7 +1417,7 @@ filesearch_OnKey:
test al, al
jnz @b
lea edi, [ebp+filesearch_data.statusstr]
mov dword [ebp+filesearch_data.search_dlgdata+filesearch_search_template.data3-filesearch_search_template], edi
mov dword [ebp+filesearch_data.search_dlgdata+FileSearch_SearchTemplate.lbl1.text], edi
mov esi, aSearchingIn
@@:
lodsb
@ -1451,12 +1451,12 @@ filesearch_OnKey:
stosb
test al, al
jnz @b
sub edi, dword [ebp+filesearch_data.search_dlgdata+filesearch_search_template.data3-filesearch_search_template]
mov dword [ebp+filesearch_data.search_dlgdata+filesearch_search_template.width3-filesearch_search_template], edi
sub edi, dword [ebp +filesearch_data.search_dlgdata +FileSearch_SearchTemplate.lbl1.text]
mov dword [ebp+filesearch_data.search_dlgdata+FileSearch_SearchTemplate.lbl1.x2], edi
inc edi
mov dword [ebp+filesearch_data.search_dlgdata+filesearch_search_template.x4-filesearch_search_template], edi
mov dword [ebp+filesearch_data.search_dlgdata+FileSearch_SearchTemplate.lbl2.x1], edi
lea eax, [ebp+filesearch_data.curdir]
mov dword [ebp+filesearch_data.search_dlgdata+filesearch_search_template.data4-filesearch_search_template], eax
mov dword [ebp+filesearch_data.search_dlgdata+FileSearch_SearchTemplate.lbl2.text], eax
call filesearch_set_dlgflags ; use it? I think, yes
cmp [ebp+filesearch_data.slot], 0
jnz @f
@ -1469,8 +1469,8 @@ filesearch_done:
jnz @f
or [idle_interval], -1
@@:
and dword [ebp+filesearch_data.search_dlgdata+filesearch_search_template.data4-filesearch_search_template], 0
mov edi, dword [ebp+filesearch_data.search_dlgdata+filesearch_search_template.data3-filesearch_search_template]
and dword [ebp+filesearch_data.search_dlgdata+FileSearch_SearchTemplate.lbl2.text], 0
mov edi, dword [ebp+filesearch_data.search_dlgdata+FileSearch_SearchTemplate.lbl1.text]
mov esi, aSearchDone
@@:
lodsb
@ -1560,14 +1560,14 @@ filesearch_IsHandleUsed:
ret
filesearch_set_dlgflags:
mov eax, dword [ebp+filesearch_data.query_dlgdata+filesearch_query_template.flags_case-filesearch_query_template]
mov eax, dword [ebp+filesearch_data.query_dlgdata+FileSearch_QueryTemplate.case.flags]
and al, 10h
or al, 8
mov [find_in_file_dlgdata.flags_case], eax
mov eax, dword [ebp+filesearch_data.query_dlgdata+filesearch_query_template.flags_whole-filesearch_query_template]
mov [find_in_file_dlgdata.case.flags], eax
mov eax, dword [ebp+filesearch_data.query_dlgdata+FileSearch_QueryTemplate.whole.flags]
and al, 10h
or al, 8
mov [find_in_file_dlgdata.flags_whole], eax
mov [find_in_file_dlgdata.whole.flags], eax
lea esi, [ebp+filesearch_data.string]
mov edi, SearchString
and dword [edi-4], 0
@ -1608,11 +1608,11 @@ filesearch_thread:
cmp byte [ebx], dl
jz .noprepare
mov esi, tolower_table
test byte [ebp+filesearch_data.query_dlgdata+filesearch_query_template.flags_case-filesearch_query_template], 10h
test byte [ebp+filesearch_data.query_dlgdata+FileSearch_QueryTemplate.case.flags], 10h
jz @f
mov esi, identical_table
@@:
test byte [ebp+filesearch_data.query_dlgdata+filesearch_query_template.flags_whole-filesearch_query_template], 10h
test byte [ebp+filesearch_data.query_dlgdata+FileSearch_QueryTemplate.whole.flags], 10h
setnz al
push eax
push ecx ; force cp866
@ -1880,7 +1880,7 @@ filesearch_test_file:
mov [ebx+8], eax
mov dword [ebx+12], search_filebuf_size
mov edi, edx
test byte [ebp+filesearch_data.query_dlgdata+filesearch_query_template.flags_whole-filesearch_query_template], 10h
test byte [ebp+filesearch_data.query_dlgdata+FileSearch_QueryTemplate.whole.flags], 10h
jz .loop
add edi, 256
.loop:
@ -1949,7 +1949,7 @@ filesearch_test_file:
cmp ebx, search_filebuf_size
jz .loop
; EOF, last chance for whole-words-only search
test byte [ebp+filesearch_data.query_dlgdata+filesearch_query_template.flags_whole-filesearch_query_template], 10h
test byte [ebp+filesearch_data.query_dlgdata+FileSearch_QueryTemplate.whole.flags], 10h
jz .ret_failed
movzx edi, byte [edi+' ']
cmp edi, ecx

View File

@ -61,6 +61,7 @@ ends
cursor_normal_size = (font_height*15+50)/100
cursor_big_size = font_height
align 4
start:
mov eax,SF_SET_EVENTS_MASK
mov ebx,(11b shl 30) or 100111b
@ -813,9 +814,9 @@ key:
align 16
mouse:
cmp dword[active_screen],0
jg event
mov eax,SF_MOUSE_GET
cmp dword[active_screen],0
jg event
mov eax,SF_MOUSE_GET
mov ebx,SSF_BUTTON_EXT
int 0x40
bt eax,8 ;left but. down
@ -849,34 +850,34 @@ mouse:
mov ecx, [cur_width]
if font_width & 3
imul ecx, font_width
shr ecx, 2
shr ecx, 2
else
imul ecx, font_width/4
end if
xor dx,dx
sub ax, 5 ;window border
div cx
bt ax, 0
jnc @f
add [esp+4], ebx ;¥á«¨ 2-© á⮫¡¥æ
xor dx,dx
sub ax, 5 ;window border
div cx
bt ax, 0
jnc @f
add [esp+4], ebx ;¥á«¨ 2-© á⮫¡¥æ
@@:
pop eax ;edx in stack
jmp @f
pop eax ;edx in stack
jmp @f
.no_ch_pos:
push -1 ;edx = -1 - no change position
push -1 ;edx = -1 - no change position
@@:
mov ebx, [cur_width]
imul ebx, font_width/2
add ebx, 5 ;window border
cmp eax,ebx
jg @f
cmp [active_panel], panel1
je .move
jmp .tab
add ebx, 5 ;window border
cmp eax,ebx
jg @f
cmp [active_panel], panel1
je .move
jmp .tab
@@:
cmp [active_panel], panel2
je .move
cmp [active_panel], panel2
je .move
.tab:
xor [active_panel], panel1 xor panel2
call draw_cmdbar
@ -885,45 +886,45 @@ end if
call draw_panel
.move:
mov ebp, [active_panel]
pop edx
mov eax, [ebp + PanelData.numfiles]
add edx, [ebp + PanelData.start] ;ç¨á«® ¯à®ªàã祭ëå ä ©«®¢
dec eax
cmp edx, eax
jle @f
mov edx, eax
pop edx
mov eax, [ebp + PanelData.numfiles]
add edx, [ebp + PanelData.start] ;ç¨á«® ¯à®ªàã祭ëå ä ©«®¢
dec eax
cmp edx, eax
jle @f
mov edx, eax
@@:
cmp edx, 0
jl @f
mov [ebp + PanelData.index], edx
jl @f
mov [ebp + PanelData.index], edx
@@:
call draw_panel
call draw_panel
jmp event
.on_panel:
call get_keybar_ind
lea eax, [panels_mouse+4*eax]
cmp dword[eax], 0
je event
lea eax, [panels_mouse+4*eax]
cmp dword[eax], 0
je event
mov ebp, [active_panel]
mov ecx, [ebp + PanelData.index]
call dword[eax]
call dword[eax]
@@:
jmp event
jmp event
;input:
; eax - coord x
;output:
; eax - key bar index (0 to 35) if press F1 index = 0
; eax - key bar index (0 to 95) if press F1 index = 0
align 16
get_keybar_ind:
push ebx ecx edx esi edi
xor edx, edx
mov ebx, font_width
sub eax, 5 ;border
div ebx
mov edi, eax
mov ebx, font_width
sub eax, 5 ;border
div ebx
mov edi, eax
xor esi, esi
xor esi, esi
test [ctrlstate], 3
jz @f
inc esi
@ -2533,6 +2534,7 @@ else
@@:
end if
jmp .f5_selected1
.f5_noselected1:
mov al, '"'
stosb
@ -2577,24 +2579,24 @@ end if
mov [ebx + dlgtemplate.width], eax
dec eax
dec eax
mov [ebx - copy_dlgdata + copy_dlgdata.width2], eax
mov [ebx - copy_dlgdata + copy_dlgdata.width3], eax
mov [ebx - copy_dlgdata + copy_dlgdata.lcopy.x2], eax
mov [ebx - copy_dlgdata + copy_dlgdata.ename.x2], eax
shr eax, 1
dec eax
dec eax
mov [ebx - copy_dlgdata + copy_dlgdata.copy_x2], eax
mov [ebx - copy_dlgdata + copy_dlgdata.copy.x2], eax
sub eax, aCopyLength-1
mov [ebx - copy_dlgdata + copy_dlgdata.copy_x1], eax
mov [ebx - copy_dlgdata + copy_dlgdata.copy.x1], eax
add eax, aCopyLength+3
mov [ebx - copy_dlgdata + copy_dlgdata.cnl_x1], eax
mov [ebx - copy_dlgdata + copy_dlgdata.cnl.x1], eax
add eax, aCancelBLength - 1
mov [ebx - copy_dlgdata + copy_dlgdata.cnl_x2], eax
mov byte [ebx - copy_dlgdata + copy_dlgdata.flags0], 0xC
and byte [ebx - copy_dlgdata + copy_dlgdata.flags1], not 4
and byte [ebx - copy_dlgdata + copy_dlgdata.flags2], not 4
mov [ebx - copy_dlgdata + copy_dlgdata.cnl.x2], eax
mov byte [ebx - copy_dlgdata + copy_dlgdata.ename.flags], 0xC
and byte [ebx - copy_dlgdata + copy_dlgdata.copy.flags], not 4
and byte [ebx - copy_dlgdata + copy_dlgdata.cnl.flags], not 4
push ebx
call DialogBox
cmp eax, copy_dlgdata.copy_btn
cmp eax, copy_dlgdata.copy
jnz .ret2
; Š®¯¨à㥬
mov esi, CopyDestEditBuf+12
@ -3257,23 +3259,23 @@ end if
mov [ebx + dlgtemplate.width], eax
dec eax
dec eax
mov [ebx - mkdir_dlgdata + mkdir_dlgdata.width2], eax
mov [ebx + MkDir_Dlgdata.dnam.x2], eax
shr eax, 1
dec eax
dec eax
mov [ebx - mkdir_dlgdata + mkdir_dlgdata.cont_x2], eax
mov [ebx + MkDir_Dlgdata.cont.x2], eax
sub eax, a_ContinueLength-1
mov [ebx - mkdir_dlgdata + mkdir_dlgdata.cont_x1], eax
mov [ebx + MkDir_Dlgdata.cont.x1], eax
add eax, a_ContinueLength+3
mov [ebx - mkdir_dlgdata + mkdir_dlgdata.cnl_x1], eax
mov [ebx + MkDir_Dlgdata.cnl.x1], eax
add eax, aCancelBLength - 1
mov [ebx - mkdir_dlgdata + mkdir_dlgdata.cnl_x2], eax
mov byte [ebx - mkdir_dlgdata + mkdir_dlgdata.flags0], 0xC
and byte [ebx - mkdir_dlgdata + mkdir_dlgdata.flags1], not 4
and byte [ebx - mkdir_dlgdata + mkdir_dlgdata.flags2], not 4
mov [ebx + MkDir_Dlgdata.cnl.x2], eax
mov byte [ebx + MkDir_Dlgdata.dnam.flags], 0xC
and byte [ebx + MkDir_Dlgdata.cont.flags], not 4
and byte [ebx + MkDir_Dlgdata.cnl.flags], not 4
push ebx
call DialogBox
cmp eax, mkdir_dlgdata.cont_btn
cmp eax, mkdir_dlgdata.cont
jnz .ret2
mov esi, CopyDestEditBuf+12
cmp byte [esi], 0
@ -3364,7 +3366,7 @@ end if
@@:
mov eax, mark_dlgdata
mov [eax+mark_dlgdata.title-mark_dlgdata], ecx
mov [eax+mark_dlgdata.flags-mark_dlgdata], 0xC
mov [eax+mark_dlgdata.edit.flags-mark_dlgdata], 0xC
mov edi, enter_string_buf+12
mov dword [edi-12], 512
mov dword [edi-8], 1
@ -3941,6 +3943,7 @@ draw_image.nomem:
int 40h
ret
align 16
draw_image:
mov [bMemForImageValidData], byte 1
cmp [MemForImage], 0
@ -7946,15 +7949,9 @@ nomem_dlgdata:
dd 0
dd 2
; áâப  "No memory"
dd 1
dd 1,0,10,0
dd aNoMemory
dd 1
DlgLbl ,1,0,10,0,aNoMemory,1
; ª­®¯ª  "Ok"
dd 2
dd 4,1,7,1
dd aOk
dd 0xD
DlgBtn ,4,1,7,1,aOk,0xD
; ¤¨ «®£ ª®¯¨à®¢ ­¨ï
copy_dlgdata:
@ -7975,42 +7972,19 @@ copy_dlgdata:
dd 0
dd 4
; áâப  'Š®¯¨à®¢ âì "%s" ¢:'
dd 1
dd 1,0
.width2 dd ?
dd 0
dd CopySourceTextBuf
dd 0
.lcopy DlgLbl ,1,0,,0,CopySourceTextBuf,0
; ¯®«¥ । ªâ¨à®¢ ­¨ï á ¨¬¥­¥¬ ä ©« /¯ ¯ª¨ ­ §­ ç¥­¨ï
dd 3
dd 1,1
.width3 dd ?
dd 1
dd CopyDestEditBuf
.flags0 dd 0
.ename DlgEdit ,1,1,,1,CopyDestEditBuf,0
; ª­®¯ª  "ª®¯¨à®¢ âì"
.copy_btn:
dd 2
.copy_x1 dd ?
dd 3
.copy_x2 dd ?
dd 3
dd aCopy
.flags1 dd 18h
.copy DlgBtn ,,3,,3,aCopy,18h
; ª­®¯ª  "®â¬¥­¨âì"
dd 2
.cnl_x1 dd ?
dd 3
.cnl_x2 dd ?
dd 3
dd aCancelB
.flags2 dd 8
.cnl DlgBtn ,,3,,3,aCancelB,8
mkdir_dlgdata:
struct MkDir_Dlgdata
dd 1
dd -1, -1
.width dd ?
.height dd 4
width dd ?
height dd 4
dd 4, 2
dd aMkDirCaption
dd ?, ?
@ -8018,34 +7992,16 @@ mkdir_dlgdata:
dd 0
dd 4
; ‘âப  "‘®§¤ âì ¯ ¯ªã"
dd 1
dd 1,0,aMkDirLen,0
dd aMkDir
dd 0
DlgLbl ,1,0,aMkDirLen,0,aMkDir,0
; ¯®«¥ । ªâ¨à®¢ ­¨ï á ¨¬¥­¥¬ ᮧ¤ ¢ ¥¬®© ¯ ¯ª¨
dd 3
dd 1,1
.width2 dd ?
dd 1
dd CopyDestEditBuf
.flags0 dd 0xC
dnam DlgEdit ,1,1,,1,CopyDestEditBuf,0xC
; ª­®¯ª  "<22>த®«¦¨âì"
.cont_btn:
dd 2
.cont_x1 dd ?
dd 3
.cont_x2 dd ?
dd 3
dd a_Continue
.flags1 dd 18h
cont DlgBtn ,,3,,3,a_Continue,18h
; ª­®¯ª  "®â¬¥­¨âì"
dd 2
.cnl_x1 dd ?
dd 3
.cnl_x2 dd ?
dd 3
dd aCancelB
.flags2 dd 8
cnl DlgBtn ,,3,,3,aCancelB,8
ends
mkdir_dlgdata MkDir_Dlgdata
; ¤¨ «®£ ¢ë¤¥«¥­¨ï/á­ïâ¨ï
mark_dlgdata:
@ -8058,10 +8014,7 @@ mark_dlgdata:
dd 0, 0
dd 1
; ¯®«¥ । ªâ¨à®¢ ­¨ï
dd 3
dd 1, 0, 35, 0
dd enter_string_buf
.flags dd ?
.edit DlgEdit ,1, 0, 35, 0, enter_string_buf,
; ¤¨ «®£ ¡ëáâண® ¯®¨áª  ¢ ¯ ­¥«¨ (Alt+¡ãª¢ë)
QuickSearchDlg:
@ -8075,84 +8028,47 @@ QuickSearchDlg:
dd 0, 0
dd 1
; ¯®«¥ । ªâ¨à®¢ ­¨ï
dd 3
dd 1, 0, 18, 0
dd quick_search_buf
dd 1Ch
DlgEdit ,1, 0, 18, 0, quick_search_buf, 1Ch
; ¤¨ «®£ ¯®¨áª  ¢ ä ©«¥ ¤«ï ¯à®á¬®âà騪  ¨ । ªâ®à 
find_in_file_dlgdata:
struct FindInFileDlgdata
dd 1
.x dd -1
.y dd -1
.width dd ?
.height dd 7
x dd -1
y dd -1
width dd ?
height dd 7
dd 4, 2
dd aSearch
dd ?, ?
dd 0, 0
dd 8
; ‘âப  "ˆáª âì"
dd 1
dd 1,0,aSearchForLen,0
dd aSearchFor
dd 0
DlgLbl ,1,0,aSearchForLen,0,aSearchFor,0
; ¯®«¥ । ªâ¨à®¢ ­¨ï á ⥪á⮬ ¤«ï ¯®¨áª 
dd 3
dd 1,1
.width2 dd ?
dd 1
dd SearchStringEditBuf
.flags0 dd 0xC
efind DlgEdit ,1,1,,1,SearchStringEditBuf,0xC
; £®à¨§®­â «ì­ë© à §¤¥«¨â¥«ì
dd 4
dd -1,2
dd -1,2
dd 0
dd 0
DlgLine ,-1,2,-1,2
; ä« ¦®ª "“ç¨â뢠âì ॣ¨áâà"
dd 5
dd 1,3
dd -1,3
dd aCaseSensitive
.flags_case dd 18h ; default: search is case sensitive
case DlgCheck,1,3,-1,3,aCaseSensitive,18h ; default: search is case sensitive
; ä« ¦®ª "’®«ìª® æ¥«ë¥ á«®¢ "
dd 5
dd 1,4
dd -1,4
dd aWholeWords
.flags_whole dd 8 ; default: do NOT search whole words only
whole DlgCheck,1,4,-1,4,aWholeWords,8 ; default: do NOT search whole words only
; £®à¨§®­â «ì­ë© à §¤¥«¨â¥«ì
dd 4
dd -1,5
dd -1,5
dd 0
dd 0
DlgLine ,-1,5,-1,5
; ª­®¯ª  "ˆáª âì"
.search_btn:
dd 2
.search_x1 dd ?
dd 6
.search_x2 dd ?
dd 6
dd aSearchB
.flags1 dd 18h
search DlgBtn ,,6,,6,aSearchB,18h
; ª­®¯ª  "®â¬¥­¨âì"
dd 2
.cnl_x1 dd ?
dd 6
.cnl_x2 dd ?
dd 6
dd aCancelB
.flags2 dd 8
cnl DlgBtn ,,6,,6,aCancelB,8
ends
find_in_file_dlgdata FindInFileDlgdata
; ¯¥à¢ë© ¤¨ «®£ ¯®¨áª  ¢ ä ©« å (§ ¯à®á)
filesearch_query_template:
struct FileSearch_QueryTemplate
dd 1
.x dd ?
.y dd ?
.width dd ?
.height dd 9
x dd ?
y dd ?
width dd ?
height dd 9
dd 4, 2
dd aFileSearch
dd ?
@ -8160,156 +8076,60 @@ filesearch_query_template:
dd 0, 0
dd 10
; áâப -¯à¨£« è¥­¨¥ ¤«ï ¢¢®¤  ¬ áª¨
dd 1
dd 1,0,aFileMasksLen,0
dd aFileMasks
dd 0
DlgLbl ,1,0,aFileMasksLen,0,aFileMasks,0
; ¯®«¥ ¢¢®¤  ¤«ï ¬ áª¨
dd 3
dd 1, 1
.width2 dd ?
dd 1
.editptr1 dd ?
dd 0xC
edit1 DlgEdit ,1,1,,1,,0xC
; áâப -¯à¨£« è¥­¨¥ ¤«ï ⥪áâ  ¯®¨áª 
dd 1
dd 1,2,aContainingTextLen,2
dd aContainingText
dd 0
DlgLbl ,1,2,aContainingTextLen,2,aContainingText,0
; ¯®«¥ ¢¢®¤  ¤«ï ⥪áâ  ¯®¨áª 
dd 3
dd 1, 3
.width3 dd ?
dd 3
.editptr2 dd ?
dd 8
edit2 DlgEdit ,1,3,,3,,8
; £®à¨§®­â «ì­ë© à §¤¥«¨â¥«ì
dd 4
dd -1,4
dd -1,4
dd 0
dd 0
DlgLine ,-1,4,-1,4
; ä« ¦®ª "“ç¨â뢠âì ॣ¨áâà"
dd 5
dd 1,5
dd -1,5
dd aCaseSensitive
.flags_case dd ? ; will be initialized from find_in_file_dlgdata
case DlgCheck,1,5,-1,5,aCaseSensitive, ; will be initialized from find_in_file_dlgdata
; ä« ¦®ª "’®«ìª® æ¥«ë¥ á«®¢ "
dd 5
dd 1,6
dd -1,6
dd aWholeWords
.flags_whole dd ? ; will be initialized from find_in_file_dlgdata
whole DlgCheck,1,6,-1,6,aWholeWords, ; will be initialized from find_in_file_dlgdata
; £®à¨§®­â «ì­ë© à §¤¥«¨â¥«ì
dd 4
dd -1,7
dd -1,7
dd 0
dd 0
DlgLine ,-1,7,-1,7
; ª­®¯ª  "ˆáª âì"
.search_btn:
dd 2
.search_x1 dd ?
dd 8
.search_x2 dd ?
dd 8
dd aSearchB
dd 18h
search DlgBtn ,,8,,8,aSearchB,18h
; ª­®¯ª  "®â¬¥­¨âì"
dd 2
.cnl_x1 dd ?
dd 8
.cnl_x2 dd ?
dd 8
dd aCancelB
dd 8
.size = $ - filesearch_query_template
cnl DlgBtn ,,8,,8,aCancelB,8
ends
filesearch_query_template FileSearch_QueryTemplate
; ¢â®à®© ¤¨ «®£ ¯®¨áª  ¢ ä ©« å (᪠­¨à®¢ ­¨¥)
filesearch_search_template:
struct FileSearch_SearchTemplate
dd 1
.x dd ?
.y dd ?
.width dd ?
.height dd ?
x dd ?
y dd ?
width dd ?
height dd ?
dd 4, 2
.caption dd ?
caption dd ?
dd ?
dd 0
dd 0, 0
dd 9
; ᯨ᮪ ­ ©¤¥­­ëå ä ©«®¢
dd 6
dd 0, 0
.width1 dd ?
.height1 dd ?
.data1 dd ?
dd 0
list1 DlgList ,0,0,,,,0
; £®à¨§®­â «ì­ë© à §¤¥«¨â¥«ì
dd 4
dd -1
.y2 dd ?
dd -1
dd ?
dd 0, 0
lin1 DlgLine ,-1,,-1,
; áâப  "<22>®¨áª <string> ¢:" «¨¡® "<22>®¨áª § ª®­ç¥­..."
dd 1
dd 1
.y3 dd ?
.width3 dd ?
dd ?
.data3 dd ?
dd 0
lbl1 DlgLbl ,1
; áâப  á ⥪ã饩 ¯ ¯ª®©
dd 1
.x4 dd ?
.y4 dd ?
.width4 dd ?
dd ?
.data4 dd ?
dd 0
lbl2 DlgLbl
; £®à¨§®­â «ì­ë© à §¤¥«¨â¥«ì
dd 4
dd -1
.y5 dd ?
dd -1
dd ?
dd 0, 0
lin2 DlgLine ,-1,,-1,
; ª­®¯ª¨
.btn1:
dd 2
.btn1x1 dd ?
.btn1y dd ?
.btn1x2 dd ?
dd ?
dd aNewSearch
dd 8
.btn2:
dd 2
.btn2x1 dd ?
.btn2y dd ?
.btn2x2 dd ?
dd ?
dd aGoto
dd 1Ch
.btn3:
dd 2
.btn3x1 dd ?
.btn3y dd ?
.btn3x2 dd ?
dd ?
dd aView
dd 8
.btn4:
dd 2
.btn4x1 dd ?
.btn4y dd ?
.btn4x2 dd ?
dd ?
dd aCancelB2
dd 8
.size = $ - filesearch_search_template
btn1 DlgBtn ,,,,,aNewSearch,8
btn2 DlgBtn ,,,,,aGoto,1Ch
btn3 DlgBtn ,,,,,aView,8
btn4 DlgBtn ,,,,,aCancelB2,8
ends
filesearch_search_template FileSearch_SearchTemplate
RetryOrCancelBtn:
dd aRetry

View File

@ -1657,12 +1657,12 @@ viewer_OnKey:
call viewer_seek
call viewer_skip_unicode_marker
mov esi, tolower_table
test [find_in_file_dlgdata.flags_case], 10h
test [find_in_file_dlgdata.case.flags], 10h
jz @f
mov esi, identical_table
@@:
mov ebx, SearchString
test [find_in_file_dlgdata.flags_whole], 10h
test [find_in_file_dlgdata.whole.flags], 10h
setnz al
push eax
push dword [ebp+viewer_data.encoding]
@ -1684,7 +1684,7 @@ viewer_OnKey:
lea ebx, [ebp+viewer_data.buf]
add ebx, [ebp+viewer_data.buf_size]
@@:
test [find_in_file_dlgdata.flags_whole], 10h
test [find_in_file_dlgdata.whole.flags], 10h
jz .search_loop
cmp dword [ebp+viewer_data.buf_start], 0
jnz @f
@ -1732,7 +1732,7 @@ viewer_OnKey:
jmp .search_loop
.f7.notfoundt:
; last chance - if we are looking for a whole word, EOF is ok for last symbol
test [find_in_file_dlgdata.flags_whole], 10h
test [find_in_file_dlgdata.whole.flags], 10h
jz .f7.notfound
movzx edi, byte [edi+' ']
inc esi
@ -1759,7 +1759,7 @@ viewer_OnKey:
jnz @f
inc edx
@@:
test [find_in_file_dlgdata.flags_whole], 10h
test [find_in_file_dlgdata.whole.flags], 10h
jz @f
sub dword [ebp+viewer_data.selected_len], 2
sbb dword [ebp+viewer_data.selected_len+4], 0

View File

@ -658,7 +658,7 @@ endp
;output:
; eax - number
align 4
proc conv_str_to_int uses ebx ecx esi, buf:dword
proc conv_str_to_int uses ebx esi, buf:dword
xor eax,eax
xor ebx,ebx
mov esi,[buf]
@ -690,11 +690,6 @@ proc conv_str_to_int uses ebx ecx esi, buf:dword
inc esi
jmp .cycle_16
@@:
cmp ecx,0 ;if the number is negative
jne @f
sub ecx,eax
mov eax,ecx
@@:
ret
endp
;---------------------------------------------------------------------