Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 1456 → Rev 1457

/programs/other/t_edit/t_work.inc
File deleted
/programs/other/t_edit/build_en.bat
6,7 → 6,7
if not exist bin\info mkdir bin\info
copy info\* bin\info\*
 
@fasm.exe -m 16384 ..\..\develop\libraries\box_lib\trunk\box_lib.asm bin\box_lib.obj
if not exist bin\box_lib.obj @fasm.exe -m 16384 ..\..\develop\libraries\box_lib\trunk\box_lib.asm bin\box_lib.obj
@kpack bin\box_lib.obj
 
@erase lang.inc
/programs/other/t_edit/build_ru.bat
6,7 → 6,7
if not exist bin\info mkdir bin\info
copy info\* bin\info\*
 
@fasm.exe -m 16384 ..\..\develop\libraries\box_lib\trunk\box_lib.asm bin\box_lib.obj
if not exist bin\box_lib.obj @fasm.exe -m 16384 ..\..\develop\libraries\box_lib\trunk\box_lib.asm bin\box_lib.obj
@kpack bin\box_lib.obj
 
@erase lang.inc
/programs/other/t_edit/readme.htm
48,7 → 48,7
</head>
 
<body>
<h1>TextEditor âåðñèÿ îò 22.04.2010</h1>
<h1>TextEditor âåðñèÿ îò 29.04.2010</h1>
<h2>Î ïðîãðàììå</h2>
<p>Ïðîãðàììà äëÿ ðàáîòû ñ òåêñòîâûìè ôàéëàìè.
Ëèöåíçèÿ ñâîáîäíàÿ.</p>
73,11 → 73,11
<tr><td>Ïîääåðæêà êîäèðîâîê KOI8M, OEM</td>
<td>åñòü</td><td>íåò</td></tr>
<tr><td>Ïîäñâåòêà ñèíòàêñèñà</td>
<td>ïîäñâåòêà çàðàíåå çàøèòà â ïðîãðàììó</td><td>ïîäñâåòêà áåðåòñÿ èç ôàéëîâ, êîòîðûå ìîæåò óêàçàòü ïîëüçîâàòåëü. Òàêæå åñòü âîçìîæíîñòü ïîëó÷àòü ñïðàâêó ïî ïîäñâå÷èâàåìûì ñëîâàì (åñëè îíà åñòü â ôàéëàõ ïîäñâåòêè, íàâåñòè êóðñîð íà ñëîâî è íàæàòü F1).</td><td></td></tr>
<td>ïîäñâåòêà çàðàíåå çàøèòà â ïðîãðàììó</td><td>ïîäñâåòêà áåðåòñÿ èç ôàéëîâ, êîòîðûå ìîæåò óêàçàòü ïîëüçîâàòåëü. Òàêæå åñòü âîçìîæíîñòü ïîëó÷àòü ñïðàâêó ïî ïîäñâå÷èâàåìûì ñëîâàì (åñëè îíà åñòü â ôàéëàõ ïîäñâåòêè, íàâåñòè êóðñîð íà ñëîâî è íàæàòü F1).</td></tr>
<tr><td>Ìíîãîêðàòíàÿ îòìåíà/ïîâòîð äåéñòâèé</td>
<td>íåò</td><td>åñòü</td><td></td></tr>
<td>íåò</td><td>åñòü</td></tr>
<tr><td>Îãðàíè÷åíèÿ íà ðàçìåð ôàéëîâ</td>
<td>íåò</td><td>åñòü</td><td></td></tr>
<td>íåò</td><td>åñòü</td></tr>
</table>
 
<h2>Íåêîòîðûå íåäîðàáîòêè</h2>
112,22 → 112,9
óäàëåíèÿ ñèìâîëîâ, òåêñò ìîæåò áûòü âîññòàíîâëåí.</p>
<p><b>'col'</b> - èñïîëüçóåòñÿ äëÿ öâåòîâîé ðàçìåòêè.</p>
 
<p>Òåïåðü íåìíîãî î ôóíêöèÿõ:</p>
<p><b>GetTexPervPos</b> - ïåðåõîä íà ïðåäûäóùèé ñèìâîë â öåïè (÷åðåç óêàçàòåëü 'perv')</p>
<p><b>GetTexNextPos</b> - ïåðåõîä íà ñëåäóþùèé ñèìâîë â öåïè (÷åðåç óêàçàòåëü 'next')</p>
<p><b>SymbNotVis</b> - îïðåäåëÿåò âèäèìûé ëè óêàçàííûé ñèìâîë íà ýêðàíå (â çàâèñèìîñòè
îò çíà÷åíèé 'tc' è 'td')</p>
<p><b>IteratNext</b> - ïåðåõîä íà ñëåäóþùèé âèäèìûé ñèìâîë â öåïè. Èñïîëüçóåò äëÿ
ðàáîòû ôóíêöèè GetTexNextPos è SymbNotVis.</p>
<p><b>IteratPerv</b> - ïåðåõîä íà ïðåäåäóùèé âèäèìûé ñèìâîë â öåïè.</p>
<h3>Ôóíêöèè</h3>
<p>Èíôîðìàöèþ ïî ôóíêöèÿì ñìîòðèòå â äîêóìåíòàöèè ïî ýëåìåíòó t_edit â áèáëèîòåêå box_lib.obj.</p>
 
<p><b>ItPoNextUc</b> - íàéòè ñëåäóþùóþ ïîçèöèþ óêàçàííîãî ñèìâîëà (edx-ïîç. íà÷àëà
ïîèñêà, bl->êîä èñêîìîãî ñèìâîëà)</p>
<p><b>GetPosByParam</b> - áåðåò ïîçèöèþ ñèìâîëà ïî êîîðäèíàòàì (esi->êîîðä. x, çíàê;
ecx->êîîðä. y, ñòðîêà)</p>
<p><b>GoToPos</b> - ïåðåñòàâëÿåò êóðñîð â óêàçàííóþ ïîçèöèþ, åñëè óêàçàííàÿ ïîçèöèÿ
íàõîäèòñÿ âíå ýêðàíà, òî òàêæå ïåðåñòàâëÿþòñÿ ñêðîëèíãè (ecx->êîîðä. x, çíàê; edx->êîîðä. y, ñòðîêà)</p>
 
<h3>Ôîðìàò ôàéëà ïîäñâåòêè *.syn</h3>
<table>
<tr><th>Ýëåìåíò</th><th>Ðàçìåð (áàéò)</th></tr>
/programs/other/t_edit/t_button.inc
1,7 → 1,83
struct f70
func_n dd ?
param1 dd ?
param2 dd ?
param3 dd ?
param4 dd ?
rezerv db ?
name dd ?
ends
 
struct TexColViv
Text rb MAX_COLOR_WORD_LEN ; á«®¢® ¤«ï ¯®¤á¢¥âª¨
f1 dd 0 ; á¯à ¢ª  ¯® á«®¢ã
wwo db ? ; whole words only
endc db ? ; ᨬ¢®« ª®­æ  ¢ë¤¥«¥­¨ï (wwo&4)
color db ? ; ­®¬¥à 梥â 
ends
 
struct symbol
c db ? ; +0 ᨬ¢®«
col db ? ; +1 梥â
perv dd ? ; +2
next dd ? ; +6 㪠§ â¥«¨
tc dd ? ; +10 ¢à¥¬. ᮧ¤ ­¨ï
td dd ? ; +14 ¢à¥¬. 㤠«¥­¨ï
ends
 
 
hed db 'TextEditor 29.04.10',0 ;¯®¤¯¨áì ®ª­ 
sc system_colors
 
fn_icon db 'te_icon.bmp',0
bmp_icon dd 0
run_file_70 f70
 
 
;input:
; al = ª®¤ ®è¨¡ª¨
align 4
but_NewFile:
ted_on_init_synt_err:
mov byte[msgbox_3.err],al
stdcall [mb_create],msgbox_3,thread ;message: Can-t open color options file!
ret
 
 
;-----------------------------------------------------------------------------
;äã­ªæ¨ï ¤«ï ¢ë¤¥«¥­¨ï ¯ ¬ïâ¨
;input:
; ecx = size data
;otput:
; eax = pointer to memory
align 4
mem_Alloc:
push ebx
mov eax,68
mov ebx,12
int 0x40
pop ebx
ret
;-----------------------------------------------------------------------------
;äã­ªæ¨ï ¤«ï ®á¢®¡®¦¤¥­¨ï ¯ ¬ïâ¨
;input:
; ecx = pointer to memory
align 4
mem_Free:
push eax ebx
stdcall ted_can_save, tedit0
cmp ecx,0
jz @f
mov eax,68
mov ebx,13
int 0x40
@@:
pop ebx eax
ret
 
align 4
ted_but_new_file:
push eax ebx
stdcall [ted_can_save], tedit0
cmp al,1
jne @f
stdcall [mb_create],msgbox_2,thread ;message: save changes in file?
18,9 → 94,9
 
align 4
On_NewFile:
stdcall ted_clear, tedit0,1
stdcall [ted_clear], tedit0,1
call draw_but_toolbar
stdcall draw_main_win, tedit0
stdcall [ted_draw], tedit0
ret
 
align 4
28,7 → 104,7
push edi
mov edi, tedit0
 
stdcall but_SaveFile,edi
stdcall [ted_but_save_file],edi,run_file_70,[edit1.text]
cmp ted_err_save,0
jne @f
call On_NewFile
36,17 → 112,22
pop edi
ret
 
;description:
; äã­ªæ¨ï ®âªàëâ¨ï ä ©«  ¡¥§ ®ª®­  á®®¡é¥­¨ï
align 4
but_no_msg_OpenFile: ;äã­ªæ¨ï ®âªàëâ¨ï ä ©«  ç¥à¥§ ¡¥§ ®ª®­  á®®¡é¥­¨ï
stdcall ted_on_open_file, tedit0
but_no_msg_OpenFile:
push eax ebx
stdcall [ted_open_file], tedit0,run_file_70,[edit1.text]
call ted_messages_after_open_file
pop ebx eax
ret
 
 
;description:
;äã­ªæ¨ï ®âªàëâ¨ï ä ©«  á ¢®§¬®¦­ë¬ ®ª­®¬ á®®¡é¥­¨ï (® ¢®§¬®¦­®á⨠®â¬¥­¨âì ®âªàë⨥)
align 4
but_OpenFile:
push eax
stdcall ted_can_save, tedit0
ted_but_open_file:
push eax ebx
stdcall [ted_can_save], tedit0
cmp al,1
jne @f
stdcall [mb_create],msgbox_5,thread ;message: save changes in file?
53,28 → 134,19
stdcall [mb_setfunctions],msgbox_5_funct
jmp .ret_f
@@:
stdcall ted_on_open_file, tedit0
stdcall [ted_open_file], tedit0,run_file_70,[edit1.text]
call ted_messages_after_open_file
.ret_f:
pop eax
pop ebx eax
ret
 
;input:
; eax = ª®¤ ®è¨¡ª¨
; ebx = ª®««¨ç¥á⢮ ¯à®ç¨â ­­ëå ¡ ©â
; edi = pointer to tedit struct
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], ted_tex
mov [run_file_70.rezerv], 0
push dword[edit1.text]
pop dword[run_file_70.name]
mov ebx,run_file_70
int 0x40
 
ted_messages_after_open_file:
push ecx
cmp eax,0
je @f
cmp eax,6
93,435 → 165,75
cmp ebx,-1
je .ret_f
;if open file
call OpenFile
cmp ebx,maxChars-2
mov ecx,ted_max_chars
sub ecx,2 ;ecx = ¬ ªá¨¬ «ì­®¥ ç¨á«® ¡ ©â, ¤«ï ª®â®àëå ¡ë«  ¢ë¤¥«¥­  ¯ ¬ïâì
cmp ebx,ecx
jl .ret_f
stdcall [mb_create],msgbox_1,thread
.ret_f:
pop edi ebx eax
pop ecx
ret
endp
 
 
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,ted_tex
xor ecx,ecx
@@:
call IteratNext
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
inc ecx
jmp @b
@@:
 
cmp ecx,0
je @f
pop eax
mov [run_file_70.param4],eax
push eax
mov eax,70
mov [run_file_70.func_n], 2
mov [run_file_70.param1], 0
mov [run_file_70.param2], 0
mov [run_file_70.param3], ecx
mov [run_file_70.rezerv], 0
push [edit1.text]
pop [run_file_70.name]
mov ebx,run_file_70
int 0x40
 
mov ted_err_save,ax
 
cmp eax,0
je .no_msg
; cmp eax,6
; je @f
cmp ax,10
jl .zifra_0_9
mov al,'?'
sub ax,48
.zifra_0_9:
add ax,48
 
ted_save_err_msg:
mov byte[msgbox_6.err],al
stdcall [mb_create],msgbox_6,thread ;message: Can-t save text file!
jmp @f
.no_msg:
m2m ted_tim_ls,ted_tim_ch
@@:
 
pop ecx
call mem_Free
.no_save:
popad
ret
endp
 
 
align 4
proc but_FindText, edit:dword
pushad
mov edi,dword[edit]
 
call GetPos
mov eax,[edit2.text]
mov bl,byte[eax]
@@:
call GetFindRezult
cmp bh,1
je @f ; find
 
call IteratNext
cmp edx,ted_tex_1
jle @f
jmp @b
@@:
cmp bh,0
je @f
call GetTexCoords
inc ebx ;move cursor right
mov ted_sel_x1,ebx
mov ted_sel_y1,eax
mov edx,eax
mov ecx,ebx
call GoToPos
mov edx,esi ;esi ¡ë«® ãáâ ­®¢«¥® ¢ GetFindRezult
call GetTexCoords
mov ted_sel_x0,ebx
mov ted_sel_y0,eax
stdcall draw_main_win,edi
jmp .end_find
@@:
stdcall [mb_create],msgbox_7,thread ;message: Can not find text
.end_find:
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)
; esi - first symbol pointer
;description:
; ”ã­ªæ¨ï ¯à®¢¥àï¥â ᮢ¯ ¤ ¥â «¨ ⥪áâ ¢ ¡ãä¥à¥ eax
; á ⥪á⮬ । ªâ®à  ¯® 㪠§ â¥«î edx.
; ‘â ­¤ àâ­ë¥ ä㭪樨 (­ ¯à. strcmp) âãâ ­¥ ¯®¤®©¤ãâ, ¯®â®¬ã çâ®
; ¢ ¯ ¬ï⨠। ªâ®à  ⥪áâ ᮤ¥à¦¨âáï ­¥ ¢ ¢¨¤¥ ascii áâப.
align 4
GetFindRezult:
push eax
mov bh,1
mov esi,edx ;copy edx
@@:
cmp byte[edx],bl
jne .no_text
 
inc eax ;*** get next symbol (in find text) ***
mov bl,byte[eax]
cmp bl,0
je @f ;end of find text
 
call IteratNext ;*** get next symbol (in editor text) ***
cmp edx,ted_tex_1
jle @f ;end of editor text
 
jmp @b
.no_text:
xor bh,bh
mov edx,esi ;restore edx
@@:
pop eax
mov bl,byte[eax] ;restore bl
ret
 
align 4
proc ted_but_open_syntax, edit:dword
push edi
push ebx edi
mov edi,dword[edit]
 
cmp ted_panel_id,TE_PANEL_SYNTAX
cmp ted_panel_id,TED_PANEL_SYNTAX
jne @f
stdcall dword[tl_node_get_data], tree1
pop dword[fn_col_option]
stdcall InitColText,edi
call CmColored
stdcall draw_main_win,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
stdcall [ted_init_syntax_file],edi,run_file_70,file_name
call [ted_text_colored]
stdcall [ted_draw],edi
@@:
pop edi
pop edi ebx
ret
endp
 
align 4
proc ted_but_select_word, edit:dword
pushad
mov edi,dword[edit]
 
call GetPos
push edx
call ItPervColorTag
cmp edx,ted_tex_1
jle @f
call GetTexCoords
mov ted_sel_x0,ebx
mov ted_sel_y0,eax
@@:
pop edx
call ItNextColorTag
cmp edx,ted_tex_1
jle @f
call GetTexCoords
mov ted_sel_x1,ebx
mov ted_sel_y1,eax
@@:
 
call draw_but_toolbar
stdcall draw_main_win,edi
popad
ret
endp
 
align 4
proc ted_but_cut, edit:dword
proc ted_but_find ;¢ë§®¢/áªàë⨥ ¯ ­¥«¨ ¯®¨áª 
push edi
mov edi,dword[edit]
mov edi,tedit0
 
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,edi
@@:
pop edi
ret
endp
 
;output:
; al = 1 if copy text
align 4
proc ted_but_copy, edit:dword
pushad
mov edi,dword[edit]
 
stdcall IsSel,edi
cmp al,0
je .end_f ;if not selected text
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
mov esi,ebx
 
xor ecx,ecx
mov ebx,buf
;mov edx,ted_tex
@@:
cmp edx,ted_tex_1 ;end of file
jle @f
cmp edx,esi ;end of select
cmp ted_panel_id,TED_PANEL_NULL
je @f
inc ecx
cmp ecx,BUF_SIZE ;owerflow bufer
je @f
 
mov al,byte[edx]
mov byte[ebx],al
inc ebx
 
call IteratNext
jmp @b
@@:
add ecx,buf
mov byte[ebx],0
 
cmp ecx,0
je .end_f
call draw_but_toolbar
stdcall draw_bufer,edi
.end_f:
popad
ret
endp
 
 
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
stdcall ted_set_undo,edi
mov esi,eax
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,edi
@@:
pop edi esi ebx eax
ret
endp
 
align 4
proc but_find, edit:dword ;¢ë§®¢/áªàë⨥ ¯ ­¥«¨ ¯®¨áª 
push edi
mov edi,dword[edit]
 
cmp ted_panel_id,TE_PANEL_NULL
je @f
mov ted_panel_id,TE_PANEL_NULL
mov ted_panel_id,TED_PANEL_NULL
mov ted_wnd_l,0
jmp .e_if
@@:
mov ted_panel_id,TE_PANEL_FIND
mov ted_wnd_l,TE_PANEL_WIDTH
mov ted_panel_id,TED_PANEL_FIND
mov ted_wnd_l,TED_PANEL_WIDTH
.e_if:
stdcall EvSize,edi
stdcall draw_main_win,edi
stdcall [ted_draw],edi
pop edi
ret
endp
 
align 4
but_replace:
ted_on_find_err:
stdcall [mb_create],msgbox_7,thread ;message: Can not find text
ret
 
align 4
but_find_key_w:
but_replace:
ret
 
align 4
proc but_sumb_upper, edit:dword
push edi esi
mov edi,dword[edit]
 
mov [conv_table],EvUpper
call ConvertSelText
cmp esi,0
je @f
stdcall draw_main_win,edi
@@:
pop esi edi
but_find_key_w:
ret
endp
 
align 4
proc but_sumb_lover, edit:dword
push edi esi
mov edi,dword[edit]
 
mov [conv_table],EvLover
call ConvertSelText
cmp esi,0
je @f
stdcall draw_main_win,edi
@@:
pop esi edi
ret
endp
 
align 4
proc but_reverse, edit:dword
push eax ebx edi
mov edi,dword[edit]
 
stdcall IsSel,edi
cmp al,0
je @f
stdcall SelNormalize,edi
push esi ecx edx
mov esi,ted_seln_x0
mov ecx,ted_seln_y0
call GetPosByParam
mov eax,edx
mov esi,ted_seln_x1
cmp esi,0
je .beg_str
dec esi
.beg_str:
mov ecx,ted_seln_y1
call GetPosByParam
;call GetTexPervPos
mov ebx,edx
pop edx ecx esi
;cmp eax,...
;je @f
call Revers
@@:
stdcall draw_main_win,edi
pop edi ebx eax
ret
endp
 
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
stdcall draw_main_win,edi
call draw_but_toolbar
@@:
pop edi eax
ret
endp
 
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
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]
528,7 → 240,7
 
xor ted_mode_invis,1
call draw_but_toolbar
stdcall draw_main_win,edi
stdcall [ted_draw],edi
pop edi
ret
endp
541,153 → 253,30
xor ted_mode_color,1
cmp ted_mode_color,0
je @f
call CmColored
call [ted_text_colored]
@@:
call draw_but_toolbar
stdcall draw_main_win,edi
stdcall [ted_draw],edi
pop edi
ret
endp
 
 
;input:
; edi = pointer to tedit struct
align 4
but_CtrlHome:
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,edi
ret
 
align 4
proc but_synt_show, edit:dword
push edi
mov edi,[edit]
 
cmp ted_panel_id,TE_PANEL_NULL
cmp ted_panel_id,TED_PANEL_NULL
je @f
mov ted_panel_id,TE_PANEL_NULL
mov ted_panel_id,TED_PANEL_NULL
mov ted_wnd_l,0
jmp .e_if
@@:
mov ted_panel_id,TE_PANEL_SYNTAX
mov ted_wnd_l,TE_PANEL_WIDTH
mov ted_panel_id,TED_PANEL_SYNTAX
mov ted_wnd_l,TED_PANEL_WIDTH
.e_if:
stdcall EvSize,edi
stdcall draw_main_win,edi
stdcall [ted_draw],edi
pop edi
ret
endp
 
align 4
proc ted_sel_key_up, edit:dword
push edi
mov edi,dword[edit]
 
cmp ted_drag_k,1
je @f
stdcall SelStart,edi
mov ted_drag_k,1
@@:
push dx
call CurMoveUp
cmp dl,8
jne @f
call OnInitialUpdate
@@:
pop dx
stdcall SelMove,edi
stdcall draw_main_win,edi
pop edi
ret
endp
 
align 4
proc ted_sel_key_down, edit:dword
push edi
mov edi,dword[edit]
 
cmp ted_drag_k,1
je @f
stdcall SelStart,edi
mov ted_drag_k,1
@@:
push dx
call CurMoveDown
cmp dl,8
jne @f
call OnInitialUpdate
@@:
pop dx
stdcall SelMove,edi
stdcall draw_main_win,edi
pop edi
ret
endp
 
align 4
proc ted_sel_key_left, edit:dword
push edi
mov edi,dword[edit]
 
cmp ted_drag_k,1
je @f
stdcall SelStart,edi
@@:
push dx
call CurMoveLeft
stdcall SelMove,edi
cmp ted_drag_k,1
je @f
mov ted_drag_k,1
mov dl,8
@@:
cmp dl,8
jne @f
call OnInitialUpdate
stdcall draw_main_win,edi
jmp .end_f
@@:
stdcall draw_cur_line,edi
.end_f:
pop dx
pop edi
ret
endp
 
align 4
proc ted_sel_key_right, edit:dword
push edi
mov edi,dword[edit]
 
cmp ted_drag_k,1
je @f
stdcall SelStart,edi
@@:
push dx
call CurMoveRight
stdcall SelMove,edi
cmp ted_drag_k,1
je @f
mov ted_drag_k,1
mov dl,8
@@:
cmp dl,8
jne @f
call OnInitialUpdate
stdcall draw_main_win,edi
jmp .end_f
@@:
stdcall draw_cur_line,edi
.end_f:
pop dx
pop edi
ret
endp
/programs/other/t_edit/t_data.inc
72,6 → 72,32
tl_node_close_open dd sz_tl_node_close_open
tl_node_lev_inc dd sz_tl_node_lev_inc
tl_node_lev_dec dd sz_tl_node_lev_dec
 
ted_but_save_file dd sz_ted_but_save_file
ted_but_sumb_upper dd sz_ted_but_sumb_upper
ted_but_sumb_lover dd sz_ted_but_sumb_lover
ted_can_save dd sz_ted_can_save
ted_clear dd sz_ted_clear
ted_delete dd sz_ted_delete
ted_draw dd sz_ted_draw
ted_init dd sz_ted_init
ted_init_syntax_file dd sz_ted_init_syntax_file
ted_is_select dd sz_ted_is_select
ted_key dd sz_ted_key
ted_mouse dd sz_ted_mouse
ted_open_file dd sz_ted_open_file
ted_text_add dd sz_ted_text_add
ted_but_select_word dd sz_ted_but_select_word
ted_but_cut dd sz_ted_but_cut
ted_but_copy dd sz_ted_but_copy
ted_but_paste dd sz_ted_but_paste
ted_but_undo dd sz_ted_but_undo
ted_but_redo dd sz_ted_but_redo
ted_but_reverse dd sz_ted_but_reverse
ted_but_find_next dd sz_ted_but_find_next
ted_text_colored dd sz_ted_text_colored
;;;version_text_edit dd sz_ted_version
 
dd 0,0
 
aEdit_box_draw db 'edit_box',0
119,6 → 145,31
sz_tl_node_close_open db 'tl_node_close_open',0
sz_tl_node_lev_inc db 'tl_node_lev_inc',0
sz_tl_node_lev_dec db 'tl_node_lev_dec',0
 
sz_ted_but_save_file db 'ted_but_save_file',0
sz_ted_but_sumb_upper db 'ted_but_sumb_upper',0
sz_ted_but_sumb_lover db 'ted_but_sumb_lover',0
sz_ted_can_save db 'ted_can_save',0
sz_ted_clear db 'ted_clear',0
sz_ted_delete db 'ted_delete',0
sz_ted_draw db 'ted_draw',0
sz_ted_init db 'ted_init',0
sz_ted_init_syntax_file db 'ted_init_syntax_file',0
sz_ted_is_select db 'ted_is_select',0
sz_ted_key db 'ted_key',0
sz_ted_mouse db 'ted_mouse',0
sz_ted_open_file db 'ted_open_file',0
sz_ted_text_add db 'ted_text_add',0
sz_ted_but_select_word db 'ted_but_select_word',0
sz_ted_but_cut db 'ted_but_cut',0
sz_ted_but_copy db 'ted_but_copy',0
sz_ted_but_paste db 'ted_but_paste',0
sz_ted_but_undo db 'ted_but_undo',0
sz_ted_but_redo db 'ted_but_redo',0
sz_ted_but_reverse db 'ted_but_reverse',0
sz_ted_but_find_next db 'ted_but_find_next',0
sz_ted_text_colored db 'ted_text_colored',0
;;;sz_ted_version db 'version_text_edit',0
;--------------------------------------------------
align 4
msgbox_lib_import:
275,10 → 326,10
.get_mouse_flag dd 0 ;+116
;-------------------------
 
TE_PANEL_NULL equ 0
TE_PANEL_FIND equ 1
TE_PANEL_SYNTAX equ 2
TE_PANEL_WIDTH equ 150 ;øèðèíà ïàíåëè
TED_PANEL_NULL equ 0 ;­¥â ®âªàë⮩ ¯ ­¥«¨
TED_PANEL_FIND equ 1 ;¯ ­¥«ì ¯®¨áª 
TED_PANEL_SYNTAX equ 2 ;¯ ­¥«ì ¢ë¡®à  ä ©«®¢ ¯®¤á¢¥âª¨
TED_PANEL_WIDTH equ 150 ;è¨à¨­  ¯ ­¥«¨
 
count_of_dir_list_files equ 15
 
290,75 → 341,6
y1 dd ?
ends
;------------------------------------------------------------------------------
ted_wnd_l equ dword[edi+ 0] ;®ª­® । ªâ®à : ®âáâ㯠᫥¢ 
ted_wnd_t equ dword[edi+ 4] ;®ª­® । ªâ®à : ®âáâ㯠ᢥàåã
ted_wnd_w equ dword[edi+ 8] ;®ª­® । ªâ®à : è¨à¨­ 
ted_wnd_h equ dword[edi+12] ;®ª­® । ªâ®à : ¢ëá®â 
ted_rec_l equ dword[edi+16] ;è¨à¨­  ¯ ­¥«¨ ¢ ®ª­¥
ted_rec_t equ dword[edi+20] ;¢ëá®â  ¯ ­¥«¨ ¢ ®ª­¥
ted_rec_w equ dword[edi+24] ;è¨à¨­  ᨬ¢®«  (§­ ª®¬¥áâ ) ¢ ®ª­¥
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
370,12 → 352,9
.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
.cur_x dd 0 ;+78 ª®®à¤¨­ â  x ªãàá®à 
.cur_y dd 0 ;+82 ª®®à¤¨­ â  y ªãàá®à 
.max_chars dd maxChars ;+86 ¬ ªá¨¬ «ì­®¥ ç¨á«® ᨬ¢®«®¢ ¢ ®¤­®¬ ¤®ªã¬¥­â¥
; \/ ­¥ à §à뢠âì á«¥¤ãî騥 ¯¥à¥¬¥­­ë¥:
.count_colors_text dd 1 ;+90 ª®««¨ç¥á⢮ 梥⮢ ⥪áâ 
.count_key_words dd 0 ;+94 ª®««¨ç¥á⢮ ª«î祢ëå á«®¢
388,7 → 367,7
.color_wnd_text dd 0xffff00 ;+122 梥â ⥪áâ  ¢ ®ª­¥
; /\ ¤à㣨¥, ¨¤ã騥 ­¨¦¥ ¬®¦­® à §à뢠âì.
.syntax_file dd 0 ;+126 㪠§ â¥«ì ­  ­ ç «® ä ©«  ᨭ⠪á¨á 
.syntax_file_end dd 0 ;+130 㪠§ â¥«ì ­  ª®­¥æ ä ©«  ᨭ⠪á¨á 
.syntax_file_size dd maxSyntaxFileSize ;+130 ¬ ªá¨¬ «ì­ë© à §¬¥à ä ©«  ᨭ⠪á¨á 
.text_colors dd 0 ;+134 㪠§ â¥«ì ­  ¬ áᨢ 梥⮢ ⥪áâ 
.help_text_f1 dd 0 ;+138 㪠§ â¥«ì ­  ⥪áâ á¯à ¢ª¨ (¯® ­ ¦ â¨¨ F1)
.help_id dd -1 ;+142 ¨¤¥­â¨ä¨ª â®à ¤«ï á¯à ¢ª¨
398,22 → 377,39
.tim_ls dd ? ;+158 ¢à¥¬ï ¯®á«¥¤­¥£® á®åà ­¥­¨ï
.tim_co dd ? ;+162 ¢à¥¬ï ¯®á«¥¤­¥© 梥⮢®© à §¬¥âª¨
.el_focus dd el_focus ;+166 㪠§ â¥«ì ­  ¯¥à¥¬¥­­ãî í«¥¬¥­â  ¢ 䮪ãá¥
.err_save dw 0 ;+170 ®è¨¡ª  á®åà ­¥­¨ï ä ©« 
.err_save db 0 ;+170 ®è¨¡ª  á®åà ­¥­¨ï ä ©« 
.panel_id db 0 ;+171 ­®¬¥à ®âªàë⮩ ¯ ­¥«¨
.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 ­®¬¥à ®âªàë⮩ ¯ ­¥«¨
.arr_key_pos dd 0 ;+182 㪠§ â¥«ì ­  ¬ áᨢ ¯®§¨æ¨© ª«î祢ëå á«®¢
.buffer dd buf ;+186 㪠§ â¥«ì ­  ¡ãä¥à ª®¯¨à®¢ ­¨ï/¢áâ ¢ª¨
.buffer_find dd buf_find ;+190 㪠§ â¥«ì ­  ¡ãä¥à ¤«ï ¯®¨áª 
.cur_ins db 1 ;+194 ०¨¬ à ¡®âë ªãàá®à  (®¡ëç­ë© ¨«¨ § ¬¥­ )
.mode_color db 1 ;+195 ०¨¬ ¢ë¤¥«¥­¨ï á«®¢ 梥⮬ (0-¢ëª«. 1-¢ª«.)
.mode_invis db 0 ;+196 ०¨¬ ¯®ª §  ­¥¯¥ç â ¥¬ëå ᨬ¢®«®¢
.gp_opt db 0 ;+197 ®¯æ¨¨ ¢®§¢à é ¥¬ë¥ ä㭪樥© ted_get_pos_by_cursor
.fun_on_key_ctrl_o dd ted_but_open_file ;+198 㪠§ â¥«ì ­  äã­ªæ¨î ¢ë§ë¢ ¥¬ãî ¯à¨ ­ ¦ â¨¨ Ctrl+O (®âªàë⨥ ä ©« )
.fun_on_key_ctrl_f dd ted_but_find ;+202 ... Ctrl+F (¢ë§®¢ /áªàëâ¨ï ¯ ­¥«¨ ¯®¨áª )
.fun_on_key_ctrl_n dd ted_but_new_file ;+206 ... Ctrl+N (ᮧ¤ ­¨¥ ­®¢®£® ¤®ªã¬¥­â )
.fun_on_key_ctrl_s dd 0 ;+210 ... Ctrl+S
.buffer_size dd BUF_SIZE ;+214 à §¬¥à ¡ãä¥à  ª®¯¨à®¢ ­¨ï/¢áâ ¢ª¨
.fun_find_err dd ted_on_find_err ;+218 㪠§ â¥«ì ­  äã­ªæ¨î ¢ë§ë¢ ¥¬ãî ¥á«¨ ¯®¨áª § ª®­ç¨«áï ­¥ã¤ ç­®
.fun_init_synt_err dd ted_on_init_synt_err ;+222 㪠§ â¥«ì ­  äã­ªæ¨î ¢ë§ë¢ ¥¬ãî ¯à¨ ®è¨¡®ç­®¬ ®âªàë⨨ ä ©«  ᨭ⠪á¨á 
.fun_draw_panel_buttons dd draw_but_toolbar ;+226 㪠§ â¥«ì ­  äã­ªæ¨î à¨á®¢ ­¨ï ¯ ­¥«¨ á ª­®¯ª ¬¨
.fun_draw_panel_find dd draw_panel_find ;+230 㪠§ â¥«ì ­  äã­ªæ¨î à¨á®¢ ­¨ï ¯ ­¥«¨ ¯®¨áª 
.fun_draw_panel_syntax dd draw_panel_syntax ;+234 㪠§ â¥«ì ­  äã­ªæ¨î à¨á®¢ ­¨ï ¯ ­¥«¨ ᨭ⠪á¨á 
.fun_save_err dd ted_save_err_msg ;+238 㪠§ â¥«ì ­  äã­ªæ¨î ¢ë§ë¢ ¥¬ãî ¥á«¨ á®åà ­¥­¨¥ ä ©«  § ª®­ç¨«®áì ­¥ã¤ ç­®
;------------------------------------------------------------------------------
 
FkPos: rd 256
conv_tabl rb 128 ; â ¡«¨æ  ¤«ï ª®­¢¥àâ¨à®¢ ­¨ï scan-ª®¤  ¢ ascii-ª®¤
buf db BUF_SIZE dup(0)
 
 
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,\
16,16, 0x8080ff,0x0000ff,0xffffff, 0,70,TE_PANEL_WIDTH-17,120, 0,0,0, el_focus,\
16,16, 0x8080ff,0x0000ff,0xffffff, 0,70,TED_PANEL_WIDTH-17,120, 0,0,0, el_focus,\
ws_dir_lbox,0
 
;dir_list memory
426,7 → 422,6
 
dir_mem rb 32+304*count_of_dir_list_files
 
 
if lang eq ru
 
menu_text_area:
525,11 → 520,6
txtFindNext db ' ©â¨ ¤ «¥¥',0
txtFormatCapt db '”®à¬ â',0
txtFormatApply db 'à¨¬¥­¨âì',0
txtRow db '‘âப ',0
txtCol db '‡­ ª',0
txtOtm db 'Žâ¬¥­ë',0
txtBuf db 'ãä¥à: '
buf db BUF_SIZE dup(0) ;buf âñåãäà ïîñëå txtBuf
 
else
 
629,67 → 619,10
txtFindNext db 'Find next',0
txtFormatCapt db 'Format',0
txtFormatApply db 'Apply',0
txtRow db 'Rows',0
txtCol db 'Cols',0
txtOtm db 'Undo',0
txtBuf db 'Buffer: '
buf db BUF_SIZE dup(0) ;buf always after txtBuf
 
end if
;------
align 4
EvChar db 0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0
db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 
EvUpper db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79
db 80,81,82,83,84,85,86,87,88,89,90,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
EvLover db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111
db 112,113,114,115,116,117,118,119,120,121,122,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
conv_table dd 0
 
 
KM_SHIFT equ 0x00010000
KM_CTRL equ 0x00020000
KM_ALT equ 0x00040000
/programs/other/t_edit/t_draw.inc
1,133 → 1,6
align 4
proc mouse_wnd_main, edit:dword
push eax ebx ecx edi
mcall 37,2 ;get mouse buttons
 
mov edi,dword[edit]
 
cmp al,1
jne @f
mcall 37,1 ;get mouse coords
mov ebx,ted_wnd_t
add ebx,ted_rec_t
cmp ax,bx
jl @f ;y_mouse<y_wnd
 
sub ebx,ted_rec_t
add ebx,ted_wnd_h
cmp bx,ax
jl @f ;y_mouse>y_wnd
 
mov ebx,ted_wnd_l
add ebx,ted_rec_l
mov ecx,eax
shr ecx,16
cmp cx,bx
jl @f ;x_mouse<x_wnd
 
sub ebx,ted_rec_l
add ebx,ted_wnd_w
cmp bx,cx
jl @f ;x_mouse>x_wnd
 
stdcall draw_cursor_sumb, tedit0
call wnd_main_click
jmp .no_in_wnd
@@:
call wnd_main_mouse_scroll
cmp ted_drag_m,0
je .no_in_wnd
mov ted_drag_m,0
call draw_but_toolbar
stdcall draw_main_win, tedit0
.no_in_wnd:
pop edi ecx ebx eax
ret
endp
 
;input:
; eax -> (x,y)
; edi -> óêàçàòåëü íà ñòðóêòóðó tedit
;description:
; ôóíêöèÿ âûçûâåòñÿ ïðè íàæàòèè êíîïêîé ìûøè è ïîïàäåíèè êóðñîðîì â îêíî ðåäàêòîðà
align 4
wnd_main_click:
push ecx edx
 
push eax
shr eax,16
and eax,0xffff
sub eax,ted_wnd_l
sub eax,ted_rec_l
 
xor edx,edx
mov ecx,ted_rec_w
div cx
;inc eax
cmp eax,[hScr.cur_area]
jle @f
mov eax,[hScr.cur_area]
@@:
;dec eax
mov ted_cur_x,eax
pop eax
 
push eax
and eax,0xffff
sub eax,ted_wnd_t
sub eax,ted_rec_t
 
xor edx,edx
mov ecx,ted_rec_h
div cx
inc eax
cmp eax,[wScr.cur_area]
jle @f
mov eax,[wScr.cur_area]
@@:
dec eax
mov ted_cur_y,eax
pop eax
 
cmp ted_drag_m,0
je @f
stdcall SelMove,edi
jmp .sel_move
@@:
mov ted_drag_m,1
stdcall SelStart,edi
.sel_move:
pop edx ecx
ret
 
align 4
wnd_main_mouse_scroll:
push eax ebx
mcall 37,7
cmp ax,0
je .no_scroll
mov ebx,dword[wScr.position] ;copy old scroll position
and eax,0xffff
btr ax,15
jae @f
or eax,0xffff8000
@@:
add dword[wScr.position],eax
 
mov eax,[wScr.position]
cmp eax,[wScr.max_area]
jb @f
mov dword[wScr.position],ebx ;if scroll position out of range
jmp .no_scroll
@@:
stdcall draw_main_win, tedit0
.no_scroll:
pop ebx eax
ret
 
align 4
draw_but_toolbar: ;âíåøíÿÿ ôóíêöèÿ äëÿ ðèñîâàíèÿ ïàíåëè èíñòðóìåíòîâ
push ebx ecx edx edi
draw_but_toolbar: ;ôóíêöèÿ äëÿ ðèñîâàíèÿ ïàíåëè èíñòðóìåíòîâ
pushad
mov edi,tedit0
 
mov ecx,0x40000000
140,7 → 13,7
mov edx,110*65536+2
call draw_but_icon
 
stdcall ted_can_save,edi
stdcall [ted_can_save],edi
cmp al,1
je @f
and ecx,0xffff
155,7 → 28,7
mov edx,85*65536+25
call draw_but_icon
 
stdcall IsSel,edi
call [ted_is_select]
cmp al,0
jne @f
and ecx,0xffff
176,7 → 49,7
mov edx,290*65536+25
call draw_but_icon
 
inc cx ; Reverse
inc cx ; reverse
mov edx,315*65536+25
call draw_but_icon
or ecx,0x40000000
233,262 → 106,26
mov edx,450*65536+25
call draw_but_icon
 
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]
mov ebx,dword[coords] ;ebx = x*2^16+y coords to left up point clear line
mov esi,dword[numb_lin] ;esi - number text line
 
sub ebx,0x10001 ;îòíèìàåì îòñòóïû äëÿ âûðàâíèâàíèÿ áóêâû ïî öåíòðó
cmp dword[clear_o],0
jne @f
add ebx,ted_rec_h
inc esi
ror ebx,16
xor bx,bx
add ebx,ted_wnd_l
add ebx,ted_rec_l ;bx = ted_wnd_l+ted_rec_l
ror ebx,16
@@:
 
mov eax,ted_wnd_h
add eax,ted_wnd_t
cmp ax,bx
jl .no_clear
sub ax,bx
 
mov cx,bx
shl ecx,16
 
xor bx,bx
add ebx,ted_wnd_w
sub ebx,ted_rec_l
xor cx,cx
add ecx,ted_rec_h
mov edx,ted_color_wnd_work
 
cmp dword[clear_o],0
je .pusto
cmp ax,cx
jge @f
.pusto:
mov cx,ax
@@:
 
stdcall IsSel,edi
cmp al,0
je @f
cmp ted_seln_y0,esi
jg @f
cmp ted_seln_y1,esi
jl @f
mov edx,ted_color_select ;draw selected line
@@:
 
mov eax,13 ;rect
int 0x40
 
stdcall IsSel,edi
cmp al,0
je .no_clear
 
mov al,13 ;rect
xor cx,cx
add ecx,ted_rec_h
cmp ted_seln_y0,esi
jne @f
push bx
mov edx,ted_seln_x0 ; âåðõíÿÿ ïîëîñà (çàòèðàåò ñëåâà)
cmp edx,[hScr.position]
jle .in_wnd
sub edx,[hScr.position]
imul edx,ted_rec_w
mov bx,dx
jmp .no_wnd
.in_wnd:
mov bx,0
.no_wnd:
mov edx,ted_color_wnd_work
int 0x40
pop bx
@@:
cmp ted_seln_y1,esi
jne @f
mov edx,ted_seln_x1 ; íèæíÿÿ ïîëîñà (çàòèðàåò ñïðàâà)
cmp edx,[hScr.position]
jle .in_wnd2
sub edx,[hScr.position]
imul edx,ted_rec_w
sub bx,dx
shl edx,16
add ebx,edx
.in_wnd2:
 
mov edx,ted_color_wnd_work
int 0x40
@@:
 
.no_clear:
popad
ret
endp
 
align 4
proc draw_main_win, edit:dword
locals
line_num dd ?
endl
pushad
mov edi,dword[edit]
 
mov eax,4 ;draw text
mov ecx,ted_text_colors
mov ecx,dword[ecx]
 
mov ebx,ted_wnd_l
add ebx,ted_rec_l
shl ebx,16
add ebx,ted_wnd_t
add ebx,ted_rec_t
add ebx,0x10001 ;äîáàâëÿåì îòñòóïû äëÿ âûðàâíèâàíèÿ áóêâû ïî öåíòðó
 
stdcall SelNormalize,edi ;need before draw select
mov esi,[wScr.position]
mov dword[line_num],esi
 
stdcall clear_line_before_draw, edi,ebx,1,esi
call GetFirstVisiblePos
cmp edx,0
je .no_draw_text
mov esi,1 ;äëèííà âûâîäèìîãî òåêñòà ïî 1-ìó ñèìâîëó
@@:
call IteratNext
cmp edx,ted_tex_1
jle .no_draw_text
 
; *** öâåòîâàÿ ðàçìåòêà
cmp ted_mode_color,0
je .no_col_change
cmp byte[edx+1],0
je .no_col_change
call GetSymbColor
.no_col_change:
 
cmp byte [edx],13
jne .no_13
cmp ted_mode_invis,1
jne .no_invis
push edx
mov edx,edi
add edx,ted_offs_symbol_new_line
int 0x40
pop edx
.no_invis:
add ebx,ted_rec_h
;optimized output \/
mov eax,ted_wnd_h
add eax,ted_wnd_t
cmp bx,ax
jg .no_draw_text
mov eax,4
;optimized output /\
and ebx,0xffff
ror ebx,16
add ebx,ted_wnd_l
add ebx,ted_rec_l
inc ebx
ror ebx,16
inc dword[line_num] ;increment line number
stdcall clear_line_before_draw,edi,ebx,1,dword[line_num]
call OptDrawLineLeft
jmp @b
.no_13:
 
int 0x40
ror ebx,16
add ebx,ted_rec_w
mov esi,ted_wnd_l
add esi,ted_wnd_w
cmp bx,si
jl .no_opt
call OptDrawLineRight
.no_opt:
mov si,1
ror ebx,16
jmp @b
.no_draw_text:
 
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
; In some cases it is necessity to draw only the area
; of moving of a "runner", for acceleration of output -
; in this case the flag needs to be reset to 0 (zero).
xor eax,eax
inc eax
mov [wScr.all_redraw],eax
mov [hScr.all_redraw],eax
 
; draw for Vertical ScrollBar
stdcall [scrollbar_ver_draw], dword wScr
stdcall [scrollbar_hor_draw], dword hScr
; reset all_redraw flag
xor eax,eax
mov [wScr.all_redraw],eax
mov [hScr.all_redraw],eax
;---------------------------------------------
 
mov eax,13
;left-bottom square
mov ebx,ted_wnd_l
shl ebx,16
add ebx,ted_rec_l
mov ecx,ted_wnd_t
add ecx,ted_wnd_h
shl ecx,16
mov cx,word[hScr.size_y]
inc cx
mov edx,[sc.work]
int 0x40
 
;right-bottom square
mov ebx,ted_wnd_l
add ebx,ted_wnd_w
shl ebx,16
mov bx,word[wScr.size_x]
inc bx
int 0x40
 
stdcall draw_panel_find, edi
stdcall draw_panel_syntax, edi
popad
ret
endp
 
;txtBUp db 24
;txtBDn db 25
;txtBRi db 26
;txtBLe db 27
 
;input:
; edi = pointer to tedit struct
align 4
proc draw_panel_find, edit:dword
push edi
mov edi,dword[edit]
 
cmp ted_panel_id,TE_PANEL_FIND ;if not panel
proc draw_panel_find
;push edi
;mov edi,dword[edit]
cmp ted_panel_id,TED_PANEL_FIND ;if not panel
jne @f
push eax ebx ecx edx
 
mov eax,13 ;ðèñîâàíèå ïðÿìîóãîëüíèêà
mov ebx,TE_PANEL_WIDTH
mov ebx,TED_PANEL_WIDTH
mov ecx,ted_wnd_t
shl ecx,16
mov cx,20
506,12 → 143,13
stdcall [edit_box_draw], dword edit2
 
mov eax,13 ;ðèñîâàíèå ïðÿìîóãîëüíèêà
mov ebx,TE_PANEL_WIDTH
mov ebx,TED_PANEL_WIDTH
mov ecx,ted_wnd_t
add cx,20+15 ; 15 - height text box
shl ecx,16
add ecx,ted_wnd_h
add cx,word[hScr.size_y]
mov edx,ted_scr_h
add cx,word[edx+sb_offs_size_y]
sub cx,20+15-1 ; 15 - height text box
mov edx,[sc.work]
int 0x40
544,22 → 182,22
int 0x40
pop edx eax
.end_f:
pop edi
;pop edi
ret
endp
 
 
;input:
; edi = pointer to tedit struct
align 4
proc draw_panel_syntax, edit:dword
push edi
mov edi,dword[edit]
 
cmp ted_panel_id,TE_PANEL_SYNTAX ;if not panel
proc draw_panel_syntax
;push edi
;mov edi,dword[edit]
cmp ted_panel_id,TED_PANEL_SYNTAX ;if not panel
jne @f
push eax ebx ecx edx
pushad
 
mov eax,13 ;ðèñîâàíèå ïðÿìîóãîëüíèêà
mov ebx,TE_PANEL_WIDTH
mov ebx,TED_PANEL_WIDTH
mov ecx,ted_wnd_t
shl ecx,16
mov cx,20
576,7 → 214,8
and ecx,0xffff
ror ecx,16
add ecx,ted_wnd_h
add cx,word[hScr.size_y]
mov esi,ted_scr_h
add cx,word[esi+sb_offs_size_y]
sub cx,20
sub ecx,dword[tree1.box_height]
inc cx
607,7 → 246,7
mov edx,txtFormatApply
int 0x40
 
pop edx ecx ebx eax
popad
jmp .end_f
@@:
push eax edx
617,94 → 256,24
int 0x40 ;åñëè íåò ïàíåëè òî óäàëÿåì êíîïêó
pop edx eax
.end_f:
pop edi
;pop edi
ret
endp
 
 
align 4
proc draw_cur_line, edit:dword
pushad
mov edi,dword[edit]
 
mov ebx,ted_wnd_l
add ebx,ted_rec_l
shl ebx,16
mov eax,ted_cur_y
imul eax,ted_rec_h
mov bx,ax
add ebx,ted_wnd_t
add ebx,ted_rec_t ;ebx - êîîðäèíàòû äëÿ ïðÿìîóãîëüíèêà î÷èñòêè ëèíèè
add ebx,0x10001 ;äîáàâëÿåì îòñòóïû äëÿ âûðàâíèâàíèÿ áóêâû ïî öåíòðó
 
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
 
mov esi,[hScr.position]
call GetPosByParam
 
cmp ted_gp_opt,2
jne .no_draw_text
; mov eax,4 ;draw text
call GetSymbColor
mov esi,1 ;draw 1 symbol
@@:
;call IteratNext
cmp edx,ted_tex_1
jle .no_draw_text
 
; *** öâåòîâàÿ ðàçìåòêà
cmp ted_mode_color,0
je .no_col_change
cmp byte[edx+1],0
je .no_col_change
call GetSymbColor
.no_col_change:
 
mov eax,4 ;draw text
cmp byte [edx],13
jne .no_13
cmp ted_mode_invis,1
jne .no_draw_text
push edx
mov edx,edi
add edx,ted_offs_symbol_new_line
int 0x40
pop edx
jmp .no_draw_text
.no_13:
 
int 0x40
ror ebx,16
add ebx,ted_rec_w
mov eax,ted_wnd_w
add eax,ted_wnd_l ;ax = îòñòóï ïî îñè x
cmp bx,ax
jge .no_draw_text ;Opt
ror ebx,16
call IteratNext
jmp @b
.no_draw_text:
 
stdcall draw_main_cursor,edi
popad
ret
endp
 
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
pushad
mov edi,dword[edit]
mov ebx,ted_scr_h
mov esi,ted_scr_w
 
m2m ted_wnd_w,[procinfo.client_box.width] ;ñòàâèì øèðèíó îêíà ðåäàêòîðà ðàâíîé øèðèíå âñåãî îêíà
mov eax,ted_wnd_l
sub ted_wnd_w,eax ;îòíèìàåì îòñòóï ñëåâà
mov eax,[wScr] ;+0 size_x
mov eax,dword[esi+sb_offs_size_x]
and eax,0xffff
sub ted_wnd_w,eax ;îòíèìàåì øèðèíó âåðò. ñêðîëëèíãà
 
714,11 → 283,11
mov ted_wnd_h,MIN_M_WND_H
@@:
 
mov ax,word[hScr.size_y]
mov ax,word[ebx+sb_offs_size_y]
and eax,0xffff
sub ted_wnd_h,eax ;îòíèìàåì âûñîòó ãîðèç. ñêðîëëèíãà
mov eax,ted_wnd_h ;eax = âûñîòà îêíà - âûñîòà ãîðèç. ñêðîëëèíãà
mov word[hScr.start_y],ax ;ïåðåäâèãàåì ãîðèç. ñêðîëëèíã
mov word[ebx+sb_offs_start_y],ax ;ïåðåäâèãàåì ãîðèç. ñêðîëëèíã
mov eax,ted_wnd_t
sub ted_wnd_h,eax ;îòíèìàåì îòñòóï ñâåðõó
 
725,15 → 294,15
mov eax,ted_wnd_w
mov ecx,ted_wnd_l
add eax,ecx
mov word[wScr.start_x],ax ;ïåðåäâèãàåì âåðò. ñêðîëëèíã
mov word[esi+sb_offs_start_x],ax ;ïåðåäâèãàåì âåðò. ñêðîëëèíã
mov eax,ted_wnd_h
mov word[wScr.size_y],ax ;çàäàåì âûñîòó âåðò. ñêðîëëèíãà
mov word[esi+sb_offs_size_y],ax ;çàäàåì âûñîòó âåðò. ñêðîëëèíãà
 
add ecx,ted_rec_l ;ecx=ted_wnd_l+ted_rec_l
mov [hScr.start_x],cx ;ñäâèãàåì ãîðèç. ñêðîëëèíã ïî ðàçìåðó ëåâîãî îòñòóïà äëÿ öèôð
mov word[ebx+sb_offs_start_x],cx ;ñäâèãàåì ãîðèç. ñêðîëëèíã ïî ðàçìåðó ëåâîãî îòñòóïà äëÿ öèôð
mov eax,ted_wnd_w
sub eax,ted_rec_l
mov word[hScr.size_x],ax ;çàäàåì øèðèíó ãîðèç. ñêðîëëèíãà
mov word[ebx+sb_offs_size_x],ax ;çàäàåì øèðèíó ãîðèç. ñêðîëëèíãà
 
mov eax,ted_wnd_h ;calculate lines in page
sub eax,ted_rec_t
744,7 → 313,7
jg @f
mov eax,MIN_W_SCRL_ARE
@@:
mov [wScr.cur_area],eax
mov dword[esi+sb_offs_cur_area],eax
 
mov eax,ted_wnd_w ;calculate cols in page
sub eax,ted_rec_l
756,7 → 325,7
mov eax,MIN_H_SCRL_ARE
@@:
dec eax ; ???
mov [hScr.cur_area],eax
mov dword[ebx+sb_offs_cur_area],eax
 
mov eax,ted_wnd_t
mov edi,dword tree1
766,558 → 335,11
mov dword[edit2.top],eax ;=ted_wnd_t
add dword[edit2.top],20
 
pop edi edx ecx eax
call OnInitialUpdate
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,ted_tex
xor ecx,ecx
@@:
cmp ecx,[wScr.position]
je @f
call IteratNext
cmp edx,ted_tex_1
jle @f
cmp byte [edx],13
jne @b
inc ecx
jmp @b
@@:
 
cmp ecx,[wScr.position]
je @f
xor edx,edx
@@:
cmp ecx,[wScr.max_area]
jle @f
mov [wScr.max_area],ecx
@@:
pop ecx
call OptDrawLineLeft
ret
 
 
 
;input:
; edx = pointer to symbol
; edi = pointer to tedit struct
;output:
; 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,ted_tex
jne @f
call IteratNext
jmp .beg_cycle
@@:
 
cmp ebx,0
je @f
 
cmp byte[edx],13
jne @f
call IteratNext
.beg_cycle:
@@:
cmp edx,ted_tex_1
jle @f
cmp byte[edx],13
je @f
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 ebx
jmp @b
@@:
mov edx,eax
pop eax
.ret_f:
call GetSymbColor
pop ebx
ret
endp
 
;input:
; edx = pointer to symbol
; edi = pointer to tedit struct
;output:
; edx = pointer to 13 symbol
align 4
proc OptDrawLineRight
push eax
mov eax,edx
@@:
cmp edx,ted_tex_1
jle @f
cmp byte[edx],13
je @f
mov eax,edx
call IteratNext
jmp @b
@@:
mov edx,eax ;perv sumbol
call GetSymbColor
 
pop eax
ret
endp
 
align 4
proc draw_main_cursor, edit:dword
pushad
mov edi,dword[edit]
 
mov eax,13 ;draw cursor
mov ecx,ted_wnd_t ;calc rect -> y0,y1
add ecx,ted_rec_t
mov edx,ted_cur_y
imul edx,ted_rec_h
add ecx,edx
 
cmp ted_cur_ins,1 ;ïðîâåðêà ðåæèìà ðàáîòû êóðñîðà (îáû÷íûé èëè âñòàâêà)
jne @f
mov edx,ted_rec_h
inc edx ;1->1, 3->2, 5->3, ...
shr edx,1 ;edx = âûñîòà ñòðîêè äåëåííàÿ íà 2 (êîãäà êóðñîð íå ïîëíûé)
add ecx,edx
@@:
shl ecx,16
add ecx,ted_rec_h
cmp ted_cur_ins,1
jne @f
shr cx,1 ;äåëèì âûñîòó êóðñîðà íà 2
@@:
 
mov ebx,ted_wnd_l ;calc rect -> x0,x1
add ebx,ted_rec_l
mov edx,ted_cur_x
imul edx,ted_rec_w
add ebx,edx
shl ebx,16
add ebx,ted_rec_w
 
mov edx,ted_color_cursor
int 0x40 ;âûâîä êóðñîðà
 
call GetPos
cmp ted_gp_opt,2
jne @f
mov eax,4 ;draw text
mov esi,1
ror ecx,16
mov bx,cx
add ebx,0x10001
cmp ted_cur_ins,1
jne .no_up_tetx
mov ecx,ted_rec_h
inc cx ; 1->1, 3->2, 5->3, ...
shr cx,1
sub bx,cx
.no_up_tetx:
mov ecx,ted_color_cur_text
call ConvertInvisSymb
int 0x40
@@:
 
mov eax,4
mov ebx,ted_wnd_l
add ebx,ted_rec_l
shl ebx,16
add ebx,ted_wnd_t
add ebx,3
mov ecx,ted_color_wnd_bord
or ecx,0x80000000
mov edx,txtRow
int 0x40 ;âûâîä ïîäïèñè 'Ñòðîêà'
 
add ebx,0x500000
mov edx,txtCol
int 0x40 ;âûâîä ïîäïèñè 'Çíàê'
 
cmp ted_tim_undo,0
je @f
add ebx,0x500000
mov edx,txtOtm
int 0x40
sub ebx,0x500000
@@:
 
stdcall draw_bufer,edi
stdcall draw_help_f1
 
mov eax,47 ;draw cursor coords
mov esi,ted_color_wnd_bord
or esi,0x40000000
 
mov edx,ebx
ror edx,16
sub edx,35
ror edx,16
;add edx,3
mov ebx,0x40000 ;Row=...
mov ecx,ted_cur_y
inc ecx
add ecx,[wScr.position]
 
push edi
mov edi,ted_color_wnd_work
int 0x40 ;âûâîä ÷èñëà òåêóùåé ñòðîêè
pop edi
 
;mov ebx,0x40000 ;Col=...
mov ecx,ted_cur_x
inc ecx
add ecx,[hScr.position]
add edx,0x500000
push edi
mov edi,ted_color_wnd_work
int 0x40 ;âûâîä ÷èñëà çíàêîâ
pop edi
 
cmp ted_tim_undo,0
je @f
mov ecx,ted_tim_undo
add edx,0x500000
int 0x40
@@:
 
popad
ret
endp
 
align 4
proc draw_bufer, edit:dword
pushad
mov edi,dword[edit]
 
cmp byte[buf],0
je @f
mov ebx,ted_wnd_l
add ebx,ted_rec_l
add bx,250
shl ebx,16
add ebx,ted_wnd_t
add ebx,3
mov ecx,ted_color_wnd_bord
or ecx,0x40000000
mov edi,ted_color_wnd_work
mov edx,txtBuf
mov esi,buf
call strlen
if lang eq ru
cmp eax,15
jle .crop_buf
mov eax,15
.crop_buf:
mov esi,7 ;7=len(txtBuf)
else
cmp eax,14
jle .crop_buf
mov eax,14
.crop_buf:
mov esi,8 ;8=len(txtBuf)
end if
add esi,eax
 
mov eax,4
int 0x40
@@:
popad
ret
endp
 
;input:
; edi = pointer to tedit struct
align 4
proc draw_help_f1
pushad
 
mov eax,13 ;clear place before draw help
mov ebx,ted_wnd_l
add ebx,ted_rec_l
shl ebx,16
add ebx,ted_wnd_w
sub ebx,ted_rec_l
mov ecx,ted_wnd_t
add ecx,13
shl ecx,16
add ecx,ted_rec_h
mov edx,ted_color_wnd_capt
int 0x40
 
cmp ted_help_id,-1
je @f
mov eax,ted_help_id
ColToIndexOffset eax,edx
 
;SetCoordinates
mov ebx,ted_wnd_l
add ebx,ted_rec_l
shl ebx,16
add ebx,ted_wnd_t
add ebx,13 ;=3+10
 
;SetTextColor
xor eax,eax
mov al,byte[edx+MAX_COLOR_WORD_LEN+6]
shl ax,2
mov ecx,ted_text_colors
add ecx,eax
mov ecx,dword[ecx]
or ecx,0xc0000000 ;SetTextStyles
mov esi,edi
mov edi,ted_color_wnd_work
mov eax,4
int 0x40
mov edi,esi
 
;*** draw help string ***
mov ecx,ted_color_wnd_bord
or ecx,0x80000000
mov edx,dword[edx+MAX_COLOR_WORD_LEN]
cmp edx,0
je @f
add edx,ted_help_text_f1
add ebx,0x500000
int 0x40
@@:
popad
ret
endp
 
align 4
proc draw_line_numbers, edit:dword
pushad
mov edi,dword[edit]
 
;top panel with caption
mov ebx,ted_wnd_l
; add ebx,ted_rec_l
shl ebx,16
add ebx,ted_wnd_w
; sub ebx,ted_rec_l
mov edx,ted_color_wnd_work
mov ecx,ted_wnd_t
shl ecx,16
add ecx,ted_rec_t
mov eax,13
mov edx,ted_color_wnd_capt
int 0x40
 
;line numbers
mov ebx,0x40000 ;format
mov ecx,[wScr.position]
inc ecx
mov edx,3
add edx,ted_wnd_l
rol edx,16
add edx,ted_wnd_t
add edx,ted_rec_t
@@:
 
push ebx ecx edx
;left panel with numbers
mov ebx,ted_wnd_l
shl ebx,16
add ebx,ted_rec_l
mov ecx,ted_rec_h
rol ecx,16
mov cx,dx
rol ecx,16
mov eax,13
mov edx,ted_color_wnd_capt
int 0x40 ;ðèñóåì ïðÿìîóãîëüíèê ïîä íîìåðîì ñòðîêè
pop edx ecx ebx
 
mov eax,47
mov esi,ted_color_wnd_bord
int 0x40 ;ðèñóåì íîìåð ñòðîêè
inc ecx
add edx,ted_rec_h
sub edx,ted_wnd_t
mov esi,edx
and esi,0xffff
cmp esi,ted_wnd_h
jge @f
add edx,ted_wnd_t
jmp @b
@@:
 
popad
ret
endp
;this function need to optimize output
align 4
proc draw_cursor_sumb, edit:dword
push eax ecx edx edi
mov edi,dword[edit]
 
mov eax,13 ;rect
mov ebx,ted_wnd_l
add ebx,ted_rec_l
mov edx,ted_cur_x
imul edx,ted_rec_w
add ebx,edx
shl ebx,16
add ebx,ted_rec_w
 
mov ecx,ted_wnd_t ;calc rect -> y0,y1
add ecx,ted_rec_t
mov edx,ted_cur_y
imul edx,ted_rec_h
add ecx,edx
shl ecx,16
add ecx,ted_rec_h
 
mov edx,ted_color_wnd_work
push ecx
stdcall SelNormalize,edi
 
mov ecx,[wScr.position]
sub ted_seln_y0,ecx
sub ted_seln_y1,ecx
 
mov ecx,ted_cur_y
cmp ecx,ted_seln_y0
jl .no_cur_sel
cmp ecx,ted_seln_y1
jg .no_cur_sel
mov edx,ted_color_select
cmp ecx,ted_seln_y0
jne @f
mov ecx,ted_cur_x
add ecx,[hScr.position]
cmp ecx,ted_seln_x0
jge @f
mov edx,ted_color_wnd_work
@@:
 
mov ecx,ted_cur_y
cmp ecx,ted_seln_y1
jne .no_cur_sel
mov ecx,ted_cur_x
add ecx,[hScr.position]
cmp ecx,ted_seln_x1
jl .no_cur_sel
mov edx,ted_color_wnd_work
 
.no_cur_sel:
pop ecx
int 0x40
 
call GetPos
cmp ted_gp_opt,2
jne @f
push esi
mov eax,4 ;draw text
mov esi,1
ror ecx,16
mov bx,cx
add ebx,0x10001
call GetSymbColor
call ConvertInvisSymb
int 0x40
pop esi
@@:
 
pop edi edx ecx eax
ret
endp
 
 
;input:
; edx -> pointer to text
; edi -> óêàçàòåëü íà ñòðóêòóðó tedit
;output:
; ecx = color
; if ted_mode_color=0 then ecx=ted_color_wnd_text
align 4
GetSymbColor:
mov ecx,ted_color_wnd_text ;çàäàåì öâåò òåêñòà ïî óìîë÷àíèþ
 
push eax edx
cmp ted_mode_color,0
je .exit
jmp .on_first
@@:
call IteratPerv
cmp edx,ted_tex_1
jle .exit
.on_first:
xor eax,eax
mov al,byte[edx+1]
cmp al,0 ;åñëè al=0 òî öâåò íå ìåíÿåòñÿ
je @b
 
cmp eax,ted_colors_text_count
jge .exit
 
shl ax,2 ;óìíîæàåì èíäåêñ öâåòà íà 4 áàéòà
mov ecx,ted_text_colors ;ïðèáàâëÿåì ñìåùåíèå 1-ãî öâåòà
add ecx,eax
mov ecx,dword[ecx] ;óñòàíàâëèâàåì òåêóùèé öâåò òåêñòà ïî ñìåùåíèþ
.exit:
pop edx eax
ret
 
;input:
; edx = pointer to text
; edi = pointer to tedit struct
align 4
ConvertInvisSymb:
cmp ted_mode_invis,1
jne @f
cmp byte [edx],13
jne @f
mov edx,edi
add edx,ted_offs_symbol_new_line
@@:
ret
 
;input:
; ecx = 0x4000____
; cx = icon index
; edx = x*2^16+y
1334,16 → 356,23
shl ecx,16
mov cx,19 ;=20-1
mov bx,19 ;=20-1
mov esi,ebx
shr esi,16
add esi,20
cmp esi,[procinfo.client_box.width]
jge @f ;êíîïêà íå âëåçëà â ýêðàí
mov esi,[sc.work_button]
int 0x40
int 0x40 ;ñòàâèì êíîïêó
mov eax,7 ;bmp
@@:
pop esi edx ecx
 
cmp eax,7
jne @f ;êíîïêà íå âëåçëà â ýêðàí
mov ebx,ecx
ror ebx,16
cmp bx,0x4000
jne @f
 
mov eax,7 ;bmp
mov ebx,[bmp_icon]
push ecx
and ecx,0xffff
1352,9 → 381,8
mov ecx,20
shl ecx,16
add ecx,20
int 0x40
int 0x40 ;ñòàâèì ðèñóíîê íà êíîïêó
pop ecx
 
@@:
pop ebx eax
ret
/programs/other/t_edit/t_edit.asm
16,8 → 16,8
 
MAX_COLOR_WORD_LEN equ 40
maxChars equ 100002 ;(...+2)
BUF_SIZE equ 1000 ;bufer for copy|paste
maxColWords equ 10000
BUF_SIZE equ 1000 ;buffer for copy|paste
maxSyntaxFileSize equ 410000
 
include '../../proc32.inc'
include '../../macros.inc'
27,9 → 27,8
include 'lang.inc'
include 't_data.inc'
include 'strlen.inc'
include 't_work.inc' ;text work functions
include 't_draw.inc' ;draw main window functions
include 't_button.inc'
include 't_button.inc' ;text work functions
 
@use_library
 
37,15 → 36,16
start:
mcall 48,3,sc,sizeof.system_colors
 
m2m [wScr.bckg_col],[sc.work]
m2m [wScr.frnt_col],[sc.work_button]
m2m [wScr.line_col],[sc.work_button_text]
mov eax,[sc.work]
mov [wScr.bckg_col],eax
mov [hScr.bckg_col],eax
mov eax,[sc.work_button]
mov [wScr.frnt_col],eax
mov [hScr.frnt_col],eax
mov eax,[sc.work_button_text]
mov [wScr.line_col],eax
mov [hScr.line_col],eax
 
m2m [hScr.bckg_col],[sc.work]
m2m [hScr.frnt_col],[sc.work_button]
m2m [hScr.line_col],[sc.work_button_text]
 
 
mcall 68,11
or eax,eax
jz button.exit
75,7 → 75,7
@@:
 
;---------------------------------------------------------------------
stdcall ted_init, tedit0
stdcall [ted_init], tedit0
stdcall dword[tl_data_init], tree1
;---------------------------------------------------------------------
 
174,7 → 174,10
.end_dir_init:
 
;--- load color option file ---
stdcall InitColText, tedit0
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
stdcall [ted_init_syntax_file], tedit0,run_file_70,file_name
 
;--- get cmd line ---
cmp byte[buf_cmd_lin+3],0 ;buf_cmd_lin
202,7 → 205,7
mcall 9,procinfo,-1
stdcall EvSize,edi
 
mov eax,13 ;âåðõíèé ïðÿìîóãîëüíèê, äëÿ î÷èñòêè âåðõíåé ïàíåëè
mov eax,13 ;¢¥àå­¨© ¯àאַ㣮«ì­¨ª, ¤«ï ®ç¨á⪨ ¢¥àå­¥© ¯ ­¥«¨
xor ebx,ebx
mov ecx,ted_wnd_t
mov bx,word [procinfo.client_box.width]
234,7 → 237,7
 
cmp [err_ini0],1
je @f
stdcall draw_main_win, tedit0
stdcall [ted_draw], tedit0
@@:
 
mcall 12,2
263,53 → 266,13
test word [edit1.flags],10b;ed_focus ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬
jne still
 
;-----------------------------------------------
cmp [hScr.delta2],0
jne .horizontal
.vertical:
mov eax,[wScr.max_area]
cmp eax,[wScr.cur_area]
jbe .horizontal
; mouse event for Vertical ScrollBar
stdcall [scrollbar_ver_mouse], dword wScr
mov eax,wScr.redraw
xor ebx,ebx
cmp [eax],ebx
je @f
mov [eax],ebx
stdcall [ted_mouse], tedit0
 
stdcall draw_main_win, tedit0
jmp still
@@:
cmp [wScr.delta2],0
jne still
.horizontal:
mov eax,[hScr.max_area]
cmp eax,[hScr.cur_area]
jbe .other
; mouse event for Horizontal ScrollBar
push dword hScr
call [scrollbar_hor_mouse]
mov eax,hScr.redraw
xor ebx,ebx
cmp [eax],ebx
je .other
mov [eax],ebx
stdcall draw_main_win, tedit0
jmp still
.other:
cmp [wScr.delta2],0
jne still
cmp [hScr.delta2],0
jne still
 
stdcall mouse_wnd_main, tedit0
 
cmp byte[tedit0.panel_id],TE_PANEL_FIND ;if not panel
cmp byte[tedit0.panel_id],TED_PANEL_FIND ;if not panel
jne @f
stdcall [edit_box_mouse], dword edit2
@@:
cmp byte[tedit0.panel_id],TE_PANEL_SYNTAX ;if not panel
cmp byte[tedit0.panel_id],TED_PANEL_SYNTAX ;if not panel
jne .menu_bar_1 ;@f
stdcall [tl_mouse], tree1
;-----------------------------------------------
324,15 → 287,15
je button.exit
cmp [menu_data_1.cursor_out],dword 3
jne @f
stdcall but_SaveFile, tedit0
stdcall [ted_but_save_file], tedit0,run_file_70,[edit1.text]
@@:
cmp [menu_data_1.cursor_out],dword 2
jne @f
call but_OpenFile
call ted_but_open_file
@@:
cmp [menu_data_1.cursor_out],dword 1
jne @f
call but_NewFile
call ted_but_new_file
@@:
;cmp [menu_data_1.cursor_out],dword 0
;jne @f
357,29 → 320,30
align 4
key:
mcall 66,3 ;66.3 ¯®«ãç¨âì á®áâ®ï­¨¥ ã¯à ¢«ïîé¨å ª« ¢¨è
xor ebx,ebx
xor esi,esi
mov ecx,1
test al,0x03 ;[Shift]
jz @f
mov cl,2
or ebx,KM_SHIFT
or esi,KM_SHIFT
@@:
test al,0x0c ;[Ctrl]
jz @f
or ebx,KM_CTRL
or esi,KM_CTRL
@@:
test al,0x30 ;[Alt]
jz @f
mov cl,3
or ebx,KM_ALT
or esi,KM_ALT
@@:
test al,0x80 ;[NumLock]
jz @f
or ebx,KM_NUMLOCK
or esi,KM_NUMLOCK
@@:
 
mcall 26,2,,conv_tabl ;26.2 ¯®«ãç¨âì à áª« ¤ªã ª« ¢¨ âãàë
mcall 2 ;¯®«ãç ¥¬ ª®¤ ­ ¦ â®© ª« ¢¨è¨
;stdcall [tl_key], tree1 ;???
;stdcall [tl_key], tree1
 
test word [edit1.flags],10b;ed_focus ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬
je @f
421,9 → 385,10
jmp still
@@:
 
stdcall ted_key, tedit0, conv_tabl
stdcall [ted_key], tedit0, conv_tabl,esi
jmp still
 
align 4
button:
; cmp [menu_active],1 ;¥á«¨ ­ ¦ «¨ ¬¥­î, â® á­ ç «  ॠªæ¨ï ­  ¬¥­î
; jne @f ;mouse.menu_bar_1
434,35 → 399,35
mcall 17 ;¯®«ãç¨âì ª®¤ ­ ¦ â®© ª­®¯ª¨
cmp ah,3
jne @f
call but_NewFile
call ted_but_new_file
@@:
cmp ah,4
jne @f
call but_OpenFile
call ted_but_open_file
@@:
cmp ah,5
jne @f
stdcall but_SaveFile, tedit0
stdcall [ted_but_save_file], tedit0,run_file_70,[edit1.text]
@@:
cmp ah,6
jne @f
stdcall ted_but_select_word, tedit0
stdcall [ted_but_select_word], tedit0
@@:
cmp ah,7
jne @f
stdcall ted_but_cut, tedit0
stdcall [ted_but_cut], tedit0
@@:
cmp ah,8
jne @f
stdcall ted_but_copy, tedit0
stdcall [ted_but_copy], tedit0
@@:
cmp ah,9
jne @f
stdcall ted_but_paste, tedit0
stdcall [ted_but_paste], tedit0
@@:
cmp ah,10
jne @f
stdcall but_find, tedit0
call ted_but_find
@@:
cmp ah,11
jne @f
474,23 → 439,23
@@:
cmp ah,13
jne @f
stdcall but_sumb_upper, tedit0
stdcall [ted_but_sumb_upper], tedit0
@@:
cmp ah,14
jne @f
stdcall but_sumb_lover, tedit0
stdcall [ted_but_sumb_lover], tedit0
@@:
cmp ah,15
jne @f
stdcall but_reverse, tedit0
stdcall [ted_but_reverse], tedit0
@@:
cmp ah,16
jne @f
stdcall ted_but_undo, tedit0
stdcall [ted_but_undo], tedit0
@@:
cmp ah,17
jne @f
stdcall ted_but_redo, tedit0
stdcall [ted_but_redo], tedit0
@@:
cmp ah,18
jne @f
511,13 → 476,13
@@:
cmp ah,201
jne @f
stdcall but_FindText, tedit0
stdcall [ted_but_find_next], tedit0
@@:
 
cmp ah,1
jne still
.exit:
stdcall ted_can_save, tedit0
stdcall [ted_can_save], tedit0
cmp al,1
jne @f
stdcall [mb_create],msgbox_8,thread ;message: save changes in file?
526,7 → 491,7
mov ecx,[bmp_icon]
call mem_Free
 
stdcall ted_delete, tedit0
stdcall [ted_delete], tedit0
stdcall dword[tl_data_clear], tree1
mcall -1 ;¢ë室 ¨§ ¯à®£à ¬¬ë
 
536,7 → 501,7
err_ini0 db 0
 
edit1 edit_box 250, 220, 5, 0xffffff, 0xff80, 0xff0000, 0xff, 0x4080, 300, buf_cmd_lin, mouse_dd, 0
edit2 edit_box TE_PANEL_WIDTH-1, 0, 20, 0xffffff, 0xff80, 0xff0000, 0xff, 0x4080, 300, buf_find, mouse_dd, 0
edit2 edit_box TED_PANEL_WIDTH-1, 0, 20, 0xffffff, 0xff80, 0xff0000, 0xff, 0x4080, 300, buf_find, mouse_dd, 0
 
buf_cmd_lin db 302 dup(0)
buf_find db 302 dup(0)