Tinypad: numpad support

git-svn-id: svn://kolibrios.org@826 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Mihail Semenyako (mike.dld) 2008-07-17 21:41:30 +00:00
parent a59b895ca6
commit 4def1db832
6 changed files with 110 additions and 38 deletions

View File

@ -14,6 +14,48 @@ key0 db \
align 4 align 4
numpad_table_off dd \
0x00000135,0x06000035, \ ; /
0x00000037,0x07010009, \ ; *
0x0000004A,0x0600000C, \ ; -
0x00000047,0x07000147, \ ; KP Home
0x00000048,0x07000148, \ ; KP Up
0x00000049,0x07000149, \ ; KP PageUp
0x0000004B,0x0700014B, \ ; KP Left
0x0000004C,0x0700014C, \ ; KP Begin
0x0000004D,0x0700014D, \ ; KP Right
0x0000004E,0x0701000D, \ ; +
0x0000004F,0x0700014F, \ ; KP End
0x00000050,0x07000150, \ ; KP Down
0x00000051,0x07000151, \ ; KP PageDown
0x00000052,0x07000152, \ ; KP Insert
0x00000053,0x07000153, \ ; KP Delete
0x0000011C,0x0700001C, \ ; KP Enter
0
align 4
numpad_table_on dd \
0x00000135,0x06000035, \ ; /
0x00000037,0x07010009, \ ; *
0x0000004A,0x0600000C, \ ; -
0x00000047,0x06000008, \ ; 7
0x00000048,0x06000009, \ ; 8
0x00000049,0x0600000A, \ ; 9
0x0000004B,0x06000005, \ ; 4
0x0000004C,0x06000006, \ ; 5
0x0000004D,0x06000007, \ ; 6
0x0000004E,0x0701000D, \ ; +
0x0000004F,0x06000002, \ ; 1
0x00000050,0x06000003, \ ; 2
0x00000051,0x06000004, \ ; 3
0x00000052,0x0600000B, \ ; 0
0x00000053,0x06000034, \ ; .
0x0000011C,0x0700001C, \ ; Enter
0
align 4
accel_table_main dd \ accel_table_main dd \
0x0000000E,key.bkspace ,\ ; BackSpace 0x0000000E,key.bkspace ,\ ; BackSpace
0x0000000F,key.tab ,\ ; Tab 0x0000000F,key.tab ,\ ; Tab

View File

@ -67,8 +67,8 @@ s_search rb PATHL+1
s_title rb PATHL+11 ; window caption s_title rb PATHL+11 ; window caption
chr db ?
ext db ? ext db ?
chr dd ?
shi dd ? shi dd ?
align 4 align 4

View File

@ -1,15 +1,18 @@
HISTORY: HISTORY:
4.0.5 (Rus, mike.dld) 4.0.5 (Rus, mike.dld)
bug-fixes: bug-fixes:
- new tab is created when opening a file from Tinypad's home folder - new tab is created when opening a file from Tinypad's home folder
(was opening in current tab if there was a new file, even modified) (was opening in current tab if there was a new file, even modified)
- show "save file" dialog for new files or files from Tinypad's home folder - show "save file" dialog for new files or files from Tinypad's home folder
new features: - line is redrawn after lining up a single char and then deleting it
- prompt to save modified file before closing (+fixes) (pressing Del twice) [#1]
- button to close current tab (+fixes) new features:
- mouse scroll wheel support - prompt to save modified file before closing (+fixes)
- button to close current tab (+fixes)
- mouse scroll wheel support
- numpad support
4.0.4 (mike.dld) 4.0.4 (mike.dld)
bug-fixes: bug-fixes:

View File

@ -507,9 +507,9 @@ TPOSW = 10
;cmp ebx,0x00000153 ;cmp ebx,0x00000153
;jbe .key.tb.2 ;jbe .key.tb.2
test dword[shi],KM_CTRLALT test [chr],KM_CTRLALT
jnz .key.exit jnz .key.exit
movzx eax,[chr] movzx eax,byte[chr]
movzx eax,[eax+key0] movzx eax,[eax+key0]
or al,al or al,al
jz .key.exit jz .key.exit

View File

@ -3,6 +3,7 @@ diff16 'tp-key.asm',0,$
key: key:
mov ecx,1 mov ecx,1
mcall 66,3 mcall 66,3
mov [shi],eax
xor ebx,ebx xor ebx,ebx
test al,0x03 test al,0x03
jz @f jz @f
@ -13,12 +14,11 @@ key:
@@: test al,0x30 @@: test al,0x30
jz @f jz @f
or ebx,KM_ALT or ebx,KM_ALT
@@: mov [shi],ebx @@: mov edx,ebx
test al,0x03 test al,0x03
jz @f jz @f
inc cl inc cl
@@: mcall 26,2,,key1 @@:
mcall 2 mcall 2
cmp al,0 cmp al,0
jne still.skip_write jne still.skip_write
@ -34,11 +34,38 @@ key:
@@: @@:
mov ah,[ext] mov ah,[ext]
mov [ext],0 mov [ext],0
or eax,[shi]
test al,0x80 mov esi,numpad_table_off
test [shi], 0x00000080 ; NumLock is on?
jz .num
mov esi,numpad_table_on
.num: cmp eax,[esi]
jne @f
mov eax,[esi+4]
mov ebx,eax
or eax,edx
shr ebx,8
or ebx,0x0000FFFF
and eax,ebx
mov ecx,eax
shr ecx,16
and cl,1
inc cl
jmp .lp0
@@: add esi,8
cmp dword[esi],0
jne .num
or eax,edx
.lp0: test al,0x80
jnz still.skip_write jnz still.skip_write
mov [chr],al
push eax
mcall 26,2,,key1
pop eax
mov [chr],eax
cmp [bot_mode],0 cmp [bot_mode],0
je @f je @f
@ -60,15 +87,15 @@ key:
call editor_check_for_changes call editor_check_for_changes
jmp still jmp still
@@: add esi,8 @@: add esi,8
cmp byte[esi],0 cmp dword[esi],0
jne .acc jne .acc
test dword[shi],KM_CTRLALT test [chr],KM_CTRLALT
jnz still.skip_write jnz still.skip_write
mov [s_status],0 mov [s_status],0
movzx eax,[chr] movzx eax,byte[chr]
movzx eax,[eax+key0] movzx eax,[eax+key0]
or al,al or al,al
jz still.skip_write jz still.skip_write
@ -303,7 +330,7 @@ proc key.ctrl_left ;///// GO TO PREVIOUS WORD ////////////////////////////////
inc edx inc edx
mov [cur_editor.Caret.Y],ebx mov [cur_editor.Caret.Y],ebx
mov [cur_editor.Caret.X],edx mov [cur_editor.Caret.X],edx
test byte[shi+2],0x01 test [chr],KM_SHIFT
jnz @f jnz @f
mov [cur_editor.SelStart.Y],ebx mov [cur_editor.SelStart.Y],ebx
mov [cur_editor.SelStart.X],edx mov [cur_editor.SelStart.X],edx
@ -389,7 +416,7 @@ proc key.ctrl_right ;///// GO TO NEXT WORD ///////////////////////////////////
@@: @@:
mov [cur_editor.Caret.Y],ebx mov [cur_editor.Caret.Y],ebx
mov [cur_editor.Caret.X],edx mov [cur_editor.Caret.X],edx
test byte[shi+2],0x01 test [chr],KM_SHIFT
jnz @f jnz @f
mov [cur_editor.SelStart.Y],ebx mov [cur_editor.SelStart.Y],ebx
mov [cur_editor.SelStart.X],edx mov [cur_editor.SelStart.X],edx
@ -731,7 +758,7 @@ proc key.up ;///// GO TO PREVIOUS LINE ///////////////////////////////////////
dec ecx dec ecx
jns @f jns @f
xor ecx,ecx xor ecx,ecx
@@: test byte[shi+2],0x01 @@: test [chr],KM_SHIFT
jnz @f jnz @f
mov [cur_editor.SelStart.Y],eax mov [cur_editor.SelStart.Y],eax
@@: mov [cur_editor.Caret.Y],eax @@: mov [cur_editor.Caret.Y],eax
@ -761,7 +788,7 @@ proc key.down ;///// GO TO NEXT LINE /////////////////////////////////////////
cmp edx,[lines.scr] cmp edx,[lines.scr]
jb @f jb @f
inc ecx inc ecx
@@: test byte[shi+2],0x01 @@: test [chr],KM_SHIFT
jnz @f jnz @f
mov [cur_editor.SelStart.Y],eax mov [cur_editor.SelStart.Y],eax
@@: mov [cur_editor.Caret.Y],eax @@: mov [cur_editor.Caret.Y],eax
@ -783,7 +810,7 @@ proc key.left ;///// GO TO PREVIOUS CHAR /////////////////////////////////////
dec eax dec eax
jns @f jns @f
inc eax inc eax
@@: test byte[shi+2],0x01 @@: test [chr],KM_SHIFT
jnz @f jnz @f
mov [cur_editor.SelStart.X],eax mov [cur_editor.SelStart.X],eax
@@: mov [cur_editor.Caret.X],eax @@: mov [cur_editor.Caret.X],eax
@ -805,7 +832,7 @@ proc key.right ;///// GO TO NEXT CHAR ////////////////////////////////////////
cmp eax,[cur_editor.Columns.Count] cmp eax,[cur_editor.Columns.Count]
jbe @f jbe @f
dec eax dec eax
@@: test byte[shi+2],0x01 @@: test [chr],KM_SHIFT
jnz @f jnz @f
mov [cur_editor.SelStart.X],eax mov [cur_editor.SelStart.X],eax
@@: mov [cur_editor.Caret.X],eax @@: mov [cur_editor.Caret.X],eax
@ -832,7 +859,7 @@ proc key.pgup ;///// GO TO PREVIOUS PAGE /////////////////////////////////////
@@: sub ecx,edx @@: sub ecx,edx
jns @f jns @f
xor ecx,ecx xor ecx,ecx
@@: test byte[shi+2],0x01 @@: test [chr],KM_SHIFT
jnz @f jnz @f
mov [cur_editor.SelStart.Y],eax mov [cur_editor.SelStart.Y],eax
@@: mov [cur_editor.Caret.Y],eax @@: mov [cur_editor.Caret.Y],eax
@ -860,7 +887,7 @@ proc key.pgdn ;///// GO TO NEXT PAGE /////////////////////////////////////////
jb @f jb @f
mov eax,[cur_editor.Lines.Count] mov eax,[cur_editor.Lines.Count]
dec eax dec eax
@@: test byte[shi+2],0x01 @@: test [chr],KM_SHIFT
jnz @f jnz @f
mov [cur_editor.SelStart.Y],eax mov [cur_editor.SelStart.Y],eax
@@: mov [cur_editor.Caret.Y],eax @@: mov [cur_editor.Caret.Y],eax
@ -879,7 +906,7 @@ proc key.home ;///// GO TO LINE START ////////////////////////////////////////
key.shift_home: ;///// GO TO LINE START, WITH SELECTION ///////////////// key.shift_home: ;///// GO TO LINE START, WITH SELECTION /////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
mov [cur_editor.Caret.X],0 mov [cur_editor.Caret.X],0
test byte[shi+2],0x01 test [chr],KM_SHIFT
jnz @f jnz @f
mov [cur_editor.SelStart.X],0 mov [cur_editor.SelStart.X],0
@@: @@:
@ -900,7 +927,7 @@ proc key.end ;///// GO TO LINE END ///////////////////////////////////////////
call get_line_offset call get_line_offset
call get_real_length call get_real_length
mov [cur_editor.Caret.X],eax mov [cur_editor.Caret.X],eax
test byte[shi+2],0x01 test [chr],KM_SHIFT
jnz @f jnz @f
mov [cur_editor.SelStart.X],eax mov [cur_editor.SelStart.X],eax
@@: @@:
@ -919,7 +946,7 @@ proc key.ctrl_home ;///// GO TO PAGE START ///////////////////////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
mov eax,[cur_editor.TopLeft.Y] mov eax,[cur_editor.TopLeft.Y]
mov ecx,eax mov ecx,eax
test byte[shi+2],0x01 test [chr],KM_SHIFT
jnz @f jnz @f
mov [cur_editor.SelStart.Y],eax mov [cur_editor.SelStart.Y],eax
@@: mov [cur_editor.Caret.Y],eax @@: mov [cur_editor.Caret.Y],eax
@ -944,7 +971,7 @@ proc key.ctrl_end ;///// GO TO PAGE END //////////////////////////////////////
mov eax,[cur_editor.Lines.Count] mov eax,[cur_editor.Lines.Count]
@@: add eax,ecx @@: add eax,ecx
dec eax dec eax
test byte[shi+2],0x01 test [chr],KM_SHIFT
jnz @f jnz @f
mov [cur_editor.SelStart.Y],eax mov [cur_editor.SelStart.Y],eax
@@: mov [cur_editor.Caret.Y],eax @@: mov [cur_editor.Caret.Y],eax
@ -965,7 +992,7 @@ proc key.ctrl_pgup ;///// GO TO DOCUMENT START ///////////////////////////////
xor eax,eax xor eax,eax
mov [cur_editor.TopLeft.Y],eax mov [cur_editor.TopLeft.Y],eax
mov [cur_editor.Caret.Y],eax mov [cur_editor.Caret.Y],eax
test byte[shi+2],0x01 test [chr],KM_SHIFT
jnz @f jnz @f
mov [cur_editor.SelStart.Y],eax mov [cur_editor.SelStart.Y],eax
@@: @@:
@ -989,7 +1016,7 @@ proc key.ctrl_pgdn ;///// GO TO DOCUMENT END /////////////////////////////////
xor eax,eax xor eax,eax
@@: mov [cur_editor.TopLeft.Y],eax @@: mov [cur_editor.TopLeft.Y],eax
dec [cur_editor.Caret.Y] dec [cur_editor.Caret.Y]
test byte[shi+2],0x01 test [chr],KM_SHIFT
jnz @f jnz @f
m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y]
@@: @@:

View File

@ -211,12 +211,12 @@ proc textbox.key
cmp byte[esi],0 cmp byte[esi],0
jne .acc jne .acc
test byte[shi+2],0x06 test [chr],KM_CTRLALT
jnz .exit jnz .exit
cmp [tbox.length],255 cmp [tbox.length],255
je .exit je .exit
movzx eax,[chr] movzx eax,byte[chr]
movzx eax,[eax+key0] movzx eax,[eax+key0]
or al,al or al,al
jz .exit jz .exit