Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 7582 → Rev 7583

/programs/develop/libraries/box_lib/trunk/t_edit.asm
722,7 → 722,7
inc edx
loop @b
mov edx,ted_tex
mov dword [edx+6],1
mov dword [edx+symbol.next],1
pop edx
 
.exit:
834,13 → 834,13
@@:
mov ebx,[edx]
mov byte [eax],bl
mov dword [eax+2],ecx
inc dword [eax+2]
mov dword [eax+6],ecx
add dword [eax+6],3
mov dword[eax+symbol.perv],ecx
inc dword[eax+symbol.perv]
mov dword[eax+symbol.next],ecx
add dword[eax+symbol.next],3
;mov byte[eax+1],0 ;col=0
mov dword [eax+10],-1 ;tc=-1
mov dword [eax+14],0 ;td=0
mov dword[eax+symbol.tc],-1
mov dword[eax+symbol.td],0
 
cmp ecx,0
je @f
850,32 → 850,31
jmp @b
@@:
pop ebx
add eax,2
mov dword [eax],0 ; first sumbol 'perv=0'
mov dword[eax+symbol.perv],0 ; first sumbol 'perv=0'
 
mov edx,ted_tex ; ­ áâனª¨ ­ ç «ì­®£® á«ã¦¥¡­®£® ᨬ¢®« 
; begining sumbol 'perv=0' 'next=2'
mov dword [edx+2],0
mov dword [edx+6],2
mov dword[edx+symbol.perv],0
mov dword[edx+symbol.next],2
 
add edx,sizeof.symbol ; ­ áâனª¨ ª®­¥ç­®£® á«ã¦¥¡­®£® ᨬ¢®« 
mov dword [edx+6],0 ; last sumbol 'next=0'
mov dword [edx+2],ebx ; last sumbol 'perv=last'
inc dword [edx+2]
mov dword [edx+10],0 ; áâ ¢¨¬ ¢à¥¬ï ᮧ¤ ­¨ï à ¢­®¥ 0, çâ® ¡ë ᨬ¢®« ¯à ¢¨«ì­® ®¡à ¡ â뢠«áï ¯à¨ ®âªàë⨨ ä ©«®¢ ¡®«ìè¨å 28 ¡ ©â
mov dword[edx+symbol.next],0 ; last sumbol 'next=0'
mov dword[edx+symbol.perv],ebx ; last sumbol 'perv=last'
inc dword[edx+symbol.perv]
mov dword[edx+symbol.tc],0 ; áâ ¢¨¬ ¢à¥¬ï ᮧ¤ ­¨ï à ¢­®¥ 0, çâ® ¡ë ᨬ¢®« ¯à ¢¨«ì­® ®¡à ¡ â뢠«áï ¯à¨ ®âªàë⨨ ä ©«®¢ ¡®«ìè¨å 28 ¡ ©â
 
mov edx,ebx
inc edx ;2 = rezerv sumbols
imul edx,sizeof.symbol
add edx,ted_tex
mov dword [edx+6],1 ; last sumbol 'next=1'
mov dword[edx+symbol.next],1 ; last sumbol 'next=1'
 
@@: ;clear memory, need if before was open big file
add edx,sizeof.symbol
cmp edx,ted_tex_end
jge @f
mov dword[edx+10],0
mov dword[edx+14],0
mov dword[edx+symbol.tc],0
mov dword[edx+symbol.td],0
jmp @b
@@:
 
908,7 → 907,7
je .else
push ebx
@@:
mov edx,[edx+2]
mov edx,[edx+symbol.perv]
or edx,edx
jz @f
imul edx,sizeof.symbol
925,12 → 924,12
pop ebx
ret
.else:
mov edx,[edx+2]
mov edx,[edx+symbol.perv]
or edx,edx
jz @f
imul edx,sizeof.symbol
add edx,ted_tex
cmp dword [edx+14],0
cmp dword[edx+symbol.td],0
jne .else
cmp byte[edx],10 ;¯à®¯ã᪠ᨬ¢®«  á ª®¤®¬ 10
je .else
951,7 → 950,7
je .else
push ebx
@@:
mov edx,[edx+6]
mov edx,[edx+symbol.next]
cmp edx,1
jle @f
imul edx,sizeof.symbol
969,13 → 968,13
pop ebx
ret
.else:
mov edx,[edx+6]
mov edx,[edx+symbol.next]
cmp edx,1
jle @f
imul edx,sizeof.symbol
add edx,ted_tex
 
cmp dword [edx+14],0
cmp dword[edx+symbol.td],0
jne .else
cmp byte[edx],10 ;¯à®¯ã᪠ᨬ¢®«  á ª®¤®¬ 10
je .else
1055,10 → 1054,9
push eax
 
xor bl,bl
 
cmp dword [edx+14],0
cmp dword[edx+symbol.td],0
je @f
mov eax,[edx+14] ;eax=tex[i].td
mov eax,[edx+symbol.td] ;eax=tex[i].td
add eax,ted_tim_undo
cmp eax,ted_tim_ch
jg @f
1069,7 → 1067,7
 
mov eax,ted_tim_ch
sub eax,ted_tim_undo
cmp [edx+10],eax
cmp [edx+symbol.tc],eax
jle @f
or bl,1
@@:
1141,9 → 1139,9
 
mov edx,ted_ptr_free_symb
.beg_cycle: ;for(i=...;i<ted_max_chars;i++)
cmp dword [edx+10],0 ;if(!tex[i].tc && !tex[i].td)
cmp dword[edx+symbol.tc],0 ;if(!tex[i].tc && !tex[i].td)
jne .u1f
cmp dword [edx+14],0
cmp dword[edx+symbol.td],0
jne .u1f
test dword[add_opt],ted_opt_ed_change_time ;if(n_tim) ted_tim_ch++;
jz .no_tim
1173,21 → 1171,21
 
mov cl,byte[esi] ;tex[i].c=ta[ns];
mov byte[edx],cl
m2m dword[edx+10],ted_tim_ch ;tex[i].tc=ted_tim_ch;
mov [edx+2],eax ;tex[i].perv=po_t;
m2m dword[edx+symbol.tc],ted_tim_ch ;tex[i].tc=ted_tim_ch;
mov [edx+symbol.perv],eax ;tex[i].perv=po_t;
 
mov ecx,eax
imul ecx,sizeof.symbol
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;
add ecx,symbol.next ; *** ecx = tex[po_t].next ***
m2m dword[edx+symbol.next],dword[ecx] ;tex[i].next=tex[po_t].next;
 
call ted_get_text_arr_index ;*** eax = i ***
mov [ecx],eax ;tex[po_t].next=i; // áá뫪¨ ¯¥à¥­ ¯à ¢«ï¥¬
mov ecx,[edx+6] ; *** ecx = tex[i].next ***
mov ecx,[edx+symbol.next] ; *** ecx = tex[i].next ***
imul ecx,sizeof.symbol
add ecx,ted_tex ; *** ecx = tex[tex[i].next] ***
mov [ecx+2],eax ;tex[tex[i].next].perv=i;
mov [ecx+symbol.perv],eax ;tex[tex[i].next].perv=i;
 
; *** ¢áâ ¢ª  ¤®¯®«­¨â¥«ì­ëå áâப ¨ ¯à®¡¥«®¢
; ¥á«¨ ªãàá®à ¢® ¢à¥¬ï ¢áâ ¢ª¨ ­ å®¤¨«áï §  ⥪á⮬ ***
1268,9 → 1266,9
.loop_b:
cmp ecx,ted_tex_end
jge .end_f
cmp dword[ecx+10],0
cmp dword[ecx+symbol.tc],0
jne @f
cmp dword[ecx+14],0
cmp dword[ecx+symbol.td],0
je .loop_e
@@:
add ecx,sizeof.symbol
1280,13 → 1278,13
 
push eax ebx
mov eax,ted_tim_ch
mov dword[ecx+10],eax
mov [ecx+symbol.tc],eax
mov ax,si
mov byte[ecx],al
 
call ted_get_text_arr_index ; *** eax=pos ***
mov [ecx+2],eax ;tex[i].perv=pos;
m2m dword[ecx+6],dword[edx+6] ;tex[i].next=tex[pos].next;
mov [ecx+symbol.perv],eax ;tex[i].perv=pos;
m2m dword[ecx+symbol.next],dword[edx+symbol.next] ;tex[i].next=tex[pos].next;
 
push edx
mov edx,ecx
1293,10 → 1291,10
call ted_get_text_arr_index ; *** eax=i ***
pop edx
 
mov [edx+6],eax ;tex[pos].next=i; // áá뫪¨ ¯¥à¥­ ¯à ¢«ï¥¬
mov ebx,[ecx+6]
mov [edx+symbol.next],eax ;tex[pos].next=i; // áá뫪¨ ¯¥à¥­ ¯à ¢«ï¥¬
mov ebx,[ecx+symbol.next]
ConvertIndexToPointer ebx
mov [ebx+2],eax ;tex[tex[i].next].perv=i; // ...
mov [ebx+symbol.perv],eax ;tex[tex[i].next].perv=i; // ...
pop ebx eax
 
.end_f:
1314,7 → 1312,7
mov edx,ted_tex
.cycle:
;¯¥à¥å®¤¨¬ ­  á«¥¤ãî騩 ᨬ¢®«
mov edx,[edx+6]
mov edx,[edx+symbol.next]
cmp edx,1
jle .end_text
imul edx,sizeof.symbol
1380,7 → 1378,7
cmp byte[edx],al
pop eax
je .no_change
m2m dword [edx+14],ted_tim_ch
m2m dword[edx+symbol.td],ted_tim_ch
call ted_char_add ;b_pos=ted_char_add(tex[i].c^32,i,false,b_pos);
call ted_get_text_next_pos ;go to added symbol
inc dword[conv_cou]
1424,7 → 1422,7
jz @f
inc ted_tim_ch
@@:
m2m dword[edx+14], ted_tim_ch
m2m dword[edx+symbol.td], ted_tim_ch
mov cl,1
.no_del:
mov bl,cl
1461,7 → 1459,7
je @f
cmp edx,ebx ;if(i==te)break;
je @f
m2m dword[edx+14],ted_tim_ch
m2m dword[edx+symbol.td],ted_tim_ch
mov esi,ted_opt_ed_change_time
not esi
and dword[del_opt],esi ;n_tim=false;
1510,28 → 1508,28
@@:
 
push esi
mov edx,[eax+2] ; *** edx = tex[p0].perv ***
mov edx,[eax+symbol.perv] ; *** edx = tex[p0].perv ***
ConvertIndexToPointer edx
add edx,6
mov ecx,[edx] ;tmp = tex[tex[p0].perv].next;
add edx,symbol.next
mov ecx,[edx] ;ecx = tex[tex[p0].perv].next
 
mov esi,[ebx+6] ; *** esi = tex[p1].next ***
mov esi,[ebx+symbol.next] ; *** esi = tex[p1].next ***
ConvertIndexToPointer esi
add esi,2
m2m dword[edx],dword[esi] ;tex[tex[p0].perv].next = tex[tex[p1].next].perv;
add esi,symbol.perv
m2m dword[edx],dword[esi] ;tex[tex[p0].perv].next = tex[tex[p1].next].perv
 
mov [esi],ecx ;tex[tex[p1].next].perv = tmp;
mov [esi],ecx ;tex[tex[p1].next].perv = ecx
pop esi
 
mov ecx,[eax+2] ;tmp = tex[p0].perv;
m2m dword[eax+2],dword[ebx+6] ;tex[p0].perv = tex[p1].next;
mov [ebx+6],ecx ;tex[p1].next = tmp;
mov ecx,[eax+symbol.perv] ;ecx = tex[p0].perv
m2m dword[eax+symbol.perv],dword[ebx+symbol.next] ;tex[p0].perv = tex[p1].next
mov [ebx+symbol.next],ecx ;tex[p1].next = ecx
 
mov edx,eax ;i=p0;
@@:
mov ecx,[edx+6] ;tmp = tex[i].next;
m2m dword[edx+6],dword[edx+2] ;tex[i].next = tex[i].perv;
mov [edx+2],ecx ;tex[i].perv = tmp;
mov ecx,[edx+symbol.next] ;ecx = tex[i].next
m2m dword[edx+symbol.next],dword[edx+symbol.perv] ;tex[i].next = tex[i].perv
mov [edx+symbol.perv],ecx ;tex[i].perv = ecx
cmp edx,ebx ;if(i==p1)break;
je @f
; ---
1538,7 → 1536,7
;cmp edx,ted_tex
;je @f
; ---
mov edx,ecx ;i = tmp;
mov edx,ecx ;i = ecx
ConvertIndexToPointer edx
jmp @b
@@:
1804,7 → 1802,7
; edx = pointer to 'perv' struct
align 16
ted_get_text_perv_pos:
mov edx,[edx+2]
mov edx,[edx+symbol.perv]
imul edx,sizeof.symbol
add edx,ted_tex
ret
1815,7 → 1813,7
; edx = pointer to 'next' symbol struct
align 16
ted_get_text_next_pos:
mov edx,[edx+6]
mov edx,[edx+symbol.next]
imul edx,sizeof.symbol
add edx,ted_tex
ret
2869,24 → 2867,30
; f_opt = ¯ à ¬¥âàë ¯®¨áª :
; (0 - ¨áª âì ­¨¦¥ ªãàá®à , 1 - ¨áª âì ¢ëè¥ ªãàá®à , 2 - ¨áª âì ®â ­ ç «  ä ©« )
; ¥á«¨ ãáâ ­®¢«¥­ 31-© ¡¨â, â® ­¥ ®¡­®¢«ï¥âáï ®ª­®
; ¥á«¨ ãáâ ­®¢«¥­ 30-© ¡¨â, â® ¯®¨áª ¨¤¥â ¡¥§ ãç¥â  ॣ¨áâà  á¨¬¢®«®¢
;output:
; eax = ¡ë« «¨ ­ ©¤¥­ ¨áª®¬ë© ⥪áâ (0 - ­¥â, 1 - ¤ )
align 16
proc ted_but_find uses ebx ecx edx edi esi, edit:dword, f_opt:dword
mov eax,[f_opt]
push eax
push [edit]
cmp word[f_opt],2
cmp al,2
jne @f
call _but_find_first
jmp .end0
@@:
cmp word[f_opt],0
cmp al,0
jne @f
call _but_find_next
jmp .end0
@@:
cmp word[f_opt],1
jne .end0
cmp al,1
jne @f
call _but_find_perv
jmp .end0
@@:
add esp,8
.end0:
 
bt dword[f_opt],31
2907,11 → 2911,13
 
;description:
; äã­ªæ¨ï ­ å®¤¨â ⥪á⠮⠭ ç «  ä ©« , ¨«¨ ®â ª®­æ  ⥪ã饣® ¢ë¤¥«¥­¨ï
;input:
; f_opt = ®¯æ¨¨ ¤«ï ¯®¨áª 
;output:
; eax = ¡ë« «¨ ­ ©¤¥­ ¨áª®¬ë© ⥪áâ (0 - ­¥â, 1 - ¤ )
; ebx, ecx, edx, edi, edi - ¯®àâïâáï
align 16
proc _but_find_first, edit:dword
proc _but_find_first, edit:dword, f_opt:dword
mov edi,[edit]
 
call ted_is_select
2927,11 → 2933,11
mov edx,ted_tex
call ted_iterat_next
.end0:
mov eax,ted_buffer_find
mov bl,byte[eax]
mov ebx,ted_buffer_find
@@:
mov eax,[f_opt]
call ted_get_find_rezult
cmp bh,1
cmp ah,1
je @f ; find
call ted_iterat_next
cmp edx,ted_tex_1
2944,12 → 2950,15
 
;description:
; äã­ªæ¨ï ­ å®¤¨â ⥪áâ ¢ëè¥ ªãàá®à 
;input:
; f_opt = ®¯æ¨¨ ¤«ï ¯®¨áª 
;output:
; eax = ¡ë« «¨ ­ ©¤¥­ ¨áª®¬ë© ⥪áâ (0 - ­¥â, 1 - ¤ )
; ebx, ecx, edx, edi, edi - ¯®àâïâáï
align 16
proc _but_find_perv, edit:dword
proc _but_find_perv, edit:dword, f_opt:dword
mov edi,[edit]
 
call ted_is_select
or al,al
jz @f
2963,11 → 2972,11
@@:
call ted_get_pos_by_cursor
.end0:
mov eax,ted_buffer_find
mov bl,byte[eax]
mov ebx,ted_buffer_find
@@:
mov eax,[f_opt]
call ted_get_find_rezult
cmp bh,1
cmp ah,1
je @f ; find
call ted_iterat_perv
cmp edx,ted_tex_1
2980,19 → 2989,21
 
;description:
; äã­ªæ¨ï ­ å®¤¨â ⥪áâ ­¨¦¥ ªãàá®à 
;input:
; f_opt = ®¯æ¨¨ ¤«ï ¯®¨áª 
;output:
; eax = ¡ë« «¨ ­ ©¤¥­ ¨áª®¬ë© ⥪áâ (0 - ­¥â, 1 - ¤ )
; ebx, edx, edi, esi - ¯®àâïâáï
; ebx, ecx, edx, edi, esi - ¯®àâïâáï
align 16
proc _but_find_next, edit:dword
proc _but_find_next, edit:dword, f_opt:dword
mov edi,[edit]
 
call ted_get_pos_by_cursor
mov eax,ted_buffer_find
mov bl,byte[eax]
mov ebx,ted_buffer_find
@@:
mov eax,[f_opt]
call ted_get_find_rezult
cmp bh,1
cmp ah,1
je @f ; find
call ted_iterat_next
cmp edx,ted_tex_1
3006,11 → 3017,11
;description:
; ¢á¯®¬®£ â¥«ì­ ï äã­ªæ¨ï, ¢ë¤¥«ï¥â ­ ©¤¥­­ë© ⥪áâ
;input:
; bh = ¡ë« «¨ ­ ©¤¥­ ¨áª®¬ë© ⥪áâ (0 - ­¥â, 1 - ¤ )
; ah = ¡ë« «¨ ­ ©¤¥­ ¨áª®¬ë© ⥪áâ (0 - ­¥â, 1 - ¤ )
; esi = first symbol pointer
align 16
_but_find_select:
or bh,bh
or ah,ah
jz @f
call ted_get_text_coords
inc ebx ;move cursor right
3067,45 → 3078,58
ret
endp
 
;description:
; ”ã­ªæ¨ï ¯à®¢¥àï¥â ᮢ¯ ¤ ¥â «¨ ⥪áâ ¢ ¡ãä¥à¥ ebx
; á ⥪á⮬ । ªâ®à  ¯® 㪠§ â¥«î edx.
; ‘â ­¤ àâ­ë¥ ä㭪樨 (­ ¯à. strcmp) âãâ ­¥ ¯®¤®©¤ãâ, ¯®â®¬ã çâ®
; ¢ ¯ ¬ï⨠। ªâ®à  ⥪áâ ᮤ¥à¦¨âáï ­¥ ¢ ¢¨¤¥ ascii áâப.
;input:
; eax - text need find
; bl - first symbol to find
; eax - options to find
; ebx - text need find
; edx - first symbol pointer
; edi - pointer to tedit struct
;output:
; bh - rezult
; ah - rezult
; edx - last text position (if find sucess)
; esi - first symbol pointer
;description:
; ”ã­ªæ¨ï ¯à®¢¥àï¥â ᮢ¯ ¤ ¥â «¨ ⥪áâ ¢ ¡ãä¥à¥ eax
; á ⥪á⮬ । ªâ®à  ¯® 㪠§ â¥«î edx.
; ‘â ­¤ àâ­ë¥ ä㭪樨 (­ ¯à. strcmp) âãâ ­¥ ¯®¤®©¤ãâ, ¯®â®¬ã çâ®
; ¢ ¯ ¬ï⨠। ªâ®à  ⥪áâ ᮤ¥à¦¨âáï ­¥ ¢ ¢¨¤¥ ascii áâப.
align 16
ted_get_find_rezult:
push eax
mov bh,1
proc ted_get_find_rezult uses ebx
mov al,byte[ebx]
bt eax,30
jnc @f
call fb_char_toupper
@@:
mov ah,1
mov esi,edx ;copy edx
.cycle0:
mov cl,al
mov al,byte[edx]
bt eax,30
jnc @f
call fb_char_toupper
@@:
cmp byte[edx],bl
cmp al,cl
jne .no_text
 
inc eax ;*** get next symbol (in find text) ***
mov bl,byte[eax]
or bl,bl
jz @f ;end of find text
inc ebx ;*** get next symbol (in find text) ***
mov al,byte[ebx]
or al,al
jz .end_f ;end of find text
bt eax,30
jnc @f
call fb_char_toupper
@@:
 
call ted_iterat_next ;*** get next symbol (in editor text) ***
cmp edx,ted_tex_1
jg @b
jg .cycle0
align 4
.no_text:
xor bh,bh
xor ah,ah
mov edx,esi ;restore edx
@@:
pop eax
mov bl,byte[eax] ;restore bl
.end_f:
ret
endp
 
;input:
; edi = pointer to tedit struct
4134,8 → 4158,7
;description:
; äã­ªæ¨ï ­ã¦­  ¤«ï ®¯â¨¬¨§ æ¨¨ ¢ë¢®¤  ⥪áâ 
align 16
proc ted_opt_draw_line_right
push eax
proc ted_opt_draw_line_right uses eax
mov eax,edx
@@:
cmp edx,ted_tex_1
4148,8 → 4171,6
@@:
mov edx,eax ;perv sumbol
call ted_get_symb_color
 
pop eax
ret
endp
 
4375,8 → 4396,6
 
or eax,eax
jz .no_msg
;cmp eax,6
;je @f
cmp ax,10
jl .zifra_0_9
mov al,'?'