Rev 1338 | Rev 1456 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1338 | IgorA | 1 | but_NewFile: |
2 | push eax ebx |
||
3 | call CanSave |
||
4 | cmp al,1 |
||
5 | jne @f |
||
6 | push thread |
||
7 | push msgbox_2 |
||
8 | call [mb_create] ;message: save changes in file? |
||
9 | ;mov eax,5 |
||
10 | ;mov ebx,50 |
||
11 | ;int 0x40 |
||
12 | push msgbox_2_funct |
||
13 | call [mb_setfunctions] |
||
14 | jmp .ret_f |
||
15 | @@: |
||
16 | call On_NewFile |
||
17 | .ret_f: |
||
18 | pop ebx eax |
||
19 | ret |
||
20 | |||
21 | On_NewFile: |
||
22 | push eax |
||
23 | mov al,1 |
||
24 | call Clear |
||
25 | call draw_but_toolbar |
||
1449 | IgorA | 26 | stdcall draw_main_win, tedit0 |
1338 | IgorA | 27 | pop eax |
28 | ret |
||
29 | |||
30 | On_SaveAndNewFile: |
||
31 | call but_SaveFile |
||
32 | cmp byte[err_sav],0 |
||
33 | jne @f |
||
34 | call On_NewFile |
||
35 | @@: |
||
36 | ret |
||
37 | |||
38 | but_OpenFile: |
||
39 | push eax |
||
40 | call CanSave |
||
41 | cmp al,1 |
||
42 | jne @f |
||
43 | push thread |
||
44 | push msgbox_5 |
||
45 | call [mb_create] ;message: save changes in file? |
||
46 | push msgbox_5_funct |
||
47 | call [mb_setfunctions] |
||
48 | jmp .ret_f |
||
49 | @@: |
||
50 | call On_OpenFile |
||
51 | .ret_f: |
||
52 | pop eax |
||
53 | ret |
||
54 | |||
55 | On_OpenFile: |
||
56 | push eax ebx |
||
57 | mov eax,70 |
||
58 | mov [run_file_70.func_n], 0 |
||
59 | mov [run_file_70.param1], 0 |
||
60 | mov [run_file_70.param2], 0 |
||
61 | mov [run_file_70.param3], maxChars-2 ;sizeof.symbol |
||
62 | m2m [run_file_70.param4], [tex] |
||
63 | mov [run_file_70.rezerv], 0 |
||
64 | push dword[edit1.text] |
||
65 | pop dword[run_file_70.name] |
||
66 | mov ebx,run_file_70 |
||
67 | int 0x40 |
||
68 | |||
69 | cmp eax,0 |
||
70 | je @f |
||
71 | cmp eax,6 |
||
72 | je @f |
||
73 | cmp ax,10 |
||
74 | jl .zifra_0_9 |
||
75 | mov al,'?' |
||
76 | sub ax,48 |
||
77 | .zifra_0_9: |
||
78 | add ax,48 |
||
79 | |||
80 | mov byte[msgbox_4.err],al |
||
81 | push thread |
||
82 | push msgbox_4 |
||
83 | call [mb_create] ;message: Can-t open text file! |
||
84 | jmp .ret_f |
||
85 | @@: |
||
86 | cmp ebx,-1 |
||
87 | je .ret_f |
||
88 | ;if open file |
||
89 | call OpenFile |
||
90 | call draw_but_toolbar |
||
1449 | IgorA | 91 | stdcall draw_main_win, tedit0 |
1338 | IgorA | 92 | cmp ebx,maxChars-2 |
93 | jl .ret_f |
||
94 | push thread |
||
95 | push msgbox_1 |
||
96 | call [mb_create] |
||
97 | .ret_f: |
||
98 | pop ebx eax |
||
99 | ret |
||
100 | |||
101 | but_SaveFile: |
||
102 | push eax ebx ecx edx |
||
103 | call CanSave |
||
104 | cmp al,0 |
||
105 | je .no_save |
||
106 | |||
107 | mov ecx,maxChars |
||
108 | call mem_Alloc |
||
109 | push eax |
||
110 | |||
111 | mov edx,[tex] |
||
112 | xor ecx,ecx |
||
113 | @@: |
||
114 | call IteratNext |
||
115 | cmp edx,[tex_1] |
||
116 | jle @f ;edx = [tex] or edx = [tex]+sizeof.symbol |
||
117 | mov bl,[edx] |
||
118 | mov byte[eax],bl |
||
119 | inc eax |
||
120 | inc ecx |
||
121 | jmp @b |
||
122 | @@: |
||
123 | |||
124 | cmp ecx,0 |
||
125 | je @f |
||
126 | pop eax |
||
127 | mov [run_file_70.param4],eax |
||
128 | push eax |
||
129 | mov eax,70 |
||
130 | mov [run_file_70.func_n], 2 |
||
131 | mov [run_file_70.param1], 0 |
||
132 | mov [run_file_70.param2], 0 |
||
133 | mov [run_file_70.param3], ecx |
||
134 | mov [run_file_70.rezerv], 0 |
||
135 | push [edit1.text] |
||
136 | pop [run_file_70.name] |
||
137 | mov ebx,run_file_70 |
||
138 | int 0x40 |
||
139 | |||
140 | mov [err_sav],al |
||
141 | |||
142 | cmp eax,0 |
||
143 | je .no_msg |
||
144 | ; cmp eax,6 |
||
145 | ; je @f |
||
146 | cmp ax,10 |
||
147 | jl .zifra_0_9 |
||
148 | mov al,'?' |
||
149 | sub ax,48 |
||
150 | .zifra_0_9: |
||
151 | add ax,48 |
||
152 | |||
153 | mov byte[msgbox_6.err],al |
||
154 | push thread |
||
155 | push msgbox_6 |
||
156 | call [mb_create] ;message: Can-t save text file! |
||
157 | jmp @f |
||
158 | .no_msg: |
||
159 | m2m [ls_tim],[ch_tim] |
||
160 | @@: |
||
161 | |||
162 | pop ecx |
||
163 | call mem_Free |
||
164 | .no_save: |
||
165 | pop edx ecx ebx eax |
||
166 | ret |
||
167 | |||
168 | but_FindText: |
||
169 | push eax ebx ecx edx edi |
||
170 | call GetPos |
||
171 | mov eax,[edit2.text] |
||
172 | mov bl,byte[eax] |
||
173 | @@: |
||
174 | call GetFindRezult |
||
175 | cmp bh,1 |
||
176 | je @f ; find |
||
177 | |||
178 | call IteratNext |
||
179 | cmp edx,[tex_1] |
||
180 | jle @f |
||
181 | jmp @b |
||
182 | @@: |
||
183 | cmp bh,0 |
||
184 | je @f |
||
185 | call GetTexCoords |
||
186 | inc ebx ;move cursor right |
||
187 | mov [sel.x1],ebx |
||
188 | mov [sel.y1],eax |
||
189 | mov edx,eax |
||
190 | mov ecx,ebx |
||
191 | call GoToPos |
||
192 | mov edx,edi |
||
193 | call GetTexCoords |
||
194 | mov [sel.x0],ebx |
||
195 | mov [sel.y0],eax |
||
1449 | IgorA | 196 | stdcall draw_main_win, tedit0 |
1338 | IgorA | 197 | jmp .end_find |
198 | @@: |
||
199 | push thread |
||
200 | push msgbox_7 |
||
201 | call [mb_create] ;message: Can not find text |
||
202 | .end_find: |
||
203 | pop edi edx ecx ebx eax |
||
204 | ret |
||
205 | |||
206 | ;input: |
||
207 | ; eax - text need find |
||
208 | ; bl - first symbol to find |
||
209 | ; edx - first symbol pointer |
||
210 | ;output: |
||
211 | ; bh - rezult |
||
212 | ; edx - last text position (if find sucess) |
||
213 | ; edi - first symbol pointer |
||
214 | GetFindRezult: |
||
215 | push eax |
||
216 | mov bh,1 |
||
217 | mov edi,edx ;copy edx |
||
218 | @@: |
||
219 | cmp byte[edx],bl |
||
220 | jne .no_text |
||
221 | |||
222 | inc eax ;*** get next symbol (in find text) *** |
||
223 | mov bl,byte[eax] |
||
224 | cmp bl,0 |
||
225 | je @f ;end of find text |
||
226 | |||
227 | call IteratNext ;*** get next symbol (in editor text) *** |
||
228 | cmp edx,[tex_1] |
||
229 | jle @f ;end of editor text |
||
230 | |||
231 | jmp @b |
||
232 | .no_text: |
||
233 | xor bh,bh |
||
234 | mov edx,edi ;restore edx |
||
235 | @@: |
||
236 | pop eax |
||
237 | mov bl,byte[eax] ;restore bl |
||
238 | ret |
||
239 | |||
240 | but_OpenSyntax: |
||
241 | cmp byte[panel_id],TE_PANEL_SYNTAX |
||
242 | jne @f |
||
1449 | IgorA | 243 | stdcall dword[tl_node_get_data], dword tree1 |
244 | pop dword[fn_col_option] |
||
1338 | IgorA | 245 | call InitColText |
246 | call CmColored |
||
1449 | IgorA | 247 | stdcall draw_main_win, tedit0 |
1338 | IgorA | 248 | @@: |
249 | ret |
||
250 | |||
251 | but_select_word: |
||
252 | push eax ebx ecx edx |
||
253 | |||
254 | call GetPos |
||
255 | push edx |
||
256 | call ItPervColorTag |
||
257 | cmp edx,[tex_1] |
||
258 | jle @f |
||
259 | call GetTexCoords |
||
260 | mov [sel.x0],ebx |
||
261 | mov [sel.y0],eax |
||
262 | @@: |
||
263 | pop edx |
||
264 | call ItNextColorTag |
||
265 | cmp edx,[tex_1] |
||
266 | jle @f |
||
267 | call GetTexCoords |
||
268 | mov [sel.x1],ebx |
||
269 | mov [sel.y1],eax |
||
270 | @@: |
||
271 | pop edx ecx ebx eax |
||
272 | call draw_but_toolbar |
||
1449 | IgorA | 273 | stdcall draw_main_win, tedit0 |
1338 | IgorA | 274 | jmp still |
275 | |||
276 | but_cut: |
||
277 | call but_Copy |
||
278 | call SetUndo |
||
279 | push bx |
||
280 | mov bl,1 |
||
281 | call SelTextDel |
||
282 | pop bx |
||
283 | cmp al,1 |
||
284 | jne @f |
||
285 | call draw_but_toolbar |
||
1449 | IgorA | 286 | stdcall draw_main_win, tedit0 |
1338 | IgorA | 287 | @@: |
288 | jmp still |
||
289 | |||
290 | ;output: |
||
291 | ; al = 1 if copy text |
||
292 | but_Copy: |
||
293 | push ax |
||
1449 | IgorA | 294 | stdcall IsSel, tedit0 |
1338 | IgorA | 295 | cmp al,0 |
296 | jne @f |
||
297 | pop ax |
||
298 | ret ;if not selected text |
||
299 | @@: |
||
300 | call SelNormalize |
||
301 | |||
302 | push ebx ecx edx esi |
||
303 | mov esi,[seln.x1] |
||
304 | mov ecx,[seln.y1] |
||
305 | call GetPosByParam |
||
306 | mov ebx,edx |
||
307 | mov esi,[seln.x0] |
||
308 | mov ecx,[seln.y0] |
||
309 | call GetPosByParam |
||
310 | mov esi,ebx |
||
311 | |||
312 | xor ecx,ecx |
||
313 | mov ebx,buf |
||
314 | ;mov edx,[tex] |
||
315 | @@: |
||
316 | cmp edx,[tex_1] ;end of file |
||
317 | jle @f |
||
318 | cmp edx,esi ;end of select |
||
319 | je @f |
||
320 | inc ecx |
||
321 | cmp ecx,BUF_SIZE ;owerflow bufer |
||
322 | je @f |
||
323 | |||
324 | mov al,byte[edx] |
||
325 | mov byte[ebx],al |
||
326 | inc ebx |
||
327 | |||
328 | call IteratNext |
||
329 | jmp @b |
||
330 | @@: |
||
331 | add ecx,buf |
||
332 | mov byte[ebx],0 |
||
333 | |||
334 | cmp ecx,0 |
||
335 | je @f |
||
336 | call draw_but_toolbar |
||
1449 | IgorA | 337 | stdcall draw_bufer, tedit0 |
1338 | IgorA | 338 | @@: |
339 | pop esi edx ecx ebx ax |
||
340 | ret |
||
341 | |||
342 | but_paste: |
||
343 | push eax bx esi edi |
||
344 | mov esi,buf |
||
345 | call strlen |
||
346 | cmp eax,1 |
||
347 | jl @f |
||
348 | call SetUndo |
||
349 | mov esi,eax |
||
350 | mov bx,0x0101 |
||
351 | call SelTextDel |
||
352 | mov edi,buf |
||
353 | call TextAdd |
||
354 | call draw_but_toolbar |
||
1449 | IgorA | 355 | stdcall draw_main_win, tedit0 |
1338 | IgorA | 356 | @@: |
357 | pop edi esi bx eax |
||
358 | jmp still |
||
359 | |||
1449 | IgorA | 360 | proc but_find, edit:dword ;вызов/скрытие панели поиска |
361 | push edi |
||
362 | mov edi,[edit] |
||
363 | |||
1338 | IgorA | 364 | cmp byte[panel_id],TE_PANEL_NULL |
365 | je @f |
||
366 | mov byte[panel_id],TE_PANEL_NULL |
||
1449 | IgorA | 367 | mov ted_wnd_l,0 |
1338 | IgorA | 368 | jmp .e_if |
369 | @@: |
||
370 | mov byte[panel_id],TE_PANEL_FIND |
||
1449 | IgorA | 371 | mov ted_wnd_l,TE_PANEL_WIDTH |
1338 | IgorA | 372 | .e_if: |
1449 | IgorA | 373 | stdcall EvSize,edi |
374 | stdcall draw_main_win,edi |
||
375 | pop edi |
||
376 | ret |
||
377 | endp |
||
1338 | IgorA | 378 | |
379 | but_replace: |
||
380 | jmp still |
||
381 | |||
382 | but_find_key_w: |
||
383 | jmp still |
||
384 | |||
385 | but_sumb_upper: |
||
386 | push edi |
||
387 | mov [conv_table],EvUpper |
||
388 | call ConvertSelText |
||
389 | cmp edi,0 |
||
390 | je @f |
||
1449 | IgorA | 391 | stdcall draw_main_win, tedit0 |
1338 | IgorA | 392 | @@: |
393 | pop edi |
||
394 | jmp still |
||
395 | |||
396 | but_sumb_lover: |
||
397 | push edi |
||
398 | mov [conv_table],EvLover |
||
399 | call ConvertSelText |
||
400 | cmp edi,0 |
||
401 | je @f |
||
1449 | IgorA | 402 | stdcall draw_main_win, tedit0 |
1338 | IgorA | 403 | @@: |
404 | pop edi |
||
405 | jmp still |
||
406 | |||
407 | but_reverse: |
||
408 | push eax ebx |
||
1449 | IgorA | 409 | stdcall IsSel, tedit0 |
1338 | IgorA | 410 | cmp al,0 |
411 | je @f |
||
412 | call SelNormalize |
||
413 | push esi ecx edx |
||
414 | mov esi,[seln.x0] |
||
415 | mov ecx,[seln.y0] |
||
416 | call GetPosByParam |
||
417 | mov eax,edx |
||
418 | mov esi,[seln.x1] |
||
419 | cmp esi,0 |
||
420 | je .beg_str |
||
421 | dec esi |
||
422 | .beg_str: |
||
423 | mov ecx,[seln.y1] |
||
424 | call GetPosByParam |
||
425 | ;call GetTexPervPos |
||
426 | mov ebx,edx |
||
427 | pop edx ecx esi |
||
428 | ;cmp eax,... |
||
429 | ;je @f |
||
430 | call Revers |
||
431 | @@: |
||
432 | pop ebx eax |
||
1449 | IgorA | 433 | stdcall draw_main_win, tedit0 |
1338 | IgorA | 434 | jmp still |
435 | |||
436 | but_undo: |
||
437 | mov eax,[tim_Undo] |
||
438 | cmp [ch_tim],eax |
||
439 | jbe still |
||
440 | inc [tim_Undo] |
||
441 | ;call CmColored |
||
442 | jmp red_win |
||
443 | |||
444 | but_redo: |
||
445 | cmp [tim_Undo],1 |
||
446 | jb still |
||
447 | dec [tim_Undo] |
||
448 | ;call CmColored |
||
449 | jmp red_win |
||
450 | |||
451 | |||
452 | but_sumb_invis: |
||
453 | xor [invis],1 |
||
454 | jmp red_win |
||
455 | |||
456 | but_k_words_show: |
||
457 | xor byte[mode_colored],1 |
||
458 | cmp byte[mode_colored],0 |
||
459 | je red_win |
||
460 | call CmColored |
||
461 | |||
462 | ; push eax ebx ecx esi edi |
||
463 | ; mov eax,dword[cur_x] |
||
464 | ; ColToIndexOffset eax,edx |
||
465 | ; mov eax,4 |
||
466 | ; mov ebx,50*65536+75 |
||
467 | ; mov ecx,0x40ffffff |
||
468 | ; mov edi,0x404040 |
||
469 | ; mov esi,10 |
||
470 | ; int 0x40 |
||
471 | ; |
||
472 | ; mov eax,47 |
||
473 | ; mov ecx,250 |
||
474 | ; mov esi,0xffff80 |
||
475 | ; mov edx,50*65536+80 |
||
476 | ; mov esi,FkPos;[keyW] |
||
477 | ; @@: |
||
478 | ; mov ebx,0x30001 |
||
479 | ; cmp dx,300 |
||
480 | ; jl .no_br |
||
481 | ; mov dx,80 |
||
482 | ; add edx,0x200000 |
||
483 | ; .no_br: |
||
484 | ; add dx,10 |
||
485 | ; push ecx esi |
||
486 | ; mov ecx,esi |
||
487 | ; cmp dword[ecx],-1 |
||
488 | ; jne .no_minus |
||
489 | ; mov ebx,0x10000 |
||
490 | ; mov ecx,1 |
||
491 | ; .no_minus: |
||
492 | ; mov esi,0xffff00 |
||
493 | ; int 0x40 |
||
494 | ; pop esi ecx |
||
495 | ; add esi,4 |
||
496 | ; loop @b |
||
497 | ; pop edi esi ecx ebx eax |
||
498 | jmp red_win |
||
499 | |||
500 | but_CtrlHome: |
||
501 | mov [cur_x],0 |
||
502 | mov [cur_y],0 |
||
503 | mov [wScr.position],0 |
||
504 | mov [hScr.position],0 |
||
505 | |||
506 | call draw_but_toolbar |
||
1449 | IgorA | 507 | stdcall draw_main_win, tedit0 |
1338 | IgorA | 508 | ret |
509 | |||
1449 | IgorA | 510 | proc but_synt_show, edit:dword |
511 | push edi |
||
512 | mov edi,[edit] |
||
513 | |||
1338 | IgorA | 514 | cmp byte[panel_id],TE_PANEL_NULL |
515 | je @f |
||
516 | mov byte[panel_id],TE_PANEL_NULL |
||
1449 | IgorA | 517 | mov ted_wnd_l,0 |
1338 | IgorA | 518 | jmp .e_if |
519 | @@: |
||
520 | mov byte[panel_id],TE_PANEL_SYNTAX |
||
1449 | IgorA | 521 | mov ted_wnd_l,TE_PANEL_WIDTH |
1338 | IgorA | 522 | .e_if: |
1449 | IgorA | 523 | stdcall EvSize,edi |
524 | stdcall draw_main_win,edi |
||
525 | pop edi |
||
526 | ret |
||
527 | endp |
||
1338 | IgorA | 528 | |
529 | sel_KeyUp: |
||
530 | cmp [dragk],1 |
||
531 | je @f |
||
532 | call SelStart |
||
533 | mov [dragk],1 |
||
534 | @@: |
||
535 | push dx |
||
536 | call CurMoveUp |
||
537 | cmp dl,8 |
||
538 | jne @f |
||
539 | call OnInitialUpdate |
||
540 | @@: |
||
541 | pop dx |
||
542 | call SelMove |
||
1449 | IgorA | 543 | stdcall draw_main_win, tedit0 |
1338 | IgorA | 544 | ret |
545 | |||
546 | sel_KeyDown: |
||
547 | cmp [dragk],1 |
||
548 | je @f |
||
549 | call SelStart |
||
550 | mov [dragk],1 |
||
551 | @@: |
||
552 | push dx |
||
553 | call CurMoveDown |
||
554 | cmp dl,8 |
||
555 | jne @f |
||
556 | call OnInitialUpdate |
||
557 | @@: |
||
558 | pop dx |
||
559 | call SelMove |
||
1449 | IgorA | 560 | stdcall draw_main_win, tedit0 |
1338 | IgorA | 561 | ret |
562 | |||
563 | sel_KeyLeft: |
||
564 | cmp [dragk],1 |
||
565 | je @f |
||
566 | call SelStart |
||
567 | @@: |
||
568 | push dx |
||
569 | call CurMoveLeft |
||
570 | call SelMove |
||
571 | cmp [dragk],1 |
||
572 | je @f |
||
573 | mov [dragk],1 |
||
574 | mov dl,8 |
||
575 | @@: |
||
576 | cmp dl,8 |
||
577 | jne @f |
||
578 | call OnInitialUpdate |
||
1449 | IgorA | 579 | stdcall draw_main_win, tedit0 |
1338 | IgorA | 580 | jmp .end_f |
581 | @@: |
||
1449 | IgorA | 582 | stdcall draw_cur_line, tedit0 |
1338 | IgorA | 583 | .end_f: |
584 | pop dx |
||
585 | ret |
||
586 | |||
587 | sel_KeyRight: |
||
588 | cmp [dragk],1 |
||
589 | je @f |
||
590 | call SelStart |
||
591 | @@: |
||
592 | push dx |
||
593 | call CurMoveRight |
||
594 | call SelMove |
||
595 | cmp [dragk],1 |
||
596 | je @f |
||
597 | mov [dragk],1 |
||
598 | mov dl,8 |
||
599 | @@: |
||
600 | cmp dl,8 |
||
601 | jne @f |
||
602 | call OnInitialUpdate |
||
1449 | IgorA | 603 | stdcall draw_main_win, tedit0 |
1338 | IgorA | 604 | jmp .end_f |
605 | @@: |
||
1449 | IgorA | 606 | stdcall draw_cur_line, tedit0 |
1338 | IgorA | 607 | .end_f: |
608 | pop dx |
||
609 | ret |