Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 288 → Rev 289

/programs/develop/examples/editbox/trunk/EDITBOX.INC
1,4 → 1,5
; <Lrz> 19.01.2007 ॠ«¨§®¢ « ¢ë¤¥«¥­¨¥ ⥪áâ  ¯® shift
; <Lrz> 22.01.2007 ¨§¡ ¢¨«áï ®â £«îª®¢ ¯à¨ à ¡®â¥ á ¢ë¤¥«¥­¨¥¬ ¨ 㤠«¥­¨¥, ª®à४⭠ï à ¡®â  ª« ¢¨è¥© del & backspase
; <Lrz> 20.01.2007 ॠ«¨§®¢ « ¢ë¤¥«¥­¨¥ ⥪áâ  ¯® shift
; <Lrz> 12.12.2006 ॠ«¨§®¢ « ¯®¤¤¥à¦ªã ª­®¯ª¨ insert ¨ ᥣ®¤ï ª®¬¯®­¥­â ¯®ç⨠ࠡ®â ¥â!!!!
; <Lrz> 07.12.2006 ¯à®¤®«¦ ¥âáï à ¡®â  ­ ¤ ¯¥à¥à ¡®âª®© ª®¬¯®­¥­â ,¨§¬¥­¥­¨ï¬ ¯®¤¢¥à£«¨áì ¬­®£¨¥ ä㭪樨, ¯¥à¥à ¡®â ­ ¢ë¢®¤ ⥪áâ ,   â ª  ¦¥  «£®à¨â¬ ¢­¥á¥­¨ï ᨬ¢®«®¢.
; <Lrz> 03.09.2006 ¯® ¢®§¬®¦­®á⨠®âª § «áï ®â 16 ¡¨â­®©  à¨ä¬¥â¨ª¨, ¤®¡ ¢¨« ­®¢ë¥ ¡ £¨
144,12 → 145,12
shl ecx,16
mov cx,13
; sub ecx,1
mov edx,[esp+4] ;color
; pop edx ;color
; mov edx,ed_color
mov eax,13
int 0x40
;popa
ret 4
ret
 
jmp @f
.draw_bg:
298,7 → 299,7
shl ebx,16
mov bx,ed_width
dec ebx
push dword ed_color
mov edx,ed_color
call .draw_bg_eax
mov dword [esp+28],0
@@: popad
356,7 → 357,10
cmp ah,'9'
ja .no_figure
@@: ; ¯à®¢¥à塞, ­ å®¤¨âáï «¨ ªãàá®à ¢ ª®­æ¥
mov ecx,ed_size
mov edx, ed_max
cmp ecx,edx
jae .no_figure
mov ebx, ed_pos
cmp ebx,edx
jl @f ; ¥á«¨ ¬¥­ìè¥ ¨«¨ à ¢­®
408,23 → 412,23
; 㢥«¨ç¨¢ ¥¬ §­ ç¥­¨¥ à §¬¥à  ¨ ¯®§¨æ¨¨
inc dword ed_size
 
push dword ed_pos
push dword ed_size
;push dword ed_pos
;push dword ed_size
; push .return
call .draw_all2
inc dword ed_pos
;.return:
jmp .draw_cursor_text
jmp .shift;.draw_cursor_text
.delete:
 
mov edx,ed_size
mov ecx,ed_pos
 
cmp edx,ecx
jg @f
test word ed_flags,ed_shift_on
jne .del_bac
popa
ret
.bac_del:
@@: call .del_char
jmp .draw_all
435,21 → 439,35
mov ecx,ed_pos
test ecx,ecx
jnz @f
test word ed_flags,ed_shift_on
jne .bac_del
;jmp @b
 
popa
ret
 
.del_bac:
@@: cmp edx,ecx ;if ed_pos=ed_size
je @f
dec ecx
call .del_char
@@:
@@: test word ed_flags,ed_shift_on
jne .bac_del
dec dword ed_pos
 
.draw_all:
push dword ed_pos
push dword ed_size
push .draw_cursor_text;eax
dec dword ed_size
push .shift;.draw_cursor_text;eax
 
test word ed_flags,ed_shift_on
je @f
mov eax,ed_shift_pos
mov ebx,ed_size
sub ebx,eax
mov ed_size,ebx
jmp .draw_all2
 
@@: dec dword ed_size
 
.draw_all2:
call .clear_cursor
call .check_offset
457,16 → 475,16
push eax
mov ebx,ed_offset
add eax,ebx ;eax = w_off= ed_offset+width
mov ebx,[esp+8] ;ed_size
mov ebx,ed_size
cmp eax,ebx
jb @f
mov eax,[esp+12] ; ed_pos
mov eax,ed_pos
sub ebx,eax
mov ecx,ed_offset
sub eax,ecx
jmp .nxt
@@: mov ebx,[esp+12];ed_pos
@@: mov ebx,ed_pos
push ebx
sub eax,ebx
mov ebx,eax ;It is don't optimal
492,18 → 510,13
lea ecx,[edx*2+edx]
shl ecx,1
mov bx,cx
push dword ed_color
mov edx,ed_color
call .draw_bg_eax
ret 8
ret
; jmp .shift
;--- ­ ¦ â  ª« ¢¨è  left ---
.left: test word ed_flags,ed_shift
je @f
test word ed_flags,ed_shift_on
jne @f
push dword ed_pos
pop dword ed_shift_pos
or word ed_flags,ed_shift_on
@@: mov ebx,ed_pos
.left: call .sh_enable
mov ebx,ed_pos
test ebx,ebx
jz .nd_k
call .clear_cursor
510,26 → 523,15
dec dword ed_pos
jmp .nd_k
;--- ­ ¦ â  ª« ¢¨è  right ---
.right:
test word ed_flags,ed_shift
je @f
test word ed_flags,ed_shift_on
jne @f
push dword ed_pos
pop dword ed_shift_pos
or word ed_flags,ed_shift_on
@@: mov ebx,ed_pos
.right: call .sh_enable
mov ebx,ed_pos
cmp ebx,ed_size
je .nd_k
call .clear_cursor
inc dword ed_pos
jmp .nd_k
.home:
; test word ed_flags,ed_shift
; je @f
; push dword ed_pos
; pop dword ed_shift_pos
@@: mov ebx,ed_pos
.home: call .sh_enable
mov ebx,ed_pos
test ebx,ebx
jz .nd_k
call .clear_cursor
537,12 → 539,8
mov ed_pos,eax
jmp .nd_k
 
.end:
; test word ed_flags,ed_shift
; je @f
; push dword ed_pos
; pop dword ed_shift_pos
@@: mov ebx,ed_pos
.end: call .sh_enable
mov ebx,ed_pos
cmp ebx,dword ed_size
je @f
call .clear_cursor
554,27 → 552,6
call .draw_cursor
 
.shift: ;;;;;;;SHIFT
;----------- ®â« ¤ª 
pushad
mov [data_of_code],0
mov ax,word ed_flags
mov edi,data_of_code
call .str
;à¨á®¢ ­¨¥ ä®­ 
mov eax,13
mov ebx,178*65536+36
mov ecx,28*65536+10
xor edx,edx
int 0x40
;¢ë¢®¤ §­ ç¥­¨ï ­  íªà ­
mov eax,4
mov ebx,180*65536+30
mov ecx,0x10DDBBCC
mov edx,data_of_code
mov esi,4
int 0x40
popad
;----------- ®â« ¤ª 
call .draw_bg
test word ed_flags,ed_shift
628,14 → 605,7
sub ebx,ecx
sub ebx,eax
.nxt_f:
; mov ebp,eax ;¯à®¢¥àª  ­  ¢ë室 § ªà è¨¢ ¥¬®© ®¡« á⨠§  ¯à¥¤¥«ë ¤«¨­ë
; add ebp,ebx
; pop edx
; cmp ebp,edx
; je .ff
; inc ebx
 
.ff: mov edx,ebx
mov edx,ebx
lea ebx,[eax*2+eax]
shl ebx,1
add ebx,ed_left
644,12 → 614,8
lea ecx,[edx*2+edx]
shl ecx,1
mov bx,cx
; mov ebp,ed_color
; not ebp
push dword shift_color
mov edx,shift_color
call .draw_bg_eax
; pop edx
; or word ed_flags,ed_shift
and word ed_flags,1111111111111011b
jmp .draw_cursor_text
;;;;;;;;;;;;;;;;;;;;;
656,26 → 622,85
 
.f_exit: and word ed_flags,ed_shift_cl
jmp .draw_cursor_text
@@:
popa
ret
 
.sh_enable:
test word ed_flags,ed_shift
je @f
test word ed_flags,ed_shift_on
jne @f
push dword ed_pos
pop dword ed_shift_pos
or word ed_flags,ed_shift_on
@@: ret
 
;- 㤠«¥­¨¥ ᨬ¢®« 
;‚室­ë¥ ¤ ­­ë¥ edx=ed_size;ecx=ed_pos
.del_char:
mov esi,ed_text
 
 
test word ed_flags,ed_shift_on
je @f
mov eax,dword ed_shift_pos
mov ebx,esi
cmp eax,ecx
jae .dh_n
 
mov ed_pos,eax ;çâ® ¡ë ­¥ ¡ë«® ã¡¥£ ­¨ï ªãàá®à 
mov ebp,ecx
sub ebp,eax
add ebx,eax ;eax ¬¥­ìè¥
sub edx,ecx
add esi,ecx
 
 
mov ed_shift_pos,ebp
jmp .del_ch_sh
;¥á«¨ ¨­ ç¥
.dh_n:
mov ebp,eax
sub ebp,ecx
add ebx,ecx
sub edx,eax
add esi,eax
mov ed_shift_pos,ebp
jmp .del_ch_sh
 
@@: add esi,ecx ;㪠§ â¥«ì + ᬥ饭¨¥ ª ॠ«ì­®¬ã ¡ãää¥àã
mov ebx,esi
inc esi
cld
 
sub edx,ecx
mov ecx,edx
.del_ch_sh:
;----------- ®â« ¤ª 
pushad
mov [data_of_code],0
mov eax,ed_pos;word ed_flags
mov edi,data_of_code
call .str
;à¨á®¢ ­¨¥ ä®­ 
mov eax,13
mov ebx,178*65536+36
mov ecx,28*65536+10
xor edx,edx
int 0x40
;¢ë¢®¤ §­ ç¥­¨ï ­  íªà ­
mov eax,4
mov ebx,180*65536+30
mov ecx,0x10DDBBCC
mov edx,data_of_code
mov esi,4
int 0x40
popad
;----------- ®â« ¤ª 
 
push edi
mov edi,ebx
@@:
lodsb
stosb
dec ecx
dec edx
jns @b
pop edi