From e8665a7cf1c8b2248616eb69dfdfcaa5fad8b4ad Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Thu, 14 May 2020 19:14:14 +0000 Subject: [PATCH] editbox update by Prohor N. git-svn-id: svn://kolibrios.org@7919 a494cfbc-eb01-0410-851d-a64ba20cac60 --- .../libraries/box_lib/trunk/box_lib.asm | 15 +- .../libraries/box_lib/trunk/editbox.asm | 2058 ++++++++--------- .../develop/libraries/box_lib/trunk/keys.inc | 181 ++ 3 files changed, 1185 insertions(+), 1069 deletions(-) create mode 100644 programs/develop/libraries/box_lib/trunk/keys.inc diff --git a/programs/develop/libraries/box_lib/trunk/box_lib.asm b/programs/develop/libraries/box_lib/trunk/box_lib.asm index db1a10adff..01ec9576c4 100644 --- a/programs/develop/libraries/box_lib/trunk/box_lib.asm +++ b/programs/develop/libraries/box_lib/trunk/box_lib.asm @@ -22,6 +22,7 @@ include '../../../../KOSfuncs.inc' include 'bl_sys.mac' include 'box_lib.mac' ;macro which should make life easier :) ;include '../../../../debug.inc' +include 'keys.inc' ;----------------------------------------------------------------------------- mem.alloc dd ? ;ЇєэъЎш  фы  т√фхыхэш  ярь Єш @@ -112,7 +113,7 @@ ret align 4 proc draw_edge uses eax ebx ecx edx edi esi, box_l:dword, box_t:dword, box_w:dword, box_h:dword,\ - col_0:dword, col_1:dword, col_2:dword + col_0:dword, col_1:dword, col_2:dword mov esi,dword[col_1] and esi,111111101111111011111110b @@ -130,7 +131,7 @@ proc draw_edge uses eax ebx ecx edx edi esi, box_l:dword, box_t:dword, box_w:dwo inc ecx mov edi,3 ;for cycle - @@: + @@: ;calculate colors and edx,111111101111111011111110b add edx,esi @@ -155,7 +156,7 @@ proc draw_edge uses eax ebx ecx edx edi esi, box_l:dword, box_t:dword, box_w:dwo add ecx,dword[box_h] mov edi,3 ;for cycle - @@: + @@: ;calculate colors and edx,111111101111111011111110b add edx,esi @@ -179,7 +180,7 @@ proc draw_edge uses eax ebx ecx edx edi esi, box_l:dword, box_t:dword, box_w:dwo inc ecx mov edi,3 ;for cycle - @@: + @@: ;calculate colors and edx,111111101111111011111110b add edx,esi @@ -203,7 +204,7 @@ proc draw_edge uses eax ebx ecx edx edi esi, box_l:dword, box_t:dword, box_w:dwo add ecx,dword[box_h] mov edi,3 ;for cycle - @@: + @@: ;calculate colors and edx,111111101111111011111110b add edx,esi @@ -432,7 +433,7 @@ sz_ted_but_paste db 'ted_but_paste',0 sz_ted_but_undo db 'ted_but_undo',0 sz_ted_but_redo db 'ted_but_redo',0 sz_ted_but_reverse db 'ted_but_reverse',0 -sz_ted_but_find db 'ted_but_find',0 +sz_ted_but_find db 'ted_but_find',0 sz_ted_but_replace db 'ted_but_replace',0 sz_ted_text_colored db 'ted_text_colored',0 sz_ted_go_to_position db 'ted_go_to_position',0 @@ -444,7 +445,7 @@ szVersion_frame db 'version_frame',0 sz_progressbar_draw db 'progressbar_draw', 0 sz_progressbar_progress db 'progressbar_progress', 0 -sz_tooltip_init db 'tooltip_init', 0 +sz_tooltip_init db 'tooltip_init', 0 sz_tooltip_delete db 'tooltip_delete', 0 sz_tooltip_test_show db 'tooltip_test_show', 0 sz_tooltip_mouse db 'tooltip_mouse', 0 diff --git a/programs/develop/libraries/box_lib/trunk/editbox.asm b/programs/develop/libraries/box_lib/trunk/editbox.asm index 40ebf2b850..ef5861b7ab 100644 --- a/programs/develop/libraries/box_lib/trunk/editbox.asm +++ b/programs/develop/libraries/box_lib/trunk/editbox.asm @@ -1,393 +1,346 @@ -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 align 16 edit_box: .draw: - pushad - mov edi,[esp+36] - and dword ed_text_color,17FFFFFFh - mov ecx,ed_text_color - mov ebx,ecx - shr ecx,28 - shl ebx,4 - shr ebx,28 - inc ebx - mov eax,6 - jecxz @f - mov al, 8 + pushad + mov edi,[esp+36] + and dword ed_text_color,17FFFFFFh + mov ecx,ed_text_color + mov ebx,ecx + shr ecx,28 + shl ebx,4 + shr ebx,28 + inc ebx + mov eax,6 + jecxz @f + mov al, 8 @@: - mul bl - mov ed_char_width,eax - mov al, 9 - jecxz @f - mov al, 16 + mul bl + mov ed_char_width,eax + mov al, 9 + jecxz @f + mov al, 16 @@: - mul bl - add eax,4 - mov ed_height,eax - call .draw_border + mul bl + add eax,4 + mov ed_height,eax + 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) - call .check_offset -;.sjip_offset: - call .draw_bg - test word ed_flags,ed_focus ; for unfocused controls => - jz .draw_cursor_text ; do not draw selection(named shift) - call .draw_shift + ;test word ed_flags,ed_focus ; for unfocused controls => + ;jz .skip_offset ; do not recalculate offset + call .check_offset +;.skip_offset: + call .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 - test word ed_flags,ed_focus ; and dosn`t draw cursor - jz .editbox_exit - call .draw_cursor + call .draw_text + test word ed_flags,ed_focus ; and dosn`t draw cursor + jz .editbox_exit + call .draw_cursor ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Общий выход из editbox для всех функций и пост обработчиков;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; .editbox_exit: - popad - ret 4 + popad + ret 4 ;========================================================== ;=== обработка клавиатуры ================================= ;========================================================== align 16 edit_box_key: - pushad - mov edi,[esp+36] - test word ed_flags,ed_focus ; если не в фокусе, выходим - jz edit_box.editbox_exit - test word ed_flags,ed_mouse_on or ed_disabled - jnz edit_box.editbox_exit + pushad + mov edi,[esp+36] + test word ed_flags,ed_focus ; если не в фокусе, выходим + jz edit_box.editbox_exit + test word ed_flags,ed_mouse_on or ed_disabled + jnz edit_box.editbox_exit ;-------------------------------------- ; 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 + mcall SF_KEYBOARD,SSF_GET_CONTROL_KEYS + 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 + ror eax,8 ; check for ctrl+ combinations - test word ed_flags,ed_ctrl_on - jz @f - cmp ah,45 ; Ctrl + X - je edit_box_key.ctrl_x - cmp ah,46 ; Ctrl + C - je edit_box_key.ctrl_c - cmp ah,47 ; Ctrl + V - je edit_box_key.ctrl_v - cmp ah,30 ; Ctrl + A - je edit_box_key.ctrl_a + test word ed_flags,ed_ctrl_on + jz @f + cmp ah,SCAN_CODE_X ; Ctrl + X + je edit_box_key.ctrl_x + cmp ah,SCAN_CODE_C ; Ctrl + C + je edit_box_key.ctrl_c + cmp ah,SCAN_CODE_V ; Ctrl + V + je edit_box_key.ctrl_v + cmp ah,SCAN_CODE_A ; Ctrl + A + je edit_box_key.ctrl_a + jmp edit_box.editbox_exit +@@: + 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_CODE_TAB + jz edit_box.editbox_exit + 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 al,'0' + jb edit_box.editbox_exit + cmp al,'9' + ja edit_box.editbox_exit @@: - cmp ah,SCAN_LWIN_RELEASE - jz edit_box.editbox_exit - cmp ah,SCAN_RWIN_RELEASE - 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 -;--- нажата другая клавиша --- -;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;Проверка установлен ли флаг при котором нужно выводить -;только цифры в нужном боксе -;;;;;;;;;;;;;;;;;;;;;;;;;;;; - test word ed_flags,ed_figure_only ; только цифры? - jz @f - cmp ah,'0' - jb edit_box.editbox_exit - cmp ah,'9' - ja edit_box.editbox_exit -@@: + rol eax,8 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;проверка на shift, был ли нажат ;;;;;;;;;;;;;;;;;;;;;;;;;;;; - test word ed_flags,ed_shift_on - je @f + test word ed_flags,ed_shift_on + je @f ; edx = ed_size, ecx = ed_pos - push eax - mov edx,ed_size - mov ecx, ed_pos - pusha + push eax + mov edx,ed_size + mov ecx, ed_pos + pusha ; clear input area - mov ebp,ed_color - movzx ebx, word ed_shift_pos - call edit_box_key.sh_cl_ - mov ebp,ed_size - call edit_box_key.clear_bg - popa - call edit_box_key.del_char - mov ebx,ed_size - sub bx,ed_shift_pos - mov ed_size,ebx - pop eax + mov ebp,ed_color + movzx ebx, word ed_shift_pos + call edit_box_key.sh_cl_ + mov ebp,ed_size + call edit_box_key.clear_bg + popa + call edit_box_key.del_char + mov ebx,ed_size + sub bx,ed_shift_pos + mov ed_size,ebx + pop eax @@: ;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; проверяем, находится ли курсор в конце + дальнейшая обработка ;;;;;;;;;;;;;;;;;;;;;;;;;;;; - mov ecx,ed_size - mov edx, ed_max - test word ed_flags,ed_insert - jne @f - cmp ecx,edx - jae edit_box.editbox_exit -@@: mov ebx, ed_pos - cmp ebx,edx - jnl edit_box.editbox_exit - mov ecx,ed_size - push edi eax - mov ebp,edi - mov esi,ed_text - add esi,ecx - mov edi,esi - cmp ecx,ebx - je edit_box_key.In_k - test dword bp_flags,ed_insert - jne edit_box_key.ins_v - pusha - mov edi,ebp - mov ebp,ed_size - call edit_box_key.clear_bg - popa - sub ecx,ebx - inc edi - std - inc ecx + mov ecx,ed_size + mov edx, ed_max + test word ed_flags,ed_insert + jne @f + cmp ecx,edx + jae edit_box.editbox_exit +@@: mov ebx, ed_pos + cmp ebx,edx + jnl edit_box.editbox_exit + mov ecx,ed_size + push edi eax + mov ebp,edi + mov esi,ed_text + add esi,ecx + mov edi,esi + cmp ecx,ebx + je edit_box_key.In_k + test dword bp_flags,ed_insert + jne edit_box_key.ins_v + pusha + mov edi,ebp + mov ebp,ed_size + call edit_box_key.clear_bg + popa + sub ecx,ebx + inc edi + std + inc ecx @@: - lodsb - stosb - loop @b + lodsb + stosb + loop @b edit_box_key.In_k: - cld - pop eax - mov al,ah - stosb - pop edi - inc dword ed_size - inc dword ed_pos - call edit_box_key.draw_all2 - jmp edit_box_key.shift + cld + pop eax + mov al,ah + stosb + pop edi + inc dword ed_size + inc dword ed_pos + call edit_box_key.draw_all2 + jmp edit_box_key.shift ;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Обработка клавиш 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 - jmp edit_box.editbox_exit - -@@: or word ed_flags,ed_insert - jmp edit_box.editbox_exit + xor word ed_flags,ed_insert + jmp edit_box.editbox_exit edit_box_key.ins_v: - dec dword bp_size - sub esi,ecx - add esi,ebx - mov edi,esi - pusha - mov edi,ebp - mov ebp,ed_pos - call edit_box_key.clear_bg - popa - jmp edit_box_key.In_k + dec dword bp_size + sub esi,ecx + add esi,ebx + mov edi,esi + pusha + mov edi,ebp + mov ebp,ed_pos + call edit_box_key.clear_bg + popa + jmp edit_box_key.In_k edit_box_key.delete: - mov edx,ed_size - mov ecx,ed_pos - cmp edx,ecx - jg edit_box_key.bac_del - test word ed_flags,ed_shift_on - jne edit_box_key.del_bac - popad - ret 4 + mov edx,ed_size + mov ecx,ed_pos + cmp edx,ecx + jg edit_box_key.bac_del + test word ed_flags,ed_shift_on + jne edit_box_key.del_bac + popad + ret 4 edit_box_key.bac_del: - call edit_box_key.del_char - jmp edit_box_key.draw_all + call edit_box_key.del_char + jmp edit_box_key.draw_all edit_box_key.backspace: - test word ed_flags,ed_shift_on - jne edit_box_key.delete - mov ecx,ed_pos - test ecx,ecx - jnz edit_box_key.del_bac - popad - ret 4 + test word ed_flags,ed_shift_on + jne edit_box_key.delete + mov ecx,ed_pos + test ecx,ecx + jnz edit_box_key.del_bac + popad + ret 4 edit_box_key.del_bac: - mov edx,ed_size - cmp edx,ecx ;if ed_pos=ed_size - je @f - dec ecx - call edit_box_key.del_char -@@: test word ed_flags,ed_shift_on - jne edit_box_key.bac_del - dec dword ed_pos + mov edx,ed_size + cmp edx,ecx ;if ed_pos=ed_size + je @f + dec ecx + call edit_box_key.del_char +@@: test word ed_flags,ed_shift_on + jne edit_box_key.bac_del + dec dword ed_pos edit_box_key.draw_all: - push edit_box_key.shift - test word ed_flags,ed_shift_on - je @f - movzx eax, word ed_shift_pos - mov ebx,ed_size - sub ebx,eax - mov ed_size,ebx - mov ebp,ed_color - call edit_box.clear_cursor - call edit_box.check_offset - and word ed_flags,ed_shift_cl - jmp edit_box.draw_bg + push edit_box_key.shift + test word ed_flags,ed_shift_on + je @f + movzx eax, word ed_shift_pos + mov ebx,ed_size + sub ebx,eax + mov ed_size,ebx + mov ebp,ed_color + call edit_box.clear_cursor + call edit_box.check_offset + and word ed_flags,ed_shift_cl + jmp edit_box.draw_bg -@@: dec dword ed_size +@@: dec dword ed_size edit_box_key.draw_all2: - and word ed_flags,ed_shift_cl - mov ebp,ed_color - call edit_box.clear_cursor - call edit_box.check_offset - mov ebp,ed_size - jmp edit_box_key.clear_bg + and word ed_flags,ed_shift_cl + mov ebp,ed_color + call edit_box.clear_cursor + call edit_box.check_offset + mov ebp,ed_size + jmp edit_box_key.clear_bg ;--- нажата клавиша left --- edit_box_key.left: - mov ebx,ed_pos - test ebx,ebx - jz edit_box_key.sh_st_of - 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_key.sh_enable - jmp edit_box.draw_cursor_text + mov ebx,ed_pos + test ebx,ebx + jz edit_box_key.sh_st_of + 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_key.sh_enable + jmp edit_box.draw_cursor_text ;--- нажата клавиша right --- edit_box_key.right: - mov ebx,ed_pos - cmp ebx,ed_size - je edit_box_key.sh_st_of - 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_key.sh_enable - jmp edit_box.draw_cursor_text + mov ebx,ed_pos + cmp ebx,ed_size + je edit_box_key.sh_st_of + 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_key.sh_enable + jmp edit_box.draw_cursor_text edit_box_key.home: - mov ebx,ed_pos - test ebx,ebx - jz edit_box_key.sh_st_of - 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_key.sh_home_end - jmp edit_box.draw_cursor_text + mov ebx,ed_pos + test ebx,ebx + jz edit_box_key.sh_st_of + 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_key.sh_home_end + jmp edit_box.draw_cursor_text ;--- нажата клавиша end --- edit_box_key.end: - mov ebx,ed_pos - cmp ebx,ed_size - je edit_box_key.sh_st_of - 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_key.sh_home_end - jmp edit_box.draw_cursor_text + mov ebx,ed_pos + cmp ebx,ed_size + je edit_box_key.sh_st_of + 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_key.sh_home_end + jmp edit_box.draw_cursor_text ;---------------------------------------- StrInsert: ; SizeOf(TmpBuf) >= StrLen(Src) + StrLen(Dst) + 1 @@ -397,58 +350,58 @@ Pos equ [esp + 8] ; - position for insert DstMax equ [esp + 4] ; - maximum Dst length(exclude terminating null) SrcCount equ [esp - 4] DstCount equ [esp - 8] -TmpBuf equ [esp - 12] ; - temporary buffer - mov edi, Src - mov ecx, -1 - xor eax, eax - repne scasb - mov eax, -2 - sub eax, ecx - mov SrcCount, eax - mov edi, Dst - add edi, Pos - mov ecx, -1 - xor eax, eax - repne scasb - mov eax, -2 - sub eax, ecx - inc eax - mov DstCount, eax - mov ecx, eax - add ecx, SrcCount - add ecx, Pos - mcall SF_SYS_MISC,SSF_MEM_ALLOC - mov TmpBuf, eax - mov esi, Dst - mov edi, TmpBuf - mov ecx, Pos - mov edx, ecx - rep movsb - mov esi, Src - mov edi, TmpBuf - add edi, Pos - mov ecx, SrcCount - add edx, ecx - rep movsb - mov esi, Pos - add esi, Dst - mov ecx, DstCount - add edx, ecx - rep movsb - mov esi, TmpBuf - mov edi, Dst +TmpBuf equ [esp - 12] ; - temporary buffer + mov edi, Src + mov ecx, -1 + xor eax, eax + repne scasb + mov eax, -2 + sub eax, ecx + mov SrcCount, eax + mov edi, Dst + add edi, Pos + mov ecx, -1 + xor eax, eax + repne scasb + mov eax, -2 + sub eax, ecx + inc eax + mov DstCount, eax + mov ecx, eax + add ecx, SrcCount + add ecx, Pos + mcall SF_SYS_MISC,SSF_MEM_ALLOC + mov TmpBuf, eax + mov esi, Dst + mov edi, TmpBuf + mov ecx, Pos + mov edx, ecx + rep movsb + mov esi, Src + mov edi, TmpBuf + add edi, Pos + mov ecx, SrcCount + add edx, ecx + rep movsb + mov esi, Pos + add esi, Dst + mov ecx, DstCount + add edx, ecx + rep movsb + mov esi, TmpBuf + mov edi, Dst ; ecx = MIN(edx, DstSize) - cmp edx, DstMax - sbb ecx, ecx - and edx, ecx - not ecx - and ecx, DstMax - add ecx, edx - mov eax, ecx ; return total length - rep movsb - mov ecx, TmpBuf - mcall SF_SYS_MISC,SSF_MEM_FREE - ret 16 + cmp edx, DstMax + sbb ecx, ecx + and edx, ecx + not ecx + and ecx, DstMax + add ecx, edx + mov eax, ecx ; return total length + rep movsb + mov ecx, TmpBuf + mcall SF_SYS_MISC,SSF_MEM_FREE + ret 16 restore Dst restore Src restore Pos @@ -458,122 +411,122 @@ restore SrcCount restore DstCount ;---------------------------------------- edit_box_key.ctrl_x: - test word ed_flags,ed_shift_on - jz edit_box.editbox_exit - push dword 'X' ; this value need below to determine which action is used - jmp edit_box_key.ctrl_c.pushed + test word ed_flags,ed_shift_on + jz edit_box.editbox_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 - push dword 'C' ; this value need below to determine which action is used + test word ed_flags,ed_shift_on + jz edit_box.editbox_exit + push dword 'C' ; this value need below to determine which action is used .pushed: ; add memory area - mov ecx,ed_size - add ecx,3*4 - mcall SF_SYS_MISC,SSF_MEM_ALLOC + mov ecx,ed_size + add ecx,3*4 + mcall SF_SYS_MISC,SSF_MEM_ALLOC ; 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_pos - movzx ebx,word ed_shift_pos - sub ecx,ebx + xor ecx,ecx + mov [eax+4],ecx ; type 'text' + inc ecx + mov [eax+8],ecx ; cp866 text encoding + mov ecx,ed_pos + movzx ebx,word ed_shift_pos + sub ecx,ebx .abs: ; make ecx = abs(ecx) neg ecx jl .abs - add ecx,3*4 - mov [eax],ecx - sub ecx,3*4 - mov edx,ed_pos - movzx ebx,word ed_shift_pos - cmp edx,ebx - jle @f - mov edx,ebx + add ecx,3*4 + mov [eax],ecx + sub ecx,3*4 + mov edx,ed_pos + movzx ebx,word ed_shift_pos + cmp edx,ebx + jle @f + mov edx,ebx @@: ; copy data - mov esi,ed_text - add esi,edx - push edi - mov edi,eax - add edi,3*4 - cld - rep movsb - pop edi + mov esi,ed_text + add esi,edx + 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 SF_CLIPBOARD,SSF_WRITE_CB - pop ecx + mov edx,eax + mov ecx,[edx] + push eax + mcall SF_CLIPBOARD,SSF_WRITE_CB + pop ecx ; remove unnecessary memory area - mcall SF_SYS_MISC,SSF_MEM_FREE + mcall SF_SYS_MISC,SSF_MEM_FREE .exit: - pop eax ; determine current action (ctrl+X or ctrl+C) - cmp eax, 'X' - je edit_box_key.delete - jmp edit_box.editbox_exit + pop eax ; determine current action (ctrl+X or ctrl+C) + cmp eax, 'X' + je edit_box_key.delete + jmp edit_box.editbox_exit edit_box_key.ctrl_v: - mcall SF_CLIPBOARD,SSF_GET_SLOT_COUNT + mcall SF_CLIPBOARD,SSF_GET_SLOT_COUNT ; no slots of clipboard ? - test eax,eax - jz .exit + test eax,eax + jz .exit ; main list area not found ? - inc eax - test eax,eax - jz .exit - sub eax,2 - mov ecx,eax - mcall SF_CLIPBOARD,SSF_READ_CB + inc eax + test eax,eax + jz .exit + sub eax,2 + mov ecx,eax + mcall SF_CLIPBOARD,SSF_READ_CB ; main list area not found ? - inc eax - test eax,eax - jz .exit + inc eax + test eax,eax + jz .exit ; error ? - sub eax,2 - test eax,eax - jz .exit - inc eax + sub eax,2 + test eax,eax + jz .exit + inc eax ; check contents of container - mov ebx,[eax+4] + mov ebx,[eax+4] ; check for text - test ebx,ebx - jnz .no_valid_text - mov ebx,[eax+8] + test ebx,ebx + jnz .no_valid_text + mov ebx,[eax+8] ; check for cp866 - cmp bl,1 - jnz .no_valid_text + cmp bl,1 + jnz .no_valid_text ; if something selected then need to delete it - test word ed_flags,ed_shift_on - jz .selected_done - push eax; dummy parameter ; need to - push dword .selected_done ; correctly return - pushad ; from edit_box_key.delete - jmp edit_box_key.delete + test word ed_flags,ed_shift_on + jz .selected_done + push eax; dummy parameter ; need to + push dword .selected_done ; correctly return + pushad ; from edit_box_key.delete + jmp edit_box_key.delete .selected_done: - mov ecx,[eax] - sub ecx,3*4 - push ecx + mov ecx,[eax] + sub ecx,3*4 + push ecx ; in ecx size of string to insert - add ecx,ed_size - mov edx,ed_max - cmp ecx,edx - jb @f - mov ecx,edx + add ecx,ed_size + mov edx,ed_max + cmp ecx,edx + jb @f + mov ecx,edx @@: - mov esi,eax - add esi,3*4 - push eax edi + mov esi,eax + add esi,3*4 + push eax edi ;---------------------------------------; - mov ed_size,ecx + mov ed_size,ecx - push dword ed_text ; Dst - push esi ; Src - push dword ed_pos ; Pos in Dst - push dword ed_max ; DstMax - call StrInsert + push dword ed_text ; Dst + push esi ; Src + push dword ed_pos ; Pos in Dst + push dword ed_max ; DstMax + call StrInsert ;---------------------------------------; ; mov edi,ed_text ; cld @@ -589,29 +542,29 @@ edit_box_key.ctrl_v: ; stosb ; dec ecx ; jnz @b - pop edi eax -;move cursor to the end of the inserted string - pop ecx - add ecx,ed_pos - cmp ecx,ed_max - jbe @f - mov ecx,ed_max + pop edi eax +;move cursor to the end of the inserted string + pop ecx + add ecx,ed_pos + cmp ecx,ed_max + jbe @f + mov ecx,ed_max @@: mov ed_pos, ecx .no_valid_text: ; remove unnecessary memory area - mov ecx,eax - mcall SF_SYS_MISC,SSF_MEM_FREE + 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 - mov ed_pos,eax - 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 + mov eax,ed_size + mov ed_pos,eax + 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 ;========================================================== ;=== обработка мыши ======================================= @@ -619,127 +572,127 @@ edit_box_key.ctrl_a: ;save for stdcall ebx,esi,edi,ebp align 16 edit_box_mouse: - pushad - mov edi,[esp+36] - test word ed_flags,ed_disabled - jnz edit_box.editbox_exit + pushad + mov edi,[esp+36] + test word ed_flags,ed_disabled + jnz edit_box.editbox_exit ;---------------------------------------------------------- ;--- получаем состояние кнопок мыши ----------------------- ;---------------------------------------------------------- - mcall SF_MOUSE_GET,SSF_BUTTON + mcall SF_MOUSE_GET,SSF_BUTTON ;---------------------------------------------------------- ;--- проверяем состояние ---------------------------------- ;---------------------------------------------------------- - test eax,1 - jnz edit_box_mouse.mouse_left_button - and word ed_flags,ed_mouse_on_off - mov ebx,ed_mouse_variable - push 0 - pop dword [ebx] - jmp edit_box.editbox_exit + test eax,1 + jnz edit_box_mouse.mouse_left_button + and word ed_flags,ed_mouse_on_off + mov ebx,ed_mouse_variable + push 0 + pop dword [ebx] + jmp edit_box.editbox_exit .mouse_left_button: ;---------------------------------------------------------- ;--- блокировка от фокусировки в других боксах при попадании на них курсора ;---------------------------------------------------------- - mov eax,ed_mouse_variable - push dword [eax] - pop eax - test eax,eax - jz @f - cmp eax,edi - je @f - jmp edit_box_mouse._blur + mov eax,ed_mouse_variable + push dword [eax] + pop eax + test eax,eax + jz @f + cmp eax,edi + je @f + jmp edit_box_mouse._blur ;---------------------------------------------------------- ;--- получаем координаты мыши относительно 0 т.е всей области экрана ;---------------------------------------------------------- @@: - mcall SF_MOUSE_GET,SSF_WINDOW_POSITION + mcall SF_MOUSE_GET,SSF_WINDOW_POSITION ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Функция обработки мышки получение координат и проверка их + выделения ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Не удерживаем ли мы клавишу мышки, перемещая курсор? - test word ed_flags,ed_mouse_on - jne edit_box_mouse.mouse_wigwag + test word ed_flags,ed_mouse_on + jne edit_box_mouse.mouse_wigwag ; проверяем, попадает ли курсор в edit box - mov ebx,ed_top - cmp ax,bx - jl edit_box_mouse._blur - add ebx,ed_height - cmp ax,bx - jg edit_box_mouse._blur - shr eax,16 - mov ebx,ed_left - cmp ax,bx - jl edit_box_mouse._blur - add ebx,ed_width - cmp ax,bx - jg edit_box_mouse._blur + mov ebx,ed_top + cmp ax,bx + jl edit_box_mouse._blur + add ebx,ed_height + cmp ax,bx + jg edit_box_mouse._blur + shr eax,16 + mov ebx,ed_left + cmp ax,bx + jl edit_box_mouse._blur + add ebx,ed_width + cmp ax,bx + jg edit_box_mouse._blur ; изменяем позицию курсора - push eax - mov ebp,ed_color - call edit_box.clear_cursor - pop eax + push eax + mov ebp,ed_color + call edit_box.clear_cursor + pop eax edit_box_mouse._mvpos: - xor edx,edx - sub eax,ed_left - div word ed_char_width - add eax,ed_offset - cmp eax,ed_size - jna edit_box_mouse._mshift - mov eax,ed_size + xor edx,edx + sub eax,ed_left + div word ed_char_width + add eax,ed_offset + cmp eax,ed_size + jna edit_box_mouse._mshift + mov eax,ed_size edit_box_mouse._mshift: ; секция обработки shift и выделения по shift - test word ed_flags,ed_shift_bac - je @f - mov ebp,ed_color - movzx ebx, word ed_shift_pos - push eax - call edit_box_key.sh_cl_ - and word ed_flags,ed_shift_bac_cl - pop eax + test word ed_flags,ed_shift_bac + je @f + mov ebp,ed_color + movzx ebx, word ed_shift_pos + push eax + call edit_box_key.sh_cl_ + and word ed_flags,ed_shift_bac_cl + pop eax @@: - test word ed_flags,ed_mouse_on - jne @f - mov ed_shift_pos,ax - or word ed_flags,ed_mouse_on - mov ed_pos,eax - mov ebx,ed_mouse_variable - push edi - pop dword [ebx] - bts word ed_flags,1 - call edit_box.draw_bg - jmp edit_box_mouse.m_sh + test word ed_flags,ed_mouse_on + jne @f + mov ed_shift_pos,ax + or word ed_flags,ed_mouse_on + mov ed_pos,eax + mov ebx,ed_mouse_variable + push edi + pop dword [ebx] + bts word ed_flags,1 + call edit_box.draw_bg + jmp edit_box_mouse.m_sh -@@: cmp ax,ed_shift_pos - je edit_box.editbox_exit - mov ed_pos,eax - 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 +@@: cmp ax,ed_shift_pos + je edit_box.editbox_exit + mov ed_pos,eax + 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 - + jmp edit_box_mouse.drc + edit_box_mouse._remove_selection: - and word ed_flags,ed_shift_cl - jmp edit_box.draw_bg_cursor_text + and word ed_flags,ed_shift_cl + jmp edit_box.draw_bg_cursor_text edit_box_mouse._blur: - test word ed_flags,ed_always_focus - jne edit_box_mouse._remove_selection - btr word ed_flags, bsf ed_focus ;if focused then remove focus, otherwise exit - jnc edit_box_mouse._remove_selection - mov ebp,ed_color - call edit_box.clear_cursor + test word ed_flags,ed_always_focus + jne edit_box_mouse._remove_selection + btr word ed_flags, bsf ed_focus ;if focused then remove focus, otherwise exit + jnc edit_box_mouse._remove_selection + mov ebp,ed_color + call edit_box.clear_cursor edit_box_mouse.drc: - call edit_box.draw_border - jmp edit_box_mouse._remove_selection + call edit_box.draw_border + jmp edit_box_mouse._remove_selection ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Общие функции обработки @@ -747,159 +700,163 @@ edit_box_mouse.drc: ;--- процедура прорисовки выделенной части ---------------- ;---------------------------------------------------------- edit_box.draw_shift: - test word ed_flags,ed_shift_bac ;установка флага, выделенной области - jz @f - mov ebp,shift_color - movzx ebx, word ed_shift_pos - call edit_box_key.sh_cl_ -@@: ret + test word ed_flags,ed_shift_bac ;установка флага, выделенной области + jz @f + mov ebp,shift_color + movzx ebx, word ed_shift_pos + call edit_box_key.sh_cl_ +@@: ret ;---------------------------------------------------------- ;--- процедура прорисовки текста -------------------------- ;---------------------------------------------------------- edit_box.draw_text: - call edit_box.get_n - mov esi,ed_size - sub esi,ed_offset - cmp eax,esi - jae @f - mov esi,eax + call edit_box.get_n + mov esi,ed_size + sub esi,ed_offset + cmp eax,esi + jae @f + mov esi,eax @@: - test esi,esi - jz @f - mov eax,SF_DRAW_TEXT - mov ebx,ed_left - add ebx,2 - shl ebx,16 - add ebx,ed_top - add ebx,3 - mov ecx,ed_text_color - test dword ed_flags,ed_pass - jnz .password - mov edx,ed_text - add edx,ed_offset - mcall + test esi,esi + jz @f + mov eax,SF_DRAW_TEXT + mov ebx,ed_left + add ebx,2 + shl ebx,16 + add ebx,ed_top + add ebx,3 + mov ecx,ed_text_color + test dword ed_flags,ed_pass + jnz .password + mov edx,ed_text + add edx,ed_offset + mcall @@: - ret + ret .password: - mov ebp,esi - mov esi,1 - mov edx,txt_pass + mov ebp,esi + mov esi,1 + mov edx,txt_pass @@: - mcall - rol ebx,16 - add ebx,ed_char_width - rol ebx,16 - dec ebp - jnz @b - ret + mcall + rol ebx,16 + add ebx,ed_char_width + rol ebx,16 + dec ebp + jnz @b + ret txt_pass db '*' ;---------------------------------------------------------- ;--- процедура прорисовки фона ---------------------------- ;---------------------------------------------------------- edit_box.draw_bg: - mov ebx,ed_left - inc ebx - shl ebx,16 - add ebx,ed_width - dec ebx - mov edx,ed_color - test word ed_flags, ed_disabled - jz edit_box.draw_bg_eax - mov edx, 0xCACACA ; TODO: add disabled_color field to editbox struct + mov ebx,ed_left + inc ebx + shl ebx,16 + add ebx,ed_width + dec ebx + mov edx,ed_color + test word ed_flags, ed_disabled + jz edit_box.draw_bg_eax + mov edx, 0xCACACA ; TODO: add disabled_color field to editbox struct edit_box.draw_bg_eax: - mov ecx,ed_top - inc ecx - shl ecx,16 - add ecx,ed_height - mcall SF_DRAW_RECT - ret + mov ecx,ed_top + inc ecx + shl ecx,16 + add ecx,ed_height + mcall SF_DRAW_RECT + ret ;---------------------------------------------------------- ;--- процедура получения количества символов в текущей ширине компонента ;---------------------------------------------------------- edit_box.get_n: - mov eax,ed_width - sub eax,4 - xor edx,edx - div word ed_char_width - ret + mov eax,ed_width + sub eax,4 + xor edx,edx + div word ed_char_width + ret ;---------------------------------------------------------- ;------------------ Draw Cursor Procedure ----------------- ;---------------------------------------------------------- ; in: ebp = Color edit_box.clear_cursor: - movzx ebx, word cl_curs_x - cmp ebx, ed_left ;попадает ли курсор текстовое поле? - jle @f - mov edx, ebp - movzx ecx, word cl_curs_y - cmp ecx, ed_top - jg edit_box.draw_curs + movzx ebx, word cl_curs_x + cmp ebx, ed_left ;попадает ли курсор текстовое поле? + jle @f + mov edx, ebp + movzx ecx, word cl_curs_y + cmp ecx, ed_top + jg edit_box.draw_curs @@: - ret + ret edit_box.draw_cursor: - mov edx, ed_text_color - mov eax, ed_pos - sub eax, ed_offset - mul dword ed_char_width - mov ebx, eax - add ebx, ed_left - inc ebx - mov ecx, ed_top - add ecx, 2 - mov cl_curs_x, bx - mov cl_curs_y, cx + mov edx, ed_text_color + mov eax, ed_pos + sub eax, ed_offset + mul dword ed_char_width + mov ebx, eax + add ebx, ed_left + inc ebx + mov ecx, ed_top + add ecx, 2 + mov cl_curs_x, bx + mov cl_curs_y, cx edit_box.draw_curs: - mov eax, ebx - shl ebx, 16 - or ebx, eax - mov eax, ecx - shl ecx, 16 - or ecx, eax - add ecx, ed_height - sub ecx, 3 - mcall SF_DRAW_LINE - ret + mov eax, ebx + shl ebx, 16 + or ebx, eax + mov eax, ecx + shl ecx, 16 + or ecx, eax + add ecx, ed_height + sub ecx, 3 + mcall SF_DRAW_LINE + ret ;---------------------------------------------------------- ;--- процедура рисования рамки ---------------------------- ;---------------------------------------------------------- edit_box.draw_border: - test word ed_flags,ed_focus - mov edx,ed_focus_border_color - jne @f - mov edx,ed_blur_border_color + test word ed_flags,ed_focus + mov edx,ed_focus_border_color + jne @f + mov edx,ed_blur_border_color @@: - mov ebx,ed_left - mov ecx,ebx - shl ebx,16 - add ebx,ecx - add ebx,ed_width - mov ecx,ed_top - mov esi,ecx - shl ecx,16 - add ecx,esi - mcall SF_DRAW_LINE ; top - mov esi,ecx - inc ecx - add ecx,ed_height - mov ebp,ecx - shl ecx,16 - mov cx,bp - 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 + ;mov edx,$808080 + mov ebx,ed_left + mov eax,ebx + shl ebx,16 + add ebx,eax + ;add ebx,ed_width + mov ecx,ed_top + mov eax,ecx + shl ecx,16 + add ecx,eax + push ecx + inc ecx + add ecx,ed_height + 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 + ret ;---------------------------------------------------------- ;--- проверка, зашел ли курсор за границы и, если надо, --- @@ -909,78 +866,78 @@ edit_box.draw_border: ; в общей битовой матрице состояния компонентов word ed_flags ;---------------------------------------------------------- edit_box.check_offset: - pushad - mov ecx,ed_pos - mov ebx,ed_offset - cmp ebx,ecx - ja edit_box.sub_8 - push ebx - call edit_box.get_n - pop ebx - mov edx,ebx - add edx,eax - inc edx ;необходимо для нормального положения курсора в крайней левой позиции - cmp edx,ecx - ja @f - mov edx,ed_size - cmp edx,ecx - je edit_box.add_end - sub edx,ecx - cmp edx,8 - jbe edit_box.add_8 - add ebx,8 - jmp edit_box.chk_d + pushad + mov ecx,ed_pos + mov ebx,ed_offset + cmp ebx,ecx + ja edit_box.sub_8 + push ebx + call edit_box.get_n + pop ebx + mov edx,ebx + add edx,eax + inc edx ;необходимо для нормального положения курсора в крайней левой позиции + cmp edx,ecx + ja @f + mov edx,ed_size + cmp edx,ecx + je edit_box.add_end + sub edx,ecx + cmp edx,8 + jbe edit_box.add_8 + add ebx,8 + jmp edit_box.chk_d -@@: or word ed_flags,ed_offset_fl - popad - ret +@@: or word ed_flags,ed_offset_fl + popad + ret edit_box.sub_8: - test ecx,ecx - jz @f - sub ebx,8 ;ebx=ed_offset - ja edit_box.chk_d + test ecx,ecx + jz @f + sub ebx,8 ;ebx=ed_offset + ja edit_box.chk_d @@: - xor ebx,ebx - jmp edit_box.chk_d + xor ebx,ebx + jmp edit_box.chk_d edit_box.add_end: - sub edx,eax - mov ebx,edx - jmp edit_box.chk_d + sub edx,eax + mov ebx,edx + jmp edit_box.chk_d edit_box.add_8: - add ebx,edx + add ebx,edx edit_box.chk_d: - mov ed_offset,ebx - call edit_box.draw_bg - and word ed_flags,ed_offset_cl - popad - ret + mov ed_offset,ebx + call edit_box.draw_bg + and word ed_flags,ed_offset_cl + popad + ret align 4 proc edit_box_set_text, edit:dword, text:dword - pushad - mov edi,[edit] - mov ecx,ed_max - inc ecx - mov edi,[text] - xor al,al - cld - repne scasb - mov ecx,edi - mov edi,[edit] - mov esi,[text] - sub ecx,esi - dec ecx - mov ed_size,ecx - mov ed_pos,ecx - and word ed_flags,ed_shift_cl - mov edi,ed_text - repne movsb - mov byte[edi],0 - popad - ret + pushad + mov edi,[edit] + mov ecx,ed_max + inc ecx + mov edi,[text] + xor al,al + cld + repne scasb + mov ecx,edi + mov edi,[edit] + mov esi,[text] + sub ecx,esi + dec ecx + mov ed_size,ecx + mov ed_pos,ecx + and word ed_flags,ed_shift_cl + mov edi,ed_text + repne movsb + mov byte[edi],0 + popad + ret endp ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -989,306 +946,306 @@ endp ;Обработка Shift для снятия выделения неизвестной области edit_box_key.shift: - call edit_box.draw_bg - test word ed_flags,ed_shift - je edit_box_key.f_exit - mov ebp,shift_color - 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 + call edit_box.draw_bg + test word ed_flags,ed_shift + je edit_box_key.f_exit + mov ebp,shift_color + 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 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 + call edit_box.check_offset + and word ed_flags,ed_shift_cl + call edit_box_key.enable_null + jmp edit_box.draw_cursor_text edit_box_key.sh_cl_: ;обработка очистки, при левом - правом движении выделения ;для обработки снятия выделения ;входные параметры ebp=color ebx=ed_shift_pos - mov eax,ed_pos - cmp eax,ebx - jae edit_box_key.sh_n - push eax ;меньшее в eax - push ebx ;большее - jmp edit_box_key.sh_n1 + mov eax,ed_pos + cmp eax,ebx + jae edit_box_key.sh_n + push eax ;меньшее в eax + push ebx ;большее + jmp edit_box_key.sh_n1 edit_box_key.sh_n: - push ebx - push eax + push ebx + push eax edit_box_key.sh_n1: - call edit_box.check_offset - call edit_box.get_n - mov edx,eax ;size of ed_box - mov ecx,ed_offset - add eax,ecx ;eax = w_off= ed_offset+width - mov edx,eax ;save - pop ebx ;большее - pop eax ;меньшее - cmp eax,ecx ;сравнение меньшего с offset. - jae edit_box_key.f_f ;если больше - xor eax,eax - cmp edx,ebx ;cравним размер w_off с большим - jnb @f - mov ebx,edx + call edit_box.check_offset + call edit_box.get_n + mov edx,eax ;size of ed_box + mov ecx,ed_offset + add eax,ecx ;eax = w_off= ed_offset+width + mov edx,eax ;save + pop ebx ;большее + pop eax ;меньшее + cmp eax,ecx ;сравнение меньшего с offset. + jae edit_box_key.f_f ;если больше + xor eax,eax + cmp edx,ebx ;cравним размер w_off с большим + jnb @f + mov ebx,edx @@: - sub ebx,ecx - jmp edit_box_key.nxt_f + sub ebx,ecx + jmp edit_box_key.nxt_f edit_box_key.f_f: - sub eax,ecx - cmp edx,ebx ;cравним размер w_off с большим - jle @f - sub ebx,ecx - sub ebx,eax - jmp edit_box_key.nxt_f + sub eax,ecx + cmp edx,ebx ;cравним размер w_off с большим + jle @f + sub ebx,ecx + sub ebx,eax + jmp edit_box_key.nxt_f -@@: mov ebx,edx - sub ebx,ecx - sub ebx,eax +@@: mov ebx,edx + sub ebx,ecx + sub ebx,eax edit_box_key.nxt_f: - mul dword ed_char_width - xchg eax,ebx - mul dword ed_char_width - add ebx,ed_left - inc ebx - shl ebx,16 - inc eax - mov bx, ax - mov edx,ebp ;shift_color - call edit_box.draw_bg_eax - jmp edit_box_key.enable_null + mul dword ed_char_width + xchg eax,ebx + mul dword ed_char_width + add ebx,ed_left + inc ebx + shl ebx,16 + inc eax + mov bx, ax + mov edx,ebp ;shift_color + call edit_box.draw_bg_eax + jmp edit_box_key.enable_null ;Установка- снятие выделения в один символ edit_box_key.drw_sim: - mov eax,ed_pos - call edit_box_key.draw_rectangle - jmp edit_box_key.enable_null + mov eax,ed_pos + call edit_box_key.draw_rectangle + jmp edit_box_key.enable_null ;Функция установки выделения при движении влево и вправо и нажатии shift edit_box_key.draw_wigwag: - mov ebp,shift_color - call edit_box.clear_cursor - or word ed_flags,ed_shift_bac ;установка флага выделенной области - mov ebp,shift_color - mov eax,ed_pos - test word ed_flags,ed_left_fl - jnz edit_box_key.draw_rectangle - dec eax - jmp edit_box_key.draw_rectangle + mov ebp,shift_color + call edit_box.clear_cursor + or word ed_flags,ed_shift_bac ;установка флага выделенной области + mov ebp,shift_color + mov eax,ed_pos + test word ed_flags,ed_left_fl + jnz edit_box_key.draw_rectangle + dec eax + jmp edit_box_key.draw_rectangle ;Функция удаления выделения при движении влево и вправо и нажатии shift edit_box_key.draw_wigwag_cl: - mov ebp,ed_color - call edit_box.clear_cursor - mov ebp,ed_color - mov eax,ed_pos - test word ed_flags,ed_left_fl - jnz edit_box_key.draw_rectangle - dec eax - jmp edit_box_key.draw_rectangle + mov ebp,ed_color + call edit_box.clear_cursor + mov ebp,ed_color + mov eax,ed_pos + test word ed_flags,ed_left_fl + jnz edit_box_key.draw_rectangle + dec eax + jmp edit_box_key.draw_rectangle ;входной параметр ebx - ed_pos edit_box_key.sh_first_sh: - test word ed_flags,ed_shift - je @f - mov ed_shift_pos_old,bx - test word ed_flags,ed_shift_on - jne @f - mov ed_shift_pos,bx - or word ed_flags,ed_shift_on -@@: ret + test word ed_flags,ed_shift + je @f + mov ed_shift_pos_old,bx + test word ed_flags,ed_shift_on + jne @f + mov ed_shift_pos,bx + or word ed_flags,ed_shift_on +@@: ret ;Обработка крайних положений в editbox при нажатом shift ;производит снятие выделения, если нет shift ;иначе вообще выходит edit_box_key.sh_st_of: - test word ed_flags,ed_shift - jne @f - test word ed_flags,ed_shift_bac - je @f - 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 + test word ed_flags,ed_shift + jne @f + test word ed_flags,ed_shift_bac + je @f + 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 -@@: and word ed_flags,ed_shift_off - popad - ret 4 +@@: and word ed_flags,ed_shift_off + popad + ret 4 ;проверка состояния shift, был ли он нажат раньше? edit_box_key.sh_enable: - test word ed_flags,ed_shift - jne edit_box_key.sh_ext_en ;нарисовать закрашенный прямоугольник - test word ed_flags,ed_shift_bac - je @f - call edit_box.check_offset - mov ebp,ed_color - movzx ebx, word ed_shift_pos - call edit_box_key.sh_cl_ ;очистка выделенного фрагмента - call edit_box_key.draw_wigwag_cl - and word ed_flags,ed_shift_cl ; 1вар не нужно - ret + test word ed_flags,ed_shift + jne edit_box_key.sh_ext_en ;нарисовать закрашенный прямоугольник + test word ed_flags,ed_shift_bac + je @f + call edit_box.check_offset + mov ebp,ed_color + movzx ebx, word ed_shift_pos + call edit_box_key.sh_cl_ ;очистка выделенного фрагмента + call edit_box_key.draw_wigwag_cl + and word ed_flags,ed_shift_cl ; 1вар не нужно + ret -@@: mov ebp,ed_color - call edit_box.clear_cursor - jmp edit_box.check_offset +@@: mov ebp,ed_color + call edit_box.clear_cursor + jmp edit_box.check_offset edit_box_key.sh_ext_en: - call edit_box.check_offset - test word ed_flags,ed_offset_fl - je @f + call edit_box.check_offset + test word ed_flags,ed_offset_fl + je @f ;Рисование закрашенных прямоугольников и их очистка - movzx eax, word ed_shift_pos - mov ebx,ed_pos - movzx ecx, word ed_shift_pos_old + movzx eax, word ed_shift_pos + mov ebx,ed_pos + movzx ecx, word ed_shift_pos_old ;проверка и рисование закрашенных областей - cmp eax,ecx - je edit_box_key.1_shem - jb edit_box_key.smaller - cmp ecx,ebx - ja edit_box_key.1_shem - call edit_box_key.draw_wigwag_cl ;clear - jmp edit_box_key.sh_e_end + cmp eax,ecx + je edit_box_key.1_shem + jb edit_box_key.smaller + cmp ecx,ebx + ja edit_box_key.1_shem + call edit_box_key.draw_wigwag_cl ;clear + jmp edit_box_key.sh_e_end edit_box_key.smaller: - cmp ecx,ebx - jb edit_box_key.1_shem - call edit_box_key.draw_wigwag_cl ;clear - jmp edit_box_key.sh_e_end + cmp ecx,ebx + jb edit_box_key.1_shem + call edit_box_key.draw_wigwag_cl ;clear + jmp edit_box_key.sh_e_end edit_box_key.1_shem: - call edit_box_key.draw_wigwag + call edit_box_key.draw_wigwag edit_box_key.sh_e_end: - and word ed_flags,ed_shift_off - ret + and word ed_flags,ed_shift_off + ret -@@: mov ebp,shift_color - movzx ebx, word ed_shift_pos - call edit_box_key.sh_cl_ - jmp edit_box_key.sh_e_end +@@: mov ebp,shift_color + movzx ebx, word ed_shift_pos + call edit_box_key.sh_cl_ + jmp edit_box_key.sh_e_end ;функция для обработки shift при нажатии home and end edit_box_key.sh_home_end: - mov ebp,ed_color - call edit_box.clear_cursor - test word ed_flags,ed_shift_bac - je @f - mov ebp,ed_color - movzx ebx, word ed_shift_pos_old - call edit_box_key.sh_cl_ + mov ebp,ed_color + call edit_box.clear_cursor + test word ed_flags,ed_shift_bac + je @f + mov ebp,ed_color + movzx ebx, word ed_shift_pos_old + call edit_box_key.sh_cl_ @@: - test word ed_flags,ed_shift - je edit_box_key.sh_exit_ ;выйти - mov ebp,shift_color - movzx ebx, word ed_shift_pos - call edit_box_key.sh_cl_ - or word ed_flags,ed_shift_bac ;установка флага, выделенной области - jmp edit_box_key.sh_e_end + test word ed_flags,ed_shift + je edit_box_key.sh_exit_ ;выйти + mov ebp,shift_color + movzx ebx, word ed_shift_pos + call edit_box_key.sh_cl_ + or word ed_flags,ed_shift_bac ;установка флага, выделенной области + jmp edit_box_key.sh_e_end edit_box_key.sh_exit_: - call edit_box.draw_bg - jmp edit_box.check_offset + call edit_box.draw_bg + jmp edit_box.check_offset ;функция внесения 0 по адресу ed_size+1 edit_box_key.enable_null: - pusha - mov eax,ed_size - mov ebx,ed_text - test eax,eax - add eax,ebx - jne @f - inc eax -@@: xor ebx,ebx - mov [eax],bl - popad - ret + pusha + mov eax,ed_size + mov ebx,ed_text + test eax,eax + add eax,ebx + jne @f + inc eax +@@: xor ebx,ebx + mov [eax],bl + popad + ret ;- удаление символа ;Входные данные edx=ed_size;ecx=ed_pos edit_box_key.del_char: - mov esi,ed_text - test word ed_flags,ed_shift_on - je @f - movzx eax, word ed_shift_pos - mov ebx,esi - cmp eax,ecx - jae edit_box_key.dh_n - mov ed_pos,eax ;чтобы не было убегания курсора - mov ebp,ecx - sub ebp,eax - add ebx,eax ;eax меньше - sub edx,ecx - add esi,ecx - mov ed_shift_pos,bp - jmp edit_box_key.del_ch_sh + mov esi,ed_text + test word ed_flags,ed_shift_on + je @f + movzx eax, word ed_shift_pos + mov ebx,esi + cmp eax,ecx + jae edit_box_key.dh_n + mov ed_pos,eax ;чтобы не было убегания курсора + mov ebp,ecx + sub ebp,eax + add ebx,eax ;eax меньше + sub edx,ecx + add esi,ecx + mov ed_shift_pos,bp + jmp edit_box_key.del_ch_sh edit_box_key.dh_n: - mov ebp,eax - sub ebp,ecx - add ebx,ecx - sub edx,eax - add esi,eax - mov ed_shift_pos,bp - jmp edit_box_key.del_ch_sh + mov ebp,eax + sub ebp,ecx + add ebx,ecx + sub edx,eax + add esi,eax + mov ed_shift_pos,bp + jmp edit_box_key.del_ch_sh -@@: add esi,ecx ;указатель + смещение к реальному буферу - mov ebx,esi - inc esi - cld - sub edx,ecx +@@: add esi,ecx ;указатель + смещение к реальному буферу + mov ebx,esi + inc esi + cld + sub edx,ecx edit_box_key.del_ch_sh: - push edi - mov edi,ebx + push edi + mov edi,ebx @@: - lodsb - stosb - dec edx - jns @b - pop edi - ret + lodsb + stosb + dec edx + jns @b + pop edi + ret ;вычислить закрашиваемую область ;соглашение в ebp - передается ed_size edit_box_key.clear_bg: - call edit_box.get_n ;получить размер в символах ширины компонента - push eax - mov ebx,ed_offset - add eax,ebx ;eax = w_off= ed_offset+width - mov ebx,ebp ;ed_size - cmp eax,ebx - jb @f - mov eax,ed_pos - sub ebx,eax - mov ecx,ed_offset - sub eax,ecx - jmp edit_box_key.nxt + call edit_box.get_n ;получить размер в символах ширины компонента + push eax + mov ebx,ed_offset + add eax,ebx ;eax = w_off= ed_offset+width + mov ebx,ebp ;ed_size + cmp eax,ebx + jb @f + mov eax,ed_pos + sub ebx,eax + mov ecx,ed_offset + sub eax,ecx + jmp edit_box_key.nxt -@@: mov ebx,ed_pos - push ebx - sub eax,ebx - mov ebx,eax ;It is not optimal - pop eax ;ed_pos - mov ecx,ed_offset - sub eax,ecx +@@: mov ebx,ed_pos + push ebx + sub eax,ebx + mov ebx,eax ;It is not optimal + pop eax ;ed_pos + mov ecx,ed_offset + sub eax,ecx edit_box_key.nxt: - mov ebp,eax ;проверка на выход закрашиваемой области за пределы длины - add ebp,ebx - pop edx - cmp ebp,edx - je @f - inc ebx + mov ebp,eax ;проверка на выход закрашиваемой области за пределы длины + add ebp,ebx + pop edx + cmp ebp,edx + je @f + inc ebx @@: - mul dword ed_char_width - xchg eax,ebx - mul dword ed_char_width - add ebx,ed_left - inc ebx - shl ebx,16 - inc eax - mov bx, ax - mov edx,ed_color - jmp edit_box.draw_bg_eax + mul dword ed_char_width + xchg eax,ebx + mul dword ed_char_width + add ebx,ed_left + inc ebx + shl ebx,16 + inc eax + mov bx, ax + mov edx,ed_color + jmp edit_box.draw_bg_eax ;;;;;;;;;;;;;;;;;;; ;;; Обработка примитивов @@ -1298,122 +1255,99 @@ edit_box_key.nxt: ;eax=dword ed_pos ;ebp=-цвет ed_color or shift_color edit_box_key.draw_rectangle: - sub eax,ed_offset - mul dword ed_char_width - add eax,ed_left - inc eax - shl eax,16 - add eax,ed_char_width - mov ebx,eax - 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 + sub eax,ed_offset + mul dword ed_char_width + add eax,ed_left + inc eax + shl eax,16 + add eax,ed_char_width + mov ebx,eax + mov edx,ebp + jmp edit_box.draw_bg_eax ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Функции для работы с mouse ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; edit_box_mouse.mouse_wigwag: - push eax - call edit_box.draw_bg - call edit_box.draw_shift - pop eax - or word ed_flags,ed_shift_bac+ed_shift_on+ed_shift + push eax + 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 - test eax,eax - js edit_box_mouse.mleft - shr eax,16 - sub eax,ed_left - jc edit_box_mouse.mleft - cmp ed_width,eax - jc edit_box_mouse.mright - xor edx,edx - div word ed_char_width + test eax,eax + js edit_box_mouse.mleft + shr eax,16 + sub eax,ed_left + jc edit_box_mouse.mleft + cmp ed_width,eax + jc edit_box_mouse.mright + xor edx,edx + div word ed_char_width ;Обработка положения выделенного текста, в пределах области editbox ;Получили координаты в eax мышки, т.е. куда она переместилась ;Рисование закрашенных прямоугольников и их очистка - add eax,ed_offset - cmp eax,ed_size - ja edit_box_mouse.mwigvag + add eax,ed_offset + cmp eax,ed_size + ja edit_box_mouse.mwigvag edit_box_mouse.mdraw: - mov ed_pos,eax + mov ed_pos,eax ;Рисование закрашенных прямоугольников и их очистка - movzx ecx, word ed_shift_pos - movzx ebx, word ed_shift_pos_old - mov ed_shift_pos_old,ax + movzx ecx, word ed_shift_pos + movzx ebx, word ed_shift_pos_old + mov ed_shift_pos_old,ax ;проверка и рисование закрашенных областей - cmp ecx,ebx - je edit_box_mouse.m1_shem ;движения не было ранее - jb edit_box_mouse.msmaller ;было движение -> - cmp ebx,eax - ja edit_box_mouse.m1_shem ;было движение <- - je edit_box_mouse.mwigvag - mov ebp,ed_color - call edit_box_key.sh_cl_ ;очистить область c ed_pos ed_shift_pos_old - jmp edit_box_mouse.mwigvag + cmp ecx,ebx + je edit_box_mouse.m1_shem ;движения не было ранее + jb edit_box_mouse.msmaller ;было движение -> + cmp ebx,eax + ja edit_box_mouse.m1_shem ;было движение <- + je edit_box_mouse.mwigvag + mov ebp,ed_color + call edit_box_key.sh_cl_ ;очистить область c ed_pos ed_shift_pos_old + jmp edit_box_mouse.mwigvag edit_box_mouse.msmaller: - cmp ebx,eax - jb edit_box_mouse.m1_shem - mov ebp,ed_color - call edit_box_key.sh_cl_ - jmp edit_box_mouse.mwigvag + cmp ebx,eax + jb edit_box_mouse.m1_shem + mov ebp,ed_color + call edit_box_key.sh_cl_ + jmp edit_box_mouse.mwigvag edit_box_mouse.m1_shem: - mov ebp,shift_color - mov ebx,ecx - call edit_box_key.sh_cl_ + mov ebp,shift_color + mov ebx,ecx + call edit_box_key.sh_cl_ edit_box_mouse.mwigvag: - and word ed_flags,ed_shift_mcl - jmp edit_box.draw_cursor_text + and word ed_flags,ed_shift_mcl + jmp edit_box.draw_cursor_text edit_box_mouse.mleft: - mov eax,ed_pos - cmp eax,0 - jbe edit_box_mouse.mwigvag - dec eax - call edit_box.check_offset - push eax - movzx ebx, word ed_shift_pos - mov ebp,shift_color - call edit_box_key.sh_cl_ - pop eax - jmp edit_box_mouse.mdraw + mov eax,ed_pos + cmp eax,0 + jbe edit_box_mouse.mwigvag + dec eax + call edit_box.check_offset + push eax + movzx ebx, word ed_shift_pos + mov ebp,shift_color + call edit_box_key.sh_cl_ + pop eax + jmp edit_box_mouse.mdraw edit_box_mouse.mright: - mov eax,ed_pos - mov ebx,ed_size - cmp eax,ebx - jae edit_box_mouse.mwigvag - inc eax - call edit_box.check_offset - movzx ebx, word ed_shift_pos - mov ebp,shift_color - push eax - call edit_box_key.sh_cl_ - pop eax - jmp edit_box_mouse.mdraw + mov eax,ed_pos + mov ebx,ed_size + cmp eax,ebx + jae edit_box_mouse.mwigvag + inc eax + call edit_box.check_offset + movzx ebx, word ed_shift_pos + mov ebp,shift_color + push eax + call edit_box_key.sh_cl_ + pop eax + jmp edit_box_mouse.mdraw ed_struc_size=84 diff --git a/programs/develop/libraries/box_lib/trunk/keys.inc b/programs/develop/libraries/box_lib/trunk/keys.inc new file mode 100644 index 0000000000..bd89e58b28 --- /dev/null +++ b/programs/develop/libraries/box_lib/trunk/keys.inc @@ -0,0 +1,181 @@ +; Key scan codes + +SCAN_CODE_ESCAPE = $01 +SCAN_CODE_1 = $02 +SCAN_CODE_2 = $03 +SCAN_CODE_3 = $04 +SCAN_CODE_4 = $05 +SCAN_CODE_5 = $06 +SCAN_CODE_6 = $07 +SCAN_CODE_7 = $08 +SCAN_CODE_8 = $09 +SCAN_CODE_9 = $0A +SCAN_CODE_0 = $0B +SCAN_CODE_MINUS = $0C +SCAN_CODE_PLUS = $0D +SCAN_CODE_BACK = $0E + +SCAN_CODE_TAB = $0F +SCAN_CODE_Q = $10 +SCAN_CODE_W = $11 +SCAN_CODE_E = $12 +SCAN_CODE_R = $13 +SCAN_CODE_T = $14 +SCAN_CODE_Y = $15 +SCAN_CODE_U = $16 +SCAN_CODE_I = $17 +SCAN_CODE_O = $18 +SCAN_CODE_P = $19 + +SCAN_CODE_RETURN = $1C + +SCAN_CODE_A = $1E +SCAN_CODE_S = $1F +SCAN_CODE_D = $20 +SCAN_CODE_F = $21 +SCAN_CODE_G = $22 +SCAN_CODE_H = $23 +SCAN_CODE_J = $24 +SCAN_CODE_K = $25 +SCAN_CODE_L = $26 + +SCAN_CODE_Z = $2C +SCAN_CODE_X = $2D +SCAN_CODE_C = $2E +SCAN_CODE_V = $2F +SCAN_CODE_B = $30 +SCAN_CODE_N = $31 +SCAN_CODE_M = $32 + +SCAN_CODE_DIVIDE = $35 ; Numpad divide (has ASCII $2F) + +SCAN_CODE_MULTIPLY = $37 ; Numpad multiply (has ASCII $2A) +SCAN_CODE_SNAPSHOT = $37 ; Print Screen (has ASCII $34) + +SCAN_CODE_SPACE = $39 +SCAN_CODE_CAPITAL_PRESSED = $3A ; Caps Lock +SCAN_CODE_F1 = $3B +SCAN_CODE_F2 = $3C +SCAN_CODE_F3 = $3D +SCAN_CODE_F4 = $3E +SCAN_CODE_F5 = $3F +SCAN_CODE_F6 = $40 +SCAN_CODE_F7 = $41 +SCAN_CODE_F8 = $42 +SCAN_CODE_F9 = $43 +SCAN_CODE_F10 = $44 +SCAN_CODE_NUMLOCK_PRESSED = $45 +SCAN_CODE_SCROLL_PRESSED = $46 ; Scroll Lock +SCAN_CODE_CANCEL_PRESSED = $46 ; Ctrl+Break ; share with scroll lock ASCII & scan code, but require 2 buttons Ctrl & Pause Break to be pressed same time, while scroll lock only 1 button +SCAN_CODE_NUMPAD_7 = $47 +SCAN_CODE_HOME = $47 +SCAN_CODE_NUMPAD_8 = $48 +SCAN_CODE_UP = $48 +SCAN_CODE_NUMPAD_9 = $49 +SCAN_CODE_PGUP = $49 +SCAN_CODE_SUBTRACT = $4A ; Numpad substract (has ASCII $4A) +SCAN_CODE_NUMPAD_4 = $4B +SCAN_CODE_LEFT = $4B +SCAN_CODE_NUMPAD_5 = $4C +SCAN_CODE_CLEAR = $4C ; Numpad unlocked 5(has ASCII $37) +SCAN_CODE_NUMPAD_6 = $4D +SCAN_CODE_RIGHT = $4D +SCAN_CODE_ADD = $4E ; Numpad add (has ASCII $2B) +SCAN_CODE_NUMPAD_1 = $4F +SCAN_CODE_END = $4F +SCAN_CODE_NUMPAD_2 = $50 +SCAN_CODE_DOWN = $50 +SCAN_CODE_NUMPAD_3 = $51 +SCAN_CODE_PGDN = $51 +SCAN_CODE_NUMPAD_0 = $52 +SCAN_CODE_INSERT = $52 +SCAN_CODE_DECIMAL = $53 ; Numpad loced decimal separator +SCAN_CODE_DELETE = $53 + +SCAN_CODE_LWIN_PRESSED = $5B +SCAN_CODE_RWIN_PRESSED = $5C +SCAN_CODE_CONTEXT = $5D ; right mouse button analog + +SCAN_CODE_CAPITAL_RELEASED = $BA ; Caps Lock + +SCAN_CODE_NUMLOCK_RELEASED = $C5 +SCAN_CODE_SCROLL_RELEASED = $C6 ; Scroll Lock +SCAN_CODE_CANCEL_RELEASED = $C6 ; Ctrl+Break + +SCAN_CODE_LWIN_RELEASED = $DB +SCAN_CODE_RWIN_RELEASED = $DC + +; ASCII key codes +_ASCII equ $FF and +_CTRL equ $A0 + + +ASCII_KEY_CANCEL = $01 ; ; Ctrl+Break ; share with scroll lock ASCII & scan code, but require 2 buttons Ctrl & Pause Break to be pressed same time, while scroll lock only 1 button +ASCII_KEY_SCROLL = $01 ; ; Scroll Lock +ASCII_KEY_NUMLOCK = $02 +ASCII_KEY_CAPITAL = $04 ; Caps Lock +ASCII_KEY_BACK = $08 +ASCII_KEY_CTRL_BACK = _ASCII(_CTRL(ASCII_KEY_BACK)) +ASCII_KEY_TAB = $09 +ASCII_KEY_CTRL_TAB = _ASCII(_CTRL(ASCII_KEY_TAB)) +ASCII_KEY_RETURN = $0D +ASCII_KEY_CTRL_RETURN = _ASCII(_CTRL(ASCII_KEY_RETURN)) +ASCII_KEY_ESCAPE = $1B +ASCII_KEY_CTRL_ESCAPE = _ASCII(_CTRL(ASCII_KEY_ESCAPE)) +ASCII_KEY_SPACE = $20 +ASCII_KEY_CTRL_SPACE = _ASCII(_CTRL(ASCII_KEY_SPACE)) + +ASCII_KEY_CTRL_0 = _ASCII(_CTRL('0')) +ASCII_KEY_CTRL_1 = _ASCII(_CTRL('1')) +ASCII_KEY_CTRL_2 = _ASCII(_CTRL('2')) +ASCII_KEY_CTRL_3 = _ASCII(_CTRL('3')) +ASCII_KEY_CTRL_4 = _ASCII(_CTRL('4')) +ASCII_KEY_CTRL_5 = _ASCII(_CTRL('5')) +ASCII_KEY_CTRL_6 = _ASCII(_CTRL('6')) +ASCII_KEY_CTRL_7 = _ASCII(_CTRL('7')) +ASCII_KEY_CTRL_8 = _ASCII(_CTRL('8')) +ASCII_KEY_CTRL_9 = _ASCII(_CTRL('9')) + +ASCII_KEY_NUMPAD_0 = '0' ; numpad locked 0 +ASCII_KEY_CTRL_NUMPAD_0 = '0' ; numpad locked 0 +ASCII_KEY_NUMPAD_1 = '1' ; numpad locked 0 +ASCII_KEY_CTRL_NUMPAD_1 = '1' ; numpad locked 0 +ASCII_KEY_NUMPAD_2 = '2' ; numpad locked 0 +ASCII_KEY_CTRL_NUMPAD_2 = '2' ; numpad locked 0 +ASCII_KEY_NUMPAD_3 = '3' ; numpad locked 0 +ASCII_KEY_CTRL_NUMPAD_3 = '3' ; numpad locked 0 +ASCII_KEY_NUMPAD_4 = '4' ; numpad locked 0 +ASCII_KEY_CTRL_NUMPAD_4 = '4' ; numpad locked 0 +ASCII_KEY_NUMPAD_5 = '5' ; numpad locked 0 +ASCII_KEY_CTRL_NUMPAD_5 = '5' ; numpad locked 0 +ASCII_KEY_NUMPAD_6 = '6' ; numpad locked 0 +ASCII_KEY_CTRL_NUMPAD_6 = '6' ; numpad locked 0 +ASCII_KEY_NUMPAD_7 = '7' ; numpad locked 0 +ASCII_KEY_CTRL_NUMPAD_7 = '7' ; numpad locked 0 +ASCII_KEY_NUMPAD_8 = '8' ; numpad locked 0 +ASCII_KEY_CTRL_NUMPAD_8 = '8' ; numpad locked 0 +ASCII_KEY_NUMPAD_9 = '9' ; numpad locked 0 +ASCII_KEY_CTRL_NUMPAD_9 = '9' ; numpad locked 0 + +ASCII_KEY_CLEAR = $37 ; Numpad unlocked 5 +ASCII_KEY_CTRL_CLEAR = _ASCII(_CTRL(ASCII_KEY_CLEAR)) + +ASCII_KEY_LEFT = $B0 +ASCII_KEY_CTRL_LEFT = _ASCII(_CTRL(ASCII_KEY_LEFT)) +ASCII_KEY_DOWN = $B1 +ASCII_KEY_CTRL_DOWN = _ASCII(_CTRL(ASCII_KEY_DOWN)) +ASCII_KEY_UP = $B2 +ASCII_KEY_CTRL_UP = _ASCII(_CTRL(ASCII_KEY_UP)) +ASCII_KEY_RIGHT = $B3 +ASCII_KEY_CTRL_RIGHT = _ASCII(_CTRL(ASCII_KEY_RIGHT)) +ASCII_KEY_HOME = $B4 +ASCII_KEY_CTRL_HOME = _ASCII(_CTRL(ASCII_KEY_HOME)) +ASCII_KEY_END = $B5 +ASCII_KEY_CTRL_END = _ASCII(_CTRL(ASCII_KEY_END)) +ASCII_KEY_DELETE = $B6 +ASCII_KEY_CTRL_DELETE = _ASCII(_CTRL(ASCII_KEY_DELETE)) +ASCII_KEY_PGDN = $B7 +ASCII_KEY_CTRL_PGDN = _ASCII(_CTRL(ASCII_KEY_PGDN)) +ASCII_KEY_PGUP = $B8 +ASCII_KEY_CTRL_PGUP = _ASCII(_CTRL(ASCII_KEY_PGUP)) +ASCII_KEY_INSERT = $B9 +ASCII_KEY_CTRL_INSERT = _ASCII(_CTRL(ASCII_KEY_INSERT)) \ No newline at end of file