KFar 0.6: search capabilities
git-svn-id: svn://kolibrios.org@997 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
f7e7dc15e2
commit
77889c54ce
@ -40,6 +40,7 @@ GenericBox:
|
||||
pushad
|
||||
; message loop
|
||||
.event:
|
||||
; call get_event
|
||||
push 10
|
||||
pop eax
|
||||
int 40h
|
||||
@ -264,6 +265,16 @@ ShowGenericBox:
|
||||
; draw shadow
|
||||
test byte [ebx+dlgtemplate.flags], 4
|
||||
jnz .noshadow
|
||||
call draw_dialog_shadow
|
||||
.noshadow:
|
||||
popad
|
||||
push dword [esp+8]
|
||||
push dword [esp+8]
|
||||
call DrawGenericBox
|
||||
xor eax, eax
|
||||
ret 8
|
||||
|
||||
draw_dialog_shadow:
|
||||
mov eax, [ebx+dlgtemplate.x]
|
||||
sub eax, [ebx+dlgtemplate.border_size_x]
|
||||
ja @f
|
||||
@ -316,13 +327,7 @@ ShowGenericBox:
|
||||
add edi, [cur_width]
|
||||
dec edx
|
||||
jnz .shadow_loop
|
||||
.noshadow:
|
||||
popad
|
||||
push dword [esp+8]
|
||||
push dword [esp+8]
|
||||
call DrawGenericBox
|
||||
xor eax, eax
|
||||
ret 8
|
||||
ret
|
||||
|
||||
; void __stdcall DrawGenericBox(DLGDATA* dlg, void* DlgProc)
|
||||
DrawGenericBox:
|
||||
@ -648,9 +653,9 @@ menu_centered_in:
|
||||
xor ecx, ecx
|
||||
mov esi, [esp+20h+20]
|
||||
mov [ebx+40], esi
|
||||
and dword [ebx+56], 0
|
||||
mov dword [ebx+56], eax
|
||||
@@:
|
||||
cmp dword [esi+4], 0
|
||||
cmp dword [esi+4], eax
|
||||
jz .find_width
|
||||
mov esi, [esi+4]
|
||||
inc dword [ebx+56]
|
||||
@ -1103,6 +1108,9 @@ dlgitemtemplate:
|
||||
; 1 = áâ â¨ç¥áª¨© ⥪áâ
|
||||
; 2 = ª®¯ª
|
||||
; 3 = ¯®«¥ । ªâ¨à®¢ ¨ï
|
||||
; 4 = £®à¨§®â «ìë© à §¤¥«¨â¥«ì
|
||||
; 5 = ä« ¦®ª
|
||||
; 6 = ᯨ᮪
|
||||
.type dd ?
|
||||
.x1 dd ?
|
||||
.y1 dd ?
|
||||
@ -1110,9 +1118,14 @@ dlgitemtemplate:
|
||||
.y2 dd ?
|
||||
; „ ë¥:
|
||||
; ¤«ï ⥪áâ : const char* data - ASCIIZ-áâப
|
||||
; ¤«ï ª®¯ª¨: const char* data - § £®«®¢®ª
|
||||
; ¤«ï ª®¯ª¨ ¨ ä« ¦ª : const char* data - § £®«®¢®ª
|
||||
; ¤«ï । ªâ®à : struct {unsigned maxlength; unsigned pos; unsigned start;
|
||||
; char data[maxlength+1];}* data;
|
||||
; ¤«ï ᯨ᪠: struct {listitem* curitemptr; unsigned numitems;
|
||||
; listitem *head; unsigned curitem;}* data;
|
||||
; head = 㪠§ â¥«ì ¯¥à¢ë© ®â®¡à ¦ ¥¬ë© í«¥¬¥â,
|
||||
; curitemptr = 㪠§ â¥«ì ¢ë¤¥«¥ë© í«¥¬¥â, curitem = ¥£® ¨¤¥ªá ¢ ᯨ᪥ (®â 0)
|
||||
; (£¤¥ struct listitem {listitem* next; listitem* prev; char text[];};)
|
||||
.data dd ?
|
||||
.flags dd ?
|
||||
; ”« £¨:
|
||||
@ -1123,6 +1136,7 @@ dlgitemtemplate:
|
||||
; 8 = í«¥¬¥â ¬®¦¥â ¨¬¥âì 䮪ãá ¢¢®¤
|
||||
; 10h: ¤«ï ª®¯ª¨ = ª®¯ª ¯® 㬮«ç ¨î (Enter ¥-ª®¯ª¥)
|
||||
; ¤«ï ¯®«ï ¢¢®¤ = ¤ ë¥ ¡ë«¨ ¬®¤¨ä¨æ¨à®¢ ë
|
||||
; ¤«ï ä« ¦ª = ä« ¦®ª ãáâ ®¢«¥
|
||||
; 20h: ¤«ï ¯®«ï ¢¢®¤ = ¥ ®â®¡à ¦ âì ¢¢®¤¨¬ë¥ ¤ ë¥ (¯®ª §ë¢ âì '*')
|
||||
.size = $
|
||||
end virtual
|
||||
@ -1191,10 +1205,17 @@ ManagerDlgProc:
|
||||
jz .up
|
||||
cmp al, 0x50
|
||||
jz .down
|
||||
jecxz @f
|
||||
jecxz .nobtns2
|
||||
cmp [ebx+dlgitemtemplate.type], 3
|
||||
jz .key_edit
|
||||
cmp [ebx+dlgitemtemplate.type], 5
|
||||
jnz @f
|
||||
cmp al, 0x39
|
||||
jnz @f
|
||||
xor [ebx+dlgitemtemplate.flags], 10h
|
||||
jmp .ret_draw
|
||||
@@:
|
||||
.nobtns2:
|
||||
cmp al, 0x4B
|
||||
jz .left
|
||||
cmp al, 0x4D
|
||||
@ -1386,19 +1407,9 @@ ManagerDlgProc:
|
||||
.draw_loop:
|
||||
push ecx
|
||||
mov eax, [ebx+dlgitemtemplate.type]
|
||||
dec eax
|
||||
jz .draw_text
|
||||
dec eax
|
||||
jz .draw_button
|
||||
dec eax
|
||||
jnz .draw_loop_continue
|
||||
call draw_editbox
|
||||
jmp .draw_loop_continue
|
||||
.draw_button:
|
||||
call draw_button
|
||||
jmp .draw_loop_continue
|
||||
.draw_text:
|
||||
call draw_static_text
|
||||
cmp eax, draw_functions_num
|
||||
jae .draw_loop_continue
|
||||
call [draw_functions + eax*4]
|
||||
.draw_loop_continue:
|
||||
pop ecx
|
||||
add ebx, dlgitemtemplate.size
|
||||
@ -1406,6 +1417,19 @@ ManagerDlgProc:
|
||||
.done_draw:
|
||||
ret
|
||||
|
||||
iglobal
|
||||
align 4
|
||||
label draw_functions dword
|
||||
dd ManagerDlgProc.done_draw
|
||||
dd draw_static_text
|
||||
dd draw_button
|
||||
dd draw_editbox
|
||||
dd draw_h_separator
|
||||
dd draw_checkbox
|
||||
dd draw_listbox
|
||||
draw_functions_num = ($ - draw_functions) / 4
|
||||
endg
|
||||
|
||||
draw_static_text:
|
||||
; à¨á㥬 áâ â¨ç¥áª¨© ⥪áâ
|
||||
mov ah, [dialog_main_color]
|
||||
@ -1417,7 +1441,8 @@ draw_text:
|
||||
mov esi, [ebx+dlgitemtemplate.data]
|
||||
draw_text_esi:
|
||||
test esi, esi
|
||||
jz .ret
|
||||
jz .ret2
|
||||
push eax
|
||||
push -1
|
||||
pop ecx
|
||||
@@:
|
||||
@ -1425,7 +1450,6 @@ draw_text_esi:
|
||||
cmp byte [ecx+esi], 0
|
||||
jnz @b
|
||||
; ¢ ecx ¤«¨ áâப¨
|
||||
push eax
|
||||
xor eax, eax
|
||||
mov edx, [ebx+dlgitemtemplate.x2]
|
||||
sub edx, [ebx+dlgitemtemplate.x1]
|
||||
@ -1451,12 +1475,8 @@ draw_text_esi:
|
||||
.text_draw:
|
||||
push ecx
|
||||
push eax
|
||||
mov eax, [ebx+dlgitemtemplate.x1]
|
||||
add eax, [ebp+dlgtemplate.x]
|
||||
push edx
|
||||
mov edx, [ebx+dlgitemtemplate.y1]
|
||||
add edx, [ebp+dlgtemplate.y]
|
||||
call get_console_ptr
|
||||
call dlgitem_get_console_ptr
|
||||
pop edx
|
||||
pop ecx
|
||||
mov ah, [esp+5]
|
||||
@ -1508,6 +1528,7 @@ draw_text_esi:
|
||||
pop eax
|
||||
mov al, ' '
|
||||
rep stosw
|
||||
.ret2:
|
||||
ret
|
||||
|
||||
draw_button:
|
||||
@ -1551,6 +1572,310 @@ draw_editbox:
|
||||
add esi, 12
|
||||
jmp draw_text_esi
|
||||
|
||||
dlgitem_get_console_ptr:
|
||||
mov eax, [ebx+dlgitemtemplate.x1]
|
||||
mov edx, [ebx+dlgitemtemplate.y1]
|
||||
mov ecx, eax
|
||||
add eax, [ebp+dlgtemplate.x]
|
||||
add edx, [ebp+dlgtemplate.y]
|
||||
jmp get_console_ptr
|
||||
|
||||
draw_h_separator:
|
||||
; à¨á㥬 £®à¨§®â «ìë© à §¤¥«¨â¥«ì
|
||||
call dlgitem_get_console_ptr
|
||||
.scan:
|
||||
mov al, 0xC7
|
||||
test ecx, ecx
|
||||
js @f
|
||||
mov al, 0xB6
|
||||
cmp ecx, [ebp+dlgtemplate.width]
|
||||
jz @f
|
||||
mov al, 0xC4
|
||||
@@:
|
||||
stosb
|
||||
jz .done
|
||||
inc ecx
|
||||
inc edi
|
||||
cmp ecx, [ebx+dlgitemtemplate.x2]
|
||||
jb .scan
|
||||
.done:
|
||||
ret
|
||||
|
||||
draw_checkbox:
|
||||
; à¨á㥬 ä« ¦®ª
|
||||
call dlgitem_get_console_ptr
|
||||
test byte [ebx+dlgitemtemplate.flags], 4
|
||||
jz @f
|
||||
inc eax
|
||||
mov [cursor_x], eax
|
||||
mov [cursor_y], edx
|
||||
@@:
|
||||
mov ah, [dialog_main_color]
|
||||
test byte [ebp+dlgtemplate.flags], 2
|
||||
jz @f
|
||||
mov ah, [warning_main_color]
|
||||
@@:
|
||||
mov al, '['
|
||||
stosw
|
||||
mov al, 'x'
|
||||
test byte [ebx+dlgitemtemplate.flags], 10h
|
||||
jnz @f
|
||||
mov al, ' '
|
||||
@@:
|
||||
stosw
|
||||
mov al, ']'
|
||||
stosw
|
||||
mov al, ' '
|
||||
stosw
|
||||
mov ecx, [ebx+dlgitemtemplate.x2]
|
||||
sub ecx, [ebx+dlgitemtemplate.x1]
|
||||
jb .ret
|
||||
sub ecx, 3
|
||||
jbe .ret
|
||||
mov esi, [ebx+dlgitemtemplate.data]
|
||||
@@:
|
||||
lodsb
|
||||
test al, al
|
||||
jz .ret
|
||||
stosw
|
||||
loop @b
|
||||
.ret:
|
||||
ret
|
||||
|
||||
draw_listbox:
|
||||
; à¨á㥬 ᯨ᮪
|
||||
call dlgitem_get_console_ptr
|
||||
mov edx, [ebx+dlgitemtemplate.data]
|
||||
mov esi, [edx+8]
|
||||
mov eax, [ebx+dlgitemtemplate.y2]
|
||||
sub eax, [ebx+dlgitemtemplate.y1]
|
||||
push eax
|
||||
push eax
|
||||
.0:
|
||||
test esi, esi
|
||||
jz .listdone
|
||||
push esi edi
|
||||
push edx
|
||||
or edx, -1
|
||||
mov ecx, [ebx+dlgitemtemplate.x2]
|
||||
sub ecx, [ebx+dlgitemtemplate.x1]
|
||||
inc ecx
|
||||
xor eax, eax
|
||||
@@:
|
||||
inc edx
|
||||
cmp byte [esi+8+edx], al
|
||||
jnz @b
|
||||
@@:
|
||||
cmp ecx, edx
|
||||
jae .text_draw
|
||||
mov al, byte [ebx+dlgitemtemplate.flags]
|
||||
and al, 3
|
||||
jz .text_align_left
|
||||
cmp al, 1
|
||||
jz .text_align_center
|
||||
; ⥪áâ ¢ë஢¥ ¢¯à ¢®
|
||||
mov eax, edx
|
||||
sub eax, ecx
|
||||
jmp .text_draw
|
||||
.text_align_center:
|
||||
mov eax, edx
|
||||
sub eax, ecx
|
||||
shr eax, 1
|
||||
jmp .text_draw
|
||||
.text_align_left:
|
||||
; xor eax, eax
|
||||
.text_draw:
|
||||
pop edx
|
||||
cmp esi, [edx]
|
||||
lea esi, [esi+8+eax]
|
||||
mov ah, [dialog_selected_list_color]
|
||||
jz @f
|
||||
mov ah, [dialog_list_color]
|
||||
@@:
|
||||
jecxz .next
|
||||
@@:
|
||||
lodsb
|
||||
test al, al
|
||||
jz @f
|
||||
stosw
|
||||
loop @b
|
||||
@@:
|
||||
mov al, ' '
|
||||
rep stosw
|
||||
.next:
|
||||
pop edi esi
|
||||
add edi, [cur_width]
|
||||
add edi, [cur_width]
|
||||
mov esi, [esi]
|
||||
dec dword [esp]
|
||||
jns .0
|
||||
.listdone:
|
||||
pop eax
|
||||
; ‹¨¥©ª ¯à®ªàã⪨
|
||||
pop ecx
|
||||
inc ecx
|
||||
mov esi, [edx+4]
|
||||
cmp ecx, esi
|
||||
jae .noscrollbar
|
||||
sub ecx, 2
|
||||
jbe .noscrollbar
|
||||
mov eax, [edx+12]
|
||||
mul ecx
|
||||
div esi
|
||||
push eax
|
||||
mov eax, [ebx+dlgitemtemplate.x2]
|
||||
add eax, [ebp+dlgtemplate.x]
|
||||
mov edx, [ebx+dlgitemtemplate.y1]
|
||||
add edx, [ebp+dlgtemplate.y]
|
||||
call get_console_ptr
|
||||
pop edx
|
||||
inc edx
|
||||
mov al, 0x1E
|
||||
mov ah, [dialog_scroll_list_color]
|
||||
mov [edi], ax
|
||||
add edi, [cur_width]
|
||||
add edi, [cur_width]
|
||||
.2:
|
||||
mov al, 0xB1
|
||||
dec edx
|
||||
jz @f
|
||||
mov al, 0xB0
|
||||
@@:
|
||||
mov [edi], ax
|
||||
add edi, [cur_width]
|
||||
add edi, [cur_width]
|
||||
loop .2
|
||||
mov al, 0x1F
|
||||
stosw
|
||||
.noscrollbar:
|
||||
ret
|
||||
|
||||
listbox_key:
|
||||
mov edx, [ebx+dlgitemtemplate.data]
|
||||
cmp al, 0x48
|
||||
jz .prev
|
||||
cmp al, 0x50
|
||||
jz .next
|
||||
cmp al, 0x47
|
||||
jz .home
|
||||
cmp al, 0x4F
|
||||
jz .end
|
||||
cmp al, 0x51
|
||||
jz .pgdn
|
||||
cmp al, 0x49
|
||||
jz .pgup
|
||||
ret
|
||||
.next:
|
||||
call .calc_last_line
|
||||
mov eax, [edx]
|
||||
cmp dword [eax], 0
|
||||
jz @f
|
||||
call .line_next
|
||||
@@:
|
||||
mov [edx], eax
|
||||
ret
|
||||
.pgdn:
|
||||
call .calc_last_line
|
||||
mov eax, [edx]
|
||||
mov ecx, [ebx+dlgitemtemplate.y2]
|
||||
sub ecx, [ebx+dlgitemtemplate.y1]
|
||||
.pgdnl:
|
||||
cmp dword [eax], 0
|
||||
jz @f
|
||||
call .line_next
|
||||
loop .pgdnl
|
||||
@@:
|
||||
mov [edx], eax
|
||||
ret
|
||||
.prev:
|
||||
mov eax, [edx]
|
||||
cmp dword [eax+4], 0
|
||||
jz @f
|
||||
call .line_prev
|
||||
@@:
|
||||
mov [edx], eax
|
||||
ret
|
||||
.pgup:
|
||||
mov eax, [edx]
|
||||
mov ecx, [ebx+dlgitemtemplate.y2]
|
||||
sub ecx, [ebx+dlgitemtemplate.y1]
|
||||
; inc ecx
|
||||
.pgupl:
|
||||
cmp dword [eax+4], 0
|
||||
jz @f
|
||||
call .line_prev
|
||||
loop .pgupl
|
||||
@@:
|
||||
mov [edx], eax
|
||||
ret
|
||||
.home:
|
||||
mov eax, [edx]
|
||||
@@:
|
||||
cmp dword [eax+4], 0
|
||||
jz @f
|
||||
mov eax, [eax+4]
|
||||
jmp @b
|
||||
@@:
|
||||
mov [edx], eax
|
||||
mov [edx+8], eax
|
||||
and dword [edx+12], 0
|
||||
ret
|
||||
.end:
|
||||
mov eax, [edx]
|
||||
@@:
|
||||
cmp dword [eax], 0
|
||||
jz @f
|
||||
mov eax, [eax]
|
||||
jmp @b
|
||||
@@:
|
||||
mov [edx], eax
|
||||
mov ecx, [ebx+dlgitemtemplate.y2]
|
||||
sub ecx, [ebx+dlgitemtemplate.y1]
|
||||
jz .e1
|
||||
.e2:
|
||||
mov eax, [eax+4]
|
||||
loop .e2
|
||||
.e1:
|
||||
mov [edx+8], eax
|
||||
mov eax, [edx+4]
|
||||
dec eax
|
||||
mov [edx+12], eax
|
||||
ret
|
||||
|
||||
.line_prev:
|
||||
cmp eax, [edx+8]
|
||||
mov eax, [eax+4]
|
||||
jnz @f
|
||||
mov [edx+8], eax
|
||||
@@:
|
||||
dec dword [edx+12]
|
||||
ret
|
||||
.calc_last_line:
|
||||
mov esi, [edx+8]
|
||||
mov ecx, [ebx+dlgitemtemplate.y2]
|
||||
sub ecx, [ebx+dlgitemtemplate.y1]
|
||||
jz .clldone
|
||||
@@:
|
||||
mov esi, [esi]
|
||||
test esi, esi
|
||||
jz @f
|
||||
loop @b
|
||||
.clldone:
|
||||
ret
|
||||
.line_next:
|
||||
cmp eax, esi
|
||||
mov eax, [eax]
|
||||
jnz @f
|
||||
push eax
|
||||
mov eax, [edx+8]
|
||||
mov eax, [eax]
|
||||
mov [edx+8], eax
|
||||
pop eax
|
||||
mov esi, eax
|
||||
@@:
|
||||
inc dword [edx+12]
|
||||
ret
|
||||
|
||||
; void __stdcall SayNoMem(void);
|
||||
SayNoMem:
|
||||
or dword [nomem_dlgdata+4], -1
|
||||
@ -1559,6 +1884,18 @@ SayNoMem:
|
||||
call DialogBox
|
||||
ret
|
||||
|
||||
; int __stdcall ConfirmCancel(void);
|
||||
; return value: 0 = the user is sure, nonzero = the user wants to continue
|
||||
ConfirmCancel:
|
||||
push YesOrNoBtn
|
||||
push 2
|
||||
push ConfirmCancelMsg
|
||||
push 1
|
||||
push aCancelled
|
||||
call SayErrTitle
|
||||
test eax, eax
|
||||
ret
|
||||
|
||||
; int __stdcall SayErr(int num_strings, const char* strings[],
|
||||
; int num_buttons, const char* buttons[]);
|
||||
SayErr:
|
||||
|
@ -123,7 +123,7 @@ edit_file:
|
||||
mov [ebp + editor_data.memsize], ebx
|
||||
mov al, [EditEOLStyle]
|
||||
mov [ebp + editor_data.eol], al
|
||||
mov eax, [esi + panel1_hPlugin - panel1_data]
|
||||
mov eax, dword [esi + panel1_hPlugin - panel1_dir]
|
||||
mov [ebp + editor_data.hPlugin], eax
|
||||
test eax, eax
|
||||
jz .nocopyhostname
|
||||
@ -196,6 +196,7 @@ edit_file:
|
||||
push dword [ebx+21]
|
||||
push [ebp + editor_data.hFile]
|
||||
call [edx + PluginInfo.open]
|
||||
mov [esp+1Ch], eax
|
||||
popad
|
||||
test eax, eax
|
||||
jz ..openerr_in_screen
|
||||
@ -210,6 +211,7 @@ edit_file:
|
||||
push [readinfo.data]
|
||||
push ebx
|
||||
call [edx + PluginInfo.read]
|
||||
mov [esp+1Ch], eax
|
||||
popad
|
||||
cmp eax, -1
|
||||
jnz .readok
|
||||
@ -259,7 +261,7 @@ edit_file:
|
||||
jnz .readdone
|
||||
@@:
|
||||
push eax ebx
|
||||
mov ebx, [ebx+16]
|
||||
mov ebx, [readinfo.data]
|
||||
.loadloop:
|
||||
mov ecx, [EditBlockSize]
|
||||
cmp eax, ecx
|
||||
@ -1977,7 +1979,7 @@ editor_OnKey:
|
||||
|
||||
.left:
|
||||
call editor_cursor_left
|
||||
jc .redraw_status
|
||||
jnc .redraw_status
|
||||
jmp editor_draw_text
|
||||
.ret3:
|
||||
ret
|
||||
@ -2156,6 +2158,204 @@ editor_OnKey:
|
||||
.del1:
|
||||
jmp editor_draw_text
|
||||
|
||||
.f7:
|
||||
call find_in_file_dlg
|
||||
jz .shift_f7
|
||||
.f7.ret:
|
||||
ret
|
||||
.shift_f7:
|
||||
; search string SearchString in file starting from current cursor position
|
||||
mov ebx, SearchString
|
||||
xor eax, eax
|
||||
cmp byte [ebx], al
|
||||
jz .f7.ret
|
||||
mov esi, tolower_table
|
||||
test [find_in_file_dlgdata.flags_case], 10h
|
||||
jz @f
|
||||
mov esi, identical_table
|
||||
@@:
|
||||
test [find_in_file_dlgdata.flags_whole], 10h
|
||||
setnz al
|
||||
push eax
|
||||
push dword [ebp+editor_data.encoding]; always cp866 for now
|
||||
; needs to be revisited after Unicode support in editor
|
||||
call search_string_pre
|
||||
mov esi, [ebp + editor_data.cur_block]
|
||||
add esi, ebp
|
||||
mov ebx, [ebp + editor_data.cur_offs]
|
||||
call editor_normalize_offs
|
||||
jnc .f7.notfound
|
||||
xor edi, edi
|
||||
push ebx esi
|
||||
push edi
|
||||
push edi
|
||||
test [find_in_file_dlgdata.flags_whole], 10h
|
||||
jnz @f
|
||||
movzx eax, byte [esi+ebx]
|
||||
jmp .search_loop_next
|
||||
@@:
|
||||
mov edi, edx
|
||||
.search_loop:
|
||||
; edx -> FSM, ecx = last state, esi:ebx -> current data,
|
||||
; edi = current state
|
||||
; [esp] = row, [esp+4] = delta in lines
|
||||
; get current symbol
|
||||
movzx eax, byte [esi+ebx]
|
||||
; calculate next state
|
||||
movzx edi, byte [edi+eax]
|
||||
; done?
|
||||
cmp edi, ecx
|
||||
jz .f7.found
|
||||
.search_loop_next:
|
||||
; no; proceed to next symbol
|
||||
add ebx, 1
|
||||
shl edi, 8
|
||||
add dword [esp], 1
|
||||
add edi, edx
|
||||
cmp ebx, [esi + edit_block_header.limit]
|
||||
jae .f7.nextblock
|
||||
.f7.nonextblock:
|
||||
cmp al, 10
|
||||
jz .f7.newline
|
||||
cmp al, 13
|
||||
jnz .search_loop
|
||||
cmp byte [esi+ebx], 10
|
||||
jnz .f7.newline
|
||||
call editor_step_forward
|
||||
jnc .f7.notfound_pop
|
||||
.f7.newline:
|
||||
mov dword [esp], 0
|
||||
add dword [esp+4], 1
|
||||
mov dword [esp+8], esi
|
||||
mov dword [esp+12], ebx
|
||||
jmp .search_loop
|
||||
.f7.nextblock:
|
||||
call editor_normalize_offs
|
||||
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
|
||||
jz @f
|
||||
mov esi, [ebp + editor_data.last_block]
|
||||
add esi, ebp
|
||||
mov ebx, [esi + edit_block_header.limit]
|
||||
movzx edi, byte [edi+' ']
|
||||
cmp edi, ecx
|
||||
jz .f7.found
|
||||
@@:
|
||||
add esp, 10h
|
||||
.f7.notfound:
|
||||
jmp search_failed
|
||||
.f7.found:
|
||||
or [ebp + editor_data.cur_delta], -1
|
||||
sub ebx, ecx
|
||||
inc ebx
|
||||
test [find_in_file_dlgdata.flags_whole], 10h
|
||||
jz @f
|
||||
inc ebx
|
||||
@@:
|
||||
cmp ebx, [EditBlockStart]
|
||||
jge @f
|
||||
sub ebx, [EditBlockStart]
|
||||
mov esi, [esi + edit_block_header.prev]
|
||||
add esi, ebp
|
||||
add ebx, [esi + edit_block_header.limit]
|
||||
jmp @b
|
||||
@@:
|
||||
sub esi, ebp
|
||||
mov [ebp + editor_data.cur_block], esi
|
||||
add esi, ebp
|
||||
mov [ebp + editor_data.cur_offs], ebx
|
||||
push ecx
|
||||
mov ecx, edx
|
||||
call pgfree
|
||||
pop ecx
|
||||
pop eax
|
||||
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
|
||||
jz @f
|
||||
dec ecx
|
||||
@@:
|
||||
push ebx esi
|
||||
sub eax, ecx
|
||||
lea edx, [eax+1]
|
||||
mov eax, [ebp + editor_data.curcol]
|
||||
add eax, [ebp + editor_data.cursor_x]
|
||||
test edi, edi
|
||||
jz @f
|
||||
xor eax, eax
|
||||
@@:
|
||||
test edx, edx
|
||||
jz .f7.foundpos1
|
||||
.f7.findpos1:
|
||||
cmp byte [ebx+esi], 9
|
||||
jz .f7.findpos1.tab
|
||||
inc eax
|
||||
call editor_step_forward
|
||||
dec edx
|
||||
jnz .f7.findpos1
|
||||
jmp .f7.foundpos1
|
||||
.f7.findpos1.tab:
|
||||
push edx eax
|
||||
xor edx, edx
|
||||
div [editor_tabsize]
|
||||
pop eax
|
||||
sub edx, [editor_tabsize]
|
||||
sub eax, edx
|
||||
call editor_step_forward
|
||||
pop edx
|
||||
dec edx
|
||||
jnz .f7.findpos1
|
||||
.f7.foundpos1:
|
||||
pop esi ebx
|
||||
push eax
|
||||
cmp eax, [ebp + editor_data.curcol]
|
||||
jb .f7.scrollleft
|
||||
sub eax, [ebp + editor_data.curcol]
|
||||
sub eax, [cur_width]
|
||||
jb .f7.xset
|
||||
inc eax
|
||||
inc edx
|
||||
add [ebp + editor_data.curcol], eax
|
||||
jmp .f7.xset
|
||||
.f7.scrollleft:
|
||||
inc edx
|
||||
mov [ebp + editor_data.curcol], eax
|
||||
.f7.xset:
|
||||
pop eax
|
||||
push edx
|
||||
sub eax, [ebp + editor_data.curcol]
|
||||
mov [ebp + editor_data.cursor_x], eax
|
||||
mov [cursor_x], eax
|
||||
add edi, [ebp + editor_data.cursor_y]
|
||||
push edi
|
||||
inc edi
|
||||
cmp edi, [cur_height]
|
||||
pop edi
|
||||
jae .f7.newview
|
||||
mov [ebp + editor_data.cursor_y], edi
|
||||
mov [cursor_y], edi
|
||||
jmp .f7.yset
|
||||
.f7.newview:
|
||||
dec edi
|
||||
mov [ebp + editor_data.linedata_start + editor_line.block], esi
|
||||
mov [ebp + editor_data.linedata_start + editor_line.offs], bx
|
||||
add [ebp + editor_data.curline], edi
|
||||
xor eax, eax
|
||||
inc eax
|
||||
mov [ebp + editor_data.cursor_y], eax
|
||||
mov [cursor_y], eax
|
||||
call editor_init_lines
|
||||
call editor_test_cursor_y
|
||||
inc dword [esp]
|
||||
.f7.yset:
|
||||
pop eax
|
||||
test eax, eax
|
||||
jz .redraw_status
|
||||
jmp editor_draw_text
|
||||
|
||||
editor_cursor_left:
|
||||
cmp [ebp + editor_data.cur_delta], -1
|
||||
jz .in_text
|
||||
@ -2292,3 +2492,31 @@ editor_OnExit:
|
||||
call close_handle_if_unused
|
||||
@@:
|
||||
ret
|
||||
|
||||
find_in_file_dlg:
|
||||
mov ebx, find_in_file_dlgdata
|
||||
mov eax, [cur_width]
|
||||
sub eax, 12
|
||||
mov [ebx + dlgtemplate.width], eax
|
||||
dec eax
|
||||
dec eax
|
||||
mov [ebx - find_in_file_dlgdata + find_in_file_dlgdata.width2], eax
|
||||
shr eax, 1
|
||||
dec eax
|
||||
dec eax
|
||||
mov [ebx - find_in_file_dlgdata + find_in_file_dlgdata.search_x2], eax
|
||||
sub eax, aSearchBLength-1
|
||||
mov [ebx - find_in_file_dlgdata + find_in_file_dlgdata.search_x1], eax
|
||||
add eax, aSearchBLength+3
|
||||
mov [ebx - find_in_file_dlgdata + find_in_file_dlgdata.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
|
||||
push ebx
|
||||
call DialogBox
|
||||
cmp eax, find_in_file_dlgdata.search_btn
|
||||
ret
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -7,8 +7,8 @@ memsize dd mem
|
||||
dd stacktop
|
||||
dd 0, app_path
|
||||
|
||||
version equ '0.5'
|
||||
version_dword equ 0*10000h + 50
|
||||
version equ '0.6'
|
||||
version_dword equ 0*10000h + 60
|
||||
|
||||
min_width = 54
|
||||
max_width = 255
|
||||
@ -20,6 +20,7 @@ include 'font.inc'
|
||||
include 'sort.inc'
|
||||
include 'kglobals.inc'
|
||||
include 'dialogs.inc'
|
||||
include 'search.inc'
|
||||
include 'viewer.inc'
|
||||
include 'editor.inc'
|
||||
include 'tools.inc'
|
||||
@ -29,10 +30,14 @@ cursor_normal_size = (font_height*15+50)/100
|
||||
cursor_big_size = font_height
|
||||
|
||||
start:
|
||||
mov edi, tolower_table
|
||||
push 'A'
|
||||
pop ecx
|
||||
mov edi, identical_table
|
||||
mov ecx, 0x100
|
||||
xor eax, eax
|
||||
@@:
|
||||
stosb
|
||||
inc eax
|
||||
loop @b
|
||||
mov cl, 'A'
|
||||
@@:
|
||||
stosb
|
||||
inc eax
|
||||
@ -68,6 +73,41 @@ start:
|
||||
inc eax
|
||||
loop @b
|
||||
mov byte [edi-256+'ð'], 'ñ'
|
||||
mov cl, 'A'
|
||||
inc eax
|
||||
rep stosb
|
||||
mov cl, 'Z'-'A'+1
|
||||
dec eax
|
||||
rep stosb
|
||||
mov cl, 'a'-'Z'-1
|
||||
inc eax
|
||||
rep stosb
|
||||
mov byte [edi-'a'+'_'], 0
|
||||
mov cl, 'z'-'a'+1
|
||||
dec eax
|
||||
rep stosb
|
||||
mov cl, '€'-'z'-1
|
||||
inc eax
|
||||
rep stosb
|
||||
mov cl, '¯'-'€'+1
|
||||
dec eax
|
||||
rep stosb
|
||||
mov cl, 'à'-'¯'-1
|
||||
inc eax
|
||||
rep stosb
|
||||
mov cl, 'ñ'-'à'+1
|
||||
dec eax
|
||||
rep stosb
|
||||
mov cl, 256-'ñ'-1
|
||||
inc eax
|
||||
rep stosb
|
||||
mov edi, SearchStringEditBuf
|
||||
mov eax, SearchStringEditBuf.length
|
||||
stosd
|
||||
xor eax, eax
|
||||
stosd
|
||||
stosd
|
||||
stosb
|
||||
push 68
|
||||
pop eax
|
||||
push 11
|
||||
@ -116,6 +156,7 @@ start:
|
||||
mov ecx, panels_vtable
|
||||
mov [eax], ecx
|
||||
mov [active_screen_vtable], ecx
|
||||
mov [active_screen_keybar], keybar_panels
|
||||
; load libini.obj and kfar.ini
|
||||
mov eax, libini_name
|
||||
mov esi, ini_import
|
||||
@ -294,12 +335,13 @@ start:
|
||||
add ebx, 3
|
||||
and ebx, not 3
|
||||
mov [EditPlugInfo], ebx
|
||||
add ebx, editor_line.plugdata
|
||||
imul ebx, max_height
|
||||
add ebx, editor_data.basesize + 0xFFF
|
||||
shr ebx, 12
|
||||
mov [EditDataSize], ebx
|
||||
.noini:
|
||||
mov eax, [EditPlugInfo]
|
||||
add eax, editor_line.plugdata
|
||||
imul eax, max_height
|
||||
add eax, editor_data.basesize + 0xFFF
|
||||
shr eax, 12
|
||||
mov [EditDataSize], eax
|
||||
mov esi, def_left_dir
|
||||
mov edi, panel1_dir
|
||||
@@:
|
||||
@ -327,9 +369,7 @@ start:
|
||||
call read_folder
|
||||
call draw_panel
|
||||
event:
|
||||
push 10
|
||||
pop eax
|
||||
int 40h
|
||||
call get_event
|
||||
dec eax
|
||||
jz redraw
|
||||
dec eax
|
||||
@ -418,6 +458,33 @@ if CHECK_FOR_LEAKS
|
||||
end if
|
||||
or eax, -1
|
||||
int 40h
|
||||
|
||||
get_event:
|
||||
push ebx
|
||||
mov ebx, [idle_interval]
|
||||
cmp ebx, -1
|
||||
jz .infinite
|
||||
push 23
|
||||
pop eax
|
||||
int 40h
|
||||
pop ebx
|
||||
test eax, eax
|
||||
jnz .ret
|
||||
mov ebp, [active_screen_data]
|
||||
mov eax, [active_screen_vtable]
|
||||
mov eax, [eax+screen_vtable.OnIdle]
|
||||
test eax, eax
|
||||
jz get_event
|
||||
call eax
|
||||
jmp get_event
|
||||
.infinite:
|
||||
pop ebx
|
||||
push 10
|
||||
pop eax
|
||||
int 40h
|
||||
.ret:
|
||||
ret
|
||||
|
||||
redraw:
|
||||
; query kbd state from OS
|
||||
mov al, 66
|
||||
@ -1034,6 +1101,12 @@ new_screen:
|
||||
mov [active_screen], eax
|
||||
mov [active_screen_vtable], edx
|
||||
mov [active_screen_data], ebp
|
||||
or [idle_interval], -1
|
||||
mov edx, [edx+screen_vtable.keybar]
|
||||
test edx, edx
|
||||
jz @f
|
||||
mov [active_screen_keybar], edx
|
||||
@@:
|
||||
jmp draw_keybar
|
||||
|
||||
next_screen:
|
||||
@ -1068,16 +1141,29 @@ delete_active_screen:
|
||||
.norealloc:
|
||||
pop ecx
|
||||
call pgfree
|
||||
and [active_screen], 0
|
||||
dec [active_screen]
|
||||
|
||||
change_screen:
|
||||
pusha
|
||||
or [idle_interval], -1
|
||||
mov eax, [active_screen]
|
||||
mov esi, [screens]
|
||||
mov ebp, [esi+eax*8+4]
|
||||
mov eax, [esi+eax*8]
|
||||
push eax ebp
|
||||
mov eax, [eax+screen_vtable.OnActivate]
|
||||
test eax, eax
|
||||
jz @f
|
||||
call eax
|
||||
@@:
|
||||
pop ebp eax
|
||||
mov [active_screen_vtable], eax
|
||||
mov [active_screen_data], ebp
|
||||
mov edx, [eax+screen_vtable.keybar]
|
||||
test edx, edx
|
||||
jz @f
|
||||
mov [active_screen_keybar], edx
|
||||
@@:
|
||||
call draw_keybar
|
||||
mov [cursor_size], cursor_normal_size
|
||||
call [eax+screen_vtable.OnRedraw]
|
||||
@ -2557,6 +2643,12 @@ end if
|
||||
jmp .copydone
|
||||
|
||||
.f3:
|
||||
mov eax, [ebp + panel1_files - panel1_data]
|
||||
mov ecx, [eax+ecx*4]
|
||||
test byte [ecx], 10h
|
||||
jnz .ret2
|
||||
lea esi, [ebp + panel1_dir - panel1_data]
|
||||
xor eax, eax
|
||||
call view_file
|
||||
.ret2:
|
||||
ret
|
||||
@ -2694,6 +2786,7 @@ end if
|
||||
stosb
|
||||
test al, al
|
||||
jnz @b
|
||||
.ctrl_r.doread:
|
||||
push [ebp + panel1_start - panel1_data]
|
||||
call read_folder
|
||||
pop [ebp + panel1_start - panel1_data]
|
||||
@ -3855,8 +3948,7 @@ draw_keybar:
|
||||
or al, 4
|
||||
@@:
|
||||
imul eax, 6*12
|
||||
mov esi, [active_screen_vtable]
|
||||
mov esi, [esi+screen_vtable.keybar]
|
||||
mov esi, [active_screen_keybar]
|
||||
add esi, eax
|
||||
xor ecx, ecx
|
||||
inc ecx
|
||||
@ -7005,6 +7097,8 @@ cursor_size dd cursor_normal_size
|
||||
cur_cursor_pos dd -1
|
||||
old_cursor_pos dd -1
|
||||
|
||||
idle_interval dd -1
|
||||
|
||||
active_panel dd panel1_data
|
||||
|
||||
associations dd 0
|
||||
@ -7041,6 +7135,8 @@ ctrlkey_tests_num = 5
|
||||
virtual at 0
|
||||
screen_vtable:
|
||||
.OnRedraw dd ?
|
||||
.OnActivate dd ?
|
||||
.OnIdle dd ?
|
||||
.OnKey dd ?
|
||||
.keybar dd ?
|
||||
.getname dd ?
|
||||
@ -7050,6 +7146,8 @@ end virtual
|
||||
|
||||
panels_vtable:
|
||||
dd panels_OnRedraw
|
||||
dd 0
|
||||
dd 0
|
||||
dd panels_OnKey
|
||||
dd keybar_panels
|
||||
dd panels_getname
|
||||
@ -7058,6 +7156,8 @@ panels_vtable:
|
||||
|
||||
viewer_vtable:
|
||||
dd viewer_OnRedraw
|
||||
dd 0
|
||||
dd 0
|
||||
dd viewer_OnKey
|
||||
dd keybar_viewer
|
||||
dd viewer_getname
|
||||
@ -7066,12 +7166,24 @@ viewer_vtable:
|
||||
|
||||
editor_vtable:
|
||||
dd editor_OnRedraw
|
||||
dd 0
|
||||
dd 0
|
||||
dd editor_OnKey
|
||||
dd keybar_editor
|
||||
dd editor_getname
|
||||
dd editor_OnExit
|
||||
dd editor_IsHandleUsed
|
||||
|
||||
filesearch_vtable:
|
||||
dd filesearch_OnRedraw
|
||||
dd filesearch_OnActivate
|
||||
dd filesearch_OnIdle
|
||||
dd filesearch_OnKey
|
||||
dd 0
|
||||
dd filesearch_getname
|
||||
dd filesearch_OnExit
|
||||
dd filesearch_IsHandleUsed
|
||||
|
||||
; additions to this table require changes in tools.inc::get_error_msg
|
||||
errors1:
|
||||
dd error0msg
|
||||
@ -7222,6 +7334,8 @@ panels_ctrlkeys:
|
||||
dd panels_OnKey.shift_f5
|
||||
dw 0x41, 0
|
||||
dd panels_OnKey.f7
|
||||
dw 0x41, 0x100
|
||||
dd panels_OnKey.alt_f7
|
||||
dw 0x42, 0
|
||||
dd panels_OnKey.f8
|
||||
dw 0x43, 0x100
|
||||
@ -7295,6 +7409,10 @@ viewer_ctrlkeys:
|
||||
dd viewer_OnKey.exit
|
||||
dw 0x3E, 0
|
||||
dd viewer_OnKey.f4
|
||||
dw 0x41, 0
|
||||
dd viewer_OnKey.f7
|
||||
dw 0x41, 1
|
||||
dd viewer_OnKey.shift_f7
|
||||
dw 0x42, 0
|
||||
dd viewer_OnKey.f8
|
||||
dw 0x42, 1
|
||||
@ -7318,6 +7436,10 @@ editor_ctrlkeys:
|
||||
dd editor_OnKey.backspace
|
||||
dw 0x3C, 0
|
||||
dd editor_OnKey.f2
|
||||
dw 0x41, 0
|
||||
dd editor_OnKey.f7
|
||||
dw 0x41, 1
|
||||
dd editor_OnKey.shift_f7
|
||||
dw 0x43, 0x100
|
||||
dd alt_f9
|
||||
dw 0x44, 0
|
||||
@ -7429,6 +7551,9 @@ dialog_edit_color db 30h
|
||||
dialog_unmodified_edit_color db 38h
|
||||
dialog_normal_btn_color db 70h
|
||||
dialog_selected_btn_color db 30h
|
||||
dialog_list_color db 70h
|
||||
dialog_selected_list_color db 0Fh
|
||||
dialog_scroll_list_color db 70h
|
||||
; <20>।ã¯à¥¦¤¥¨ï ¨ ®è¨¡ª¨
|
||||
warning_colors:
|
||||
; !!! ¤®«¦ë ¡ëâì ⥠¦¥ ¯®«ï ¨ ¢ ⮬ ¦¥ ¯®à浪¥, çâ® ¨ ¤«ï ®¡ëçëå ¤¨ «®£®¢ !!!
|
||||
@ -7439,6 +7564,9 @@ warning_edit_color db 30h
|
||||
warning_unmodified_edit_color db 38h
|
||||
warning_normal_btn_color db 4Fh
|
||||
warning_selected_btn_color db 70h
|
||||
warning_list_color db 3Fh
|
||||
warning_selected_list_color db 70h
|
||||
warning_scroll_list_color db 3Fh
|
||||
; Œ¥î
|
||||
menu_normal_color db 3Fh
|
||||
menu_selected_color db 0Fh
|
||||
@ -7456,6 +7584,7 @@ cmdbar_normal_color db 7
|
||||
cmdbar_prefix_color db 7
|
||||
; <20>à®á¬®âà騪
|
||||
view_normal_color db 1Bh
|
||||
view_selected_color db 30h
|
||||
view_status_color db 30h
|
||||
view_arrows_color db 1Eh
|
||||
; <20>¥¤ ªâ®à
|
||||
@ -7694,6 +7823,237 @@ QuickSearchDlg:
|
||||
dd quick_search_buf
|
||||
dd 1Ch
|
||||
|
||||
; ¤¨ «®£ ¯®¨áª ¢ ä ©«¥ ¤«ï ¯à®á¬®âà騪 ¨ । ªâ®à
|
||||
find_in_file_dlgdata:
|
||||
dd 1
|
||||
.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
|
||||
; ¯®«¥ । ªâ¨à®¢ ¨ï á ⥪á⮬ ¤«ï ¯®¨áª
|
||||
dd 3
|
||||
dd 1,1
|
||||
.width2 dd ?
|
||||
dd 1
|
||||
dd SearchStringEditBuf
|
||||
.flags0 dd 0xC
|
||||
; £®à¨§®â «ìë© à §¤¥«¨â¥«ì
|
||||
dd 4
|
||||
dd -1,2
|
||||
dd -1,2
|
||||
dd 0
|
||||
dd 0
|
||||
; ä« ¦®ª "“ç¨âë¢ âì ॣ¨áâà"
|
||||
dd 5
|
||||
dd 1,3
|
||||
dd -1,3
|
||||
dd aCaseSensitive
|
||||
.flags_case dd 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
|
||||
; £®à¨§®â «ìë© à §¤¥«¨â¥«ì
|
||||
dd 4
|
||||
dd -1,5
|
||||
dd -1,5
|
||||
dd 0
|
||||
dd 0
|
||||
; ª®¯ª "ˆáª âì"
|
||||
.search_btn:
|
||||
dd 2
|
||||
.search_x1 dd ?
|
||||
dd 6
|
||||
.search_x2 dd ?
|
||||
dd 6
|
||||
dd aSearchB
|
||||
.flags1 dd 18h
|
||||
; ª®¯ª "®â¬¥¨âì"
|
||||
dd 2
|
||||
.cnl_x1 dd ?
|
||||
dd 6
|
||||
.cnl_x2 dd ?
|
||||
dd 6
|
||||
dd aCancelB
|
||||
.flags2 dd 8
|
||||
|
||||
; ¯¥à¢ë© ¤¨ «®£ ¯®¨áª ¢ ä ©« å (§ ¯à®á)
|
||||
filesearch_query_template:
|
||||
dd 1
|
||||
.x dd ?
|
||||
.y dd ?
|
||||
.width dd ?
|
||||
.height dd 9
|
||||
dd 4, 2
|
||||
dd aFileSearch
|
||||
dd ?
|
||||
dd 0
|
||||
dd 0, 0
|
||||
dd 10
|
||||
; áâப -¯à¨£« 襨¥ ¤«ï ¢¢®¤ ¬ ᪨
|
||||
dd 1
|
||||
dd 1,0,aFileMasksLen,0
|
||||
dd aFileMasks
|
||||
dd 0
|
||||
; ¯®«¥ ¢¢®¤ ¤«ï ¬ ᪨
|
||||
dd 3
|
||||
dd 1, 1
|
||||
.width2 dd ?
|
||||
dd 1
|
||||
.editptr1 dd ?
|
||||
dd 0xC
|
||||
; áâப -¯à¨£« 襨¥ ¤«ï ⥪áâ ¯®¨áª
|
||||
dd 1
|
||||
dd 1,2,aContainingTextLen,2
|
||||
dd aContainingText
|
||||
dd 0
|
||||
; ¯®«¥ ¢¢®¤ ¤«ï ⥪áâ ¯®¨áª
|
||||
dd 3
|
||||
dd 1, 3
|
||||
.width3 dd ?
|
||||
dd 3
|
||||
.editptr2 dd ?
|
||||
dd 8
|
||||
; £®à¨§®â «ìë© à §¤¥«¨â¥«ì
|
||||
dd 4
|
||||
dd -1,4
|
||||
dd -1,4
|
||||
dd 0
|
||||
dd 0
|
||||
; ä« ¦®ª "“ç¨âë¢ âì ॣ¨áâà"
|
||||
dd 5
|
||||
dd 1,5
|
||||
dd -1,5
|
||||
dd aCaseSensitive
|
||||
.flags_case dd ? ; 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
|
||||
; £®à¨§®â «ìë© à §¤¥«¨â¥«ì
|
||||
dd 4
|
||||
dd -1,7
|
||||
dd -1,7
|
||||
dd 0
|
||||
dd 0
|
||||
; ª®¯ª "ˆáª âì"
|
||||
.search_btn:
|
||||
dd 2
|
||||
.search_x1 dd ?
|
||||
dd 8
|
||||
.search_x2 dd ?
|
||||
dd 8
|
||||
dd aSearchB
|
||||
dd 18h
|
||||
; ª®¯ª "®â¬¥¨âì"
|
||||
dd 2
|
||||
.cnl_x1 dd ?
|
||||
dd 8
|
||||
.cnl_x2 dd ?
|
||||
dd 8
|
||||
dd aCancelB
|
||||
dd 8
|
||||
.size = $ - filesearch_query_template
|
||||
|
||||
; ¢â®à®© ¤¨ «®£ ¯®¨áª ¢ ä ©« å (᪠¨à®¢ ¨¥)
|
||||
filesearch_search_template:
|
||||
dd 1
|
||||
.x dd ?
|
||||
.y dd ?
|
||||
.width dd ?
|
||||
.height dd ?
|
||||
dd 4, 2
|
||||
.caption dd ?
|
||||
dd ?
|
||||
dd 0
|
||||
dd 0, 0
|
||||
dd 9
|
||||
; ᯨ᮪ ©¤¥ëå ä ©«®¢
|
||||
dd 6
|
||||
dd 0, 0
|
||||
.width1 dd ?
|
||||
.height1 dd ?
|
||||
.data1 dd ?
|
||||
dd 0
|
||||
; £®à¨§®â «ìë© à §¤¥«¨â¥«ì
|
||||
dd 4
|
||||
dd -1
|
||||
.y2 dd ?
|
||||
dd -1
|
||||
dd ?
|
||||
dd 0, 0
|
||||
; áâப "<22>®¨áª <string> ¢:" «¨¡® "<22>®¨áª § ª®ç¥..."
|
||||
dd 1
|
||||
dd 1
|
||||
.y3 dd ?
|
||||
.width3 dd ?
|
||||
dd ?
|
||||
.data3 dd ?
|
||||
dd 0
|
||||
; áâப á ⥪ã饩 ¯ ¯ª®©
|
||||
dd 1
|
||||
.x4 dd ?
|
||||
.y4 dd ?
|
||||
.width4 dd ?
|
||||
dd ?
|
||||
.data4 dd ?
|
||||
dd 0
|
||||
; £®à¨§®â «ìë© à §¤¥«¨â¥«ì
|
||||
dd 4
|
||||
dd -1
|
||||
.y5 dd ?
|
||||
dd -1
|
||||
dd ?
|
||||
dd 0, 0
|
||||
; ª®¯ª¨
|
||||
.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
|
||||
|
||||
RetryOrCancelBtn:
|
||||
dd aRetry
|
||||
dd a_Cancel
|
||||
@ -7708,18 +8068,23 @@ DeleteOrCancelBtn:
|
||||
dd a_Cancel
|
||||
DeleteErrorBtn:
|
||||
dd aRetry
|
||||
SkipOrCancelBtn:
|
||||
dd aSkip
|
||||
dd aSkipAll
|
||||
dd a_Cancel
|
||||
ContinueBtn:
|
||||
dd aContinue
|
||||
|
||||
EditorExitBtn:
|
||||
dd aSave
|
||||
dd aDontSave
|
||||
dd aContinueEdit
|
||||
YesOrNoBtn:
|
||||
dd aYes
|
||||
dd aNo
|
||||
|
||||
aCannotOpenFile_ptr dd aCannotOpenFile
|
||||
aCannotCreateThread_ptr dd aCannotCreateThread
|
||||
ConfirmCancelMsg dd aConfirmCancel
|
||||
EditConfigErr_ptr:
|
||||
dd aEditConfigErr1
|
||||
dd aEditConfigErr2
|
||||
@ -7731,6 +8096,8 @@ aConfirmDeleteTextMax = $ - aConfirmDeleteText - 2
|
||||
aDeleteFile db ' ä ©«',0
|
||||
aCancelB db '[ Žâ¬¥¨âì ]',0
|
||||
aCancelBLength = $ - aCancelB - 1
|
||||
aCancelB2 db '[ Žâ¬¥ ]',0
|
||||
aCancelB2Length = $ - aCancelB2 - 1
|
||||
aCopyCaption db 'Š®¯¨à®¢ ¨¥',0
|
||||
aCopy db '[ Š®¯¨à®¢ âì ]',0
|
||||
aCopyLength = $ - aCopy - 1
|
||||
@ -7745,6 +8112,8 @@ a_Cancel db '
|
||||
a_Delete db '“¤ «¨âì',0
|
||||
aSkip db '<27>யãáâ¨âì',0
|
||||
aSkipAll db '<27>யãáâ¨âì ¢á¥',0
|
||||
aYes db '„ ',0
|
||||
aNo db '<27>¥â',0
|
||||
error0msg db '‘âà ®... <20>¥â ®è¨¡ª¨',0
|
||||
error1msg db '‘âà ®... <20>¥ ®¯à¥¤¥«¥ ¡ § ¨/¨«¨ à §¤¥« ¦ñá⪮£® ¤¨áª ',0
|
||||
error2msg db '”ãªæ¨ï ¥ ¯®¤¤¥à¦¨¢ ¥âáï ¤«ï ¤ ®© ä ©«®¢®© á¨á⥬ë',0
|
||||
@ -7793,8 +8162,32 @@ aTables db '
|
||||
aSelect db '<27>®¬¥â¨âì',0
|
||||
aDeselect db '‘ïâì',0
|
||||
aCannotOpenFile db 'Žè¨¡ª ¯à¨ ®âªàë⨨ ä ©« ',0
|
||||
aCannotCreateThread db 'Žè¨¡ª ¯à¨ ᮧ¤ ¨¨ ¯®â®ª ',0
|
||||
aCannotSetFolder db '<27>¥ ¬®£ã § ©â¨ ¢ ¯ ¯ªã',0
|
||||
aSearch db '<27>®¨áª',0
|
||||
aSearchB db '[ ˆáª âì ]',0
|
||||
aSearchBLength = $ - aSearchB - 1
|
||||
aSearchFor db 'ˆáª âì',0
|
||||
aSearchForLen = $ - aSearchFor - 1
|
||||
aCaseSensitive db '“ç¨âë¢ âì ॣ¨áâà',0
|
||||
aWholeWords db '’®«ìª® æ¥«ë¥ á«®¢ ',0
|
||||
aReverseSearch db 'Ž¡à âë© ¯®¨áª',0
|
||||
aStringNotFound db '‘âப ¥ ©¤¥ ',0
|
||||
aFileSearch db '<27>®¨áª ä ©« ',0
|
||||
aFileMasks db 'Ž¤ ¨«¨ ¥áª®«ìª® ¬ ᮪ ä ©«®¢:',0
|
||||
aFileMasksLen = $ - aFileMasks - 1
|
||||
aContainingText db '‘®¤¥à¦ é¨å ⥪áâ:',0
|
||||
aContainingTextLen = $ - aContainingText - 1
|
||||
aSearchingIn db '<27>®¨áª "" ¢:',0
|
||||
aSearchingInLen = $ - aSearchingIn - 1
|
||||
aSearchDone db '<27>®¨áª § ª®ç¥. <20> ©¤¥® ? ä ©«(®¢)',0
|
||||
aSearchDoneLen = $ - aSearchDone - 1
|
||||
aNewSearch db '[ <20>®¢ë© ¯®¨áª ]',0
|
||||
aNewSearchLen = $ - aNewSearch - 1
|
||||
aGoto db '[ <20>¥à¥©â¨ ]',0
|
||||
aGotoLen = $ - aGoto - 1
|
||||
aView db '[ ‘¬®âà¥âì ]',0
|
||||
aViewLen = $ - aView - 1
|
||||
aEditConfigErr1 db 'Žè¨¡ª ¢ ª®ä¨£ãà 樨 ¯« £¨®¢ ¤«ï । ªâ®à .',0
|
||||
aEditConfigErr2 db '<27>®¯à®¡ã©â¥ ã¡à âì «¨è¨¥ ¯« £¨ë.',0
|
||||
aEditNoMemory db '” ©« ᫨誮¬ ¢¥«¨ª ¤«ï § £à㧪¨ ¢ । ªâ®à.',0
|
||||
@ -7806,6 +8199,9 @@ aSave db '
|
||||
aDontSave db '<27>¥ á®åà ïâì',0
|
||||
aContinueEdit db '<27>த®«¦¨âì । ªâ¨à®¢ ¨¥',0
|
||||
aCannotSaveToPlugin db '‘®åà ¥¨¥ ä ©«®¢ ¯ ¥«ïå ¯« £¨®¢ ¥ ¯®¤¤¥à¦¨¢ ¥âáï',0
|
||||
aCannotSearchOnPlugin db '<27>®¨áª ¯ ¥«ïå ¯« £¨®¢ ¥ ¯®¤¤¥à¦¨¢ ¥âáï',0
|
||||
aCancelled db '„¥©á⢨¥ ¡ë«® ¯à¥à¢ ®',0
|
||||
aConfirmCancel db '‚ë ¤¥©áâ¢¨â¥«ì® å®â¨â¥ ®â¬¥¨âì ¤¥©á⢨¥?',0
|
||||
else
|
||||
aDeleteCaption db 'Delete',0
|
||||
aConfirmDeleteText db 'Do you wish to delete',0
|
||||
@ -7832,6 +8228,8 @@ a_Cancel db 'Cancel',0
|
||||
a_Delete db 'Delete',0
|
||||
aSkip db 'Skip',0
|
||||
aSkipAll db 'Skip all',0
|
||||
aYes db 'Yes',0
|
||||
aNo db 'No',0
|
||||
error0msg db 'Strange... No error',0
|
||||
error1msg db 'Strange... Hard disk base and/or partition not defined',0
|
||||
error2msg db 'The file system does not support this function',0
|
||||
@ -7880,8 +8278,30 @@ aTables db 'Tables',0
|
||||
aSelect db 'Select',0
|
||||
aDeselect db 'Deselect',0
|
||||
aCannotOpenFile db 'Cannot open the file',0
|
||||
aCannotSetFolder db 'Cannot enter to folder',0
|
||||
aCannotCreateThread db 'Cannot create a thread',0
|
||||
aCannotSetFolder db 'Cannot enter to the folder',0
|
||||
aSearch db 'Search',0
|
||||
aSearchB db '[ Search ]',0
|
||||
aSearchBLength = $ - aSearchB - 1
|
||||
aSearchFor db 'Search for',0
|
||||
aSearchForLen = $ - aSearch - 1
|
||||
aCaseSensitive db 'Case sensitive',0
|
||||
aWholeWords db 'Whole words',0
|
||||
aReverseSearch db 'Reverse search',0
|
||||
aStringNotFound db 'Could not find the string',0
|
||||
aFileSearch db 'Find file',0
|
||||
aFileMasks db 'A file mask or several file masks:',0
|
||||
aContainingText db 'Containing text:',0
|
||||
aSearchingIn db 'Searching "" in:',0
|
||||
aSearchingInLen = $ - aSearchingIn - 1
|
||||
aSearchDone db 'Search done. Found ? file(s)',0
|
||||
aSearchDoneLen = $ - aSearchDone - 1
|
||||
aNewSearch db '[ New search ]',0
|
||||
aNewSearchLen = $ - aNewSearch - 1
|
||||
aGoto db '[ Go to ]',0
|
||||
aGotoLen = $ - aGoto - 1
|
||||
aView db '[ View ]',0
|
||||
aViewLen = $ - aView - 1
|
||||
aEditConfigErr1 db 'Error in configuration of plugins for the editor.',0
|
||||
aEditConfigErr2 db 'Try to remove unnecessary plugins.',0
|
||||
aLine db ' Line'
|
||||
@ -7892,6 +8312,8 @@ aSave db 'Save',0
|
||||
aDontSave db 'Do not save',0
|
||||
aContinueEdit db 'Continue editing',0
|
||||
aCannotSaveToPlugin db 'Saving is not supported for plugin panels',0
|
||||
aCancelled db 'Operation has been interrupted',0
|
||||
aConfirmCancel db 'Do you really want to cancel it?',0
|
||||
end if
|
||||
|
||||
aOk db 'OK',0
|
||||
@ -8263,6 +8685,7 @@ screens dd ?
|
||||
num_screens dd ?
|
||||
active_screen_vtable dd ?
|
||||
active_screen_data dd ?
|
||||
active_screen_keybar dd ?
|
||||
|
||||
default_attr dd ?
|
||||
left_dotdot_entry rb 40+4 ; 40 bytes for attributes + '..'
|
||||
@ -8273,12 +8696,20 @@ CopySourceTextBuf rb 512
|
||||
CopyDestEditBuf rb 12+512+1
|
||||
.length = $ - CopyDestEditBuf - 13
|
||||
|
||||
SearchStringEditBuf rb 12
|
||||
SearchString rb 253+1
|
||||
SearchStringEditBuf.length = $ - SearchString - 1
|
||||
db ? ; used for output (string -> "string")
|
||||
|
||||
enter_string_buf rb 12+512+1
|
||||
|
||||
bMemForImageValidData db ?
|
||||
|
||||
align 4
|
||||
identical_table rb 256
|
||||
tolower_table rb 256
|
||||
isspace_table rb 256
|
||||
composite_table rb 256
|
||||
layout rb 128
|
||||
|
||||
copy_buffer_size = 65536
|
||||
|
@ -42,6 +42,7 @@ Alt+<
|
||||
в котором можно вводить дальнейшие символы имени файла для уточнения,
|
||||
а также Ctrl+Enter/Shift+Ctrl+Enter для перемещения к следующему/предыдущему
|
||||
элементу панели, имя которого начинается с введённых букв
|
||||
Alt+F7 - вызов диалога поиска файлов
|
||||
|
||||
В просмотрщике:
|
||||
Esc = F3 = F10 = Numpad5 - выход
|
||||
@ -66,6 +67,10 @@ Shift+F8 -
|
||||
F12 - вызов меню экранов
|
||||
Alt+F9 - разворачивание окна к максимально возможным размерам и
|
||||
восстановление размеров
|
||||
F7 - поиск строки с текущей позиции в файле
|
||||
(строка и настройки поиска задаются в появляющемся диалоге)
|
||||
Shift+F7 - продолжение поиска строки
|
||||
(используются последние заданные настройки поиска и строка)
|
||||
|
||||
В редакторе:
|
||||
Esc = F10 - выход; если файл был модифицирован, последует вопрос о
|
||||
@ -86,6 +91,10 @@ Ins -
|
||||
F12 - вызов меню экранов
|
||||
Alt+F9 - разворачивание окна к максимально возможным размерам и
|
||||
восстановление размеров
|
||||
F7 - поиск строки с текущей позиции в файле
|
||||
(строка и настройки поиска задаются в появляющемся диалоге)
|
||||
Shift+F7 - продолжение поиска строки
|
||||
(используются последние заданные настройки поиска и строка)
|
||||
|
||||
diamond
|
||||
mailto:diamondz@land.ru
|
||||
|
203
programs/fs/kfar/trunk/search.inc
Normal file
203
programs/fs/kfar/trunk/search.inc
Normal file
@ -0,0 +1,203 @@
|
||||
; in: ebx -> pattern (not empty zero-terminated string), esi -> translation table,
|
||||
; dword [esp+4] = encoding, byte [esp+8] non-zero for whole words only
|
||||
; out: edx and ecx -> preprocessed data
|
||||
; when search will be done, edx must be pgfree()d
|
||||
search_string_pre:
|
||||
; FSM is used, number of states is limited by 256, so pattern length must be <= 255
|
||||
; anyway, for big patterns FSM uses too many memory, so probably it is not best choice
|
||||
; get pattern length, m
|
||||
or ecx, -1
|
||||
@@:
|
||||
inc ecx
|
||||
cmp byte [ecx+ebx], 0
|
||||
jnz @b
|
||||
cmp byte [esp+8], 0
|
||||
jz @f
|
||||
inc ecx
|
||||
inc ecx
|
||||
@@:
|
||||
push ecx
|
||||
; allocate m*257 bytes for FSM and prefix function
|
||||
imul ecx, 257
|
||||
call xpgalloc
|
||||
pop ecx
|
||||
test eax, eax
|
||||
jnz @f
|
||||
ret 8
|
||||
@@:
|
||||
shl ecx, 8
|
||||
push eax
|
||||
add eax, ecx
|
||||
; calculate prefix function
|
||||
xor ecx, ecx
|
||||
mov byte [eax], cl
|
||||
xor edi, edi
|
||||
cmp byte [esp+4+8], 0
|
||||
jnz .whole.prefixcalc
|
||||
.prefixcalc:
|
||||
inc edi
|
||||
movzx edx, byte [ebx+edi]
|
||||
mov dl, [esi+edx]
|
||||
test dl, dl
|
||||
jz .prefixdone
|
||||
@@:
|
||||
push eax
|
||||
movzx eax, byte [ebx+ecx]
|
||||
cmp dl, [esi+eax]
|
||||
pop eax
|
||||
jz @f
|
||||
jecxz .prefixint
|
||||
mov cl, byte [eax+ecx-1]
|
||||
jmp @b
|
||||
@@:
|
||||
inc ecx
|
||||
.prefixint:
|
||||
mov [eax+edi], cl
|
||||
jmp .prefixcalc
|
||||
.whole.prefixcalc:
|
||||
inc edi
|
||||
movzx edx, byte [ebx+edi-1]
|
||||
mov dl, [esi+edx]
|
||||
test dl, dl
|
||||
jz .whole.prefixdone
|
||||
.whole.prefixloop:
|
||||
jecxz .whole.testfirst
|
||||
push eax
|
||||
movzx eax, byte [ebx+ecx-1]
|
||||
cmp dl, [esi+eax]
|
||||
pop eax
|
||||
jz @f
|
||||
mov cl, byte [eax+ecx-1]
|
||||
jmp .whole.prefixloop
|
||||
.whole.testfirst:
|
||||
cmp [isspace_table+edx], 0
|
||||
jz .whole.prefixint
|
||||
@@:
|
||||
inc ecx
|
||||
.whole.prefixint:
|
||||
mov [eax+edi], cl
|
||||
jmp .whole.prefixcalc
|
||||
.whole.prefixdone:
|
||||
jecxz @f
|
||||
push eax
|
||||
movzx eax, byte [ebx+ecx-1]
|
||||
mov al, [esi+eax]
|
||||
cmp [isspace_table+eax], 0
|
||||
pop eax
|
||||
jnz @f
|
||||
mov cl, byte [eax+ecx-1]
|
||||
jmp .whole.prefixdone
|
||||
@@:
|
||||
inc ecx
|
||||
mov [eax+edi], cl
|
||||
.prefixdone:
|
||||
pop edx
|
||||
; create reverse table for encoding+translation
|
||||
push ebp
|
||||
movzx ebp, byte [esp+8]
|
||||
cmp ebp, encodings.unicode
|
||||
jb @f
|
||||
xor ebp, ebp ; no translations for Unicode encodings,
|
||||
; they must be handled separately by caller
|
||||
@@:
|
||||
mov ecx, 256
|
||||
@@:
|
||||
push 0
|
||||
loop @b
|
||||
push ebx eax
|
||||
mov ebx, esp
|
||||
shl ebp, 7
|
||||
xor eax, eax
|
||||
.createrev:
|
||||
dec cl
|
||||
mov al, cl
|
||||
jns @f
|
||||
mov al, byte [encodings.tables+ebp+ecx-80h]
|
||||
@@:
|
||||
mov al, [esi+eax]
|
||||
pushd [ebx+8+eax*4]
|
||||
pushd ecx
|
||||
mov [ebx+8+eax*4], esp
|
||||
jnz .createrev
|
||||
@@:
|
||||
dec cl
|
||||
mov al, [esi+ecx]
|
||||
pushd [ebx+8+eax*4]
|
||||
popd [ebx+8+ecx*4]
|
||||
jnz @b
|
||||
; create FSM
|
||||
xor ecx, ecx
|
||||
cmp byte [ebx+259*4+8], 0
|
||||
mov eax, [ebx]
|
||||
mov ebx, [ebx+4]
|
||||
mov edi, edx
|
||||
jz .fsmcalc
|
||||
mov esi, isspace_table
|
||||
push 256/4
|
||||
pop ecx
|
||||
rep movsd
|
||||
inc ecx
|
||||
.fsmcalc:
|
||||
movzx esi, byte [eax+ecx]
|
||||
push eax
|
||||
push ecx
|
||||
push 256/4
|
||||
pop ecx
|
||||
dec esi
|
||||
js .fsmzero
|
||||
shl esi, 8
|
||||
add esi, edx
|
||||
rep movsd
|
||||
jmp .fsmnext
|
||||
.fsmzero:
|
||||
cmp byte [esp+261*4+256*8+8], 0
|
||||
jnz .whole.fsmzero
|
||||
xor eax, eax
|
||||
rep stosd
|
||||
jmp .fsmnext
|
||||
.whole.fsmzero:
|
||||
mov esi, edx
|
||||
rep movsd
|
||||
.fsmnext:
|
||||
pop ecx
|
||||
movzx esi, byte [ebx]
|
||||
inc ecx
|
||||
mov esi, [esp+4+8*256+8+esi*4]
|
||||
@@:
|
||||
test esi, esi
|
||||
jz @f
|
||||
lodsd
|
||||
mov [edi-256+eax], cl
|
||||
mov esi, [esi]
|
||||
jmp @b
|
||||
@@:
|
||||
inc ebx
|
||||
pop eax
|
||||
cmp byte [ebx], 0
|
||||
jnz .fsmcalc
|
||||
cmp byte [esp+259*4+256*8+8], 0
|
||||
jz .nowholefin
|
||||
movzx esi, byte [eax+ecx]
|
||||
push ecx
|
||||
mov ecx, 256
|
||||
push 256/4
|
||||
pop ecx
|
||||
dec esi
|
||||
shl esi, 8
|
||||
add esi, edx
|
||||
rep movsd
|
||||
pop ecx
|
||||
inc ecx
|
||||
xor eax, eax
|
||||
.whole.fsmfin:
|
||||
cmp [isspace_table+eax], ah
|
||||
jz @f
|
||||
mov byte [edi-256+eax], cl
|
||||
@@:
|
||||
inc al
|
||||
jnz .whole.fsmfin
|
||||
.nowholefin:
|
||||
; ok, now edx -> FSM, cl = final state
|
||||
add esp, 8*256+8+4*256
|
||||
pop ebp
|
||||
ret 8
|
@ -15,6 +15,8 @@ viewer_data:
|
||||
; & 4: big-endian unicode
|
||||
.bEofReached db ?
|
||||
rb 1
|
||||
.selected_start dq ?
|
||||
.selected_len dq ?
|
||||
align 200h
|
||||
.filename rb 1024
|
||||
.hostname rb 1024
|
||||
@ -23,22 +25,30 @@ viewer_data:
|
||||
end virtual
|
||||
|
||||
view_file:
|
||||
mov eax, [ebp + panel1_files - panel1_data]
|
||||
mov ecx, [eax+ecx*4]
|
||||
test byte [ecx], 10h
|
||||
jz .file
|
||||
ret
|
||||
.file:
|
||||
lea esi, [ebp + panel1_dir - panel1_data]
|
||||
push ecx
|
||||
push eax ecx
|
||||
mov ecx, viewer_data.size
|
||||
mov edx, viewer_vtable
|
||||
call new_screen
|
||||
pop ecx
|
||||
test eax, eax
|
||||
pop eax
|
||||
jnz @f
|
||||
ret
|
||||
@@:
|
||||
test eax, eax
|
||||
jz .frompanel
|
||||
and dword [ebp+viewer_data.hPlugin], 0
|
||||
and dword [ebp+viewer_data.hFile], 0
|
||||
mov byte [ebp+viewer_data.hostname], 0
|
||||
lea edi, [ebp+viewer_data.filename]
|
||||
push edi
|
||||
@@:
|
||||
lodsb
|
||||
stosb
|
||||
test al, al
|
||||
jnz @b
|
||||
jmp .namecopied
|
||||
.frompanel:
|
||||
mov eax, dword [esi+panel1_hPlugin-panel1_dir]
|
||||
mov [ebp+viewer_data.hPlugin], eax
|
||||
test eax, eax
|
||||
@ -63,10 +73,6 @@ view_file:
|
||||
.nocopyhostname:
|
||||
mov eax, dword [esi+panel1_hFile-panel1_dir]
|
||||
mov [ebp+viewer_data.hFile], eax
|
||||
mov [ebp+viewer_data.encoding], encodings.cp866
|
||||
mov [ebp+viewer_data.flags], 0
|
||||
and dword [ebp+viewer_data.col], 0
|
||||
and dword [ebp+viewer_data.col+4], 0
|
||||
lea edi, [ebp+viewer_data.filename]
|
||||
push edi
|
||||
@@:
|
||||
@ -86,6 +92,13 @@ view_file:
|
||||
stosb
|
||||
test al, al
|
||||
jnz @b
|
||||
.namecopied:
|
||||
xor eax, eax
|
||||
mov [ebp+viewer_data.encoding], al ;encodings.cp866 = 0
|
||||
mov [ebp+viewer_data.flags], al
|
||||
mov dword [ebp+viewer_data.col], eax
|
||||
mov dword [ebp+viewer_data.col+4], eax
|
||||
call viewer_clear_selection
|
||||
pop eax
|
||||
push eax
|
||||
mov ebx, attrinfo
|
||||
@ -221,8 +234,7 @@ viewer_OnRedraw:
|
||||
call viewer_draw_text
|
||||
ret
|
||||
|
||||
viewer_get_next_char:
|
||||
pusha
|
||||
viewer_skip_unicode_marker:
|
||||
cmp [ebp+viewer_data.encoding], encodings.unicode
|
||||
jnz @f
|
||||
cmp [bForHex], 0
|
||||
@ -241,15 +253,9 @@ viewer_get_next_char:
|
||||
.skip:
|
||||
add [ebp+viewer_data.buf_pos], 2
|
||||
@@:
|
||||
mov eax, [ebp+viewer_data.buf_pos]
|
||||
lea ecx, [ebp+viewer_data.buf]
|
||||
add ecx, [ebp+viewer_data.buf_size]
|
||||
cmp eax, ecx
|
||||
jb .buffered
|
||||
mov al, ' '
|
||||
sub ecx, ebp
|
||||
cmp ecx, viewer_data.buf + 16384
|
||||
jb .err
|
||||
ret
|
||||
|
||||
viewer_load_next:
|
||||
mov eax, dword [ebp+viewer_data.buf_start]
|
||||
add eax, 8192
|
||||
mov dword [ebp+viewer_data.buf_start], eax
|
||||
@ -300,7 +306,22 @@ viewer_get_next_char:
|
||||
add ebx, 16384-8192
|
||||
mov [ebp+viewer_data.buf_size], ebx
|
||||
mov eax, [ebp+viewer_data.buf_pos]
|
||||
cmp ecx, 16384-8192
|
||||
cmp ebx, 16384-8192
|
||||
ret
|
||||
|
||||
viewer_get_next_char:
|
||||
pusha
|
||||
call viewer_skip_unicode_marker
|
||||
mov eax, [ebp+viewer_data.buf_pos]
|
||||
lea ecx, [ebp+viewer_data.buf]
|
||||
add ecx, [ebp+viewer_data.buf_size]
|
||||
cmp eax, ecx
|
||||
jb .buffered
|
||||
mov al, ' '
|
||||
sub ecx, ebp
|
||||
cmp ecx, viewer_data.buf + 16384
|
||||
jb .err
|
||||
call viewer_load_next
|
||||
jnz .buffered
|
||||
.err:
|
||||
stc
|
||||
@ -408,6 +429,13 @@ uni2ansi_char:
|
||||
add al, 0xA0
|
||||
ret
|
||||
|
||||
viewer_clear_selection:
|
||||
and dword [ebp+viewer_data.selected_start], 0
|
||||
and dword [ebp+viewer_data.selected_start+4], 0
|
||||
and dword [ebp+viewer_data.selected_len], 0
|
||||
and dword [ebp+viewer_data.selected_len+4], 0
|
||||
ret
|
||||
|
||||
fld_uint64:
|
||||
fild qword [eax]
|
||||
test byte [eax+7], 80h
|
||||
@ -698,6 +726,7 @@ end if
|
||||
div ecx
|
||||
pop eax
|
||||
sub ecx, edx
|
||||
pop edx
|
||||
add eax, ecx
|
||||
test [ebp+viewer_data.flags], 2
|
||||
jnz @f
|
||||
@ -713,7 +742,6 @@ end if
|
||||
call .write_char
|
||||
loop @b
|
||||
pop ecx
|
||||
pop edx
|
||||
jmp .1
|
||||
.done:
|
||||
setc [ebp+viewer_data.bEofReached]
|
||||
@ -971,6 +999,24 @@ end if
|
||||
.do:
|
||||
mov al, [esp]
|
||||
mov ah, [view_normal_color]
|
||||
push edx
|
||||
mov ecx, [ebp+viewer_data.buf_pos]
|
||||
sub ecx, ebp
|
||||
sub ecx, viewer_data.buf + 1
|
||||
xor edx, edx
|
||||
add ecx, dword [ebp+viewer_data.buf_start]
|
||||
adc edx, dword [ebp+viewer_data.buf_start+4]
|
||||
sub ecx, dword [ebp+viewer_data.selected_start]
|
||||
sbb edx, dword [ebp+viewer_data.selected_start+4]
|
||||
cmp edx, dword [ebp+viewer_data.selected_len+4]
|
||||
ja .color_ok
|
||||
jb @f
|
||||
cmp ecx, dword [ebp+viewer_data.selected_len]
|
||||
jae .color_ok
|
||||
@@:
|
||||
mov ah, [view_selected_color]
|
||||
.color_ok:
|
||||
pop edx
|
||||
stosw
|
||||
.skip:
|
||||
pop eax ecx
|
||||
@ -1585,6 +1631,179 @@ viewer_OnKey:
|
||||
adc dword [ebp+viewer_data.cur_pos+4], 0
|
||||
and dword [ebp+viewer_data.cur_pos], not 1
|
||||
jmp .done_redraw_keybar
|
||||
.f7:
|
||||
call viewer_clear_selection
|
||||
call find_in_file_dlg
|
||||
jz .shift_f7
|
||||
.ret2:
|
||||
ret
|
||||
.shift_f7:
|
||||
; search string SearchString in file starting from current position
|
||||
cmp byte [SearchString], 0
|
||||
jz .ret2
|
||||
mov eax, dword [ebp+viewer_data.selected_start]
|
||||
mov edx, dword [ebp+viewer_data.selected_start+4]
|
||||
inc eax
|
||||
jnz @f
|
||||
inc edx
|
||||
@@:
|
||||
cmp dword [ebp+viewer_data.selected_len], 0
|
||||
jnz @f
|
||||
cmp dword [ebp+viewer_data.selected_len+4], 0
|
||||
jnz @f
|
||||
mov eax, dword [ebp+viewer_data.cur_pos]
|
||||
mov edx, dword [ebp+viewer_data.cur_pos+4]
|
||||
@@:
|
||||
call viewer_clear_selection
|
||||
call viewer_seek
|
||||
call viewer_skip_unicode_marker
|
||||
mov esi, tolower_table
|
||||
test [find_in_file_dlgdata.flags_case], 10h
|
||||
jz @f
|
||||
mov esi, identical_table
|
||||
@@:
|
||||
mov ebx, SearchString
|
||||
test [find_in_file_dlgdata.flags_whole], 10h
|
||||
setnz al
|
||||
push eax
|
||||
push dword [ebp+viewer_data.encoding]
|
||||
call search_string_pre
|
||||
mov esi, [ebp+viewer_data.buf_pos]
|
||||
lea ebx, [ebp+viewer_data.buf]
|
||||
add ebx, [ebp+viewer_data.buf_size]
|
||||
mov edi, edx
|
||||
cmp esi, ebx
|
||||
jb @f
|
||||
sub ebx, ebp
|
||||
cmp ebx, viewer_data.buf + 16384
|
||||
jnz .f7.notfound
|
||||
pusha
|
||||
call viewer_load_next
|
||||
popa
|
||||
jz .f7.notfound
|
||||
mov esi, [ebp+viewer_data.buf_pos]
|
||||
lea ebx, [ebp+viewer_data.buf]
|
||||
add ebx, [ebp+viewer_data.buf_size]
|
||||
@@:
|
||||
test [find_in_file_dlgdata.flags_whole], 10h
|
||||
jz .search_loop
|
||||
cmp dword [ebp+viewer_data.buf_start], 0
|
||||
jnz @f
|
||||
cmp dword [ebp+viewer_data.buf_start+4], 0
|
||||
jnz @f
|
||||
lea eax, [ebp+viewer_data.buf]
|
||||
cmp [ebp+viewer_data.buf_pos], eax
|
||||
jz .f7.startspace
|
||||
@@:
|
||||
xor eax, eax
|
||||
call viewer_get_prev_char
|
||||
inc esi
|
||||
cmp [isspace_table+eax], 0
|
||||
jz .search_loop
|
||||
.f7.startspace:
|
||||
add edi, 256
|
||||
.search_loop:
|
||||
; edx -> FSM, ecx = last state, edi = current state,
|
||||
; esi = buf_pos, ebx = end of buffer
|
||||
; get current symbol
|
||||
movzx eax, byte [esi]
|
||||
; calculate next state
|
||||
movzx edi, byte [edi+eax]
|
||||
; done?
|
||||
cmp edi, ecx
|
||||
jz .f7.found
|
||||
.search_loop_next:
|
||||
; no; proceed to next symbol
|
||||
shl edi, 8
|
||||
add esi, 1
|
||||
add edi, edx
|
||||
cmp esi, ebx
|
||||
jb .search_loop
|
||||
sub ebx, ebp
|
||||
cmp ebx, viewer_data.buf + 16384
|
||||
jnz .f7.notfound
|
||||
mov [ebp+viewer_data.buf_pos], esi
|
||||
pusha
|
||||
call viewer_load_next
|
||||
popa
|
||||
jz .f7.notfoundt
|
||||
mov esi, [ebp+viewer_data.buf_pos]
|
||||
lea ebx, [ebp+viewer_data.buf]
|
||||
add ebx, [ebp+viewer_data.buf_size]
|
||||
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
|
||||
jz .f7.notfound
|
||||
movzx edi, byte [edi+' ']
|
||||
inc esi
|
||||
cmp edi, ecx
|
||||
jz .f7.found
|
||||
.f7.notfound:
|
||||
call search_failed
|
||||
jmp .done_redraw
|
||||
.f7.found:
|
||||
push ecx
|
||||
mov ecx, edx
|
||||
call pgfree
|
||||
mov [ebp+viewer_data.buf_pos], esi
|
||||
call viewer_set_curpos
|
||||
pop ecx
|
||||
mov dword [ebp+viewer_data.selected_len], ecx
|
||||
and dword [ebp+viewer_data.selected_len+4], 0
|
||||
dec ecx
|
||||
sub eax, ecx
|
||||
sbb edx, 0
|
||||
mov dword [ebp+viewer_data.selected_start], eax
|
||||
mov dword [ebp+viewer_data.selected_start+4], edx
|
||||
inc eax
|
||||
jnz @f
|
||||
inc edx
|
||||
@@:
|
||||
test [find_in_file_dlgdata.flags_whole], 10h
|
||||
jz @f
|
||||
sub dword [ebp+viewer_data.selected_len], 2
|
||||
sbb dword [ebp+viewer_data.selected_len+4], 0
|
||||
mov dword [ebp+viewer_data.selected_start], eax
|
||||
mov dword [ebp+viewer_data.selected_start+4], edx
|
||||
inc eax
|
||||
jnz @f
|
||||
inc edx
|
||||
@@:
|
||||
mov dword [ebp+viewer_data.cur_pos], eax
|
||||
mov dword [ebp+viewer_data.cur_pos+4], edx
|
||||
call viewer_seek
|
||||
call viewer_prev_newline
|
||||
jmp .done_redraw
|
||||
|
||||
search_failed:
|
||||
mov ecx, edx
|
||||
call pgfree
|
||||
mov eax, SearchString-1
|
||||
push dword [eax-3]
|
||||
push eax
|
||||
mov byte [eax], '"'
|
||||
@@:
|
||||
inc eax
|
||||
cmp byte [eax], 0
|
||||
jnz @b
|
||||
mov word [eax], '"'
|
||||
xchg eax, [esp]
|
||||
push eax
|
||||
push aStringNotFound
|
||||
mov eax, esp
|
||||
push ContinueBtn
|
||||
push 1
|
||||
push eax
|
||||
push 2
|
||||
push aSearch
|
||||
call SayErrTitle
|
||||
pop eax
|
||||
pop eax
|
||||
pop ecx
|
||||
mov byte [ecx], 0
|
||||
pop dword [eax-3]
|
||||
ret
|
||||
|
||||
viewer_getname:
|
||||
if lang eq ru
|
||||
|
Loading…
Reference in New Issue
Block a user