change cursor in t_edit

git-svn-id: svn://kolibrios.org@8532 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2021-01-10 19:33:26 +00:00
parent 762358225b
commit 57d4f63fb8
3 changed files with 82 additions and 103 deletions

View File

@ -1230,16 +1230,16 @@ proc ted_text_add, edit:dword, text:dword, t_len:dword, add_opt:dword
add edx,sizeof.symbol add edx,sizeof.symbol
cmp edx,ted_tex_end cmp edx,ted_tex_end
jge @f ;out of memory jge @f ;out of memory
cmp ebx,0 or ebx,ebx
jne .beg_cycle jnz .beg_cycle
mov ted_ptr_free_symb,edx ;¬¥­ï¥¬ 㪠§ â¥«ì ­  ᢮¡®¤­ë© ᨬ¢®«, ¤«ï ¡®«¥¥ ¡ëáâண® ¯®¨áª  ¯ ¬ï⨠mov ted_ptr_free_symb,edx ;¬¥­ï¥¬ 㪠§ â¥«ì ­  ᢮¡®¤­ë© ᨬ¢®«, ¤«ï ¡®«¥¥ ¡ëáâண® ¯®¨áª  ¯ ¬ïâ¨
jmp .add_all jmp .add_all
@@: @@:
cmp ted_increase_size,0 cmp ted_increase_size,0
je .add_all je .add_all
call ted_memory_increase call ted_memory_increase
cmp ebx,0 or ebx,ebx
jne .beg_cycle jnz .beg_cycle
.add_all: ;¢á¥ ᨬ¢®«ë ¤®¡ ¢«¥­ë .add_all: ;¢á¥ ᨬ¢®«ë ¤®¡ ¢«¥­ë
call ted_text_colored call ted_text_colored
@ -1954,27 +1954,27 @@ ted_strlen:
; ebx = symbol position in line ; ebx = symbol position in line
align 16 align 16
ted_get_text_coords: ted_get_text_coords:
push edx push edx
xor eax,eax xor eax,eax
xor ebx,ebx xor ebx,ebx
@@: @@:
call ted_iterat_perv call ted_iterat_perv
cmp eax,0 or eax,eax
jne .no_col_mov jnz .no_col_mov
inc ebx inc ebx
.no_col_mov: .no_col_mov:
cmp edx,ted_tex_1 cmp edx,ted_tex_1
jle @f jle @f
cmp byte [edx],13 cmp byte [edx],13
jne @b jne @b
inc eax inc eax
jmp @b jmp @b
@@: @@:
dec ebx dec ebx
pop edx pop edx
ret ret
;input: ;input:
; edi = pointer to tedit struct ; edi = pointer to tedit struct
@ -3596,19 +3596,8 @@ pushad
imul edx,ted_rec_h imul edx,ted_rec_h
add ecx,edx 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 shl ecx,16
add ecx,ted_rec_h 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 mov ebx,ted_wnd_l ;calc rect -> x0,x1
add ebx,ted_rec_l add ebx,ted_rec_l
@ -3617,6 +3606,10 @@ pushad
add ebx,edx add ebx,edx
shl ebx,16 shl ebx,16
add ebx,ted_rec_w add ebx,ted_rec_w
cmp ted_cur_ins,1 ;¯à®¢¥àª  ०¨¬  à ¡®âë ªãàá®à  (®¡ëç­ë© ¨«¨ ¢áâ ¢ª )
jne @f
shr bx,2 ;㬥­ìè ¥¬ è¨à¨­ã ªãàá®à 
@@:
mov edx,ted_color_cursor mov edx,ted_color_cursor
int 0x40 ;¢ë¢®¤ ªãàá®à  int 0x40 ;¢ë¢®¤ ªãàá®à 
@ -3628,13 +3621,6 @@ pushad
ror ecx,16 ror ecx,16
mov bx,cx mov bx,cx
add ebx,0x10001 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 mov ecx,ted_color_cur_text
or ecx,ted_font_size or ecx,ted_font_size
call ted_convert_invis_symb call ted_convert_invis_symb
@ -4362,6 +4348,20 @@ ted_wnd_main_mouse_scroll:
shr ebx,1 shr ebx,1
cmp eax,ebx cmp eax,ebx
jae .no_scroll jae .no_scroll
mov ebx,ted_cur_y ;¯®§¨æ¨ï ªãàá®à 
sub ebx,eax ;- ­®¢ ï ¯®§¨æ¨ï áªà®««¨­£ 
add ebx,[ecx+sb_offs_position] ;+ áâ à ï ¯®§¨æ¨ï áªà®««¨­£ 
bt ebx,31
jnc @f
xor ebx,ebx ;¥á«¨ ªãàá®à áâ « ¢ëè¥ ®ª­ , â® áâ ¢¨¬ ­  ¢¥àå­îî áâபã
@@:
inc ebx
cmp ebx,[ecx+sb_offs_cur_area]
jle @f
mov ebx,[ecx+sb_offs_cur_area] ;¥á«¨ ªãàá®à áâ « ­¨¦¥ ®ª­ , â® áâ ¢¨¬ ­  ­¨¦­îî áâபã
@@:
dec ebx
mov ted_cur_y,ebx
mov [ecx+sb_offs_position],eax mov [ecx+sb_offs_position],eax
stdcall ted_draw,edi stdcall ted_draw,edi
.no_scroll: .no_scroll:

View File

@ -37,44 +37,30 @@ else
end if end if
rdsave: rdsave:
dd 7,0,hide,0,0 dd SSF_START_APP,0,hide,0,0
db '/sys/rdsave',0 db '/sys/rdsave',0
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
;Lib_DATA ;Lib_DATA
;‚ᥣ¤  ᮡ«î¤ âì ¯®á«¥¤®¢ â¥«ì­®áâì ¢ ¨¬¥­¨.
system_dir_Boxlib db '/sys/lib/box_lib.obj',0 system_dir_Boxlib db '/sys/lib/box_lib.obj',0
system_dir_libini db '/sys/lib/libini.obj',0 system_dir_libini db '/sys/lib/libini.obj',0
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
head_f_i:
head_f_l db 'System error',0
err_message_found_lib1 db 'box_lib.obj - Not found!',0
err_message_found_lib2 db 'libini.obj - Not found!',0
err_message_import1 db 'box_lib.obj - Wrong import!',0
err_message_import2 db 'libini.obj - Wrong import!',0
;---------------------------------------------------------------------
l_libs_start: l_libs_start:
library01 l_libs system_dir_Boxlib+9, cur_dir_path, library_path, system_dir_Boxlib, \ library01 l_libs system_dir_Boxlib+9, library_path, system_dir_Boxlib, Box_lib_import
err_message_found_lib1, head_f_l, Box_lib_import, err_message_import1, head_f_i library02 l_libs system_dir_libini+9, library_path, system_dir_libini, libini_import
library02 l_libs system_dir_libini+9, cur_dir_path, library_path, system_dir_libini, \
err_message_found_lib2, head_f_l, libini_import, err_message_import2, head_f_i
end_l_libs: end_l_libs:
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
align 4 align 4
Box_lib_import: Box_lib_import:
init_checkbox2 dd aInit_checkbox2 init_checkbox dd aInit_checkbox
check_box_draw2 dd aCheck_box_draw2 check_box_draw dd aCheck_box_draw
check_box_mouse2 dd aCheck_box_mouse2 check_box_mouse dd aCheck_box_mouse
;version_ch2 dd aVersion_ch2 ;version_ch2 dd aVersion_ch2
dd 0 dd 0,0
dd 0 aInit_checkbox db 'init_checkbox2',0
aInit_checkbox2 db 'init_checkbox2',0 aCheck_box_draw db 'check_box_draw2',0
aCheck_box_draw2 db 'check_box_draw2',0 aCheck_box_mouse db 'check_box_mouse2',0
aCheck_box_mouse2 db 'check_box_mouse2',0
;aVersion_ch2 db 'version_ch2',0 ;aVersion_ch2 db 'version_ch2',0
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
align 4 align 4
@ -82,8 +68,7 @@ libini_import:
init_lib dd a_init init_lib dd a_init
ini_get_int dd aini_get_int ini_get_int dd aini_get_int
ini_set_int dd aini_set_int ini_set_int dd aini_set_int
dd 0 dd 0,0
dd 0
a_init db 'lib_init',0 a_init db 'lib_init',0
aini_get_int db 'ini_get_int',0 aini_get_int db 'ini_get_int',0
aini_set_int db 'ini_set_int',0 aini_set_int db 'ini_set_int',0

View File

@ -1,6 +1,6 @@
; END ; END
; KolibriOS Team 2005-2016 ; KolibriOS Team 2005-2021
fade equ 0 fade equ 0
@ -20,7 +20,8 @@ include 'lang.inc'
include '../../../macros.inc' include '../../../macros.inc'
include '../../../proc32.inc' include '../../../proc32.inc'
include '../../../dll.inc' include '../../../dll.inc'
include '../../../develop/libraries/box_lib/load_lib.mac' include '../../../KOSfuncs.inc'
include '../../../load_lib.mac'
include '../../../develop/libraries/box_lib/trunk/box_lib.mac' include '../../../develop/libraries/box_lib/trunk/box_lib.mac'
include '../../../gui_patterns.inc' include '../../../gui_patterns.inc'
include "../../../string.inc" include "../../../string.inc"
@ -46,8 +47,7 @@ load_libraries l_libs_start,end_l_libs
test eax,eax test eax,eax
jz close jz close
push dword check1 stdcall [init_checkbox], check1
call [init_checkbox2]
stdcall dll.Init,[init_lib] stdcall dll.Init,[init_lib]
@ -57,11 +57,11 @@ invoke ini_get_int,ini_file,asettings,aautosave,0
jnz @f jnz @f
bts dword [check1.flags],1 bts dword [check1.flags],1
@@: @@:
mcall 40,0x80000027 mcall SF_SET_EVENTS_MASK,0x80000027
redraw: redraw:
call draw_window call draw_window
still: still:
mov al,10 mov al,SF_WAIT_EVENT
mcall ;wait here for event mcall ;wait here for event
dec eax dec eax
jz redraw jz redraw
@ -70,8 +70,7 @@ still:
dec eax dec eax
jz button jz button
push dword check1 stdcall [check_box_mouse], check1
call [check_box_mouse2]
bt dword [check1.flags],1 bt dword [check1.flags],1
jnc @f jnc @f
mov [autosave],1 mov [autosave],1
@ -81,8 +80,8 @@ still:
jmp still jmp still
key: key:
mov al,2 mov al,SF_GET_KEY
mcall ;eax=2 - get key code mcall ;get key code
mov al,ah mov al,ah
cmp al,13 cmp al,13
je restart je restart
@ -96,10 +95,10 @@ key:
jne still jne still
close: close:
mcall -1 mcall SF_TERMINATE_PROCESS
button: button:
mcall 17 ;eax=17 - get pressed button id mcall SF_GET_BUTTON ;get pressed button id
xchg al,ah xchg al,ah
dec eax dec eax
jz close jz close
@ -140,32 +139,32 @@ end if
jne no_save jne no_save
if fade=0 if fade=0
mov al,4 mov al,SF_DRAW_TEXT
mcall ,<50,120> ,0x800000cc,label7 ;eax=4 - write text mcall ,<50,120> ,0x800000cc,label7
end if end if
mcall 70,rdsave mcall SF_FILE,rdsave
test eax,eax test eax,eax
js no_save js no_save
mov ecx,eax mov ecx,eax
mcall 18,21 mcall SF_SYSTEM,SSF_GET_THREAD_SLOT
mov ecx,eax mov ecx,eax
@@: @@:
push ecx push ecx
mcall 23,100 mcall SF_WAIT_EVENT_TIMEOUT,100
dec eax dec eax
jnz no_red jnz no_red
call draw_window call draw_window
no_red: no_red:
pop ecx pop ecx
mcall 9,proc_info mcall SF_THREAD_INFO,proc_info
cmp [proc_info+50],9 cmp [proc_info+50],9
je no_save je no_save
jmp @b jmp @b
no_save: no_save:
pop ecx pop ecx
mcall 18,9 mcall SF_SYSTEM,SSF_SHUTDOWN
mcall -1 mcall SF_TERMINATE_PROCESS
ret ret
checkbox: checkbox:
@ -176,15 +175,14 @@ checkbox:
.1: .1:
mov [autosave],0 mov [autosave],0
.draw: .draw:
push dword check1 stdcall [check_box_draw], check1
call [check_box_draw2]
jmp still jmp still
draw_window: draw_window:
mcall 12,1 mcall SF_REDRAW,SSF_BEGIN_DRAW
mov al,14 mov al,SF_GET_SCREEN_SIZE
mcall ;eax=14 - get screen max x & max y mcall ;get screen max x & max y
movzx ecx,ax movzx ecx,ax
shr eax,17 shr eax,17
shl eax,16 shl eax,16
@ -207,8 +205,7 @@ draw_window:
DefineButton WIN_W-33, 2, 32, 20, CANCEL_BUTTON_ID, 0 DefineButton WIN_W-33, 2, 32, 20, CANCEL_BUTTON_ID, 0
WriteText WIN_W-23, 5, 10000001b, 0xFFFfff, TEXT_CANCEL WriteText WIN_W-23, 5, 10000001b, 0xFFFfff, TEXT_CANCEL
push dword check1 stdcall [check_box_draw], check1
call [check_box_draw2]
macro EndButton x, bgcol, id, but_text, hotkey_text macro EndButton x, bgcol, id, but_text, hotkey_text
{ {
@ -226,7 +223,7 @@ macro EndButton x, bgcol, id, but_text, hotkey_text
add ebx,butw / 2 + x add ebx,butw / 2 + x
shl ebx,16 shl ebx,16
add ebx,buty+8 add ebx,buty+8
mcall 4, , 10010000b shl 24 + 0xFFFfff, but_text mcall SF_DRAW_TEXT, , 10010000b shl 24 + 0xFFFfff, but_text
add ebx,1 shl 16 add ebx,1 shl 16
mcall mcall
stdcall string.length, hotkey_text stdcall string.length, hotkey_text
@ -236,15 +233,15 @@ macro EndButton x, bgcol, id, but_text, hotkey_text
add ebx,butw / 2 + x add ebx,butw / 2 + x
shl ebx,16 shl ebx,16
add ebx,buty+26 add ebx,buty+26
mcall 4, , 10000000b shl 24 + 0xFFFfff, hotkey_text mcall SF_DRAW_TEXT, , 10000000b shl 24 + 0xFFFfff, hotkey_text
} }
EndButton 20, 0x4E91C5, HOME_BUTTON_ID, TEXT_KERNEL, TEXT_HOME EndButton 20, 0x4E91C5, HOME_BUTTON_ID, TEXT_KERNEL, TEXT_HOME
EndButton 160, 0x55C891, REBOOT_BUTTON_ID, TEXT_REBOOT, TEXT_ENTER EndButton 160, 0x55C891, REBOOT_BUTTON_ID, TEXT_REBOOT, TEXT_ENTER
EndButton 300, 0xC75C54, POWEROFF_BUTTON_ID, TEXT_OFF, TEXT_END EndButton 300, 0xC75C54, POWEROFF_BUTTON_ID, TEXT_OFF, TEXT_END
mov al,12 mov al,SF_REDRAW
mcall ,2 mcall ,SSF_END_DRAW
ret ret
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
;data ;data
@ -258,11 +255,8 @@ proc_info rb 1024
autosave rd 1 autosave rd 1
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
cur_dir_path: cur_dir_path rb 4096
rb 4096 library_path rb 4096
;---------------------------------------------------------------------
library_path:
rb 4096
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
align 32 align 32
rb 4096 rb 4096