From 070569f1e106b212299dcddea08c75c234d110aa Mon Sep 17 00:00:00 2001 From: Serhii Sakhno Date: Mon, 10 Aug 2015 07:55:50 +0000 Subject: [PATCH] use scancode in appearance, pixie, Calypte git-svn-id: svn://kolibrios.org@5705 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/Calypte/Calypte.c | 51 ++++++++++++++++++---------- programs/cmm/appearance/appearance.c | 20 +++++++---- programs/cmm/pixie/pixie.c | 26 ++++++++------ 3 files changed, 62 insertions(+), 35 deletions(-) diff --git a/programs/cmm/Calypte/Calypte.c b/programs/cmm/Calypte/Calypte.c index 64953f8705..53c470f4df 100644 --- a/programs/cmm/Calypte/Calypte.c +++ b/programs/cmm/Calypte/Calypte.c @@ -62,7 +62,7 @@ struct menu_text_struct #define WIN_W 600 #define WIN_H 400 -#define TITLE "Calypte v0.12" +#define TITLE "Calypte v0.13" char win_title[4096] = TITLE; proc_info Form; @@ -111,7 +111,9 @@ menu_data menudata1 = {0, 40, 2, 15, 2, #menu_text_area1.menu, #menu_text_area1. void main() { - int id, key; + int id; + word key_ascii, key_scancode; + dword status_key; strcpy(#filter2.ext1, "TXT"); //strcpy(#filter2.ext2, "ASM"); @@ -153,6 +155,7 @@ void main() break; case 2: read = 0; + tview.current = 0; strcpy(#win_title, TITLE); FreeBuf(); draw_window(); @@ -182,28 +185,40 @@ void main() case evKey: if (Form.status_window>2) break; - key = GetKey(); - switch (key) + GetFullKey(); + key_ascii = AH; + $shr eax,16 + key_scancode = AL; + status_key = GetStatusKey(); + if (tview.ProcessKey(key_scancode)) DrawText(); + if (TestBit(status_key, 2)) { - case 015: //Ctrl+O - OpenDialog_start stdcall (#o_dialog); - OpenFile(#openfile_path); - Prepare(); - draw_window(); - break; - case ASCII_KEY_HOME: - case ASCII_KEY_END: - case ASCII_KEY_UP: - case ASCII_KEY_DOWN: - if (tview.ProcessKey(key)) DrawText(); - break; - case ASCII_KEY_PGUP: + switch(key_scancode) + { + case 024: //Ctrl+O + OpenDialog_start stdcall (#o_dialog); + OpenFile(#openfile_path); + Prepare(); + draw_window(); + break; + } + break; + } + switch (key_scancode) + { + /*case SCAN_CODE_HOME: + case SCAN_CODE_END: + case SCAN_CODE_UP: + case SCAN_CODE_DOWN: + if (tview.ProcessKey(key_scancode)) DrawText(); + break;*/ + case SCAN_CODE_PGUP: if (!tview.current) break; if (tview.currenttview.count) break; tview.current = tview.current+tview.visible; DrawText(); diff --git a/programs/cmm/appearance/appearance.c b/programs/cmm/appearance/appearance.c index 0646c2b542..bb8237e420 100644 --- a/programs/cmm/appearance/appearance.c +++ b/programs/cmm/appearance/appearance.c @@ -145,7 +145,9 @@ OpenFile() void main() { - int id, key, mouse_clicked; + int id, mouse_clicked; + word key_ascii, key_scancode; + dword status_key; SetEventMask(0x27); load_dll(boxlib, #box_lib_init,0); @@ -193,12 +195,16 @@ void main() break; case evKey: - key = GetKey(); - if (list[SKINS].active) && (list[SKINS].ProcessKey(key)) Apply(); - if (list[WALLPAPERS].active) && (list[WALLPAPERS].ProcessKey(key)) Apply(); - IF (key==013) OpenFile(); - if (key==9) if (list[SKINS].active) TabClick(WALLPAPERS); else TabClick(SKINS); - IF (key==182) //Del + GetFullKey(); + key_ascii = AH; + $shr eax,16 + key_scancode = AL; + status_key = GetStatusKey(); + if (list[SKINS].active) && (list[SKINS].ProcessKey(key_scancode)) Apply(); + if (list[WALLPAPERS].active) && (list[WALLPAPERS].ProcessKey(key_scancode)) Apply(); + IF (key_scancode==SCAN_CODE_ENTER) OpenFile(); + if (key_scancode==SCAN_CODE_TAB) if (list[SKINS].active) TabClick(WALLPAPERS); else TabClick(SKINS); + IF (key_scancode==SCAN_CODE_TAB) //Del { DeleteFile(#cur_file_path); Open_Dir(); diff --git a/programs/cmm/pixie/pixie.c b/programs/cmm/pixie/pixie.c index 12f6fd23b7..02d197321c 100644 --- a/programs/cmm/pixie/pixie.c +++ b/programs/cmm/pixie/pixie.c @@ -73,7 +73,9 @@ char work_folder[4096], void main() { - int id, key; + int id; + word key_ascii, key_scancode; + byte mouse_clicked; dword tmp_x,tmp_y; dword z1,z2; @@ -229,19 +231,23 @@ void main() break; case evKey: - key = GetKey(); - if (key==50) SetColorThemeLight(); - if (key==51) SetColorThemeDark(); - if (key==ASCII_KEY_LEFT) RunProgram("@VOLUME", "-"); - if (key==ASCII_KEY_RIGHT) RunProgram("@VOLUME", "+"); - if (key=='m') RunProgram("@VOLUME", "m"); - if (key==ASCII_KEY_ENTER) StartPlayingMp3(); - if (key=='p') || (key==ASCII_KEY_SPACE) + GetFullKey(); + key_ascii = AH; + $shr eax,16 + key_scancode = AL; + + if (key_scancode==003) SetColorThemeLight(); + if (key_scancode==004) SetColorThemeDark(); + if (key_scancode==SCAN_CODE_LEFT) RunProgram("@VOLUME", "-"); + if (key_scancode==SCAN_CODE_RIGHT) RunProgram("@VOLUME", "+"); + if (key_scancode==050) RunProgram("@VOLUME", "m"); + if (key_scancode==SCAN_CODE_ENTER) StartPlayingMp3(); + if (key_scancode==025) || (key_scancode==SCAN_CODE_SPACE) { if (playback_mode == PLAYBACK_MODE_PLAYING) StopPlayingMp3(); else StartPlayingMp3(); } - if (list.ProcessKey(key)) DrawPlayList(); + if (list.ProcessKey(key_scancode)) DrawPlayList(); break; case evReDraw: