forked from KolibriOS/kolibrios
Box_Lib - Editbox support for Clipboard (Ctrl + C|V)
git-svn-id: svn://kolibrios.org@4601 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
45668e124d
commit
2fa4df3549
@ -20,6 +20,7 @@ include '../../../../macros.inc'
|
||||
include '../../../../proc32.inc'
|
||||
include 'bl_sys.mac'
|
||||
include 'box_lib.mac' ;macro which should make life easier :)
|
||||
;include '../../../../debug.inc'
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
mem.alloc dd ? ;ôóíêöèÿ äëÿ âûäåëåíèÿ ïàìÿòè
|
||||
|
@ -49,6 +49,10 @@ ed_insert_cl= 1111111101111111b
|
||||
ed_mouse_on = 100000000b
|
||||
ed_mous_adn_b= 100011000b
|
||||
ed_mouse_on_off=1111111011111111b
|
||||
ed_ctrl_on = 1000000000b
|
||||
ed_ctrl_off = 1111110111111111b
|
||||
ed_alt_on = 10000000000b
|
||||
ed_alt_off = 1111101111111111b
|
||||
ed_height=14 ; ¢ëá®â
|
||||
|
||||
struc edit_box width,left,top,color,shift_color,focus_border_color,\
|
||||
|
@ -8,6 +8,7 @@ macro use_editbox_draw
|
||||
edit_box:
|
||||
.draw:
|
||||
pushad
|
||||
.draw_1:
|
||||
;--- à¨á㥬 à ¬ªã ---
|
||||
mov edi,dword [esp+36]
|
||||
call .draw_border ; ”ãªæ¨ï áâ ¡¨«ì
|
||||
@ -68,7 +69,7 @@ pushad
|
||||
pop eax
|
||||
;--------------------------------------
|
||||
;<3B>஢¥àª ¦ â shift ?
|
||||
call edit_box_key.check_shift
|
||||
call edit_box_key.check_shift_ctrl_alt
|
||||
;----------------------------------------------------------
|
||||
;--- ¯à®¢¥à塞, çâ® ¦ â® --------------------------------
|
||||
;----------------------------------------------------------
|
||||
@ -86,6 +87,17 @@ pushad
|
||||
jz edit_box_key.end
|
||||
cmp ah,185 ;insert
|
||||
jz edit_box_key.insert
|
||||
; ª®¬¡¨ 樨 Ctrl + ª« ¢¨è
|
||||
test word ed_flags,ed_ctrl_on
|
||||
jz @f
|
||||
; ¯à®¢¥àª ᪠ª®¤
|
||||
ror eax,8
|
||||
cmp ah,46 ; Ctrl + C
|
||||
je edit_box_key.ctrl_c
|
||||
cmp ah,47 ; Ctrl + V
|
||||
je edit_box_key.ctrl_v
|
||||
rol eax,8
|
||||
@@:
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;‡ £«ãèª ®¡à ¡®âªã ª« ¢¨è ¢¢¥àå ¨ ¢¨§ â.¥. ¯à¨ ®¡ à㦥¨¨ íâ¨å ª®¤®¢ ¯à®¨á室¨â ¢ë室 ¨§ ®¡à ¡®â稪
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
@ -779,12 +791,22 @@ edit_box_key.draw_rectangle:
|
||||
;;;;;;;;;;;;;;;;;;
|
||||
;;<3B>஢¥àª ¦ â «¨ shift
|
||||
;;;;;;;;;;;;;;;;;;
|
||||
edit_box_key.check_shift:
|
||||
edit_box_key.check_shift_ctrl_alt:
|
||||
pusha ;á®åà ¨¬ ¢á¥ ॣ¨áâàë
|
||||
mcall 66,3
|
||||
test al,0x03
|
||||
test al,11b
|
||||
je @f
|
||||
or word ed_flags,ed_shift ;ãáâ ®¢¨¬ ä« £
|
||||
or word ed_flags,ed_shift ;ãáâ ®¢¨¬ ä« £ Shift
|
||||
@@:
|
||||
and word ed_flags,ed_ctrl_off ; ®ç¨á⨬ ä« £ Ctrl
|
||||
test al,1100b
|
||||
je @f
|
||||
or word ed_flags,ed_ctrl_on ;ãáâ ®¢¨¬ ä« £ Ctrl
|
||||
@@:
|
||||
and word ed_flags,ed_alt_off ; ®ç¨á⨬ ä« £ Alt
|
||||
test al,110000b
|
||||
je @f
|
||||
or word ed_flags,ed_alt_on ;ãáâ ®¢¨¬ ä« £ Alt
|
||||
@@:edit_ex
|
||||
}
|
||||
|
||||
@ -1052,6 +1074,112 @@ edit_box_key.end:
|
||||
mov ed_pos,eax
|
||||
call edit_box_key.sh_home_end
|
||||
jmp edit_box.draw_cursor_text
|
||||
;-----------------------------------------------------------------------------
|
||||
edit_box_key.ctrl_c:
|
||||
; add memory area
|
||||
mov ecx,ed_size
|
||||
add ecx,3*4
|
||||
mcall 68,12
|
||||
; building the clipboard slot header
|
||||
xor ecx,ecx
|
||||
mov [eax+4],ecx ; type 'text'
|
||||
inc ecx
|
||||
mov [eax+8],ecx ; cp866 text encoding
|
||||
mov ecx,ed_size
|
||||
add ecx,3*4
|
||||
mov [eax],ecx
|
||||
sub ecx,3*4
|
||||
; copy data
|
||||
mov esi,ed_text
|
||||
push edi
|
||||
mov edi,eax
|
||||
add edi,3*4
|
||||
cld
|
||||
rep movsb
|
||||
pop edi
|
||||
; put slot to the kernel clipboard
|
||||
mov edx,eax
|
||||
mov ecx,[edx]
|
||||
push eax
|
||||
mcall 54,2
|
||||
pop ecx
|
||||
; remove unnecessary memory area
|
||||
mcall 68,13
|
||||
;--------------------------------------
|
||||
.exit:
|
||||
jmp edit_box.editbox_exit
|
||||
;-----------------------------------------------------------------------------
|
||||
edit_box_key.ctrl_v:
|
||||
mcall 54,0
|
||||
; no slots of clipboard ?
|
||||
test eax,eax
|
||||
jz .exit
|
||||
; main list area not found ?
|
||||
inc eax
|
||||
test eax,eax
|
||||
jz .exit
|
||||
|
||||
sub eax,2
|
||||
mov ecx,eax
|
||||
mcall 54,1
|
||||
; main list area not found ?
|
||||
inc eax
|
||||
test eax,eax
|
||||
jz .exit
|
||||
; error ?
|
||||
sub eax,2
|
||||
test eax,eax
|
||||
jz .exit
|
||||
|
||||
inc eax
|
||||
; check contents of container
|
||||
mov ebx,[eax+4]
|
||||
; check for text
|
||||
test ebx,ebx
|
||||
jnz .no_valid_text
|
||||
|
||||
mov ebx,[eax+8]
|
||||
; check for cp866
|
||||
cmp bl,1
|
||||
jnz .no_valid_text
|
||||
|
||||
mov ecx,[eax]
|
||||
sub ecx,3*4
|
||||
cmp ecx,ed_max
|
||||
jb @f
|
||||
|
||||
mov ecx,ed_max
|
||||
@@:
|
||||
mov esi,eax
|
||||
add esi,3*4
|
||||
mov ed_size,ecx
|
||||
mov ed_pos,ecx
|
||||
push eax edi
|
||||
mov edi,ed_text
|
||||
cld
|
||||
@@:
|
||||
lodsb
|
||||
cmp al,0x0d ; EOS (end of string)
|
||||
je .replace
|
||||
|
||||
cmp al,0x0a ; EOS (end of string)
|
||||
jne .continue
|
||||
.replace:
|
||||
mov al,0x20 ; space
|
||||
.continue:
|
||||
stosb
|
||||
dec ecx
|
||||
jnz @b
|
||||
; rep movsb
|
||||
pop edi eax
|
||||
;--------------------------------------
|
||||
.no_valid_text:
|
||||
; remove unnecessary memory area
|
||||
mov ecx,eax
|
||||
mcall 68,13
|
||||
;--------------------------------------
|
||||
.exit:
|
||||
jmp edit_box.draw_1
|
||||
}
|
||||
|
||||
macro use_mouse_func
|
||||
|
Loading…
Reference in New Issue
Block a user