Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 7918 → Rev 7919

/programs/develop/libraries/box_lib/trunk/editbox.asm
1,57 → 1,3
macro use_key_no_process up,down,esc,enter,tab,numl,capsl,scrolll,pgup,pgdown
{
if up eq
else
cmp ah,178
jz edit_box.editbox_exit
end if
if down eq
else
cmp ah,177
jz edit_box.editbox_exit
end if
if esc eq
else
cmp ah,27 ;ESC - ª« ¢¨è  ))
jz edit_box.editbox_exit
end if
if enter eq
else
cmp ah,13 ;ENTER - ª« ¢¨è  ))
jz edit_box.editbox_exit
end if
if tab eq
else
cmp ah,9 ;TAB - ª« ¢¨è  ))
jz edit_box.editbox_exit
end if
if numl eq
else
cmp ah,4 ;Num Lock - ª« ¢¨è  ))
jz edit_box.editbox_exit
end if
if capsl eq
else
cmp ah,2 ;Caps Lock - ª« ¢¨è  ))
jz edit_box.editbox_exit
end if
if scrolll eq
else
cmp ah,1 ;Scroll Lock - ª« ¢¨è  ))
jz edit_box.editbox_exit
end if
if pgup eq
else
cmp ah,184 ;Page Up - ª« ¢¨è  ))
jz edit_box.editbox_exit
end if
if pgdown eq
else
cmp ah,183 ;Page Dwon - ª« ¢¨è  ))
jz edit_box.editbox_exit
end if
}
 
SCAN_LWIN_RELEASE = 0xDB
SCAN_RWIN_RELEASE = 0xDC
 
83,12 → 29,12
call .draw_border
.draw_bg_cursor_text:
;test word ed_flags,ed_focus ; for unfocused controls =>
;jz .sjip_offset ; do not recalculate offset (big OS behaviour)
;jz .skip_offset ; do not recalculate offset
call .check_offset
;.sjip_offset:
;.skip_offset:
call .draw_bg
test word ed_flags,ed_focus ; for unfocused controls =>
jz .draw_cursor_text ; do not draw selection(named shift)
test word ed_flags,ed_focus ; do not draw selection(named shift)
jz .draw_cursor_text ;
call .draw_shift
.draw_cursor_text:
call .draw_text
116,78 → 62,90
;--------------------------------------
; this code for Win-keys, works with
; kernel SVN r.3356 or later
push eax
push ebx
mcall SF_KEYBOARD,SSF_GET_CONTROL_KEYS
test ax,0x200 ; LWin
jnz .win_key_pressed
test ax,0x400 ; RWin
jz @f
.win_key_pressed:
pop ebx
pop eax
jmp edit_box.editbox_exit
 
@@: pop ebx
pop eax
test ah,$06 ; LWin ($02) & RWin ($04)
jnz edit_box.editbox_exit
;--------------------------------------
;à®¢¥àª  ­ ¦ â shift ?
call edit_box_key.check_shift_ctrl_alt
test al,$03
je @f
or word ed_flags,ed_shift ;ãáâ ­®¢¨¬ ä« £ Shift
@@:
and word ed_flags,ed_ctrl_off ; ®ç¨á⨬ ä« £ Ctrl
test al,$0C
je @f
or word ed_flags,ed_ctrl_on ;ãáâ ­®¢¨¬ ä« £ Ctrl
@@:
and word ed_flags,ed_alt_off ; ®ç¨á⨬ ä« £ Alt
test al,$30
je @f
or word ed_flags,ed_alt_on ;ãáâ ­®¢¨¬ ä« £ Alt
@@:
;----------------------------------------------------------
;--- ¯à®¢¥à塞, çâ® ­ ¦ â® --------------------------------
;----------------------------------------------------------
cmp ah,8
jz edit_box_key.backspace
cmp ah,0xb6
jz edit_box_key.delete
cmp ah,176
jz edit_box_key.left
cmp ah,179
jz edit_box_key.right
cmp ah,180
jz edit_box_key.home
cmp ah,181
jz edit_box_key.end
cmp ah,185 ;insert
jz edit_box_key.insert
 
mov eax,[esp+28]
; get scancode in ah
ror eax,8
; check for ctrl+ combinations
test word ed_flags,ed_ctrl_on
jz @f
cmp ah,45 ; Ctrl + X
cmp ah,SCAN_CODE_X ; Ctrl + X
je edit_box_key.ctrl_x
cmp ah,46 ; Ctrl + C
cmp ah,SCAN_CODE_C ; Ctrl + C
je edit_box_key.ctrl_c
cmp ah,47 ; Ctrl + V
cmp ah,SCAN_CODE_V ; Ctrl + V
je edit_box_key.ctrl_v
cmp ah,30 ; Ctrl + A
cmp ah,SCAN_CODE_A ; Ctrl + A
je edit_box_key.ctrl_a
jmp edit_box.editbox_exit
@@:
cmp ah,SCAN_LWIN_RELEASE
cmp ah,SCAN_CODE_SPACE
ja @F
cmp al,ASCII_KEY_BACK
jz edit_box_key.backspace
cmp ah,SCAN_CODE_ESCAPE
jz edit_box.editbox_exit
cmp ah,SCAN_RWIN_RELEASE
cmp ah,SCAN_CODE_TAB
jz edit_box.editbox_exit
; restore ascii code
rol eax,8
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;‡ £«ã誠 ­  ®¡à ¡®âªã ª« ¢¨è ¢¢¥àå ¨ ¢­¨§ â.¥. ¯à¨ ®¡­ à㦥­¨¨
;íâ¨å ª®¤®¢ ¯à®¨á室¨â ¢ë室 ¨§ ®¡à ¡®â稪 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
use_key_no_process up,down,esc,enter,tab,numl,capsl,scrolll,pgup,pgdown
;--- ­ ¦ â  ¤àã£ ï ª« ¢¨è  ---
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;à®¢¥àª  ãáâ ­®¢«¥­ «¨ ä« £ ¯à¨ ª®â®à®¬ ­ã¦­® ¢ë¢®¤¨âì
;⮫쪮 æ¨äàë ¢ ­ã¦­®¬ ¡®ªá¥
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cmp ah,SCAN_CODE_RETURN
jz edit_box.editbox_exit
jmp .printable_character
@@:
cmp ah,SCAN_CODE_DELETE
ja edit_box.editbox_exit
cmp ah,SCAN_CODE_HOME
jb edit_box.editbox_exit
cmp ax,SCAN_CODE_CLEAR shl 8 + ASCII_KEY_CLEAR ; not operate numpad unlocked 5
jz edit_box.editbox_exit
;here best place to filter up,down,pgup,pgdown
cmp al,ASCII_KEY_LEFT
jb .printable_character
and eax,$F
mov ebx,.unlock_numpad_filtration
jmp dword[ebx+eax*4]
.unlock_numpad_filtration \
dd edit_box_key.left, \ ; LEFT
edit_box.editbox_exit,\ ; DOWN
edit_box.editbox_exit,\ ; UP
edit_box_key.right, \ ; RIGHT
edit_box_key.home, \ ; HOME
edit_box_key.end, \ ; END
edit_box_key.delete, \ ; DELETE
edit_box.editbox_exit,\ ; PGDN
edit_box.editbox_exit,\ ; PGUP
edit_box_key.insert ; INSERT
 
.printable_character:
test word ed_flags,ed_figure_only ; ⮫쪮 æ¨äàë?
jz @f
cmp ah,'0'
cmp al,'0'
jb edit_box.editbox_exit
cmp ah,'9'
cmp al,'9'
ja edit_box.editbox_exit
@@:
; restore ascii code
rol eax,8
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;¯à®¢¥àª  ­  shift, ¡ë« «¨ ­ ¦ â
263,14 → 221,9
;Ž¡à ¡®âª  ª« ¢¨è insert,delete,backspace,home,end,left,right
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
edit_box_key.insert:
test word ed_flags,ed_insert
je @f
and word ed_flags,ed_insert_cl
xor word ed_flags,ed_insert
jmp edit_box.editbox_exit
 
@@: or word ed_flags,ed_insert
jmp edit_box.editbox_exit
 
edit_box_key.ins_v:
dec dword bp_size
sub esi,ecx
874,31 → 827,35
jne @f
mov edx,ed_blur_border_color
@@:
;mov edx,$808080
mov ebx,ed_left
mov ecx,ebx
mov eax,ebx
shl ebx,16
add ebx,ecx
add ebx,ed_width
add ebx,eax
;add ebx,ed_width
mov ecx,ed_top
mov esi,ecx
mov eax,ecx
shl ecx,16
add ecx,esi
mcall SF_DRAW_LINE ; top
mov esi,ecx
add ecx,eax
push ecx
inc ecx
add ecx,ed_height
mov ebp,ecx
shl ecx,16
mov cx,bp
mcall SF_DRAW_LINE ; left
xchg ecx,[esp]
add ebx,ed_width
mcall ; top
;or edx,-1
pop ecx
push cx
push cx
push ebx
push bx
push bx
pop ebx
mcall ; right
pop ebx
pop ecx
mcall ; bottom
mov cx,si
mov ebp,ebx
sub ebx,ed_width
mcall ; left
mov ebx,ebp
shl ebx,16
mov bx,bp
mcall ; right
ret
 
;----------------------------------------------------------
1308,29 → 1265,6
mov edx,ebp
jmp edit_box.draw_bg_eax
 
;;;;;;;;;;;;;;;;;;
;;à®¢¥àª  ­ ¦ â «¨ shift
;;;;;;;;;;;;;;;;;;
edit_box_key.check_shift_ctrl_alt:
pusha
mcall SF_KEYBOARD,SSF_GET_CONTROL_KEYS
test al,11b
je @f
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
@@:
popad
ret
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;”㭪樨 ¤«ï à ¡®âë á mouse
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;