Subversion Repositories Kolibri OS

Rev

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

Rev 1449 Rev 1456
Line 23... Line 23...
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
Line 27... Line -...
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 ;ñèìâîë çàâåðøåíèÿ ñòðîêè
-
 
Line 69... Line 27...
69
help_id dd -1  ;èäåíòèôèêàòîð äëÿ ñïðàâêè
27
 
70
 
28
 
Line 71... Line 29...
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
 
Line 74... Line 32...
74
fn_icon db 'te_icon.bmp',0
32
fn_icon db 'te_icon.bmp',0
-
 
33
bmp_icon dd 0
75
bmp_icon dd 0
34
run_file_70 f70 	  
76
run_file_70 f70 	  
35
 
77
 
36
 
78
 
37
;input:
79
;input:
38
; edi = pointer to tedit struct
80
; reg = index
39
; reg = index
81
;output:
40
;output:
Line -... Line 41...
-
 
41
; reg = pointer to 'tex' struct
-
 
42
macro ConvertIndexToPointer reg {
-
 
43
  imul reg,sizeof.symbol
-
 
44
  add reg,ted_tex
-
 
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
Line 82... Line 342...
82
; reg = pointer to 'tex' struct
342
  @@:
83
macro ConvertIndexToPointer reg {
343
 
84
  imul reg,sizeof.symbol
344
  .end_key_fun:
-
 
345
  popad
85
  add reg,[tex]
346
  ret
-
 
347
endp
-
 
348
 
86
}
349
;output:
87
 
350
; al = 1 - can save
88
 
351
align 4
89
;output:
352
proc ted_can_save, edit:dword
90
; al = 1 - can save
353
  push ecx edi
91
CanSave:
354
  mov edi,dword[edit]
92
  push ecx
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
Line 96... Line 359...
96
  cmp [ls_tim],ecx
359
  cmp ted_tim_ls,ecx
97
  jne @f
360
  jne @f
-
 
361
    dec al
98
    dec al
362
  @@:
99
  @@:
363
  pop edi ecx
100
  pop ecx
364
  ret
101
  ret
365
endp
102
 
366
 
103
 
367
;output:
104
;output:
368
; al = 1 - selected
105
; 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
Line -... Line 380...
-
 
380
    mov ebx,ted_sel_y0
116
    mov ebx,[sel.y0]
381
    cmp ebx,ted_sel_y1
117
    cmp ebx,[sel.y1]
382
    jne @f
-
 
383
    xor al,al
118
    jne @f
384
  @@:
-
 
385
  pop edi ebx
119
    xor al,al
386
  ret
120
  @@:
387
endp
121
  pop edi ebx
388
 
Line -... Line 389...
-
 
389
align 4
-
 
390
proc SelNormalize, edit:dword
122
  ret
391
  push ecx esi edi
123
endp
392
    mov edi,dword[edit]
124
 
393
    mov esi,edi
125
SelNormalize:
394
    add esi,ted_offs_sel
126
  push ecx esi edi
395
    add edi,ted_offs_seln
Line 127... Line 396...
127
    mov esi,sel
396
    mov ecx,sizeof.TexSelect
128
    mov edi,seln
397
    rep movsb
129
    mov ecx,sizeof.TexSelect
398
 
130
    rep movsb
399
	mov edi,dword[edit]
131
 
400
 
Line 132... Line 401...
132
    jmp @f
401
    jmp @f
133
    .swp_f:
402
    .swp_f:
Line 134... Line 403...
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
Line 137... Line 406...
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
Line 142... Line 411...
142
      mov [seln.y1],ecx
411
      mov ted_seln_y1,ecx
143
 
412
 
144
    jmp .end_f
413
    jmp .end_f
-
 
414
    @@:
Line 145... Line 415...
145
    @@:
415
 
-
 
416
    mov ecx,ted_seln_y0
146
 
417
    cmp ecx,ted_seln_y1 ;(sel_y0>sel_y1)
-
 
418
    jg .swp_f
-
 
419
 
147
    mov ecx,[seln.y0]
420
    cmp ecx,ted_seln_y1 ;(sel_y0==sel_y1)
148
    cmp ecx,[seln.y1] ;(sel.y0>sel.y1)
421
    jne .end_f
149
    jg .swp_f
422
      mov ecx,ted_seln_x0
150
 
423
      cmp ecx,ted_seln_x1 ;(sel_x0>sel_x1)
Line 151... Line 424...
151
    cmp ecx,[seln.y1] ;(sel.y0==sel.y1)
424
      jg .swp_f
152
    jne .end_f
425
 
153
      mov ecx,[seln.x0]
426
    .end_f:
154
      cmp ecx,[seln.x1] ;(sel.x0>sel.x1)
427
  pop edi esi ecx
155
      jg .swp_f
428
  ret
156
 
429
endp
-
 
430
 
Line 157... Line 431...
157
    .end_f:
431
align 4
158
  pop edi esi ecx
432
proc SelStart, edit:dword
159
  ret
433
  push ecx edi
-
 
434
    mov edi,dword[edit]
-
 
435
 
160
 
436
    mov ecx,ted_cur_x
161
SelStart:
437
    add ecx,[hScr.position]
162
  push ecx
438
    mov ted_sel_x0,ecx
Line 163... Line 439...
163
    mov ecx,[cur_x]
439
    mov ted_sel_x1,ecx
164
    add ecx,[hScr.position]
440
 
165
    mov [sel.x0],ecx
441
    mov ecx,ted_cur_y
166
    mov [sel.x1],ecx
442
    add ecx,[wScr.position]
167
 
443
    mov ted_sel_y0,ecx
168
    mov ecx,[cur_y]
444
    mov ted_sel_y1,ecx
-
 
445
  pop edi ecx
Line 169... Line 446...
169
    add ecx,[wScr.position]
446
  ret
170
    mov [sel.y0],ecx
447
endp
171
    mov [sel.y1],ecx
448
 
-
 
449
align 4
-
 
450
proc SelMove, edit:dword
-
 
451
  push ecx edi
-
 
452
    mov edi,dword[edit]
172
  pop ecx
453
 
173
  ret
454
    mov ecx,ted_cur_x
174
 
455
    add ecx,[hScr.position]
175
align 4
456
    mov ted_sel_x1,ecx
176
SelMove:
457
 
177
  push ecx
458
    mov ecx,ted_cur_y
178
    mov ecx,[cur_x]
459
    add ecx,[wScr.position]
Line 179... Line 460...
179
    add ecx,[hScr.position]
460
    mov ted_sel_y1,ecx
180
    mov [sel.x1],ecx
461
  pop edi ecx
181
 
462
  call draw_but_toolbar ;redraw toolbar (need to button Copy)
182
    mov ecx,[cur_y]
463
  ret
183
    add ecx,[wScr.position]
464
endp
Line 184... Line 465...
184
    mov [sel.y1],ecx
465
 
185
  pop ecx
466
;input:
186
  call draw_but_toolbar ;redraw toolbar (need to button Copy)
467
; cl_al_mem = 1 - clear all memory
187
  ret
468
align 4
Line 188... Line 469...
188
 
469
proc ted_clear, edit:dword, cl_al_mem:dword
189
;input:
470
  push edi
Line 190... Line 471...
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
 
Line 200... Line 481...
200
  mov [wScr.position],0
481
  mov [wScr.position],0
-
 
482
  mov [wScr.max_area],100
201
  mov [wScr.max_area],100
483
  mov [wScr.redraw],1
-
 
484
  mov [hScr.position],0
Line 202... Line -...
202
  mov [wScr.redraw],1
-
 
203
  mov [hScr.position],0
485
  mov [hScr.max_area],100
204
  mov [hScr.max_area],100
486
 
205
 
487
  mov ted_sel_x0,0
206
  mov [sel.x0],0
488
  mov ted_sel_y0,0
207
  mov [sel.y0],0
489
  mov ted_sel_x1,0
208
  mov [sel.x1],0
490
  mov ted_sel_y1,0
Line 209... Line 491...
209
  mov [sel.y1],0
491
 
210
 
492
  cmp dword[cl_al_mem],0
-
 
493
  je .exit
211
  cmp al,0
494
 
Line 212... Line 495...
212
  je .exit
495
  push ecx edx
213
 
496
  mov ecx,sizeof.symbol*maxChars
214
  push ecx edx
497
  mov edx,ted_tex
Line 215... Line 498...
215
  mov ecx,sizeof.symbol*maxChars
498
  @@:
216
  mov edx,[tex]
499
    mov byte [edx],0
217
  @@:
500
    inc edx
218
    mov byte [edx],0
501
  loop @b
219
    inc edx
502
  mov edx,ted_tex
220
  loop @b
503
  mov dword [edx+6],1
221
  mov edx,[tex]
504
  pop edx ecx
222
  mov dword [edx+6],1
505
 
223
  pop edx ecx
506
  .exit:
224
 
507
  pop edi
225
  .exit:
508
  ret
226
  ret
509
endp
Line 227... Line 510...
227
 
510
 
228
 
511
;--- out_reg = Col[ind_reg].Text[0] ---
229
;--- out_reg = Col[keyw[ind_reg]].Text[0] ---
512
macro ColToIndexOffset ind_reg,out_reg {
230
macro ColToIndexOffset ind_reg,out_reg {
513
  mov out_reg,ind_reg
231
  mov out_reg,ind_reg
514
  imul out_reg,sizeof.TexColViv
232
  imul out_reg,sizeof.TexColViv
515
  add out_reg,ted_key_words_data
Line 233... Line 516...
233
  add out_reg,[Col]
516
}
234
}
517
 
235
 
518
 
236
 
519
align 4
237
 
520
proc InitColText, edit:dword
Line 238... Line 521...
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]
Line 278... Line 561...
278
      sub ax,48
561
      sub ax,48
279
    .zifra_0_9:
562
    .zifra_0_9:
280
    add ax,48
563
    add ax,48
Line 281... Line 564...
281
 
564
 
282
    mov byte[msgbox_3.err],al
-
 
283
    push thread
-
 
284
    push msgbox_3
565
    mov byte[msgbox_3.err],al
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
Line -... Line 568...
-
 
568
  @@:
287
  @@:
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
-
 
573
  mov ecx,9*4
Line 291... Line 574...
291
  mov ecx,9*4
574
  rep movsb
292
  rep movsb
575
  mov edi,eax ;âîñòàíàâëèâàåì çíà÷åíèå edi
293
 
576
 
Line 294... Line 577...
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)
Line 299... Line 582...
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
Line 314... Line 597...
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
Line 319... Line 602...
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
Line 323... Line 606...
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
-
 
608
 
-
 
609
  .no_colors:
325
 
610
  popad
326
  .no_colors:
611
  ret
327
  pop edi esi ecx ebx eax
612
endp
328
  ret
613
 
Line 329... Line -...
329
 
-
 
330
 
-
 
-
 
614
;input:
331
;input:
615
; ebx = file size
332
; ebx = file size
616
; edi = pointer to tedit struct
333
OpenFile:
617
align 4
334
  push eax ;destination
618
proc OpenFile
335
  push ecx ;for cycle
619
  push eax ;destination
336
  push edx ;source
620
  push ecx ;for cycle
337
 
621
  push edx ;source
338
    xor al,al
622
 
339
    call Clear
623
    stdcall ted_clear,edi,0 ;÷èñòèì íå âñþ ïàìÿòü, ïîòîìó ÷òî íèæå áóäåì åå çàïîëíÿòü íîâûìè äàíûìè
340
    mov eax,ebx
624
    mov eax,ebx
Line 364... Line 648...
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'
Line 368... Line 652...
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
Line 372... Line 656...
372
    mov dword [edx+6],2
656
    mov dword [edx+6],2
Line 377... Line 661...
377
    inc dword [edx+2]
661
    inc dword [edx+2]
Line 378... Line 662...
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
Line 383... Line 667...
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
Line 397... Line 681...
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
Line 404... Line 692...
404
 
692
 
405
;input:
693
;input:
-
 
694
; edx = pointer to symbol struct
406
; edx = pointer to symbol struct
695
; edi = pointer to tedit struct
407
;output:
696
;output:
-
 
697
; edx = pointer to 'perv' visible symbol struct
408
; 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
Line 422... Line 712...
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
Line 434... Line 724...
434
  ret
724
  ret
Line 435... Line 725...
435
 
725
 
436
 
726
 
-
 
727
;input:
437
;input:
728
; edx = pointer to symbol struct
438
; edx = pointer to symbol struct
729
; edi = pointer to tedit struct
-
 
730
;output:
439
;output:
731
; edx = pointer to 'next' visible symbol struct
440
; 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
Line 454... Line 746...
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
Line 467... Line 759...
467
 
759
 
468
;input:
-
 
469
; edx = pointer to symbol struct
760
;input:
-
 
761
; bl = symbol end of select
-
 
762
; edx = pointer to symbol struct
-
 
763
; edi = pointer to tedit struct
470
; bl = symbol end of select
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
Line 481... Line 775...
481
  ret
775
  ret
482
 
776
 
-
 
777
;input:
-
 
778
; edx = pointer to symbol struct
483
;input:
779
; edi = pointer to tedit struct
484
; edx = pointer to symbol 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
Line 493... Line 789...
493
  @@:
789
  @@:
494
  ret
790
  ret
-
 
791
 
-
 
792
;input:
495
 
793
; edx = pointer to symbol struct
496
;input:
794
; edi = pointer to tedit struct
497
; edx = pointer to symbol 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
Line 506... Line 804...
506
  @@:
804
  @@:
507
  ;call IteratNext
805
  ;call IteratNext
-
 
806
  ret
508
  ret
807
 
509
 
808
;input:
510
;input:
809
; edx = pointer to symbol struct
-
 
810
; edi = pointer to tedit struct
511
; edx = pointer to symbol struct
811
;output:
512
;output:
812
; bl = 1 if sumbol not visible
Line 513... Line 813...
513
; bl = 1 if sumbol not visible
813
; (tex[i].td+ted_tim_undo<=ted_tim_ch && tex[i].td) || (tex[i].tc>ted_tim_ch-ted_tim_undo)
Line 514... Line 814...
514
; (tex[i].td+tim_Undo<=ch_tim && tex[i].td) || (tex[i].tc>ch_tim-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
Line 524... Line 824...
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
  @@:
Line 530... Line 830...
530
 
830
 
531
  mov eax,[ch_tim]
831
  mov eax,ted_tim_ch
Line 532... Line 832...
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
-
 
839
  ret
539
  ret
840
 
-
 
841
 
-
 
842
;input:
-
 
843
; text:dword - pointer to text string
-
 
844
; add_opt:dword - options
-
 
845
align 4
540
 
846
proc ted_text_add, edit:dword, text:dword, t_len:dword, add_opt:dword
541
 
-
 
542
;input:
847
  locals
543
; bh = 1 - move cursor after text add
848
    new_spc dd ? ;count new spaces
Line 544... Line 849...
544
; bl = 1 - change time when text add
849
	new_lin dd ? ;count new lines
545
; esi = add text len
850
  endl
546
; edi = pointer to text string
851
;èñïîëüçîâàíèå ðåãèñòðîâ âíóòðè ôóíêöèè:
Line 547... Line 852...
547
TextAdd:
852
;eax - ïîçèöèÿ äëÿ âñòàâêè òåêñòà
548
  push ebp
853
;ebx - äëÿ âðåìåííûõ íóæä, äëèííà âñòàâëÿåìîãî òåêñòà
549
  mov ebp,esp
854
;ecx - äëÿ âðåìåííûõ íóæä
550
  sub esp,4*2
855
;edx - óêàçàòåëü íà ñòðóêòóðó ñèìâîëà
551
 
856
  pushad
552
  push eax ;po_t
857
  mov edi,dword[edit]
553
  push ecx edx edi
858
  mov esi,dword[text]
Line 554... Line 859...
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
Line -... Line 865...
-
 
865
  cmp ted_gp_opt,2
-
 
866
  je @f
560
  cmp [gpOpt],2
867
    push eax ;c_sp=cur[cn].x+Scroller->XPos-StrLen(cur[cn].y+Scroller->YPos);
561
  je @f
868
      mov eax,ted_cur_x
562
    push eax ebx ;c_sp=cur[cn].x+Scroller->XPos-StrLen(cur[cn].y+Scroller->YPos);
869
      add eax,[hScr.position]
563
      mov eax,[cur_x]
870
      mov dword[new_spc],eax
564
      add eax,[hScr.position]
871
 
565
      mov dword[ebp-4],eax
872
      mov eax,ted_cur_y
566
 
873
      add eax,[wScr.position]
567
      mov eax,[cur_y]
874
      call ted_strlen ;ebx = line len
Line 568... Line 875...
568
      add eax,[wScr.position]
875
      sub dword[new_spc],ebx
569
      call StrLen
876
    pop eax
570
      sub dword[ebp-4],ebx
877
  @@:
571
    pop ebx eax
878
 
Line 572... Line 879...
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++;
Line -... Line 904...
-
 
904
      jz .no_tim
-
 
905
	inc ted_tim_ch
597
      je .no_tim
906
      .no_tim:
Line 598... Line 907...
598
	inc [ch_tim]
907
      test dword[add_opt],ted_opt_ed_move_cursor
599
      .no_tim:
908
      jz .no_cur_mov
600
      cmp bh,0
909
      cmp dword[new_lin],0 ;åñëè åñòü äîáàâî÷íûå ñòðîêè, òî êóðñîð åùå íå äâèãàåì
601
      je .no_cur_mov
910
      jg .no_cur_mov
Line 602... Line 911...
602
      cmp dword[ebp-8],0 ;åñëè åñòü äîáàâî÷íûå ñòðîêè, òî êóðñîð åùå íå äâèãàåì
911
      cmp dword[new_spc],0 ;åñëè íåò äîáàâî÷íûõ ïðîáåëîâ, òî êóðñîð òîæå íå äâèãàåì
603
      jg .no_cur_mov
912
      jg .no_cur_mov
604
      cmp dword[ebp-4],0 ;åñëè íåò äîáàâî÷íûõ ïðîáåëîâ, òî êóðñîð òîæå íå äâèãàåì
913
	inc ted_cur_x ;move cursor
605
      jg .no_cur_mov
914
	;call GoToPos
606
	inc [cur_x] ;move cursor
915
	cmp byte [esi],13
Line 607... Line 916...
607
	;call GoToPos
916
	jne .no_cur_mov
608
	cmp byte [edi],13
917
	  mov ted_cur_x,0
609
	jne .no_cur_mov
918
	  inc ted_cur_y
610
	  mov [cur_x],0
919
      .no_cur_mov:
611
	  inc [cur_y]
920
 
612
      .no_cur_mov:
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;
Line 615... Line 924...
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
 
Line 636... Line -...
636
      cmp dword[ebp-8],0 ;add lines or text
-
 
637
      jle .spc_add
-
 
638
	dec dword[ebp-8]
-
 
639
	mov byte [edx],13
945
      cmp dword[new_lin],0 ;add lines or text
-
 
946
      jle .spc_add
640
	jmp .u1f
947
	dec dword[new_lin]
641
      .spc_add:
948
	mov byte [edx],13
Line 642... Line 949...
642
      cmp dword[ebp-4],0 ;add spaces or text
949
	jmp .u1f
643
      jle .tex_add
950
      .spc_add:
644
	dec dword[ebp-4]
951
      cmp dword[new_spc],0 ;add spaces or text
645
	mov byte [edx],' '
952
      jle .tex_add
-
 
953
	dec dword[new_spc]
646
	jmp .u1f
954
	mov byte [edx],' '
647
      .tex_add:
955
	jmp .u1f
-
 
956
      .tex_add:
648
      inc edi
957
      inc esi
Line 649... Line 958...
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
Line 682... Line 991...
682
    add ecx,sizeof.symbol
991
    add ecx,sizeof.symbol
683
    jmp .loop_b
992
    jmp .loop_b
684
  .loop_e:
993
  .loop_e:
Line 685... Line 994...
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]
Line 690... Line 999...
690
  mov byte[ecx],al
999
  mov byte[ecx],al
Line 709... Line 1018...
709
  ret
1018
  ret
Line 710... Line 1019...
710
 
1019
 
711
 
1020
 
-
 
1021
;input:
712
;input:
1022
; conv_table = pointert to convert table
713
; conv_table = pointert to convert table
1023
; edi = pointer to tedit struct
-
 
1024
;output:
714
;output:
1025
; esi = count converted symbols
715
; edi = count converted symbols
1026
align 4
716
ConvertSelText:
1027
proc ConvertSelText
-
 
1028
  locals
-
 
1029
    conv_cou dd ?
-
 
1030
  endl
-
 
1031
  mov dword[conv_cou],0
717
  xor edi,edi
1032
  pushad
718
  push eax ebx ecx edx esi
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
Line 722... Line 1037...
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
Line 731... Line 1046...
731
    call GetPosByParam
1046
    call GetPosByParam
732
    ;call GetTexPervPos
1047
    ;call GetTexPervPos
Line 733... Line 1048...
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
Line 748... Line 1063...
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:
Line 753... Line 1068...
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
 
-
 
1075
      jmp @b
760
      jmp @b
1076
    @@:
761
    @@:
-
 
762
    cmp edi,0
1077
    cmp dword[conv_cou],0
-
 
1078
    jne @f
Line 763... Line -...
763
    jne @f
-
 
764
      dec [ch_tim]
-
 
765
    @@:
-
 
766
  .end_f:
1079
      dec ted_tim_ch
767
  pop esi edx ecx ebx eax
1080
    @@:
768
 
1081
  .end_f:
769
  ret
1082
  popad
-
 
1083
  mov esi,dword[conv_cou]
770
 
1084
  ret
-
 
1085
endp
-
 
1086
 
-
 
1087
;output:
771
;input:
1088
; bl = 0 - no delete
772
; bh = (0-backspace, 1-delete)
1089
; bl = 1 - delete
773
; bl = 1 - change time
1090
align 4
774
;output:
1091
proc TextDel, edit:dword, del_opt:dword
775
; bl = 0 - no delete
1092
  push cx edx edi
776
; bl = 1 - delete
1093
  mov edi,dword[edit]
777
TextDel:
1094
  mov ebx,dword[del_opt]
778
  push edx cx
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
-
 
1108
      inc ted_tim_ch
-
 
1109
    @@:
-
 
1110
    m2m dword [edx+14], ted_tim_ch
-
 
1111
    mov cl,1
-
 
1112
  .no_del:
-
 
1113
  mov bl,cl
-
 
1114
  pop edi edx cx
-
 
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
 
Line -... Line 1134...
-
 
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
Line 791... Line 1168...
791
      inc [ch_tim]
1168
			mov ted_sel_x0,0
792
    @@:
1169
			mov ted_sel_y0,0
793
    m2m dword [edx+14], dword [ch_tim]
1170
			mov ted_sel_x1,0
-
 
1171
			mov ted_sel_y1,0
-
 
1172
		@@:
794
    mov cl,1
1173
	.end_f:
795
  .no_del:
1174
	pop esi edx ecx ebx
796
  mov bl,cl
1175
	ret
797
  pop cx edx
1176
endp
798
  ret
1177
 
Line 799... Line 1178...
799
 
1178
 
Line 800... Line 1179...
800
 
1179
;input:
801
 
1180
; eax = pointer to begin select
802
;input:
1181
; ebx = pointer to end select
803
; eax = pointer to begin select
1182
; edi = pointer to tedit struct
804
; ebx = pointer to end select
1183
align 4
805
Revers:
1184
Revers:
Line 841... Line 1220...
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
Line 853... Line 1232...
853
  pop edx ecx
1232
  pop edx ecx
854
  call CmColored
1233
  call CmColored
855
  ret
1234
  ret
Line -... Line 1235...
-
 
1235
 
-
 
1236
 
856
 
1237
;input:
857
 
1238
; edi = pointer to tedit struct
858
;output:
1239
;output:
859
; dl = 0 not move
1240
; dl = 0 not move
-
 
1241
; dl = 2 if move up
860
; dl = 2 if move up
1242
; dl = 8 if scroll move up
861
; 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
  @@:
Line 873... Line 1255...
873
    ret
1255
    ret
874
  @@:
1256
  @@:
875
  mov dl,0
1257
  mov dl,0
876
  ret
1258
  ret
Line -... Line 1259...
-
 
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
-
 
1265
; dl = 8 if scroll move down
881
; dl = 8 if scroll move down
1266
align 4
882
CurMoveDown:
1267
CurMoveDown:
883
  push eax
1268
  push eax ebx
-
 
1269
  mov dl,0
884
  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
Line 903... Line 1289...
903
  ret
1289
  ret
904
 
1290
 
905
 
1291
 
-
 
1292
;output:
906
;output:
1293
; dl = 0 not move
907
; dl = 0 not move
1294
; dl = 1 if move up
908
; dl = 1 if move up
1295
align 4
909
CurMovePageUp:
1296
CurMovePageUp:
910
  push eax
1297
  push eax
Line 923... Line 1310...
923
    mov dl,1
1310
    mov dl,1
924
  @@:
1311
  @@:
925
  pop eax
1312
  pop eax
926
  ret
1313
  ret
Line -... Line 1314...
-
 
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
Line -... Line 1336...
-
 
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
-
 
1343
; dl = 3 if move left and up
949
; dl = 3 if move left and up
1344
; dl = 8 if scroll move up
950
; 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
Line -... Line 1380...
-
 
1380
  .ret_f:
-
 
1381
  ret
-
 
1382
 
985
  .ret_f:
1383
;input:
986
  ret
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
Line -... Line 1398...
-
 
1398
  .ret_f:
-
 
1399
  pop eax
-
 
1400
  ret
1000
  .ret_f:
1401
 
1001
  pop eax
1402
;input:
1002
  ret
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
Line 1009... Line 1410...
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
Line 1023... Line 1424...
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
Line -... Line 1432...
-
 
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
-
 
1438
; dl = 8 move cursor and scroll
1035
; 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
Line 1047... Line 1451...
1047
  @@:
1451
  @@:
1048
  ret
1452
  ret
Line 1049... Line 1453...
1049
 
1453
 
1050
;input:
1454
;input:
-
 
1455
; edx = pointer to symbol struct
1051
; edx = pointer to symbol struct
1456
; edi = pointer to tedit struct
1052
;output:
1457
;output:
-
 
1458
; eax = array index
1053
; eax = array index
1459
align 4
1054
GetTexArrIndex:
1460
GetTexArrIndex:
Line 1055... Line 1461...
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
Line 1060... Line 1466...
1060
  mov ecx,sizeof.symbol
1466
  mov ecx,sizeof.symbol
1061
  div ecx
1467
  div ecx
Line 1062... Line 1468...
1062
 
1468
 
1063
  pop edx ecx
1469
  pop edx ecx
-
 
1470
  ret
1064
  ret
1471
 
1065
 
1472
;input:
-
 
1473
; edx = pointer to symbol struct
1066
;input:
1474
; edi = pointer to tedit struct
1067
; edx = pointer to symbol struct
1475
;output:
1068
;output:
1476
; edx = pointer to 'perv' struct
1069
; edx = pointer to 'perv' struct
1477
align 4
1070
GetTexPervPos:
1478
GetTexPervPos:
1071
  push dword [edx+2]
1479
  push dword [edx+2]
Line 1072... Line 1480...
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
-
 
1484
 
1076
 
1485
;input:
1077
;input:
1486
; edx = pointer to symbol struct
1078
; edx = pointer to symbol struct
1487
;output:
1079
;output:
1488
; edx = pointer to 'next' symbol struct
1080
; edx = pointer to 'next' symbol struct
1489
align 4
1081
GetTexNextPos:
1490
GetTexNextPos:
Line 1082... Line 1491...
1082
  push dword [edx+6]
1491
  push dword [edx+6]
-
 
1492
  pop edx
1083
  pop edx
1493
  imul edx,sizeof.symbol
1084
  imul edx,sizeof.symbol
1494
  add edx,ted_tex
1085
  add edx,[tex]
1495
  ret
1086
  ret
1496
 
1087
 
1497
;input:
-
 
1498
; edi = pointer to tedit struct
1088
 
1499
;output:
1089
;output:
1500
; edx = symbol under cursor
1090
; edx = symbol under cursor
1501
; ted_gp_opt = 1,2
1091
; gpOpt = 1,2
1502
; edx = tex[1].perv if error
1092
; 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
Line 1097... Line 1508...
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]
-
 
1511
    call GetPosByParam
1100
    call GetPosByParam
1512
  pop ecx esi
1101
  pop ecx esi
1513
  ret
1102
  ret
1514
 
1103
 
1515
 
1104
 
1516
;input:
1105
;input:
1517
; esi = XPos
-
 
1518
; ecx = YPos
1106
; esi = XPos
1519
; edi = pointer to tedit struct
1107
; ecx = YPos
1520
;output:
1108
;output:
1521
; edx = symbol under cursor
Line 1109... Line 1522...
1109
; edx = symbol under cursor
1522
; ted_gp_opt = 1 if found text line
1110
; gpOpt = 1 if found text line
1523
; ted_gp_opt = 2 if found text line and column
1111
; gpOpt = 2 if found text line and column
1524
; edx = tex[1] if error
1112
; edx = tex[1] if error
1525
; ted_gp_opt = 0 if text no found
1113
; gpOpt = 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
Line 1144... Line 1557...
1144
    inc [gpOpt]
1557
    inc ted_gp_opt
1145
  @@:
1558
  @@:
-
 
1559
  cmp ted_gp_opt,0
1146
  cmp [gpOpt],0
1560
  jne @f
1147
  jne @f
1561
    mov edx,ted_tex_1
-
 
1562
    ;call GetTexPervPos
1148
    mov edx,[tex_1]
1563
  @@:
1149
    ;call GetTexPervPos
1564
  pop ebx eax
1150
  @@:
1565
  ret
Line 1151... Line 1566...
1151
  pop ebx eax
1566
 
1152
  ret
1567
 
1153
 
1568
;input:
1154
 
1569
; eax = Row
1155
;input:
1570
; edi = pointer to tedit struct
1156
; eax = Row
1571
;output:
1157
;output:
1572
; ebx = str len
1158
; 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
Line 1185... Line 1600...
1185
 
1600
 
1186
  pop ecx edx
1601
  pop ecx edx
Line 1187... Line 1602...
1187
  ret
1602
  ret
1188
 
1603
 
-
 
1604
 
1189
 
1605
;input:
1190
;output:
1606
; edx = symbol position
1191
; edx = symbol position
1607
; edi = pointer to tedit struct
-
 
1608
;output:
1192
;output:
1609
; eax = number of line
1193
; eax = number of line
1610
; ebx = symbol position in line
1194
; ebx = symbol position in line
1611
align 4
1195
GetTexCoords:
1612
GetTexCoords:
1196
  push edx
1613
  push edx
Line 1202... Line 1619...
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:
Line 1206... Line 1623...
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
Line -... Line 1633...
-
 
1633
  ret
-
 
1634
 
1216
  ret
1635
;input:
1217
 
1636
; edi = pointer to tedit struct
-
 
1637
;output:
1218
;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
Line 1233... Line 1653...
1233
;...
1653
;...
1234
;dec eax
1654
;dec eax
1235
  pop edx
1655
  pop edx
1236
  ret
1656
  ret
Line -... Line 1657...
-
 
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
Line 1241... Line 1666...
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
  @@:
Line 1253... Line 1678...
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
Line 1258... Line 1683...
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
 
Line 1262... Line 1687...
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;
Line 1266... Line 1691...
1266
 
1691
 
Line 1267... Line 1692...
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
 
Line 1272... Line 1697...
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
  @@:
-
 
1708
  mov ted_tim_undo,0
1283
  mov dword [tim_Undo],0
1709
  mov eax,ted_tim_co
-
 
1710
  cmp ted_tim_ch,eax
Line 1284... Line 1711...
1284
  mov eax,[co_tim]
1711
  jge @f
1285
  cmp [ch_tim],eax
1712
    mov ted_tim_co,0
1286
  jge @f
1713
  @@:
-
 
1714
  pop edx ebx eax
-
 
1715
  .no_work:
1287
    mov [co_tim],0
1716
  pop edi
1288
  @@:
1717
  ret
1289
  pop edx ebx eax
1718
endp
Line 1290... Line 1719...
1290
  .no_work:
1719
 
1291
  ret
1720
;input:
1292
 
1721
; ecx = Col
1293
;input:
1722
; edx = Row
1294
; ecx = Col
1723
; edi = pointer to tedit struct
1295
; edx = Row
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
Line 1303... Line 1732...
1303
    mov ebx,edx
1732
    mov ebx,edx
1304
    sub ebx,[wScr.cur_area]
1733
    sub ebx,[wScr.cur_area]
1305
    inc ebx
-
 
1306
    add [wScr.position],ebx
-
 
1307
    sub edx,ebx
-
 
1308
    pop ebx
-
 
1309
    ; ??? redrav
-
 
1310
  @@:
1734
    inc ebx
1311
  mov [cur_y],edx
-
 
1312
  ret
-
 
1313
 
-
 
1314
;input:
-
 
1315
; bl = 1 change time when delete text
-
 
1316
;output:
-
 
1317
; al = 1 if delete
-
 
1318
SelTextDel:
-
 
1319
  stdcall IsSel, tedit0
-
 
1320
  cmp al,0
-
 
1321
  jne @f
-
 
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
1735
    add [wScr.position],ebx
1360
      mov [sel.x0],0
1736
    sub edx,ebx
1361
      mov [sel.y0],0
1737
    pop ebx
1362
      mov [sel.x1],0
1738
    ; ??? redrav
1363
      mov [sel.y1],0
1739
  @@:
1364
    @@:
1740
  mov ted_cur_y,edx
1365
  pop edx ecx edi esi
1741
  ret
1366
 
1742
 
1367
  ret
1743
;input:
1368
 
1744
; edi = pointer to tedit struct
1369
 
1745
align 4
1370
CmColored:
1746
CmColored:
1371
  push eax edx
1747
  push eax edx
Line 1372... Line 1748...
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
  @@:
Line 1383... Line -...
1383
 
-
 
1384
  cmp dword[ColWords],1
1759
 
1385
  jl .no_colors
1760
  cmp ted_key_words_count,1
-
 
1761
  jl .no_colors
1386
  mov edx,[tex]
1762
  mov edx,ted_tex
1387
  @@:
1763
  @@:
1388
    call TextFSColor
1764
    call TextFSColor
-
 
1765
    cmp edx,ted_tex_1
1389
    cmp edx,[tex_1]
1766
    jle .no_colors
1390
    jle .no_colors
1767
    jmp @b
1391
    jmp @b
-
 
1392
  .no_colors:
1768
  .no_colors:
1393
  pop edx eax
-
 
1394
  ret
1769
  pop edx eax
1395
 
1770
  ret
1396
 
1771
 
1397
 
1772
 
1398
;input:
1773
;input:
1399
; edx = pointer to start symbol
1774
; edx = pointer to start symbol
-
 
1775
; edi = pointer to tedit struct
-
 
1776
;output:
-
 
1777
; edx = pointer to next symbol
-
 
1778
;description:
1400
;output:
1779
; Ôóíêöèÿ äëÿ ïîèñêà è âûäåëåíèÿ ïîäñâå÷åíûõ ñëîâ
1401
; edx = pointer to next symbol
1780
align 4
1402
TextFSColor:
1781
proc TextFSColor
1403
  ;eax = word_n
1782
locals
1404
  ;ecx = l_pos
1783
  begPos dd ? ;íà÷àëüíàÿ ïîçèöèÿ
1405
  push ebp
1784
  endPos dd ? ;êîíå÷íàÿ ïîçèöèÿ
1406
  mov ebp,esp
1785
  find db ? ;íàéäåíî / íå íàéäåíî
1407
  sub esp,10 ;2*4+2*1
1786
  f_color db ? ;èíäåêñ öâåòà íàéäåíîãî ñëîâà
Line 1408... Line 1787...
1408
  ;bP  = dword[ebp-4]
1787
endl
1409
  ;eP  = dword[ebp-8]
1788
  push eax ebx ecx esi
1410
  ;fnd = byte[ebp-12]
-
 
1411
  ;f_color = byte[ebp-13]
-
 
1412
 
1789
;eax = word_n òåêóùèé íîìåð (ïîçèöèÿ) ïðîâåðÿåìîãî ñëîâà â ñïèñêå
1413
  push eax ebx ecx esi edi
1790
;ebx = äëÿ ðàçíûõ öåëåé
1414
  mov dword[ebp-4],1
1791
;ecx = l_pos ïîñëåäíèé íîìåð (ïîçèöèÿ) ïîäõîäÿùåãî ñëîâà â ñïèñêå
1415
  mov dword[ebp-4],1
1792
;esi = äëÿ ðàçíûõ öåëåé, íîìåð ïðîâåðÿåìîãî ñèìâîëà â ñëîâå
1416
  mov byte[ebp-12],0
1793
  mov dword[begPos],1
Line 1417... Line 1794...
1417
  mov byte[ebp-13],1
1794
  mov dword[endPos],1
1418
  @@:
1795
  mov byte[find],0
1419
    call IteratNext
1796
  mov byte[f_color],1
1420
    cmp edx,[tex_1]
1797
  @@:
1421
    jle @f
1798
    call IteratNext
1422
 
1799
    cmp edx,ted_tex_1
1423
    xor ebx,ebx
-
 
1424
    mov bl,byte[edx]
-
 
1425
;mov byte[buf],bl
1800
    jle @f
-
 
1801
 
1426
;mov byte[buf+1],0
1802
    xor eax,eax
1427
    shl bx,2 ;ebx*=4
1803
    mov al,byte[edx]
1428
    add ebx,FkPos
1804
    shl ax,2 ;eax*=4
1429
    mov eax,dword[ebx]
1805
    add eax,FkPos
1430
    cmp eax,0
1806
    mov eax,dword[eax]
Line 1431... Line 1807...
1431
    jl @b ;if( (word_n=FkPos[(unsigned char)tex[i].c])>-1 ){
1807
    cmp eax,0
1432
 
1808
    jl @b ;if( (word_n=FkPos[(unsigned char)tex[i].c])>-1 ){
Line 1433... Line 1809...
1433
    mov ecx,eax
1809
 
1434
    ;while(l_pos
1810
    mov ecx,eax
Line 1435... Line 1811...
1435
    .wh_1b:
1811
    ;while(l_pos
1436
      cmp ecx,dword[ColWords]
1812
    .wh_1b:
1437
      jge .wh_1e
1813
      cmp ecx,ted_key_words_count
1438
      ColToIndexOffset ecx,esi
1814
      jge .wh_1e
1439
      mov bh,byte[esi]
1815
      ColToIndexOffset ecx,esi
1440
      ColToIndexOffset eax,esi
1816
      mov bl,byte[esi]
1441
      mov bl,byte[esi]
1817
      ColToIndexOffset eax,esi
1442
      cmp bh,bl
1818
      cmp bl,byte[esi]
1443
      jne .wh_1e
-
 
1444
	inc ecx
1819
      jne .wh_1e
1445
      jmp .wh_1b
-
 
1446
    .wh_1e:
-
 
1447
 
1820
	inc ecx
1448
    mov dword[ebp-4],edx ;bP=i;
1821
      jmp .wh_1b
1449
    mov edi,1
1822
    .wh_1e:
1450
 
1823
 
1451
    .wh_2b: ;while(1){
1824
    mov dword[begPos],edx ;bP=i;
Line 1452... Line 1825...
1452
      call IteratNext
1825
    mov esi,1
1453
 
1826
 
1454
      ;while(l_pos>word_n && Col[keyw[l_pos-1]].Text[pos]!=tex[i].c)
1827
    .wh_2b: ;while(1){
1455
      .wh_3b:
1828
      call IteratNext
1456
	cmp ecx,eax
1829
 
1457
	jle .wh_3e
1830
      ;while(l_pos>word_n && Col[l_pos-1].Text[pos]!=tex[i].c)
1458
	dec ecx
1831
      .wh_3b:
Line 1459... Line 1832...
1459
	ColToIndexOffset ecx,ebx
1832
	cmp ecx,eax
1460
	inc ecx
1833
	jle .wh_3e
1461
	;cmp byte[ebx+edi],byte[edx]
1834
	dec ecx
1462
	push ax
1835
	ColToIndexOffset ecx,ebx
1463
	  mov al,byte[ebx+edi]
1836
	inc ecx
1464
	  mov bl,al
1837
	;cmp byte[ebx+esi],byte[edx]
1465
	pop ax
1838
	mov bl,byte[ebx+esi]
1466
	cmp bl,byte[edx]
1839
	cmp bl,byte[edx]
1467
	je .wh_3e
-
 
Line 1468... Line 1840...
1468
	  dec ecx
1840
	je .wh_3e
1469
	jmp .wh_3b
1841
	  dec ecx
1470
      .wh_3e:
1842
	jmp .wh_3b
1471
 
1843
      .wh_3e:
1472
      ColToIndexOffset eax,ebx
1844
 
1473
      cmp byte[ebx+edi],0
1845
      ColToIndexOffset eax,ebx
1474
      jne .if_0 ;if(Col[keyw[word_n]].Text[pos]==0){
1846
      cmp byte[ebx+esi],0
Line 1475... Line 1847...
1475
	mov dword[ebp-8],edx ;eP=i;
1847
      jne .if_0 ;if(Col[word_n].Text[pos]==0){
1476
	ColToIndexOffset eax,esi
1848
	mov dword[endPos],edx ;eP=i;
1477
	mov bl,byte[esi+MAX_COLOR_WORD_LEN+6]
1849
	ColToIndexOffset eax,ebx
1478
	mov byte[ebp-13],bl ;f_color=Col[keyw[word_n]].color;
1850
	mov bl,byte[ebx+MAX_COLOR_WORD_LEN+6]
1479
 
1851
	mov byte[f_color],bl ;f_color=Col[word_n].color;
1480
mov byte[ebp-12],1
1852
 
1481
;... esi = Col[keyw[word_n]]
1853
mov byte[find],1
Line 1482... Line -...
1482
	  mov bl,byte[esi+MAX_COLOR_WORD_LEN+4]
-
 
1483
	  cmp bl,0 ;if(Col[keyw[word_n]].wwo)
1854
	  ColToIndexOffset eax,ebx ;... ebx = Col[word_n]
1484
	  je .if_2n
1855
	  mov bl,byte[ebx+MAX_COLOR_WORD_LEN+4]
Line 1485... Line 1856...
1485
	    push edx
1856
	  cmp bl,0 ;if(Col[word_n].wwo)
1486
	    mov edx,dword[ebp-4]
1857
	  je .if_2n
1487
     call IteratPerv
1858
	    push edx
1488
;           mov bh,bl
1859
	    mov edx,dword[begPos]
1489
 
1860
     call IteratPerv
1490
	    btr bx,0 ;1-1
1861
 
1491
	    jae .if_3e ;if(Col[keyw[word_n]].wwo&1)
1862
	    btr bx,0 ;1-1
Line 1492... Line 1863...
1492
	      ;u1= !(isalnum(cont_s)||cont_s=='_')
1863
	    jae .if_3e ;if(Col[word_n].wwo&1)
1493
	      call isalnum
1864
	      ;u1= !(isalnum(cont_s)||cont_s=='_')
1494
	      jae .if_3e
1865
	      call isalnum
1495
		mov byte[ebp-12],0
1866
	      jae .if_3e
1496
	    .if_3e:
1867
		mov byte[find],0
1497
 
1868
	    .if_3e:
1498
	    btr bx,3 ;4-1
1869
 
Line 1499... Line 1870...
1499
	    jae .if_4e ;if(Col[keyw[word_n]].wwo&8)
1870
	    btr bx,3 ;4-1
1500
	      ;u1= !isalpha(cont_s);
1871
	    jae .if_4e ;if(Col[word_n].wwo&8)
-
 
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
 
1877
 
1506
 
1878
	    mov edx,dword[endPos]
Line 1507... Line 1879...
1507
	    mov edx,dword[ebp-8]
1879
;     call IteratNext
1508
;     call IteratNext
1880
 
1509
 
1881
	    btr bx,1 ;2-1
1510
	    btr bx,1 ;2-1
1882
	    jae .if_5e ;if(Col[word_n].wwo&2)
1511
	    jae .if_5e ;if(Col[keyw[word_n]].wwo&2)
1883
	      ;u1= !(isalnum(cont_s)||cont_s=='_')
1512
	      ;u1= !(isalnum(cont_s)||cont_s=='_')
1884
	      call isalnum
1513
	      call isalnum
1885
	      jae .if_5e
Line 1514... Line 1886...
1514
	      jae .if_5e
1886
		mov byte[find],0
1515
		mov byte[ebp-12],0
1887
	    .if_5e:
1516
	    .if_5e:
1888
 
Line 1517... Line 1889...
1517
 
1889
	    btr bx,4 ;5-1
1518
	    btr bx,4 ;5-1
1890
	    jae .if_6e ;if(Col[word_n].wwo&16)
Line 1519... Line 1891...
1519
	    jae .if_6e ;if(Col[keyw[word_n]].wwo&16)
1891
	      ;u1= !isalpha(cont_s);
1520
	      ;u1= !isalpha(cont_s);
1892
	      call isalpha
1521
	      call isalpha
1893
	      jae .if_6e
1522
	      jae .if_6e
1894
		mov byte[find],0
1523
		mov byte[ebp-12],0
1895
	    .if_6e:
1524
	    .if_6e:
1896
 
1525
 
-
 
1526
	    btr bx,2 ;3-1
1897
	    btr bx,2 ;3-1
1527
	    jae .if_7e ;if(Col[keyw[word_n]].wwo&4)
-
 
1528
       mov bl,byte[esi+MAX_COLOR_WORD_LEN+5]
-
 
1529
	      call ItPoNextUc
1898
	    jae .if_7e ;if(Col[word_n].wwo&4)
1530
       cmp edx,[tex_1]
1899
	    ColToIndexOffset eax,ebx
1531
       jle .if_7e
1900
	    mov bl,byte[ebx+MAX_COLOR_WORD_LEN+5]
1532
       mov dword[ebp-8],edx
1901
	    call ItPoNextUc
1533
	    .if_7e:
1902
       cmp edx,ted_tex_1
Line 1534... Line 1903...
1534
 
1903
       jle .if_7e
1535
	    pop edx
1904
       mov dword[endPos],edx
1536
	  .if_2n:
1905
	    .if_7e:
1537
;                 if(i!=1){ // íå êîíåö äîêóìåíòà
1906
 
1538
;                   cont_s=tex[eP].c;
1907
	    pop edx
Line 1539... Line 1908...
1539
;                   if(Col[keyw[word_n]].wwo&2) u2= !(isalnum(cont_s)||cont_s=='_');  // íå áóêâ.-÷èñë. ñèìâîë
1908
	  .if_2n:
1540
;                   if(u2 && Col[keyw[word_n]].wwo&16) u2= !isalpha(cont_s); // íå ÷èñë. ñèìâîë
1909
;                 if(i!=1){ // íå êîíåö äîêóìåíòà
1541
;                   if(Col[keyw[word_n]].wwo&4) eP=ItPoNextUc(eP,Col[keyw[word_n]].endc);
1910
;                   cont_s=tex[eP].c;
1542
 
1911
;                   if(Col[word_n].wwo&2) u2= !(isalnum(cont_s)||cont_s=='_');  // íå áóêâ.-÷èñë. ñèìâîë
1543
	cmp eax,ecx
1912
;                   if(u2 && Col[word_n].wwo&16) u2= !isalpha(cont_s); // íå ÷èñë. ñèìâîë
Line 1544... Line 1913...
1544
	je .wh_2e ;if(word_n==l_pos) break; // do double - åñëè ñëîâî òî÷íî ïîñëåäíåå
1913
;                   if(Col[word_n].wwo&4) eP=ItPoNextUc(eP,Col[word_n].endc);
1545
      .if_0:
1914
 
1546
 
1915
	cmp eax,ecx
1547
      cmp edx,[tex_1]
1916
	je .wh_2e ;if(word_n==l_pos) break; // do double - åñëè ñëîâî òî÷íî ïîñëåäíåå
1548
      jle .wh_2e ;if(i==1) break;
1917
      .if_0:
1549
 
1918
 
1550
      ;while(l_pos>word_n && Col[keyw[word_n]].Text[pos]!=tex[i].c)
1919
      cmp edx,ted_tex_1
1551
      .wh_4b:
1920
      jle .wh_2e ;if(i==1) break;
1552
	cmp ecx,eax
1921
 
1553
	jle .wh_4e
1922
      ;while(l_pos>word_n && Col[word_n].Text[pos]!=tex[i].c)
1554
	ColToIndexOffset eax,ebx
1923
      .wh_4b:
1555
	;cmp byte[ebx+edi],byte[edx]
1924
	cmp ecx,eax
1556
	push ax
1925
	jle .wh_4e
1557
	  mov al,byte[ebx+edi]
1926
	ColToIndexOffset eax,ebx
1558
	  mov bl,al
1927
	;cmp byte[ebx+esi],byte[edx]
Line 1559... Line 1928...
1559
	pop ax
1928
	mov bl,byte[ebx+esi]
1560
	cmp bl,byte[edx]
-
 
1561
	je .wh_4e
-
 
1562
	  inc eax
1929
	cmp bl,byte[edx]
1563
	jmp .wh_4b
1930
	je .wh_4e
Line 1564... Line 1931...
1564
      .wh_4e:
1931
	  inc eax
1565
 
1932
	jmp .wh_4b
1566
      cmp eax,ecx
1933
      .wh_4e:
1567
      je .wh_2e;if(word_n==l_pos) break;
1934
 
-
 
1935
      cmp eax,ecx
1568
      inc edi ;pos++;
1936
      je .wh_2e;if(word_n==l_pos) break;
1569
      jmp .wh_2b
1937
      inc esi ;pos++;
1570
    .wh_2e:
-
 
-
 
1938
      jmp .wh_2b
-
 
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]
-
 
1954
    mov byte[eax+1],0xff ;tex[eP].col=255;
1585
    mov byte[eax+1],0xff ;tex[eP].col=255;
1955
;    return ItPoPerv(eP); // âîçâðàùàåì ïîçèöèþ êîíöà âõîæäåíèÿ
1586
;    return ItPoPerv(eP); // âîçâðàùàåì ïîçèöèþ êîíöà âõîæäåíèÿ
1956
    mov edx,dword[endPos]
1587
    mov edx,dword[ebp-8]
1957
    call GetTexPervPos
1588
    call GetTexPervPos
1958
    jmp @f
1589
    jmp @f
1959
  .if_1e:
1590
  .if_1e:
1960
    mov edx,ted_tex
1591
    mov edx,[tex]
1961
  @@:
1592
  @@:
1962
 
1593
 
1963
  pop esi ecx ebx eax
1594
  pop edi esi ecx ebx eax
1964
  ret
1595
  mov esp,ebp
1965
endp
1596
  pop ebp
1966
 
1597
  ret
1967
;input:
1598
 
1968
; edx = pointer to char (byte)
Line 1599... Line 1969...
1599
 
1969
;output:
1600
;input:
1970
; cf=1 if symbol is...
1601
; edx = pointer to char (byte)
1971
align 4
-
 
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
Line 1602... Line 1973...
1602
;output:
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
1603
; cf=1 if symbol is...
1974
 
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
1975
align 4
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
1976
isalnum:
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
1977
  push eax ebx
1607
isalnum:
1978
  mov al,byte[edx] ;al=offset
Line 1608... Line 1979...
1608
  push eax ebx
1979
  shr al,3
1609
  mov al,byte[edx] ;al=offset
1980
  and eax,11111b
1610
  shr al,3
1981
  mov ebx,tab_all_num
1611
  and eax,11111b
1982
  add ebx,eax
1612
  mov ebx,tab_all_num
1983
  mov ah,byte[ebx]
1613
  add ebx,eax
1984
  mov al,byte[edx] ;al=bit
1614
  mov ah,byte[ebx]
-
 
1615
  mov al,byte[edx] ;al=bit
1985
  and ax,111b
1616
  and ax,111b
1986
  mov bx,word[ebx]
-
 
1987
  btr bx,ax
1617
  m2m bx,word[ebx]
1988
  pop ebx eax
-
 
1989
  ret
Line 1618... Line 1990...
1618
  btr bx,ax
1990
align 4
1619
  pop ebx eax
1991
isalpha:
-
 
1992
  push eax ebx
1620
  ret
1993
  mov al,byte[edx] ;al=offset
-
 
1994
  shr al,3
1621
isalpha:
1995
  and eax,11111b
1622
  push eax ebx
1996
  mov ebx,tab_alpha
1623
  mov al,byte[edx] ;al=offset
1997
  add ebx,eax
1624
  shr al,3
1998
  mov ah,byte[ebx]
Line 1625... Line 1999...
1625
  and eax,11111b
1999
  mov al,byte[edx] ;al=bit
1626
  mov ebx,tab_alpha
2000
  and ax,111b
1627
  add ebx,eax
2001
  mov bx,word[ebx]
1628
  mov ah,byte[ebx]
2002
  btr bx,ax
1629
  mov al,byte[edx] ;al=bit
2003
  pop ebx eax
1630
  and ax,111b
2004
  ret
1631
  m2m bx,word[ebx]
2005
 
1632
  btr bx,ax
2006
align 4
1633
  pop ebx eax
2007
proc ted_show_help_f1, edit:dword
1634
  ret
2008
  push eax edx edi
1635
 
2009
  mov edi,dword[edit]
1636
 
2010
 
1637
ShowHelpF1:
2011
  call GetPos
1638
  push eax edx
2012
  push edx
1639
 
2013
    call ItNextColorTag
1640
  call GetPos
2014
    mov eax,edx
1641
  push edx
2015
  pop edx
1642
    call ItNextColorTag
2016
  call ItPervColorTag
1643
    mov eax,edx
2017
 
1644
  pop edx
2018
  cmp eax,ted_tex
1645
  call ItPervColorTag
2019
  jle @f
1646
 
2020
  cmp edx,ted_tex_1
1647
  cmp eax,[tex]
2021
  jle @f
1648
  jle @f
2022
    stdcall FindHelpId,eax
Line 1695... Line 2069...
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:
Line 1707... Line 2081...
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:
Line 1717... Line 2091...
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
Line 1726... Line 2100...
1726
      @@:
2100
      @@:
1727
      pop edi esi
2101
      pop eax esi
Line 1728... Line 2102...
1728
 
2102
 
1729
      mov dword[help_id],ecx
2103
      mov ted_help_id,ecx
1730
      ;return keyw[word_n];
2104
      ;return word_n;
-
 
2105
 
Line 1731... Line 2106...
1731
 
2106
    .if_0e:
1732
    .if_0e:
2107
  pop ecx ebx
1733
  pop ecx ebx
2108
  ret
1734
  ret
2109
endp