forked from KolibriOS/kolibrios
1) revised 't_edit' new function 'ted_init_scroll_bars'
2) updated documentation git-svn-id: svn://kolibrios.org@1458 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
; ¬ ªà®á ¤«ï á¨á⥬®© ¡¨¡«¨®â¥ª¨ box_lib.obj
|
||||
; í«¥¬¥â TextEditor ¤«ï Kolibri OS
|
||||
; ä ©« ¯®á«¥¤¨© à § ¨§¬¥ï«áï 29.04.2010 IgorA
|
||||
; ä ©« ¯®á«¥¤¨© à § ¨§¬¥ï«áï 03.05.2010 IgorA
|
||||
; ª®¤ ¯à¨¬¥¥ GPL2 «¨æ¥§¨ï
|
||||
|
||||
;input:
|
||||
@@ -54,6 +54,8 @@ struct symbol
|
||||
ends
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
ted_symbol_tab db 26
|
||||
|
||||
if lang eq ru
|
||||
|
||||
txtFindCapt db '�®¨áª',0
|
||||
@@ -80,7 +82,7 @@ end if
|
||||
|
||||
;------
|
||||
align 4
|
||||
EvChar db 0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0
|
||||
EvChar db 0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0
|
||||
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
|
||||
db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
|
||||
@@ -146,30 +148,95 @@ KEY_F3 equ 0x0000003D
|
||||
|
||||
align 4
|
||||
proc ted_init, edit:dword
|
||||
push eax ecx edi
|
||||
mov edi,dword[edit]
|
||||
push eax ecx edi
|
||||
mov edi,dword[edit]
|
||||
|
||||
mov ecx,sizeof.symbol
|
||||
imul ecx,ted_max_chars
|
||||
call mem_Alloc ;¢ë¤¥«ï¥¬ ¯ ¬ïâì
|
||||
mov ted_tex,eax
|
||||
mov ted_tex_1,eax
|
||||
add ted_tex_1,sizeof.symbol
|
||||
add eax,ecx
|
||||
mov ted_tex_end,eax
|
||||
mov ecx,sizeof.symbol
|
||||
imul ecx,ted_max_chars
|
||||
call mem_Alloc ;¢ë¤¥«ï¥¬ ¯ ¬ïâì
|
||||
mov ted_tex,eax
|
||||
mov ted_tex_1,eax
|
||||
add ted_tex_1,sizeof.symbol
|
||||
add eax,ecx
|
||||
mov ted_tex_end,eax
|
||||
|
||||
stdcall ted_clear, edi,1
|
||||
stdcall ted_clear, edi,1
|
||||
|
||||
;-------------------------------------------------
|
||||
mov ecx,1024 ;1024 - ¤«ï ¬ áᨢ ted_arr_key_pos
|
||||
add ecx,ted_syntax_file_size
|
||||
call mem_Alloc
|
||||
mov ted_arr_key_pos,eax
|
||||
add eax,1024
|
||||
mov ted_syntax_file,eax
|
||||
mov ecx,1024 ;1024 - ¤«ï ¬ áᨢ ted_arr_key_pos
|
||||
add ecx,ted_syntax_file_size
|
||||
call mem_Alloc
|
||||
mov ted_arr_key_pos,eax
|
||||
add eax,1024
|
||||
mov ted_syntax_file,eax
|
||||
|
||||
pop edi ecx eax
|
||||
ret
|
||||
stdcall ted_init_scroll_bars,edi,3
|
||||
pop edi ecx eax
|
||||
ret
|
||||
endp
|
||||
|
||||
MIN_W_SCRL_ARE equ 3 ;¬¨¨¬ «ì ï ®â®¡à ¦ ¥¬ ï ®¡« áâì ¤«ï ¢¥àâ. áªà®««¨£
|
||||
MIN_H_SCRL_ARE equ 3 ;¬¨¨¬ «ì ï ®â®¡à ¦ ¥¬ ï ®¡« áâì ¤«ï £®à¨§. áªà®««¨£
|
||||
;input:
|
||||
; opt = 1 - ¬¥ïâì æ¢¥â áªà®««¨£®¢, 2 - ¬¥ïâì ¢¥è¨¥ à §¬¥àë
|
||||
align 4
|
||||
proc ted_init_scroll_bars, edit:dword, opt:dword
|
||||
pushad
|
||||
mov esi,ted_scr_w
|
||||
mov ebx,ted_scr_h
|
||||
bt dword[opt],0
|
||||
jae @f
|
||||
mov ecx,ted_color_wnd_work
|
||||
mov dword[esi+sb_offs_bckg_col],ecx
|
||||
mov dword[ebx+sb_offs_bckg_col],ecx
|
||||
mov ecx,ted_color_wnd_capt
|
||||
mov dword[esi+sb_offs_frnt_col],ecx
|
||||
mov dword[ebx+sb_offs_frnt_col],ecx
|
||||
mov ecx,ted_color_wnd_bord
|
||||
mov dword[esi+sb_offs_line_col],ecx
|
||||
mov dword[ebx+sb_offs_line_col],ecx
|
||||
@@:
|
||||
bt dword[opt],1
|
||||
jae .no_size
|
||||
mov edx,ted_wnd_l
|
||||
add edx,ted_rec_l
|
||||
mov word[ebx+sb_offs_start_x],dx ;¢ëáâ ¢«ï¥¬ «¥¢ë© ®âáâ㯠£®à¨§. áªà®««¨£
|
||||
mov eax,ted_wnd_h ;calculate lines in page
|
||||
mov edx,ted_wnd_t
|
||||
add edx,eax
|
||||
mov word[ebx+sb_offs_start_y],dx ;¢ëáâ ¢«ï¥¬ ¢¥à娩 ®âáâ㯠£®à¨§. áªà®««¨£
|
||||
sub eax,ted_rec_t
|
||||
xor edx,edx
|
||||
mov ecx,ted_rec_h
|
||||
div ecx
|
||||
cmp eax,MIN_W_SCRL_ARE
|
||||
jg @f
|
||||
mov eax,MIN_W_SCRL_ARE
|
||||
@@:
|
||||
mov dword[esi+sb_offs_cur_area],eax
|
||||
|
||||
mov eax,ted_wnd_w ;calculate cols in page
|
||||
mov edx,ted_wnd_l ;«¥¢ë© ®âáâ㯠®ª
|
||||
add edx,eax ;¤®¡ ¢«ï¥¬ è¨à¨ã ®ª
|
||||
mov word[esi+sb_offs_start_x],dx ;¢ëáâ ¢«ï¥¬ «¥¢ë© ®âáâ㯠¢¥àâ. áªà®««¨£
|
||||
mov edx,ted_wnd_t
|
||||
mov word[esi+sb_offs_start_y],dx ;¢ëáâ ¢«ï¥¬ ¢¥à娩 ®âáâ㯠¢¥àâ. áªà®««¨£
|
||||
mov edx,ted_wnd_h
|
||||
mov word[esi+sb_offs_size_y],dx ;¢ëáâ ¢«ï¥¬ ¢ëá®âã ¢¥àâ. áªà®««¨£
|
||||
sub eax,ted_rec_l
|
||||
mov word[ebx+sb_offs_size_x],ax ;¢ëáâ ¢«ï¥¬ è¨à¨ã £®à¨§. áªà®««¨£
|
||||
xor edx,edx
|
||||
mov ecx,ted_rec_w
|
||||
div ecx
|
||||
cmp eax,MIN_H_SCRL_ARE
|
||||
jg @f
|
||||
mov eax,MIN_H_SCRL_ARE
|
||||
@@:
|
||||
dec eax
|
||||
mov dword[ebx+sb_offs_cur_area],eax ;ãáâ ¢«¨¢ ¥¬ ç¨á«® ᨬ¢®«®¢, ª®â®àë¥ ¢« §ïâ ¢ íªà ¤«ï £®à¨§. áªà®««¨£
|
||||
.no_size:
|
||||
popad
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
@@ -193,6 +260,9 @@ align 4
|
||||
proc ted_key, edit:dword, table:dword, control:dword
|
||||
pushad
|
||||
mov edi,dword[edit]
|
||||
mov esi,ted_el_focus
|
||||
cmp dword[esi],edi
|
||||
jne .end_key_fun ;í«¥¬¥â ¥ ¢ 䮪ãᥠ¢ë室¨¬ ¨§ äãªæ¨¨
|
||||
mov esi,dword[control]
|
||||
|
||||
cmp ah,KEY_F1 ;[F1]
|
||||
@@ -214,6 +284,12 @@ proc ted_key, edit:dword, table:dword, control:dword
|
||||
je @f
|
||||
call ted_fun_on_key_ctrl_o
|
||||
@@:
|
||||
cmp ah,31 ;Ctrl+S
|
||||
jne @f
|
||||
cmp ted_fun_on_key_ctrl_s,0
|
||||
je @f
|
||||
call ted_fun_on_key_ctrl_s
|
||||
@@:
|
||||
cmp ah,33 ;Ctrl+F
|
||||
jne @f
|
||||
cmp ted_panel_id,TED_PANEL_FIND
|
||||
@@ -247,41 +323,41 @@ proc ted_key, edit:dword, table:dword, control:dword
|
||||
jmp .end_key_fun
|
||||
.key_Ctrl:
|
||||
|
||||
test esi,KM_SHIFT ;Shift+...
|
||||
jz .key_Shift
|
||||
cmp ah,72 ;Shift+Up
|
||||
jne @f
|
||||
call ted_sel_key_up
|
||||
@@:
|
||||
cmp ah,75 ;Shift+Left
|
||||
jne @f
|
||||
call ted_sel_key_left
|
||||
@@:
|
||||
cmp ah,77 ;Shift+Right
|
||||
jne @f
|
||||
call ted_sel_key_right
|
||||
@@:
|
||||
cmp ah,80 ;Shift+Down
|
||||
jne @f
|
||||
call ted_sel_key_down
|
||||
@@:
|
||||
;mov ted_drag_k,1 ; ç¨ ¥¬ ¢ë¤¥«¥¨¥ ®â ª« ¢¨ âãàë
|
||||
jmp .key_MoveCur
|
||||
.key_Shift:
|
||||
test esi,KM_SHIFT ;Shift+...
|
||||
jz .key_Shift
|
||||
cmp ah,72 ;Shift+Up
|
||||
jne @f
|
||||
call ted_sel_key_up
|
||||
@@:
|
||||
cmp ah,75 ;Shift+Left
|
||||
jne @f
|
||||
call ted_sel_key_left
|
||||
@@:
|
||||
cmp ah,77 ;Shift+Right
|
||||
jne @f
|
||||
call ted_sel_key_right
|
||||
@@:
|
||||
cmp ah,80 ;Shift+Down
|
||||
jne @f
|
||||
call ted_sel_key_down
|
||||
@@:
|
||||
;mov ted_drag_k,1 ; ç¨ ¥¬ ¢ë¤¥«¥¨¥ ®â ª« ¢¨ âãàë
|
||||
jmp .key_MoveCur
|
||||
.key_Shift:
|
||||
;-------------------------------------------------
|
||||
cmp ah,72 ;178 ;Up
|
||||
jne @f
|
||||
call ted_draw_cursor_sumb
|
||||
call ted_cur_move_up
|
||||
cmp dl,8
|
||||
jne .no_red_0
|
||||
call ted_scroll_set_redraw
|
||||
stdcall ted_draw,edi
|
||||
jmp @f
|
||||
.no_red_0:
|
||||
call ted_draw_main_cursor
|
||||
mov ted_drag_k,0 ;§ ª 稢 ¥¬ ¢ë¤¥«¥¨¥ ®â ª« ¢¨ âãàë
|
||||
@@:
|
||||
cmp ah,72 ;178 ;Up
|
||||
jne @f
|
||||
call ted_draw_cursor_sumb
|
||||
call ted_cur_move_up
|
||||
cmp dl,8
|
||||
jne .no_red_0
|
||||
call ted_scroll_set_redraw
|
||||
stdcall ted_draw,edi
|
||||
jmp @f
|
||||
.no_red_0:
|
||||
call ted_draw_main_cursor
|
||||
mov ted_drag_k,0 ;§ ª 稢 ¥¬ ¢ë¤¥«¥¨¥ ®â ª« ¢¨ âãàë
|
||||
@@:
|
||||
cmp ah,80 ;177 ;Down
|
||||
jne @f
|
||||
call ted_draw_cursor_sumb
|
||||
@@ -365,8 +441,8 @@ proc ted_key, edit:dword, table:dword, control:dword
|
||||
mov ted_drag_k,0 ;§ ª 稢 ¥¬ ¢ë¤¥«¥¨¥ ®â ª« ¢¨ âãàë
|
||||
@@:
|
||||
;-------------------------------------------------
|
||||
; cmp esi,0
|
||||
; jne .end_key_fun
|
||||
; cmp esi,0
|
||||
; jne .end_key_fun
|
||||
.key_MoveCur:
|
||||
|
||||
cmp ah,69 ;[Pause Break]
|
||||
@@ -607,11 +683,11 @@ proc ted_clear, edit:dword, cl_al_mem:dword
|
||||
|
||||
mov ecx,ted_scr_w
|
||||
mov dword[ecx+sb_offs_position],0
|
||||
mov dword[ecx+sb_offs_max_area],100
|
||||
mov dword[ecx+sb_offs_max_area],100 ;ç¨á«® áâப ¢¨¤¨¬ëå ¢ ®¢®¬ ¤®ªã¬¥â¥
|
||||
mov dword[ecx+sb_offs_redraw],1
|
||||
mov ecx,ted_scr_h
|
||||
mov dword[ecx+sb_offs_position],0
|
||||
mov dword[ecx+sb_offs_max_area],100
|
||||
mov dword[ecx+sb_offs_max_area],100 ;ç¨á«® ᨬ¢®«®¢ ¢¨¤¨¬ëå ¢ ®¢®¬ ¤®ªã¬¥â¥
|
||||
|
||||
mov ted_sel_x0,0
|
||||
mov ted_sel_y0,0
|
||||
@@ -724,6 +800,7 @@ proc ted_init_syntax_file, edit:dword, file:dword, f_name:dword
|
||||
add ecx,ted_key_words_data
|
||||
mov ted_help_text_f1,ecx
|
||||
|
||||
stdcall ted_init_scroll_bars,edi,1 ;¬¥ï¥¬ 梥â áªà®««¨£®¢
|
||||
.no_colors:
|
||||
popad
|
||||
ret
|
||||
@@ -2805,14 +2882,19 @@ ted_get_symb_color:
|
||||
; ”ãªæ¨ï ¯à¥®¡à §ã¥â ¥¢¨¤¨¬ë¥ ᨬ¢®«ë ¢ ¯¥ç â ¥¬ë¥ íªà ¥
|
||||
align 4
|
||||
ted_convert_invis_symb:
|
||||
cmp ted_mode_invis,1
|
||||
jne @f
|
||||
cmp byte[edx],13
|
||||
jne @f
|
||||
mov edx,edi
|
||||
add edx,ted_offs_symbol_new_line
|
||||
@@:
|
||||
ret
|
||||
cmp ted_mode_invis,1
|
||||
jne .end_f
|
||||
cmp byte[edx],9
|
||||
jne @f
|
||||
lea edx,[ted_symbol_tab]
|
||||
@@:
|
||||
cmp byte[edx],13
|
||||
jne @f
|
||||
mov edx,edi
|
||||
add edx,ted_offs_symbol_new_line
|
||||
@@:
|
||||
.end_f:
|
||||
ret
|
||||
|
||||
;input:
|
||||
; edi = pointer to tedit struct
|
||||
@@ -2828,93 +2910,93 @@ ted_scroll_set_redraw:
|
||||
|
||||
align 4
|
||||
proc ted_draw, edit:dword
|
||||
locals
|
||||
line_num dd ?
|
||||
endl
|
||||
pushad
|
||||
mov edi,dword[edit]
|
||||
locals
|
||||
line_num dd ?
|
||||
endl
|
||||
pushad
|
||||
mov edi,dword[edit]
|
||||
|
||||
mov eax,4 ;draw text
|
||||
mov ecx,ted_text_colors
|
||||
mov ecx,dword[ecx]
|
||||
mov eax,4 ;draw text
|
||||
mov ecx,ted_text_colors
|
||||
mov ecx,dword[ecx]
|
||||
|
||||
mov ebx,ted_wnd_l
|
||||
add ebx,ted_rec_l
|
||||
shl ebx,16
|
||||
add ebx,ted_wnd_t
|
||||
add ebx,ted_rec_t
|
||||
add ebx,0x10001 ;¤®¡ ¢«ï¥¬ ®âáâã¯ë ¤«ï ¢ëà ¢¨¢ ¨ï ¡ãª¢ë ¯® æ¥âàã
|
||||
mov ebx,ted_wnd_l
|
||||
add ebx,ted_rec_l
|
||||
shl ebx,16
|
||||
add ebx,ted_wnd_t
|
||||
add ebx,ted_rec_t
|
||||
add ebx,0x10001 ;¤®¡ ¢«ï¥¬ ®âáâã¯ë ¤«ï ¢ëà ¢¨¢ ¨ï ¡ãª¢ë ¯® æ¥âàã
|
||||
|
||||
call ted_sel_normalize ;need before draw select
|
||||
mov esi,ted_scr_w
|
||||
mov esi,dword[esi+sb_offs_position]
|
||||
mov dword[line_num],esi
|
||||
call ted_sel_normalize ;need before draw select
|
||||
mov esi,ted_scr_w
|
||||
mov esi,dword[esi+sb_offs_position]
|
||||
mov dword[line_num],esi
|
||||
|
||||
stdcall ted_clear_line_before_draw, edi,ebx,1,esi
|
||||
call ted_get_first_visible_pos
|
||||
cmp edx,0
|
||||
je .no_draw_text
|
||||
mov esi,1 ;¤«¨ ¢ë¢®¤¨¬®£® ⥪áâ ¯® 1-¬ã ᨬ¢®«ã
|
||||
@@:
|
||||
call ted_iterat_next
|
||||
cmp edx,ted_tex_1
|
||||
jle .no_draw_text
|
||||
stdcall ted_clear_line_before_draw, edi,ebx,1,esi
|
||||
call ted_get_first_visible_pos
|
||||
cmp edx,0
|
||||
je .no_draw_text
|
||||
mov esi,1 ;¤«¨ ¢ë¢®¤¨¬®£® ⥪áâ ¯® 1-¬ã ᨬ¢®«ã
|
||||
@@:
|
||||
call ted_iterat_next
|
||||
cmp edx,ted_tex_1
|
||||
jle .no_draw_text
|
||||
|
||||
; *** 梥⮢ ï à §¬¥âª
|
||||
cmp ted_mode_color,0
|
||||
je .no_col_change
|
||||
cmp byte[edx+1],0
|
||||
je .no_col_change
|
||||
call ted_get_symb_color
|
||||
.no_col_change:
|
||||
; *** 梥⮢ ï à §¬¥âª
|
||||
cmp ted_mode_color,0
|
||||
je .no_col_change
|
||||
cmp byte[edx+1],0
|
||||
je .no_col_change
|
||||
call ted_get_symb_color
|
||||
.no_col_change:
|
||||
|
||||
cmp byte [edx],13
|
||||
jne .no_13
|
||||
cmp ted_mode_invis,1
|
||||
jne .no_invis
|
||||
push edx
|
||||
mov edx,edi
|
||||
add edx,ted_offs_symbol_new_line
|
||||
int 0x40
|
||||
pop edx
|
||||
.no_invis:
|
||||
add ebx,ted_rec_h
|
||||
;optimized output \/
|
||||
mov eax,ted_wnd_h
|
||||
add eax,ted_wnd_t
|
||||
cmp bx,ax
|
||||
jg .no_draw_text
|
||||
mov eax,4
|
||||
;optimized output /\
|
||||
and ebx,0xffff
|
||||
ror ebx,16
|
||||
add ebx,ted_wnd_l
|
||||
add ebx,ted_rec_l
|
||||
inc ebx
|
||||
ror ebx,16
|
||||
inc dword[line_num] ;increment line number
|
||||
stdcall ted_clear_line_before_draw,edi,ebx,1,dword[line_num]
|
||||
call ted_opt_draw_line_left
|
||||
jmp @b
|
||||
.no_13:
|
||||
cmp byte [edx],13
|
||||
jne .no_13
|
||||
cmp ted_mode_invis,1
|
||||
jne .no_invis
|
||||
push edx
|
||||
mov edx,edi
|
||||
add edx,ted_offs_symbol_new_line
|
||||
int 0x40
|
||||
pop edx
|
||||
.no_invis:
|
||||
add ebx,ted_rec_h
|
||||
;optimized output \/
|
||||
mov eax,ted_wnd_h
|
||||
add eax,ted_wnd_t
|
||||
cmp bx,ax
|
||||
jg .no_draw_text
|
||||
mov eax,4
|
||||
;optimized output /\
|
||||
and ebx,0xffff
|
||||
ror ebx,16
|
||||
add ebx,ted_wnd_l
|
||||
add ebx,ted_rec_l
|
||||
inc ebx
|
||||
ror ebx,16
|
||||
inc dword[line_num] ;increment line number
|
||||
stdcall ted_clear_line_before_draw,edi,ebx,1,dword[line_num]
|
||||
call ted_opt_draw_line_left
|
||||
jmp @b
|
||||
.no_13:
|
||||
|
||||
int 0x40
|
||||
ror ebx,16
|
||||
add ebx,ted_rec_w
|
||||
mov esi,ted_wnd_l
|
||||
add esi,ted_wnd_w
|
||||
cmp bx,si
|
||||
jl .no_opt
|
||||
call ted_opt_draw_line_right
|
||||
.no_opt:
|
||||
mov si,1
|
||||
ror ebx,16
|
||||
jmp @b
|
||||
.no_draw_text:
|
||||
int 0x40
|
||||
ror ebx,16
|
||||
add ebx,ted_rec_w
|
||||
mov esi,ted_wnd_l
|
||||
add esi,ted_wnd_w
|
||||
cmp bx,si
|
||||
jl .no_opt
|
||||
call ted_opt_draw_line_right
|
||||
.no_opt:
|
||||
mov si,1
|
||||
ror ebx,16
|
||||
jmp @b
|
||||
.no_draw_text:
|
||||
|
||||
stdcall ted_clear_line_before_draw,edi,ebx,0,dword[line_num]
|
||||
call ted_draw_line_numbers
|
||||
call ted_draw_main_cursor
|
||||
stdcall ted_clear_line_before_draw,edi,ebx,0,dword[line_num]
|
||||
call ted_draw_line_numbers
|
||||
call ted_draw_main_cursor
|
||||
|
||||
;---------------------------------------------
|
||||
; set all_redraw flag for draw all ScrollBar
|
||||
@@ -3086,7 +3168,8 @@ pop edi
|
||||
je @f
|
||||
mov ecx,ted_tim_undo
|
||||
add edx,0x500000
|
||||
int 0x40
|
||||
mov edi,ted_color_wnd_work ;¯®à⨬ ॣ¨áâà edi, ® ¢ ª®æ¥ äãªæ¨¨ í⮠㦥 ¥ ¢ ¦®
|
||||
int 0x40 ;¢ë¢®¤ ç¨á« ®â¬¥¥ëå ¤¥©á⢨©
|
||||
@@:
|
||||
|
||||
popad
|
||||
@@ -3101,9 +3184,12 @@ proc ted_draw_buffer
|
||||
mov eax,ted_buffer
|
||||
cmp byte[eax],0 ;ᬮâਬ 1-© ᨬ¢®« ¨§ ¡ãä¥à
|
||||
je @f
|
||||
mov ebx,ted_wnd_l
|
||||
add ebx,ted_rec_l
|
||||
mov ebx,ted_rec_l
|
||||
add bx,300
|
||||
cmp ebx,ted_wnd_w ;áà ¢¨¢ ¥¬ ª®®à¤¨ âã ¤«ï ¢ë¢®¤ ⥪áâ
|
||||
jge @f ;¯®¤¯¨áì ¥ ¢« §¨â ¢ ®ª®
|
||||
|
||||
add ebx,ted_wnd_l
|
||||
shl ebx,16
|
||||
add ebx,ted_wnd_t
|
||||
add ebx,3
|
||||
@@ -3141,59 +3227,60 @@ endp
|
||||
; edi = pointer to tedit struct
|
||||
align 4
|
||||
proc ted_draw_help_f1
|
||||
pushad
|
||||
pushad
|
||||
cmp ted_rec_t,13 ;¬¨¨¬ «ì ï ¢ëá®â ¤«ï à¨á®¢ ¨ï á¯à ¢ª¨
|
||||
jle @f
|
||||
mov eax,13 ;clear place before draw help
|
||||
mov ebx,ted_wnd_l
|
||||
add ebx,ted_rec_l
|
||||
shl ebx,16
|
||||
add ebx,ted_wnd_w
|
||||
sub ebx,ted_rec_l
|
||||
mov ecx,ted_wnd_t
|
||||
add ecx,13
|
||||
shl ecx,16
|
||||
add ecx,ted_rec_h
|
||||
mov edx,ted_color_wnd_capt
|
||||
int 0x40
|
||||
|
||||
mov eax,13 ;clear place before draw help
|
||||
mov ebx,ted_wnd_l
|
||||
add ebx,ted_rec_l
|
||||
shl ebx,16
|
||||
add ebx,ted_wnd_w
|
||||
sub ebx,ted_rec_l
|
||||
mov ecx,ted_wnd_t
|
||||
add ecx,13
|
||||
shl ecx,16
|
||||
add ecx,ted_rec_h
|
||||
mov edx,ted_color_wnd_capt
|
||||
int 0x40
|
||||
cmp ted_help_id,-1
|
||||
je @f
|
||||
mov eax,ted_help_id
|
||||
ColToIndexOffset eax,edx
|
||||
|
||||
cmp ted_help_id,-1
|
||||
je @f
|
||||
mov eax,ted_help_id
|
||||
ColToIndexOffset eax,edx
|
||||
;SetCoordinates
|
||||
mov ebx,ted_wnd_l
|
||||
add ebx,ted_rec_l
|
||||
shl ebx,16
|
||||
add ebx,ted_wnd_t
|
||||
add ebx,13 ;=3+10
|
||||
|
||||
;SetCoordinates
|
||||
mov ebx,ted_wnd_l
|
||||
add ebx,ted_rec_l
|
||||
shl ebx,16
|
||||
add ebx,ted_wnd_t
|
||||
add ebx,13 ;=3+10
|
||||
;SetTextColor
|
||||
xor eax,eax
|
||||
mov al,byte[edx+MAX_COLOR_WORD_LEN+6]
|
||||
shl ax,2
|
||||
mov ecx,ted_text_colors
|
||||
add ecx,eax
|
||||
mov ecx,dword[ecx]
|
||||
or ecx,0xc0000000 ;SetTextStyles
|
||||
mov esi,edi
|
||||
mov edi,ted_color_wnd_work
|
||||
mov eax,4
|
||||
int 0x40
|
||||
mov edi,esi
|
||||
|
||||
;SetTextColor
|
||||
xor eax,eax
|
||||
mov al,byte[edx+MAX_COLOR_WORD_LEN+6]
|
||||
shl ax,2
|
||||
mov ecx,ted_text_colors
|
||||
add ecx,eax
|
||||
mov ecx,dword[ecx]
|
||||
or ecx,0xc0000000 ;SetTextStyles
|
||||
mov esi,edi
|
||||
mov edi,ted_color_wnd_work
|
||||
mov eax,4
|
||||
int 0x40
|
||||
mov edi,esi
|
||||
|
||||
;*** draw help string ***
|
||||
mov ecx,ted_color_wnd_bord
|
||||
or ecx,0x80000000
|
||||
mov edx,dword[edx+MAX_COLOR_WORD_LEN]
|
||||
cmp edx,0
|
||||
je @f
|
||||
add edx,ted_help_text_f1
|
||||
add ebx,0x500000
|
||||
int 0x40
|
||||
@@:
|
||||
popad
|
||||
ret
|
||||
;*** draw help string ***
|
||||
mov ecx,ted_color_wnd_bord
|
||||
or ecx,0x80000000
|
||||
mov edx,dword[edx+MAX_COLOR_WORD_LEN]
|
||||
cmp edx,0
|
||||
je @f
|
||||
add edx,ted_help_text_f1
|
||||
add ebx,0x500000
|
||||
int 0x40
|
||||
@@:
|
||||
popad
|
||||
ret
|
||||
endp
|
||||
|
||||
;input:
|
||||
@@ -3698,7 +3785,11 @@ proc ted_mouse, edit:dword
|
||||
call ted_wnd_main_click
|
||||
jmp .no_in_wnd
|
||||
@@:
|
||||
call ted_wnd_main_mouse_scroll
|
||||
mov edx,ted_el_focus
|
||||
cmp dword[edx],edi
|
||||
jne @f
|
||||
call ted_wnd_main_mouse_scroll ;ᬮâਬ ¯à®ªàãâªã ª®«¥á ¬ëè¨
|
||||
@@:
|
||||
cmp ted_drag_m,0
|
||||
je .no_in_wnd
|
||||
mov ted_drag_m,0
|
||||
@@ -3718,7 +3809,9 @@ endp
|
||||
; äãªæ¨ï ¢ë§ë¢¥âáï ¯à¨ ¦ ⨨ ª®¯ª®© ¬ëè¨ ¨ ¯®¯ ¤¥¨¨ ªãàá®à®¬ ¢ ®ª® । ªâ®à
|
||||
align 4
|
||||
ted_wnd_main_click:
|
||||
push ebx ecx edx
|
||||
push ebx ecx edx
|
||||
mov ebx,ted_el_focus
|
||||
mov dword[ebx],edi ;áâ ¢¨¬ 䮪ãá
|
||||
|
||||
push eax
|
||||
shr eax,16
|
||||
@@ -3757,23 +3850,23 @@ ted_wnd_main_click:
|
||||
mov ted_cur_y,eax
|
||||
pop eax
|
||||
|
||||
cmp ted_drag_m,0
|
||||
je @f
|
||||
call ted_sel_move
|
||||
jmp .sel_move
|
||||
@@:
|
||||
mov ted_drag_m,1
|
||||
call ted_sel_start
|
||||
.sel_move:
|
||||
pop edx ecx ebx
|
||||
ret
|
||||
cmp ted_drag_m,0
|
||||
je @f
|
||||
call ted_sel_move
|
||||
jmp .sel_move
|
||||
@@:
|
||||
mov ted_drag_m,1
|
||||
call ted_sel_start
|
||||
.sel_move:
|
||||
pop edx ecx ebx
|
||||
ret
|
||||
|
||||
;input:
|
||||
; edi = pointer to tedit struct
|
||||
align 4
|
||||
ted_wnd_main_mouse_scroll:
|
||||
push eax ebx ecx
|
||||
mcall 37,7
|
||||
mcall 37,7 ;¯à®ªàã⪠ª®«¥á ¬ëè¨
|
||||
cmp ax,0
|
||||
je .no_scroll
|
||||
mov ecx,ted_scr_w
|
||||
@@ -3782,16 +3875,16 @@ ted_wnd_main_mouse_scroll:
|
||||
btr ax,15
|
||||
jae @f
|
||||
or eax,0xffff8000
|
||||
@@:
|
||||
add dword[ecx+sb_offs_position],eax
|
||||
@@:
|
||||
add dword[ecx+sb_offs_position],eax
|
||||
|
||||
mov eax,[ecx+sb_offs_position]
|
||||
cmp eax,[ecx+sb_offs_max_area]
|
||||
jb @f
|
||||
mov dword[ecx+sb_offs_position],ebx ;if scroll position out of range
|
||||
jmp .no_scroll
|
||||
@@:
|
||||
stdcall ted_draw,edi
|
||||
mov eax,[ecx+sb_offs_position]
|
||||
cmp eax,[ecx+sb_offs_max_area]
|
||||
jb @f
|
||||
mov dword[ecx+sb_offs_position],ebx ;if scroll position out of range
|
||||
jmp .no_scroll
|
||||
@@:
|
||||
stdcall ted_draw,edi
|
||||
.no_scroll:
|
||||
pop ecx ebx eax
|
||||
ret
|
||||
|
||||
Reference in New Issue
Block a user