forked from KolibriOS/kolibrios
Tinypad: fixed bug#1 (2)
Tinypad: changes in memory management git-svn-id: svn://kolibrios.org@824 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
1827396bcc
commit
c6fefc9917
@ -1,3 +1,5 @@
|
|||||||
|
diff16 'tp-button.asm',0,$
|
||||||
|
|
||||||
button:
|
button:
|
||||||
mcall 17
|
mcall 17
|
||||||
cmp al,0
|
cmp al,0
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
diff16 'tp-common.asm',0,$
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
proc clear_selection ;////////////////////////////////////////////////////////
|
proc clear_selection ;////////////////////////////////////////////////////////
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
@ -421,7 +423,7 @@ proc delete_selection ;///////////////////////////////////////////////////////
|
|||||||
add edi,[sel.begin.x]
|
add edi,[sel.begin.x]
|
||||||
lea esi,[esi+eax+4]
|
lea esi,[esi+eax+4]
|
||||||
mov ecx,[cur_editor.Lines]
|
mov ecx,[cur_editor.Lines]
|
||||||
add ecx,[ecx-4]
|
add ecx,[cur_editor.Lines.Size] ;*** add ecx,[ecx-4]
|
||||||
sub ecx,esi
|
sub ecx,esi
|
||||||
cld
|
cld
|
||||||
rep movsb
|
rep movsb
|
||||||
@ -447,7 +449,7 @@ proc delete_selection ;///////////////////////////////////////////////////////
|
|||||||
add edi,[sel.begin.x]
|
add edi,[sel.begin.x]
|
||||||
lea esi,[edi+ecx]
|
lea esi,[edi+ecx]
|
||||||
mov ecx,[cur_editor.Lines]
|
mov ecx,[cur_editor.Lines]
|
||||||
add ecx,[ecx-4]
|
add ecx,[cur_editor.Lines.Size] ;*** add ecx,[ecx-4]
|
||||||
sub ecx,esi
|
sub ecx,esi
|
||||||
cld
|
cld
|
||||||
rep movsb
|
rep movsb
|
||||||
@ -465,7 +467,7 @@ proc delete_selection ;///////////////////////////////////////////////////////
|
|||||||
movzx eax,word[esi]
|
movzx eax,word[esi]
|
||||||
lea esi,[esi+eax+4]
|
lea esi,[esi+eax+4]
|
||||||
mov eax,[cur_editor.Lines]
|
mov eax,[cur_editor.Lines]
|
||||||
add eax,[eax-4]
|
add eax,[cur_editor.Lines.Size] ;*** add eax,[eax-4]
|
||||||
sub esi,eax
|
sub esi,eax
|
||||||
lea eax,[esi+4096]
|
lea eax,[esi+4096]
|
||||||
call editor_realloc_lines
|
call editor_realloc_lines
|
||||||
@ -587,11 +589,11 @@ proc mem.Alloc,size ;/////////////////////////////////////////////////////////
|
|||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
push ebx ecx
|
push ebx ecx
|
||||||
mov ecx,[size]
|
mov ecx,[size]
|
||||||
add ecx,4
|
;*** add ecx,4
|
||||||
mcall 68,12
|
mcall 68,12
|
||||||
add ecx,-4
|
;*** add ecx,-4
|
||||||
mov [eax],ecx
|
;*** mov [eax],ecx
|
||||||
add eax,4
|
;*** add eax,4
|
||||||
pop ecx ebx
|
pop ecx ebx
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
@ -601,19 +603,19 @@ proc mem.ReAlloc,mptr,size ;//////////////////////////////////////////////////
|
|||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
push ebx ecx edx
|
push ebx ecx edx
|
||||||
mov ecx,[size]
|
mov ecx,[size]
|
||||||
or ecx,ecx
|
or ecx,ecx
|
||||||
jz @f
|
jz @f
|
||||||
add ecx,4
|
;*** add ecx,4
|
||||||
@@: mov edx,[mptr]
|
@@: mov edx,[mptr]
|
||||||
or edx,edx
|
or edx,edx
|
||||||
jz @f
|
jz @f
|
||||||
add edx,-4
|
;*** add edx,-4
|
||||||
@@: mcall 68,20
|
@@: mcall 68,20
|
||||||
or eax,eax
|
or eax,eax
|
||||||
jz @f
|
jz @f
|
||||||
add ecx,-4
|
;*** add ecx,-4
|
||||||
mov [eax],ecx
|
;*** mov [eax],ecx
|
||||||
add eax,4
|
;*** add eax,4
|
||||||
@@: pop edx ecx ebx
|
@@: pop edx ecx ebx
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
@ -623,9 +625,9 @@ proc mem.Free,mptr ;//////////////////////////////////////////////////////////
|
|||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
push ebx ecx
|
push ebx ecx
|
||||||
mov ecx,[mptr]
|
mov ecx,[mptr]
|
||||||
or ecx,ecx
|
or ecx,ecx
|
||||||
jz @f
|
jz @f
|
||||||
add ecx,-4
|
;*** add ecx,-4
|
||||||
@@: mcall 68,13
|
@@: mcall 68,13
|
||||||
pop ecx ebx
|
pop ecx ebx
|
||||||
ret
|
ret
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
diff16 'tp-dialog.asm',0,$
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
proc define_3d_button ;///////////////////////////////////////////////////////
|
proc define_3d_button ;///////////////////////////////////////////////////////
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
diff16 'tp-draw.asm',0,$
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
proc drawwindow ;///// DRAW WINDOW ///////////////////////////////////////////
|
proc drawwindow ;///// DRAW WINDOW ///////////////////////////////////////////
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
diff16 'tp-editor.asm',0,$
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
proc draw_editor ;///// DRAW EDITOR //////////////////////////////////////////
|
proc draw_editor ;///// DRAW EDITOR //////////////////////////////////////////
|
||||||
@ -979,7 +980,7 @@ proc editor_realloc_lines ;///// ADD $DELTA$ TO LINES SIZE ///////////////////
|
|||||||
mov eax,[cur_editor.Lines]
|
mov eax,[cur_editor.Lines]
|
||||||
mov [cur_editor.Lines.Size],ebx
|
mov [cur_editor.Lines.Size],ebx
|
||||||
mov ecx,eax
|
mov ecx,eax
|
||||||
stdcall mem.ReAlloc,eax,ebx
|
stdcall mem.ReAlloc,eax,ebx
|
||||||
mov [cur_editor.Lines],eax
|
mov [cur_editor.Lines],eax
|
||||||
sub eax,ecx
|
sub eax,ecx
|
||||||
pop ecx ebx
|
pop ecx ebx
|
||||||
@ -999,6 +1000,11 @@ proc editor_check_for_changes ;///// EDITOR CHANGES CHECKER //////////////////
|
|||||||
.direct:
|
.direct:
|
||||||
xor edx,edx
|
xor edx,edx
|
||||||
|
|
||||||
|
mov ecx,[cur_editor.Caret.Y]
|
||||||
|
call get_line_offset
|
||||||
|
call get_real_length
|
||||||
|
mov ecx,eax
|
||||||
|
|
||||||
mov eax,[cur_editor.Lines.Count]
|
mov eax,[cur_editor.Lines.Count]
|
||||||
cmp eax,[checker_ed.Lines.Count]
|
cmp eax,[checker_ed.Lines.Count]
|
||||||
je @f
|
je @f
|
||||||
@ -1014,12 +1020,9 @@ proc editor_check_for_changes ;///// EDITOR CHANGES CHECKER //////////////////
|
|||||||
@@: or dl,dl
|
@@: or dl,dl
|
||||||
jnz .redraw
|
jnz .redraw
|
||||||
|
|
||||||
mov ecx,[cur_editor.Caret.Y]
|
cmp ecx,[checker_ed_ll]
|
||||||
call get_line_offset
|
|
||||||
call get_real_length
|
|
||||||
cmp eax,[checker_ed_ll]
|
|
||||||
je @f
|
je @f
|
||||||
mov [checker_ed_ll],eax
|
mov [checker_ed_ll],ecx
|
||||||
or dl,REDRAW_ONELINE
|
or dl,REDRAW_ONELINE
|
||||||
@@:
|
@@:
|
||||||
mov eax,[cur_editor.Caret.Y]
|
mov eax,[cur_editor.Caret.Y]
|
||||||
@ -1107,6 +1110,7 @@ proc editor_check_for_changes ;///// EDITOR CHANGES CHECKER //////////////////
|
|||||||
jmp .exit
|
jmp .exit
|
||||||
|
|
||||||
.redraw:
|
.redraw:
|
||||||
|
mov [checker_ed_ll],ecx
|
||||||
push edx
|
push edx
|
||||||
call draw_editor_gutter
|
call draw_editor_gutter
|
||||||
call draw_editor_text
|
call draw_editor_text
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
diff16 'tp-files.asm',0,$
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
proc save_file ;//////////////////////////////////////////////////////////////
|
proc save_file ;//////////////////////////////////////////////////////////////
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
@ -21,7 +23,7 @@ proc save_file ;//////////////////////////////////////////////////////////////
|
|||||||
mov eax,[cur_editor.Lines.Count]
|
mov eax,[cur_editor.Lines.Count]
|
||||||
shl eax,1
|
shl eax,1
|
||||||
lea eax,[eax+ebx+1024]
|
lea eax,[eax+ebx+1024]
|
||||||
stdcall mem.Alloc,eax
|
stdcall mem.Alloc,eax
|
||||||
push eax
|
push eax
|
||||||
mov esi,[cur_editor.Lines]
|
mov esi,[cur_editor.Lines]
|
||||||
mov edi,eax
|
mov edi,eax
|
||||||
@ -171,7 +173,7 @@ proc load_file ;//////////////////////////////////////////////////////////////
|
|||||||
mov [f_info70+0],0
|
mov [f_info70+0],0
|
||||||
mov eax,dword[file_info.Size]
|
mov eax,dword[file_info.Size]
|
||||||
mov [f_info70+12],eax
|
mov [f_info70+12],eax
|
||||||
stdcall mem.Alloc,eax
|
stdcall mem.Alloc,eax
|
||||||
mov [f_info70+16],eax
|
mov [f_info70+16],eax
|
||||||
mcall 70,f_info70
|
mcall 70,f_info70
|
||||||
|
|
||||||
@ -185,7 +187,7 @@ proc load_file ;//////////////////////////////////////////////////////////////
|
|||||||
cmp ebx,6 ;// ATV driver fix (6 instead of 5)
|
cmp ebx,6 ;// ATV driver fix (6 instead of 5)
|
||||||
je .file_found
|
je .file_found
|
||||||
|
|
||||||
stdcall mem.Free,[f_info70+16]
|
stdcall mem.Free,[f_info70+16]
|
||||||
stc
|
stc
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@ -220,7 +222,7 @@ proc load_file ;//////////////////////////////////////////////////////////////
|
|||||||
call flush_cur_tab
|
call flush_cur_tab
|
||||||
pop edi esi ecx
|
pop edi esi ecx
|
||||||
call load_from_memory
|
call load_from_memory
|
||||||
stdcall mem.Free,[f_info70+16]
|
stdcall mem.Free,[f_info70+16]
|
||||||
|
|
||||||
xor eax,eax
|
xor eax,eax
|
||||||
mov [cur_editor.TopLeft.Y],eax
|
mov [cur_editor.TopLeft.Y],eax
|
||||||
@ -264,7 +266,7 @@ proc load_from_memory ;///////////////////////////////////////////////////////
|
|||||||
imul ebx,eax,14
|
imul ebx,eax,14
|
||||||
add ebx,edx
|
add ebx,edx
|
||||||
mov [ebp+EDITOR.Lines.Size],ebx
|
mov [ebp+EDITOR.Lines.Size],ebx
|
||||||
stdcall mem.ReAlloc,[ebp+EDITOR.Lines],ebx
|
stdcall mem.ReAlloc,[ebp+EDITOR.Lines],ebx
|
||||||
mov [ebp+EDITOR.Lines],eax
|
mov [ebp+EDITOR.Lines],eax
|
||||||
|
|
||||||
mov [ebp+EDITOR.Columns.Count],0
|
mov [ebp+EDITOR.Columns.Count],0
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
diff16 'tp-key.asm',0,$
|
||||||
|
|
||||||
key:
|
key:
|
||||||
mov ecx,1
|
mov ecx,1
|
||||||
mcall 66,3
|
mcall 66,3
|
||||||
@ -544,7 +546,7 @@ proc key.ctrl_v
|
|||||||
mov ecx,[copy_size]
|
mov ecx,[copy_size]
|
||||||
sub ecx,4
|
sub ecx,4
|
||||||
mov edi,[cur_editor.Lines]
|
mov edi,[cur_editor.Lines]
|
||||||
add edi,[edi-4]
|
add edi,[cur_editor.Lines.Size] ;*** add edi,[edi-4]
|
||||||
dec edi
|
dec edi
|
||||||
mov eax,esi
|
mov eax,esi
|
||||||
mov esi,edi
|
mov esi,edi
|
||||||
@ -691,7 +693,7 @@ proc key.ctrl_y ;///// DELETE CURRENT LINE ///////////////////////////////////
|
|||||||
|
|
||||||
dec [cur_editor.Lines.Count]
|
dec [cur_editor.Lines.Count]
|
||||||
mov ecx,[cur_editor.Lines]
|
mov ecx,[cur_editor.Lines]
|
||||||
add ecx,[ecx-4]
|
add ecx,[cur_editor.Lines.Size] ;*** add ecx,[ecx-4]
|
||||||
sub ecx,esi
|
sub ecx,esi
|
||||||
shr ecx,2
|
shr ecx,2
|
||||||
cld
|
cld
|
||||||
@ -1079,7 +1081,7 @@ proc key.del ;///// DELETE NEXT CHAR OR SELECTION ////////////////////////////
|
|||||||
@@:
|
@@:
|
||||||
push ecx
|
push ecx
|
||||||
mov edi,[cur_editor.Lines]
|
mov edi,[cur_editor.Lines]
|
||||||
add edi,[edi-4]
|
add edi,[cur_editor.Lines.Size] ;*** add edi,[edi-4]
|
||||||
dec edi
|
dec edi
|
||||||
lea esi,[edi+8]
|
lea esi,[edi+8]
|
||||||
sub esi,ecx
|
sub esi,ecx
|
||||||
@ -1102,7 +1104,7 @@ proc key.del ;///// DELETE NEXT CHAR OR SELECTION ////////////////////////////
|
|||||||
movzx eax,word[esi-4]
|
movzx eax,word[esi-4]
|
||||||
add esi,eax
|
add esi,eax
|
||||||
mov ecx,[cur_editor.Lines]
|
mov ecx,[cur_editor.Lines]
|
||||||
add ecx,[ecx-4]
|
add ecx,[cur_editor.Lines.Size] ;*** add ecx,[ecx-4]
|
||||||
sub ecx,esi
|
sub ecx,esi
|
||||||
cld
|
cld
|
||||||
@@: rep movsb
|
@@: rep movsb
|
||||||
@ -1127,7 +1129,7 @@ proc key.del ;///// DELETE NEXT CHAR OR SELECTION ////////////////////////////
|
|||||||
movzx eax,word[esi]
|
movzx eax,word[esi]
|
||||||
lea esi,[esi+eax+4]
|
lea esi,[esi+eax+4]
|
||||||
mov eax,[cur_editor.Lines]
|
mov eax,[cur_editor.Lines]
|
||||||
add eax,[eax-4]
|
add eax,[cur_editor.Lines.Size] ;*** add eax,[eax-4]
|
||||||
sub esi,eax
|
sub esi,eax
|
||||||
lea eax,[esi+4096]
|
lea eax,[esi+4096]
|
||||||
call editor_realloc_lines
|
call editor_realloc_lines
|
||||||
@ -1249,7 +1251,7 @@ proc key.tab ;///// TABULATE /////////////////////////////////////////////////
|
|||||||
pop eax
|
pop eax
|
||||||
pushad
|
pushad
|
||||||
mov ecx,[cur_editor.Lines]
|
mov ecx,[cur_editor.Lines]
|
||||||
add ecx,[ecx-4]
|
add ecx,[cur_editor.Lines.Size] ;*** add ecx,[ecx-4]
|
||||||
dec ecx
|
dec ecx
|
||||||
mov edi,ecx
|
mov edi,ecx
|
||||||
add ecx,-10+1
|
add ecx,-10+1
|
||||||
@ -1392,7 +1394,7 @@ proc key.return ;///// CARRIAGE RETURN ///////////////////////////////////////
|
|||||||
|
|
||||||
push ecx
|
push ecx
|
||||||
mov edi,[cur_editor.Lines]
|
mov edi,[cur_editor.Lines]
|
||||||
add edi,[edi-4]
|
add edi,[cur_editor.Lines.Size] ;*** add edi,[edi-4]
|
||||||
dec edi
|
dec edi
|
||||||
lea esi,[edi+4]
|
lea esi,[edi+4]
|
||||||
sub esi,ecx
|
sub esi,ecx
|
||||||
@ -1410,7 +1412,7 @@ proc key.return ;///// CARRIAGE RETURN ///////////////////////////////////////
|
|||||||
movzx ecx,word[ebp]
|
movzx ecx,word[ebp]
|
||||||
add esi,ecx
|
add esi,ecx
|
||||||
mov ecx,[cur_editor.Lines]
|
mov ecx,[cur_editor.Lines]
|
||||||
add ecx,[ecx-4]
|
add ecx,[cur_editor.Lines.Size] ;*** add ecx,[ecx-4]
|
||||||
sub ecx,esi
|
sub ecx,esi
|
||||||
cld
|
cld
|
||||||
@@: rep movsb
|
@@: rep movsb
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
diff16 'tp-mouse.asm',0,$
|
||||||
|
|
||||||
proc check_mouse_in_edit_area
|
proc check_mouse_in_edit_area
|
||||||
mcall 37,1
|
mcall 37,1
|
||||||
mov ebx,eax
|
mov ebx,eax
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
diff16 'tp-popup.asm',0,$
|
||||||
|
|
||||||
;POP_WIDTH = (popup_text.max_title+popup_text.max_accel+6)*6
|
;POP_WIDTH = (popup_text.max_title+popup_text.max_accel+6)*6
|
||||||
POP_IHEIGHT = 16
|
POP_IHEIGHT = 16
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
diff16 'tp-recode.asm',0,$
|
||||||
|
|
||||||
recode:
|
recode:
|
||||||
|
|
||||||
.866.1251:
|
.866.1251:
|
||||||
@ -37,4 +39,4 @@ recode:
|
|||||||
jmp @b
|
jmp @b
|
||||||
.exit:
|
.exit:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
diff16 'tp-tabctl.asm',0,$
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
proc flush_cur_tab ;///// SAVE CURRENT TAB DATA TO CONTROL ///////////////////
|
proc flush_cur_tab ;///// SAVE CURRENT TAB DATA TO CONTROL ///////////////////
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
diff16 'tp-tbox.asm',0,$
|
||||||
|
|
||||||
virtual at ebp
|
virtual at ebp
|
||||||
tbox TBOX
|
tbox TBOX
|
||||||
end virtual
|
end virtual
|
||||||
|
Loading…
x
Reference in New Issue
Block a user