Subversion Repositories Kolibri OS

Rev

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

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