Rev 8532 | Rev 8852 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8532 | Rev 8533 | ||
---|---|---|---|
1 | ; ¬ ªà®á ¤«ï á¨á⥬®© ¡¨¡«¨®â¥ª¨ box_lib.obj |
1 | ; ¬ ªà®á ¤«ï á¨á⥬®© ¡¨¡«¨®â¥ª¨ box_lib.obj |
2 | ; í«¥¬¥â TextEditor ¤«ï Kolibri OS |
2 | ; í«¥¬¥â TextEditor ¤«ï Kolibri OS |
3 | ; ä ©« ¯®á«¥¤¨© à § ¨§¬¥ï«áï 10.06.2020 IgorA |
3 | ; ä ©« ¯®á«¥¤¨© à § ¨§¬¥ï«áï 12.01.2021 IgorA |
4 | ; ª®¤ ¯à¨¬¥¥ GPL2 «¨æ¥§¨ï |
4 | ; ª®¤ ¯à¨¬¥¥ GPL2 «¨æ¥§¨ï |
5 | 5 | ||
6 | ;input: |
6 | ;input: |
7 | ; edi = pointer to tedit struct |
7 | ; edi = pointer to tedit struct |
8 | ; reg = index |
8 | ; reg = index |
9 | ;output: |
9 | ;output: |
10 | ; reg = pointer to 'tex' struct |
10 | ; reg = pointer to 'tex' struct |
11 | macro ConvertIndexToPointer reg { |
11 | macro ConvertIndexToPointer reg { |
12 | imul reg,sizeof.symbol |
12 | imul reg,sizeof.symbol |
13 | add reg,ted_tex |
13 | add reg,ted_tex |
14 | } |
14 | } |
15 | 15 | ||
16 | ;--- out_reg = ted_key_words_data[ind_reg].Text[0] --- |
16 | ;--- out_reg = ted_key_words_data[ind_reg].Text[0] --- |
17 | macro ColToIndexOffset ind_reg,out_reg { |
17 | macro ColToIndexOffset ind_reg,out_reg { |
18 | mov out_reg,ind_reg |
18 | mov out_reg,ind_reg |
19 | imul out_reg,sizeof.TexColViv |
19 | imul out_reg,sizeof.TexColViv |
20 | add out_reg,ted_key_words_data |
20 | add out_reg,ted_key_words_data |
21 | } |
21 | } |
22 | 22 | ||
23 | TED_LINES_IN_NEW_FILE equ 30 ;ç¨á«® áâப ¢ ®¢®¬ ä ©«¥ |
23 | TED_LINES_IN_NEW_FILE equ 30 ;ç¨á«® áâப ¢ ®¢®¬ ä ©«¥ |
24 | MAX_COLOR_WORD_LEN equ 40 |
24 | MAX_COLOR_WORD_LEN equ 40 |
25 | ;------------------------------------------------------------------------------ |
25 | ;------------------------------------------------------------------------------ |
26 | struct TexSelect |
26 | struct TexSelect |
27 | x0 dd ? |
27 | x0 dd ? |
28 | y0 dd ? |
28 | y0 dd ? |
29 | x1 dd ? |
29 | x1 dd ? |
30 | y1 dd ? |
30 | y1 dd ? |
31 | ends |
31 | ends |
32 | 32 | ||
33 | struct TexColViv |
33 | struct TexColViv |
34 | Text rb MAX_COLOR_WORD_LEN ; á«®¢® ¤«ï ¯®¤á¢¥âª¨ |
34 | Text rb MAX_COLOR_WORD_LEN ; á«®¢® ¤«ï ¯®¤á¢¥âª¨ |
35 | f1 dd 0 ; á¯à ¢ª ¯® á«®¢ã |
35 | f1 dd 0 ; á¯à ¢ª ¯® á«®¢ã |
36 | flags db ? ; f1+4 ä« £¨ ¨á¯®«ì§ã¥¬ë¥ ¯à¨ ¢ë¤¥«¥¨¨ |
36 | flags db ? ; f1+4 ä« £¨ ¨á¯®«ì§ã¥¬ë¥ ¯à¨ ¢ë¤¥«¥¨¨ |
37 | endc db ? ; f1+5 ᨬ¢®« ª®æ ¢ë¤¥«¥¨ï (¨á¯®«ì§ã¥âáï ¯à¨ flags&4) |
37 | endc db ? ; f1+5 ᨬ¢®« ª®æ ¢ë¤¥«¥¨ï (¨á¯®«ì§ã¥âáï ¯à¨ flags&4) |
38 | escc db ? ; f1+6 íªà ¨àãî騩 ᨬ¢®« (¨á¯®«ì§ã¥âáï ¯à¨ flags&4) |
38 | escc db ? ; f1+6 íªà ¨àãî騩 ᨬ¢®« (¨á¯®«ì§ã¥âáï ¯à¨ flags&4) |
39 | color db ? ; f1+7 ®¬¥à 梥â |
39 | color db ? ; f1+7 ®¬¥à 梥â |
40 | ends |
40 | ends |
41 | 41 | ||
42 | struct symbol |
42 | struct symbol |
43 | c db ? ; +0 ᨬ¢®« |
43 | c db ? ; +0 ᨬ¢®« |
44 | col db ? ; +1 梥â |
44 | col db ? ; +1 梥â |
45 | perv dd ? ; +2 |
45 | perv dd ? ; +2 |
46 | next dd ? ; +6 㪠§ ⥫¨ |
46 | next dd ? ; +6 㪠§ ⥫¨ |
47 | tc dd ? ; +10 ¢à¥¬. ᮧ¤ ¨ï |
47 | tc dd ? ; +10 ¢à¥¬. ᮧ¤ ¨ï |
48 | td dd ? ; +14 ¢à¥¬. 㤠«¥¨ï |
48 | td dd ? ; +14 ¢à¥¬. 㤠«¥¨ï |
49 | ends |
49 | ends |
50 | ;------------------------------------------------------------------------------ |
50 | ;------------------------------------------------------------------------------ |
51 | 51 | ||
52 | ted_symbol_space db 32 ;ascii ª®¤ ¯à®¡¥« , ¨®£¤ ¡ë¢ ¥â 㦥 ¢ ª®¤¥ |
52 | ted_symbol_space db 32 ;ascii ª®¤ ¯à®¡¥« , ¨®£¤ ¡ë¢ ¥â 㦥 ¢ ª®¤¥ |
53 | ted_symbol_tab db 26 ;ascii ª®¤ áâ५ª¨ ¢¯à ¢®, ¨á¯®«ì§ã¥âáï ¤«ï à¨á®¢ ¨ï â ¡ã«ï樨 ¢ ०¨¬¥ ¯®ª § ¥¢¨¤¨¬ëå ᨬ¢®«®¢ |
53 | ted_symbol_tab db 26 ;ascii ª®¤ áâ५ª¨ ¢¯à ¢®, ¨á¯®«ì§ã¥âáï ¤«ï à¨á®¢ ¨ï â ¡ã«ï樨 ¢ ०¨¬¥ ¯®ª § ¥¢¨¤¨¬ëå ᨬ¢®«®¢ |
54 | 54 | ||
55 | if lang eq ru |
55 | if lang eq ru |
56 | 56 | ||
57 | txtRow db 'âப ',0 |
57 | txtRow db 'âப ',0 |
58 | txtCol db ' ª',0 |
58 | txtCol db ' ª',0 |
59 | txtOtm db '⬥ë',0 |
59 | txtOtm db '⬥ë',0 |
60 | txtBuf db 'ãä¥à:',0 |
60 | txtBuf db 'ãä¥à:',0 |
61 | 61 | ||
62 | else |
62 | else |
63 | 63 | ||
64 | txtRow db 'Rows',0 |
64 | txtRow db 'Rows',0 |
65 | txtCol db 'Cols',0 |
65 | txtCol db 'Cols',0 |
66 | txtOtm db 'Undo',0 |
66 | txtOtm db 'Undo',0 |
67 | txtBuf db 'Buffer:',0 |
67 | txtBuf db 'Buffer:',0 |
68 | 68 | ||
69 | end if |
69 | end if |
70 | 70 | ||
71 | ;EvChar - â ¡«¨æ ¤«ï 䨫ìâ஢ ¨ï ¤®¡ ¢«ï¥¬ëå ᨬ¢®«®¢, çâ®-¡ë ¥ ¯®¯ «¨ «¨è¨¥ § ª¨ |
71 | ;EvChar - â ¡«¨æ ¤«ï 䨫ìâ஢ ¨ï ¤®¡ ¢«ï¥¬ëå ᨬ¢®«®¢, çâ®-¡ë ¥ ¯®¯ «¨ «¨è¨¥ § ª¨ |
72 | align 16 |
72 | align 16 |
73 | EvChar db 0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0 |
73 | EvChar db 0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0 |
74 | db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 |
74 | db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 |
75 | db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 |
75 | db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 |
76 | db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 |
76 | db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 |
77 | db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 |
77 | db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 |
78 | db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 |
78 | db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 |
79 | db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 |
79 | db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 |
80 | db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0 |
80 | db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0 |
81 | db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 |
81 | db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 |
82 | db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 |
82 | db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 |
83 | db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 |
83 | db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 |
84 | db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 |
84 | db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 |
85 | db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 |
85 | db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 |
86 | db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 |
86 | db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 |
87 | db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 |
87 | db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 |
88 | db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 |
88 | db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 |
89 | 89 | ||
90 | KM_SHIFT equ 0x00010000 |
90 | KM_SHIFT equ 0x00010000 |
91 | KM_CTRL equ 0x00020000 |
91 | KM_CTRL equ 0x00020000 |
92 | KM_ALT equ 0x00040000 |
92 | KM_ALT equ 0x00040000 |
93 | KM_NUMLOCK equ 0x00080000 |
93 | KM_NUMLOCK equ 0x00080000 |
94 | 94 | ||
95 | ; KEY CODES |
95 | ; KEY CODES |
96 | KEY_F1 equ 0x0000003B |
96 | KEY_F1 equ 0x0000003B |
97 | KEY_F2 equ 0x0000003C |
97 | KEY_F2 equ 0x0000003C |
98 | KEY_F3 equ 0x0000003D |
98 | KEY_F3 equ 0x0000003D |
99 | 99 | ||
100 | 100 | ||
101 | 101 | ||
102 | align 16 |
102 | align 16 |
103 | proc ted_init uses eax ecx edi, edit:dword |
103 | proc ted_init uses eax ecx edi, edit:dword |
104 | mov edi,[edit] |
104 | mov edi,[edit] |
105 | 105 | ||
106 | mov ecx,sizeof.symbol |
106 | mov ecx,sizeof.symbol |
107 | imul ecx,ted_max_chars |
107 | imul ecx,ted_max_chars |
108 | invoke mem.alloc,ecx ;¢ë¤¥«ï¥¬ ¯ ¬ïâì |
108 | invoke mem.alloc,ecx ;¢ë¤¥«ï¥¬ ¯ ¬ïâì |
109 | mov ted_tex,eax |
109 | mov ted_tex,eax |
110 | mov ted_tex_1,eax |
110 | mov ted_tex_1,eax |
111 | add ted_tex_1,sizeof.symbol |
111 | add ted_tex_1,sizeof.symbol |
112 | add eax,ecx |
112 | add eax,ecx |
113 | mov ted_tex_end,eax |
113 | mov ted_tex_end,eax |
114 | 114 | ||
115 | stdcall ted_clear, edi,1 |
115 | stdcall ted_clear, edi,1 |
116 | 116 | ||
117 | ;------------------------------------------------- |
117 | ;------------------------------------------------- |
118 | mov ecx,1024 ;1024 - ¤«ï ¬ áᨢ ted_arr_key_pos |
118 | mov ecx,1024 ;1024 - ¤«ï ¬ áᨢ ted_arr_key_pos |
119 | add ecx,ted_syntax_file_size |
119 | add ecx,ted_syntax_file_size |
120 | invoke mem.alloc,ecx |
120 | invoke mem.alloc,ecx |
121 | mov ted_arr_key_pos,eax |
121 | mov ted_arr_key_pos,eax |
122 | add eax,1024 |
122 | add eax,1024 |
123 | mov ted_syntax_file,eax |
123 | mov ted_syntax_file,eax |
124 | 124 | ||
125 | stdcall ted_init_scroll_bars,edi,3 |
125 | stdcall ted_init_scroll_bars,edi,3 |
126 | ret |
126 | ret |
127 | endp |
127 | endp |
128 | 128 | ||
129 | MIN_W_SCRL_ARE equ 3 ;¬¨¨¬ «ì ï ®â®¡à ¦ ¥¬ ï ®¡« áâì ¤«ï ¢¥àâ. áªà®««¨£ |
129 | MIN_W_SCRL_ARE equ 3 ;¬¨¨¬ «ì ï ®â®¡à ¦ ¥¬ ï ®¡« áâì ¤«ï ¢¥àâ. áªà®««¨£ |
130 | MIN_H_SCRL_ARE equ 3 ;¬¨¨¬ «ì ï ®â®¡à ¦ ¥¬ ï ®¡« áâì ¤«ï £®à¨§. áªà®««¨£ |
130 | MIN_H_SCRL_ARE equ 3 ;¬¨¨¬ «ì ï ®â®¡à ¦ ¥¬ ï ®¡« áâì ¤«ï £®à¨§. áªà®««¨£ |
131 | ;input: |
131 | ;input: |
132 | ; opt = 1 - ¬¥ïâì 梥â áªà®««¨£®¢, 2 - ¨§¬¥¨«¨áì à §¬¥àë ®ª , |
132 | ; opt = 1 - ¬¥ïâì 梥â áªà®««¨£®¢, 2 - ¨§¬¥¨«¨áì à §¬¥àë ®ª , |
133 | ; 4 - ¨§¬¥¨«¨áì à §¬¥àë ¤®ªã¬¥â |
133 | ; 4 - ¨§¬¥¨«¨áì à §¬¥àë ¤®ªã¬¥â |
134 | align 16 |
134 | align 16 |
135 | proc ted_init_scroll_bars, edit:dword, opt:dword |
135 | proc ted_init_scroll_bars, edit:dword, opt:dword |
136 | pushad |
136 | pushad |
137 | mov edi,[edit] |
137 | mov edi,[edit] |
138 | mov esi,ted_scr_w |
138 | mov esi,ted_scr_w |
139 | mov ebx,ted_scr_h |
139 | mov ebx,ted_scr_h |
140 | bt dword[opt],0 |
140 | bt dword[opt],0 |
141 | jae @f |
141 | jae @f |
142 | mov ecx,ted_color_wnd_work |
142 | mov ecx,ted_color_wnd_work |
143 | mov dword[esi+sb_offs_bckg_col],ecx |
143 | mov dword[esi+sb_offs_bckg_col],ecx |
144 | mov dword[ebx+sb_offs_bckg_col],ecx |
144 | mov dword[ebx+sb_offs_bckg_col],ecx |
145 | mov ecx,ted_color_wnd_capt |
145 | mov ecx,ted_color_wnd_capt |
146 | mov dword[esi+sb_offs_frnt_col],ecx |
146 | mov dword[esi+sb_offs_frnt_col],ecx |
147 | mov dword[ebx+sb_offs_frnt_col],ecx |
147 | mov dword[ebx+sb_offs_frnt_col],ecx |
148 | mov ecx,ted_color_wnd_bord |
148 | mov ecx,ted_color_wnd_bord |
149 | mov dword[esi+sb_offs_line_col],ecx |
149 | mov dword[esi+sb_offs_line_col],ecx |
150 | mov dword[ebx+sb_offs_line_col],ecx |
150 | mov dword[ebx+sb_offs_line_col],ecx |
151 | @@: |
151 | @@: |
152 | bt dword[opt],2 ; ¨§¬¥¨«¨áì à §¬¥àë ¤®ªã¬¥â ? |
152 | bt dword[opt],2 ; ¨§¬¥¨«¨áì à §¬¥àë ¤®ªã¬¥â ? |
153 | jae .doc_resize |
153 | jae .doc_resize |
154 | call ted_get_num_lines |
154 | call ted_get_num_lines |
155 | cmp eax,TED_LINES_IN_NEW_FILE |
155 | cmp eax,TED_LINES_IN_NEW_FILE |
156 | jge @f |
156 | jge @f |
157 | mov eax,TED_LINES_IN_NEW_FILE |
157 | mov eax,TED_LINES_IN_NEW_FILE |
158 | @@: |
158 | @@: |
159 | mov dword[esi+sb_offs_max_area],eax |
159 | mov dword[esi+sb_offs_max_area],eax |
160 | .doc_resize: |
160 | .doc_resize: |
161 | bt dword[opt],1 ; ¨§¬¥¨«¨áì à §¬¥àë ®ª ? |
161 | bt dword[opt],1 ; ¨§¬¥¨«¨áì à §¬¥àë ®ª ? |
162 | jae .no_size |
162 | jae .no_size |
163 | mov edx,ted_wnd_l |
163 | mov edx,ted_wnd_l |
164 | add edx,ted_rec_l |
164 | add edx,ted_rec_l |
165 | mov word[ebx+sb_offs_start_x],dx ;¢ëáâ ¢«ï¥¬ «¥¢ë© ®âáâ㯠£®à¨§. áªà®««¨£ |
165 | mov word[ebx+sb_offs_start_x],dx ;¢ëáâ ¢«ï¥¬ «¥¢ë© ®âáâ㯠£®à¨§. áªà®««¨£ |
166 | mov eax,ted_wnd_h ;calculate lines in page |
166 | mov eax,ted_wnd_h ;calculate lines in page |
167 | mov edx,ted_wnd_t |
167 | mov edx,ted_wnd_t |
168 | add edx,eax |
168 | add edx,eax |
169 | mov word[ebx+sb_offs_start_y],dx ;¢ëáâ ¢«ï¥¬ ¢¥à娩 ®âáâ㯠£®à¨§. áªà®««¨£ |
169 | mov word[ebx+sb_offs_start_y],dx ;¢ëáâ ¢«ï¥¬ ¢¥à娩 ®âáâ㯠£®à¨§. áªà®««¨£ |
170 | sub eax,ted_rec_t |
170 | sub eax,ted_rec_t |
171 | xor edx,edx |
171 | xor edx,edx |
172 | mov ecx,ted_rec_h |
172 | mov ecx,ted_rec_h |
173 | div ecx |
173 | div ecx |
174 | cmp eax,MIN_W_SCRL_ARE |
174 | cmp eax,MIN_W_SCRL_ARE |
175 | jg @f |
175 | jg @f |
176 | mov eax,MIN_W_SCRL_ARE |
176 | mov eax,MIN_W_SCRL_ARE |
177 | @@: |
177 | @@: |
178 | mov dword[esi+sb_offs_cur_area],eax |
178 | mov dword[esi+sb_offs_cur_area],eax |
179 | 179 | ||
180 | mov eax,ted_wnd_w ;calculate cols in page |
180 | mov eax,ted_wnd_w ;calculate cols in page |
181 | mov edx,ted_wnd_l ;«¥¢ë© ®âáâ㯠®ª |
181 | mov edx,ted_wnd_l ;«¥¢ë© ®âáâ㯠®ª |
182 | add edx,eax ;¤®¡ ¢«ï¥¬ è¨à¨ã ®ª |
182 | add edx,eax ;¤®¡ ¢«ï¥¬ è¨à¨ã ®ª |
183 | mov word[esi+sb_offs_start_x],dx ;¢ëáâ ¢«ï¥¬ «¥¢ë© ®âáâ㯠¢¥àâ. áªà®««¨£ |
183 | mov word[esi+sb_offs_start_x],dx ;¢ëáâ ¢«ï¥¬ «¥¢ë© ®âáâ㯠¢¥àâ. áªà®««¨£ |
184 | mov edx,ted_wnd_t |
184 | mov edx,ted_wnd_t |
185 | mov word[esi+sb_offs_start_y],dx ;¢ëáâ ¢«ï¥¬ ¢¥à娩 ®âáâ㯠¢¥àâ. áªà®««¨£ |
185 | mov word[esi+sb_offs_start_y],dx ;¢ëáâ ¢«ï¥¬ ¢¥à娩 ®âáâ㯠¢¥àâ. áªà®««¨£ |
186 | mov edx,ted_wnd_h |
186 | mov edx,ted_wnd_h |
187 | mov word[esi+sb_offs_size_y],dx ;¢ëáâ ¢«ï¥¬ ¢ëá®âã ¢¥àâ. áªà®««¨£ |
187 | mov word[esi+sb_offs_size_y],dx ;¢ëáâ ¢«ï¥¬ ¢ëá®âã ¢¥àâ. áªà®««¨£ |
188 | sub eax,ted_rec_l |
188 | sub eax,ted_rec_l |
189 | mov word[ebx+sb_offs_size_x],ax ;¢ëáâ ¢«ï¥¬ è¨à¨ã £®à¨§. áªà®««¨£ |
189 | mov word[ebx+sb_offs_size_x],ax ;¢ëáâ ¢«ï¥¬ è¨à¨ã £®à¨§. áªà®««¨£ |
190 | xor edx,edx |
190 | xor edx,edx |
191 | mov ecx,ted_rec_w |
191 | mov ecx,ted_rec_w |
192 | div ecx |
192 | div ecx |
193 | cmp eax,MIN_H_SCRL_ARE |
193 | cmp eax,MIN_H_SCRL_ARE |
194 | jg @f |
194 | jg @f |
195 | mov eax,MIN_H_SCRL_ARE |
195 | mov eax,MIN_H_SCRL_ARE |
196 | @@: |
196 | @@: |
197 | dec eax |
197 | dec eax |
198 | mov dword[ebx+sb_offs_cur_area],eax ;ãáâ ¢«¨¢ ¥¬ ç¨á«® ᨬ¢®«®¢, ª®â®àë¥ ¢« §ïâ ¢ íªà ¤«ï £®à¨§. áªà®««¨£ |
198 | mov dword[ebx+sb_offs_cur_area],eax ;ãáâ ¢«¨¢ ¥¬ ç¨á«® ᨬ¢®«®¢, ª®â®àë¥ ¢« §ïâ ¢ íªà ¤«ï £®à¨§. áªà®««¨£ |
199 | .no_size: |
199 | .no_size: |
200 | popad |
200 | popad |
201 | ret |
201 | ret |
202 | endp |
202 | endp |
203 | 203 | ||
204 | align 16 |
204 | align 16 |
205 | proc ted_delete uses edi, edit:dword |
205 | proc ted_delete uses edi, edit:dword |
206 | mov edi,[edit] |
206 | mov edi,[edit] |
207 | invoke mem.free,ted_tex |
207 | invoke mem.free,ted_tex |
208 | invoke mem.free,ted_arr_key_pos ;ted_syntax_file |
208 | invoke mem.free,ted_arr_key_pos ;ted_syntax_file |
209 | ret |
209 | ret |
210 | endp |
210 | endp |
211 | 211 | ||
212 | 212 | ||
213 | ;input: |
213 | ;input: |
214 | ; eax = key kodes |
214 | ; eax = key kodes |
215 | align 16 |
215 | align 16 |
216 | proc ted_key, edit:dword, table:dword, control:dword |
216 | proc ted_key, edit:dword, table:dword, control:dword |
217 | pushad |
217 | pushad |
218 | mov edi,[edit] |
218 | mov edi,[edit] |
219 | mov esi,ted_el_focus |
219 | mov esi,ted_el_focus |
220 | cmp dword[esi],edi |
220 | cmp dword[esi],edi |
221 | jne .end_key_fun ;í«¥¬¥â ¥ ¢ 䮪ãᥠ¢ë室¨¬ ¨§ äãªæ¨¨ |
221 | jne .end_key_fun ;í«¥¬¥â ¥ ¢ 䮪ãᥠ¢ë室¨¬ ¨§ äãªæ¨¨ |
222 | mov esi,dword[control] |
222 | mov esi,dword[control] |
223 | 223 | ||
224 | cmp ah,KEY_F1 ;[F1] |
224 | cmp ah,KEY_F1 ;[F1] |
225 | jne @f |
225 | jne @f |
226 | stdcall ted_show_help_f1,edi |
226 | stdcall ted_show_help_f1,edi |
227 | jmp .end_key_fun |
227 | jmp .end_key_fun |
228 | @@: |
228 | @@: |
229 | cmp ah,KEY_F3 ;[F3] |
229 | cmp ah,KEY_F3 ;[F3] |
230 | jne @f |
230 | jne @f |
231 | stdcall ted_but_find,edi,0 |
231 | stdcall ted_but_find,edi,0 |
232 | jmp .end_key_fun |
232 | jmp .end_key_fun |
233 | @@: |
233 | @@: |
234 | 234 | ||
235 | test esi,KM_CTRL ;Ctrl+... |
235 | test esi,KM_CTRL ;Ctrl+... |
236 | jz .key_Ctrl |
236 | jz .key_Ctrl |
237 | ; *** ¢ë§®¢ ¢¥è¨å äãªæ¨© ª®â®àë¥ âॡãîâ ®ª ®âªàëâ¨ï/á®åà ¥¨ï/¯®¨áª /... |
237 | ; *** ¢ë§®¢ ¢¥è¨å äãªæ¨© ª®â®àë¥ âॡãîâ ®ª ®âªàëâ¨ï/á®åà ¥¨ï/¯®¨áª /... |
238 | cmp ted_fun_on_key_ctrl_all,0 |
238 | cmp ted_fun_on_key_ctrl_all,0 |
239 | je .end0 |
239 | je .end0 |
240 | xor al,al |
240 | xor al,al |
241 | cmp ah,24 ;Ctrl+O |
241 | cmp ah,24 ;Ctrl+O |
242 | jne @f |
242 | jne @f |
243 | mov al,'O' |
243 | mov al,'O' |
244 | @@: |
244 | @@: |
245 | cmp ah,31 ;Ctrl+S |
245 | cmp ah,31 ;Ctrl+S |
246 | jne @f |
246 | jne @f |
247 | mov al,'S' |
247 | mov al,'S' |
248 | @@: |
248 | @@: |
249 | cmp ah,33 ;Ctrl+F |
249 | cmp ah,33 ;Ctrl+F |
250 | jne @f |
250 | jne @f |
251 | mov al,'F' |
251 | mov al,'F' |
252 | @@: |
252 | @@: |
253 | cmp ah,34 ;Ctrl+G |
253 | cmp ah,34 ;Ctrl+G |
254 | jne @f |
254 | jne @f |
255 | mov al,'G' |
255 | mov al,'G' |
256 | @@: |
256 | @@: |
257 | cmp ah,35 ;Ctrl+H |
257 | cmp ah,35 ;Ctrl+H |
258 | jne @f |
258 | jne @f |
259 | mov al,'H' |
259 | mov al,'H' |
260 | @@: |
260 | @@: |
261 | cmp ah,49 ;Ctrl+N |
261 | cmp ah,49 ;Ctrl+N |
262 | jne @f |
262 | jne @f |
263 | mov al,'N' |
263 | mov al,'N' |
264 | @@: |
264 | @@: |
265 | or al,al |
265 | or al,al |
266 | jz .end0 |
266 | jz .end0 |
267 | and eax,0xff |
267 | and eax,0xff |
268 | test esi,KM_SHIFT |
268 | test esi,KM_SHIFT |
269 | jz @f |
269 | jz @f |
270 | or eax,0x100 |
270 | or eax,0x100 |
271 | @@: |
271 | @@: |
272 | stdcall ted_fun_on_key_ctrl_all, eax |
272 | stdcall ted_fun_on_key_ctrl_all, eax |
273 | jmp .end_key_fun |
273 | jmp .end_key_fun |
274 | .end0: |
274 | .end0: |
275 | 275 | ||
276 | ; *** ¢ë§®¢ ¢ãâ२å äãªæ¨© |
276 | ; *** ¢ë§®¢ ¢ãâ२å äãªæ¨© |
277 | cmp ah,30 ;Ctrl+A |
277 | cmp ah,30 ;Ctrl+A |
278 | jne @f |
278 | jne @f |
279 | call ted_sel_all |
279 | call ted_sel_all |
280 | @@: |
280 | @@: |
281 | cmp ah,44 ;Ctrl+Z |
281 | cmp ah,44 ;Ctrl+Z |
282 | jne @f |
282 | jne @f |
283 | stdcall ted_but_undo,edi |
283 | stdcall ted_but_undo,edi |
284 | @@: |
284 | @@: |
285 | cmp ah,45 ;Ctrl+X |
285 | cmp ah,45 ;Ctrl+X |
286 | jne @f |
286 | jne @f |
287 | stdcall ted_but_cut,edi |
287 | stdcall ted_but_cut,edi |
288 | @@: |
288 | @@: |
289 | cmp ah,46 ;Ctrl+C |
289 | cmp ah,46 ;Ctrl+C |
290 | jne @f |
290 | jne @f |
291 | stdcall ted_but_copy,edi |
291 | stdcall ted_but_copy,edi |
292 | @@: |
292 | @@: |
293 | cmp ah,47 ;Ctrl+V |
293 | cmp ah,47 ;Ctrl+V |
294 | jne @f |
294 | jne @f |
295 | stdcall ted_but_paste,edi |
295 | stdcall ted_but_paste,edi |
296 | @@: |
296 | @@: |
297 | cmp ah,199 ;Ctrl+Home |
297 | cmp ah,199 ;Ctrl+Home |
298 | jne @f |
298 | jne @f |
299 | call ted_key_ctrl_home |
299 | call ted_key_ctrl_home |
300 | @@: |
300 | @@: |
301 | cmp ah,207 ;Ctrl+End |
301 | cmp ah,207 ;Ctrl+End |
302 | jne @f |
302 | jne @f |
303 | call ted_key_ctrl_end |
303 | call ted_key_ctrl_end |
304 | @@: |
304 | @@: |
305 | jmp .end_key_fun |
305 | jmp .end_key_fun |
306 | .key_Ctrl: |
306 | .key_Ctrl: |
307 | 307 | ||
308 | test esi,KM_SHIFT ;Shift+... |
308 | test esi,KM_SHIFT ;Shift+... |
309 | jz .key_Shift |
309 | jz .key_Shift |
310 | cmp ah,72 ;Shift+Up |
310 | cmp ah,72 ;Shift+Up |
311 | jne @f |
311 | jne @f |
312 | call ted_sel_key_up |
312 | call ted_sel_key_up |
313 | @@: |
313 | @@: |
314 | cmp ah,75 ;Shift+Left |
314 | cmp ah,75 ;Shift+Left |
315 | jne @f |
315 | jne @f |
316 | call ted_sel_key_left |
316 | call ted_sel_key_left |
317 | @@: |
317 | @@: |
318 | cmp ah,77 ;Shift+Right |
318 | cmp ah,77 ;Shift+Right |
319 | jne @f |
319 | jne @f |
320 | call ted_sel_key_right |
320 | call ted_sel_key_right |
321 | @@: |
321 | @@: |
322 | cmp ah,80 ;Shift+Down |
322 | cmp ah,80 ;Shift+Down |
323 | jne @f |
323 | jne @f |
324 | call ted_sel_key_down |
324 | call ted_sel_key_down |
325 | @@: |
325 | @@: |
326 | ;mov ted_drag_k,1 ; ç¨ ¥¬ ¢ë¤¥«¥¨¥ ®â ª« ¢¨ âãàë |
326 | ;mov ted_drag_k,1 ; ç¨ ¥¬ ¢ë¤¥«¥¨¥ ®â ª« ¢¨ âãàë |
327 | jmp .key_MoveCur |
327 | jmp .key_MoveCur |
328 | .key_Shift: |
328 | .key_Shift: |
329 | ;------------------------------------------------- |
329 | ;------------------------------------------------- |
330 | cmp ah,72 ;178 ;Up |
330 | cmp ah,72 ;178 ;Up |
331 | jne @f |
331 | jne @f |
332 | call ted_draw_cursor_sumb |
332 | call ted_draw_cursor_sumb |
333 | call ted_cur_move_up |
333 | call ted_cur_move_up |
334 | cmp dl,8 |
334 | cmp dl,8 |
335 | jne .no_red_0 |
335 | jne .no_red_0 |
336 | call ted_scroll_set_redraw |
336 | call ted_scroll_set_redraw |
337 | stdcall ted_draw,edi |
337 | stdcall ted_draw,edi |
338 | jmp @f |
338 | jmp @f |
339 | .no_red_0: |
339 | .no_red_0: |
340 | call ted_sel_end |
340 | call ted_sel_end |
341 | @@: |
341 | @@: |
342 | cmp ah,80 ;177 ;Down |
342 | cmp ah,80 ;177 ;Down |
343 | jne @f |
343 | jne @f |
344 | call ted_draw_cursor_sumb |
344 | call ted_draw_cursor_sumb |
345 | call ted_cur_move_down |
345 | call ted_cur_move_down |
346 | cmp dl,8 |
346 | cmp dl,8 |
347 | jne .no_red_1 |
347 | jne .no_red_1 |
348 | call ted_scroll_set_redraw |
348 | call ted_scroll_set_redraw |
349 | stdcall ted_draw,edi |
349 | stdcall ted_draw,edi |
350 | jmp @f |
350 | jmp @f |
351 | .no_red_1: |
351 | .no_red_1: |
352 | call ted_sel_end |
352 | call ted_sel_end |
353 | @@: |
353 | @@: |
354 | cmp ah,75 ;176 ;Left |
354 | cmp ah,75 ;176 ;Left |
355 | jne @f |
355 | jne @f |
356 | call ted_draw_cursor_sumb |
356 | call ted_draw_cursor_sumb |
357 | call ted_cur_move_left |
357 | call ted_cur_move_left |
358 | cmp dl,8 |
358 | cmp dl,8 |
359 | jne .no_red_2 |
359 | jne .no_red_2 |
360 | call ted_scroll_set_redraw |
360 | call ted_scroll_set_redraw |
361 | stdcall ted_draw,edi |
361 | stdcall ted_draw,edi |
362 | jmp @f |
362 | jmp @f |
363 | .no_red_2: |
363 | .no_red_2: |
364 | call ted_sel_end |
364 | call ted_sel_end |
365 | @@: |
365 | @@: |
366 | cmp ah,77 ;179 ;Right |
366 | cmp ah,77 ;179 ;Right |
367 | jne @f |
367 | jne @f |
368 | call ted_draw_cursor_sumb |
368 | call ted_draw_cursor_sumb |
369 | call ted_cur_move_right |
369 | call ted_cur_move_right |
370 | cmp dl,8 |
370 | cmp dl,8 |
371 | jne .no_red_3 |
371 | jne .no_red_3 |
372 | call ted_scroll_set_redraw |
372 | call ted_scroll_set_redraw |
373 | stdcall ted_draw,edi |
373 | stdcall ted_draw,edi |
374 | jmp @f |
374 | jmp @f |
375 | .no_red_3: |
375 | .no_red_3: |
376 | call ted_sel_end |
376 | call ted_sel_end |
377 | @@: |
377 | @@: |
378 | cmp ah,71 ;180 ;Home |
378 | cmp ah,71 ;180 ;Home |
379 | jne @f |
379 | jne @f |
380 | call ted_draw_cursor_sumb |
380 | call ted_draw_cursor_sumb |
381 | call ted_cur_move_x_first_char |
381 | call ted_cur_move_x_first_char |
382 | cmp dl,8 |
382 | cmp dl,8 |
383 | jne .no_red_4 |
383 | jne .no_red_4 |
384 | call ted_scroll_set_redraw |
384 | call ted_scroll_set_redraw |
385 | stdcall ted_draw,edi |
385 | stdcall ted_draw,edi |
386 | jmp @f |
386 | jmp @f |
387 | .no_red_4: |
387 | .no_red_4: |
388 | call ted_sel_end |
388 | call ted_sel_end |
389 | @@: |
389 | @@: |
390 | cmp ah,79 ;181 ;End |
390 | cmp ah,79 ;181 ;End |
391 | jne @f |
391 | jne @f |
392 | call ted_draw_cursor_sumb |
392 | call ted_draw_cursor_sumb |
393 | call ted_cur_move_x_last_char |
393 | call ted_cur_move_x_last_char |
394 | cmp dl,8 |
394 | cmp dl,8 |
395 | jne .no_red_5 |
395 | jne .no_red_5 |
396 | call ted_scroll_set_redraw |
396 | call ted_scroll_set_redraw |
397 | stdcall ted_draw,edi |
397 | stdcall ted_draw,edi |
398 | jmp @f |
398 | jmp @f |
399 | .no_red_5: |
399 | .no_red_5: |
400 | call ted_sel_end |
400 | call ted_sel_end |
401 | @@: |
401 | @@: |
402 | cmp ah,73 ;184 ;PageUp |
402 | cmp ah,73 ;184 ;PageUp |
403 | jne @f |
403 | jne @f |
404 | call ted_cur_move_page_up |
404 | call ted_cur_move_page_up |
405 | cmp dl,0 |
405 | cmp dl,0 |
406 | je @f |
406 | je @f |
407 | call ted_scroll_set_redraw |
407 | call ted_scroll_set_redraw |
408 | stdcall ted_draw,edi |
408 | stdcall ted_draw,edi |
409 | mov ted_drag_k,0 ;§ ª 稢 ¥¬ ¢ë¤¥«¥¨¥ ®â ª« ¢¨ âãàë |
409 | mov ted_drag_k,0 ;§ ª 稢 ¥¬ ¢ë¤¥«¥¨¥ ®â ª« ¢¨ âãàë |
410 | @@: |
410 | @@: |
411 | cmp ah,81 ;183 ;PageDown |
411 | cmp ah,81 ;183 ;PageDown |
412 | jne @f |
412 | jne @f |
413 | call ted_cur_move_page_down |
413 | call ted_cur_move_page_down |
414 | cmp dl,0 |
414 | cmp dl,0 |
415 | je @f |
415 | je @f |
416 | call ted_scroll_set_redraw |
416 | call ted_scroll_set_redraw |
417 | stdcall ted_draw,edi |
417 | stdcall ted_draw,edi |
418 | mov ted_drag_k,0 ;§ ª 稢 ¥¬ ¢ë¤¥«¥¨¥ ®â ª« ¢¨ âãàë |
418 | mov ted_drag_k,0 ;§ ª 稢 ¥¬ ¢ë¤¥«¥¨¥ ®â ª« ¢¨ âãàë |
419 | @@: |
419 | @@: |
420 | ;------------------------------------------------- |
420 | ;------------------------------------------------- |
421 | .key_MoveCur: |
421 | .key_MoveCur: |
422 | 422 | ||
423 | ;¨¦¥ ¯à®¯ã᪠îâáï á«ã¦¥¡ë¥ ª« ¢¨è¨, ª®â®àë¥ ¬®£ãâ ¤ ¢ âì ¬ãá®àë¥ á¨¬¢®«ë ¢ ®ª® |
423 | ;¨¦¥ ¯à®¯ã᪠îâáï á«ã¦¥¡ë¥ ª« ¢¨è¨, ª®â®àë¥ ¬®£ãâ ¤ ¢ âì ¬ãá®àë¥ á¨¬¢®«ë ¢ ®ª® |
424 | cmp ah,42 ;[L Shift] ª®£¤ ¦ â ¡¥§ ¤àã£¨å ª®¯®ª |
424 | cmp ah,42 ;[L Shift] ª®£¤ ¦ â ¡¥§ ¤àã£¨å ª®¯®ª |
425 | je .end_key_fun |
425 | je .end_key_fun |
426 | cmp ah,54 ;[R Shift] ª®£¤ ¦ â ¡¥§ ¤àã£¨å ª®¯®ª |
426 | cmp ah,54 ;[R Shift] ª®£¤ ¦ â ¡¥§ ¤àã£¨å ª®¯®ª |
427 | je .end_key_fun |
427 | je .end_key_fun |
428 | cmp ah,58 ;[Caps Lock] |
428 | cmp ah,58 ;[Caps Lock] |
429 | je .end_key_fun |
429 | je .end_key_fun |
430 | cmp ah,69 ;[Pause Break] |
430 | cmp ah,69 ;[Pause Break] |
431 | je .end_key_fun |
431 | je .end_key_fun |
432 | cmp ah,120 ;[Fn] |
432 | cmp ah,120 ;[Fn] |
433 | je .end_key_fun |
433 | je .end_key_fun |
434 | cmp ah,0x80 ;if key up |
434 | cmp ah,0x80 ;if key up |
435 | ja .end_key_fun |
435 | ja .end_key_fun |
436 | 436 | ||
437 | cmp dword[table],0 |
437 | cmp dword[table],0 |
438 | je @f |
438 | je @f |
439 | stdcall KeyConvertToASCII, [table] |
439 | stdcall KeyConvertToASCII, [table] |
440 | @@: |
440 | @@: |
441 | 441 | ||
442 | ;mov ted_drag_k,0 ;§ ª 稢 ¥¬ ¢ë¤¥«¥¨¥ ®â ª« ¢¨ âãàë |
442 | ;mov ted_drag_k,0 ;§ ª 稢 ¥¬ ¢ë¤¥«¥¨¥ ®â ª« ¢¨ âãàë |
443 | 443 | ||
444 | lea edx,[EvChar] ;¡¥à¥¬ ¤à¥á â ¡«¨æë á ¤®¯ãá⨬묨 ᨬ¢®« ¬¨ |
444 | lea edx,[EvChar] ;¡¥à¥¬ ¤à¥á â ¡«¨æë á ¤®¯ãá⨬묨 ᨬ¢®« ¬¨ |
445 | add dl,ah |
445 | add dl,ah |
446 | jae @f |
446 | jae @f |
447 | add edx,0x100 ;¥á«¨ ¡ë«® ¯¥à¥¯®«¥¨¥ ¯à¨ ¤®¡ ¢«¥¨¨ ª®¤ ᨬ¢®« |
447 | add edx,0x100 ;¥á«¨ ¡ë«® ¯¥à¥¯®«¥¨¥ ¯à¨ ¤®¡ ¢«¥¨¨ ª®¤ ᨬ¢®« |
448 | @@: |
448 | @@: |
449 | cmp byte[edx],1 |
449 | cmp byte[edx],1 |
450 | jne @f |
450 | jne @f |
451 | mov ted_key_new,ah |
451 | mov ted_key_new,ah |
452 | call ted_set_undo |
452 | call ted_set_undo |
453 | mov edx,ted_opt_ed_change_time+ted_opt_ed_move_cursor |
453 | mov edx,ted_opt_ed_change_time+ted_opt_ed_move_cursor |
454 | stdcall ted_sel_text_del,edx |
454 | stdcall ted_sel_text_del,edx |
455 | cmp al,1 |
455 | cmp al,1 |
456 | jne .del |
456 | jne .del |
457 | mov edx,ted_opt_ed_move_cursor |
457 | mov edx,ted_opt_ed_move_cursor |
458 | .del: |
458 | .del: |
459 | cmp ted_cur_ins,1 |
459 | cmp ted_cur_ins,1 |
460 | je .no_ins_mod |
460 | je .no_ins_mod |
461 | stdcall ted_text_del,edi,ted_opt_ed_change_time |
461 | stdcall ted_text_del,edi,ted_opt_ed_change_time |
462 | mov edx,ted_opt_ed_move_cursor |
462 | mov edx,ted_opt_ed_move_cursor |
463 | .no_ins_mod: |
463 | .no_ins_mod: |
464 | mov ecx,edi |
464 | mov ecx,edi |
465 | add ecx,ted_offs_key_new |
465 | add ecx,ted_offs_key_new |
466 | stdcall ted_text_add,edi,ecx,1,edx ;¤®¡ ¢«ï¥¬ ᨬ¢®« ¢¢¥¤¥ë© á ª« ¢¨ âãàë |
466 | stdcall ted_text_add,edi,ecx,1,edx ;¤®¡ ¢«ï¥¬ ᨬ¢®« ¢¢¥¤¥ë© á ª« ¢¨ âãàë |
467 | cmp ted_key_new,13 |
467 | cmp ted_key_new,13 |
468 | jne .dr_m_win |
468 | jne .dr_m_win |
469 | ;¥á«¨ ¢áâ ¢¨«¨ ᨬ¢®« ®¢®© áâப¨ |
469 | ;¥á«¨ ¢áâ ¢¨«¨ ᨬ¢®« ®¢®© áâப¨ |
470 | mov ecx,ted_scr_w |
470 | mov ecx,ted_scr_w |
471 | inc dword[ecx+sb_offs_max_area] ;㢥«¨ç¨¢ ¥¬ à §¬¥à ¢¥à⨪ «ì®£® áªà®««¨£ |
471 | inc dword[ecx+sb_offs_max_area] ;㢥«¨ç¨¢ ¥¬ à §¬¥à ¢¥à⨪ «ì®£® áªà®««¨£ |
472 | mov edx,ted_cur_y |
472 | mov edx,ted_cur_y |
473 | cmp edx,[ecx+sb_offs_cur_area] |
473 | cmp edx,[ecx+sb_offs_cur_area] |
474 | jl .no_change |
474 | jl .no_change |
475 | dec ted_cur_y ;ªãàá®à ®áâ ¢«ï¥¬ ¬¥á⥠|
475 | dec ted_cur_y ;ªãàá®à ®áâ ¢«ï¥¬ ¬¥á⥠|
476 | inc dword[ecx+sb_offs_position] ;ᤢ¨£ ¥¬ ¯®«§ã®ª |
476 | inc dword[ecx+sb_offs_position] ;ᤢ¨£ ¥¬ ¯®«§ã®ª |
477 | .no_change: |
477 | .no_change: |
478 | stdcall ted_draw,edi |
478 | stdcall ted_draw,edi |
479 | jmp .dr_cur_l |
479 | jmp .dr_cur_l |
480 | .dr_m_win: |
480 | .dr_m_win: |
481 | stdcall ted_draw_cur_line,edi |
481 | stdcall ted_draw_cur_line,edi |
482 | .dr_cur_l: |
482 | .dr_cur_l: |
483 | cmp ted_fun_draw_panel_buttons,0 |
483 | cmp ted_fun_draw_panel_buttons,0 |
484 | je @f |
484 | je @f |
485 | call ted_fun_draw_panel_buttons |
485 | call ted_fun_draw_panel_buttons |
486 | @@: |
486 | @@: |
487 | 487 | ||
488 | cmp ah,8 ;[<-] |
488 | cmp ah,8 ;[<-] |
489 | jne @f |
489 | jne @f |
490 | call ted_set_undo |
490 | call ted_set_undo |
491 | stdcall ted_sel_text_del,ted_opt_ed_change_time |
491 | stdcall ted_sel_text_del,ted_opt_ed_change_time |
492 | cmp al,1 |
492 | cmp al,1 |
493 | je .del_one_b |
493 | je .del_one_b |
494 | stdcall ted_text_del,edi,ted_opt_ed_change_time+ted_opt_ed_move_cursor |
494 | stdcall ted_text_del,edi,ted_opt_ed_change_time+ted_opt_ed_move_cursor |
495 | .del_one_b: |
495 | .del_one_b: |
496 | stdcall ted_draw,edi |
496 | stdcall ted_draw,edi |
497 | cmp ted_fun_draw_panel_buttons,0 |
497 | cmp ted_fun_draw_panel_buttons,0 |
498 | je .end_key_fun |
498 | je .end_key_fun |
499 | call ted_fun_draw_panel_buttons |
499 | call ted_fun_draw_panel_buttons |
500 | jmp .end_key_fun |
500 | jmp .end_key_fun |
501 | align 4 |
501 | align 4 |
502 | @@: |
502 | @@: |
503 | 503 | ||
504 | cmp ah,182 ;Delete |
504 | cmp ah,182 ;Delete |
505 | jne @f |
505 | jne @f |
506 | call ted_set_undo |
506 | call ted_set_undo |
507 | stdcall ted_sel_text_del,ted_opt_ed_change_time |
507 | stdcall ted_sel_text_del,ted_opt_ed_change_time |
508 | cmp al,1 |
508 | cmp al,1 |
509 | je .del_one_d |
509 | je .del_one_d |
510 | stdcall ted_text_del,edi,ted_opt_ed_change_time |
510 | stdcall ted_text_del,edi,ted_opt_ed_change_time |
511 | .del_one_d: |
511 | .del_one_d: |
512 | stdcall ted_draw,edi |
512 | stdcall ted_draw,edi |
513 | cmp ted_fun_draw_panel_buttons,0 |
513 | cmp ted_fun_draw_panel_buttons,0 |
514 | je .end_key_fun |
514 | je .end_key_fun |
515 | call ted_fun_draw_panel_buttons |
515 | call ted_fun_draw_panel_buttons |
516 | jmp .end_key_fun |
516 | jmp .end_key_fun |
517 | @@: |
517 | @@: |
518 | 518 | ||
519 | cmp ah,185 ;Ins |
519 | cmp ah,185 ;Ins |
520 | jne @f |
520 | jne @f |
521 | call ted_draw_cursor_sumb |
521 | call ted_draw_cursor_sumb |
522 | xor ted_cur_ins,1 |
522 | xor ted_cur_ins,1 |
523 | call ted_draw_main_cursor |
523 | call ted_draw_main_cursor |
524 | @@: |
524 | @@: |
525 | 525 | ||
526 | .end_key_fun: |
526 | .end_key_fun: |
527 | popad |
527 | popad |
528 | ret |
528 | ret |
529 | endp |
529 | endp |
530 | 530 | ||
531 | ;output: |
531 | ;output: |
532 | ; al = 1 - can save |
532 | ; al = 1 - can save |
533 | align 16 |
533 | align 16 |
534 | proc ted_can_save uses ecx edi, edit:dword |
534 | proc ted_can_save uses ecx edi, edit:dword |
535 | mov edi,[edit] |
535 | mov edi,[edit] |
536 | 536 | ||
537 | mov ecx,ted_tim_ch |
537 | mov ecx,ted_tim_ch |
538 | sub ecx,ted_tim_undo |
538 | sub ecx,ted_tim_undo |
539 | mov al,1 |
539 | mov al,1 |
540 | cmp ted_tim_ls,ecx |
540 | cmp ted_tim_ls,ecx |
541 | jne @f |
541 | jne @f |
542 | dec al |
542 | dec al |
543 | @@: |
543 | @@: |
544 | ret |
544 | ret |
545 | endp |
545 | endp |
546 | 546 | ||
547 | ;input: |
547 | ;input: |
548 | ; edi = pointer to tedit struct |
548 | ; edi = pointer to tedit struct |
549 | ;output: |
549 | ;output: |
550 | ; al = 1 - selected |
550 | ; al = 1 - selected |
551 | align 16 |
551 | align 16 |
552 | proc ted_is_select uses ebx |
552 | proc ted_is_select uses ebx |
553 | xor al,al |
553 | xor al,al |
554 | cmp ted_drag_m,1 |
554 | cmp ted_drag_m,1 |
555 | je @f |
555 | je @f |
556 | inc al |
556 | inc al |
557 | mov ebx,ted_sel_x0 |
557 | mov ebx,ted_sel_x0 |
558 | cmp ebx,ted_sel_x1 |
558 | cmp ebx,ted_sel_x1 |
559 | jne @f |
559 | jne @f |
560 | mov ebx,ted_sel_y0 |
560 | mov ebx,ted_sel_y0 |
561 | cmp ebx,ted_sel_y1 |
561 | cmp ebx,ted_sel_y1 |
562 | jne @f |
562 | jne @f |
563 | xor al,al |
563 | xor al,al |
564 | @@: |
564 | @@: |
565 | ret |
565 | ret |
566 | endp |
566 | endp |
567 | 567 | ||
568 | ;input: |
568 | ;input: |
569 | ; edi = pointer to tedit struct |
569 | ; edi = pointer to tedit struct |
570 | align 16 |
570 | align 16 |
571 | proc ted_sel_normalize uses ecx esi |
571 | proc ted_sel_normalize uses ecx esi |
572 | push edi |
572 | push edi |
573 | mov esi,edi |
573 | mov esi,edi |
574 | add esi,ted_offs_sel |
574 | add esi,ted_offs_sel |
575 | add edi,ted_offs_seln |
575 | add edi,ted_offs_seln |
576 | mov ecx,sizeof.TexSelect/4 |
576 | mov ecx,sizeof.TexSelect/4 |
577 | rep movsd |
577 | rep movsd |
578 | pop edi |
578 | pop edi |
579 | 579 | ||
580 | jmp @f |
580 | jmp @f |
581 | .swp_f: |
581 | .swp_f: |
582 | mov ecx,ted_seln_x0 |
582 | mov ecx,ted_seln_x0 |
583 | m2m ted_seln_x0,ted_seln_x1 |
583 | m2m ted_seln_x0,ted_seln_x1 |
584 | mov ted_seln_x1,ecx |
584 | mov ted_seln_x1,ecx |
585 | 585 | ||
586 | mov ecx,ted_seln_y0 |
586 | mov ecx,ted_seln_y0 |
587 | cmp ecx,ted_seln_y1 ;(sel_y0>sel_y1) |
587 | cmp ecx,ted_seln_y1 ;(sel_y0>sel_y1) |
588 | jle .end_f |
588 | jle .end_f |
589 | m2m ted_seln_y0,ted_seln_y1 |
589 | m2m ted_seln_y0,ted_seln_y1 |
590 | mov ted_seln_y1,ecx |
590 | mov ted_seln_y1,ecx |
591 | 591 | ||
592 | jmp .end_f |
592 | jmp .end_f |
593 | align 4 |
593 | align 4 |
594 | @@: |
594 | @@: |
595 | 595 | ||
596 | mov ecx,ted_seln_y0 |
596 | mov ecx,ted_seln_y0 |
597 | cmp ecx,ted_seln_y1 ;(sel_y0>sel_y1) |
597 | cmp ecx,ted_seln_y1 ;(sel_y0>sel_y1) |
598 | jg .swp_f |
598 | jg .swp_f |
599 | 599 | ||
600 | cmp ecx,ted_seln_y1 ;(sel_y0==sel_y1) |
600 | cmp ecx,ted_seln_y1 ;(sel_y0==sel_y1) |
601 | jne .end_f |
601 | jne .end_f |
602 | mov ecx,ted_seln_x0 |
602 | mov ecx,ted_seln_x0 |
603 | cmp ecx,ted_seln_x1 ;(sel_x0>sel_x1) |
603 | cmp ecx,ted_seln_x1 ;(sel_x0>sel_x1) |
604 | jg .swp_f |
604 | jg .swp_f |
605 | 605 | ||
606 | .end_f: |
606 | .end_f: |
607 | ret |
607 | ret |
608 | endp |
608 | endp |
609 | 609 | ||
610 | ;input: |
610 | ;input: |
611 | ; edi = pointer to tedit struct |
611 | ; edi = pointer to tedit struct |
612 | ;description: |
612 | ;description: |
613 | ; ãªæ¨ï ¢ë§ë¢ ¥¬ ï ¯à¨ ç «¥ ¢ë¤¥«¥¨ï |
613 | ; ãªæ¨ï ¢ë§ë¢ ¥¬ ï ¯à¨ ç «¥ ¢ë¤¥«¥¨ï |
614 | align 16 |
614 | align 16 |
615 | proc ted_sel_start uses eax ecx |
615 | proc ted_sel_start uses eax ecx |
616 | mov eax,ted_scr_h |
616 | mov eax,ted_scr_h |
617 | mov ecx,ted_cur_x |
617 | mov ecx,ted_cur_x |
618 | add ecx,[eax+sb_offs_position] |
618 | add ecx,[eax+sb_offs_position] |
619 | mov ted_sel_x0,ecx |
619 | mov ted_sel_x0,ecx |
620 | mov ted_sel_x1,ecx |
620 | mov ted_sel_x1,ecx |
621 | 621 | ||
622 | mov eax,ted_scr_w |
622 | mov eax,ted_scr_w |
623 | mov ecx,ted_cur_y |
623 | mov ecx,ted_cur_y |
624 | add ecx,[eax+sb_offs_position] |
624 | add ecx,[eax+sb_offs_position] |
625 | mov ted_sel_y0,ecx |
625 | mov ted_sel_y0,ecx |
626 | mov ted_sel_y1,ecx |
626 | mov ted_sel_y1,ecx |
627 | ret |
627 | ret |
628 | endp |
628 | endp |
629 | 629 | ||
630 | ;input: |
630 | ;input: |
631 | ; edi = pointer to tedit struct |
631 | ; edi = pointer to tedit struct |
632 | ;description: |
632 | ;description: |
633 | ; ãªæ¨ï ¢ë§ë¢ ¥¬ ï ¯à¨ áï⨨ ¢ë¤¥«¥¨ï |
633 | ; ãªæ¨ï ¢ë§ë¢ ¥¬ ï ¯à¨ áï⨨ ¢ë¤¥«¥¨ï |
634 | align 16 |
634 | align 16 |
635 | proc ted_sel_end uses eax |
635 | proc ted_sel_end uses eax |
636 | mov ted_drag_k,0 ;§ ª 稢 ¥¬ ¢ë¤¥«¥¨¥ ®â ª« ¢¨ âãàë |
636 | mov ted_drag_k,0 ;§ ª 稢 ¥¬ ¢ë¤¥«¥¨¥ ®â ª« ¢¨ âãàë |
637 | call ted_is_select |
637 | call ted_is_select |
638 | or al,al |
638 | or al,al |
639 | jz @f |
639 | jz @f |
640 | xor eax,eax |
640 | xor eax,eax |
641 | mov ted_sel_x0,eax |
641 | mov ted_sel_x0,eax |
642 | mov ted_sel_x1,eax |
642 | mov ted_sel_x1,eax |
643 | mov ted_sel_y0,eax |
643 | mov ted_sel_y0,eax |
644 | mov ted_sel_y1,eax |
644 | mov ted_sel_y1,eax |
645 | stdcall ted_draw,edi |
645 | stdcall ted_draw,edi |
646 | jmp .end_f |
646 | jmp .end_f |
647 | @@: |
647 | @@: |
648 | call ted_draw_main_cursor |
648 | call ted_draw_main_cursor |
649 | .end_f: |
649 | .end_f: |
650 | ret |
650 | ret |
651 | endp |
651 | endp |
652 | 652 | ||
653 | ;input: |
653 | ;input: |
654 | ; edi = pointer to tedit struct |
654 | ; edi = pointer to tedit struct |
655 | ;description: |
655 | ;description: |
656 | ; ãªæ¨ï ¢ë§ë¢ ¥¬ ï ¯à¨ ¯¥à¥¬¥é¥¨¨ ¢ë¤¥«¥¨ï |
656 | ; ãªæ¨ï ¢ë§ë¢ ¥¬ ï ¯à¨ ¯¥à¥¬¥é¥¨¨ ¢ë¤¥«¥¨ï |
657 | align 16 |
657 | align 16 |
658 | proc ted_sel_move |
658 | proc ted_sel_move |
659 | push eax ecx |
659 | push eax ecx |
660 | mov ecx,ted_cur_x |
660 | mov ecx,ted_cur_x |
661 | mov eax,ted_scr_h |
661 | mov eax,ted_scr_h |
662 | add ecx,[eax+sb_offs_position] |
662 | add ecx,[eax+sb_offs_position] |
663 | mov ted_sel_x1,ecx |
663 | mov ted_sel_x1,ecx |
664 | 664 | ||
665 | mov eax,ted_scr_w |
665 | mov eax,ted_scr_w |
666 | mov ecx,ted_cur_y |
666 | mov ecx,ted_cur_y |
667 | add ecx,[eax+sb_offs_position] |
667 | add ecx,[eax+sb_offs_position] |
668 | mov ted_sel_y1,ecx |
668 | mov ted_sel_y1,ecx |
669 | pop ecx eax |
669 | pop ecx eax |
670 | cmp ted_fun_draw_panel_buttons,0 ;redraw toolbar (need to button Copy) |
670 | cmp ted_fun_draw_panel_buttons,0 ;redraw toolbar (need to button Copy) |
671 | je @f |
671 | je @f |
672 | call ted_fun_draw_panel_buttons |
672 | call ted_fun_draw_panel_buttons |
673 | @@: |
673 | @@: |
674 | ret |
674 | ret |
675 | endp |
675 | endp |
676 | 676 | ||
677 | ;input: |
677 | ;input: |
678 | ; edi = pointer to tedit struct |
678 | ; edi = pointer to tedit struct |
679 | ;description: |
679 | ;description: |
680 | ; ãªæ¨ï ¢ë§ë¢ ¥¬ ï ¯à¨ ¢ë¤¥«¥¨¨ ¢á¥£® ¤®ªã¬¥â |
680 | ; ãªæ¨ï ¢ë§ë¢ ¥¬ ï ¯à¨ ¢ë¤¥«¥¨¨ ¢á¥£® ¤®ªã¬¥â |
681 | align 16 |
681 | align 16 |
682 | proc ted_sel_all |
682 | proc ted_sel_all |
683 | push eax |
683 | push eax |
684 | xor eax,eax |
684 | xor eax,eax |
685 | mov ted_sel_x0,eax |
685 | mov ted_sel_x0,eax |
686 | mov ted_sel_y0,eax |
686 | mov ted_sel_y0,eax |
687 | 687 | ||
688 | mov ted_sel_x1,eax ;??? |
688 | mov ted_sel_x1,eax ;??? |
689 | call ted_get_num_lines |
689 | call ted_get_num_lines |
690 | mov ted_sel_y1,eax |
690 | mov ted_sel_y1,eax |
691 | pop eax |
691 | pop eax |
692 | stdcall ted_draw,edi |
692 | stdcall ted_draw,edi |
693 | cmp ted_fun_draw_panel_buttons,0 ;redraw toolbar (need to button Copy) |
693 | cmp ted_fun_draw_panel_buttons,0 ;redraw toolbar (need to button Copy) |
694 | je @f |
694 | je @f |
695 | call ted_fun_draw_panel_buttons |
695 | call ted_fun_draw_panel_buttons |
696 | @@: |
696 | @@: |
697 | ret |
697 | ret |
698 | endp |
698 | endp |
699 | 699 | ||
700 | ;input: |
700 | ;input: |
701 | ; cl_al_mem = 1 - clear all memory |
701 | ; cl_al_mem = 1 - clear all memory |
702 | align 16 |
702 | align 16 |
703 | proc ted_clear uses ecx edi, edit:dword, cl_al_mem:dword |
703 | proc ted_clear uses ecx edi, edit:dword, cl_al_mem:dword |
704 | mov edi,[edit] |
704 | mov edi,[edit] |
705 | 705 | ||
706 | mov ted_cur_x,0 |
706 | mov ted_cur_x,0 |
707 | mov ted_cur_y,0 |
707 | mov ted_cur_y,0 |
708 | mov ted_tim_ch,0 |
708 | mov ted_tim_ch,0 |
709 | mov ted_tim_ls,0 |
709 | mov ted_tim_ls,0 |
710 | mov ted_tim_co,0 |
710 | mov ted_tim_co,0 |
711 | mov ted_tim_undo,0 |
711 | mov ted_tim_undo,0 |
712 | mov ted_help_id,-1 |
712 | mov ted_help_id,-1 |
713 | mov ecx,sizeof.symbol |
713 | mov ecx,sizeof.symbol |
714 | shl ecx,1 |
714 | shl ecx,1 |
715 | add ecx,ted_tex |
715 | add ecx,ted_tex |
716 | mov ted_ptr_free_symb,ecx |
716 | mov ted_ptr_free_symb,ecx |
717 | 717 | ||
718 | mov ecx,ted_scr_w |
718 | mov ecx,ted_scr_w |
719 | mov dword[ecx+sb_offs_position],0 |
719 | mov dword[ecx+sb_offs_position],0 |
720 | mov dword[ecx+sb_offs_max_area],100 ;ç¨á«® áâப ¢¨¤¨¬ëå ¢ ®¢®¬ ¤®ªã¬¥â¥ |
720 | mov dword[ecx+sb_offs_max_area],100 ;ç¨á«® áâப ¢¨¤¨¬ëå ¢ ®¢®¬ ¤®ªã¬¥â¥ |
721 | mov dword[ecx+sb_offs_redraw],1 |
721 | mov dword[ecx+sb_offs_redraw],1 |
722 | mov ecx,ted_scr_h |
722 | mov ecx,ted_scr_h |
723 | mov dword[ecx+sb_offs_position],0 |
723 | mov dword[ecx+sb_offs_position],0 |
724 | mov dword[ecx+sb_offs_max_area],100 ;ç¨á«® ᨬ¢®«®¢ ¢¨¤¨¬ëå ¢ ®¢®¬ ¤®ªã¬¥â¥ |
724 | mov dword[ecx+sb_offs_max_area],100 ;ç¨á«® ᨬ¢®«®¢ ¢¨¤¨¬ëå ¢ ®¢®¬ ¤®ªã¬¥â¥ |
725 | 725 | ||
726 | mov ted_sel_x0,0 |
726 | mov ted_sel_x0,0 |
727 | mov ted_sel_y0,0 |
727 | mov ted_sel_y0,0 |
728 | mov ted_sel_x1,0 |
728 | mov ted_sel_x1,0 |
729 | mov ted_sel_y1,0 |
729 | mov ted_sel_y1,0 |
730 | 730 | ||
731 | cmp dword[cl_al_mem],0 |
731 | cmp dword[cl_al_mem],0 |
732 | je .exit |
732 | je .exit |
733 | 733 | ||
734 | push edx |
734 | push edx |
735 | mov ecx,sizeof.symbol |
735 | mov ecx,sizeof.symbol |
736 | imul ecx,ted_max_chars |
736 | imul ecx,ted_max_chars |
737 | mov edx,ted_tex |
737 | mov edx,ted_tex |
738 | @@: |
738 | @@: |
739 | mov byte [edx],0 |
739 | mov byte [edx],0 |
740 | inc edx |
740 | inc edx |
741 | loop @b |
741 | loop @b |
742 | mov edx,ted_tex |
742 | mov edx,ted_tex |
743 | mov dword [edx+symbol.next],1 |
743 | mov dword [edx+symbol.next],1 |
744 | pop edx |
744 | pop edx |
745 | 745 | ||
746 | .exit: |
746 | .exit: |
747 | ret |
747 | ret |
748 | endp |
748 | endp |
749 | 749 | ||
750 | 750 | ||
751 | align 16 |
751 | align 16 |
752 | proc ted_init_syntax_file, edit:dword |
752 | proc ted_init_syntax_file, edit:dword |
753 | pushad |
753 | pushad |
754 | mov edi,[edit] |
754 | mov edi,[edit] |
755 | 755 | ||
756 | mov ecx,0x100 |
756 | mov ecx,0x100 |
757 | mov edx,ted_arr_key_pos |
757 | mov edx,ted_arr_key_pos |
758 | @@: |
758 | @@: |
759 | mov dword[edx],-1 |
759 | mov dword[edx],-1 |
760 | add edx,4 |
760 | add edx,4 |
761 | loop @b |
761 | loop @b |
762 | 762 | ||
763 | ;init: ted_colors_text_count, ted_key_words_count, ... |
763 | ;init: ted_colors_text_count, ted_key_words_count, ... |
764 | mov ted_colors_text_count,1 |
764 | mov ted_colors_text_count,1 |
765 | mov ted_key_words_count,0 |
765 | mov ted_key_words_count,0 |
766 | mov ted_help_text_f1,0 |
766 | mov ted_help_text_f1,0 |
767 | mov ted_help_id,-1 ;¨¤¥â¨ä¨ª â®à á«®¢ ¤«ï á¯à ¢ª¨ |
767 | mov ted_help_id,-1 ;¨¤¥â¨ä¨ª â®à á«®¢ ¤«ï á¯à ¢ª¨ |
768 | 768 | ||
769 | mov eax,edi ;á®åà 塞 § 票¥ edi |
769 | mov eax,edi ;á®åà 塞 § 票¥ edi |
770 | mov esi,ted_syntax_file |
770 | mov esi,ted_syntax_file |
771 | add edi,ted_offs_count_colors |
771 | add edi,ted_offs_count_colors |
772 | mov ecx,9 |
772 | mov ecx,9 |
773 | rep movsd |
773 | rep movsd |
774 | mov edi,eax ;¢®áâ ¢«¨¢ ¥¬ § 票¥ edi |
774 | mov edi,eax ;¢®áâ ¢«¨¢ ¥¬ § 票¥ edi |
775 | 775 | ||
776 | mov eax,ted_syntax_file |
776 | mov eax,ted_syntax_file |
777 | add eax,32 |
777 | add eax,32 |
778 | mov ted_text_colors,eax |
778 | mov ted_text_colors,eax |
779 | 779 | ||
780 | mov eax,ted_colors_text_count ;init: count_colors_text (offset to key words) |
780 | mov eax,ted_colors_text_count ;init: count_colors_text (offset to key words) |
781 | lea eax,[4*eax+32] |
781 | lea eax,[4*eax+32] |
782 | add eax,ted_syntax_file |
782 | add eax,ted_syntax_file |
783 | mov ted_key_words_data,eax |
783 | mov ted_key_words_data,eax |
784 | 784 | ||
785 | mov ecx,ted_key_words_count ;init: ted_arr_key_pos (first key positions) |
785 | mov ecx,ted_key_words_count ;init: ted_arr_key_pos (first key positions) |
786 | xor eax,eax |
786 | xor eax,eax |
787 | @@: |
787 | @@: |
788 | ColToIndexOffset eax,edx |
788 | ColToIndexOffset eax,edx |
789 | movzx ebx,byte[edx] |
789 | movzx ebx,byte[edx] |
790 | mov esi,ted_arr_key_pos |
790 | mov esi,ted_arr_key_pos |
791 | lea esi,[esi+4*ebx] |
791 | lea esi,[esi+4*ebx] |
792 | cmp dword[esi],-1 |
792 | cmp dword[esi],-1 |
793 | jne .no_ch_key |
793 | jne .no_ch_key |
794 | mov [esi],eax |
794 | mov [esi],eax |
795 | .no_ch_key: |
795 | .no_ch_key: |
796 | inc eax |
796 | inc eax |
797 | loop @b |
797 | loop @b |
798 | 798 | ||
799 | ;init: ted_help_text_f1 |
799 | ;init: ted_help_text_f1 |
800 | mov ecx,ted_key_words_count ;ª®«¨ç¥á⢮ ª«î祢ëå á«®¢ |
800 | mov ecx,ted_key_words_count ;ª®«¨ç¥á⢮ ª«î祢ëå á«®¢ |
801 | imul ecx,sizeof.TexColViv ;à §¬¥à áâàãªâãàë á 1-¬ ª«. á«. |
801 | imul ecx,sizeof.TexColViv ;à §¬¥à áâàãªâãàë á 1-¬ ª«. á«. |
802 | add ecx,ted_key_words_data ; ç «® ä ©« á ª«. á«. |
802 | add ecx,ted_key_words_data ; ç «® ä ©« á ª«. á«. |
803 | mov ted_help_text_f1,ecx ;¬¥âª ¢ ¯ ¬ïâ¨, £¤¥ 稥âáï ⥪áâ á® á¯à ¢ª®© |
803 | mov ted_help_text_f1,ecx ;¬¥âª ¢ ¯ ¬ïâ¨, £¤¥ 稥âáï ⥪áâ á® á¯à ¢ª®© |
804 | 804 | ||
805 | stdcall ted_init_scroll_bars,edi,1 ;¬¥ï¥¬ 梥â áªà®««¨£®¢ |
805 | stdcall ted_init_scroll_bars,edi,1 ;¬¥ï¥¬ 梥â áªà®««¨£®¢ |
806 | .no_colors: |
806 | .no_colors: |
807 | popad |
807 | popad |
808 | ret |
808 | ret |
809 | endp |
809 | endp |
810 | 810 | ||
811 | ;input: |
811 | ;input: |
812 | ; ebx = file size |
812 | ; ebx = file size |
813 | ; edi = pointer to tedit struct |
813 | ; edi = pointer to tedit struct |
814 | ;description: |
814 | ;description: |
815 | ; ãªæ¨ï ¢ë§ë¢ ¥âáï ¯à¨ ®âªàë⨨ ä ©« |
815 | ; ãªæ¨ï ¢ë§ë¢ ¥âáï ¯à¨ ®âªàë⨨ ä ©« |
816 | align 16 |
816 | align 16 |
817 | proc ted_on_open_file |
817 | proc ted_on_open_file |
818 | push eax ;destination |
818 | push eax ;destination |
819 | push ecx ;for cycle |
819 | push ecx ;for cycle |
820 | push edx ;source |
820 | push edx ;source |
821 | push esi |
821 | push esi |
822 | 822 | ||
823 | or ebx,ebx |
823 | or ebx,ebx |
824 | jnz @f |
824 | jnz @f |
825 | ;¥á«¨ ä ©« ¯ãá⮩ |
825 | ;¥á«¨ ä ©« ¯ãá⮩ |
826 | stdcall ted_clear,edi,1 ;ç¨á⨬ ¢áî ¯ ¬ïâì |
826 | stdcall ted_clear,edi,1 ;ç¨á⨬ ¢áî ¯ ¬ïâì |
827 | jmp .end_opn |
827 | jmp .end_opn |
828 | @@: |
828 | @@: |
829 | stdcall ted_clear,edi,0 ;ç¨á⨬ ¥ ¢áî ¯ ¬ïâì, ¯®â®¬ã çâ® ¨¦¥ ¡ã¤¥¬ ¥¥ § ¯®«ïâì ®¢ë¬¨ ¤ 묨 |
829 | stdcall ted_clear,edi,0 ;ç¨á⨬ ¥ ¢áî ¯ ¬ïâì, ¯®â®¬ã çâ® ¨¦¥ ¡ã¤¥¬ ¥¥ § ¯®«ïâì ®¢ë¬¨ ¤ 묨 |
830 | 830 | ||
831 | ;ª®£¤ ᨬ¢®« § ¢¥à襨ï áâப¨ ⮫쪮 10 (¡¥§ 13) |
831 | ;ª®£¤ ᨬ¢®« § ¢¥à襨ï áâப¨ ⮫쪮 10 (¡¥§ 13) |
832 | mov edx,ted_tex |
832 | mov edx,ted_tex |
833 | mov ecx,ebx |
833 | mov ecx,ebx |
834 | @@: |
834 | @@: |
835 | cmp byte[edx],13 |
835 | cmp byte[edx],13 |
836 | je .no_10 ;¥á«¨ ©¤¥ ᨬ¢®« 13, â® 10-¥ ¨£®à¨à㥬 |
836 | je .no_10 ;¥á«¨ ©¤¥ ᨬ¢®« 13, â® 10-¥ ¨£®à¨à㥬 |
837 | inc edx |
837 | inc edx |
838 | loop @b |
838 | loop @b |
839 | mov edx,ted_tex |
839 | mov edx,ted_tex |
840 | mov ecx,ebx |
840 | mov ecx,ebx |
841 | .s_10: |
841 | .s_10: |
842 | cmp byte[edx],10 |
842 | cmp byte[edx],10 |
843 | jne @f |
843 | jne @f |
844 | mov byte[edx],13 ;¬¥ï¥¬ 10-© ᨬ¢®« ª®æ áâப¨ |
844 | mov byte[edx],13 ;¬¥ï¥¬ 10-© ᨬ¢®« ª®æ áâப¨ |
845 | @@: |
845 | @@: |
846 | inc edx |
846 | inc edx |
847 | loop .s_10 |
847 | loop .s_10 |
848 | .no_10: |
848 | .no_10: |
849 | 849 | ||
850 | ;¯¥à¥¢®¤¨¬ ®âªàëâë© ä ©« ¢ãâàì í«¥¬¥â t_edit |
850 | ;¯¥à¥¢®¤¨¬ ®âªàëâë© ä ©« ¢ãâàì í«¥¬¥â t_edit |
851 | mov ecx,ebx |
851 | mov ecx,ebx |
852 | lea eax,[ebx+2] |
852 | lea eax,[ebx+2] |
853 | ConvertIndexToPointer eax |
853 | ConvertIndexToPointer eax |
854 | mov edx,ted_tex |
854 | mov edx,ted_tex |
855 | add edx,ebx |
855 | add edx,ebx |
856 | push ebx |
856 | push ebx |
857 | @@: |
857 | @@: |
858 | mov ebx,[edx] |
858 | mov ebx,[edx] |
859 | mov byte[eax],bl |
859 | mov byte[eax],bl |
860 | mov dword[eax+symbol.perv],ecx |
860 | mov dword[eax+symbol.perv],ecx |
861 | inc dword[eax+symbol.perv] |
861 | inc dword[eax+symbol.perv] |
862 | mov dword[eax+symbol.next],ecx |
862 | mov dword[eax+symbol.next],ecx |
863 | add dword[eax+symbol.next],3 |
863 | add dword[eax+symbol.next],3 |
864 | ;mov byte[eax+1],0 ;col=0 |
864 | ;mov byte[eax+1],0 ;col=0 |
865 | mov dword[eax+symbol.tc],-1 |
865 | mov dword[eax+symbol.tc],-1 |
866 | mov dword[eax+symbol.td],0 |
866 | mov dword[eax+symbol.td],0 |
867 | 867 | ||
868 | or ecx,ecx |
868 | or ecx,ecx |
869 | jz @f |
869 | jz @f |
870 | dec ecx |
870 | dec ecx |
871 | dec edx |
871 | dec edx |
872 | sub eax,sizeof.symbol |
872 | sub eax,sizeof.symbol |
873 | jmp @b |
873 | jmp @b |
874 | @@: |
874 | @@: |
875 | pop ebx |
875 | pop ebx |
876 | mov dword[eax+symbol.perv],0 ; first sumbol 'perv=0' |
876 | mov dword[eax+symbol.perv],0 ; first sumbol 'perv=0' |
877 | 877 | ||
878 | mov edx,ted_tex ; áâனª¨ ç «ì®£® á«ã¦¥¡®£® ᨬ¢®« |
878 | mov edx,ted_tex ; áâனª¨ ç «ì®£® á«ã¦¥¡®£® ᨬ¢®« |
879 | ; begining sumbol 'perv=0' 'next=2' |
879 | ; begining sumbol 'perv=0' 'next=2' |
880 | mov dword[edx+symbol.perv],0 |
880 | mov dword[edx+symbol.perv],0 |
881 | mov dword[edx+symbol.next],2 |
881 | mov dword[edx+symbol.next],2 |
882 | 882 | ||
883 | add edx,sizeof.symbol ; áâனª¨ ª®¥ç®£® á«ã¦¥¡®£® ᨬ¢®« |
883 | add edx,sizeof.symbol ; áâனª¨ ª®¥ç®£® á«ã¦¥¡®£® ᨬ¢®« |
884 | mov dword[edx+symbol.next],0 ; last sumbol 'next=0' |
884 | mov dword[edx+symbol.next],0 ; last sumbol 'next=0' |
885 | mov dword[edx+symbol.perv],ebx ; last sumbol 'perv=last' |
885 | mov dword[edx+symbol.perv],ebx ; last sumbol 'perv=last' |
886 | inc dword[edx+symbol.perv] |
886 | inc dword[edx+symbol.perv] |
887 | mov dword[edx+symbol.tc],0 ; áâ ¢¨¬ ¢à¥¬ï ᮧ¤ ¨ï à ¢®¥ 0, çâ® ¡ë ᨬ¢®« ¯à ¢¨«ì® ®¡à ¡ âë¢ «áï ¯à¨ ®âªàë⨨ ä ©«®¢ ¡®«ìè¨å 28 ¡ ©â |
887 | mov dword[edx+symbol.tc],0 ; áâ ¢¨¬ ¢à¥¬ï ᮧ¤ ¨ï à ¢®¥ 0, çâ® ¡ë ᨬ¢®« ¯à ¢¨«ì® ®¡à ¡ âë¢ «áï ¯à¨ ®âªàë⨨ ä ©«®¢ ¡®«ìè¨å 28 ¡ ©â |
888 | 888 | ||
889 | mov edx,ebx |
889 | mov edx,ebx |
890 | inc edx ;2 = rezerv sumbols |
890 | inc edx ;2 = rezerv sumbols |
891 | imul edx,sizeof.symbol |
891 | imul edx,sizeof.symbol |
892 | add edx,ted_tex |
892 | add edx,ted_tex |
893 | mov dword[edx+symbol.next],1 ; last sumbol 'next=1' |
893 | mov dword[edx+symbol.next],1 ; last sumbol 'next=1' |
894 | 894 | ||
895 | @@: ;clear memory, need if before was open big file |
895 | @@: ;clear memory, need if before was open big file |
896 | add edx,sizeof.symbol |
896 | add edx,sizeof.symbol |
897 | cmp edx,ted_tex_end |
897 | cmp edx,ted_tex_end |
898 | jge .end_opn |
898 | jge .end_opn |
899 | mov dword[edx+symbol.tc],0 |
899 | mov dword[edx+symbol.tc],0 |
900 | mov dword[edx+symbol.td],0 |
900 | mov dword[edx+symbol.td],0 |
901 | jmp @b |
901 | jmp @b |
902 | .end_opn: |
902 | .end_opn: |
903 | 903 | ||
904 | call ted_get_num_lines |
904 | call ted_get_num_lines |
905 | cmp eax,TED_LINES_IN_NEW_FILE |
905 | cmp eax,TED_LINES_IN_NEW_FILE |
906 | jge @f |
906 | jge @f |
907 | mov eax,TED_LINES_IN_NEW_FILE |
907 | mov eax,TED_LINES_IN_NEW_FILE |
908 | @@: |
908 | @@: |
909 | mov esi,ted_scr_w |
909 | mov esi,ted_scr_w |
910 | mov dword[esi+sb_offs_max_area],eax |
910 | mov dword[esi+sb_offs_max_area],eax |
911 | pop esi edx ecx eax |
911 | pop esi edx ecx eax |
912 | 912 | ||
913 | call ted_text_colored |
913 | call ted_text_colored |
914 | stdcall ted_draw,edi |
914 | stdcall ted_draw,edi |
915 | cmp ted_fun_draw_panel_buttons,0 |
915 | cmp ted_fun_draw_panel_buttons,0 |
916 | je @f |
916 | je @f |
917 | call ted_fun_draw_panel_buttons |
917 | call ted_fun_draw_panel_buttons |
918 | @@: |
918 | @@: |
919 | ret |
919 | ret |
920 | endp |
920 | endp |
921 | 921 | ||
922 | ;input: |
922 | ;input: |
923 | ; edx = pointer to symbol struct |
923 | ; edx = pointer to symbol struct |
924 | ; edi = pointer to tedit struct |
924 | ; edi = pointer to tedit struct |
925 | ;output: |
925 | ;output: |
926 | ; edx = pointer to 'perv' visible symbol struct |
926 | ; edx = pointer to 'perv' visible symbol struct |
927 | align 16 |
927 | align 16 |
928 | ted_iterat_perv: |
928 | ted_iterat_perv: |
929 | cmp ted_tim_undo,0 |
929 | cmp ted_tim_undo,0 |
930 | je .else |
930 | je .else |
931 | push ebx |
931 | push ebx |
932 | @@: |
932 | @@: |
933 | mov edx,[edx+symbol.perv] |
933 | mov edx,[edx+symbol.perv] |
934 | or edx,edx |
934 | or edx,edx |
935 | jz @f |
935 | jz @f |
936 | imul edx,sizeof.symbol |
936 | imul edx,sizeof.symbol |
937 | add edx,ted_tex |
937 | add edx,ted_tex |
938 | call ted_symbol_not_vis |
938 | call ted_symbol_not_vis |
939 | cmp bl,1 |
939 | cmp bl,1 |
940 | je @b |
940 | je @b |
941 | cmp byte[edx],10 ;¯à®¯ã᪠ᨬ¢®« á ª®¤®¬ 10 |
941 | cmp byte[edx],10 ;¯à®¯ã᪠ᨬ¢®« á ª®¤®¬ 10 |
942 | je @b |
942 | je @b |
943 | pop ebx |
943 | pop ebx |
944 | ret |
944 | ret |
945 | @@: |
945 | @@: |
946 | mov edx,ted_tex ; ç «® ä ©« |
946 | mov edx,ted_tex ; ç «® ä ©« |
947 | pop ebx |
947 | pop ebx |
948 | ret |
948 | ret |
949 | .else: |
949 | .else: |
950 | mov edx,[edx+symbol.perv] |
950 | mov edx,[edx+symbol.perv] |
951 | or edx,edx |
951 | or edx,edx |
952 | jz @f |
952 | jz @f |
953 | imul edx,sizeof.symbol |
953 | imul edx,sizeof.symbol |
954 | add edx,ted_tex |
954 | add edx,ted_tex |
955 | cmp dword[edx+symbol.td],0 |
955 | cmp dword[edx+symbol.td],0 |
956 | jne .else |
956 | jne .else |
957 | cmp byte[edx],10 ;¯à®¯ã᪠ᨬ¢®« á ª®¤®¬ 10 |
957 | cmp byte[edx],10 ;¯à®¯ã᪠ᨬ¢®« á ª®¤®¬ 10 |
958 | je .else |
958 | je .else |
959 | ret |
959 | ret |
960 | @@: |
960 | @@: |
961 | mov edx,ted_tex ; ç «® ä ©« |
961 | mov edx,ted_tex ; ç «® ä ©« |
962 | ret |
962 | ret |
963 | 963 | ||
964 | 964 | ||
965 | ;input: |
965 | ;input: |
966 | ; edx = pointer to symbol struct |
966 | ; edx = pointer to symbol struct |
967 | ; edi = pointer to tedit struct |
967 | ; edi = pointer to tedit struct |
968 | ;output: |
968 | ;output: |
969 | ; edx = pointer to 'next' visible symbol struct |
969 | ; edx = pointer to 'next' visible symbol struct |
970 | align 16 |
970 | align 16 |
971 | ted_iterat_next: |
971 | ted_iterat_next: |
972 | cmp ted_tim_undo,0 |
972 | cmp ted_tim_undo,0 |
973 | je .else |
973 | je .else |
974 | push ebx |
974 | push ebx |
975 | @@: |
975 | @@: |
976 | mov edx,[edx+symbol.next] |
976 | mov edx,[edx+symbol.next] |
977 | cmp edx,1 |
977 | cmp edx,1 |
978 | jle @f |
978 | jle @f |
979 | imul edx,sizeof.symbol |
979 | imul edx,sizeof.symbol |
980 | add edx,ted_tex |
980 | add edx,ted_tex |
981 | 981 | ||
982 | call ted_symbol_not_vis |
982 | call ted_symbol_not_vis |
983 | cmp bl,1 |
983 | cmp bl,1 |
984 | je @b |
984 | je @b |
985 | cmp byte[edx],10 ;¯à®¯ã᪠ᨬ¢®« á ª®¤®¬ 10 |
985 | cmp byte[edx],10 ;¯à®¯ã᪠ᨬ¢®« á ª®¤®¬ 10 |
986 | je @b |
986 | je @b |
987 | pop ebx |
987 | pop ebx |
988 | ret |
988 | ret |
989 | @@: |
989 | @@: |
990 | mov edx,ted_tex_1 ;ª®¥æ ä ©« |
990 | mov edx,ted_tex_1 ;ª®¥æ ä ©« |
991 | pop ebx |
991 | pop ebx |
992 | ret |
992 | ret |
993 | .else: |
993 | .else: |
994 | mov edx,[edx+symbol.next] |
994 | mov edx,[edx+symbol.next] |
995 | cmp edx,1 |
995 | cmp edx,1 |
996 | jle @f |
996 | jle @f |
997 | imul edx,sizeof.symbol |
997 | imul edx,sizeof.symbol |
998 | add edx,ted_tex |
998 | add edx,ted_tex |
999 | 999 | ||
1000 | cmp dword[edx+symbol.td],0 |
1000 | cmp dword[edx+symbol.td],0 |
1001 | jne .else |
1001 | jne .else |
1002 | cmp byte[edx],10 ;¯à®¯ã᪠ᨬ¢®« á ª®¤®¬ 10 |
1002 | cmp byte[edx],10 ;¯à®¯ã᪠ᨬ¢®« á ª®¤®¬ 10 |
1003 | je .else |
1003 | je .else |
1004 | ret |
1004 | ret |
1005 | @@: |
1005 | @@: |
1006 | mov edx,ted_tex_1 ;ª®¥æ ä ©« |
1006 | mov edx,ted_tex_1 ;ª®¥æ ä ©« |
1007 | ret |
1007 | ret |
1008 | 1008 | ||
1009 | ;input: |
1009 | ;input: |
1010 | ; bl = symbol end of select |
1010 | ; bl = symbol end of select |
1011 | ; bh = íªà ¨àãî騩 ᨬ¢®« (= 0 ¥á«¨ ¥â ¯à®¢¥àª¨ ¨å) |
1011 | ; bh = íªà ¨àãî騩 ᨬ¢®« (= 0 ¥á«¨ ¥â ¯à®¢¥àª¨ ¨å) |
1012 | ; edx = pointer to symbol struct |
1012 | ; edx = pointer to symbol struct |
1013 | ; edi = pointer to tedit struct |
1013 | ; edi = pointer to tedit struct |
1014 | ;description: |
1014 | ;description: |
1015 | ; ©â¨ á«¥¤ãîéãî ¯®§¨æ¨î 㪠§ ®£® ᨬ¢®« |
1015 | ; ©â¨ á«¥¤ãîéãî ¯®§¨æ¨î 㪠§ ®£® ᨬ¢®« |
1016 | align 16 |
1016 | align 16 |
1017 | ted_iterat_next_pos_char: |
1017 | ted_iterat_next_pos_char: |
1018 | push ax |
1018 | push ax |
1019 | mov al,1 ;¯à¥¤ë¤ã騩 ᨬ¢®«, á«ã¦¨â ¤«ï áà ¢¥¨ï á ᨬ¢®«®¬ bh |
1019 | mov al,1 ;¯à¥¤ë¤ã騩 ᨬ¢®«, á«ã¦¨â ¤«ï áà ¢¥¨ï á ᨬ¢®«®¬ bh |
1020 | @@: |
1020 | @@: |
1021 | cmp bl,byte[edx] |
1021 | cmp bl,byte[edx] |
1022 | je .found |
1022 | je .found |
1023 | .no_found: |
1023 | .no_found: |
1024 | cmp edx,ted_tex_1 |
1024 | cmp edx,ted_tex_1 |
1025 | jle @f |
1025 | jle @f |
1026 | mov al,byte[edx] |
1026 | mov al,byte[edx] |
1027 | call ted_iterat_next |
1027 | call ted_iterat_next |
1028 | jmp @b |
1028 | jmp @b |
1029 | .found: |
1029 | .found: |
1030 | cmp bh,al |
1030 | cmp bh,al |
1031 | je .no_found |
1031 | je .no_found |
1032 | @@: |
1032 | @@: |
1033 | call ted_iterat_next |
1033 | call ted_iterat_next |
1034 | pop ax |
1034 | pop ax |
1035 | ret |
1035 | ret |
1036 | 1036 | ||
1037 | ;input: |
1037 | ;input: |
1038 | ; edx = pointer to symbol struct |
1038 | ; edx = pointer to symbol struct |
1039 | ; edi = pointer to tedit struct |
1039 | ; edi = pointer to tedit struct |
1040 | align 16 |
1040 | align 16 |
1041 | ted_iterat_perv_color_tag: |
1041 | ted_iterat_perv_color_tag: |
1042 | @@: |
1042 | @@: |
1043 | cmp byte[edx+1],0 |
1043 | cmp byte[edx+1],0 |
1044 | jne @f |
1044 | jne @f |
1045 | call ted_iterat_perv |
1045 | call ted_iterat_perv |
1046 | cmp edx,ted_tex_1 |
1046 | cmp edx,ted_tex_1 |
1047 | jle @f |
1047 | jle @f |
1048 | jmp @b |
1048 | jmp @b |
1049 | align 4 |
1049 | align 4 |
1050 | @@: |
1050 | @@: |
1051 | ret |
1051 | ret |
1052 | 1052 | ||
1053 | ;input: |
1053 | ;input: |
1054 | ; edx = pointer to symbol struct |
1054 | ; edx = pointer to symbol struct |
1055 | ; edi = pointer to tedit struct |
1055 | ; edi = pointer to tedit struct |
1056 | align 16 |
1056 | align 16 |
1057 | ted_iterat_next_color_tag: |
1057 | ted_iterat_next_color_tag: |
1058 | @@: |
1058 | @@: |
1059 | call ted_iterat_next |
1059 | call ted_iterat_next |
1060 | cmp byte[edx+1],0 |
1060 | cmp byte[edx+1],0 |
1061 | jne @f |
1061 | jne @f |
1062 | cmp edx,ted_tex_1 |
1062 | cmp edx,ted_tex_1 |
1063 | jle @f |
1063 | jle @f |
1064 | jmp @b |
1064 | jmp @b |
1065 | align 4 |
1065 | align 4 |
1066 | @@: |
1066 | @@: |
1067 | ret |
1067 | ret |
1068 | 1068 | ||
1069 | ;input: |
1069 | ;input: |
1070 | ; edx = pointer to symbol struct |
1070 | ; edx = pointer to symbol struct |
1071 | ; edi = pointer to tedit struct |
1071 | ; edi = pointer to tedit struct |
1072 | ;output: |
1072 | ;output: |
1073 | ; bl = 1 if sumbol not visible |
1073 | ; bl = 1 if sumbol not visible |
1074 | ; (tex[i].td+ted_tim_undo<=ted_tim_ch && tex[i].td) || (tex[i].tc>ted_tim_ch-ted_tim_undo) |
1074 | ; (tex[i].td+ted_tim_undo<=ted_tim_ch && tex[i].td) || (tex[i].tc>ted_tim_ch-ted_tim_undo) |
1075 | align 16 |
1075 | align 16 |
1076 | ted_symbol_not_vis: |
1076 | ted_symbol_not_vis: |
1077 | push eax |
1077 | push eax |
1078 | 1078 | ||
1079 | xor bl,bl |
1079 | xor bl,bl |
1080 | cmp dword[edx+symbol.td],0 |
1080 | cmp dword[edx+symbol.td],0 |
1081 | je @f |
1081 | je @f |
1082 | mov eax,[edx+symbol.td] ;eax=tex[i].td |
1082 | mov eax,[edx+symbol.td] ;eax=tex[i].td |
1083 | add eax,ted_tim_undo |
1083 | add eax,ted_tim_undo |
1084 | cmp eax,ted_tim_ch |
1084 | cmp eax,ted_tim_ch |
1085 | jg @f |
1085 | jg @f |
1086 | mov bl,1 |
1086 | mov bl,1 |
1087 | pop eax |
1087 | pop eax |
1088 | ret |
1088 | ret |
1089 | @@: |
1089 | @@: |
1090 | 1090 | ||
1091 | mov eax,ted_tim_ch |
1091 | mov eax,ted_tim_ch |
1092 | sub eax,ted_tim_undo |
1092 | sub eax,ted_tim_undo |
1093 | cmp [edx+symbol.tc],eax |
1093 | cmp [edx+symbol.tc],eax |
1094 | jle @f |
1094 | jle @f |
1095 | or bl,1 |
1095 | or bl,1 |
1096 | @@: |
1096 | @@: |
1097 | 1097 | ||
1098 | pop eax |
1098 | pop eax |
1099 | ret |
1099 | ret |
1100 | 1100 | ||
1101 | ;input: |
1101 | ;input: |
1102 | ; text - pointer to text string |
1102 | ; text - pointer to text string |
1103 | ; add_opt - options |
1103 | ; add_opt - options |
1104 | align 16 |
1104 | align 16 |
1105 | proc ted_text_add, edit:dword, text:dword, t_len:dword, add_opt:dword |
1105 | proc ted_text_add, edit:dword, text:dword, t_len:dword, add_opt:dword |
1106 | locals |
1106 | locals |
1107 | new_spc dd ? ;count new spaces |
1107 | new_spc dd ? ;count new spaces |
1108 | new_lin dd ? ;count new lines |
1108 | new_lin dd ? ;count new lines |
1109 | endl |
1109 | endl |
1110 | ;¨á¯®«ì§®¢ ¨¥ ॣ¨áâ஢ ¢ãâਠäãªæ¨¨: |
1110 | ;¨á¯®«ì§®¢ ¨¥ ॣ¨áâ஢ ¢ãâਠäãªæ¨¨: |
1111 | ;eax - ¯®§¨æ¨ï ¤«ï ¢áâ ¢ª¨ ⥪áâ |
1111 | ;eax - ¯®§¨æ¨ï ¤«ï ¢áâ ¢ª¨ ⥪áâ |
1112 | ;ebx - ¤«ï ¢à¥¬¥ëå 㦤, ¤«¨ ¢áâ ¢«ï¥¬®£® ⥪áâ |
1112 | ;ebx - ¤«ï ¢à¥¬¥ëå 㦤, ¤«¨ ¢áâ ¢«ï¥¬®£® ⥪áâ |
1113 | ;ecx - ¤«ï ¢à¥¬¥ëå 㦤 |
1113 | ;ecx - ¤«ï ¢à¥¬¥ëå 㦤 |
1114 | ;edx - 㪠§ ⥫ì áâàãªâãàã ᨬ¢®« |
1114 | ;edx - 㪠§ ⥫ì áâàãªâãàã ᨬ¢®« |
1115 | pushad |
1115 | pushad |
1116 | cmp dword[t_len],1 ;¯à®¢¥à塞 ¤«¨ã ¤®¡¢«ï¥¬®£® ⥪áâ |
1116 | cmp dword[t_len],1 ;¯à®¢¥à塞 ¤«¨ã ¤®¡¢«ï¥¬®£® ⥪áâ |
1117 | jl .no_add ;ª®£¤ ¤«¨ <1 ¯àë£ ¥¬ ª®¥æ äãªæ¨¨, ¢® ¨§¡¥¦ ¨¥ £«îª®¢ |
1117 | jl .no_add ;ª®£¤ ¤«¨ <1 ¯àë£ ¥¬ ª®¥æ äãªæ¨¨, ¢® ¨§¡¥¦ ¨¥ £«îª®¢ |
1118 | 1118 | ||
1119 | mov edi,[edit] |
1119 | mov edi,[edit] |
1120 | mov esi,[text] |
1120 | mov esi,[text] |
1121 | 1121 | ||
1122 | call ted_get_pos_by_cursor |
1122 | call ted_get_pos_by_cursor |
1123 | call ted_get_text_perv_pos |
1123 | call ted_get_text_perv_pos |
1124 | call ted_get_text_arr_index ;eax=po_t |
1124 | call ted_get_text_arr_index ;eax=po_t |
1125 | 1125 | ||
1126 | mov dword[new_spc],0 |
1126 | mov dword[new_spc],0 |
1127 | cmp ted_gp_opt,2 |
1127 | cmp ted_gp_opt,2 |
1128 | je @f |
1128 | je @f |
1129 | push eax ;c_sp=cur[cn].x+Scroller->XPos-StrLen(cur[cn].y+Scroller->YPos); |
1129 | push eax ;c_sp=cur[cn].x+Scroller->XPos-StrLen(cur[cn].y+Scroller->YPos); |
1130 | mov eax,ted_scr_h |
1130 | mov eax,ted_scr_h |
1131 | mov eax,[eax+sb_offs_position] |
1131 | mov eax,[eax+sb_offs_position] |
1132 | add eax,ted_cur_x ;eax - ®¬¥à ᨬ¢®« |
1132 | add eax,ted_cur_x ;eax - ®¬¥à ᨬ¢®« |
1133 | mov [new_spc],eax |
1133 | mov [new_spc],eax |
1134 | 1134 | ||
1135 | mov eax,ted_scr_w |
1135 | mov eax,ted_scr_w |
1136 | mov eax,[eax+sb_offs_position] |
1136 | mov eax,[eax+sb_offs_position] |
1137 | add eax,ted_cur_y ;eax - ®¬¥à áâப¨ |
1137 | add eax,ted_cur_y ;eax - ®¬¥à áâப¨ |
1138 | call ted_strlen ;ebx = line len |
1138 | call ted_strlen ;ebx = line len |
1139 | sub [new_spc],ebx ;®â ¯®§¨æ¨¨ ªãàá®à ®â¨¬ ¥¬ ¤«¨ã áâப¨, 㧠¥¬ ª®««¨ç¥á⢮ ¤®¡ ¢«ï¥¬ëå ¯à®¡¥«®¢ |
1139 | sub [new_spc],ebx ;®â ¯®§¨æ¨¨ ªãàá®à ®â¨¬ ¥¬ ¤«¨ã áâப¨, 㧠¥¬ ª®««¨ç¥á⢮ ¤®¡ ¢«ï¥¬ëå ¯à®¡¥«®¢ |
1140 | pop eax |
1140 | pop eax |
1141 | @@: |
1141 | @@: |
1142 | 1142 | ||
1143 | mov ebx,[t_len] |
1143 | mov ebx,[t_len] |
1144 | 1144 | ||
1145 | mov dword[new_lin],0 |
1145 | mov dword[new_lin],0 |
1146 | cmp ted_gp_opt,0 |
1146 | cmp ted_gp_opt,0 |
1147 | jne @f |
1147 | jne @f |
1148 | push eax |
1148 | push eax |
1149 | mov eax,ted_scr_w |
1149 | mov eax,ted_scr_w |
1150 | mov eax,[eax+sb_offs_position] |
1150 | mov eax,[eax+sb_offs_position] |
1151 | add eax,ted_cur_y |
1151 | add eax,ted_cur_y |
1152 | inc eax |
1152 | inc eax |
1153 | mov [new_lin],eax |
1153 | mov [new_lin],eax |
1154 | 1154 | ||
1155 | call ted_get_num_lines |
1155 | call ted_get_num_lines |
1156 | sub [new_lin],eax |
1156 | sub [new_lin],eax |
1157 | ;㢥«¨ç¨¢ ¥¬ «¨¨¨ ¢ áªà®««¨£¥ ç¨á«® ¤®¡ ¢«¥ëå ¤®¯®«¨â¥«ìëå áâப |
1157 | ;㢥«¨ç¨¢ ¥¬ «¨¨¨ ¢ áªà®««¨£¥ ç¨á«® ¤®¡ ¢«¥ëå ¤®¯®«¨â¥«ìëå áâப |
1158 | mov ecx,ted_scr_w |
1158 | mov ecx,ted_scr_w |
1159 | add [ecx+sb_offs_max_area],eax ;㢥«¨ç¨¢ ¥¬ à §¬¥à ¢¥à⨪ «ì®£® áªà®««¨£ |
1159 | add [ecx+sb_offs_max_area],eax ;㢥«¨ç¨¢ ¥¬ à §¬¥à ¢¥à⨪ «ì®£® áªà®««¨£ |
1160 | pop eax |
1160 | pop eax |
1161 | @@: |
1161 | @@: |
1162 | 1162 | ||
1163 | mov edx,ted_ptr_free_symb |
1163 | mov edx,ted_ptr_free_symb |
1164 | .beg_cycle: ;for(i=...;i |
1164 | .beg_cycle: ;for(i=...;i |
1165 | cmp dword[edx+symbol.tc],0 ;if(!tex[i].tc && !tex[i].td) |
1165 | cmp dword[edx+symbol.tc],0 ;if(!tex[i].tc && !tex[i].td) |
1166 | jne .u1f |
1166 | jne .u1f |
1167 | cmp dword[edx+symbol.td],0 |
1167 | cmp dword[edx+symbol.td],0 |
1168 | jne .u1f |
1168 | jne .u1f |
1169 | test dword[add_opt],ted_opt_ed_change_time ;if(n_tim) ted_tim_ch++; |
1169 | test dword[add_opt],ted_opt_ed_change_time ;if(n_tim) ted_tim_ch++; |
1170 | jz .no_tim |
1170 | jz .no_tim |
1171 | inc ted_tim_ch |
1171 | inc ted_tim_ch |
1172 | .no_tim: |
1172 | .no_tim: |
1173 | test dword[add_opt],ted_opt_ed_move_cursor |
1173 | test dword[add_opt],ted_opt_ed_move_cursor |
1174 | jz .no_cur_mov |
1174 | jz .no_cur_mov |
1175 | cmp dword[new_lin],0 ;¥á«¨ ¥áâì ¤®¡ ¢®çë¥ áâப¨, â® ªãàá®à ¥é¥ ¥ ¤¢¨£ ¥¬ |
1175 | cmp dword[new_lin],0 ;¥á«¨ ¥áâì ¤®¡ ¢®çë¥ áâப¨, â® ªãàá®à ¥é¥ ¥ ¤¢¨£ ¥¬ |
1176 | jg .no_cur_mov |
1176 | jg .no_cur_mov |
1177 | cmp dword[new_spc],0 ;¥á«¨ ¥â ¤®¡ ¢®çëå ¯à®¡¥«®¢, â® ªãàá®à ⮦¥ ¥ ¤¢¨£ ¥¬ |
1177 | cmp dword[new_spc],0 ;¥á«¨ ¥â ¤®¡ ¢®çëå ¯à®¡¥«®¢, â® ªãàá®à ⮦¥ ¥ ¤¢¨£ ¥¬ |
1178 | jg .no_cur_mov |
1178 | jg .no_cur_mov |
1179 | inc ted_cur_x ;move cursor |
1179 | inc ted_cur_x ;move cursor |
1180 | ;call ted_go_to_pos |
1180 | ;call ted_go_to_pos |
1181 | cmp byte[esi],13 |
1181 | cmp byte[esi],13 |
1182 | jne .no_cur_mov |
1182 | jne .no_cur_mov |
1183 | mov ted_cur_x,0 |
1183 | mov ted_cur_x,0 |
1184 | inc ted_cur_y |
1184 | inc ted_cur_y |
1185 | ;㢥«¨ç¨¢ ¥¬ «¨¨¨ ¢ áªà®««¨£¥ ç¨á«® ¤®¡ ¢«¥ëå ¢ ⥪á⥠áâப |
1185 | ;㢥«¨ç¨¢ ¥¬ «¨¨¨ ¢ áªà®««¨£¥ ç¨á«® ¤®¡ ¢«¥ëå ¢ ⥪á⥠áâப |
1186 | mov ecx,ted_scr_w |
1186 | mov ecx,ted_scr_w |
1187 | inc dword[ecx+sb_offs_max_area] ;㢥«¨ç¨¢ ¥¬ à §¬¥à ¢¥à⨪ «ì®£® áªà®««¨£ |
1187 | inc dword[ecx+sb_offs_max_area] ;㢥«¨ç¨¢ ¥¬ à §¬¥à ¢¥à⨪ «ì®£® áªà®««¨£ |
1188 | .no_cur_mov: |
1188 | .no_cur_mov: |
1189 | 1189 | ||
1190 | ; *** ¢áâ ¢ª ⥪ã饣® ᨬ¢®« ¨§ áâப¨ *** |
1190 | ; *** ¢áâ ¢ª ⥪ã饣® ᨬ¢®« ¨§ áâப¨ *** |
1191 | mov ecx,ted_opt_ed_change_time |
1191 | mov ecx,ted_opt_ed_change_time |
1192 | not ecx |
1192 | not ecx |
1193 | and [add_opt],ecx ;n_tim=false; |
1193 | and [add_opt],ecx ;n_tim=false; |
1194 | 1194 | ||
1195 | mov cl,byte[esi] ;tex[i].c=ta[ns]; |
1195 | mov cl,byte[esi] ;tex[i].c=ta[ns]; |
1196 | mov byte[edx],cl |
1196 | mov byte[edx],cl |
1197 | m2m dword[edx+symbol.tc],ted_tim_ch ;tex[i].tc=ted_tim_ch; |
1197 | m2m dword[edx+symbol.tc],ted_tim_ch ;tex[i].tc=ted_tim_ch; |
1198 | mov [edx+symbol.perv],eax ;tex[i].perv=po_t; |
1198 | mov [edx+symbol.perv],eax ;tex[i].perv=po_t; |
1199 | 1199 | ||
1200 | mov ecx,eax |
1200 | mov ecx,eax |
1201 | imul ecx,sizeof.symbol |
1201 | imul ecx,sizeof.symbol |
1202 | add ecx,ted_tex ; *** ecx = tex[po_t] *** |
1202 | add ecx,ted_tex ; *** ecx = tex[po_t] *** |
1203 | add ecx,symbol.next ; *** ecx = tex[po_t].next *** |
1203 | add ecx,symbol.next ; *** ecx = tex[po_t].next *** |
1204 | m2m dword[edx+symbol.next],dword[ecx] ;tex[i].next=tex[po_t].next; |
1204 | m2m dword[edx+symbol.next],dword[ecx] ;tex[i].next=tex[po_t].next; |
1205 | 1205 | ||
1206 | call ted_get_text_arr_index ;*** eax = i *** |
1206 | call ted_get_text_arr_index ;*** eax = i *** |
1207 | mov [ecx],eax ;tex[po_t].next=i; // áá뫪¨ ¯¥à¥ ¯à ¢«ï¥¬ |
1207 | mov [ecx],eax ;tex[po_t].next=i; // áá뫪¨ ¯¥à¥ ¯à ¢«ï¥¬ |
1208 | mov ecx,[edx+symbol.next] ; *** ecx = tex[i].next *** |
1208 | mov ecx,[edx+symbol.next] ; *** ecx = tex[i].next *** |
1209 | imul ecx,sizeof.symbol |
1209 | imul ecx,sizeof.symbol |
1210 | add ecx,ted_tex ; *** ecx = tex[tex[i].next] *** |
1210 | add ecx,ted_tex ; *** ecx = tex[tex[i].next] *** |
1211 | mov [ecx+symbol.perv],eax ;tex[tex[i].next].perv=i; |
1211 | mov [ecx+symbol.perv],eax ;tex[tex[i].next].perv=i; |
1212 | 1212 | ||
1213 | ; *** ¢áâ ¢ª ¤®¯®«¨â¥«ìëå áâப ¨ ¯à®¡¥«®¢ |
1213 | ; *** ¢áâ ¢ª ¤®¯®«¨â¥«ìëå áâப ¨ ¯à®¡¥«®¢ |
1214 | ; ¥á«¨ ªãàá®à ¢® ¢à¥¬ï ¢áâ ¢ª¨ 室¨«áï § ⥪á⮬ *** |
1214 | ; ¥á«¨ ªãàá®à ¢® ¢à¥¬ï ¢áâ ¢ª¨ 室¨«áï § ⥪á⮬ *** |
1215 | cmp dword[new_lin],0 ;add lines or text |
1215 | cmp dword[new_lin],0 ;add lines or text |
1216 | jle .spc_add |
1216 | jle .spc_add |
1217 | dec dword[new_lin] |
1217 | dec dword[new_lin] |
1218 | mov byte [edx],13 |
1218 | mov byte [edx],13 |
1219 | jmp .u1f |
1219 | jmp .u1f |
1220 | .spc_add: |
1220 | .spc_add: |
1221 | cmp dword[new_spc],0 ;add spaces or text |
1221 | cmp dword[new_spc],0 ;add spaces or text |
1222 | jle .tex_add |
1222 | jle .tex_add |
1223 | dec dword[new_spc] |
1223 | dec dword[new_spc] |
1224 | mov byte [edx],' ' |
1224 | mov byte [edx],' ' |
1225 | jmp .u1f |
1225 | jmp .u1f |
1226 | .tex_add: |
1226 | .tex_add: |
1227 | inc esi ; ¯¥à¥å®¤ ª á«¥¤ãî饬㠢áâ ¢«ï¥¬®¬ã ᨬ¢®«ã |
1227 | inc esi ; ¯¥à¥å®¤ ª á«¥¤ãî饬㠢áâ ¢«ï¥¬®¬ã ᨬ¢®«ã |
1228 | dec ebx |
1228 | dec ebx |
1229 | .u1f: |
1229 | .u1f: |
1230 | add edx,sizeof.symbol |
1230 | add edx,sizeof.symbol |
1231 | cmp edx,ted_tex_end |
1231 | cmp edx,ted_tex_end |
1232 | jge @f ;out of memory |
1232 | jge @f ;out of memory |
1233 | or ebx,ebx |
1233 | or ebx,ebx |
1234 | jnz .beg_cycle |
1234 | jnz .beg_cycle |
1235 | mov ted_ptr_free_symb,edx ;¬¥ï¥¬ 㪠§ ⥫ì ᢮¡®¤ë© ᨬ¢®«, ¤«ï ¡®«¥¥ ¡ëáâண® ¯®¨áª ¯ ¬ï⨠|
1235 | mov ted_ptr_free_symb,edx ;¬¥ï¥¬ 㪠§ ⥫ì ᢮¡®¤ë© ᨬ¢®«, ¤«ï ¡®«¥¥ ¡ëáâண® ¯®¨áª ¯ ¬ï⨠|
1236 | jmp .add_all |
1236 | jmp .add_all |
1237 | @@: |
1237 | @@: |
1238 | cmp ted_increase_size,0 |
1238 | cmp ted_increase_size,0 |
1239 | je .add_all |
1239 | je .add_all |
1240 | call ted_memory_increase |
1240 | call ted_memory_increase |
1241 | or ebx,ebx |
1241 | or ebx,ebx |
1242 | jnz .beg_cycle |
1242 | jnz .beg_cycle |
1243 | .add_all: ;¢á¥ ᨬ¢®«ë ¤®¡ ¢«¥ë |
1243 | .add_all: ;¢á¥ ᨬ¢®«ë ¤®¡ ¢«¥ë |
1244 | 1244 | ||
1245 | call ted_text_colored |
1245 | call ted_text_colored |
1246 | .no_add: |
1246 | .no_add: |
1247 | popad |
1247 | popad |
1248 | ret |
1248 | ret |
1249 | endp |
1249 | endp |
1250 | 1250 | ||
1251 | ;input: |
1251 | ;input: |
1252 | ; edx = pointer to sumbol, when insert |
1252 | ; edx = pointer to sumbol, when insert |
1253 | ; edi = pointer to tedit struct |
1253 | ; edi = pointer to tedit struct |
1254 | ;output: |
1254 | ;output: |
1255 | ; edx = new pointer to sumbol, when insert |
1255 | ; edx = new pointer to sumbol, when insert |
1256 | align 16 |
1256 | align 16 |
1257 | proc ted_memory_increase |
1257 | proc ted_memory_increase |
1258 | cmp ted_increase_size,0 |
1258 | cmp ted_increase_size,0 |
1259 | je @f |
1259 | je @f |
1260 | push eax ebx ecx |
1260 | push eax ebx ecx |
1261 | mov ecx,ted_increase_size |
1261 | mov ecx,ted_increase_size |
1262 | add ecx,ted_max_chars |
1262 | add ecx,ted_max_chars |
1263 | mov ted_max_chars,ecx |
1263 | mov ted_max_chars,ecx |
1264 | imul ecx,sizeof.symbol |
1264 | imul ecx,sizeof.symbol |
1265 | invoke mem.realloc, ted_tex,ecx |
1265 | invoke mem.realloc, ted_tex,ecx |
1266 | mov ebx,ted_tex |
1266 | mov ebx,ted_tex |
1267 | mov ted_tex,eax |
1267 | mov ted_tex,eax |
1268 | mov ted_tex_1,eax |
1268 | mov ted_tex_1,eax |
1269 | add ted_tex_1,sizeof.symbol |
1269 | add ted_tex_1,sizeof.symbol |
1270 | sub edx,ebx |
1270 | sub edx,ebx |
1271 | add edx,eax |
1271 | add edx,eax |
1272 | mov ted_ptr_free_symb,edx |
1272 | mov ted_ptr_free_symb,edx |
1273 | add eax,ecx |
1273 | add eax,ecx |
1274 | mov ted_tex_end,eax |
1274 | mov ted_tex_end,eax |
1275 | pop ecx ebx eax |
1275 | pop ecx ebx eax |
1276 | @@: |
1276 | @@: |
1277 | ret |
1277 | ret |
1278 | endp |
1278 | endp |
1279 | 1279 | ||
1280 | ;input: |
1280 | ;input: |
1281 | ; ecx = position to free insert cell |
1281 | ; ecx = position to free insert cell |
1282 | ; edx = pointer to sumbol, when insert |
1282 | ; edx = pointer to sumbol, when insert |
1283 | ; esi = added symbol |
1283 | ; esi = added symbol |
1284 | ; edi = pointer to tedit struct |
1284 | ; edi = pointer to tedit struct |
1285 | ;output: |
1285 | ;output: |
1286 | ; ecx = position to inserted cell |
1286 | ; ecx = position to inserted cell |
1287 | align 16 |
1287 | align 16 |
1288 | ted_char_add: |
1288 | ted_char_add: |
1289 | .loop_b: |
1289 | .loop_b: |
1290 | cmp ecx,ted_tex_end |
1290 | cmp ecx,ted_tex_end |
1291 | jge .end_f |
1291 | jge .end_f |
1292 | cmp dword[ecx+symbol.tc],0 |
1292 | cmp dword[ecx+symbol.tc],0 |
1293 | jne @f |
1293 | jne @f |
1294 | cmp dword[ecx+symbol.td],0 |
1294 | cmp dword[ecx+symbol.td],0 |
1295 | je .loop_e |
1295 | je .loop_e |
1296 | @@: |
1296 | @@: |
1297 | add ecx,sizeof.symbol |
1297 | add ecx,sizeof.symbol |
1298 | jmp .loop_b |
1298 | jmp .loop_b |
1299 | align 4 |
1299 | align 4 |
1300 | .loop_e: |
1300 | .loop_e: |
1301 | 1301 | ||
1302 | push eax ebx |
1302 | push eax ebx |
1303 | mov eax,ted_tim_ch |
1303 | mov eax,ted_tim_ch |
1304 | mov [ecx+symbol.tc],eax |
1304 | mov [ecx+symbol.tc],eax |
1305 | mov ax,si |
1305 | mov ax,si |
1306 | mov byte[ecx],al |
1306 | mov byte[ecx],al |
1307 | 1307 | ||
1308 | call ted_get_text_arr_index ; *** eax=pos *** |
1308 | call ted_get_text_arr_index ; *** eax=pos *** |
1309 | mov [ecx+symbol.perv],eax ;tex[i].perv=pos; |
1309 | mov [ecx+symbol.perv],eax ;tex[i].perv=pos; |
1310 | m2m dword[ecx+symbol.next],dword[edx+symbol.next] ;tex[i].next=tex[pos].next; |
1310 | m2m dword[ecx+symbol.next],dword[edx+symbol.next] ;tex[i].next=tex[pos].next; |
1311 | 1311 | ||
1312 | push edx |
1312 | push edx |
1313 | mov edx,ecx |
1313 | mov edx,ecx |
1314 | call ted_get_text_arr_index ; *** eax=i *** |
1314 | call ted_get_text_arr_index ; *** eax=i *** |
1315 | pop edx |
1315 | pop edx |
1316 | 1316 | ||
1317 | mov [edx+symbol.next],eax ;tex[pos].next=i; // áá뫪¨ ¯¥à¥ ¯à ¢«ï¥¬ |
1317 | mov [edx+symbol.next],eax ;tex[pos].next=i; // áá뫪¨ ¯¥à¥ ¯à ¢«ï¥¬ |
1318 | mov ebx,[ecx+symbol.next] |
1318 | mov ebx,[ecx+symbol.next] |
1319 | ConvertIndexToPointer ebx |
1319 | ConvertIndexToPointer ebx |
1320 | mov [ebx+symbol.perv],eax ;tex[tex[i].next].perv=i; // ... |
1320 | mov [ebx+symbol.perv],eax ;tex[tex[i].next].perv=i; // ... |
1321 | pop ebx eax |
1321 | pop ebx eax |
1322 | 1322 | ||
1323 | .end_f: |
1323 | .end_f: |
1324 | call ted_text_colored |
1324 | call ted_text_colored |
1325 | ret |
1325 | ret |
1326 | 1326 | ||
1327 | ;description: |
1327 | ;description: |
1328 | ; äãªæ¨ï ¤«ï á¬¥ë ª®¤¨à®¢®ª |
1328 | ; äãªæ¨ï ¤«ï á¬¥ë ª®¤¨à®¢®ª |
1329 | ;input: |
1329 | ;input: |
1330 | ; table - â ¡«¨æ ¤«ï ¯¥à¥ª®¤¨à®¢ª¨ |
1330 | ; table - â ¡«¨æ ¤«ï ¯¥à¥ª®¤¨à®¢ª¨ |
1331 | align 16 |
1331 | align 16 |
1332 | proc ted_but_convert_by_table uses eax edx edi esi, edit:dword, table:dword |
1332 | proc ted_but_convert_by_table uses eax edx edi esi, edit:dword, table:dword |
1333 | mov edi,[edit] |
1333 | mov edi,[edit] |
1334 | mov esi,[table] |
1334 | mov esi,[table] |
1335 | mov edx,ted_tex |
1335 | mov edx,ted_tex |
1336 | .cycle: |
1336 | .cycle: |
1337 | ;¯¥à¥å®¤¨¬ á«¥¤ãî騩 ᨬ¢®« |
1337 | ;¯¥à¥å®¤¨¬ á«¥¤ãî騩 ᨬ¢®« |
1338 | mov edx,[edx+symbol.next] |
1338 | mov edx,[edx+symbol.next] |
1339 | cmp edx,1 |
1339 | cmp edx,1 |
1340 | jle .end_text |
1340 | jle .end_text |
1341 | imul edx,sizeof.symbol |
1341 | imul edx,sizeof.symbol |
1342 | add edx,ted_tex |
1342 | add edx,ted_tex |
1343 | 1343 | ||
1344 | movzx eax,byte[edx] |
1344 | movzx eax,byte[edx] |
1345 | add eax,esi |
1345 | add eax,esi |
1346 | mov al,byte[eax] |
1346 | mov al,byte[eax] |
1347 | cmp al,0 |
1347 | cmp al,0 |
1348 | je @f |
1348 | je @f |
1349 | mov byte[edx],al ;¬¥ï¥¬ ª®¤¨à®¢ªã ᨬ¢®« |
1349 | mov byte[edx],al ;¬¥ï¥¬ ª®¤¨à®¢ªã ᨬ¢®« |
1350 | @@: |
1350 | @@: |
1351 | jmp .cycle |
1351 | jmp .cycle |
1352 | .end_text: |
1352 | .end_text: |
1353 | ;cmp esi,0 |
1353 | ;cmp esi,0 |
1354 | ;je @f |
1354 | ;je @f |
1355 | stdcall ted_draw,edi ;®¡®¢«ï¥¬ ®ª® |
1355 | stdcall ted_draw,edi ;®¡®¢«ï¥¬ ®ª® |
1356 | ;@@: |
1356 | ;@@: |
1357 | ret |
1357 | ret |
1358 | endp |
1358 | endp |
1359 | 1359 | ||
1360 | ;input: |
1360 | ;input: |
1361 | ; edi = pointer to tedit struct |
1361 | ; edi = pointer to tedit struct |
1362 | ;output: |
1362 | ;output: |
1363 | ; esi = count converted symbols |
1363 | ; esi = count converted symbols |
1364 | ;description: |
1364 | ;description: |
1365 | ; ãªæ¨ï ¨á¯®«ì§ã¥âáï ¤«ï ᬥë ॣ¨áâà ¢ë¡à ëå ᨬ¢®«®¢ |
1365 | ; ãªæ¨ï ¨á¯®«ì§ã¥âáï ¤«ï ᬥë ॣ¨áâà ¢ë¡à ëå ᨬ¢®«®¢ |
1366 | align 16 |
1366 | align 16 |
1367 | proc ted_convert_sel_text, conv_fun:dword |
1367 | proc ted_convert_sel_text, conv_fun:dword |
1368 | locals |
1368 | locals |
1369 | conv_cou dd ? |
1369 | conv_cou dd ? |
1370 | endl |
1370 | endl |
1371 | mov dword[conv_cou],0 |
1371 | mov dword[conv_cou],0 |
1372 | pushad |
1372 | pushad |
1373 | 1373 | ||
1374 | call ted_is_select |
1374 | call ted_is_select |
1375 | or al,al |
1375 | or al,al |
1376 | jz .end_f |
1376 | jz .end_f |
1377 | call ted_set_undo |
1377 | call ted_set_undo |
1378 | call ted_sel_normalize |
1378 | call ted_sel_normalize |
1379 | 1379 | ||
1380 | mov esi,ted_seln_x0 |
1380 | mov esi,ted_seln_x0 |
1381 | mov ecx,ted_seln_y0 |
1381 | mov ecx,ted_seln_y0 |
1382 | call ted_get_pos_by_coords |
1382 | call ted_get_pos_by_coords |
1383 | mov eax,edx |
1383 | mov eax,edx |
1384 | mov esi,ted_seln_x1 |
1384 | mov esi,ted_seln_x1 |
1385 | mov ecx,ted_seln_y1 |
1385 | mov ecx,ted_seln_y1 |
1386 | call ted_get_pos_by_coords |
1386 | call ted_get_pos_by_coords |
1387 | ;call ted_get_text_perv_pos |
1387 | ;call ted_get_text_perv_pos |
1388 | mov ebx,edx |
1388 | mov ebx,edx |
1389 | 1389 | ||
1390 | cmp eax,ebx |
1390 | cmp eax,ebx |
1391 | je .end_f |
1391 | je .end_f |
1392 | 1392 | ||
1393 | inc ted_tim_ch |
1393 | inc ted_tim_ch |
1394 | mov edx,eax ;i=p0; |
1394 | mov edx,eax ;i=p0; |
1395 | mov ecx,ted_ptr_free_symb |
1395 | mov ecx,ted_ptr_free_symb |
1396 | @@: |
1396 | @@: |
1397 | push eax |
1397 | push eax |
1398 | mov al,byte[edx] |
1398 | mov al,byte[edx] |
1399 | call dword[conv_fun] ;¯à¥®¡à §®¢ ¨¥ ᨬ¢®« |
1399 | call dword[conv_fun] ;¯à¥®¡à §®¢ ¨¥ ᨬ¢®« |
1400 | mov esi,eax |
1400 | mov esi,eax |
1401 | cmp byte[edx],al |
1401 | cmp byte[edx],al |
1402 | pop eax |
1402 | pop eax |
1403 | je .no_change |
1403 | je .no_change |
1404 | m2m dword[edx+symbol.td],ted_tim_ch |
1404 | m2m dword[edx+symbol.td],ted_tim_ch |
1405 | call ted_char_add ;b_pos=ted_char_add(tex[i].c^32,i,false,b_pos); |
1405 | call ted_char_add ;b_pos=ted_char_add(tex[i].c^32,i,false,b_pos); |
1406 | call ted_get_text_next_pos ;go to added symbol |
1406 | call ted_get_text_next_pos ;go to added symbol |
1407 | inc dword[conv_cou] |
1407 | inc dword[conv_cou] |
1408 | .no_change: |
1408 | .no_change: |
1409 | 1409 | ||
1410 | call ted_iterat_next |
1410 | call ted_iterat_next |
1411 | cmp edx,ted_tex |
1411 | cmp edx,ted_tex |
1412 | je @f |
1412 | je @f |
1413 | cmp edx,ebx |
1413 | cmp edx,ebx |
1414 | jne @b |
1414 | jne @b |
1415 | @@: |
1415 | @@: |
1416 | cmp dword[conv_cou],0 |
1416 | cmp dword[conv_cou],0 |
1417 | jne @f |
1417 | jne @f |
1418 | dec ted_tim_ch |
1418 | dec ted_tim_ch |
1419 | @@: |
1419 | @@: |
1420 | .end_f: |
1420 | .end_f: |
1421 | popad |
1421 | popad |
1422 | mov esi,[conv_cou] |
1422 | mov esi,[conv_cou] |
1423 | ret |
1423 | ret |
1424 | endp |
1424 | endp |
1425 | 1425 | ||
1426 | ;output: |
1426 | ;output: |
1427 | ; bl = 0 - no delete |
1427 | ; bl = 0 - no delete |
1428 | ; bl = 1 - delete |
1428 | ; bl = 1 - delete |
1429 | align 16 |
1429 | align 16 |
1430 | proc ted_text_del uses ecx edx edi, edit:dword, del_opt:dword |
1430 | proc ted_text_del uses ecx edx edi, edit:dword, del_opt:dword |
1431 | mov edi,[edit] |
1431 | mov edi,[edit] |
1432 | mov ebx,[del_opt] |
1432 | mov ebx,[del_opt] |
1433 | 1433 | ||
1434 | xor cl,cl |
1434 | xor cl,cl |
1435 | test ebx,ted_opt_ed_move_cursor |
1435 | test ebx,ted_opt_ed_move_cursor |
1436 | jz @f |
1436 | jz @f |
1437 | call ted_cur_move_left |
1437 | call ted_cur_move_left |
1438 | cmp dl,0 |
1438 | cmp dl,0 |
1439 | je .no_del |
1439 | je .no_del |
1440 | @@: |
1440 | @@: |
1441 | call ted_get_pos_by_cursor |
1441 | call ted_get_pos_by_cursor |
1442 | cmp ted_gp_opt,1 |
1442 | cmp ted_gp_opt,1 |
1443 | je .no_del |
1443 | je .no_del |
1444 | test ebx,ted_opt_ed_change_time |
1444 | test ebx,ted_opt_ed_change_time |
1445 | jz @f |
1445 | jz @f |
1446 | inc ted_tim_ch |
1446 | inc ted_tim_ch |
1447 | @@: |
1447 | @@: |
1448 | m2m dword[edx+symbol.td], ted_tim_ch |
1448 | m2m dword[edx+symbol.td], ted_tim_ch |
1449 | mov cl,1 |
1449 | mov cl,1 |
1450 | .no_del: |
1450 | .no_del: |
1451 | mov bl,cl |
1451 | mov bl,cl |
1452 | ret |
1452 | ret |
1453 | endp |
1453 | endp |
1454 | 1454 | ||
1455 | ;input: |
1455 | ;input: |
1456 | ; edi = pointer to tedit struct |
1456 | ; edi = pointer to tedit struct |
1457 | ;output: |
1457 | ;output: |
1458 | ; al = 1 if delete |
1458 | ; al = 1 if delete |
1459 | ;description: |
1459 | ;description: |
1460 | ; ãªæ¨ï 㤠«ï¥â ¢ë¤¥«¥ë© ⥪áâ |
1460 | ; ãªæ¨ï 㤠«ï¥â ¢ë¤¥«¥ë© ⥪áâ |
1461 | align 16 |
1461 | align 16 |
1462 | proc ted_sel_text_del uses ebx ecx edx esi, del_opt:dword |
1462 | proc ted_sel_text_del uses ebx ecx edx esi, del_opt:dword |
1463 | call ted_is_select |
1463 | call ted_is_select |
1464 | or al,al |
1464 | or al,al |
1465 | jz .end_f |
1465 | jz .end_f |
1466 | call ted_sel_normalize |
1466 | call ted_sel_normalize |
1467 | 1467 | ||
1468 | mov esi,ted_seln_x1 |
1468 | mov esi,ted_seln_x1 |
1469 | mov ecx,ted_seln_y1 |
1469 | mov ecx,ted_seln_y1 |
1470 | call ted_get_pos_by_coords |
1470 | call ted_get_pos_by_coords |
1471 | mov ebx,edx |
1471 | mov ebx,edx |
1472 | 1472 | ||
1473 | mov esi,ted_seln_x0 |
1473 | mov esi,ted_seln_x0 |
1474 | mov ecx,ted_seln_y0 |
1474 | mov ecx,ted_seln_y0 |
1475 | call ted_get_pos_by_coords |
1475 | call ted_get_pos_by_coords |
1476 | 1476 | ||
1477 | test dword[del_opt],ted_opt_ed_change_time |
1477 | test dword[del_opt],ted_opt_ed_change_time |
1478 | jz @f |
1478 | jz @f |
1479 | inc ted_tim_ch |
1479 | inc ted_tim_ch |
1480 | @@: |
1480 | @@: |
1481 | cmp edx,ted_tex |
1481 | cmp edx,ted_tex |
1482 | je @f |
1482 | je @f |
1483 | cmp edx,ebx ;if(i==te)break; |
1483 | cmp edx,ebx ;if(i==te)break; |
1484 | je @f |
1484 | je @f |
1485 | m2m dword[edx+symbol.td],ted_tim_ch |
1485 | m2m dword[edx+symbol.td],ted_tim_ch |
1486 | mov esi,ted_opt_ed_change_time |
1486 | mov esi,ted_opt_ed_change_time |
1487 | not esi |
1487 | not esi |
1488 | and dword[del_opt],esi ;n_tim=false; |
1488 | and dword[del_opt],esi ;n_tim=false; |
1489 | call ted_iterat_next |
1489 | call ted_iterat_next |
1490 | jmp @b |
1490 | jmp @b |
1491 | align 4 |
1491 | align 4 |
1492 | @@: |
1492 | @@: |
1493 | test dword[del_opt],ted_opt_ed_change_time |
1493 | test dword[del_opt],ted_opt_ed_change_time |
1494 | jz @f |
1494 | jz @f |
1495 | dec ted_tim_ch |
1495 | dec ted_tim_ch |
1496 | xor al,al |
1496 | xor al,al |
1497 | @@: |
1497 | @@: |
1498 | test dword[del_opt],ted_opt_ed_change_time |
1498 | test dword[del_opt],ted_opt_ed_change_time |
1499 | jnz @f |
1499 | jnz @f |
1500 | mov ecx,ted_seln_x0 |
1500 | mov ecx,ted_seln_x0 |
1501 | mov edx,ted_seln_y0 |
1501 | mov edx,ted_seln_y0 |
1502 | call ted_go_to_pos |
1502 | call ted_go_to_pos |
1503 | mov ted_sel_x0,0 |
1503 | mov ted_sel_x0,0 |
1504 | mov ted_sel_y0,0 |
1504 | mov ted_sel_y0,0 |
1505 | mov ted_sel_x1,0 |
1505 | mov ted_sel_x1,0 |
1506 | mov ted_sel_y1,0 |
1506 | mov ted_sel_y1,0 |
1507 | @@: |
1507 | @@: |
1508 | .end_f: |
1508 | .end_f: |
1509 | ret |
1509 | ret |
1510 | endp |
1510 | endp |
1511 | 1511 | ||
1512 | 1512 | ||
1513 | ;input: |
1513 | ;input: |
1514 | ; eax = pointer to begin select |
1514 | ; eax = pointer to begin select |
1515 | ; ebx = pointer to end select |
1515 | ; ebx = pointer to end select |
1516 | ; edi = pointer to tedit struct |
1516 | ; edi = pointer to tedit struct |
1517 | align 16 |
1517 | align 16 |
1518 | ted_revers: |
1518 | ted_revers: |
1519 | cmp eax,ebx |
1519 | cmp eax,ebx |
1520 | jne @f |
1520 | jne @f |
1521 | ret |
1521 | ret |
1522 | @@: |
1522 | @@: |
1523 | 1523 | ||
1524 | push ecx edx |
1524 | push ecx edx |
1525 | 1525 | ||
1526 | mov edx,ted_tex_1 |
1526 | mov edx,ted_tex_1 |
1527 | cmp edx,ebx ;if(p1==1)p1=tex[1].perv; |
1527 | cmp edx,ebx ;if(p1==1)p1=tex[1].perv; |
1528 | jne @f |
1528 | jne @f |
1529 | call ted_get_text_perv_pos |
1529 | call ted_get_text_perv_pos |
1530 | mov ebx,edx |
1530 | mov ebx,edx |
1531 | @@: |
1531 | @@: |
1532 | 1532 | ||
1533 | push esi |
1533 | push esi |
1534 | mov edx,[eax+symbol.perv] ; *** edx = tex[p0].perv *** |
1534 | mov edx,[eax+symbol.perv] ; *** edx = tex[p0].perv *** |
1535 | ConvertIndexToPointer edx |
1535 | ConvertIndexToPointer edx |
1536 | add edx,symbol.next |
1536 | add edx,symbol.next |
1537 | mov ecx,[edx] ;ecx = tex[tex[p0].perv].next |
1537 | mov ecx,[edx] ;ecx = tex[tex[p0].perv].next |
1538 | 1538 | ||
1539 | mov esi,[ebx+symbol.next] ; *** esi = tex[p1].next *** |
1539 | mov esi,[ebx+symbol.next] ; *** esi = tex[p1].next *** |
1540 | ConvertIndexToPointer esi |
1540 | ConvertIndexToPointer esi |
1541 | add esi,symbol.perv |
1541 | add esi,symbol.perv |
1542 | m2m dword[edx],dword[esi] ;tex[tex[p0].perv].next = tex[tex[p1].next].perv |
1542 | m2m dword[edx],dword[esi] ;tex[tex[p0].perv].next = tex[tex[p1].next].perv |
1543 | 1543 | ||
1544 | mov [esi],ecx ;tex[tex[p1].next].perv = ecx |
1544 | mov [esi],ecx ;tex[tex[p1].next].perv = ecx |
1545 | pop esi |
1545 | pop esi |
1546 | 1546 | ||
1547 | mov ecx,[eax+symbol.perv] ;ecx = tex[p0].perv |
1547 | mov ecx,[eax+symbol.perv] ;ecx = tex[p0].perv |
1548 | m2m dword[eax+symbol.perv],dword[ebx+symbol.next] ;tex[p0].perv = tex[p1].next |
1548 | m2m dword[eax+symbol.perv],dword[ebx+symbol.next] ;tex[p0].perv = tex[p1].next |
1549 | mov [ebx+symbol.next],ecx ;tex[p1].next = ecx |
1549 | mov [ebx+symbol.next],ecx ;tex[p1].next = ecx |
1550 | 1550 | ||
1551 | mov edx,eax ;i=p0; |
1551 | mov edx,eax ;i=p0; |
1552 | @@: |
1552 | @@: |
1553 | mov ecx,[edx+symbol.next] ;ecx = tex[i].next |
1553 | mov ecx,[edx+symbol.next] ;ecx = tex[i].next |
1554 | m2m dword[edx+symbol.next],dword[edx+symbol.perv] ;tex[i].next = tex[i].perv |
1554 | m2m dword[edx+symbol.next],dword[edx+symbol.perv] ;tex[i].next = tex[i].perv |
1555 | mov [edx+symbol.perv],ecx ;tex[i].perv = ecx |
1555 | mov [edx+symbol.perv],ecx ;tex[i].perv = ecx |
1556 | cmp edx,ebx ;if(i==p1)break; |
1556 | cmp edx,ebx ;if(i==p1)break; |
1557 | je @f |
1557 | je @f |
1558 | ; --- |
1558 | ; --- |
1559 | ;cmp edx,ted_tex |
1559 | ;cmp edx,ted_tex |
1560 | ;je @f |
1560 | ;je @f |
1561 | ; --- |
1561 | ; --- |
1562 | mov edx,ecx ;i = ecx |
1562 | mov edx,ecx ;i = ecx |
1563 | ConvertIndexToPointer edx |
1563 | ConvertIndexToPointer edx |
1564 | jmp @b |
1564 | jmp @b |
1565 | @@: |
1565 | @@: |
1566 | pop edx ecx |
1566 | pop edx ecx |
1567 | call ted_text_colored |
1567 | call ted_text_colored |
1568 | ret |
1568 | ret |
1569 | 1569 | ||
1570 | 1570 | ||
1571 | ;input: |
1571 | ;input: |
1572 | ; edi = pointer to tedit struct |
1572 | ; edi = pointer to tedit struct |
1573 | ;output: |
1573 | ;output: |
1574 | ; dl = 0 not move |
1574 | ; dl = 0 not move |
1575 | ; dl = 2 if move up |
1575 | ; dl = 2 if move up |
1576 | ; dl = 8 if scroll move up |
1576 | ; dl = 8 if scroll move up |
1577 | align 16 |
1577 | align 16 |
1578 | ted_cur_move_up: |
1578 | ted_cur_move_up: |
1579 | cmp ted_cur_y,0 |
1579 | cmp ted_cur_y,0 |
1580 | je @f |
1580 | je @f |
1581 | dec ted_cur_y |
1581 | dec ted_cur_y |
1582 | mov dl,2 |
1582 | mov dl,2 |
1583 | ret |
1583 | ret |
1584 | @@: |
1584 | @@: |
1585 | push eax |
1585 | push eax |
1586 | mov eax,ted_scr_w |
1586 | mov eax,ted_scr_w |
1587 | cmp dword[eax+sb_offs_position],0 |
1587 | cmp dword[eax+sb_offs_position],0 |
1588 | je @f |
1588 | je @f |
1589 | dec dword[eax+sb_offs_position] |
1589 | dec dword[eax+sb_offs_position] |
1590 | mov dl,8 |
1590 | mov dl,8 |
1591 | jmp .ret_f |
1591 | jmp .ret_f |
1592 | @@: |
1592 | @@: |
1593 | mov dl,0 |
1593 | mov dl,0 |
1594 | .ret_f: |
1594 | .ret_f: |
1595 | pop eax |
1595 | pop eax |
1596 | ret |
1596 | ret |
1597 | 1597 | ||
1598 | ;input: |
1598 | ;input: |
1599 | ; edi = pointer to tedit struct |
1599 | ; edi = pointer to tedit struct |
1600 | ;output: |
1600 | ;output: |
1601 | ; dl = 0 not move |
1601 | ; dl = 0 not move |
1602 | ; dl = 2 if move down |
1602 | ; dl = 2 if move down |
1603 | ; dl = 8 if scroll move down |
1603 | ; dl = 8 if scroll move down |
1604 | align 16 |
1604 | align 16 |
1605 | ted_cur_move_down: |
1605 | ted_cur_move_down: |
1606 | push eax ebx |
1606 | push eax ebx |
1607 | mov ebx,ted_scr_w |
1607 | mov ebx,ted_scr_w |
1608 | xor dl,dl |
1608 | xor dl,dl |
1609 | mov eax,[ebx+sb_offs_cur_area] |
1609 | mov eax,[ebx+sb_offs_cur_area] |
1610 | dec eax |
1610 | dec eax |
1611 | cmp ted_cur_y,eax |
1611 | cmp ted_cur_y,eax |
1612 | jge @f |
1612 | jge @f |
1613 | inc ted_cur_y |
1613 | inc ted_cur_y |
1614 | mov dl,2 |
1614 | mov dl,2 |
1615 | jmp .ret_f |
1615 | jmp .ret_f |
1616 | @@: |
1616 | @@: |
1617 | mov eax,ted_cur_y |
1617 | mov eax,ted_cur_y |
1618 | add eax,[ebx+sb_offs_position] |
1618 | add eax,[ebx+sb_offs_position] |
1619 | inc eax |
1619 | inc eax |
1620 | cmp [ebx+sb_offs_max_area],eax |
1620 | cmp [ebx+sb_offs_max_area],eax |
1621 | jle @f |
1621 | jle @f |
1622 | inc dword[ebx+sb_offs_position] |
1622 | inc dword[ebx+sb_offs_position] |
1623 | mov dl,8 |
1623 | mov dl,8 |
1624 | @@: |
1624 | @@: |
1625 | .ret_f: |
1625 | .ret_f: |
1626 | pop ebx eax |
1626 | pop ebx eax |
1627 | ret |
1627 | ret |
1628 | 1628 | ||
1629 | 1629 | ||
1630 | ;input: |
1630 | ;input: |
1631 | ; edi = pointer to tedit struct |
1631 | ; edi = pointer to tedit struct |
1632 | ;output: |
1632 | ;output: |
1633 | ; dl = 0 not move |
1633 | ; dl = 0 not move |
1634 | ; dl = 1 if move up |
1634 | ; dl = 1 if move up |
1635 | align 16 |
1635 | align 16 |
1636 | ted_cur_move_page_up: |
1636 | ted_cur_move_page_up: |
1637 | push eax ebx |
1637 | push eax ebx |
1638 | mov ebx,ted_scr_w |
1638 | mov ebx,ted_scr_w |
1639 | mov eax,[ebx+sb_offs_cur_area] |
1639 | mov eax,[ebx+sb_offs_cur_area] |
1640 | xor dl,dl |
1640 | xor dl,dl |
1641 | cmp eax,[ebx+sb_offs_position] |
1641 | cmp eax,[ebx+sb_offs_position] |
1642 | jg @f |
1642 | jg @f |
1643 | sub [ebx+sb_offs_position],eax |
1643 | sub [ebx+sb_offs_position],eax |
1644 | mov dl,1 |
1644 | mov dl,1 |
1645 | @@: |
1645 | @@: |
1646 | cmp dword[ebx+sb_offs_position],0 |
1646 | cmp dword[ebx+sb_offs_position],0 |
1647 | je @f |
1647 | je @f |
1648 | cmp dl,1 |
1648 | cmp dl,1 |
1649 | je @f |
1649 | je @f |
1650 | mov dword[ebx+sb_offs_position],0 |
1650 | mov dword[ebx+sb_offs_position],0 |
1651 | mov dl,1 |
1651 | mov dl,1 |
1652 | @@: |
1652 | @@: |
1653 | pop ebx eax |
1653 | pop ebx eax |
1654 | ret |
1654 | ret |
1655 | 1655 | ||
1656 | ;input: |
1656 | ;input: |
1657 | ; edi = pointer to tedit struct |
1657 | ; edi = pointer to tedit struct |
1658 | align 16 |
1658 | align 16 |
1659 | ted_cur_move_page_down: |
1659 | ted_cur_move_page_down: |
1660 | push eax ebx ecx |
1660 | push eax ebx ecx |
1661 | mov ecx,ted_scr_w |
1661 | mov ecx,ted_scr_w |
1662 | 1662 | ||
1663 | xor dl,dl |
1663 | xor dl,dl |
1664 | mov eax,[ecx+sb_offs_max_area] |
1664 | mov eax,[ecx+sb_offs_max_area] |
1665 | sub eax,[ecx+sb_offs_cur_area] |
1665 | sub eax,[ecx+sb_offs_cur_area] |
1666 | cmp [ecx+sb_offs_position],eax |
1666 | cmp [ecx+sb_offs_position],eax |
1667 | jge @f |
1667 | jge @f |
1668 | mov ebx,[ecx+sb_offs_cur_area] |
1668 | mov ebx,[ecx+sb_offs_cur_area] |
1669 | add [ecx+sb_offs_position],ebx |
1669 | add [ecx+sb_offs_position],ebx |
1670 | mov dl,1 |
1670 | mov dl,1 |
1671 | mov dword[ecx+sb_offs_redraw],1 |
1671 | mov dword[ecx+sb_offs_redraw],1 |
1672 | cmp [ecx+sb_offs_position],eax |
1672 | cmp [ecx+sb_offs_position],eax |
1673 | jle @f |
1673 | jle @f |
1674 | mov [ecx+sb_offs_position],eax |
1674 | mov [ecx+sb_offs_position],eax |
1675 | @@: |
1675 | @@: |
1676 | pop ecx ebx eax |
1676 | pop ecx ebx eax |
1677 | ret |
1677 | ret |
1678 | 1678 | ||
1679 | ;input: |
1679 | ;input: |
1680 | ; edi = pointer to tedit struct |
1680 | ; edi = pointer to tedit struct |
1681 | ;output: |
1681 | ;output: |
1682 | ; dl = 0 not move |
1682 | ; dl = 0 not move |
1683 | ; dl = 1 if move left |
1683 | ; dl = 1 if move left |
1684 | ; dl = 3 if move left and up |
1684 | ; dl = 3 if move left and up |
1685 | ; dl = 8 if scroll move up |
1685 | ; dl = 8 if scroll move up |
1686 | align 16 |
1686 | align 16 |
1687 | ted_cur_move_left: |
1687 | ted_cur_move_left: |
1688 | cmp ted_cur_x,0 |
1688 | cmp ted_cur_x,0 |
1689 | je @f |
1689 | je @f |
1690 | dec ted_cur_x |
1690 | dec ted_cur_x |
1691 | mov dl,1 |
1691 | mov dl,1 |
1692 | ret |
1692 | ret |
1693 | @@: |
1693 | @@: |
1694 | push eax |
1694 | push eax |
1695 | mov eax,ted_scr_h |
1695 | mov eax,ted_scr_h |
1696 | cmp dword[eax+sb_offs_position],0 |
1696 | cmp dword[eax+sb_offs_position],0 |
1697 | je @f |
1697 | je @f |
1698 | dec dword[eax+sb_offs_position] |
1698 | dec dword[eax+sb_offs_position] |
1699 | mov dl,8 |
1699 | mov dl,8 |
1700 | jmp .ret_f |
1700 | jmp .ret_f |
1701 | @@: |
1701 | @@: |
1702 | cmp ted_cur_y,0 |
1702 | cmp ted_cur_y,0 |
1703 | jne @f |
1703 | jne @f |
1704 | mov eax,ted_scr_w |
1704 | mov eax,ted_scr_w |
1705 | mov dl,0 |
1705 | mov dl,0 |
1706 | cmp dword[eax+sb_offs_position],0 |
1706 | cmp dword[eax+sb_offs_position],0 |
1707 | je .ret_f |
1707 | je .ret_f |
1708 | dec dword[eax+sb_offs_position] |
1708 | dec dword[eax+sb_offs_position] |
1709 | call ted_scroll_set_redraw |
1709 | call ted_scroll_set_redraw |
1710 | call ted_cur_move_x_last_char |
1710 | call ted_cur_move_x_last_char |
1711 | mov dl,8 |
1711 | mov dl,8 |
1712 | jmp .ret_f |
1712 | jmp .ret_f |
1713 | @@: |
1713 | @@: |
1714 | cmp ted_cur_y,0 |
1714 | cmp ted_cur_y,0 |
1715 | je @f |
1715 | je @f |
1716 | dec ted_cur_y |
1716 | dec ted_cur_y |
1717 | call ted_cur_move_x_last_char |
1717 | call ted_cur_move_x_last_char |
1718 | cmp dl,8 |
1718 | cmp dl,8 |
1719 | je .ret_f |
1719 | je .ret_f |
1720 | mov dl,3 |
1720 | mov dl,3 |
1721 | jmp .ret_f |
1721 | jmp .ret_f |
1722 | @@: |
1722 | @@: |
1723 | mov dl,0 |
1723 | mov dl,0 |
1724 | .ret_f: |
1724 | .ret_f: |
1725 | pop eax |
1725 | pop eax |
1726 | ret |
1726 | ret |
1727 | 1727 | ||
1728 | ;input: |
1728 | ;input: |
1729 | ; edi = pointer to tedit struct |
1729 | ; edi = pointer to tedit struct |
1730 | align 16 |
1730 | align 16 |
1731 | ted_cur_move_right: |
1731 | ted_cur_move_right: |
1732 | push eax ebx |
1732 | push eax ebx |
1733 | mov eax,ted_scr_h |
1733 | mov eax,ted_scr_h |
1734 | xor dl,dl |
1734 | xor dl,dl |
1735 | mov ebx,[eax+sb_offs_cur_area] |
1735 | mov ebx,[eax+sb_offs_cur_area] |
1736 | cmp ted_cur_x,ebx |
1736 | cmp ted_cur_x,ebx |
1737 | jge @f |
1737 | jge @f |
1738 | inc ted_cur_x |
1738 | inc ted_cur_x |
1739 | mov dl,1 |
1739 | mov dl,1 |
1740 | jmp .ret_f |
1740 | jmp .ret_f |
1741 | @@: |
1741 | @@: |
1742 | inc dword[eax+sb_offs_position] |
1742 | inc dword[eax+sb_offs_position] |
1743 | mov dl,8 |
1743 | mov dl,8 |
1744 | .ret_f: |
1744 | .ret_f: |
1745 | pop ebx eax |
1745 | pop ebx eax |
1746 | ret |
1746 | ret |
1747 | 1747 | ||
1748 | ;input: |
1748 | ;input: |
1749 | ; edi = pointer to tedit struct |
1749 | ; edi = pointer to tedit struct |
1750 | align 16 |
1750 | align 16 |
1751 | ted_cur_move_x_last_char: |
1751 | ted_cur_move_x_last_char: |
1752 | ;[hScr.position] |
1752 | ;[hScr.position] |
1753 | ;[hScr.cur_area] |
1753 | ;[hScr.cur_area] |
1754 | ;dl-??? |
1754 | ;dl-??? |
1755 | push eax ebx ecx |
1755 | push eax ebx ecx |
1756 | mov eax,ted_cur_y |
1756 | mov eax,ted_cur_y |
1757 | mov ecx,ted_scr_w |
1757 | mov ecx,ted_scr_w |
1758 | add eax,[ecx+sb_offs_position] |
1758 | add eax,[ecx+sb_offs_position] |
1759 | call ted_strlen |
1759 | call ted_strlen |
1760 | xor dl,dl |
1760 | xor dl,dl |
1761 | 1761 | ||
1762 | mov ecx,ted_scr_h |
1762 | mov ecx,ted_scr_h |
1763 | cmp ebx,[ecx+sb_offs_position] |
1763 | cmp ebx,[ecx+sb_offs_position] |
1764 | jge @f |
1764 | jge @f |
1765 | mov dl,8 |
1765 | mov dl,8 |
1766 | mov [ecx+sb_offs_position],ebx |
1766 | mov [ecx+sb_offs_position],ebx |
1767 | @@: |
1767 | @@: |
1768 | sub ebx,[ecx+sb_offs_position] |
1768 | sub ebx,[ecx+sb_offs_position] |
1769 | 1769 | ||
1770 | cmp ebx,[ecx+sb_offs_cur_area] |
1770 | cmp ebx,[ecx+sb_offs_cur_area] |
1771 | jle @f ; b---[---]---e |
1771 | jle @f ; b---[---]---e |
1772 | add [ecx+sb_offs_position],ebx |
1772 | add [ecx+sb_offs_position],ebx |
1773 | mov ebx,[ecx+sb_offs_cur_area] |
1773 | mov ebx,[ecx+sb_offs_cur_area] |
1774 | sub [ecx+sb_offs_position],ebx |
1774 | sub [ecx+sb_offs_position],ebx |
1775 | mov dl,8 |
1775 | mov dl,8 |
1776 | @@: |
1776 | @@: |
1777 | mov ted_cur_x,ebx |
1777 | mov ted_cur_x,ebx |
1778 | pop ecx ebx eax |
1778 | pop ecx ebx eax |
1779 | ret |
1779 | ret |
1780 | 1780 | ||
1781 | ;input: |
1781 | ;input: |
1782 | ; edi = pointer to tedit struct |
1782 | ; edi = pointer to tedit struct |
1783 | ;output: |
1783 | ;output: |
1784 | ; dl = 0 not move |
1784 | ; dl = 0 not move |
1785 | ; dl = 1 move cursor |
1785 | ; dl = 1 move cursor |
1786 | ; dl = 8 move cursor and scroll |
1786 | ; dl = 8 move cursor and scroll |
1787 | align 16 |
1787 | align 16 |
1788 | ted_cur_move_x_first_char: |
1788 | ted_cur_move_x_first_char: |
1789 | xor dl,dl |
1789 | xor dl,dl |
1790 | cmp ted_cur_x,0 |
1790 | cmp ted_cur_x,0 |
1791 | je @f |
1791 | je @f |
1792 | mov ted_cur_x,0 |
1792 | mov ted_cur_x,0 |
1793 | mov dl,1 |
1793 | mov dl,1 |
1794 | @@: |
1794 | @@: |
1795 | push eax |
1795 | push eax |
1796 | mov eax,ted_scr_h |
1796 | mov eax,ted_scr_h |
1797 | cmp dword[eax+sb_offs_position],0 |
1797 | cmp dword[eax+sb_offs_position],0 |
1798 | je @f |
1798 | je @f |
1799 | mov dword[eax+sb_offs_position],0 |
1799 | mov dword[eax+sb_offs_position],0 |
1800 | mov dl,8 |
1800 | mov dl,8 |
1801 | @@: |
1801 | @@: |
1802 | pop eax |
1802 | pop eax |
1803 | ret |
1803 | ret |
1804 | 1804 | ||
1805 | ;input: |
1805 | ;input: |
1806 | ; edx = pointer to symbol struct |
1806 | ; edx = pointer to symbol struct |
1807 | ; edi = pointer to tedit struct |
1807 | ; edi = pointer to tedit struct |
1808 | ;output: |
1808 | ;output: |
1809 | ; eax = array index |
1809 | ; eax = array index |
1810 | align 16 |
1810 | align 16 |
1811 | ted_get_text_arr_index: |
1811 | ted_get_text_arr_index: |
1812 | push ecx edx |
1812 | push ecx edx |
1813 | mov eax,edx |
1813 | mov eax,edx |
1814 | sub eax,ted_tex |
1814 | sub eax,ted_tex |
1815 | xor edx,edx |
1815 | xor edx,edx |
1816 | mov ecx,sizeof.symbol |
1816 | mov ecx,sizeof.symbol |
1817 | div ecx |
1817 | div ecx |
1818 | pop edx ecx |
1818 | pop edx ecx |
1819 | ret |
1819 | ret |
1820 | 1820 | ||
1821 | ;input: |
1821 | ;input: |
1822 | ; edx = pointer to symbol struct |
1822 | ; edx = pointer to symbol struct |
1823 | ; edi = pointer to tedit struct |
1823 | ; edi = pointer to tedit struct |
1824 | ;output: |
1824 | ;output: |
1825 | ; edx = pointer to 'perv' struct |
1825 | ; edx = pointer to 'perv' struct |
1826 | align 16 |
1826 | align 16 |
1827 | ted_get_text_perv_pos: |
1827 | ted_get_text_perv_pos: |
1828 | mov edx,[edx+symbol.perv] |
1828 | mov edx,[edx+symbol.perv] |
1829 | imul edx,sizeof.symbol |
1829 | imul edx,sizeof.symbol |
1830 | add edx,ted_tex |
1830 | add edx,ted_tex |
1831 | ret |
1831 | ret |
1832 | 1832 | ||
1833 | ;input: |
1833 | ;input: |
1834 | ; edx = pointer to symbol struct |
1834 | ; edx = pointer to symbol struct |
1835 | ;output: |
1835 | ;output: |
1836 | ; edx = pointer to 'next' symbol struct |
1836 | ; edx = pointer to 'next' symbol struct |
1837 | align 16 |
1837 | align 16 |
1838 | ted_get_text_next_pos: |
1838 | ted_get_text_next_pos: |
1839 | mov edx,[edx+symbol.next] |
1839 | mov edx,[edx+symbol.next] |
1840 | imul edx,sizeof.symbol |
1840 | imul edx,sizeof.symbol |
1841 | add edx,ted_tex |
1841 | add edx,ted_tex |
1842 | ret |
1842 | ret |
1843 | 1843 | ||
1844 | ;input: |
1844 | ;input: |
1845 | ; edi = pointer to tedit struct |
1845 | ; edi = pointer to tedit struct |
1846 | ;output: |
1846 | ;output: |
1847 | ; edx = symbol under cursor |
1847 | ; edx = symbol under cursor |
1848 | ; ted_gp_opt = 1,2 |
1848 | ; ted_gp_opt = 1,2 |
1849 | ; edx = tex[1].perv if error |
1849 | ; edx = tex[1].perv if error |
1850 | ; ted_gp_opt = 0 |
1850 | ; ted_gp_opt = 0 |
1851 | align 16 |
1851 | align 16 |
1852 | ted_get_pos_by_cursor: |
1852 | ted_get_pos_by_cursor: |
1853 | push eax ecx esi |
1853 | push eax ecx esi |
1854 | mov esi,ted_cur_x |
1854 | mov esi,ted_cur_x |
1855 | mov eax,ted_scr_h |
1855 | mov eax,ted_scr_h |
1856 | add esi,[eax+sb_offs_position] |
1856 | add esi,[eax+sb_offs_position] |
1857 | mov ecx,ted_cur_y |
1857 | mov ecx,ted_cur_y |
1858 | mov eax,ted_scr_w |
1858 | mov eax,ted_scr_w |
1859 | add ecx,[eax+sb_offs_position] |
1859 | add ecx,[eax+sb_offs_position] |
1860 | call ted_get_pos_by_coords |
1860 | call ted_get_pos_by_coords |
1861 | pop esi ecx eax |
1861 | pop esi ecx eax |
1862 | ret |
1862 | ret |
1863 | 1863 | ||
1864 | ;input: |
1864 | ;input: |
1865 | ; esi = XPos |
1865 | ; esi = XPos |
1866 | ; ecx = YPos |
1866 | ; ecx = YPos |
1867 | ; edi = pointer to tedit struct |
1867 | ; edi = pointer to tedit struct |
1868 | ;output: |
1868 | ;output: |
1869 | ; edx = symbol under cursor |
1869 | ; edx = symbol under cursor |
1870 | ; ted_gp_opt = 1 if found text line |
1870 | ; ted_gp_opt = 1 if found text line |
1871 | ; ted_gp_opt = 2 if found text line and column |
1871 | ; ted_gp_opt = 2 if found text line and column |
1872 | ; edx = tex[1] if error |
1872 | ; edx = tex[1] if error |
1873 | ; ted_gp_opt = 0 if text no found |
1873 | ; ted_gp_opt = 0 if text no found |
1874 | align 16 |
1874 | align 16 |
1875 | proc ted_get_pos_by_coords uses eax ebx |
1875 | proc ted_get_pos_by_coords uses eax ebx |
1876 | xor eax,eax ;Row |
1876 | xor eax,eax ;Row |
1877 | xor ebx,ebx ;Col |
1877 | xor ebx,ebx ;Col |
1878 | mov ted_gp_opt,0 |
1878 | mov ted_gp_opt,0 |
1879 | mov edx,ted_tex |
1879 | mov edx,ted_tex |
1880 | @@: |
1880 | @@: |
1881 | call ted_iterat_next |
1881 | call ted_iterat_next |
1882 | cmp edx,ted_tex_1 |
1882 | cmp edx,ted_tex_1 |
1883 | jle @f |
1883 | jle @f |
1884 | cmp ebx,esi |
1884 | cmp ebx,esi |
1885 | jne .u1_0 ;Col <> ted_cur_x |
1885 | jne .u1_0 ;Col <> ted_cur_x |
1886 | mov ted_gp_opt,1 |
1886 | mov ted_gp_opt,1 |
1887 | cmp eax,ecx |
1887 | cmp eax,ecx |
1888 | jge @f ; Row >= ted_cur_y |
1888 | jge @f ; Row >= ted_cur_y |
1889 | .u1_0: |
1889 | .u1_0: |
1890 | mov ted_gp_opt,0 |
1890 | mov ted_gp_opt,0 |
1891 | inc ebx |
1891 | inc ebx |
1892 | cmp byte [edx],13 |
1892 | cmp byte [edx],13 |
1893 | jne @b |
1893 | jne @b |
1894 | cmp eax,ecx |
1894 | cmp eax,ecx |
1895 | jge @f ; Row >= ted_cur_y |
1895 | jge @f ; Row >= ted_cur_y |
1896 | inc eax |
1896 | inc eax |
1897 | xor ebx,ebx |
1897 | xor ebx,ebx |
1898 | jmp @b |
1898 | jmp @b |
1899 | @@: |
1899 | @@: |
1900 | cmp eax,ecx |
1900 | cmp eax,ecx |
1901 | jne @f ; Row = ted_cur_y |
1901 | jne @f ; Row = ted_cur_y |
1902 | inc ted_gp_opt |
1902 | inc ted_gp_opt |
1903 | @@: |
1903 | @@: |
1904 | cmp ted_gp_opt,0 |
1904 | cmp ted_gp_opt,0 |
1905 | jne @f |
1905 | jne @f |
1906 | mov edx,ted_tex_1 |
1906 | mov edx,ted_tex_1 |
1907 | ;call ted_get_text_perv_pos |
1907 | ;call ted_get_text_perv_pos |
1908 | @@: |
1908 | @@: |
1909 | ret |
1909 | ret |
1910 | endp |
1910 | endp |
1911 | 1911 | ||
1912 | ;input: |
1912 | ;input: |
1913 | ; eax = Row |
1913 | ; eax = Row |
1914 | ; edi = pointer to tedit struct |
1914 | ; edi = pointer to tedit struct |
1915 | ;output: |
1915 | ;output: |
1916 | ; ebx = str len |
1916 | ; ebx = str len |
1917 | align 16 |
1917 | align 16 |
1918 | ted_strlen: |
1918 | ted_strlen: |
1919 | push edx ecx |
1919 | push edx ecx |
1920 | ;ecx = Row, from cycle |
1920 | ;ecx = Row, from cycle |
1921 | 1921 | ||
1922 | xor ebx,ebx |
1922 | xor ebx,ebx |
1923 | xor ecx,ecx |
1923 | xor ecx,ecx |
1924 | mov edx,ted_tex |
1924 | mov edx,ted_tex |
1925 | @@: |
1925 | @@: |
1926 | call ted_iterat_next |
1926 | call ted_iterat_next |
1927 | cmp edx,ted_tex_1 |
1927 | cmp edx,ted_tex_1 |
1928 | jle @f |
1928 | jle @f |
1929 | inc ebx |
1929 | inc ebx |
1930 | cmp byte [edx],13 |
1930 | cmp byte [edx],13 |
1931 | jne @b |
1931 | jne @b |
1932 | dec ebx ;lenght minus 1 sumbol to paragraph |
1932 | dec ebx ;lenght minus 1 sumbol to paragraph |
1933 | cmp eax,ecx |
1933 | cmp eax,ecx |
1934 | je @f |
1934 | je @f |
1935 | xor ebx,ebx |
1935 | xor ebx,ebx |
1936 | inc ecx |
1936 | inc ecx |
1937 | jmp @b |
1937 | jmp @b |
1938 | @@: |
1938 | @@: |
1939 | 1939 | ||
1940 | cmp eax,ecx |
1940 | cmp eax,ecx |
1941 | je @f |
1941 | je @f |
1942 | xor ebx,ebx |
1942 | xor ebx,ebx |
1943 | @@: |
1943 | @@: |
1944 | 1944 | ||
1945 | pop ecx edx |
1945 | pop ecx edx |
1946 | ret |
1946 | ret |
1947 | 1947 | ||
1948 | 1948 | ||
1949 | ;input: |
1949 | ;input: |
1950 | ; edx = symbol position |
1950 | ; edx = symbol position |
1951 | ; edi = pointer to tedit struct |
1951 | ; edi = pointer to tedit struct |
1952 | ;output: |
1952 | ;output: |
1953 | ; eax = number of line |
1953 | ; eax = number of line |
1954 | ; ebx = symbol position in line |
1954 | ; ebx = symbol position in line |
1955 | align 16 |
1955 | align 16 |
1956 | ted_get_text_coords: |
1956 | ted_get_text_coords: |
1957 | push edx |
1957 | push edx |
1958 | xor eax,eax |
1958 | xor eax,eax |
1959 | xor ebx,ebx |
1959 | xor ebx,ebx |
1960 | @@: |
1960 | @@: |
1961 | call ted_iterat_perv |
1961 | call ted_iterat_perv |
1962 | 1962 | ||
1963 | or eax,eax |
1963 | or eax,eax |
1964 | jnz .no_col_mov |
1964 | jnz .no_col_mov |
1965 | inc ebx |
1965 | inc ebx |
1966 | .no_col_mov: |
1966 | .no_col_mov: |
1967 | 1967 | ||
1968 | cmp edx,ted_tex_1 |
1968 | cmp edx,ted_tex_1 |
1969 | jle @f |
1969 | jle @f |
1970 | cmp byte [edx],13 |
1970 | cmp byte [edx],13 |
1971 | jne @b |
1971 | jne @b |
1972 | inc eax |
1972 | inc eax |
1973 | jmp @b |
1973 | jmp @b |
1974 | @@: |
1974 | @@: |
1975 | dec ebx |
1975 | dec ebx |
1976 | pop edx |
1976 | pop edx |
1977 | ret |
1977 | ret |
1978 | 1978 | ||
1979 | ;input: |
1979 | ;input: |
1980 | ; edi = pointer to tedit struct |
1980 | ; edi = pointer to tedit struct |
1981 | ;output: |
1981 | ;output: |
1982 | ; eax = num lines |
1982 | ; eax = num lines |
1983 | align 16 |
1983 | align 16 |
1984 | ted_get_num_lines: |
1984 | ted_get_num_lines: |
1985 | push edx |
1985 | push edx |
1986 | mov eax,1 |
1986 | mov eax,1 |
1987 | mov edx,ted_tex |
1987 | mov edx,ted_tex |
1988 | @@: |
1988 | @@: |
1989 | call ted_iterat_next |
1989 | call ted_iterat_next |
1990 | cmp edx,ted_tex_1 |
1990 | cmp edx,ted_tex_1 |
1991 | jle @f |
1991 | jle @f |
1992 | cmp byte[edx],13 |
1992 | cmp byte[edx],13 |
1993 | jne @b |
1993 | jne @b |
1994 | inc eax |
1994 | inc eax |
1995 | jmp @b |
1995 | jmp @b |
1996 | @@: |
1996 | @@: |
1997 | ;... |
1997 | ;... |
1998 | ;dec eax |
1998 | ;dec eax |
1999 | pop edx |
1999 | pop edx |
2000 | ret |
2000 | ret |
2001 | 2001 | ||
2002 | 2002 | ||
2003 | ;input: |
2003 | ;input: |
2004 | ; edi = pointer to tedit struct |
2004 | ; edi = pointer to tedit struct |
2005 | ;description: |
2005 | ;description: |
2006 | ; ®â¬¥ï¥â ®â¬¥¥ë¥ ¤¥©á⢨ï, ¯¥à¥¤ ¨§¬¥¥¨¥¬ ¤®ªã¬¥â |
2006 | ; ®â¬¥ï¥â ®â¬¥¥ë¥ ¤¥©á⢨ï, ¯¥à¥¤ ¨§¬¥¥¨¥¬ ¤®ªã¬¥â |
2007 | align 16 |
2007 | align 16 |
2008 | proc ted_set_undo |
2008 | proc ted_set_undo |
2009 | mov ted_drag_k,0 ;§ ª 稢 ¥¬ ¢ë¤¥«¥¨¥ ®â ª« ¢¨ âãàë |
2009 | mov ted_drag_k,0 ;§ ª 稢 ¥¬ ¢ë¤¥«¥¨¥ ®â ª« ¢¨ âãàë |
2010 | cmp ted_tim_undo,1 |
2010 | cmp ted_tim_undo,1 |
2011 | jl .no_work |
2011 | jl .no_work |
2012 | 2012 | ||
2013 | push eax ebx edx |
2013 | push eax ebx edx |
2014 | mov edx,ted_tex |
2014 | mov edx,ted_tex |
2015 | call ted_get_text_next_pos ;long i=tex[0].next; |
2015 | call ted_get_text_next_pos ;long i=tex[0].next; |
2016 | mov eax,ted_tim_undo |
2016 | mov eax,ted_tim_undo |
2017 | sub ted_tim_ch,eax ;ted_tim_ch-=ted_tim_undo; |
2017 | sub ted_tim_ch,eax ;ted_tim_ch-=ted_tim_undo; |
2018 | mov eax,ted_tim_ch |
2018 | mov eax,ted_tim_ch |
2019 | cmp ted_tim_ls,eax ;if(ted_tim_ls>ted_tim_ch) |
2019 | cmp ted_tim_ls,eax ;if(ted_tim_ls>ted_tim_ch) |
2020 | jle @f |
2020 | jle @f |
2021 | mov ted_tim_ls,0 |
2021 | mov ted_tim_ls,0 |
2022 | @@: |
2022 | @@: |
2023 | cmp edx,ted_tex_1 |
2023 | cmp edx,ted_tex_1 |
2024 | jle @f |
2024 | jle @f |
2025 | 2025 | ||
2026 | ;if(tex[i].tc>ted_tim_ch){ // ¥á«¨ ᮧ¤ ¨¥ ᨬ¢®« ¡ë«® ®â¬¥¥® |
2026 | ;if(tex[i].tc>ted_tim_ch){ // ¥á«¨ ᮧ¤ ¨¥ ᨬ¢®« ¡ë«® ®â¬¥¥® |
2027 | cmp [edx+symbol.tc],eax |
2027 | cmp [edx+symbol.tc],eax |
2028 | jle .no_u1 |
2028 | jle .no_u1 |
2029 | mov dword[edx+symbol.tc],0 |
2029 | mov dword[edx+symbol.tc],0 |
2030 | mov dword[edx+symbol.td],0 |
2030 | mov dword[edx+symbol.td],0 |
2031 | 2031 | ||
2032 | mov ebx,[edx+symbol.perv] |
2032 | mov ebx,[edx+symbol.perv] |
2033 | imul ebx,sizeof.symbol |
2033 | imul ebx,sizeof.symbol |
2034 | add ebx,ted_tex ;ebx=tex[i].perv |
2034 | add ebx,ted_tex ;ebx=tex[i].perv |
2035 | m2m dword [ebx+symbol.next],dword [edx+symbol.next] ;tex[tex[i].perv].next=tex[i].next; |
2035 | m2m dword [ebx+symbol.next],dword [edx+symbol.next] ;tex[tex[i].perv].next=tex[i].next; |
2036 | 2036 | ||
2037 | mov ebx,[edx+symbol.next] |
2037 | mov ebx,[edx+symbol.next] |
2038 | imul ebx,sizeof.symbol |
2038 | imul ebx,sizeof.symbol |
2039 | add ebx,ted_tex ;ebx=tex[i].next |
2039 | add ebx,ted_tex ;ebx=tex[i].next |
2040 | m2m dword [ebx+symbol.perv],dword [edx+symbol.perv] ;tex[tex[i].next].perv=tex[i].perv; |
2040 | m2m dword [ebx+symbol.perv],dword [edx+symbol.perv] ;tex[tex[i].next].perv=tex[i].perv; |
2041 | 2041 | ||
2042 | cmp ted_ptr_free_symb,edx |
2042 | cmp ted_ptr_free_symb,edx |
2043 | jle .no_cor_free |
2043 | jle .no_cor_free |
2044 | mov ted_ptr_free_symb,edx ;¬¥ï¥¬ 㪠§ ⥫ì ᢮¡®¤ë© ᨬ¢®«, ¤«ï ¡®«¥¥ ¡ëáâண® ¯®¨áª ¯ ¬ï⨠|
2044 | mov ted_ptr_free_symb,edx ;¬¥ï¥¬ 㪠§ ⥫ì ᢮¡®¤ë© ᨬ¢®«, ¤«ï ¡®«¥¥ ¡ëáâண® ¯®¨áª ¯ ¬ï⨠|
2045 | .no_cor_free: |
2045 | .no_cor_free: |
2046 | mov edx,ebx ;®¯â¨¬¨§¨à㥬 ¯® ᪮à®á⨠(edx ¯®á«¥ ¢ë§®¢ ted_get_text_next_pos ¡ã¤¥â à ¢¥ ebx) |
2046 | mov edx,ebx ;®¯â¨¬¨§¨à㥬 ¯® ᪮à®á⨠(edx ¯®á«¥ ¢ë§®¢ ted_get_text_next_pos ¡ã¤¥â à ¢¥ ebx) |
2047 | jmp @b |
2047 | jmp @b |
2048 | .no_u1: |
2048 | .no_u1: |
2049 | 2049 | ||
2050 | ;else if(tex[i].td>ted_tim_ch) tex[i].td=0; // ¥á«¨ 㤠«¥¨¥ ᨬ¢®« ¡ë«® ®â¬¥¥® |
2050 | ;else if(tex[i].td>ted_tim_ch) tex[i].td=0; // ¥á«¨ 㤠«¥¨¥ ᨬ¢®« ¡ë«® ®â¬¥¥® |
2051 | cmp [edx+symbol.td],eax |
2051 | cmp [edx+symbol.td],eax |
2052 | jle .no_u2 |
2052 | jle .no_u2 |
2053 | mov dword[edx+symbol.td],0 |
2053 | mov dword[edx+symbol.td],0 |
2054 | .no_u2: |
2054 | .no_u2: |
2055 | 2055 | ||
2056 | call ted_get_text_next_pos |
2056 | call ted_get_text_next_pos |
2057 | jmp @b |
2057 | jmp @b |
2058 | @@: |
2058 | @@: |
2059 | mov ted_tim_undo,0 |
2059 | mov ted_tim_undo,0 |
2060 | mov eax,ted_tim_co |
2060 | mov eax,ted_tim_co |
2061 | cmp ted_tim_ch,eax |
2061 | cmp ted_tim_ch,eax |
2062 | jge @f |
2062 | jge @f |
2063 | mov ted_tim_co,0 |
2063 | mov ted_tim_co,0 |
2064 | @@: |
2064 | @@: |
2065 | pop edx ebx eax |
2065 | pop edx ebx eax |
2066 | .no_work: |
2066 | .no_work: |
2067 | ret |
2067 | ret |
2068 | endp |
2068 | endp |
2069 | 2069 | ||
2070 | ;description: |
2070 | ;description: |
2071 | ; ¯¥à¥å®¤ 㪠§ ãî ¯®§¨æ¨î |
2071 | ; ¯¥à¥å®¤ 㪠§ ãî ¯®§¨æ¨î |
2072 | ;input: |
2072 | ;input: |
2073 | ; row = ®¬¥à áâப¨ |
2073 | ; row = ®¬¥à áâப¨ |
2074 | ; col = ᨬ¢®« |
2074 | ; col = ᨬ¢®« |
2075 | align 16 |
2075 | align 16 |
2076 | proc ted_go_to_position uses ecx edx edi, edit:dword, row:dword, col:dword |
2076 | proc ted_go_to_position uses ecx edx edi, edit:dword, row:dword, col:dword |
2077 | mov edi,[edit] |
2077 | mov edi,[edit] |
2078 | ; ¯®¤£®â®¢ª áâப¨ |
2078 | ; ¯®¤£®â®¢ª áâப¨ |
2079 | mov edx,[row] |
2079 | mov edx,[row] |
2080 | call ted_get_num_lines |
2080 | call ted_get_num_lines |
2081 | cmp edx,eax |
2081 | cmp edx,eax |
2082 | jle @f |
2082 | jle @f |
2083 | mov edx,eax ;®£à ¨ç¥¨¥ ¯® áâப¥ max |
2083 | mov edx,eax ;®£à ¨ç¥¨¥ ¯® áâப¥ max |
2084 | @@: |
2084 | @@: |
2085 | dec edx |
2085 | dec edx |
2086 | cmp edx,0 |
2086 | cmp edx,0 |
2087 | jge @f |
2087 | jge @f |
2088 | xor edx,edx ;®£à ¨ç¥¨¥ ¯® áâப¥ min |
2088 | xor edx,edx ;®£à ¨ç¥¨¥ ¯® áâப¥ min |
2089 | @@: |
2089 | @@: |
2090 | ; ¯®¤£®â®¢ª ᨬ¢®« |
2090 | ; ¯®¤£®â®¢ª ᨬ¢®« |
2091 | mov ecx,[col] |
2091 | mov ecx,[col] |
2092 | dec ecx |
2092 | dec ecx |
2093 | cmp ecx,0 |
2093 | cmp ecx,0 |
2094 | jge @f |
2094 | jge @f |
2095 | xor ecx,ecx |
2095 | xor ecx,ecx |
2096 | @@: |
2096 | @@: |
2097 | call ted_go_to_pos |
2097 | call ted_go_to_pos |
2098 | stdcall ted_draw,edi |
2098 | stdcall ted_draw,edi |
2099 | ret |
2099 | ret |
2100 | endp |
2100 | endp |
2101 | 2101 | ||
2102 | ;input: |
2102 | ;input: |
2103 | ; ecx = Col |
2103 | ; ecx = Col |
2104 | ; edx = Row |
2104 | ; edx = Row |
2105 | ; edi = pointer to tedit struct |
2105 | ; edi = pointer to tedit struct |
2106 | ;output: |
2106 | ;output: |
2107 | ; ecx = cursor x |
2107 | ; ecx = cursor x |
2108 | ; edx = cursor y |
2108 | ; edx = cursor y |
2109 | align 16 |
2109 | align 16 |
2110 | ted_go_to_pos: |
2110 | ted_go_to_pos: |
2111 | push eax ebx |
2111 | push eax ebx |
2112 | mov eax,ted_scr_h |
2112 | mov eax,ted_scr_h |
2113 | sub ecx,[eax+sb_offs_position] |
2113 | sub ecx,[eax+sb_offs_position] |
2114 | cmp ecx,0 ;ted_cur_x < 0 |
2114 | cmp ecx,0 ;ted_cur_x < 0 |
2115 | jge @f |
2115 | jge @f |
2116 | add [eax+sb_offs_position],ecx ;¯à®ªàã⪠áªà®««¨£ ¢«¥¢® |
2116 | add [eax+sb_offs_position],ecx ;¯à®ªàã⪠áªà®««¨£ ¢«¥¢® |
2117 | xor ecx,ecx |
2117 | xor ecx,ecx |
2118 | @@: |
2118 | @@: |
2119 | mov ebx,5 ;5 - ¦¥« ¥¬ë© ®âáâ㯠᫥¢ |
2119 | mov ebx,5 ;5 - ¦¥« ¥¬ë© ®âáâ㯠᫥¢ |
2120 | cmp ecx,ebx |
2120 | cmp ecx,ebx |
2121 | jge .end0 |
2121 | jge .end0 |
2122 | sub ebx,ecx ;ebx - ᪮«ìª® ᨬ¢®«®¢ 㦮 ᤢ¨ãâì ªãàá®à |
2122 | sub ebx,ecx ;ebx - ᪮«ìª® ᨬ¢®«®¢ 㦮 ᤢ¨ãâì ªãàá®à |
2123 | cmp [eax+sb_offs_position],ebx |
2123 | cmp [eax+sb_offs_position],ebx |
2124 | jge @f |
2124 | jge @f |
2125 | add ecx,[eax+sb_offs_position] |
2125 | add ecx,[eax+sb_offs_position] |
2126 | mov dword[eax+sb_offs_position],0 |
2126 | mov dword[eax+sb_offs_position],0 |
2127 | jmp .end0 |
2127 | jmp .end0 |
2128 | @@: |
2128 | @@: |
2129 | sub [eax+sb_offs_position],ebx |
2129 | sub [eax+sb_offs_position],ebx |
2130 | add ecx,ebx |
2130 | add ecx,ebx |
2131 | .end0: |
2131 | .end0: |
2132 | cmp ecx,[eax+sb_offs_cur_area] ;ted_cur_x > [.cur_area] |
2132 | cmp ecx,[eax+sb_offs_cur_area] ;ted_cur_x > [.cur_area] |
2133 | jl .end1 |
2133 | jl .end1 |
2134 | mov ebx,ecx |
2134 | mov ebx,ecx |
2135 | sub ebx,[eax+sb_offs_cur_area] |
2135 | sub ebx,[eax+sb_offs_cur_area] |
2136 | inc ebx |
2136 | inc ebx |
2137 | add [eax+sb_offs_position],ebx ;¯à®ªàã⪠áªà®««¨£ ¢¯à ¢® |
2137 | add [eax+sb_offs_position],ebx ;¯à®ªàã⪠áªà®««¨£ ¢¯à ¢® |
2138 | sub ecx,ebx |
2138 | sub ecx,ebx |
2139 | .end1: |
2139 | .end1: |
2140 | mov ted_cur_x,ecx |
2140 | mov ted_cur_x,ecx |
2141 | 2141 | ||
2142 | mov eax,ted_scr_w |
2142 | mov eax,ted_scr_w |
2143 | sub edx,[eax+sb_offs_position] |
2143 | sub edx,[eax+sb_offs_position] |
2144 | cmp edx,0 ;ted_cur_y < 0 |
2144 | cmp edx,0 ;ted_cur_y < 0 |
2145 | jge @f |
2145 | jge @f |
2146 | add [eax+sb_offs_position],edx ;¯à®ªàã⪠áªà®««¨£ ¢¢¥àå |
2146 | add [eax+sb_offs_position],edx ;¯à®ªàã⪠áªà®««¨£ ¢¢¥àå |
2147 | xor edx,edx |
2147 | xor edx,edx |
2148 | jmp .end2 |
2148 | jmp .end2 |
2149 | @@: |
2149 | @@: |
2150 | cmp edx,[eax+sb_offs_cur_area] ;ted_cur_y > [.cur_area] |
2150 | cmp edx,[eax+sb_offs_cur_area] ;ted_cur_y > [.cur_area] |
2151 | jl .end2 |
2151 | jl .end2 |
2152 | mov ebx,edx |
2152 | mov ebx,edx |
2153 | sub ebx,[eax+sb_offs_cur_area] |
2153 | sub ebx,[eax+sb_offs_cur_area] |
2154 | inc ebx |
2154 | inc ebx |
2155 | add [eax+sb_offs_position],ebx ;¯à®ªàã⪠áªà®««¨£ ¢¨§ |
2155 | add [eax+sb_offs_position],ebx ;¯à®ªàã⪠áªà®««¨£ ¢¨§ |
2156 | sub edx,ebx |
2156 | sub edx,ebx |
2157 | .end2: |
2157 | .end2: |
2158 | mov ted_cur_y,edx |
2158 | mov ted_cur_y,edx |
2159 | pop ebx eax |
2159 | pop ebx eax |
2160 | ret |
2160 | ret |
2161 | 2161 | ||
2162 | ;input: |
2162 | ;input: |
2163 | ; edi = pointer to tedit struct |
2163 | ; edi = pointer to tedit struct |
2164 | align 16 |
2164 | align 16 |
2165 | ted_text_colored: |
2165 | ted_text_colored: |
2166 | push eax edx |
2166 | push eax edx |
2167 | mov eax,ted_tim_ch |
2167 | mov eax,ted_tim_ch |
2168 | sub eax,ted_tim_undo |
2168 | sub eax,ted_tim_undo |
2169 | mov ted_tim_co,eax |
2169 | mov ted_tim_co,eax |
2170 | mov edx,ted_tex |
2170 | mov edx,ted_tex |
2171 | @@: |
2171 | @@: |
2172 | call ted_iterat_next |
2172 | call ted_iterat_next |
2173 | cmp edx,ted_tex_1 |
2173 | cmp edx,ted_tex_1 |
2174 | jle @f |
2174 | jle @f |
2175 | mov byte[edx+1],0 |
2175 | mov byte[edx+1],0 |
2176 | jmp @b |
2176 | jmp @b |
2177 | @@: |
2177 | @@: |
2178 | 2178 | ||
2179 | cmp ted_key_words_count,1 |
2179 | cmp ted_key_words_count,1 |
2180 | jl .no_colors |
2180 | jl .no_colors |
2181 | mov edx,ted_tex |
2181 | mov edx,ted_tex |
2182 | @@: |
2182 | @@: |
2183 | call ted_text_find_sel_color |
2183 | call ted_text_find_sel_color |
2184 | cmp edx,ted_tex_1 |
2184 | cmp edx,ted_tex_1 |
2185 | jle .no_colors |
2185 | jle .no_colors |
2186 | jmp @b |
2186 | jmp @b |
2187 | .no_colors: |
2187 | .no_colors: |
2188 | pop edx eax |
2188 | pop edx eax |
2189 | ret |
2189 | ret |
2190 | 2190 | ||
2191 | 2191 | ||
2192 | ;input: |
2192 | ;input: |
2193 | ; edx = pointer to start symbol |
2193 | ; edx = pointer to start symbol |
2194 | ; edi = pointer to tedit struct |
2194 | ; edi = pointer to tedit struct |
2195 | ;output: |
2195 | ;output: |
2196 | ; edx = pointer to next symbol |
2196 | ; edx = pointer to next symbol |
2197 | ;description: |
2197 | ;description: |
2198 | ; ãªæ¨ï ¤«ï ¯®¨áª ¨ ¢ë¤¥«¥¨ï ¯®¤á¢¥ç¥ëå á«®¢ |
2198 | ; ãªæ¨ï ¤«ï ¯®¨áª ¨ ¢ë¤¥«¥¨ï ¯®¤á¢¥ç¥ëå á«®¢ |
2199 | align 16 |
2199 | align 16 |
2200 | proc ted_text_find_sel_color uses eax ebx ecx esi |
2200 | proc ted_text_find_sel_color uses eax ebx ecx esi |
2201 | locals |
2201 | locals |
2202 | begPos dd ? ; ç «ì ï ¯®§¨æ¨ï |
2202 | begPos dd ? ; ç «ì ï ¯®§¨æ¨ï |
2203 | endPos dd ? ;ª®¥ç ï ¯®§¨æ¨ï |
2203 | endPos dd ? ;ª®¥ç ï ¯®§¨æ¨ï |
2204 | find db ? ; ©¤¥® / ¥ ©¤¥® |
2204 | find db ? ;0 - ¥ ©¤¥®, 1 - ©¤¥®, 2 - ©¤¥® ¢ ª®æ¥ ä ©« |
2205 | f_color db ? ;¨¤¥ªá 梥⠩¤¥®£® á«®¢ |
2205 | f_color db ? ;¨¤¥ªá 梥⠩¤¥®£® á«®¢ |
2206 | endl |
2206 | endl |
2207 | ;eax = word_n ⥪ã騩 ®¬¥à (¯®§¨æ¨ï) ¯à®¢¥à塞®£® á«®¢ ¢ ᯨ᪥ |
2207 | ;eax = word_n ⥪ã騩 ®¬¥à (¯®§¨æ¨ï) ¯à®¢¥à塞®£® á«®¢ ¢ ᯨ᪥ |
2208 | ;ebx = ¤«ï à §ëå 楫¥© |
2208 | ;ebx = ¤«ï à §ëå 楫¥© |
2209 | ;ecx = l_pos ¯®á«¥¤¨© ®¬¥à (¯®§¨æ¨ï) ¯®¤å®¤ï饣® á«®¢ ¢ ᯨ᪥ |
2209 | ;ecx = l_pos ¯®á«¥¤¨© ®¬¥à (¯®§¨æ¨ï) ¯®¤å®¤ï饣® á«®¢ ¢ ᯨ᪥ |
2210 | ;esi = ¤«ï à §ëå 楫¥©, ®¬¥à ¯à®¢¥à塞®£® ᨬ¢®« ¢ á«®¢¥ |
2210 | ;esi = ¤«ï à §ëå 楫¥©, ®¬¥à ¯à®¢¥à塞®£® ᨬ¢®« ¢ á«®¢¥ |
2211 | mov dword[begPos],1 |
2211 | mov dword[begPos],1 |
2212 | mov dword[endPos],1 |
2212 | mov dword[endPos],1 |
2213 | mov byte[find],0 |
2213 | mov byte[find],0 |
2214 | mov byte[f_color],1 |
2214 | mov byte[f_color],1 |
2215 | .cycle0: |
2215 | .cycle0: |
2216 | call ted_iterat_next |
2216 | call ted_iterat_next |
2217 | cmp edx,ted_tex_1 |
2217 | cmp edx,ted_tex_1 |
2218 | jle .cycle0end |
2218 | jle .cycle0end |
2219 | - | ||
2220 | xor eax,eax |
2219 | |
2221 | mov al,byte[edx] |
2220 | movzx eax,byte[edx] |
2222 | shl ax,2 ;eax*=4 |
2221 | shl eax,2 ;eax*=4 |
2223 | add eax,ted_arr_key_pos |
2222 | add eax,ted_arr_key_pos |
2224 | mov eax,[eax] |
2223 | mov eax,[eax] |
2225 | cmp eax,0 |
2224 | cmp eax,0 |
2226 | jl .cycle0 ;if( (word_n=ted_arr_key_pos[(unsigned char)tex[i].c])>-1 ){ |
2225 | jl .cycle0 ;if( (word_n=ted_arr_key_pos[(unsigned char)tex[i].c])>-1 ){ |
2227 | 2226 | ||
2228 | mov ecx,eax |
2227 | mov ecx,eax |
2229 | ;while(l_pos |
2228 | ;while(l_pos |
2230 | .wh_1b: |
2229 | .wh_1b: |
2231 | cmp ecx,ted_key_words_count |
2230 | cmp ecx,ted_key_words_count |
2232 | jge .wh_1e |
2231 | jge .wh_1e |
2233 | ColToIndexOffset ecx,esi |
2232 | ColToIndexOffset ecx,esi |
2234 | mov bl,byte[esi] |
2233 | mov bl,byte[esi] |
2235 | ColToIndexOffset eax,esi |
2234 | ColToIndexOffset eax,esi |
2236 | cmp bl,byte[esi] |
2235 | cmp bl,byte[esi] |
2237 | jne .wh_1e |
2236 | jne .wh_1e |
2238 | inc ecx |
2237 | inc ecx |
2239 | jmp .wh_1b |
2238 | jmp .wh_1b |
2240 | .wh_1e: |
2239 | .wh_1e: |
2241 | 2240 | ||
2242 | mov [begPos],edx ;bP=i; |
2241 | mov [begPos],edx ;bP=i; |
2243 | mov esi,1 |
2242 | mov esi,1 |
2244 | align 4 |
2243 | align 4 |
2245 | .wh_2b: ;while(1){ |
2244 | .wh_2b: ;while(1){ |
2246 | call ted_iterat_next |
2245 | call ted_iterat_next |
2247 | 2246 | ||
2248 | ;while(l_pos>word_n && Col[l_pos-1].Text[pos]!=tex[i].c) |
2247 | ;while(l_pos>word_n && Col[l_pos-1].Text[pos]!=tex[i].c) |
2249 | @@: |
2248 | @@: |
2250 | cmp ecx,eax |
2249 | cmp ecx,eax |
2251 | jle @f |
2250 | jle @f |
2252 | dec ecx |
2251 | dec ecx |
2253 | ColToIndexOffset ecx,ebx |
2252 | ColToIndexOffset ecx,ebx |
2254 | inc ecx |
2253 | inc ecx |
2255 | ;cmp byte[ebx+esi],byte[edx] |
2254 | ;cmp byte[ebx+esi],byte[edx] |
2256 | mov bl,byte[ebx+esi] |
2255 | mov bl,byte[ebx+esi] |
2257 | cmp bl,byte[edx] |
2256 | cmp bl,byte[edx] |
2258 | je @f |
2257 | je @f |
2259 | dec ecx |
2258 | dec ecx |
2260 | jmp @b |
2259 | jmp @b |
2261 | @@: |
2260 | @@: |
2262 | 2261 | ||
2263 | ColToIndexOffset eax,ebx |
2262 | ColToIndexOffset eax,ebx |
2264 | cmp byte[ebx+esi],0 |
2263 | cmp byte[ebx+esi],0 |
2265 | jne .if_0 ;if(Col[word_n].Text[pos]==0){ |
2264 | jne .if_0 ;if(Col[word_n].Text[pos]==0){ |
2266 | mov [endPos],edx ;eP=i; |
2265 | mov [endPos],edx ;eP=i; |
2267 | ColToIndexOffset eax,ebx |
2266 | ColToIndexOffset eax,ebx |
2268 | mov bl,[ebx+MAX_COLOR_WORD_LEN+7] |
2267 | mov bl,[ebx+MAX_COLOR_WORD_LEN+7] |
2269 | mov [f_color],bl ;f_color=Col[word_n].color; |
2268 | mov [f_color],bl ;f_color=Col[word_n].color; |
2270 | 2269 | ||
2271 | mov byte[find],1 |
2270 | mov byte[find],1 |
2272 | ColToIndexOffset eax,ebx ;... ebx = Col[word_n] |
2271 | ColToIndexOffset eax,ebx ;... ebx = Col[word_n] |
2273 | mov bl,[ebx+MAX_COLOR_WORD_LEN+4] |
2272 | mov bl,[ebx+MAX_COLOR_WORD_LEN+4] |
2274 | cmp bl,0 ;if(Col[word_n].wwo) |
2273 | cmp bl,0 ;if(Col[word_n].wwo) |
2275 | je .if_2n |
2274 | je .if_2n |
2276 | push edx |
2275 | push edx |
2277 | mov edx,[begPos] |
2276 | mov edx,[begPos] |
2278 | call ted_iterat_perv |
2277 | call ted_iterat_perv |
2279 | 2278 | ||
2280 | btr bx,0 ;1-1 |
2279 | btr bx,0 ;1-1 |
2281 | jae @f ;if(Col[word_n].wwo&1) |
2280 | jae @f ;if(Col[word_n].wwo&1) |
2282 | ;u1= !(isalnum(cont_s)||cont_s=='_') |
2281 | ;u1= !(isalnum(cont_s)||cont_s=='_') |
2283 | call isalnum |
2282 | call isalnum |
2284 | jae @f |
2283 | jae @f |
2285 | mov byte[find],0 |
2284 | mov byte[find],0 |
2286 | jmp .if_4e |
2285 | jmp .if_4e |
2287 | @@: |
2286 | @@: |
2288 | 2287 | ||
2289 | btr bx,3 ;4-1 |
2288 | btr bx,3 ;4-1 |
2290 | jae .if_4e ;if(Col[word_n].wwo&8) |
2289 | jae .if_4e ;if(Col[word_n].wwo&8) |
2291 | ;u1= !isalpha(cont_s); |
2290 | ;u1= !isalpha(cont_s); |
2292 | call isalpha |
2291 | call isalpha |
2293 | jae .if_4e |
2292 | jae .if_4e |
2294 | mov byte[find],0 |
2293 | mov byte[find],0 |
2295 | .if_4e: |
2294 | .if_4e: |
2296 | 2295 | ||
2297 | mov edx,[endPos] |
2296 | mov edx,[endPos] |
2298 | ;call ted_iterat_next |
2297 | ;call ted_iterat_next |
2299 | 2298 | ||
2300 | btr bx,1 ;2-1 |
2299 | btr bx,1 ;2-1 |
2301 | jae @f ;if(Col[word_n].wwo&2) |
2300 | jae @f ;if(Col[word_n].wwo&2) |
2302 | ;u1= !(isalnum(cont_s)||cont_s=='_') |
2301 | ;u1= !(isalnum(cont_s)||cont_s=='_') |
2303 | call isalnum |
2302 | call isalnum |
2304 | jae @f |
2303 | jae @f |
2305 | mov byte[find],0 |
2304 | mov byte[find],0 |
2306 | jmp .if_6e |
2305 | jmp .if_6e |
2307 | @@: |
2306 | @@: |
2308 | 2307 | ||
2309 | btr bx,4 ;5-1 |
2308 | btr bx,4 ;5-1 |
2310 | jae .if_6e ;if(Col[word_n].wwo&16) |
2309 | jae .if_6e ;if(Col[word_n].wwo&16) |
2311 | ;u1= !isalpha(cont_s); |
2310 | ;u1= !isalpha(cont_s); |
2312 | call isalpha |
2311 | call isalpha |
2313 | jae .if_6e |
2312 | jae .if_6e |
2314 | mov byte[find],0 |
2313 | mov byte[find],0 |
2315 | .if_6e: |
2314 | .if_6e: |
2316 | 2315 | ||
2317 | btr bx,2 ;3-1 |
2316 | btr bx,2 ;3-1 |
2318 | jae .if_7e ;if(Col[word_n].wwo&4) |
2317 | jae .if_7e ;if(Col[word_n].wwo&4) |
2319 | ColToIndexOffset eax,ebx |
2318 | ColToIndexOffset eax,ebx |
2320 | mov bx,word[ebx+MAX_COLOR_WORD_LEN+5] |
2319 | mov bx,word[ebx+MAX_COLOR_WORD_LEN+5] |
2321 | call ted_iterat_next_pos_char |
2320 | call ted_iterat_next_pos_char |
2322 | cmp edx,ted_tex_1 |
2321 | cmp edx,ted_tex_1 |
2323 | jg @f |
2322 | jg @f |
2324 | ;¥á«¨ ¤®è«¨ ¤® ª®æ ä ©« ¨ ¥ 諨 ᨬ¢®« ª®æ à §¬¥âª¨ |
2323 | ;¥á«¨ ¤®è«¨ ¤® ª®æ ä ©« ¨ ¥ 諨 ᨬ¢®« ª®æ à §¬¥âª¨ |
2325 | call ted_iterat_perv |
2324 | call ted_iterat_perv |
- | 2325 | mov byte[find],2 |
|
2326 | @@: |
2326 | @@: |
2327 | mov dword[endPos],edx |
2327 | mov dword[endPos],edx |
2328 | .if_7e: |
2328 | .if_7e: |
2329 | 2329 | ||
2330 | pop edx |
2330 | pop edx |
2331 | .if_2n: |
2331 | .if_2n: |
2332 | ;if(i!=1){ // ¥ ª®¥æ ¤®ªã¬¥â |
2332 | ;if(i!=1){ // ¥ ª®¥æ ¤®ªã¬¥â |
2333 | ; cont_s=tex[eP].c; |
2333 | ; cont_s=tex[eP].c; |
2334 | ; if(Col[word_n].wwo&2) u2= !(isalnum(cont_s)||cont_s=='_'); // ¥ ¡ãª¢.-ç¨á«. ᨬ¢®« |
2334 | ; if(Col[word_n].wwo&2) u2= !(isalnum(cont_s)||cont_s=='_'); // ¥ ¡ãª¢.-ç¨á«. ᨬ¢®« |
2335 | ; if(u2 && Col[word_n].wwo&16) u2= !isalpha(cont_s); // ¥ ç¨á«. ᨬ¢®« |
2335 | ; if(u2 && Col[word_n].wwo&16) u2= !isalpha(cont_s); // ¥ ç¨á«. ᨬ¢®« |
2336 | ; if(Col[word_n].wwo&4) eP=ted_iterat_next_pos_char(eP,Col[word_n].endc); |
2336 | ; if(Col[word_n].wwo&4) eP=ted_iterat_next_pos_char(eP,Col[word_n].endc); |
2337 | 2337 | ||
2338 | cmp eax,ecx |
2338 | cmp eax,ecx |
2339 | je .wh_2e ;if(word_n==l_pos) break; // do double - ¥á«¨ á«®¢® â®ç® ¯®á«¥¤¥¥ |
2339 | je .wh_2e ;if(word_n==l_pos) break; // do double - ¥á«¨ á«®¢® â®ç® ¯®á«¥¤¥¥ |
2340 | .if_0: |
2340 | .if_0: |
2341 | 2341 | ||
2342 | cmp edx,ted_tex_1 |
2342 | cmp edx,ted_tex_1 |
2343 | jle .wh_2e ;if(i==1) break; |
2343 | jle .wh_2e ;if(i==1) break; |
2344 | 2344 | ||
2345 | ;while(l_pos>word_n && Col[word_n].Text[pos]!=tex[i].c) |
2345 | ;while(l_pos>word_n && Col[word_n].Text[pos]!=tex[i].c) |
2346 | .wh_4b: |
2346 | .wh_4b: |
2347 | cmp ecx,eax |
2347 | cmp ecx,eax |
2348 | jle .wh_4e |
2348 | jle .wh_4e |
2349 | ColToIndexOffset eax,ebx |
2349 | ColToIndexOffset eax,ebx |
2350 | ;cmp byte[ebx+esi],byte[edx] |
2350 | ;cmp byte[ebx+esi],byte[edx] |
2351 | mov bl,byte[ebx+esi] |
2351 | mov bl,byte[ebx+esi] |
2352 | cmp bl,byte[edx] |
2352 | cmp bl,byte[edx] |
2353 | je .wh_4e |
2353 | je .wh_4e |
2354 | inc eax |
2354 | inc eax |
2355 | jmp .wh_4b |
2355 | jmp .wh_4b |
2356 | .wh_4e: |
2356 | .wh_4e: |
2357 | 2357 | ||
2358 | cmp eax,ecx |
2358 | cmp eax,ecx |
2359 | je .wh_2e;if(word_n==l_pos) break; |
2359 | je .wh_2e;if(word_n==l_pos) break; |
2360 | inc esi ;pos++; |
2360 | inc esi ;pos++; |
2361 | jmp .wh_2b |
2361 | jmp .wh_2b |
2362 | .wh_2e: |
2362 | .wh_2e: |
2363 | 2363 | ||
2364 | cmp byte[find],1 ;if(fnd)break; |
2364 | cmp byte[find],0 ;if(fnd)break; |
2365 | je .cycle0end |
2365 | jne .cycle0end |
2366 | mov edx,[begPos];i=bP; |
2366 | mov edx,[begPos];i=bP; |
2367 | jmp .cycle0 |
2367 | jmp .cycle0 |
2368 | .cycle0end: |
2368 | .cycle0end: |
2369 | 2369 | ||
2370 | cmp byte[find],1 |
2370 | cmp byte[find],0 |
2371 | jne .if_1e ;if(fnd){ // ¢ë¤¥«¥¨¥ ©¤¥®£® ⥪áâ |
2371 | je .if_1e ;if(fnd){ // ¢ë¤¥«¥¨¥ ©¤¥®£® ⥪áâ |
2372 | ;if(!mode_sf1 || (mode_sf1 && strlen(Col[word_n].f1->c_str())>0)){ |
2372 | ;if(!mode_sf1 || (mode_sf1 && strlen(Col[word_n].f1->c_str())>0)){ |
2373 | mov eax,[begPos] |
2373 | mov eax,[begPos] |
2374 | mov bl,[f_color] |
2374 | mov bl,[f_color] |
2375 | mov [eax+1],bl ;tex[bP].col=f_color; |
2375 | mov [eax+1],bl ;tex[bP].col=f_color; |
2376 | mov eax,[endPos] |
2376 | mov eax,[endPos] |
2377 | mov byte[eax+1],0xff ;tex[eP].col=255; |
2377 | mov byte[eax+1],0xff ;tex[eP].col=255; |
- | 2378 | cmp byte[find],2 |
|
- | 2379 | je .if_1e |
|
2378 | ;return ItPoPerv(eP); // ¢®§¢à é ¥¬ ¯®§¨æ¨î ª®æ ¢å®¦¤¥¨ï |
2380 | ;return ItPoPerv(eP); // ¢®§¢à é ¥¬ ¯®§¨æ¨î ª®æ ¢å®¦¤¥¨ï |
2379 | mov edx,[endPos] |
2381 | mov edx,[endPos] |
2380 | call ted_get_text_perv_pos |
2382 | call ted_get_text_perv_pos |
2381 | jmp @f |
2383 | jmp @f |
2382 | .if_1e: |
2384 | .if_1e: |
2383 | mov edx,ted_tex |
2385 | mov edx,ted_tex |
2384 | @@: |
2386 | @@: |
2385 | 2387 | ||
2386 | ret |
2388 | ret |
2387 | endp |
2389 | endp |
2388 | 2390 | ||
2389 | ;input: |
2391 | ;input: |
2390 | ; edx = pointer to char (byte) |
2392 | ; edx = pointer to char (byte) |
2391 | ;output: |
2393 | ;output: |
2392 | ; cf=1 if symbol is... |
2394 | ; cf=1 if symbol is... |
2393 | align 16 |
2395 | align 16 |
2394 | tab_all_num db 0,0,0,0,0,0,0xff,11b,11111110b,0xff,0xff,10000111b,11111110b,0xff,0xff,111b,0,0,0,0,0,0,0,0;,0,0,0,0,0,0,0,0 - tab_alpha_0,0,0,0,0,0,0,0 |
2396 | tab_all_num db 0,0,0,0,0,0,0xff,11b,11111110b,0xff,0xff,10000111b,11111110b,0xff,0xff,111b,0,0,0,0,0,0,0,0;,0,0,0,0,0,0,0,0 - tab_alpha_0,0,0,0,0,0,0,0 |
2395 | tab_alpha db 0,0,0,0,0,0,0,0,11111110b,0xff,0xff,10000111b,11111110b,0xff,0xff,111b,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 |
2397 | tab_alpha db 0,0,0,0,0,0,0,0,11111110b,0xff,0xff,10000111b,11111110b,0xff,0xff,111b,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 |
2396 | 2398 | ||
2397 | ;output: |
2399 | ;output: |
2398 | ; cf=1 ¥á«¨ ¢ [edx] ¡ãª¢ , æ¨äà ¨«¨ '_' |
2400 | ; cf=1 ¥á«¨ ¢ [edx] ¡ãª¢ , æ¨äà ¨«¨ '_' |
2399 | align 16 |
2401 | align 16 |
2400 | isalnum: |
2402 | isalnum: |
2401 | push eax ebx |
2403 | push eax ebx |
2402 | movzx eax,byte[edx] ;al=offset |
2404 | movzx eax,byte[edx] ;al=offset |
2403 | shr eax,3 |
2405 | shr eax,3 |
2404 | lea ebx,[tab_all_num] |
2406 | lea ebx,[tab_all_num] |
2405 | add ebx,eax |
2407 | add ebx,eax |
2406 | movzx ax,byte[edx] ;al=bit |
2408 | movzx ax,byte[edx] ;al=bit |
2407 | and ax,111b |
2409 | and ax,111b |
2408 | bt word[ebx],ax |
2410 | bt word[ebx],ax |
2409 | pop ebx eax |
2411 | pop ebx eax |
2410 | ret |
2412 | ret |
2411 | 2413 | ||
2412 | ;output: |
2414 | ;output: |
2413 | ; cf=1 ¥á«¨ ¢ [edx] ¡ãª¢ ¨«¨ '_' |
2415 | ; cf=1 ¥á«¨ ¢ [edx] ¡ãª¢ ¨«¨ '_' |
2414 | align 16 |
2416 | align 16 |
2415 | isalpha: |
2417 | isalpha: |
2416 | push eax ebx |
2418 | push eax ebx |
2417 | movzx eax,byte[edx] ;al=offset |
2419 | movzx eax,byte[edx] ;al=offset |
2418 | shr eax,3 |
2420 | shr eax,3 |
2419 | lea ebx,[tab_alpha] |
2421 | lea ebx,[tab_alpha] |
2420 | add ebx,eax |
2422 | add ebx,eax |
2421 | movzx ax,byte[edx] ;al=bit |
2423 | movzx ax,byte[edx] ;al=bit |
2422 | and ax,111b |
2424 | and ax,111b |
2423 | bt word[ebx],ax |
2425 | bt word[ebx],ax |
2424 | pop ebx eax |
2426 | pop ebx eax |
2425 | ret |
2427 | ret |
2426 | 2428 | ||
2427 | align 16 |
2429 | align 16 |
2428 | proc ted_show_help_f1 uses eax edx edi, edit:dword |
2430 | proc ted_show_help_f1 uses eax edx edi, edit:dword |
2429 | mov edi,[edit] |
2431 | mov edi,[edit] |
2430 | 2432 | ||
2431 | call ted_get_pos_by_cursor |
2433 | call ted_get_pos_by_cursor |
2432 | push edx |
2434 | push edx |
2433 | call ted_iterat_next_color_tag |
2435 | call ted_iterat_next_color_tag |
2434 | mov eax,edx |
2436 | mov eax,edx |
2435 | pop edx |
2437 | pop edx |
2436 | call ted_iterat_perv_color_tag |
2438 | call ted_iterat_perv_color_tag |
2437 | 2439 | ||
2438 | cmp eax,ted_tex |
2440 | cmp eax,ted_tex |
2439 | jle @f |
2441 | jle @f |
2440 | cmp edx,ted_tex_1 |
2442 | cmp edx,ted_tex_1 |
2441 | jle @f |
2443 | jle @f |
2442 | stdcall ted_find_help_id,eax |
2444 | stdcall ted_find_help_id,eax |
2443 | @@: |
2445 | @@: |
2444 | ;call ted_draw_main_cursor |
2446 | ;call ted_draw_main_cursor |
2445 | call ted_draw_help_f1 |
2447 | call ted_draw_help_f1 |
2446 | ret |
2448 | ret |
2447 | endp |
2449 | endp |
2448 | 2450 | ||
2449 | ;input: |
2451 | ;input: |
2450 | ; edx = position begin 'symbol' struct |
2452 | ; edx = position begin 'symbol' struct |
2451 | ; edi = pointer to tedit struct |
2453 | ; edi = pointer to tedit struct |
2452 | ; end_pos = position end 'symbol' struct |
2454 | ; end_pos = position end 'symbol' struct |
2453 | align 16 |
2455 | align 16 |
2454 | proc ted_find_help_id uses ebx ecx, end_pos:dword |
2456 | proc ted_find_help_id uses ebx ecx, end_pos:dword |
2455 | ; ecx = word_n |
2457 | ; ecx = word_n |
2456 | ; ebx = l_pos |
2458 | ; ebx = l_pos |
2457 | mov ted_help_id,-1 |
2459 | mov ted_help_id,-1 |
2458 | - | ||
2459 | xor ebx,ebx |
2460 | |
2460 | mov bl,[edx] |
2461 | movzx ebx,byte[edx] |
2461 | shl bx,2 ;ebx*=4 |
2462 | shl ebx,2 ;ebx*=4 |
2462 | add ebx,ted_arr_key_pos |
2463 | add ebx,ted_arr_key_pos |
2463 | mov ecx,[ebx] |
2464 | mov ecx,[ebx] |
2464 | cmp ecx,0 |
2465 | cmp ecx,0 |
2465 | jl .if_0e ;if( (word_n=ted_arr_key_pos[(unsigned char)tf[0]])>-1 ){ |
2466 | jl .if_0e ;if( (word_n=ted_arr_key_pos[(unsigned char)tf[0]])>-1 ){ |
2466 | push esi eax |
2467 | push esi eax |
2467 | mov ebx,ecx ;l_pos=word_n; |
2468 | mov ebx,ecx ;l_pos=word_n; |
2468 | ColToIndexOffset ecx,esi |
2469 | ColToIndexOffset ecx,esi |
2469 | push cx |
2470 | push cx |
2470 | mov cl,[esi] |
2471 | mov cl,[esi] |
2471 | @@: |
2472 | @@: |
2472 | cmp ebx,ted_key_words_count ;while(l_pos |
2473 | cmp ebx,ted_key_words_count ;while(l_pos |
2473 | jge @f |
2474 | jge @f |
2474 | ;ColToIndexOffset ecx,esi |
2475 | ;ColToIndexOffset ecx,esi |
2475 | ColToIndexOffset ebx,eax |
2476 | ColToIndexOffset ebx,eax |
2476 | cmp cl,[eax] ;&& Col[l_pos].Text[0]==Col[word_n].Text[0]) |
2477 | cmp cl,[eax] ;&& Col[l_pos].Text[0]==Col[word_n].Text[0]) |
2477 | jne @f |
2478 | jne @f |
2478 | inc ebx ;l_pos++; |
2479 | inc ebx ;l_pos++; |
2479 | jmp @b |
2480 | jmp @b |
2480 | @@: |
2481 | @@: |
2481 | pop cx |
2482 | pop cx |
2482 | call ted_iterat_next ;pos=1; |
2483 | call ted_iterat_next ;pos=1; |
2483 | mov esi,1 |
2484 | mov esi,1 |
2484 | @@: |
2485 | @@: |
2485 | push dx |
2486 | push dx |
2486 | push word[edx] |
2487 | push word[edx] |
2487 | pop dx |
2488 | pop dx |
2488 | .wh_0b: |
2489 | .wh_0b: |
2489 | cmp ebx,ecx ;while(l_pos>word_n |
2490 | cmp ebx,ecx ;while(l_pos>word_n |
2490 | jle .wh_0e |
2491 | jle .wh_0e |
2491 | dec ebx |
2492 | dec ebx |
2492 | ColToIndexOffset ebx,eax |
2493 | ColToIndexOffset ebx,eax |
2493 | inc ebx |
2494 | inc ebx |
2494 | cmp byte[eax+esi],dl ;&& Col[l_pos-1].Text[pos]!=tf[i]) |
2495 | cmp byte[eax+esi],dl ;&& Col[l_pos-1].Text[pos]!=tf[i]) |
2495 | je .wh_0e |
2496 | je .wh_0e |
2496 | dec ebx ;l_pos--; |
2497 | dec ebx ;l_pos--; |
2497 | jmp .wh_0b |
2498 | jmp .wh_0b |
2498 | .wh_0e: |
2499 | .wh_0e: |
2499 | 2500 | ||
2500 | .wh_1b: |
2501 | .wh_1b: |
2501 | cmp ebx,ecx ;while(l_pos>word_n |
2502 | cmp ebx,ecx ;while(l_pos>word_n |
2502 | jle .wh_1e |
2503 | jle .wh_1e |
2503 | ColToIndexOffset ecx,eax |
2504 | ColToIndexOffset ecx,eax |
2504 | cmp byte[eax+esi],dl |
2505 | cmp byte[eax+esi],dl |
2505 | je .wh_1e |
2506 | je .wh_1e |
2506 | inc ecx ;word_n++; |
2507 | inc ecx ;word_n++; |
2507 | jmp .wh_1b |
2508 | jmp .wh_1b |
2508 | .wh_1e: |
2509 | .wh_1e: |
2509 | pop dx |
2510 | pop dx |
2510 | 2511 | ||
2511 | cmp ecx,ebx ;if(word_n==l_pos) break; |
2512 | cmp ecx,ebx ;if(word_n==l_pos) break; |
2512 | je @f |
2513 | je @f |
2513 | call ted_iterat_next ;pos++; |
2514 | call ted_iterat_next ;pos++; |
2514 | cmp edx,[end_pos] ;for(...;i |
2515 | cmp edx,[end_pos] ;for(...;i |
2515 | je @f ;jge |
2516 | je @f ;jge |
2516 | inc esi |
2517 | inc esi |
2517 | jmp @b |
2518 | jmp @b |
2518 | @@: |
2519 | @@: |
2519 | pop eax esi |
2520 | pop eax esi |
2520 | 2521 | ||
2521 | mov ted_help_id,ecx |
2522 | mov ted_help_id,ecx |
2522 | ;return word_n; |
2523 | ;return word_n; |
2523 | 2524 | ||
2524 | .if_0e: |
2525 | .if_0e: |
2525 | ret |
2526 | ret |
2526 | endp |
2527 | endp |
2527 | 2528 | ||
2528 | ;output: |
2529 | ;output: |
2529 | ; eax = ª®¤ ®è¨¡ª¨ |
2530 | ; eax = ª®¤ ®è¨¡ª¨ |
2530 | ; ebx = ª®««¨ç¥á⢮ ¯à®ç¨â ëå ¡ ©â |
2531 | ; ebx = ª®««¨ç¥á⢮ ¯à®ç¨â ëå ¡ ©â |
2531 | align 16 |
2532 | align 16 |
2532 | proc ted_open_file uses ecx edx edi, edit:dword, file:dword, f_name:dword ;äãªæ¨ï ®âªàëâ¨ï ä ©« |
2533 | proc ted_open_file uses ecx edx edi, edit:dword, file:dword, f_name:dword ;äãªæ¨ï ®âªàëâ¨ï ä ©« |
2533 | mov edi,[edit] |
2534 | mov edi,[edit] |
2534 | 2535 | ||
2535 | ; *** ¯à®¢¥à塞 à §¬¥à ¯ ¬ï⨠¨ ¥á«¨ ¥ å¢ â ¥â ⮠㢥«¨ç¨¢ ¥¬ *** |
2536 | ; *** ¯à®¢¥à塞 à §¬¥à ¯ ¬ï⨠¨ ¥á«¨ ¥ å¢ â ¥â ⮠㢥«¨ç¨¢ ¥¬ *** |
2536 | ;¯à®¡ã¥¬ ¯®«ãç¨âì ¨ä®à¬ æ¨î ® ä ©«¥ |
2537 | ;¯à®¡ã¥¬ ¯®«ãç¨âì ¨ä®à¬ æ¨î ® ä ©«¥ |
2537 | mov ebx,[file] |
2538 | mov ebx,[file] |
2538 | mov dword[ebx], SSF_GET_INFO |
2539 | mov dword[ebx], SSF_GET_INFO |
2539 | mov dword[ebx+4], 0 |
2540 | mov dword[ebx+4], 0 |
2540 | mov dword[ebx+8], 0 |
2541 | mov dword[ebx+8], 0 |
2541 | mov dword[ebx+12], 0 |
2542 | mov dword[ebx+12], 0 |
2542 | m2m dword[ebx+16], ted_tex |
2543 | m2m dword[ebx+16], ted_tex |
2543 | mov byte[ebx+20], 0 |
2544 | mov byte[ebx+20], 0 |
2544 | push dword[f_name] |
2545 | push dword[f_name] |
2545 | pop dword[ebx+21] |
2546 | pop dword[ebx+21] |
2546 | mcall SF_FILE |
2547 | mcall SF_FILE |
2547 | or eax,eax |
2548 | or eax,eax |
2548 | jz .end_0 |
2549 | jz .end_0 |
2549 | mov edx,ted_max_chars |
2550 | mov edx,ted_max_chars |
2550 | cmp eax,2 ;äãªæ¨ï ¥ ¯®¤¤¥à¦¨¢ ¥âáï ¤«ï ¤ ®© ä ©«®¢®© á¨á⥬ë |
2551 | cmp eax,2 ;äãªæ¨ï ¥ ¯®¤¤¥à¦¨¢ ¥âáï ¤«ï ¤ ®© ä ©«®¢®© á¨á⥬ë |
2551 | je @f |
2552 | je @f |
2552 | jmp .ret_f |
2553 | jmp .ret_f |
2553 | align 4 |
2554 | align 4 |
2554 | .end_0: |
2555 | .end_0: |
2555 | ;¯à®¢¥à塞 å¢ â¨â «¨ ¯ ¬ï⨠¤«ï § £à㧪¨ ä ©« |
2556 | ;¯à®¢¥à塞 å¢ â¨â «¨ ¯ ¬ï⨠¤«ï § £à㧪¨ ä ©« |
2556 | mov ecx,ted_max_chars |
2557 | mov ecx,ted_max_chars |
2557 | sub ecx,2 ;ecx = ¬ ªá¨¬ «ì®¥ ç¨á«® ¡ ©â, ¤«ï ª®â®àëå ¡ë« ¢ë¤¥«¥ ¯ ¬ïâì |
2558 | sub ecx,2 ;ecx = ¬ ªá¨¬ «ì®¥ ç¨á«® ¡ ©â, ¤«ï ª®â®àëå ¡ë« ¢ë¤¥«¥ ¯ ¬ïâì |
2558 | mov edx,ted_tex |
2559 | mov edx,ted_tex |
2559 | mov edx,[edx+32] ;+32 = +0x20: qword: à §¬¥à ä ©« ¢ ¡ ©â å |
2560 | mov edx,[edx+32] ;+32 = +0x20: qword: à §¬¥à ä ©« ¢ ¡ ©â å |
2560 | cmp edx,ecx |
2561 | cmp edx,ecx |
2561 | jl @f |
2562 | jl @f |
2562 | ;㢥«¨ç¨¢ ¥¬ ¯ ¬ïâì ¥á«¨ ¥ å¢ â¨«® |
2563 | ;㢥«¨ç¨¢ ¥¬ ¯ ¬ïâì ¥á«¨ ¥ å¢ â¨«® |
2563 | mov ecx,edx ;¯ ¬ïâì ¥®¡å®¤¨¬ ï ¤«ï ®âªàëâ¨ï ä ©« |
2564 | mov ecx,edx ;¯ ¬ïâì ¥®¡å®¤¨¬ ï ¤«ï ®âªàëâ¨ï ä ©« |
2564 | add ecx,2 ;¯ ¬ïâì ¤«ï á«ã¦¥¡ëå ç «ì®£® ¨ ª®¥ç®£® ᨬ¢®«®¢ |
2565 | add ecx,2 ;¯ ¬ïâì ¤«ï á«ã¦¥¡ëå ç «ì®£® ¨ ª®¥ç®£® ᨬ¢®«®¢ |
2565 | add ecx,ted_increase_size ;¯ ¬ïâì ¤«ï । ªâ¨à®¢ ¨ï ä ©« |
2566 | add ecx,ted_increase_size ;¯ ¬ïâì ¤«ï । ªâ¨à®¢ ¨ï ä ©« |
2566 | mov ted_max_chars,ecx |
2567 | mov ted_max_chars,ecx |
2567 | imul ecx,sizeof.symbol |
2568 | imul ecx,sizeof.symbol |
2568 | invoke mem.realloc, ted_tex,ecx |
2569 | invoke mem.realloc, ted_tex,ecx |
2569 | mov ted_tex,eax |
2570 | mov ted_tex,eax |
2570 | mov ted_tex_1,eax |
2571 | mov ted_tex_1,eax |
2571 | add ted_tex_1,sizeof.symbol |
2572 | add ted_tex_1,sizeof.symbol |
2572 | add eax,ecx |
2573 | add eax,ecx |
2573 | mov ted_tex_end,eax |
2574 | mov ted_tex_end,eax |
2574 | mov ecx,ted_tex_1 |
2575 | mov ecx,ted_tex_1 |
2575 | add ecx,sizeof.symbol |
2576 | add ecx,sizeof.symbol |
2576 | mov ted_ptr_free_symb,ecx |
2577 | mov ted_ptr_free_symb,ecx |
2577 | @@: |
2578 | @@: |
2578 | 2579 | ||
2579 | ; *** ¯à®¡ã¥¬ ®âªàëâì ä ©« *** |
2580 | ; *** ¯à®¡ã¥¬ ®âªàëâì ä ©« *** |
2580 | mov ebx,[file] |
2581 | mov ebx,[file] |
2581 | mov dword[ebx], SSF_READ_FILE |
2582 | mov dword[ebx], SSF_READ_FILE |
2582 | mov dword[ebx+4], 0 |
2583 | mov dword[ebx+4], 0 |
2583 | mov dword[ebx+8], 0 |
2584 | mov dword[ebx+8], 0 |
2584 | m2m dword[ebx+12], edx ;ç¨á«® ¡ ©â, ª®â®àë¥ ¬®£ãâ ¡ëâì áç¨â ë á ä ©« (¥ ¡®«ìè¥ ç¥¬ ted_max_chars) |
2585 | m2m dword[ebx+12], edx ;ç¨á«® ¡ ©â, ª®â®àë¥ ¬®£ãâ ¡ëâì áç¨â ë á ä ©« (¥ ¡®«ìè¥ ç¥¬ ted_max_chars) |
2585 | m2m dword[ebx+16], ted_tex |
2586 | m2m dword[ebx+16], ted_tex |
2586 | mov byte[ebx+20], 0 |
2587 | mov byte[ebx+20], 0 |
2587 | push dword[f_name] |
2588 | push dword[f_name] |
2588 | pop dword[ebx+21] |
2589 | pop dword[ebx+21] |
2589 | mcall SF_FILE |
2590 | mcall SF_FILE |
2590 | 2591 | ||
2591 | or eax,eax |
2592 | or eax,eax |
2592 | jz @f |
2593 | jz @f |
2593 | cmp eax,6 |
2594 | cmp eax,6 |
2594 | jne .ret_f |
2595 | jne .ret_f |
2595 | @@: |
2596 | @@: |
2596 | cmp ebx,-1 |
2597 | cmp ebx,-1 |
2597 | je .ret_f |
2598 | je .ret_f |
2598 | ;if open file |
2599 | ;if open file |
2599 | call ted_on_open_file |
2600 | call ted_on_open_file |
2600 | .ret_f: |
2601 | .ret_f: |
2601 | ret |
2602 | ret |
2602 | endp |
2603 | endp |
2603 | 2604 | ||
2604 | align 16 |
2605 | align 16 |
2605 | proc ted_but_select_word, edit:dword |
2606 | proc ted_but_select_word, edit:dword |
2606 | pushad |
2607 | pushad |
2607 | mov edi,[edit] |
2608 | mov edi,[edit] |
2608 | 2609 | ||
2609 | call ted_get_pos_by_cursor |
2610 | call ted_get_pos_by_cursor |
2610 | push edx |
2611 | push edx |
2611 | call ted_iterat_perv_color_tag |
2612 | call ted_iterat_perv_color_tag |
2612 | cmp edx,ted_tex_1 |
2613 | cmp edx,ted_tex_1 |
2613 | jle @f |
2614 | jle @f |
2614 | call ted_get_text_coords |
2615 | call ted_get_text_coords |
2615 | mov ted_sel_x0,ebx |
2616 | mov ted_sel_x0,ebx |
2616 | mov ted_sel_y0,eax |
2617 | mov ted_sel_y0,eax |
2617 | @@: |
2618 | @@: |
2618 | pop edx |
2619 | pop edx |
2619 | call ted_iterat_next_color_tag |
2620 | call ted_iterat_next_color_tag |
2620 | cmp edx,ted_tex_1 |
2621 | cmp edx,ted_tex_1 |
2621 | jle @f |
2622 | jle @f |
2622 | call ted_get_text_coords |
2623 | call ted_get_text_coords |
2623 | mov ted_sel_x1,ebx |
2624 | mov ted_sel_x1,ebx |
2624 | mov ted_sel_y1,eax |
2625 | mov ted_sel_y1,eax |
2625 | @@: |
2626 | @@: |
2626 | 2627 | ||
2627 | cmp ted_fun_draw_panel_buttons,0 |
2628 | cmp ted_fun_draw_panel_buttons,0 |
2628 | je @f |
2629 | je @f |
2629 | call ted_fun_draw_panel_buttons |
2630 | call ted_fun_draw_panel_buttons |
2630 | @@: |
2631 | @@: |
2631 | stdcall ted_draw,edi |
2632 | stdcall ted_draw,edi |
2632 | popad |
2633 | popad |
2633 | ret |
2634 | ret |
2634 | endp |
2635 | endp |
2635 | 2636 | ||
2636 | ;output: |
2637 | ;output: |
2637 | ; al = 1 if delete |
2638 | ; al = 1 if delete |
2638 | align 16 |
2639 | align 16 |
2639 | proc ted_but_cut uses edi, edit:dword |
2640 | proc ted_but_cut uses edi, edit:dword |
2640 | mov edi,[edit] |
2641 | mov edi,[edit] |
2641 | 2642 | ||
2642 | stdcall ted_but_copy,edi |
2643 | stdcall ted_but_copy,edi |
2643 | call ted_set_undo |
2644 | call ted_set_undo |
2644 | stdcall ted_sel_text_del,ted_opt_ed_change_time |
2645 | stdcall ted_sel_text_del,ted_opt_ed_change_time |
2645 | 2646 | ||
2646 | cmp al,1 |
2647 | cmp al,1 |
2647 | jne @f |
2648 | jne @f |
2648 | stdcall ted_draw,edi |
2649 | stdcall ted_draw,edi |
2649 | cmp ted_fun_draw_panel_buttons,0 |
2650 | cmp ted_fun_draw_panel_buttons,0 |
2650 | je @f |
2651 | je @f |
2651 | call ted_fun_draw_panel_buttons |
2652 | call ted_fun_draw_panel_buttons |
2652 | @@: |
2653 | @@: |
2653 | ret |
2654 | ret |
2654 | endp |
2655 | endp |
2655 | 2656 | ||
2656 | align 16 |
2657 | align 16 |
2657 | proc ted_but_copy, edit:dword |
2658 | proc ted_but_copy, edit:dword |
2658 | pushad |
2659 | pushad |
2659 | mov edi,[edit] |
2660 | mov edi,[edit] |
2660 | 2661 | ||
2661 | call ted_is_select |
2662 | call ted_is_select |
2662 | or al,al |
2663 | or al,al |
2663 | jz .end_f ;if not selected text |
2664 | jz .end_f ;if not selected text |
2664 | call ted_sel_normalize |
2665 | call ted_sel_normalize |
2665 | 2666 | ||
2666 | mov esi,ted_seln_x1 |
2667 | mov esi,ted_seln_x1 |
2667 | mov ecx,ted_seln_y1 |
2668 | mov ecx,ted_seln_y1 |
2668 | call ted_get_pos_by_coords |
2669 | call ted_get_pos_by_coords |
2669 | mov ebx,edx |
2670 | mov ebx,edx |
2670 | mov esi,ted_seln_x0 |
2671 | mov esi,ted_seln_x0 |
2671 | mov ecx,ted_seln_y0 |
2672 | mov ecx,ted_seln_y0 |
2672 | call ted_get_pos_by_coords |
2673 | call ted_get_pos_by_coords |
2673 | mov esi,ebx |
2674 | mov esi,ebx |
2674 | 2675 | ||
2675 | mov ecx,12 ;system buffer header size |
2676 | mov ecx,12 ;system buffer header size |
2676 | mov ebx,ted_buffer |
2677 | mov ebx,ted_buffer |
2677 | mov dword[ebx+4],0 ;text data |
2678 | mov dword[ebx+4],0 ;text data |
2678 | mov dword[ebx+8],1 ;code 866 |
2679 | mov dword[ebx+8],1 ;code 866 |
2679 | add ebx,ecx |
2680 | add ebx,ecx |
2680 | @@: |
2681 | @@: |
2681 | cmp edx,ted_tex_1 ;end of file |
2682 | cmp edx,ted_tex_1 ;end of file |
2682 | jle @f |
2683 | jle @f |
2683 | cmp edx,esi ;end of select |
2684 | cmp edx,esi ;end of select |
2684 | je @f |
2685 | je @f |
2685 | inc ecx |
2686 | inc ecx |
2686 | cmp ecx,ted_buffer_size ;owerflow bufer |
2687 | cmp ecx,ted_buffer_size ;owerflow bufer |
2687 | je @f |
2688 | je @f |
2688 | 2689 | ||
2689 | mov al,byte[edx] |
2690 | mov al,byte[edx] |
2690 | mov byte[ebx],al |
2691 | mov byte[ebx],al |
2691 | inc ebx |
2692 | inc ebx |
2692 | cmp al,13 |
2693 | cmp al,13 |
2693 | jne .no_13 |
2694 | jne .no_13 |
2694 | mov byte[ebx],10 ;¤¥« ¥¬ ª®¥æ áâப¨ ¢ ¡ãä¥à¥ 13,10 ¤«ï ᮢ¬¥á⨬®áâ¨ á ¤à㣨¬¨ ¯à®£à ¬¬ ¬¨ |
2695 | mov byte[ebx],10 ;¤¥« ¥¬ ª®¥æ áâப¨ ¢ ¡ãä¥à¥ 13,10 ¤«ï ᮢ¬¥á⨬®áâ¨ á ¤à㣨¬¨ ¯à®£à ¬¬ ¬¨ |
2695 | inc ebx |
2696 | inc ebx |
2696 | inc ecx |
2697 | inc ecx |
2697 | .no_13: |
2698 | .no_13: |
2698 | 2699 | ||
2699 | call ted_iterat_next |
2700 | call ted_iterat_next |
2700 | jmp @b |
2701 | jmp @b |
2701 | @@: |
2702 | @@: |
2702 | mov byte[ebx],0 |
2703 | mov byte[ebx],0 |
2703 | 2704 | ||
2704 | cmp ecx,12 |
2705 | cmp ecx,12 |
2705 | je .end_f |
2706 | je .end_f |
2706 | mov ebx,ted_buffer |
2707 | mov ebx,ted_buffer |
2707 | mov [ebx],ecx |
2708 | mov [ebx],ecx |
2708 | mcall SF_CLIPBOARD,SSF_WRITE_CB,ecx,ted_buffer |
2709 | mcall SF_CLIPBOARD,SSF_WRITE_CB,ecx,ted_buffer |
2709 | call ted_draw_buffer |
2710 | call ted_draw_buffer |
2710 | cmp ted_fun_draw_panel_buttons,0 |
2711 | cmp ted_fun_draw_panel_buttons,0 |
2711 | je .end_f |
2712 | je .end_f |
2712 | call ted_fun_draw_panel_buttons |
2713 | call ted_fun_draw_panel_buttons |
2713 | .end_f: |
2714 | .end_f: |
2714 | popad |
2715 | popad |
2715 | ret |
2716 | ret |
2716 | endp |
2717 | endp |
2717 | 2718 | ||
2718 | 2719 | ||
2719 | align 16 |
2720 | align 16 |
2720 | proc ted_but_paste, edit:dword |
2721 | proc ted_but_paste, edit:dword |
2721 | pushad |
2722 | pushad |
2722 | mov edi,[edit] |
2723 | mov edi,[edit] |
2723 | 2724 | ||
2724 | mcall SF_CLIPBOARD,SSF_GET_SLOT_COUNT |
2725 | mcall SF_CLIPBOARD,SSF_GET_SLOT_COUNT |
2725 | cmp eax,1 |
2726 | cmp eax,1 |
2726 | jl .no_buf_r |
2727 | jl .no_buf_r |
2727 | 2728 | ||
2728 | mov esi,eax |
2729 | mov esi,eax |
2729 | .cycle: ;®¡à âë© æ¨ª« ¯® ᫮⠬ |
2730 | .cycle: ;®¡à âë© æ¨ª« ¯® ᫮⠬ |
2730 | dec esi ;®¬¥à ⥪ã饣®, ¯à®¢¥à塞®£® á«®â |
2731 | dec esi ;®¬¥à ⥪ã饣®, ¯à®¢¥à塞®£® á«®â |
2731 | mcall SF_CLIPBOARD,SSF_READ_CB,esi |
2732 | mcall SF_CLIPBOARD,SSF_READ_CB,esi |
2732 | cmp eax,1 |
2733 | cmp eax,1 |
2733 | je .no_buf_r |
2734 | je .no_buf_r |
2734 | cmp eax,-1 |
2735 | cmp eax,-1 |
2735 | je .no_buf_r |
2736 | je .no_buf_r |
2736 | mov ecx,[eax] |
2737 | mov ecx,[eax] |
2737 | cmp ecx,1 ;size |
2738 | cmp ecx,1 ;size |
2738 | jl .no_buf_r |
2739 | jl .no_buf_r |
2739 | cmp dword[eax+4],0 ;text |
2740 | cmp dword[eax+4],0 ;text |
2740 | je @f |
2741 | je @f |
2741 | cmp esi,1 |
2742 | cmp esi,1 |
2742 | jge .cycle ;¥á«¨ ¢ ¡ãä¥à¥ ¥ ⥪áâ, ᫮⮢ ¢ ¡ãä¥à¥ ¥áª®«ìª®, ¯à®¡ã¥¬ ¯¥à¥©â¨ ª ¢¥à奬ã á«®âã |
2743 | jge .cycle ;¥á«¨ ¢ ¡ãä¥à¥ ¥ ⥪áâ, ᫮⮢ ¢ ¡ãä¥à¥ ¥áª®«ìª®, ¯à®¡ã¥¬ ¯¥à¥©â¨ ª ¢¥à奬ã á«®âã |
2743 | jmp .no_buf_r |
2744 | jmp .no_buf_r |
2744 | @@: |
2745 | @@: |
2745 | cmp dword[eax+8],1 ;866 |
2746 | cmp dword[eax+8],1 ;866 |
2746 | je @f |
2747 | je @f |
2747 | cmp esi,1 |
2748 | cmp esi,1 |
2748 | jge .cycle ;¥á«¨ ¢ ¡ãä¥à¥ ⥪áâ ¥ ¢ ª®¤¨à®¢ª¥ 866 ... ¯à®¡ã¥¬ ¯¥à¥©â¨ ª ¢¥à奬ã á«®âã |
2749 | jge .cycle ;¥á«¨ ¢ ¡ãä¥à¥ ⥪áâ ¥ ¢ ª®¤¨à®¢ª¥ 866 ... ¯à®¡ã¥¬ ¯¥à¥©â¨ ª ¢¥à奬ã á«®âã |
2749 | jmp .no_buf_r |
2750 | jmp .no_buf_r |
2750 | @@: |
2751 | @@: |
2751 | ;ª®¯¨à®¢ ¨¥ ⥪áâ ¨§ á¨á⥬®£® ¡ãä¥à ¢® ¢ãâ२© |
2752 | ;ª®¯¨à®¢ ¨¥ ⥪áâ ¨§ á¨á⥬®£® ¡ãä¥à ¢® ¢ãâ२© |
2752 | cmp ecx,ted_buffer_size |
2753 | cmp ecx,ted_buffer_size |
2753 | jle @f |
2754 | jle @f |
2754 | mov ecx,ted_buffer_size |
2755 | mov ecx,ted_buffer_size |
2755 | @@: |
2756 | @@: |
2756 | mov edi,ted_buffer |
2757 | mov edi,ted_buffer |
2757 | mov esi,eax |
2758 | mov esi,eax |
2758 | add esi,4 ;12 |
2759 | add esi,4 ;12 |
2759 | mov dword[edi],ecx |
2760 | mov dword[edi],ecx |
2760 | add edi,4 ;12 |
2761 | add edi,4 ;12 |
2761 | sub ecx,4 ;12 |
2762 | sub ecx,4 ;12 |
2762 | rep movsb |
2763 | rep movsb |
2763 | mov edi,[edit] |
2764 | mov edi,[edit] |
2764 | 2765 | ||
2765 | mov esi,eax |
2766 | mov esi,eax |
2766 | add esi,12 |
2767 | add esi,12 |
2767 | jmp .buf_r |
2768 | jmp .buf_r |
2768 | .no_buf_r: |
2769 | .no_buf_r: |
2769 | 2770 | ||
2770 | ;¥á«¨ ¥ 㤠«®áì ¯à®ç¨â âì ¤ ë¥ ¨§ á¨á⥬®£® ¡ãä¥à , ¯®¯ ¤ ¥¬ áî¤ |
2771 | ;¥á«¨ ¥ 㤠«®áì ¯à®ç¨â âì ¤ ë¥ ¨§ á¨á⥬®£® ¡ãä¥à , ¯®¯ ¤ ¥¬ áî¤ |
2771 | mov esi,ted_buffer |
2772 | mov esi,ted_buffer |
2772 | cmp dword[esi],1 ;¯à®¢¥à塞 ¥áâì «¨ ¤ ë¥ ¢® ¢ãâ॥¬ ¡ãä¥à¥ |
2773 | cmp dword[esi],1 ;¯à®¢¥à塞 ¥áâì «¨ ¤ ë¥ ¢® ¢ãâ॥¬ ¡ãä¥à¥ |
2773 | jl .no_paste ;¥á«¨ ¢®®¡é¥ ¨ç¥£® ¥ 㤠«®áì ¯à®ç¨â âì ¨¤¥¬ ¢ë室 |
2774 | jl .no_paste ;¥á«¨ ¢®®¡é¥ ¨ç¥£® ¥ 㤠«®áì ¯à®ç¨â âì ¨¤¥¬ ¢ë室 |
2774 | add esi,12 ;system buffer header size |
2775 | add esi,12 ;system buffer header size |
2775 | .buf_r: |
2776 | .buf_r: |
2776 | 2777 | ||
2777 | mov edx,esi |
2778 | mov edx,esi |
2778 | call tl_strlen |
2779 | call tl_strlen |
2779 | cmp eax,1 |
2780 | cmp eax,1 |
2780 | jl .no_paste |
2781 | jl .no_paste |
2781 | mov esi,eax |
2782 | mov esi,eax |
2782 | call ted_set_undo |
2783 | call ted_set_undo |
2783 | mov ebx,ted_opt_ed_change_time+ted_opt_ed_move_cursor |
2784 | mov ebx,ted_opt_ed_change_time+ted_opt_ed_move_cursor |
2784 | stdcall ted_sel_text_del,ebx |
2785 | stdcall ted_sel_text_del,ebx |
2785 | cmp al,1 |
2786 | cmp al,1 |
2786 | jne .del |
2787 | jne .del |
2787 | mov ebx,ted_opt_ed_move_cursor |
2788 | mov ebx,ted_opt_ed_move_cursor |
2788 | .del: |
2789 | .del: |
2789 | stdcall ted_text_add,edi,edx,esi,ebx |
2790 | stdcall ted_text_add,edi,edx,esi,ebx |
2790 | stdcall ted_draw,edi |
2791 | stdcall ted_draw,edi |
2791 | cmp ted_fun_draw_panel_buttons,0 |
2792 | cmp ted_fun_draw_panel_buttons,0 |
2792 | je .no_paste |
2793 | je .no_paste |
2793 | call ted_fun_draw_panel_buttons |
2794 | call ted_fun_draw_panel_buttons |
2794 | .no_paste: |
2795 | .no_paste: |
2795 | popad |
2796 | popad |
2796 | ret |
2797 | ret |
2797 | endp |
2798 | endp |
2798 | 2799 | ||
2799 | align 16 |
2800 | align 16 |
2800 | proc ted_but_sumb_upper uses edi esi, edit:dword |
2801 | proc ted_but_sumb_upper uses edi esi, edit:dword |
2801 | mov edi,[edit] |
2802 | mov edi,[edit] |
2802 | 2803 | ||
2803 | stdcall ted_convert_sel_text,fb_char_toupper |
2804 | stdcall ted_convert_sel_text,fb_char_toupper |
2804 | or esi,esi |
2805 | or esi,esi |
2805 | jz @f |
2806 | jz @f |
2806 | stdcall ted_draw,edi |
2807 | stdcall ted_draw,edi |
2807 | @@: |
2808 | @@: |
2808 | ret |
2809 | ret |
2809 | endp |
2810 | endp |
2810 | 2811 | ||
2811 | align 16 |
2812 | align 16 |
2812 | proc ted_but_sumb_lover uses edi esi, edit:dword |
2813 | proc ted_but_sumb_lover uses edi esi, edit:dword |
2813 | mov edi,[edit] |
2814 | mov edi,[edit] |
2814 | 2815 | ||
2815 | stdcall ted_convert_sel_text,fb_char_todown |
2816 | stdcall ted_convert_sel_text,fb_char_todown |
2816 | or esi,esi |
2817 | or esi,esi |
2817 | jz @f |
2818 | jz @f |
2818 | stdcall ted_draw,edi |
2819 | stdcall ted_draw,edi |
2819 | @@: |
2820 | @@: |
2820 | ret |
2821 | ret |
2821 | endp |
2822 | endp |
2822 | 2823 | ||
2823 | align 16 |
2824 | align 16 |
2824 | proc ted_but_reverse uses eax ebx edi, edit:dword |
2825 | proc ted_but_reverse uses eax ebx edi, edit:dword |
2825 | mov edi,[edit] |
2826 | mov edi,[edit] |
2826 | 2827 | ||
2827 | call ted_is_select |
2828 | call ted_is_select |
2828 | or al,al |
2829 | or al,al |
2829 | jz @f |
2830 | jz @f |
2830 | call ted_sel_normalize |
2831 | call ted_sel_normalize |
2831 | push esi ecx edx |
2832 | push esi ecx edx |
2832 | mov esi,ted_seln_x0 |
2833 | mov esi,ted_seln_x0 |
2833 | mov ecx,ted_seln_y0 |
2834 | mov ecx,ted_seln_y0 |
2834 | call ted_get_pos_by_coords |
2835 | call ted_get_pos_by_coords |
2835 | mov eax,edx |
2836 | mov eax,edx |
2836 | mov esi,ted_seln_x1 |
2837 | mov esi,ted_seln_x1 |
2837 | cmp esi,0 |
2838 | cmp esi,0 |
2838 | je .beg_str |
2839 | je .beg_str |
2839 | dec esi |
2840 | dec esi |
2840 | .beg_str: |
2841 | .beg_str: |
2841 | mov ecx,ted_seln_y1 |
2842 | mov ecx,ted_seln_y1 |
2842 | call ted_get_pos_by_coords |
2843 | call ted_get_pos_by_coords |
2843 | ;call ted_get_text_perv_pos |
2844 | ;call ted_get_text_perv_pos |
2844 | mov ebx,edx |
2845 | mov ebx,edx |
2845 | pop edx ecx esi |
2846 | pop edx ecx esi |
2846 | ;cmp eax,... |
2847 | ;cmp eax,... |
2847 | ;je @f |
2848 | ;je @f |
2848 | call ted_revers |
2849 | call ted_revers |
2849 | @@: |
2850 | @@: |
2850 | stdcall ted_draw,edi |
2851 | stdcall ted_draw,edi |
2851 | ret |
2852 | ret |
2852 | endp |
2853 | endp |
2853 | 2854 | ||
2854 | align 16 |
2855 | align 16 |
2855 | proc ted_but_undo uses eax edi, edit:dword |
2856 | proc ted_but_undo uses eax edi, edit:dword |
2856 | mov edi,[edit] |
2857 | mov edi,[edit] |
2857 | 2858 | ||
2858 | mov eax,ted_tim_undo |
2859 | mov eax,ted_tim_undo |
2859 | cmp ted_tim_ch,eax |
2860 | cmp ted_tim_ch,eax |
2860 | jbe @f |
2861 | jbe @f |
2861 | inc ted_tim_undo |
2862 | inc ted_tim_undo |
2862 | ;call ted_text_colored |
2863 | ;call ted_text_colored |
2863 | stdcall ted_draw,edi |
2864 | stdcall ted_draw,edi |
2864 | cmp ted_fun_draw_panel_buttons,0 |
2865 | cmp ted_fun_draw_panel_buttons,0 |
2865 | je @f |
2866 | je @f |
2866 | call ted_fun_draw_panel_buttons |
2867 | call ted_fun_draw_panel_buttons |
2867 | @@: |
2868 | @@: |
2868 | ret |
2869 | ret |
2869 | endp |
2870 | endp |
2870 | 2871 | ||
2871 | align 16 |
2872 | align 16 |
2872 | proc ted_but_redo uses edi, edit:dword |
2873 | proc ted_but_redo uses edi, edit:dword |
2873 | mov edi,[edit] |
2874 | mov edi,[edit] |
2874 | 2875 | ||
2875 | cmp ted_tim_undo,1 |
2876 | cmp ted_tim_undo,1 |
2876 | jb @f |
2877 | jb @f |
2877 | dec ted_tim_undo |
2878 | dec ted_tim_undo |
2878 | ;call ted_text_colored |
2879 | ;call ted_text_colored |
2879 | stdcall ted_draw,edi |
2880 | stdcall ted_draw,edi |
2880 | cmp ted_fun_draw_panel_buttons,0 |
2881 | cmp ted_fun_draw_panel_buttons,0 |
2881 | je @f |
2882 | je @f |
2882 | call ted_fun_draw_panel_buttons |
2883 | call ted_fun_draw_panel_buttons |
2883 | @@: |
2884 | @@: |
2884 | ret |
2885 | ret |
2885 | endp |
2886 | endp |
2886 | 2887 | ||
2887 | ;description: |
2888 | ;description: |
2888 | ; äãªæ¨ï 室¨â ⥪áâ ª®â®àë© ãª §ë¢ ¥â ted_buffer_find |
2889 | ; äãªæ¨ï 室¨â ⥪áâ ª®â®àë© ãª §ë¢ ¥â ted_buffer_find |
2889 | ;input: |
2890 | ;input: |
2890 | ; f_opt = ¯ à ¬¥âàë ¯®¨áª : |
2891 | ; f_opt = ¯ à ¬¥âàë ¯®¨áª : |
2891 | ; (0 - ¨áª âì ¨¦¥ ªãàá®à , 1 - ¨áª âì ¢ëè¥ ªãàá®à , 2 - ¨áª âì ®â ç « ä ©« ) |
2892 | ; (0 - ¨áª âì ¨¦¥ ªãàá®à , 1 - ¨áª âì ¢ëè¥ ªãàá®à , 2 - ¨áª âì ®â ç « ä ©« ) |
2892 | ; ¥á«¨ ãáâ ®¢«¥ 31-© ¡¨â, â® ¥ ®¡®¢«ï¥âáï ®ª® |
2893 | ; ¥á«¨ ãáâ ®¢«¥ 31-© ¡¨â, â® ¥ ®¡®¢«ï¥âáï ®ª® |
2893 | ; ¥á«¨ ãáâ ®¢«¥ 30-© ¡¨â, â® ¯®¨áª ¨¤¥â ¡¥§ ãç¥â ॣ¨áâà ᨬ¢®«®¢ |
2894 | ; ¥á«¨ ãáâ ®¢«¥ 30-© ¡¨â, â® ¯®¨áª ¨¤¥â ¡¥§ ãç¥â ॣ¨áâà ᨬ¢®«®¢ |
2894 | ;output: |
2895 | ;output: |
2895 | ; eax = ¡ë« «¨ ©¤¥ ¨áª®¬ë© ⥪áâ (0 - ¥â, 1 - ¤ ) |
2896 | ; eax = ¡ë« «¨ ©¤¥ ¨áª®¬ë© ⥪áâ (0 - ¥â, 1 - ¤ ) |
2896 | align 16 |
2897 | align 16 |
2897 | proc ted_but_find uses ebx ecx edx edi esi, edit:dword, f_opt:dword |
2898 | proc ted_but_find uses ebx ecx edx edi esi, edit:dword, f_opt:dword |
2898 | mov eax,[f_opt] |
2899 | mov eax,[f_opt] |
2899 | push eax |
2900 | push eax |
2900 | push [edit] |
2901 | push [edit] |
2901 | cmp al,2 |
2902 | cmp al,2 |
2902 | jne @f |
2903 | jne @f |
2903 | call _but_find_first |
2904 | call _but_find_first |
2904 | jmp .end0 |
2905 | jmp .end0 |
2905 | @@: |
2906 | @@: |
2906 | cmp al,0 |
2907 | cmp al,0 |
2907 | jne @f |
2908 | jne @f |
2908 | call _but_find_next |
2909 | call _but_find_next |
2909 | jmp .end0 |
2910 | jmp .end0 |
2910 | @@: |
2911 | @@: |
2911 | cmp al,1 |
2912 | cmp al,1 |
2912 | jne @f |
2913 | jne @f |
2913 | call _but_find_perv |
2914 | call _but_find_perv |
2914 | jmp .end0 |
2915 | jmp .end0 |
2915 | @@: |
2916 | @@: |
2916 | add esp,8 |
2917 | add esp,8 |
2917 | .end0: |
2918 | .end0: |
2918 | 2919 | ||
2919 | bt dword[f_opt],31 |
2920 | bt dword[f_opt],31 |
2920 | jc .end1 |
2921 | jc .end1 |
2921 | or eax,eax |
2922 | or eax,eax |
2922 | jz @f |
2923 | jz @f |
2923 | ;⥪áâ ©¤¥, ®¡®¢«ï¥¬ ®ª® |
2924 | ;⥪áâ ©¤¥, ®¡®¢«ï¥¬ ®ª® |
2924 | stdcall ted_draw,edi |
2925 | stdcall ted_draw,edi |
2925 | jmp .end1 |
2926 | jmp .end1 |
2926 | @@: |
2927 | @@: |
2927 | ;⥪áâ ¥ ©¤¥, ¯à®¡ã¥¬ ¢ë§¢ âì á®®¡é¥¨¥ |
2928 | ;⥪áâ ¥ ©¤¥, ¯à®¡ã¥¬ ¢ë§¢ âì á®®¡é¥¨¥ |
2928 | cmp ted_fun_find_err,0 |
2929 | cmp ted_fun_find_err,0 |
2929 | je .end1 |
2930 | je .end1 |
2930 | call ted_fun_find_err ;¯®«ì§®¢ ⥫ì᪠ï äãªæ¨ï |
2931 | call ted_fun_find_err ;¯®«ì§®¢ ⥫ì᪠ï äãªæ¨ï |
2931 | .end1: |
2932 | .end1: |
2932 | ret |
2933 | ret |
2933 | endp |
2934 | endp |
2934 | 2935 | ||
2935 | ;description: |
2936 | ;description: |
2936 | ; äãªæ¨ï 室¨â ⥪áâ ®â ç « ä ©« , ¨«¨ ®â ª®æ ⥪ã饣® ¢ë¤¥«¥¨ï |
2937 | ; äãªæ¨ï 室¨â ⥪áâ ®â ç « ä ©« , ¨«¨ ®â ª®æ ⥪ã饣® ¢ë¤¥«¥¨ï |
2937 | ;input: |
2938 | ;input: |
2938 | ; f_opt = ®¯æ¨¨ ¤«ï ¯®¨áª |
2939 | ; f_opt = ®¯æ¨¨ ¤«ï ¯®¨áª |
2939 | ;output: |
2940 | ;output: |
2940 | ; eax = ¡ë« «¨ ©¤¥ ¨áª®¬ë© ⥪áâ (0 - ¥â, 1 - ¤ ) |
2941 | ; eax = ¡ë« «¨ ©¤¥ ¨áª®¬ë© ⥪áâ (0 - ¥â, 1 - ¤ ) |
2941 | ; ebx, ecx, edx, edi, edi - ¯®àâïâáï |
2942 | ; ebx, ecx, edx, edi, edi - ¯®àâïâáï |
2942 | align 16 |
2943 | align 16 |
2943 | proc _but_find_first, edit:dword, f_opt:dword |
2944 | proc _but_find_first, edit:dword, f_opt:dword |
2944 | mov edi,[edit] |
2945 | mov edi,[edit] |
2945 | 2946 | ||
2946 | call ted_is_select |
2947 | call ted_is_select |
2947 | or al,al |
2948 | or al,al |
2948 | jz @f |
2949 | jz @f |
2949 | call ted_sel_normalize |
2950 | call ted_sel_normalize |
2950 | mov edx,ted_sel_y1 |
2951 | mov edx,ted_sel_y1 |
2951 | mov ecx,ted_sel_x1 |
2952 | mov ecx,ted_sel_x1 |
2952 | call ted_go_to_pos ;¯¥à¥å®¤ ª®¥æ ¢ë¤¥«¥¨ï |
2953 | call ted_go_to_pos ;¯¥à¥å®¤ ª®¥æ ¢ë¤¥«¥¨ï |
2953 | call ted_get_pos_by_cursor |
2954 | call ted_get_pos_by_cursor |
2954 | jmp .end0 |
2955 | jmp .end0 |
2955 | @@: |
2956 | @@: |
2956 | mov edx,ted_tex |
2957 | mov edx,ted_tex |
2957 | call ted_iterat_next |
2958 | call ted_iterat_next |
2958 | .end0: |
2959 | .end0: |
2959 | mov ebx,ted_buffer_find |
2960 | mov ebx,ted_buffer_find |
2960 | @@: |
2961 | @@: |
2961 | mov eax,[f_opt] |
2962 | mov eax,[f_opt] |
2962 | call ted_get_find_rezult |
2963 | call ted_get_find_rezult |
2963 | cmp ah,1 |
2964 | cmp ah,1 |
2964 | je @f ; find |
2965 | je @f ; find |
2965 | call ted_iterat_next |
2966 | call ted_iterat_next |
2966 | cmp edx,ted_tex_1 |
2967 | cmp edx,ted_tex_1 |
2967 | jle @f |
2968 | jle @f |
2968 | jmp @b |
2969 | jmp @b |
2969 | @@: |
2970 | @@: |
2970 | call _but_find_select |
2971 | call _but_find_select |
2971 | ret |
2972 | ret |
2972 | endp |
2973 | endp |
2973 | 2974 | ||
2974 | ;description: |
2975 | ;description: |
2975 | ; äãªæ¨ï 室¨â ⥪áâ ¢ëè¥ ªãàá®à |
2976 | ; äãªæ¨ï 室¨â ⥪áâ ¢ëè¥ ªãàá®à |
2976 | ;input: |
2977 | ;input: |
2977 | ; f_opt = ®¯æ¨¨ ¤«ï ¯®¨áª |
2978 | ; f_opt = ®¯æ¨¨ ¤«ï ¯®¨áª |
2978 | ;output: |
2979 | ;output: |
2979 | ; eax = ¡ë« «¨ ©¤¥ ¨áª®¬ë© ⥪áâ (0 - ¥â, 1 - ¤ ) |
2980 | ; eax = ¡ë« «¨ ©¤¥ ¨áª®¬ë© ⥪áâ (0 - ¥â, 1 - ¤ ) |
2980 | ; ebx, ecx, edx, edi, edi - ¯®àâïâáï |
2981 | ; ebx, ecx, edx, edi, edi - ¯®àâïâáï |
2981 | align 16 |
2982 | align 16 |
2982 | proc _but_find_perv, edit:dword, f_opt:dword |
2983 | proc _but_find_perv, edit:dword, f_opt:dword |
2983 | mov edi,[edit] |
2984 | mov edi,[edit] |
2984 | 2985 | ||
2985 | call ted_is_select |
2986 | call ted_is_select |
2986 | or al,al |
2987 | or al,al |
2987 | jz @f |
2988 | jz @f |
2988 | call ted_sel_normalize |
2989 | call ted_sel_normalize |
2989 | mov edx,ted_sel_y0 |
2990 | mov edx,ted_sel_y0 |
2990 | mov ecx,ted_sel_x0 |
2991 | mov ecx,ted_sel_x0 |
2991 | call ted_go_to_pos ;¯¥à¥å®¤ ç «® ¢ë¤¥«¥¨ï |
2992 | call ted_go_to_pos ;¯¥à¥å®¤ ç «® ¢ë¤¥«¥¨ï |
2992 | call ted_get_pos_by_cursor |
2993 | call ted_get_pos_by_cursor |
2993 | call ted_iterat_perv ;¯¥à¥å®¤ 1-© ᨬ¢®« ¯¥à¥¤ ¢ë¤¥«¥¨¥¬ |
2994 | call ted_iterat_perv ;¯¥à¥å®¤ 1-© ᨬ¢®« ¯¥à¥¤ ¢ë¤¥«¥¨¥¬ |
2994 | jmp .end0 |
2995 | jmp .end0 |
2995 | @@: |
2996 | @@: |
2996 | call ted_get_pos_by_cursor |
2997 | call ted_get_pos_by_cursor |
2997 | .end0: |
2998 | .end0: |
2998 | mov ebx,ted_buffer_find |
2999 | mov ebx,ted_buffer_find |
2999 | @@: |
3000 | @@: |
3000 | mov eax,[f_opt] |
3001 | mov eax,[f_opt] |
3001 | call ted_get_find_rezult |
3002 | call ted_get_find_rezult |
3002 | cmp ah,1 |
3003 | cmp ah,1 |
3003 | je @f ; find |
3004 | je @f ; find |
3004 | call ted_iterat_perv |
3005 | call ted_iterat_perv |
3005 | cmp edx,ted_tex_1 |
3006 | cmp edx,ted_tex_1 |
3006 | jle @f |
3007 | jle @f |
3007 | jmp @b |
3008 | jmp @b |
3008 | @@: |
3009 | @@: |
3009 | call _but_find_select |
3010 | call _but_find_select |
3010 | ret |
3011 | ret |
3011 | endp |
3012 | endp |
3012 | 3013 | ||
3013 | ;description: |
3014 | ;description: |
3014 | ; äãªæ¨ï 室¨â ⥪áâ ¨¦¥ ªãàá®à |
3015 | ; äãªæ¨ï 室¨â ⥪áâ ¨¦¥ ªãàá®à |
3015 | ;input: |
3016 | ;input: |
3016 | ; f_opt = ®¯æ¨¨ ¤«ï ¯®¨áª |
3017 | ; f_opt = ®¯æ¨¨ ¤«ï ¯®¨áª |
3017 | ;output: |
3018 | ;output: |
3018 | ; eax = ¡ë« «¨ ©¤¥ ¨áª®¬ë© ⥪áâ (0 - ¥â, 1 - ¤ ) |
3019 | ; eax = ¡ë« «¨ ©¤¥ ¨áª®¬ë© ⥪áâ (0 - ¥â, 1 - ¤ ) |
3019 | ; ebx, ecx, edx, edi, esi - ¯®àâïâáï |
3020 | ; ebx, ecx, edx, edi, esi - ¯®àâïâáï |
3020 | align 16 |
3021 | align 16 |
3021 | proc _but_find_next, edit:dword, f_opt:dword |
3022 | proc _but_find_next, edit:dword, f_opt:dword |
3022 | mov edi,[edit] |
3023 | mov edi,[edit] |
3023 | 3024 | ||
3024 | call ted_get_pos_by_cursor |
3025 | call ted_get_pos_by_cursor |
3025 | mov ebx,ted_buffer_find |
3026 | mov ebx,ted_buffer_find |
3026 | @@: |
3027 | @@: |
3027 | mov eax,[f_opt] |
3028 | mov eax,[f_opt] |
3028 | call ted_get_find_rezult |
3029 | call ted_get_find_rezult |
3029 | cmp ah,1 |
3030 | cmp ah,1 |
3030 | je @f ; find |
3031 | je @f ; find |
3031 | call ted_iterat_next |
3032 | call ted_iterat_next |
3032 | cmp edx,ted_tex_1 |
3033 | cmp edx,ted_tex_1 |
3033 | jle @f |
3034 | jle @f |
3034 | jmp @b |
3035 | jmp @b |
3035 | @@: |
3036 | @@: |
3036 | call _but_find_select |
3037 | call _but_find_select |
3037 | ret |
3038 | ret |
3038 | endp |
3039 | endp |
3039 | 3040 | ||
3040 | ;description: |
3041 | ;description: |
3041 | ; ¢á¯®¬®£ ⥫ì ï äãªæ¨ï, ¢ë¤¥«ï¥â ©¤¥ë© ⥪áâ |
3042 | ; ¢á¯®¬®£ ⥫ì ï äãªæ¨ï, ¢ë¤¥«ï¥â ©¤¥ë© ⥪áâ |
3042 | ;input: |
3043 | ;input: |
3043 | ; ah = ¡ë« «¨ ©¤¥ ¨áª®¬ë© ⥪áâ (0 - ¥â, 1 - ¤ ) |
3044 | ; ah = ¡ë« «¨ ©¤¥ ¨áª®¬ë© ⥪áâ (0 - ¥â, 1 - ¤ ) |
3044 | ; esi = first symbol pointer |
3045 | ; esi = first symbol pointer |
3045 | align 16 |
3046 | align 16 |
3046 | _but_find_select: |
3047 | _but_find_select: |
3047 | or ah,ah |
3048 | or ah,ah |
3048 | jz @f |
3049 | jz @f |
3049 | call ted_get_text_coords |
3050 | call ted_get_text_coords |
3050 | inc ebx ;move cursor right |
3051 | inc ebx ;move cursor right |
3051 | mov ted_sel_x1,ebx |
3052 | mov ted_sel_x1,ebx |
3052 | mov ted_sel_y1,eax |
3053 | mov ted_sel_y1,eax |
3053 | mov edx,eax |
3054 | mov edx,eax |
3054 | mov ecx,ebx |
3055 | mov ecx,ebx |
3055 | call ted_go_to_pos |
3056 | call ted_go_to_pos |
3056 | mov edx,esi |
3057 | mov edx,esi |
3057 | call ted_get_text_coords |
3058 | call ted_get_text_coords |
3058 | mov ted_sel_x0,ebx |
3059 | mov ted_sel_x0,ebx |
3059 | mov ted_sel_y0,eax |
3060 | mov ted_sel_y0,eax |
3060 | xor eax,eax |
3061 | xor eax,eax |
3061 | inc eax |
3062 | inc eax |
3062 | jmp .end0 |
3063 | jmp .end0 |
3063 | @@: |
3064 | @@: |
3064 | xor eax,eax ;⥪áâ ¥ ©¤¥ |
3065 | xor eax,eax ;⥪áâ ¥ ©¤¥ |
3065 | .end0: |
3066 | .end0: |
3066 | ret |
3067 | ret |
3067 | 3068 | ||
3068 | ;input: |
3069 | ;input: |
3069 | ; rpl_text = ⥪áâ ¤«ï § ¬¥ë |
3070 | ; rpl_text = ⥪áâ ¤«ï § ¬¥ë |
3070 | ; r_opt = ¯ à ¬¥âàë ¯®¨áª : |
3071 | ; r_opt = ¯ à ¬¥âàë ¯®¨áª : |
3071 | ; (0 - ¨áª âì ¨¦¥ ªãàá®à , 1 - ¨áª âì ¢ëè¥ ªãàá®à , 2 - ¨áª âì ®â ç « ä ©« ) |
3072 | ; (0 - ¨áª âì ¨¦¥ ªãàá®à , 1 - ¨áª âì ¢ëè¥ ªãàá®à , 2 - ¨áª âì ®â ç « ä ©« ) |
3072 | ; n_tim = 䨪á¨à®¢ âì § ¬¥ã ¢ ¨§¬¥¥¨ïå (0 - ¥â, 1 - ¤ ) |
3073 | ; n_tim = 䨪á¨à®¢ âì § ¬¥ã ¢ ¨§¬¥¥¨ïå (0 - ¥â, 1 - ¤ ) |
3073 | ;output: |
3074 | ;output: |
3074 | ; eax = 0 - ¥ 㤠ç®, 1 - ã¤ ç® |
3075 | ; eax = 0 - ¥ 㤠ç®, 1 - ã¤ ç® |
3075 | align 16 |
3076 | align 16 |
3076 | proc ted_but_replace uses edx edi esi, edit:dword, rpl_text:dword, r_opt:dword, n_tim:dword |
3077 | proc ted_but_replace uses edx edi esi, edit:dword, rpl_text:dword, r_opt:dword, n_tim:dword |
3077 | mov edi,[edit] |
3078 | mov edi,[edit] |
3078 | mov eax,[r_opt] |
3079 | mov eax,[r_opt] |
3079 | bts eax,31 |
3080 | bts eax,31 |
3080 | stdcall ted_but_find, edi,eax |
3081 | stdcall ted_but_find, edi,eax |
3081 | or eax,eax |
3082 | or eax,eax |
3082 | jz .end0 |
3083 | jz .end0 |
3083 | 3084 | ||
3084 | xor edx,edx |
3085 | xor edx,edx |
3085 | cmp dword[n_tim],0 |
3086 | cmp dword[n_tim],0 |
3086 | je @f |
3087 | je @f |
3087 | call ted_set_undo |
3088 | call ted_set_undo |
3088 | mov edx,ted_opt_ed_change_time |
3089 | mov edx,ted_opt_ed_change_time |
3089 | @@: |
3090 | @@: |
3090 | stdcall ted_sel_text_del, edx |
3091 | stdcall ted_sel_text_del, edx |
3091 | or eax,0xff |
3092 | or eax,0xff |
3092 | jz .end0 |
3093 | jz .end0 |
3093 | mov esi,[rpl_text] |
3094 | mov esi,[rpl_text] |
3094 | stdcall tl_strlen |
3095 | stdcall tl_strlen |
3095 | or eax,eax |
3096 | or eax,eax |
3096 | jz .end0 |
3097 | jz .end0 |
3097 | stdcall ted_text_add, edi,esi,eax,ted_opt_ed_move_cursor |
3098 | stdcall ted_text_add, edi,esi,eax,ted_opt_ed_move_cursor |
3098 | xor eax,eax |
3099 | xor eax,eax |
3099 | inc eax |
3100 | inc eax |
3100 | .end0: |
3101 | .end0: |
3101 | ret |
3102 | ret |
3102 | endp |
3103 | endp |
3103 | 3104 | ||
3104 | ;description: |
3105 | ;description: |
3105 | ; ãªæ¨ï ¯à®¢¥àï¥â ᮢ¯ ¤ ¥â «¨ ⥪áâ ¢ ¡ãä¥à¥ ebx |
3106 | ; ãªæ¨ï ¯à®¢¥àï¥â ᮢ¯ ¤ ¥â «¨ ⥪áâ ¢ ¡ãä¥à¥ ebx |
3106 | ; á ⥪á⮬ । ªâ®à ¯® 㪠§ ⥫î edx. |
3107 | ; á ⥪á⮬ । ªâ®à ¯® 㪠§ ⥫î edx. |
3107 | ; â ¤ àâë¥ äãªæ¨¨ ( ¯à. strcmp) âãâ ¥ ¯®¤®©¤ãâ, ¯®â®¬ã çâ® |
3108 | ; â ¤ àâë¥ äãªæ¨¨ ( ¯à. strcmp) âãâ ¥ ¯®¤®©¤ãâ, ¯®â®¬ã çâ® |
3108 | ; ¢ ¯ ¬ï⨠। ªâ®à ⥪áâ ᮤ¥à¦¨âáï ¥ ¢ ¢¨¤¥ ascii áâப. |
3109 | ; ¢ ¯ ¬ï⨠। ªâ®à ⥪áâ ᮤ¥à¦¨âáï ¥ ¢ ¢¨¤¥ ascii áâப. |
3109 | ;input: |
3110 | ;input: |
3110 | ; eax - options to find |
3111 | ; eax - options to find |
3111 | ; ebx - text need find |
3112 | ; ebx - text need find |
3112 | ; edx - first symbol pointer |
3113 | ; edx - first symbol pointer |
3113 | ; edi - pointer to tedit struct |
3114 | ; edi - pointer to tedit struct |
3114 | ;output: |
3115 | ;output: |
3115 | ; ah - rezult |
3116 | ; ah - rezult |
3116 | ; edx - last text position (if find sucess) |
3117 | ; edx - last text position (if find sucess) |
3117 | ; esi - first symbol pointer |
3118 | ; esi - first symbol pointer |
3118 | align 16 |
3119 | align 16 |
3119 | proc ted_get_find_rezult uses ebx |
3120 | proc ted_get_find_rezult uses ebx |
3120 | mov al,byte[ebx] |
3121 | mov al,byte[ebx] |
3121 | bt eax,30 |
3122 | bt eax,30 |
3122 | jnc @f |
3123 | jnc @f |
3123 | call fb_char_toupper |
3124 | call fb_char_toupper |
3124 | @@: |
3125 | @@: |
3125 | mov ah,1 |
3126 | mov ah,1 |
3126 | mov esi,edx ;copy edx |
3127 | mov esi,edx ;copy edx |
3127 | .cycle0: |
3128 | .cycle0: |
3128 | mov cl,al |
3129 | mov cl,al |
3129 | mov al,byte[edx] |
3130 | mov al,byte[edx] |
3130 | bt eax,30 |
3131 | bt eax,30 |
3131 | jnc @f |
3132 | jnc @f |
3132 | call fb_char_toupper |
3133 | call fb_char_toupper |
3133 | @@: |
3134 | @@: |
3134 | cmp al,cl |
3135 | cmp al,cl |
3135 | jne .no_text |
3136 | jne .no_text |
3136 | 3137 | ||
3137 | inc ebx ;*** get next symbol (in find text) *** |
3138 | inc ebx ;*** get next symbol (in find text) *** |
3138 | mov al,byte[ebx] |
3139 | mov al,byte[ebx] |
3139 | or al,al |
3140 | or al,al |
3140 | jz .end_f ;end of find text |
3141 | jz .end_f ;end of find text |
3141 | bt eax,30 |
3142 | bt eax,30 |
3142 | jnc @f |
3143 | jnc @f |
3143 | call fb_char_toupper |
3144 | call fb_char_toupper |
3144 | @@: |
3145 | @@: |
3145 | 3146 | ||
3146 | call ted_iterat_next ;*** get next symbol (in editor text) *** |
3147 | call ted_iterat_next ;*** get next symbol (in editor text) *** |
3147 | cmp edx,ted_tex_1 |
3148 | cmp edx,ted_tex_1 |
3148 | jg .cycle0 |
3149 | jg .cycle0 |
3149 | align 4 |
3150 | align 4 |
3150 | .no_text: |
3151 | .no_text: |
3151 | xor ah,ah |
3152 | xor ah,ah |
3152 | mov edx,esi ;restore edx |
3153 | mov edx,esi ;restore edx |
3153 | .end_f: |
3154 | .end_f: |
3154 | ret |
3155 | ret |
3155 | endp |
3156 | endp |
3156 | 3157 | ||
3157 | ;input: |
3158 | ;input: |
3158 | ; edi = pointer to tedit struct |
3159 | ; edi = pointer to tedit struct |
3159 | align 16 |
3160 | align 16 |
3160 | ted_key_ctrl_home: |
3161 | ted_key_ctrl_home: |
3161 | mov ted_cur_x,0 |
3162 | mov ted_cur_x,0 |
3162 | mov ted_cur_y,0 |
3163 | mov ted_cur_y,0 |
3163 | push eax |
3164 | push eax |
3164 | mov eax,ted_scr_w |
3165 | mov eax,ted_scr_w |
3165 | mov dword[eax+sb_offs_position],0 |
3166 | mov dword[eax+sb_offs_position],0 |
3166 | mov eax,ted_scr_h |
3167 | mov eax,ted_scr_h |
3167 | mov dword[eax+sb_offs_position],0 |
3168 | mov dword[eax+sb_offs_position],0 |
3168 | pop eax |
3169 | pop eax |
3169 | stdcall ted_draw,edi |
3170 | stdcall ted_draw,edi |
3170 | cmp ted_fun_draw_panel_buttons,0 |
3171 | cmp ted_fun_draw_panel_buttons,0 |
3171 | je @f |
3172 | je @f |
3172 | call ted_fun_draw_panel_buttons |
3173 | call ted_fun_draw_panel_buttons |
3173 | @@: |
3174 | @@: |
3174 | ret |
3175 | ret |
3175 | 3176 | ||
3176 | ;input: |
3177 | ;input: |
3177 | ; edi = pointer to tedit struct |
3178 | ; edi = pointer to tedit struct |
3178 | align 16 |
3179 | align 16 |
3179 | ted_key_ctrl_end: |
3180 | ted_key_ctrl_end: |
3180 | push eax ebx |
3181 | push eax ebx |
3181 | call ted_get_num_lines |
3182 | call ted_get_num_lines |
3182 | mov ebx,ted_scr_w |
3183 | mov ebx,ted_scr_w |
3183 | mov [ebx+sb_offs_position],eax ;áâ ¢¨¬ ¯®«§ã®ª ¯®á«¥¤îî áâப㠤®ªã¬¥â |
3184 | mov [ebx+sb_offs_position],eax ;áâ ¢¨¬ ¯®«§ã®ª ¯®á«¥¤îî áâப㠤®ªã¬¥â |
3184 | cmp eax,[ebx+sb_offs_cur_area] |
3185 | cmp eax,[ebx+sb_offs_cur_area] |
3185 | jle @f |
3186 | jle @f |
3186 | mov eax,[ebx+sb_offs_cur_area] ;¯®«ãç ¥¬ ç¨á«® áâப ¢« §ïé¨å ¢ ®ª® |
3187 | mov eax,[ebx+sb_offs_cur_area] ;¯®«ãç ¥¬ ç¨á«® áâப ¢« §ïé¨å ¢ ®ª® |
3187 | @@: |
3188 | @@: |
3188 | sub [ebx+sb_offs_position],eax ;®â¨¬ ¥¬ ®â ¯®«§ãª ç¨á«® áâப ¢« §ïé¨å ¢ ®ª® (® ¥ ¡®«ìè¥ â¥å, çâ® ¥áâì ¢ ¤®ªã¬¥â¥) |
3189 | sub [ebx+sb_offs_position],eax ;®â¨¬ ¥¬ ®â ¯®«§ãª ç¨á«® áâப ¢« §ïé¨å ¢ ®ª® (® ¥ ¡®«ìè¥ â¥å, çâ® ¥áâì ¢ ¤®ªã¬¥â¥) |
3189 | dec eax |
3190 | dec eax |
3190 | mov ted_cur_y,eax ;áâ ¢¨¬ ªãàá®à ¯®á«¥¤îî áâப㠤®ªã¬¥â |
3191 | mov ted_cur_y,eax ;áâ ¢¨¬ ªãàá®à ¯®á«¥¤îî áâப㠤®ªã¬¥â |
3191 | pop ebx eax |
3192 | pop ebx eax |
3192 | call ted_cur_move_x_last_char |
3193 | call ted_cur_move_x_last_char |
3193 | stdcall ted_draw,edi |
3194 | stdcall ted_draw,edi |
3194 | cmp ted_fun_draw_panel_buttons,0 |
3195 | cmp ted_fun_draw_panel_buttons,0 |
3195 | je @f |
3196 | je @f |
3196 | call ted_fun_draw_panel_buttons |
3197 | call ted_fun_draw_panel_buttons |
3197 | @@: |
3198 | @@: |
3198 | ret |
3199 | ret |
3199 | 3200 | ||
3200 | ;input: |
3201 | ;input: |
3201 | ; edi = pointer to tedit struct |
3202 | ; edi = pointer to tedit struct |
3202 | align 16 |
3203 | align 16 |
3203 | proc ted_sel_key_up |
3204 | proc ted_sel_key_up |
3204 | cmp ted_drag_k,1 |
3205 | cmp ted_drag_k,1 |
3205 | je @f |
3206 | je @f |
3206 | call ted_sel_start |
3207 | call ted_sel_start |
3207 | mov ted_drag_k,1 |
3208 | mov ted_drag_k,1 |
3208 | @@: |
3209 | @@: |
3209 | push dx |
3210 | push dx |
3210 | call ted_cur_move_up |
3211 | call ted_cur_move_up |
3211 | cmp dl,8 |
3212 | cmp dl,8 |
3212 | jne @f |
3213 | jne @f |
3213 | call ted_scroll_set_redraw |
3214 | call ted_scroll_set_redraw |
3214 | @@: |
3215 | @@: |
3215 | pop dx |
3216 | pop dx |
3216 | call ted_sel_move |
3217 | call ted_sel_move |
3217 | stdcall ted_draw,edi |
3218 | stdcall ted_draw,edi |
3218 | ret |
3219 | ret |
3219 | endp |
3220 | endp |
3220 | 3221 | ||
3221 | ;input: |
3222 | ;input: |
3222 | ; edi = pointer to tedit struct |
3223 | ; edi = pointer to tedit struct |
3223 | align 16 |
3224 | align 16 |
3224 | proc ted_sel_key_down |
3225 | proc ted_sel_key_down |
3225 | cmp ted_drag_k,1 |
3226 | cmp ted_drag_k,1 |
3226 | je @f |
3227 | je @f |
3227 | call ted_sel_start |
3228 | call ted_sel_start |
3228 | mov ted_drag_k,1 |
3229 | mov ted_drag_k,1 |
3229 | @@: |
3230 | @@: |
3230 | push dx |
3231 | push dx |
3231 | call ted_cur_move_down |
3232 | call ted_cur_move_down |
3232 | cmp dl,8 |
3233 | cmp dl,8 |
3233 | jne @f |
3234 | jne @f |
3234 | call ted_scroll_set_redraw |
3235 | call ted_scroll_set_redraw |
3235 | @@: |
3236 | @@: |
3236 | pop dx |
3237 | pop dx |
3237 | call ted_sel_move |
3238 | call ted_sel_move |
3238 | stdcall ted_draw,edi |
3239 | stdcall ted_draw,edi |
3239 | ret |
3240 | ret |
3240 | endp |
3241 | endp |
3241 | 3242 | ||
3242 | ;input: |
3243 | ;input: |
3243 | ; edi = pointer to tedit struct |
3244 | ; edi = pointer to tedit struct |
3244 | align 16 |
3245 | align 16 |
3245 | proc ted_sel_key_left |
3246 | proc ted_sel_key_left |
3246 | cmp ted_drag_k,1 |
3247 | cmp ted_drag_k,1 |
3247 | je @f |
3248 | je @f |
3248 | call ted_sel_start |
3249 | call ted_sel_start |
3249 | @@: |
3250 | @@: |
3250 | push dx |
3251 | push dx |
3251 | call ted_cur_move_left |
3252 | call ted_cur_move_left |
3252 | call ted_sel_move |
3253 | call ted_sel_move |
3253 | cmp ted_drag_k,1 |
3254 | cmp ted_drag_k,1 |
3254 | je @f |
3255 | je @f |
3255 | mov ted_drag_k,1 |
3256 | mov ted_drag_k,1 |
3256 | mov dl,8 |
3257 | mov dl,8 |
3257 | @@: |
3258 | @@: |
3258 | cmp dl,8 |
3259 | cmp dl,8 |
3259 | jne @f |
3260 | jne @f |
3260 | call ted_scroll_set_redraw |
3261 | call ted_scroll_set_redraw |
3261 | stdcall ted_draw,edi |
3262 | stdcall ted_draw,edi |
3262 | jmp .end_f |
3263 | jmp .end_f |
3263 | @@: |
3264 | @@: |
3264 | stdcall ted_draw_cur_line,edi |
3265 | stdcall ted_draw_cur_line,edi |
3265 | .end_f: |
3266 | .end_f: |
3266 | pop dx |
3267 | pop dx |
3267 | ret |
3268 | ret |
3268 | endp |
3269 | endp |
3269 | 3270 | ||
3270 | ;input: |
3271 | ;input: |
3271 | ; edi = pointer to tedit struct |
3272 | ; edi = pointer to tedit struct |
3272 | align 16 |
3273 | align 16 |
3273 | proc ted_sel_key_right |
3274 | proc ted_sel_key_right |
3274 | cmp ted_drag_k,1 |
3275 | cmp ted_drag_k,1 |
3275 | je @f |
3276 | je @f |
3276 | call ted_sel_start |
3277 | call ted_sel_start |
3277 | @@: |
3278 | @@: |
3278 | push dx |
3279 | push dx |
3279 | call ted_cur_move_right |
3280 | call ted_cur_move_right |
3280 | call ted_sel_move |
3281 | call ted_sel_move |
3281 | cmp ted_drag_k,1 |
3282 | cmp ted_drag_k,1 |
3282 | je @f |
3283 | je @f |
3283 | mov ted_drag_k,1 |
3284 | mov ted_drag_k,1 |
3284 | mov dl,8 |
3285 | mov dl,8 |
3285 | @@: |
3286 | @@: |
3286 | cmp dl,8 |
3287 | cmp dl,8 |
3287 | jne @f |
3288 | jne @f |
3288 | call ted_scroll_set_redraw |
3289 | call ted_scroll_set_redraw |
3289 | stdcall ted_draw,edi |
3290 | stdcall ted_draw,edi |
3290 | jmp .end_f |
3291 | jmp .end_f |
3291 | @@: |
3292 | @@: |
3292 | stdcall ted_draw_cur_line,edi |
3293 | stdcall ted_draw_cur_line,edi |
3293 | .end_f: |
3294 | .end_f: |
3294 | pop dx |
3295 | pop dx |
3295 | ret |
3296 | ret |
3296 | endp |
3297 | endp |
3297 | 3298 | ||
3298 | ;input: |
3299 | ;input: |
3299 | ; edi = pointer to tedit struct |
3300 | ; edi = pointer to tedit struct |
3300 | ;description: |
3301 | ;description: |
3301 | ; this function need to optimize output |
3302 | ; this function need to optimize output |
3302 | align 16 |
3303 | align 16 |
3303 | proc ted_draw_cursor_sumb |
3304 | proc ted_draw_cursor_sumb |
3304 | pushad |
3305 | pushad |
3305 | mov ebx,ted_wnd_l |
3306 | mov ebx,ted_wnd_l |
3306 | add ebx,ted_rec_l |
3307 | add ebx,ted_rec_l |
3307 | mov edx,ted_cur_x |
3308 | mov edx,ted_cur_x |
3308 | imul edx,ted_rec_w |
3309 | imul edx,ted_rec_w |
3309 | add ebx,edx |
3310 | add ebx,edx |
3310 | shl ebx,16 |
3311 | shl ebx,16 |
3311 | add ebx,ted_rec_w |
3312 | add ebx,ted_rec_w |
3312 | 3313 | ||
3313 | mov ecx,ted_wnd_t ;calc rect -> y0,y1 |
3314 | mov ecx,ted_wnd_t ;calc rect -> y0,y1 |
3314 | add ecx,ted_rec_t |
3315 | add ecx,ted_rec_t |
3315 | mov edx,ted_cur_y |
3316 | mov edx,ted_cur_y |
3316 | imul edx,ted_rec_h |
3317 | imul edx,ted_rec_h |
3317 | add ecx,edx |
3318 | add ecx,edx |
3318 | shl ecx,16 |
3319 | shl ecx,16 |
3319 | add ecx,ted_rec_h |
3320 | add ecx,ted_rec_h |
3320 | 3321 | ||
3321 | mov edx,ted_color_wnd_work |
3322 | mov edx,ted_color_wnd_work |
3322 | call ted_sel_normalize |
3323 | call ted_sel_normalize |
3323 | 3324 | ||
3324 | mov esi,ted_scr_w |
3325 | mov esi,ted_scr_w |
3325 | mov eax,[esi+sb_offs_position] |
3326 | mov eax,[esi+sb_offs_position] |
3326 | sub ted_seln_y0,eax |
3327 | sub ted_seln_y0,eax |
3327 | sub ted_seln_y1,eax |
3328 | sub ted_seln_y1,eax |
3328 | 3329 | ||
3329 | mov eax,ted_cur_y |
3330 | mov eax,ted_cur_y |
3330 | cmp eax,ted_seln_y0 |
3331 | cmp eax,ted_seln_y0 |
3331 | jl .no_cur_sel |
3332 | jl .no_cur_sel |
3332 | cmp eax,ted_seln_y1 |
3333 | cmp eax,ted_seln_y1 |
3333 | jg .no_cur_sel |
3334 | jg .no_cur_sel |
3334 | mov edx,ted_color_select ;¬¥ï¥¬ 梥â ä® æ¢¥â ¢ë¤¥«¥¨ï |
3335 | mov edx,ted_color_select ;¬¥ï¥¬ 梥â ä® æ¢¥â ¢ë¤¥«¥¨ï |
3335 | mov esi,ted_scr_h |
3336 | mov esi,ted_scr_h |
3336 | cmp eax,ted_seln_y0 |
3337 | cmp eax,ted_seln_y0 |
3337 | jne @f |
3338 | jne @f |
3338 | mov eax,ted_cur_x |
3339 | mov eax,ted_cur_x |
3339 | add eax,[esi+sb_offs_position] |
3340 | add eax,[esi+sb_offs_position] |
3340 | cmp eax,ted_seln_x0 |
3341 | cmp eax,ted_seln_x0 |
3341 | jge @f |
3342 | jge @f |
3342 | mov edx,ted_color_wnd_work |
3343 | mov edx,ted_color_wnd_work |
3343 | @@: |
3344 | @@: |
3344 | mov eax,ted_cur_y |
3345 | mov eax,ted_cur_y |
3345 | cmp eax,ted_seln_y1 |
3346 | cmp eax,ted_seln_y1 |
3346 | jne .no_cur_sel |
3347 | jne .no_cur_sel |
3347 | mov eax,ted_cur_x |
3348 | mov eax,ted_cur_x |
3348 | add eax,[esi+sb_offs_position] |
3349 | add eax,[esi+sb_offs_position] |
3349 | cmp eax,ted_seln_x1 |
3350 | cmp eax,ted_seln_x1 |
3350 | jl .no_cur_sel |
3351 | jl .no_cur_sel |
3351 | mov edx,ted_color_wnd_work |
3352 | mov edx,ted_color_wnd_work |
3352 | .no_cur_sel: |
3353 | .no_cur_sel: |
3353 | mcall SF_DRAW_RECT |
3354 | mcall SF_DRAW_RECT |
3354 | 3355 | ||
3355 | call ted_get_pos_by_cursor ;¡¥à¥¬ ¯®§¨æ¨î ᨬ¢®« |
3356 | call ted_get_pos_by_cursor ;¡¥à¥¬ ¯®§¨æ¨î ᨬ¢®« |
3356 | cmp ted_gp_opt,2 |
3357 | cmp ted_gp_opt,2 |
3357 | jne @f |
3358 | jne @f |
3358 | mov esi,1 |
3359 | mov esi,1 |
3359 | ror ecx,16 |
3360 | ror ecx,16 |
3360 | mov bx,cx |
3361 | mov bx,cx |
3361 | add ebx,0x10001 |
3362 | add ebx,0x10001 |
3362 | call ted_get_symb_color |
3363 | call ted_get_symb_color |
3363 | call ted_convert_invis_symb |
3364 | call ted_convert_invis_symb |
3364 | mcall SF_DRAW_TEXT ;à¨á®¢ ¨¥ ᨬ¢®« |
3365 | mcall SF_DRAW_TEXT ;à¨á®¢ ¨¥ ᨬ¢®« |
3365 | @@: |
3366 | @@: |
3366 | popad |
3367 | popad |
3367 | ret |
3368 | ret |
3368 | endp |
3369 | endp |
3369 | 3370 | ||
3370 | ;input: |
3371 | ;input: |
3371 | ; edx -> pointer to text |
3372 | ; edx -> pointer to text |
3372 | ; edi -> 㪠§ ⥫ì áâàãªâãàã tedit |
3373 | ; edi -> 㪠§ ⥫ì áâàãªâãàã tedit |
3373 | ;output: |
3374 | ;output: |
3374 | ; ecx = color |
3375 | ; ecx = color |
3375 | ; if ted_mode_color=0 then ecx=ted_color_wnd_text |
3376 | ; if ted_mode_color=0 then ecx=ted_color_wnd_text |
3376 | align 16 |
3377 | align 16 |
3377 | ted_get_symb_color: |
3378 | ted_get_symb_color: |
3378 | mov ecx,ted_color_wnd_text ;§ ¤ ¥¬ 梥â ⥪áâ ¯® 㬮«ç ¨î |
3379 | mov ecx,ted_color_wnd_text ;§ ¤ ¥¬ 梥â ⥪áâ ¯® 㬮«ç ¨î |
3379 | 3380 | ||
3380 | push eax edx |
3381 | push eax edx |
3381 | cmp ted_mode_color,0 |
3382 | cmp ted_mode_color,0 |
3382 | je .exit |
3383 | je .exit |
3383 | jmp .on_first |
3384 | jmp .on_first |
3384 | @@: |
3385 | @@: |
3385 | call ted_iterat_perv |
3386 | call ted_iterat_perv |
3386 | cmp edx,ted_tex_1 |
3387 | cmp edx,ted_tex_1 |
3387 | jle .exit |
3388 | jle .exit |
3388 | .on_first: |
3389 | .on_first: |
3389 | xor eax,eax |
- | |
3390 | mov al,byte[edx+1] |
3390 | movzx eax,byte[edx+1] |
3391 | or al,al ;¥á«¨ al=0 ⮠梥⠥ ¬¥ï¥âáï |
3391 | or eax,eax ;¥á«¨ al=0 ⮠梥⠥ ¬¥ï¥âáï |
3392 | jz @b |
3392 | jz @b |
3393 | 3393 | ||
3394 | cmp eax,ted_colors_text_count |
3394 | cmp eax,ted_colors_text_count |
3395 | jge .exit |
3395 | jge .exit |
3396 | - | ||
3397 | shl ax,2 ;㬮¦ ¥¬ ¨¤¥ªá 梥â 4 ¡ ©â |
3396 | |
3398 | mov ecx,ted_text_colors ;¯à¨¡ ¢«ï¥¬ ᬥ饨¥ 1-£® 梥â |
3397 | mov ecx,ted_text_colors ;¯à¨¡ ¢«ï¥¬ ᬥ饨¥ 1-£® 梥â |
3399 | add ecx,eax |
3398 | lea ecx,[ecx+4*eax] |
3400 | mov ecx,[ecx] ;ãáâ ¢«¨¢ ¥¬ ⥪ã騩 梥â ⥪áâ ¯® ᬥ饨î |
3399 | mov ecx,[ecx] ;ãáâ ¢«¨¢ ¥¬ ⥪ã騩 梥â ⥪áâ ¯® ᬥ饨î |
3401 | .exit: |
3400 | .exit: |
3402 | or ecx,ted_font_size |
3401 | or ecx,ted_font_size |
3403 | pop edx eax |
3402 | pop edx eax |
3404 | ret |
3403 | ret |
3405 | 3404 | ||
3406 | ;input: |
3405 | ;input: |
3407 | ; edx = pointer to text |
3406 | ; edx = pointer to text |
3408 | ; edi = pointer to tedit struct |
3407 | ; edi = pointer to tedit struct |
3409 | ;description: |
3408 | ;description: |
3410 | ; ãªæ¨ï ¯à¥®¡à §ã¥â ¥¢¨¤¨¬ë¥ ᨬ¢®«ë ¢ ¯¥ç â ¥¬ë¥ íªà ¥ |
3409 | ; ãªæ¨ï ¯à¥®¡à §ã¥â ¥¢¨¤¨¬ë¥ ᨬ¢®«ë ¢ ¯¥ç â ¥¬ë¥ íªà ¥ |
3411 | align 16 |
3410 | align 16 |
3412 | ted_convert_invis_symb: |
3411 | ted_convert_invis_symb: |
3413 | cmp ted_mode_invis,1 |
3412 | cmp ted_mode_invis,1 |
3414 | jne .else |
3413 | jne .else |
3415 | cmp byte[edx],9 |
3414 | cmp byte[edx],9 |
3416 | jne @f |
3415 | jne @f |
3417 | lea edx,[ted_symbol_tab] |
3416 | lea edx,[ted_symbol_tab] |
3418 | jmp .end_f |
3417 | jmp .end_f |
3419 | align 4 |
3418 | align 4 |
3420 | @@: |
3419 | @@: |
3421 | cmp byte[edx],13 |
3420 | cmp byte[edx],13 |
3422 | jne @f |
3421 | jne @f |
3423 | mov edx,edi |
3422 | mov edx,edi |
3424 | add edx,ted_offs_symbol_new_line |
3423 | add edx,ted_offs_symbol_new_line |
3425 | @@: |
3424 | @@: |
3426 | jmp .end_f |
3425 | jmp .end_f |
3427 | align 4 |
3426 | align 4 |
3428 | .else: |
3427 | .else: |
3429 | cmp byte[edx],9 |
3428 | cmp byte[edx],9 |
3430 | je @f |
3429 | je @f |
3431 | cmp byte[edx],13 |
3430 | cmp byte[edx],13 |
3432 | jne .end_f |
3431 | jne .end_f |
3433 | @@: |
3432 | @@: |
3434 | lea edx,[ted_symbol_space] |
3433 | lea edx,[ted_symbol_space] |
3435 | .end_f: |
3434 | .end_f: |
3436 | ret |
3435 | ret |
3437 | 3436 | ||
3438 | ;input: |
3437 | ;input: |
3439 | ; edi = pointer to tedit struct |
3438 | ; edi = pointer to tedit struct |
3440 | align 16 |
3439 | align 16 |
3441 | ted_scroll_set_redraw: |
3440 | ted_scroll_set_redraw: |
3442 | push eax |
3441 | push eax |
3443 | mov eax,ted_scr_w |
3442 | mov eax,ted_scr_w |
3444 | mov dword[eax+sb_offs_redraw],1 |
3443 | mov dword[eax+sb_offs_redraw],1 |
3445 | mov eax,ted_scr_h |
3444 | mov eax,ted_scr_h |
3446 | mov dword[eax+sb_offs_redraw],1 |
3445 | mov dword[eax+sb_offs_redraw],1 |
3447 | pop eax |
3446 | pop eax |
3448 | ret |
3447 | ret |
3449 | 3448 | ||
3450 | align 16 |
3449 | align 16 |
3451 | proc ted_draw, edit:dword |
3450 | proc ted_draw, edit:dword |
3452 | locals |
3451 | locals |
3453 | line_num dd ? |
3452 | line_num dd ? |
3454 | endl |
3453 | endl |
3455 | pushad |
3454 | pushad |
3456 | mov edi,[edit] |
3455 | mov edi,[edit] |
3457 | 3456 | ||
3458 | mov eax,SF_DRAW_TEXT |
3457 | mov eax,SF_DRAW_TEXT |
3459 | mov ecx,ted_text_colors |
3458 | mov ecx,ted_text_colors |
3460 | mov ecx,[ecx] |
3459 | mov ecx,[ecx] |
3461 | 3460 | ||
3462 | mov ebx,ted_wnd_l |
3461 | mov ebx,ted_wnd_l |
3463 | add ebx,ted_rec_l |
3462 | add ebx,ted_rec_l |
3464 | shl ebx,16 |
3463 | shl ebx,16 |
3465 | add ebx,ted_wnd_t |
3464 | add ebx,ted_wnd_t |
3466 | add ebx,ted_rec_t |
3465 | add ebx,ted_rec_t |
3467 | add ebx,0x10001 ;¤®¡ ¢«ï¥¬ ®âáâã¯ë ¤«ï ¢ëà ¢¨¢ ¨ï ¡ãª¢ë ¯® æ¥âàã |
3466 | add ebx,0x10001 ;¤®¡ ¢«ï¥¬ ®âáâã¯ë ¤«ï ¢ëà ¢¨¢ ¨ï ¡ãª¢ë ¯® æ¥âàã |
3468 | 3467 | ||
3469 | call ted_sel_normalize ;need before draw select |
3468 | call ted_sel_normalize ;need before draw select |
3470 | mov esi,ted_scr_w |
3469 | mov esi,ted_scr_w |
3471 | mov esi,[esi+sb_offs_position] |
3470 | mov esi,[esi+sb_offs_position] |
3472 | mov [line_num],esi |
3471 | mov [line_num],esi |
3473 | 3472 | ||
3474 | stdcall ted_clear_line_before_draw, edi,ebx,1,esi |
3473 | stdcall ted_clear_line_before_draw, edi,ebx,1,esi |
3475 | call ted_get_first_visible_pos |
3474 | call ted_get_first_visible_pos |
3476 | or edx,edx |
3475 | or edx,edx |
3477 | jz .no_draw_text |
3476 | jz .no_draw_text |
3478 | mov esi,1 ;¤«¨ ¢ë¢®¤¨¬®£® ⥪áâ ¯® 1-¬ã ᨬ¢®«ã |
3477 | mov esi,1 ;¤«¨ ¢ë¢®¤¨¬®£® ⥪áâ ¯® 1-¬ã ᨬ¢®«ã |
3479 | @@: |
3478 | @@: |
3480 | call ted_iterat_next |
3479 | call ted_iterat_next |
3481 | cmp edx,ted_tex_1 |
3480 | cmp edx,ted_tex_1 |
3482 | jle .no_draw_text |
3481 | jle .no_draw_text |
3483 | 3482 | ||
3484 | ; *** 梥⮢ ï à §¬¥âª |
3483 | ; *** 梥⮢ ï à §¬¥âª |
3485 | cmp ted_mode_color,0 |
3484 | cmp ted_mode_color,0 |
3486 | je .no_col_change |
3485 | je .no_col_change |
3487 | cmp byte[edx+1],0 |
3486 | cmp byte[edx+1],0 |
3488 | je .no_col_change |
3487 | je .no_col_change |
3489 | call ted_get_symb_color |
3488 | call ted_get_symb_color |
3490 | .no_col_change: |
3489 | .no_col_change: |
3491 | 3490 | ||
3492 | cmp byte[edx],13 |
3491 | cmp byte[edx],13 |
3493 | jne .no_13 |
3492 | jne .no_13 |
3494 | cmp ted_mode_invis,1 |
3493 | cmp ted_mode_invis,1 |
3495 | jne .no_invis |
3494 | jne .no_invis |
3496 | push edx |
3495 | push edx |
3497 | mov edx,edi |
3496 | mov edx,edi |
3498 | add edx,ted_offs_symbol_new_line |
3497 | add edx,ted_offs_symbol_new_line |
3499 | int 0x40 |
3498 | int 0x40 |
3500 | pop edx |
3499 | pop edx |
3501 | .no_invis: |
3500 | .no_invis: |
3502 | add ebx,ted_rec_h |
3501 | add ebx,ted_rec_h |
3503 | ;optimized output \/ |
3502 | ;optimized output \/ |
3504 | mov eax,ted_wnd_h |
3503 | mov eax,ted_wnd_h |
3505 | add eax,ted_wnd_t |
3504 | add eax,ted_wnd_t |
3506 | cmp bx,ax |
3505 | cmp bx,ax |
3507 | jg .no_draw_text |
3506 | jg .no_draw_text |
3508 | mov eax,SF_DRAW_TEXT |
3507 | mov eax,SF_DRAW_TEXT |
3509 | ;optimized output /\ |
3508 | ;optimized output /\ |
3510 | and ebx,0xffff |
3509 | and ebx,0xffff |
3511 | ror ebx,16 |
3510 | ror ebx,16 |
3512 | add ebx,ted_wnd_l |
3511 | add ebx,ted_wnd_l |
3513 | add ebx,ted_rec_l |
3512 | add ebx,ted_rec_l |
3514 | inc ebx |
3513 | inc ebx |
3515 | ror ebx,16 |
3514 | ror ebx,16 |
3516 | inc dword[line_num] ;increment line number |
3515 | inc dword[line_num] ;increment line number |
3517 | stdcall ted_clear_line_before_draw,edi,ebx,1,dword[line_num] |
3516 | stdcall ted_clear_line_before_draw,edi,ebx,1,dword[line_num] |
3518 | call ted_opt_draw_line_left |
3517 | call ted_opt_draw_line_left |
3519 | jmp @b |
3518 | jmp @b |
3520 | align 4 |
3519 | align 4 |
3521 | .no_13: |
3520 | .no_13: |
3522 | 3521 | ||
3523 | int 0x40 |
3522 | int 0x40 |
3524 | ror ebx,16 |
3523 | ror ebx,16 |
3525 | add ebx,ted_rec_w |
3524 | add ebx,ted_rec_w |
3526 | mov esi,ted_wnd_l |
3525 | mov esi,ted_wnd_l |
3527 | add esi,ted_wnd_w |
3526 | add esi,ted_wnd_w |
3528 | cmp bx,si |
3527 | cmp bx,si |
3529 | jl .no_opt |
3528 | jl .no_opt |
3530 | call ted_opt_draw_line_right |
3529 | call ted_opt_draw_line_right |
3531 | .no_opt: |
3530 | .no_opt: |
3532 | mov si,1 |
3531 | mov si,1 |
3533 | ror ebx,16 |
3532 | ror ebx,16 |
3534 | jmp @b |
3533 | jmp @b |
3535 | .no_draw_text: |
3534 | .no_draw_text: |
3536 | 3535 | ||
3537 | inc dword[line_num] |
3536 | inc dword[line_num] |
3538 | stdcall ted_clear_line_before_draw,edi,ebx,0,dword[line_num] |
3537 | stdcall ted_clear_line_before_draw,edi,ebx,0,dword[line_num] |
3539 | call ted_draw_line_numbers |
3538 | call ted_draw_line_numbers |
3540 | call ted_draw_main_cursor |
3539 | call ted_draw_main_cursor |
3541 | 3540 | ||
3542 | ;--------------------------------------------- |
3541 | ;--------------------------------------------- |
3543 | ; set all_redraw flag for draw all ScrollBar |
3542 | ; set all_redraw flag for draw all ScrollBar |
3544 | ; In some cases it is necessity to draw only the area |
3543 | ; In some cases it is necessity to draw only the area |
3545 | ; of moving of a "runner", for acceleration of output - |
3544 | ; of moving of a "runner", for acceleration of output - |
3546 | ; in this case the flag needs to be reset to 0 (zero). |
3545 | ; in this case the flag needs to be reset to 0 (zero). |
3547 | mov eax,ted_scr_h |
3546 | mov eax,ted_scr_h |
3548 | mov esi,ted_scr_w |
3547 | mov esi,ted_scr_w |
3549 | mov dword[eax+sb_offs_all_redraw],1 |
3548 | mov dword[eax+sb_offs_all_redraw],1 |
3550 | mov dword[esi+sb_offs_all_redraw],1 |
3549 | mov dword[esi+sb_offs_all_redraw],1 |
3551 | 3550 | ||
3552 | ; à¨á®¢ ¨¥ ¯®«®á ¯à®ªàã⪨ |
3551 | ; à¨á®¢ ¨¥ ¯®«®á ¯à®ªàã⪨ |
3553 | stdcall scroll_bar_horizontal.draw,eax ;[scrollbar_hor_draw] |
3552 | stdcall scroll_bar_horizontal.draw,eax ;[scrollbar_hor_draw] |
3554 | stdcall scroll_bar_vertical.draw,esi ;[scrollbar_ver_draw] |
3553 | stdcall scroll_bar_vertical.draw,esi ;[scrollbar_ver_draw] |
3555 | ; reset all_redraw flag |
3554 | ; reset all_redraw flag |
3556 | mov dword[eax+sb_offs_all_redraw],0 |
3555 | mov dword[eax+sb_offs_all_redraw],0 |
3557 | mov dword[esi+sb_offs_all_redraw],0 |
3556 | mov dword[esi+sb_offs_all_redraw],0 |
3558 | ;--------------------------------------------- |
3557 | ;--------------------------------------------- |
3559 | 3558 | ||
3560 | ;left-bottom square |
3559 | ;left-bottom square |
3561 | mov ebx,ted_wnd_l |
3560 | mov ebx,ted_wnd_l |
3562 | shl ebx,16 |
3561 | shl ebx,16 |
3563 | add ebx,ted_rec_l |
3562 | add ebx,ted_rec_l |
3564 | mov ecx,ted_wnd_t |
3563 | mov ecx,ted_wnd_t |
3565 | add ecx,ted_wnd_h |
3564 | add ecx,ted_wnd_h |
3566 | shl ecx,16 |
3565 | shl ecx,16 |
3567 | mov cx,word[eax+sb_offs_size_y] |
3566 | mov cx,word[eax+sb_offs_size_y] |
3568 | inc cx |
3567 | inc cx |
3569 | mcall SF_DRAW_RECT,,,ted_color_wnd_capt ;[sc.work] |
3568 | mcall SF_DRAW_RECT,,,ted_color_wnd_capt ;[sc.work] |
3570 | 3569 | ||
3571 | ;right-bottom square |
3570 | ;right-bottom square |
3572 | mov ebx,ted_wnd_l |
3571 | mov ebx,ted_wnd_l |
3573 | add ebx,ted_wnd_w |
3572 | add ebx,ted_wnd_w |
3574 | shl ebx,16 |
3573 | shl ebx,16 |
3575 | mov bx,word[esi+sb_offs_size_x] |
3574 | mov bx,word[esi+sb_offs_size_x] |
3576 | inc bx |
3575 | inc bx |
3577 | int 0x40 |
3576 | int 0x40 |
3578 | 3577 | ||
3579 | cmp ted_fun_draw_panels,0 |
3578 | cmp ted_fun_draw_panels,0 |
3580 | je @f |
3579 | je @f |
3581 | stdcall ted_fun_draw_panels, edi |
3580 | stdcall ted_fun_draw_panels, edi |
3582 | @@: |
3581 | @@: |
3583 | popad |
3582 | popad |
3584 | ret |
3583 | ret |
3585 | endp |
3584 | endp |
3586 | 3585 | ||
3587 | ;input: |
3586 | ;input: |
3588 | ; edi = pointer to tedit struct |
3587 | ; edi = pointer to tedit struct |
3589 | align 16 |
3588 | align 16 |
3590 | proc ted_draw_main_cursor |
3589 | proc ted_draw_main_cursor |
3591 | pushad |
3590 | pushad |
3592 | mov eax,SF_DRAW_RECT ;draw cursor |
3591 | mov eax,SF_DRAW_RECT ;draw cursor |
3593 | mov ecx,ted_wnd_t ;calc rect -> y0,y1 |
3592 | mov ecx,ted_wnd_t ;calc rect -> y0,y1 |
3594 | add ecx,ted_rec_t |
3593 | add ecx,ted_rec_t |
3595 | mov edx,ted_cur_y |
3594 | mov edx,ted_cur_y |
3596 | imul edx,ted_rec_h |
3595 | imul edx,ted_rec_h |
3597 | add ecx,edx |
3596 | add ecx,edx |
3598 | 3597 | ||
3599 | shl ecx,16 |
3598 | shl ecx,16 |
3600 | add ecx,ted_rec_h |
3599 | add ecx,ted_rec_h |
3601 | 3600 | ||
3602 | mov ebx,ted_wnd_l ;calc rect -> x0,x1 |
3601 | mov ebx,ted_wnd_l ;calc rect -> x0,x1 |
3603 | add ebx,ted_rec_l |
3602 | add ebx,ted_rec_l |
3604 | mov edx,ted_cur_x |
3603 | mov edx,ted_cur_x |
3605 | imul edx,ted_rec_w |
3604 | imul edx,ted_rec_w |
3606 | add ebx,edx |
3605 | add ebx,edx |
3607 | shl ebx,16 |
3606 | shl ebx,16 |
3608 | add ebx,ted_rec_w |
3607 | add ebx,ted_rec_w |
3609 | cmp ted_cur_ins,1 ;¯à®¢¥àª ०¨¬ à ¡®âë ªãàá®à (®¡ëçë© ¨«¨ ¢áâ ¢ª ) |
3608 | cmp ted_cur_ins,1 ;¯à®¢¥àª ०¨¬ à ¡®âë ªãàá®à (®¡ëçë© ¨«¨ ¢áâ ¢ª ) |
3610 | jne @f |
3609 | jne @f |
3611 | shr bx,2 ;㬥ìè ¥¬ è¨à¨ã ªãàá®à |
3610 | shr bx,2 ;㬥ìè ¥¬ è¨à¨ã ªãàá®à |
3612 | @@: |
3611 | @@: |
3613 | 3612 | ||
3614 | mov edx,ted_color_cursor |
3613 | mov edx,ted_color_cursor |
3615 | int 0x40 ;¢ë¢®¤ ªãàá®à |
3614 | int 0x40 ;¢ë¢®¤ ªãàá®à |
3616 | 3615 | ||
3617 | call ted_get_pos_by_cursor |
3616 | call ted_get_pos_by_cursor |
3618 | cmp ted_gp_opt,2 |
3617 | cmp ted_gp_opt,2 |
3619 | jne @f |
3618 | jne @f |
3620 | mov esi,1 |
3619 | mov esi,1 |
3621 | ror ecx,16 |
3620 | ror ecx,16 |
3622 | mov bx,cx |
3621 | mov bx,cx |
3623 | add ebx,0x10001 |
3622 | add ebx,0x10001 |
3624 | mov ecx,ted_color_cur_text |
3623 | mov ecx,ted_color_cur_text |
3625 | or ecx,ted_font_size |
3624 | or ecx,ted_font_size |
3626 | call ted_convert_invis_symb |
3625 | call ted_convert_invis_symb |
3627 | mcall SF_DRAW_TEXT |
3626 | mcall SF_DRAW_TEXT |
3628 | @@: |
3627 | @@: |
3629 | 3628 | ||
3630 | mov ebx,ted_wnd_l |
3629 | mov ebx,ted_wnd_l |
3631 | add ebx,ted_rec_l |
3630 | add ebx,ted_rec_l |
3632 | shl ebx,16 |
3631 | shl ebx,16 |
3633 | add ebx,ted_wnd_t |
3632 | add ebx,ted_wnd_t |
3634 | add ebx,3 |
3633 | add ebx,3 |
3635 | mov ecx,ted_color_wnd_bord |
3634 | mov ecx,ted_color_wnd_bord |
3636 | or ecx,0x80000000 |
3635 | or ecx,0x80000000 |
3637 | lea edx,[txtRow] |
3636 | lea edx,[txtRow] |
3638 | mcall SF_DRAW_TEXT ;¢ë¢®¤ ¯®¤¯¨á¨ 'âப ' |
3637 | mcall SF_DRAW_TEXT ;¢ë¢®¤ ¯®¤¯¨á¨ 'âப ' |
3639 | 3638 | ||
3640 | add ebx,0x500000 |
3639 | add ebx,0x500000 |
3641 | lea edx,[txtCol] |
3640 | lea edx,[txtCol] |
3642 | int 0x40 ;¢ë¢®¤ ¯®¤¯¨á¨ ' ª' |
3641 | int 0x40 ;¢ë¢®¤ ¯®¤¯¨á¨ ' ª' |
3643 | 3642 | ||
3644 | cmp ted_tim_undo,0 |
3643 | cmp ted_tim_undo,0 |
3645 | je @f |
3644 | je @f |
3646 | add ebx,0x500000 |
3645 | add ebx,0x500000 |
3647 | lea edx,[txtOtm] |
3646 | lea edx,[txtOtm] |
3648 | int 0x40 |
3647 | int 0x40 |
3649 | sub ebx,0x500000 |
3648 | sub ebx,0x500000 |
3650 | @@: |
3649 | @@: |
3651 | 3650 | ||
3652 | call ted_draw_buffer |
3651 | call ted_draw_buffer |
3653 | call ted_draw_help_f1 |
3652 | call ted_draw_help_f1 |
3654 | 3653 | ||
3655 | mov eax,47 ;draw cursor coords |
3654 | mov eax,47 ;draw cursor coords |
3656 | mov esi,ted_color_wnd_bord |
3655 | mov esi,ted_color_wnd_bord |
3657 | or esi,0x40000000 |
3656 | or esi,0x40000000 |
3658 | 3657 | ||
3659 | mov edx,ebx |
3658 | mov edx,ebx |
3660 | ror edx,16 |
3659 | ror edx,16 |
3661 | sub edx,35 |
3660 | sub edx,35 |
3662 | ror edx,16 |
3661 | ror edx,16 |
3663 | ;add edx,3 |
3662 | ;add edx,3 |
3664 | mov ebx,0x40000 ;Row=... |
3663 | mov ebx,0x40000 ;Row=... |
3665 | mov ecx,ted_scr_w |
3664 | mov ecx,ted_scr_w |
3666 | mov ecx,[ecx+sb_offs_position] |
3665 | mov ecx,[ecx+sb_offs_position] |
3667 | add ecx,ted_cur_y |
3666 | add ecx,ted_cur_y |
3668 | inc ecx |
3667 | inc ecx |
3669 | 3668 | ||
3670 | push edi |
3669 | push edi |
3671 | mov edi,ted_color_wnd_work |
3670 | mov edi,ted_color_wnd_work |
3672 | int 0x40 ;¢ë¢®¤ ç¨á« ⥪ã饩 áâப¨ |
3671 | int 0x40 ;¢ë¢®¤ ç¨á« ⥪ã饩 áâப¨ |
3673 | pop edi |
3672 | pop edi |
3674 | 3673 | ||
3675 | ;mov ebx,0x40000 ;Col=... |
3674 | ;mov ebx,0x40000 ;Col=... |
3676 | mov ecx,ted_scr_h |
3675 | mov ecx,ted_scr_h |
3677 | mov ecx,[ecx+sb_offs_position] |
3676 | mov ecx,[ecx+sb_offs_position] |
3678 | add ecx,ted_cur_x |
3677 | add ecx,ted_cur_x |
3679 | inc ecx |
3678 | inc ecx |
3680 | add edx,0x500000 |
3679 | add edx,0x500000 |
3681 | push edi |
3680 | push edi |
3682 | mov edi,ted_color_wnd_work |
3681 | mov edi,ted_color_wnd_work |
3683 | int 0x40 ;¢ë¢®¤ ç¨á« § ª®¢ |
3682 | int 0x40 ;¢ë¢®¤ ç¨á« § ª®¢ |
3684 | pop edi |
3683 | pop edi |
3685 | 3684 | ||
3686 | cmp ted_tim_undo,0 |
3685 | cmp ted_tim_undo,0 |
3687 | je @f |
3686 | je @f |
3688 | mov ecx,ted_tim_undo |
3687 | mov ecx,ted_tim_undo |
3689 | add edx,0x500000 |
3688 | add edx,0x500000 |
3690 | mov edi,ted_color_wnd_work ;¯®à⨬ ॣ¨áâà edi, ® ¢ ª®æ¥ äãªæ¨¨ í⮠㦥 ¥ ¢ ¦® |
3689 | mov edi,ted_color_wnd_work ;¯®à⨬ ॣ¨áâà edi, ® ¢ ª®æ¥ äãªæ¨¨ í⮠㦥 ¥ ¢ ¦® |
3691 | int 0x40 ;¢ë¢®¤ ç¨á« ®â¬¥¥ëå ¤¥©á⢨© |
3690 | int 0x40 ;¢ë¢®¤ ç¨á« ®â¬¥¥ëå ¤¥©á⢨© |
3692 | @@: |
3691 | @@: |
3693 | 3692 | ||
3694 | popad |
3693 | popad |
3695 | ret |
3694 | ret |
3696 | endp |
3695 | endp |
3697 | 3696 | ||
3698 | ;input: |
3697 | ;input: |
3699 | ; edi = pointer to tedit struct |
3698 | ; edi = pointer to tedit struct |
3700 | align 16 |
3699 | align 16 |
3701 | proc ted_draw_buffer |
3700 | proc ted_draw_buffer |
3702 | pushad |
3701 | pushad |
3703 | 3702 | ||
3704 | mov eax,ted_buffer |
3703 | mov eax,ted_buffer |
3705 | cmp dword[eax],1 ;ᬮâਬ à §¬¥à ¡ãä¥à |
3704 | cmp dword[eax],1 ;ᬮâਬ à §¬¥à ¡ãä¥à |
3706 | jl @f |
3705 | jl @f |
3707 | mov ebx,ted_rec_l |
3706 | mov ebx,ted_rec_l |
3708 | add bx,300 |
3707 | add bx,300 |
3709 | cmp ebx,ted_wnd_w ;áà ¢¨¢ ¥¬ ª®®à¤¨ âã ¤«ï ¢ë¢®¤ ⥪áâ |
3708 | cmp ebx,ted_wnd_w ;áà ¢¨¢ ¥¬ ª®®à¤¨ âã ¤«ï ¢ë¢®¤ ⥪áâ |
3710 | jge @f ;¯®¤¯¨áì ¥ ¢« §¨â ¢ ®ª® |
3709 | jge @f ;¯®¤¯¨áì ¥ ¢« §¨â ¢ ®ª® |
3711 | 3710 | ||
3712 | add ebx,ted_wnd_l |
3711 | add ebx,ted_wnd_l |
3713 | shl ebx,16 |
3712 | shl ebx,16 |
3714 | add ebx,ted_wnd_t |
3713 | add ebx,ted_wnd_t |
3715 | add ebx,3 |
3714 | add ebx,3 |
3716 | mov ecx,ted_color_wnd_bord |
3715 | mov ecx,ted_color_wnd_bord |
3717 | or ecx,0x40000000 |
3716 | or ecx,0x40000000 |
3718 | 3717 | ||
3719 | mov edx,ted_buffer |
3718 | mov edx,ted_buffer |
3720 | add edx,12 |
3719 | add edx,12 |
3721 | mov esi,edx |
3720 | mov esi,edx |
3722 | mov edi,ted_color_wnd_work ;edi - destroy not pointer to tedit |
3721 | mov edi,ted_color_wnd_work ;edi - destroy not pointer to tedit |
3723 | call tl_strlen |
3722 | call tl_strlen |
3724 | ;cmp eax,0 ;¡ãä¥à ¯ãáâ |
3723 | ;cmp eax,0 ;¡ãä¥à ¯ãáâ |
3725 | ;je @f |
3724 | ;je @f |
3726 | cmp eax,20 |
3725 | cmp eax,20 |
3727 | jle .crop_buf |
3726 | jle .crop_buf |
3728 | mov eax,20 ;®¡à¥§ª ¯®¤¯¨á¨ ¤® 20 ᨬ¢®«®¢ |
3727 | mov eax,20 ;®¡à¥§ª ¯®¤¯¨á¨ ¤® 20 ᨬ¢®«®¢ |
3729 | .crop_buf: |
3728 | .crop_buf: |
3730 | mov esi,eax |
3729 | mov esi,eax |
3731 | mcall SF_DRAW_TEXT ;¢ë¢®¤ ᮤ¥à¦¨¬®£® ¡ãä¥à |
3730 | mcall SF_DRAW_TEXT ;¢ë¢®¤ ᮤ¥à¦¨¬®£® ¡ãä¥à |
3732 | 3731 | ||
3733 | sub ebx,50 shl 16 |
3732 | sub ebx,50 shl 16 |
3734 | lea edx,[txtBuf] |
3733 | lea edx,[txtBuf] |
3735 | mov esi,edx |
3734 | mov esi,edx |
3736 | call tl_strlen |
3735 | call tl_strlen |
3737 | mov esi,eax |
3736 | mov esi,eax |
3738 | xor ecx,0x40000000 ;ã¡¨à ¥¬ 梥â ä® |
3737 | xor ecx,0x40000000 ;ã¡¨à ¥¬ 梥â ä® |
3739 | mcall SF_DRAW_TEXT ;¢ë¢®¤ ¯®¤¯¨á¨ ¤«ï ¡ãä¥à |
3738 | mcall SF_DRAW_TEXT ;¢ë¢®¤ ¯®¤¯¨á¨ ¤«ï ¡ãä¥à |
3740 | @@: |
3739 | @@: |
3741 | popad |
3740 | popad |
3742 | ret |
3741 | ret |
3743 | endp |
3742 | endp |
3744 | 3743 | ||
3745 | ;input: |
3744 | ;input: |
3746 | ; edi = pointer to tedit struct |
3745 | ; edi = pointer to tedit struct |
3747 | align 16 |
3746 | align 16 |
3748 | proc ted_draw_help_f1 |
3747 | proc ted_draw_help_f1 |
3749 | pushad |
3748 | pushad |
3750 | cmp ted_rec_t,13 ;¬¨¨¬ «ì ï ¢ëá®â ¤«ï à¨á®¢ ¨ï á¯à ¢ª¨ |
3749 | cmp ted_rec_t,13 ;¬¨¨¬ «ì ï ¢ëá®â ¤«ï à¨á®¢ ¨ï á¯à ¢ª¨ |
3751 | jle @f |
3750 | jle @f |
3752 | ;clear place before draw help |
3751 | ;clear place before draw help |
3753 | mov ebx,ted_wnd_l |
3752 | mov ebx,ted_wnd_l |
3754 | add ebx,ted_rec_l |
3753 | add ebx,ted_rec_l |
3755 | shl ebx,16 |
3754 | shl ebx,16 |
3756 | add ebx,ted_wnd_w |
3755 | add ebx,ted_wnd_w |
3757 | sub ebx,ted_rec_l |
3756 | sub ebx,ted_rec_l |
3758 | mov ecx,ted_wnd_t |
3757 | mov ecx,ted_wnd_t |
3759 | add ecx,13 |
3758 | add ecx,13 |
3760 | shl ecx,16 |
3759 | shl ecx,16 |
3761 | add ecx,9 ;9 - ¢ëá®â 0-£® èà¨äâ , áâ ¢¨âì ted_rec_h ¯®ª ¥é¥ à ® |
3760 | add ecx,9 ;9 - ¢ëá®â 0-£® èà¨äâ , áâ ¢¨âì ted_rec_h ¯®ª ¥é¥ à ® |
3762 | mcall SF_DRAW_RECT,,,ted_color_wnd_capt |
3761 | mcall SF_DRAW_RECT,,,ted_color_wnd_capt |
3763 | 3762 | ||
3764 | cmp ted_help_id,-1 |
3763 | cmp ted_help_id,-1 |
3765 | je @f |
3764 | je @f |
3766 | mov eax,ted_help_id |
3765 | mov eax,ted_help_id |
3767 | ColToIndexOffset eax,edx |
3766 | ColToIndexOffset eax,edx |
3768 | 3767 | ||
3769 | ;SetCoordinates |
3768 | ;SetCoordinates |
3770 | mov ebx,ted_wnd_l |
3769 | mov ebx,ted_wnd_l |
3771 | add ebx,ted_rec_l |
3770 | add ebx,ted_rec_l |
3772 | shl ebx,16 |
3771 | shl ebx,16 |
3773 | add ebx,ted_wnd_t |
3772 | add ebx,ted_wnd_t |
3774 | add ebx,13 ;=3+10 |
3773 | add ebx,13 ;=3+10 |
3775 | 3774 | ||
3776 | ;SetTextColor |
3775 | ;SetTextColor |
3777 | xor eax,eax |
- | |
3778 | mov al,byte[edx+MAX_COLOR_WORD_LEN+7] |
3776 | movzx eax,byte[edx+MAX_COLOR_WORD_LEN+7] |
3779 | shl ax,2 |
3777 | shl eax,2 |
3780 | mov ecx,ted_text_colors |
3778 | mov ecx,ted_text_colors |
3781 | add ecx,eax |
3779 | add ecx,eax |
3782 | mov ecx,[ecx] |
3780 | mov ecx,[ecx] |
3783 | or ecx,0xc0000000 ;SetTextStyles |
3781 | or ecx,0xc0000000 ;SetTextStyles |
3784 | mov esi,edi |
3782 | mov esi,edi |
3785 | mcall SF_DRAW_TEXT,,,,,ted_color_wnd_work |
3783 | mcall SF_DRAW_TEXT,,,,,ted_color_wnd_work |
3786 | mov edi,esi |
3784 | mov edi,esi |
3787 | 3785 | ||
3788 | mov esi,edx |
3786 | mov esi,edx |
3789 | call tl_strlen |
3787 | call tl_strlen |
3790 | 3788 | ||
3791 | ;*** draw help string *** |
3789 | ;*** draw help string *** |
3792 | mov ecx,ted_color_wnd_bord |
3790 | mov ecx,ted_color_wnd_bord |
3793 | or ecx,0x80000000 |
3791 | or ecx,0x80000000 |
3794 | mov edx,[edx+MAX_COLOR_WORD_LEN] |
3792 | mov edx,[edx+MAX_COLOR_WORD_LEN] |
3795 | or edx,edx |
3793 | or edx,edx |
3796 | jz @f |
3794 | jz @f |
3797 | add edx,ted_help_text_f1 |
3795 | add edx,ted_help_text_f1 |
3798 | inc eax |
3796 | inc eax |
3799 | imul eax,6 ;è¨à¨ ᨬ¢®« ¢ á¨áâ. èà¨ä⥠|
3797 | imul eax,6 ;è¨à¨ ᨬ¢®« ¢ á¨áâ. èà¨ä⥠|
3800 | shl eax,16 |
3798 | shl eax,16 |
3801 | add ebx,eax |
3799 | add ebx,eax |
3802 | mcall SF_DRAW_TEXT |
3800 | mcall SF_DRAW_TEXT |
3803 | @@: |
3801 | @@: |
3804 | popad |
3802 | popad |
3805 | ret |
3803 | ret |
3806 | endp |
3804 | endp |
3807 | 3805 | ||
3808 | ;input: |
3806 | ;input: |
3809 | ; edi = pointer to tedit struct |
3807 | ; edi = pointer to tedit struct |
3810 | align 16 |
3808 | align 16 |
3811 | proc ted_draw_line_numbers |
3809 | proc ted_draw_line_numbers |
3812 | pushad |
3810 | pushad |
3813 | ;top panel with caption |
3811 | ;top panel with caption |
3814 | mov ebx,ted_wnd_l |
3812 | mov ebx,ted_wnd_l |
3815 | ;add ebx,ted_rec_l |
3813 | ;add ebx,ted_rec_l |
3816 | shl ebx,16 |
3814 | shl ebx,16 |
3817 | add ebx,ted_wnd_w |
3815 | add ebx,ted_wnd_w |
3818 | ;sub ebx,ted_rec_l |
3816 | ;sub ebx,ted_rec_l |
3819 | mov edx,ted_color_wnd_work |
3817 | mov edx,ted_color_wnd_work |
3820 | mov ecx,ted_wnd_t |
3818 | mov ecx,ted_wnd_t |
3821 | shl ecx,16 |
3819 | shl ecx,16 |
3822 | add ecx,ted_rec_t |
3820 | add ecx,ted_rec_t |
3823 | mov edx,ted_color_wnd_capt |
3821 | mov edx,ted_color_wnd_capt |
3824 | mcall SF_DRAW_RECT |
3822 | mcall SF_DRAW_RECT |
3825 | 3823 | ||
3826 | ;line numbers |
3824 | ;line numbers |
3827 | mov ebx,0x40000 ;format |
3825 | mov ebx,0x40000 ;format |
3828 | mov ecx,ted_scr_w |
3826 | mov ecx,ted_scr_w |
3829 | mov ecx,[ecx+sb_offs_position] |
3827 | mov ecx,[ecx+sb_offs_position] |
3830 | inc ecx |
3828 | inc ecx |
3831 | mov edx,3 |
3829 | mov edx,3 |
3832 | add edx,ted_wnd_l |
3830 | add edx,ted_wnd_l |
3833 | rol edx,16 |
3831 | rol edx,16 |
3834 | add edx,ted_wnd_t |
3832 | add edx,ted_wnd_t |
3835 | add edx,ted_rec_t |
3833 | add edx,ted_rec_t |
3836 | @@: |
3834 | @@: |
3837 | 3835 | ||
3838 | push ebx ecx edx |
3836 | push ebx ecx edx |
3839 | ;left panel with numbers |
3837 | ;left panel with numbers |
3840 | mov ebx,ted_wnd_l |
3838 | mov ebx,ted_wnd_l |
3841 | shl ebx,16 |
3839 | shl ebx,16 |
3842 | add ebx,ted_rec_l |
3840 | add ebx,ted_rec_l |
3843 | mov ecx,ted_rec_h |
3841 | mov ecx,ted_rec_h |
3844 | rol ecx,16 |
3842 | rol ecx,16 |
3845 | mov cx,dx |
3843 | mov cx,dx |
3846 | rol ecx,16 |
3844 | rol ecx,16 |
3847 | mov edx,ted_color_wnd_capt |
3845 | mov edx,ted_color_wnd_capt |
3848 | mcall SF_DRAW_RECT ;à¨á㥬 ¯àאַ㣮«ì¨ª ¯®¤ ®¬¥à®¬ áâப¨ |
3846 | mcall SF_DRAW_RECT ;à¨á㥬 ¯àאַ㣮«ì¨ª ¯®¤ ®¬¥à®¬ áâப¨ |
3849 | pop edx ecx ebx |
3847 | pop edx ecx ebx |
3850 | 3848 | ||
3851 | mov esi,ted_color_wnd_bord |
3849 | mov esi,ted_color_wnd_bord |
3852 | mcall SF_DRAW_NUMBER ;à¨á㥬 ®¬¥à áâப¨ |
3850 | mcall SF_DRAW_NUMBER ;à¨á㥬 ®¬¥à áâப¨ |
3853 | inc ecx |
3851 | inc ecx |
3854 | add edx,ted_rec_h |
3852 | add edx,ted_rec_h |
3855 | sub edx,ted_wnd_t |
3853 | sub edx,ted_wnd_t |
3856 | mov esi,edx |
3854 | mov esi,edx |
3857 | and esi,0xffff |
3855 | and esi,0xffff |
3858 | cmp esi,ted_wnd_h |
3856 | cmp esi,ted_wnd_h |
3859 | jge @f |
3857 | jge @f |
3860 | add edx,ted_wnd_t |
3858 | add edx,ted_wnd_t |
3861 | jmp @b |
3859 | jmp @b |
3862 | align 4 |
3860 | align 4 |
3863 | @@: |
3861 | @@: |
3864 | popad |
3862 | popad |
3865 | ret |
3863 | ret |
3866 | endp |
3864 | endp |
3867 | 3865 | ||
3868 | ;output: |
3866 | ;output: |
3869 | ; ah = symbol |
3867 | ; ah = symbol |
3870 | align 16 |
3868 | align 16 |
3871 | proc KeyConvertToASCII uses ebx, table:dword |
3869 | proc KeyConvertToASCII uses ebx, table:dword |
3872 | mov ebx,[table] ;convert scan to ascii |
3870 | mov ebx,[table] ;convert scan to ascii |
3873 | shr ax,8 |
3871 | shr ax,8 |
3874 | add bx,ax ;? ebx,eax |
3872 | add bx,ax ;? ebx,eax |
3875 | mov ah,byte[ebx] |
3873 | mov ah,byte[ebx] |
3876 | ret |
3874 | ret |
3877 | endp |
3875 | endp |
3878 | 3876 | ||
3879 | align 16 |
3877 | align 16 |
3880 | proc ted_draw_cur_line, edit:dword |
3878 | proc ted_draw_cur_line, edit:dword |
3881 | pushad |
3879 | pushad |
3882 | mov edi,[edit] |
3880 | mov edi,[edit] |
3883 | 3881 | ||
3884 | mov ebx,ted_wnd_l |
3882 | mov ebx,ted_wnd_l |
3885 | add ebx,ted_rec_l |
3883 | add ebx,ted_rec_l |
3886 | shl ebx,16 |
3884 | shl ebx,16 |
3887 | mov eax,ted_cur_y |
3885 | mov eax,ted_cur_y |
3888 | imul eax,ted_rec_h |
3886 | imul eax,ted_rec_h |
3889 | mov bx,ax |
3887 | mov bx,ax |
3890 | add ebx,ted_wnd_t |
3888 | add ebx,ted_wnd_t |
3891 | add ebx,ted_rec_t ;ebx - ª®®à¤¨ âë ¤«ï ¯àאַ㣮«ì¨ª ®ç¨á⪨ «¨¨¨ |
3889 | add ebx,ted_rec_t ;ebx - ª®®à¤¨ âë ¤«ï ¯àאַ㣮«ì¨ª ®ç¨á⪨ «¨¨¨ |
3892 | add ebx,0x10001 ;¤®¡ ¢«ï¥¬ ®âáâã¯ë ¤«ï ¢ëà ¢¨¢ ¨ï ¡ãª¢ë ¯® æ¥âàã |
3890 | add ebx,0x10001 ;¤®¡ ¢«ï¥¬ ®âáâã¯ë ¤«ï ¢ëà ¢¨¢ ¨ï ¡ãª¢ë ¯® æ¥âàã |
3893 | 3891 | ||
3894 | call ted_sel_normalize ;need before draw select |
3892 | call ted_sel_normalize ;need before draw select |
3895 | mov ecx,ted_cur_y |
3893 | mov ecx,ted_cur_y |
3896 | mov eax,ted_scr_w |
3894 | mov eax,ted_scr_w |
3897 | add ecx,[eax+sb_offs_position] |
3895 | add ecx,[eax+sb_offs_position] |
3898 | stdcall ted_clear_line_before_draw,edi,ebx,1,ecx |
3896 | stdcall ted_clear_line_before_draw,edi,ebx,1,ecx |
3899 | 3897 | ||
3900 | mov eax,ted_scr_h |
3898 | mov eax,ted_scr_h |
3901 | mov esi,[eax+sb_offs_position] |
3899 | mov esi,[eax+sb_offs_position] |
3902 | call ted_get_pos_by_coords |
3900 | call ted_get_pos_by_coords |
3903 | 3901 | ||
3904 | cmp ted_gp_opt,2 |
3902 | cmp ted_gp_opt,2 |
3905 | jne .no_draw_text |
3903 | jne .no_draw_text |
3906 | call ted_get_symb_color |
3904 | call ted_get_symb_color |
3907 | mov esi,1 ;draw 1 symbol |
3905 | mov esi,1 ;draw 1 symbol |
3908 | @@: |
3906 | @@: |
3909 | ;call ted_iterat_next |
3907 | ;call ted_iterat_next |
3910 | cmp edx,ted_tex_1 |
3908 | cmp edx,ted_tex_1 |
3911 | jle .no_draw_text |
3909 | jle .no_draw_text |
3912 | 3910 | ||
3913 | ; *** 梥⮢ ï à §¬¥âª |
3911 | ; *** 梥⮢ ï à §¬¥âª |
3914 | cmp ted_mode_color,0 |
3912 | cmp ted_mode_color,0 |
3915 | je .no_col_change |
3913 | je .no_col_change |
3916 | cmp byte[edx+1],0 |
3914 | cmp byte[edx+1],0 |
3917 | je .no_col_change |
3915 | je .no_col_change |
3918 | call ted_get_symb_color |
3916 | call ted_get_symb_color |
3919 | .no_col_change: |
3917 | .no_col_change: |
3920 | 3918 | ||
3921 | mov eax,SF_DRAW_TEXT |
3919 | mov eax,SF_DRAW_TEXT |
3922 | cmp byte [edx],13 |
3920 | cmp byte [edx],13 |
3923 | jne .no_13 |
3921 | jne .no_13 |
3924 | cmp ted_mode_invis,1 |
3922 | cmp ted_mode_invis,1 |
3925 | jne .no_draw_text |
3923 | jne .no_draw_text |
3926 | push edx |
3924 | push edx |
3927 | mov edx,edi |
3925 | mov edx,edi |
3928 | add edx,ted_offs_symbol_new_line |
3926 | add edx,ted_offs_symbol_new_line |
3929 | int 0x40 |
3927 | int 0x40 |
3930 | pop edx |
3928 | pop edx |
3931 | jmp .no_draw_text |
3929 | jmp .no_draw_text |
3932 | align 4 |
3930 | align 4 |
3933 | .no_13: |
3931 | .no_13: |
3934 | 3932 | ||
3935 | int 0x40 |
3933 | int 0x40 |
3936 | ror ebx,16 |
3934 | ror ebx,16 |
3937 | add ebx,ted_rec_w |
3935 | add ebx,ted_rec_w |
3938 | mov eax,ted_wnd_w |
3936 | mov eax,ted_wnd_w |
3939 | add eax,ted_wnd_l ;ax = ®âáâ㯠¯® ®á¨ x |
3937 | add eax,ted_wnd_l ;ax = ®âáâ㯠¯® ®á¨ x |
3940 | cmp bx,ax |
3938 | cmp bx,ax |
3941 | jge .no_draw_text ;Opt |
3939 | jge .no_draw_text ;Opt |
3942 | ror ebx,16 |
3940 | ror ebx,16 |
3943 | call ted_iterat_next |
3941 | call ted_iterat_next |
3944 | jmp @b |
3942 | jmp @b |
3945 | align 4 |
3943 | align 4 |
3946 | .no_draw_text: |
3944 | .no_draw_text: |
3947 | 3945 | ||
3948 | call ted_draw_main_cursor |
3946 | call ted_draw_main_cursor |
3949 | popad |
3947 | popad |
3950 | ret |
3948 | ret |
3951 | endp |
3949 | endp |
3952 | 3950 | ||
3953 | ;input: |
3951 | ;input: |
3954 | ; clear_o - ¥á«¨ =1 ®ç¨áâ¨âì ®¤ã áâபã, =0 ®ç¨áâ¨âì ¢á¥ áâப¨ ®ª ¤® ¨§ã |
3952 | ; clear_o - ¥á«¨ =1 ®ç¨áâ¨âì ®¤ã áâபã, =0 ®ç¨áâ¨âì ¢á¥ áâப¨ ®ª ¤® ¨§ã |
3955 | align 16 |
3953 | align 16 |
3956 | proc ted_clear_line_before_draw, edit:dword, coords:dword, clear_o:dword, numb_lin:dword |
3954 | proc ted_clear_line_before_draw, edit:dword, coords:dword, clear_o:dword, numb_lin:dword |
3957 | pushad |
3955 | pushad |
3958 | mov edi,[edit] |
3956 | mov edi,[edit] |
3959 | mov ebx,[coords] ;ebx = x*2^16+y coords to left up point clear line |
3957 | mov ebx,[coords] ;ebx = x*2^16+y coords to left up point clear line |
3960 | mov esi,[numb_lin] ;esi - number text line |
3958 | mov esi,[numb_lin] ;esi - number text line |
3961 | 3959 | ||
3962 | sub ebx,0x10001 ;®â¨¬ ¥¬ ®âáâã¯ë ¤«ï ¢ëà ¢¨¢ ¨ï ¡ãª¢ë ¯® æ¥âàã |
3960 | sub ebx,0x10001 ;®â¨¬ ¥¬ ®âáâã¯ë ¤«ï ¢ëà ¢¨¢ ¨ï ¡ãª¢ë ¯® æ¥âàã |
3963 | cmp dword[clear_o],0 |
3961 | cmp dword[clear_o],0 |
3964 | jne @f |
3962 | jne @f |
3965 | add ebx,ted_rec_h |
3963 | add ebx,ted_rec_h |
3966 | ror ebx,16 |
3964 | ror ebx,16 |
3967 | xor bx,bx |
3965 | xor bx,bx |
3968 | add ebx,ted_wnd_l |
3966 | add ebx,ted_wnd_l |
3969 | add ebx,ted_rec_l ;bx = ted_wnd_l+ted_rec_l |
3967 | add ebx,ted_rec_l ;bx = ted_wnd_l+ted_rec_l |
3970 | ror ebx,16 |
3968 | ror ebx,16 |
3971 | @@: |
3969 | @@: |
3972 | 3970 | ||
3973 | mov eax,ted_wnd_h |
3971 | mov eax,ted_wnd_h |
3974 | add eax,ted_wnd_t |
3972 | add eax,ted_wnd_t |
3975 | cmp ax,bx |
3973 | cmp ax,bx |
3976 | jl .no_clear |
3974 | jl .no_clear |
3977 | sub ax,bx |
3975 | sub ax,bx |
3978 | 3976 | ||
3979 | mov cx,bx |
3977 | mov cx,bx |
3980 | shl ecx,16 |
3978 | shl ecx,16 |
3981 | 3979 | ||
3982 | xor bx,bx |
3980 | xor bx,bx |
3983 | add ebx,ted_wnd_w |
3981 | add ebx,ted_wnd_w |
3984 | sub ebx,ted_rec_l |
3982 | sub ebx,ted_rec_l |
3985 | xor cx,cx |
3983 | xor cx,cx |
3986 | add ecx,ted_rec_h |
3984 | add ecx,ted_rec_h |
3987 | mov edx,ted_color_wnd_work |
3985 | mov edx,ted_color_wnd_work |
3988 | 3986 | ||
3989 | cmp dword[clear_o],0 |
3987 | cmp dword[clear_o],0 |
3990 | je .pusto |
3988 | je .pusto |
3991 | cmp ax,cx |
3989 | cmp ax,cx |
3992 | jge @f |
3990 | jge @f |
3993 | .pusto: |
3991 | .pusto: |
3994 | mov cx,ax |
3992 | mov cx,ax |
3995 | jmp .no_select ;¥á«¨ ®ç¨á⪠®ª ¤® ¨§ã, â® ¢á¥£¤ ä®®¢ë¬ 梥⮬ |
3993 | jmp .no_select ;¥á«¨ ®ç¨á⪠®ª ¤® ¨§ã, â® ¢á¥£¤ ä®®¢ë¬ 梥⮬ |
3996 | @@: |
3994 | @@: |
3997 | 3995 | ||
3998 | call ted_is_select |
3996 | call ted_is_select |
3999 | or al,al |
3997 | or al,al |
4000 | jz .no_select |
3998 | jz .no_select |
4001 | cmp ted_seln_y0,esi |
3999 | cmp ted_seln_y0,esi |
4002 | jg .no_select |
4000 | jg .no_select |
4003 | cmp ted_seln_y1,esi |
4001 | cmp ted_seln_y1,esi |
4004 | jl .no_select |
4002 | jl .no_select |
4005 | mov edx,ted_color_select ;draw selected line |
4003 | mov edx,ted_color_select ;draw selected line |
4006 | .no_select: |
4004 | .no_select: |
4007 | 4005 | ||
4008 | mcall SF_DRAW_RECT ;§ ªà ᪠¯®«®© áâப¨ 梥⮬ ä® ¨«¨ 梥⮬ ¢ë¤¥«¥¨ï |
4006 | mcall SF_DRAW_RECT ;§ ªà ᪠¯®«®© áâப¨ 梥⮬ ä® ¨«¨ 梥⮬ ¢ë¤¥«¥¨ï |
4009 | 4007 | ||
4010 | call ted_is_select |
4008 | call ted_is_select |
4011 | or al,al |
4009 | or al,al |
4012 | jz .no_clear |
4010 | jz .no_clear |
4013 | 4011 | ||
4014 | mov al,SF_DRAW_RECT |
4012 | mov al,SF_DRAW_RECT |
4015 | xor cx,cx |
4013 | xor cx,cx |
4016 | add ecx,ted_rec_h |
4014 | add ecx,ted_rec_h |
4017 | cmp ted_seln_y0,esi |
4015 | cmp ted_seln_y0,esi |
4018 | jne @f |
4016 | jne @f |
4019 | push bx esi |
4017 | push bx esi |
4020 | mov edx,ted_seln_x0 ; ¢¥àåïï ¯®«®á (§ â¨à ¥â á«¥¢ ) |
4018 | mov edx,ted_seln_x0 ; ¢¥àåïï ¯®«®á (§ â¨à ¥â á«¥¢ ) |
4021 | mov esi,ted_scr_h |
4019 | mov esi,ted_scr_h |
4022 | cmp edx,[esi+sb_offs_position] |
4020 | cmp edx,[esi+sb_offs_position] |
4023 | jle .in_wnd |
4021 | jle .in_wnd |
4024 | sub edx,[esi+sb_offs_position] |
4022 | sub edx,[esi+sb_offs_position] |
4025 | imul edx,ted_rec_w |
4023 | imul edx,ted_rec_w |
4026 | mov bx,dx |
4024 | mov bx,dx |
4027 | jmp .no_wnd |
4025 | jmp .no_wnd |
4028 | .in_wnd: |
4026 | .in_wnd: |
4029 | xor bx,bx |
4027 | xor bx,bx |
4030 | .no_wnd: |
4028 | .no_wnd: |
4031 | mov edx,ted_color_wnd_work |
4029 | mov edx,ted_color_wnd_work |
4032 | int 0x40 |
4030 | int 0x40 |
4033 | pop esi bx |
4031 | pop esi bx |
4034 | @@: |
4032 | @@: |
4035 | cmp ted_seln_y1,esi |
4033 | cmp ted_seln_y1,esi |
4036 | jne @f |
4034 | jne @f |
4037 | ;push esi |
4035 | ;push esi |
4038 | ;¥á«¨ ¢ë¤¥«¥ ¢¥áì ä ©« âãâ ¬®¦® ᤥ« âì ¢ë室, ® ⮣¤ 㦮 ¢ëè¥ ã¡à âì jmp .no_select |
4036 | ;¥á«¨ ¢ë¤¥«¥ ¢¥áì ä ©« âãâ ¬®¦® ᤥ« âì ¢ë室, ® ⮣¤ 㦮 ¢ëè¥ ã¡à âì jmp .no_select |
4039 | mov edx,ted_seln_x1 ; ¨¦ïï ¯®«®á (§ â¨à ¥â á¯à ¢ ) |
4037 | mov edx,ted_seln_x1 ; ¨¦ïï ¯®«®á (§ â¨à ¥â á¯à ¢ ) |
4040 | mov esi,ted_scr_h |
4038 | mov esi,ted_scr_h |
4041 | cmp edx,[esi+sb_offs_position] |
4039 | cmp edx,[esi+sb_offs_position] |
4042 | jle .in_wnd2 |
4040 | jle .in_wnd2 |
4043 | sub edx,[esi+sb_offs_position] |
4041 | sub edx,[esi+sb_offs_position] |
4044 | imul edx,ted_rec_w |
4042 | imul edx,ted_rec_w |
4045 | sub bx,dx |
4043 | sub bx,dx |
4046 | shl edx,16 |
4044 | shl edx,16 |
4047 | add ebx,edx |
4045 | add ebx,edx |
4048 | .in_wnd2: |
4046 | .in_wnd2: |
4049 | mov edx,ted_color_wnd_work |
4047 | mov edx,ted_color_wnd_work |
4050 | int 0x40 |
4048 | int 0x40 |
4051 | ;pop esi |
4049 | ;pop esi |
4052 | @@: |
4050 | @@: |
4053 | 4051 | ||
4054 | .no_clear: |
4052 | .no_clear: |
4055 | popad |
4053 | popad |
4056 | ret |
4054 | ret |
4057 | endp |
4055 | endp |
4058 | 4056 | ||
4059 | ;input: |
4057 | ;input: |
4060 | ; edi = pointer to tedit struct |
4058 | ; edi = pointer to tedit struct |
4061 | ;output: |
4059 | ;output: |
4062 | ; ecx = ®¢ë© 梥â ᨬ¢®« |
4060 | ; ecx = ®¢ë© 梥â ᨬ¢®« |
4063 | ; edx = pointer to symbol |
4061 | ; edx = pointer to symbol |
4064 | ; edx = 0 if text not in screen |
4062 | ; edx = 0 if text not in screen |
4065 | align 16 |
4063 | align 16 |
4066 | ted_get_first_visible_pos: |
4064 | ted_get_first_visible_pos: |
4067 | push eax ecx |
4065 | push eax ecx |
4068 | mov eax,ted_scr_w |
4066 | mov eax,ted_scr_w |
4069 | mov edx,ted_tex |
4067 | mov edx,ted_tex |
4070 | xor ecx,ecx |
4068 | xor ecx,ecx |
4071 | @@: |
4069 | @@: |
4072 | cmp ecx,[eax+sb_offs_position] |
4070 | cmp ecx,[eax+sb_offs_position] |
4073 | je @f |
4071 | je @f |
4074 | call ted_iterat_next |
4072 | call ted_iterat_next |
4075 | cmp edx,ted_tex_1 |
4073 | cmp edx,ted_tex_1 |
4076 | jle @f |
4074 | jle @f |
4077 | cmp byte[edx],13 |
4075 | cmp byte[edx],13 |
4078 | jne @b |
4076 | jne @b |
4079 | inc ecx |
4077 | inc ecx |
4080 | jmp @b |
4078 | jmp @b |
4081 | align 4 |
4079 | align 4 |
4082 | @@: |
4080 | @@: |
4083 | 4081 | ||
4084 | cmp ecx,[eax+sb_offs_position] |
4082 | cmp ecx,[eax+sb_offs_position] |
4085 | je @f |
4083 | je @f |
4086 | xor edx,edx |
4084 | xor edx,edx |
4087 | @@: |
4085 | @@: |
4088 | cmp ecx,[eax+sb_offs_max_area] |
4086 | cmp ecx,[eax+sb_offs_max_area] |
4089 | jle @f |
4087 | jle @f |
4090 | mov [eax+sb_offs_max_area],ecx |
4088 | mov [eax+sb_offs_max_area],ecx |
4091 | @@: |
4089 | @@: |
4092 | pop ecx eax |
4090 | pop ecx eax |
4093 | call ted_opt_draw_line_left |
4091 | call ted_opt_draw_line_left |
4094 | ret |
4092 | ret |
4095 | 4093 | ||
4096 | ;input: |
4094 | ;input: |
4097 | ; edx = pointer to symbol |
4095 | ; edx = pointer to symbol |
4098 | ; edi = pointer to tedit struct |
4096 | ; edi = pointer to tedit struct |
4099 | ;output: |
4097 | ;output: |
4100 | ; ecx = 梥â ᨬ¢®« |
4098 | ; ecx = 梥â ᨬ¢®« |
4101 | ; edx = 㪠§ â¥«ì ¯¥à¢ë© «¥¢ë© ᨬ¢®« |
4099 | ; edx = 㪠§ â¥«ì ¯¥à¢ë© «¥¢ë© ᨬ¢®« |
4102 | ;description: |
4100 | ;description: |
4103 | ; äãªæ¨ï 㦠¤«ï ®¯â¨¬¨§ 樨 ¢ë¢®¤ ⥪áâ |
4101 | ; äãªæ¨ï 㦠¤«ï ®¯â¨¬¨§ 樨 ¢ë¢®¤ ⥪áâ |
4104 | align 16 |
4102 | align 16 |
4105 | proc ted_opt_draw_line_left uses ebx |
4103 | proc ted_opt_draw_line_left uses ebx |
4106 | mov ebx,ted_scr_h |
4104 | mov ebx,ted_scr_h |
4107 | mov ebx,[ebx+sb_offs_position] |
4105 | mov ebx,[ebx+sb_offs_position] |
4108 | or ebx,ebx |
4106 | or ebx,ebx |
4109 | jz .ret_f |
4107 | jz .ret_f |
4110 | push eax |
4108 | push eax |
4111 | mov eax,edx |
4109 | mov eax,edx |
4112 | 4110 | ||
4113 | cmp edx,ted_tex |
4111 | cmp edx,ted_tex |
4114 | jne @f |
4112 | jne @f |
4115 | call ted_iterat_next |
4113 | call ted_iterat_next |
4116 | jmp .beg_cycle |
4114 | jmp .beg_cycle |
4117 | @@: |
4115 | @@: |
4118 | 4116 | ||
4119 | or ebx,ebx |
4117 | or ebx,ebx |
4120 | jz @f |
4118 | jz @f |
4121 | 4119 | ||
4122 | cmp byte[edx],13 |
4120 | cmp byte[edx],13 |
4123 | jne @f |
4121 | jne @f |
4124 | call ted_iterat_next |
4122 | call ted_iterat_next |
4125 | .beg_cycle: |
4123 | .beg_cycle: |
4126 | @@: |
4124 | @@: |
4127 | cmp edx,ted_tex_1 |
4125 | cmp edx,ted_tex_1 |
4128 | jle @f |
4126 | jle @f |
4129 | cmp byte[edx],13 |
4127 | cmp byte[edx],13 |
4130 | je @f |
4128 | je @f |
4131 | or ebx,ebx |
4129 | or ebx,ebx |
4132 | jz @f |
4130 | jz @f |
4133 | ;-------------------------------------- |
4131 | ;-------------------------------------- |
4134 | xor eax,eax ;eax ¡ã¤¥â ¬¥ïâìáï |
4132 | ;eax ¡ã¤¥â ¬¥ïâìáï |
4135 | mov al,byte[edx+1] |
4133 | movzx eax,byte[edx+1] |
4136 | or al,al |
4134 | or eax,eax |
4137 | jz .no_color |
4135 | jz .no_color |
4138 | cmp eax,ted_colors_text_count |
4136 | cmp eax,ted_colors_text_count |
4139 | jge .no_color |
4137 | jge .no_color |
4140 | xor ecx,ecx |
- | |
4141 | mov cl,byte[edx+1] |
4138 | movzx ecx,byte[edx+1] |
4142 | shl cx,2 |
4139 | shl ecx,2 |
4143 | add ecx,ted_text_colors |
4140 | add ecx,ted_text_colors |
4144 | mov ecx,[ecx] |
4141 | mov ecx,[ecx] |
4145 | .no_color: |
4142 | .no_color: |
4146 | ;-------------------------------------- |
4143 | ;-------------------------------------- |
4147 | mov eax,edx |
4144 | mov eax,edx |
4148 | call ted_iterat_next |
4145 | call ted_iterat_next |
4149 | dec ebx |
4146 | dec ebx |
4150 | jmp @b |
4147 | jmp @b |
4151 | align 4 |
4148 | align 4 |
4152 | @@: |
4149 | @@: |
4153 | mov edx,eax |
4150 | mov edx,eax |
4154 | pop eax |
4151 | pop eax |
4155 | .ret_f: |
4152 | .ret_f: |
4156 | call ted_get_symb_color |
4153 | call ted_get_symb_color |
4157 | ret |
4154 | ret |
4158 | endp |
4155 | endp |
4159 | 4156 | ||
4160 | ;input: |
4157 | ;input: |
4161 | ; edx = pointer to symbol |
4158 | ; edx = pointer to symbol |
4162 | ; edi = pointer to tedit struct |
4159 | ; edi = pointer to tedit struct |
4163 | ;output: |
4160 | ;output: |
4164 | ; ecx = symbol color |
4161 | ; ecx = symbol color |
4165 | ; edx = pointer to 13 symbol |
4162 | ; edx = pointer to 13 symbol |
4166 | ;description: |
4163 | ;description: |
4167 | ; äãªæ¨ï 㦠¤«ï ®¯â¨¬¨§ 樨 ¢ë¢®¤ ⥪áâ |
4164 | ; äãªæ¨ï 㦠¤«ï ®¯â¨¬¨§ 樨 ¢ë¢®¤ ⥪áâ |
4168 | align 16 |
4165 | align 16 |
4169 | proc ted_opt_draw_line_right uses eax |
4166 | proc ted_opt_draw_line_right uses eax |
4170 | mov eax,edx |
4167 | mov eax,edx |
4171 | @@: |
4168 | @@: |
4172 | cmp edx,ted_tex_1 |
4169 | cmp edx,ted_tex_1 |
4173 | jle @f |
4170 | jle @f |
4174 | cmp byte[edx],13 |
4171 | cmp byte[edx],13 |
4175 | je @f |
4172 | je @f |
4176 | mov eax,edx |
4173 | mov eax,edx |
4177 | call ted_iterat_next |
4174 | call ted_iterat_next |
4178 | jmp @b |
4175 | jmp @b |
4179 | @@: |
4176 | @@: |
4180 | mov edx,eax ;perv sumbol |
4177 | mov edx,eax ;perv sumbol |
4181 | call ted_get_symb_color |
4178 | call ted_get_symb_color |
4182 | ret |
4179 | ret |
4183 | endp |
4180 | endp |
4184 | 4181 | ||
4185 | align 16 |
4182 | align 16 |
4186 | proc ted_mouse, edit:dword |
4183 | proc ted_mouse, edit:dword |
4187 | pushad |
4184 | pushad |
4188 | mov edi,[edit] |
4185 | mov edi,[edit] |
4189 | 4186 | ||
4190 | ;®¡à ¡ âë¢ ¥¬ áªà®««¨£¨ |
4187 | ;®¡à ¡ âë¢ ¥¬ áªà®««¨£¨ |
4191 | mov edx,ted_scr_h |
4188 | mov edx,ted_scr_h |
4192 | mov ecx,ted_scr_w |
4189 | mov ecx,ted_scr_w |
4193 | 4190 | ||
4194 | cmp word[edx+sb_offs_delta2],0 |
4191 | cmp word[edx+sb_offs_delta2],0 |
4195 | jne .horizontal |
4192 | jne .horizontal |
4196 | 4193 | ||
4197 | mov eax,[ecx+sb_offs_max_area] |
4194 | mov eax,[ecx+sb_offs_max_area] |
4198 | cmp eax,[ecx+sb_offs_cur_area] |
4195 | cmp eax,[ecx+sb_offs_cur_area] |
4199 | jbe .horizontal |
4196 | jbe .horizontal |
4200 | ; mouse event for Vertical ScrollBar |
4197 | ; mouse event for Vertical ScrollBar |
4201 | stdcall scroll_bar_vertical.mouse,ecx ;[scrollbar_ver_mouse] |
4198 | stdcall scroll_bar_vertical.mouse,ecx ;[scrollbar_ver_mouse] |
4202 | cmp dword[ecx+sb_offs_redraw],0 |
4199 | cmp dword[ecx+sb_offs_redraw],0 |
4203 | je @f |
4200 | je @f |
4204 | mov dword[ecx+sb_offs_redraw],0 |
4201 | mov dword[ecx+sb_offs_redraw],0 |
4205 | stdcall ted_draw,edi |
4202 | stdcall ted_draw,edi |
4206 | jmp .no_in_wnd |
4203 | jmp .no_in_wnd |
4207 | @@: |
4204 | @@: |
4208 | cmp word[ecx+sb_offs_delta2],0 |
4205 | cmp word[ecx+sb_offs_delta2],0 |
4209 | jne .no_in_wnd |
4206 | jne .no_in_wnd |
4210 | .horizontal: |
4207 | .horizontal: |
4211 | mov eax,[edx+sb_offs_max_area] |
4208 | mov eax,[edx+sb_offs_max_area] |
4212 | cmp eax,[edx+sb_offs_cur_area] |
4209 | cmp eax,[edx+sb_offs_cur_area] |
4213 | jbe .other |
4210 | jbe .other |
4214 | ; mouse event for Horizontal ScrollBar |
4211 | ; mouse event for Horizontal ScrollBar |
4215 | stdcall scroll_bar_horizontal.mouse,edx ;[scrollbar_hor_mouse] |
4212 | stdcall scroll_bar_horizontal.mouse,edx ;[scrollbar_hor_mouse] |
4216 | cmp dword[edx+sb_offs_redraw],0 |
4213 | cmp dword[edx+sb_offs_redraw],0 |
4217 | je .other |
4214 | je .other |
4218 | mov dword[edx+sb_offs_redraw],0 |
4215 | mov dword[edx+sb_offs_redraw],0 |
4219 | stdcall ted_draw,edi |
4216 | stdcall ted_draw,edi |
4220 | jmp .no_in_wnd |
4217 | jmp .no_in_wnd |
4221 | .other: |
4218 | .other: |
4222 | cmp word[ecx+sb_offs_delta2],0 |
4219 | cmp word[ecx+sb_offs_delta2],0 |
4223 | jne .no_in_wnd |
4220 | jne .no_in_wnd |
4224 | cmp word[edx+sb_offs_delta2],0 |
4221 | cmp word[edx+sb_offs_delta2],0 |
4225 | jne .no_in_wnd |
4222 | jne .no_in_wnd |
4226 | 4223 | ||
4227 | ;®¡à ¡ âë¢ ¥¬ ®ª® । ªâ®à |
4224 | ;®¡à ¡ âë¢ ¥¬ ®ª® । ªâ®à |
4228 | mcall SF_MOUSE_GET,SSF_BUTTON |
4225 | mcall SF_MOUSE_GET,SSF_BUTTON |
4229 | cmp al,1 |
4226 | cmp al,1 |
4230 | jne @f |
4227 | jne @f |
4231 | mcall SF_MOUSE_GET,SSF_WINDOW_POSITION |
4228 | mcall SF_MOUSE_GET,SSF_WINDOW_POSITION |
4232 | mov ebx,ted_wnd_t |
4229 | mov ebx,ted_wnd_t |
4233 | add ebx,ted_rec_t |
4230 | add ebx,ted_rec_t |
4234 | cmp ax,bx |
4231 | cmp ax,bx |
4235 | jl @f ;y_mouse |
4232 | jl @f ;y_mouse |
4236 | 4233 | ||
4237 | sub ebx,ted_rec_t |
4234 | sub ebx,ted_rec_t |
4238 | add ebx,ted_wnd_h |
4235 | add ebx,ted_wnd_h |
4239 | cmp bx,ax |
4236 | cmp bx,ax |
4240 | jl @f ;y_mouse>y_wnd |
4237 | jl @f ;y_mouse>y_wnd |
4241 | 4238 | ||
4242 | mov ebx,ted_wnd_l |
4239 | mov ebx,ted_wnd_l |
4243 | add ebx,ted_rec_l |
4240 | add ebx,ted_rec_l |
4244 | mov ecx,eax |
4241 | mov ecx,eax |
4245 | shr ecx,16 |
4242 | shr ecx,16 |
4246 | cmp cx,bx |
4243 | cmp cx,bx |
4247 | jl @f ;x_mouse |
4244 | jl @f ;x_mouse |
4248 | 4245 | ||
4249 | sub ebx,ted_rec_l |
4246 | sub ebx,ted_rec_l |
4250 | add ebx,ted_wnd_w |
4247 | add ebx,ted_wnd_w |
4251 | cmp bx,cx |
4248 | cmp bx,cx |
4252 | jl @f ;x_mouse>x_wnd |
4249 | jl @f ;x_mouse>x_wnd |
4253 | 4250 | ||
4254 | call ted_draw_cursor_sumb |
4251 | call ted_draw_cursor_sumb |
4255 | call ted_wnd_main_click |
4252 | call ted_wnd_main_click |
4256 | jmp .no_in_wnd |
4253 | jmp .no_in_wnd |
4257 | @@: |
4254 | @@: |
4258 | mov edx,ted_el_focus |
4255 | mov edx,ted_el_focus |
4259 | cmp [edx],edi |
4256 | cmp [edx],edi |
4260 | jne @f |
4257 | jne @f |
4261 | call ted_wnd_main_mouse_scroll ;ᬮâਬ ¯à®ªàãâªã ª®«¥á ¬ëè¨ |
4258 | call ted_wnd_main_mouse_scroll ;ᬮâਬ ¯à®ªàãâªã ª®«¥á ¬ëè¨ |
4262 | @@: |
4259 | @@: |
4263 | cmp ted_drag_m,0 |
4260 | cmp ted_drag_m,0 |
4264 | je .no_in_wnd |
4261 | je .no_in_wnd |
4265 | mov ted_drag_m,0 |
4262 | mov ted_drag_m,0 |
4266 | stdcall ted_draw,edi |
4263 | stdcall ted_draw,edi |
4267 | cmp ted_fun_draw_panel_buttons,0 |
4264 | cmp ted_fun_draw_panel_buttons,0 |
4268 | je .no_in_wnd |
4265 | je .no_in_wnd |
4269 | call ted_fun_draw_panel_buttons |
4266 | call ted_fun_draw_panel_buttons |
4270 | .no_in_wnd: |
4267 | .no_in_wnd: |
4271 | popad |
4268 | popad |
4272 | ret |
4269 | ret |
4273 | endp |
4270 | endp |
4274 | 4271 | ||
4275 | ;input: |
4272 | ;input: |
4276 | ; eax -> (x,y) |
4273 | ; eax -> (x,y) |
4277 | ; edi -> 㪠§ ⥫ì áâàãªâãàã tedit |
4274 | ; edi -> 㪠§ ⥫ì áâàãªâãàã tedit |
4278 | ;description: |
4275 | ;description: |
4279 | ; äãªæ¨ï ¢ë§ë¢¥âáï ¯à¨ ¦ ⨨ ª®¯ª®© ¬ëè¨ ¨ ¯®¯ ¤¥¨¨ ªãàá®à®¬ ¢ ®ª® । ªâ®à |
4276 | ; äãªæ¨ï ¢ë§ë¢¥âáï ¯à¨ ¦ ⨨ ª®¯ª®© ¬ëè¨ ¨ ¯®¯ ¤¥¨¨ ªãàá®à®¬ ¢ ®ª® । ªâ®à |
4280 | align 16 |
4277 | align 16 |
4281 | ted_wnd_main_click: |
4278 | ted_wnd_main_click: |
4282 | push ebx ecx edx |
4279 | push ebx ecx edx |
4283 | mov ebx,ted_el_focus |
4280 | mov ebx,ted_el_focus |
4284 | mov [ebx],edi ;áâ ¢¨¬ 䮪ãá |
4281 | mov [ebx],edi ;áâ ¢¨¬ 䮪ãá |
4285 | 4282 | ||
4286 | push eax |
4283 | push eax |
4287 | shr eax,16 |
4284 | shr eax,16 |
4288 | sub eax,ted_wnd_l |
4285 | sub eax,ted_wnd_l |
4289 | sub eax,ted_rec_l |
4286 | sub eax,ted_rec_l |
4290 | 4287 | ||
4291 | xor edx,edx |
4288 | xor edx,edx |
4292 | mov ecx,ted_rec_w |
4289 | mov ecx,ted_rec_w |
4293 | div cx |
4290 | div cx |
4294 | ;inc eax |
4291 | ;inc eax |
4295 | mov ebx,ted_scr_h |
4292 | mov ebx,ted_scr_h |
4296 | cmp eax,[ebx+sb_offs_cur_area] |
4293 | cmp eax,[ebx+sb_offs_cur_area] |
4297 | jle @f |
4294 | jle @f |
4298 | mov eax,[ebx+sb_offs_cur_area] |
4295 | mov eax,[ebx+sb_offs_cur_area] |
4299 | @@: |
4296 | @@: |
4300 | ;dec eax |
4297 | ;dec eax |
4301 | mov ted_cur_x,eax |
4298 | mov ted_cur_x,eax |
4302 | pop eax |
4299 | pop eax |
4303 | 4300 | ||
4304 | push eax |
4301 | push eax |
4305 | and eax,0xffff |
4302 | and eax,0xffff |
4306 | sub eax,ted_wnd_t |
4303 | sub eax,ted_wnd_t |
4307 | sub eax,ted_rec_t |
4304 | sub eax,ted_rec_t |
4308 | 4305 | ||
4309 | xor edx,edx |
4306 | xor edx,edx |
4310 | mov ecx,ted_rec_h |
4307 | mov ecx,ted_rec_h |
4311 | div cx |
4308 | div cx |
4312 | inc eax |
4309 | inc eax |
4313 | mov ebx,ted_scr_w |
4310 | mov ebx,ted_scr_w |
4314 | cmp eax,[ebx+sb_offs_cur_area] |
4311 | cmp eax,[ebx+sb_offs_cur_area] |
4315 | jle @f |
4312 | jle @f |
4316 | mov eax,[ebx+sb_offs_cur_area] |
4313 | mov eax,[ebx+sb_offs_cur_area] |
4317 | @@: |
4314 | @@: |
4318 | dec eax |
4315 | dec eax |
4319 | mov ted_cur_y,eax |
4316 | mov ted_cur_y,eax |
4320 | pop eax |
4317 | pop eax |
4321 | 4318 | ||
4322 | cmp ted_drag_m,0 |
4319 | cmp ted_drag_m,0 |
4323 | je @f |
4320 | je @f |
4324 | call ted_sel_move |
4321 | call ted_sel_move |
4325 | jmp .sel_move |
4322 | jmp .sel_move |
4326 | @@: |
4323 | @@: |
4327 | mov ted_drag_m,1 |
4324 | mov ted_drag_m,1 |
4328 | call ted_sel_start |
4325 | call ted_sel_start |
4329 | .sel_move: |
4326 | .sel_move: |
4330 | pop edx ecx ebx |
4327 | pop edx ecx ebx |
4331 | ret |
4328 | ret |
4332 | 4329 | ||
4333 | ;input: |
4330 | ;input: |
4334 | ; edi = pointer to tedit struct |
4331 | ; edi = pointer to tedit struct |
4335 | align 16 |
4332 | align 16 |
4336 | ted_wnd_main_mouse_scroll: |
4333 | ted_wnd_main_mouse_scroll: |
4337 | push eax ebx ecx |
4334 | push eax ebx ecx |
4338 | mcall SF_MOUSE_GET,SSF_SCROLL_DATA |
4335 | mcall SF_MOUSE_GET,SSF_SCROLL_DATA |
4339 | or ax,ax |
4336 | or ax,ax |
4340 | jz .no_scroll |
4337 | jz .no_scroll |
4341 | mov ecx,ted_scr_w |
4338 | mov ecx,ted_scr_w |
4342 | movsx eax,ax |
4339 | movsx eax,ax |
4343 | lea eax,[eax+eax*2] ;㬮¦ ¥¬ 3 (ç¨á«® áâப ¯à®ªàã⪨ § ®¤® ¤¢¨¦¥¨¥ ª®«¥á ¬ëè¨) |
4340 | lea eax,[eax+eax*2] ;㬮¦ ¥¬ 3 (ç¨á«® áâப ¯à®ªàã⪨ § ®¤® ¤¢¨¦¥¨¥ ª®«¥á ¬ëè¨) |
4344 | add eax,[ecx+sb_offs_position] |
4341 | add eax,[ecx+sb_offs_position] |
4345 | mov ebx,[ecx+sb_offs_max_area] |
4342 | mov ebx,[ecx+sb_offs_max_area] |
4346 | shl ebx,1 |
4343 | shl ebx,1 |
4347 | sub ebx,[ecx+sb_offs_cur_area] ;®â¨¬ ¥¬ ¯®«®¢¨ã ¢ëá®âë ®ª |
4344 | sub ebx,[ecx+sb_offs_cur_area] ;®â¨¬ ¥¬ ¯®«®¢¨ã ¢ëá®âë ®ª |
4348 | shr ebx,1 |
4345 | shr ebx,1 |
4349 | cmp eax,ebx |
4346 | cmp eax,ebx |
4350 | jae .no_scroll |
4347 | jae .no_scroll |
4351 | mov ebx,ted_cur_y ;¯®§¨æ¨ï ªãàá®à |
4348 | mov ebx,ted_cur_y ;¯®§¨æ¨ï ªãàá®à |
4352 | sub ebx,eax ;- ®¢ ï ¯®§¨æ¨ï áªà®««¨£ |
4349 | sub ebx,eax ;- ®¢ ï ¯®§¨æ¨ï áªà®««¨£ |
4353 | add ebx,[ecx+sb_offs_position] ;+ áâ à ï ¯®§¨æ¨ï áªà®««¨£ |
4350 | add ebx,[ecx+sb_offs_position] ;+ áâ à ï ¯®§¨æ¨ï áªà®««¨£ |
4354 | bt ebx,31 |
4351 | bt ebx,31 |
4355 | jnc @f |
4352 | jnc @f |
4356 | xor ebx,ebx ;¥á«¨ ªãàá®à áâ « ¢ëè¥ ®ª , â® áâ ¢¨¬ ¢¥àåîî áâபã |
4353 | xor ebx,ebx ;¥á«¨ ªãàá®à áâ « ¢ëè¥ ®ª , â® áâ ¢¨¬ ¢¥àåîî áâபã |
4357 | @@: |
4354 | @@: |
4358 | inc ebx |
4355 | inc ebx |
4359 | cmp ebx,[ecx+sb_offs_cur_area] |
4356 | cmp ebx,[ecx+sb_offs_cur_area] |
4360 | jle @f |
4357 | jle @f |
4361 | mov ebx,[ecx+sb_offs_cur_area] ;¥á«¨ ªãàá®à áâ « ¨¦¥ ®ª , â® áâ ¢¨¬ ¨¦îî áâபã |
4358 | mov ebx,[ecx+sb_offs_cur_area] ;¥á«¨ ªãàá®à áâ « ¨¦¥ ®ª , â® áâ ¢¨¬ ¨¦îî áâபã |
4362 | @@: |
4359 | @@: |
4363 | dec ebx |
4360 | dec ebx |
4364 | mov ted_cur_y,ebx |
4361 | mov ted_cur_y,ebx |
4365 | mov [ecx+sb_offs_position],eax |
4362 | mov [ecx+sb_offs_position],eax |
4366 | stdcall ted_draw,edi |
4363 | stdcall ted_draw,edi |
4367 | .no_scroll: |
4364 | .no_scroll: |
4368 | pop ecx ebx eax |
4365 | pop ecx ebx eax |
4369 | ret |
4366 | ret |
4370 | 4367 | ||
4371 | align 16 |
4368 | align 16 |
4372 | proc ted_save_file, edit:dword, file:dword, f_name:dword |
4369 | proc ted_save_file, edit:dword, file:dword, f_name:dword |
4373 | pushad |
4370 | pushad |
4374 | mov edi,[edit] |
4371 | mov edi,[edit] |
4375 | 4372 | ||
4376 | stdcall ted_can_save,edi |
4373 | stdcall ted_can_save,edi |
4377 | ;or al,al |
4374 | ;or al,al |
4378 | ;jz .no_save |
4375 | ;jz .no_save |
4379 | 4376 | ||
4380 | mov ecx,ted_max_chars |
4377 | mov ecx,ted_max_chars |
4381 | invoke mem.alloc,ecx |
4378 | invoke mem.alloc,ecx |
4382 | push eax ;§ ¯®¬¨ ¥¬ 㪠§ â¥«ì ¢ë¤¥«¥ãî ¯ ¬ïâì |
4379 | push eax ;§ ¯®¬¨ ¥¬ 㪠§ â¥«ì ¢ë¤¥«¥ãî ¯ ¬ïâì |
4383 | 4380 | ||
4384 | mov edx,ted_tex |
4381 | mov edx,ted_tex |
4385 | xor ecx,ecx |
4382 | xor ecx,ecx |
4386 | @@: |
4383 | @@: |
4387 | call ted_iterat_next |
4384 | call ted_iterat_next |
4388 | cmp edx,ted_tex_1 |
4385 | cmp edx,ted_tex_1 |
4389 | jle @f ;edx = ted_tex or edx = ted_tex+sizeof.symbol |
4386 | jle @f ;edx = ted_tex or edx = ted_tex+sizeof.symbol |
4390 | mov bl,[edx] |
4387 | mov bl,[edx] |
4391 | mov byte[eax],bl |
4388 | mov byte[eax],bl |
4392 | inc eax |
4389 | inc eax |
4393 | inc ecx |
4390 | inc ecx |
4394 | jmp @b |
4391 | jmp @b |
4395 | align 4 |
4392 | align 4 |
4396 | @@: |
4393 | @@: |
4397 | 4394 | ||
4398 | or ecx,ecx |
4395 | or ecx,ecx |
4399 | jz @f |
4396 | jz @f |
4400 | mov ebx,[file] |
4397 | mov ebx,[file] |
4401 | pop eax ;§ ¯¨áë¢ ¥¬ 㪠§ â¥«ì ¢ë¤¥«¥ãî ¯ ¬ïâì |
4398 | pop eax ;§ ¯¨áë¢ ¥¬ 㪠§ â¥«ì ¢ë¤¥«¥ãî ¯ ¬ïâì |
4402 | mov [ebx+16],eax |
4399 | mov [ebx+16],eax |
4403 | push eax ;®¡à â® § ¯®¬¨ ¥¬ 㪠§ â¥«ì ¢ë¤¥«¥ãî ¯ ¬ïâì |
4400 | push eax ;®¡à â® § ¯®¬¨ ¥¬ 㪠§ â¥«ì ¢ë¤¥«¥ãî ¯ ¬ïâì |
4404 | mov dword[ebx], SSF_CREATE_FILE |
4401 | mov dword[ebx], SSF_CREATE_FILE |
4405 | mov dword[ebx+4], 0 |
4402 | mov dword[ebx+4], 0 |
4406 | mov dword[ebx+8], 0 |
4403 | mov dword[ebx+8], 0 |
4407 | mov [ebx+12], ecx |
4404 | mov [ebx+12], ecx |
4408 | mov byte[ebx+20], 0 |
4405 | mov byte[ebx+20], 0 |
4409 | push dword[f_name] |
4406 | push dword[f_name] |
4410 | pop dword[ebx+21] |
4407 | pop dword[ebx+21] |
4411 | mcall SF_FILE |
4408 | mcall SF_FILE |
4412 | 4409 | ||
4413 | mov ted_err_save,al |
4410 | mov ted_err_save,al |
4414 | 4411 | ||
4415 | or eax,eax |
4412 | or eax,eax |
4416 | jz .no_msg |
4413 | jz .no_msg |
4417 | cmp ax,10 |
4414 | cmp ax,10 |
4418 | jl .zifra_0_9 |
4415 | jl .zifra_0_9 |
4419 | mov al,'?' |
4416 | mov al,'?' |
4420 | sub ax,48 |
4417 | sub ax,48 |
4421 | .zifra_0_9: |
4418 | .zifra_0_9: |
4422 | add ax,48 |
4419 | add ax,48 |
4423 | cmp ted_fun_save_err,0 |
4420 | cmp ted_fun_save_err,0 |
4424 | je @f |
4421 | je @f |
4425 | call ted_fun_save_err |
4422 | call ted_fun_save_err |
4426 | jmp @f |
4423 | jmp @f |
4427 | .no_msg: |
4424 | .no_msg: |
4428 | m2m ted_tim_ls,ted_tim_ch |
4425 | m2m ted_tim_ls,ted_tim_ch |
4429 | @@: |
4426 | @@: |
4430 | 4427 | ||
4431 | pop ecx ;§ ¯¨áë¢ ¥¬ 㪠§ â¥«ì ¢ë¤¥«¥ãî ¯ ¬ïâì |
4428 | pop ecx ;§ ¯¨áë¢ ¥¬ 㪠§ â¥«ì ¢ë¤¥«¥ãî ¯ ¬ïâì |
4432 | invoke mem.free,ecx |
4429 | invoke mem.free,ecx |
4433 | .no_save: |
4430 | .no_save: |
4434 | popad |
4431 | popad |
4435 | ret |
4432 | ret |
4436 | endp |
4433 | endp |
4437 | 4434 | ||
4438 | > |
4435 | > |
4439 | 4436 | ||
4440 | > |
4437 | > |
4441 | > |
4438 | > |
4442 | >>>> |
4439 | >>>> |
4443 | >1>=ted_tim_ch>-] |
4440 | >1>=ted_tim_ch>-] |
4444 | > |
4441 | > |