Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 9567 → Rev 9568

/programs/develop/libraries/box_lib/trunk/box_lib.asm
183,7 → 183,8
dd sz_init, lib_init
dd sz_version, 0x00000001
 
dd sz_edit_box, edit_box
dd sz_edit_box, edit_box_draw ;old function name
dd sz_edit_box_draw, edit_box_draw
dd sz_edit_box_key, edit_box_key
dd sz_edit_box_mouse, edit_box_mouse
dd sz_edit_box_set_text, edit_box_set_text
298,6 → 299,7
sz_version db 'version',0
 
sz_edit_box db 'edit_box',0
sz_edit_box_draw db 'edit_box_draw',0
sz_edit_box_key db 'edit_box_key',0
sz_edit_box_mouse db 'edit_box_mouse',0
sz_edit_box_set_text db 'edit_box_set_text',0
/programs/develop/libraries/box_lib/trunk/editbox.asm
2,8 → 2,7
SCAN_RWIN_RELEASE = 0xDC
 
align 16
edit_box:
.draw:
edit_box_draw:
pushad
mov edi,[esp+36]
and dword ed_text_color,17FFFFFFh
26,25 → 25,25
mul bl
add eax,4
mov ed_height,eax
call .draw_border
.draw_bg_cursor_text:
call .border
.bg_cursor_text:
;test word ed_flags,ed_focus ; for unfocused controls =>
;jz .skip_offset ; do not recalculate offset
call .check_offset
call edit_box.check_offset
;.skip_offset:
call .draw_bg
call edit_box_draw.bg
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
jz .cursor_text ;
call .shift
.cursor_text:
call .text
test word ed_flags,ed_focus ; and dosn`t draw cursor
jz .editbox_exit
call .draw_cursor
jz edit_box_exit
call .cursor
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Ž¡é¨© ¢ë室 ¨§ editbox ¤«ï ¢á¥å ä㭪権 ¨ ¯®áâ ®¡à ¡®â稪®¢;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.editbox_exit:
edit_box_exit:
popad
ret 4
 
56,15 → 55,15
pushad
mov edi,[esp+36]
test word ed_flags,ed_focus ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬
jz edit_box.editbox_exit
jz edit_box_exit
test word ed_flags,ed_mouse_on or ed_disabled
jnz edit_box.editbox_exit
jnz edit_box_exit
;--------------------------------------
; this code for Win-keys, works with
; kernel SVN r.3356 or later
mcall SF_KEYBOARD,SSF_GET_CONTROL_KEYS
test ah,$06 ; LWin ($02) & RWin ($04)
jnz edit_box.editbox_exit
jnz edit_box_exit
;--------------------------------------
;à®¢¥àª  ­ ¦ â shift ?
test al,$03
98,7 → 97,7
je edit_box_key.ctrl_v
cmp ah,SCAN_CODE_A ; Ctrl + A
je edit_box_key.ctrl_a
jmp edit_box.editbox_exit
jmp edit_box_exit
@@:
cmp ah,SCAN_CODE_SPACE
ja @F
105,19 → 104,19
cmp al,ASCII_KEY_BACK
jz edit_box_key.backspace
cmp ah,SCAN_CODE_ESCAPE
jz edit_box.editbox_exit
jz edit_box_exit
cmp ah,SCAN_CODE_TAB
jz edit_box.editbox_exit
jz edit_box_exit
cmp ah,SCAN_CODE_RETURN
jz edit_box.editbox_exit
jz edit_box_exit
jmp .printable_character
@@:
cmp ah,SCAN_CODE_DELETE
ja edit_box.editbox_exit
ja edit_box_exit
cmp ah,SCAN_CODE_HOME
jb edit_box.editbox_exit
jb edit_box_exit
cmp ax,SCAN_CODE_CLEAR shl 8 + ASCII_KEY_CLEAR ; not operate numpad unlocked 5
jz edit_box.editbox_exit
jz edit_box_exit
;here best place to filter up,down,pgup,pgdown
cmp al,ASCII_KEY_LEFT
jb .printable_character
126,14 → 125,14
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_exit,\ ; DOWN
edit_box_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_exit,\ ; PGDN
edit_box_exit,\ ; PGUP
edit_box_key.insert ; INSERT
 
.printable_character:
140,9 → 139,9
test word ed_flags,ed_figure_only ; ⮫쪮 æ¨äàë?
jz @f
cmp al,'0'
jb edit_box.editbox_exit
jb edit_box_exit
cmp al,'9'
ja edit_box.editbox_exit
ja edit_box_exit
@@:
; restore ascii code
rol eax,8
179,10 → 178,10
test word ed_flags,ed_insert
jne @f
cmp ecx,edx
jae edit_box.editbox_exit
jae edit_box_exit
@@: mov ebx, ed_pos
cmp ebx,edx
jnl edit_box.editbox_exit
jnl edit_box_exit
mov ecx,ed_size
push edi eax
mov ebp,edi
222,7 → 221,7
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
edit_box_key.insert:
xor word ed_flags,ed_insert
jmp edit_box.editbox_exit
jmp edit_box_exit
 
edit_box_key.ins_v:
dec dword bp_size
280,7 → 279,7
call edit_box.clear_cursor
call edit_box.check_offset
and word ed_flags,ed_shift_cl
jmp edit_box.draw_bg
jmp edit_box_draw.bg
 
@@: dec dword ed_size
edit_box_key.draw_all2:
299,10 → 298,10
or word ed_flags,ed_left_fl
call edit_box_key.sh_first_sh
dec dword ed_pos
call edit_box.draw_bg
call edit_box.draw_shift
call edit_box_draw.bg
call edit_box_draw.shift
call edit_box_key.sh_enable
jmp edit_box.draw_cursor_text
jmp edit_box_draw.cursor_text
 
;--- ­ ¦ â  ª« ¢¨è  right ---
edit_box_key.right:
312,10 → 311,10
and word ed_flags,ed_right_fl
call edit_box_key.sh_first_sh
inc dword ed_pos
call edit_box.draw_bg
call edit_box.draw_shift
call edit_box_draw.bg
call edit_box_draw.shift
call edit_box_key.sh_enable
jmp edit_box.draw_cursor_text
jmp edit_box_draw.cursor_text
 
edit_box_key.home:
mov ebx,ed_pos
324,10 → 323,10
call edit_box_key.sh_first_sh
xor eax,eax
mov ed_pos,eax
call edit_box.draw_bg
call edit_box.draw_shift
call edit_box_draw.bg
call edit_box_draw.shift
call edit_box_key.sh_home_end
jmp edit_box.draw_cursor_text
jmp edit_box_draw.cursor_text
 
;--- ­ ¦ â  ª« ¢¨è  end ---
edit_box_key.end:
337,10 → 336,10
call edit_box_key.sh_first_sh
mov eax,ed_size
mov ed_pos,eax
call edit_box.draw_bg
call edit_box.draw_shift
call edit_box_draw.bg
call edit_box_draw.shift
call edit_box_key.sh_home_end
jmp edit_box.draw_cursor_text
jmp edit_box_draw.cursor_text
;----------------------------------------
StrInsert:
; SizeOf(TmpBuf) >= StrLen(Src) + StrLen(Dst) + 1
412,13 → 411,13
;----------------------------------------
edit_box_key.ctrl_x:
test word ed_flags,ed_shift_on
jz edit_box.editbox_exit
jz edit_box_exit
push dword 'X' ; this value need below to determine which action is used
jmp edit_box_key.ctrl_c.pushed
 
edit_box_key.ctrl_c:
test word ed_flags,ed_shift_on
jz edit_box.editbox_exit
jz edit_box_exit
push dword 'C' ; this value need below to determine which action is used
.pushed:
; add memory area
466,7 → 465,7
pop eax ; determine current action (ctrl+X or ctrl+C)
cmp eax, 'X'
je edit_box_key.delete
jmp edit_box.editbox_exit
jmp edit_box_exit
 
edit_box_key.ctrl_v:
mcall SF_CLIPBOARD,SSF_GET_SLOT_COUNT
556,7 → 555,7
mov ecx,eax
mcall SF_SYS_MISC,SSF_MEM_FREE
.exit:
jmp edit_box.draw_bg_cursor_text
jmp edit_box_draw.bg_cursor_text
 
edit_box_key.ctrl_a:
mov eax,ed_size
564,7 → 563,7
xor eax,eax
mov ed_shift_pos,eax
or word ed_flags,ed_shift_bac+ed_shift_on
jmp edit_box.draw_bg_cursor_text
jmp edit_box_draw.bg_cursor_text
 
;==========================================================
;=== ®¡à ¡®âª  ¬ëè¨ =======================================
575,7 → 574,7
pushad
mov edi,[esp+36]
test word ed_flags,ed_disabled
jnz edit_box.editbox_exit
jnz edit_box_exit
 
;----------------------------------------------------------
;--- ¯®«ãç ¥¬ á®áâ®ï­¨¥ ª­®¯®ª ¬ëè¨ -----------------------
590,7 → 589,7
mov ebx,ed_mouse_variable
push 0
pop dword [ebx]
jmp edit_box.editbox_exit
jmp edit_box_exit
 
.mouse_left_button:
;----------------------------------------------------------
662,26 → 661,26
push edi
pop dword [ebx]
bts word ed_flags,1
call edit_box.draw_bg
call edit_box_draw.bg
jmp edit_box_mouse.m_sh
 
@@: cmp ax,ed_shift_pos
je edit_box.editbox_exit
je edit_box_exit
mov ed_pos,eax
call edit_box.draw_bg
call edit_box_draw.bg
mov ebp,shift_color
movzx ebx, word ed_shift_pos
call edit_box_key.sh_cl_
or word ed_flags,ed_mous_adn_b
edit_box_mouse.m_sh:
call edit_box.draw_text
call edit_box.draw_cursor
call edit_box_draw.text
call edit_box_draw.cursor
; ¯à®æ¥¤ãà  ãáâ ­®¢ª¨ 䮪ãá 
jmp edit_box_mouse.drc
edit_box_mouse._remove_selection:
and word ed_flags,ed_shift_cl
jmp edit_box.draw_bg_cursor_text
jmp edit_box_draw.bg_cursor_text
 
edit_box_mouse._blur:
test word ed_flags,ed_always_focus
691,7 → 690,7
mov ebp,ed_color
call edit_box.clear_cursor
edit_box_mouse.drc:
call edit_box.draw_border
call edit_box_draw.border
jmp edit_box_mouse._remove_selection
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
699,7 → 698,7
;----------------------------------------------------------
;--- ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ ¢ë¤¥«¥­­®© ç á⨠----------------
;----------------------------------------------------------
edit_box.draw_shift:
edit_box_draw.shift:
test word ed_flags,ed_shift_bac ;ãáâ ­®¢ª  ä« £ , ¢ë¤¥«¥­­®© ®¡« áâ¨
jz @f
mov ebp,shift_color
709,7 → 708,7
;----------------------------------------------------------
;--- ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ ⥪áâ  --------------------------
;----------------------------------------------------------
edit_box.draw_text:
edit_box_draw.text:
call edit_box.get_n
mov esi,ed_size
sub esi,ed_offset
751,7 → 750,7
;----------------------------------------------------------
;--- ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ ä®­  ----------------------------
;----------------------------------------------------------
edit_box.draw_bg:
edit_box_draw.bg:
mov ebx,ed_left
inc ebx
shl ebx,16
759,9 → 758,9
dec ebx
mov edx,ed_color
test word ed_flags, ed_disabled
jz edit_box.draw_bg_eax
jz edit_box_draw.bg_eax
mov edx, 0xCACACA ; TODO: add disabled_color field to editbox struct
edit_box.draw_bg_eax:
edit_box_draw.bg_eax:
mov ecx,ed_top
inc ecx
shl ecx,16
796,11 → 795,11
mov edx, ebp
movzx ecx, word cl_curs_y
cmp ecx, ed_top
jg edit_box.draw_curs
jg edit_box_draw.curs
@@:
ret
 
edit_box.draw_cursor:
edit_box_draw.cursor:
mov edx, ed_text_color
mov eax, ed_pos
sub eax, ed_offset
812,7 → 811,7
add ecx, 2
mov cl_curs_x, bx
mov cl_curs_y, cx
edit_box.draw_curs:
edit_box_draw.curs:
mov eax, ebx
shl ebx, 16
or ebx, eax
827,7 → 826,7
;----------------------------------------------------------
;--- ¯à®æ¥¤ãà  à¨á®¢ ­¨ï à ¬ª¨ ----------------------------
;----------------------------------------------------------
edit_box.draw_border:
edit_box_draw.border:
test word ed_flags,ed_focus
mov edx,ed_focus_border_color
jne @f
916,7 → 915,7
add ebx,edx
edit_box.chk_d:
mov ed_offset,ebx
call edit_box.draw_bg
call edit_box_draw.bg
and word ed_flags,ed_offset_cl
popad
ret
952,7 → 951,7
 
;Ž¡à ¡®âª  Shift ¤«ï á­ïâ¨ï ¢ë¤¥«¥­¨ï ­¥¨§¢¥áâ­®© ®¡« áâ¨
edit_box_key.shift:
call edit_box.draw_bg
call edit_box_draw.bg
test word ed_flags,ed_shift
je edit_box_key.f_exit
mov ebp,shift_color
959,13 → 958,13
or word ed_flags,ed_shift_bac ;ãáâ ­®¢ª  ä« £ , ¢ë¤¥«¥­­®© ®¡« áâ¨
movzx ebx, word ed_shift_pos
call edit_box_key.sh_cl_
jmp edit_box.draw_cursor_text
jmp edit_box_draw.cursor_text
 
edit_box_key.f_exit:
call edit_box.check_offset
and word ed_flags,ed_shift_cl
call edit_box_key.enable_null
jmp edit_box.draw_cursor_text
jmp edit_box_draw.cursor_text
 
edit_box_key.sh_cl_:
;®¡à ¡®âª  ®ç¨á⪨, ¯à¨ «¥¢®¬ - ¯à ¢®¬ ¤¢¨¦¥­¨¨ ¢ë¤¥«¥­¨ï
1020,7 → 1019,7
inc eax
mov bx, ax
mov edx,ebp ;shift_color
call edit_box.draw_bg_eax
call edit_box_draw.bg_eax
jmp edit_box_key.enable_null
 
;“áâ ­®¢ª - á­ï⨥ ¢ë¤¥«¥­¨ï ¢ ®¤¨­ ᨬ¢®«
1070,12 → 1069,12
jne @f
test word ed_flags,ed_shift_bac
je @f
call edit_box.draw_bg
call edit_box_draw.bg
mov ebp,ed_color
movzx ebx, word ed_shift_pos
call edit_box_key.sh_cl_ ;®ç¨á⪠ ¢ë¤¥«¥­®£® äà £¬¥­â 
and word ed_flags,ed_shift_cl ; ®ç¨á⪠ ®â ⮣®, çâ® ã¡à «¨ ¢ë¤¥«¥­¨¥
jmp edit_box.draw_cursor_text
jmp edit_box_draw.cursor_text
 
@@: and word ed_flags,ed_shift_off
popad
1150,7 → 1149,7
jmp edit_box_key.sh_e_end
 
edit_box_key.sh_exit_:
call edit_box.draw_bg
call edit_box_draw.bg
jmp edit_box.check_offset
 
;äã­ªæ¨ï ¢­¥á¥­¨ï 0 ¯®  ¤à¥áã ed_size+1
1248,7 → 1247,7
inc eax
mov bx, ax
mov edx,ed_color
jmp edit_box.draw_bg_eax
jmp edit_box_draw.bg_eax
 
;;;;;;;;;;;;;;;;;;;
;;; Ž¡à ¡®âª  ¯à¨¬¨â¨¢®¢
1266,7 → 1265,7
add eax,ed_char_width
mov ebx,eax
mov edx,ebp
jmp edit_box.draw_bg_eax
jmp edit_box_draw.bg_eax
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;”㭪樨 ¤«ï à ¡®âë á mouse
1273,8 → 1272,8
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
edit_box_mouse.mouse_wigwag:
push eax
call edit_box.draw_bg
call edit_box.draw_shift
call edit_box_draw.bg
call edit_box_draw.shift
pop eax
or word ed_flags,ed_shift_bac+ed_shift_on+ed_shift
;Ž¡à ¡®âª  ¯®«®¦¥­¨ï ¢ë¤¥«¥­­®£® ⥪áâ , ª®£¤  ¯à®¨á室¨â ¢ë室 §  ¯à¥¤¥«ë editbox
1323,7 → 1322,7
call edit_box_key.sh_cl_
edit_box_mouse.mwigvag:
and word ed_flags,ed_shift_mcl
jmp edit_box.draw_cursor_text
jmp edit_box_draw.cursor_text
 
edit_box_mouse.mleft:
mov eax,ed_pos