Subversion Repositories Kolibri OS

Rev

Rev 814 | Rev 1122 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 814 Rev 997
Line 13... Line 13...
13
        .flags          db      ?       ; & 1: hex mode
13
        .flags          db      ?       ; & 1: hex mode
14
                                        ; & 2: unwrap
14
                                        ; & 2: unwrap
15
                                        ; & 4: big-endian unicode
15
                                        ; & 4: big-endian unicode
16
        .bEofReached    db      ?
16
        .bEofReached    db      ?
17
                        rb      1
17
                        rb      1
-
 
18
        .selected_start dq      ?
-
 
19
        .selected_len   dq      ?
18
        align 200h
20
        align 200h
19
        .filename       rb      1024
21
        .filename       rb      1024
20
        .hostname       rb      1024
22
        .hostname       rb      1024
21
        .buf            rb      16384
23
        .buf            rb      16384
22
        .size = $
24
        .size = $
23
end virtual
25
end virtual
Line 24... Line 26...
24
 
26
 
25
view_file:
-
 
26
        mov     eax, [ebp + panel1_files - panel1_data]
-
 
27
        mov     ecx, [eax+ecx*4]
-
 
28
        test    byte [ecx], 10h
-
 
29
        jz      .file
-
 
30
        ret
-
 
31
.file:
-
 
32
        lea     esi, [ebp + panel1_dir - panel1_data]
27
view_file:
33
        push    ecx
28
        push    eax ecx
34
        mov     ecx, viewer_data.size
29
        mov     ecx, viewer_data.size
35
        mov     edx, viewer_vtable
30
        mov     edx, viewer_vtable
36
        call    new_screen
31
        call    new_screen
37
        pop     ecx
32
        pop     ecx
-
 
33
        test    eax, eax
38
        test    eax, eax
34
        pop     eax
39
        jnz     @f
35
        jnz     @f
40
        ret
36
        ret
-
 
37
@@:
-
 
38
        test    eax, eax
-
 
39
        jz      .frompanel
-
 
40
        and     dword [ebp+viewer_data.hPlugin], 0
-
 
41
        and     dword [ebp+viewer_data.hFile], 0
-
 
42
        mov     byte [ebp+viewer_data.hostname], 0
-
 
43
        lea     edi, [ebp+viewer_data.filename]
-
 
44
        push    edi
-
 
45
@@:
-
 
46
        lodsb
-
 
47
        stosb
-
 
48
        test    al, al
-
 
49
        jnz     @b
-
 
50
        jmp     .namecopied
41
@@:
51
.frompanel:
42
        mov     eax, dword [esi+panel1_hPlugin-panel1_dir]
52
        mov     eax, dword [esi+panel1_hPlugin-panel1_dir]
43
        mov     [ebp+viewer_data.hPlugin], eax
53
        mov     [ebp+viewer_data.hPlugin], eax
44
        test    eax, eax
54
        test    eax, eax
45
        jz      .nocopyhostname
55
        jz      .nocopyhostname
Line 61... Line 71...
61
        jnz     @b
71
        jnz     @b
62
        pop     esi
72
        pop     esi
63
.nocopyhostname:
73
.nocopyhostname:
64
        mov     eax, dword [esi+panel1_hFile-panel1_dir]
74
        mov     eax, dword [esi+panel1_hFile-panel1_dir]
65
        mov     [ebp+viewer_data.hFile], eax
75
        mov     [ebp+viewer_data.hFile], eax
66
        mov     [ebp+viewer_data.encoding], encodings.cp866
-
 
67
        mov     [ebp+viewer_data.flags], 0
-
 
68
        and     dword [ebp+viewer_data.col], 0
-
 
69
        and     dword [ebp+viewer_data.col+4], 0
-
 
70
        lea     edi, [ebp+viewer_data.filename]
76
        lea     edi, [ebp+viewer_data.filename]
71
        push    edi
77
        push    edi
72
@@:
78
@@:
73
        lodsb
79
        lodsb
74
        test    al, al
80
        test    al, al
Line 84... Line 90...
84
@@:
90
@@:
85
        lodsb
91
        lodsb
86
        stosb
92
        stosb
87
        test    al, al
93
        test    al, al
88
        jnz     @b
94
        jnz     @b
-
 
95
.namecopied:
-
 
96
        xor     eax, eax
-
 
97
        mov     [ebp+viewer_data.encoding], al ;encodings.cp866 = 0
-
 
98
        mov     [ebp+viewer_data.flags], al
-
 
99
        mov     dword [ebp+viewer_data.col], eax
-
 
100
        mov     dword [ebp+viewer_data.col+4], eax
-
 
101
        call    viewer_clear_selection
89
        pop     eax
102
        pop     eax
90
        push    eax
103
        push    eax
91
        mov     ebx, attrinfo
104
        mov     ebx, attrinfo
92
        mov     [ebx+21], eax
105
        mov     [ebx+21], eax
93
.attr_retry:
106
.attr_retry:
Line 219... Line 232...
219
        or      [cursor_y], -1
232
        or      [cursor_y], -1
220
        call    viewer_set_keybar
233
        call    viewer_set_keybar
221
        call    viewer_draw_text
234
        call    viewer_draw_text
222
        ret
235
        ret
Line 223... Line 236...
223
 
236
 
224
viewer_get_next_char:
-
 
225
        pusha
237
viewer_skip_unicode_marker:
226
        cmp     [ebp+viewer_data.encoding], encodings.unicode
238
        cmp     [ebp+viewer_data.encoding], encodings.unicode
227
        jnz     @f
239
        jnz     @f
228
        cmp     [bForHex], 0
240
        cmp     [bForHex], 0
229
        jnz     @f
241
        jnz     @f
Line 239... Line 251...
239
        cmp     word [eax], 0xFEFF
251
        cmp     word [eax], 0xFEFF
240
        jnz     @f
252
        jnz     @f
241
.skip:
253
.skip:
242
        add     [ebp+viewer_data.buf_pos], 2
254
        add     [ebp+viewer_data.buf_pos], 2
243
@@:
255
@@:
244
        mov     eax, [ebp+viewer_data.buf_pos]
-
 
245
        lea     ecx, [ebp+viewer_data.buf]
-
 
246
        add     ecx, [ebp+viewer_data.buf_size]
-
 
247
        cmp     eax, ecx
-
 
248
        jb      .buffered
256
        ret
249
        mov     al, ' '
-
 
250
        sub     ecx, ebp
-
 
251
        cmp     ecx, viewer_data.buf + 16384
-
 
-
 
257
 
252
        jb      .err
258
viewer_load_next:
253
        mov     eax, dword [ebp+viewer_data.buf_start]
259
        mov     eax, dword [ebp+viewer_data.buf_start]
254
        add     eax, 8192
260
        add     eax, 8192
255
        mov     dword [ebp+viewer_data.buf_start], eax
261
        mov     dword [ebp+viewer_data.buf_start], eax
256
        mov     edx, dword [ebp+viewer_data.buf_start+4]
262
        mov     edx, dword [ebp+viewer_data.buf_start+4]
257
        adc     edx, 0
263
        adc     edx, 0
Line 298... Line 304...
298
.readok:
304
.readok:
299
        sub     [ebp+viewer_data.buf_pos], 8192
305
        sub     [ebp+viewer_data.buf_pos], 8192
300
        add     ebx, 16384-8192
306
        add     ebx, 16384-8192
301
        mov     [ebp+viewer_data.buf_size], ebx
307
        mov     [ebp+viewer_data.buf_size], ebx
302
        mov     eax, [ebp+viewer_data.buf_pos]
308
        mov     eax, [ebp+viewer_data.buf_pos]
303
        cmp     ecx, 16384-8192
309
        cmp     ebx, 16384-8192
-
 
310
        ret
-
 
311
 
-
 
312
viewer_get_next_char:
-
 
313
        pusha
-
 
314
        call    viewer_skip_unicode_marker
-
 
315
        mov     eax, [ebp+viewer_data.buf_pos]
-
 
316
        lea     ecx, [ebp+viewer_data.buf]
-
 
317
        add     ecx, [ebp+viewer_data.buf_size]
-
 
318
        cmp     eax, ecx
-
 
319
        jb      .buffered
-
 
320
        mov     al, ' '
-
 
321
        sub     ecx, ebp
-
 
322
        cmp     ecx, viewer_data.buf + 16384
-
 
323
        jb      .err
-
 
324
        call    viewer_load_next
304
        jnz     .buffered
325
        jnz     .buffered
305
.err:
326
.err:
306
        stc
327
        stc
307
        popa
328
        popa
308
        ret
329
        ret
Line 406... Line 427...
406
.rus2:
427
.rus2:
407
; 0x440-0x44F -> 0xE0-0xEF
428
; 0x440-0x44F -> 0xE0-0xEF
408
        add     al, 0xA0
429
        add     al, 0xA0
409
        ret
430
        ret
Line -... Line 431...
-
 
431
 
-
 
432
viewer_clear_selection:
-
 
433
        and     dword [ebp+viewer_data.selected_start], 0
-
 
434
        and     dword [ebp+viewer_data.selected_start+4], 0
-
 
435
        and     dword [ebp+viewer_data.selected_len], 0
-
 
436
        and     dword [ebp+viewer_data.selected_len+4], 0
-
 
437
        ret
410
 
438
 
411
fld_uint64:
439
fld_uint64:
412
        fild    qword [eax]
440
        fild    qword [eax]
413
        test    byte [eax+7], 80h
441
        test    byte [eax+7], 80h
414
        jz      .ret
442
        jz      .ret
Line 696... Line 724...
696
        mov     ecx, [viewer_tabsize]
724
        mov     ecx, [viewer_tabsize]
697
        xor     edx, edx
725
        xor     edx, edx
698
        div     ecx
726
        div     ecx
699
        pop     eax
727
        pop     eax
700
        sub     ecx, edx
728
        sub     ecx, edx
-
 
729
        pop     edx
701
        add     eax, ecx
730
        add     eax, ecx
702
        test    [ebp+viewer_data.flags], 2
731
        test    [ebp+viewer_data.flags], 2
703
        jnz     @f
732
        jnz     @f
704
        cmp     eax, [cur_width]
733
        cmp     eax, [cur_width]
705
        jbe     @f
734
        jbe     @f
Line 711... Line 740...
711
        mov     al, ' '
740
        mov     al, ' '
712
@@:
741
@@:
713
        call    .write_char
742
        call    .write_char
714
        loop    @b
743
        loop    @b
715
        pop     ecx
744
        pop     ecx
716
        pop     edx
-
 
717
        jmp     .1
745
        jmp     .1
718
.done:
746
.done:
719
        setc    [ebp+viewer_data.bEofReached]
747
        setc    [ebp+viewer_data.bEofReached]
720
.done2:
748
.done2:
721
        inc     edx
749
        inc     edx
Line 969... Line 997...
969
        stosw
997
        stosw
970
        jmp     .skip
998
        jmp     .skip
971
.do:
999
.do:
972
        mov     al, [esp]
1000
        mov     al, [esp]
973
        mov     ah, [view_normal_color]
1001
        mov     ah, [view_normal_color]
-
 
1002
        push    edx
-
 
1003
        mov     ecx, [ebp+viewer_data.buf_pos]
-
 
1004
        sub     ecx, ebp
-
 
1005
        sub     ecx, viewer_data.buf + 1
-
 
1006
        xor     edx, edx
-
 
1007
        add     ecx, dword [ebp+viewer_data.buf_start]
-
 
1008
        adc     edx, dword [ebp+viewer_data.buf_start+4]
-
 
1009
        sub     ecx, dword [ebp+viewer_data.selected_start]
-
 
1010
        sbb     edx, dword [ebp+viewer_data.selected_start+4]
-
 
1011
        cmp     edx, dword [ebp+viewer_data.selected_len+4]
-
 
1012
        ja      .color_ok
-
 
1013
        jb      @f
-
 
1014
        cmp     ecx, dword [ebp+viewer_data.selected_len]
-
 
1015
        jae     .color_ok
-
 
1016
@@:
-
 
1017
        mov     ah, [view_selected_color]
-
 
1018
.color_ok:
-
 
1019
        pop     edx
974
        stosw
1020
        stosw
975
.skip:
1021
.skip:
976
        pop     eax ecx
1022
        pop     eax ecx
977
        add     dword [scrpos], 1
1023
        add     dword [scrpos], 1
978
        adc     dword [scrpos+4], 0
1024
        adc     dword [scrpos+4], 0
Line 1583... Line 1629...
1583
        jnz     .done_redraw_keybar
1629
        jnz     .done_redraw_keybar
1584
        add     dword [ebp+viewer_data.cur_pos], 1
1630
        add     dword [ebp+viewer_data.cur_pos], 1
1585
        adc     dword [ebp+viewer_data.cur_pos+4], 0
1631
        adc     dword [ebp+viewer_data.cur_pos+4], 0
1586
        and     dword [ebp+viewer_data.cur_pos], not 1
1632
        and     dword [ebp+viewer_data.cur_pos], not 1
1587
        jmp     .done_redraw_keybar
1633
        jmp     .done_redraw_keybar
-
 
1634
.f7:
-
 
1635
        call    viewer_clear_selection
-
 
1636
        call    find_in_file_dlg
-
 
1637
        jz      .shift_f7
-
 
1638
.ret2:
-
 
1639
        ret
-
 
1640
.shift_f7:
-
 
1641
; search string SearchString in file starting from current position
-
 
1642
        cmp     byte [SearchString], 0
-
 
1643
        jz      .ret2
-
 
1644
        mov     eax, dword [ebp+viewer_data.selected_start]
-
 
1645
        mov     edx, dword [ebp+viewer_data.selected_start+4]
-
 
1646
        inc     eax
-
 
1647
        jnz     @f
-
 
1648
        inc     edx
-
 
1649
@@:
-
 
1650
        cmp     dword [ebp+viewer_data.selected_len], 0
-
 
1651
        jnz     @f
-
 
1652
        cmp     dword [ebp+viewer_data.selected_len+4], 0
-
 
1653
        jnz     @f
-
 
1654
        mov     eax, dword [ebp+viewer_data.cur_pos]
-
 
1655
        mov     edx, dword [ebp+viewer_data.cur_pos+4]
-
 
1656
@@:
-
 
1657
        call    viewer_clear_selection
-
 
1658
        call    viewer_seek
-
 
1659
        call    viewer_skip_unicode_marker
-
 
1660
        mov     esi, tolower_table
-
 
1661
        test    [find_in_file_dlgdata.flags_case], 10h
-
 
1662
        jz      @f
-
 
1663
        mov     esi, identical_table
-
 
1664
@@:
-
 
1665
        mov     ebx, SearchString
-
 
1666
 	test	[find_in_file_dlgdata.flags_whole], 10h
-
 
1667
	setnz	al
-
 
1668
	push	eax
-
 
1669
        push    dword [ebp+viewer_data.encoding]
-
 
1670
        call    search_string_pre
-
 
1671
        mov     esi, [ebp+viewer_data.buf_pos]
-
 
1672
        lea     ebx, [ebp+viewer_data.buf]
-
 
1673
        add     ebx, [ebp+viewer_data.buf_size]
-
 
1674
        mov     edi, edx
-
 
1675
        cmp     esi, ebx
-
 
1676
        jb      @f
-
 
1677
        sub     ebx, ebp
-
 
1678
        cmp     ebx, viewer_data.buf + 16384
-
 
1679
        jnz     .f7.notfound
-
 
1680
        pusha
-
 
1681
        call    viewer_load_next
-
 
1682
        popa
-
 
1683
        jz      .f7.notfound
-
 
1684
        mov     esi, [ebp+viewer_data.buf_pos]
-
 
1685
        lea     ebx, [ebp+viewer_data.buf]
-
 
1686
        add     ebx, [ebp+viewer_data.buf_size]
-
 
1687
@@:
-
 
1688
        test    [find_in_file_dlgdata.flags_whole], 10h
-
 
1689
        jz      .search_loop
-
 
1690
        cmp     dword [ebp+viewer_data.buf_start], 0
-
 
1691
        jnz     @f
-
 
1692
        cmp     dword [ebp+viewer_data.buf_start+4], 0
-
 
1693
        jnz     @f
-
 
1694
        lea     eax, [ebp+viewer_data.buf]
-
 
1695
        cmp     [ebp+viewer_data.buf_pos], eax
-
 
1696
        jz      .f7.startspace
-
 
1697
@@:
-
 
1698
        xor     eax, eax
-
 
1699
        call    viewer_get_prev_char
-
 
1700
        inc     esi
-
 
1701
        cmp     [isspace_table+eax], 0
-
 
1702
        jz      .search_loop
-
 
1703
.f7.startspace:
-
 
1704
        add     edi, 256
-
 
1705
.search_loop:
-
 
1706
; edx -> FSM, ecx = last state, edi = current state,
-
 
1707
; esi = buf_pos, ebx = end of buffer
-
 
1708
; get current symbol
-
 
1709
        movzx   eax, byte [esi]
-
 
1710
; calculate next state
-
 
1711
        movzx   edi, byte [edi+eax]
-
 
1712
; done?
-
 
1713
        cmp     edi, ecx
-
 
1714
        jz      .f7.found
-
 
1715
.search_loop_next:
-
 
1716
; no; proceed to next symbol
-
 
1717
        shl     edi, 8
-
 
1718
        add     esi, 1
-
 
1719
        add     edi, edx
-
 
1720
        cmp     esi, ebx
-
 
1721
        jb      .search_loop
-
 
1722
        sub     ebx, ebp
-
 
1723
        cmp     ebx, viewer_data.buf + 16384
-
 
1724
        jnz     .f7.notfound
-
 
1725
        mov     [ebp+viewer_data.buf_pos], esi
-
 
1726
        pusha
-
 
1727
        call    viewer_load_next
-
 
1728
        popa
-
 
1729
        jz      .f7.notfoundt
-
 
1730
        mov     esi, [ebp+viewer_data.buf_pos]
-
 
1731
        lea     ebx, [ebp+viewer_data.buf]
-
 
1732
        add     ebx, [ebp+viewer_data.buf_size]
-
 
1733
        jmp     .search_loop
-
 
1734
.f7.notfoundt:
-
 
1735
; last chance - if we are looking for a whole word, EOF is ok for last symbol
-
 
1736
        test    [find_in_file_dlgdata.flags_whole], 10h
-
 
1737
        jz      .f7.notfound
-
 
1738
        movzx   edi, byte [edi+' ']
-
 
1739
        inc     esi
-
 
1740
        cmp     edi, ecx
-
 
1741
        jz      .f7.found
-
 
1742
.f7.notfound:
-
 
1743
        call    search_failed
-
 
1744
        jmp     .done_redraw
-
 
1745
.f7.found:
-
 
1746
        push    ecx
-
 
1747
        mov     ecx, edx
-
 
1748
        call    pgfree
-
 
1749
        mov     [ebp+viewer_data.buf_pos], esi
-
 
1750
        call    viewer_set_curpos
-
 
1751
        pop     ecx
-
 
1752
        mov     dword [ebp+viewer_data.selected_len], ecx
-
 
1753
        and     dword [ebp+viewer_data.selected_len+4], 0
-
 
1754
        dec     ecx
-
 
1755
        sub     eax, ecx
-
 
1756
        sbb     edx, 0
-
 
1757
        mov     dword [ebp+viewer_data.selected_start], eax
-
 
1758
        mov     dword [ebp+viewer_data.selected_start+4], edx
-
 
1759
        inc     eax
-
 
1760
        jnz     @f
-
 
1761
        inc     edx
-
 
1762
@@:
-
 
1763
        test    [find_in_file_dlgdata.flags_whole], 10h
-
 
1764
        jz      @f
-
 
1765
        sub     dword [ebp+viewer_data.selected_len], 2
-
 
1766
        sbb     dword [ebp+viewer_data.selected_len+4], 0
-
 
1767
        mov     dword [ebp+viewer_data.selected_start], eax
-
 
1768
        mov     dword [ebp+viewer_data.selected_start+4], edx
-
 
1769
        inc     eax
-
 
1770
        jnz     @f
-
 
1771
        inc     edx
-
 
1772
@@:
-
 
1773
        mov     dword [ebp+viewer_data.cur_pos], eax
-
 
1774
        mov     dword [ebp+viewer_data.cur_pos+4], edx
-
 
1775
        call    viewer_seek
-
 
1776
        call    viewer_prev_newline
-
 
1777
        jmp     .done_redraw
-
 
1778
 
-
 
1779
search_failed:
-
 
1780
	mov	ecx, edx
-
 
1781
	call	pgfree
-
 
1782
	mov	eax, SearchString-1
-
 
1783
	push	dword [eax-3]
-
 
1784
	push	eax
-
 
1785
	mov	byte [eax], '"'
-
 
1786
@@:
-
 
1787
	inc	eax
-
 
1788
	cmp	byte [eax], 0
-
 
1789
	jnz	@b
-
 
1790
	mov	word [eax], '"'
-
 
1791
	xchg	eax, [esp]
-
 
1792
	push	eax
-
 
1793
	push	aStringNotFound
-
 
1794
	mov	eax, esp
-
 
1795
	push	ContinueBtn
-
 
1796
	push	1
-
 
1797
	push	eax
-
 
1798
	push	2
-
 
1799
	push	aSearch
-
 
1800
	call	SayErrTitle
-
 
1801
	pop	eax
-
 
1802
	pop	eax
-
 
1803
	pop	ecx
-
 
1804
	mov	byte [ecx], 0
-
 
1805
	pop	dword [eax-3]
-
 
1806
	ret
Line 1588... Line 1807...
1588
 
1807
 
1589
viewer_getname:
1808
viewer_getname:
1590
if lang eq ru
1809
if lang eq ru
1591
        mov     eax, 'à®á'
1810
        mov     eax, 'à®á'