forked from KolibriOS/kolibrios
add select word by double click
git-svn-id: svn://kolibrios.org@6239 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
b28721dd10
commit
d112b67c4c
@ -1,13 +1,3 @@
|
||||
struct FileInfoBlock
|
||||
Function dd ?
|
||||
Position dd ?
|
||||
Flags dd ?
|
||||
Count dd ?
|
||||
Buffer dd ?
|
||||
db ?
|
||||
FileName dd ?
|
||||
ends
|
||||
|
||||
struct symbol
|
||||
c db ? ; +0 ᨬ¢®«
|
||||
col db ? ; +1 梥â
|
||||
@ -412,53 +402,47 @@ but_find_key_w:
|
||||
;description:
|
||||
; ¢ë¤¥«¥¨¥/áªàë⨥ ¥¯¥ç â ¥¬ëå ᨬ¢®«®¢
|
||||
align 4
|
||||
proc but_sumb_invis, edit:dword
|
||||
push edi
|
||||
mov edi,dword[edit]
|
||||
proc but_sumb_invis uses edi, edit:dword
|
||||
mov edi,dword[edit]
|
||||
|
||||
xor ted_mode_invis,1
|
||||
call draw_but_toolbar
|
||||
stdcall [ted_draw],edi
|
||||
pop edi
|
||||
ret
|
||||
xor ted_mode_invis,1
|
||||
call draw_but_toolbar
|
||||
stdcall [ted_draw],edi
|
||||
ret
|
||||
endp
|
||||
|
||||
;description:
|
||||
; ¢ë¤¥«¥¨¥/áªàë⨥ ª«î祢ëå á«®¢
|
||||
align 4
|
||||
proc but_k_words_show, edit:dword
|
||||
push edi
|
||||
mov edi,dword[edit]
|
||||
proc but_k_words_show uses edi, edit:dword
|
||||
mov edi,dword[edit]
|
||||
|
||||
xor ted_mode_color,1
|
||||
cmp ted_mode_color,0
|
||||
je @f
|
||||
call [ted_text_colored]
|
||||
@@:
|
||||
call draw_but_toolbar
|
||||
stdcall [ted_draw],edi
|
||||
pop edi
|
||||
ret
|
||||
xor ted_mode_color,1
|
||||
cmp ted_mode_color,0
|
||||
je @f
|
||||
call [ted_text_colored]
|
||||
@@:
|
||||
call draw_but_toolbar
|
||||
stdcall [ted_draw],edi
|
||||
ret
|
||||
endp
|
||||
|
||||
;description:
|
||||
; ¢ë§®¢/áªàë⨥ ¯ ¥«¨ á ä ©« ¬¨ á¨â ªá¨á
|
||||
align 4
|
||||
proc but_synt_show, edit:dword
|
||||
push edi
|
||||
mov edi,[edit]
|
||||
proc but_synt_show uses edi, edit:dword
|
||||
mov edi,[edit]
|
||||
|
||||
cmp ted_panel_id,TED_PANEL_NULL
|
||||
je @f
|
||||
mov ted_panel_id,TED_PANEL_NULL
|
||||
mov ted_wnd_l,0
|
||||
jmp .e_if
|
||||
@@:
|
||||
mov ted_panel_id,TED_PANEL_SYNTAX
|
||||
mov ted_wnd_l,TED_PANEL_WIDTH
|
||||
.e_if:
|
||||
call EvSize
|
||||
stdcall [ted_draw],edi
|
||||
pop edi
|
||||
ret
|
||||
cmp ted_panel_id,TED_PANEL_NULL
|
||||
je @f
|
||||
mov ted_panel_id,TED_PANEL_NULL
|
||||
mov ted_wnd_l,0
|
||||
jmp .e_if
|
||||
@@:
|
||||
mov ted_panel_id,TED_PANEL_SYNTAX
|
||||
mov ted_wnd_l,TED_PANEL_WIDTH
|
||||
.e_if:
|
||||
call EvSize
|
||||
stdcall [ted_draw],edi
|
||||
ret
|
||||
endp
|
||||
|
@ -14,11 +14,9 @@ maxSyntaxFileSize equ 410000
|
||||
TOOLBAR_ICONS_SIZE equ 1200*20
|
||||
|
||||
include '../../proc32.inc'
|
||||
;include '../../config.inc'
|
||||
include '../../macros.inc'
|
||||
include '../../dll.inc'
|
||||
include '../../KOSfuncs.inc'
|
||||
include '../../develop/libraries/box_lib/load_lib.mac'
|
||||
include '../../load_img.inc'
|
||||
include '../../develop/libraries/box_lib/trunk/box_lib.mac'
|
||||
include '../../system/skincfg/trunk/kglobals.inc'
|
||||
include '../../system/skincfg/trunk/unpacker.inc'
|
||||
@ -33,50 +31,6 @@ include 'wnd_k_words.inc'
|
||||
|
||||
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
|
||||
|
||||
|
||||
;Œ ªà®á ¤«ï § £à㧪¨ ¨§®¡à ¦¥¨© á ¨á¯®«ì§®¢ ¨¥¬ ¡¨¡«¨®â¥ª¨ libimg.obj
|
||||
;¤«ï ¨á¯®«ì§®¢ ¨ï ¬ ªà®á ã¦ë ¯¥à¥¬¥ë¥:
|
||||
; - run_file_70 FileInfoBlock
|
||||
; - image_data dd 0
|
||||
macro load_image_file path,buf,size
|
||||
{
|
||||
;path - ¬®¦¥â ¡ëâì ¯¥à¥¬¥®© ¨«¨ áâப®¢ë¬ ¯ à ¬¥â஬
|
||||
if path eqtype '' ;¯à®¢¥à塞 § ¤ «¨ áâப®© ¯ à ¬¥âà path
|
||||
jmp @f
|
||||
local .path_str
|
||||
.path_str db path ;ä®à¬¨à㥬 «®ª «ìãî ¯¥à¥¬¥ãî
|
||||
db 0
|
||||
@@:
|
||||
;32 - áâ ¤ àâë© ¤à¥á ¯® ª®â®à®¬ã ¤®«¦¥ ¡ëâì ¡ãä¥à á á¨áâ¥¬ë¬ ¯ã⥬
|
||||
copy_path .path_str,[32],file_name,0
|
||||
else
|
||||
copy_path path,[32],file_name,0 ;ä®à¬¨à㥬 ¯®«ë© ¯ãâì ª ä ©«ã ¨§®¡à ¦¥¨ï, ¯®¤à §ã¬¥¢ ¥¬ çâ® ® ¢ ®¤®© ¯ ¯ª¥ á ¯à®£à ¬¬®©
|
||||
end if
|
||||
|
||||
stdcall mem.Alloc, dword size ;¢ë¤¥«ï¥¬ ¯ ¬ïâì ¤«ï ¨§®¡à ¦¥¨ï
|
||||
mov [buf],eax
|
||||
|
||||
mov [run_file_70.Function], SSF_READ_FILE
|
||||
mov [run_file_70.Position], 0
|
||||
mov [run_file_70.Flags], 0
|
||||
mov [run_file_70.Count], dword size
|
||||
m2m [run_file_70.Buffer], eax
|
||||
mov byte[run_file_70+20], 0
|
||||
mov [run_file_70.FileName], file_name
|
||||
mcall SF_FILE,run_file_70 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥¨ï
|
||||
cmp ebx,0xffffffff
|
||||
je @f
|
||||
;®¯à¥¤¥«ï¥¬ ¢¨¤ ¨§®¡à ¦¥¨ï ¨ ¯¥à¥¢®¤¨¬ ¥£® ¢® ¢à¥¬¥ë© ¡ãä¥à image_data
|
||||
stdcall dword[img_decode], dword[buf],ebx,0
|
||||
mov dword[image_data],eax
|
||||
;¯à¥®¡à §ã¥¬ ¨§®¡à ¦¥¨¥ ª ä®à¬ âã rgb
|
||||
stdcall dword[img_to_rgb2], dword[image_data],dword[buf]
|
||||
;㤠«ï¥¬ ¢à¥¬¥ë© ¡ãä¥à image_data
|
||||
stdcall dword[img_destroy], dword[image_data]
|
||||
@@:
|
||||
}
|
||||
|
||||
image_data dd 0 ;㪠§ â¥«ì ¢à¥¬¥ãî ¯ ¬ïâì. ¤«ï 㦥 ¯à¥®¡à §®¢ ¨ï ¨§®¡à ¦¥¨ï
|
||||
icon_tl_sys dd 0 ;㪠§ â¥«ì ¯ ¬ïâì ¤«ï åà ¥¨ï á¨á⥬ëå ¨ª®®ª
|
||||
|
||||
align 4
|
||||
@ -190,18 +144,18 @@ mov ebp,lib0
|
||||
stdcall [ksubmenu_add], [main_menu], eax
|
||||
|
||||
; init toolbar file
|
||||
load_image_file 'te_icon.png', bmp_icon,TOOLBAR_ICONS_SIZE*2 ;㬮¦¥¨¥ 2 ¤«ï á¥àëå ª®¯®ª
|
||||
load_image_file 'te_icon.png', bmp_icon,,,6 ;6 ¤«ï á¥àëå ª®¯®ª
|
||||
mov eax,[bmp_icon]
|
||||
add eax,TOOLBAR_ICONS_SIZE
|
||||
stdcall img_to_gray, [bmp_icon],eax,(TOOLBAR_ICONS_SIZE)/3
|
||||
;---------------------------------------------------------------------
|
||||
; ç¨â ¥¬ ä ©« á ªãàá®à ¬¨ ¨ «¨¨ï¬¨
|
||||
load_image_file 'tl_sys_16.png', icon_tl_sys,54+3*256*13
|
||||
load_image_file 'tl_sys_16.png', icon_tl_sys
|
||||
mov eax,dword[icon_tl_sys]
|
||||
mov dword[tree1.data_img_sys],eax
|
||||
;---------------------------------------------------------------------
|
||||
; ç¨â ¥¬ ä ©« á ¨ª®ª ¬¨ 㧫®¢
|
||||
load_image_file 'tl_nod_16.png', icon_tl_sys,54+3*256*2
|
||||
load_image_file 'tl_nod_16.png', icon_tl_sys
|
||||
mov eax,dword[icon_tl_sys]
|
||||
mov dword[tree1.data_img],eax
|
||||
;------------------------------------------------------------------------------
|
||||
@ -282,11 +236,11 @@ mov ebp,lib0
|
||||
|
||||
|
||||
|
||||
align 4
|
||||
align 16
|
||||
red_win:
|
||||
call draw_window
|
||||
|
||||
align 4
|
||||
align 16
|
||||
still:
|
||||
mcall SF_WAIT_EVENT
|
||||
cmp dword[exit_code],1
|
||||
@ -304,7 +258,7 @@ still:
|
||||
@@:
|
||||
jmp still
|
||||
|
||||
align 4
|
||||
align 16
|
||||
draw_window:
|
||||
mcall SF_REDRAW,SSF_BEGIN_DRAW
|
||||
|
||||
@ -326,25 +280,39 @@ draw_window:
|
||||
mcall SF_REDRAW,SSF_END_DRAW
|
||||
ret
|
||||
|
||||
align 4
|
||||
align 16
|
||||
mouse:
|
||||
stdcall [kmainmenu_dispatch_cursorevent], [main_menu]
|
||||
stdcall [ted_mouse], tedit0
|
||||
|
||||
mcall SF_MOUSE_GET,SSF_WINDOW_POSITION
|
||||
cmp word[tedit0.wnd.top],ax
|
||||
jg .no_edit
|
||||
shr eax,16
|
||||
cmp word[tedit0.wnd.left],ax
|
||||
jg .no_edit
|
||||
mcall SF_MOUSE_GET,SSF_BUTTON_EXT
|
||||
bt eax,24 ;¤¢®©®© 饫çñª «¥¢®© ª®¯ª®©
|
||||
jnc @f
|
||||
stdcall [ted_but_select_word], tedit0
|
||||
jmp still
|
||||
@@:
|
||||
stdcall [ted_mouse], tedit0
|
||||
.no_edit:
|
||||
|
||||
cmp byte[tedit0.panel_id],TED_PANEL_FIND ;if not panel
|
||||
jne @f
|
||||
stdcall [edit_box_mouse], dword edit2
|
||||
stdcall [edit_box_mouse], edit2
|
||||
@@:
|
||||
cmp byte[tedit0.panel_id],TED_PANEL_SYNTAX ;if not panel
|
||||
jne .mouse_end
|
||||
stdcall [tl_mouse], tree1
|
||||
.mouse_end:
|
||||
jne @f
|
||||
stdcall [tl_mouse], tree1
|
||||
@@:
|
||||
jmp still
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
;output:
|
||||
; ah = symbol
|
||||
align 4
|
||||
align 16
|
||||
proc KeyConvertToASCII uses ebx, table:dword
|
||||
mov ebx,dword[table] ;convert scan to ascii
|
||||
ror ax,8
|
||||
@ -354,158 +322,179 @@ proc KeyConvertToASCII uses ebx, table:dword
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
align 16
|
||||
key:
|
||||
mcall SF_KEYBOARD,SSF_GET_CONTROL_KEYS ;66.3 ¯®«ãç¨âì á®áâ®ï¨¥ ã¯à ¢«ïîé¨å ª« ¢¨è
|
||||
xor esi,esi
|
||||
mov ecx,1
|
||||
test al,0x03 ;[Shift]
|
||||
jz @f
|
||||
mov cl,2
|
||||
or esi,KM_SHIFT
|
||||
@@:
|
||||
test al,0x0c ;[Ctrl]
|
||||
jz @f
|
||||
or esi,KM_CTRL
|
||||
@@:
|
||||
test al,0x30 ;[Alt]
|
||||
jz @f
|
||||
mov cl,3
|
||||
or esi,KM_ALT
|
||||
@@:
|
||||
test al,0x80 ;[NumLock]
|
||||
jz @f
|
||||
or esi,KM_NUMLOCK
|
||||
@@:
|
||||
mcall SF_KEYBOARD,SSF_GET_CONTROL_KEYS ;66.3 ¯®«ãç¨âì á®áâ®ï¨¥ ã¯à ¢«ïîé¨å ª« ¢¨è
|
||||
xor esi,esi
|
||||
mov ecx,1
|
||||
test al,0x03 ;[Shift]
|
||||
jz @f
|
||||
mov cl,2
|
||||
or esi,KM_SHIFT
|
||||
@@:
|
||||
test al,0x0c ;[Ctrl]
|
||||
jz @f
|
||||
or esi,KM_CTRL
|
||||
@@:
|
||||
test al,0x30 ;[Alt]
|
||||
jz @f
|
||||
mov cl,3
|
||||
or esi,KM_ALT
|
||||
@@:
|
||||
test al,0x80 ;[NumLock]
|
||||
jz @f
|
||||
or esi,KM_NUMLOCK
|
||||
@@:
|
||||
|
||||
mcall SF_SYSTEM_GET,SSF_KEYBOARD_LAYOUT,,conv_tabl ;26.2 ¯®«ãç¨âì à ᪫ ¤ªã ª« ¢¨ âãàë
|
||||
mcall SF_GET_KEY
|
||||
stdcall [tl_key], tree1
|
||||
mcall SF_SYSTEM_GET,SSF_KEYBOARD_LAYOUT,,conv_tabl ;26.2 ¯®«ãç¨âì à ᪫ ¤ªã ª« ¢¨ âãàë
|
||||
mcall SF_GET_KEY
|
||||
stdcall [tl_key], tree1
|
||||
|
||||
test word [edit2.flags],10b;ed_focus ; ¥á«¨ ¥ ¢ 䮪ãá¥, ¢ë室¨¬
|
||||
je @f
|
||||
cmp ah,0x80 ;if key up
|
||||
ja still
|
||||
cmp ah,42 ;[Shift] (left)
|
||||
je still
|
||||
cmp ah,54 ;[Shift] (right)
|
||||
je still
|
||||
cmp ah,56 ;[Alt]
|
||||
je still
|
||||
cmp ah,29 ;[Ctrl]
|
||||
je still
|
||||
cmp ah,69 ;[Pause Break]
|
||||
je still
|
||||
test word [edit2.flags],10b;ed_focus ; ¥á«¨ ¥ ¢ 䮪ãá¥, ¢ë室¨¬
|
||||
je @f
|
||||
cmp ah,0x80 ;if key up
|
||||
ja still
|
||||
cmp ah,42 ;[Shift] (left)
|
||||
je still
|
||||
cmp ah,54 ;[Shift] (right)
|
||||
je still
|
||||
cmp ah,56 ;[Alt]
|
||||
je still
|
||||
cmp ah,29 ;[Ctrl]
|
||||
je still
|
||||
cmp ah,69 ;[Pause Break]
|
||||
je still
|
||||
|
||||
stdcall KeyConvertToASCII, dword conv_tabl
|
||||
stdcall [edit_box_key], dword edit2
|
||||
jmp still
|
||||
@@:
|
||||
stdcall KeyConvertToASCII, dword conv_tabl
|
||||
stdcall [edit_box_key], dword edit2
|
||||
jmp still
|
||||
@@:
|
||||
|
||||
stdcall [ted_key], tedit0, conv_tabl,esi
|
||||
jmp still
|
||||
stdcall [ted_key], tedit0, conv_tabl,esi
|
||||
jmp still
|
||||
|
||||
align 4
|
||||
align 16
|
||||
button:
|
||||
mcall SF_GET_BUTTON
|
||||
cmp ah,3
|
||||
jne @f
|
||||
call ted_but_new_file
|
||||
jmp still
|
||||
@@:
|
||||
cmp ah,4
|
||||
jne @f
|
||||
call ted_but_open_file
|
||||
jmp still
|
||||
@@:
|
||||
cmp ah,5
|
||||
jne @f
|
||||
call ted_but_save_file
|
||||
jmp still
|
||||
@@:
|
||||
cmp ah,6
|
||||
jne @f
|
||||
stdcall [ted_but_select_word], tedit0
|
||||
jmp still
|
||||
@@:
|
||||
cmp ah,7
|
||||
jne @f
|
||||
stdcall [ted_but_cut], tedit0
|
||||
jmp still
|
||||
@@:
|
||||
cmp ah,8
|
||||
jne @f
|
||||
stdcall [ted_but_copy], tedit0
|
||||
jmp still
|
||||
@@:
|
||||
cmp ah,9
|
||||
jne @f
|
||||
stdcall [ted_but_paste], tedit0
|
||||
jmp still
|
||||
@@:
|
||||
cmp ah,10
|
||||
jne @f
|
||||
call ted_but_find
|
||||
jmp still
|
||||
@@:
|
||||
cmp ah,11
|
||||
jne @f
|
||||
call but_replace
|
||||
jmp still
|
||||
@@:
|
||||
cmp ah,12
|
||||
jne @f
|
||||
call but_find_key_w
|
||||
jmp still
|
||||
@@:
|
||||
cmp ah,13
|
||||
jne @f
|
||||
stdcall [ted_but_sumb_upper], tedit0
|
||||
jmp still
|
||||
@@:
|
||||
cmp ah,14
|
||||
jne @f
|
||||
stdcall [ted_but_sumb_lover], tedit0
|
||||
jmp still
|
||||
@@:
|
||||
cmp ah,15
|
||||
jne @f
|
||||
stdcall [ted_but_reverse], tedit0
|
||||
jmp still
|
||||
@@:
|
||||
cmp ah,16
|
||||
jne @f
|
||||
stdcall [ted_but_undo], tedit0
|
||||
jmp still
|
||||
@@:
|
||||
cmp ah,17
|
||||
jne @f
|
||||
stdcall [ted_but_redo], tedit0
|
||||
jmp still
|
||||
@@:
|
||||
cmp ah,18
|
||||
jne @f
|
||||
stdcall but_sumb_invis, tedit0
|
||||
jmp still
|
||||
@@:
|
||||
cmp ah,19
|
||||
jne @f
|
||||
stdcall but_k_words_show, tedit0
|
||||
jmp still
|
||||
@@:
|
||||
cmp ah,20
|
||||
jne @f
|
||||
stdcall but_synt_show, tedit0
|
||||
jmp still
|
||||
@@:
|
||||
cmp ah,21
|
||||
jne @f
|
||||
stdcall [ted_but_convert_by_table],tedit0,tbl_1251_866
|
||||
jmp still
|
||||
@@:
|
||||
cmp ah,22
|
||||
jne @f
|
||||
stdcall [ted_but_convert_by_table],tedit0,tbl_866_1251
|
||||
jmp still
|
||||
@@:
|
||||
|
||||
mcall SF_GET_BUTTON
|
||||
cmp ah,3
|
||||
jne @f
|
||||
call ted_but_new_file
|
||||
@@:
|
||||
cmp ah,4
|
||||
jne @f
|
||||
call ted_but_open_file
|
||||
@@:
|
||||
cmp ah,5
|
||||
jne @f
|
||||
call ted_but_save_file
|
||||
@@:
|
||||
cmp ah,6
|
||||
jne @f
|
||||
stdcall [ted_but_select_word], tedit0
|
||||
@@:
|
||||
cmp ah,7
|
||||
jne @f
|
||||
stdcall [ted_but_cut], tedit0
|
||||
@@:
|
||||
cmp ah,8
|
||||
jne @f
|
||||
stdcall [ted_but_copy], tedit0
|
||||
@@:
|
||||
cmp ah,9
|
||||
jne @f
|
||||
stdcall [ted_but_paste], tedit0
|
||||
@@:
|
||||
cmp ah,10
|
||||
jne @f
|
||||
call ted_but_find
|
||||
@@:
|
||||
cmp ah,11
|
||||
jne @f
|
||||
call but_replace
|
||||
@@:
|
||||
cmp ah,12
|
||||
jne @f
|
||||
call but_find_key_w
|
||||
@@:
|
||||
cmp ah,13
|
||||
jne @f
|
||||
stdcall [ted_but_sumb_upper], tedit0
|
||||
@@:
|
||||
cmp ah,14
|
||||
jne @f
|
||||
stdcall [ted_but_sumb_lover], tedit0
|
||||
@@:
|
||||
cmp ah,15
|
||||
jne @f
|
||||
stdcall [ted_but_reverse], tedit0
|
||||
@@:
|
||||
cmp ah,16
|
||||
jne @f
|
||||
stdcall [ted_but_undo], tedit0
|
||||
@@:
|
||||
cmp ah,17
|
||||
jne @f
|
||||
stdcall [ted_but_redo], tedit0
|
||||
@@:
|
||||
cmp ah,18
|
||||
jne @f
|
||||
stdcall but_sumb_invis, tedit0
|
||||
@@:
|
||||
cmp ah,19
|
||||
jne @f
|
||||
stdcall but_k_words_show, tedit0
|
||||
@@:
|
||||
cmp ah,20
|
||||
jne @f
|
||||
stdcall but_synt_show, tedit0
|
||||
@@:
|
||||
cmp ah,21
|
||||
jne @f
|
||||
stdcall [ted_but_convert_by_table],tedit0,tbl_1251_866
|
||||
@@:
|
||||
cmp ah,22
|
||||
jne @f
|
||||
stdcall [ted_but_convert_by_table],tedit0,tbl_866_1251
|
||||
@@:
|
||||
cmp ah,200
|
||||
jne @f
|
||||
stdcall ted_but_open_syntax, tedit0
|
||||
jmp still
|
||||
@@:
|
||||
cmp ah,201
|
||||
jne @f
|
||||
stdcall [ted_but_find_next], tedit0
|
||||
jmp still
|
||||
@@:
|
||||
|
||||
cmp ah,200
|
||||
jne @f
|
||||
stdcall ted_but_open_syntax, tedit0
|
||||
@@:
|
||||
cmp ah,201
|
||||
jne @f
|
||||
stdcall [ted_but_find_next], tedit0
|
||||
@@:
|
||||
cmp ah,1
|
||||
je .exit
|
||||
|
||||
cmp ah,1
|
||||
je .exit
|
||||
cmp ah,199
|
||||
je .exit
|
||||
|
||||
cmp ah,199
|
||||
je .exit
|
||||
|
||||
jmp still
|
||||
jmp still
|
||||
.exit:
|
||||
cmp dword[exit_code],1
|
||||
je @f
|
||||
|
Loading…
Reference in New Issue
Block a user