't_edit' use system buffer (function 54)

git-svn-id: svn://kolibrios.org@4228 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2013-11-14 10:59:09 +00:00
parent 79585a5d9b
commit 96c7d6c310
3 changed files with 84 additions and 20 deletions

View File

@ -1,6 +1,6 @@
; ¬ ªà®á ¤«ï á¨á⥬­®© ¡¨¡«¨®â¥ª¨ box_lib.obj
; í«¥¬¥­â TextEditor ¤«ï Kolibri OS
; ä ©« ¯®á«¥¤­¨© à § ¨§¬¥­ï«áï 20.06.2012 IgorA
; ä ©« ¯®á«¥¤­¨© à § ¨§¬¥­ï«áï 13.11.2013 IgorA
; ­  ª®¤ ¯à¨¬¥­¥­  GPL2 «¨æ¥­§¨ï
;input:
@ -2512,9 +2512,11 @@ proc ted_but_copy, edit:dword
call ted_get_pos_by_coords
mov esi,ebx
xor ecx,ecx
mov ecx,12 ;system buffer header size
mov ebx,ted_buffer
;mov edx,ted_tex
mov dword[ebx+4],0 ;text data
mov dword[ebx+8],1 ;code 866
add ebx,ecx
@@:
cmp edx,ted_tex_1 ;end of file
jle @f
@ -2536,6 +2538,10 @@ proc ted_but_copy, edit:dword
cmp ecx,0
je .end_f
mov ebx,ted_buffer
mov eax,ted_buffer_size
mov dword[ebx],eax
mcall 54,2,ted_buffer_size,ted_buffer
call ted_draw_buffer
cmp ted_fun_draw_panel_buttons,0
je .end_f
@ -2548,13 +2554,66 @@ endp
align 4
proc ted_but_paste, edit:dword
push eax ebx esi edi
pushad
mov edi,dword[edit]
mcall 54,0
cmp eax,1
jl .no_buf_r
mov esi,eax
.cycle: ;®¡à â­ë© 横« ¯® ᫮⠬
dec esi ;­®¬¥à ⥪ã饣®, ¯à®¢¥à塞®£® á«®â 
mcall 54,1,esi ;read system buffer
cmp eax,1
je .no_buf_r
cmp eax,-1
je .no_buf_r
mov ecx,dword[eax]
cmp ecx,1 ;size
jl .no_buf_r
cmp dword[eax+4],0 ;text
je @f
cmp esi,1
jge .cycle ;¥á«¨ ¢ ¡ãä¥à¥ ­¥ ⥪áâ,   ᫮⮢ ¢ ¡ãä¥à¥ ­¥áª®«ìª®, ¯à®¡ã¥¬ ¯¥à¥©â¨ ª ¢¥àå­¥¬ã á«®âã
jmp .no_buf_r
@@:
cmp dword[eax+8],1 ;866
je @f
cmp esi,1
jge .cycle ;¥á«¨ ¢ ¡ãä¥à¥ ⥪áâ ­¥ ¢ ª®¤¨à®¢ª¥ 866 ... ¯à®¡ã¥¬ ¯¥à¥©â¨ ª ¢¥àå­¥¬ã á«®âã
jmp .no_buf_r
@@:
;ª®¯¨à®¢ ­¨¥ ⥪áâ  ¨§ á¨á⥬­®£® ¡ãä¥à  ¢® ¢­ãâ७­¨©
cmp ecx,ted_buffer_size
jle @f
mov ecx,ted_buffer_size
@@:
mov edi,ted_buffer
mov esi,eax
add esi,4 ;12
mov dword[edi],ecx
add edi,4 ;12
sub ecx,4 ;12
rep movsb
mov edi,dword[edit]
mov esi,eax
add esi,12
jmp .buf_r
.no_buf_r:
;¥á«¨ ­¥ 㤠«®áì ¯à®ç¨â âì ¤ ­­ë¥ ¨§ á¨á⥬­®£® ¡ãä¥à , ¯®¯ ¤ ¥¬ á
mov esi,ted_buffer
cmp dword[esi],1 ;¯à®¢¥à塞 ¥áâì «¨ ¤ ­­ë¥ ¢® ¢­ãâ७­¥¬ ¡ãä¥à¥
jl .no_paste ;¥á«¨ ¢®®¡é¥ ­¨ç¥£® ­¥ 㤠«®áì ¯à®ç¨â âì ¨¤¥¬ ­  ¢ë室
add esi,12 ;system buffer header size
.buf_r:
mov edx,esi
call tl_strlen
cmp eax,1
jl @f
jl .no_paste
mov esi,eax
call ted_set_undo
mov ebx,ted_opt_ed_change_time+ted_opt_ed_move_cursor
@ -2563,13 +2622,13 @@ proc ted_but_paste, edit:dword
jne .del
mov ebx,ted_opt_ed_move_cursor
.del:
stdcall ted_text_add,edi,ted_buffer,esi,ebx
stdcall ted_text_add,edi,edx,esi,ebx
stdcall ted_draw,edi
cmp ted_fun_draw_panel_buttons,0
je @f
je .no_paste
call ted_fun_draw_panel_buttons
@@:
pop edi esi ebx eax
.no_paste:
popad
ret
endp
@ -3249,8 +3308,8 @@ proc ted_draw_buffer
pushad
mov eax,ted_buffer
cmp byte[eax],0 ;ᬮâਬ 1-© ᨬ¢®« ¨§ ¡ãä¥à 
je @f
cmp dword[eax],1 ;ᬮâਬ à §¬¥à ¡ãä¥à 
jl @f
mov ebx,ted_rec_l
add bx,300
cmp ebx,ted_wnd_w ;áà ¢­¨¢ ¥¬ ª®®à¤¨­ âã ¤«ï ¢ë¢®¤ ⥪áâ 
@ -3264,6 +3323,7 @@ proc ted_draw_buffer
or ecx,0x40000000
mov edx,ted_buffer
add edx,12
mov esi,edx
mov edi,ted_color_wnd_work ;edi - destroy not pointer to tedit
call tl_strlen

View File

@ -486,7 +486,7 @@ tree_file_struct:
if lang eq ru
hed db '’¥ªáâ®¢ë© à¥¤ ªâ®à 29.10.13',0 ;¯®¤¯¨áì ®ª­ 
hed db '’¥ªáâ®¢ë© à¥¤ ªâ®à 14.11.13',0 ;¯®¤¯¨áì ®ª­ 
menu_text_area:
db '” ©«',0
@ -597,7 +597,7 @@ txtFormatApply db '
else
hed db 'Text editor 29.10.13',0
hed db 'Text editor 14.11.13',0
menu_text_area:
db 'File',0

View File

@ -54,7 +54,7 @@ and ecx,0xffff
call draw_but_icon
or ecx,0x40000000
cmp byte[buf],0
cmp dword[buf],0
jne @f
and ecx,0xffff
@@:
@ -356,23 +356,27 @@ draw_but_icon:
; buf_g24 - áóôåð ñ âûõîäíûì 24 áèòíûì ñåðûì èçîáðàæåíèåì
; pixels - ÷èñëî ïèêñåëåé â èçîáðàæåíèè
align 4
proc img_to_gray uses eax ebx ecx edi esi, buf_rgb:dword, buf_g24:dword, pixels:dword
proc img_to_gray, buf_rgb:dword, buf_g24:dword, pixels:dword
pushad
mov esi,[buf_rgb]
mov edi,[buf_g24]
mov ecx,[pixels]
mov ebx,3
@@:
movzx eax,byte[esi]
movzx ebx,byte[esi+1]
add eax,ebx
movzx ebx,byte[esi+2]
add eax,ebx
shr eax,2
movzx edx,byte[esi+1]
add eax,edx
movzx edx,byte[esi+2]
add eax,edx
xor edx,edx
div ebx ;shr eax,2
mov ah,al
mov word[edi],ax
mov byte[edi+2],al
add esi,3
add edi,3
loop @b
popad
ret
endp