From 4def1db832f6cc2666ebf88f273c323dc09d5bf6 Mon Sep 17 00:00:00 2001 From: "Mihail Semenyako (mike.dld)" Date: Thu, 17 Jul 2008 21:41:30 +0000 Subject: [PATCH] Tinypad: numpad support git-svn-id: svn://kolibrios.org@826 a494cfbc-eb01-0410-851d-a64ba20cac60 --- .../develop/tinypad/trunk/data/tp-tables.inc | 42 +++++++++++ .../develop/tinypad/trunk/data/tp-udata.inc | 2 +- programs/develop/tinypad/trunk/history.txt | 23 +++--- programs/develop/tinypad/trunk/tp-dialog.asm | 4 +- programs/develop/tinypad/trunk/tp-key.asm | 73 +++++++++++++------ programs/develop/tinypad/trunk/tp-tbox.asm | 4 +- 6 files changed, 110 insertions(+), 38 deletions(-) diff --git a/programs/develop/tinypad/trunk/data/tp-tables.inc b/programs/develop/tinypad/trunk/data/tp-tables.inc index 4cbbaa05fd..0d485643d2 100644 --- a/programs/develop/tinypad/trunk/data/tp-tables.inc +++ b/programs/develop/tinypad/trunk/data/tp-tables.inc @@ -14,6 +14,48 @@ key0 db \ 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 \ 0x0000000E,key.bkspace ,\ ; BackSpace 0x0000000F,key.tab ,\ ; Tab diff --git a/programs/develop/tinypad/trunk/data/tp-udata.inc b/programs/develop/tinypad/trunk/data/tp-udata.inc index 79de2eb5d9..94ddaafda2 100644 --- a/programs/develop/tinypad/trunk/data/tp-udata.inc +++ b/programs/develop/tinypad/trunk/data/tp-udata.inc @@ -67,8 +67,8 @@ s_search rb PATHL+1 s_title rb PATHL+11 ; window caption -chr db ? ext db ? +chr dd ? shi dd ? align 4 diff --git a/programs/develop/tinypad/trunk/history.txt b/programs/develop/tinypad/trunk/history.txt index c3c4cf9f87..75748bc172 100644 --- a/programs/develop/tinypad/trunk/history.txt +++ b/programs/develop/tinypad/trunk/history.txt @@ -1,15 +1,18 @@ HISTORY: - -4.0.5 (Rus, mike.dld) - bug-fixes: - - 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) - - show "save file" dialog for new files or files from Tinypad's home folder - new features: - - prompt to save modified file before closing (+fixes) - - button to close current tab (+fixes) - - mouse scroll wheel support + +4.0.5 (Rus, mike.dld) + bug-fixes: + - 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) + - show "save file" dialog for new files or files from Tinypad's home folder + - line is redrawn after lining up a single char and then deleting it + (pressing Del twice) [#1] + new features: + - 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) bug-fixes: diff --git a/programs/develop/tinypad/trunk/tp-dialog.asm b/programs/develop/tinypad/trunk/tp-dialog.asm index b5c3ec6f3c..847d99b48b 100644 --- a/programs/develop/tinypad/trunk/tp-dialog.asm +++ b/programs/develop/tinypad/trunk/tp-dialog.asm @@ -507,9 +507,9 @@ TPOSW = 10 ;cmp ebx,0x00000153 ;jbe .key.tb.2 - test dword[shi],KM_CTRLALT + test [chr],KM_CTRLALT jnz .key.exit - movzx eax,[chr] + movzx eax,byte[chr] movzx eax,[eax+key0] or al,al jz .key.exit diff --git a/programs/develop/tinypad/trunk/tp-key.asm b/programs/develop/tinypad/trunk/tp-key.asm index 3e7e1070a4..a1f893e14d 100644 --- a/programs/develop/tinypad/trunk/tp-key.asm +++ b/programs/develop/tinypad/trunk/tp-key.asm @@ -3,6 +3,7 @@ diff16 'tp-key.asm',0,$ key: mov ecx,1 mcall 66,3 + mov [shi],eax xor ebx,ebx test al,0x03 jz @f @@ -13,12 +14,11 @@ key: @@: test al,0x30 jz @f or ebx,KM_ALT - @@: mov [shi],ebx + @@: mov edx,ebx test al,0x03 jz @f inc cl - @@: mcall 26,2,,key1 - + @@: mcall 2 cmp al,0 jne still.skip_write @@ -34,11 +34,38 @@ key: @@: mov ah,[ext] 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 - mov [chr],al + + push eax + mcall 26,2,,key1 + pop eax + + mov [chr],eax cmp [bot_mode],0 je @f @@ -60,15 +87,15 @@ key: call editor_check_for_changes jmp still @@: add esi,8 - cmp byte[esi],0 + cmp dword[esi],0 jne .acc - test dword[shi],KM_CTRLALT + test [chr],KM_CTRLALT jnz still.skip_write mov [s_status],0 - movzx eax,[chr] + movzx eax,byte[chr] movzx eax,[eax+key0] or al,al jz still.skip_write @@ -303,7 +330,7 @@ proc key.ctrl_left ;///// GO TO PREVIOUS WORD //////////////////////////////// inc edx mov [cur_editor.Caret.Y],ebx mov [cur_editor.Caret.X],edx - test byte[shi+2],0x01 + test [chr],KM_SHIFT jnz @f mov [cur_editor.SelStart.Y],ebx 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.X],edx - test byte[shi+2],0x01 + test [chr],KM_SHIFT jnz @f mov [cur_editor.SelStart.Y],ebx mov [cur_editor.SelStart.X],edx @@ -731,7 +758,7 @@ proc key.up ;///// GO TO PREVIOUS LINE /////////////////////////////////////// dec ecx jns @f xor ecx,ecx - @@: test byte[shi+2],0x01 + @@: test [chr],KM_SHIFT jnz @f mov [cur_editor.SelStart.Y],eax @@: mov [cur_editor.Caret.Y],eax @@ -761,7 +788,7 @@ proc key.down ;///// GO TO NEXT LINE ///////////////////////////////////////// cmp edx,[lines.scr] jb @f inc ecx - @@: test byte[shi+2],0x01 + @@: test [chr],KM_SHIFT jnz @f mov [cur_editor.SelStart.Y],eax @@: mov [cur_editor.Caret.Y],eax @@ -783,7 +810,7 @@ proc key.left ;///// GO TO PREVIOUS CHAR ///////////////////////////////////// dec eax jns @f inc eax - @@: test byte[shi+2],0x01 + @@: test [chr],KM_SHIFT jnz @f mov [cur_editor.SelStart.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] jbe @f dec eax - @@: test byte[shi+2],0x01 + @@: test [chr],KM_SHIFT jnz @f mov [cur_editor.SelStart.X],eax @@: mov [cur_editor.Caret.X],eax @@ -832,7 +859,7 @@ proc key.pgup ;///// GO TO PREVIOUS PAGE ///////////////////////////////////// @@: sub ecx,edx jns @f xor ecx,ecx - @@: test byte[shi+2],0x01 + @@: test [chr],KM_SHIFT jnz @f mov [cur_editor.SelStart.Y],eax @@: mov [cur_editor.Caret.Y],eax @@ -860,7 +887,7 @@ proc key.pgdn ;///// GO TO NEXT PAGE ///////////////////////////////////////// jb @f mov eax,[cur_editor.Lines.Count] dec eax - @@: test byte[shi+2],0x01 + @@: test [chr],KM_SHIFT jnz @f mov [cur_editor.SelStart.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 ///////////////// ;----------------------------------------------------------------------------- mov [cur_editor.Caret.X],0 - test byte[shi+2],0x01 + test [chr],KM_SHIFT jnz @f mov [cur_editor.SelStart.X],0 @@: @@ -900,7 +927,7 @@ proc key.end ;///// GO TO LINE END /////////////////////////////////////////// call get_line_offset call get_real_length mov [cur_editor.Caret.X],eax - test byte[shi+2],0x01 + test [chr],KM_SHIFT jnz @f 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 ecx,eax - test byte[shi+2],0x01 + test [chr],KM_SHIFT jnz @f mov [cur_editor.SelStart.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] @@: add eax,ecx dec eax - test byte[shi+2],0x01 + test [chr],KM_SHIFT jnz @f mov [cur_editor.SelStart.Y],eax @@: mov [cur_editor.Caret.Y],eax @@ -965,7 +992,7 @@ proc key.ctrl_pgup ;///// GO TO DOCUMENT START /////////////////////////////// xor eax,eax mov [cur_editor.TopLeft.Y],eax mov [cur_editor.Caret.Y],eax - test byte[shi+2],0x01 + test [chr],KM_SHIFT jnz @f mov [cur_editor.SelStart.Y],eax @@: @@ -989,7 +1016,7 @@ proc key.ctrl_pgdn ;///// GO TO DOCUMENT END ///////////////////////////////// xor eax,eax @@: mov [cur_editor.TopLeft.Y],eax dec [cur_editor.Caret.Y] - test byte[shi+2],0x01 + test [chr],KM_SHIFT jnz @f m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] @@: diff --git a/programs/develop/tinypad/trunk/tp-tbox.asm b/programs/develop/tinypad/trunk/tp-tbox.asm index 5a8c12f71d..4bca368d96 100644 --- a/programs/develop/tinypad/trunk/tp-tbox.asm +++ b/programs/develop/tinypad/trunk/tp-tbox.asm @@ -211,12 +211,12 @@ proc textbox.key cmp byte[esi],0 jne .acc - test byte[shi+2],0x06 + test [chr],KM_CTRLALT jnz .exit cmp [tbox.length],255 je .exit - movzx eax,[chr] + movzx eax,byte[chr] movzx eax,[eax+key0] or al,al jz .exit