/programs/other/t_edit/readme.htm |
---|
48,7 → 48,7 |
</head> |
<body> |
<h1>TextEditor âåðñèÿ îò 29.12.2009</h1> |
<h1>TextEditor âåðñèÿ îò 22.04.2010</h1> |
<h2>Î ïðîãðàììå</h2> |
<p>Ïðîãðàììà äëÿ ðàáîòû ñ òåêñòîâûìè ôàéëàìè. |
Ëèöåíçèÿ ñâîáîäíàÿ.</p> |
67,11 → 67,11 |
ó êàæäîé èç íèõ åñòü ñâîè ñèëüíûå è ñëàáûå ñòîðîíû. |
Ïðîâåäó (íå ïîëíîå) ñðàâíåíèå ïðîãðàìì TinyPad è TextEditor:</p> |
<table border=1> |
<tr><th>Äåéñòâèÿ</th><th>TinyPad</th><th>TextEditor</th><th>Êîììåíòàðèé</th></tr> |
<tr><th>Äåéñòâèÿ</th><th>TinyPad</th><th>TextEditor</th></tr> |
<tr><td>Ðàáîòà ñ íåñêîëüêèìè äîêóìåíòàìè</td> |
<td>åñòü</td><td>íåò</td><td>ïîêà íå ïëàíèðóþ ñäåëàòü</td></tr> |
<td>åñòü</td><td>íåò (âîçìîæíî ñêîðî áóäåò)</td></tr> |
<tr><td>Ïîääåðæêà êîäèðîâîê KOI8M, OEM</td> |
<td>åñòü</td><td>íåò</td><td>õîòåëîñü-áû ñäåëàòü</td></tr> |
<td>åñòü</td><td>íåò</td></tr> |
<tr><td>Ïîäñâåòêà ñèíòàêñèñà</td> |
<td>ïîäñâåòêà çàðàíåå çàøèòà â ïðîãðàììó</td><td>ïîäñâåòêà áåðåòñÿ èç ôàéëîâ, êîòîðûå ìîæåò óêàçàòü ïîëüçîâàòåëü. Òàêæå åñòü âîçìîæíîñòü ïîëó÷àòü ñïðàâêó ïî ïîäñâå÷èâàåìûì ñëîâàì (åñëè îíà åñòü â ôàéëàõ ïîäñâåòêè, íàâåñòè êóðñîð íà ñëîâî è íàæàòü F1).</td><td></td></tr> |
<tr><td>Ìíîãîêðàòíàÿ îòìåíà/ïîâòîð äåéñòâèé</td> |
/programs/other/t_edit/t_button.inc |
---|
1,16 → 1,14 |
align 4 |
but_NewFile: |
push eax ebx |
call CanSave |
stdcall ted_can_save, tedit0 |
cmp al,1 |
jne @f |
push thread |
push msgbox_2 |
call [mb_create] ;message: save changes in file? |
stdcall [mb_create],msgbox_2,thread ;message: save changes in file? |
;mov eax,5 |
;mov ebx,50 |
;int 0x40 |
push msgbox_2_funct |
call [mb_setfunctions] |
stdcall [mb_setfunctions],msgbox_2_funct |
jmp .ret_f |
@@: |
call On_NewFile |
18,48 → 16,59 |
pop ebx eax |
ret |
align 4 |
On_NewFile: |
push eax |
mov al,1 |
call Clear |
stdcall ted_clear, tedit0,1 |
call draw_but_toolbar |
stdcall draw_main_win, tedit0 |
pop eax |
ret |
align 4 |
On_SaveAndNewFile: |
call but_SaveFile |
cmp byte[err_sav],0 |
push edi |
mov edi, tedit0 |
stdcall but_SaveFile,edi |
cmp ted_err_save,0 |
jne @f |
call On_NewFile |
@@: |
pop edi |
ret |
align 4 |
but_no_msg_OpenFile: ;äãªæ¨ï ®âªàëâ¨ï ä ©« ç¥à¥§ ¡¥§ ®ª® á®®¡é¥¨ï |
stdcall ted_on_open_file, tedit0 |
ret |
;äãªæ¨ï ®âªàëâ¨ï ä ©« á ¢®§¬®¦ë¬ ®ª®¬ á®®¡é¥¨ï (® ¢®§¬®¦®á⨠®â¬¥¨âì ®âªàë⨥) |
align 4 |
but_OpenFile: |
push eax |
call CanSave |
stdcall ted_can_save, tedit0 |
cmp al,1 |
jne @f |
push thread |
push msgbox_5 |
call [mb_create] ;message: save changes in file? |
push msgbox_5_funct |
call [mb_setfunctions] |
stdcall [mb_create],msgbox_5,thread ;message: save changes in file? |
stdcall [mb_setfunctions],msgbox_5_funct |
jmp .ret_f |
@@: |
call On_OpenFile |
stdcall ted_on_open_file, tedit0 |
.ret_f: |
pop eax |
ret |
On_OpenFile: |
push eax ebx |
align 4 |
proc ted_on_open_file, edit:dword ;äãªæ¨ï ®âªàëâ¨ï ä ©« |
push eax ebx edi |
mov edi,dword[edit] |
mov eax,70 |
mov [run_file_70.func_n], 0 |
mov [run_file_70.param1], 0 |
mov [run_file_70.param2], 0 |
mov [run_file_70.param3], maxChars-2 ;sizeof.symbol |
m2m [run_file_70.param4], [tex] |
m2m [run_file_70.param4], ted_tex |
mov [run_file_70.rezerv], 0 |
push dword[edit1.text] |
pop dword[run_file_70.name] |
78,9 → 87,7 |
add ax,48 |
mov byte[msgbox_4.err],al |
push thread |
push msgbox_4 |
call [mb_create] ;message: Can-t open text file! |
stdcall [mb_create],msgbox_4,thread ;message: Can-t open text file! |
jmp .ret_f |
@@: |
cmp ebx,-1 |
87,33 → 94,35 |
je .ret_f |
;if open file |
call OpenFile |
call draw_but_toolbar |
stdcall draw_main_win, tedit0 |
cmp ebx,maxChars-2 |
jl .ret_f |
push thread |
push msgbox_1 |
call [mb_create] |
stdcall [mb_create],msgbox_1,thread |
.ret_f: |
pop ebx eax |
pop edi ebx eax |
ret |
endp |
but_SaveFile: |
push eax ebx ecx edx |
call CanSave |
align 4 |
proc but_SaveFile, edit:dword |
pushad |
stdcall ted_can_save,edi |
cmp al,0 |
je .no_save |
mov edi,dword[edit] |
mov ecx,maxChars |
call mem_Alloc |
push eax |
mov edx,[tex] |
mov edx,ted_tex |
xor ecx,ecx |
@@: |
call IteratNext |
cmp edx,[tex_1] |
jle @f ;edx = [tex] or edx = [tex]+sizeof.symbol |
cmp edx,ted_tex_1 |
jle @f ;edx = ted_tex or edx = ted_tex+sizeof.symbol |
mov bl,[edx] |
mov byte[eax],bl |
inc eax |
137,7 → 146,7 |
mov ebx,run_file_70 |
int 0x40 |
mov [err_sav],al |
mov ted_err_save,ax |
cmp eax,0 |
je .no_msg |
151,22 → 160,25 |
add ax,48 |
mov byte[msgbox_6.err],al |
push thread |
push msgbox_6 |
call [mb_create] ;message: Can-t save text file! |
stdcall [mb_create],msgbox_6,thread ;message: Can-t save text file! |
jmp @f |
.no_msg: |
m2m [ls_tim],[ch_tim] |
m2m ted_tim_ls,ted_tim_ch |
@@: |
pop ecx |
call mem_Free |
.no_save: |
pop edx ecx ebx eax |
popad |
ret |
endp |
but_FindText: |
push eax ebx ecx edx edi |
align 4 |
proc but_FindText, edit:dword |
pushad |
mov edi,dword[edit] |
call GetPos |
mov eax,[edit2.text] |
mov bl,byte[eax] |
176,7 → 188,7 |
je @f ; find |
call IteratNext |
cmp edx,[tex_1] |
cmp edx,ted_tex_1 |
jle @f |
jmp @b |
@@: |
184,37 → 196,43 |
je @f |
call GetTexCoords |
inc ebx ;move cursor right |
mov [sel.x1],ebx |
mov [sel.y1],eax |
mov ted_sel_x1,ebx |
mov ted_sel_y1,eax |
mov edx,eax |
mov ecx,ebx |
call GoToPos |
mov edx,edi |
mov edx,esi ;esi ¡ë«® ãáâ ®¢«¥® ¢ GetFindRezult |
call GetTexCoords |
mov [sel.x0],ebx |
mov [sel.y0],eax |
stdcall draw_main_win, tedit0 |
mov ted_sel_x0,ebx |
mov ted_sel_y0,eax |
stdcall draw_main_win,edi |
jmp .end_find |
@@: |
push thread |
push msgbox_7 |
call [mb_create] ;message: Can not find text |
stdcall [mb_create],msgbox_7,thread ;message: Can not find text |
.end_find: |
pop edi edx ecx ebx eax |
popad |
ret |
endp |
;input: |
; eax - text need find |
; bl - first symbol to find |
; edx - first symbol pointer |
; edi - pointer to tedit struct |
;output: |
; bh - rezult |
; edx - last text position (if find sucess) |
; edi - first symbol pointer |
; esi - first symbol pointer |
;description: |
; ãªæ¨ï ¯à®¢¥àï¥â ᮢ¯ ¤ ¥â «¨ ⥪áâ ¢ ¡ãä¥à¥ eax |
; á ⥪á⮬ । ªâ®à ¯® 㪠§ ⥫î edx. |
; â ¤ àâë¥ äãªæ¨¨ ( ¯à. strcmp) âãâ ¥ ¯®¤®©¤ãâ, ¯®â®¬ã çâ® |
; ¢ ¯ ¬ï⨠। ªâ®à ⥪áâ ᮤ¥à¦¨âáï ¥ ¢ ¢¨¤¥ ascii áâப. |
align 4 |
GetFindRezult: |
push eax |
mov bh,1 |
mov edi,edx ;copy edx |
mov esi,edx ;copy edx |
@@: |
cmp byte[edx],bl |
jne .no_text |
225,95 → 243,108 |
je @f ;end of find text |
call IteratNext ;*** get next symbol (in editor text) *** |
cmp edx,[tex_1] |
cmp edx,ted_tex_1 |
jle @f ;end of editor text |
jmp @b |
.no_text: |
xor bh,bh |
mov edx,edi ;restore edx |
mov edx,esi ;restore edx |
@@: |
pop eax |
mov bl,byte[eax] ;restore bl |
ret |
but_OpenSyntax: |
cmp byte[panel_id],TE_PANEL_SYNTAX |
align 4 |
proc ted_but_open_syntax, edit:dword |
push edi |
mov edi,dword[edit] |
cmp ted_panel_id,TE_PANEL_SYNTAX |
jne @f |
stdcall dword[tl_node_get_data], dword tree1 |
stdcall dword[tl_node_get_data], tree1 |
pop dword[fn_col_option] |
call InitColText |
stdcall InitColText,edi |
call CmColored |
stdcall draw_main_win, tedit0 |
stdcall draw_main_win,edi |
@@: |
pop edi |
ret |
endp |
but_select_word: |
push eax ebx ecx edx |
align 4 |
proc ted_but_select_word, edit:dword |
pushad |
mov edi,dword[edit] |
call GetPos |
push edx |
call ItPervColorTag |
cmp edx,[tex_1] |
cmp edx,ted_tex_1 |
jle @f |
call GetTexCoords |
mov [sel.x0],ebx |
mov [sel.y0],eax |
mov ted_sel_x0,ebx |
mov ted_sel_y0,eax |
@@: |
pop edx |
call ItNextColorTag |
cmp edx,[tex_1] |
cmp edx,ted_tex_1 |
jle @f |
call GetTexCoords |
mov [sel.x1],ebx |
mov [sel.y1],eax |
mov ted_sel_x1,ebx |
mov ted_sel_y1,eax |
@@: |
pop edx ecx ebx eax |
call draw_but_toolbar |
stdcall draw_main_win, tedit0 |
jmp still |
stdcall draw_main_win,edi |
popad |
ret |
endp |
but_cut: |
call but_Copy |
call SetUndo |
push bx |
mov bl,1 |
call SelTextDel |
pop bx |
align 4 |
proc ted_but_cut, edit:dword |
push edi |
mov edi,dword[edit] |
stdcall ted_but_copy,edi |
stdcall ted_set_undo,edi |
stdcall SelTextDel,ted_opt_ed_change_time |
cmp al,1 |
jne @f |
call draw_but_toolbar |
stdcall draw_main_win, tedit0 |
stdcall draw_main_win,edi |
@@: |
jmp still |
pop edi |
ret |
endp |
;output: |
; al = 1 if copy text |
but_Copy: |
push ax |
stdcall IsSel, tedit0 |
align 4 |
proc ted_but_copy, edit:dword |
pushad |
mov edi,dword[edit] |
stdcall IsSel,edi |
cmp al,0 |
jne @f |
pop ax |
ret ;if not selected text |
@@: |
call SelNormalize |
je .end_f ;if not selected text |
stdcall SelNormalize,edi |
push ebx ecx edx esi |
mov esi,[seln.x1] |
mov ecx,[seln.y1] |
mov esi,ted_seln_x1 |
mov ecx,ted_seln_y1 |
call GetPosByParam |
mov ebx,edx |
mov esi,[seln.x0] |
mov ecx,[seln.y0] |
mov esi,ted_seln_x0 |
mov ecx,ted_seln_y0 |
call GetPosByParam |
mov esi,ebx |
xor ecx,ecx |
mov ebx,buf |
;mov edx,[tex] |
;mov edx,ted_tex |
@@: |
cmp edx,[tex_1] ;end of file |
cmp edx,ted_tex_1 ;end of file |
jle @f |
cmp edx,esi ;end of select |
je @f |
332,42 → 363,52 |
mov byte[ebx],0 |
cmp ecx,0 |
je @f |
je .end_f |
call draw_but_toolbar |
stdcall draw_bufer, tedit0 |
@@: |
pop esi edx ecx ebx ax |
stdcall draw_bufer,edi |
.end_f: |
popad |
ret |
endp |
but_paste: |
push eax bx esi edi |
align 4 |
proc ted_but_paste, edit:dword |
push eax ebx esi edi |
mov edi,dword[edit] |
mov esi,buf |
call strlen |
cmp eax,1 |
jl @f |
call SetUndo |
stdcall ted_set_undo,edi |
mov esi,eax |
mov bx,0x0101 |
call SelTextDel |
mov edi,buf |
call TextAdd |
mov ebx,ted_opt_ed_change_time+ted_opt_ed_move_cursor |
stdcall SelTextDel,ebx |
cmp al,1 |
jne .del |
mov ebx,ted_opt_ed_move_cursor |
.del: |
stdcall ted_text_add,edi,buf,esi,ebx |
call draw_but_toolbar |
stdcall draw_main_win, tedit0 |
stdcall draw_main_win,edi |
@@: |
pop edi esi bx eax |
jmp still |
pop edi esi ebx eax |
ret |
endp |
align 4 |
proc but_find, edit:dword ;¢ë§®¢/áªàë⨥ ¯ ¥«¨ ¯®¨áª |
push edi |
mov edi,[edit] |
mov edi,dword[edit] |
cmp byte[panel_id],TE_PANEL_NULL |
cmp ted_panel_id,TE_PANEL_NULL |
je @f |
mov byte[panel_id],TE_PANEL_NULL |
mov ted_panel_id,TE_PANEL_NULL |
mov ted_wnd_l,0 |
jmp .e_if |
@@: |
mov byte[panel_id],TE_PANEL_FIND |
mov ted_panel_id,TE_PANEL_FIND |
mov ted_wnd_l,TE_PANEL_WIDTH |
.e_if: |
stdcall EvSize,edi |
376,51 → 417,64 |
ret |
endp |
align 4 |
but_replace: |
jmp still |
ret |
align 4 |
but_find_key_w: |
jmp still |
ret |
but_sumb_upper: |
push edi |
align 4 |
proc but_sumb_upper, edit:dword |
push edi esi |
mov edi,dword[edit] |
mov [conv_table],EvUpper |
call ConvertSelText |
cmp edi,0 |
cmp esi,0 |
je @f |
stdcall draw_main_win, tedit0 |
stdcall draw_main_win,edi |
@@: |
pop edi |
jmp still |
pop esi edi |
ret |
endp |
but_sumb_lover: |
push edi |
align 4 |
proc but_sumb_lover, edit:dword |
push edi esi |
mov edi,dword[edit] |
mov [conv_table],EvLover |
call ConvertSelText |
cmp edi,0 |
cmp esi,0 |
je @f |
stdcall draw_main_win, tedit0 |
stdcall draw_main_win,edi |
@@: |
pop edi |
jmp still |
pop esi edi |
ret |
endp |
but_reverse: |
push eax ebx |
stdcall IsSel, tedit0 |
align 4 |
proc but_reverse, edit:dword |
push eax ebx edi |
mov edi,dword[edit] |
stdcall IsSel,edi |
cmp al,0 |
je @f |
call SelNormalize |
stdcall SelNormalize,edi |
push esi ecx edx |
mov esi,[seln.x0] |
mov ecx,[seln.y0] |
mov esi,ted_seln_x0 |
mov ecx,ted_seln_y0 |
call GetPosByParam |
mov eax,edx |
mov esi,[seln.x1] |
mov esi,ted_seln_x1 |
cmp esi,0 |
je .beg_str |
dec esi |
.beg_str: |
mov ecx,[seln.y1] |
mov ecx,ted_seln_y1 |
call GetPosByParam |
;call GetTexPervPos |
mov ebx,edx |
429,95 → 483,101 |
;je @f |
call Revers |
@@: |
pop ebx eax |
stdcall draw_main_win, tedit0 |
jmp still |
stdcall draw_main_win,edi |
pop edi ebx eax |
ret |
endp |
but_undo: |
mov eax,[tim_Undo] |
cmp [ch_tim],eax |
jbe still |
inc [tim_Undo] |
align 4 |
proc ted_but_undo, edit:dword |
push eax edi |
mov edi,dword[edit] |
mov eax,ted_tim_undo |
cmp ted_tim_ch,eax |
jbe @f |
inc ted_tim_undo |
;call CmColored |
jmp red_win |
stdcall draw_main_win,edi |
call draw_but_toolbar |
@@: |
pop edi eax |
ret |
endp |
but_redo: |
cmp [tim_Undo],1 |
jb still |
dec [tim_Undo] |
align 4 |
proc ted_but_redo, edit:dword |
push edi |
mov edi,dword[edit] |
cmp ted_tim_undo,1 |
jb @f |
dec ted_tim_undo |
;call CmColored |
jmp red_win |
stdcall draw_main_win,edi |
call draw_but_toolbar |
@@: |
pop edi |
ret |
endp |
align 4 |
proc but_sumb_invis, edit:dword |
push edi |
mov edi,dword[edit] |
but_sumb_invis: |
xor [invis],1 |
jmp red_win |
xor ted_mode_invis,1 |
call draw_but_toolbar |
stdcall draw_main_win,edi |
pop edi |
ret |
endp |
but_k_words_show: |
xor byte[mode_colored],1 |
cmp byte[mode_colored],0 |
je red_win |
align 4 |
proc but_k_words_show, edit:dword |
push edi |
mov edi,dword[edit] |
xor ted_mode_color,1 |
cmp ted_mode_color,0 |
je @f |
call CmColored |
@@: |
call draw_but_toolbar |
stdcall draw_main_win,edi |
pop edi |
ret |
endp |
; push eax ebx ecx esi edi |
; mov eax,dword[cur_x] |
; ColToIndexOffset eax,edx |
; mov eax,4 |
; mov ebx,50*65536+75 |
; mov ecx,0x40ffffff |
; mov edi,0x404040 |
; mov esi,10 |
; int 0x40 |
; |
; mov eax,47 |
; mov ecx,250 |
; mov esi,0xffff80 |
; mov edx,50*65536+80 |
; mov esi,FkPos;[keyW] |
; @@: |
; mov ebx,0x30001 |
; cmp dx,300 |
; jl .no_br |
; mov dx,80 |
; add edx,0x200000 |
; .no_br: |
; add dx,10 |
; push ecx esi |
; mov ecx,esi |
; cmp dword[ecx],-1 |
; jne .no_minus |
; mov ebx,0x10000 |
; mov ecx,1 |
; .no_minus: |
; mov esi,0xffff00 |
; int 0x40 |
; pop esi ecx |
; add esi,4 |
; loop @b |
; pop edi esi ecx ebx eax |
jmp red_win |
;input: |
; edi = pointer to tedit struct |
align 4 |
but_CtrlHome: |
mov [cur_x],0 |
mov [cur_y],0 |
mov [wScr.position],0 |
mov [hScr.position],0 |
mov ted_cur_x,0 |
mov ted_cur_y,0 |
push eax |
mov eax,ted_scr_w |
mov dword[eax+sb_offs_position],0 |
mov eax,ted_scr_h |
mov dword[eax+sb_offs_position],0 |
pop eax |
call draw_but_toolbar |
stdcall draw_main_win, tedit0 |
stdcall draw_main_win,edi |
ret |
align 4 |
proc but_synt_show, edit:dword |
push edi |
mov edi,[edit] |
cmp byte[panel_id],TE_PANEL_NULL |
cmp ted_panel_id,TE_PANEL_NULL |
je @f |
mov byte[panel_id],TE_PANEL_NULL |
mov ted_panel_id,TE_PANEL_NULL |
mov ted_wnd_l,0 |
jmp .e_if |
@@: |
mov byte[panel_id],TE_PANEL_SYNTAX |
mov ted_panel_id,TE_PANEL_SYNTAX |
mov ted_wnd_l,TE_PANEL_WIDTH |
.e_if: |
stdcall EvSize,edi |
526,11 → 586,15 |
ret |
endp |
sel_KeyUp: |
cmp [dragk],1 |
align 4 |
proc ted_sel_key_up, edit:dword |
push edi |
mov edi,dword[edit] |
cmp ted_drag_k,1 |
je @f |
call SelStart |
mov [dragk],1 |
stdcall SelStart,edi |
mov ted_drag_k,1 |
@@: |
push dx |
call CurMoveUp |
539,15 → 603,21 |
call OnInitialUpdate |
@@: |
pop dx |
call SelMove |
stdcall draw_main_win, tedit0 |
stdcall SelMove,edi |
stdcall draw_main_win,edi |
pop edi |
ret |
endp |
sel_KeyDown: |
cmp [dragk],1 |
align 4 |
proc ted_sel_key_down, edit:dword |
push edi |
mov edi,dword[edit] |
cmp ted_drag_k,1 |
je @f |
call SelStart |
mov [dragk],1 |
stdcall SelStart,edi |
mov ted_drag_k,1 |
@@: |
push dx |
call CurMoveDown |
556,54 → 626,68 |
call OnInitialUpdate |
@@: |
pop dx |
call SelMove |
stdcall draw_main_win, tedit0 |
stdcall SelMove,edi |
stdcall draw_main_win,edi |
pop edi |
ret |
endp |
sel_KeyLeft: |
cmp [dragk],1 |
align 4 |
proc ted_sel_key_left, edit:dword |
push edi |
mov edi,dword[edit] |
cmp ted_drag_k,1 |
je @f |
call SelStart |
stdcall SelStart,edi |
@@: |
push dx |
call CurMoveLeft |
call SelMove |
cmp [dragk],1 |
stdcall SelMove,edi |
cmp ted_drag_k,1 |
je @f |
mov [dragk],1 |
mov ted_drag_k,1 |
mov dl,8 |
@@: |
cmp dl,8 |
jne @f |
call OnInitialUpdate |
stdcall draw_main_win, tedit0 |
stdcall draw_main_win,edi |
jmp .end_f |
@@: |
stdcall draw_cur_line, tedit0 |
stdcall draw_cur_line,edi |
.end_f: |
pop dx |
pop edi |
ret |
endp |
sel_KeyRight: |
cmp [dragk],1 |
align 4 |
proc ted_sel_key_right, edit:dword |
push edi |
mov edi,dword[edit] |
cmp ted_drag_k,1 |
je @f |
call SelStart |
stdcall SelStart,edi |
@@: |
push dx |
call CurMoveRight |
call SelMove |
cmp [dragk],1 |
stdcall SelMove,edi |
cmp ted_drag_k,1 |
je @f |
mov [dragk],1 |
mov ted_drag_k,1 |
mov dl,8 |
@@: |
cmp dl,8 |
jne @f |
call OnInitialUpdate |
stdcall draw_main_win, tedit0 |
stdcall draw_main_win,edi |
jmp .end_f |
@@: |
stdcall draw_cur_line, tedit0 |
stdcall draw_cur_line,edi |
.end_f: |
pop dx |
ret |
pop edi |
ret |
endp |
/programs/other/t_edit/t_data.inc |
---|
300,17 → 300,116 |
ted_rec_h equ dword[edi+28] ;¢ëá®â ᨬ¢®« (§ ª®¬¥áâ ) ¢ ®ª¥ |
ted_drag_m equ byte[edi+32] ;¢ë¤¥«¥¨¥ ®â ¬ëè¨ |
ted_drag_k equ byte[edi+33] ;¢ë¤¥«¥¨¥ ®â ª« ¢¨ âãàë |
ted_sel_x0 equ dword[edi+34] ;ª®®à¤¨ ⠢뤥«¥¨ï x0 |
ted_sel_y0 equ dword[edi+38] ;ª®®à¤¨ ⠢뤥«¥¨ï y0 |
ted_sel_x1 equ dword[edi+42] ;ª®®à¤¨ ⠢뤥«¥¨ï x1 |
ted_sel_y1 equ dword[edi+46] ;ª®®à¤¨ ⠢뤥«¥¨ï y1 |
;§ ¯ áë¥ ª®®à¤¨ âë ¢ë¤¥«¥¨ï |
ted_seln_x0 equ dword[edi+50] |
ted_seln_y0 equ dword[edi+54] |
ted_seln_x1 equ dword[edi+58] |
ted_seln_y1 equ dword[edi+62] |
ted_tex equ dword[edi+66] ;㪠§ â¥«ì ¯ ¬ïâì ¤«ï åà ¥¨ï ⥪áâ |
ted_tex_1 equ dword[edi+70] ;㪠§ ⥫ì 1-î áâàªãâàã ᨬ¢®« |
ted_tex_end equ dword[edi+74] ;㪠§ â¥«ì ¯®á«¥¤îî áâàãªâãàã ᨬ¢®« |
ted_cur_x equ dword[edi+78] ;ª®®à¤¨ â x ªãàá®à |
ted_cur_y equ dword[edi+82] ;ª®®à¤¨ â y ªãàá®à |
ted_cur_ins equ byte[edi+86] ;०¨¬ à ¡®âë ªãàá®à (®¡ëçë© ¨«¨ § ¬¥ ) |
ted_mode_color equ byte[edi+87] ;०¨¬ ¢ë¤¥«¥¨ï á«®¢ 梥⮬ (0-¢ëª«. 1-¢ª«.) |
ted_mode_invis equ byte[edi+88] ;०¨¬ ¯®ª § ¥¯¥ç â ¥¬ëå ᨬ¢®«®¢ |
ted_gp_opt equ byte[edi+89] ;®¯æ¨¨ ¢®§¢à é ¥¬ë¥ äãªæ¨¥© GetPos |
ted_colors_text_count equ dword[edi+90] ;ª®««¨ç¥á⢮ 梥⮢ ⥪áâ |
ted_key_words_count equ dword[edi+94] ;ª®««¨ç¥á⢮ ª«î祢ëå á«®¢ |
ted_color_cursor equ dword[edi+98] ;梥⠪ãàá®à |
ted_color_wnd_capt equ dword[edi+102] ;梥⠯®«¥© ¢®ªà㣠®ª |
ted_color_wnd_work equ dword[edi+106] ;梥â ä® ®ª |
ted_color_wnd_bord equ dword[edi+110] ;梥â ⥪áâ ¯®«ïå |
ted_color_select equ dword[edi+114] ;梥⠢뤥«¥¨ï |
ted_color_cur_text equ dword[edi+118] ;梥â ᨬ¢®« ¯®¤ ªãàá®à®¬ |
ted_color_wnd_text equ dword[edi+122] ;梥â ⥪áâ ¢ ®ª¥ |
ted_syntax_file equ dword[edi+126] ;㪠§ ⥫ì ç «® ä ©« á¨â ªá¨á |
ted_syntax_file_end equ dword[edi+130] ;㪠§ â¥«ì ª®¥æ ä ©« á¨â ªá¨á |
ted_text_colors equ dword[edi+134] ;㪠§ â¥«ì ¬ áᨢ 梥⮢ ⥪áâ |
ted_help_text_f1 equ dword[edi+138] ;㪠§ ⥫ì ⥪áâ á¯à ¢ª¨ (¯® ¦ ⨨ F1) |
ted_help_id equ dword[edi+142] ;¨¤¥â¨ä¨ª â®à ¤«ï á¯à ¢ª¨ |
ted_key_words_data equ dword[edi+146] ;㪠§ ⥫ì áâàãªâãàë ª«î祢ëå á«®¢ TexColViv |
ted_tim_ch equ dword[edi+150] ;ª®««¨ç¥á⢮ ¨§¬¥¥¨© ¢ ä ©«¥ |
ted_tim_undo equ dword[edi+154] ;ª®««¨ç¥á⢮ ®â¬¥¥ëå ¤¥©á⢨© |
ted_tim_ls equ dword[edi+158] ;¢à¥¬ï ¯®á«¥¤¥£® á®åà ¥¨ï |
ted_tim_co equ dword[edi+162] ;¢à¥¬ï ¯®á«¥¤¥© 梥⮢®© à §¬¥âª¨ |
ted_el_focus equ dword[edi+166] ;㪠§ â¥«ì ¯¥à¥¬¥ãî í«¥¬¥â ¢ 䮪ãᥠ|
ted_err_save equ word[edi+170] ;®è¨¡ª á®åà ¥¨ï ä ©« |
ted_key_new equ byte[edi+172] ;ᨬ¢®«, ª®â®àë© ¡ã¤¥â ¤®¡ ¢«ïâáï á ª« ¢¨ âãàë |
ted_symbol_new_line equ byte[edi+173] ;ᨬ¢®« § ¢¥à襨ï áâப¨ |
ted_scr_w equ dword[edi+174] ;¢¥à⨪ «ìë© áªà®««¨£ |
ted_scr_h equ dword[edi+178] ;£®à¨§®â «ìë© áªà®««¨£ |
ted_panel_id equ byte[edi+182] ;®¬¥à ®âªàë⮩ ¯ ¥«¨ |
;------------------------------------------------------------------------------ |
sb_offs_max_area equ 16 |
sb_offs_cur_area equ 20 |
sb_offs_position equ 24 |
sb_offs_redraw equ 40 |
;------------------------------------------------------------------------------ |
ted_opt_ed_move_cursor equ 1 ;¤¢¨£ âì ªãàá®à ¯®á«¥ ¤®¡ ¢«¥¨ï ⥪áâ |
ted_opt_ed_change_time equ 2 ;¤®¡ ¢«ïâì ¨§¬¥¥¨ï ¯à¨ । ªâ¨à®¢ ¨¨ ⥪áâ |
ted_offs_sel equ 34 ;ᬥ饨¥ áâàãªâãàë sel |
ted_offs_seln equ 50 ;ᬥ饨¥ áâàãªâãàë seln |
ted_offs_count_colors equ 90 ;ᬥ饨¥ ¯¥à¥¬¥®© ª®««¨ç¥á⢠梥⮢ |
ted_offs_key_new equ 172 |
ted_offs_symbol_new_line equ 173 ;ᬥ饨¥ ᨬ¢®« ®¢®© áâப¨ |
;------------------------------------------------------------------------------ |
align 4 |
tedit0: ;áâàãªâãà ⥪á⮢®£® । ªâ®à |
.wnd BOX 0,50,440,150 ;+ 0 |
.rec BOX 30,23,7,10 ;+16 |
.dragm db 0 ;+32 ¢ë¤¥«¥¨¥ ®â ¬ëè¨ |
dragk db 0 ;+33 ¢ë¤¥«¥¨¥ ®â ª« ¢¨ âãàë |
sel TexSelect 0,0,0,0 ;+34 áâàãªâãà ¢ë¤¥«¥¨ï |
seln TexSelect ;+50 ¤®¯®«¨â¥«ì ï áâàãªâãà ¢ë¤¥«¥¨ï |
.drag_m db 0 ;+32 ¢ë¤¥«¥¨¥ ®â ¬ëè¨ |
.drag_k db 0 ;+33 ¢ë¤¥«¥¨¥ ®â ª« ¢¨ âãàë |
.sel TexSelect 0,0,0,0 ;+34 áâàãªâãà ¢ë¤¥«¥¨ï |
.seln TexSelect ;+50 ¤®¯®«¨â¥«ì ï áâàãªâãà ¢ë¤¥«¥¨ï |
.tex dd 0 ;+66 text memory pointer |
.tex_1 dd 0 ;+70 text first symbol pointer |
.tex_end dd 0 ;+74 text end memory pointer |
.cur_x dd 0 ;+78 |
.cur_y dd 0 ;+82 |
.cur_ins db 1 ;+86 |
.mode_color db 1 ;+87 ०¨¬ ¢ë¤¥«¥¨ï á«®¢ 梥⮬ (0-¢ëª«. 1-¢ª«.) |
.mode_invis db 0 ;+88 ०¨¬ ¯®ª § ¥¯¥ç â ¥¬ëå ᨬ¢®«®¢ |
.gp_opt db 0 ;+89 ®¯æ¨¨ ¢®§¢à é ¥¬ë¥ äãªæ¨¥© GetPos |
; \/ ¥ à §àë¢ âì á«¥¤ãî騥 ¯¥à¥¬¥ë¥: |
.count_colors_text dd 1 ;+90 ª®««¨ç¥á⢮ 梥⮢ ⥪áâ |
.count_key_words dd 0 ;+94 ª®««¨ç¥á⢮ ª«î祢ëå á«®¢ |
.color_cursor dd 0x808080 ;+98 梥⠪ãàá®à |
.color_wnd_capt dd 0x80 ;+102 梥⠯®«¥© ¢®ªà㣠®ª |
.color_wnd_work dd 0x0 ;+106 梥â ä® ®ª |
.color_wnd_bord dd 0xd0d0d0 ;+110 梥â ⥪áâ ¯®«ïå |
.color_select dd 0x208080 ;+114 梥⠢뤥«¥¨ï |
.color_cur_text dd 0xff0000 ;+118 梥â ᨬ¢®« ¯®¤ ªãàá®à®¬ |
.color_wnd_text dd 0xffff00 ;+122 梥â ⥪áâ ¢ ®ª¥ |
; /\ ¤à㣨¥, ¨¤ã騥 ¨¦¥ ¬®¦® à §àë¢ âì. |
.syntax_file dd 0 ;+126 㪠§ ⥫ì ç «® ä ©« á¨â ªá¨á |
.syntax_file_end dd 0 ;+130 㪠§ â¥«ì ª®¥æ ä ©« á¨â ªá¨á |
.text_colors dd 0 ;+134 㪠§ â¥«ì ¬ áᨢ 梥⮢ ⥪áâ |
.help_text_f1 dd 0 ;+138 㪠§ ⥫ì ⥪áâ á¯à ¢ª¨ (¯® ¦ ⨨ F1) |
.help_id dd -1 ;+142 ¨¤¥â¨ä¨ª â®à ¤«ï á¯à ¢ª¨ |
.key_words_data dd 0 ;+146 㪠§ ⥫ì áâàãªâãàë ª«î祢ëå á«®¢ TexColViv |
.tim_ch dd ? ;+150 ª®«¨ç¥á⢮ ¨§¬¥¥¨© ¢ ä ©«¥ |
.tim_undo dd ? ;+154 ª®«¨ç¥á⢮ ®â¬¥¥ëå ¤¥©á⢨© |
.tim_ls dd ? ;+158 ¢à¥¬ï ¯®á«¥¤¥£® á®åà ¥¨ï |
.tim_co dd ? ;+162 ¢à¥¬ï ¯®á«¥¤¥© 梥⮢®© à §¬¥âª¨ |
.el_focus dd el_focus ;+166 㪠§ â¥«ì ¯¥à¥¬¥ãî í«¥¬¥â ¢ 䮪ãᥠ|
.err_save dw 0 ;+170 ®è¨¡ª á®åà ¥¨ï ä ©« |
.key_new db 0 ;+172 ᨬ¢®«, ª®â®àë© ¡ã¤¥â ¤®¡ ¢«ïâáï á ª« ¢¨ âãàë |
.symbol_new_line db 20 ;+173 ᨬ¢®« § ¢¥à襨ï áâப¨ |
.scr_w dd wScr ;+174 ¢¥à⨪ «ìë© áªà®««¨£ |
.scr_h dd hScr ;+178 £®à¨§®â «ìë© áªà®««¨£ |
.panel_id db 0 ;+182 ®¬¥à ®âªàë⮩ ¯ ¥«¨ |
;------------------------------------------------------------------------------ |
FkPos: rd 256 |
conv_tabl rb 128 ; â ¡«¨æ ¤«ï ª®¢¥àâ¨à®¢ ¨ï scan-ª®¤ ¢ ascii-ª®¤ |
el_focus dd 0 |
mouse_dd dd 0 |
tree1 tree_list 264,count_of_dir_list_files+2, tl_key_no_edit+tl_draw_par_line+tl_list_box_mode,\ |
392,8 → 491,7 |
db '⬥ ',0 |
db 0 |
msgbox_5_funct: |
; dd but_SaveFile |
dd On_OpenFile |
dd but_no_msg_OpenFile |
dd 0 |
msgbox_6: |
497,8 → 595,7 |
db 'Cancel',0 |
db 0 |
msgbox_5_funct: |
; dd but_SaveFile |
dd On_OpenFile |
dd but_no_msg_OpenFile |
dd 0 |
msgbox_6: |
/programs/other/t_edit/t_draw.inc |
---|
1,3 → 1,4 |
align 4 |
proc mouse_wnd_main, edit:dword |
push eax ebx ecx edi |
mcall 37,2 ;get mouse buttons |
49,6 → 50,7 |
; edi -> óêàçàòåëü íà ñòðóêòóðó tedit |
;description: |
; ôóíêöèÿ âûçûâåòñÿ ïðè íàæàòèè êíîïêîé ìûøè è ïîïàäåíèè êóðñîðîì â îêíî ðåäàêòîðà |
align 4 |
wnd_main_click: |
push ecx edx |
67,7 → 69,7 |
mov eax,[hScr.cur_area] |
@@: |
;dec eax |
mov [cur_x],eax |
mov ted_cur_x,eax |
pop eax |
push eax |
84,20 → 86,21 |
mov eax,[wScr.cur_area] |
@@: |
dec eax |
mov [cur_y],eax |
mov ted_cur_y,eax |
pop eax |
cmp ted_drag_m,0 |
je @f |
call SelMove |
stdcall SelMove,edi |
jmp .sel_move |
@@: |
mov ted_drag_m,1 |
call SelStart |
stdcall SelStart,edi |
.sel_move: |
pop edx ecx |
ret |
align 4 |
wnd_main_mouse_scroll: |
push eax ebx |
mcall 37,7 |
122,9 → 125,11 |
pop ebx eax |
ret |
draw_but_toolbar: |
align 4 |
draw_but_toolbar: ;âíåøíÿÿ ôóíêöèÿ äëÿ ðèñîâàíèÿ ïàíåëè èíñòðóìåíòîâ |
push ebx ecx edx edi |
mov edi,tedit0 |
push ebx ecx edx |
mov ecx,0x40000000 |
; mov edx,5*65536+25 |
mov edx,85*65536+2 |
135,7 → 140,7 |
mov edx,110*65536+2 |
call draw_but_icon |
call CanSave |
stdcall ted_can_save,edi |
cmp al,1 |
je @f |
and ecx,0xffff |
150,7 → 155,7 |
mov edx,85*65536+25 |
call draw_but_icon |
stdcall IsSel, tedit0 |
stdcall IsSel,edi |
cmp al,0 |
jne @f |
and ecx,0xffff |
197,8 → 202,8 |
mov edx,235*65536+25 |
call draw_but_icon |
mov ebx,[tim_Undo] |
cmp [ch_tim],ebx |
mov ebx,ted_tim_undo |
cmp ted_tim_ch,ebx |
jg @f |
and ecx,0xffff |
@@: |
207,7 → 212,7 |
call draw_but_icon |
or ecx,0x40000000 |
cmp [tim_Undo],1 |
cmp ted_tim_undo,1 |
jge @f |
and ecx,0xffff |
@@: |
228,11 → 233,12 |
mov edx,450*65536+25 |
call draw_but_icon |
pop edx ecx ebx |
pop edi edx ecx ebx |
ret |
;input: |
; clear_o - åñëè =1 î÷èñòèòü îäíó ñòðîêó, =0 î÷èñòèòü âñå ñòðîêè îêíà äî íèçó |
align 4 |
proc clear_line_before_draw, edit:dword, coords:dword, clear_o:dword, numb_lin:dword |
pushad |
mov edi,dword[edit] |
265,7 → 271,7 |
sub ebx,ted_rec_l |
xor cx,cx |
add ecx,ted_rec_h |
mov edx,[WND_WORK_COLOR] |
mov edx,ted_color_wnd_work |
cmp dword[clear_o],0 |
je .pusto |
278,11 → 284,11 |
stdcall IsSel,edi |
cmp al,0 |
je @f |
cmp [seln.y0],esi |
cmp ted_seln_y0,esi |
jg @f |
cmp [seln.y1],esi |
cmp ted_seln_y1,esi |
jl @f |
mov edx,[SELECT_COLOR] ;draw selected line |
mov edx,ted_color_select ;draw selected line |
@@: |
mov eax,13 ;rect |
295,10 → 301,10 |
mov al,13 ;rect |
xor cx,cx |
add ecx,ted_rec_h |
cmp [seln.y0],esi |
cmp ted_seln_y0,esi |
jne @f |
push bx |
mov edx,[seln.x0] ; âåðõíÿÿ ïîëîñà (çàòèðàåò ñëåâà) |
mov edx,ted_seln_x0 ; âåðõíÿÿ ïîëîñà (çàòèðàåò ñëåâà) |
cmp edx,[hScr.position] |
jle .in_wnd |
sub edx,[hScr.position] |
308,13 → 314,13 |
.in_wnd: |
mov bx,0 |
.no_wnd: |
mov edx,[WND_WORK_COLOR] |
mov edx,ted_color_wnd_work |
int 0x40 |
pop bx |
@@: |
cmp [seln.y1],esi |
cmp ted_seln_y1,esi |
jne @f |
mov edx,[seln.x1] ; íèæíÿÿ ïîëîñà (çàòèðàåò ñïðàâà) |
mov edx,ted_seln_x1 ; íèæíÿÿ ïîëîñà (çàòèðàåò ñïðàâà) |
cmp edx,[hScr.position] |
jle .in_wnd2 |
sub edx,[hScr.position] |
324,7 → 330,7 |
add ebx,edx |
.in_wnd2: |
mov edx,[WND_WORK_COLOR] |
mov edx,ted_color_wnd_work |
int 0x40 |
@@: |
333,7 → 339,7 |
ret |
endp |
align 4 |
proc draw_main_win, edit:dword |
locals |
line_num dd ? |
342,9 → 348,8 |
mov edi,dword[edit] |
mov eax,4 ;draw text |
mov ecx,[tex_colors] |
push dword[ecx] |
pop ecx |
mov ecx,ted_text_colors |
mov ecx,dword[ecx] |
mov ebx,ted_wnd_l |
add ebx,ted_rec_l |
353,11 → 358,11 |
add ebx,ted_rec_t |
add ebx,0x10001 ;äîáàâëÿåì îòñòóïû äëÿ âûðàâíèâàíèÿ áóêâû ïî öåíòðó |
call SelNormalize ;need before draw select |
stdcall SelNormalize,edi ;need before draw select |
mov esi,[wScr.position] |
mov dword[line_num],esi |
stdcall clear_line_before_draw, tedit0,ebx,1,esi |
stdcall clear_line_before_draw, edi,ebx,1,esi |
call GetFirstVisiblePos |
cmp edx,0 |
je .no_draw_text |
364,11 → 369,11 |
mov esi,1 ;äëèííà âûâîäèìîãî òåêñòà ïî 1-ìó ñèìâîëó |
@@: |
call IteratNext |
cmp edx,[tex_1] |
cmp edx,ted_tex_1 |
jle .no_draw_text |
; *** öâåòîâàÿ ðàçìåòêà |
cmp byte[mode_colored],0 |
cmp ted_mode_color,0 |
je .no_col_change |
cmp byte[edx+1],0 |
je .no_col_change |
377,10 → 382,11 |
cmp byte [edx],13 |
jne .no_13 |
cmp [invis],1 |
cmp ted_mode_invis,1 |
jne .no_invis |
push edx |
mov edx,symbol_new_line |
mov edx,edi |
add edx,ted_offs_symbol_new_line |
int 0x40 |
pop edx |
.no_invis: |
399,7 → 405,7 |
inc ebx |
ror ebx,16 |
inc dword[line_num] ;increment line number |
stdcall clear_line_before_draw, tedit0,ebx,1,dword[line_num] |
stdcall clear_line_before_draw,edi,ebx,1,dword[line_num] |
call OptDrawLineLeft |
jmp @b |
.no_13: |
418,9 → 424,9 |
jmp @b |
.no_draw_text: |
stdcall clear_line_before_draw, tedit0,ebx,0,dword[line_num] |
stdcall draw_line_numbers, tedit0 |
stdcall draw_main_cursor, tedit0 |
stdcall clear_line_before_draw,edi,ebx,0,dword[line_num] |
stdcall draw_line_numbers,edi |
stdcall draw_main_cursor,edi |
;--------------------------------------------- |
; set all_redraw flag for draw all ScrollBar |
472,11 → 478,12 |
;txtBDn db 25 |
;txtBRi db 26 |
;txtBLe db 27 |
align 4 |
proc draw_panel_find, edit:dword |
push edi |
mov edi,dword[edit] |
cmp byte[panel_id],TE_PANEL_FIND ;if not panel |
cmp ted_panel_id,TE_PANEL_FIND ;if not panel |
jne @f |
push eax ebx ecx edx |
496,8 → 503,7 |
mov edx,txtFindCapt |
int 0x40 |
push dword edit2 |
call [edit_box_draw] |
stdcall [edit_box_draw], dword edit2 |
mov eax,13 ;ðèñîâàíèå ïðÿìîóãîëüíèêà |
mov ebx,TE_PANEL_WIDTH |
542,11 → 548,13 |
ret |
endp |
align 4 |
proc draw_panel_syntax, edit:dword |
push edi |
mov edi,dword[edit] |
cmp byte[panel_id],TE_PANEL_SYNTAX ;if not panel |
cmp ted_panel_id,TE_PANEL_SYNTAX ;if not panel |
jne @f |
push eax ebx ecx edx |
558,7 → 566,7 |
mov edx,[sc.work] |
int 0x40 ;ðèñîâàíèå âåðõíåãî ôîíîâîãî ïðÿìîóãîëüíèêà |
stdcall dword[tl_draw], dword tree1 |
stdcall dword[tl_draw], tree1 |
mov [ws_dir_lbox.all_redraw],1 ;äëÿ ïîëíîé ïåðåðèñîâêè äî÷åðíåãî ñêðîëëèíãà |
stdcall dword[scrollbar_ver_draw], dword ws_dir_lbox |
613,6 → 621,8 |
ret |
endp |
align 4 |
proc draw_cur_line, edit:dword |
pushad |
mov edi,dword[edit] |
620,7 → 630,7 |
mov ebx,ted_wnd_l |
add ebx,ted_rec_l |
shl ebx,16 |
mov eax,[cur_y] |
mov eax,ted_cur_y |
imul eax,ted_rec_h |
mov bx,ax |
add ebx,ted_wnd_t |
627,8 → 637,8 |
add ebx,ted_rec_t ;ebx - êîîðäèíàòû äëÿ ïðÿìîóãîëüíèêà î÷èñòêè ëèíèè |
add ebx,0x10001 ;äîáàâëÿåì îòñòóïû äëÿ âûðàâíèâàíèÿ áóêâû ïî öåíòðó |
call SelNormalize ;need before draw select |
mov ecx,[cur_y] |
stdcall SelNormalize,edi ;need before draw select |
mov ecx,ted_cur_y |
add ecx,[wScr.position] |
stdcall clear_line_before_draw, tedit0, ebx,1,ecx |
635,7 → 645,7 |
mov esi,[hScr.position] |
call GetPosByParam |
cmp [gpOpt],2 |
cmp ted_gp_opt,2 |
jne .no_draw_text |
; mov eax,4 ;draw text |
call GetSymbColor |
642,11 → 652,11 |
mov esi,1 ;draw 1 symbol |
@@: |
;call IteratNext |
cmp edx,[tex_1] |
cmp edx,ted_tex_1 |
jle .no_draw_text |
; *** öâåòîâàÿ ðàçìåòêà |
cmp byte[mode_colored],0 |
cmp ted_mode_color,0 |
je .no_col_change |
cmp byte[edx+1],0 |
je .no_col_change |
656,10 → 666,11 |
mov eax,4 ;draw text |
cmp byte [edx],13 |
jne .no_13 |
cmp [invis],1 |
cmp ted_mode_invis,1 |
jne .no_draw_text |
push edx |
mov edx,symbol_new_line |
mov edx,edi |
add edx,ted_offs_symbol_new_line |
int 0x40 |
pop edx |
jmp .no_draw_text |
677,7 → 688,7 |
jmp @b |
.no_draw_text: |
stdcall draw_main_cursor, tedit0 |
stdcall draw_main_cursor,edi |
popad |
ret |
endp |
685,6 → 696,7 |
MIN_M_WND_H equ 100 |
MIN_W_SCRL_ARE equ 3 |
MIN_H_SCRL_ARE equ 3 |
align 4 |
proc EvSize, edit:dword |
push eax ecx edx edi |
mov edi,dword[edit] |
759,23 → 771,28 |
ret |
endp |
align 4 |
OnInitialUpdate: |
mov [wScr.redraw],1 |
mov [hScr.redraw],1 |
ret |
;input: |
; edi = pointer to tedit struct |
;output: |
; ecx = íîâûé öâåò ñèìâîëà |
; edx = pointer to symbol |
; edx = 0 if text not in screen |
align 4 |
GetFirstVisiblePos: |
push ecx |
mov edx,[tex] |
mov edx,ted_tex |
xor ecx,ecx |
@@: |
cmp ecx,[wScr.position] |
je @f |
call IteratNext |
cmp edx,[tex_1] |
cmp edx,ted_tex_1 |
jle @f |
cmp byte [edx],13 |
jne @b |
799,23 → 816,27 |
;input: |
; edx = pointer to symbol |
; edi = pointer to tedit struct |
;output: |
; edx = pointer to first left symbol |
OptDrawLineLeft: |
push ecx |
mov ecx,[hScr.position] |
cmp ecx,0 |
; ecx = íîâûé öâåò ñèìâîëà |
; edx = óêàçàòåëü íà ïåðâûé ëåâûé ñèìâîë |
align 4 |
proc OptDrawLineLeft |
push ebx |
mov ebx,[hScr.position] |
cmp ebx,0 |
je .ret_f |
push eax |
mov eax,edx |
cmp edx,[tex] |
cmp edx,ted_tex |
jne @f |
call IteratNext |
jmp .beg_cycle |
@@: |
cmp ecx,0 |
cmp ebx,0 |
je @f |
cmp byte[edx],13 |
823,33 → 844,50 |
call IteratNext |
.beg_cycle: |
@@: |
cmp edx,[tex_1] |
cmp edx,ted_tex_1 |
jle @f |
cmp byte[edx],13 |
je @f |
cmp ecx,0 |
cmp ebx,0 |
je @f |
;-------------------------------------- |
xor eax,eax ;eax áóäåò ìåíÿòüñÿ |
mov al,byte[edx+1] |
cmp al,0 |
je .no_color |
cmp eax,ted_colors_text_count |
jge .no_color |
xor ecx,ecx |
mov cl,byte[edx+1] |
shl cx,2 |
add ecx,ted_text_colors |
mov ecx,dword[ecx] |
.no_color: |
;-------------------------------------- |
mov eax,edx |
call IteratNext |
dec ecx |
dec ebx |
jmp @b |
@@: |
mov edx,eax |
pop eax |
.ret_f: |
pop ecx |
call GetSymbColor |
pop ebx |
ret |
endp |
;input: |
; edx = pointer to symbol |
; edi = pointer to tedit struct |
;output: |
; edx = pointer to 13 symbol |
OptDrawLineRight: |
align 4 |
proc OptDrawLineRight |
push eax |
mov eax,edx |
@@: |
cmp edx,[tex_1] |
cmp edx,ted_tex_1 |
jle @f |
cmp byte[edx],13 |
je @f |
858,10 → 896,13 |
jmp @b |
@@: |
mov edx,eax ;perv sumbol |
call GetSymbColor |
pop eax |
call GetSymbColor |
ret |
endp |
align 4 |
proc draw_main_cursor, edit:dword |
pushad |
mov edi,dword[edit] |
869,11 → 910,11 |
mov eax,13 ;draw cursor |
mov ecx,ted_wnd_t ;calc rect -> y0,y1 |
add ecx,ted_rec_t |
mov edx,[cur_y] |
mov edx,ted_cur_y |
imul edx,ted_rec_h |
add ecx,edx |
cmp [curMod],1 ;ïðîâåðêà ðåæèìà ðàáîòû êóðñîðà (îáû÷íûé èëè âñòàâêà) |
cmp ted_cur_ins,1 ;ïðîâåðêà ðåæèìà ðàáîòû êóðñîðà (îáû÷íûé èëè âñòàâêà) |
jne @f |
mov edx,ted_rec_h |
inc edx ;1->1, 3->2, 5->3, ... |
882,7 → 923,7 |
@@: |
shl ecx,16 |
add ecx,ted_rec_h |
cmp [curMod],1 |
cmp ted_cur_ins,1 |
jne @f |
shr cx,1 ;äåëèì âûñîòó êóðñîðà íà 2 |
@@: |
889,17 → 930,17 |
mov ebx,ted_wnd_l ;calc rect -> x0,x1 |
add ebx,ted_rec_l |
mov edx,[cur_x] |
mov edx,ted_cur_x |
imul edx,ted_rec_w |
add ebx,edx |
shl ebx,16 |
add ebx,ted_rec_w |
mov edx,[CURSOR_COLOR] |
mov edx,ted_color_cursor |
int 0x40 ;âûâîä êóðñîðà |
call GetPos |
cmp [gpOpt],2 |
cmp ted_gp_opt,2 |
jne @f |
mov eax,4 ;draw text |
mov esi,1 |
906,7 → 947,7 |
ror ecx,16 |
mov bx,cx |
add ebx,0x10001 |
cmp [curMod],1 |
cmp ted_cur_ins,1 |
jne .no_up_tetx |
mov ecx,ted_rec_h |
inc cx ; 1->1, 3->2, 5->3, ... |
913,7 → 954,7 |
shr cx,1 |
sub bx,cx |
.no_up_tetx: |
mov ecx,[CUR_TEXT_COLOR] |
mov ecx,ted_color_cur_text |
call ConvertInvisSymb |
int 0x40 |
@@: |
924,7 → 965,7 |
shl ebx,16 |
add ebx,ted_wnd_t |
add ebx,3 |
mov ecx,[WND_BORD_COLOR] |
mov ecx,ted_color_wnd_bord |
or ecx,0x80000000 |
mov edx,txtRow |
int 0x40 ;âûâîä ïîäïèñè 'Ñòðîêà' |
933,7 → 974,7 |
mov edx,txtCol |
int 0x40 ;âûâîä ïîäïèñè 'Çíàê' |
cmp [tim_Undo],0 |
cmp ted_tim_undo,0 |
je @f |
add ebx,0x500000 |
mov edx,txtOtm |
942,10 → 983,10 |
@@: |
stdcall draw_bufer, edi |
stdcall draw_help_f1, edi |
stdcall draw_help_f1 |
mov eax,47 ;draw cursor coords |
mov esi,[WND_BORD_COLOR] |
mov esi,ted_color_wnd_bord |
or esi,0x40000000 |
mov edx,ebx |
954,23 → 995,28 |
ror edx,16 |
;add edx,3 |
mov ebx,0x40000 ;Row=... |
mov ecx,[cur_y] |
mov ecx,ted_cur_y |
inc ecx |
add ecx,[wScr.position] |
; edi <> tedit ---------------------------------------------------------------- |
mov edi,[WND_WORK_COLOR] |
int 0x40 |
push edi |
mov edi,ted_color_wnd_work |
int 0x40 ;âûâîä ÷èñëà òåêóùåé ñòðîêè |
pop edi |
;mov ebx,0x40000 ;Col=... |
mov ecx,[cur_x] |
mov ecx,ted_cur_x |
inc ecx |
add ecx,[hScr.position] |
add edx,0x500000 |
int 0x40 |
push edi |
mov edi,ted_color_wnd_work |
int 0x40 ;âûâîä ÷èñëà çíàêîâ |
pop edi |
cmp [tim_Undo],0 |
cmp ted_tim_undo,0 |
je @f |
mov ecx,[tim_Undo] |
mov ecx,ted_tim_undo |
add edx,0x500000 |
int 0x40 |
@@: |
979,6 → 1025,7 |
ret |
endp |
align 4 |
proc draw_bufer, edit:dword |
pushad |
mov edi,dword[edit] |
991,9 → 1038,9 |
shl ebx,16 |
add ebx,ted_wnd_t |
add ebx,3 |
mov ecx,[WND_BORD_COLOR] |
mov ecx,ted_color_wnd_bord |
or ecx,0x40000000 |
mov edi,[WND_WORK_COLOR] |
mov edi,ted_color_wnd_work |
mov edx,txtBuf |
mov esi,buf |
1020,9 → 1067,11 |
ret |
endp |
proc draw_help_f1, edit:dword |
;input: |
; edi = pointer to tedit struct |
align 4 |
proc draw_help_f1 |
pushad |
mov edi,dword[edit] |
mov eax,13 ;clear place before draw help |
mov ebx,ted_wnd_l |
1034,12 → 1083,12 |
add ecx,13 |
shl ecx,16 |
add ecx,ted_rec_h |
mov edx,[WND_CAPT_COLOR] |
mov edx,ted_color_wnd_capt |
int 0x40 |
cmp [help_id],-1 |
cmp ted_help_id,-1 |
je @f |
mov eax,[help_id] |
mov eax,ted_help_id |
ColToIndexOffset eax,edx |
;SetCoordinates |
1053,24 → 1102,23 |
xor eax,eax |
mov al,byte[edx+MAX_COLOR_WORD_LEN+6] |
shl ax,2 |
mov ecx,[tex_colors] |
mov ecx,ted_text_colors |
add ecx,eax |
push dword[ecx] |
pop ecx |
mov ecx,dword[ecx] |
or ecx,0xc0000000 ;SetTextStyles |
mov edi,[WND_WORK_COLOR] |
; edi <> edit ----------------------------------------------------------------- |
mov esi,edi |
mov edi,ted_color_wnd_work |
mov eax,4 |
int 0x40 |
mov edi,esi |
;*** draw help string *** |
mov ecx,[WND_BORD_COLOR] |
mov ecx,ted_color_wnd_bord |
or ecx,0x80000000 |
mov edi,dword[edx+MAX_COLOR_WORD_LEN] |
cmp edi,0 |
mov edx,dword[edx+MAX_COLOR_WORD_LEN] |
cmp edx,0 |
je @f |
add edi,dword[tex_help_f1] |
mov edx,edi |
add edx,ted_help_text_f1 |
add ebx,0x500000 |
int 0x40 |
@@: |
1078,6 → 1126,7 |
ret |
endp |
align 4 |
proc draw_line_numbers, edit:dword |
pushad |
mov edi,dword[edit] |
1088,12 → 1137,12 |
shl ebx,16 |
add ebx,ted_wnd_w |
; sub ebx,ted_rec_l |
mov edx,[WND_WORK_COLOR] |
mov edx,ted_color_wnd_work |
mov ecx,ted_wnd_t |
shl ecx,16 |
add ecx,ted_rec_t |
mov eax,13 |
mov edx,[WND_CAPT_COLOR] |
mov edx,ted_color_wnd_capt |
int 0x40 |
;line numbers |
1117,12 → 1166,12 |
mov cx,dx |
rol ecx,16 |
mov eax,13 |
mov edx,[WND_CAPT_COLOR] |
mov edx,ted_color_wnd_capt |
int 0x40 ;ðèñóåì ïðÿìîóãîëüíèê ïîä íîìåðîì ñòðîêè |
pop edx ecx ebx |
mov eax,47 |
mov esi,[WND_BORD_COLOR] |
mov esi,ted_color_wnd_bord |
int 0x40 ;ðèñóåì íîìåð ñòðîêè |
inc ecx |
add edx,ted_rec_h |
1140,6 → 1189,7 |
endp |
;this function need to optimize output |
align 4 |
proc draw_cursor_sumb, edit:dword |
push eax ecx edx edi |
mov edi,dword[edit] |
1147,7 → 1197,7 |
mov eax,13 ;rect |
mov ebx,ted_wnd_l |
add ebx,ted_rec_l |
mov edx,[cur_x] |
mov edx,ted_cur_x |
imul edx,ted_rec_w |
add ebx,edx |
shl ebx,16 |
1155,44 → 1205,44 |
mov ecx,ted_wnd_t ;calc rect -> y0,y1 |
add ecx,ted_rec_t |
mov edx,[cur_y] |
mov edx,ted_cur_y |
imul edx,ted_rec_h |
add ecx,edx |
shl ecx,16 |
add ecx,ted_rec_h |
mov edx,[WND_WORK_COLOR] |
mov edx,ted_color_wnd_work |
push ecx |
call SelNormalize |
stdcall SelNormalize,edi |
mov ecx,[wScr.position] |
sub [seln.y0],ecx |
sub [seln.y1],ecx |
sub ted_seln_y0,ecx |
sub ted_seln_y1,ecx |
mov ecx,[cur_y] |
cmp ecx,[seln.y0] |
mov ecx,ted_cur_y |
cmp ecx,ted_seln_y0 |
jl .no_cur_sel |
cmp ecx,[seln.y1] |
cmp ecx,ted_seln_y1 |
jg .no_cur_sel |
mov edx,[SELECT_COLOR] |
mov edx,ted_color_select |
cmp ecx,[seln.y0] |
cmp ecx,ted_seln_y0 |
jne @f |
mov ecx,[cur_x] |
mov ecx,ted_cur_x |
add ecx,[hScr.position] |
cmp ecx,[seln.x0] |
cmp ecx,ted_seln_x0 |
jge @f |
mov edx,[WND_WORK_COLOR] |
mov edx,ted_color_wnd_work |
@@: |
mov ecx,[cur_y] |
cmp ecx,[seln.y1] |
mov ecx,ted_cur_y |
cmp ecx,ted_seln_y1 |
jne .no_cur_sel |
mov ecx,[cur_x] |
mov ecx,ted_cur_x |
add ecx,[hScr.position] |
cmp ecx,[seln.x1] |
cmp ecx,ted_seln_x1 |
jl .no_cur_sel |
mov edx,[WND_WORK_COLOR] |
mov edx,ted_color_wnd_work |
.no_cur_sel: |
pop ecx |
1199,7 → 1249,7 |
int 0x40 |
call GetPos |
cmp [gpOpt],2 |
cmp ted_gp_opt,2 |
jne @f |
push esi |
mov eax,4 ;draw text |
1207,7 → 1257,6 |
ror ecx,16 |
mov bx,cx |
add ebx,0x10001 |
;mov ecx,[WND_TEXT_COLOR] |
call GetSymbColor |
call ConvertInvisSymb |
int 0x40 |
1220,37 → 1269,36 |
;input: |
; edx = pointer to text |
; edx -> pointer to text |
; edi -> óêàçàòåëü íà ñòðóêòóðó tedit |
;output: |
; ecx = color |
; if mode_colored=0 then ecx=WND_TEXT_COLOR |
; if ted_mode_color=0 then ecx=ted_color_wnd_text |
align 4 |
GetSymbColor: |
mov ecx,[WND_TEXT_COLOR] |
mov ecx,ted_color_wnd_text ;çàäàåì öâåò òåêñòà ïî óìîë÷àíèþ |
push eax edx |
cmp byte[mode_colored],0 |
cmp ted_mode_color,0 |
je .exit |
jmp .on_first |
@@: |
call IteratPerv |
cmp edx,[tex_1] |
cmp edx,ted_tex_1 |
jle .exit |
.on_first: |
xor eax,eax |
mov al,byte[edx+1] |
cmp al,0 |
cmp al,0 ;åñëè al=0 òî öâåò íå ìåíÿåòñÿ |
je @b |
;cmp al,0xff |
;je .exit |
cmp eax,[ColColor] |
cmp eax,ted_colors_text_count |
jge .exit |
shl ax,2 ;*4 |
mov ecx,[tex_colors] |
shl ax,2 ;óìíîæàåì èíäåêñ öâåòà íà 4 áàéòà |
mov ecx,ted_text_colors ;ïðèáàâëÿåì ñìåùåíèå 1-ãî öâåòà |
add ecx,eax |
push dword[ecx] |
pop ecx |
mov ecx,dword[ecx] ;óñòàíàâëèâàåì òåêóùèé öâåò òåêñòà ïî ñìåùåíèþ |
.exit: |
pop edx eax |
ret |
1257,12 → 1305,15 |
;input: |
; edx = pointer to text |
; edi = pointer to tedit struct |
align 4 |
ConvertInvisSymb: |
cmp [invis],1 |
cmp ted_mode_invis,1 |
jne @f |
cmp byte [edx],13 |
jne @f |
mov edx,symbol_new_line |
mov edx,edi |
add edx,ted_offs_symbol_new_line |
@@: |
ret |
1270,6 → 1321,7 |
; ecx = 0x4000____ |
; cx = icon index |
; edx = x*2^16+y |
align 4 |
draw_but_icon: |
push eax ebx |
/programs/other/t_edit/t_edit.asm |
---|
33,12 → 33,9 |
@use_library |
align 4 |
start: |
mov eax,48 |
mov ebx,3 |
mov ecx,sc |
mov edx,sizeof.system_colors |
mcall |
mcall 48,3,sc,sizeof.system_colors |
m2m [wScr.bckg_col],[sc.work] |
m2m [wScr.frnt_col],[sc.work_button] |
55,40 → 52,38 |
mcall 66,1,1 ;scan code |
;mcall 26,2,1,conv_tabl |
mcall 40,0x27 |
mov ecx,sizeof.symbol*maxChars |
call mem_Alloc |
mov [tex],eax |
mov [tex_1],eax |
add [tex_1],sizeof.symbol |
mov [tex_end],eax |
add [tex_end],sizeof.symbol*maxChars |
mov esi,file_name |
call strlen |
mov ecx,eax |
mov edi,buf_cmd_lin |
rep movsb ;ª®¯¨à㥬 ¨¬ï ä ©« ¢ ¡ãä¥à edit1 |
mcall 40,0x27 |
load_libraries l_libs_start,load_lib_end |
call Clear |
;¯à®¢¥àª ᪮«ìª® ã¤ ç® § £ã§¨« áì è «¨¡ |
mov ebp,lib0 |
cmp dword [ebp+ll_struc_size-4],0 |
jz @f |
mcall -1 ;exit not correct |
@@: |
mov ebp,lib1 ; |
cmp dword [ebp+ll_struc_size-4],0 |
jz @f |
mcall -1 ;exit not correct |
@@: |
;------------------------------------------------- |
mov ecx,maxColWords*sizeof.TexColViv+40 |
;add ecx,40 |
call mem_Alloc |
mov [options_file],eax |
mov [options_file_end],eax |
add [options_file_end],maxColWords*sizeof.TexColViv |
add [options_file_end],40 |
;--------------------------------------------------------------------- |
stdcall ted_init, tedit0 |
stdcall dword[tl_data_init], tree1 |
;--------------------------------------------------------------------- |
;------------------------------------------------- |
; init bmp file |
mov ecx,1200*18 |
call mem_Alloc |
mov [bmp_icon],eax |
mov esi,file_name |
call strlen |
mov ecx,eax |
mov edi,buf_cmd_lin |
rep movsb |
copy_path fn_icon,sys_path,file_name,0x0 |
mov eax,70 ;load icon file |
108,25 → 103,7 |
mov [err_ini0],0 |
@@: |
load_libraries l_libs_start,load_lib_end |
;¯à®¢¥àª ᪮«ìª® ã¤ ç® § £ã§¨« áì è «¨¡ |
mov ebp,lib0 |
cmp dword [ebp+ll_struc_size-4],0 |
jz @f |
mcall -1 ;exit not correct |
@@: |
mov ebp,lib1 ; |
cmp dword [ebp+ll_struc_size-4],0 |
jz @f |
mcall -1 ;exit not correct |
@@: |
;--------------------------------------------------------------------- |
push dword tree1 |
call dword[tl_data_init] |
;--------------------------------------------------------------------- |
; ç¨â ¥¬ bmp ä ©« á ªãàá®à ¬¨ ¨ «¨¨ï¬¨ |
copy_path fn_icon_tl_sys,sys_path,file_name,0x0 |
187,26 → 164,17 |
@@: |
cmp byte[eax],'.' ;䨫ìâà㥬 ä ©«ë á ¨¬¥ ¬¨ '.' ¨ '..' |
je .filter |
push dword tree1 |
push dword 0x10000 ;1*2^16 - £¤¥ 1 ®¬¥à ¨ª®ª¨ á ª¨£®© |
push dword eax |
call dword[tl_node_add] |
;0x10000 ;1*2^16 - £¤¥ 1 ®¬¥à ¨ª®ª¨ á ª¨£®© |
stdcall dword[tl_node_add], eax,0x10000, tree1 |
push dword tree1 |
call dword[tl_cur_next] |
stdcall dword[tl_cur_next], tree1 |
.filter: |
add eax,304 |
loop @b |
.end_dir_init: |
; push dword tree1 |
; push dword 0 |
; push dword file_name |
; call dword[tl_node_add] |
;--- load color option file --- |
call InitColText |
stdcall InitColText, tedit0 |
;--- get cmd line --- |
cmp byte[buf_cmd_lin+3],0 ;buf_cmd_lin |
214,10 → 182,10 |
mov esi,buf_cmd_lin |
call strlen ;eax=strlen |
mov [edit1.size],eax |
call but_OpenFile |
call but_no_msg_OpenFile |
@@: |
align 4 |
red_win: |
mcall 12,1 |
271,6 → 239,7 |
mcall 12,2 |
align 4 |
still: |
mov eax,10 |
mcall |
287,7 → 256,7 |
jmp still |
align 4 |
mouse: |
stdcall [edit_box_mouse], dword edit1 |
336,15 → 305,13 |
stdcall mouse_wnd_main, tedit0 |
cmp byte[panel_id],TE_PANEL_FIND ;if not panel |
cmp byte[tedit0.panel_id],TE_PANEL_FIND ;if not panel |
jne @f |
push dword edit2 |
call [edit_box_mouse] |
stdcall [edit_box_mouse], dword edit2 |
@@: |
cmp byte[panel_id],TE_PANEL_SYNTAX ;if not panel |
cmp byte[tedit0.panel_id],TE_PANEL_SYNTAX ;if not panel |
jne .menu_bar_1 ;@f |
push dword tree1 |
call [tl_mouse] |
stdcall [tl_mouse], tree1 |
;----------------------------------------------- |
.menu_bar_1: |
mov [menu_data_1.get_mouse_flag],1 |
357,7 → 324,7 |
je button.exit |
cmp [menu_data_1.cursor_out],dword 3 |
jne @f |
call but_SaveFile |
stdcall but_SaveFile, tedit0 |
@@: |
cmp [menu_data_1.cursor_out],dword 2 |
jne @f |
373,21 → 340,28 |
jmp still |
;--------------------------------------------------------------------- |
KeyConvertToASCII: |
mov ebx,conv_tabl ;convert scan to ascii |
;output: |
; ah = symbol |
align 4 |
proc KeyConvertToASCII, table:dword |
push ebx |
mov ebx,dword[table] ;convert scan to ascii |
ror ax,8 |
xor ah,ah |
add bx,ax |
mov ah,byte[ebx] |
pop ebx |
ret |
endp |
align 4 |
key: |
mcall 66,3 ;66.3 ¯®«ãç¨âì á®áâ®ï¨¥ ã¯à ¢«ïîé¨å ª« ¢¨è |
xor ebx,ebx |
mov ecx,1 |
mcall 66,3 |
xor ebx,ebx |
test al,0x03 ;[Shift] |
jz @f |
inc cl |
mov cl,2 |
or ebx,KM_SHIFT |
@@: |
test al,0x0c ;[Ctrl] |
396,6 → 370,7 |
@@: |
test al,0x30 ;[Alt] |
jz @f |
mov cl,3 |
or ebx,KM_ALT |
@@: |
test al,0x80 ;[NumLock] |
402,14 → 377,10 |
jz @f |
or ebx,KM_NUMLOCK |
@@: |
mcall 26,2,,conv_tabl ;26.2 ¯®«ãç¨âì à ᪫ ¤ªã ª« ¢¨ âãàë |
mcall 2 ;¯®«ãç ¥¬ ª®¤ ¦ ⮩ ª« ¢¨è¨ |
;stdcall [tl_key], tree1 ;??? |
mov [keyUpr],ebx |
mcall 26,2,,conv_tabl |
mcall 2 |
; push dword tree1 ;??? |
; call [tl_key] ;??? |
test word [edit1.flags],10b;ed_focus ; ¥á«¨ ¥ ¢ 䮪ãá¥, ¢ë室¨¬ |
je @f |
cmp ah,0x80 ;if key up |
424,13 → 395,9 |
je still |
cmp ah,69 ;[Pause Break] |
je still |
; cmp [keyUpr],0 |
; jne still |
call KeyConvertToASCII |
push dword edit1 |
call [edit_box_key] |
stdcall KeyConvertToASCII, dword conv_tabl |
stdcall [edit_box_key], dword edit1 |
jmp still |
@@: |
448,283 → 415,15 |
je still |
cmp ah,69 ;[Pause Break] |
je still |
; cmp [keyUpr],0 |
; jne still |
call KeyConvertToASCII |
stdcall KeyConvertToASCII, dword conv_tabl |
stdcall [edit_box_key], dword edit2 |
jmp still |
@@: |
cmp ah,KEY_F1 ;[F1] |
jne @f |
call ShowHelpF1 |
stdcall ted_key, tedit0, conv_tabl |
jmp still |
@@: |
cmp ah,KEY_F3 ;[F3] |
jne @f |
call but_FindText |
jmp still |
@@: |
test [keyUpr],KM_CTRL ;Ctrl+... |
jz .key_Ctrl |
cmp ah,24 ;Ctrl+O |
jne @f |
call but_OpenFile |
@@: |
cmp ah,33 ;Ctrl+F |
jne @f |
cmp byte[panel_id],TE_PANEL_FIND |
je @f |
stdcall but_find, tedit0 |
@@: |
cmp ah,44 ;Ctrl+Z |
je but_undo |
cmp ah,46 ;Ctrl+C |
jne @f |
call but_Copy |
@@: |
cmp ah,47 ;Ctrl+V |
je but_paste |
cmp ah,49 ;Ctrl+N |
jne @f |
call but_NewFile |
@@: |
cmp ah,199 ;Ctrl+Home |
jne @f |
call but_CtrlHome |
@@: |
;jmp still |
.key_Ctrl: |
test [keyUpr],KM_SHIFT ;Shift+... |
jz .key_Shift |
cmp ah,72 ;Shift+Up |
jne @f |
call sel_KeyUp |
@@: |
cmp ah,75 ;Shift+Left |
jne @f |
call sel_KeyLeft |
@@: |
cmp ah,77 ;Shift+Right |
jne @f |
call sel_KeyRight |
@@: |
cmp ah,80 ;Shift+Down |
jne @f |
call sel_KeyDown |
@@: |
;mov [dragk],1 ; ç¨ ¥¬ ¢ë¤¥«¥¨¥ ®â ª« ¢¨ âãàë |
jmp .key_MoveCur |
.key_Shift: |
;------------------------------------------------- |
cmp ah,72 ;178 ;Up |
jne @f |
push dx |
stdcall draw_cursor_sumb, tedit0 |
call CurMoveUp |
cmp dl,8 |
jne .no_red_0 |
call OnInitialUpdate |
stdcall draw_main_win, tedit0 |
pop dx |
jmp @f |
.no_red_0: |
stdcall draw_main_cursor, tedit0 |
pop dx |
mov [dragk],0 ;§ ª 稢 ¥¬ ¢ë¤¥«¥¨¥ ®â ª« ¢¨ âãàë |
@@: |
cmp ah,80 ;177 ;Down |
jne @f |
push dx |
stdcall draw_cursor_sumb, tedit0 |
call CurMoveDown |
cmp dl,8 |
jne .no_red_1 |
call OnInitialUpdate |
stdcall draw_main_win, tedit0 |
pop dx |
jmp @f |
.no_red_1: |
stdcall draw_main_cursor, tedit0 |
pop dx |
mov [dragk],0 ;§ ª 稢 ¥¬ ¢ë¤¥«¥¨¥ ®â ª« ¢¨ âãàë |
@@: |
cmp ah,75 ;176 ;Left |
jne @f |
push dx |
stdcall draw_cursor_sumb, tedit0 |
call CurMoveLeft |
cmp dl,8 |
jne .no_red_2 |
call OnInitialUpdate |
stdcall draw_main_win, tedit0 |
pop dx |
jmp @f |
.no_red_2: |
stdcall draw_main_cursor, tedit0 |
pop dx |
mov [dragk],0 ;§ ª 稢 ¥¬ ¢ë¤¥«¥¨¥ ®â ª« ¢¨ âãàë |
@@: |
cmp ah,77 ;179 ;Right |
jne @f |
push dx |
stdcall draw_cursor_sumb, tedit0 |
call CurMoveRight |
cmp dl,8 |
jne .no_red_3 |
call OnInitialUpdate |
stdcall draw_main_win, tedit0 |
pop dx |
jmp @f |
.no_red_3: |
stdcall draw_main_cursor, tedit0 |
pop dx |
mov [dragk],0 ;§ ª 稢 ¥¬ ¢ë¤¥«¥¨¥ ®â ª« ¢¨ âãàë |
@@: |
cmp ah,71 ;180 ;Home |
jne @f |
push dx |
stdcall draw_cursor_sumb, tedit0 |
call CurMoveX_FirstChar |
cmp dl,8 |
jne .no_red_4 |
call OnInitialUpdate |
stdcall draw_main_win, tedit0 |
pop dx |
jmp @f |
.no_red_4: |
stdcall draw_main_cursor, tedit0 |
pop dx |
mov [dragk],0 ;§ ª 稢 ¥¬ ¢ë¤¥«¥¨¥ ®â ª« ¢¨ âãàë |
@@: |
cmp ah,79 ;181 ;End |
jne @f |
push dx |
stdcall draw_cursor_sumb, tedit0 |
call CurMoveX_LastChar |
cmp dl,8 |
jne .no_red_5 |
call OnInitialUpdate |
stdcall draw_main_win, tedit0 |
pop dx |
jmp @f |
.no_red_5: |
stdcall draw_main_cursor, tedit0 |
pop dx |
mov [dragk],0 ;§ ª 稢 ¥¬ ¢ë¤¥«¥¨¥ ®â ª« ¢¨ âãàë |
@@: |
cmp ah,73 ;184 ;PageUp |
jne @f |
push dx |
call CurMovePageUp |
cmp dl,0 |
pop dx |
je @f |
call OnInitialUpdate |
stdcall draw_main_win, tedit0 |
@@: |
cmp ah,81 ;183 ;PageDown |
jne @f |
push dx |
call CurMovePageDown |
cmp dl,0 |
pop dx |
je @f |
call OnInitialUpdate |
stdcall draw_main_win, tedit0 |
mov [dragk],0 ;§ ª 稢 ¥¬ ¢ë¤¥«¥¨¥ ®â ª« ¢¨ âãàë |
@@: |
;------------------------------------------------- |
cmp [keyUpr],0 |
jne still |
.key_MoveCur: |
cmp ah,69 ;[Pause Break] |
je still |
cmp ah,120 ;[Fn] |
je still |
cmp ah,0x80 ;if key up |
ja still |
call KeyConvertToASCII |
;mov [dragk],0 ;§ ª 稢 ¥¬ ¢ë¤¥«¥¨¥ ®â ª« ¢¨ âãàë |
push ebx |
xor ebx,ebx |
mov bl,ah |
add ebx,EvChar ;add char to text |
cmp byte [ebx],1 |
jne @f |
push esi edi |
call SetUndo |
mov bx,0x0101 |
call SelTextDel |
mov esi,1 |
mov byte [key_new],ah |
mov edi,dword key_new |
cmp [curMod],1 |
je .no_ins_mod |
call TextDel |
xor bl,1 |
.no_ins_mod: |
call TextAdd |
call draw_but_toolbar |
cmp byte [key_new],13 |
jne .dr_m_win |
stdcall draw_main_win, tedit0 |
jmp .dr_cur_l |
.dr_m_win: |
stdcall draw_cur_line, tedit0 |
.dr_cur_l: |
pop edi esi |
@@: |
pop ebx |
cmp ah,8 ;[<-] |
jne @f |
push ax bx |
call SetUndo |
mov bx,0x0001 |
call SelTextDel |
cmp al,1 |
je .del_one_b |
call TextDel |
.del_one_b: |
call draw_but_toolbar |
stdcall draw_main_win, tedit0 |
pop bx ax |
@@: |
cmp ah,182 ;Delete |
jne @f |
push ax bx |
call SetUndo |
mov bx,0x0101 |
call SelTextDel |
cmp al,1 |
je .del_one_d |
call TextDel |
.del_one_d: |
call draw_but_toolbar |
stdcall draw_main_win, tedit0 |
pop bx ax |
@@: |
cmp ah,185 ;Ins |
jne @f |
stdcall draw_cursor_sumb, tedit0 |
xor [curMod],1 |
stdcall draw_main_cursor, tedit0 |
@@: |
jmp still |
button: |
; cmp [menu_active],1 ;¥á«¨ ¦ «¨ ¬¥î, â® á ç « ॠªæ¨ï ¬¥î |
; jne @f ;mouse.menu_bar_1 |
743,40 → 442,64 |
@@: |
cmp ah,5 |
jne @f |
call but_SaveFile |
stdcall but_SaveFile, tedit0 |
@@: |
cmp ah,6 |
jz but_select_word |
jne @f |
stdcall ted_but_select_word, tedit0 |
@@: |
cmp ah,7 |
jz but_cut |
jne @f |
stdcall ted_but_cut, tedit0 |
@@: |
cmp ah,8 |
jne @f |
call but_Copy |
stdcall ted_but_copy, tedit0 |
@@: |
cmp ah,9 |
jz but_paste |
jne @f |
stdcall ted_but_paste, tedit0 |
@@: |
cmp ah,10 |
jne @f |
stdcall but_find, tedit0 |
@@: |
cmp ah,11 |
jz but_replace |
jne @f |
call but_replace |
@@: |
cmp ah,12 |
jz but_find_key_w |
jne @f |
call but_find_key_w |
@@: |
cmp ah,13 |
jz but_sumb_upper |
jne @f |
stdcall but_sumb_upper, tedit0 |
@@: |
cmp ah,14 |
jz but_sumb_lover |
jne @f |
stdcall but_sumb_lover, tedit0 |
@@: |
cmp ah,15 |
jz but_reverse |
jne @f |
stdcall but_reverse, tedit0 |
@@: |
cmp ah,16 |
jz but_undo |
jne @f |
stdcall ted_but_undo, tedit0 |
@@: |
cmp ah,17 |
jz but_redo |
jne @f |
stdcall ted_but_redo, tedit0 |
@@: |
cmp ah,18 |
jz but_sumb_invis |
jne @f |
stdcall but_sumb_invis, tedit0 |
@@: |
cmp ah,19 |
jz but_k_words_show |
jne @f |
stdcall but_k_words_show, tedit0 |
@@: |
cmp ah,20 |
jne @f |
stdcall but_synt_show, tedit0 |
784,33 → 507,27 |
cmp ah,200 |
jne @f |
call but_OpenSyntax |
stdcall ted_but_open_syntax, tedit0 |
@@: |
cmp ah,201 |
jne @f |
call but_FindText |
stdcall but_FindText, tedit0 |
@@: |
cmp ah,1 |
jne still |
.exit: |
;push eax |
call CanSave |
stdcall ted_can_save, tedit0 |
cmp al,1 |
jne @f |
push thread |
push msgbox_8 |
call [mb_create] ;message: save changes in file? |
stdcall [mb_create],msgbox_8,thread ;message: save changes in file? |
jmp still |
@@: |
mov ecx,[tex] |
call mem_Free |
mov ecx,[bmp_icon] |
call mem_Free |
mov ecx,[options_file] |
call mem_Free |
push dword tree1 |
call dword[tl_data_clear] |
stdcall ted_delete, tedit0 |
stdcall dword[tl_data_clear], tree1 |
mcall -1 ;¢ë室 ¨§ ¯à®£à ¬¬ë |
/programs/other/t_edit/t_work.inc |
---|
25,50 → 25,8 |
td dd ? ; +14 âðåì. óäàëåíèÿ |
ends |
ColColor dd 1 |
ColWords dd 0 |
CURSOR_COLOR dd 0x808080 |
WND_CAPT_COLOR dd 0x80 |
WND_WORK_COLOR dd 0x0 |
WND_BORD_COLOR dd 0xd0d0d0 |
SELECT_COLOR dd 0x208080 |
CUR_TEXT_COLOR dd 0xff0000 |
WND_TEXT_COLOR dd 0xffff00 |
options_file dd 0 |
options_file_end dd 0 |
tex_colors dd 0 |
tex_help_f1 dd 0 |
FkPos: rd 256 |
Col dd 0 ;óêàçàòåëü íà ñòðóêòóðû êëþ÷åâûõ ñëîâ TexColViv |
conv_tabl rb 128 ; òàáëèöà äëÿ êîíâåðòèðîâàíèÿ scan-êîäà â ascii-êîä |
keyUpr dd 0 |
err_sav db 0 ;îøèáêà ñîõðàíåíèÿ ôàéëà |
panel_id db 0 ;íîìåð îòêðûòîé ïàíåëè |
ch_tim dd ? ; êîëè÷åñòâî èçìåíåíèé â ôàéëå |
ls_tim dd ? ; âðåìÿ ïîñëåäíåãî ñîõðàíåíèÿ |
co_tim dd ? ; âðåìÿ ïîñëåäíåé öâåòîâîé ðàçìåòêè |
tim_Undo dd ? ; êîëè÷åñòâî îòìåíåííûõ äåéñòâèé |
gpOpt db 0 |
mode_colored db 1 ; ðåæèì âûäåëåíèÿ ñëîâ öâåòîì (0-âûêë. 1-âêë.) |
key_new db 0 ; ñèìâîë, êîòîðûé áóäåò äîáàâëÿòñÿ ñ êëàâèàòóðû |
tex dd 0 ;text memory pointer |
tex_1 dd 0 ;text first symbol pointer |
tex_end dd 0 ;text end memory pointer |
curMod db 1 |
cur_x dd 0 |
cur_y dd 0 |
invis db 0 ;ðåæèì ïîêàçà íåïå÷àòàåìûõ ñèìâîëîâ |
symbol_new_line db 20 ;ñèìâîë çàâåðøåíèÿ ñòðîêè |
help_id dd -1 ;èäåíòèôèêàòîð äëÿ ñïðàâêè |
hed db 'TextEditor 15.04.10',0 ;ïîäïèñü îêíà |
hed db 'TextEditor 22.04.10',0 ;ïîäïèñü îêíà |
sc system_colors |
fn_icon db 'te_icon.bmp',0 |
77,32 → 35,338 |
;input: |
; edi = pointer to tedit struct |
; reg = index |
;output: |
; reg = pointer to 'tex' struct |
macro ConvertIndexToPointer reg { |
imul reg,sizeof.symbol |
add reg,[tex] |
add reg,ted_tex |
} |
align 4 |
proc ted_init, edit:dword |
push eax ecx edi |
mov edi,dword[edit] |
mov ecx,sizeof.symbol*maxChars |
call mem_Alloc ;âûäåëÿåì ïàìÿòü |
mov ted_tex,eax |
mov ted_tex_1,eax |
add ted_tex_1,sizeof.symbol |
mov ted_tex_end,eax |
add ted_tex_end,sizeof.symbol*maxChars |
stdcall ted_clear, edi,1 |
;------------------------------------------------- |
mov ecx,maxColWords*sizeof.TexColViv+40 |
;add ecx,40 |
call mem_Alloc |
mov ted_syntax_file,eax |
mov ted_syntax_file_end,eax |
add ted_syntax_file_end,ecx |
pop edi ecx eax |
ret |
endp |
align 4 |
proc ted_delete, edit:dword |
push ecx edi |
mov edi,dword[edit] |
mov ecx,ted_tex |
call mem_Free |
mov ecx,ted_syntax_file |
call mem_Free |
pop edi ecx |
ret |
endp |
;input: |
; eax = key kodes |
; ebx = key control |
align 4 |
proc ted_key, edit:dword, table:dword |
pushad |
mov edi,dword[edit] |
cmp ah,KEY_F1 ;[F1] |
jne @f |
stdcall ted_show_help_f1,edi |
jmp .end_key_fun |
@@: |
cmp ah,KEY_F3 ;[F3] |
jne @f |
stdcall but_FindText,edi |
jmp .end_key_fun |
@@: |
test ebx,KM_CTRL ;Ctrl+... |
jz .key_Ctrl |
cmp ah,24 ;Ctrl+O |
jne @f |
call but_OpenFile |
@@: |
cmp ah,33 ;Ctrl+F |
jne @f |
cmp ted_panel_id,TE_PANEL_FIND |
je @f |
stdcall but_find,edi |
@@: |
cmp ah,44 ;Ctrl+Z |
jne @f |
stdcall ted_but_undo,edi |
@@: |
cmp ah,46 ;Ctrl+C |
jne @f |
stdcall ted_but_copy,edi |
@@: |
cmp ah,47 ;Ctrl+V |
jne @f |
stdcall ted_but_paste,edi |
@@: |
cmp ah,49 ;Ctrl+N |
jne @f |
call but_NewFile |
@@: |
cmp ah,199 ;Ctrl+Home |
jne @f |
call but_CtrlHome |
@@: |
;jmp .end_key_fun |
.key_Ctrl: |
test ebx,KM_SHIFT ;Shift+... |
jz .key_Shift |
cmp ah,72 ;Shift+Up |
jne @f |
stdcall ted_sel_key_up,edi |
@@: |
cmp ah,75 ;Shift+Left |
jne @f |
stdcall ted_sel_key_left,edi |
@@: |
cmp ah,77 ;Shift+Right |
jne @f |
stdcall ted_sel_key_right,edi |
@@: |
cmp ah,80 ;Shift+Down |
jne @f |
stdcall ted_sel_key_down,edi |
@@: |
;mov ted_drag_k,1 ;íà÷èíàåì âûäåëåíèå îò êëàâèàòóðû |
jmp .key_MoveCur |
.key_Shift: |
;------------------------------------------------- |
cmp ah,72 ;178 ;Up |
jne @f |
stdcall draw_cursor_sumb,edi |
call CurMoveUp |
cmp dl,8 |
jne .no_red_0 |
call OnInitialUpdate |
stdcall draw_main_win,edi |
jmp @f |
.no_red_0: |
stdcall draw_main_cursor,edi |
mov ted_drag_k,0 ;çàêàí÷èâàåì âûäåëåíèå îò êëàâèàòóðû |
@@: |
cmp ah,80 ;177 ;Down |
jne @f |
stdcall draw_cursor_sumb,edi |
call CurMoveDown |
cmp dl,8 |
jne .no_red_1 |
call OnInitialUpdate |
stdcall draw_main_win,edi |
jmp @f |
.no_red_1: |
stdcall draw_main_cursor,edi |
mov ted_drag_k,0 ;çàêàí÷èâàåì âûäåëåíèå îò êëàâèàòóðû |
@@: |
cmp ah,75 ;176 ;Left |
jne @f |
stdcall draw_cursor_sumb,edi |
call CurMoveLeft |
cmp dl,8 |
jne .no_red_2 |
call OnInitialUpdate |
stdcall draw_main_win,edi |
jmp @f |
.no_red_2: |
stdcall draw_main_cursor,edi |
mov ted_drag_k,0 ;çàêàí÷èâàåì âûäåëåíèå îò êëàâèàòóðû |
@@: |
cmp ah,77 ;179 ;Right |
jne @f |
stdcall draw_cursor_sumb,edi |
call CurMoveRight |
cmp dl,8 |
jne .no_red_3 |
call OnInitialUpdate |
stdcall draw_main_win,edi |
jmp @f |
.no_red_3: |
stdcall draw_main_cursor,edi |
mov ted_drag_k,0 ;çàêàí÷èâàåì âûäåëåíèå îò êëàâèàòóðû |
@@: |
cmp ah,71 ;180 ;Home |
jne @f |
stdcall draw_cursor_sumb,edi |
call CurMoveX_FirstChar |
cmp dl,8 |
jne .no_red_4 |
call OnInitialUpdate |
stdcall draw_main_win,edi |
jmp @f |
.no_red_4: |
stdcall draw_main_cursor,edi |
mov ted_drag_k,0 ;çàêàí÷èâàåì âûäåëåíèå îò êëàâèàòóðû |
@@: |
cmp ah,79 ;181 ;End |
jne @f |
stdcall draw_cursor_sumb,edi |
call CurMoveX_LastChar |
cmp dl,8 |
jne .no_red_5 |
call OnInitialUpdate |
stdcall draw_main_win,edi |
jmp @f |
.no_red_5: |
stdcall draw_main_cursor,edi |
mov ted_drag_k,0 ;çàêàí÷èâàåì âûäåëåíèå îò êëàâèàòóðû |
@@: |
cmp ah,73 ;184 ;PageUp |
jne @f |
call CurMovePageUp |
cmp dl,0 |
je @f |
call OnInitialUpdate |
stdcall draw_main_win,edi |
@@: |
cmp ah,81 ;183 ;PageDown |
jne @f |
call CurMovePageDown |
cmp dl,0 |
je @f |
call OnInitialUpdate |
stdcall draw_main_win,edi |
mov ted_drag_k,0 ;çàêàí÷èâàåì âûäåëåíèå îò êëàâèàòóðû |
@@: |
;------------------------------------------------- |
; cmp ebx,0 |
; jne .end_key_fun |
.key_MoveCur: |
cmp ah,69 ;[Pause Break] |
je .end_key_fun |
cmp ah,120 ;[Fn] |
je .end_key_fun |
cmp ah,0x80 ;if key up |
ja .end_key_fun |
cmp dword[table],0 |
je @f |
stdcall KeyConvertToASCII, dword[table] |
@@: |
;mov ted_drag_k,0 ;çàêàí÷èâàåì âûäåëåíèå îò êëàâèàòóðû |
xor edx,edx |
mov dl,ah |
add edx,EvChar ;add char to text |
cmp byte [edx],1 |
jne @f |
mov ted_key_new,ah |
stdcall ted_set_undo,edi |
mov edx,ted_opt_ed_change_time+ted_opt_ed_move_cursor |
stdcall SelTextDel,edx |
cmp al,1 |
jne .del |
mov edx,ted_opt_ed_move_cursor |
.del: |
cmp ted_cur_ins,1 |
je .no_ins_mod |
stdcall TextDel,edi,ted_opt_ed_change_time |
mov edx,ted_opt_ed_move_cursor |
.no_ins_mod: |
mov ecx,edi |
add ecx,ted_offs_key_new |
stdcall ted_text_add,edi,ecx,1,edx ;äîáàâëÿåì ñèìâîë ââåäåííûé ñ êëàâèàòóðû |
call draw_but_toolbar |
cmp ted_key_new,13 |
jne .dr_m_win |
stdcall draw_main_win,edi |
jmp .dr_cur_l |
.dr_m_win: |
stdcall draw_cur_line,edi |
.dr_cur_l: |
@@: |
cmp ah,8 ;[<-] |
jne @f |
stdcall ted_set_undo,edi |
stdcall SelTextDel,ted_opt_ed_change_time |
cmp al,1 |
je .del_one_b |
stdcall TextDel,edi,ted_opt_ed_change_time+ted_opt_ed_move_cursor |
.del_one_b: |
call draw_but_toolbar |
stdcall draw_main_win,edi |
jmp .end_key_fun |
@@: |
cmp ah,182 ;Delete |
jne @f |
stdcall ted_set_undo,edi |
stdcall SelTextDel,ted_opt_ed_change_time |
cmp al,1 |
je .del_one_d |
stdcall TextDel,edi,ted_opt_ed_change_time |
.del_one_d: |
call draw_but_toolbar |
stdcall draw_main_win,edi |
jmp .end_key_fun |
@@: |
cmp ah,185 ;Ins |
jne @f |
stdcall draw_cursor_sumb,edi |
xor ted_cur_ins,1 |
stdcall draw_main_cursor,edi |
@@: |
.end_key_fun: |
popad |
ret |
endp |
;output: |
; al = 1 - can save |
CanSave: |
push ecx |
mov ecx,[ch_tim] |
sub ecx,[tim_Undo] |
align 4 |
proc ted_can_save, edit:dword |
push ecx edi |
mov edi,dword[edit] |
mov ecx,ted_tim_ch |
sub ecx,ted_tim_undo |
mov al,1 |
cmp [ls_tim],ecx |
cmp ted_tim_ls,ecx |
jne @f |
dec al |
@@: |
pop ecx |
pop edi ecx |
ret |
endp |
;output: |
; al = 1 - selected |
align 4 |
proc IsSel, edit:dword |
push ebx edi |
mov edi,dword[edit] |
110,11 → 374,11 |
cmp ted_drag_m,1 |
je @f |
mov al,1 |
mov ebx,[sel.x0] |
cmp ebx,[sel.x1] |
mov ebx,ted_sel_x0 |
cmp ebx,ted_sel_x1 |
jne @f |
mov ebx,[sel.y0] |
cmp ebx,[sel.y1] |
mov ebx,ted_sel_y0 |
cmp ebx,ted_sel_y1 |
jne @f |
xor al,al |
@@: |
122,81 → 386,98 |
ret |
endp |
SelNormalize: |
align 4 |
proc SelNormalize, edit:dword |
push ecx esi edi |
mov esi,sel |
mov edi,seln |
mov edi,dword[edit] |
mov esi,edi |
add esi,ted_offs_sel |
add edi,ted_offs_seln |
mov ecx,sizeof.TexSelect |
rep movsb |
mov edi,dword[edit] |
jmp @f |
.swp_f: |
mov ecx,[seln.x0] |
m2m [seln.x0],[seln.x1] |
mov [seln.x1],ecx |
mov ecx,ted_seln_x0 |
m2m ted_seln_x0,ted_seln_x1 |
mov ted_seln_x1,ecx |
mov ecx,[seln.y0] |
cmp ecx,[seln.y1] ;(sel.y0>sel.y1) |
mov ecx,ted_seln_y0 |
cmp ecx,ted_seln_y1 ;(sel_y0>sel_y1) |
jle .end_f |
m2m [seln.y0],[seln.y1] |
mov [seln.y1],ecx |
m2m ted_seln_y0,ted_seln_y1 |
mov ted_seln_y1,ecx |
jmp .end_f |
@@: |
mov ecx,[seln.y0] |
cmp ecx,[seln.y1] ;(sel.y0>sel.y1) |
mov ecx,ted_seln_y0 |
cmp ecx,ted_seln_y1 ;(sel_y0>sel_y1) |
jg .swp_f |
cmp ecx,[seln.y1] ;(sel.y0==sel.y1) |
cmp ecx,ted_seln_y1 ;(sel_y0==sel_y1) |
jne .end_f |
mov ecx,[seln.x0] |
cmp ecx,[seln.x1] ;(sel.x0>sel.x1) |
mov ecx,ted_seln_x0 |
cmp ecx,ted_seln_x1 ;(sel_x0>sel_x1) |
jg .swp_f |
.end_f: |
pop edi esi ecx |
ret |
endp |
SelStart: |
push ecx |
mov ecx,[cur_x] |
align 4 |
proc SelStart, edit:dword |
push ecx edi |
mov edi,dword[edit] |
mov ecx,ted_cur_x |
add ecx,[hScr.position] |
mov [sel.x0],ecx |
mov [sel.x1],ecx |
mov ted_sel_x0,ecx |
mov ted_sel_x1,ecx |
mov ecx,[cur_y] |
mov ecx,ted_cur_y |
add ecx,[wScr.position] |
mov [sel.y0],ecx |
mov [sel.y1],ecx |
pop ecx |
mov ted_sel_y0,ecx |
mov ted_sel_y1,ecx |
pop edi ecx |
ret |
endp |
align 4 |
SelMove: |
push ecx |
mov ecx,[cur_x] |
proc SelMove, edit:dword |
push ecx edi |
mov edi,dword[edit] |
mov ecx,ted_cur_x |
add ecx,[hScr.position] |
mov [sel.x1],ecx |
mov ted_sel_x1,ecx |
mov ecx,[cur_y] |
mov ecx,ted_cur_y |
add ecx,[wScr.position] |
mov [sel.y1],ecx |
pop ecx |
mov ted_sel_y1,ecx |
pop edi ecx |
call draw_but_toolbar ;redraw toolbar (need to button Copy) |
ret |
endp |
;input: |
; al = 1 - clear all memory |
Clear: |
mov [cur_x],0 |
mov [cur_y],0 |
mov [ch_tim],0 |
mov [ls_tim],0 |
mov [co_tim],0 |
mov [tim_Undo],0 |
mov [help_id],-1 |
; cl_al_mem = 1 - clear all memory |
align 4 |
proc ted_clear, edit:dword, cl_al_mem:dword |
push edi |
mov edi,dword[edit] |
mov ted_cur_x,0 |
mov ted_cur_y,0 |
mov ted_tim_ch,0 |
mov ted_tim_ls,0 |
mov ted_tim_co,0 |
mov ted_tim_undo,0 |
mov ted_help_id,-1 |
mov [wScr.position],0 |
mov [wScr.max_area],100 |
mov [wScr.redraw],1 |
203,41 → 484,43 |
mov [hScr.position],0 |
mov [hScr.max_area],100 |
mov [sel.x0],0 |
mov [sel.y0],0 |
mov [sel.x1],0 |
mov [sel.y1],0 |
mov ted_sel_x0,0 |
mov ted_sel_y0,0 |
mov ted_sel_x1,0 |
mov ted_sel_y1,0 |
cmp al,0 |
cmp dword[cl_al_mem],0 |
je .exit |
push ecx edx |
mov ecx,sizeof.symbol*maxChars |
mov edx,[tex] |
mov edx,ted_tex |
@@: |
mov byte [edx],0 |
inc edx |
loop @b |
mov edx,[tex] |
mov edx,ted_tex |
mov dword [edx+6],1 |
pop edx ecx |
.exit: |
pop edi |
ret |
endp |
;--- out_reg = Col[keyw[ind_reg]].Text[0] --- |
;--- out_reg = Col[ind_reg].Text[0] --- |
macro ColToIndexOffset ind_reg,out_reg { |
mov out_reg,ind_reg |
imul out_reg,sizeof.TexColViv |
add out_reg,[Col] |
add out_reg,ted_key_words_data |
} |
align 4 |
proc InitColText, edit:dword |
pushad |
mov edi,dword[edit] |
InitColText: |
push eax ebx ecx esi edi |
mov ebx,dword[fn_col_option] |
copy_path ebx,fn_syntax_dir,file_name_rez,0x0 |
copy_path file_name_rez,sys_path,file_name,0x0 |
246,10 → 529,10 |
mov [run_file_70.func_n], 0 |
mov [run_file_70.param1], 0 |
mov [run_file_70.param2], 0 |
mov ebx,[options_file_end] |
sub ebx,[options_file] |
mov ebx,ted_syntax_file_end |
sub ebx,ted_syntax_file |
mov [run_file_70.param3], ebx |
m2m [run_file_70.param4], [options_file] |
m2m [run_file_70.param4], ted_syntax_file |
mov [run_file_70.rezerv], 0 |
mov [run_file_70.name], file_name |
mov ebx,run_file_70 |
256,17 → 539,17 |
int 0x40 |
mov ecx,0x100 |
mov edi,FkPos |
mov edx,FkPos |
@@: |
mov dword[edi],-1 |
add edi,4 |
mov dword[edx],-1 |
add edx,4 |
loop @b |
;init: ColColor, ColWords, ... |
mov dword[ColColor],1 |
mov dword[ColWords],0 |
mov dword[tex_help_f1],0 |
mov [help_id],-1 ;èäåíòèôèêàòîð ñëîâà äëÿ ñïðàâêè |
;init: ted_colors_text_count, ted_key_words_count, ... |
mov ted_colors_text_count,1 |
mov ted_key_words_count,0 |
mov ted_help_text_f1,0 |
mov ted_help_id,-1 ;èäåíòèôèêàòîð ñëîâà äëÿ ñïðàâêè |
cmp eax,6 |
je @f |
280,33 → 563,33 |
add ax,48 |
mov byte[msgbox_3.err],al |
push thread |
push msgbox_3 |
call [mb_create] ;message: Can-t open color options file! |
stdcall [mb_create],msgbox_3,thread ;message: Can-t open color options file! |
jmp .no_colors |
@@: |
mov esi,[options_file] |
mov edi,ColColor |
mov eax,edi ;ñîõðàíÿåì çíà÷åíèå edi |
mov esi,ted_syntax_file |
add edi,ted_offs_count_colors |
mov ecx,9*4 |
rep movsb |
mov edi,eax ;âîñòàíàâëèâàåì çíà÷åíèå edi |
mov eax,[options_file] |
mov eax,ted_syntax_file |
add eax,32 |
mov dword[tex_colors],eax |
mov ted_text_colors,eax |
mov eax,dword[ColColor] ;init: Col (offset to key words) |
mov eax,ted_colors_text_count ;init: count_colors_text (offset to key words) |
add eax,8 |
shl eax,2 |
add eax,[options_file] |
mov dword[Col],eax |
add eax,ted_syntax_file |
mov ted_key_words_data,eax |
mov ecx,dword[ColWords] ;init: FkPos (first key positions) |
mov ecx,ted_key_words_count ;init: FkPos (first key positions) |
xor eax,eax |
@@: |
ColToIndexOffset eax,edi |
ColToIndexOffset eax,edx |
xor ebx,ebx |
mov bl,byte[edi] |
mov bl,byte[edx] |
shl bx,2 |
mov esi,FkPos |
add esi,ebx |
317,31 → 600,32 |
inc eax |
loop @b |
;init: tex_help_f1 |
mov ecx,dword[ColWords] |
;init: ted_help_text_f1 |
mov ecx,ted_key_words_count |
imul ecx,sizeof.TexColViv |
add ecx,dword[Col] |
mov dword[tex_help_f1],ecx |
add ecx,ted_key_words_data |
mov ted_help_text_f1,ecx |
.no_colors: |
pop edi esi ecx ebx eax |
popad |
ret |
endp |
;input: |
; ebx = file size |
OpenFile: |
; edi = pointer to tedit struct |
align 4 |
proc OpenFile |
push eax ;destination |
push ecx ;for cycle |
push edx ;source |
xor al,al |
call Clear |
stdcall ted_clear,edi,0 ;÷èñòèì íå âñþ ïàìÿòü, ïîòîìó ÷òî íèæå áóäåì åå çàïîëíÿòü íîâûìè äàíûìè |
mov eax,ebx |
mov ecx,ebx |
add eax,2 |
ConvertIndexToPointer eax |
mov edx,[tex] |
mov edx,ted_tex |
add edx,ebx |
push ebx |
@@: |
366,7 → 650,7 |
add eax,2 |
mov dword [eax],0 ; first sumbol 'perv=0' |
mov edx,[tex] |
mov edx,ted_tex |
; begining sumbol 'perv=0' 'next=2' |
mov dword [edx+2],0 |
mov dword [edx+6],2 |
379,12 → 663,12 |
mov edx,ebx |
inc edx ;2 = rezerv sumbols |
imul edx,sizeof.symbol |
add edx,[tex] |
add edx,ted_tex |
mov dword [edx+6],1 ; last sumbol 'next=1' |
@@: ;clear memory, need if before was open big file |
add edx,sizeof.symbol |
cmp edx,[tex_end] |
cmp edx,ted_tex_end |
jge @f |
mov dword[edx+10],0 |
mov dword[edx+14],0 |
399,20 → 683,26 |
mov [wScr.max_area],eax |
; mov [wScr.redraw],1 |
pop edx ecx eax |
call CmColored |
call draw_but_toolbar |
stdcall draw_main_win,edi |
ret |
endp |
;input: |
; edx = pointer to symbol struct |
; edi = pointer to tedit struct |
;output: |
; edx = pointer to 'perv' visible symbol struct |
align 4 |
IteratPerv: |
cmp [tim_Undo],0 |
cmp ted_tim_undo,0 |
je .else |
push ebx |
@@: |
call GetTexPervPos |
cmp edx,[tex] |
cmp edx,ted_tex |
je @f |
call SymbNotVis |
cmp bl,1 |
424,7 → 714,7 |
ret |
.else: |
call GetTexPervPos |
cmp edx,[tex] |
cmp edx,ted_tex |
je .endif |
cmp dword [edx+14],0 |
jne .else |
436,15 → 726,17 |
;input: |
; edx = pointer to symbol struct |
; edi = pointer to tedit struct |
;output: |
; edx = pointer to 'next' visible symbol struct |
align 4 |
IteratNext: |
cmp [tim_Undo],0 |
cmp ted_tim_undo,0 |
je .else |
push ebx |
@@: |
call GetTexNextPos |
cmp edx,[tex_1] |
cmp edx,ted_tex_1 |
jle @f |
call SymbNotVis |
cmp bl,1 |
456,7 → 748,7 |
ret |
.else: |
call GetTexNextPos |
cmp edx,[tex_1] |
cmp edx,ted_tex_1 |
jle .endif |
cmp dword [edx+14],0 |
jne .else |
466,13 → 758,15 |
ret |
;input: |
; bl = symbol end of select |
; edx = pointer to symbol struct |
; bl = symbol end of select |
; edi = pointer to tedit struct |
align 4 |
ItPoNextUc: |
@@: |
cmp bl,byte[edx] |
je @f |
cmp edx,[tex_1] |
cmp edx,ted_tex_1 |
jle @f |
call IteratNext |
jmp @b |
482,12 → 776,14 |
;input: |
; edx = pointer to symbol struct |
; edi = pointer to tedit struct |
align 4 |
ItPervColorTag: |
@@: |
cmp byte[edx+1],0 |
jne @f |
call IteratPerv |
cmp edx,[tex_1] |
cmp edx,ted_tex_1 |
jle @f |
jmp @b |
@@: |
495,12 → 791,14 |
;input: |
; edx = pointer to symbol struct |
; edi = pointer to tedit struct |
align 4 |
ItNextColorTag: |
@@: |
call IteratNext |
cmp byte[edx+1],0 |
jne @f |
cmp edx,[tex_1] |
cmp edx,ted_tex_1 |
jle @f |
jmp @b |
@@: |
509,9 → 807,11 |
;input: |
; edx = pointer to symbol struct |
; edi = pointer to tedit struct |
;output: |
; bl = 1 if sumbol not visible |
; (tex[i].td+tim_Undo<=ch_tim && tex[i].td) || (tex[i].tc>ch_tim-tim_Undo) |
; (tex[i].td+ted_tim_undo<=ted_tim_ch && tex[i].td) || (tex[i].tc>ted_tim_ch-ted_tim_undo) |
align 4 |
SymbNotVis: |
push eax |
520,8 → 820,8 |
cmp dword [edx+14],0 |
je @f |
mov eax,[edx+14] ;eax=tex[i].td |
add eax,[tim_Undo] |
cmp eax,[ch_tim] |
add eax,ted_tim_undo |
cmp eax,ted_tim_ch |
jg @f |
mov bl,1 |
pop eax |
528,8 → 828,8 |
ret |
@@: |
mov eax,[ch_tim] |
sub eax,[tim_Undo] |
mov eax,ted_tim_ch |
sub eax,ted_tim_undo |
cmp [edx+10],eax |
jle @f |
or bl,1 |
540,87 → 840,96 |
;input: |
; bh = 1 - move cursor after text add |
; bl = 1 - change time when text add |
; esi = add text len |
; edi = pointer to text string |
TextAdd: |
push ebp |
mov ebp,esp |
sub esp,4*2 |
; text:dword - pointer to text string |
; add_opt:dword - options |
align 4 |
proc ted_text_add, edit:dword, text:dword, t_len:dword, add_opt:dword |
locals |
new_spc dd ? ;count new spaces |
new_lin dd ? ;count new lines |
endl |
;èñïîëüçîâàíèå ðåãèñòðîâ âíóòðè ôóíêöèè: |
;eax - ïîçèöèÿ äëÿ âñòàâêè òåêñòà |
;ebx - äëÿ âðåìåííûõ íóæä, äëèííà âñòàâëÿåìîãî òåêñòà |
;ecx - äëÿ âðåìåííûõ íóæä |
;edx - óêàçàòåëü íà ñòðóêòóðó ñèìâîëà |
pushad |
mov edi,dword[edit] |
mov esi,dword[text] |
push eax ;po_t |
push ecx edx edi |
call GetPos |
call GetTexPervPos |
call GetTexArrIndex ;eax=po_t |
mov dword[ebp-4],0 ;count new spaces |
cmp [gpOpt],2 |
mov dword[new_spc],0 |
cmp ted_gp_opt,2 |
je @f |
push eax ebx ;c_sp=cur[cn].x+Scroller->XPos-StrLen(cur[cn].y+Scroller->YPos); |
mov eax,[cur_x] |
push eax ;c_sp=cur[cn].x+Scroller->XPos-StrLen(cur[cn].y+Scroller->YPos); |
mov eax,ted_cur_x |
add eax,[hScr.position] |
mov dword[ebp-4],eax |
mov dword[new_spc],eax |
mov eax,[cur_y] |
mov eax,ted_cur_y |
add eax,[wScr.position] |
call StrLen |
sub dword[ebp-4],ebx |
pop ebx eax |
call ted_strlen ;ebx = line len |
sub dword[new_spc],ebx |
pop eax |
@@: |
mov dword[ebp-8],0 ;count new lines |
cmp [gpOpt],0 |
mov ebx,dword[t_len] |
mov dword[new_lin],0 |
cmp ted_gp_opt,0 |
jne @f |
push eax |
mov eax,[cur_y] |
mov eax,ted_cur_y |
add eax,[wScr.position] |
inc eax |
mov dword[ebp-8],eax |
mov dword[new_lin],eax |
call GetNumLines |
sub dword[ebp-8],eax |
sub dword[new_lin],eax |
pop eax |
@@: |
mov edx,sizeof.symbol |
shl edx,1 |
add edx,[tex] |
add edx,ted_tex |
@@: ;for(i=2;i<texMax;i++) |
cmp dword [edx+10],0 ;if(!tex[i].tc && !tex[i].td) |
jne .u1f |
cmp dword [edx+14],0 |
jne .u1f |
cmp bl,0 ;if(n_tim) ch_tim++; |
je .no_tim |
inc [ch_tim] |
test dword[add_opt],ted_opt_ed_change_time ;if(n_tim) ted_tim_ch++; |
jz .no_tim |
inc ted_tim_ch |
.no_tim: |
cmp bh,0 |
je .no_cur_mov |
cmp dword[ebp-8],0 ;åñëè åñòü äîáàâî÷íûå ñòðîêè, òî êóðñîð åùå íå äâèãàåì |
test dword[add_opt],ted_opt_ed_move_cursor |
jz .no_cur_mov |
cmp dword[new_lin],0 ;åñëè åñòü äîáàâî÷íûå ñòðîêè, òî êóðñîð åùå íå äâèãàåì |
jg .no_cur_mov |
cmp dword[ebp-4],0 ;åñëè íåò äîáàâî÷íûõ ïðîáåëîâ, òî êóðñîð òîæå íå äâèãàåì |
cmp dword[new_spc],0 ;åñëè íåò äîáàâî÷íûõ ïðîáåëîâ, òî êóðñîð òîæå íå äâèãàåì |
jg .no_cur_mov |
inc [cur_x] ;move cursor |
inc ted_cur_x ;move cursor |
;call GoToPos |
cmp byte [edi],13 |
cmp byte [esi],13 |
jne .no_cur_mov |
mov [cur_x],0 |
inc [cur_y] |
mov ted_cur_x,0 |
inc ted_cur_y |
.no_cur_mov: |
xor bl,bl ;n_tim=false; |
mov ecx,ted_opt_ed_change_time |
not ecx |
and dword[add_opt],ecx ;n_tim=false; |
mov cl,byte [edi] ;tex[i].c=ta[ns]; |
mov cl,byte [esi] ;tex[i].c=ta[ns]; |
mov byte [edx],cl |
m2m dword [edx+10],dword [ch_tim] ;tex[i].tc=ch_tim; |
m2m dword [edx+10],ted_tim_ch ;tex[i].tc=ted_tim_ch; |
mov [edx+2],eax ;tex[i].perv=po_t; |
mov ecx,eax |
imul ecx,sizeof.symbol |
add ecx,[tex] ; *** ecx = tex[po_t] *** |
add ecx,ted_tex ; *** ecx = tex[po_t] *** |
add ecx,6 ; *** ecx = tex[po_t].next *** |
m2m dword [edx+6],dword [ecx] ;tex[i].next=tex[po_t].next; |
630,49 → 939,49 |
mov [ecx],eax ;tex[po_t].next=i; // ññûëêè ïåðåíàïðàâëÿåì |
mov ecx,[edx+6] ; *** ecx = tex[i].next *** |
imul ecx,sizeof.symbol |
add ecx,[tex] ; *** ecx = tex[tex[i].next] *** |
add ecx,ted_tex ; *** ecx = tex[tex[i].next] *** |
mov [ecx+2],eax ;tex[tex[i].next].perv=i; |
cmp dword[ebp-8],0 ;add lines or text |
cmp dword[new_lin],0 ;add lines or text |
jle .spc_add |
dec dword[ebp-8] |
dec dword[new_lin] |
mov byte [edx],13 |
jmp .u1f |
.spc_add: |
cmp dword[ebp-4],0 ;add spaces or text |
cmp dword[new_spc],0 ;add spaces or text |
jle .tex_add |
dec dword[ebp-4] |
dec dword[new_spc] |
mov byte [edx],' ' |
jmp .u1f |
.tex_add: |
inc edi |
dec esi |
inc esi |
dec ebx |
.u1f: |
add edx,sizeof.symbol |
cmp edx,[tex_end] |
cmp edx,ted_tex_end |
jge @f ;out of memory |
cmp esi,0 |
cmp ebx,0 |
jne @b |
@@: |
pop edi edx ecx eax |
mov esp,ebp ; âîññòàíàâëèâàåì ñòåê |
pop ebp |
call CmColored |
popad |
ret |
endp |
;input: |
; ecx = position to free insert cell |
; edx = pointer to sumbol, when insert |
; esi = pointer to added symbol |
; edi = pointer to tedit struct |
;output: |
; ecx = position to inserted cell |
align 4 |
CharAdd: |
.loop_b: |
cmp ecx,[tex_end] |
cmp ecx,ted_tex_end |
jge .end_f |
cmp dword[ecx+10],0 |
jne @f |
684,7 → 993,7 |
.loop_e: |
push eax ebx |
mov eax,[ch_tim] |
mov eax,ted_tim_ch |
mov dword[ecx+10],eax |
mov al,byte[esi] |
mov byte[ecx],al |
711,23 → 1020,29 |
;input: |
; conv_table = pointert to convert table |
; edi = pointer to tedit struct |
;output: |
; edi = count converted symbols |
ConvertSelText: |
xor edi,edi |
push eax ebx ecx edx esi |
stdcall IsSel, tedit0 |
; esi = count converted symbols |
align 4 |
proc ConvertSelText |
locals |
conv_cou dd ? |
endl |
mov dword[conv_cou],0 |
pushad |
stdcall IsSel,edi |
cmp al,0 |
je .end_f |
call SetUndo |
call SelNormalize |
stdcall ted_set_undo,edi |
stdcall SelNormalize,edi |
mov esi,[seln.x0] |
mov ecx,[seln.y0] |
mov esi,ted_seln_x0 |
mov ecx,ted_seln_y0 |
call GetPosByParam |
mov eax,edx |
mov esi,[seln.x1] |
mov ecx,[seln.y1] |
mov esi,ted_seln_x1 |
mov ecx,ted_seln_y1 |
call GetPosByParam |
;call GetTexPervPos |
mov ebx,edx |
735,7 → 1050,7 |
cmp eax,ebx |
je .end_f |
inc [ch_tim] |
inc ted_tim_ch |
mov edx,eax ;i=p0; |
mov ecx,2 |
ConvertIndexToPointer ecx |
745,14 → 1060,14 |
add esi,[conv_table] ;EvUpper |
cmp byte [esi],0 |
je .no_change |
m2m dword [edx+14],dword [ch_tim] |
m2m dword [edx+14],ted_tim_ch |
call CharAdd ;b_pos=CharAdd(tex[i].c^32,i,false,b_pos); |
call GetTexNextPos ;go to added symbol |
inc edi |
inc dword[conv_cou] |
.no_change: |
call IteratNext |
cmp edx,[tex] |
cmp edx,ted_tex |
je @f |
cmp edx,ebx |
je @f |
759,49 → 1074,113 |
jmp @b |
@@: |
cmp edi,0 |
cmp dword[conv_cou],0 |
jne @f |
dec [ch_tim] |
dec ted_tim_ch |
@@: |
.end_f: |
pop esi edx ecx ebx eax |
popad |
mov esi,dword[conv_cou] |
ret |
endp |
;input: |
; bh = (0-backspace, 1-delete) |
; bl = 1 - change time |
;output: |
; bl = 0 - no delete |
; bl = 1 - delete |
TextDel: |
push edx cx |
align 4 |
proc TextDel, edit:dword, del_opt:dword |
push cx edx edi |
mov edi,dword[edit] |
mov ebx,dword[del_opt] |
xor cl,cl |
cmp bh,1 |
je @f |
test ebx,ted_opt_ed_move_cursor |
jz @f |
call CurMoveLeft |
cmp dl,0 |
je .no_del |
@@: |
call GetPos |
cmp [gpOpt],1 |
cmp ted_gp_opt,1 |
je .no_del |
cmp bl,0 |
je @f |
inc [ch_tim] |
test ebx,ted_opt_ed_change_time |
jz @f |
inc ted_tim_ch |
@@: |
m2m dword [edx+14], dword [ch_tim] |
m2m dword [edx+14], ted_tim_ch |
mov cl,1 |
.no_del: |
mov bl,cl |
pop cx edx |
pop edi edx cx |
ret |
endp |
;input: |
; edi = pointer to tedit struct |
;output: |
; al = 1 if delete |
;description: |
; Ôóíêöèÿ óäàëÿåò âûäåëåííûé òåêñò |
align 4 |
proc SelTextDel, del_opt:dword |
push ebx ecx edx esi |
stdcall IsSel,edi |
cmp al,0 |
je .end_f |
stdcall SelNormalize,edi |
mov esi,ted_seln_x1 |
mov ecx,ted_seln_y1 |
call GetPosByParam |
mov ebx,edx |
mov esi,ted_seln_x0 |
mov ecx,ted_seln_y0 |
call GetPosByParam |
test dword[del_opt],ted_opt_ed_change_time |
jz @f |
inc ted_tim_ch |
@@: |
cmp edx,ted_tex |
je @f |
cmp edx,ebx ;if(i==te)break; |
je @f |
m2m dword[edx+14],ted_tim_ch |
mov esi,ted_opt_ed_change_time |
not esi |
and dword[del_opt],esi ;n_tim=false; |
call IteratNext |
jmp @b |
@@: |
test dword[del_opt],ted_opt_ed_change_time |
jz @f |
dec ted_tim_ch |
xor al,al |
@@: |
test dword[del_opt],ted_opt_ed_change_time |
jnz @f |
mov ecx,ted_seln_x0 |
mov edx,ted_seln_y0 |
call GoToPos |
mov ted_sel_x0,0 |
mov ted_sel_y0,0 |
mov ted_sel_x1,0 |
mov ted_sel_y1,0 |
@@: |
.end_f: |
pop esi edx ecx ebx |
ret |
endp |
;input: |
; eax = pointer to begin select |
; ebx = pointer to end select |
; edi = pointer to tedit struct |
align 4 |
Revers: |
cmp eax,ebx |
jne @f |
810,7 → 1189,7 |
push ecx edx |
mov edx,[tex_1] |
mov edx,ted_tex_1 |
cmp edx,ebx ;if(p1==1)p1=tex[1].perv; |
jne @f |
call GetTexPervPos |
843,7 → 1222,7 |
cmp edx,ebx ;if(i==p1)break; |
je @f |
; --- |
;cmp edx,[tex] |
;cmp edx,ted_tex |
;je @f |
; --- |
mov edx,ecx ;i = tmp; |
855,14 → 1234,17 |
ret |
;input: |
; edi = pointer to tedit struct |
;output: |
; dl = 0 not move |
; dl = 2 if move up |
; dl = 8 if scroll move up |
align 4 |
CurMoveUp: |
cmp [cur_y],0 |
cmp ted_cur_y,0 |
je @f |
dec [cur_y] |
dec ted_cur_y |
mov dl,2 |
ret |
@@: |
875,31 → 1257,35 |
mov dl,0 |
ret |
;input: |
; edi = pointer to tedit struct |
;output: |
; dl = 0 not move |
; dl = 2 if move down |
; dl = 8 if scroll move down |
align 4 |
CurMoveDown: |
push eax |
push eax ebx |
mov dl,0 |
mov eax,[wScr.cur_area] |
mov ebx,ted_scr_w |
mov eax,dword[ebx+sb_offs_cur_area] |
dec eax |
cmp [cur_y],eax |
cmp ted_cur_y,eax |
jge @f |
inc [cur_y] |
inc ted_cur_y |
mov dl,2 |
jmp .ret_f |
@@: |
mov eax,[cur_y] |
add eax,[wScr.position] |
mov eax,ted_cur_y |
add eax,dword[ebx+sb_offs_position] |
inc eax |
cmp [wScr.max_area],eax |
cmp dword[ebx+sb_offs_max_area],eax |
jle @f |
inc [wScr.position] |
inc dword[ebx+sb_offs_position] |
mov dl,8 |
@@: |
.ret_f: |
pop eax |
pop ebx eax |
ret |
906,6 → 1292,7 |
;output: |
; dl = 0 not move |
; dl = 1 if move up |
align 4 |
CurMovePageUp: |
push eax |
mov eax,[wScr.cur_area] |
925,33 → 1312,41 |
pop eax |
ret |
;input: |
; edi = pointer to tedit struct |
align 4 |
CurMovePageDown: |
push eax ebx |
push eax ebx ecx |
mov ecx,ted_scr_w |
xor dl,dl |
mov eax,[wScr.max_area] |
sub eax,[wScr.cur_area] |
cmp [wScr.position],eax |
mov eax,dword[ecx+sb_offs_max_area] |
sub eax,dword[ecx+sb_offs_cur_area] |
cmp dword[ecx+sb_offs_position],eax |
jge @f |
mov ebx,[wScr.cur_area] |
add [wScr.position],ebx |
mov ebx,dword[ecx+sb_offs_cur_area] |
add dword[ecx+sb_offs_position],ebx |
mov dl,1 |
mov [wScr.redraw],1 |
cmp [wScr.position],eax |
mov dword[ecx+sb_offs_redraw],1 |
cmp dword[ecx+sb_offs_position],eax |
jle @f |
mov [wScr.position],eax |
mov dword[ecx+sb_offs_position],eax |
@@: |
pop ebx eax |
pop ecx ebx eax |
ret |
;input: |
; edi = pointer to tedit struct |
;output: |
; dl = 0 not move |
; dl = 1 if move left |
; dl = 3 if move left and up |
; dl = 8 if scroll move up |
align 4 |
CurMoveLeft: |
cmp [cur_x],0 |
cmp ted_cur_x,0 |
je @f |
dec [cur_x] |
dec ted_cur_x |
mov dl,1 |
ret |
@@: |
961,7 → 1356,7 |
mov dl,8 |
ret |
@@: |
cmp [cur_y],0 |
cmp ted_cur_y,0 |
jne @f |
mov dl,0 |
cmp [wScr.position],0 |
972,9 → 1367,9 |
mov dl,8 |
jmp .ret_f |
@@: |
cmp [cur_y],0 |
cmp ted_cur_y,0 |
je @f |
dec [cur_y] |
dec ted_cur_y |
call CurMoveX_LastChar |
cmp dl,8 |
je .ret_f |
985,13 → 1380,16 |
.ret_f: |
ret |
;input: |
; edi = pointer to tedit struct |
align 4 |
CurMoveRight: |
push eax |
xor dl,dl |
mov eax,[hScr.cur_area] |
cmp [cur_x],eax |
cmp ted_cur_x,eax |
jge @f |
inc [cur_x] |
inc ted_cur_x |
mov dl,1 |
jmp .ret_f |
@@: |
1001,14 → 1399,17 |
pop eax |
ret |
;input: |
; edi = pointer to tedit struct |
align 4 |
CurMoveX_LastChar: |
;[hScr.position] |
;[hScr.cur_area] |
;dl-??? |
push eax ebx |
mov eax,[cur_y] |
mov eax,ted_cur_y |
add eax,[wScr.position] |
call StrLen |
call ted_strlen |
xor dl,dl |
cmp ebx,[hScr.position] |
1025,19 → 1426,22 |
sub [hScr.position],ebx |
mov dl,8 |
@@: |
mov [cur_x],ebx |
mov ted_cur_x,ebx |
pop ebx eax |
ret |
;input: |
; edi = pointer to tedit struct |
;output: |
; dl = 0 not move |
; dl = 1 move cursor |
; dl = 8 move cursor and scroll |
align 4 |
CurMoveX_FirstChar: |
xor dl,dl |
cmp [cur_x],0 |
cmp ted_cur_x,0 |
je @f |
mov [cur_x],0 |
mov ted_cur_x,0 |
mov dl,1 |
@@: |
cmp [hScr.position],0 |
1049,13 → 1453,15 |
;input: |
; edx = pointer to symbol struct |
; edi = pointer to tedit struct |
;output: |
; eax = array index |
align 4 |
GetTexArrIndex: |
push ecx edx |
mov eax,edx |
sub eax,[tex] |
sub eax,ted_tex |
xor edx,edx |
mov ecx,sizeof.symbol |
div ecx |
1065,13 → 1471,15 |
;input: |
; edx = pointer to symbol struct |
; edi = pointer to tedit struct |
;output: |
; edx = pointer to 'perv' struct |
align 4 |
GetTexPervPos: |
push dword [edx+2] |
pop edx |
imul edx,sizeof.symbol |
add edx,[tex] |
add edx,ted_tex |
ret |
;input: |
1078,24 → 1486,27 |
; edx = pointer to symbol struct |
;output: |
; edx = pointer to 'next' symbol struct |
align 4 |
GetTexNextPos: |
push dword [edx+6] |
pop edx |
imul edx,sizeof.symbol |
add edx,[tex] |
add edx,ted_tex |
ret |
;input: |
; edi = pointer to tedit struct |
;output: |
; edx = symbol under cursor |
; gpOpt = 1,2 |
; ted_gp_opt = 1,2 |
; edx = tex[1].perv if error |
; gpOpt = 0 |
; ted_gp_opt = 0 |
align 4 |
GetPos: |
push esi ecx |
mov esi,[cur_x] |
mov esi,ted_cur_x |
add esi,[hScr.position] |
mov ecx,[cur_y] |
mov ecx,ted_cur_y |
add ecx,[wScr.position] |
call GetPosByParam |
pop ecx esi |
1105,12 → 1516,14 |
;input: |
; esi = XPos |
; ecx = YPos |
; edi = pointer to tedit struct |
;output: |
; edx = symbol under cursor |
; gpOpt = 1 if found text line |
; gpOpt = 2 if found text line and column |
; ted_gp_opt = 1 if found text line |
; ted_gp_opt = 2 if found text line and column |
; edx = tex[1] if error |
; gpOpt = 0 if text no found |
; ted_gp_opt = 0 if text no found |
align 4 |
GetPosByParam: |
push eax ;Row |
push ebx ;Col |
1117,35 → 1530,35 |
xor eax,eax |
xor ebx,ebx |
mov [gpOpt],0 |
mov edx,[tex] |
mov ted_gp_opt,0 |
mov edx,ted_tex |
@@: |
call IteratNext |
cmp edx,[tex_1] |
cmp edx,ted_tex_1 |
jle @f |
cmp ebx,esi |
jne .u1_0 ;Col <> cur_x |
mov [gpOpt],1 |
jne .u1_0 ;Col <> ted_cur_x |
mov ted_gp_opt,1 |
cmp eax,ecx |
jge @f ; Row >= cur_y |
jge @f ; Row >= ted_cur_y |
.u1_0: |
mov [gpOpt],0 |
mov ted_gp_opt,0 |
inc ebx |
cmp byte [edx],13 |
jne @b |
cmp eax,ecx |
jge @f ; Row >= cur_y |
jge @f ; Row >= ted_cur_y |
inc eax |
xor ebx,ebx |
jmp @b |
@@: |
cmp eax,ecx |
jne @f ; Row = cur_y |
inc [gpOpt] |
jne @f ; Row = ted_cur_y |
inc ted_gp_opt |
@@: |
cmp [gpOpt],0 |
cmp ted_gp_opt,0 |
jne @f |
mov edx,[tex_1] |
mov edx,ted_tex_1 |
;call GetTexPervPos |
@@: |
pop ebx eax |
1154,18 → 1567,20 |
;input: |
; eax = Row |
; edi = pointer to tedit struct |
;output: |
; ebx = str len |
StrLen: |
align 4 |
ted_strlen: |
push edx ecx |
;ecx = Row, from cycle |
xor ebx,ebx |
xor ecx,ecx |
mov edx,[tex] |
mov edx,ted_tex |
@@: |
call IteratNext |
cmp edx,[tex_1] |
cmp edx,ted_tex_1 |
jle @f |
inc ebx |
cmp byte [edx],13 |
1187,11 → 1602,13 |
ret |
;output: |
;input: |
; edx = symbol position |
; edi = pointer to tedit struct |
;output: |
; eax = number of line |
; ebx = symbol position in line |
align 4 |
GetTexCoords: |
push edx |
xor eax,eax |
1204,7 → 1621,7 |
inc ebx |
.no_col_mov: |
cmp edx,[tex_1] |
cmp edx,ted_tex_1 |
jle @f |
cmp byte [edx],13 |
jne @b |
1215,15 → 1632,18 |
pop edx |
ret |
;input: |
; edi = pointer to tedit struct |
;output: |
; eax = num lines |
align 4 |
GetNumLines: |
push edx |
mov eax,1 |
mov edx,[tex] |
mov edx,ted_tex |
@@: |
call IteratNext |
cmp edx,[tex_1] |
cmp edx,ted_tex_1 |
jle @f |
cmp byte [edx],13 |
jne @b |
1235,25 → 1655,30 |
pop edx |
ret |
SetUndo: |
mov [dragk],0 ;çàêàí÷èâàåì âûäåëåíèå îò êëàâèàòóðû |
cmp [tim_Undo],1 |
align 4 |
proc ted_set_undo, edit:dword |
push edi |
mov edi,dword[edit] |
mov ted_drag_k,0 ;çàêàí÷èâàåì âûäåëåíèå îò êëàâèàòóðû |
cmp ted_tim_undo,1 |
jl .no_work |
push eax ebx edx |
mov edx,[tex] |
mov edx,ted_tex |
call GetTexNextPos ;long i=tex[0].next; |
mov eax,[tim_Undo] |
sub [ch_tim],eax ;ch_tim-=tim_Undo; |
mov eax,[ch_tim] |
cmp [ls_tim],eax ;if(ls_tim>ch_tim) |
mov eax,ted_tim_undo |
sub ted_tim_ch,eax ;ted_tim_ch-=ted_tim_undo; |
mov eax,ted_tim_ch |
cmp ted_tim_ls,eax ;if(ted_tim_ls>ted_tim_ch) |
jle @f |
mov dword [ls_tim],0 |
mov ted_tim_ls,0 |
@@: |
cmp edx,[tex] |
cmp edx,ted_tex |
je @f |
;if(tex[i].tc>ch_tim){ // åñëè ñîçäàíèå ñèìâîëà áûëî îòìåíåíî |
;if(tex[i].tc>ted_tim_ch){ // åñëè ñîçäàíèå ñèìâîëà áûëî îòìåíåíî |
cmp [edx+10],eax |
jle .no_u1 |
mov dword [edx+10],0 |
1261,17 → 1686,17 |
mov ebx,[edx+2] |
imul ebx,sizeof.symbol |
add ebx,[tex];.next |
add ebx,ted_tex;.next |
m2m dword [ebx+6],dword [edx+6] ;tex[tex[i].perv].next=tex[i].next; |
mov ebx,[edx+6] |
imul ebx,sizeof.symbol |
add ebx,[tex];.perv |
add ebx,ted_tex;.perv |
m2m dword [ebx+2],dword [edx+2] ;tex[tex[i].next].perv=tex[i].perv; |
.no_u1: |
;else if(tex[i].td>ch_tim) tex[i].td=0; // åñëè óäàëåíèå ñèìâîëà áûëî îòìåíåíî |
;else if(tex[i].td>ted_tim_ch) tex[i].td=0; // åñëè óäàëåíèå ñèìâîëà áûëî îòìåíåíî |
cmp [edx+14],eax |
jle .no_u2 |
mov dword [edx+14],0 |
1280,24 → 1705,28 |
call GetTexNextPos |
jmp @b |
@@: |
mov dword [tim_Undo],0 |
mov eax,[co_tim] |
cmp [ch_tim],eax |
mov ted_tim_undo,0 |
mov eax,ted_tim_co |
cmp ted_tim_ch,eax |
jge @f |
mov [co_tim],0 |
mov ted_tim_co,0 |
@@: |
pop edx ebx eax |
.no_work: |
pop edi |
ret |
endp |
;input: |
; ecx = Col |
; edx = Row |
; edi = pointer to tedit struct |
align 4 |
GoToPos: |
mov [cur_x],ecx |
mov ted_cur_x,ecx |
sub edx,[wScr.position] |
cmp edx,[wScr.cur_area] ;[cur_y] > [.cur_area] |
cmp edx,[wScr.cur_area] ;ted_cur_y > [.cur_area] |
jl @f |
push ebx |
mov ebx,edx |
1308,85 → 1737,32 |
pop ebx |
; ??? redrav |
@@: |
mov [cur_y],edx |
mov ted_cur_y,edx |
ret |
;input: |
; bl = 1 change time when delete text |
;output: |
; al = 1 if delete |
SelTextDel: |
stdcall IsSel, tedit0 |
cmp al,0 |
jne @f |
ret |
@@: |
;call SelEnd |
call SelNormalize |
push esi edi ecx edx |
mov esi,[seln.x1] |
mov ecx,[seln.y1] |
call GetPosByParam |
mov edi,edx |
mov esi,[seln.x0] |
mov ecx,[seln.y0] |
call GetPosByParam |
cmp bl,0 |
je @f |
inc [ch_tim] |
@@: |
cmp edx,[tex] |
je @f |
cmp edx,edi ;if(i==te)break; |
je @f |
m2m dword[edx+14],dword[ch_tim] |
xor bl,bl ;n_tim=false; |
call IteratNext |
jmp @b |
@@: |
cmp bl,0 |
je @f |
dec [ch_tim] |
xor al,al |
@@: |
cmp bl,0 |
jne @f |
mov ecx,[seln.x0] |
mov edx,[seln.y0] |
call GoToPos |
mov [sel.x0],0 |
mov [sel.y0],0 |
mov [sel.x1],0 |
mov [sel.y1],0 |
@@: |
pop edx ecx edi esi |
ret |
; edi = pointer to tedit struct |
align 4 |
CmColored: |
push eax edx |
mov eax,[ch_tim] |
sub eax,[tim_Undo] |
mov dword[co_tim],eax |
mov edx,[tex] |
mov eax,ted_tim_ch |
sub eax,ted_tim_undo |
mov ted_tim_co,eax |
mov edx,ted_tex |
@@: |
call IteratNext |
cmp edx,[tex_1] |
cmp edx,ted_tex_1 |
jle @f |
mov byte[edx+1],0 |
jmp @b |
@@: |
cmp dword[ColWords],1 |
cmp ted_key_words_count,1 |
jl .no_colors |
mov edx,[tex] |
mov edx,ted_tex |
@@: |
call TextFSColor |
cmp edx,[tex_1] |
cmp edx,ted_tex_1 |
jle .no_colors |
jmp @b |
.no_colors: |
1394,64 → 1770,64 |
ret |
;input: |
; edx = pointer to start symbol |
; edi = pointer to tedit struct |
;output: |
; edx = pointer to next symbol |
TextFSColor: |
;eax = word_n |
;ecx = l_pos |
push ebp |
mov ebp,esp |
sub esp,10 ;2*4+2*1 |
;bP = dword[ebp-4] |
;eP = dword[ebp-8] |
;fnd = byte[ebp-12] |
;f_color = byte[ebp-13] |
push eax ebx ecx esi edi |
mov dword[ebp-4],1 |
mov dword[ebp-4],1 |
mov byte[ebp-12],0 |
mov byte[ebp-13],1 |
;description: |
; Ôóíêöèÿ äëÿ ïîèñêà è âûäåëåíèÿ ïîäñâå÷åíûõ ñëîâ |
align 4 |
proc TextFSColor |
locals |
begPos dd ? ;íà÷àëüíàÿ ïîçèöèÿ |
endPos dd ? ;êîíå÷íàÿ ïîçèöèÿ |
find db ? ;íàéäåíî / íå íàéäåíî |
f_color db ? ;èíäåêñ öâåòà íàéäåíîãî ñëîâà |
endl |
push eax ebx ecx esi |
;eax = word_n òåêóùèé íîìåð (ïîçèöèÿ) ïðîâåðÿåìîãî ñëîâà â ñïèñêå |
;ebx = äëÿ ðàçíûõ öåëåé |
;ecx = l_pos ïîñëåäíèé íîìåð (ïîçèöèÿ) ïîäõîäÿùåãî ñëîâà â ñïèñêå |
;esi = äëÿ ðàçíûõ öåëåé, íîìåð ïðîâåðÿåìîãî ñèìâîëà â ñëîâå |
mov dword[begPos],1 |
mov dword[endPos],1 |
mov byte[find],0 |
mov byte[f_color],1 |
@@: |
call IteratNext |
cmp edx,[tex_1] |
cmp edx,ted_tex_1 |
jle @f |
xor ebx,ebx |
mov bl,byte[edx] |
;mov byte[buf],bl |
;mov byte[buf+1],0 |
shl bx,2 ;ebx*=4 |
add ebx,FkPos |
mov eax,dword[ebx] |
xor eax,eax |
mov al,byte[edx] |
shl ax,2 ;eax*=4 |
add eax,FkPos |
mov eax,dword[eax] |
cmp eax,0 |
jl @b ;if( (word_n=FkPos[(unsigned char)tex[i].c])>-1 ){ |
mov ecx,eax |
;while(l_pos<ColWords && Col[keyw[l_pos]].Text[0]==Col[keyw[word_n]].Text[0]) |
;while(l_pos<ted_key_words_count && Col[l_pos].Text[0]==Col[word_n].Text[0]) |
.wh_1b: |
cmp ecx,dword[ColWords] |
cmp ecx,ted_key_words_count |
jge .wh_1e |
ColToIndexOffset ecx,esi |
mov bh,byte[esi] |
mov bl,byte[esi] |
ColToIndexOffset eax,esi |
mov bl,byte[esi] |
cmp bh,bl |
cmp bl,byte[esi] |
jne .wh_1e |
inc ecx |
jmp .wh_1b |
.wh_1e: |
mov dword[ebp-4],edx ;bP=i; |
mov edi,1 |
mov dword[begPos],edx ;bP=i; |
mov esi,1 |
.wh_2b: ;while(1){ |
call IteratNext |
;while(l_pos>word_n && Col[keyw[l_pos-1]].Text[pos]!=tex[i].c) |
;while(l_pos>word_n && Col[l_pos-1].Text[pos]!=tex[i].c) |
.wh_3b: |
cmp ecx,eax |
jle .wh_3e |
1458,11 → 1834,8 |
dec ecx |
ColToIndexOffset ecx,ebx |
inc ecx |
;cmp byte[ebx+edi],byte[edx] |
push ax |
mov al,byte[ebx+edi] |
mov bl,al |
pop ax |
;cmp byte[ebx+esi],byte[edx] |
mov bl,byte[ebx+esi] |
cmp bl,byte[edx] |
je .wh_3e |
dec ecx |
1470,66 → 1843,65 |
.wh_3e: |
ColToIndexOffset eax,ebx |
cmp byte[ebx+edi],0 |
jne .if_0 ;if(Col[keyw[word_n]].Text[pos]==0){ |
mov dword[ebp-8],edx ;eP=i; |
ColToIndexOffset eax,esi |
mov bl,byte[esi+MAX_COLOR_WORD_LEN+6] |
mov byte[ebp-13],bl ;f_color=Col[keyw[word_n]].color; |
cmp byte[ebx+esi],0 |
jne .if_0 ;if(Col[word_n].Text[pos]==0){ |
mov dword[endPos],edx ;eP=i; |
ColToIndexOffset eax,ebx |
mov bl,byte[ebx+MAX_COLOR_WORD_LEN+6] |
mov byte[f_color],bl ;f_color=Col[word_n].color; |
mov byte[ebp-12],1 |
;... esi = Col[keyw[word_n]] |
mov bl,byte[esi+MAX_COLOR_WORD_LEN+4] |
cmp bl,0 ;if(Col[keyw[word_n]].wwo) |
mov byte[find],1 |
ColToIndexOffset eax,ebx ;... ebx = Col[word_n] |
mov bl,byte[ebx+MAX_COLOR_WORD_LEN+4] |
cmp bl,0 ;if(Col[word_n].wwo) |
je .if_2n |
push edx |
mov edx,dword[ebp-4] |
mov edx,dword[begPos] |
call IteratPerv |
; mov bh,bl |
btr bx,0 ;1-1 |
jae .if_3e ;if(Col[keyw[word_n]].wwo&1) |
jae .if_3e ;if(Col[word_n].wwo&1) |
;u1= !(isalnum(cont_s)||cont_s=='_') |
call isalnum |
jae .if_3e |
mov byte[ebp-12],0 |
mov byte[find],0 |
.if_3e: |
btr bx,3 ;4-1 |
jae .if_4e ;if(Col[keyw[word_n]].wwo&8) |
jae .if_4e ;if(Col[word_n].wwo&8) |
;u1= !isalpha(cont_s); |
call isalpha |
jae .if_4e |
mov byte[ebp-12],0 |
mov byte[find],0 |
.if_4e: |
mov edx,dword[ebp-8] |
mov edx,dword[endPos] |
; call IteratNext |
btr bx,1 ;2-1 |
jae .if_5e ;if(Col[keyw[word_n]].wwo&2) |
jae .if_5e ;if(Col[word_n].wwo&2) |
;u1= !(isalnum(cont_s)||cont_s=='_') |
call isalnum |
jae .if_5e |
mov byte[ebp-12],0 |
mov byte[find],0 |
.if_5e: |
btr bx,4 ;5-1 |
jae .if_6e ;if(Col[keyw[word_n]].wwo&16) |
jae .if_6e ;if(Col[word_n].wwo&16) |
;u1= !isalpha(cont_s); |
call isalpha |
jae .if_6e |
mov byte[ebp-12],0 |
mov byte[find],0 |
.if_6e: |
btr bx,2 ;3-1 |
jae .if_7e ;if(Col[keyw[word_n]].wwo&4) |
mov bl,byte[esi+MAX_COLOR_WORD_LEN+5] |
jae .if_7e ;if(Col[word_n].wwo&4) |
ColToIndexOffset eax,ebx |
mov bl,byte[ebx+MAX_COLOR_WORD_LEN+5] |
call ItPoNextUc |
cmp edx,[tex_1] |
cmp edx,ted_tex_1 |
jle .if_7e |
mov dword[ebp-8],edx |
mov dword[endPos],edx |
.if_7e: |
pop edx |
1536,27 → 1908,24 |
.if_2n: |
; if(i!=1){ // íå êîíåö äîêóìåíòà |
; cont_s=tex[eP].c; |
; if(Col[keyw[word_n]].wwo&2) u2= !(isalnum(cont_s)||cont_s=='_'); // íå áóêâ.-÷èñë. ñèìâîë |
; if(u2 && Col[keyw[word_n]].wwo&16) u2= !isalpha(cont_s); // íå ÷èñë. ñèìâîë |
; if(Col[keyw[word_n]].wwo&4) eP=ItPoNextUc(eP,Col[keyw[word_n]].endc); |
; if(Col[word_n].wwo&2) u2= !(isalnum(cont_s)||cont_s=='_'); // íå áóêâ.-÷èñë. ñèìâîë |
; if(u2 && Col[word_n].wwo&16) u2= !isalpha(cont_s); // íå ÷èñë. ñèìâîë |
; if(Col[word_n].wwo&4) eP=ItPoNextUc(eP,Col[word_n].endc); |
cmp eax,ecx |
je .wh_2e ;if(word_n==l_pos) break; // do double - åñëè ñëîâî òî÷íî ïîñëåäíåå |
.if_0: |
cmp edx,[tex_1] |
cmp edx,ted_tex_1 |
jle .wh_2e ;if(i==1) break; |
;while(l_pos>word_n && Col[keyw[word_n]].Text[pos]!=tex[i].c) |
;while(l_pos>word_n && Col[word_n].Text[pos]!=tex[i].c) |
.wh_4b: |
cmp ecx,eax |
jle .wh_4e |
ColToIndexOffset eax,ebx |
;cmp byte[ebx+edi],byte[edx] |
push ax |
mov al,byte[ebx+edi] |
mov bl,al |
pop ax |
;cmp byte[ebx+esi],byte[edx] |
mov bl,byte[ebx+esi] |
cmp bl,byte[edx] |
je .wh_4e |
inc eax |
1565,45 → 1934,45 |
cmp eax,ecx |
je .wh_2e;if(word_n==l_pos) break; |
inc edi ;pos++; |
inc esi ;pos++; |
jmp .wh_2b |
.wh_2e: |
cmp byte[ebp-12],1 ;if(fnd)break; |
cmp byte[find],1 ;if(fnd)break; |
je @f |
mov edx,dword[ebp-4];i=bP; |
mov edx,dword[begPos];i=bP; |
jmp @b |
@@: |
cmp byte[ebp-12],1 |
cmp byte[find],1 |
jne .if_1e ;if(fnd){ // âûäåëåíèå íàéäåíîãî òåêñòà |
; if(!mode_sf1 || (mode_sf1 && strlen(Col[keyw[word_n]].f1->c_str())>0)){ |
mov eax,dword[ebp-4] |
mov bl,byte[ebp-13] |
; if(!mode_sf1 || (mode_sf1 && strlen(Col[word_n].f1->c_str())>0)){ |
mov eax,dword[begPos] |
mov bl,byte[f_color] |
mov byte[eax+1],bl ;tex[bP].col=f_color; |
mov eax,dword[ebp-8] |
mov eax,dword[endPos] |
mov byte[eax+1],0xff ;tex[eP].col=255; |
; return ItPoPerv(eP); // âîçâðàùàåì ïîçèöèþ êîíöà âõîæäåíèÿ |
mov edx,dword[ebp-8] |
mov edx,dword[endPos] |
call GetTexPervPos |
jmp @f |
.if_1e: |
mov edx,[tex] |
mov edx,ted_tex |
@@: |
pop edi esi ecx ebx eax |
mov esp,ebp |
pop ebp |
pop esi ecx ebx eax |
ret |
endp |
;input: |
; edx = pointer to char (byte) |
;output: |
; cf=1 if symbol is... |
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 |
align 4 |
tab_all_num db 0,0,0,0,0,0,11111111b,11b,11111110b,0xff,0xff,111b,11111110b,0xff,0xff,111b,0,0,0,0,0,0,0,0;,0,0,0,0,0,0,0,0 - tab_alpha_0,0,0,0,0,0,0,0 |
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 |
;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 |
align 4 |
isalnum: |
push eax ebx |
mov al,byte[edx] ;al=offset |
1614,10 → 1983,11 |
mov ah,byte[ebx] |
mov al,byte[edx] ;al=bit |
and ax,111b |
m2m bx,word[ebx] |
mov bx,word[ebx] |
btr bx,ax |
pop ebx eax |
ret |
align 4 |
isalpha: |
push eax ebx |
mov al,byte[edx] ;al=offset |
1628,15 → 1998,16 |
mov ah,byte[ebx] |
mov al,byte[edx] ;al=bit |
and ax,111b |
m2m bx,word[ebx] |
mov bx,word[ebx] |
btr bx,ax |
pop ebx eax |
ret |
align 4 |
proc ted_show_help_f1, edit:dword |
push eax edx edi |
mov edi,dword[edit] |
ShowHelpF1: |
push eax edx |
call GetPos |
push edx |
call ItNextColorTag |
1644,24 → 2015,27 |
pop edx |
call ItPervColorTag |
cmp eax,[tex] |
cmp eax,ted_tex |
jle @f |
cmp edx,[tex_1] |
cmp edx,ted_tex_1 |
jle @f |
call FindHelpId |
stdcall FindHelpId,eax |
@@: |
pop edx eax |
;stdcall draw_main_cursor, tedit0 |
stdcall draw_help_f1, tedit0 |
;stdcall draw_main_cursor,edi |
stdcall draw_help_f1 |
pop edi edx eax |
ret |
endp |
;input: |
; edx = position begin 'symbol' struct |
; eax = position end 'symbol' struct |
FindHelpId: |
; edi = pointer to tedit struct |
; end_pos = position end 'symbol' struct |
align 4 |
proc FindHelpId, end_pos:dword |
; ecx = word_n |
; ebx = l_pos |
mov [help_id],-1 |
mov ted_help_id,-1 |
push ebx ecx |
xor ebx,ebx |
1671,17 → 2045,17 |
mov ecx,dword[ebx] |
cmp ecx,0 |
jl .if_0e ;if( (word_n=FkPos[(unsigned char)tf[0]])>-1 ){ |
push esi edi |
push esi eax |
mov ebx,ecx ;l_pos=word_n; |
ColToIndexOffset ecx,esi |
push cx |
mov cl,byte[esi] |
@@: |
cmp ebx,dword[ColWords] ;while(l_pos<ColWords |
cmp ebx,ted_key_words_count ;while(l_pos<ted_key_words_count) |
jge @f |
;ColToIndexOffset ecx,esi |
ColToIndexOffset ebx,edi |
cmp cl,byte[edi] ;&& Col[keyw[l_pos]].Text[0]==Col[keyw[word_n]].Text[0]) |
ColToIndexOffset ebx,eax |
cmp cl,byte[eax] ;&& Col[l_pos].Text[0]==Col[word_n].Text[0]) |
jne @f |
inc ebx ;l_pos++; |
jmp @b |
1697,9 → 2071,9 |
cmp ebx,ecx ;while(l_pos>word_n |
jle .wh_0e |
dec ebx |
ColToIndexOffset ebx,edi |
ColToIndexOffset ebx,eax |
inc ebx |
cmp byte[edi+esi],dl ;&& Col[keyw[l_pos-1]].Text[pos]!=tf[i]) |
cmp byte[eax+esi],dl ;&& Col[l_pos-1].Text[pos]!=tf[i]) |
je .wh_0e |
dec ebx ;l_pos--; |
jmp .wh_0b |
1708,8 → 2082,8 |
.wh_1b: |
cmp ebx,ecx ;while(l_pos>word_n |
jle .wh_1e |
ColToIndexOffset ecx,edi |
cmp byte[edi+esi],dl |
ColToIndexOffset ecx,eax |
cmp byte[eax+esi],dl |
je .wh_1e |
inc ecx ;word_n++; |
jmp .wh_1b |
1719,19 → 2093,20 |
cmp ecx,ebx ;if(word_n==l_pos) break; |
je @f |
call IteratNext ;pos++; |
cmp edx,eax ;for(...;i<strlen;...) |
cmp edx,dword[end_pos] ;for(...;i<strlen;...) |
je @f ;jge |
inc esi |
jmp @b |
@@: |
pop edi esi |
pop eax esi |
mov dword[help_id],ecx |
;return keyw[word_n]; |
mov ted_help_id,ecx |
;return word_n; |
.if_0e: |
pop ecx ebx |
ret |
endp |
;----------------------------------------------------------------------------- |
;ôóíêöèÿ äëÿ âûäåëåíèÿ ïàìÿòè |