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:
@@ -8,6 +8,7 @@ macro use_editbox_draw
|
||||
edit_box:
|
||||
.draw:
|
||||
pushad
|
||||
.draw_1:
|
||||
;--- <20><><EFBFBD>㥬 ࠬ<><E0A0AC> ---
|
||||
mov edi,dword [esp+36]
|
||||
call .draw_border ; <20>㭪<EFBFBD><E3ADAA><EFBFBD> <20>⠡<EFBFBD><E2A0A1>쭠
|
||||
@@ -68,7 +69,7 @@ pushad
|
||||
pop eax
|
||||
;--------------------------------------
|
||||
;<3B><EFBFBD>ઠ <20><><EFBFBD><EFBFBD><EFBFBD> shift ?
|
||||
call edit_box_key.check_shift
|
||||
call edit_box_key.check_shift_ctrl_alt
|
||||
;----------------------------------------------------------
|
||||
;--- <20><EFBFBD><E0AEA2>塞, <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> --------------------------------
|
||||
;----------------------------------------------------------
|
||||
@@ -86,6 +87,17 @@ pushad
|
||||
jz edit_box_key.end
|
||||
cmp ah,185 ;insert
|
||||
jz edit_box_key.insert
|
||||
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>樨 Ctrl + <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
test word ed_flags,ed_ctrl_on
|
||||
jz @f
|
||||
; <20><EFBFBD>ઠ ᪠<><E1AAA0><EFBFBD><EFBFBD><EFBFBD>
|
||||
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
|
||||
@@:
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;<3B><><EFBFBD><EFBFBD><EFBFBD>誠 <20><> <20><>ࠡ<EFBFBD><E0A0A1><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD> <20>.<2E>. <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>㦥<EFBFBD><E3A6A5><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20>ந<EFBFBD>室<EFBFBD><E5AEA4> <20><>室 <20><> <20><>ࠡ<EFBFBD><E0A0A1>稪<EFBFBD>
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
@@ -779,12 +791,22 @@ edit_box_key.draw_rectangle:
|
||||
;;;;;;;;;;;;;;;;;;
|
||||
;;<3B><EFBFBD>ઠ <20><><EFBFBD><EFBFBD><EFBFBD> <20><> shift
|
||||
;;;;;;;;;;;;;;;;;;
|
||||
edit_box_key.check_shift:
|
||||
edit_box_key.check_shift_ctrl_alt:
|
||||
pusha ;<3B><><EFBFBD>࠭<EFBFBD><E0A0AD> <20><><EFBFBD> ॣ<><E0A5A3><EFBFBD><EFBFBD><EFBFBD>
|
||||
mcall 66,3
|
||||
test al,0x03
|
||||
test al,11b
|
||||
je @f
|
||||
or word ed_flags,ed_shift ;<3B><>⠭<EFBFBD><E2A0AD><EFBFBD><EFBFBD> 䫠<>
|
||||
or word ed_flags,ed_shift ;<3B><>⠭<EFBFBD><E2A0AD><EFBFBD><EFBFBD> 䫠<> Shift
|
||||
@@:
|
||||
and word ed_flags,ed_ctrl_off ; <20><><EFBFBD><EFBFBD>⨬ 䫠<> Ctrl
|
||||
test al,1100b
|
||||
je @f
|
||||
or word ed_flags,ed_ctrl_on ;<3B><>⠭<EFBFBD><E2A0AD><EFBFBD><EFBFBD> 䫠<> Ctrl
|
||||
@@:
|
||||
and word ed_flags,ed_alt_off ; <20><><EFBFBD><EFBFBD>⨬ 䫠<> Alt
|
||||
test al,110000b
|
||||
je @f
|
||||
or word ed_flags,ed_alt_on ;<3B><>⠭<EFBFBD><E2A0AD><EFBFBD><EFBFBD> 䫠<> 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
|
||||
|
Reference in New Issue
Block a user