Subversion Repositories Kolibri OS

Rev

Rev 1449 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1449 Rev 1456
1
struct f70
1
struct f70
2
  func_n dd ?
2
  func_n dd ?
3
  param1 dd ?
3
  param1 dd ?
4
  param2 dd ?
4
  param2 dd ?
5
  param3 dd ?
5
  param3 dd ?
6
  param4 dd ?
6
  param4 dd ?
7
  rezerv db ?
7
  rezerv db ?
8
  name dd ?
8
  name dd ?
9
ends
9
ends
10
 
10
 
11
struct TexColViv
11
struct TexColViv
12
  Text rb MAX_COLOR_WORD_LEN; // ñëîâî
12
  Text rb MAX_COLOR_WORD_LEN; // ñëîâî
13
  f1 dd 0
13
  f1 dd 0
14
  wwo db ? ; whole words only
14
  wwo db ? ; whole words only
15
  endc db ? ; ñèìâîë êîíöà âûäåëåíèÿ (wwo&4)
15
  endc db ? ; ñèìâîë êîíöà âûäåëåíèÿ (wwo&4)
16
  color db ? ; íîìåð öâåòà
16
  color db ? ; íîìåð öâåòà
17
ends
17
ends
18
 
18
 
19
struct symbol
19
struct symbol
20
  c db ?    ;  +0 ñèìâîë
20
  c db ?    ;  +0 ñèìâîë
21
  col db ?  ;  +1 öâåò
21
  col db ?  ;  +1 öâåò
22
  perv dd ? ;  +2
22
  perv dd ? ;  +2
23
  next dd ? ;  +6 óêàçàòåëè
23
  next dd ? ;  +6 óêàçàòåëè
24
  tc dd ?   ; +10 âðåì. ñîçäàíèÿ
24
  tc dd ?   ; +10 âðåì. ñîçäàíèÿ
25
  td dd ?   ; +14 âðåì. óäàëåíèÿ
25
  td dd ?   ; +14 âðåì. óäàëåíèÿ
26
ends
26
ends
27
 
-
 
28
ColColor dd 1
-
 
29
ColWords dd 0
-
 
30
CURSOR_COLOR dd 0x808080
-
 
31
WND_CAPT_COLOR dd 0x80
-
 
32
WND_WORK_COLOR dd 0x0
-
 
33
WND_BORD_COLOR dd 0xd0d0d0
-
 
34
SELECT_COLOR dd 0x208080
-
 
35
CUR_TEXT_COLOR dd 0xff0000
-
 
36
WND_TEXT_COLOR dd 0xffff00
-
 
37
 
-
 
38
options_file dd 0
-
 
39
options_file_end dd 0
-
 
40
tex_colors dd 0
-
 
41
tex_help_f1 dd 0
-
 
42
 
-
 
43
FkPos: rd 256
-
 
44
Col dd 0 ;óêàçàòåëü íà ñòðóêòóðû êëþ÷åâûõ ñëîâ TexColViv
-
 
45
 
-
 
46
conv_tabl rb 128 ; òàáëèöà äëÿ êîíâåðòèðîâàíèÿ scan-êîäà â ascii-êîä
-
 
47
keyUpr dd 0
-
 
48
 
-
 
49
err_sav db 0 ;îøèáêà ñîõðàíåíèÿ ôàéëà
-
 
50
panel_id db 0 ;íîìåð îòêðûòîé ïàíåëè
-
 
51
 
-
 
52
ch_tim	 dd ? ; êîëè÷åñòâî èçìåíåíèé â ôàéëå
-
 
53
ls_tim	 dd ? ; âðåìÿ ïîñëåäíåãî ñîõðàíåíèÿ
-
 
54
co_tim	 dd ? ; âðåìÿ ïîñëåäíåé öâåòîâîé ðàçìåòêè
-
 
55
tim_Undo dd ? ; êîëè÷åñòâî îòìåíåííûõ äåéñòâèé
-
 
56
gpOpt db 0
-
 
57
mode_colored db 1 ; ðåæèì âûäåëåíèÿ ñëîâ öâåòîì (0-âûêë. 1-âêë.)
-
 
58
 
-
 
59
key_new db 0 ; ñèìâîë, êîòîðûé áóäåò äîáàâëÿòñÿ ñ êëàâèàòóðû
-
 
60
tex	dd 0 ;text memory pointer
-
 
61
tex_1	dd 0 ;text first symbol pointer
-
 
62
tex_end dd 0 ;text end memory pointer
-
 
63
 
-
 
64
curMod db 1
-
 
65
cur_x dd 0
-
 
66
cur_y dd 0
-
 
67
invis db 0 ;ðåæèì ïîêàçà íåïå÷àòàåìûõ ñèìâîëîâ
-
 
68
symbol_new_line db 20 ;ñèìâîë çàâåðøåíèÿ ñòðîêè
-
 
69
help_id dd -1  ;èäåíòèôèêàòîð äëÿ ñïðàâêè
27
 
70
 
28
 
71
hed db 'TextEditor 15.04.10',0 ;ïîäïèñü îêíà
29
hed db 'TextEditor 22.04.10',0 ;ïîäïèñü îêíà
72
sc system_colors
30
sc system_colors
73
 
31
 
74
fn_icon db 'te_icon.bmp',0
32
fn_icon db 'te_icon.bmp',0
75
bmp_icon dd 0
33
bmp_icon dd 0
76
run_file_70 f70 	  
34
run_file_70 f70 	  
77
 
35
 
78
 
36
 
79
;input:
37
;input:
-
 
38
; edi = pointer to tedit struct
80
; reg = index
39
; reg = index
81
;output:
40
;output:
82
; reg = pointer to 'tex' struct
41
; reg = pointer to 'tex' struct
83
macro ConvertIndexToPointer reg {
42
macro ConvertIndexToPointer reg {
84
  imul reg,sizeof.symbol
43
  imul reg,sizeof.symbol
85
  add reg,[tex]
44
  add reg,ted_tex
86
}
45
}
-
 
46
 
-
 
47
align 4
-
 
48
proc ted_init, edit:dword
-
 
49
  push eax ecx edi
-
 
50
  mov edi,dword[edit]
-
 
51
 
-
 
52
  mov ecx,sizeof.symbol*maxChars
-
 
53
  call mem_Alloc ;âûäåëÿåì ïàìÿòü
-
 
54
  mov ted_tex,eax
-
 
55
  mov ted_tex_1,eax
-
 
56
  add ted_tex_1,sizeof.symbol
-
 
57
  mov ted_tex_end,eax
-
 
58
  add ted_tex_end,sizeof.symbol*maxChars
-
 
59
 
-
 
60
  stdcall ted_clear, edi,1
-
 
61
 
-
 
62
;-------------------------------------------------
-
 
63
  mov ecx,maxColWords*sizeof.TexColViv+40
-
 
64
  ;add ecx,40
-
 
65
  call mem_Alloc
-
 
66
  mov ted_syntax_file,eax
-
 
67
  mov ted_syntax_file_end,eax
-
 
68
  add ted_syntax_file_end,ecx
-
 
69
 
-
 
70
  pop edi ecx eax
-
 
71
  ret
-
 
72
endp
-
 
73
 
-
 
74
align 4
-
 
75
proc ted_delete, edit:dword
-
 
76
  push ecx edi
-
 
77
  mov edi,dword[edit]
-
 
78
 
-
 
79
  mov ecx,ted_tex
-
 
80
  call mem_Free
-
 
81
  mov ecx,ted_syntax_file
-
 
82
  call mem_Free
-
 
83
 
-
 
84
  pop edi ecx
-
 
85
  ret
-
 
86
endp
-
 
87
 
-
 
88
 
-
 
89
;input:
-
 
90
; eax = key kodes
-
 
91
; ebx = key control
-
 
92
align 4
-
 
93
proc ted_key, edit:dword, table:dword
-
 
94
  pushad
-
 
95
  mov edi,dword[edit]
-
 
96
 
-
 
97
  cmp ah,KEY_F1 ;[F1]
-
 
98
  jne @f
-
 
99
    stdcall ted_show_help_f1,edi
-
 
100
    jmp .end_key_fun
-
 
101
  @@:
-
 
102
  cmp ah,KEY_F3 ;[F3]
-
 
103
  jne @f
-
 
104
    stdcall but_FindText,edi
-
 
105
    jmp .end_key_fun
-
 
106
  @@:
-
 
107
 
-
 
108
  test ebx,KM_CTRL ;Ctrl+...
-
 
109
  jz .key_Ctrl
-
 
110
 
-
 
111
    cmp ah,24 ;Ctrl+O
-
 
112
    jne @f
-
 
113
      call but_OpenFile
-
 
114
    @@:
-
 
115
    cmp ah,33 ;Ctrl+F
-
 
116
    jne @f
-
 
117
    cmp ted_panel_id,TE_PANEL_FIND
-
 
118
    je @f
-
 
119
      stdcall but_find,edi
-
 
120
    @@:
-
 
121
    cmp ah,44 ;Ctrl+Z
-
 
122
	jne @f
-
 
123
      stdcall ted_but_undo,edi
-
 
124
	@@:
-
 
125
    cmp ah,46 ;Ctrl+C
-
 
126
    jne @f
-
 
127
      stdcall ted_but_copy,edi
-
 
128
    @@:
-
 
129
    cmp ah,47 ;Ctrl+V
-
 
130
    jne @f
-
 
131
      stdcall ted_but_paste,edi
-
 
132
    @@:
-
 
133
    cmp ah,49 ;Ctrl+N
-
 
134
    jne @f
-
 
135
      call but_NewFile
-
 
136
    @@:
-
 
137
    cmp ah,199 ;Ctrl+Home
-
 
138
    jne @f
-
 
139
      call but_CtrlHome
-
 
140
    @@:
-
 
141
    ;jmp .end_key_fun
-
 
142
  .key_Ctrl:
-
 
143
 
-
 
144
  test ebx,KM_SHIFT ;Shift+...
-
 
145
  jz .key_Shift
-
 
146
    cmp ah,72 ;Shift+Up
-
 
147
    jne @f
-
 
148
      stdcall ted_sel_key_up,edi
-
 
149
    @@:
-
 
150
    cmp ah,75 ;Shift+Left
-
 
151
    jne @f
-
 
152
      stdcall ted_sel_key_left,edi
-
 
153
    @@:
-
 
154
    cmp ah,77 ;Shift+Right
-
 
155
    jne @f
-
 
156
      stdcall ted_sel_key_right,edi
-
 
157
    @@:
-
 
158
    cmp ah,80 ;Shift+Down
-
 
159
    jne @f
-
 
160
      stdcall ted_sel_key_down,edi
-
 
161
    @@:
-
 
162
    ;mov ted_drag_k,1 ;íà÷èíàåì âûäåëåíèå îò êëàâèàòóðû
-
 
163
    jmp .key_MoveCur
-
 
164
  .key_Shift:
-
 
165
;-------------------------------------------------
-
 
166
  cmp ah,72 ;178 ;Up
-
 
167
  jne @f
-
 
168
    stdcall draw_cursor_sumb,edi
-
 
169
    call CurMoveUp
-
 
170
    cmp dl,8
-
 
171
    jne .no_red_0
-
 
172
      call OnInitialUpdate
-
 
173
      stdcall draw_main_win,edi
-
 
174
      jmp @f
-
 
175
    .no_red_0:
-
 
176
    stdcall draw_main_cursor,edi
-
 
177
    mov ted_drag_k,0 ;çàêàí÷èâàåì âûäåëåíèå îò êëàâèàòóðû
-
 
178
  @@:
-
 
179
  cmp ah,80 ;177 ;Down
-
 
180
  jne @f
-
 
181
    stdcall draw_cursor_sumb,edi
-
 
182
    call CurMoveDown
-
 
183
    cmp dl,8
-
 
184
    jne .no_red_1
-
 
185
      call OnInitialUpdate
-
 
186
      stdcall draw_main_win,edi
-
 
187
      jmp @f
-
 
188
    .no_red_1:
-
 
189
    stdcall draw_main_cursor,edi
-
 
190
    mov ted_drag_k,0 ;çàêàí÷èâàåì âûäåëåíèå îò êëàâèàòóðû
-
 
191
  @@:
-
 
192
  cmp ah,75 ;176 ;Left
-
 
193
  jne @f
-
 
194
    stdcall draw_cursor_sumb,edi
-
 
195
    call CurMoveLeft
-
 
196
    cmp dl,8
-
 
197
    jne .no_red_2
-
 
198
      call OnInitialUpdate
-
 
199
      stdcall draw_main_win,edi
-
 
200
      jmp @f
-
 
201
    .no_red_2:
-
 
202
    stdcall draw_main_cursor,edi
-
 
203
    mov ted_drag_k,0 ;çàêàí÷èâàåì âûäåëåíèå îò êëàâèàòóðû
-
 
204
  @@:
-
 
205
  cmp ah,77 ;179 ;Right
-
 
206
  jne @f
-
 
207
    stdcall draw_cursor_sumb,edi
-
 
208
    call CurMoveRight
-
 
209
    cmp dl,8
-
 
210
    jne .no_red_3
-
 
211
      call OnInitialUpdate
-
 
212
      stdcall draw_main_win,edi
-
 
213
      jmp @f
-
 
214
    .no_red_3:
-
 
215
    stdcall draw_main_cursor,edi
-
 
216
    mov ted_drag_k,0 ;çàêàí÷èâàåì âûäåëåíèå îò êëàâèàòóðû
-
 
217
  @@:
-
 
218
  cmp ah,71 ;180 ;Home
-
 
219
  jne @f
-
 
220
    stdcall draw_cursor_sumb,edi
-
 
221
    call CurMoveX_FirstChar
-
 
222
    cmp dl,8
-
 
223
    jne .no_red_4
-
 
224
      call OnInitialUpdate
-
 
225
      stdcall draw_main_win,edi
-
 
226
      jmp @f
-
 
227
    .no_red_4:
-
 
228
    stdcall draw_main_cursor,edi
-
 
229
    mov ted_drag_k,0 ;çàêàí÷èâàåì âûäåëåíèå îò êëàâèàòóðû
-
 
230
  @@:
-
 
231
  cmp ah,79 ;181 ;End
-
 
232
  jne @f
-
 
233
    stdcall draw_cursor_sumb,edi
-
 
234
    call CurMoveX_LastChar
-
 
235
    cmp dl,8
-
 
236
    jne .no_red_5
-
 
237
      call OnInitialUpdate
-
 
238
      stdcall draw_main_win,edi
-
 
239
      jmp @f
-
 
240
    .no_red_5:
-
 
241
    stdcall draw_main_cursor,edi
-
 
242
    mov ted_drag_k,0 ;çàêàí÷èâàåì âûäåëåíèå îò êëàâèàòóðû
-
 
243
  @@:
-
 
244
  cmp ah,73 ;184 ;PageUp
-
 
245
  jne @f
-
 
246
    call CurMovePageUp
-
 
247
    cmp dl,0
-
 
248
    je @f
-
 
249
    call OnInitialUpdate
-
 
250
    stdcall draw_main_win,edi
-
 
251
  @@:
-
 
252
  cmp ah,81 ;183 ;PageDown
-
 
253
  jne @f
-
 
254
    call CurMovePageDown
-
 
255
    cmp dl,0
-
 
256
    je @f
-
 
257
    call OnInitialUpdate
-
 
258
    stdcall draw_main_win,edi
-
 
259
    mov ted_drag_k,0 ;çàêàí÷èâàåì âûäåëåíèå îò êëàâèàòóðû
-
 
260
  @@:
-
 
261
;-------------------------------------------------
-
 
262
;    cmp ebx,0
-
 
263
;    jne .end_key_fun
-
 
264
  .key_MoveCur:
-
 
265
 
-
 
266
  cmp ah,69 ;[Pause Break]
-
 
267
  je .end_key_fun
-
 
268
  cmp ah,120 ;[Fn]
-
 
269
  je .end_key_fun
-
 
270
  cmp ah,0x80 ;if key up
-
 
271
  ja .end_key_fun
-
 
272
 
-
 
273
  cmp dword[table],0
-
 
274
  je @f
-
 
275
    stdcall KeyConvertToASCII, dword[table]
-
 
276
  @@:
-
 
277
 
-
 
278
  ;mov ted_drag_k,0 ;çàêàí÷èâàåì âûäåëåíèå îò êëàâèàòóðû
-
 
279
 
-
 
280
  xor edx,edx
-
 
281
  mov dl,ah
-
 
282
  add edx,EvChar ;add char to text
-
 
283
  cmp byte [edx],1
-
 
284
  jne @f
-
 
285
    mov ted_key_new,ah
-
 
286
    stdcall ted_set_undo,edi
-
 
287
    mov edx,ted_opt_ed_change_time+ted_opt_ed_move_cursor
-
 
288
    stdcall SelTextDel,edx
-
 
289
    cmp al,1
-
 
290
    jne .del
-
 
291
      mov edx,ted_opt_ed_move_cursor
-
 
292
    .del:
-
 
293
    cmp ted_cur_ins,1
-
 
294
    je .no_ins_mod
-
 
295
      stdcall TextDel,edi,ted_opt_ed_change_time
-
 
296
	  mov edx,ted_opt_ed_move_cursor
-
 
297
    .no_ins_mod:
-
 
298
	mov ecx,edi
-
 
299
	add ecx,ted_offs_key_new
-
 
300
    stdcall ted_text_add,edi,ecx,1,edx ;äîáàâëÿåì ñèìâîë ââåäåííûé ñ êëàâèàòóðû
-
 
301
    call draw_but_toolbar
-
 
302
    cmp ted_key_new,13
-
 
303
    jne .dr_m_win
-
 
304
      stdcall draw_main_win,edi
-
 
305
      jmp .dr_cur_l
-
 
306
    .dr_m_win:
-
 
307
      stdcall draw_cur_line,edi
-
 
308
    .dr_cur_l:
-
 
309
  @@:
-
 
310
 
-
 
311
  cmp ah,8 ;[<-]
-
 
312
  jne @f
-
 
313
    stdcall ted_set_undo,edi
-
 
314
    stdcall SelTextDel,ted_opt_ed_change_time
-
 
315
    cmp al,1
-
 
316
    je .del_one_b
-
 
317
      stdcall TextDel,edi,ted_opt_ed_change_time+ted_opt_ed_move_cursor
-
 
318
    .del_one_b:
-
 
319
    call draw_but_toolbar
-
 
320
    stdcall draw_main_win,edi
-
 
321
    jmp .end_key_fun
-
 
322
  @@:
-
 
323
 
-
 
324
  cmp ah,182 ;Delete
-
 
325
  jne @f
-
 
326
    stdcall ted_set_undo,edi
-
 
327
    stdcall SelTextDel,ted_opt_ed_change_time
-
 
328
    cmp al,1
-
 
329
    je .del_one_d
-
 
330
      stdcall TextDel,edi,ted_opt_ed_change_time
-
 
331
    .del_one_d:
-
 
332
    call draw_but_toolbar
-
 
333
    stdcall draw_main_win,edi
-
 
334
    jmp .end_key_fun
-
 
335
  @@:
-
 
336
 
-
 
337
  cmp ah,185 ;Ins
-
 
338
  jne @f
-
 
339
    stdcall draw_cursor_sumb,edi
-
 
340
    xor ted_cur_ins,1
-
 
341
    stdcall draw_main_cursor,edi
-
 
342
  @@:
-
 
343
 
-
 
344
  .end_key_fun:
-
 
345
  popad
-
 
346
  ret
87
 
347
endp
88
 
348
 
89
;output:
349
;output:
90
; al = 1 - can save
350
; al = 1 - can save
91
CanSave:
351
align 4
-
 
352
proc ted_can_save, edit:dword
92
  push ecx
353
  push ecx edi
-
 
354
  mov edi,dword[edit]
-
 
355
 
93
  mov ecx,[ch_tim]
356
  mov ecx,ted_tim_ch
94
  sub ecx,[tim_Undo]
357
  sub ecx,ted_tim_undo
95
  mov al,1
358
  mov al,1
96
  cmp [ls_tim],ecx
359
  cmp ted_tim_ls,ecx
97
  jne @f
360
  jne @f
98
    dec al
361
    dec al
99
  @@:
362
  @@:
100
  pop ecx
363
  pop edi ecx
101
  ret
364
  ret
102
 
365
endp
103
 
366
 
104
;output:
367
;output:
105
; al = 1 - selected
368
; al = 1 - selected
-
 
369
align 4
106
proc IsSel, edit:dword
370
proc IsSel, edit:dword
107
  push ebx edi
371
  push ebx edi
108
  mov edi,dword[edit]
372
  mov edi,dword[edit]
109
  xor al,al
373
  xor al,al
110
  cmp ted_drag_m,1
374
  cmp ted_drag_m,1
111
  je @f
375
  je @f
112
    mov al,1
376
    mov al,1
113
    mov ebx,[sel.x0]
377
    mov ebx,ted_sel_x0
114
    cmp ebx,[sel.x1]
378
    cmp ebx,ted_sel_x1
115
    jne @f
379
    jne @f
116
    mov ebx,[sel.y0]
380
    mov ebx,ted_sel_y0
117
    cmp ebx,[sel.y1]
381
    cmp ebx,ted_sel_y1
118
    jne @f
382
    jne @f
119
    xor al,al
383
    xor al,al
120
  @@:
384
  @@:
121
  pop edi ebx
385
  pop edi ebx
122
  ret
386
  ret
123
endp
387
endp
-
 
388
 
124
 
389
align 4
125
SelNormalize:
390
proc SelNormalize, edit:dword
-
 
391
  push ecx esi edi
126
  push ecx esi edi
392
    mov edi,dword[edit]
-
 
393
    mov esi,edi
127
    mov esi,sel
394
    add esi,ted_offs_sel
128
    mov edi,seln
395
    add edi,ted_offs_seln
129
    mov ecx,sizeof.TexSelect
396
    mov ecx,sizeof.TexSelect
130
    rep movsb
397
    rep movsb
-
 
398
 
-
 
399
	mov edi,dword[edit]
131
 
400
 
132
    jmp @f
401
    jmp @f
133
    .swp_f:
402
    .swp_f:
134
      mov ecx,[seln.x0]
403
      mov ecx,ted_seln_x0
135
      m2m [seln.x0],[seln.x1]
404
      m2m ted_seln_x0,ted_seln_x1
136
      mov [seln.x1],ecx
405
      mov ted_seln_x1,ecx
137
 
406
 
138
      mov ecx,[seln.y0]
407
      mov ecx,ted_seln_y0
139
      cmp ecx,[seln.y1] ;(sel.y0>sel.y1)
408
      cmp ecx,ted_seln_y1 ;(sel_y0>sel_y1)
140
      jle .end_f
409
      jle .end_f
141
      m2m [seln.y0],[seln.y1]
410
      m2m ted_seln_y0,ted_seln_y1
142
      mov [seln.y1],ecx
411
      mov ted_seln_y1,ecx
143
 
412
 
144
    jmp .end_f
413
    jmp .end_f
145
    @@:
414
    @@:
146
 
415
 
147
    mov ecx,[seln.y0]
416
    mov ecx,ted_seln_y0
148
    cmp ecx,[seln.y1] ;(sel.y0>sel.y1)
417
    cmp ecx,ted_seln_y1 ;(sel_y0>sel_y1)
149
    jg .swp_f
418
    jg .swp_f
150
 
419
 
151
    cmp ecx,[seln.y1] ;(sel.y0==sel.y1)
420
    cmp ecx,ted_seln_y1 ;(sel_y0==sel_y1)
152
    jne .end_f
421
    jne .end_f
153
      mov ecx,[seln.x0]
422
      mov ecx,ted_seln_x0
154
      cmp ecx,[seln.x1] ;(sel.x0>sel.x1)
423
      cmp ecx,ted_seln_x1 ;(sel_x0>sel_x1)
155
      jg .swp_f
424
      jg .swp_f
156
 
425
 
157
    .end_f:
426
    .end_f:
158
  pop edi esi ecx
427
  pop edi esi ecx
159
  ret
428
  ret
-
 
429
endp
160
 
430
 
-
 
431
align 4
161
SelStart:
432
proc SelStart, edit:dword
-
 
433
  push ecx edi
-
 
434
    mov edi,dword[edit]
162
  push ecx
435
 
163
    mov ecx,[cur_x]
436
    mov ecx,ted_cur_x
164
    add ecx,[hScr.position]
437
    add ecx,[hScr.position]
165
    mov [sel.x0],ecx
438
    mov ted_sel_x0,ecx
166
    mov [sel.x1],ecx
439
    mov ted_sel_x1,ecx
167
 
440
 
168
    mov ecx,[cur_y]
441
    mov ecx,ted_cur_y
169
    add ecx,[wScr.position]
442
    add ecx,[wScr.position]
170
    mov [sel.y0],ecx
443
    mov ted_sel_y0,ecx
171
    mov [sel.y1],ecx
444
    mov ted_sel_y1,ecx
-
 
445
  pop edi ecx
172
  pop ecx
446
  ret
173
  ret
447
endp
174
 
448
 
-
 
449
align 4
-
 
450
proc SelMove, edit:dword
175
align 4
451
  push ecx edi
176
SelMove:
452
    mov edi,dword[edit]
177
  push ecx
453
 
178
    mov ecx,[cur_x]
454
    mov ecx,ted_cur_x
179
    add ecx,[hScr.position]
455
    add ecx,[hScr.position]
180
    mov [sel.x1],ecx
456
    mov ted_sel_x1,ecx
181
 
457
 
182
    mov ecx,[cur_y]
458
    mov ecx,ted_cur_y
183
    add ecx,[wScr.position]
459
    add ecx,[wScr.position]
-
 
460
    mov ted_sel_y1,ecx
184
    mov [sel.y1],ecx
461
  pop edi ecx
185
  pop ecx
462
  call draw_but_toolbar ;redraw toolbar (need to button Copy)
186
  call draw_but_toolbar ;redraw toolbar (need to button Copy)
463
  ret
-
 
464
endp
-
 
465
 
-
 
466
;input:
-
 
467
; cl_al_mem = 1 - clear all memory
187
  ret
468
align 4
188
 
469
proc ted_clear, edit:dword, cl_al_mem:dword
189
;input:
470
  push edi
190
; al = 1 - clear all memory
471
  mov edi,dword[edit]
191
Clear:
472
 
192
  mov [cur_x],0
473
  mov ted_cur_x,0
193
  mov [cur_y],0
474
  mov ted_cur_y,0
194
  mov [ch_tim],0
475
  mov ted_tim_ch,0
195
  mov [ls_tim],0
476
  mov ted_tim_ls,0
196
  mov [co_tim],0
477
  mov ted_tim_co,0
197
  mov [tim_Undo],0
478
  mov ted_tim_undo,0
198
  mov [help_id],-1
479
  mov ted_help_id,-1
199
 
480
 
200
  mov [wScr.position],0
481
  mov [wScr.position],0
201
  mov [wScr.max_area],100
482
  mov [wScr.max_area],100
202
  mov [wScr.redraw],1
483
  mov [wScr.redraw],1
203
  mov [hScr.position],0
484
  mov [hScr.position],0
204
  mov [hScr.max_area],100
485
  mov [hScr.max_area],100
205
 
486
 
206
  mov [sel.x0],0
487
  mov ted_sel_x0,0
207
  mov [sel.y0],0
488
  mov ted_sel_y0,0
208
  mov [sel.x1],0
489
  mov ted_sel_x1,0
209
  mov [sel.y1],0
490
  mov ted_sel_y1,0
210
 
491
 
211
  cmp al,0
492
  cmp dword[cl_al_mem],0
212
  je .exit
493
  je .exit
213
 
494
 
214
  push ecx edx
495
  push ecx edx
215
  mov ecx,sizeof.symbol*maxChars
496
  mov ecx,sizeof.symbol*maxChars
216
  mov edx,[tex]
497
  mov edx,ted_tex
217
  @@:
498
  @@:
218
    mov byte [edx],0
499
    mov byte [edx],0
219
    inc edx
500
    inc edx
220
  loop @b
501
  loop @b
221
  mov edx,[tex]
502
  mov edx,ted_tex
222
  mov dword [edx+6],1
503
  mov dword [edx+6],1
223
  pop edx ecx
504
  pop edx ecx
224
 
505
 
225
  .exit:
506
  .exit:
-
 
507
  pop edi
226
  ret
508
  ret
-
 
509
endp
227
 
-
 
228
 
510
 
229
;--- out_reg = Col[keyw[ind_reg]].Text[0] ---
511
;--- out_reg = Col[ind_reg].Text[0] ---
230
macro ColToIndexOffset ind_reg,out_reg {
512
macro ColToIndexOffset ind_reg,out_reg {
231
  mov out_reg,ind_reg
513
  mov out_reg,ind_reg
232
  imul out_reg,sizeof.TexColViv
514
  imul out_reg,sizeof.TexColViv
233
  add out_reg,[Col]
515
  add out_reg,ted_key_words_data
234
}
516
}
235
 
517
 
236
 
518
 
237
 
519
align 4
-
 
520
proc InitColText, edit:dword
238
InitColText:
521
  pushad
239
  push eax ebx ecx esi edi
522
  mov edi,dword[edit]
240
 
523
 
241
  mov  ebx,dword[fn_col_option]
524
  mov ebx,dword[fn_col_option]
242
  copy_path ebx,fn_syntax_dir,file_name_rez,0x0
525
  copy_path ebx,fn_syntax_dir,file_name_rez,0x0
243
  copy_path file_name_rez,sys_path,file_name,0x0
526
  copy_path file_name_rez,sys_path,file_name,0x0
244
 
527
 
245
  mov eax,70
528
  mov eax,70
246
  mov [run_file_70.func_n], 0
529
  mov [run_file_70.func_n], 0
247
  mov [run_file_70.param1], 0
530
  mov [run_file_70.param1], 0
248
  mov [run_file_70.param2], 0
531
  mov [run_file_70.param2], 0
249
  mov ebx,[options_file_end]
532
  mov ebx,ted_syntax_file_end
250
  sub ebx,[options_file]
533
  sub ebx,ted_syntax_file
251
  mov [run_file_70.param3], ebx
534
  mov [run_file_70.param3], ebx
252
  m2m [run_file_70.param4], [options_file]
535
  m2m [run_file_70.param4], ted_syntax_file
253
  mov [run_file_70.rezerv], 0
536
  mov [run_file_70.rezerv], 0
254
  mov [run_file_70.name], file_name
537
  mov [run_file_70.name], file_name
255
  mov ebx,run_file_70
538
  mov ebx,run_file_70
256
  int 0x40
539
  int 0x40
257
 
540
 
258
  mov ecx,0x100
541
  mov ecx,0x100
259
  mov edi,FkPos
542
  mov edx,FkPos
260
  @@:
543
  @@:
261
    mov dword[edi],-1
544
    mov dword[edx],-1
262
    add edi,4
545
    add edx,4
263
  loop @b
546
  loop @b
264
 
547
 
265
  ;init: ColColor, ColWords, ...
548
  ;init: ted_colors_text_count, ted_key_words_count, ...
266
  mov dword[ColColor],1
549
  mov ted_colors_text_count,1
267
  mov dword[ColWords],0
550
  mov ted_key_words_count,0
268
    mov dword[tex_help_f1],0
551
    mov ted_help_text_f1,0
269
  mov [help_id],-1 ;èäåíòèôèêàòîð ñëîâà äëÿ ñïðàâêè
552
  mov ted_help_id,-1 ;èäåíòèôèêàòîð ñëîâà äëÿ ñïðàâêè
270
 
553
 
271
  cmp eax,6
554
  cmp eax,6
272
  je @f
555
  je @f
273
  cmp eax,0
556
  cmp eax,0
274
  je @f
557
  je @f
275
    cmp ax,10
558
    cmp ax,10
276
    jl .zifra_0_9
559
    jl .zifra_0_9
277
      mov al,'?'
560
      mov al,'?'
278
      sub ax,48
561
      sub ax,48
279
    .zifra_0_9:
562
    .zifra_0_9:
280
    add ax,48
563
    add ax,48
281
 
564
 
282
    mov byte[msgbox_3.err],al
565
    mov byte[msgbox_3.err],al
283
    push thread
-
 
284
    push msgbox_3
-
 
285
    call [mb_create] ;message: Can-t open color options file!
566
    stdcall [mb_create],msgbox_3,thread ;message: Can-t open color options file!
286
    jmp .no_colors
567
    jmp .no_colors
287
  @@:
568
  @@:
-
 
569
 
288
 
570
  mov eax,edi ;ñîõðàíÿåì çíà÷åíèå edi
289
  mov esi,[options_file]
571
  mov esi,ted_syntax_file
290
  mov edi,ColColor
572
  add edi,ted_offs_count_colors
291
  mov ecx,9*4
573
  mov ecx,9*4
-
 
574
  rep movsb
292
  rep movsb
575
  mov edi,eax ;âîñòàíàâëèâàåì çíà÷åíèå edi
293
 
576
 
294
  mov eax,[options_file]
577
  mov eax,ted_syntax_file
295
  add eax,32
578
  add eax,32
296
  mov dword[tex_colors],eax
579
  mov ted_text_colors,eax
297
 
580
 
298
  mov eax,dword[ColColor] ;init: Col (offset to key words)
581
  mov eax,ted_colors_text_count ;init: count_colors_text (offset to key words)
299
  add eax,8
582
  add eax,8
300
  shl eax,2
583
  shl eax,2
301
  add eax,[options_file]
584
  add eax,ted_syntax_file
302
  mov dword[Col],eax
585
  mov ted_key_words_data,eax
303
 
586
 
304
  mov ecx,dword[ColWords] ;init: FkPos (first key positions)
587
  mov ecx,ted_key_words_count ;init: FkPos (first key positions)
305
  xor eax,eax
588
  xor eax,eax
306
  @@:
589
  @@:
307
    ColToIndexOffset eax,edi
590
    ColToIndexOffset eax,edx
308
    xor ebx,ebx
591
    xor ebx,ebx
309
    mov bl,byte[edi]
592
    mov bl,byte[edx]
310
    shl bx,2
593
    shl bx,2
311
    mov esi,FkPos
594
    mov esi,FkPos
312
    add esi,ebx
595
    add esi,ebx
313
    cmp dword[esi],-1
596
    cmp dword[esi],-1
314
    jne .no_ch_key
597
    jne .no_ch_key
315
      mov dword[esi],eax
598
      mov dword[esi],eax
316
    .no_ch_key:
599
    .no_ch_key:
317
    inc eax
600
    inc eax
318
  loop @b
601
  loop @b
319
 
602
 
320
  ;init: tex_help_f1
603
  ;init: ted_help_text_f1
321
  mov ecx,dword[ColWords]
604
  mov ecx,ted_key_words_count
322
  imul ecx,sizeof.TexColViv
605
  imul ecx,sizeof.TexColViv
323
  add ecx,dword[Col]
606
  add ecx,ted_key_words_data
324
  mov dword[tex_help_f1],ecx
607
  mov ted_help_text_f1,ecx
325
 
608
 
326
  .no_colors:
609
  .no_colors:
327
  pop edi esi ecx ebx eax
610
  popad
328
  ret
611
  ret
329
 
612
endp
330
 
613
 
331
;input:
614
;input:
332
; ebx = file size
615
; ebx = file size
-
 
616
; edi = pointer to tedit struct
-
 
617
align 4
333
OpenFile:
618
proc OpenFile
334
  push eax ;destination
619
  push eax ;destination
335
  push ecx ;for cycle
620
  push ecx ;for cycle
336
  push edx ;source
621
  push edx ;source
337
 
-
 
338
    xor al,al
-
 
-
 
622
 
339
    call Clear
623
    stdcall ted_clear,edi,0 ;÷èñòèì íå âñþ ïàìÿòü, ïîòîìó ÷òî íèæå áóäåì åå çàïîëíÿòü íîâûìè äàíûìè
340
    mov eax,ebx
624
    mov eax,ebx
341
    mov ecx,ebx
625
    mov ecx,ebx
342
    add eax,2
626
    add eax,2
343
    ConvertIndexToPointer eax
627
    ConvertIndexToPointer eax
344
    mov edx,[tex]
628
    mov edx,ted_tex
345
    add edx,ebx
629
    add edx,ebx
346
  push ebx
630
  push ebx
347
    @@:
631
    @@:
348
      mov ebx,[edx]
632
      mov ebx,[edx]
349
      mov byte [eax],bl
633
      mov byte [eax],bl
350
      mov dword [eax+2],ecx
634
      mov dword [eax+2],ecx
351
      inc dword [eax+2]
635
      inc dword [eax+2]
352
      mov dword [eax+6],ecx
636
      mov dword [eax+6],ecx
353
      add dword [eax+6],3
637
      add dword [eax+6],3
354
      ;mov byte[eax+1],0 ;col=0
638
      ;mov byte[eax+1],0 ;col=0
355
      mov dword [eax+10],-1 ;tc=-1
639
      mov dword [eax+10],-1 ;tc=-1
356
      mov dword [eax+14],0 ;td=0
640
      mov dword [eax+14],0 ;td=0
357
 
641
 
358
      cmp ecx,0
642
      cmp ecx,0
359
      je @f
643
      je @f
360
      dec ecx
644
      dec ecx
361
      dec edx
645
      dec edx
362
      sub eax,sizeof.symbol
646
      sub eax,sizeof.symbol
363
      jmp @b
647
      jmp @b
364
    @@:
648
    @@:
365
  pop ebx
649
  pop ebx
366
    add eax,2
650
    add eax,2
367
    mov dword [eax],0 ; first sumbol 'perv=0'
651
    mov dword [eax],0 ; first sumbol 'perv=0'
368
 
652
 
369
    mov edx,[tex]
653
    mov edx,ted_tex
370
    ; begining sumbol 'perv=0' 'next=2'
654
    ; begining sumbol 'perv=0' 'next=2'
371
    mov dword [edx+2],0
655
    mov dword [edx+2],0
372
    mov dword [edx+6],2
656
    mov dword [edx+6],2
373
 
657
 
374
    add edx,sizeof.symbol
658
    add edx,sizeof.symbol
375
    mov dword [edx+6],0 ; last sumbol 'next=0'
659
    mov dword [edx+6],0 ; last sumbol 'next=0'
376
    mov dword [edx+2],ebx ; last sumbol 'perv=last'
660
    mov dword [edx+2],ebx ; last sumbol 'perv=last'
377
    inc dword [edx+2]
661
    inc dword [edx+2]
378
 
662
 
379
    mov edx,ebx
663
    mov edx,ebx
380
    inc edx ;2 = rezerv sumbols
664
    inc edx ;2 = rezerv sumbols
381
    imul edx,sizeof.symbol
665
    imul edx,sizeof.symbol
382
    add edx,[tex]
666
    add edx,ted_tex
383
    mov dword [edx+6],1 ; last sumbol 'next=1'
667
    mov dword [edx+6],1 ; last sumbol 'next=1'
384
 
668
 
385
    @@: ;clear memory, need if before was open big file
669
    @@: ;clear memory, need if before was open big file
386
      add edx,sizeof.symbol
670
      add edx,sizeof.symbol
387
      cmp edx,[tex_end]
671
      cmp edx,ted_tex_end
388
      jge @f
672
      jge @f
389
	mov dword[edx+10],0
673
	mov dword[edx+10],0
390
	mov dword[edx+14],0
674
	mov dword[edx+14],0
391
      jmp @b
675
      jmp @b
392
    @@:
676
    @@:
393
 
677
 
394
    call GetNumLines
678
    call GetNumLines
395
    cmp eax,100
679
    cmp eax,100
396
    jge @f
680
    jge @f
397
      mov eax,100
681
      mov eax,100
398
    @@:
682
    @@:
399
    mov [wScr.max_area],eax
683
    mov [wScr.max_area],eax
400
;    mov [wScr.redraw],1
684
;    mov [wScr.redraw],1
401
  pop edx ecx eax
685
  pop edx ecx eax
-
 
686
 
402
  call CmColored
687
  call CmColored
-
 
688
  call draw_but_toolbar
-
 
689
  stdcall draw_main_win,edi
403
  ret
690
  ret
-
 
691
endp
404
 
692
 
405
;input:
693
;input:
406
; edx = pointer to symbol struct
694
; edx = pointer to symbol struct
-
 
695
; edi = pointer to tedit struct
407
;output:
696
;output:
408
; edx = pointer to 'perv' visible symbol struct
697
; edx = pointer to 'perv' visible symbol struct
-
 
698
align 4
409
IteratPerv:
699
IteratPerv:
410
  cmp [tim_Undo],0
700
  cmp ted_tim_undo,0
411
  je .else
701
  je .else
412
  push ebx
702
  push ebx
413
  @@:
703
  @@:
414
    call GetTexPervPos
704
    call GetTexPervPos
415
    cmp edx,[tex]
705
    cmp edx,ted_tex
416
    je @f
706
    je @f
417
    call SymbNotVis
707
    call SymbNotVis
418
    cmp bl,1
708
    cmp bl,1
419
    je @b
709
    je @b
420
    cmp byte[edx],10 ;ïðîïóñê ñèìâîëà ñ êîäîì 10
710
    cmp byte[edx],10 ;ïðîïóñê ñèìâîëà ñ êîäîì 10
421
    je @b
711
    je @b
422
  @@:
712
  @@:
423
  pop ebx
713
  pop ebx
424
  ret
714
  ret
425
  .else:
715
  .else:
426
    call GetTexPervPos
716
    call GetTexPervPos
427
    cmp edx,[tex]
717
    cmp edx,ted_tex
428
    je .endif
718
    je .endif
429
    cmp dword [edx+14],0
719
    cmp dword [edx+14],0
430
    jne .else
720
    jne .else
431
    cmp byte[edx],10 ;ïðîïóñê ñèìâîëà ñ êîäîì 10
721
    cmp byte[edx],10 ;ïðîïóñê ñèìâîëà ñ êîäîì 10
432
    je .else
722
    je .else
433
  .endif:
723
  .endif:
434
  ret
724
  ret
435
 
725
 
436
 
726
 
437
;input:
727
;input:
438
; edx = pointer to symbol struct
728
; edx = pointer to symbol struct
-
 
729
; edi = pointer to tedit struct
439
;output:
730
;output:
440
; edx = pointer to 'next' visible symbol struct
731
; edx = pointer to 'next' visible symbol struct
-
 
732
align 4
441
IteratNext:
733
IteratNext:
442
  cmp [tim_Undo],0
734
  cmp ted_tim_undo,0
443
  je .else
735
  je .else
444
  push ebx
736
  push ebx
445
  @@:
737
  @@:
446
    call GetTexNextPos
738
    call GetTexNextPos
447
    cmp edx,[tex_1]
739
    cmp edx,ted_tex_1
448
    jle @f
740
    jle @f
449
    call SymbNotVis
741
    call SymbNotVis
450
    cmp bl,1
742
    cmp bl,1
451
    je @b
743
    je @b
452
    cmp byte[edx],10 ;ïðîïóñê ñèìâîëà ñ êîäîì 10
744
    cmp byte[edx],10 ;ïðîïóñê ñèìâîëà ñ êîäîì 10
453
    je @b
745
    je @b
454
  @@:
746
  @@:
455
  pop ebx
747
  pop ebx
456
  ret
748
  ret
457
  .else:
749
  .else:
458
    call GetTexNextPos
750
    call GetTexNextPos
459
    cmp edx,[tex_1]
751
    cmp edx,ted_tex_1
460
    jle .endif
752
    jle .endif
461
    cmp dword [edx+14],0
753
    cmp dword [edx+14],0
462
    jne .else
754
    jne .else
463
    cmp byte[edx],10 ;ïðîïóñê ñèìâîëà ñ êîäîì 10
755
    cmp byte[edx],10 ;ïðîïóñê ñèìâîëà ñ êîäîì 10
464
    je .else
756
    je .else
465
  .endif:
757
  .endif:
466
  ret
758
  ret
467
 
759
 
468
;input:
760
;input:
469
; edx = pointer to symbol struct
-
 
470
; bl = symbol end of select
761
; bl = symbol end of select
-
 
762
; edx = pointer to symbol struct
-
 
763
; edi = pointer to tedit struct
-
 
764
align 4
471
ItPoNextUc:
765
ItPoNextUc:
472
  @@:
766
  @@:
473
    cmp bl,byte[edx]
767
    cmp bl,byte[edx]
474
    je @f
768
    je @f
475
    cmp edx,[tex_1]
769
    cmp edx,ted_tex_1
476
    jle @f
770
    jle @f
477
    call IteratNext
771
    call IteratNext
478
    jmp @b
772
    jmp @b
479
  @@:
773
  @@:
480
  call IteratNext
774
  call IteratNext
481
  ret
775
  ret
482
 
776
 
483
;input:
777
;input:
484
; edx = pointer to symbol struct
778
; edx = pointer to symbol struct
-
 
779
; edi = pointer to tedit struct
-
 
780
align 4
485
ItPervColorTag:
781
ItPervColorTag:
486
  @@:
782
  @@:
487
    cmp byte[edx+1],0
783
    cmp byte[edx+1],0
488
    jne @f
784
    jne @f
489
    call IteratPerv
785
    call IteratPerv
490
    cmp edx,[tex_1]
786
    cmp edx,ted_tex_1
491
    jle @f
787
    jle @f
492
    jmp @b
788
    jmp @b
493
  @@:
789
  @@:
494
  ret
790
  ret
495
 
791
 
496
;input:
792
;input:
497
; edx = pointer to symbol struct
793
; edx = pointer to symbol struct
-
 
794
; edi = pointer to tedit struct
-
 
795
align 4
498
ItNextColorTag:
796
ItNextColorTag:
499
  @@:
797
  @@:
500
    call IteratNext
798
    call IteratNext
501
    cmp byte[edx+1],0
799
    cmp byte[edx+1],0
502
    jne @f
800
    jne @f
503
    cmp edx,[tex_1]
801
    cmp edx,ted_tex_1
504
    jle @f
802
    jle @f
505
    jmp @b
803
    jmp @b
506
  @@:
804
  @@:
507
  ;call IteratNext
805
  ;call IteratNext
508
  ret
806
  ret
509
 
807
 
510
;input:
808
;input:
511
; edx = pointer to symbol struct
809
; edx = pointer to symbol struct
-
 
810
; edi = pointer to tedit struct
512
;output:
811
;output:
513
; bl = 1 if sumbol not visible
812
; bl = 1 if sumbol not visible
514
; (tex[i].td+tim_Undo<=ch_tim && tex[i].td) || (tex[i].tc>ch_tim-tim_Undo)
813
; (tex[i].td+ted_tim_undo<=ted_tim_ch && tex[i].td) || (tex[i].tc>ted_tim_ch-ted_tim_undo)
-
 
814
align 4
515
SymbNotVis:
815
SymbNotVis:
516
  push eax
816
  push eax
517
 
817
 
518
  xor bl,bl
818
  xor bl,bl
519
 
819
 
520
  cmp dword [edx+14],0
820
  cmp dword [edx+14],0
521
  je @f
821
  je @f
522
  mov eax,[edx+14] ;eax=tex[i].td
822
  mov eax,[edx+14] ;eax=tex[i].td
523
  add eax,[tim_Undo]
823
  add eax,ted_tim_undo
524
  cmp eax,[ch_tim]
824
  cmp eax,ted_tim_ch
525
  jg @f
825
  jg @f
526
    mov bl,1
826
    mov bl,1
527
    pop eax
827
    pop eax
528
    ret
828
    ret
529
  @@:
829
  @@:
530
 
830
 
531
  mov eax,[ch_tim]
831
  mov eax,ted_tim_ch
532
  sub eax,[tim_Undo]
832
  sub eax,ted_tim_undo
533
  cmp [edx+10],eax
833
  cmp [edx+10],eax
534
  jle @f
834
  jle @f
535
    or bl,1
835
    or bl,1
536
  @@:
836
  @@:
537
 
837
 
538
  pop eax
838
  pop eax
539
  ret
839
  ret
540
 
840
 
541
 
841
 
542
;input:
842
;input:
543
; bh = 1 - move cursor after text add
843
; text:dword - pointer to text string
544
; bl = 1 - change time when text add
844
; add_opt:dword - options
545
; esi = add text len
845
align 4
546
; edi = pointer to text string
846
proc ted_text_add, edit:dword, text:dword, t_len:dword, add_opt:dword
547
TextAdd:
847
  locals
548
  push ebp
848
    new_spc dd ? ;count new spaces
-
 
849
	new_lin dd ? ;count new lines
549
  mov ebp,esp
850
  endl
-
 
851
;èñïîëüçîâàíèå ðåãèñòðîâ âíóòðè ôóíêöèè:
-
 
852
;eax - ïîçèöèÿ äëÿ âñòàâêè òåêñòà
-
 
853
;ebx - äëÿ âðåìåííûõ íóæä, äëèííà âñòàâëÿåìîãî òåêñòà
-
 
854
;ecx - äëÿ âðåìåííûõ íóæä
-
 
855
;edx - óêàçàòåëü íà ñòðóêòóðó ñèìâîëà
550
  sub esp,4*2
856
  pushad
551
 
-
 
552
  push eax ;po_t
857
  mov edi,dword[edit]
553
  push ecx edx edi
858
  mov esi,dword[text]
554
 
859
 
555
  call GetPos
860
  call GetPos
556
  call GetTexPervPos
861
  call GetTexPervPos
557
  call GetTexArrIndex ;eax=po_t
862
  call GetTexArrIndex ;eax=po_t
558
 
863
 
559
  mov dword[ebp-4],0 ;count new spaces
864
  mov dword[new_spc],0
560
  cmp [gpOpt],2
865
  cmp ted_gp_opt,2
561
  je @f
866
  je @f
562
    push eax ebx ;c_sp=cur[cn].x+Scroller->XPos-StrLen(cur[cn].y+Scroller->YPos);
867
    push eax ;c_sp=cur[cn].x+Scroller->XPos-StrLen(cur[cn].y+Scroller->YPos);
563
      mov eax,[cur_x]
868
      mov eax,ted_cur_x
564
      add eax,[hScr.position]
869
      add eax,[hScr.position]
565
      mov dword[ebp-4],eax
870
      mov dword[new_spc],eax
566
 
871
 
567
      mov eax,[cur_y]
872
      mov eax,ted_cur_y
568
      add eax,[wScr.position]
873
      add eax,[wScr.position]
569
      call StrLen
874
      call ted_strlen ;ebx = line len
570
      sub dword[ebp-4],ebx
875
      sub dword[new_spc],ebx
-
 
876
    pop eax
-
 
877
  @@:
571
    pop ebx eax
878
 
572
  @@:
879
  mov ebx,dword[t_len]
573
 
880
 
574
  mov dword[ebp-8],0 ;count new lines
881
  mov dword[new_lin],0
575
  cmp [gpOpt],0
882
  cmp ted_gp_opt,0
576
  jne @f
883
  jne @f
577
    push eax
884
    push eax
578
      mov eax,[cur_y]
885
      mov eax,ted_cur_y
579
      add eax,[wScr.position]
886
      add eax,[wScr.position]
580
      inc eax
887
      inc eax
581
      mov dword[ebp-8],eax
888
      mov dword[new_lin],eax
582
 
889
 
583
      call GetNumLines
890
      call GetNumLines
584
      sub dword[ebp-8],eax
891
      sub dword[new_lin],eax
585
    pop eax
892
    pop eax
586
  @@:
893
  @@:
587
 
894
 
588
  mov edx,sizeof.symbol
895
  mov edx,sizeof.symbol
589
  shl edx,1
896
  shl edx,1
590
  add edx,[tex]
897
  add edx,ted_tex
591
  @@: ;for(i=2;i
898
  @@: ;for(i=2;i
592
    cmp dword [edx+10],0 ;if(!tex[i].tc && !tex[i].td)
899
    cmp dword [edx+10],0 ;if(!tex[i].tc && !tex[i].td)
593
    jne .u1f
900
    jne .u1f
594
    cmp dword [edx+14],0
901
    cmp dword [edx+14],0
595
    jne .u1f
902
    jne .u1f
596
      cmp bl,0 ;if(n_tim) ch_tim++;
903
      test dword[add_opt],ted_opt_ed_change_time ;if(n_tim) ted_tim_ch++;
597
      je .no_tim
904
      jz .no_tim
598
	inc [ch_tim]
905
	inc ted_tim_ch
599
      .no_tim:
906
      .no_tim:
600
      cmp bh,0
907
      test dword[add_opt],ted_opt_ed_move_cursor
601
      je .no_cur_mov
908
      jz .no_cur_mov
602
      cmp dword[ebp-8],0 ;åñëè åñòü äîáàâî÷íûå ñòðîêè, òî êóðñîð åùå íå äâèãàåì
909
      cmp dword[new_lin],0 ;åñëè åñòü äîáàâî÷íûå ñòðîêè, òî êóðñîð åùå íå äâèãàåì
603
      jg .no_cur_mov
910
      jg .no_cur_mov
604
      cmp dword[ebp-4],0 ;åñëè íåò äîáàâî÷íûõ ïðîáåëîâ, òî êóðñîð òîæå íå äâèãàåì
911
      cmp dword[new_spc],0 ;åñëè íåò äîáàâî÷íûõ ïðîáåëîâ, òî êóðñîð òîæå íå äâèãàåì
605
      jg .no_cur_mov
912
      jg .no_cur_mov
606
	inc [cur_x] ;move cursor
913
	inc ted_cur_x ;move cursor
607
	;call GoToPos
914
	;call GoToPos
608
	cmp byte [edi],13
915
	cmp byte [esi],13
609
	jne .no_cur_mov
916
	jne .no_cur_mov
610
	  mov [cur_x],0
917
	  mov ted_cur_x,0
611
	  inc [cur_y]
918
	  inc ted_cur_y
612
      .no_cur_mov:
919
      .no_cur_mov:
-
 
920
 
-
 
921
      mov ecx,ted_opt_ed_change_time
613
 
922
	  not ecx
614
      xor bl,bl ;n_tim=false;
923
	  and dword[add_opt],ecx ;n_tim=false;
615
 
924
 
616
      mov cl,byte [edi] ;tex[i].c=ta[ns];
925
      mov cl,byte [esi] ;tex[i].c=ta[ns];
617
      mov byte [edx],cl
926
      mov byte [edx],cl
618
      m2m dword [edx+10],dword [ch_tim] ;tex[i].tc=ch_tim;
927
      m2m dword [edx+10],ted_tim_ch ;tex[i].tc=ted_tim_ch;
619
      mov [edx+2],eax ;tex[i].perv=po_t;
928
      mov [edx+2],eax ;tex[i].perv=po_t;
620
 
929
 
621
      mov ecx,eax
930
      mov ecx,eax
622
      imul ecx,sizeof.symbol
931
      imul ecx,sizeof.symbol
623
      add ecx,[tex] ; *** ecx = tex[po_t] ***
932
      add ecx,ted_tex ; *** ecx = tex[po_t] ***
624
      add ecx,6   ; *** ecx = tex[po_t].next ***
933
      add ecx,6   ; *** ecx = tex[po_t].next ***
625
      m2m dword [edx+6],dword [ecx] ;tex[i].next=tex[po_t].next;
934
      m2m dword [edx+6],dword [ecx] ;tex[i].next=tex[po_t].next;
626
 
935
 
627
      call GetTexArrIndex ;*** eax = i ***
936
      call GetTexArrIndex ;*** eax = i ***
628
      cmp eax,maxChars
937
      cmp eax,maxChars
629
      jge @f
938
      jge @f
630
      mov [ecx],eax ;tex[po_t].next=i; // ññûëêè ïåðåíàïðàâëÿåì
939
      mov [ecx],eax ;tex[po_t].next=i; // ññûëêè ïåðåíàïðàâëÿåì
631
      mov ecx,[edx+6] ; *** ecx = tex[i].next ***
940
      mov ecx,[edx+6] ; *** ecx = tex[i].next ***
632
      imul ecx,sizeof.symbol
941
      imul ecx,sizeof.symbol
633
      add ecx,[tex] ; *** ecx = tex[tex[i].next] ***
942
      add ecx,ted_tex ; *** ecx = tex[tex[i].next] ***
634
      mov [ecx+2],eax ;tex[tex[i].next].perv=i;
943
      mov [ecx+2],eax ;tex[tex[i].next].perv=i;
635
 
944
 
636
      cmp dword[ebp-8],0 ;add lines or text
945
      cmp dword[new_lin],0 ;add lines or text
637
      jle .spc_add
946
      jle .spc_add
638
	dec dword[ebp-8]
947
	dec dword[new_lin]
639
	mov byte [edx],13
948
	mov byte [edx],13
640
	jmp .u1f
949
	jmp .u1f
641
      .spc_add:
950
      .spc_add:
642
      cmp dword[ebp-4],0 ;add spaces or text
951
      cmp dword[new_spc],0 ;add spaces or text
643
      jle .tex_add
952
      jle .tex_add
644
	dec dword[ebp-4]
953
	dec dword[new_spc]
645
	mov byte [edx],' '
954
	mov byte [edx],' '
646
	jmp .u1f
955
	jmp .u1f
647
      .tex_add:
956
      .tex_add:
648
      inc edi
957
      inc esi
649
      dec esi
958
      dec ebx
650
    .u1f:
959
    .u1f:
651
    add edx,sizeof.symbol
960
    add edx,sizeof.symbol
652
    cmp edx,[tex_end]
961
    cmp edx,ted_tex_end
653
    jge @f ;out of memory
962
    jge @f ;out of memory
654
    cmp esi,0
963
    cmp ebx,0
655
    jne @b
964
    jne @b
656
  @@:
965
  @@:
657
 
-
 
658
  pop edi edx ecx eax
-
 
659
  mov esp,ebp ; âîññòàíàâëèâàåì ñòåê
-
 
660
  pop ebp
966
 
-
 
967
  call CmColored
661
  call CmColored
968
  popad
662
  ret
969
  ret
663
 
970
endp
664
 
971
 
665
 
972
 
666
;input:
973
;input:
667
;  ecx = position to free insert cell
974
;  ecx = position to free insert cell
668
;  edx = pointer to sumbol, when insert
975
;  edx = pointer to sumbol, when insert
669
;  esi = pointer to added symbol
976
;  esi = pointer to added symbol
-
 
977
;  edi = pointer to tedit struct
670
;output:
978
;output:
671
;  ecx = position to inserted cell
979
;  ecx = position to inserted cell
-
 
980
align 4
672
CharAdd:
981
CharAdd:
673
 
982
 
674
  .loop_b:
983
  .loop_b:
675
    cmp ecx,[tex_end]
984
    cmp ecx,ted_tex_end
676
    jge .end_f
985
    jge .end_f
677
    cmp dword[ecx+10],0
986
    cmp dword[ecx+10],0
678
    jne @f
987
    jne @f
679
      cmp dword[ecx+14],0
988
      cmp dword[ecx+14],0
680
      je .loop_e
989
      je .loop_e
681
    @@:
990
    @@:
682
    add ecx,sizeof.symbol
991
    add ecx,sizeof.symbol
683
    jmp .loop_b
992
    jmp .loop_b
684
  .loop_e:
993
  .loop_e:
685
 
994
 
686
  push eax ebx
995
  push eax ebx
687
  mov eax,[ch_tim]
996
  mov eax,ted_tim_ch
688
  mov dword[ecx+10],eax
997
  mov dword[ecx+10],eax
689
  mov al,byte[esi]
998
  mov al,byte[esi]
690
  mov byte[ecx],al
999
  mov byte[ecx],al
691
 
1000
 
692
  call GetTexArrIndex ; *** eax=pos ***
1001
  call GetTexArrIndex ; *** eax=pos ***
693
  mov [ecx+2],eax ;tex[i].perv=pos;
1002
  mov [ecx+2],eax ;tex[i].perv=pos;
694
  m2m dword[ecx+6],dword[edx+6] ;tex[i].next=tex[pos].next;
1003
  m2m dword[ecx+6],dword[edx+6] ;tex[i].next=tex[pos].next;
695
 
1004
 
696
  push edx
1005
  push edx
697
    mov edx,ecx
1006
    mov edx,ecx
698
    call GetTexArrIndex ; *** eax=i ***
1007
    call GetTexArrIndex ; *** eax=i ***
699
  pop edx
1008
  pop edx
700
 
1009
 
701
  mov [edx+6],eax ;tex[pos].next=i; // ññûëêè ïåðåíàïðàâëÿåì
1010
  mov [edx+6],eax ;tex[pos].next=i; // ññûëêè ïåðåíàïðàâëÿåì
702
  mov ebx,[ecx+6]
1011
  mov ebx,[ecx+6]
703
  ConvertIndexToPointer ebx
1012
  ConvertIndexToPointer ebx
704
  mov [ebx+2],eax ;tex[tex[i].next].perv=i; // ...
1013
  mov [ebx+2],eax ;tex[tex[i].next].perv=i; // ...
705
  pop ebx eax
1014
  pop ebx eax
706
 
1015
 
707
  .end_f:
1016
  .end_f:
708
  call CmColored
1017
  call CmColored
709
  ret
1018
  ret
710
 
1019
 
711
 
1020
 
712
;input:
1021
;input:
713
; conv_table = pointert to convert table
1022
; conv_table = pointert to convert table
-
 
1023
; edi = pointer to tedit struct
714
;output:
1024
;output:
715
; edi = count converted symbols
1025
; esi = count converted symbols
-
 
1026
align 4
716
ConvertSelText:
1027
proc ConvertSelText
717
  xor edi,edi
1028
  locals
718
  push eax ebx ecx edx esi
1029
    conv_cou dd ?
-
 
1030
  endl
-
 
1031
  mov dword[conv_cou],0
-
 
1032
  pushad
-
 
1033
 
719
  stdcall IsSel, tedit0
1034
  stdcall IsSel,edi
720
  cmp al,0
1035
  cmp al,0
721
  je .end_f
1036
  je .end_f
722
    call SetUndo
1037
    stdcall ted_set_undo,edi
723
    call SelNormalize
1038
    stdcall SelNormalize,edi
724
 
1039
 
725
    mov esi,[seln.x0]
1040
    mov esi,ted_seln_x0
726
    mov ecx,[seln.y0]
1041
    mov ecx,ted_seln_y0
727
    call GetPosByParam
1042
    call GetPosByParam
728
    mov eax,edx
1043
    mov eax,edx
729
    mov esi,[seln.x1]
1044
    mov esi,ted_seln_x1
730
    mov ecx,[seln.y1]
1045
    mov ecx,ted_seln_y1
731
    call GetPosByParam
1046
    call GetPosByParam
732
    ;call GetTexPervPos
1047
    ;call GetTexPervPos
733
    mov ebx,edx
1048
    mov ebx,edx
734
 
1049
 
735
    cmp eax,ebx
1050
    cmp eax,ebx
736
    je .end_f
1051
    je .end_f
737
 
1052
 
738
    inc [ch_tim]
1053
    inc ted_tim_ch
739
    mov edx,eax ;i=p0;
1054
    mov edx,eax ;i=p0;
740
    mov ecx,2
1055
    mov ecx,2
741
    ConvertIndexToPointer ecx
1056
    ConvertIndexToPointer ecx
742
    @@:
1057
    @@:
743
      mov esi,[edx]
1058
      mov esi,[edx]
744
      and esi,0xff
1059
      and esi,0xff
745
      add esi,[conv_table] ;EvUpper
1060
      add esi,[conv_table] ;EvUpper
746
      cmp byte [esi],0
1061
      cmp byte [esi],0
747
      je .no_change
1062
      je .no_change
748
	m2m dword [edx+14],dword [ch_tim]
1063
	m2m dword [edx+14],ted_tim_ch
749
	call CharAdd ;b_pos=CharAdd(tex[i].c^32,i,false,b_pos);
1064
	call CharAdd ;b_pos=CharAdd(tex[i].c^32,i,false,b_pos);
750
	call GetTexNextPos ;go to added symbol
1065
	call GetTexNextPos ;go to added symbol
751
	inc edi
1066
	inc dword[conv_cou]
752
      .no_change:
1067
      .no_change:
753
 
1068
 
754
      call IteratNext
1069
      call IteratNext
755
      cmp edx,[tex]
1070
      cmp edx,ted_tex
756
      je @f 
1071
      je @f 
757
      cmp edx,ebx
1072
      cmp edx,ebx
758
      je @f
1073
      je @f
759
 
1074
 
760
      jmp @b
1075
      jmp @b
761
    @@:
1076
    @@:
762
    cmp edi,0
1077
    cmp dword[conv_cou],0
763
    jne @f
1078
    jne @f
764
      dec [ch_tim]
1079
      dec ted_tim_ch
765
    @@:
1080
    @@:
766
  .end_f:
1081
  .end_f:
-
 
1082
  popad
767
  pop esi edx ecx ebx eax
1083
  mov esi,dword[conv_cou]
768
 
-
 
769
  ret
1084
  ret
-
 
1085
endp
770
 
-
 
771
;input:
-
 
772
; bh = (0-backspace, 1-delete)
-
 
773
; bl = 1 - change time
1086
 
774
;output:
1087
;output:
775
; bl = 0 - no delete
1088
; bl = 0 - no delete
776
; bl = 1 - delete
1089
; bl = 1 - delete
777
TextDel:
1090
align 4
-
 
1091
proc TextDel, edit:dword, del_opt:dword
778
  push edx cx
1092
  push cx edx edi
-
 
1093
  mov edi,dword[edit]
-
 
1094
  mov ebx,dword[del_opt]
-
 
1095
 
779
  xor cl,cl
1096
  xor cl,cl
780
  cmp bh,1
1097
  test ebx,ted_opt_ed_move_cursor
781
  je @f
1098
  jz @f
782
    call CurMoveLeft
1099
    call CurMoveLeft
783
    cmp dl,0
1100
    cmp dl,0
784
    je .no_del
1101
    je .no_del
785
  @@:
1102
  @@:
786
  call GetPos
1103
  call GetPos
787
  cmp [gpOpt],1
1104
  cmp ted_gp_opt,1
788
  je .no_del
1105
  je .no_del
789
    cmp bl,0
1106
    test ebx,ted_opt_ed_change_time
790
    je @f
1107
    jz @f
791
      inc [ch_tim]
1108
      inc ted_tim_ch
792
    @@:
1109
    @@:
793
    m2m dword [edx+14], dword [ch_tim]
1110
    m2m dword [edx+14], ted_tim_ch
794
    mov cl,1
1111
    mov cl,1
795
  .no_del:
1112
  .no_del:
796
  mov bl,cl
1113
  mov bl,cl
797
  pop cx edx
1114
  pop edi edx cx
798
  ret
1115
  ret
-
 
1116
endp
-
 
1117
 
-
 
1118
;input:
-
 
1119
; edi = pointer to tedit struct
-
 
1120
;output:
-
 
1121
; al = 1 if delete
-
 
1122
;description:
-
 
1123
; Ôóíêöèÿ óäàëÿåò âûäåëåííûé òåêñò
-
 
1124
align 4
-
 
1125
proc SelTextDel, del_opt:dword
-
 
1126
	push ebx ecx edx esi
-
 
1127
 
-
 
1128
	stdcall IsSel,edi
-
 
1129
	cmp al,0
-
 
1130
	je .end_f
-
 
1131
 
-
 
1132
		stdcall SelNormalize,edi
-
 
1133
 
-
 
1134
		mov esi,ted_seln_x1
-
 
1135
		mov ecx,ted_seln_y1
-
 
1136
		call GetPosByParam
-
 
1137
		mov ebx,edx
-
 
1138
 
-
 
1139
		mov esi,ted_seln_x0
-
 
1140
		mov ecx,ted_seln_y0
-
 
1141
		call GetPosByParam
-
 
1142
 
-
 
1143
		test dword[del_opt],ted_opt_ed_change_time
-
 
1144
		jz @f
-
 
1145
			inc ted_tim_ch
-
 
1146
		@@:
-
 
1147
		cmp edx,ted_tex
-
 
1148
		je @f
-
 
1149
		cmp edx,ebx ;if(i==te)break;
-
 
1150
		je @f
-
 
1151
			m2m dword[edx+14],ted_tim_ch
-
 
1152
			mov esi,ted_opt_ed_change_time
-
 
1153
			not esi
-
 
1154
			and dword[del_opt],esi ;n_tim=false;
-
 
1155
			call IteratNext
-
 
1156
			jmp @b
-
 
1157
		@@:
-
 
1158
		test dword[del_opt],ted_opt_ed_change_time
-
 
1159
		jz @f
-
 
1160
			dec ted_tim_ch
-
 
1161
			xor al,al
-
 
1162
		@@:
-
 
1163
		test dword[del_opt],ted_opt_ed_change_time
-
 
1164
		jnz @f
-
 
1165
			mov ecx,ted_seln_x0
-
 
1166
			mov edx,ted_seln_y0
-
 
1167
			call GoToPos
-
 
1168
			mov ted_sel_x0,0
-
 
1169
			mov ted_sel_y0,0
-
 
1170
			mov ted_sel_x1,0
-
 
1171
			mov ted_sel_y1,0
-
 
1172
		@@:
-
 
1173
	.end_f:
-
 
1174
	pop esi edx ecx ebx
-
 
1175
	ret
799
 
1176
endp
800
 
1177
 
801
 
1178
 
802
;input:
1179
;input:
803
; eax = pointer to begin select
1180
; eax = pointer to begin select
804
; ebx = pointer to end select
1181
; ebx = pointer to end select
-
 
1182
; edi = pointer to tedit struct
-
 
1183
align 4
805
Revers:
1184
Revers:
806
  cmp eax,ebx
1185
  cmp eax,ebx
807
  jne @f
1186
  jne @f
808
    ret
1187
    ret
809
  @@:
1188
  @@:
810
 
1189
 
811
  push ecx edx
1190
  push ecx edx
812
 
1191
 
813
  mov edx,[tex_1]
1192
  mov edx,ted_tex_1
814
  cmp edx,ebx ;if(p1==1)p1=tex[1].perv;
1193
  cmp edx,ebx ;if(p1==1)p1=tex[1].perv;
815
  jne @f
1194
  jne @f
816
    call GetTexPervPos
1195
    call GetTexPervPos
817
    mov ebx,edx
1196
    mov ebx,edx
818
  @@:
1197
  @@:
819
 
1198
 
820
  push esi
1199
  push esi
821
    mov edx,[eax+2] ; *** edx = tex[p0].perv ***
1200
    mov edx,[eax+2] ; *** edx = tex[p0].perv ***
822
    ConvertIndexToPointer edx
1201
    ConvertIndexToPointer edx
823
    add edx,6
1202
    add edx,6
824
    mov ecx,[edx] ;tmp = tex[tex[p0].perv].next;
1203
    mov ecx,[edx] ;tmp = tex[tex[p0].perv].next;
825
 
1204
 
826
    mov esi,[ebx+6] ; *** esi = tex[p1].next ***
1205
    mov esi,[ebx+6] ; *** esi = tex[p1].next ***
827
    ConvertIndexToPointer esi
1206
    ConvertIndexToPointer esi
828
    add esi,2
1207
    add esi,2
829
    m2m dword[edx],dword[esi] ;tex[tex[p0].perv].next = tex[tex[p1].next].perv;
1208
    m2m dword[edx],dword[esi] ;tex[tex[p0].perv].next = tex[tex[p1].next].perv;
830
 
1209
 
831
    mov [esi],ecx ;tex[tex[p1].next].perv = tmp;
1210
    mov [esi],ecx ;tex[tex[p1].next].perv = tmp;
832
  pop esi
1211
  pop esi
833
 
1212
 
834
  mov ecx,[eax+2] ;tmp = tex[p0].perv;
1213
  mov ecx,[eax+2] ;tmp = tex[p0].perv;
835
  m2m dword[eax+2],dword[ebx+6] ;tex[p0].perv = tex[p1].next;
1214
  m2m dword[eax+2],dword[ebx+6] ;tex[p0].perv = tex[p1].next;
836
  mov [ebx+6],ecx ;tex[p1].next = tmp;
1215
  mov [ebx+6],ecx ;tex[p1].next = tmp;
837
 
1216
 
838
  mov edx,eax ;i=p0;
1217
  mov edx,eax ;i=p0;
839
  @@:
1218
  @@:
840
    mov ecx,[edx+6] ;tmp = tex[i].next;
1219
    mov ecx,[edx+6] ;tmp = tex[i].next;
841
    m2m dword[edx+6],dword[edx+2] ;tex[i].next = tex[i].perv;
1220
    m2m dword[edx+6],dword[edx+2] ;tex[i].next = tex[i].perv;
842
    mov [edx+2],ecx ;tex[i].perv = tmp;
1221
    mov [edx+2],ecx ;tex[i].perv = tmp;
843
    cmp edx,ebx ;if(i==p1)break;
1222
    cmp edx,ebx ;if(i==p1)break;
844
    je @f
1223
    je @f
845
; ---
1224
; ---
846
;cmp edx,[tex]
1225
;cmp edx,ted_tex
847
;je @f
1226
;je @f
848
; ---
1227
; ---
849
    mov edx,ecx ;i = tmp;
1228
    mov edx,ecx ;i = tmp;
850
    ConvertIndexToPointer edx
1229
    ConvertIndexToPointer edx
851
    jmp @b
1230
    jmp @b
852
  @@:
1231
  @@:
853
  pop edx ecx
1232
  pop edx ecx
854
  call CmColored
1233
  call CmColored
855
  ret
1234
  ret
856
 
1235
 
-
 
1236
 
-
 
1237
;input:
857
 
1238
; edi = pointer to tedit struct
858
;output:
1239
;output:
859
; dl = 0 not move
1240
; dl = 0 not move
860
; dl = 2 if move up
1241
; dl = 2 if move up
861
; dl = 8 if scroll move up
1242
; dl = 8 if scroll move up
-
 
1243
align 4
862
CurMoveUp:
1244
CurMoveUp:
863
  cmp [cur_y],0
1245
  cmp ted_cur_y,0
864
  je @f
1246
  je @f
865
    dec [cur_y]
1247
    dec ted_cur_y
866
    mov dl,2
1248
    mov dl,2
867
    ret
1249
    ret
868
  @@:
1250
  @@:
869
  cmp [wScr.position],0
1251
  cmp [wScr.position],0
870
  je @f
1252
  je @f
871
    dec [wScr.position]
1253
    dec [wScr.position]
872
    mov dl,8
1254
    mov dl,8
873
    ret
1255
    ret
874
  @@:
1256
  @@:
875
  mov dl,0
1257
  mov dl,0
876
  ret
1258
  ret
-
 
1259
 
-
 
1260
;input:
877
 
1261
; edi = pointer to tedit struct
878
;output:
1262
;output:
879
; dl = 0 not move
1263
; dl = 0 not move
880
; dl = 2 if move down
1264
; dl = 2 if move down
881
; dl = 8 if scroll move down
1265
; dl = 8 if scroll move down
-
 
1266
align 4
882
CurMoveDown:
1267
CurMoveDown:
883
  push eax
1268
  push eax ebx
884
  mov dl,0
1269
  mov dl,0
-
 
1270
  mov ebx,ted_scr_w
885
  mov eax,[wScr.cur_area]
1271
  mov eax,dword[ebx+sb_offs_cur_area]
886
  dec eax
1272
  dec eax
887
  cmp [cur_y],eax
1273
  cmp ted_cur_y,eax
888
  jge @f
1274
  jge @f
889
    inc [cur_y]
1275
    inc ted_cur_y
890
    mov dl,2
1276
    mov dl,2
891
    jmp .ret_f
1277
    jmp .ret_f
892
  @@:
1278
  @@:
893
  mov eax,[cur_y]
1279
  mov eax,ted_cur_y
894
  add eax,[wScr.position]
1280
  add eax,dword[ebx+sb_offs_position]
895
  inc eax
1281
  inc eax
896
  cmp [wScr.max_area],eax
1282
  cmp dword[ebx+sb_offs_max_area],eax
897
  jle @f
1283
  jle @f
898
    inc [wScr.position]
1284
    inc dword[ebx+sb_offs_position]
899
    mov dl,8
1285
    mov dl,8
900
  @@:
1286
  @@:
901
  .ret_f:
1287
  .ret_f:
902
  pop eax
1288
  pop ebx eax
903
  ret
1289
  ret
904
 
1290
 
905
 
1291
 
906
;output:
1292
;output:
907
; dl = 0 not move
1293
; dl = 0 not move
908
; dl = 1 if move up
1294
; dl = 1 if move up
-
 
1295
align 4
909
CurMovePageUp:
1296
CurMovePageUp:
910
  push eax
1297
  push eax
911
  mov eax,[wScr.cur_area]
1298
  mov eax,[wScr.cur_area]
912
  xor dl,dl
1299
  xor dl,dl
913
  cmp eax,[wScr.position]
1300
  cmp eax,[wScr.position]
914
  jg @f
1301
  jg @f
915
    sub [wScr.position],eax
1302
    sub [wScr.position],eax
916
    mov dl,1
1303
    mov dl,1
917
  @@:
1304
  @@:
918
  cmp [wScr.position],0
1305
  cmp [wScr.position],0
919
  je @f
1306
  je @f
920
  cmp dl,1
1307
  cmp dl,1
921
  je @f
1308
  je @f
922
    mov [wScr.position],0
1309
    mov [wScr.position],0
923
    mov dl,1
1310
    mov dl,1
924
  @@:
1311
  @@:
925
  pop eax
1312
  pop eax
926
  ret
1313
  ret
-
 
1314
 
-
 
1315
;input:
-
 
1316
; edi = pointer to tedit struct
927
 
1317
align 4
928
CurMovePageDown:
1318
CurMovePageDown:
-
 
1319
	push eax ebx ecx
-
 
1320
	mov ecx,ted_scr_w
929
  push eax ebx
1321
 
930
  xor dl,dl
1322
	xor dl,dl
931
  mov eax,[wScr.max_area]
1323
	mov eax,dword[ecx+sb_offs_max_area]
932
  sub eax,[wScr.cur_area]
1324
	sub eax,dword[ecx+sb_offs_cur_area]
933
  cmp [wScr.position],eax
1325
	cmp dword[ecx+sb_offs_position],eax
934
  jge @f
1326
	jge @f
935
    mov ebx,[wScr.cur_area]
1327
		mov ebx,dword[ecx+sb_offs_cur_area]
936
    add [wScr.position],ebx
1328
		add dword[ecx+sb_offs_position],ebx
937
    mov dl,1
1329
		mov dl,1
938
    mov [wScr.redraw],1
1330
		mov dword[ecx+sb_offs_redraw],1
939
    cmp [wScr.position],eax
1331
		cmp dword[ecx+sb_offs_position],eax
940
    jle @f
1332
		jle @f
941
      mov [wScr.position],eax
1333
			mov dword[ecx+sb_offs_position],eax
942
  @@:
1334
	@@:
943
  pop ebx eax
1335
	pop ecx ebx eax
-
 
1336
	ret
-
 
1337
 
944
  ret
1338
;input:
945
 
1339
; edi = pointer to tedit struct
946
;output:
1340
;output:
947
; dl = 0 not move
1341
; dl = 0 not move
948
; dl = 1 if move left
1342
; dl = 1 if move left
949
; dl = 3 if move left and up
1343
; dl = 3 if move left and up
950
; dl = 8 if scroll move up
1344
; dl = 8 if scroll move up
-
 
1345
align 4
951
CurMoveLeft:
1346
CurMoveLeft:
952
  cmp [cur_x],0
1347
  cmp ted_cur_x,0
953
  je @f
1348
  je @f
954
    dec [cur_x]
1349
    dec ted_cur_x
955
    mov dl,1
1350
    mov dl,1
956
    ret
1351
    ret
957
  @@:
1352
  @@:
958
  cmp [hScr.position],0
1353
  cmp [hScr.position],0
959
  je @f
1354
  je @f
960
    dec [hScr.position]
1355
    dec [hScr.position]
961
    mov dl,8
1356
    mov dl,8
962
    ret
1357
    ret
963
  @@:
1358
  @@:
964
  cmp [cur_y],0
1359
  cmp ted_cur_y,0
965
  jne @f
1360
  jne @f
966
    mov dl,0
1361
    mov dl,0
967
    cmp [wScr.position],0
1362
    cmp [wScr.position],0
968
    je .ret_f
1363
    je .ret_f
969
      dec [wScr.position]
1364
      dec [wScr.position]
970
      call OnInitialUpdate
1365
      call OnInitialUpdate
971
      call CurMoveX_LastChar
1366
      call CurMoveX_LastChar
972
      mov dl,8
1367
      mov dl,8
973
    jmp .ret_f
1368
    jmp .ret_f
974
  @@:
1369
  @@:
975
  cmp [cur_y],0
1370
  cmp ted_cur_y,0
976
  je @f
1371
  je @f
977
  dec [cur_y]
1372
  dec ted_cur_y
978
  call CurMoveX_LastChar
1373
  call CurMoveX_LastChar
979
  cmp dl,8
1374
  cmp dl,8
980
  je .ret_f
1375
  je .ret_f
981
  mov dl,3
1376
  mov dl,3
982
  ret
1377
  ret
983
  @@:
1378
  @@:
984
  mov dl,0
1379
  mov dl,0
985
  .ret_f:
1380
  .ret_f:
986
  ret
1381
  ret
-
 
1382
 
-
 
1383
;input:
-
 
1384
; edi = pointer to tedit struct
987
 
1385
align 4
988
CurMoveRight:
1386
CurMoveRight:
989
  push eax
1387
  push eax
990
  xor dl,dl
1388
  xor dl,dl
991
  mov eax,[hScr.cur_area]
1389
  mov eax,[hScr.cur_area]
992
  cmp [cur_x],eax
1390
  cmp ted_cur_x,eax
993
  jge @f
1391
  jge @f
994
    inc [cur_x]
1392
    inc ted_cur_x
995
    mov dl,1
1393
    mov dl,1
996
    jmp .ret_f
1394
    jmp .ret_f
997
  @@:
1395
  @@:
998
    inc [hScr.position]
1396
    inc [hScr.position]
999
    mov dl,8
1397
    mov dl,8
1000
  .ret_f:
1398
  .ret_f:
1001
  pop eax
1399
  pop eax
1002
  ret
1400
  ret
-
 
1401
 
-
 
1402
;input:
-
 
1403
; edi = pointer to tedit struct
1003
 
1404
align 4
1004
CurMoveX_LastChar:
1405
CurMoveX_LastChar:
1005
;[hScr.position]
1406
;[hScr.position]
1006
;[hScr.cur_area]
1407
;[hScr.cur_area]
1007
;dl-???
1408
;dl-???
1008
  push eax ebx
1409
  push eax ebx
1009
  mov eax,[cur_y]
1410
  mov eax,ted_cur_y
1010
  add eax,[wScr.position]
1411
  add eax,[wScr.position]
1011
  call StrLen
1412
  call ted_strlen
1012
  xor dl,dl
1413
  xor dl,dl
1013
 
1414
 
1014
  cmp ebx,[hScr.position]
1415
  cmp ebx,[hScr.position]
1015
  jge @f
1416
  jge @f
1016
    mov dl,8
1417
    mov dl,8
1017
    mov [hScr.position],ebx
1418
    mov [hScr.position],ebx
1018
  @@:
1419
  @@:
1019
  sub ebx,[hScr.position]
1420
  sub ebx,[hScr.position]
1020
 
1421
 
1021
  cmp ebx,[hScr.cur_area]
1422
  cmp ebx,[hScr.cur_area]
1022
  jle @f ; b---[---]---e
1423
  jle @f ; b---[---]---e
1023
    add [hScr.position],ebx
1424
    add [hScr.position],ebx
1024
    mov ebx,[hScr.cur_area]
1425
    mov ebx,[hScr.cur_area]
1025
    sub [hScr.position],ebx
1426
    sub [hScr.position],ebx
1026
    mov dl,8
1427
    mov dl,8
1027
  @@:
1428
  @@:
1028
  mov [cur_x],ebx
1429
  mov ted_cur_x,ebx
1029
  pop ebx eax
1430
  pop ebx eax
1030
  ret
1431
  ret
-
 
1432
 
-
 
1433
;input:
1031
 
1434
; edi = pointer to tedit struct
1032
;output:
1435
;output:
1033
; dl = 0 not move
1436
; dl = 0 not move
1034
; dl = 1 move cursor
1437
; dl = 1 move cursor
1035
; dl = 8 move cursor and scroll
1438
; dl = 8 move cursor and scroll
-
 
1439
align 4
1036
CurMoveX_FirstChar:
1440
CurMoveX_FirstChar:
1037
  xor dl,dl
1441
  xor dl,dl
1038
  cmp [cur_x],0
1442
  cmp ted_cur_x,0
1039
  je @f
1443
  je @f
1040
  mov [cur_x],0
1444
  mov ted_cur_x,0
1041
  mov dl,1
1445
  mov dl,1
1042
  @@:
1446
  @@:
1043
  cmp [hScr.position],0
1447
  cmp [hScr.position],0
1044
  je @f
1448
  je @f
1045
    mov [hScr.position],0
1449
    mov [hScr.position],0
1046
    mov dl,8
1450
    mov dl,8
1047
  @@:
1451
  @@:
1048
  ret
1452
  ret
1049
 
1453
 
1050
;input:
1454
;input:
1051
; edx = pointer to symbol struct
1455
; edx = pointer to symbol struct
-
 
1456
; edi = pointer to tedit struct
1052
;output:
1457
;output:
1053
; eax = array index
1458
; eax = array index
-
 
1459
align 4
1054
GetTexArrIndex:
1460
GetTexArrIndex:
1055
  push ecx edx
1461
  push ecx edx
1056
 
1462
 
1057
  mov eax,edx
1463
  mov eax,edx
1058
  sub eax,[tex]
1464
  sub eax,ted_tex
1059
  xor edx,edx
1465
  xor edx,edx
1060
  mov ecx,sizeof.symbol
1466
  mov ecx,sizeof.symbol
1061
  div ecx
1467
  div ecx
1062
 
1468
 
1063
  pop edx ecx
1469
  pop edx ecx
1064
  ret
1470
  ret
1065
 
1471
 
1066
;input:
1472
;input:
1067
; edx = pointer to symbol struct
1473
; edx = pointer to symbol struct
-
 
1474
; edi = pointer to tedit struct
1068
;output:
1475
;output:
1069
; edx = pointer to 'perv' struct
1476
; edx = pointer to 'perv' struct
-
 
1477
align 4
1070
GetTexPervPos:
1478
GetTexPervPos:
1071
  push dword [edx+2]
1479
  push dword [edx+2]
1072
  pop edx
1480
  pop edx
1073
  imul edx,sizeof.symbol
1481
  imul edx,sizeof.symbol
1074
  add edx,[tex]
1482
  add edx,ted_tex
1075
  ret
1483
  ret
1076
 
1484
 
1077
;input:
1485
;input:
1078
; edx = pointer to symbol struct
1486
; edx = pointer to symbol struct
1079
;output:
1487
;output:
1080
; edx = pointer to 'next' symbol struct
1488
; edx = pointer to 'next' symbol struct
-
 
1489
align 4
1081
GetTexNextPos:
1490
GetTexNextPos:
1082
  push dword [edx+6]
1491
  push dword [edx+6]
1083
  pop edx
1492
  pop edx
1084
  imul edx,sizeof.symbol
1493
  imul edx,sizeof.symbol
1085
  add edx,[tex]
1494
  add edx,ted_tex
1086
  ret
1495
  ret
1087
 
1496
 
-
 
1497
;input:
1088
 
1498
; edi = pointer to tedit struct
1089
;output:
1499
;output:
1090
; edx = symbol under cursor
1500
; edx = symbol under cursor
1091
; gpOpt = 1,2
1501
; ted_gp_opt = 1,2
1092
; edx = tex[1].perv if error
1502
; edx = tex[1].perv if error
-
 
1503
; ted_gp_opt = 0
1093
; gpOpt = 0
1504
align 4
1094
GetPos:
1505
GetPos:
1095
  push esi ecx
1506
  push esi ecx
1096
    mov esi,[cur_x]
1507
    mov esi,ted_cur_x
1097
    add esi,[hScr.position]
1508
    add esi,[hScr.position]
1098
    mov ecx,[cur_y]
1509
    mov ecx,ted_cur_y
1099
    add ecx,[wScr.position]
1510
    add ecx,[wScr.position]
1100
    call GetPosByParam
1511
    call GetPosByParam
1101
  pop ecx esi
1512
  pop ecx esi
1102
  ret
1513
  ret
1103
 
1514
 
1104
 
1515
 
1105
;input:
1516
;input:
1106
; esi = XPos
1517
; esi = XPos
1107
; ecx = YPos
1518
; ecx = YPos
-
 
1519
; edi = pointer to tedit struct
1108
;output:
1520
;output:
1109
; edx = symbol under cursor
1521
; edx = symbol under cursor
1110
; gpOpt = 1 if found text line
1522
; ted_gp_opt = 1 if found text line
1111
; gpOpt = 2 if found text line and column
1523
; ted_gp_opt = 2 if found text line and column
1112
; edx = tex[1] if error
1524
; edx = tex[1] if error
1113
; gpOpt = 0 if text no found
1525
; ted_gp_opt = 0 if text no found
-
 
1526
align 4
1114
GetPosByParam:
1527
GetPosByParam:
1115
  push eax ;Row
1528
  push eax ;Row
1116
  push ebx ;Col
1529
  push ebx ;Col
1117
 
1530
 
1118
  xor eax,eax
1531
  xor eax,eax
1119
  xor ebx,ebx
1532
  xor ebx,ebx
1120
  mov [gpOpt],0
1533
  mov ted_gp_opt,0
1121
  mov edx,[tex]
1534
  mov edx,ted_tex
1122
  @@:
1535
  @@:
1123
    call IteratNext
1536
    call IteratNext
1124
    cmp edx,[tex_1]
1537
    cmp edx,ted_tex_1
1125
    jle @f 
1538
    jle @f 
1126
    cmp ebx,esi
1539
    cmp ebx,esi
1127
    jne .u1_0 ;Col <> cur_x
1540
    jne .u1_0 ;Col <> ted_cur_x
1128
      mov [gpOpt],1
1541
      mov ted_gp_opt,1
1129
      cmp eax,ecx
1542
      cmp eax,ecx
1130
      jge @f ; Row >= cur_y
1543
      jge @f ; Row >= ted_cur_y
1131
    .u1_0:
1544
    .u1_0:
1132
    mov [gpOpt],0
1545
    mov ted_gp_opt,0
1133
    inc ebx
1546
    inc ebx
1134
    cmp byte [edx],13
1547
    cmp byte [edx],13
1135
    jne @b
1548
    jne @b
1136
    cmp eax,ecx
1549
    cmp eax,ecx
1137
    jge @f ; Row >= cur_y
1550
    jge @f ; Row >= ted_cur_y
1138
    inc eax
1551
    inc eax
1139
    xor ebx,ebx
1552
    xor ebx,ebx
1140
    jmp @b
1553
    jmp @b
1141
  @@:
1554
  @@:
1142
  cmp eax,ecx
1555
  cmp eax,ecx
1143
  jne @f ; Row = cur_y
1556
  jne @f ; Row = ted_cur_y
1144
    inc [gpOpt]
1557
    inc ted_gp_opt
1145
  @@:
1558
  @@:
1146
  cmp [gpOpt],0
1559
  cmp ted_gp_opt,0
1147
  jne @f
1560
  jne @f
1148
    mov edx,[tex_1]
1561
    mov edx,ted_tex_1
1149
    ;call GetTexPervPos
1562
    ;call GetTexPervPos
1150
  @@:
1563
  @@:
1151
  pop ebx eax
1564
  pop ebx eax
1152
  ret
1565
  ret
1153
 
1566
 
1154
 
1567
 
1155
;input:
1568
;input:
1156
; eax = Row
1569
; eax = Row
-
 
1570
; edi = pointer to tedit struct
1157
;output:
1571
;output:
1158
; ebx = str len
1572
; ebx = str len
-
 
1573
align 4
1159
StrLen:
1574
ted_strlen:
1160
  push edx ecx
1575
  push edx ecx
1161
  ;ecx = Row, from cycle
1576
  ;ecx = Row, from cycle
1162
 
1577
 
1163
  xor ebx,ebx
1578
  xor ebx,ebx
1164
  xor ecx,ecx
1579
  xor ecx,ecx
1165
  mov edx,[tex]
1580
  mov edx,ted_tex
1166
  @@:
1581
  @@:
1167
    call IteratNext
1582
    call IteratNext
1168
    cmp edx,[tex_1]
1583
    cmp edx,ted_tex_1
1169
    jle @f 
1584
    jle @f 
1170
    inc ebx
1585
    inc ebx
1171
    cmp byte [edx],13
1586
    cmp byte [edx],13
1172
    jne @b
1587
    jne @b
1173
    dec ebx ;lenght minus 1 sumbol to paragraph
1588
    dec ebx ;lenght minus 1 sumbol to paragraph
1174
    cmp eax,ecx
1589
    cmp eax,ecx
1175
    je @f
1590
    je @f
1176
    xor ebx,ebx
1591
    xor ebx,ebx
1177
    inc ecx
1592
    inc ecx
1178
    jmp @b
1593
    jmp @b
1179
  @@:
1594
  @@:
1180
 
1595
 
1181
  cmp eax,ecx
1596
  cmp eax,ecx
1182
  je @f
1597
  je @f
1183
    xor ebx,ebx
1598
    xor ebx,ebx
1184
  @@:
1599
  @@:
1185
 
1600
 
1186
  pop ecx edx
1601
  pop ecx edx
1187
  ret
1602
  ret
1188
 
1603
 
1189
 
1604
 
1190
;output:
1605
;input:
-
 
1606
; edx = symbol position
1191
; edx = symbol position
1607
; edi = pointer to tedit struct
1192
;output:
1608
;output:
1193
; eax = number of line
1609
; eax = number of line
1194
; ebx = symbol position in line
1610
; ebx = symbol position in line
-
 
1611
align 4
1195
GetTexCoords:
1612
GetTexCoords:
1196
  push edx
1613
  push edx
1197
  xor eax,eax
1614
  xor eax,eax
1198
  xor ebx,ebx
1615
  xor ebx,ebx
1199
  @@:
1616
  @@:
1200
    call IteratPerv
1617
    call IteratPerv
1201
 
1618
 
1202
    cmp eax,0
1619
    cmp eax,0
1203
    jne .no_col_mov
1620
    jne .no_col_mov
1204
    inc ebx
1621
    inc ebx
1205
    .no_col_mov:
1622
    .no_col_mov:
1206
 
1623
 
1207
    cmp edx,[tex_1]
1624
    cmp edx,ted_tex_1
1208
    jle @f
1625
    jle @f
1209
    cmp byte [edx],13
1626
    cmp byte [edx],13
1210
    jne @b
1627
    jne @b
1211
    inc eax
1628
    inc eax
1212
    jmp @b
1629
    jmp @b
1213
  @@:
1630
  @@:
1214
  dec ebx
1631
  dec ebx
1215
  pop edx
1632
  pop edx
1216
  ret
1633
  ret
-
 
1634
 
-
 
1635
;input:
1217
 
1636
; edi = pointer to tedit struct
1218
;output:
1637
;output:
-
 
1638
; eax = num lines
1219
; eax = num lines
1639
align 4
1220
GetNumLines:
1640
GetNumLines:
1221
  push edx
1641
  push edx
1222
  mov eax,1
1642
  mov eax,1
1223
  mov edx,[tex]
1643
  mov edx,ted_tex
1224
  @@:
1644
  @@:
1225
    call IteratNext
1645
    call IteratNext
1226
    cmp edx,[tex_1]
1646
    cmp edx,ted_tex_1
1227
    jle @f
1647
    jle @f
1228
    cmp byte [edx],13
1648
    cmp byte [edx],13
1229
    jne @b
1649
    jne @b
1230
    inc eax
1650
    inc eax
1231
    jmp @b
1651
    jmp @b
1232
  @@:
1652
  @@:
1233
;...
1653
;...
1234
;dec eax
1654
;dec eax
1235
  pop edx
1655
  pop edx
1236
  ret
1656
  ret
-
 
1657
 
1237
 
1658
 
-
 
1659
align 4
-
 
1660
proc ted_set_undo, edit:dword
-
 
1661
  push edi
-
 
1662
  mov edi,dword[edit]
1238
SetUndo:
1663
 
1239
  mov [dragk],0 ;çàêàí÷èâàåì âûäåëåíèå îò êëàâèàòóðû
1664
  mov ted_drag_k,0 ;çàêàí÷èâàåì âûäåëåíèå îò êëàâèàòóðû
1240
  cmp [tim_Undo],1
1665
  cmp ted_tim_undo,1
1241
  jl .no_work
1666
  jl .no_work
1242
 
1667
 
1243
  push eax ebx edx
1668
  push eax ebx edx
1244
  mov edx,[tex]
1669
  mov edx,ted_tex
1245
  call GetTexNextPos ;long i=tex[0].next;
1670
  call GetTexNextPos ;long i=tex[0].next;
1246
  mov eax,[tim_Undo]
1671
  mov eax,ted_tim_undo
1247
  sub [ch_tim],eax ;ch_tim-=tim_Undo;
1672
  sub ted_tim_ch,eax ;ted_tim_ch-=ted_tim_undo;
1248
  mov eax,[ch_tim]
1673
  mov eax,ted_tim_ch
1249
  cmp [ls_tim],eax ;if(ls_tim>ch_tim)
1674
  cmp ted_tim_ls,eax ;if(ted_tim_ls>ted_tim_ch)
1250
  jle @f
1675
  jle @f
1251
    mov dword [ls_tim],0
1676
    mov ted_tim_ls,0
1252
  @@:
1677
  @@:
1253
    cmp edx,[tex]
1678
    cmp edx,ted_tex
1254
    je @f
1679
    je @f
1255
 
1680
 
1256
    ;if(tex[i].tc>ch_tim){ // åñëè ñîçäàíèå ñèìâîëà áûëî îòìåíåíî
1681
    ;if(tex[i].tc>ted_tim_ch){ // åñëè ñîçäàíèå ñèìâîëà áûëî îòìåíåíî
1257
    cmp [edx+10],eax
1682
    cmp [edx+10],eax
1258
    jle .no_u1
1683
    jle .no_u1
1259
      mov dword [edx+10],0
1684
      mov dword [edx+10],0
1260
      mov dword [edx+14],0
1685
      mov dword [edx+14],0
1261
 
1686
 
1262
      mov ebx,[edx+2]
1687
      mov ebx,[edx+2]
1263
      imul ebx,sizeof.symbol
1688
      imul ebx,sizeof.symbol
1264
      add ebx,[tex];.next
1689
      add ebx,ted_tex;.next
1265
      m2m dword [ebx+6],dword [edx+6] ;tex[tex[i].perv].next=tex[i].next;
1690
      m2m dword [ebx+6],dword [edx+6] ;tex[tex[i].perv].next=tex[i].next;
1266
 
1691
 
1267
      mov ebx,[edx+6]
1692
      mov ebx,[edx+6]
1268
      imul ebx,sizeof.symbol
1693
      imul ebx,sizeof.symbol
1269
      add ebx,[tex];.perv
1694
      add ebx,ted_tex;.perv
1270
      m2m dword [ebx+2],dword [edx+2] ;tex[tex[i].next].perv=tex[i].perv;
1695
      m2m dword [ebx+2],dword [edx+2] ;tex[tex[i].next].perv=tex[i].perv;
1271
 
1696
 
1272
    .no_u1:
1697
    .no_u1:
1273
 
1698
 
1274
    ;else if(tex[i].td>ch_tim) tex[i].td=0; // åñëè óäàëåíèå ñèìâîëà áûëî îòìåíåíî
1699
    ;else if(tex[i].td>ted_tim_ch) tex[i].td=0; // åñëè óäàëåíèå ñèìâîëà áûëî îòìåíåíî
1275
    cmp [edx+14],eax
1700
    cmp [edx+14],eax
1276
    jle .no_u2
1701
    jle .no_u2
1277
      mov dword [edx+14],0
1702
      mov dword [edx+14],0
1278
    .no_u2:
1703
    .no_u2:
1279
 
1704
 
1280
    call GetTexNextPos
1705
    call GetTexNextPos
1281
    jmp @b
1706
    jmp @b
1282
  @@:
1707
  @@:
1283
  mov dword [tim_Undo],0
1708
  mov ted_tim_undo,0
1284
  mov eax,[co_tim]
1709
  mov eax,ted_tim_co
1285
  cmp [ch_tim],eax
1710
  cmp ted_tim_ch,eax
1286
  jge @f
1711
  jge @f
1287
    mov [co_tim],0
1712
    mov ted_tim_co,0
1288
  @@:
1713
  @@:
1289
  pop edx ebx eax
1714
  pop edx ebx eax
1290
  .no_work:
1715
  .no_work:
-
 
1716
  pop edi
1291
  ret
1717
  ret
-
 
1718
endp
1292
 
1719
 
1293
;input:
1720
;input:
1294
; ecx = Col
1721
; ecx = Col
1295
; edx = Row
1722
; edx = Row
-
 
1723
; edi = pointer to tedit struct
-
 
1724
align 4
1296
GoToPos:
1725
GoToPos:
1297
  mov [cur_x],ecx
1726
  mov ted_cur_x,ecx
1298
  sub edx,[wScr.position]
1727
  sub edx,[wScr.position]
1299
 
1728
 
1300
  cmp edx,[wScr.cur_area] ;[cur_y] > [.cur_area]
1729
  cmp edx,[wScr.cur_area] ;ted_cur_y > [.cur_area]
1301
  jl @f
1730
  jl @f
1302
    push ebx
1731
    push ebx
1303
    mov ebx,edx
1732
    mov ebx,edx
1304
    sub ebx,[wScr.cur_area]
1733
    sub ebx,[wScr.cur_area]
1305
    inc ebx
1734
    inc ebx
1306
    add [wScr.position],ebx
1735
    add [wScr.position],ebx
1307
    sub edx,ebx
1736
    sub edx,ebx
1308
    pop ebx
1737
    pop ebx
1309
    ; ??? redrav
1738
    ; ??? redrav
1310
  @@:
1739
  @@:
1311
  mov [cur_y],edx
1740
  mov ted_cur_y,edx
1312
  ret
1741
  ret
1313
 
1742
 
1314
;input:
1743
;input:
1315
; bl = 1 change time when delete text
1744
; edi = pointer to tedit struct
1316
;output:
-
 
1317
; al = 1 if delete
-
 
1318
SelTextDel:
-
 
1319
  stdcall IsSel, tedit0
-
 
1320
  cmp al,0
-
 
1321
  jne @f
1745
align 4
1322
  ret
-
 
1323
  @@:
-
 
1324
  ;call SelEnd
-
 
1325
  call SelNormalize
-
 
1326
  push esi edi ecx edx
-
 
1327
    mov esi,[seln.x1]
-
 
1328
    mov ecx,[seln.y1]
-
 
1329
    call GetPosByParam
-
 
1330
    mov edi,edx
-
 
1331
 
-
 
1332
    mov esi,[seln.x0]
-
 
1333
    mov ecx,[seln.y0]
-
 
1334
    call GetPosByParam
-
 
1335
 
-
 
1336
    cmp bl,0
-
 
1337
    je @f
-
 
1338
      inc [ch_tim]
-
 
1339
 
-
 
1340
    @@:
-
 
1341
      cmp edx,[tex]
-
 
1342
      je @f
-
 
1343
      cmp edx,edi ;if(i==te)break;
-
 
1344
      je @f
-
 
1345
      m2m dword[edx+14],dword[ch_tim]
-
 
1346
      xor bl,bl   ;n_tim=false;
-
 
1347
      call IteratNext
-
 
1348
      jmp @b
-
 
1349
    @@:
-
 
1350
    cmp bl,0
-
 
1351
    je @f
-
 
1352
      dec [ch_tim]
-
 
1353
      xor al,al
-
 
1354
    @@:
-
 
1355
    cmp bl,0
-
 
1356
    jne @f
-
 
1357
      mov ecx,[seln.x0]
-
 
1358
      mov edx,[seln.y0]
-
 
1359
      call GoToPos
-
 
1360
      mov [sel.x0],0
-
 
1361
      mov [sel.y0],0
-
 
1362
      mov [sel.x1],0
-
 
1363
      mov [sel.y1],0
-
 
1364
    @@:
-
 
1365
  pop edx ecx edi esi
-
 
1366
 
-
 
1367
  ret
-
 
1368
 
-
 
1369
 
-
 
1370
CmColored:
1746
CmColored:
1371
  push eax edx
1747
  push eax edx
1372
  mov eax,[ch_tim]
1748
  mov eax,ted_tim_ch
1373
  sub eax,[tim_Undo]
1749
  sub eax,ted_tim_undo
1374
  mov dword[co_tim],eax
1750
  mov ted_tim_co,eax
1375
  mov edx,[tex]
1751
  mov edx,ted_tex
1376
  @@:
1752
  @@:
1377
    call IteratNext
1753
    call IteratNext
1378
    cmp edx,[tex_1]
1754
    cmp edx,ted_tex_1
1379
    jle @f
1755
    jle @f
1380
    mov byte[edx+1],0
1756
    mov byte[edx+1],0
1381
    jmp @b
1757
    jmp @b
1382
  @@:
1758
  @@:
1383
 
1759
 
1384
  cmp dword[ColWords],1
1760
  cmp ted_key_words_count,1
1385
  jl .no_colors
1761
  jl .no_colors
1386
  mov edx,[tex]
1762
  mov edx,ted_tex
1387
  @@:
1763
  @@:
1388
    call TextFSColor
1764
    call TextFSColor
1389
    cmp edx,[tex_1]
1765
    cmp edx,ted_tex_1
1390
    jle .no_colors
1766
    jle .no_colors
1391
    jmp @b
1767
    jmp @b
1392
  .no_colors:
1768
  .no_colors:
1393
  pop edx eax
1769
  pop edx eax
1394
  ret
1770
  ret
1395
 
1771
 
1396
 
-
 
1397
 
1772
 
1398
;input:
1773
;input:
-
 
1774
; edx = pointer to start symbol
1399
; edx = pointer to start symbol
1775
; edi = pointer to tedit struct
1400
;output:
1776
;output:
1401
; edx = pointer to next symbol
1777
; edx = pointer to next symbol
-
 
1778
;description:
1402
TextFSColor:
1779
; Ôóíêöèÿ äëÿ ïîèñêà è âûäåëåíèÿ ïîäñâå÷åíûõ ñëîâ
1403
  ;eax = word_n
1780
align 4
1404
  ;ecx = l_pos
-
 
1405
  push ebp
1781
proc TextFSColor
1406
  mov ebp,esp
-
 
1407
  sub esp,10 ;2*4+2*1
1782
locals
1408
  ;bP  = dword[ebp-4]
1783
  begPos dd ? ;íà÷àëüíàÿ ïîçèöèÿ
1409
  ;eP  = dword[ebp-8]
1784
  endPos dd ? ;êîíå÷íàÿ ïîçèöèÿ
1410
  ;fnd = byte[ebp-12]
1785
  find db ? ;íàéäåíî / íå íàéäåíî
1411
  ;f_color = byte[ebp-13]
1786
  f_color db ? ;èíäåêñ öâåòà íàéäåíîãî ñëîâà
1412
 
1787
endl
-
 
1788
  push eax ebx ecx esi
-
 
1789
;eax = word_n òåêóùèé íîìåð (ïîçèöèÿ) ïðîâåðÿåìîãî ñëîâà â ñïèñêå
-
 
1790
;ebx = äëÿ ðàçíûõ öåëåé
-
 
1791
;ecx = l_pos ïîñëåäíèé íîìåð (ïîçèöèÿ) ïîäõîäÿùåãî ñëîâà â ñïèñêå
1413
  push eax ebx ecx esi edi
1792
;esi = äëÿ ðàçíûõ öåëåé, íîìåð ïðîâåðÿåìîãî ñèìâîëà â ñëîâå
1414
  mov dword[ebp-4],1
1793
  mov dword[begPos],1
1415
  mov dword[ebp-4],1
1794
  mov dword[endPos],1
1416
  mov byte[ebp-12],0
1795
  mov byte[find],0
1417
  mov byte[ebp-13],1
1796
  mov byte[f_color],1
1418
  @@:
1797
  @@:
1419
    call IteratNext
1798
    call IteratNext
1420
    cmp edx,[tex_1]
1799
    cmp edx,ted_tex_1
1421
    jle @f
1800
    jle @f
1422
 
1801
 
1423
    xor ebx,ebx
-
 
1424
    mov bl,byte[edx]
-
 
1425
;mov byte[buf],bl
1802
    xor eax,eax
1426
;mov byte[buf+1],0
1803
    mov al,byte[edx]
1427
    shl bx,2 ;ebx*=4
1804
    shl ax,2 ;eax*=4
1428
    add ebx,FkPos
1805
    add eax,FkPos
1429
    mov eax,dword[ebx]
1806
    mov eax,dword[eax]
1430
    cmp eax,0
1807
    cmp eax,0
1431
    jl @b ;if( (word_n=FkPos[(unsigned char)tex[i].c])>-1 ){
1808
    jl @b ;if( (word_n=FkPos[(unsigned char)tex[i].c])>-1 ){
1432
 
1809
 
1433
    mov ecx,eax
1810
    mov ecx,eax
1434
    ;while(l_pos
1811
    ;while(l_pos
1435
    .wh_1b:
1812
    .wh_1b:
1436
      cmp ecx,dword[ColWords]
1813
      cmp ecx,ted_key_words_count
1437
      jge .wh_1e
1814
      jge .wh_1e
1438
      ColToIndexOffset ecx,esi
1815
      ColToIndexOffset ecx,esi
1439
      mov bh,byte[esi]
-
 
1440
      ColToIndexOffset eax,esi
-
 
1441
      mov bl,byte[esi]
1816
      mov bl,byte[esi]
-
 
1817
      ColToIndexOffset eax,esi
1442
      cmp bh,bl
1818
      cmp bl,byte[esi]
1443
      jne .wh_1e
1819
      jne .wh_1e
1444
	inc ecx
1820
	inc ecx
1445
      jmp .wh_1b
1821
      jmp .wh_1b
1446
    .wh_1e:
1822
    .wh_1e:
1447
 
1823
 
1448
    mov dword[ebp-4],edx ;bP=i;
1824
    mov dword[begPos],edx ;bP=i;
1449
    mov edi,1
1825
    mov esi,1
1450
 
1826
 
1451
    .wh_2b: ;while(1){
1827
    .wh_2b: ;while(1){
1452
      call IteratNext
1828
      call IteratNext
1453
 
1829
 
1454
      ;while(l_pos>word_n && Col[keyw[l_pos-1]].Text[pos]!=tex[i].c)
1830
      ;while(l_pos>word_n && Col[l_pos-1].Text[pos]!=tex[i].c)
1455
      .wh_3b:
1831
      .wh_3b:
1456
	cmp ecx,eax
1832
	cmp ecx,eax
1457
	jle .wh_3e
1833
	jle .wh_3e
1458
	dec ecx
1834
	dec ecx
1459
	ColToIndexOffset ecx,ebx
1835
	ColToIndexOffset ecx,ebx
1460
	inc ecx
1836
	inc ecx
1461
	;cmp byte[ebx+edi],byte[edx]
1837
	;cmp byte[ebx+esi],byte[edx]
1462
	push ax
-
 
1463
	  mov al,byte[ebx+edi]
1838
	mov bl,byte[ebx+esi]
1464
	  mov bl,al
-
 
1465
	pop ax
-
 
1466
	cmp bl,byte[edx]
1839
	cmp bl,byte[edx]
1467
	je .wh_3e
1840
	je .wh_3e
1468
	  dec ecx
1841
	  dec ecx
1469
	jmp .wh_3b
1842
	jmp .wh_3b
1470
      .wh_3e:
1843
      .wh_3e:
1471
 
1844
 
1472
      ColToIndexOffset eax,ebx
1845
      ColToIndexOffset eax,ebx
1473
      cmp byte[ebx+edi],0
1846
      cmp byte[ebx+esi],0
1474
      jne .if_0 ;if(Col[keyw[word_n]].Text[pos]==0){
1847
      jne .if_0 ;if(Col[word_n].Text[pos]==0){
1475
	mov dword[ebp-8],edx ;eP=i;
1848
	mov dword[endPos],edx ;eP=i;
1476
	ColToIndexOffset eax,esi
1849
	ColToIndexOffset eax,ebx
1477
	mov bl,byte[esi+MAX_COLOR_WORD_LEN+6]
1850
	mov bl,byte[ebx+MAX_COLOR_WORD_LEN+6]
1478
	mov byte[ebp-13],bl ;f_color=Col[keyw[word_n]].color;
1851
	mov byte[f_color],bl ;f_color=Col[word_n].color;
1479
 
1852
 
1480
mov byte[ebp-12],1
1853
mov byte[find],1
1481
;... esi = Col[keyw[word_n]]
1854
	  ColToIndexOffset eax,ebx ;... ebx = Col[word_n]
1482
	  mov bl,byte[esi+MAX_COLOR_WORD_LEN+4]
1855
	  mov bl,byte[ebx+MAX_COLOR_WORD_LEN+4]
1483
	  cmp bl,0 ;if(Col[keyw[word_n]].wwo)
1856
	  cmp bl,0 ;if(Col[word_n].wwo)
1484
	  je .if_2n
1857
	  je .if_2n
1485
	    push edx
1858
	    push edx
1486
	    mov edx,dword[ebp-4]
1859
	    mov edx,dword[begPos]
1487
     call IteratPerv
-
 
1488
;           mov bh,bl
1860
     call IteratPerv
1489
 
1861
 
1490
	    btr bx,0 ;1-1
1862
	    btr bx,0 ;1-1
1491
	    jae .if_3e ;if(Col[keyw[word_n]].wwo&1)
1863
	    jae .if_3e ;if(Col[word_n].wwo&1)
1492
	      ;u1= !(isalnum(cont_s)||cont_s=='_')
1864
	      ;u1= !(isalnum(cont_s)||cont_s=='_')
1493
	      call isalnum
1865
	      call isalnum
1494
	      jae .if_3e
1866
	      jae .if_3e
1495
		mov byte[ebp-12],0
1867
		mov byte[find],0
1496
	    .if_3e:
1868
	    .if_3e:
1497
 
1869
 
1498
	    btr bx,3 ;4-1
1870
	    btr bx,3 ;4-1
1499
	    jae .if_4e ;if(Col[keyw[word_n]].wwo&8)
1871
	    jae .if_4e ;if(Col[word_n].wwo&8)
1500
	      ;u1= !isalpha(cont_s);
1872
	      ;u1= !isalpha(cont_s);
1501
	      call isalpha
1873
	      call isalpha
1502
	      jae .if_4e
1874
	      jae .if_4e
1503
		mov byte[ebp-12],0
1875
		mov byte[find],0
1504
	    .if_4e:
1876
	    .if_4e:
1505
 
-
 
1506
 
1877
 
1507
	    mov edx,dword[ebp-8]
1878
	    mov edx,dword[endPos]
1508
;     call IteratNext
1879
;     call IteratNext
1509
 
1880
 
1510
	    btr bx,1 ;2-1
1881
	    btr bx,1 ;2-1
1511
	    jae .if_5e ;if(Col[keyw[word_n]].wwo&2)
1882
	    jae .if_5e ;if(Col[word_n].wwo&2)
1512
	      ;u1= !(isalnum(cont_s)||cont_s=='_')
1883
	      ;u1= !(isalnum(cont_s)||cont_s=='_')
1513
	      call isalnum
1884
	      call isalnum
1514
	      jae .if_5e
1885
	      jae .if_5e
1515
		mov byte[ebp-12],0
1886
		mov byte[find],0
1516
	    .if_5e:
1887
	    .if_5e:
1517
 
1888
 
1518
	    btr bx,4 ;5-1
1889
	    btr bx,4 ;5-1
1519
	    jae .if_6e ;if(Col[keyw[word_n]].wwo&16)
1890
	    jae .if_6e ;if(Col[word_n].wwo&16)
1520
	      ;u1= !isalpha(cont_s);
1891
	      ;u1= !isalpha(cont_s);
1521
	      call isalpha
1892
	      call isalpha
1522
	      jae .if_6e
1893
	      jae .if_6e
1523
		mov byte[ebp-12],0
1894
		mov byte[find],0
1524
	    .if_6e:
1895
	    .if_6e:
1525
 
1896
 
1526
	    btr bx,2 ;3-1
1897
	    btr bx,2 ;3-1
1527
	    jae .if_7e ;if(Col[keyw[word_n]].wwo&4)
1898
	    jae .if_7e ;if(Col[word_n].wwo&4)
-
 
1899
	    ColToIndexOffset eax,ebx
1528
       mov bl,byte[esi+MAX_COLOR_WORD_LEN+5]
1900
	    mov bl,byte[ebx+MAX_COLOR_WORD_LEN+5]
1529
	      call ItPoNextUc
1901
	    call ItPoNextUc
1530
       cmp edx,[tex_1]
1902
       cmp edx,ted_tex_1
1531
       jle .if_7e
1903
       jle .if_7e
1532
       mov dword[ebp-8],edx
1904
       mov dword[endPos],edx
1533
	    .if_7e:
1905
	    .if_7e:
1534
 
1906
 
1535
	    pop edx
1907
	    pop edx
1536
	  .if_2n:
1908
	  .if_2n:
1537
;                 if(i!=1){ // íå êîíåö äîêóìåíòà
1909
;                 if(i!=1){ // íå êîíåö äîêóìåíòà
1538
;                   cont_s=tex[eP].c;
1910
;                   cont_s=tex[eP].c;
1539
;                   if(Col[keyw[word_n]].wwo&2) u2= !(isalnum(cont_s)||cont_s=='_');  // íå áóêâ.-÷èñë. ñèìâîë
1911
;                   if(Col[word_n].wwo&2) u2= !(isalnum(cont_s)||cont_s=='_');  // íå áóêâ.-÷èñë. ñèìâîë
1540
;                   if(u2 && Col[keyw[word_n]].wwo&16) u2= !isalpha(cont_s); // íå ÷èñë. ñèìâîë
1912
;                   if(u2 && Col[word_n].wwo&16) u2= !isalpha(cont_s); // íå ÷èñë. ñèìâîë
1541
;                   if(Col[keyw[word_n]].wwo&4) eP=ItPoNextUc(eP,Col[keyw[word_n]].endc);
1913
;                   if(Col[word_n].wwo&4) eP=ItPoNextUc(eP,Col[word_n].endc);
1542
 
1914
 
1543
	cmp eax,ecx
1915
	cmp eax,ecx
1544
	je .wh_2e ;if(word_n==l_pos) break; // do double - åñëè ñëîâî òî÷íî ïîñëåäíåå
1916
	je .wh_2e ;if(word_n==l_pos) break; // do double - åñëè ñëîâî òî÷íî ïîñëåäíåå
1545
      .if_0:
1917
      .if_0:
1546
 
1918
 
1547
      cmp edx,[tex_1]
1919
      cmp edx,ted_tex_1
1548
      jle .wh_2e ;if(i==1) break;
1920
      jle .wh_2e ;if(i==1) break;
1549
 
1921
 
1550
      ;while(l_pos>word_n && Col[keyw[word_n]].Text[pos]!=tex[i].c)
1922
      ;while(l_pos>word_n && Col[word_n].Text[pos]!=tex[i].c)
1551
      .wh_4b:
1923
      .wh_4b:
1552
	cmp ecx,eax
1924
	cmp ecx,eax
1553
	jle .wh_4e
1925
	jle .wh_4e
1554
	ColToIndexOffset eax,ebx
1926
	ColToIndexOffset eax,ebx
1555
	;cmp byte[ebx+edi],byte[edx]
1927
	;cmp byte[ebx+esi],byte[edx]
1556
	push ax
-
 
1557
	  mov al,byte[ebx+edi]
1928
	mov bl,byte[ebx+esi]
1558
	  mov bl,al
-
 
1559
	pop ax
-
 
1560
	cmp bl,byte[edx]
1929
	cmp bl,byte[edx]
1561
	je .wh_4e
1930
	je .wh_4e
1562
	  inc eax
1931
	  inc eax
1563
	jmp .wh_4b
1932
	jmp .wh_4b
1564
      .wh_4e:
1933
      .wh_4e:
1565
 
1934
 
1566
      cmp eax,ecx
1935
      cmp eax,ecx
1567
      je .wh_2e;if(word_n==l_pos) break;
1936
      je .wh_2e;if(word_n==l_pos) break;
1568
      inc edi ;pos++;
1937
      inc esi ;pos++;
1569
      jmp .wh_2b
1938
      jmp .wh_2b
1570
    .wh_2e:
1939
    .wh_2e:
1571
 
1940
 
1572
    cmp byte[ebp-12],1 ;if(fnd)break;
1941
    cmp byte[find],1 ;if(fnd)break;
1573
    je @f
1942
    je @f
1574
    mov edx,dword[ebp-4];i=bP;
1943
    mov edx,dword[begPos];i=bP;
1575
    jmp @b
1944
    jmp @b
1576
  @@:
1945
  @@:
1577
 
1946
 
1578
  cmp byte[ebp-12],1
1947
  cmp byte[find],1
1579
  jne .if_1e ;if(fnd){ // âûäåëåíèå íàéäåíîãî òåêñòà
1948
  jne .if_1e ;if(fnd){ // âûäåëåíèå íàéäåíîãî òåêñòà
1580
;    if(!mode_sf1 || (mode_sf1 && strlen(Col[keyw[word_n]].f1->c_str())>0)){
1949
;    if(!mode_sf1 || (mode_sf1 && strlen(Col[word_n].f1->c_str())>0)){
1581
    mov eax,dword[ebp-4]
1950
    mov eax,dword[begPos]
1582
    mov bl,byte[ebp-13]
1951
    mov bl,byte[f_color]
1583
    mov byte[eax+1],bl ;tex[bP].col=f_color;
1952
    mov byte[eax+1],bl ;tex[bP].col=f_color;
1584
    mov eax,dword[ebp-8]
1953
    mov eax,dword[endPos]
1585
    mov byte[eax+1],0xff ;tex[eP].col=255;
1954
    mov byte[eax+1],0xff ;tex[eP].col=255;
1586
;    return ItPoPerv(eP); // âîçâðàùàåì ïîçèöèþ êîíöà âõîæäåíèÿ
1955
;    return ItPoPerv(eP); // âîçâðàùàåì ïîçèöèþ êîíöà âõîæäåíèÿ
1587
    mov edx,dword[ebp-8]
1956
    mov edx,dword[endPos]
1588
    call GetTexPervPos
1957
    call GetTexPervPos
1589
    jmp @f
1958
    jmp @f
1590
  .if_1e:
1959
  .if_1e:
1591
    mov edx,[tex]
1960
    mov edx,ted_tex
1592
  @@:
1961
  @@:
1593
 
1962
 
1594
  pop edi esi ecx ebx eax
-
 
1595
  mov esp,ebp
-
 
1596
  pop ebp
1963
  pop esi ecx ebx eax
1597
  ret
1964
  ret
1598
 
1965
endp
1599
 
1966
 
1600
;input:
1967
;input:
1601
; edx = pointer to char (byte)
1968
; edx = pointer to char (byte)
1602
;output:
1969
;output:
1603
; cf=1 if symbol is...
1970
; cf=1 if symbol is...
-
 
1971
align 4
1604
tab_all_num db 0,0,0,0,0,0,11111111b,11b,11111110b,0xff,0xff,111b,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
1972
tab_all_num db 0,0,0,0,0,0,11111111b,11b,11111110b,0xff,0xff,111b,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
1605
tab_alpha db 0,0,0,0,0,0,0,0,11111110b,0xff,0xff,111b,11111110b,0xff,0xff,111b,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
1973
tab_alpha db 0,0,0,0,0,0,0,0,11111110b,0xff,0xff,111b,11111110b,0xff,0xff,111b,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
1606
  ;db 0,0,0,0,0,0,11111111b,11b,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-
 
-
 
1974
 
-
 
1975
align 4
1607
isalnum:
1976
isalnum:
1608
  push eax ebx
1977
  push eax ebx
1609
  mov al,byte[edx] ;al=offset
1978
  mov al,byte[edx] ;al=offset
1610
  shr al,3
1979
  shr al,3
1611
  and eax,11111b
1980
  and eax,11111b
1612
  mov ebx,tab_all_num
1981
  mov ebx,tab_all_num
1613
  add ebx,eax
1982
  add ebx,eax
1614
  mov ah,byte[ebx]
1983
  mov ah,byte[ebx]
1615
  mov al,byte[edx] ;al=bit
1984
  mov al,byte[edx] ;al=bit
1616
  and ax,111b
1985
  and ax,111b
1617
  m2m bx,word[ebx]
1986
  mov bx,word[ebx]
1618
  btr bx,ax
1987
  btr bx,ax
1619
  pop ebx eax
1988
  pop ebx eax
1620
  ret
1989
  ret
-
 
1990
align 4
1621
isalpha:
1991
isalpha:
1622
  push eax ebx
1992
  push eax ebx
1623
  mov al,byte[edx] ;al=offset
1993
  mov al,byte[edx] ;al=offset
1624
  shr al,3
1994
  shr al,3
1625
  and eax,11111b
1995
  and eax,11111b
1626
  mov ebx,tab_alpha
1996
  mov ebx,tab_alpha
1627
  add ebx,eax
1997
  add ebx,eax
1628
  mov ah,byte[ebx]
1998
  mov ah,byte[ebx]
1629
  mov al,byte[edx] ;al=bit
1999
  mov al,byte[edx] ;al=bit
1630
  and ax,111b
2000
  and ax,111b
1631
  m2m bx,word[ebx]
2001
  mov bx,word[ebx]
1632
  btr bx,ax
2002
  btr bx,ax
1633
  pop ebx eax
2003
  pop ebx eax
1634
  ret
2004
  ret
1635
 
2005
 
1636
 
2006
align 4
1637
ShowHelpF1:
2007
proc ted_show_help_f1, edit:dword
-
 
2008
  push eax edx edi
1638
  push eax edx
2009
  mov edi,dword[edit]
1639
 
2010
 
1640
  call GetPos
2011
  call GetPos
1641
  push edx
2012
  push edx
1642
    call ItNextColorTag
2013
    call ItNextColorTag
1643
    mov eax,edx
2014
    mov eax,edx
1644
  pop edx
2015
  pop edx
1645
  call ItPervColorTag
2016
  call ItPervColorTag
1646
 
2017
 
1647
  cmp eax,[tex]
2018
  cmp eax,ted_tex
1648
  jle @f
2019
  jle @f
1649
  cmp edx,[tex_1]
2020
  cmp edx,ted_tex_1
1650
  jle @f
2021
  jle @f
1651
    call FindHelpId
2022
    stdcall FindHelpId,eax
1652
  @@:
-
 
1653
  pop edx eax
2023
  @@:
1654
  ;stdcall draw_main_cursor, tedit0
2024
  ;stdcall draw_main_cursor,edi
-
 
2025
  stdcall draw_help_f1
1655
  stdcall draw_help_f1, tedit0
2026
  pop edi edx eax
-
 
2027
  ret 
1656
  ret 
2028
endp
1657
 
2029
 
1658
;input:
2030
;input:
1659
; edx = position begin 'symbol' struct
2031
; edx = position begin 'symbol' struct
-
 
2032
; edi = pointer to tedit struct
1660
; eax = position end 'symbol' struct
2033
; end_pos = position end 'symbol' struct
-
 
2034
align 4
1661
FindHelpId:
2035
proc FindHelpId, end_pos:dword
1662
; ecx = word_n
2036
; ecx = word_n
1663
; ebx = l_pos
2037
; ebx = l_pos
1664
  mov [help_id],-1
2038
  mov ted_help_id,-1
1665
 
2039
 
1666
  push ebx ecx
2040
  push ebx ecx
1667
    xor ebx,ebx
2041
    xor ebx,ebx
1668
    mov bl,byte[edx]
2042
    mov bl,byte[edx]
1669
    shl bx,2 ;ebx*=4
2043
    shl bx,2 ;ebx*=4
1670
    add ebx,FkPos
2044
    add ebx,FkPos
1671
    mov ecx,dword[ebx]
2045
    mov ecx,dword[ebx]
1672
    cmp ecx,0
2046
    cmp ecx,0
1673
    jl .if_0e ;if( (word_n=FkPos[(unsigned char)tf[0]])>-1 ){
2047
    jl .if_0e ;if( (word_n=FkPos[(unsigned char)tf[0]])>-1 ){
1674
      push esi edi
2048
      push esi eax
1675
      mov ebx,ecx ;l_pos=word_n;
2049
      mov ebx,ecx ;l_pos=word_n;
1676
      ColToIndexOffset ecx,esi
2050
      ColToIndexOffset ecx,esi
1677
      push cx
2051
      push cx
1678
      mov cl,byte[esi]
2052
      mov cl,byte[esi]
1679
      @@:
2053
      @@:
1680
	cmp ebx,dword[ColWords] ;while(l_pos
2054
	cmp ebx,ted_key_words_count ;while(l_pos
1681
	jge @f
2055
	jge @f
1682
	;ColToIndexOffset ecx,esi
2056
	;ColToIndexOffset ecx,esi
1683
	ColToIndexOffset ebx,edi
2057
	ColToIndexOffset ebx,eax
1684
	cmp cl,byte[edi] ;&& Col[keyw[l_pos]].Text[0]==Col[keyw[word_n]].Text[0])
2058
	cmp cl,byte[eax] ;&& Col[l_pos].Text[0]==Col[word_n].Text[0])
1685
	jne @f
2059
	jne @f
1686
	  inc ebx ;l_pos++;
2060
	  inc ebx ;l_pos++;
1687
	  jmp @b
2061
	  jmp @b
1688
      @@:
2062
      @@:
1689
      pop cx
2063
      pop cx
1690
      call IteratNext ;pos=1;
2064
      call IteratNext ;pos=1;
1691
      mov esi,1
2065
      mov esi,1
1692
      @@:
2066
      @@:
1693
	push dx
2067
	push dx
1694
	push word[edx]
2068
	push word[edx]
1695
	pop dx 
2069
	pop dx 
1696
	  .wh_0b:
2070
	  .wh_0b:
1697
	    cmp ebx,ecx ;while(l_pos>word_n
2071
	    cmp ebx,ecx ;while(l_pos>word_n
1698
	    jle .wh_0e
2072
	    jle .wh_0e
1699
	    dec ebx
2073
	    dec ebx
1700
	    ColToIndexOffset ebx,edi
2074
	    ColToIndexOffset ebx,eax
1701
	    inc ebx
2075
	    inc ebx
1702
	    cmp byte[edi+esi],dl ;&& Col[keyw[l_pos-1]].Text[pos]!=tf[i])
2076
	    cmp byte[eax+esi],dl ;&& Col[l_pos-1].Text[pos]!=tf[i])
1703
	    je .wh_0e
2077
	    je .wh_0e
1704
	      dec ebx ;l_pos--;
2078
	      dec ebx ;l_pos--;
1705
	    jmp .wh_0b
2079
	    jmp .wh_0b
1706
	  .wh_0e:
2080
	  .wh_0e:
1707
 
2081
 
1708
	  .wh_1b:
2082
	  .wh_1b:
1709
	    cmp ebx,ecx ;while(l_pos>word_n
2083
	    cmp ebx,ecx ;while(l_pos>word_n
1710
	    jle .wh_1e
2084
	    jle .wh_1e
1711
	    ColToIndexOffset ecx,edi
2085
	    ColToIndexOffset ecx,eax
1712
	    cmp byte[edi+esi],dl
2086
	    cmp byte[eax+esi],dl
1713
	    je .wh_1e
2087
	    je .wh_1e
1714
	      inc ecx ;word_n++;
2088
	      inc ecx ;word_n++;
1715
	    jmp .wh_1b
2089
	    jmp .wh_1b
1716
	  .wh_1e:
2090
	  .wh_1e:
1717
	pop dx
2091
	pop dx
1718
 
2092
 
1719
	cmp ecx,ebx ;if(word_n==l_pos) break;
2093
	cmp ecx,ebx ;if(word_n==l_pos) break;
1720
	je @f
2094
	je @f
1721
	call IteratNext ;pos++;
2095
	call IteratNext ;pos++;
1722
	cmp edx,eax ;for(...;i
2096
	cmp edx,dword[end_pos] ;for(...;i
1723
	je @f ;jge
2097
	je @f ;jge
1724
	inc esi
2098
	inc esi
1725
	jmp @b
2099
	jmp @b
1726
      @@:
2100
      @@:
1727
      pop edi esi
2101
      pop eax esi
1728
 
2102
 
1729
      mov dword[help_id],ecx
2103
      mov ted_help_id,ecx
1730
      ;return keyw[word_n];
2104
      ;return word_n;
1731
 
2105
 
1732
    .if_0e:
2106
    .if_0e:
1733
  pop ecx ebx
2107
  pop ecx ebx
1734
  ret
2108
  ret
-
 
2109
endp
1735
 
2110
 
1736
;-----------------------------------------------------------------------------
2111
;-----------------------------------------------------------------------------
1737
;ôóíêöèÿ äëÿ âûäåëåíèÿ ïàìÿòè
2112
;ôóíêöèÿ äëÿ âûäåëåíèÿ ïàìÿòè
1738
;input:
2113
;input:
1739
; ecx = size data
2114
; ecx = size data
1740
;otput:
2115
;otput:
1741
; eax = pointer to memory
2116
; eax = pointer to memory
1742
align 4
2117
align 4
1743
mem_Alloc:
2118
mem_Alloc:
1744
  push ebx
2119
  push ebx
1745
  mov eax,68
2120
  mov eax,68
1746
  mov ebx,12
2121
  mov ebx,12
1747
  int 0x40
2122
  int 0x40
1748
  pop ebx
2123
  pop ebx
1749
  ret
2124
  ret
1750
;-----------------------------------------------------------------------------
2125
;-----------------------------------------------------------------------------
1751
;ôóíêöèÿ äëÿ îñâîáîæäåíèÿ ïàìÿòè
2126
;ôóíêöèÿ äëÿ îñâîáîæäåíèÿ ïàìÿòè
1752
;input:
2127
;input:
1753
; ecx = pointer to memory
2128
; ecx = pointer to memory
1754
align 4
2129
align 4
1755
mem_Free:
2130
mem_Free:
1756
  push eax ebx
2131
  push eax ebx
1757
  cmp ecx,0
2132
  cmp ecx,0
1758
  jz @f
2133
  jz @f
1759
    mov eax,68
2134
    mov eax,68
1760
    mov ebx,13
2135
    mov ebx,13
1761
    int 0x40
2136
    int 0x40
1762
  @@:
2137
  @@:
1763
  pop ebx eax
2138
  pop ebx eax
1764
  ret
2139
  ret
1765
>
2140
>
1766
>
2141
>
1767
>
2142
>
-
 
2143
>