From c65a0e6a0a84cccebc64704fbbe8bc48ca4ad57c Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Mon, 31 Oct 2016 11:27:15 +0000 Subject: [PATCH] CMM: ability to use Ctrl+C/Ctrl+V in EditBox. Fix Dicty, TmpDisk. TmpDisk switch from ASCII to SCANCODE, better process keys for case when EditBox is active and inactive. git-svn-id: svn://kolibrios.org@6640 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/dicty/dicty.c | 3 +- programs/cmm/lib/keyboard.h | 5 +-- programs/cmm/tmpdisk/t_gui.c | 67 +++++++++++++++++++++++------------- 3 files changed, 47 insertions(+), 28 deletions(-) diff --git a/programs/cmm/dicty/dicty.c b/programs/cmm/dicty/dicty.c index 52d2e9a27b..c52c4a91d9 100644 --- a/programs/cmm/dicty/dicty.c +++ b/programs/cmm/dicty/dicty.c @@ -68,8 +68,7 @@ void main() break; case evKey: - GetKeys(); - EAX=key_ascii<<8; + GetKeys(); edit_box_key stdcall(#edit1); Translate(); break; diff --git a/programs/cmm/lib/keyboard.h b/programs/cmm/lib/keyboard.h index 6b1bb6a51d..4ecbe18647 100644 --- a/programs/cmm/lib/keyboard.h +++ b/programs/cmm/lib/keyboard.h @@ -70,9 +70,8 @@ GETKEYII: $shr eax,8 } - unsigned char key_ascii; -dword key_scancode, key_modifier; +dword key_scancode, key_modifier, key_editbox; int GetKeys() { $push edx @@ -88,6 +87,7 @@ GETKEYI: $jmp GETKEY GETKEYII: $pop edx + key_editbox = EAX; key_ascii = AH; $shr eax,16 key_scancode = AL; @@ -96,6 +96,7 @@ GETKEYII: $mov ebx,3 $int 0x40 key_modifier = EAX; + EAX = key_editbox; } #endif \ No newline at end of file diff --git a/programs/cmm/tmpdisk/t_gui.c b/programs/cmm/tmpdisk/t_gui.c index c9c1e8aa95..3132e29b39 100644 --- a/programs/cmm/tmpdisk/t_gui.c +++ b/programs/cmm/tmpdisk/t_gui.c @@ -55,7 +55,7 @@ edit_box edit_disk_size= {50,0,7,0xffffff,0x94AECE,0xFFFfff,0xffffff,0,4,#new_di void Main_Window() { - word id, key; + word id; int i, x; mem_Init(); @@ -85,51 +85,66 @@ void Main_Window() } break; case evKey: - key = GetKey(); - switch(key) + GetKeys(); + // PROCESS KEYS WHEN EDIT BOX INACTIVE + if ( !asm test edit_disk_size.flags, 2) switch(key_scancode) { - case 9: - if ( !asm test edit_disk_size.flags, 2) edit_disk_size.flags=1000000000000010b; - else edit_disk_size.flags=1000000000000000b; + case SCAN_CODE_TAB: + edit_disk_size.flags=1000000000000010b; edit_box_draw stdcall (#edit_disk_size); + DrawTmpDisks(); break; - case 185: - AddDisk(); - break; - case 182: - if (disk_num<>0) DelDisk(); - break; - case 13: - if ( !asm test edit_disk_size.flags, 2) OpenTmpDisk(); - else AddDisk(); - break; - case 178: + case SCAN_CODE_UP: if (selected==0) break; selected--; DrawTmpDisks(); break; - case 177: + case SCAN_CODE_DOWN: if (selected+2>disk_num) break; selected++; DrawTmpDisks(); break; - case 176: + case SCAN_CODE_LEFT: if (selected<3) break; selected-=3; DrawTmpDisks(); break; - case 179: + case SCAN_CODE_RIGHT: if (selected+4>disk_num) break; selected+=3; DrawTmpDisks(); + break; + case SCAN_CODE_INS: + AddDisk(); + break; + case SCAN_CODE_DEL: + if (disk_num<>0) DelDisk(); + break; + case SCAN_CODE_ENTER: + OpenTmpDisk(); + break; + } + // PROCESS KEYS WHEN EDIT BOX ACTIVE + else switch(key_scancode) + { + case SCAN_CODE_TAB: + edit_disk_size.flags=1000000000000000b; + edit_box_draw stdcall (#edit_disk_size); + DrawTmpDisks(); + break; + case SCAN_CODE_ENTER: + case SCAN_CODE_INS: + AddDisk(); + break; + default: + EAX = key_editbox; + edit_box_key stdcall(#edit_disk_size); break; } - EAX=key<<8; - edit_box_key stdcall(#edit_disk_size); break; case evReDraw: system.color.get(); - DefineAndDrawWindow(170,150,314,270,0x74,system.color.work,"Virtual Disk Manager 0.62",0); + DefineAndDrawWindow(170,150,314,270,0x74,system.color.work,"Virtual Disk Manager 0.65",0); GetProcessInfo(#Form, SelfInfo); if (Form.status_window>2) break; @@ -202,6 +217,9 @@ unsigned int disk_pos_y[]={60,95,130, 60, 95, 130, 60, 95,130, 60, 85,130}; void DrawTmpDisks() { + dword selection_color; + dword selection_active = 0x0080FF; + dword selection_inactive = 0x757489; char free_ram_text[60]; byte i, real_id; int FreeRAM=GetFreeRAM()/1024; @@ -230,7 +248,8 @@ void DrawTmpDisks() WriteText(disk_pos_x[i]+25,disk_pos_y[i]+19, 0x80, 0x888888, ConvertSize(disk_sizes[real_id])); _PutImage(disk_pos_x[i]+5,disk_pos_y[i]+4, 14,14, 2*14*14*3+#icons); if (selected==i) { - DrawWideRectangle(disk_pos_x[i], disk_pos_y[i], 65, 30, 2, 0x0080FF); + if ( !asm test edit_disk_size.flags, 2) selection_color = selection_active; else selection_color = selection_inactive; + DrawWideRectangle(disk_pos_x[i], disk_pos_y[i], 65, 30, 2, selection_color); PutPixel(disk_pos_x[i], disk_pos_y[i], 0xFFFfff); } }